vc1: don't read the interpfrm and bfraction elements for interlaced frames
authorHendrik Leppkes <h.leppkes@gmail.com>
Fri, 13 Jan 2012 17:41:21 +0000 (18:41 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 23 Jan 2012 18:04:14 +0000 (19:04 +0100)
This matches the spec as well as the reference decoder, and fixes a bug
with interlaced frame decoding.

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
libavcodec/vc1.c

index d728f9b..0a70062 100644 (file)
@@ -911,13 +911,15 @@ int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
         }
         goto parse_common_info;
     }
-    if (v->finterpflag)
-        v->interpfrm = get_bits1(gb);
-    if (v->s.pict_type == AV_PICTURE_TYPE_B) {
-        v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
-        v->bfraction           = ff_vc1_bfraction_lut[v->bfraction_lut_index];
-        if (v->bfraction == 0) {
-            v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
+    if (v->fcm == PROGRESSIVE) {
+        if (v->finterpflag)
+            v->interpfrm = get_bits1(gb);
+        if (v->s.pict_type == AV_PICTURE_TYPE_B) {
+            v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
+            v->bfraction           = ff_vc1_bfraction_lut[v->bfraction_lut_index];
+            if (v->bfraction == 0) {
+                v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
+            }
         }
     }