summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_mcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_mcomp.c')
-rw-r--r--vp9/encoder/vp9_mcomp.c197
1 files changed, 101 insertions, 96 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index ca04980fd..b3b27b3cf 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -33,7 +33,7 @@ static INLINE const uint8_t *get_buf_from_mv(const struct buf_2d *buf,
return &buf->buf[mv->row * buf->stride + mv->col];
}
-void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) {
+void vp9_set_mv_search_range(MvLimits *mv_limits, const MV *mv) {
int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0);
int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0);
int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
@@ -46,10 +46,10 @@ void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) {
// Get intersection of UMV window and valid MV window to reduce # of checks
// in diamond search.
- if (x->mv_col_min < col_min) x->mv_col_min = col_min;
- if (x->mv_col_max > col_max) x->mv_col_max = col_max;
- if (x->mv_row_min < row_min) x->mv_row_min = row_min;
- if (x->mv_row_max > row_max) x->mv_row_max = row_max;
+ if (mv_limits->col_min < col_min) mv_limits->col_min = col_min;
+ if (mv_limits->col_max > col_max) mv_limits->col_max = col_max;
+ if (mv_limits->row_min < row_min) mv_limits->row_min = row_min;
+ if (mv_limits->row_max > row_max) mv_limits->row_max = row_max;
}
int vp9_init_search_range(int size) {
@@ -273,34 +273,34 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
} \
}
-#define SETUP_SUBPEL_SEARCH \
- const uint8_t *const z = x->plane[0].src.buf; \
- const int src_stride = x->plane[0].src.stride; \
- const MACROBLOCKD *xd = &x->e_mbd; \
- unsigned int besterr = INT_MAX; \
- unsigned int sse; \
- unsigned int whichdir; \
- int thismse; \
- const unsigned int halfiters = iters_per_step; \
- const unsigned int quarteriters = iters_per_step; \
- const unsigned int eighthiters = iters_per_step; \
- const int y_stride = xd->plane[0].pre[0].stride; \
- const int offset = bestmv->row * y_stride + bestmv->col; \
- const uint8_t *const y = xd->plane[0].pre[0].buf; \
- \
- int rr = ref_mv->row; \
- int rc = ref_mv->col; \
- int br = bestmv->row * 8; \
- int bc = bestmv->col * 8; \
- int hstep = 4; \
- const int minc = VPXMAX(x->mv_col_min * 8, ref_mv->col - MV_MAX); \
- const int maxc = VPXMIN(x->mv_col_max * 8, ref_mv->col + MV_MAX); \
- const int minr = VPXMAX(x->mv_row_min * 8, ref_mv->row - MV_MAX); \
- const int maxr = VPXMIN(x->mv_row_max * 8, ref_mv->row + MV_MAX); \
- int tr = br; \
- int tc = bc; \
- \
- bestmv->row *= 8; \
+#define SETUP_SUBPEL_SEARCH \
+ const uint8_t *const z = x->plane[0].src.buf; \
+ const int src_stride = x->plane[0].src.stride; \
+ const MACROBLOCKD *xd = &x->e_mbd; \
+ unsigned int besterr = INT_MAX; \
+ unsigned int sse; \
+ unsigned int whichdir; \
+ int thismse; \
+ const unsigned int halfiters = iters_per_step; \
+ const unsigned int quarteriters = iters_per_step; \
+ const unsigned int eighthiters = iters_per_step; \
+ const int y_stride = xd->plane[0].pre[0].stride; \
+ const int offset = bestmv->row * y_stride + bestmv->col; \
+ const uint8_t *const y = xd->plane[0].pre[0].buf; \
+ \
+ int rr = ref_mv->row; \
+ int rc = ref_mv->col; \
+ int br = bestmv->row * 8; \
+ int bc = bestmv->col * 8; \
+ int hstep = 4; \
+ const int minc = VPXMAX(x->mv_limits.col_min * 8, ref_mv->col - MV_MAX); \
+ const int maxc = VPXMIN(x->mv_limits.col_max * 8, ref_mv->col + MV_MAX); \
+ const int minr = VPXMAX(x->mv_limits.row_min * 8, ref_mv->row - MV_MAX); \
+ const int maxr = VPXMIN(x->mv_limits.row_max * 8, ref_mv->row + MV_MAX); \
+ int tr = br; \
+ int tc = bc; \
+ \
+ bestmv->row *= 8; \
bestmv->col *= 8;
static unsigned int setup_center_error(
@@ -659,10 +659,10 @@ uint32_t vp9_find_best_sub_pixel_tree(
int bc = bestmv->col * 8;
int hstep = 4;
int iter, round = 3 - forced_stop;
- const int minc = VPXMAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
- const int maxc = VPXMIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
- const int minr = VPXMAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
- const int maxr = VPXMIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
+ const int minc = VPXMAX(x->mv_limits.col_min * 8, ref_mv->col - MV_MAX);
+ const int maxc = VPXMIN(x->mv_limits.col_max * 8, ref_mv->col + MV_MAX);
+ const int minr = VPXMAX(x->mv_limits.row_min * 8, ref_mv->row - MV_MAX);
+ const int maxr = VPXMIN(x->mv_limits.row_max * 8, ref_mv->row + MV_MAX);
int tr = br;
int tc = bc;
const MV *search_step = search_step_table;
@@ -779,15 +779,17 @@ uint32_t vp9_find_best_sub_pixel_tree(
#undef MVC
#undef CHECK_BETTER
-static INLINE int check_bounds(const MACROBLOCK *x, int row, int col,
+static INLINE int check_bounds(const MvLimits *mv_limits, int row, int col,
int range) {
- return ((row - range) >= x->mv_row_min) & ((row + range) <= x->mv_row_max) &
- ((col - range) >= x->mv_col_min) & ((col + range) <= x->mv_col_max);
+ return ((row - range) >= mv_limits->row_min) &
+ ((row + range) <= mv_limits->row_max) &
+ ((col - range) >= mv_limits->col_min) &
+ ((col + range) <= mv_limits->col_max);
}
-static INLINE int is_mv_in(const MACROBLOCK *x, const MV *mv) {
- return (mv->col >= x->mv_col_min) && (mv->col <= x->mv_col_max) &&
- (mv->row >= x->mv_row_min) && (mv->row <= x->mv_row_max);
+static INLINE int is_mv_in(const MvLimits *mv_limits, const MV *mv) {
+ return (mv->col >= mv_limits->col_min) && (mv->col <= mv_limits->col_max) &&
+ (mv->row >= mv_limits->row_min) && (mv->row <= mv_limits->row_max);
}
#define CHECK_BETTER \
@@ -827,7 +829,7 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x, const MV *ref_mv,
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)) {
+ if (check_bounds(&x->mv_limits, 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->vf(what->buf, what->stride,
@@ -839,7 +841,7 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x, const MV *ref_mv,
} 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))
+ if (!is_mv_in(&x->mv_limits, &this_mv))
cost_list[i + 1] = INT_MAX;
else
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
@@ -876,7 +878,8 @@ static int vp9_pattern_search(
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
int best_init_s = search_param_to_steps[search_param];
// adjust ref_mv to make sure it is within MV range
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ clamp_mv(ref_mv, x->mv_limits.col_min, x->mv_limits.col_max,
+ x->mv_limits.row_min, x->mv_limits.row_max);
br = ref_mv->row;
bc = ref_mv->col;
@@ -893,7 +896,7 @@ static int vp9_pattern_search(
best_init_s = -1;
for (t = 0; t <= s; ++t) {
int best_site = -1;
- if (check_bounds(x, br, bc, 1 << t)) {
+ if (check_bounds(&x->mv_limits, br, bc, 1 << t)) {
for (i = 0; i < num_candidates[t]; i++) {
const MV this_mv = { br + candidates[t][i].row,
bc + candidates[t][i].col };
@@ -906,7 +909,7 @@ static int vp9_pattern_search(
for (i = 0; i < num_candidates[t]; i++) {
const MV this_mv = { br + candidates[t][i].row,
bc + candidates[t][i].col };
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -935,7 +938,7 @@ static int vp9_pattern_search(
do {
// No need to search all 6 points the 1st time if initial search was used
if (!do_init_search || s != best_init_s) {
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, 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 };
@@ -948,7 +951,7 @@ static int vp9_pattern_search(
for (i = 0; i < num_candidates[s]; i++) {
const MV this_mv = { br + candidates[s][i].row,
bc + candidates[s][i].col };
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -972,7 +975,7 @@ static int vp9_pattern_search(
next_chkpts_indices[1] = k;
next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1;
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, br, bc, 1 << s)) {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
const MV this_mv = {
br + candidates[s][next_chkpts_indices[i]].row,
@@ -989,7 +992,7 @@ static int vp9_pattern_search(
br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col
};
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -1045,7 +1048,8 @@ static int vp9_pattern_search_sad(
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
int best_init_s = search_param_to_steps[search_param];
// adjust ref_mv to make sure it is within MV range
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ clamp_mv(ref_mv, x->mv_limits.col_min, x->mv_limits.col_max,
+ x->mv_limits.row_min, x->mv_limits.row_max);
br = ref_mv->row;
bc = ref_mv->col;
if (cost_list != NULL) {
@@ -1066,7 +1070,7 @@ static int vp9_pattern_search_sad(
best_init_s = -1;
for (t = 0; t <= s; ++t) {
int best_site = -1;
- if (check_bounds(x, br, bc, 1 << t)) {
+ if (check_bounds(&x->mv_limits, br, bc, 1 << t)) {
for (i = 0; i < num_candidates[t]; i++) {
const MV this_mv = { br + candidates[t][i].row,
bc + candidates[t][i].col };
@@ -1079,7 +1083,7 @@ static int vp9_pattern_search_sad(
for (i = 0; i < num_candidates[t]; i++) {
const MV this_mv = { br + candidates[t][i].row,
bc + candidates[t][i].col };
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -1108,7 +1112,7 @@ static int vp9_pattern_search_sad(
for (; s >= do_sad; s--) {
if (!do_init_search || s != best_init_s) {
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, 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 };
@@ -1121,7 +1125,7 @@ static int vp9_pattern_search_sad(
for (i = 0; i < num_candidates[s]; i++) {
const MV this_mv = { br + candidates[s][i].row,
bc + candidates[s][i].col };
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -1145,7 +1149,7 @@ static int vp9_pattern_search_sad(
next_chkpts_indices[1] = k;
next_chkpts_indices[2] = (k == num_candidates[s] - 1) ? 0 : k + 1;
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, br, bc, 1 << s)) {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
const MV this_mv = {
br + candidates[s][next_chkpts_indices[i]].row,
@@ -1162,7 +1166,7 @@ static int vp9_pattern_search_sad(
br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col
};
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -1182,7 +1186,7 @@ static int vp9_pattern_search_sad(
if (s == 0) {
cost_list[0] = bestsad;
if (!do_init_search || s != best_init_s) {
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, 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 };
@@ -1195,7 +1199,7 @@ static int vp9_pattern_search_sad(
for (i = 0; i < num_candidates[s]; i++) {
const MV this_mv = { br + candidates[s][i].row,
bc + candidates[s][i].col };
- if (!is_mv_in(x, &this_mv)) continue;
+ if (!is_mv_in(&x->mv_limits, &this_mv)) continue;
cost_list[i + 1] = thissad =
vfp->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &this_mv), in_what->stride);
@@ -1219,7 +1223,7 @@ static int vp9_pattern_search_sad(
cost_list[((k + 2) % 4) + 1] = cost_list[0];
cost_list[0] = bestsad;
- if (check_bounds(x, br, bc, 1 << s)) {
+ if (check_bounds(&x->mv_limits, br, bc, 1 << s)) {
for (i = 0; i < PATTERN_CANDIDATES_REF; i++) {
const MV this_mv = {
br + candidates[s][next_chkpts_indices[i]].row,
@@ -1236,7 +1240,7 @@ static int vp9_pattern_search_sad(
br + candidates[s][next_chkpts_indices[i]].row,
bc + candidates[s][next_chkpts_indices[i]].col
};
- if (!is_mv_in(x, &this_mv)) {
+ if (!is_mv_in(&x->mv_limits, &this_mv)) {
cost_list[next_chkpts_indices[i] + 1] = INT_MAX;
continue;
}
@@ -1266,7 +1270,7 @@ static int vp9_pattern_search_sad(
static const MV neighbors[4] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 } };
if (cost_list[0] == INT_MAX) {
cost_list[0] = bestsad;
- if (check_bounds(x, br, bc, 1)) {
+ if (check_bounds(&x->mv_limits, 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] =
@@ -1276,7 +1280,7 @@ static int vp9_pattern_search_sad(
} 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))
+ if (!is_mv_in(&x->mv_limits, &this_mv))
cost_list[i + 1] = INT_MAX;
else
cost_list[i + 1] =
@@ -1499,17 +1503,17 @@ static int exhuastive_mesh_search(const MACROBLOCK *x, MV *ref_mv, MV *best_mv,
assert(step >= 1);
- clamp_mv(&fcenter_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min,
- x->mv_row_max);
+ clamp_mv(&fcenter_mv, x->mv_limits.col_min, x->mv_limits.col_max,
+ x->mv_limits.row_min, x->mv_limits.row_max);
*best_mv = fcenter_mv;
best_sad =
fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &fcenter_mv), in_what->stride) +
mvsad_err_cost(x, &fcenter_mv, ref_mv, sad_per_bit);
- start_row = VPXMAX(-range, x->mv_row_min - fcenter_mv.row);
- start_col = VPXMAX(-range, x->mv_col_min - fcenter_mv.col);
- end_row = VPXMIN(range, x->mv_row_max - fcenter_mv.row);
- end_col = VPXMIN(range, x->mv_col_max - fcenter_mv.col);
+ start_row = VPXMAX(-range, x->mv_limits.row_min - fcenter_mv.row);
+ start_col = VPXMAX(-range, x->mv_limits.col_min - fcenter_mv.col);
+ end_row = VPXMIN(range, x->mv_limits.row_max - fcenter_mv.row);
+ end_col = VPXMIN(range, x->mv_limits.col_max - fcenter_mv.col);
for (r = start_row; r <= end_row; r += step) {
for (c = start_col; c <= end_col; c += col_step) {
@@ -1602,7 +1606,8 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x, const search_site_config *cfg,
const int tot_steps = cfg->total_steps - search_param;
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
- clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ clamp_mv(ref_mv, x->mv_limits.col_min, x->mv_limits.col_max,
+ x->mv_limits.row_min, x->mv_limits.row_max);
ref_row = ref_mv->row;
ref_col = ref_mv->col;
*num00 = 0;
@@ -1624,10 +1629,10 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x, const search_site_config *cfg,
// All_in is true if every one of the points we are checking are within
// the bounds of the image.
- all_in &= ((best_mv->row + ss_mv[i].row) > x->mv_row_min);
- all_in &= ((best_mv->row + ss_mv[i + 1].row) < x->mv_row_max);
- all_in &= ((best_mv->col + ss_mv[i + 2].col) > x->mv_col_min);
- all_in &= ((best_mv->col + ss_mv[i + 3].col) < x->mv_col_max);
+ all_in &= ((best_mv->row + ss_mv[i].row) > x->mv_limits.row_min);
+ all_in &= ((best_mv->row + ss_mv[i + 1].row) < x->mv_limits.row_max);
+ all_in &= ((best_mv->col + ss_mv[i + 2].col) > x->mv_limits.col_min);
+ all_in &= ((best_mv->col + ss_mv[i + 3].col) < x->mv_limits.col_max);
// If all the pixels are within the bounds we don't check whether the
// search point is valid in this loop, otherwise we check each point
@@ -1662,7 +1667,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x, const search_site_config *cfg,
const MV this_mv = { best_mv->row + ss_mv[i].row,
best_mv->col + ss_mv[i].col };
- if (is_mv_in(x, &this_mv)) {
+ if (is_mv_in(&x->mv_limits, &this_mv)) {
const uint8_t *const check_here = ss_os[i] + best_address;
unsigned int thissad =
fn_ptr->sdf(what, what_stride, check_here, in_what_stride);
@@ -1687,7 +1692,7 @@ int vp9_diamond_search_sad_c(const MACROBLOCK *x, const search_site_config *cfg,
while (1) {
const MV this_mv = { best_mv->row + ss_mv[best_site].row,
best_mv->col + ss_mv[best_site].col };
- if (is_mv_in(x, &this_mv)) {
+ if (is_mv_in(&x->mv_limits, &this_mv)) {
const uint8_t *const check_here = ss_os[best_site] + best_address;
unsigned int thissad =
fn_ptr->sdf(what, what_stride, check_here, in_what_stride);
@@ -2044,10 +2049,10 @@ int vp9_full_search_sad_c(const MACROBLOCK *x, const MV *ref_mv,
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_limits.row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_limits.row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_limits.col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_limits.col_max);
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
int best_sad =
fn_ptr->sdf(what->buf, what->stride, get_buf_from_mv(in_what, ref_mv),
@@ -2079,10 +2084,10 @@ int vp9_full_search_sadx3(const MACROBLOCK *x, const MV *ref_mv,
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_limits.row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_limits.row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_limits.col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_limits.col_max);
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
unsigned int best_sad =
fn_ptr->sdf(what->buf, what->stride, get_buf_from_mv(in_what, ref_mv),
@@ -2145,10 +2150,10 @@ int vp9_full_search_sadx8(const MACROBLOCK *x, const MV *ref_mv,
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_limits.row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_limits.row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_limits.col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_limits.col_max);
const MV fcenter_mv = { center_mv->row >> 3, center_mv->col >> 3 };
unsigned int best_sad =
fn_ptr->sdf(what->buf, what->stride, get_buf_from_mv(in_what, ref_mv),
@@ -2244,10 +2249,10 @@ int vp9_refining_search_sad(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
for (i = 0; i < search_range; i++) {
int best_site = -1;
- const int all_in = ((ref_mv->row - 1) > x->mv_row_min) &
- ((ref_mv->row + 1) < x->mv_row_max) &
- ((ref_mv->col - 1) > x->mv_col_min) &
- ((ref_mv->col + 1) < x->mv_col_max);
+ const int all_in = ((ref_mv->row - 1) > x->mv_limits.row_min) &
+ ((ref_mv->row + 1) < x->mv_limits.row_max) &
+ ((ref_mv->col - 1) > x->mv_limits.col_min) &
+ ((ref_mv->col + 1) < x->mv_limits.col_max);
if (all_in) {
unsigned int sads[4];
@@ -2273,7 +2278,7 @@ int vp9_refining_search_sad(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
const MV mv = { ref_mv->row + neighbors[j].row,
ref_mv->col + neighbors[j].col };
- if (is_mv_in(x, &mv)) {
+ if (is_mv_in(&x->mv_limits, &mv)) {
unsigned int sad =
fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride);
@@ -2325,7 +2330,7 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x, MV *ref_mv, int error_per_bit,
const MV mv = { ref_mv->row + neighbors[j].row,
ref_mv->col + neighbors[j].col };
- if (is_mv_in(x, &mv)) {
+ if (is_mv_in(&x->mv_limits, &mv)) {
unsigned int sad =
fn_ptr->sdaf(what->buf, what->stride, get_buf_from_mv(in_what, &mv),
in_what->stride, second_pred);