shithub: libvpx

Download patch

ref: 6e8c1036209791b86938f3c65fb5b7e17df4776a
parent: ed2fba2a79efd9d32e5e082f1fbe4ca4a54ed058
parent: 672c355a2654f46216a74878b8dc940b5864a711
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Jan 3 12:38:28 EST 2014

Merge "Replacing int_mv with MV."

--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -22,7 +22,7 @@
 
 
 static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
-                                              int_mv *ref_mv,
+                                              const MV *ref_mv,
                                               int_mv *dst_mv,
                                               int mb_row,
                                               int mb_col) {
@@ -42,15 +42,14 @@
       (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
   step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
 
-  vp9_set_mv_search_range(x, &ref_mv->as_mv);
+  vp9_set_mv_search_range(x, ref_mv);
 
-  ref_full.as_mv.col = ref_mv->as_mv.col >> 3;
-  ref_full.as_mv.row = ref_mv->as_mv.row >> 3;
+  ref_full.as_mv.col = ref_mv->col >> 3;
+  ref_full.as_mv.row = ref_mv->row >> 3;
 
   /*cpi->sf.search_method == HEX*/
   best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit,
-                            0, &v_fn_ptr,
-                            0, &ref_mv->as_mv, &dst_mv->as_mv);
+                            0, &v_fn_ptr, 0, ref_mv, &dst_mv->as_mv);
 
   // Try sub-pixel MC
   // if (bestsme > error_thresh && bestsme < INT_MAX)
@@ -59,7 +58,7 @@
     unsigned int sse;
     best_err = cpi->find_fractional_mv_step(
         x,
-        &dst_mv->as_mv, &ref_mv->as_mv,
+        &dst_mv->as_mv, ref_mv,
         cpi->common.allow_high_precision_mv,
         x->errorperbit, &v_fn_ptr,
         0, cpi->sf.subpel_iters_per_step, NULL, NULL,
@@ -81,8 +80,8 @@
   return best_err;
 }
 
