From cba322d76d4a00b659d7de030018d6003820c715 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 26 Sep 2010 13:56:50 +0000 Subject: Make WMV3 decoder attempt to decode WMVP as well Originally committed as revision 25209 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 2 +- libavcodec/vc1.c | 22 +++++++++++++++++++--- libavcodec/vc1dec.c | 5 +++++ libavformat/riff.c | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 24e9077521..45609d0585 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -32,7 +32,7 @@ #define LIBAVCODEC_VERSION_MAJOR 52 #define LIBAVCODEC_VERSION_MINOR 90 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index d9d7d515ae..86904cbffd 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -315,8 +315,7 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte return -1; } if (v->res_sprite) { - av_log(avctx, AV_LOG_ERROR, "WMVP is not supported\n"); - return -1; + av_log(avctx, AV_LOG_ERROR, "WMVP is not fully supported\n"); } } @@ -387,7 +386,21 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte v->quantizer_mode = get_bits(gb, 2); //common v->finterpflag = get_bits1(gb); //common - v->res_rtm_flag = get_bits1(gb); //reserved + + if (v->res_sprite) { + v->s.avctx->width = v->s.avctx->coded_width = get_bits(gb, 11); + v->s.avctx->height = v->s.avctx->coded_height = get_bits(gb, 11); + skip_bits(gb, 5); //frame rate + v->res_x8 = get_bits1(gb); + if (get_bits1(gb)) { // something to do with DC VLC selection + av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n"); + return -1; + } + skip_bits(gb, 3); //slice code + v->res_rtm_flag = 0; + } else { + v->res_rtm_flag = get_bits1(gb); //reserved + } if (!v->res_rtm_flag) { // av_log(avctx, AV_LOG_ERROR, @@ -566,6 +579,9 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; + if(v->res_sprite) { + skip_bits(gb, 2); //not yet deciphered + } if(v->finterpflag) v->interpfrm = get_bits1(gb); skip_bits(gb, 2); //framecnt unused v->rangeredfrm = 0; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 8c9cbcd9db..c9a547b615 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3240,6 +3240,11 @@ static int vc1_decode_frame(AVCodecContext *avctx, } } + if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){ + av_free(buf2); + return -1; + } + // for hurry_up==5 s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; diff --git a/libavformat/riff.c b/libavformat/riff.c index 24d0cce975..55418514bf 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -227,6 +227,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') }, { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') }, { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') }, + { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', 'P') }, { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') }, { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') }, { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') }, -- cgit v1.2.3