From: Yaowu Xu Date: Fri, 23 Aug 2013 23:22:50 +0000 (-0700) Subject: Reduce the amount of extension in src frames X-Git-Tag: v1.3.0~475^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65c2444e1561eabb9604c9be186993508ea6f666;p=libvpx Reduce the amount of extension in src frames The commit changes the border pixel extension from 160 pixel each side to what is necessary in arnr filter or motion estimation portion, i.e. 16 pixel on top and left side. For right or bottom side, the extension is changed to either round up image size to multiple of 64 or at least 16 pixels. Change-Id: Ic05e19b94368c1ab4df568723aae5734e6c3d2c5 --- diff --git a/vp9/common/vp9_extend.c b/vp9/common/vp9_extend.c index d8496c4f2..07c68c84a 100644 --- a/vp9/common/vp9_extend.c +++ b/vp9/common/vp9_extend.c @@ -57,15 +57,23 @@ static void copy_and_extend_plane(const uint8_t *src, int src_pitch, void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst) { - const int et_y = dst->border; - const int el_y = dst->border; - const int eb_y = dst->border + dst->y_height - src->y_height; - const int er_y = dst->border + dst->y_width - src->y_width; - - const int et_uv = dst->border >> (dst->uv_height != dst->y_height); - const int el_uv = dst->border >> (dst->uv_width != dst->y_width); - const int eb_uv = et_uv + dst->uv_height - src->uv_height; - const int er_uv = el_uv + dst->uv_width - src->uv_width; + // Extend src frame in buffer + // Altref filtering assumes 16 pixel extension + const int et_y = 16; + const int el_y = 16; + // Motion estimation may use src block variance with the block size up + // to 64x64, so the right and bottom need to be extended to 64 mulitple + // or up to 16, whichever is greater. + const int eb_y = MAX(ALIGN_POWER_OF_TWO(src->y_width, 6) - src->y_width, + 16); + const int er_y = MAX(ALIGN_POWER_OF_TWO(src->y_height, 6) - src->y_height, + 16); + const int uv_width_subsampling = (src->uv_width != src->y_width); + const int uv_height_subsampling = (src->uv_height != src->y_height); + const int et_uv = et_y >> uv_height_subsampling; + const int el_uv = el_y >> uv_width_subsampling; + const int eb_uv = eb_y >> uv_height_subsampling; + const int er_uv = er_y >> uv_width_subsampling; #if CONFIG_ALPHA const int et_a = dst->border >> (dst->alpha_height != dst->y_height);