From ebe10bcc33c838b7e062fd3a60b7e3098da94c7b Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Fri, 28 Sep 2018 14:35:21 -0700 Subject: [PATCH] Change interface of motion_compensated_prediction Change the interface of vp9_full_pixel_diamond_new Change-Id: Ic9ed6ed61c5178f3f445f40860ebaac7ea17f75d --- vp9/encoder/vp9_encoder.c | 29 +++++++++++++++++++++++------ vp9/encoder/vp9_mcomp.c | 4 +++- vp9/encoder/vp9_mcomp.h | 4 +++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index a8810e9b9..a5fdda109 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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]); diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 980bf24ba..56e6edf7f 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -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; diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 46dd55129..8cecc24dd 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -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" -- 2.40.0