Skip to content

Round up sub-sampled width in Compute Layout and Allocation Size - #964

Merged
Djuffin merged 1 commit into
w3c:mainfrom
jyavenard:fix-layout-width-rounding
Oct 7, 2026
Merged

Djuffin merged 1 commit into
w3c:mainfrom
jyavenard:fix-layout-width-rounding

Conversation

@jyavenard

@jyavenard jyavenard commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Step 9 computed sourceWidthBytes using the integer division of the rect width by the horizontal sub-sampling factor, while step 7 rounds the sub-sampled height up and the pixel format definitions round both dimensions up. For a rect with an odd width, this dropped the last chroma column: a 3x3 I420 frame got a chroma stride of 1 and an allocation size of 13 instead of 2 and 17, as expected by
webcodecs/videoFrame-odd-size.any.js.

Round the division up, matching step 7.

Fixes #963


Preview | Diff

Step 9 computed sourceWidthBytes using the integer division of the rect
width by the horizontal sub-sampling factor, while step 7 rounds the
sub-sampled height up and the pixel format definitions round both
dimensions up. For a rect with an odd width, this dropped the last chroma
column: a 3x3 I420 frame got a chroma stride of 1 and an allocation size
of 13 instead of 2 and 17, as expected by
webcodecs/videoFrame-odd-size.any.js.

Round the division up, matching step 7.

Fixes w3c#963
@Djuffin
Djuffin merged commit 6f4d6eb into w3c:main Oct 7, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Oct 7, 2026
SHA: 6f4d6eb
Reason: push, by Djuffin

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compute Layout and Allocation Size rounds sub-sampled widths down but heights up

2 participants