Commit cc29cebd authored by James Zern's avatar James Zern Committed by Gerrit Code Review
Browse files

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
parents 6d585393 ff03d544
......@@ -686,7 +686,7 @@ static int alloc_context_buffers_ext(VP9_COMP *cpi) {
return 0;
}
void vp9_alloc_compressor_data(VP9_COMP *cpi) {
static void alloc_compressor_data(VP9_COMP *cpi) {
VP9_COMMON *cm = &cpi->common;
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->height = oxcf->height;
vp9_alloc_compressor_data(cpi);
alloc_compressor_data(cpi);
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 (cm->width > cpi->initial_width || cm->height > cpi->initial_height) {
vp9_free_context_buffers(cm);
vp9_alloc_compressor_data(cpi);
alloc_compressor_data(cpi);
realloc_segmentation_maps(cpi);
cpi->initial_width = cpi->initial_height = 0;
}
......
......@@ -605,8 +605,6 @@ int64_t vp9_highbd_get_y_sse(const YV12_BUFFER_CONFIG *a,
const YV12_BUFFER_CONFIG *b);
#endif // CONFIG_VP9_HIGHBITDEPTH
void vp9_alloc_compressor_data(VP9_COMP *cpi);
void vp9_scale_references(VP9_COMP *cpi);
void vp9_update_reference_frames(VP9_COMP *cpi);
......
......@@ -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;
RATE_CONTROL *const rc = &cpi->rc;
const int w = cm->width;
......@@ -1332,7 +1332,7 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
twopass->last_kfgroup_zeromotion_pct = 100;
if (oxcf->resize_mode != RESIZE_NONE) {
vp9_init_subsampling(cpi);
init_subsampling(cpi);
}
}
......
......@@ -153,8 +153,6 @@ void vp9_twopass_postencode_update(struct VP9_COMP *cpi);
// Post encode update of the rate control parameters for 2-pass
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,
int *scaled_frame_width,
int *scaled_frame_height);
......
......@@ -29,7 +29,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
int mb_col) {
MACROBLOCK *const x = &cpi->td.mb;
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 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.row = ref_mv->row >> 3;
/*cpi->sf.search_method == HEX*/
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0,
cond_cost_list(cpi, cost_list),
&v_fn_ptr, 0, ref_mv, dst_mv);
mv_sf->search_method = HEX;
vp9_full_pixel_search(cpi, x, BLOCK_16X16, &ref_full, step_param,
x->errorperbit, cond_cost_list(cpi, cost_list), ref_mv,
dst_mv, 0, 0);
mv_sf->search_method = old_search_method;
// Try sub-pixel MC
// if (bestsme > error_thresh && bestsme < INT_MAX)
......
......@@ -1371,15 +1371,15 @@ int vp9_get_mvpred_av_var(const MACROBLOCK *x,
x->mvcost, x->errorperbit) : 0);
}
int vp9_hex_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv, MV *best_mv) {
static int hex_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv, MV *best_mv) {
// First scale has 8-closest points, the rest have 6 points in hex shape
// at increasing 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);
}
int vp9_bigdia_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
static int bigdia_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
// First scale has 4-closest points, the rest have 8 points in diamond
// shape at increasing 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);
}
int vp9_square_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
static int square_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
// All scales have 8 closest points in square shape
static const int square_num_candidates[MAX_PATTERN_SCALES] = {
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);
}
int vp9_fast_hex_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search, // must be zero for fast_hex
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return vp9_hex_search(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);
static int fast_hex_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search, // must be zero for fast_hex
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return hex_search(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);
}
int vp9_fast_dia_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return vp9_bigdia_search(
static int fast_dia_search(const MACROBLOCK *x,
MV *ref_mv,
int search_param,
int sad_per_bit,
int do_init_search,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
return bigdia_search(
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);
}
......@@ -1946,15 +1946,16 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
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
point as the best match, we will do a final 1-away diamond
refining search */
int vp9_full_pixel_diamond(const 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) {
static int full_pixel_diamond(const 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) {
MV temp_mv;
int thissme, n, num00 = 0;
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) {
case FAST_DIAMOND:
var = vp9_fast_dia_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
var = fast_dia_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case FAST_HEX:
var = vp9_fast_hex_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
var = fast_hex_search(x, mvp_full, step_param, error_per_bit, 0,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case HEX:
var = vp9_hex_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
var = hex_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case SQUARE:
var = vp9_square_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
var = square_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case BIGDIA:
var = vp9_bigdia_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
var = bigdia_search(x, mvp_full, step_param, error_per_bit, 1,
cost_list, fn_ptr, 1, ref_mv, tmp_mv);
break;
case NSTEP:
var = vp9_full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
MAX_MVSEARCH_STEPS - 1 - step_param,
1, cost_list, fn_ptr, ref_mv, tmp_mv);
var = full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit,
MAX_MVSEARCH_STEPS - 1 - step_param,
1, cost_list, fn_ptr, ref_mv, tmp_mv);
break;
default:
assert(0 && "Invalid search method.");
......
......@@ -72,38 +72,12 @@ int vp9_refining_search_sad(const struct macroblock *x,
const struct vp9_variance_vtable *fn_ptr,
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.
unsigned int vp9_int_pro_motion_estimation(const struct VP9_COMP *cpi,
MACROBLOCK *x,
BLOCK_SIZE bsize,
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) (
const MACROBLOCK *x,
MV *bestmv, const MV *ref_mv,
......
......@@ -216,7 +216,8 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
int stride) {
MACROBLOCK *const x = &cpi->td.mb;
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 sadpb = x->sadperbit16;
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 = VPXMIN(step_param, MAX_MVSEARCH_STEPS - 2);
// Ignore mv costing by sending NULL pointer instead of cost arrays
vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
cond_cost_list(cpi, cost_list),
&cpi->fn_ptr[BLOCK_16X16], 0, &best_ref_mv1, ref_mv);
mv_sf->search_method = HEX;
vp9_full_pixel_search(cpi, x, BLOCK_16X16, &best_ref_mv1_full, step_param,
sadpb, cond_cost_list(cpi, cost_list), &best_ref_mv1,
ref_mv, 0, 0);
mv_sf->search_method = old_search_method;
// Ignore mv costing by sending NULL pointer instead of cost array
bestsme = cpi->find_fractional_mv_step(x, ref_mv,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment