From 922bc38d55995536e84db1b704fdccc140870d26 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 26 Aug 2003 07:42:25 +0000 Subject: [PATCH] mpeg2 regression test add mpeg2video_decoder, thats more consistant with the encoders, note, both mpeg1video and mpeg2video decoder will happily decode both mpeg1 and 2 Originally committed as revision 2166 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/allcodecs.c | 3 ++- libavcodec/avcodec.h | 3 ++- libavcodec/mpeg12.c | 17 +++++++++++++++-- tests/ffmpeg.regression.ref | 3 +++ tests/regression.sh | 11 +++++++++-- tests/rotozoom.regression.ref | 3 +++ 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index f6695303cf..bd544f7d92 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -96,7 +96,8 @@ void avcodec_register_all(void) register_avcodec(&mpeg4aac_decoder); #endif #endif - register_avcodec(&mpeg_decoder); + register_avcodec(&mpeg1video_decoder); + register_avcodec(&mpeg2video_decoder); #ifdef HAVE_XVMC register_avcodec(&mpeg_xvmc_decoder); #endif diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 5a158096d2..febb80b23b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1309,7 +1309,8 @@ extern AVCodec msmpeg4v2_decoder; extern AVCodec msmpeg4v3_decoder; extern AVCodec wmv1_decoder; extern AVCodec wmv2_decoder; -extern AVCodec mpeg_decoder; +extern AVCodec mpeg1video_decoder; +extern AVCodec mpeg2video_decoder; extern AVCodec mpeg_xvmc_decoder; extern AVCodec h263i_decoder; extern AVCodec flv_decoder; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index a2a1bbd7ac..d65ad86f21 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -2496,8 +2496,8 @@ static int mpeg_decode_end(AVCodecContext *avctx) return 0; } -AVCodec mpeg_decoder = { - "mpegvideo", +AVCodec mpeg1video_decoder = { + "mpeg1video", CODEC_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, sizeof(Mpeg1Context), @@ -2509,6 +2509,19 @@ AVCodec mpeg_decoder = { .flush= ff_mpeg_flush, }; +AVCodec mpeg2video_decoder = { + "mpeg2video", + CODEC_TYPE_VIDEO, + CODEC_ID_MPEG2VIDEO, + sizeof(Mpeg1Context), + mpeg_decode_init, + NULL, + mpeg_decode_end, + mpeg_decode_frame, + CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, + .flush= ff_mpeg_flush, +}; + #ifdef HAVE_XVMC static int mpeg_mc_decode_init(AVCodecContext *avctx){ Mpeg1Context *s; diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index a20dcf3727..8d7caa53b0 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -2,6 +2,9 @@ ffmpeg regression test dda0ba041aef50a5101884291c06d4d9 *./data/a-mpeg1.mpg 6713259d72260740bbddaea30631ea18 *./data/out.yuv stddev: 7.58 bytes:7299072 +17c66261cb5dc193793b5af9564c8592 *./data/a-mpeg2.vob +9f5d85c6473b802a9d86cfc01a3ed046 *./data/out.yuv +stddev: 7.66 bytes:7450624 d0dc46dd831398237a690ebbeff18b64 *./data/a-msmpeg4v2.avi 712aa6c959d1d90a78fe98657cbff19c *./data/out.yuv stddev: 8.11 bytes:7602176 diff --git a/tests/regression.sh b/tests/regression.sh index 72ae9d0a9a..397bdc89a8 100755 --- a/tests/regression.sh +++ b/tests/regression.sh @@ -32,6 +32,7 @@ elif [ "$1" = "libavtest" ] ; then outfile="$datadir/b-" else do_mpeg=y + do_mpeg2=y do_msmpeg4v2=y do_msmpeg4=y do_wmv1=y @@ -121,10 +122,16 @@ do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file # mpeg1 decoding do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst +fi + +################################### +if [ -n "$do_mpeg2" ] ; then +# mpeg2 encoding +file=${outfile}mpeg2.vob +do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video $file # mpeg2 decoding -#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \ -# -f rawvideo /tmp/out-mpeg2.yuv +do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst fi ################################### diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index e1e264537f..4d38d0e932 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -2,6 +2,9 @@ ffmpeg regression test 1738d12380be0d8aa20d08e178349299 *./data/a-mpeg1.mpg 0cf790edd0f4c5cf993c2d59211b9de2 *./data/out.yuv stddev: 4.91 bytes:7299072 +55cedcf0fb67e18718d6ed88da7784a4 *./data/a-mpeg2.vob +f5436b327c38b66eb95f3428aff790f1 *./data/out.yuv +stddev: 4.94 bytes:7450624 14db391f167b52b21a983157b410affc *./data/a-msmpeg4v2.avi fc8881e0904af9491d5fa0163183954b *./data/out.yuv stddev: 5.29 bytes:7602176