]> git.sesse.net Git - ffmpeg/commitdiff
vp9: fix mvref finding to adhere to bug in libvpx.
authorRonald S. Bultje <rsbultje@gmail.com>
Sun, 19 Jan 2014 18:04:58 +0000 (19:04 +0100)
committerAnton Khirnov <anton@khirnov.net>
Fri, 24 Jan 2014 06:02:56 +0000 (07:02 +0100)
Fixes a particular youtube video that I unfortunately can't share.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/vp9mvs.c

index 2f37755046a4a4a31e96b32b68daa5681665659d..1f65aaac0ac98d66004043c8bc1cf204e0beef24 100644 (file)
@@ -191,9 +191,13 @@ static void find_ref_mvs(VP9Context *s,
             if (mv->ref[0] != ref && mv->ref[0] >= 0)
                 RETURN_SCALE_MV(mv->mv[0],
                                 s->signbias[mv->ref[0]] != s->signbias[ref]);
-            if (mv->ref[1] != ref && mv->ref[1] >= 0)
+            if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
+                // BUG - libvpx has this condition regardless of whether
+                // we used the first ref MV and pre-scaling
+                AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
                 RETURN_SCALE_MV(mv->mv[1],
                                 s->signbias[mv->ref[1]] != s->signbias[ref]);
+            }
         }
     }
 
@@ -204,9 +208,13 @@ static void find_ref_mvs(VP9Context *s,
         if (mv->ref[0] != ref && mv->ref[0] >= 0)
             RETURN_SCALE_MV(mv->mv[0],
                             s->signbias[mv->ref[0]] != s->signbias[ref]);
-        if (mv->ref[1] != ref && mv->ref[1] >= 0)
+        if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
+            // BUG - libvpx has this condition regardless of whether
+            // we used the first ref MV and pre-scaling
+            AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
             RETURN_SCALE_MV(mv->mv[1],
                             s->signbias[mv->ref[1]] != s->signbias[ref]);
+        }
     }
 
     AV_ZERO32(pmv);