Commit d78dbff0 authored by Deb Mukherjee's avatar Deb Mukherjee
Browse files

Subpel search cleanups and enhancements

- Some fixes to surface fit.
- Returns variance function as cost rather than sad in the
  pattern search and diamond search functions. Only
  vp9_pattern_search_sad function used in bigdia search
  uses sad as integer 1-away costs.
- Deploys SUBPEL_TREE_PRUNED_MORE for speed 4+.

Results:
derf [Speed 3]: About +0.036% in coding efficiency without any
discernible speed loss.
derf [Speed 4]: About 2-3% faster at -0.199% loss in coding efficiency.
derf [Speed 5]: About 3-4% faster at -0.149% loss in coding efficiency.

Change-Id: I8462f94f6adb46966ca964f2bd0400977357fd63
parent cfc337aa
......@@ -531,8 +531,8 @@ 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;
static INLINE int *cond_cost_list(const struct VP9_COMP *cpi, int *cost_list) {
return cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL;
}
#ifdef __cplusplus
......
......@@ -34,7 +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];
int cost_list[5];
// Further step/diamond searches as necessary
int step_param = mv_sf->reduce_first_step_size;
......@@ -47,7 +47,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
/*cpi->sf.search_method == HEX*/
vp9_hex_search(x, &ref_full, step_param, x->errorperbit, 0,
cond_sad_list(cpi, sad_list),
cond_cost_list(cpi, cost_list),
&v_fn_ptr, 0, ref_mv, dst_mv);
// Try sub-pixel MC
......@@ -58,7 +58,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
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,
cond_sad_list(cpi, sad_list),
cond_cost_list(cpi, cost_list),
NULL, NULL,
&distortion, &sse, NULL, 0, 0);
}
......
......@@ -327,11 +327,11 @@ static INLINE int divide_and_round(const int n, const int d) {
return ((n < 0) ^ (d < 0)) ? ((n - d / 2) / d) : ((n + d / 2) / d);
}
static INLINE int is_sad_list_wellbehaved(int *sad_list) {
return sad_list[0] >= sad_list[1] &&
sad_list[0] >= sad_list[2] &&
sad_list[0] >= sad_list[3] &&
sad_list[0] >= sad_list[4];
static INLINE int is_cost_list_wellbehaved(int *cost_list) {
return cost_list[0] < cost_list[1] &&
cost_list[0] < cost_list[2] &&
cost_list[0] < cost_list[3] &&
cost_list[0] < cost_list[4];
}
// Returns surface minima estimate at given precision in 1/2^n bits.
......@@ -342,27 +342,28 @@ static INLINE int is_sad_list_wellbehaved(int *sad_list) {
// x0 = 1/2 (S1 - S3)/(S1 + S3 - 2*S0),
// y0 = 1/2 (S4 - S2)/(S4 + S2 - 2*S0).
// The code below is an integerized version of that.
static void get_cost_surf_min(int *sad_list, int *ir, int *ic,
static void get_cost_surf_min(int *cost_list, int *ir, int *ic,
int bits) {
*ic = divide_and_round((sad_list[1] - sad_list[3]) * (1 << (bits - 1)),
(sad_list[1] - 2 * sad_list[0] + sad_list[3]));
*ir = divide_and_round((sad_list[4] - sad_list[2]) * (1 << (bits - 1)),
(sad_list[4] - 2 * sad_list[0] + sad_list[2]));
*ic = divide_and_round((cost_list[1] - cost_list[3]) * (1 << (bits - 1)),
(cost_list[1] - 2 * cost_list[0] + cost_list[3]));
*ir = divide_and_round((cost_list[4] - cost_list[2]) * (1 << (bits - 1)),
(cost_list[4] - 2 * cost_list[0] + cost_list[2]));
}
int vp9_find_best_sub_pixel_surface_fit(const MACROBLOCK *x,
MV *bestmv, const MV *ref_mv,
int allow_hp,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
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) {
int vp9_find_best_sub_pixel_tree_pruned_evenmore(
const MACROBLOCK *x,
MV *bestmv, const MV *ref_mv,
int allow_hp,
int error_per_bit,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
const uint8_t *second_pred,
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
(void) halfiters;
......@@ -373,16 +374,46 @@ int vp9_find_best_sub_pixel_surface_fit(const MACROBLOCK *x,
(void) forced_stop;
(void) hstep;
if (sad_list &&
sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
sad_list[4] != INT_MAX &&
is_sad_list_wellbehaved(sad_list)) {
if (cost_list &&
cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
cost_list[4] != INT_MAX &&
is_cost_list_wellbehaved(cost_list)) {
int ir, ic;
unsigned int minpt;
get_cost_surf_min(sad_list, &ir, &ic, 3);
get_cost_surf_min(cost_list, &ir, &ic, 2);
if (ir != 0 || ic != 0) {
CHECK_BETTER(minpt, tr + ir, tc + ic);
CHECK_BETTER(minpt, tr + 2 * ir, tc + 2 * ic);
}
} else {
FIRST_LEVEL_CHECKS;
if (halfiters > 1) {
SECOND_LEVEL_CHECKS;
}
tr = br;
tc = bc;
// Each subsequent iteration checks at least one point in common with
// the last iteration could be 2 ( if diag selected) 1/4 pel
// Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
if (forced_stop != 2) {
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (quarteriters > 1) {
SECOND_LEVEL_CHECKS;
}
}
}
tr = br;
tc = bc;
if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (eighthiters > 1) {
SECOND_LEVEL_CHECKS;
}
}
......@@ -403,7 +434,7 @@ int vp9_find_best_sub_pixel_tree_pruned_more(const MACROBLOCK *x,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
int *sad_list,
int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
......@@ -411,14 +442,14 @@ int vp9_find_best_sub_pixel_tree_pruned_more(const MACROBLOCK *x,
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
if (sad_list &&
sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
sad_list[4] != INT_MAX &&
is_sad_list_wellbehaved(sad_list)) {
if (cost_list &&
cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
cost_list[4] != INT_MAX &&
is_cost_list_wellbehaved(cost_list)) {
unsigned int minpt;
int ir, ic;
get_cost_surf_min(sad_list, &ir, &ic, 1);
get_cost_surf_min(cost_list, &ir, &ic, 1);
if (ir != 0 || ic != 0) {
CHECK_BETTER(minpt, tr + ir * hstep, tc + ic * hstep);
}
......@@ -429,31 +460,28 @@ int vp9_find_best_sub_pixel_tree_pruned_more(const MACROBLOCK *x,
}
}
tr = br;
tc = bc;
// Each subsequent iteration checks at least one point in common with
// the last iteration could be 2 ( if diag selected) 1/4 pel
// Note forced_stop: 0 - full, 1 - qtr only, 2 - half only
if (forced_stop != 2) {
tr = br;
tc = bc;
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (quarteriters > 1) {
SECOND_LEVEL_CHECKS;
}
tr = br;
tc = bc;
}
if (allow_hp && vp9_use_mv_hp(ref_mv) && forced_stop == 0) {
tr = br;
tc = bc;
hstep >>= 1;
FIRST_LEVEL_CHECKS;
if (eighthiters > 1) {
SECOND_LEVEL_CHECKS;
}
tr = br;
tc = bc;
}
// These lines insure static analysis doesn't warn that
// tr and tc aren't used after the above point.
......@@ -477,7 +505,7 @@ int vp9_find_best_sub_pixel_tree_pruned(const MACROBLOCK *x,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
int *sad_list,
int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
......@@ -485,13 +513,13 @@ int vp9_find_best_sub_pixel_tree_pruned(const MACROBLOCK *x,
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
if (sad_list &&
sad_list[0] != INT_MAX && sad_list[1] != INT_MAX &&
sad_list[2] != INT_MAX && sad_list[3] != INT_MAX &&
sad_list[4] != INT_MAX) {
if (cost_list &&
cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
cost_list[4] != INT_MAX) {
unsigned int left, right, up, down, diag;
whichdir = (sad_list[1] < sad_list[3] ? 0 : 1) +
(sad_list[2] < sad_list[4] ? 0 : 2);
whichdir = (cost_list[1] < cost_list[3] ? 0 : 1) +
(cost_list[2] < cost_list[4] ? 0 : 2);
switch (whichdir) {
case 0:
CHECK_BETTER(left, tr, tc - hstep);
......@@ -569,7 +597,7 @@ int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x,
const vp9_variance_fn_ptr_t *vfp,
int forced_stop,
int iters_per_step,
int *sad_list,
int *cost_list,
int *mvjcost, int *mvcost[2],
int *distortion,
unsigned int *sse1,
......@@ -577,7 +605,7 @@ int vp9_find_best_sub_pixel_tree(const MACROBLOCK *x,
int w, int h) {
SETUP_SUBPEL_SEARCH;
SETUP_CENTER_ERROR;
(void) sad_list; // to silence compiler warning
(void) cost_list; // to silence compiler warning
// Each subsequent iteration checks at least one point in
// common with the last iteration could be 2 ( if diag selected)
......@@ -661,12 +689,12 @@ static INLINE int is_mv_in(const MACROBLOCK *x, const MV *mv) {
#define PATTERN_CANDIDATES_REF 3 // number of refinement candidates
// Calculate and return a sad+mvcost list around an integer best pel.
static INLINE void calc_int_sad_cost_list(MACROBLOCK *x,
const MV *ref_mv,
int sadpb,
const vp9_variance_fn_ptr_t *fn_ptr,
const MV *best_mv,
int *cost_list) {
static INLINE void calc_int_cost_list(const MACROBLOCK *x,
const MV *ref_mv,
int sadpb,
const vp9_variance_fn_ptr_t *fn_ptr,
const MV *best_mv,
int *cost_list) {
static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &x->e_mbd.plane[0].pre[0];
......@@ -675,21 +703,24 @@ static INLINE void calc_int_sad_cost_list(MACROBLOCK *x,
int bc = best_mv->col;
MV this_mv;
int i;
unsigned int sse;
this_mv.row = br;
this_mv.col = bc;
cost_list[0] = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride) +
cost_list[0] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
if (check_bounds(x, br, bc, 1)) {
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
cost_list[i + 1] = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride) +
mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
// mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
x->errorperbit);
}
} else {
for (i = 0; i < 4; i++) {
......@@ -698,10 +729,12 @@ static INLINE void calc_int_sad_cost_list(MACROBLOCK *x,
if (!is_mv_in(x, &this_mv))
cost_list[i + 1] = INT_MAX;
else
cost_list[i + 1] = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride) +
mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride, &sse) +
// mvsad_err_cost(x, &this_mv, &fcenter_mv, sadpb);
mv_err_cost(&this_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
x->errorperbit);
}
}
}
......@@ -716,7 +749,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search,
int *sad_list,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
......@@ -868,40 +901,14 @@ static int vp9_pattern_search(const MACROBLOCK *x,
}
// Returns the one-away integer pel sad values around the best as follows:
// sad_list[0]: sad at the best integer pel
// sad_list[1]: sad at delta {0, -1} (left) from the best integer pel
// sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
// sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel
// sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel
if (sad_list) {
static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
sad_list[0] = bestsad;
if (check_bounds(x, br, bc, 1)) {
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride) +
(use_mvcost ?
mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) :
0);
}
} else {
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
if (!is_mv_in(x, &this_mv))
sad_list[i + 1] = INT_MAX;
else
sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride) +
(use_mvcost ?
mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit) :
0);
}
}
// cost_list[0]: cost at the best integer pel
// cost_list[1]: cost at delta {0, -1} (left) from the best integer pel
// cost_list[2]: cost at delta { 1, 0} (bottom) from the best integer pel
// cost_list[3]: cost at delta { 0, 1} (right) from the best integer pel
// cost_list[4]: cost at delta {-1, 0} (top) from the best integer pel
if (cost_list) {
const MV best_mv = { br, bc };
calc_int_cost_list(x, &fcenter_mv, sad_per_bit, vfp, &best_mv, cost_list);
}
best_mv->row = br;
best_mv->col = bc;
......@@ -909,7 +916,7 @@ static int vp9_pattern_search(const MACROBLOCK *x,
}
// A specialized function where the smallest scale search candidates
// are 4 1-away neighbors, and sad_list is non-null
// are 4 1-away neighbors, and cost_list is non-null
// TODO(debargha): Merge this function with the one above. Also remove
// use_mvcost option since it is always 1, to save unnecessary branches.
static int vp9_pattern_search_sad(const MACROBLOCK *x,
......@@ -917,7 +924,7 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search,
int *sad_list,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
......@@ -942,8 +949,8 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
br = ref_mv->row;
bc = ref_mv->col;
if (sad_list != NULL) {
sad_list[0] = sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] =
if (cost_list != NULL) {
cost_list[0] = cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] =
INT_MAX;
}
......@@ -997,7 +1004,7 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
// If the center point is still the best, just skip this and move to
// the refinement step.
if (best_init_s != -1) {
int do_sad = (num_candidates[0] == 4 && sad_list != NULL);
int do_sad = (num_candidates[0] == 4 && cost_list != NULL);
int best_site = -1;
s = best_init_s;
......@@ -1071,15 +1078,15 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
} while (best_site != -1);
}
// Note: If we enter the if below, then sad_list must be non-NULL.
// Note: If we enter the if below, then cost_list must be non-NULL.
if (s == 0) {
sad_list[0] = bestsad;
cost_list[0] = bestsad;
if (!do_init_search || s != best_init_s) {
if (check_bounds(x, br, bc, 1 << s)) {
for (i = 0; i < num_candidates[s]; i++) {
const MV this_mv = {br + candidates[s][i].row,
bc + candidates[s][i].col};
sad_list[i + 1] =
cost_list[i + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
......@@ -1091,7 +1098,7 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
bc + candidates[s][i].col};
if (!is_mv_in(x, &this_mv))
continue;
sad_list[i + 1] =
cost_list[i + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
......@@ -1111,15 +1118,15 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
next_chkpts_indices[0] = (k == 0) ? num_candidates[s] - 1 : k - 1;
next_chkpts_indices[1] = k;
next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1;
sad_list[1] = sad_list[2] = sad_list[3] = sad_list[4] = INT_MAX;
sad_list[((k + 2) % 4) + 1] = sad_list[0];
sad_list[0] = bestsad;
cost_list[1] = cost_list[2] = cost_list[3] = cost_list[4] = INT_MAX;
cost_list[((k + 2) % 4) + 1] = cost_list[0];
cost_list[0] = bestsad;
if (check_bounds(x, br, bc, 1 << s)) {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col};
sad_list[next_chkpts_indices[i] + 1] =
cost_list[next_chkpts_indices[i] + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
......@@ -1130,10 +1137,10 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
const MV this_mv = {br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col};
if (!is_mv_in(x, &this_mv)) {
sad_list[next_chkpts_indices[i] + 1] = INT_MAX;
cost_list[next_chkpts_indices[i] + 1] = INT_MAX;
continue;
}
sad_list[next_chkpts_indices[i] + 1] =
cost_list[next_chkpts_indices[i] + 1] =
thissad = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
......@@ -1151,20 +1158,20 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
}
// Returns the one-away integer pel sad values around the best as follows:
// sad_list[0]: sad at the best integer pel
// sad_list[1]: sad at delta {0, -1} (left) from the best integer pel
// sad_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
// sad_list[3]: sad at delta { 0, 1} (right) from the best integer pel
// sad_list[4]: sad at delta {-1, 0} (top) from the best integer pel
if (sad_list) {
// cost_list[0]: sad at the best integer pel
// cost_list[1]: sad at delta {0, -1} (left) from the best integer pel
// cost_list[2]: sad at delta { 1, 0} (bottom) from the best integer pel
// cost_list[3]: sad at delta { 0, 1} (right) from the best integer pel
// cost_list[4]: sad at delta {-1, 0} (top) from the best integer pel
if (cost_list) {
static const MV neighbors[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
if (sad_list[0] == INT_MAX) {
sad_list[0] = bestsad;
if (cost_list[0] == INT_MAX) {
cost_list[0] = bestsad;
if (check_bounds(x, br, bc, 1)) {
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
const MV this_mv = { br + neighbors[i].row,
bc + neighbors[i].col };
cost_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
}
......@@ -1173,9 +1180,9 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
if (!is_mv_in(x, &this_mv))
sad_list[i + 1] = INT_MAX;
cost_list[i + 1] = INT_MAX;
else
sad_list[i + 1] = vfp->sdf(what->buf, what->stride,
cost_list[i + 1] = vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv),
in_what->stride);
}
......@@ -1185,8 +1192,8 @@ static int vp9_pattern_search_sad(const MACROBLOCK *x,
for (i = 0; i < 4; i++) {
const MV this_mv = {br + neighbors[i].row,
bc + neighbors[i].col};
if (sad_list[i + 1] != INT_MAX) {
sad_list[i + 1] +=
if (cost_list[i + 1] != INT_MAX) {
cost_list[i + 1] +=
mvsad_err_cost(x, &this_mv, &fcenter_mv, sad_per_bit);
}
}
......@@ -1236,7 +1243,7 @@ int vp9_hex_search(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search,
int *sad_list,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv, MV *best_mv) {
......@@ -1261,7 +1268,7 @@ int vp9_hex_search(const MACROBLOCK *x,
{ -1024, 0}},
};
return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
do_init_search, sad_list, vfp, use_mvcost,
do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
hex_num_candidates, hex_candidates);
}
......@@ -1271,7 +1278,7 @@ int vp9_bigdia_search(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search,
int *sad_list,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
......@@ -1303,7 +1310,7 @@ int vp9_bigdia_search(const MACROBLOCK *x,
{-512, 512}, {-1024, 0}},
};
return vp9_pattern_search_sad(x, ref_mv, search_param, sad_per_bit,
do_init_search, sad_list, vfp, use_mvcost,
do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
bigdia_num_candidates, bigdia_candidates);
}
......@@ -1313,7 +1320,7 @@ int vp9_square_search(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search,
int *sad_list,
int *cost_list,
const vp9_variance_fn_ptr_t *vfp,
int use_mvcost,
const MV *center_mv,
......@@ -1345,7 +1352,7 @@ int vp9_square_search(const MACROBLOCK *x,
{0, 1024}, {-1024, 1024}, {-1024, 0}},
};
return vp9_pattern_search(x, ref_mv, search_param, sad_per_bit,
do_init_search, sad_list, vfp, use_mvcost,
do_init_search, cost_list, vfp, use_mvcost,
center_mv, best_mv,
square_num_candidates, square_candidates);
}
......@@ -1355,13 +1362,13 @@ int vp9_fast_hex_search(const MACROBLOCK *x,
int search_param,
int sad_per_bit,
int do_init_search, // must be zero for fast_hex
int *sad_list,
int *cost_list,