First pass mv_limits setting
Modified mv_limits setting in first pass motion search, making it
consistent with mv_limits in other encoder stages.
Speed 1 borg test result:
avg_psnr: ovr_psnr: ssim: speed change:
lowres: -0.016 -0.019 -0.020 -0.1%
midres: -0.043 -0.043 -0.037 0.1%
Minor impact on quality and speed.
STATS_CHANGED
Change-Id: Ia8315daf39d9ab6695f249dfe5b4d6eb9a475ac0
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index e2696a7..fd7dcd2 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -424,9 +424,8 @@
// Set up limit values for motion vectors to prevent them extending
// outside the UMV borders.
- 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;
+ av1_set_mv_row_limits(cm, &x->mv_limits, (mb_row << 2),
+ (16 >> MI_SIZE_LOG2), cpi->oxcf.border_in_pixels);
for (mb_col = 0; mb_col < cm->mb_cols; ++mb_col) {
int this_intra_error;
@@ -525,9 +524,8 @@
// Set up limit values for motion vectors to prevent them extending
// outside the UMV borders.
- 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;
+ av1_set_mv_col_limits(cm, &x->mv_limits, (mb_col << 2),
+ (16 >> MI_SIZE_LOG2), cpi->oxcf.border_in_pixels);
if (!frame_is_intra_only(cm)) { // Do a motion search
int tmp_err, motion_error, raw_motion_error;
diff --git a/av1/encoder/mcomp.h b/av1/encoder/mcomp.h
index 9d4f372..8a66cf1 100644
--- a/av1/encoder/mcomp.h
+++ b/av1/encoder/mcomp.h
@@ -29,9 +29,6 @@
#define MAX_FULL_PEL_VAL ((1 << (MAX_MVSEARCH_STEPS - 1)) - 1)
// Maximum size of the first step in full pel units
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS - 1))
-// Allowed motion vector pixel distance outside image border
-// for Block_16x16
-#define BORDER_MV_PIXELS_B16 (16 + AOM_INTERP_EXTEND)
#define SEARCH_RANGE_8P 3
#define SEARCH_GRID_STRIDE_8P (2 * SEARCH_RANGE_8P + 1)