Skip to content

Commit 924a4f8

Browse files
authored
Account for interleaved samples in Compute Layout and Allocation Size (#962)
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.
1 parent 6d8e3d3 commit 924a4f8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎index.src.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4303,7 +4303,10 @@
43034303
7. While |planeIndex| < |numPlanes|:
43044304
1. Let |plane| be the Plane identified by |planeIndex| as defined by
43054305
|format|.
4306-
2. Let |sampleBytes| be the number of bytes per sample for |plane|.
4306+
2. Let |sampleBytes| be the number of bytes per sample for |plane|,
4307+
multiplied by the number of samples stored at each position of
4308+
|plane| (for example, 2 for the UV plane of {{NV12}} and 4 for
4309+
{{RGBA}}).
43074310
3. Let |sampleWidth| be the horizontal [=sub-sampling factor=] of each
43084311
subsample for |plane|.
43094312
4. Let |sampleHeight| be the vertical [=sub-sampling factor=] of each

0 commit comments

Comments
 (0)