Commit 71b43b0f authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Clean ups of the subpel search functions

Removes some unused code and speed features, and organizes the
interfaces for fractional mv step functions for use in new speed
features to come.

In the process a new speed feature - number of iterations per
step during the subpel search - is exposed.

No change when this parameter is set as the original value of 3.

Results:
subpel_iters_per_step = 3: baseline
subpel_iters_per_step = 2: psnr -0.067%, 1% speedup
subpel_iters_per_step = 1: psnr -0.331%, 3-4% speedup

Change-Id: I2eba8a21f6461be8caf56af04a5337257a5693a8
parent fac7c8c9
......@@ -59,7 +59,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
x,
dst_mv, ref_mv,
x->errorperbit, &v_fn_ptr,
NULL, NULL,
0, cpi->sf.subpel_iters_per_step, NULL, NULL,
& distortion, &sse);
}
......
This diff is collapsed.
......@@ -67,12 +67,19 @@ int vp9_square_search(MACROBLOCK *x,
int_mv *center_mv,
int_mv *best_mv);
typedef int (fractional_mv_step_fp) (MACROBLOCK *x, int_mv
*bestmv, int_mv *ref_mv, int error_per_bit, const vp9_variance_fn_ptr_t *vfp,
int *mvjcost, int *mvcost[2], int *distortion, unsigned int *sse);
extern fractional_mv_step_fp vp9_find_best_sub_pixel_step_iteratively;
extern fractional_mv_step_fp vp9_find_best_sub_pixel_step;
extern fractional_mv_step_fp vp9_find_best_half_pixel_step;
typedef int (fractional_mv_step_fp) (
MACROBLOCK *x,
int_mv *bestmv,
int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
int iters_per_step,
int *mvjcost,
int *mvcost[2],
int *distortion,
unsigned int *sse);
extern fractional_mv_step_fp vp9_find_best_sub_pixel_iterative;
typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x,
int_mv *ref_mv, int sad_per_bit,
......@@ -95,14 +102,17 @@ typedef int (*vp9_diamond_search_fn_t)(MACROBLOCK *x,
int *mvjcost, int *mvcost[2],
int_mv *center_mv);
int vp9_find_best_sub_pixel_comp(MACROBLOCK *x,
int_mv *bestmv, int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred,
int w, int h);
int vp9_find_best_sub_pixel_comp_iterative(
MACROBLOCK *x,
int_mv *bestmv, int_mv *ref_mv,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
int iters_per_step,
int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred,
int w, int h);
int vp9_refining_search_8p_c(MACROBLOCK *x,
int_mv *ref_mv, int error_per_bit,
......
......@@ -713,9 +713,8 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->search_method = NSTEP;
sf->auto_filter = 1;
sf->recode_loop = 1;
sf->quarter_pixel_search = 1;
sf->half_pixel_search = 1;
sf->iterative_sub_pixel = 1;
sf->subpel_search_method = SUBPEL_ITERATIVE;
sf->subpel_iters_per_step = 3;
sf->optimize_coefficients = !cpi->oxcf.lossless;
sf->reduce_first_step_size = 0;
sf->auto_mv_step_size = 0;
......@@ -831,6 +830,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
(MIN(cpi->common.width, cpi->common.height) >= 720)? 1 : 0;
sf->auto_mv_step_size = 1;
sf->search_method = SQUARE;
sf->subpel_iters_per_step = 2;
}
if (speed == 3) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES;
......@@ -851,6 +851,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->disable_splitmv = 1;
sf->auto_mv_step_size = 1;
sf->search_method = BIGDIA;
sf->subpel_iters_per_step = 1;
}
if (speed == 4) {
sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES;
......@@ -875,6 +876,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->disable_splitmv = 1;
sf->search_method = HEX;
sf->subpel_iters_per_step = 1;
}
/*
if (speed == 2) {
......@@ -918,12 +920,11 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
cpi->mb.quantize_b_4x4 = vp9_regular_quantize_b_4x4;
if (cpi->sf.iterative_sub_pixel == 1) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_step_iteratively;
} else if (cpi->sf.quarter_pixel_search) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_step;
} else if (cpi->sf.half_pixel_search) {
cpi->find_fractional_mv_step = vp9_find_best_half_pixel_step;
if (cpi->sf.subpel_search_method == SUBPEL_ITERATIVE) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_iterative;
} else {
// TODO(debargha): Other methods to come
assert(0);
}
cpi->mb.optimize = cpi->sf.optimize_coefficients == 1 && cpi->pass != 1;
......
......@@ -232,14 +232,18 @@ typedef enum {
FLAG_SKIP_INTRA_LOWVAR = 32,
} MODE_SEARCH_SKIP_LOGIC;
typedef enum {
SUBPEL_ITERATIVE = 0,
// Other methods to come
} SUBPEL_SEARCH_METHODS;
typedef struct {
int RD;
SEARCH_METHODS search_method;
int auto_filter;
int recode_loop;
int iterative_sub_pixel;
int half_pixel_search;
int quarter_pixel_search;
SUBPEL_SEARCH_METHODS subpel_search_method;
int subpel_iters_per_step;
int thresh_mult[MAX_MODES];
int max_step_search_steps;
int reduce_first_step_size;
......
......@@ -1967,6 +1967,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
unsigned int sse;
cpi->find_fractional_mv_step(x, &mode_mv[NEWMV],
bsi->ref_mv, x->errorperbit, v_fn_ptr,
0, cpi->sf.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&distortion, &sse);
......@@ -2547,6 +2548,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
cpi->find_fractional_mv_step(x, tmp_mv, &ref_mv,
x->errorperbit,
&cpi->fn_ptr[block_size],
0, cpi->sf.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&dis, &sse);
}
......@@ -2673,13 +2675,15 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int dis; /* TODO: use dis in distortion calculation later. */
unsigned int sse;
bestsme = vp9_find_best_sub_pixel_comp(x, &tmp_mv,
&ref_mv[id],
x->errorperbit,
&cpi->fn_ptr[block_size],
x->nmvjointcost, x->mvcost,
&dis, &sse, second_pred,
pw, ph);
bestsme = vp9_find_best_sub_pixel_comp_iterative(
x, &tmp_mv,
&ref_mv[id],
x->errorperbit,
&cpi->fn_ptr[block_size],
0, cpi->sf.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&dis, &sse, second_pred,
pw, ph);
}
if (id)
......
......@@ -170,6 +170,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
&best_ref_mv1,
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
0, cpi->sf.subpel_iters_per_step,
NULL, NULL,
&distortion, &sse);
}
......
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