-static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv,
-                                  int mb_row, int mb_col) {
+static int do_16x16_motion_search(VP9_COMP *cpi, const int_mv *ref_mv,
+                                  int_mv *dst_mv, int mb_row, int mb_col) {
   MACROBLOCK *const x = &cpi->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
   unsigned int err, tmp_err;
@@ -97,7 +96,8 @@
 
   // Test last reference frame using the previous best mv as the
   // starting point (best reference) for the search
-  tmp_err = do_16x16_motion_iteration(cpi, ref_mv, &tmp_mv, mb_row, mb_col);
+  tmp_err = do_16x16_motion_iteration(cpi, &ref_mv->as_mv, &tmp_mv,
+                                      mb_row, mb_col);
   if (tmp_err < err) {
     err = tmp_err;
     dst_mv->as_int = tmp_mv.as_int;
@@ -110,7 +110,7 @@
     int_mv zero_ref_mv, tmp_mv;
 
     zero_ref_mv.as_int = 0;
-    tmp_err = do_16x16_motion_iteration(cpi, &zero_ref_mv, &tmp_mv,
+    tmp_err = do_16x16_motion_iteration(cpi, &zero_ref_mv.as_mv, &tmp_mv,
                                         mb_row, mb_col);
     if (tmp_err < err) {
       dst_mv->as_int = tmp_mv.as_int;
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -23,7 +23,7 @@
 
 // #define NEW_DIAMOND_SEARCH
 
-void vp9_set_mv_search_range(MACROBLOCK *x, MV *mv) {
+void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) {
   const int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0);
   const int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0);
   const int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
@@ -1303,16 +1303,16 @@
               refining search  */
 
 int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
-                           int_mv *mvp_full, int step_param,
+                           MV *mvp_full, int step_param,
                            int sadpb, int further_steps,
                            int do_refine, vp9_variance_fn_ptr_t *fn_ptr,
-                           int_mv *ref_mv, int_mv *dst_mv) {
+                           const MV *ref_mv, int_mv *dst_mv) {
   int_mv temp_mv;
   int thissme, n, num00;
-  int bestsme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
+  int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv.as_mv,
                                         step_param, sadpb, &num00,
                                         fn_ptr, x->nmvjointcost,
-                                        x->mvcost, &ref_mv->as_mv);
+                                        x->mvcost, ref_mv);
   dst_mv->as_int = temp_mv.as_int;
 
   n = num00;
@@ -1329,10 +1329,10 @@
     if (num00) {
       num00--;
     } else {
-      thissme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
+      thissme = cpi->diamond_search_sad(x, mvp_full, &temp_mv.as_mv,
                                         step_param + n, sadpb, &num00,
                                         fn_ptr, x->nmvjointcost, x->mvcost,
-                                        &ref_mv->as_mv);
+                                        ref_mv);
 
       /* check to see if refining search is needed. */
       if (num00 > (further_steps - n))
@@ -1352,7 +1352,7 @@
     best_mv.as_int = dst_mv->as_int;
     thissme = cpi->refining_search_sad(x, &best_mv.as_mv, sadpb, search_range,
                                        fn_ptr, x->nmvjointcost, x->mvcost,
-                                       &ref_mv->as_mv);
+                                       ref_mv);
 
     if (thissme < bestsme) {
       bestsme = thissme;
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -28,7 +28,7 @@
 #define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
 
 
-void vp9_set_mv_search_range(MACROBLOCK *x, MV *mv);
+void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv);
 int vp9_mv_bit_cost(const MV *mv, const MV *ref,
                     const int *mvjcost, int *mvcost[2], int weight);
 void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
@@ -39,10 +39,10 @@
 
 // Runs sequence of diamond searches in smaller steps for RD
 int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x,
-                           int_mv *mvp_full, int step_param,
+                           MV *mvp_full, int step_param,
                            int sadpb, int further_steps, int do_refine,
                            vp9_variance_fn_ptr_t *fn_ptr,
-                           int_mv *ref_mv, int_mv *dst_mv);
+                           const MV *ref_mv, int_mv *dst_mv);
 
 int vp9_hex_search(MACROBLOCK *x,
                    MV *ref_mv,
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1742,7 +1742,7 @@
           int further_steps;
           int thissme, bestsme = INT_MAX;
           int sadpb = x->sadperbit4;
-          int_mv mvp_full;
+          MV mvp_full;
           int max_mv;
 
           /* Is the best so far sufficiently good that we cant justify doing
@@ -1773,12 +1773,12 @@
             step_param = cpi->mv_step_param;
           }
 
-          mvp_full.as_mv.row = bsi->mvp.as_mv.row >> 3;
-          mvp_full.as_mv.col = bsi->mvp.as_mv.col >> 3;
+          mvp_full.row = bsi->mvp.as_mv.row >> 3;
+          mvp_full.col = bsi->mvp.as_mv.col >> 3;
 
           if (cpi->sf.adaptive_motion_search && cpi->common.show_frame) {
-            mvp_full.as_mv.row = x->pred_mv[mbmi->ref_frame[0]].as_mv.row >> 3;
-            mvp_full.as_mv.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
+            mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].as_mv.row >> 3;
+            mvp_full.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
             step_param = MAX(step_param, 8);
           }
 
@@ -1789,19 +1789,19 @@
           vp9_set_mv_search_range(x, &bsi->ref_mv->as_mv);
 
           if (cpi->sf.search_method == HEX) {
-            bestsme = vp9_hex_search(x, &mvp_full.as_mv,
+            bestsme = vp9_hex_search(x, &mvp_full,
                                      step_param,
                                      sadpb, 1, v_fn_ptr, 1,
                                      &bsi->ref_mv->as_mv,
                                      &mode_mv[NEWMV].as_mv);
           } else if (cpi->sf.search_method == SQUARE) {
-            bestsme = vp9_square_search(x, &mvp_full.as_mv,
+            bestsme = vp9_square_search(x, &mvp_full,
                                         step_param,
                                         sadpb, 1, v_fn_ptr, 1,
                                         &bsi->ref_mv->as_mv,
                                         &mode_mv[NEWMV].as_mv);
           } else if (cpi->sf.search_method == BIGDIA) {
-            bestsme = vp9_bigdia_search(x, &mvp_full.as_mv,
+            bestsme = vp9_bigdia_search(x, &mvp_full,
                                         step_param,
                                         sadpb, 1, v_fn_ptr, 1,
                                         &bsi->ref_mv->as_mv,
@@ -1809,16 +1809,17 @@
           } else {
             bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
                                              sadpb, further_steps, 0, v_fn_ptr,
-                                             bsi->ref_mv, &mode_mv[NEWMV]);
+                                             &bsi->ref_mv->as_mv,
+                                             &mode_mv[NEWMV]);
           }
 
           // Should we do a full search (best quality only)
           if (cpi->compressor_speed == 0) {
             /* Check if mvp_full is within the range. */
-            clamp_mv(&mvp_full.as_mv, x->mv_col_min, x->mv_col_max,
+            clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
                      x->mv_row_min, x->mv_row_max);
 
-            thissme = cpi->full_search_sad(x, &mvp_full.as_mv,
+            thissme = cpi->full_search_sad(x, &mvp_full,
                                            sadpb, 16, v_fn_ptr,
                                            x->nmvjointcost, x->mvcost,
                                            &bsi->ref_mv->as_mv, i);
@@ -2439,10 +2440,10 @@
                                 &cpi->fn_ptr[bsize], 1,
                                 &ref_mv.as_mv, &tmp_mv->as_mv);
   } else {
-    bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
+    bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full.as_mv, step_param,
                                      sadpb, further_steps, 1,
                                      &cpi->fn_ptr[bsize],
-                                     &ref_mv, tmp_mv);
+                                     &ref_mv.as_mv, tmp_mv);
   }
 
   x->mv_col_min = tmp_col_min;