summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2017-10-10 23:02:05 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-10 23:02:05 +0000
commitdcfae2cc64345b8f0a67044cd07a64bed7d9a8fe (patch)
treecd210bb10a05be8d0f5ad824b96170366cc3f879
parent017257a317be2605e91341b20f539028730dc89b (diff)
parent33c598990bc771d7367fe6282bd445e92cd856a6 (diff)
downloadlibvpx-dcfae2cc64345b8f0a67044cd07a64bed7d9a8fe.tar
libvpx-dcfae2cc64345b8f0a67044cd07a64bed7d9a8fe.tar.gz
libvpx-dcfae2cc64345b8f0a67044cd07a64bed7d9a8fe.tar.bz2
libvpx-dcfae2cc64345b8f0a67044cd07a64bed7d9a8fe.zip
Merge "Fix alignment in vpx_image without external allocation."
-rw-r--r--vpx/src/vpx_image.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vpx/src/vpx_image.c b/vpx/src/vpx_image.c
index ebd3d7f74..af7c529a7 100644
--- a/vpx/src/vpx_image.c
+++ b/vpx/src/vpx_image.c
@@ -112,10 +112,10 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt,
if (!img_data) {
uint64_t alloc_size;
/* Calculate storage sizes given the chroma subsampling */
- align = xcs ? (1 << xcs) - 1 : 1;
- w = (d_w + align - 1) & ~(align - 1);
- align = ycs ? (1 << ycs) - 1 : 1;
- h = (d_h + align - 1) & ~(align - 1);
+ align = (1 << xcs) - 1;
+ w = (d_w + align) & ~align;
+ align = (1 << ycs) - 1;
+ h = (d_h + align) & ~align;
s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
s = (s + stride_align - 1) & ~(stride_align - 1);