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];
- MV fcenter_mv = { center_mv->row, center_mv->col };
int64_t best_sad;
int r, c, i;
int start_col, end_col, start_row, end_row;
int col_step = (step > 1) ? step : 4;
assert(step >= 1);
+ assert(is_mv_in(&x->mv_limits, center_mv));
- 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_mv = *center_mv;
best_sad =
((int64_t)fn_ptr->sdf(what->buf, what->stride,
- get_buf_from_mv(in_what, &fcenter_mv),
+ get_buf_from_mv(in_what, center_mv),
in_what->stride)
<< LOG2_PRECISION) +
- lambda * vp9_nb_mvs_inconsistency(&fcenter_mv, nb_full_mvs, full_mv_num);
- 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);
+ lambda * vp9_nb_mvs_inconsistency(best_mv, nb_full_mvs, full_mv_num);
+ start_row = VPXMAX(center_mv->row - range, x->mv_limits.row_min);
+ start_col = VPXMAX(center_mv->col - range, x->mv_limits.col_min);
+ end_row = VPXMIN(center_mv->row + range, x->mv_limits.row_max);
+ end_col = VPXMIN(center_mv->col + range, x->mv_limits.col_max);
for (r = start_row; r <= end_row; r += step) {
for (c = start_col; c <= end_col; c += col_step) {
// Step > 1 means we are not checking every location in this pass.
if (step > 1) {
- const MV mv = { fcenter_mv.row + r, fcenter_mv.col + c };
+ const MV mv = { r, c };
int64_t sad =
(int64_t)fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride)
unsigned int sads[4];
const uint8_t *addrs[4];
for (i = 0; i < 4; ++i) {
- const MV mv = { fcenter_mv.row + r, fcenter_mv.col + c + i };
+ const MV mv = { r, c + i };
addrs[i] = get_buf_from_mv(in_what, &mv);
}
fn_ptr->sdx4df(what->buf, what->stride, addrs, in_what->stride, sads);
for (i = 0; i < 4; ++i) {
int64_t sad = (int64_t)sads[i] << LOG2_PRECISION;
if (sad < best_sad) {
- const MV mv = { fcenter_mv.row + r, fcenter_mv.col + c + i };
+ const MV mv = { r, c + i };
sad += lambda *
vp9_nb_mvs_inconsistency(&mv, nb_full_mvs, full_mv_num);
if (sad < best_sad) {
}
} else {
for (i = 0; i < end_col - c; ++i) {
- const MV mv = { fcenter_mv.row + r, fcenter_mv.col + c + i };
+ const MV mv = { r, c + i };
int64_t sad = (int64_t)fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv),
in_what->stride)