From 184071fe9f3c4db1b22d5bd69c9015b518c65e7a Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Wed, 26 Jun 2019 16:28:46 -0700 Subject: [PATCH] Integerize vp9_full_pixel_diamond_new Change-Id: I833c82fb910c8274b5a237e26fe0dcda7def9796 --- vp9/encoder/vp9_mcomp.c | 22 ++++++++++------------ vp9/encoder/vp9_mcomp.h | 12 ++++++------ vp9/encoder/vp9_rdopt.c | 7 +------ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index 2938dea07..fbf5e3974 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -2031,7 +2031,6 @@ static int64_t full_pixel_exhaustive_new(const VP9_COMP *cpi, MACROBLOCK *x, int interval = sf->mesh_patterns[0].interval; int range = sf->mesh_patterns[0].range; int baseline_interval_divisor; - const MV dummy_mv = { 0, 0 }; // Trap illegal values for interval and range for this function. if ((range < MIN_RANGE) || (range > MAX_RANGE) || (interval < MIN_INTERVAL) || @@ -2067,7 +2066,6 @@ static int64_t full_pixel_exhaustive_new(const VP9_COMP *cpi, MACROBLOCK *x, } } - bestsme = vp9_get_mvpred_var(x, &temp_mv, &dummy_mv, fn_ptr, 0); *dst_mv = temp_mv; return bestsme; @@ -2590,15 +2588,14 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, /* do_refine: If last step (1-away) of n-step search doesn't pick the center point as the best match, we will do a final 1-away diamond refining search */ -double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, - MV *mvp_full, int step_param, int lambda, - int do_refine, - const vp9_variance_fn_ptr_t *fn_ptr, - const int_mv *nb_full_mvs, int full_mv_num, - MV *best_mv) { +int vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, MV *mvp_full, + int step_param, int lambda, int do_refine, + const vp9_variance_fn_ptr_t *fn_ptr, + const int_mv *nb_full_mvs, int full_mv_num, + MV *best_mv) { int n, num00 = 0; - double thissme; - double bestsme; + int thissme; + int bestsme; const int further_steps = MAX_MVSEARCH_STEPS - 1 - step_param; const MV center_mv = { 0, 0 }; vpx_clear_system_state(); @@ -2644,8 +2641,9 @@ double vp9_full_pixel_diamond_new(const VP9_COMP *cpi, MACROBLOCK *x, } } - bestsme = (double)full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv, - lambda, nb_full_mvs, full_mv_num); + full_pixel_exhaustive_new(cpi, x, best_mv, fn_ptr, best_mv, lambda, + nb_full_mvs, full_mv_num); + bestsme = vp9_get_mvpred_var(x, best_mv, ¢er_mv, fn_ptr, 0); return bestsme; } #endif // CONFIG_NON_GREEDY_MV diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 5562f2965..12c9bc286 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -133,12 +133,12 @@ int64_t vp9_refining_search_sad_new(const MACROBLOCK *x, MV *best_full_mv, const vp9_variance_fn_ptr_t *fn_ptr, const int_mv *nb_full_mvs, int full_mv_num); -double vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x, - MV *mvp_full, int step_param, int lambda, - int do_refine, - const vp9_variance_fn_ptr_t *fn_ptr, - const int_mv *nb_full_mvs, int full_mv_num, - MV *best_mv); +int vp9_full_pixel_diamond_new(const struct VP9_COMP *cpi, MACROBLOCK *x, + MV *mvp_full, int step_param, int lambda, + int do_refine, + const vp9_variance_fn_ptr_t *fn_ptr, + const int_mv *nb_full_mvs, int full_mv_num, + 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 d07d91774..1df69c9af 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2494,8 +2494,8 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, const int ph = num_4x4_blocks_high_lookup[bsize] << 2; MV pred_mv[3]; + int bestsme = INT_MAX; #if CONFIG_NON_GREEDY_MV - double bestsme; int_mv nb_full_mvs[NB_MVS_NUM]; const int nb_full_mv_num = NB_MVS_NUM; int gf_group_idx = cpi->twopass.gf_group.index; @@ -2506,7 +2506,6 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, vp9_prepare_nb_full_mvs(&cpi->tpl_stats[gf_group_idx], mi_row, mi_col, gf_rf_idx, square_bsize, nb_full_mvs); #else // CONFIG_NON_GREEDY_MV - int bestsme = INT_MAX; int sadpb = x->sadperbit16; #endif // CONFIG_NON_GREEDY_MV @@ -2592,11 +2591,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, if (cpi->sf.enhanced_full_pixel_motion_search) { int i; for (i = 0; i < 3; ++i) { -#if CONFIG_NON_GREEDY_MV - double this_me; -#else // CONFIG_NON_GREEDY_MV int this_me; -#endif // CONFIG_NON_GREEDY_MV MV this_mv; int diff_row; int diff_col; -- 2.40.0