shithub: libvpx

Download patch

ref: ebe10bcc33c838b7e062fd3a60b7e3098da94c7b
parent: 33cc4670473d51de0f1a782108ace460e028e23a
author: Angie Chiang <[email protected]>
date: Fri Sep 28 10:35:21 EDT 2018

Change interface of motion_compensated_prediction

Change the interface of vp9_full_pixel_diamond_new

Change-Id: Ic9ed6ed61c5178f3f445f40860ebaac7ea17f75d

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5469,11 +5469,20 @@
 }
 #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 @@
   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 @@
       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 @@
 
 #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]);
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -2084,7 +2084,9 @@
                                   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;
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -121,6 +121,7 @@
 
 #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 @@
                                   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"