DIRECTBIT was decoded before the intra/inter MB branching when decoding
interlace frame B pictures. Resulting in mistakenly also decoding it for intra
MBs where this syntax element is not present.

Signed-off-by: Jerome Borsboom <jerome.borsb...@carpalis.nl>
---
 libavcodec/vc1_block.c | 71 +++++++++++++++++++++++++-------------------------
 1 file changed, 36 insertions(+), 35 deletions(-)

diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
index aa2ea5024e..74935ec9e9 100644
--- a/libavcodec/vc1_block.c
+++ b/libavcodec/vc1_block.c
@@ -2173,41 +2173,6 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
         }
     }
 
-    if (v->dmb_is_raw)
-        direct = get_bits1(gb);
-    else
-        direct = v->direct_mb_plane[mb_pos];
-
-    if (direct) {
-        if (s->next_picture_ptr->field_picture)
-            av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode 
not supported\n");
-        s->mv[0][0][0] = 
s->current_picture.motion_val[0][s->block_index[0]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, 
s->quarter_sample);
-        s->mv[0][0][1] = 
s->current_picture.motion_val[0][s->block_index[0]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, 
s->quarter_sample);
-        s->mv[1][0][0] = 
s->current_picture.motion_val[1][s->block_index[0]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, 
s->quarter_sample);
-        s->mv[1][0][1] = 
s->current_picture.motion_val[1][s->block_index[0]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, 
s->quarter_sample);
-
-        if (twomv) {
-            s->mv[0][2][0] = 
s->current_picture.motion_val[0][s->block_index[2]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, 
s->quarter_sample);
-            s->mv[0][2][1] = 
s->current_picture.motion_val[0][s->block_index[2]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, 
s->quarter_sample);
-            s->mv[1][2][0] = 
s->current_picture.motion_val[1][s->block_index[2]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, 
s->quarter_sample);
-            s->mv[1][2][1] = 
s->current_picture.motion_val[1][s->block_index[2]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, 
s->quarter_sample);
-
-            for (i = 1; i < 4; i += 2) {
-                s->mv[0][i][0] = 
s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0];
-                s->mv[0][i][1] = 
s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1];
-                s->mv[1][i][0] = 
s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0];
-                s->mv[1][i][1] = 
s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1];
-            }
-        } else {
-            for (i = 1; i < 4; i++) {
-                s->mv[0][i][0] = 
s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0];
-                s->mv[0][i][1] = 
s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1];
-                s->mv[1][i][0] = 
s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0];
-                s->mv[1][i][1] = 
s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1];
-            }
-        }
-    }
-
     if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // 
intra MB
         for (i = 0; i < 4; i++) {
             s->mv[0][i][0] = 
s->current_picture.motion_val[0][s->block_index[i]][0] = 0;
@@ -2258,6 +2223,42 @@ static int vc1_decode_b_mb_intfr(VC1Context *v)
         }
     } else {
         s->mb_intra = v->is_intra[s->mb_x] = 0;
+
+        if (v->dmb_is_raw)
+            direct = get_bits1(gb);
+        else
+            direct = v->direct_mb_plane[mb_pos];
+
+        if (direct) {
+            if (s->next_picture_ptr->field_picture)
+                av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct 
mode not supported\n");
+            s->mv[0][0][0] = 
s->current_picture.motion_val[0][s->block_index[0]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, 
s->quarter_sample);
+            s->mv[0][0][1] = 
s->current_picture.motion_val[0][s->block_index[0]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, 
s->quarter_sample);
+            s->mv[1][0][0] = 
s->current_picture.motion_val[1][s->block_index[0]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, 
s->quarter_sample);
+            s->mv[1][0][1] = 
s->current_picture.motion_val[1][s->block_index[0]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, 
s->quarter_sample);
+
+            if (twomv) {
+                s->mv[0][2][0] = 
s->current_picture.motion_val[0][s->block_index[2]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, 
s->quarter_sample);
+                s->mv[0][2][1] = 
s->current_picture.motion_val[0][s->block_index[2]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, 
s->quarter_sample);
+                s->mv[1][2][0] = 
s->current_picture.motion_val[1][s->block_index[2]][0] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, 
s->quarter_sample);
+                s->mv[1][2][1] = 
s->current_picture.motion_val[1][s->block_index[2]][1] = 
scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, 
s->quarter_sample);
+
+                for (i = 1; i < 4; i += 2) {
+                    s->mv[0][i][0] = 
s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0];
+                    s->mv[0][i][1] = 
s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1];
+                    s->mv[1][i][0] = 
s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0];
+                    s->mv[1][i][1] = 
s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1];
+                }
+            } else {
+                for (i = 1; i < 4; i++) {
+                    s->mv[0][i][0] = 
s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0];
+                    s->mv[0][i][1] = 
s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1];
+                    s->mv[1][i][0] = 
s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0];
+                    s->mv[1][i][1] = 
s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1];
+                }
+            }
+        }
+
         if (!direct) {
             if (skipped || !s->mb_intra) {
                 bmvtype = decode012(gb);
-- 
2.13.6


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to