]> granicus.if.org Git - libvpx/commitdiff
Changed to use real pixels only for evaluating MVs
authorYaowu Xu <yaowu@google.com>
Mon, 15 Oct 2012 21:30:15 +0000 (14:30 -0700)
committerYaowu Xu <yaowu@google.com>
Mon, 15 Oct 2012 21:51:14 +0000 (14:51 -0700)
The commit changed to avoid using pixels from extended border in
in evaluating and select best reference motion vector.

Change-Id: I39b758889373e42ed2889d59744388e5b9c1a20a

vp8/common/findnearmv.c

index 235ca46cead17e37cc6e7d5b019de4cec3d31a9c..285aabdb6968c138f3b8acc65c2be99bff6d5fa2 100644 (file)
@@ -217,7 +217,7 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
   unsigned char *above_ref;
   unsigned char *left_ref;
   int sad;
-  int sad_scores[MAX_MV_REFS];
+  int sad_scores[MAX_MV_REFS] = {0};
   int_mv sorted_mvs[MAX_MV_REFS];
   int zero_seen = FALSE;
 
@@ -259,12 +259,13 @@ void vp8_find_best_ref_mvs(MACROBLOCKD *xd,
       ((this_mv.as_mv.col + 3) >> 3):((this_mv.as_mv.col + 4) >> 3);
     offset = ref_y_stride * row_offset + col_offset;
 
-    sad = vp8_sad16x3_c(above_src, xd->dst.y_stride,
-                        above_ref + offset, ref_y_stride, INT_MAX);
-
-    sad += vp8_sad3x16_c(left_src, xd->dst.y_stride,
-                         left_ref + offset, ref_y_stride, INT_MAX);
-
+    sad = 0;
+    if (xd->up_available)
+      sad += vp8_sad16x3_c(above_src, xd->dst.y_stride,
+                           above_ref + offset, ref_y_stride, INT_MAX);
+    if (xd->left_available)
+      sad += vp8_sad3x16_c(left_src, xd->dst.y_stride,
+                           left_ref + offset, ref_y_stride, INT_MAX);
     // Add the entry to our list and then resort the list on score.
     sad_scores[i] = sad;
     sorted_mvs[i].as_int = this_mv.as_int;