Merge changes from topic 'vp9-enc-static-fns'

* changes:
  vp9_mcomp: make search functions private
  vp9_mbgraph: use vp9_full_pixel_search(HEX)
  vp9_temporal_filter: use vp9_full_pixel_search(HEX)
  vp9_firstpass: make vp9_init_subsampling private
  vp9_encoder: make vp9_alloc_compressor_data private
This commit is contained in:
James Zern 2015-08-29 03:25:29 +00:00 committed by Gerrit Code Review
commit cc29cebde6
8 changed files with 92 additions and 117 deletions

View File

@ -686,7 +686,7 @@ static int alloc_context_buffers_ext(VP9_COMP *cpi) {
return 0; return 0;
} }
void vp9_alloc_compressor_data(VP9_COMP *cpi) { static void alloc_compressor_data(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common; VP9_COMMON *cm = &cpi->common;
vp9_alloc_context_buffers(cm, cm->width, cm->height); vp9_alloc_context_buffers(cm, cm->width, cm->height);
@ -775,7 +775,7 @@ static void init_config(struct VP9_COMP *cpi, VP9EncoderConfig *oxcf) {
cm->width = oxcf->width; cm->width = oxcf->width;
cm->height = oxcf->height; cm->height = oxcf->height;
vp9_alloc_compressor_data(cpi); alloc_compressor_data(cpi);
cpi->svc.temporal_layering_mode = oxcf->temporal_layering_mode; cpi->svc.temporal_layering_mode = oxcf->temporal_layering_mode;
@ -1510,7 +1510,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
if (cpi->initial_width) { if (cpi->initial_width) {
if (cm->width > cpi->initial_width || cm->height > cpi->initial_height) { if (cm->width > cpi->initial_width || cm->height > cpi->initial_height) {
vp9_free_context_buffers(cm); vp9_free_context_buffers(cm);
vp9_alloc_compressor_data(cpi); alloc_compressor_data(cpi);
realloc_segmentation_maps(cpi); realloc_segmentation_maps(cpi);
cpi->initial_width = cpi->initial_height = 0; cpi->initial_width = cpi->initial_height = 0;
} }

View File

@ -605,8 +605,6 @@ int64_t vp9_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b); const YV12_BUFFER_CONFIG *b);
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
void vp9_alloc_compressor_data(VP9_COMP *cpi);
void vp9_scale_references(VP9_COMP *cpi); void vp9_scale_references(VP9_COMP *cpi);
void vp9_update_reference_frames(VP9_COMP *cpi); void vp9_update_reference_frames(VP9_COMP *cpi);

View File

@ -1237,7 +1237,7 @@ static void setup_rf_level_maxq(VP9_COMP *cpi) {
} }
} }
void vp9_init_subsampling(VP9_COMP *cpi) { static void init_subsampling(VP9_COMP *cpi) {
const VP9_COMMON *const cm = &cpi->common; const VP9_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc; RATE_CONTROL *const rc = &cpi->rc;
const int w = cm->width; const int w = cm->width;
@ -1332,7 +1332,7 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
twopass->last_kfgroup_zeromotion_pct = 100; twopass->last_kfgroup_zeromotion_pct = 100;
if (oxcf->resize_mode != RESIZE_NONE) { if (oxcf->resize_mode != RESIZE_NONE) {
vp9_init_subsampling(cpi); init_subsampling(cpi);
} }
} }

View File

@ -153,8 +153,6 @@ void vp9_twopass_postencode_update(struct VP9_COMP *cpi);
// Post encode update of the rate control parameters for 2-pass // Post encode update of the rate control parameters for 2-pass
void vp9_twopass_postencode_update(struct VP9_COMP *cpi); void vp9_twopass_postencode_update(struct VP9_COMP *cpi);
void vp9_init_subsampling(struct VP9_COMP *cpi);
void calculate_coded_size(struct VP9_COMP *cpi, void calculate_coded_size(struct VP9_COMP *cpi,
int *scaled_frame_width, int *scaled_frame_width,
int *scaled_frame_height); int *scaled_frame_height);

View File

@ -29,7 +29,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
int mb_col) { int mb_col) {
MACROBLOCK *const x = &cpi->td.mb; MACROBLOCK *const x = &cpi->td.mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv; MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
const SEARCH_METHODS old_search_method = mv_sf->search_method;
const vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16]; const vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
const int tmp_col_min = x->mv_col_min; const int tmp_col_min = x->mv_col_min;
@ -48,10 +49,11 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
ref_full.col = ref_mv->col >> 3; ref_full.col = ref_mv->col >> 3;
ref_full.row = ref_mv->row >> 3; ref_full.row = ref_mv->row >> 3;
/*cpi->sf.search_method == HEX*/ mv_sf->search_method = HEX;
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0, vp9_full_pixel_search(cpi, x, BLOCK_16X16, &ref_full, step_param,
cond_cost_list(cpi, cost_list), x->errorperbit, cond_cost_list(cpi, cost_list), ref_mv,
&v_fn_ptr, 0, ref_mv, dst_mv); dst_mv, 0, 0);
mv_sf->search_method = old_search_method;
// Try sub-pixel MC // Try sub-pixel MC
// if (bestsme > error_thresh && bestsme < INT_MAX) // if (bestsme > error_thresh && bestsme < INT_MAX)

