summaryrefslogtreecommitdiff
path: root/vp8/encoder/onyx_if.c
diff options
context:
space:
mode:
authorYunqing Wang <yunqingwang@google.com>2011-02-16 12:00:25 -0500
committerYunqing Wang <yunqingwang@google.com>2011-02-16 12:57:17 -0500
commitda227b901d5f97e1ffbbb7ffe3fddf8d015164cd (patch)
treec473fea6d5786c03643816dc5d6d4c48294720cc /vp8/encoder/onyx_if.c
parent7725a7eb56e74ebbdba14d01cfe85a151f81bf1c (diff)
downloadlibvpx-da227b901d5f97e1ffbbb7ffe3fddf8d015164cd.tar
libvpx-da227b901d5f97e1ffbbb7ffe3fddf8d015164cd.tar.gz
libvpx-da227b901d5f97e1ffbbb7ffe3fddf8d015164cd.tar.bz2
libvpx-da227b901d5f97e1ffbbb7ffe3fddf8d015164cd.zip
Allocate source buffers to be multiples of 16
Currently, when the video frame width is not multiples of 16, the source buffer has a stride of non-multiples of 16, which forces an unaligned load in SAD function and hurts the performance. To avoid that, this change allocates source buffers to be multiples of 16. Change-Id: Ib7506e3eb2cea06657d56be5a899f38dfe3eeb39
Diffstat (limited to 'vp8/encoder/onyx_if.c')
-rw-r--r--vp8/encoder/onyx_if.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 3f787d6da..47c46cae8 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1280,6 +1280,8 @@ void vp8_set_speed_features(VP8_COMP *cpi)
static void alloc_raw_frame_buffers(VP8_COMP *cpi)
{
int i, buffers;
+ /* allocate source_buffer to be multiples of 16 */
+ int width = (cpi->oxcf.Width + 15) & ~15;
buffers = cpi->oxcf.lag_in_frames;
@@ -1291,7 +1293,7 @@ static void alloc_raw_frame_buffers(VP8_COMP *cpi)
for (i = 0; i < buffers; i++)
if (vp8_yv12_alloc_frame_buffer(&cpi->src_buffer[i].source_buffer,
- cpi->oxcf.Width, cpi->oxcf.Height,
+ width, cpi->oxcf.Height,
16))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate lag buffer");
@@ -1299,7 +1301,7 @@ static void alloc_raw_frame_buffers(VP8_COMP *cpi)
#if VP8_TEMPORAL_ALT_REF
if (vp8_yv12_alloc_frame_buffer(&cpi->alt_ref_buffer.source_buffer,
- cpi->oxcf.Width, cpi->oxcf.Height, 16))
+ width, cpi->oxcf.Height, 16))
vpx_internal_error(&cpi->common.error, VPX_CODEC_MEM_ERROR,
"Failed to allocate altref buffer");