Fix mv clamping when superres is used BUG=aomedia:862 Change-Id: Ide71432cb85858362360e3c4ae8404f75ff9ba03
diff --git a/aom_scale/yv12config.h b/aom_scale/yv12config.h index 0c47f65..994b1b0 100644 --- a/aom_scale/yv12config.h +++ b/aom_scale/yv12config.h
@@ -31,7 +31,11 @@ // TODO(jingning): Use unified inter predictor for encoder and // decoder during the development process. Revisit the frame border // to improve the decoder performance. +#if CONFIG_EXT_PARTITION && CONFIG_FRAME_SUPERRES +#define AOM_BORDER_IN_PIXELS 288 +#else #define AOM_BORDER_IN_PIXELS 160 +#endif // CONFIG_EXT_PARTITION typedef struct yv12_buffer_config { union {
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index a1a22a0..703c364 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c
@@ -1336,10 +1336,10 @@ pos_x += SCALE_EXTRA_OFF; pos_y += SCALE_EXTRA_OFF; - const int top = -((AOM_INTERP_EXTEND + bh) << SCALE_SUBPEL_BITS); + const int top = -AOM_LEFT_TOP_MARGIN_SCALED; + const int left = -AOM_LEFT_TOP_MARGIN_SCALED; const int bottom = (pre_buf->height + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; - const int left = -((AOM_INTERP_EXTEND + bw) << SCALE_SUBPEL_BITS); const int right = (pre_buf->width + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; pos_y = clamp(pos_y, top, bottom); @@ -1494,10 +1494,10 @@ // Clamp against the reference frame borders, with enough extension // that we don't force the reference block to be partially onscreen. - const int top = -((AOM_INTERP_EXTEND + bh) << SCALE_SUBPEL_BITS); + const int top = -AOM_LEFT_TOP_MARGIN_SCALED; + const int left = -AOM_LEFT_TOP_MARGIN_SCALED; const int bottom = (pre_buf->height + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; - const int left = -((AOM_INTERP_EXTEND + bw) << SCALE_SUBPEL_BITS); const int right = (pre_buf->width + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; pos_y = clamp(pos_y, top, bottom); @@ -3227,10 +3227,10 @@ pos_x += SCALE_EXTRA_OFF; pos_y += SCALE_EXTRA_OFF; - const int top = -((AOM_INTERP_EXTEND + bh) << SCALE_SUBPEL_BITS); + const int top = -AOM_LEFT_TOP_MARGIN_SCALED; + const int left = -AOM_LEFT_TOP_MARGIN_SCALED; const int bottom = (pre_buf->height + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; - const int left = -((AOM_INTERP_EXTEND + bw) << SCALE_SUBPEL_BITS); const int right = (pre_buf->width + AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS; pos_y = clamp(pos_y, top, bottom); pos_x = clamp(pos_x, left, right);
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index 0c33333..b5af38d 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h
@@ -28,6 +28,9 @@ #define WARP_GM_NEIGHBORS_WITH_OBMC 0 #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION +#define AOM_LEFT_TOP_MARGIN_SCALED \ + ((AOM_BORDER_IN_PIXELS - AOM_INTERP_EXTEND) << SCALE_SUBPEL_BITS) + #ifdef __cplusplus extern "C" { #endif