Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert PredefinedColorSpace to VideoColorSpace #835

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions index.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,25 @@
alpha channel is present.

: <dfn>sRGB Color Space</dfn>
:: A {{VideoColorSpaceInit}} containing «[
"primaries" → {{VideoColorPrimaries/bt709}},
"transfer" → {{VideoTransferCharacteristics/iec61966-2-1}},
"matrix" → {{VideoMatrixCoefficients/rgb}},
"fullRange" → `true`]».
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
4. {{VideoColorSpace/[[full range]]}} is set to `true`

: <dfn>Display P3 Color Space</dfn>
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/smpte432}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/iec61966-2-1}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/rgb}},
4. {{VideoColorSpace/[[full range]]}} is set to `true`

: <dfn>REC709 Color Space</dfn>
:: A {{VideoColorSpaceInit}} containing «[
"primaries" → {{VideoColorPrimaries/bt709}},
"transfer" → {{VideoTransferCharacteristics/bt709}},
"matrix" → {{VideoMatrixCoefficients/bt709}},
"fullRange" → `false`]».
:: A {{VideoColorSpace}} object, initialized as follows:
1. {{VideoColorSpace/[[primaries]]}} is set to {{VideoColorPrimaries/bt709}},
2. {{VideoColorSpace/[[transfer]]}} is set to {{VideoTransferCharacteristics/bt709}},
3. {{VideoColorSpace/[[matrix]]}} is set to {{VideoMatrixCoefficients/bt709}},
4. {{VideoColorSpace/[[full range]]}} is set to `false`

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

The {{VideoFrame/timestamp}} getter steps are to return
{{VideoFrame/[[timestamp]]}}.
Expand Down Expand Up @@ -4205,6 +4212,13 @@
[=combined buffer layout/allocationSize=].
9. Return |combinedLayout|.

: <dfn>Convert PredefinedColorSpace to VideoColorSpace</dfn> (with |colorSpace|)
:: 1. Assert: |colorSpace| is equal to one of {{srgb}} or {{display-p3}}.
2. If |colorSpace| is equal to {{srgb}} return a new instance of the
[=sRGB Color Space=]
3. If |colorSpace| is equal to {{display-p3}} return a new instance of the
[=Display P3 Color Space=]

: <dfn for=VideoFrame>Convert to RGB frame</dfn> (with |frame|, |format| and |colorSpace|)
:: 1. This algorithm <em class="rfc2119">MUST</em> be called only if |format|
is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}.
Expand All @@ -4221,11 +4235,14 @@
6. Assign |frame|'s {{VideoFrame/[[duration]]}} and |frame|'s
{{VideoFrame/[[timestamp]]}} to {{VideoFrame/[[duration]]}} and
{{VideoFrame/[[timestamp]]}} respectively.
7. Assign |colorSpace| to {{VideoFrame/[[color space]]}}.
7. Assign the result of running the <a>Convert
PredefinedColorSpace to VideoColorSpace</a> algorithm with
|colorSpace| to {{VideoFrame/[[color space]]}}.
8. Let |resource| be a new [=media resource=] containing the result of
conversion of [=media resource=] referenced by |frame|'s
{{VideoFrame/[[resource reference]]}} into a color space and pixel
format specified by |colorSpace| and |format| respectively.
format specified by {{VideoFrame/[[color space]]}} and
{{VideoFrame/[[format]]}} respectively.
9. Assign the reference to |resource| to {{VideoFrame/[[resource reference]]}}
3. Return |convertedFrame|.

Expand Down