The Compute Layout and Allocation Size algorithm is rounding up subsampled height but not subsampled width
Open
@Djuffin is already working on this.
Since May 31, 2025.
- Dominant language
- HTML
- Stars
- 1.3k
- Forks
- 194
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
When reading https://www.w3.org/TR/webcodecs/#videoframe-compute-layout-and-allocation-size, I can see:
Set computedLayout’s sourceTop to the result of the division of truncated parsedRect.y by sampleHeight, rounded up to the nearest integer.Set computedLayout’s sourceHeight to the result of the division of truncated parsedRect.height by sampleHeight, rounded up to the nearest integer.
On the other hand,the result of the integer division of truncated parsedRect.x by sampleWidthandthe result of the integer division of truncated parsedRect.width by sampleWidthare not rounded up.
Looking at Chromium implementation and WPT test webcodecs/videoFrame-odd-size.any.js, it seems rounding up should be applied for width as well.
@sandersdan, thoughts?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.