Skip to content

Commit 4bea332

Browse files
authored
Merge pull request #835 from Djuffin/color
Convert PredefinedColorSpace to VideoColorSpace
2 parents 2c47490 + 737c7a2 commit 4bea332

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

index.src.html

Lines changed: 30 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,13 @@
42054212
[=combined buffer layout/allocationSize=].
42064213
9. Return |combinedLayout|.
42074214

4215+
: <dfn>Convert PredefinedColorSpace to VideoColorSpace</dfn> (with |colorSpace|)
4216+
:: 1. Assert: |colorSpace| is equal to one of {{srgb}} or {{display-p3}}.
4217+
2. If |colorSpace| is equal to {{srgb}} return a new instance of the
4218+
[=sRGB Color Space=]
4219+
3. If |colorSpace| is equal to {{display-p3}} return a new instance of the
4220+
[=Display P3 Color Space=]
4221+
42084222
: <dfn for=VideoFrame>Convert to RGB frame</dfn> (with |frame|, |format| and |colorSpace|)
42094223
:: 1. This algorithm <em class="rfc2119">MUST</em> be called only if |format|
42104224
is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}.
@@ -4221,11 +4235,14 @@
42214235
6. Assign |frame|'s {{VideoFrame/[[duration]]}} and |frame|'s
42224236
{{VideoFrame/[[timestamp]]}} to {{VideoFrame/[[duration]]}} and
42234237
{{VideoFrame/[[timestamp]]}} respectively.
4224-
7. Assign |colorSpace| to {{VideoFrame/[[color space]]}}.
4238+
7. Assign the result of running the <a>Convert
4239+
PredefinedColorSpace to VideoColorSpace</a> algorithm with
4240+
|colorSpace| to {{VideoFrame/[[color space]]}}.
42254241
8. Let |resource| be a new [=media resource=] containing the result of
42264242
conversion of [=media resource=] referenced by |frame|'s
42274243
{{VideoFrame/[[resource reference]]}} into a color space and pixel
4228-
format specified by |colorSpace| and |format| respectively.
4244+
format specified by {{VideoFrame/[[color space]]}} and
4245+
{{VideoFrame/[[format]]}} respectively.
42294246
9. Assign the reference to |resource| to {{VideoFrame/[[resource reference]]}}
42304247
3. Return |convertedFrame|.
42314248

0 commit comments

Comments
 (0)