From c184665ecdbf6d58690ef8560e9d9f5a3a872e47 Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 16 Nov 2017 20:19:09 -0800 Subject: [PATCH] WebPPictureAllocARGB: align argb allocation Change-Id: Ib390e8bbb97b38316a38af6a33e8a26bd050ee16 --- src/enc/picture_enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/enc/picture_enc.c b/src/enc/picture_enc.c index 1069c59e..e6e75568 100644 --- a/src/enc/picture_enc.c +++ b/src/enc/picture_enc.c @@ -76,13 +76,12 @@ int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height) { return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION); } // allocate a new buffer. - memory = WebPSafeMalloc(argb_size, sizeof(*picture->argb)); + memory = WebPSafeMalloc(argb_size + WEBP_ALIGN_CST, sizeof(*picture->argb)); if (memory == NULL) { return WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY); } - // TODO(skal): align plane to cache line? picture->memory_argb_ = memory; - picture->argb = (uint32_t*)memory; + picture->argb = (uint32_t*)WEBP_ALIGN(memory); picture->argb_stride = width; return 1; }