Commit e606cac0 authored by Paul Wilkins's avatar Paul Wilkins
Browse files

Change meaning of cpi->sf.first_step and rename.

Renamed cpi->sf.first_step to cpi->sf.reduce_first_step_size
and changed its meaning such that it is a delta applied to
reduce the default first step size (>> x) in the motion search
rather than an absolute value.

The default first step size is already changed according to the image
dimensions (smaller for smaller images). cpi->sf.reduce_first_step_size
now applies a further correction from the default.

Change-Id: Ia94e08bc24c67b604831f980909af7e982fcd16d
parent 2291563b
......@@ -35,8 +35,9 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
int_mv ref_full;
// Further step/diamond searches as necessary
int step_param = cpi->sf.first_step +
int step_param = cpi->sf.reduce_first_step_size +
(cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
vp9_clamp_mv_min_max(x, ref_mv);
......
......@@ -38,16 +38,17 @@ void vp9_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv) {
x->mv_row_max = row_max;
}
int vp9_init_search_range(int width, int height) {
int vp9_init_search_range(VP9_COMP *cpi, int size) {
int sr = 0;
int frm = MIN(width, height);
while ((frm << sr) < MAX_FULL_PEL_VAL)
while ((size << sr) < MAX_FULL_PEL_VAL)
sr++;
if (sr)
sr--;
sr += cpi->sf.reduce_first_step_size;
sr = MIN(sr, (cpi->sf.max_step_search_steps - 2));
return sr;
}
......
......@@ -24,15 +24,15 @@
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))
void vp9_clamp_mv_min_max(MACROBLOCK *x, int_mv *ref_mv);
int vp9_init_search_range(int width, int height);
int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost,
int *mvcost[2], int weight, int ishp);
void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
void vp9_init3smotion_compensation(MACROBLOCK *x, int stride);
// Runs sequence of diamond searches in smaller steps for RD
struct VP9_COMP;
int vp9_init_search_range(struct VP9_COMP *cpi, int size);
// Runs sequence of diamond searches in smaller steps for RD
int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x,
int_mv *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine,
......
......@@ -680,7 +680,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->half_pixel_search = 1;
sf->iterative_sub_pixel = 1;
sf->optimize_coefficients = !cpi->oxcf.lossless;
sf->first_step = 0;
sf->reduce_first_step_size = 0;
sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_AB4X4;
sf->adpative_rd_thresh = 0;
......@@ -721,7 +721,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
if (speed == 1) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES;
sf->optimize_coefficients = 0;
sf->first_step = 1;
sf->reduce_first_step_size = 1;
sf->use_avoid_tested_higherror = 1;
sf->adjust_thresholds_by_speed = 1;
sf->use_largest_txform = !(cpi->common.frame_type == KEY_FRAME ||
......@@ -731,27 +731,27 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
if (speed == 2) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
sf->use_lastframe_partitioning = 1;
sf->first_step = 0;
sf->reduce_first_step_size = 0;
}
if (speed == 3) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
sf->partition_by_variance = 1;
sf->first_step = 0;
sf->reduce_first_step_size = 0;
}
if (speed == 4) {
sf->first_step = 0;
sf->reduce_first_step_size = 0;
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
sf->use_one_partition_size_always = 1;
sf->always_this_block_size = BLOCK_SIZE_MB16X16;
}
if (speed == 2) {
sf->first_step = 0;
sf->reduce_first_step_size = 0;
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
sf->use_partitions_less_than = 1;
sf->less_than_block_size = BLOCK_SIZE_MB16X16;
}
if (speed == 3) {
sf->first_step = 0;
sf->reduce_first_step_size = 0;
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
sf->use_partitions_greater_than = 1;
sf->greater_than_block_size = BLOCK_SIZE_SB8X8;
......
......@@ -210,7 +210,7 @@ typedef struct {
int quarter_pixel_search;
int thresh_mult[MAX_MODES];
int max_step_search_steps;
int first_step;
int reduce_first_step_size;
int optimize_coefficients;
int search_best_filter;
int static_segmentation;
......
......@@ -1989,12 +1989,11 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}};
int bestsme = INT_MAX;
int further_steps, step_param = cpi->sf.first_step;
int further_steps, step_param;
int sadpb = x->sadperbit16;
int_mv mvp_full;
int ref = mbmi->ref_frame[0];
int_mv ref_mv = mbmi->ref_mvs[ref][0];
int sr = 0;
const enum BlockSize block_size = get_plane_block_size(bsize, &xd->plane[0]);
int tmp_col_min = x->mv_col_min;
......@@ -2018,7 +2017,8 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
vp9_clamp_mv_min_max(x, &ref_mv);
sr = vp9_init_search_range(cpi->common.width, cpi->common.height);
step_param = vp9_init_search_range(
cpi, MIN(cpi->common.width, cpi->common.height));
// mvp_full.as_int = ref_mv[0].as_int;
mvp_full.as_int =
......@@ -2027,9 +2027,6 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mvp_full.as_mv.col >>= 3;
mvp_full.as_mv.row >>= 3;
// adjust search range according to sr from mv prediction
step_param = MAX(step_param, sr);
// Further step/diamond searches as necessary
further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
......
......@@ -148,9 +148,10 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
// Further step/diamond searches as necessary
if (cpi->speed < 8)
step_param = cpi->sf.first_step + ((cpi->speed > 5) ? 1 : 0);
step_param = cpi->sf.reduce_first_step_size + ((cpi->speed > 5) ? 1 : 0);
else
step_param = cpi->sf.first_step + 2;
step_param = cpi->sf.reduce_first_step_size + 2;
step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
/*cpi->sf.search_method == HEX*/
// TODO Check that the 16x16 vf & sdf are selected here
......
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