Skip to content

Commit

Permalink
Add borders to w first, before all manipulations.
Browse files Browse the repository at this point in the history
This allows the border samples to be multiplied by bps / bit_depth for
non-planar formats.

Change-Id: I4c7e2d4fd6e21049963bf21ee9e55ee6683dde30
  • Loading branch information
wantehchang committed Apr 10, 2024
1 parent a38ab61 commit dac747e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aom/src/aom_image.c
Expand Up @@ -118,8 +118,8 @@ static aom_image_t *img_alloc_helper(
const unsigned int h = align_image_dimension(d_h, ycs, size_align);
assert(d_h <= h);

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

0 comments on commit dac747e

Please sign in to comment.