vc1dec: Set opposite to the correct value for 1REF field pictures
authorMashiat Sarker Shakkhar <mashiat.sarker@gmail.com>
Tue, 9 Oct 2012 19:38:18 +0000 (19:38 +0000)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Wed, 10 Oct 2012 18:55:38 +0000 (14:55 -0400)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/vc1dec.c

index 491e200..40164cc 100644 (file)
@@ -1458,10 +1458,16 @@ static inline void vc1_pred_mv(VC1Context *v, int n, int dmv_x, int dmv_y,
     }
 
     if (v->field_mode) {
-        if (num_samefield <= num_oppfield)
-            opposite = 1 - pred_flag;
-        else
-            opposite = pred_flag;
+        if (!v->numref)
+            // REFFIELD determines if the last field or the second-last field is
+            // to be used as reference
+            opposite = 1 - v->reffield;
+        else {
+            if (num_samefield <= num_oppfield)
+                opposite = 1 - pred_flag;
+            else
+                opposite = pred_flag;
+        }
     } else
         opposite = 0;
     if (opposite) {