Change interface of motion_compensated_prediction
authorAngie Chiang <angiebird@google.com>
Fri, 28 Sep 2018 21:35:21 +0000 (14:35 -0700)
committerAngie Chiang <angiebird@google.com>
Fri, 28 Sep 2018 23:05:34 +0000 (16:05 -0700)
Change the interface of vp9_full_pixel_diamond_new

Change-Id: Ic9ed6ed61c5178f3f445f40860ebaac7ea17f75d

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_mcomp.c
vp9/encoder/vp9_mcomp.h

index a8810e9..a5fdda1 100644 (file)
@@ -5469,11 +5469,20 @@ static void prepare_nb_full_mvs(const TplDepFrame *tpl_frame, int mi_row,
 }
 #endif
 
+#if CONFIG_NON_GREEDY_MV
 uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td,
                                        int frame_idx, uint8_t *cur_frame_buf,
                                        uint8_t *ref_frame_buf, int stride,
-                                       MV *mv, BLOCK_SIZE bsize, int mi_row,
-                                       int mi_col) {
+                                       BLOCK_SIZE bsize, int mi_row, int mi_col,
+                                       TplDepStats *tpl_stats, int rf_idx) {
+  MV *mv = &tpl_stats->mv_arr[rf_idx].as_mv;
+#else   // CONFIG_NON_GREEDY_MV
+uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td,
+                                       int frame_idx, uint8_t *cur_frame_buf,
+                                       uint8_t *ref_frame_buf, int stride,
+                                       BLOCK_SIZE bsize, int mi_row, int mi_col,
+                                       MV *mv) {
+#endif  // CONFIG_NON_GREEDY_MV
   MACROBLOCK *const x = &td->mb;
   MACROBLOCKD *const xd = &x->e_mbd;
   MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
@@ -5515,7 +5524,8 @@ uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td,
   prepare_nb_full_mvs(&cpi->tpl_stats[frame_idx], mi_row, mi_col, nb_full_mvs);
   vp9_full_pixel_diamond_new(cpi, x, &best_ref_mv1_full, step_param, lambda,
                              MAX_MVSEARCH_STEPS - 1 - step_param, 1,
-                             &cpi->fn_ptr[bsize], nb_full_mvs, mv);
+                             &cpi->fn_ptr[bsize], nb_full_mvs, tpl_stats,
+                             rf_idx);
 #else
   (void)frame_idx;
   (void)mi_row;
@@ -5830,10 +5840,18 @@ void mode_estimation(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
       continue;
     }
 
+#if CONFIG_NON_GREEDY_MV
     motion_compensated_prediction(
         cpi, td, frame_idx, xd->cur_buf->y_buffer + mb_y_offset,
-        ref_frame[rf_idx]->y_buffer + mb_y_offset, xd->cur_buf->y_stride,
-        &mv.as_mv, bsize, mi_row, mi_col);
+        ref_frame[rf_idx]->y_buffer + mb_y_offset, xd->cur_buf->y_stride, bsize,
+        mi_row, mi_col, tpl_stats, rf_idx);
+    mv.as_int = tpl_stats->mv_arr[rf_idx].as_int;
+#else
+    motion_compensated_prediction(
+        cpi, td, frame_idx, xd->cur_buf->y_buffer + mb_y_offset,
+        ref_frame[rf_idx]->y_buffer + mb_y_offset, xd->cur_buf->y_stride, bsize,
+        mi_row, mi_col, &mv.as_mv);
+#endif
 
     // TODO(jingning): Not yet support high bit-depth in the next three
     // steps.
@@ -5871,7 +5889,6 @@ void mode_estimation(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd,
 
 #if CONFIG_NON_GREEDY_MV
     tpl_stats->inter_cost_arr[rf_idx] = inter_cost;
-    tpl_stats->mv_arr[rf_idx].as_int = mv.as_int;
     get_quantize_error(x, 0, coeff, qcoeff, dqcoeff, tx_size,
                        &tpl_stats->recon_error_arr[rf_idx],
                        &tpl_stats->sse_arr[rf_idx]);
index 980bf24..56e6edf 100644 (file)
@@ -2084,7 +2084,9 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x,
                                   MV *mvp_full, int step_param, double lambda,
                                   int further_steps, int do_refine,
                                   const vp9_variance_fn_ptr_t *fn_ptr,
-                                  const int_mv *nb_full_mvs, MV *dst_mv) {
+                                  const int_mv *nb_full_mvs,
+                                  TplDepStats *tpl_stats, int rf_idx) {
+  MV *dst_mv = &tpl_stats->mv_arr[rf_idx].as_mv;
   MV temp_mv;
   int n, num00 = 0;
   double thissme;
index 46dd551..8cecc24 100644 (file)
@@ -121,6 +121,7 @@ void vp9_set_subpel_mv_search_range(MvLimits *subpel_mv_limits,
 
 #if CONFIG_NON_GREEDY_MV
 #define NB_MVS_NUM 4
+struct TplDepStats;
 double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv,
                                    double lambda, int search_range,
                                    const vp9_variance_fn_ptr_t *fn_ptr,
@@ -130,7 +131,8 @@ double vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x,
                                   MV *mvp_full, int step_param, double lambda,
                                   int further_steps, int do_refine,
                                   const vp9_variance_fn_ptr_t *fn_ptr,
-                                  const int_mv *nb_full_mvs, MV *dst_mv);
+                                  const int_mv *nb_full_mvs,
+                                  struct TplDepStats *tpl_stats, int rf_idx);
 #endif  // CONFIG_NON_GREEDY_MV
 #ifdef __cplusplus
 }  // extern "C"