Commit 0fa0f42c authored by Alex Converse's avatar Alex Converse

Refactor mv limits.

cherry pick of libvpx commit 6554333b59cf773983c7cacbd832d754f75139e8

BUG=aomedia:443

Change-Id: Ifebdc9ef37850508eb4b8e572fd0f6026ab04987
parent f323f015
......@@ -88,6 +88,13 @@ typedef struct {
#endif
} MB_MODE_INFO_EXT;
typedef struct {
int col_min;
int col_max;
int row_min;
int row_max;
} MvLimits;
#if CONFIG_PALETTE
typedef struct {
uint8_t best_palette_color_map[MAX_SB_SQUARE];
......@@ -163,10 +170,7 @@ struct macroblock {
// These define limits to motion vector components to prevent them
// from extending outside the UMV borders
int mv_col_min;
int mv_col_max;
int mv_row_min;
int mv_row_max;
MvLimits mv_limits;
#if CONFIG_VAR_TX
uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8];
......
......@@ -289,10 +289,11 @@ static void set_offsets_without_segment_id(const AV1_COMP *const cpi,
// Set up limit values for MV components.
// Mv beyond the range do not produce new/different prediction block.
x->mv_row_min = -(((mi_row + mi_height) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_col_min = -(((mi_col + mi_width) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_row_max = (cm->mi_rows - mi_row) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_col_max = (cm->mi_cols - mi_col) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_limits.row_min =
-(((mi_row + mi_height) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_limits.col_min = -(((mi_col + mi_width) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_limits.row_max = (cm->mi_rows - mi_row) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_limits.col_max = (cm->mi_cols - mi_col) * MI_SIZE + AOM_INTERP_EXTEND;
set_plane_n4(xd, mi_width, mi_height);
......@@ -389,10 +390,14 @@ static void set_offsets_extend(const AV1_COMP *const cpi, ThreadData *td,
// Set up limit values for MV components.
// Mv beyond the range do not produce new/different prediction block.
x->mv_row_min = -(((mi_row_pred + mi_height) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_col_min = -(((mi_col_pred + mi_width) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_row_max = (cm->mi_rows - mi_row_pred) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_col_max = (cm->mi_cols - mi_col_pred) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_limits.row_min =
-(((mi_row_pred + mi_height) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_limits.col_min =
-(((mi_col_pred + mi_width) * MI_SIZE) + AOM_INTERP_EXTEND);
x->mv_limits.row_max =
(cm->mi_rows - mi_row_pred) * MI_SIZE + AOM_INTERP_EXTEND;
x->mv_limits.col_max =
(cm->mi_cols - mi_col_pred) * MI_SIZE + AOM_INTERP_EXTEND;
// Set up distance of MB to edge of frame in 1/8th pel units.
#if !CONFIG_CB4X4
......
......@@ -615,8 +615,9 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
// Set up limit values for motion vectors to prevent them extending
// outside the UMV borders.
x->mv_row_min = -((mb_row * 16) + BORDER_MV_PIXELS_B16);
x->mv_row_max = ((cm->mb_rows - 1 - mb_row) * 16) + BORDER_MV_PIXELS_B16;
x->mv_limits.row_min = -((mb_row * 16) + BORDER_MV_PIXELS_B16);
x->mv_limits.row_max =
((cm->mb_rows - 1 - mb_row) * 16) + BORDER_MV_PIXELS_B16;
for (mb_col = 0; mb_col < cm->mb_cols; ++mb_col) {
int this_error;
......@@ -728,8 +729,9 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) {
// Set up limit values for motion vectors to prevent them extending
// outside the UMV borders.
x->mv_col_min = -((mb_col * 16) + BORDER_MV_PIXELS_B16);
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + BORDER_MV_PIXELS_B16;
x->mv_limits.col_min = -((mb_col * 16) + BORDER_MV_PIXELS_B16);
x->mv_limits.col_max =
((cm->mb_cols - 1 - mb_col) * 16) + BORDER_MV_PIXELS_B16;
if (!frame_is_intra_only(cm)) { // Do a motion search
int tmp_err, motion_error, raw_motion_error;
......
......@@ -30,10 +30,7 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
const aom_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
const int tmp_col_min = x->mv_col_min;
const int tmp_col_max = x->mv_col_max;
const int tmp_row_min = x->mv_row_min;
const int tmp_row_max = x->mv_row_max;
const MvLimits tmp_mv_limits = x->mv_limits;
MV ref_full;
int cost_list[5];
......@@ -41,7 +38,7 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
int step_param = mv_sf->reduce_first_step_size;
step_param = AOMMIN(step_param, MAX_MVSEARCH_STEPS - 2);
av1_set_mv_search_range(x, ref_mv);
av1_set_mv_search_range(&x->mv_limits, ref_mv);
ref_full.col = ref_mv->col >> 3;
ref_full.row = ref_mv->row >> 3;
......@@ -77,10 +74,7 @@ static unsigned int do_16x16_motion_iteration(AV1_COMP *cpi, const MV *ref_mv,
av1_build_inter_predictors_sby(xd, mb_row, mb_col, NULL, BLOCK_16X16);
/* restore UMV window */
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
return aom_sad16x16(x->plane[0].src.buf, x->plane[0].src.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride);
......@@ -237,8 +231,8 @@ static void update_mbgraph_frame_stats(AV1_COMP *cpi,
av1_zero(mi_local);
// Set up limit values for motion vectors to prevent them extending outside
// the UMV borders.
x->mv_row_min = -BORDER_MV_PIXELS_B16;
x->mv_row_max = (cm->mb_rows - 1) * 8 + BORDER_MV_PIXELS_B16;
x->mv_limits.row_min = -BORDER_MV_PIXELS_B16;
x->mv_limits.row_max = (cm->mb_rows - 1) * 8 + BORDER_MV_PIXELS_B16;
xd->up_available = 0;
xd->plane[0].dst.stride = buf->y_stride;
xd->plane[0].pre[0].stride = buf->y_stride;
......@@ -256,8 +250,8 @@ static void update_mbgraph_frame_stats(AV1_COMP *cpi,
// Set up limit values for motion vectors to prevent them extending outside
// the UMV borders.
x->mv_col_min = -BORDER_MV_PIXELS_B16;
x->mv_col_max = (cm->mb_cols - 1) * 8 + BORDER_MV_PIXELS_B16;
x->mv_limits.col_min = -BORDER_MV_PIXELS_B16;
x->mv_limits.col_max = (cm->mb_cols - 1) * 8 + BORDER_MV_PIXELS_B16;
xd->left_available = 0;
for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
......@@ -273,15 +267,15 @@ static void update_mbgraph_frame_stats(AV1_COMP *cpi,
mb_y_in_offset += 16;
gld_y_in_offset += 16;
arf_y_in_offset += 16;
x->mv_col_min -= 16;
x->mv_col_max -= 16;
x->mv_limits.col_min -= 16;
x->mv_limits.col_max -= 16;
}
xd->up_available = 1;
mb_y_offset += buf->y_stride * 16;
gld_y_offset += golden_ref->y_stride * 16;
if (alt_ref) arf_y_offset += alt_ref->y_stride * 16;
x->mv_row_min -= 16;
x->mv_row_max -= 16;
x->mv_limits.row_min -= 16;
x->mv_limits.row_max -= 16;
offset += cm->mb_cols;
}
}
......
This diff is collapsed.
......@@ -46,8 +46,8 @@ typedef struct search_site_config {
void av1_init_dsmotion_compensation(search_site_config *cfg, int stride);
void av1_init3smotion_compensation(search_site_config *cfg, int stride);
void av1_set_mv_search_range(MACROBLOCK *x, const MV *mv);
void av1_set_subpel_mv_search_range(const MACROBLOCK *x, int *col_min,
void av1_set_mv_search_range(MvLimits *mv_limits, const MV *mv);
void av1_set_subpel_mv_search_range(const MvLimits *mv_limits, int *col_min,
int *col_max, int *row_min, int *row_max,
const MV *ref_mv);
......
......@@ -5326,9 +5326,11 @@ typedef struct {
int mvthresh;
} BEST_SEG_INFO;
static INLINE int mv_check_bounds(const MACROBLOCK *x, const MV *mv) {
return (mv->row >> 3) < x->mv_row_min || (mv->row >> 3) > x->mv_row_max ||
(mv->col >> 3) < x->mv_col_min || (mv->col >> 3) > x->mv_col_max;
static INLINE int mv_check_bounds(const MvLimits *mv_limits, const MV *mv) {
return (mv->row >> 3) < mv_limits->row_min ||
(mv->row >> 3) > mv_limits->row_max ||
(mv->col >> 3) < mv_limits->col_min ||
(mv->col >> 3) > mv_limits->col_max;
}
static INLINE void mi_buf_shift(MACROBLOCK *x, int i) {
......@@ -5575,10 +5577,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
MV *const best_mv = &x->best_mv.as_mv;
int search_range = 3;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
MvLimits tmp_mv_limits = x->mv_limits;
int id = ite % 2; // Even iterations search in the first reference frame,
// odd iterations search in the second. The predictor
// found for the 'other' reference frame is factored in.
......@@ -5639,7 +5638,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
// Do compound motion search on the current reference frame.
if (id) xd->plane[plane].pre[0] = ref_yv12[id];
av1_set_mv_search_range(x, &ref_mv[id].as_mv);
av1_set_mv_search_range(&x->mv_limits, &ref_mv[id].as_mv);
// Use the mv result from the single mode as mv predictor.
*best_mv = frame_mv[refs[id]].as_mv;
......@@ -5659,10 +5658,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
bestsme = av1_get_mvpred_av_var(x, best_mv, &ref_mv[id].as_mv,
second_pred, &cpi->fn_ptr[bsize], 1);
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {
int dis; /* TODO: use dis in distortion calculation later. */
......@@ -6048,10 +6044,7 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
MV mvp_full;
int max_mv;
int cost_list[5];
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
MvLimits tmp_mv_limits = x->mv_limits;
/* Is the best so far sufficiently good that we cant justify doing
* and new motion search. */
......@@ -6101,7 +6094,7 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
// adjust src pointer for this block
mi_buf_shift(x, index);
av1_set_mv_search_range(x, &bsi->ref_mv[0]->as_mv);
av1_set_mv_search_range(&x->mv_limits, &bsi->ref_mv[0]->as_mv);
x->best_mv.as_int = x->second_best_mv.as_int = INVALID_MV;
......@@ -6113,10 +6106,7 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
cpi->sf.mv.subpel_search_method != SUBPEL_TREE ? cost_list : NULL,
&bsi->ref_mv[0]->as_mv, INT_MAX, 1);
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {
int distortion;
......@@ -6158,10 +6148,14 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
int this_var;
MV best_mv = x->best_mv.as_mv;
const MV ref_mv = bsi->ref_mv[0]->as_mv;
const int minc = AOMMAX(x->mv_col_min * 8, ref_mv.col - MV_MAX);
const int maxc = AOMMIN(x->mv_col_max * 8, ref_mv.col + MV_MAX);
const int minr = AOMMAX(x->mv_row_min * 8, ref_mv.row - MV_MAX);
const int maxr = AOMMIN(x->mv_row_max * 8, ref_mv.row + MV_MAX);
const int minc =
AOMMAX(x->mv_limits.col_min * 8, ref_mv.col - MV_MAX);
const int maxc =
AOMMIN(x->mv_limits.col_max * 8, ref_mv.col + MV_MAX);
const int minr =
AOMMAX(x->mv_limits.row_min * 8, ref_mv.row - MV_MAX);
const int maxr =
AOMMIN(x->mv_limits.row_max * 8, ref_mv.row + MV_MAX);
x->best_mv = x->second_best_mv;
if (x->best_mv.as_mv.row * 8 <= maxr &&
......@@ -6307,8 +6301,9 @@ static int64_t rd_pick_inter_best_sub8x8_mode(
}
// Trap vectors that reach beyond the UMV borders
if (mv_check_bounds(x, &mode_mv[this_mode][0].as_mv) ||
(has_second_rf && mv_check_bounds(x, &mode_mv[this_mode][1].as_mv)))
if (mv_check_bounds(&x->mv_limits, &mode_mv[this_mode][0].as_mv) ||
(has_second_rf &&
mv_check_bounds(&x->mv_limits, &mode_mv[this_mode][1].as_mv)))
continue;
if (filter_idx > 0) {
......@@ -6919,10 +6914,7 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
#endif // CONFIG_EXT_INTER
MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
MvLimits tmp_mv_limits = x->mv_limits;
int cost_list[5];
const YV12_BUFFER_CONFIG *scaled_ref_frame =
......@@ -6944,7 +6936,7 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL);
}
av1_set_mv_search_range(x, &ref_mv);
av1_set_mv_search_range(&x->mv_limits, &ref_mv);
#if CONFIG_REF_MV
av1_set_mvcost(x, ref, ref_idx, mbmi->ref_mv_idx);
......@@ -6997,7 +6989,7 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
}
}
av1_set_mv_search_range(x, &ref_mv);
av1_set_mv_search_range(&x->mv_limits, &ref_mv);
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode != SIMPLE_TRANSLATION)
......@@ -7030,10 +7022,7 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
}
#endif // CONFIG_MOTION_VAR
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {
int dis; /* TODO: use dis in distortion calculation later. */
......@@ -7067,10 +7056,14 @@ static void single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
1);
if (try_second) {
const int minc = AOMMAX(x->mv_col_min * 8, ref_mv.col - MV_MAX);
const int maxc = AOMMIN(x->mv_col_max * 8, ref_mv.col + MV_MAX);
const int minr = AOMMAX(x->mv_row_min * 8, ref_mv.row - MV_MAX);
const int maxr = AOMMIN(x->mv_row_max * 8, ref_mv.row + MV_MAX);
const int minc =
AOMMAX(x->mv_limits.col_min * 8, ref_mv.col - MV_MAX);
const int maxc =
AOMMIN(x->mv_limits.col_max * 8, ref_mv.col + MV_MAX);
const int minr =
AOMMAX(x->mv_limits.row_min * 8, ref_mv.row - MV_MAX);
const int maxr =
AOMMIN(x->mv_limits.row_max * 8, ref_mv.row + MV_MAX);
int this_var;
MV best_mv = x->best_mv.as_mv;
......@@ -7155,10 +7148,7 @@ static void do_masked_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
int ref = mbmi->ref_frame[ref_idx];
MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv;
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
MvLimits tmp_mv_limits = x->mv_limits;
const YV12_BUFFER_CONFIG *scaled_ref_frame =
av1_get_scaled_ref_frame(cpi, ref);
......@@ -7183,7 +7173,7 @@ static void do_masked_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
av1_setup_pre_planes(xd, ref_idx, scaled_ref_frame, mi_row, mi_col, NULL);
}
av1_set_mv_search_range(x, &ref_mv);
av1_set_mv_search_range(&x->mv_limits, &ref_mv);
// Work out the size of the first step in the mv step search.
// 0 here is maximum length first step. 1 is MAX >> 1 etc.
......@@ -7242,10 +7232,7 @@ static void do_masked_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
MAX_MVSEARCH_STEPS - 1 - step_param, 1, &cpi->fn_ptr[bsize], &ref_mv,
&tmp_mv->as_mv, ref_idx);
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {
int dis; /* TODO: use dis in distortion calculation later. */
......@@ -8648,7 +8635,7 @@ static int64_t handle_inter_mode(
cur_mv[i] = frame_mv[refs[i]];
// Clip "next_nearest" so that it does not extend to far out of image
if (this_mode != NEWMV) clamp_mv2(&cur_mv[i].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[i].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[i].as_mv)) return INT64_MAX;
mbmi->mv[i].as_int = cur_mv[i].as_int;
}
......@@ -8668,7 +8655,7 @@ static int64_t handle_inter_mode(
for (i = 0; i < 2; ++i) {
clamp_mv2(&cur_mv[i].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[i].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[i].as_mv)) return INT64_MAX;
mbmi->mv[i].as_int = cur_mv[i].as_int;
}
}
......@@ -8681,7 +8668,7 @@ static int64_t handle_inter_mode(
lower_mv_precision(&cur_mv[0].as_mv, cm->allow_high_precision_mv);
clamp_mv2(&cur_mv[0].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[0].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[0].as_mv)) return INT64_MAX;
mbmi->mv[0].as_int = cur_mv[0].as_int;
}
......@@ -8690,7 +8677,7 @@ static int64_t handle_inter_mode(
lower_mv_precision(&cur_mv[1].as_mv, cm->allow_high_precision_mv);
clamp_mv2(&cur_mv[1].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[1].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[1].as_mv)) return INT64_MAX;
mbmi->mv[1].as_int = cur_mv[1].as_int;
}
}
......@@ -8703,7 +8690,7 @@ static int64_t handle_inter_mode(
lower_mv_precision(&cur_mv[0].as_mv, cm->allow_high_precision_mv);
clamp_mv2(&cur_mv[0].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[0].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[0].as_mv)) return INT64_MAX;
mbmi->mv[0].as_int = cur_mv[0].as_int;
}
......@@ -8713,7 +8700,7 @@ static int64_t handle_inter_mode(
lower_mv_precision(&cur_mv[1].as_mv, cm->allow_high_precision_mv);
clamp_mv2(&cur_mv[1].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[1].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[1].as_mv)) return INT64_MAX;
mbmi->mv[1].as_int = cur_mv[1].as_int;
}
}
......@@ -8727,7 +8714,7 @@ static int64_t handle_inter_mode(
for (i = 0; i < 2; ++i) {
clamp_mv2(&cur_mv[i].as_mv, xd);
if (mv_check_bounds(x, &cur_mv[i].as_mv)) return INT64_MAX;
if (mv_check_bounds(&x->mv_limits, &cur_mv[i].as_mv)) return INT64_MAX;
mbmi->mv[i].as_int = cur_mv[i].as_int;
}
}
......@@ -10546,7 +10533,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
.this_mv;
clamp_mv2(&cur_mv.as_mv, xd);
if (!mv_check_bounds(x, &cur_mv.as_mv)) {
if (!mv_check_bounds(&x->mv_limits, &cur_mv.as_mv)) {
int_mv dummy_single_newmv[TOTAL_REFS_PER_FRAME] = { { 0 } };
#if CONFIG_EXT_INTER
int dummy_single_newmv_rate[TOTAL_REFS_PER_FRAME] = { 0 };
......
......@@ -258,10 +258,7 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi,
int distortion;
unsigned int sse;
int cost_list[5];
int tmp_col_min = x->mv_col_min;
int tmp_col_max = x->mv_col_max;
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
MvLimits tmp_mv_limits = x->mv_limits;
MV best_ref_mv1 = { 0, 0 };
MV best_ref_mv1_full; /* full-pixel value of best_ref_mv1 */
......@@ -282,7 +279,7 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi,
step_param = mv_sf->reduce_first_step_size;
step_param = AOMMIN(step_param, MAX_MVSEARCH_STEPS - 2);
av1_set_mv_search_range(x, &best_ref_mv1);
av1_set_mv_search_range(&x->mv_limits, &best_ref_mv1);
#if CONFIG_REF_MV
x->mvcost = x->mv_cost_stack[0];
......@@ -296,10 +293,7 @@ static int temporal_filter_find_matching_mb_c(AV1_COMP *cpi,
cond_cost_list(cpi, cost_list), &cpi->fn_ptr[BLOCK_16X16], 0,
&best_ref_mv1);
x->mv_col_min = tmp_col_min;
x->mv_col_max = tmp_col_max;
x->mv_row_min = tmp_row_min;
x->mv_row_max = tmp_row_max;
x->mv_limits = tmp_mv_limits;
// Ignore mv costing by sending NULL pointer instead of cost array
bestsme = cpi->find_fractional_mv_step(
......@@ -370,8 +364,9 @@ static void temporal_filter_iterate_c(AV1_COMP *cpi,
// 8 - AOM_INTERP_EXTEND.
// To keep the mv in play for both Y and UV planes the max that it
// can be on a border is therefore 16 - (2*AOM_INTERP_EXTEND+1).
cpi->td.mb.mv_row_min = -((mb_row * 16) + (17 - 2 * AOM_INTERP_EXTEND));
cpi->td.mb.mv_row_max =
cpi->td.mb.mv_limits.row_min =
-((mb_row * 16) + (17 - 2 * AOM_INTERP_EXTEND));
cpi->td.mb.mv_limits.row_max =
((mb_rows - 1 - mb_row) * 16) + (17 - 2 * AOM_INTERP_EXTEND);
for (mb_col = 0; mb_col < mb_cols; mb_col++) {
......@@ -381,8 +376,9 @@ static void temporal_filter_iterate_c(AV1_COMP *cpi,
memset(accumulator, 0, 16 * 16 * 3 * sizeof(accumulator[0]));
memset(count, 0, 16 * 16 * 3 * sizeof(count[0]));
cpi->td.mb.mv_col_min = -((mb_col * 16) + (17 - 2 * AOM_INTERP_EXTEND));
cpi->td.mb.mv_col_max =
cpi->td.mb.mv_limits.col_min =
-((mb_col * 16) + (17 - 2 * AOM_INTERP_EXTEND));
cpi->td.mb.mv_limits.col_max =
((mb_cols - 1 - mb_col) * 16) + (17 - 2 * AOM_INTERP_EXTEND);
for (frame = 0; frame < frame_count; frame++) {
......
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