From: Angie Chiang Date: Thu, 29 Nov 2018 22:54:17 +0000 (-0800) Subject: Change the interface of vp9_full_pixel_diamond_new X-Git-Tag: v1.8.0~116^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a0d53a031eff97f893c8d77e63b65008c22f37e;p=platform%2Fupstream%2Flibvpx.git Change the interface of vp9_full_pixel_diamond_new Avoid passing in tpl_stats because this function will be called in motion search, where tpl_stats should be fixed at the point. Let further_steps becomes internal variable in the function. Change-Id: Iebe380925eb1891c19e0b78163dab8e6bfafccdb --- diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 41f9419..04d2524 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -5660,10 +5660,10 @@ uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td, (void)sadpb; prepare_nb_full_mvs(&cpi->tpl_stats[frame_idx], mi_row, mi_col, rf_idx, bsize, 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, tpl_stats, - rf_idx); + vp9_full_pixel_diamond_new( + cpi, x, &best_ref_mv1_full, step_param, lambda, 1, &cpi->fn_ptr[bsize], + nb_full_mvs, &tpl_stats->mv_arr[rf_idx].as_mv, + &tpl_stats->mv_dist[rf_idx], &tpl_stats->mv_cost[rf_idx]); #else (void)frame_idx; (void)mi_row; diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index a254303..235f034 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -2240,24 +2240,18 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, refining search */ 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, + int do_refine, const vp9_variance_fn_ptr_t *fn_ptr, - 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; + const int_mv *nb_full_mvs, MV *best_mv, + double *best_mv_dist, double *best_mv_cost) { int n, num00 = 0; double thissme; - double mv_dist; - double mv_cost; double bestsme; + const int further_steps = MAX_MVSEARCH_STEPS - 1 - step_param; vpx_clear_system_state(); - bestsme = vp9_diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, &temp_mv, - &mv_dist, &mv_cost, step_param, lambda, - &n, fn_ptr, nb_full_mvs); - *dst_mv = temp_mv; - tpl_stats->mv_dist[rf_idx] = mv_dist; - tpl_stats->mv_cost[rf_idx] = mv_cost; + bestsme = vp9_diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, best_mv, + best_mv_dist, best_mv_cost, step_param, + lambda, &n, fn_ptr, nb_full_mvs); // If there won't be more n-step search, check to see if refining search is // needed. @@ -2268,6 +2262,9 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, if (num00) { num00--; } else { + MV temp_mv; + double mv_dist; + double mv_cost; thissme = vp9_diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, &temp_mv, &mv_dist, &mv_cost, step_param + n, lambda, &num00, fn_ptr, nb_full_mvs); @@ -2276,9 +2273,9 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, if (thissme < bestsme) { bestsme = thissme; - *dst_mv = temp_mv; - tpl_stats->mv_dist[rf_idx] = mv_dist; - tpl_stats->mv_cost[rf_idx] = mv_cost; + *best_mv = temp_mv; + *best_mv_dist = mv_dist; + *best_mv_cost = mv_cost; } } } @@ -2286,15 +2283,17 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, // final 1-away diamond refining search if (do_refine) { const int search_range = 8; - MV best_mv = *dst_mv; + MV temp_mv = *best_mv; + double mv_dist; + double mv_cost; thissme = - vp9_refining_search_sad_new(x, &best_mv, &mv_dist, &mv_cost, lambda, + vp9_refining_search_sad_new(x, &temp_mv, &mv_dist, &mv_cost, lambda, search_range, fn_ptr, nb_full_mvs); if (thissme < bestsme) { bestsme = thissme; - *dst_mv = best_mv; - tpl_stats->mv_dist[rf_idx] = mv_dist; - tpl_stats->mv_cost[rf_idx] = mv_cost; + *best_mv = temp_mv; + *best_mv_dist = mv_dist; + *best_mv_cost = mv_cost; } } return bestsme; diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index a159cb2..54f68ca 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -130,10 +130,10 @@ double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, 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, + int do_refine, const vp9_variance_fn_ptr_t *fn_ptr, - const int_mv *nb_full_mvs, - struct TplDepStats *tpl_stats, int rf_idx); + const int_mv *nb_full_mvs, MV *best_mv, + double *best_mv_dist, double *best_mv_cost); double av1_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_mvs); #endif // CONFIG_NON_GREEDY_MV