Skip to content

Commit

Permalink
Apply stride_align to byte count, not pixel count
Browse files Browse the repository at this point in the history
stride_align is documented to be the "alignment, in bytes, of each row
in the image (stride)."

Change-Id: I4663f2fdf264800a0b8441772749920780248fbe
  • Loading branch information
wantehchang committed Apr 10, 2024
1 parent 60653df commit a38ab61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aom/src/aom_image.c
Expand Up @@ -119,8 +119,9 @@ static aom_image_t *img_alloc_helper(
assert(d_h <= h);

uint64_t s = (fmt & AOM_IMG_FMT_PLANAR) ? w : (uint64_t)bps * w / bit_depth;
s = (s + 2 * border + stride_align - 1) & ~((uint64_t)stride_align - 1);
s = s + 2 * border;
s = s * bit_depth / 8;
s = (s + stride_align - 1) & ~((uint64_t)stride_align - 1);
if (s > INT_MAX) goto fail;
const int stride_in_bytes = (int)s;

Expand Down

0 comments on commit a38ab61

Please sign in to comment.