Skip to content

Account for interleaved samples in Compute Layout and Allocation Size - #962

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

Djuffin merged 1 commit into
w3c:mainfrom
jyavenard:fix-layout-sample-bytes

Conversation

@jyavenard

@jyavenard jyavenard commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

As mentioned in #961

The pixel format definitions use "sample" for a single component value (an NV12 UV element is "composed of two Chroma samples", and an RGBA pixel is four 8-bit samples). Compute Layout and Allocation Size used the number of bytes per sample as the size of each position in a plane, which undercounts planes that interleave several components: sourceLeftBytes and sourceWidthBytes were half the correct value for the NV12 UV plane and a quarter for RGBA, RGBX, BGRA and BGRX.

Multiply the bytes per sample by the number of samples stored at each position of the plane.


Preview | Diff

The pixel format definitions use "sample" for a single component value
(an NV12 UV element is "composed of two Chroma samples", and an RGBA
pixel is four 8-bit samples). Compute Layout and Allocation Size used the
number of bytes per sample as the size of each position in a plane, which
undercounts planes that interleave several components: sourceLeftBytes
and sourceWidthBytes were half the correct value for the NV12 UV plane
and a quarter for RGBA, RGBX, BGRA and BGRX.

Multiply the bytes per sample by the number of samples stored at each
position of the plane.
@Djuffin
Djuffin merged commit 924a4f8 into w3c:main Oct 7, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Oct 7, 2026
…#962)

SHA: 924a4f8
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.

2 participants