]> granicus.if.org Git - libvpx/commitdiff
Fix bug which skips zeromv even if near/nearest is not 0,0.
authorRonald S. Bultje <rbultje@google.com>
Thu, 18 Jul 2013 16:34:59 +0000 (09:34 -0700)
committerRonald S. Bultje <rbultje@google.com>
Thu, 18 Jul 2013 16:35:19 +0000 (09:35 -0700)
Change-Id: Id4f454831f3f11099f39c30246adeaa52857d08d

vp9/encoder/vp9_rdopt.c

index 7f5f0de8c2f777fb4a87e8197f31466645c4bf99..91a6436ba6a6d7056578ebd777b4d38bd97bc437 100644 (file)
@@ -1875,15 +1875,28 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
           int c3 = cost_mv_ref(cpi, ZEROMV, rfc);
 
           if (this_mode == NEARMV) {
-            if (c1 >= c2 || c1 > c3)
+            if (c1 > c3)
               continue;
           } else if (this_mode == NEARESTMV) {
-            if (c2 > c1 || c2 > c3)
+            if (c2 > c3)
               continue;
           } else {
             assert(this_mode == ZEROMV);
-            if (c3 >= c2 || c3 >= c1)
-              continue;
+            if (mbmi->ref_frame[1] <= 0) {
+              if ((c3 >= c2 &&
+                   frame_mv[NEARESTMV][mbmi->ref_frame[0]].as_int == 0) ||
+                  (c3 >= c1 &&
+                   frame_mv[NEARMV][mbmi->ref_frame[0]].as_int == 0))
+                continue;
+            } else {
+              if ((c3 >= c2 &&
+                   frame_mv[NEARESTMV][mbmi->ref_frame[0]].as_int == 0 &&
+                   frame_mv[NEARESTMV][mbmi->ref_frame[1]].as_int == 0) ||
+                  (c3 >= c1 &&
+                   frame_mv[NEARMV][mbmi->ref_frame[0]].as_int == 0 &&
+                   frame_mv[NEARMV][mbmi->ref_frame[1]].as_int == 0))
+                continue;
+            }
           }
         }
 
@@ -2723,15 +2736,28 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
     int c3 = cost_mv_ref(cpi, ZEROMV, rfc);
 
     if (this_mode == NEARMV) {
-      if (c1 >= c2 || c1 > c3)
+      if (c1 > c3)
         return INT64_MAX;
     } else if (this_mode == NEARESTMV) {
-      if (c2 > c1 || c2 > c3)
+      if (c2 > c3)
         return INT64_MAX;
     } else {
       assert(this_mode == ZEROMV);
-      if (c3 >= c2 || c3 >= c1)
-        return INT64_MAX;
+      if (num_refs == 1) {
+        if ((c3 >= c2 &&
+             mode_mv[NEARESTMV][mbmi->ref_frame[0]].as_int == 0) ||
+            (c3 >= c1 &&
+             mode_mv[NEARMV][mbmi->ref_frame[0]].as_int == 0))
+          return INT64_MAX;
+      } else {
+        if ((c3 >= c2 &&
+             mode_mv[NEARESTMV][mbmi->ref_frame[0]].as_int == 0 &&
+             mode_mv[NEARESTMV][mbmi->ref_frame[1]].as_int == 0) ||
+            (c3 >= c1 &&
+             mode_mv[NEARMV][mbmi->ref_frame[0]].as_int == 0 &&
+             mode_mv[NEARMV][mbmi->ref_frame[1]].as_int == 0))
+          return INT64_MAX;
+      }
     }
   }