[FFmpeg-cvslog] vc1dec: fix handling of max_coded dimensions

Michael Niedermayer git at videolan.org
Tue Jul 31 03:16:00 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jul 31 03:00:35 2012 +0200| [3b5ba60aa76cb2701521aed546b3a3b174960bc4] | committer: Michael Niedermayer

vc1dec: fix handling of max_coded dimensions

Fixes Ticket1502

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/vc1.c |   16 +++++++++-------
 libavcodec/vc1.h |    1 +
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index d2bcc6a..955dfa7 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -418,7 +418,6 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo
 
 static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
 {
-    int w, h;
     v->res_rtm_flag = 1;
     v->level = get_bits(gb, 3);
     if (v->level >= 5) {
@@ -437,9 +436,8 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
     v->bitrtq_postproc       = get_bits(gb, 5); //common
     v->postprocflag          = get_bits1(gb);   //common
 
-    w = (get_bits(gb, 12) + 1) << 1;
-    h = (get_bits(gb, 12) + 1) << 1;
-    avcodec_set_dimensions(v->s.avctx, w, h);
+    v->max_coded_width       = (get_bits(gb, 12) + 1) << 1;
+    v->max_coded_height      = (get_bits(gb, 12) + 1) << 1;
     v->broadcast             = get_bits1(gb);
     v->interlace             = get_bits1(gb);
     v->tfcntrflag            = get_bits1(gb);
@@ -528,6 +526,7 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
 int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
 {
     int i;
+    int w,h;
 
     av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32));
     v->broken_link    = get_bits1(gb);
@@ -551,10 +550,13 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex
     }
 
     if(get_bits1(gb)){
-        int w = (get_bits(gb, 12)+1)<<1;
-        int h = (get_bits(gb, 12)+1)<<1;
-        avcodec_set_dimensions(avctx, w, h);
+        w = (get_bits(gb, 12)+1)<<1;
+        h = (get_bits(gb, 12)+1)<<1;
+    } else {
+        w = v->max_coded_width;
+        h = v->max_coded_height;
     }
+    avcodec_set_dimensions(avctx, w, h);
     if (v->extended_mv)
         v->extended_dmv = get_bits1(gb);
     if ((v->range_mapy_flag = get_bits1(gb))) {
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 0c9032f..5a8a84c 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -225,6 +225,7 @@ typedef struct VC1Context{
     int profile;          ///< 2bits, Profile
     int frmrtq_postproc;  ///< 3bits,
     int bitrtq_postproc;  ///< 5bits, quantized framerate-based postprocessing strength
+    int max_coded_width, max_coded_height;
     int fastuvmc;         ///< Rounding of qpel vector to hpel ? (not in Simple)
     int extended_mv;      ///< Ext MV in P/B (not in Simple)
     int dquant;           ///< How qscale varies with MBs, 2bits (not in Simple)



More information about the ffmpeg-cvslog mailing list