shithub: libvpx

Download patch

ref: 9a2ae317690d2d2b5aed1799b8eb6dfe316467fd
parent: 5a0d53a031eff97f893c8d77e63b65008c22f37e
author: Angie Chiang <angiebird@google.com>
date: Thu Nov 29 12:36:57 EST 2018

Consider mv inconsistency in single_motion_search

This is still a work-in-process.
nb_full_mvs and lambda are set to zero for now, which means
mv inconsistency penalty is zero while doing the mv search.

Change-Id: I18680413d748fbdb9a33621f92f83e021036a3ab

--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2322,9 +2322,7 @@
   const VP9_COMMON *cm = &cpi->common;
   MODE_INFO *mi = xd->mi[0];
   struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0 } };
-  int bestsme = INT_MAX;
   int step_param;
-  int sadpb = x->sadperbit16;
   MV mvp_full;
   int ref = mi->ref_frame[0];
   MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
@@ -2335,8 +2333,21 @@
       vp9_get_scaled_ref_frame(cpi, ref);
   const int pw = num_4x4_blocks_wide_lookup[bsize] << 2;
   const int ph = num_4x4_blocks_high_lookup[bsize] << 2;
-
   MV pred_mv[3];
+
+#if CONFIG_NON_GREEDY_MV
+  double mv_dist = 0;
+  double mv_cost = 0;
+  double lambda = 0;
+  double bestsme;
+  int_mv nb_full_mvs[NB_MVS_NUM];
+  // TODO(angiebird): Set nb_full_mvs properly.
+  vp9_zero(nb_full_mvs);
+#else   // CONFIG_NON_GREEDY_MV
+  int bestsme = INT_MAX;
+  int sadpb = x->sadperbit16;
+#endif  // CONFIG_NON_GREEDY_MV
+
   pred_mv[0] = x->mbmi_ext->ref_mvs[ref][0].as_mv;
   pred_mv[1] = x->mbmi_ext->ref_mvs[ref][1].as_mv;
   pred_mv[2] = x->pred_mv[ref];
@@ -2406,14 +2417,24 @@
   mvp_full.col >>= 3;
   mvp_full.row >>= 3;
 
+#if CONFIG_NON_GREEDY_MV
+  bestsme = vp9_full_pixel_diamond_new(cpi, x, &mvp_full, step_param, lambda, 1,
+                                       &cpi->fn_ptr[bsize], nb_full_mvs,
+                                       &tmp_mv->as_mv, &mv_dist, &mv_cost);
+#else   // CONFIG_NON_GREEDY_MV
   bestsme = vp9_full_pixel_search(
       cpi, x, bsize, &mvp_full, step_param, cpi->sf.mv.search_method, sadpb,
       cond_cost_list(cpi, cost_list), &ref_mv, &tmp_mv->as_mv, INT_MAX, 1);
+#endif  // CONFIG_NON_GREEDY_MV
 
   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;
@@ -2437,11 +2458,18 @@
       mvp_full = pred_mv[i];
       mvp_full.col >>= 3;
       mvp_full.row >>= 3;
+#if CONFIG_NON_GREEDY_MV
+      this_me = vp9_full_pixel_diamond_new(
+          cpi, x, &mvp_full, VPXMAX(step_param, MAX_MVSEARCH_STEPS - step),
+          lambda, 1, &cpi->fn_ptr[bsize], nb_full_mvs, &tmp_mv->as_mv, &mv_dist,
+          &mv_cost);
+#else   // CONFIG_NON_GREEDY_MV
       this_me = vp9_full_pixel_search(
           cpi, x, bsize, &mvp_full,
           VPXMAX(step_param, MAX_MVSEARCH_STEPS - step),
           cpi->sf.mv.search_method, sadpb, cond_cost_list(cpi, cost_list),
           &ref_mv, &this_mv, INT_MAX, 1);
+#endif  // CONFIG_NON_GREEDY_MV
       if (this_me < bestsme) {
         tmp_mv->as_mv = this_mv;
         bestsme = this_me;