shithub: libvpx

Download patch

ref: 413da97bb644beb7ddfca898588ab9ae1b3426b3
parent: 6e079b7dd44f3401f6af3f8c1f061f858ce682d0
parent: 0b6440ce02fb165965da8ff6558c9c887dcd3b88
author: Dmitry Kovalev <dkovalev@google.com>
date: Wed Mar 5 08:57:23 EST 2014

Merge "Cleaning up vp9_refining_search_sadx4()."

--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -1674,7 +1674,6 @@
   const MACROBLOCKD *const xd = &x->e_mbd;
   MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
   int i, j;
-  int this_row_offset, this_col_offset;
 
   const int what_stride = x->plane[0].src.stride;
   const int in_what_stride = xd->plane[0].pre[0].stride;
@@ -1682,8 +1681,6 @@
   const uint8_t *best_address = xd->plane[0].pre[0].buf +
                           (ref_mv->row * xd->plane[0].pre[0].stride) +
                           ref_mv->col;
-  unsigned int thissad;
-  MV this_mv;
 
   const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
 
@@ -1715,8 +1712,8 @@
 
       for (j = 0; j < 4; j++) {
         if (sad_array[j] < bestsad) {
-          this_mv.row = ref_mv->row + neighbors[j].row;
-          this_mv.col = ref_mv->col + neighbors[j].col;
+          const MV this_mv = {ref_mv->row + neighbors[j].row,
+                              ref_mv->col + neighbors[j].col};
           sad_array[j] += mvsad_err_cost(&this_mv, &fcenter_mv,
                                          mvjsadcost, mvsadcost, error_per_bit);
 
@@ -1728,21 +1725,16 @@
       }
     } else {
       for (j = 0; j < 4; j++) {
-        this_row_offset = ref_mv->row + neighbors[j].row;
-        this_col_offset = ref_mv->col + neighbors[j].col;
+        const MV this_mv = {ref_mv->row + neighbors[j].row,
+                            ref_mv->col + neighbors[j].col};
 
-        if ((this_col_offset > x->mv_col_min) &&
-            (this_col_offset < x->mv_col_max) &&
-            (this_row_offset > x->mv_row_min) &&
-            (this_row_offset < x->mv_row_max)) {
+        if (is_mv_in(x, &this_mv)) {
           const uint8_t *check_here = neighbors[j].row * in_what_stride +
                                       neighbors[j].col + best_address;
-          thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
-                                bestsad);
+          unsigned int thissad = fn_ptr->sdf(what, what_stride, check_here,
+                                             in_what_stride, bestsad);
 
           if (thissad < bestsad) {
-            this_mv.row = this_row_offset;
-            this_mv.col = this_col_offset;
             thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
                                       mvjsadcost, mvsadcost, error_per_bit);
 
@@ -1764,6 +1756,7 @@
                       neighbors[best_site].col;
     }
   }
+
   return bestsad;
 }