Skip to content

Commit 9b8238a

Browse files
committed
Convert PredefinedColorSpace to VideoColorSpace
When describing VideoFrame conversion to RGB PredefinedColorSpace can't be used as a VideoFrame.colorSpace and it needs to be converted to the appropriate type ( VideoColorSpace )
1 parent 6fd01eb commit 9b8238a

1 file changed

Lines changed: 31 additions & 13 deletions

File tree

index.src.html

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,25 @@
155155
alpha channel is present.
156156

157157
: <dfn>sRGB Color Space</dfn>
158-
:: A {{VideoColorSpaceInit}} containing «[
159-
"primaries" → {{VideoColorPrimaries/bt709}},
160-
"transfer" → {{VideoTransferCharacteristics/iec61966-2-1}},
161-
"matrix" → {{VideoMatrixCoefficients/rgb}},
162-
"fullRange" → `true`]».
158+
:: A {{VideoColorSpace}} object, initialized as follows:
159+
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
160+
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
161+
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
162+
4. {{VideoColorSpace/[[full range]]}} is set to `true`
163+
164+
: <dfn>Display P3 Color Space</dfn>
165+
:: A {{VideoColorSpace}} object, initialized as follows:
166+
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/smpte432}},
167+
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
168+
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
169+
4. {{VideoColorSpace/[[full range]]}} is set to `true`
163170

164171
: <dfn>REC709 Color Space</dfn>
165-
:: A {{VideoColorSpaceInit}} containing «[
166-
"primaries" → {{VideoColorPrimaries/bt709}},
167-
"transfer" → {{VideoTransferCharacteristics/bt709}},
168-
"matrix" → {{VideoMatrixCoefficients/bt709}},
169-
"fullRange" → `false`]».
172+
:: A {{VideoColorSpace}} object, initialized as follows:
173+
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
174+
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/bt709}},
175+
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/bt709}},
176+
4. {{VideoColorSpace/[[full range]]}} is set to `false`
170177

171178
: <dfn lt="saturated">Codec Saturation</dfn>
172179
:: The state of an underlying codec implementation where the number of active
@@ -3696,7 +3703,7 @@
36963703
:: The presentation timestamp, given in microseconds. For decode,
36973704
timestamp is copied from the {{EncodedVideoChunk}} corresponding
36983705
to this {{VideoFrame}}. For encode, timestamp is copied to the
3699-
{{EncodedVideoChunk}}s corresponding to this {{VideoFrame}}.
3706+
{{EncodedVideoChunk}}s corresponding to this {{VideoFrame}}.
37003707

37013708
The {{VideoFrame/timestamp}} getter steps are to return
37023709
{{VideoFrame/[[timestamp]]}}.
@@ -4205,6 +4212,14 @@
42054212
[=combined buffer layout/allocationSize=].
42064213
9. Return |combinedLayout|.
42074214

4215+
: <dfn>Convert PredefinedColorSpace to VideoColorSpace</dfn> (with |colorSpace|)
4216+
:: 1. This algorithm <em class="rfc2119">MUST</em> be called only if |colorSpace|
4217+
is equal to one of {{srgb}}, {{display-p3}}.
4218+
2. If |colorSpace| is equal to {{srgb}} return a new instance of the
4219+
[=sRGB Color Space=]
4220+
3. If |colorSpace| is equal to {{display-p3}} return a new instance of the
4221+
[=Display P3 Color Space=]
4222+
42084223
: <dfn for=VideoFrame>Convert to RGB frame</dfn> (with |frame|, |format| and |colorSpace|)
42094224
:: 1. This algorithm <em class="rfc2119">MUST</em> be called only if |format|
42104225
is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}.
@@ -4221,11 +4236,14 @@
42214236
6. Assign |frame|'s {{VideoFrame/[[duration]]}} and |frame|'s
42224237
{{VideoFrame/[[timestamp]]}} to {{VideoFrame/[[duration]]}} and
42234238
{{VideoFrame/[[timestamp]]}} respectively.
4224-
7. Assign |colorSpace| to {{VideoFrame/[[color space]]}}.
4239+
7. Assign the result of running the <a>Convert
4240+
PredefinedColorSpace to VideoColorSpace</a> algorithm with
4241+
|colorSpace| to {{VideoFrame/[[color space]]}}.
42254242
8. Let |resource| be a new [=media resource=] containing the result of
42264243
conversion of [=media resource=] referenced by |frame|'s
42274244
{{VideoFrame/[[resource reference]]}} into a color space and pixel
4228-
format specified by |colorSpace| and |format| respectively.
4245+
format specified by {{VideoFrame/[[color space]]}} and
4246+
{{VideoFrame/[[format]]}} respectively.
42294247
9. Assign the reference to |resource| to {{VideoFrame/[[resource reference]]}}
42304248
3. Return |convertedFrame|.
42314249

0 commit comments

Comments
 (0)