From: Dmitry Kovalev Date: Thu, 1 May 2014 23:36:51 +0000 (-0700) Subject: Using SPEED_FEATURES instead of VP9_COMP in vp9_init_search_range(). X-Git-Tag: v1.4.0~1645^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d9d5df26366c3ffa5676e8e194b6281353c124a;p=libvpx Using SPEED_FEATURES instead of VP9_COMP in vp9_init_search_range(). Change-Id: I961d50d6fafdd37ef7f23f0a871d28e28d2084ca --- diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 395d26aef..0fb00f13f 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -2097,7 +2097,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, cm->lf.mode_ref_delta_update = 0; // Initialize cpi->mv_step_param to default based on max resolution. - cpi->mv_step_param = vp9_init_search_range(cpi, max_mv_def); + cpi->mv_step_param = vp9_init_search_range(sf, max_mv_def); // Initialize cpi->max_mv_magnitude and cpi->mv_step_param if appropriate. if (sf->auto_mv_step_size) { if (frame_is_intra_only(cm)) { @@ -2109,7 +2109,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, // Allow mv_steps to correspond to twice the max mv magnitude found // in the previous frame, capped by the default max_mv_magnitude based // on resolution. - cpi->mv_step_param = vp9_init_search_range(cpi, MIN(max_mv_def, 2 * + cpi->mv_step_param = vp9_init_search_range(sf, MIN(max_mv_def, 2 * cpi->max_mv_magnitude)); cpi->max_mv_magnitude = 0; } diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index bbec4da76..5cd9fc7d7 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -51,7 +51,7 @@ void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) { x->mv_row_max = row_max; } -int vp9_init_search_range(VP9_COMP *cpi, int size) { +int vp9_init_search_range(const SPEED_FEATURES *sf, int size) { int sr = 0; // Minimum search size no matter what the passed in value. @@ -60,8 +60,8 @@ int vp9_init_search_range(VP9_COMP *cpi, int size) { while ((size << sr) < MAX_FULL_PEL_VAL) sr++; - sr += cpi->sf.reduce_first_step_size; - sr = MIN(sr, (cpi->sf.max_step_search_steps - 2)); + sr += sf->reduce_first_step_size; + sr = MIN(sr, (sf->max_step_search_steps - 2)); return sr; } diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h index 1f524f1f6..827957d62 100644 --- a/vp9/encoder/vp9_mcomp.h +++ b/vp9/encoder/vp9_mcomp.h @@ -62,7 +62,9 @@ int vp9_get_mvpred_av_var(const MACROBLOCK *x, int use_mvcost); struct VP9_COMP; -int vp9_init_search_range(struct VP9_COMP *cpi, int size); +struct SPEED_FEATURES; + +int vp9_init_search_range(const struct SPEED_FEATURES *sf, int size); // Runs sequence of diamond searches in smaller steps for RD int vp9_full_pixel_diamond(const struct VP9_COMP *cpi, MACROBLOCK *x, diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index f309aac96..1f4a7d652 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1836,8 +1836,8 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, // Take wtd average of the step_params based on the last frame's // max mv magnitude and the best ref mvs of the current block for // the given reference. - step_param = (vp9_init_search_range(cpi, max_mv) + - cpi->mv_step_param) >> 1; + step_param = (vp9_init_search_range(&cpi->sf, max_mv) + + cpi->mv_step_param) / 2; } else { step_param = cpi->mv_step_param; } @@ -2389,8 +2389,8 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, // Take wtd average of the step_params based on the last frame's // max mv magnitude and that based on the best ref mvs of the current // block for the given reference. - step_param = (vp9_init_search_range(cpi, x->max_mv_context[ref]) + - cpi->mv_step_param) >> 1; + step_param = (vp9_init_search_range(&cpi->sf, x->max_mv_context[ref]) + + cpi->mv_step_param) / 2; } else { step_param = cpi->mv_step_param; } diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h index cff99a6dc..a384a4360 100644 --- a/vp9/encoder/vp9_speed_features.h +++ b/vp9/encoder/vp9_speed_features.h @@ -129,7 +129,7 @@ typedef enum { ONE_LOOP_REDUCED = 2 } FAST_COEFF_UPDATE; -typedef struct { +typedef struct SPEED_FEATURES { // Frame level coding parameter update int frame_parameter_update;