Commit bb2a9abb authored by Deb Mukherjee's avatar Deb Mukherjee Committed by Gerrit Code Review

Merge "Updates vp9_pattern search to return integer sads"

parents c4c0b2e7 04b100b2
......@@ -523,6 +523,10 @@ static INLINE int get_chessboard_index(const int frame_index) {
return frame_index & 0x1;
}
static INLINE int *cond_sad_list(const struct VP9_COMP *cpi, int *sad_list) {
return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? sad_list : NULL;
}
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -34,6 +34,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
const int tmp_row_min = x->mv_row_min;
const int tmp_row_max = x->mv_row_max;
MV ref_full;
int sad_list[5];
// Further step/diamond searches as necessary
int step_param = mv_sf->reduce_first_step_size;
......@@ -45,8 +46,9 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
ref_full.row = ref_mv->row >> 3;
/*cpi->sf.search_method == HEX*/
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0, &v_fn_ptr, 0,
ref_mv, dst_mv);
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0,
cond_sad_list(cpi, sad_list),
&v_fn_ptr, 0, ref_mv, dst_mv);
// Try sub-pixel MC
// if (bestsme > error_thresh && bestsme < INT_MAX)
......@@ -55,8 +57,10 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
unsigned int sse;
cpi->find_fractional_mv_step(
x, dst_mv, ref_mv, cpi->common.allow_high_precision_mv, x->errorperbit,
&v_fn_ptr, 0, mv_sf->subpel_iters_per_step, NULL, NULL, &distortion,
&sse, NULL, 0, 0);
&v_fn_ptr, 0, mv_sf->subpel_iters_per_step,
cond_sad_list(cpi, sad_list),
NULL, NULL,
&distortion, &sse, NULL, 0, 0);
}
xd->mi[0]->mbmi.mode = NEWMV;
......
This diff is collapsed.
......@@ -79,6 +79,7 @@ typedef int (integer_mv_pattern_search_fn) (
int search_param,
int error_per_bit,
int do_init_search,
int *sad_list,
const vp9_variance_fn_ptr_t *vf,
int use_mvcost,
const MV *center_mv,
......@@ -98,12 +99,14 @@ typedef int (fractional_mv_step_fp) (
const vp9_variance_fn_ptr_t *vfp,
int forced_stop, // 0 - full, 1 - qtr only, 2 - half only
int iters_per_step,
int *sad_list,
int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred,
int w, int h);
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree;
extern fractional_mv_step_fp vp9_find_best_sub_pixel_tree_pruned;
typedef int (*vp9_full_search_fn_t)(const MACROBLOCK *x,
const MV *ref_mv, int sad_per_bit,
......@@ -136,8 +139,10 @@ struct VP9_COMP;
int vp9_full_pixel_search(struct VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full,
int step_param, int error_per_bit,
int *sad_list,
const MV *ref_mv, MV *tmp_mv,
int var_max, int rd);
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -126,6 +126,7 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
const int tmp_row_min = x->mv_row_min;
const int tmp_row_max = x->mv_row_max;
int rv = 0;
int sad_list[5];
const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
ref);
if (cpi->common.show_frame &&
......@@ -152,8 +153,9 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mvp_full.col >>= 3;
mvp_full.row >>= 3;
vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param, sadpb, &ref_mv,
&tmp_mv->as_mv, INT_MAX, 0);
vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param, sadpb,
cond_sad_list(cpi, sad_list),
&ref_mv, &tmp_mv->as_mv, INT_MAX, 0);
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
......@@ -179,6 +181,7 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
&cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
cond_sad_list(cpi, sad_list),
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref], NULL, 0, 0);
x->pred_mv[ref] = tmp_mv->as_mv;
......
......@@ -1378,6 +1378,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
int sadpb = x->sadperbit4;
MV mvp_full;
int max_mv;
int sad_list[5];
/* Is the best so far sufficiently good that we cant justify doing
* and new motion search. */
......@@ -1421,9 +1422,11 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
vp9_set_mv_search_range(x, &bsi->ref_mv[0]->as_mv);
bestsme = vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param,
sadpb, &bsi->ref_mv[0]->as_mv, new_mv,
INT_MAX, 1);
bestsme = vp9_full_pixel_search(
cpi, x, bsize, &mvp_full, step_param, sadpb,
cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? sad_list : NULL,
&bsi->ref_mv[0]->as_mv, new_mv,
INT_MAX, 1);
// Should we do a full search (best quality only)
if (cpi->oxcf.mode == BEST) {
......@@ -1435,6 +1438,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
sadpb, 16, &cpi->fn_ptr[bsize],
&bsi->ref_mv[0]->as_mv,
&best_mv->as_mv);
sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = INT_MAX;
if (thissme < bestsme) {
bestsme = thissme;
*new_mv = best_mv->as_mv;
......@@ -1447,17 +1451,19 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (bestsme < INT_MAX) {
int distortion;
cpi->find_fractional_mv_step(x,
new_mv,
&bsi->ref_mv[0]->as_mv,
cm->allow_high_precision_mv,
x->errorperbit, &cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
x->nmvjointcost, x->mvcost,
&distortion,
&x->pred_sse[mbmi->ref_frame[0]],
NULL, 0, 0);
cpi->find_fractional_mv_step(
x,
new_mv,
&bsi->ref_mv[0]->as_mv,
cm->allow_high_precision_mv,
x->errorperbit, &cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
cond_sad_list(cpi, sad_list),
x->nmvjointcost, x->mvcost,
&distortion,
&x->pred_sse[mbmi->ref_frame[0]],
NULL, 0, 0);
// save motion search result for use in compound prediction
seg_mvs[i][mbmi->ref_frame[0]].as_mv = *new_mv;
......@@ -1785,6 +1791,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
int sad_list[5];
const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
ref);
......@@ -1857,6 +1864,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mvp_full.row >>= 3;
bestsme = vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param, sadpb,
cond_sad_list(cpi, sad_list),
&ref_mv, &tmp_mv->as_mv, INT_MAX, 1);
x->mv_col_min = tmp_col_min;
......@@ -1872,6 +1880,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
&cpi->fn_ptr[bsize],
cpi->sf.mv.subpel_force_stop,
cpi->sf.mv.subpel_iters_per_step,
cond_sad_list(cpi, sad_list),
x->nmvjointcost, x->mvcost,
&dis, &x->pred_sse[ref], NULL, 0, 0);
}
......@@ -1996,6 +2005,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
x->errorperbit,
&cpi->fn_ptr[bsize],
0, cpi->sf.mv.subpel_iters_per_step,
NULL,
x->nmvjointcost, x->mvcost,
&dis, &sse, second_pred,
pw, ph);
......
......@@ -436,6 +436,8 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
if (sf->mv.subpel_search_method == SUBPEL_TREE) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree;
} else if (sf->mv.subpel_search_method == SUBPEL_TREE_PRUNED) {
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned;
}
cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
......
......@@ -40,6 +40,7 @@ typedef enum {
typedef enum {
SUBPEL_TREE = 0,
SUBPEL_TREE_PRUNED = 1,
// Other methods to come
} SUBPEL_SEARCH_METHODS;
......
......@@ -145,6 +145,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
int bestsme = INT_MAX;
int distortion;
unsigned int sse;
int sad_list[5];
MV best_ref_mv1 = {0, 0};
MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
......@@ -168,6 +169,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
// Ignore mv costing by sending NULL pointer instead of cost arrays
vp9_hex_search(x, &best_ref_mv1_full, step_param, sadpb, 1,
cond_sad_list(cpi, sad_list),
&cpi->fn_ptr[BLOCK_16X16], 0, &best_ref_mv1, ref_mv);
// Ignore mv costing by sending NULL pointer instead of cost array
......@@ -177,6 +179,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
x->errorperbit,
&cpi->fn_ptr[BLOCK_16X16],
0, mv_sf->subpel_iters_per_step,
cond_sad_list(cpi, sad_list),
NULL, NULL,
&distortion, &sse, NULL, 0, 0);
......
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