View File

@ -1371,15 +1371,15 @@ int vp9_get_mvpred_av_var(const MACROBLOCK *x,
x->mvcost, x->errorperbit) : 0); x->mvcost, x->errorperbit) : 0);
} }
int vp9_hex_search(const MACROBLOCK *x, static int hex_search(const MACROBLOCK *x,
MV *ref_mv, MV *ref_mv,
int search_param, int search_param,
int sad_per_bit, int sad_per_bit,
int do_init_search, int do_init_search,
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *vfp, const vp9_variance_fn_ptr_t *vfp,
int use_mvcost, int use_mvcost,
const MV *center_mv, MV *best_mv) { const MV *center_mv, MV *best_mv) {
// First scale has 8-closest points, the rest have 6 points in hex shape // First scale has 8-closest points, the rest have 6 points in hex shape
// at increasing scales // at increasing scales
static const int hex_num_candidates[MAX_PATTERN_SCALES] = { static const int hex_num_candidates[MAX_PATTERN_SCALES] = {
@ -1406,16 +1406,16 @@ int vp9_hex_search(const MACROBLOCK *x,
hex_num_candidates, hex_candidates); hex_num_candidates, hex_candidates);
} }
int vp9_bigdia_search(const MACROBLOCK *x, static int bigdia_search(const MACROBLOCK *x,
MV *ref_mv, MV *ref_mv,
int search_param, int search_param,
int sad_per_bit, int sad_per_bit,
int do_init_search, int do_init_search,
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *vfp, const vp9_variance_fn_ptr_t *vfp,
int use_mvcost, int use_mvcost,
const MV *center_mv, const MV *center_mv,
MV *best_mv) { MV *best_mv) {
// First scale has 4-closest points, the rest have 8 points in diamond // First scale has 4-closest points, the rest have 8 points in diamond
// shape at increasing scales // shape at increasing scales
static const int bigdia_num_candidates[MAX_PATTERN_SCALES] = { static const int bigdia_num_candidates[MAX_PATTERN_SCALES] = {
@ -1448,16 +1448,16 @@ int vp9_bigdia_search(const MACROBLOCK *x,
bigdia_num_candidates, bigdia_candidates); bigdia_num_candidates, bigdia_candidates);
} }
int vp9_square_search(const MACROBLOCK *x, static int square_search(const MACROBLOCK *x,
MV *ref_mv, MV *ref_mv,
int search_param, int search_param,
int sad_per_bit, int sad_per_bit,
int do_init_search, int do_init_search,
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *vfp, const vp9_variance_fn_ptr_t *vfp,
int use_mvcost, int use_mvcost,
const MV *center_mv, const MV *center_mv,
MV *best_mv) { MV *best_mv) {
// All scales have 8 closest points in square shape // All scales have 8 closest points in square shape
static const int square_num_candidates[MAX_PATTERN_SCALES] = { static const int square_num_candidates[MAX_PATTERN_SCALES] = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@ -1490,32 +1490,32 @@ int vp9_square_search(const MACROBLOCK *x,
square_num_candidates, square_candidates); square_num_candidates, square_candidates);
} }
int vp9_fast_hex_search(const MACROBLOCK *x, static int fast_hex_search(const MACROBLOCK *x,
MV *ref_mv, MV *ref_mv,
int search_param, int search_param,
int sad_per_bit, int sad_per_bit,
int do_init_search, // must be zero for fast_hex int do_init_search, // must be zero for fast_hex
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *vfp, const vp9_variance_fn_ptr_t *vfp,
int use_mvcost, int use_mvcost,
const MV *center_mv, const MV *center_mv,
MV *best_mv) { MV *best_mv) {
return vp9_hex_search(x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), return hex_search(x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param),
sad_per_bit, do_init_search, cost_list, vfp, use_mvcost, sad_per_bit, do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv); center_mv, best_mv);
} }
int vp9_fast_dia_search(const MACROBLOCK *x, static int fast_dia_search(const MACROBLOCK *x,
MV *ref_mv, MV *ref_mv,
int search_param, int search_param,
int sad_per_bit, int sad_per_bit,
int do_init_search, int do_init_search,
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *vfp, const vp9_variance_fn_ptr_t *vfp,
int use_mvcost, int use_mvcost,
const MV *center_mv, const MV *center_mv,
MV *best_mv) { MV *best_mv) {
return vp9_bigdia_search( return bigdia_search(
x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit, x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit,
do_init_search, cost_list, vfp, use_mvcost, center_mv, best_mv); do_init_search, cost_list, vfp, use_mvcost, center_mv, best_mv);
} }
@ -1946,15 +1946,16 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
return best_sad; return best_sad;
} }
// 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 /* 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 point as the best match, we will do a final 1-away diamond
refining search */ refining search */
int vp9_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x, static int full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x,
MV *mvp_full, int step_param, MV *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine, int sadpb, int further_steps, int do_refine,
int *cost_list, int *cost_list,
const vp9_variance_fn_ptr_t *fn_ptr, const vp9_variance_fn_ptr_t *fn_ptr,
const MV *ref_mv, MV *dst_mv) { const MV *ref_mv, MV *dst_mv) {
MV temp_mv; MV temp_mv;
int thissme, n, num00 = 0; int thissme, n, num00 = 0;
int bestsme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv, int bestsme = cpi->diamond_search_sad(x, &cpi->ss_cfg, mvp_full, &temp_mv,
@ -2346,29 +2347,29 @@ int vp9_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
switch (method) { switch (method) {
case FAST_DIAMOND: case FAST_DIAMOND:
var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0, var = fast_dia_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv); cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break; break;
case FAST_HEX: case FAST_HEX:
var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0, var = fast_hex_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv); cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break; break;
case HEX: case HEX:
var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1, var = hex_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv); cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break; break;
case SQUARE: case SQUARE:
var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1, var = square_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv); cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break; break;
case BIGDIA: case BIGDIA:
var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1, var = bigdia_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv); cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break; break;
case NSTEP: case NSTEP:
var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, var = full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
MAX_MVSEARCH_STEPS - 1 - step_param, MAX_MVSEARCH_STEPS - 1 - step_param,
1, cost_list, fn_ptr, ref_mv, tmp_mv); 1, cost_list, fn_ptr, ref_mv, tmp_mv);
break; break;
default: default:
assert(0 && "Invalid search method."); assert(0 && "Invalid search method.");

