shithub: libvpx

Download patch

ref: 184071fe9f3c4db1b22d5bd69c9015b518c65e7a
parent: 29382c1a06dc362abd7f7c8cf809360e63255c7d
author: Angie Chiang <[email protected]>
date: Wed Jun 26 12:28:46 EDT 2019

Integerize vp9_full_pixel_diamond_new

Change-Id: I833c82fb910c8274b5a237e26fe0dcda7def9796

--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -2031,7 +2031,6 @@
   int interval = sf->mesh_patterns[0].interval;
   int range = sf->mesh_patterns[0].range;
   int baseline_interval_divisor;
-  const MV dummy_mv = { 0, 0 };
 
   // Trap illegal values for interval and range for this function.
   if ((range < MIN_RANGE) || (range > MAX_RANGE) || (interval < MIN_INTERVAL) ||
@@ -2067,7 +2066,6 @@
     }
   }
 
-  bestsme = vp9_get_mvpred_var(x, &temp_mv, &dummy_mv, fn_ptr, 0);
   *dst_mv = temp_mv;
 
   return bestsme;
@@ -2590,15 +2588,14 @@
 /* do_refine: If last step (1-away) of n-step search doesn't pick the center
               point as the best match, we will do a final 1-away diamond
               refining search  */
-double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x,
-                                  MV *mvp_full, int step_param, int lambda,
-                                  int do_refine,
-                                  const vp9_variance_fn_ptr_t *fn_ptr,
-                                  const int_mv *nb_full_mvs, int full_mv_num,
-                                  MV *best_mv) {
+int vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
+                               int step_param, int lambda, int do_refine,
+                               const vp9_variance_fn_ptr_t *fn_ptr,
+                               const int_mv *nb_full_mvs, int full_mv_num,
+                               MV *best_mv) {
   int n, num00 = 0;
-  double thissme;
-  double bestsme;
+  int thissme;
+  int bestsme;
   const int further_steps = MAX_MVSEARCH_STEPS - 1 - step_param;
   const MV center_mv = { 0, 0 };
   vpx_clear_system_state();
@@ -2644,8 +2641,9 @@
     }
   }
 
-  bestsme = (double)full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv,
-                                              lambda, nb_full_mvs, full_mv_num);
+  full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv, lambda,
+                            nb_full_mvs, full_mv_num);
+  bestsme = vp9_get_mvpred_var(x, best_mv, &center_mv, fn_ptr, 0);
   return bestsme;
 }
 #endif  // CONFIG_NON_GREEDY_MV
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -133,12 +133,12 @@
                                     const vp9_variance_fn_ptr_t *fn_ptr,
                                     const int_mv *nb_full_mvs, int full_mv_num);
 
-double vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x,
-                                  MV *mvp_full, int step_param, int lambda,
-                                  int do_refine,
-                                  const vp9_variance_fn_ptr_t *fn_ptr,
-                                  const int_mv *nb_full_mvs, int full_mv_num,
-                                  MV *best_mv);
+int vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x,
+                               MV *mvp_full, int step_param, int lambda,
+                               int do_refine,
+                               const vp9_variance_fn_ptr_t *fn_ptr,
+                               const int_mv *nb_full_mvs, int full_mv_num,
+                               MV *best_mv);
 
 int64_t vp9_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_mvs,
                                  int mv_num);
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2494,8 +2494,8 @@
   const int ph = num_4x4_blocks_high_lookup[bsize] << 2;
   MV pred_mv[3];
 
+  int bestsme = INT_MAX;
 #if CONFIG_NON_GREEDY_MV
-  double bestsme;
   int_mv nb_full_mvs[NB_MVS_NUM];
   const int nb_full_mv_num = NB_MVS_NUM;
   int gf_group_idx = cpi->twopass.gf_group.index;
@@ -2506,7 +2506,6 @@
   vp9_prepare_nb_full_mvs(&cpi->tpl_stats[gf_group_idx], mi_row, mi_col,
                           gf_rf_idx, square_bsize, nb_full_mvs);
 #else   // CONFIG_NON_GREEDY_MV
-  int bestsme = INT_MAX;
   int sadpb = x->sadperbit16;
 #endif  // CONFIG_NON_GREEDY_MV
 
@@ -2592,11 +2591,7 @@
   if (cpi->sf.enhanced_full_pixel_motion_search) {
     int i;
     for (i = 0; i < 3; ++i) {
-#if CONFIG_NON_GREEDY_MV
-      double this_me;
-#else   // CONFIG_NON_GREEDY_MV
       int this_me;
-#endif  // CONFIG_NON_GREEDY_MV
       MV this_mv;
       int diff_row;
       int diff_col;