Merge "Cleaning up full_pixel_search()."

This commit is contained in:
Dmitry Kovalev 2014-06-03 10:22:35 -07:00 committed by Gerrit Code Review
commit 7106f709fc

View File

@ -99,41 +99,44 @@ static INLINE int full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
int step_param, int error_per_bit, int step_param, int error_per_bit,
const MV *ref_mv, MV *tmp_mv, const MV *ref_mv, MV *tmp_mv,
int var_max, int rd) { int var_max, int rd) {
const SPEED_FEATURES *const sf = &cpi->sf;
const SEARCH_METHODS method = sf->search_method;
vp9_variance_fn_ptr_t *fn_ptr = &cpi->fn_ptr[bsize];
int var = 0; int var = 0;
if (cpi->sf.search_method == FAST_DIAMOND) { switch (method) {
var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0, case FAST_DIAMOND:
&cpi->fn_ptr[bsize], 1, ref_mv, tmp_mv); var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0,
if (rd && var < var_max) fn_ptr, 1, ref_mv, tmp_mv);
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, &cpi->fn_ptr[bsize], 1); break;
} else if (cpi->sf.search_method == FAST_HEX) { case FAST_HEX:
var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0, var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0,
&cpi->fn_ptr[bsize], 1, ref_mv, tmp_mv); fn_ptr, 1, ref_mv, tmp_mv);
if (rd && var < var_max) break;
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, &cpi->fn_ptr[bsize], 1); case HEX:
} else if (cpi->sf.search_method == HEX) { var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1,
var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1, fn_ptr, 1, ref_mv, tmp_mv);
&cpi->fn_ptr[bsize], 1, ref_mv, tmp_mv); break;
if (rd && var < var_max) case SQUARE:
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, &cpi->fn_ptr[bsize], 1); var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1,
} else if (cpi->sf.search_method == SQUARE) { fn_ptr, 1, ref_mv, tmp_mv);
var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, break;
&cpi->fn_ptr[bsize], 1, ref_mv, tmp_mv); case BIGDIA:
if (rd && var < var_max) var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1,
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, &cpi->fn_ptr[bsize], 1); fn_ptr, 1, ref_mv, tmp_mv);
} else if (cpi->sf.search_method == BIGDIA) { break;
var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, case NSTEP:
&cpi->fn_ptr[bsize], 1, ref_mv, tmp_mv); var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
if (rd && var < var_max) (sf->max_step_search_steps - 1) - step_param,
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, &cpi->fn_ptr[bsize], 1); 1, fn_ptr, ref_mv, tmp_mv);
} else { break;
int further_steps = (cpi->sf.max_step_search_steps - 1) - step_param; default:
assert(!"Invalid search method.");
var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
further_steps, 1, &cpi->fn_ptr[bsize],
ref_mv, tmp_mv);
} }
if (method != NSTEP && rd && var < var_max)
var = vp9_get_mvpred_var(x, tmp_mv, ref_mv, fn_ptr, 1);
return var; return var;
} }