summaryrefslogtreecommitdiff
path: root/vpx_scale/generic/yv12extend.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2015-02-06 12:19:32 -0800
committerYaowu Xu <yaowu@google.com>2015-02-06 12:19:32 -0800
commit4bca73b609bfe9a5cb86fc25b69c6128d9041504 (patch)
tree9ceaf2ab6354ea7cffa82625484b03479d89cc6e /vpx_scale/generic/yv12extend.c
parent519b9141ad15bc06ace824aeb0cce40ffa810406 (diff)
downloadlibvpx-4bca73b609bfe9a5cb86fc25b69c6128d9041504.tar
libvpx-4bca73b609bfe9a5cb86fc25b69c6128d9041504.tar.gz
libvpx-4bca73b609bfe9a5cb86fc25b69c6128d9041504.tar.bz2
libvpx-4bca73b609bfe9a5cb86fc25b69c6128d9041504.zip
Correct the miscalculation in uv dimensions
The calculation of required extension used in HBD case was wrong due to rounding for UV when y dimension is odd. This commit replace the computation with correct version. This fixes a crash caused by writting beyond buffer boundary. Change-Id: Ic7c9afeb7388cd1341ec4974a611dacfb74ac6b6
Diffstat (limited to 'vpx_scale/generic/yv12extend.c')
-rw-r--r--vpx_scale/generic/yv12extend.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c
index 0485452ae..953527faf 100644
--- a/vpx_scale/generic/yv12extend.c
+++ b/vpx_scale/generic/yv12extend.c
@@ -122,17 +122,17 @@ void vp8_yv12_extend_frame_borders_c(YV12_BUFFER_CONFIG *ybf) {
extend_plane_high(
ybf->u_buffer, ybf->uv_stride,
- (ybf->y_crop_width + 1) / 2, (ybf->y_crop_height + 1) / 2,
- ybf->border / 2, ybf->border / 2,
- (ybf->border + ybf->y_height - ybf->y_crop_height + 1) / 2,
- (ybf->border + ybf->y_width - ybf->y_crop_width + 1) / 2);
+ ybf->uv_crop_width, ybf->uv_crop_height,
+ uv_border, uv_border,
+ uv_border + ybf->uv_height - ybf->uv_crop_height,
+ uv_border + ybf->uv_width - ybf->uv_crop_width);
extend_plane_high(
ybf->v_buffer, ybf->uv_stride,
- (ybf->y_crop_width + 1) / 2, (ybf->y_crop_height + 1) / 2,
- ybf->border / 2, ybf->border / 2,
- (ybf->border + ybf->y_height - ybf->y_crop_height + 1) / 2,
- (ybf->border + ybf->y_width - ybf->y_crop_width + 1) / 2);
+ ybf->uv_crop_width, ybf->uv_crop_height,
+ uv_border, uv_border,
+ uv_border + ybf->uv_height - ybf->uv_crop_height,
+ uv_border + ybf->uv_width - ybf->uv_crop_width);
return;
}
#endif