View File

@ -72,38 +72,12 @@ int vp9_refining_search_sad(const struct macroblock *x,
const struct vp9_variance_vtable *fn_ptr, const struct vp9_variance_vtable *fn_ptr,
const struct mv *center_mv); const struct mv *center_mv);
// Runs sequence of diamond searches in smaller steps for RD.
int vp9_full_pixel_diamond(const struct VP9_COMP *cpi, MACROBLOCK *x,
MV *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine,
int *cost_list,
const vp9_variance_fn_ptr_t *fn_ptr,
const MV *ref_mv, MV *dst_mv);
// Perform integral projection based motion estimation. // Perform integral projection based motion estimation.
unsigned int vp9_int_pro_motion_estimation(const struct VP9_COMP *cpi, unsigned int vp9_int_pro_motion_estimation(const struct VP9_COMP *cpi,
MACROBLOCK *x, MACROBLOCK *x,
BLOCK_SIZE bsize, BLOCK_SIZE bsize,
int mi_row, int mi_col); int mi_row, int mi_col);
typedef int (integer_mv_pattern_search_fn) (
const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int error_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vf,
int use_mvcost,
const MV *center_mv,
MV *best_mv);
integer_mv_pattern_search_fn vp9_hex_search;
integer_mv_pattern_search_fn vp9_bigdia_search;
integer_mv_pattern_search_fn vp9_square_search;
integer_mv_pattern_search_fn vp9_fast_hex_search;
integer_mv_pattern_search_fn vp9_fast_dia_search;
typedef int (fractional_mv_step_fp) ( typedef int (fractional_mv_step_fp) (
const MACROBLOCK *x, const MACROBLOCK *x,
MV *bestmv, const MV *ref_mv, MV *bestmv, const MV *ref_mv,

View File

@ -216,7 +216,8 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
int stride) { int stride) {
MACROBLOCK *const x = &cpi->td.mb; MACROBLOCK *const x = &cpi->td.mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv; MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
const SEARCH_METHODS old_search_method = mv_sf->search_method;
int step_param; int step_param;
int sadpb = x->sadperbit16; int sadpb = x->sadperbit16;
int bestsme = INT_MAX; int bestsme = INT_MAX;
@ -244,10 +245,11 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
step_param = mv_sf->reduce_first_step_size; step_param = mv_sf->reduce_first_step_size;
step_param = VPXMIN(step_param, MAX_MVSEARCH_STEPS - 2); step_param = VPXMIN(step_param, MAX_MVSEARCH_STEPS - 2);
// Ignore mv costing by sending NULL pointer instead of cost arrays mv_sf->search_method = HEX;
vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1, vp9_full_pixel_search(cpi, x, BLOCK_16X16, &best_ref_mv1_full, step_param,
cond_cost_list(cpi, cost_list), sadpb, cond_cost_list(cpi, cost_list), &best_ref_mv1,
&cpi->fn_ptr[BLOCK_16X16], 0, &best_ref_mv1, ref_mv); ref_mv, 0, 0);
mv_sf->search_method = old_search_method;
// Ignore mv costing by sending NULL pointer instead of cost array // Ignore mv costing by sending NULL pointer instead of cost array
bestsme = cpi->find_fractional_mv_step(x, ref_mv, bestsme = cpi->find_fractional_mv_step(x, ref_mv,