ref: d602500d4ae6e8936ee630e92b56f87005a14828
parent: a0af41697582349310c32292e9c9ff733a412da3
author: Yaowu Xu <[email protected]>
date: Wed Oct 8 05:06:36 EDT 2014
Fix src frame buffer copy and extend For input source with size that is not multiple of 8, the size is rounded to 8 and saved in width or height, the original source sizes are saved in crop_width and crop_height. This commit corrects the computation of bottom and right extension amounts to use the orignal sizes, hence crop_width and crop_height. In addition, this commit also adds the missed initialization for uv_crop_width and uv_crop_height. This addresses issue #834 Change-Id: I084543ca7645a4964b88f7cf8ff668f517d3a39b
--- a/vp9/encoder/vp9_extend.c
+++ b/vp9/encoder/vp9_extend.c
@@ -110,10 +110,10 @@
// 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 multiple
// 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 eb_y = MAX(src->y_width + 16, ALIGN_POWER_OF_TWO(src->y_width, 6))
+ - src->y_crop_width;
+ const int er_y = MAX(src->y_height + 16, ALIGN_POWER_OF_TWO(src->y_height, 6))
+ - src->y_crop_height;
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;
@@ -125,17 +125,17 @@
if (src->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
- src->y_width, src->y_height,
+ src->y_crop_width, src->y_crop_height,
et_y, el_y, eb_y, er_y);
highbd_copy_and_extend_plane(src->u_buffer, src->uv_stride,
dst->u_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
highbd_copy_and_extend_plane(src->v_buffer, src->uv_stride,
dst->v_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
return;
}
@@ -143,17 +143,17 @@
copy_and_extend_plane(src->y_buffer, src->y_stride,
dst->y_buffer, dst->y_stride,
- src->y_width, src->y_height,
+ src->y_crop_width, src->y_crop_height,
et_y, el_y, eb_y, er_y);
copy_and_extend_plane(src->u_buffer, src->uv_stride,
dst->u_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
copy_and_extend_plane(src->v_buffer, src->uv_stride,
dst->v_buffer, dst->uv_stride,
- src->uv_width, src->uv_height,
+ src->uv_crop_width, src->uv_crop_height,
et_uv, el_uv, eb_uv, er_uv);
}
--- a/vp9/vp9_iface_common.h
+++ b/vp9/vp9_iface_common.h
@@ -87,6 +87,8 @@
: yv12->y_width;
yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2
: yv12->y_height;
+ yv12->uv_crop_width = yv12->uv_width;
+ yv12->uv_crop_height = yv12->uv_height;
yv12->y_stride = img->stride[VPX_PLANE_Y];
yv12->uv_stride = img->stride[VPX_PLANE_U];