Skip to content

Commit 6f4d6eb

Browse files
authored
Round up sub-sampled width in Compute Layout and Allocation Size (#964)
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
1 parent 924a4f8 commit 6f4d6eb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎index.src.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4324,9 +4324,9 @@
43244324
truncated |parsedRect|.{{DOMRectInit/x}} by |sampleWidth|,
43254325
multiplied by |sampleBytes|.
43264326
9. Set |computedLayout|'s [=computed plane layout/sourceWidthBytes=] to
4327-
the result of the integer division of
4328-
truncated |parsedRect|.{{DOMRectInit/width}} by |sampleWidth|,
4329-
multiplied by |sampleBytes|.
4327+
the result of the division of truncated
4328+
|parsedRect|.{{DOMRectInit/width}} by |sampleWidth|, rounded up to
4329+
the nearest integer, multiplied by |sampleBytes|.
43304330
10. If |layout| is not `undefined`:
43314331
1. Let |planeLayout| be the {{PlaneLayout}} in |layout| at position
43324332
|planeIndex|.

0 commit comments

Comments
 (0)