From: Angie Chiang <angiebird@google.com> Date: Tue, 25 Jun 2019 22:43:43 +0000 (-0700) Subject: Remove mv_dist/mv_cost from new mv search funcs X-Git-Tag: v1.8.1~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30e7f9d856eb1cc6df895f6d9562493e04f6116d;p=libvpx Remove mv_dist/mv_cost from new mv search funcs The functions are diamond_search_sad_new() vp9_full_pixel_diamond_new() vp9_refining_search_sad_new() Change-Id: Ied6fe98b8a1401c95f0488faf781c5cd5e8e0db6 --- diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 4b7073d0f..7f82a470b 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -5895,8 +5895,6 @@ static uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td, // TODO(angiebird): Figure out lambda's proper value. const int lambda = cpi->tpl_stats[frame_idx].lambda; int_mv nb_full_mvs[NB_MVS_NUM]; - double mv_dist; - double mv_cost; #endif MV best_ref_mv1 = { 0, 0 }; @@ -5922,8 +5920,7 @@ static uint32_t motion_compensated_prediction(VP9_COMP *cpi, ThreadData *td, vp9_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, 1, - &cpi->fn_ptr[bsize], nb_full_mvs, NB_MVS_NUM, mv, - &mv_dist, &mv_cost); + &cpi->fn_ptr[bsize], nb_full_mvs, NB_MVS_NUM, mv); #else (void)frame_idx; (void)mi_row; diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 52bcea55f..d1688f993 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -2076,7 +2076,6 @@ static int64_t full_pixel_exhaustive_new(const VP9_COMP *cpi, MACROBLOCK *x, static double diamond_search_sad_new(const MACROBLOCK *x, const search_site_config *cfg, const MV *init_full_mv, MV *best_full_mv, - double *best_mv_dist, double *best_mv_cost, int search_param, int lambda, int *num00, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, @@ -2116,11 +2115,14 @@ static double diamond_search_sad_new(const MACROBLOCK *x, best_address = in_what; // Check the starting position - *best_mv_dist = fn_ptr->sdf(what, what_stride, in_what, in_what_stride); - *best_mv_cost = - vp9_nb_mvs_inconsistency(best_full_mv, nb_full_mvs, full_mv_num) / - (double)(1 << LOG2_PRECISION); - bestsad = (*best_mv_dist) + lambda * (*best_mv_cost); + { + const double mv_dist = + fn_ptr->sdf(what, what_stride, in_what, in_what_stride); + const double mv_cost = + vp9_nb_mvs_inconsistency(best_full_mv, nb_full_mvs, full_mv_num) / + (double)(1 << LOG2_PRECISION); + bestsad = mv_dist + lambda * mv_cost; + } i = 0; @@ -2159,8 +2161,6 @@ static double diamond_search_sad_new(const MACROBLOCK *x, double thissad = mv_dist + lambda * mv_cost; if (thissad < bestsad) { bestsad = thissad; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; best_site = i; } } @@ -2183,8 +2183,6 @@ static double diamond_search_sad_new(const MACROBLOCK *x, double thissad = mv_dist + lambda * mv_cost; if (thissad < bestsad) { bestsad = thissad; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; best_site = i; } } @@ -2597,17 +2595,16 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, int do_refine, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, int full_mv_num, - MV *best_mv, double *best_mv_dist, - double *best_mv_cost) { + MV *best_mv) { int n, num00 = 0; double thissme; double bestsme; const int further_steps = MAX_MVSEARCH_STEPS - 1 - step_param; const MV center_mv = { 0, 0 }; vpx_clear_system_state(); - bestsme = 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, full_mv_num); + bestsme = + diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, best_mv, step_param, + lambda, &n, fn_ptr, nb_full_mvs, full_mv_num); bestsme = vp9_get_mvpred_var(x, best_mv, ¢er_mv, fn_ptr, 0); @@ -2621,11 +2618,9 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, num00--; } else { MV temp_mv; - double mv_dist; - double mv_cost; - thissme = 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, full_mv_num); + thissme = diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, &temp_mv, + step_param + n, lambda, &num00, fn_ptr, + nb_full_mvs, full_mv_num); thissme = vp9_get_mvpred_var(x, &temp_mv, ¢er_mv, fn_ptr, 0); // check to see if refining search is needed. if (num00 > further_steps - n) do_refine = 0; @@ -2633,8 +2628,6 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, if (thissme < bestsme) { bestsme = thissme; *best_mv = temp_mv; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; } } } @@ -2643,17 +2636,12 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, if (do_refine) { const int search_range = 8; MV temp_mv = *best_mv; - double mv_dist; - double mv_cost; - thissme = vp9_refining_search_sad_new(x, &temp_mv, &mv_dist, &mv_cost, - lambda, search_range, fn_ptr, - nb_full_mvs, full_mv_num); + thissme = vp9_refining_search_sad_new(x, &temp_mv, lambda, search_range, + fn_ptr, nb_full_mvs, full_mv_num); thissme = vp9_get_mvpred_var(x, &temp_mv, ¢er_mv, fn_ptr, 0); if (thissme < bestsme) { bestsme = thissme; *best_mv = temp_mv; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; } } @@ -2787,7 +2775,6 @@ static int full_pixel_exhaustive(const VP9_COMP *const cpi, #if CONFIG_NON_GREEDY_MV double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, - double *best_mv_dist, double *best_mv_cost, int lambda, int search_range, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, int full_mv_num) { @@ -2799,12 +2786,14 @@ double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, double best_sad; int i, j; vpx_clear_system_state(); - *best_mv_dist = - fn_ptr->sdf(what->buf, what->stride, best_address, in_what->stride); - *best_mv_cost = - vp9_nb_mvs_inconsistency(best_full_mv, nb_full_mvs, full_mv_num) / - (double)(1 << LOG2_PRECISION); - best_sad = (*best_mv_dist) + lambda * (*best_mv_cost); + { + const double mv_dist = + fn_ptr->sdf(what->buf, what->stride, best_address, in_what->stride); + const double mv_cost = + vp9_nb_mvs_inconsistency(best_full_mv, nb_full_mvs, full_mv_num) / + (double)(1 << LOG2_PRECISION); + best_sad = mv_dist + lambda * mv_cost; + } for (i = 0; i < search_range; i++) { int best_site = -1; @@ -2831,8 +2820,6 @@ double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, const double thissad = mv_dist + lambda * mv_cost; if (thissad < best_sad) { best_sad = thissad; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; best_site = j; } } @@ -2851,8 +2838,6 @@ double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, const double thissad = mv_dist + lambda * mv_cost; if (thissad < best_sad) { best_sad = thissad; - *best_mv_dist = mv_dist; - *best_mv_cost = mv_cost; best_site = j; } } diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 300d4edeb..cafa2d150 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -129,7 +129,6 @@ void vp9_set_subpel_mv_search_range(MvLimits *subpel_mv_limits, #define NB_MVS_NUM 4 struct TplDepStats; double vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, - double *best_mv_dist, double *best_mv_cost, int lambda, int search_range, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, int full_mv_num); @@ -139,8 +138,7 @@ double vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x, int do_refine, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, int full_mv_num, - MV *best_mv, double *best_mv_dist, - double *best_mv_cost); + MV *best_mv); int64_t vp9_nb_mvs_inconsistency(const MV *mv, const int_mv *nb_mvs, int mv_num); diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 2066396f5..d07d91774 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2495,8 +2495,6 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, MV pred_mv[3]; #if CONFIG_NON_GREEDY_MV - double mv_dist = 0; - double mv_cost = 0; double bestsme; int_mv nb_full_mvs[NB_MVS_NUM]; const int nb_full_mv_num = NB_MVS_NUM; @@ -2582,9 +2580,9 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, mvp_full.row >>= 3; #if CONFIG_NON_GREEDY_MV - bestsme = vp9_full_pixel_diamond_new( - cpi, x, &mvp_full, step_param, lambda, 1, &cpi->fn_ptr[bsize], - nb_full_mvs, nb_full_mv_num, &tmp_mv->as_mv, &mv_dist, &mv_cost); + bestsme = vp9_full_pixel_diamond_new(cpi, x, &mvp_full, step_param, lambda, 1, + &cpi->fn_ptr[bsize], nb_full_mvs, + nb_full_mv_num, &tmp_mv->as_mv); #else // CONFIG_NON_GREEDY_MV bestsme = vp9_full_pixel_search( cpi, x, bsize, &mvp_full, step_param, cpi->sf.mv.search_method, sadpb, @@ -2625,8 +2623,8 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, #if CONFIG_NON_GREEDY_MV this_me = vp9_full_pixel_diamond_new( cpi, x, &mvp_full, VPXMAX(step_param, MAX_MVSEARCH_STEPS - step), - lambda, 1, &cpi->fn_ptr[bsize], nb_full_mvs, nb_full_mv_num, &this_mv, - &mv_dist, &mv_cost); + lambda, 1, &cpi->fn_ptr[bsize], nb_full_mvs, nb_full_mv_num, + &this_mv); #else // CONFIG_NON_GREEDY_MV this_me = vp9_full_pixel_search( cpi, x, bsize, &mvp_full,