From 9b7be888839c884451646905bd54b5861aac592b Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Wed, 13 Mar 2013 17:09:05 -0700 Subject: Fix pulsing issue with scaling Updates the YV12_BUFFER_CONFIG structure to be crop-aware. The exiting width/height parameters are left unchanged, storing the width and height algined to a 16 byte boundary. The cropped dimensions are added as new fields. This fixes a nasty visual pulse when switching between scaled and unscaled frame dimensions due to a mismatch between the scaling ratio and the 16-byte aligned sizes. Change-Id: Id4a3f6aea6b9b9ae38bdfa1b87b7eb2cfcdd57b6 --- vp9/common/vp9_alloccommon.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'vp9/common/vp9_alloccommon.c') diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c index c3d6dae93..15c8c0d64 100644 --- a/vp9/common/vp9_alloccommon.c +++ b/vp9/common/vp9_alloccommon.c @@ -67,16 +67,13 @@ void vp9_de_alloc_frame_buffers(VP9_COMMON *oci) { int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) { int i; + int aligned_width, aligned_height; vp9_de_alloc_frame_buffers(oci); /* our internal buffers are always multiples of 16 */ - if ((width & 0xf) != 0) - width += 16 - (width & 0xf); - - if ((height & 0xf) != 0) - height += 16 - (height & 0xf); - + aligned_width = (width + 15) & ~15; + aligned_height = (height + 15) & ~15; for (i = 0; i < NUM_YV12_BUFFERS; i++) { oci->fb_idx_ref_cnt[i] = 0; @@ -110,8 +107,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) { return 1; } - oci->mb_rows = height >> 4; - oci->mb_cols = width >> 4; + oci->mb_rows = aligned_height >> 4; + oci->mb_cols = aligned_width >> 4; oci->MBs = oci->mb_rows * oci->mb_cols; oci->mode_info_stride = oci->mb_cols + 1; oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO)); -- cgit v1.2.3