[FFmpeg-cvslog] vc1: re-initialize tables after width/height change.

John Stebbins git at videolan.org
Wed Jun 8 05:31:35 CEST 2011


ffmpeg | branch: master | John Stebbins <stebbins at jetheaddev.com> | Tue Jun  7 19:53:31 2011 +0200| [7b20d35a543c6635c348f3b312b5fa24137c0f95] | committer: Anton Khirnov

vc1: re-initialize tables after width/height change.

read_sequence_header can change width/height; therefore, re-initialize
all tables if width/height changed

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b20d35a543c6635c348f3b312b5fa24137c0f95
---

 libavcodec/vc1dec.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 5c931b1..186610e 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -3398,7 +3398,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     VC1Context *v = avctx->priv_data;
     MpegEncContext *s = &v->s;
     GetBitContext gb;
-    int i;
+    int i, cur_width, cur_height;
 
     if (!avctx->extradata_size || !avctx->extradata) return -1;
     if (!(avctx->flags & CODEC_FLAG_GRAY))
@@ -3419,8 +3419,8 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
     if (vc1_init_common(v) < 0) return -1;
     ff_vc1dsp_init(&v->vc1dsp);
 
-    avctx->coded_width = avctx->width;
-    avctx->coded_height = avctx->height;
+    cur_width = avctx->coded_width = avctx->width;
+    cur_height = avctx->coded_height = avctx->height;
     if (avctx->codec_id == CODEC_ID_WMV3)
     {
         int count = 0;
@@ -3491,6 +3491,19 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
         }
         v->res_sprite = (avctx->codec_tag == MKTAG('W','V','P','2'));
     }
+    // Sequence header information may not have been parsed
+    // yet when ff_msmpeg4_decode_init was called the fist time
+    // above.  If sequence information changes, we need to call
+    // it again.
+    if (cur_width != avctx->width ||
+        cur_height != avctx->height) {
+        MPV_common_end(s);
+        if(ff_msmpeg4_decode_init(avctx) < 0)
+            return -1;
+        avctx->coded_width = avctx->width;
+        avctx->coded_height = avctx->height;
+    }
+
     avctx->profile = v->profile;
     if (v->profile == PROFILE_ADVANCED)
         avctx->level = v->level;



More information about the ffmpeg-cvslog mailing list