w3c / w3c/webcodecs

The Compute Layout and Allocation Size algorithm is rounding up subsampled height but not subsampled width

Open
#897 0 comments 0 reactions 1 assignee View on GitHub

@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 sampleWidth and the result of the integer division of truncated parsedRect.width by sampleWidth are 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.