diff options
author | Angie Chiang <angiebird@google.com> | 2018-09-25 15:26:33 -0700 |
---|---|---|
committer | Angie Chiang <angiebird@google.com> | 2018-09-25 17:05:06 -0700 |
commit | a7aca1b5affedad769df671bff63f0999cda0e62 (patch) | |
tree | 55ab4cf483208bbb9606e417b7e141e82761cf20 /vp9/encoder/vp9_mcomp.c | |
parent | 0b06f95d2a9c08819838aaf7f63d95c8a7c4a959 (diff) | |
download | libvpx-a7aca1b5affedad769df671bff63f0999cda0e62.tar.gz |
Add vp9_full_pixel_diamond_new
This function will call vp9_diaomond_search_sad_new /
vp9_refining_search_sad_new accordingly.
Change-Id: If96a8a1c9c06b6b4ed3aac6d59bdb03f20c96df9
Diffstat (limited to 'vp9/encoder/vp9_mcomp.c')
-rw-r--r-- | vp9/encoder/vp9_mcomp.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index c7ec149d3..97ec5e06e 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -1578,8 +1578,6 @@ static int exhuastive_mesh_search(const MACROBLOCK *x, MV *ref_mv, MV *best_mv, } #if CONFIG_NON_GREEDY_MV -#define NB_MVS_NUM 4 - static double nb_mvs_inconsistency(const MV *mv, const int_mv *nb_mvs, double lambda) { int i; @@ -2078,6 +2076,61 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, return best_sad; } +#if CONFIG_NON_GREEDY_MV +// Runs sequence of diamond searches in smaller steps for RD. +/* 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, 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) { + MV temp_mv; + int n, num00 = 0; + double thissme; + double bestsme = + vp9_diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, &temp_mv, + step_param, lambda, &n, fn_ptr, nb_full_mvs); + *dst_mv = temp_mv; + + // If there won't be more n-step search, check to see if refining search is + // needed. + if (n > further_steps) do_refine = 0; + + while (n < further_steps) { + ++n; + if (num00) { + num00--; + } else { + thissme = vp9_diamond_search_sad_new(x, &cpi->ss_cfg, mvp_full, &temp_mv, + step_param + n, lambda, &num00, + fn_ptr, nb_full_mvs); + // check to see if refining search is needed. + if (num00 > further_steps - n) do_refine = 0; + + if (thissme < bestsme) { + bestsme = thissme; + *dst_mv = temp_mv; + } + } + } + + // final 1-away diamond refining search + if (do_refine) { + const int search_range = 8; + MV best_mv = *dst_mv; + thissme = vp9_refining_search_sad_new(x, &best_mv, lambda, search_range, + fn_ptr, nb_full_mvs); + if (thissme < bestsme) { + bestsme = thissme; + *dst_mv = best_mv; + } + } + return bestsme; +} +#endif // CONFIG_NON_GREEDY_MV + // Runs sequence of diamond searches in smaller steps for RD. /* 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 |