shithub: libvpx

Download patch

ref: 7fc5f6739a953735db0bd7e2dd38d22849d98d14
parent: 6f8861e293a5f376568a1468d1c9eba524ae7e8a
author: Angie Chiang <angiebird@google.com>
date: Fri Sep 28 11:52:03 EDT 2018

Add mv_{dist/cost}_sum to TplDepFrame

Change-Id: Iacce1f88630ba93ff72d745a83dd4b853b6b61af

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5948,6 +5948,9 @@
   const int mi_height = num_8x8_blocks_high_lookup[bsize];
   const int mi_width = num_8x8_blocks_wide_lookup[bsize];
   int64_t recon_error, sse;
+#if CONFIG_NON_GREEDY_MV
+  int rf_idx;
+#endif
 
   // Setup scaling factor
 #if CONFIG_VP9_HIGHBITDEPTH
@@ -5989,6 +5992,12 @@
   cm->base_qindex = tpl_frame->base_qindex;
   vp9_frame_init_quantizer(cpi);
 
+#if CONFIG_NON_GREEDY_MV
+  for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+    tpl_frame->mv_dist_sum[rf_idx] = 0;
+    tpl_frame->mv_cost_sum[rf_idx] = 0;
+  }
+#endif
   for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
     // Motion estimation row boundary
     x->mv_limits.row_min = -((mi_row * MI_SIZE) + (17 - 2 * VP9_INTERP_EXTEND));
@@ -6006,6 +6015,16 @@
 
       tpl_model_update(cpi->tpl_stats, tpl_frame->tpl_stats_ptr, mi_row, mi_col,
                        bsize);
+#if CONFIG_NON_GREEDY_MV
+      {
+        TplDepStats *this_tpl_stats =
+            &tpl_frame->tpl_stats_ptr[mi_row * tpl_frame->stride + mi_col];
+        for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+          tpl_frame->mv_dist_sum[rf_idx] += this_tpl_stats->mv_dist[rf_idx];
+          tpl_frame->mv_cost_sum[rf_idx] += this_tpl_stats->mv_cost[rf_idx];
+        }
+      }
+#endif
     }
   }
 }
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -311,6 +311,10 @@
   int mi_rows;
   int mi_cols;
   int base_qindex;
+#if CONFIG_NON_GREEDY_MV
+  double mv_dist_sum[3];
+  double mv_cost_sum[3];
+#endif
 } TplDepFrame;
 
 #define TPL_DEP_COST_SCALE_LOG2 4