diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 7b5645fd01..a19f1d3ed0 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -324,12 +324,15 @@ int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height, if (size > dest_size) return -1; - if (pf->pixel_type == FF_PIXEL_PACKED) { + if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_RGB565 || pix_fmt == PIX_FMT_RGB555) w = width * 2; + else if (pix_fmt == PIX_FMT_PAL8) + w = width; else w = width * (pf->depth * pf->nb_channels / 8); + data_planes = 1; h = height; } else { @@ -350,7 +353,10 @@ int avpicture_layout(AVPicture* src, int pix_fmt, int width, int height, s += src->linesize[i]; } } - + + if (pf->pixel_type == FF_PIXEL_PALETTE) + memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4); + return size; } diff --git a/tests/Makefile b/tests/Makefile index 2508456ac2..a94a12ec86 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -14,7 +14,7 @@ SERVER_REFFILE=$(SRC_PATH)/tests/ffserver.regression.ref LIBAV_REFFILE=$(SRC_PATH)/tests/libav.regression.ref -all: test test-server +all: test libavtest test-server test-server: vsynth1/0.pgm asynth1.sw @$(SRC_PATH)/tests/server-regression.sh $(SERVER_REFFILE) diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index a0926fcdc2..d04eaa134c 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -1,28 +1,25 @@ ffmpeg regression test -5094822b269fcbad417e22cd99e3988d *./data/a-libav.avi -./data/a-libav.avi CRC=0ddb1e18 -a409939656b9eb6e9a39712a60ec404b *./data/a-libav.asf -./data/a-libav.asf CRC=0ddb1e18 -7ee3ebfbcd0ae82f59b683ec18d09042 *./data/a-libav.rm -11c39c84b3aa4c6305fdc700f4407a66 *./data/a-libav.mpg -./data/a-libav.mpg CRC=61471a80 +55e7e5626717ced8d8709c43bd669fc1 *./data/a-libav.avi +./data/a-libav.avi CRC=665adc14 +f34176ef4f8577c93d51d7c403c8776d *./data/a-libav.asf +./data/a-libav.asf CRC=cf51c3de +59c71a1bef09beb4a4e6f203967d12de *./data/a-libav.rm +271603c17313031c17d424364f33f86f *./data/a-libav.mpg +./data/a-libav.mpg CRC=a892f96f 976a303a3f2f3c262d52b6dd5e744328 *./data/a-libav.swf ./data/a-libav.swf CRC=d813a4a6 -30bde35dc73eeb7658b93cbecb4a08f8 *./data/a-libav.ffm -./data/a-libav.ffm CRC=8a5b1654 -27dff20bbab9a65b41fffe5233eb9ac7 *./data/a-libav.mjpeg -./data/a-libav.mjpeg CRC=fd137c0e -925b133612fda60c7b95136847e78681 *./data/a-libav.pbm -./data/a-libav.pbm CRC=91ae93e8 -aff140ce80a1c86c1bf54118ad23da7b *./data/a-libav.pgm -./data/a-libav.pgm CRC=50151823 -e690ec91467990bcf31a338bc55a7281 *./data/a-libav.ppm -./data/a-libav.ppm CRC=e4799106 -268421842abae52d1f0346e07401fe0d *./data/a-libav.gif +3d0ea8f9cc0f9c4ed096381de3ab7d53 *./data/a-libav.ffm +./data/a-libav.ffm CRC=2a4bfa20 +9a9da315747599f7718cc9a9a09c21ff *./data/a-libav.pbm +./data/a-libav.pbm CRC=a1057fd1 +6ea0e1faf08f6fcdb44db4a104361b57 *./data/a-libav.pgm +./data/a-libav.pgm CRC=f4aa7c47 +0c5fe86621b7377705837f304d4ba1e9 *./data/a-libav.ppm +./data/a-libav.ppm CRC=b2bb8e92 +1cac531652ea2ff2fb141d5ae992caa8 *./data/a-libav.gif bf66705fbeee5355d8ff021d1e88fa6f *./data/a-libav.yuv4mpeg -./data/a-libav%d.pgm CRC=07f57a1a -./data/a-libav%d.ppm CRC=755c4b6a -./data/a-libav%d.jpg CRC=ed64ec39 +./data/a-libav%d.pgm CRC=84c09106 +./data/a-libav%d.ppm CRC=25c06ecf 4b7690747c49e4e8e910359768e4a77e *./data/a-libav.wav ./data/a-libav.wav CRC=2a09519c e2a6d6fae17394dfe87cb5bb8ae11837 *./data/a-libav.al @@ -31,3 +28,21 @@ e2a6d6fae17394dfe87cb5bb8ae11837 *./data/a-libav.al ./data/a-libav.ul CRC=6064b2f8 7a21ff174e3cca1702e0826c4ca0eccf *./data/a-libav.au ./data/a-libav.au CRC=2a09519c +ce356ce2708cb6033ab5d762da93cfd4 *./data/a-libav-yuv420p.yuv +ce356ce2708cb6033ab5d762da93cfd4 *./data/a-libav-yuv422p.yuv +ce356ce2708cb6033ab5d762da93cfd4 *./data/a-libav-yuv444p.yuv +ce356ce2708cb6033ab5d762da93cfd4 *./data/a-libav-yuv422.yuv +545f61c353a8b4419808785cb4f0069d *./data/a-libav-yuv410p.yuv +d6c03f930018ff859bd43f52b92e9321 *./data/a-libav-yuv411p.yuv +14117c4d7956775a7bbceabfc38da808 *./data/a-libav-yuvj420p.yuv +14117c4d7956775a7bbceabfc38da808 *./data/a-libav-yuvj422p.yuv +14117c4d7956775a7bbceabfc38da808 *./data/a-libav-yuvj444p.yuv +deb2f7ebe297df2c1fe264d19b34d2fb *./data/a-libav-rgb24.yuv +deb2f7ebe297df2c1fe264d19b34d2fb *./data/a-libav-bgr24.yuv +deb2f7ebe297df2c1fe264d19b34d2fb *./data/a-libav-rgba32.yuv +5d395f62bff8ac475f743268c772ca3a *./data/a-libav-rgb565.yuv +2ffd6871fcbfe9570454e8703ac8ea01 *./data/a-libav-rgb555.yuv +0b62dcf9b57b294dbaa5d9e99b1ee192 *./data/a-libav-gray.yuv +d5a686494c2ded1d211937ef8e22b56b *./data/a-libav-monow.yuv +d5a686494c2ded1d211937ef8e22b56b *./data/a-libav-monob.yuv +7a319375916cae4e691ecb74295e5d2a *./data/a-libav-pal8.yuv diff --git a/tests/regression.sh b/tests/regression.sh index eda779e485..64fcb94930 100755 --- a/tests/regression.sh +++ b/tests/regression.sh @@ -67,8 +67,8 @@ do_ffmpeg() { f="$1" shift - echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $* - $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ + echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* + $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true rm -f /tmp/ffmpeg$$ md5sum -b $f >> $logfile @@ -84,17 +84,20 @@ do_ffmpeg_crc() f="$1" shift echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc - $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc - echo -n "$f " >> $logfile - cat $datadir/ffmpeg.crc >> $logfile + $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1 + egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true + rm -f /tmp/ffmpeg$$ + echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile } do_ffmpeg_nocheck() { f="$1" shift - echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $* - $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp + echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* + $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$ + egrep -v "^(Stream|Press|Input|Output|frame| Stream)" /tmp/ffmpeg$$ || true + rm -f /tmp/ffmpeg$$ expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp echo `cat $datadir/bench2.tmp` $f >> $benchfile } @@ -312,9 +315,9 @@ do_ffmpeg_crc $file -i $file #################### # streamed images # mjpeg -file=${outfile}libav.mjpeg -do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file -do_ffmpeg_crc $file -i $file +#file=${outfile}libav.mjpeg +#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file +#do_ffmpeg_crc $file -i $file # pbmpipe file=${outfile}libav.pbm @@ -354,9 +357,9 @@ $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file do_ffmpeg_crc $file -i $file # jpeg (we do not do md5 on image files yet) -file=${outfile}libav%d.jpg -$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file -do_ffmpeg_crc $file -i $file +#file=${outfile}libav%d.jpg +#$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file +#do_ffmpeg_crc $file -i $file #################### # audio only @@ -381,6 +384,19 @@ file=${outfile}libav.au do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file do_ffmpeg_crc $file -i $file +#################### +# pix_fmt conversions +conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \ + yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \ + monob pal8" +for pix_fmt in $conversions ; do + file=${outfile}libav-${pix_fmt}.yuv + do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \ + -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst + do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \ + -f rawvideo -s 352x288 -pix_fmt yuv444p $file +done + fi