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

Adds support for BT 2100 PQ HDR pixels in PNG #284

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added spec/icc/TTML2_COLOR_ITUR2100PQFull.icc
Binary file not shown.
Binary file modified spec/rnc/schema.zip
Binary file not shown.
255 changes: 201 additions & 54 deletions spec/ttml2.html

Large diffs are not rendered by default.

330 changes: 330 additions & 0 deletions spec/ttml2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6802,6 +6802,13 @@ based on the actual character content of that document.</p>
<div3 id="embedded-content-vocabulary-image">
<head>image</head>
<p>The <el>image</el> element is used to define an author supplied <loc href="#terms-image-resource">image resource</loc>.</p>

<note role="clarification">
<p>
<specref ref="png-hdr-signaling"/> specifies a means of using ITU BT.2100 PQ full-range images with the PNG Format.
</p>
</note>

<p>An <el>image</el> element may appear in two contexts: (1) as a child of a <loc href="#embedded-content-vocabulary-resources"><el>resources</el></loc> element and
(2) as a child of an element in the <loc href="#element-vocab-group-block">Block.class</loc> element group, namely, as a child of a
<loc href="#content-vocabulary-div"><el>div</el></loc> or <loc href="#content-vocabulary-p"><el>p</el></loc> element, or
Expand Down Expand Up @@ -10005,6 +10012,144 @@ represented by this attribute are based upon that defined by <bibref ref="xsl11"
&sect; 7.9.9.</p>
</note>
</div3>
<div3 id="style-attribute-hdrAbsoluteLuminanceGain">
<head>tts:hdrAbsoluteLuminanceGain</head>
<p>The <att>tts:hdrAbsoluteLuminanceGain</att> allows the author to specify the absolute luminance of a region when it is composited onto images with greater dynamic range
than sRGB images.</p>
<note role="clarification">
<p>The sRGB colorspace specifies an absolute reference white point luminance of 80 cd∙m<sup>-2</sup>.
As a result, sRGB elements, i.e. elements whose color is specified in the sRGB space, cannot be
reliably composited with high-dynamic range (HDR) images intended for display with significantly
greater peak luminance, e.g. images that use the PQ EOTF specified in <bibref ref="bt2100_1"/>. Specifically:
<ulist>
<item><p>sRGB elements can appear too dim if they remains unscaled and the average luminance of the scene
exceeds 80 cd∙m<sup>-2</sup>; and
</p></item>
<item><p>conversely, sRGB elements can appear too bright if they are uniformly scaled to an arbitrary large
luminance, say 10,000 cd∙m<sup>-2</sup>.
</p>
</item>
</ulist>
</p>
</note>
<p>This attribute may be specified by any
element type
that permits use of attributes in the TT Style Namespace; however, this attribute applies
as a style property only to those element types indicated in the following table.</p>
<table id="style-property-details-hdrAbsoluteLuminanceGain" role="common">
<col css="width: 25%;"/>
<col/>
<tbody>
<tr>
<td><emph>Values:</emph></td>
<td>
<code><loc href="#style-value-non-negative-integer">&lt;non-negative-integer&gt;</loc></code>
</td>
</tr>
<tr>
<td><emph>Initial:</emph></td>
<td><code>1</code></td>
</tr>
<tr>
<td><emph>Applies to:</emph></td>
<td>
<loc href="#content-vocabulary-region"><el>region</el></loc>
</td>
</tr>
<tr>
<td><emph>Inherited:</emph></td>
<td>yes</td>
</tr>
<tr>
<td><emph>Percentages:</emph></td>
<td>N/A</td>
</tr>
<tr>
<td><emph>Animatable:</emph></td>
<td>discrete</td>
</tr>
</tbody>
</table>

<p>When applying <att>tts:hdrAbsoluteLuminanceGain</att>, the linear optical output value
(C<sub>r</sub>, C<sub>g</sub>, C<sub>b</sub>)
of the components of a pixel of a region is given by:
</p>
<p>
(C<sub>r</sub>, C<sub>g</sub>, C<sub>b</sub>) = 80 cd∙m<sup>-2</sup> ∙ <att>tts:hdrAbsoluteLuminanceGain</att> ∙ (r, g, b)
</p>
<p>
where (r, g, b) are the normalized linear sRGB components of the pixel.
</p>

<table id="hdr-computation-example" role="example">
<caption>Example &ndash; Absolute linear optical output calculation using tts:hdrAbsoluteLuminanceGain</caption>
<tbody>
<tr>
<td>
<slist>
<sitem>
Given <code>tts:hdrAbsoluteLuminanceGain="1.5"</code>, the absolute linear optical output of the components of a rendered pixel with color <code>rgb(218,165,32)</code> is:
</sitem>
<sitem>
(109.83, 56.28, 1.1) cd∙m<sup>-2</sup> ≈ 80 cd∙m<sup>-2</sup> ∙ 1.5 ∙((218/255)<sup>2.4</sup>, (165/255)<sup>2.4</sup>, (32/255)<sup>2.4</sup>)
</sitem>
</slist>
</td>
</tr>
</tbody>
</table>

<p>
<specref ref="absolute-hdr-compositing"/> provides a detailed example of compositing sRGB pixels onto HDR pixels using <att>tts:hdrAbsoluteLuminanceGain</att>.
</p>

<note role="clarification">
<p>
As specified in <specref ref="style-value-color"/>, blending of a <loc href="#terms-document-instance">document instance</loc> onto a target image is typically performed using pixel components encoded using
the inverse EOTF of the target image, as opposed to pixel components expressed in
linear light. As a result, the use of semi-transparent regions can yield
perceptually different results depending on the inverse EOTF used by the target
image, especially when there is a large luminance difference between the pixels of the <loc href="#terms-document-instance">document instance</loc> and the target image, e.g. video. Authors are therefore encouraged to consider visual results involving semi-transparent elements.
</p>
</note>

<p>If a computed value of the property associated with this attribute is not supported,
then a <loc href="#terms-presentation-processor">presentation processor</loc> must use the closest value.</p>

<p>The style is illustrated by the following example.</p>
<table id="style-attribute-hdrAbsoluteLuminanceGain-example-1" role="example">
<caption>Example Fragment &ndash; tts:hdrAbsoluteLuminanceGain</caption>
<tbody>
<tr>
<td>
<eg xml:space="preserve">
&lt;region xml:id="r1"&gt;
&lt;style tts:extent="60% 20%"/&gt;
&lt;style tts:origin="10% 70%"/&gt;
&lt;style tts:backgroundColor="black"/&gt;
&lt;style tts:color="white"/&gt;
&lt;style tts:hdrAbsoluteLuminanceGain="3.8"/&gt;
&lt;/region&gt;
&lt;region xml:id="r2"&gt;
&lt;style tts:extent="60% 20%"/&gt;
&lt;style tts:origin="10% 10%"/&gt;
&lt;style tts:backgroundColor="black"/&gt;
&lt;style tts:color="white"/&gt;
&lt;/region&gt;
...
&lt;p region="r1"&gt;
The absolute luminance of this text is specified higher 3.8 times brighter than the other text.
&lt;/p&gt;
&lt;p region="r2"&gt;
The other text.
&lt;/p&gt;
</eg>
</td>
</tr>
</tbody>
</table>
</div3>
<div3 id="style-attribute-ipd">
<head>tts:ipd</head>
<p>The <att>tts:ipd</att> attribute is used to specify the
Expand Down Expand Up @@ -23195,13 +23340,22 @@ href="http://www.w3.org/2001/tag/doc/namespaceState-2006-01-09.html">The Disposi
of Names in an XML Namespace</titleref>, TAG Finding, 9 January 2006. (See
<xspecref href="http://www.w3.org/2001/tag/doc/namespaceState-2006-01-09.html">http://www.w3.org/2001/tag/doc/namespaceState-2006-01-09</xspecref>.)
</bibl>

<bibl id="png" key="PNG">David Duce, <titleref
href="http://www.w3.org/TR/2003/REC-PNG-20031110">Portable Network Graphics (PNG) Specification (Second Edition)</titleref>.
</bibl>

<bibl id="qaf-sg" key="QAF SG">Karl Dubost, et al.,
<titleref
href="http://www.w3.org/TR/2005/REC-qaframe-spec-20050817/">QA
Framework: Specifications Guidelines</titleref>, W3C Recommendation, 17
August 2005. (See
<xspecref href="http://www.w3.org/TR/qaframe-spec/">http://www.w3.org/TR/qaframe-spec/</xspecref>.)
</bibl>
<bibl id="bt2100_1" key="ITU BT.2100-1">Recommendation ITU-R BT.2100-1,
<titleref
href="https://www.itu.int/rec/R-REC-BT.2100">Image parameter values for high dynamic range television for use in production and international programme exchange</titleref>
</bibl>
<bibl id="smiththreed" key="SMITH">Smith, Michael D.; Malia, Jason, <titleref
href="http://ieeexplore.ieee.org/document/7269419/">Controlling Miniaturization in Stereoscopic 3D Imagery</titleref>, in Motion Imaging Journal, SMPTE , vol.124, no.3, pp.50-58, April 2015 doi: 10.5594/m001513.
</bibl>
Expand Down Expand Up @@ -25170,6 +25324,182 @@ where <emph>chunking</emph> refers to the subdivision of resource content into c

</inform-div1>

<inform-div1 id="absolute-hdr-compositing">
<head>HDR Compositing Example</head>
<p>
The following illustrates the use of <att>tts:hdrAbsoluteLuminanceGain</att> to composite sRGB pixels onto HDR pixels.
</p>
<olist>
<item>
<p>
Let (r, g, b) be a full-range 8-bit sRGB pixel with opacity a between 0 and 1.
</p>
</item>
<item>
<p>
Let (R, G, B) and (R<sub>c</sub>, G<sub>c</sub>, B<sub>c</sub>) be full-range 10-bit pixels in the system colorimetry specified in <bibref ref="bt2100_1"/> using PQ EOTF and full-range quantization, with opacity A and A<sub>c</sub> between 0 and 1.
</p>
</item>
<item>
<p>
Inverse the 8-bit full-range quantization:
</p><p>
(r, g, b) / 255 → (r, g, b)
</p>
</item>
<item>
<p>
Linearize using the sRGB EOTF:
</p><p>
(r<sup>2.4</sup>, g<sup>2.4</sup>, b<sup>2.4</sup>) → (r, g, b)
</p>
</item>
<item>
<p>
Compute HDR absolute luminance using the <att>tts:hdrAbsoluteLuminanceGain</att> attribute and the sRGB illuminant:
</p><p>
80 cd∙m<sup>-2</sup> ∙ <att>tts:hdrAbsoluteLuminanceGain</att> ∙ (r, g, b) → (r, g, b)
</p>
</item>
<item>
<p>
Convert from sRGB color space to <bibref ref="bt2100_1"/> color space:
</p><p>
[(0.62740389593470, 0.32928303837789, 0.04331306568741),
(0.06909728935823, 0.91954039507545, 0.01136231556630),
(0.01639143887515, 0.08801330787723, 0.89559525324763)] ∙ (r, g, b) → (r, g, b)
</p>
</item>
<item>
<p>
Normalize to 10,000 cd∙m<sup>-2</sup>:
</p><p>
(r, g, b) / 10000 cd∙m<sup>-2</sup> → (r, g, b)
</p>
</item>
<item>
<p>
Apply inverse PQ EOTF specified in <bibref ref="bt2100_1"/>:
</p><p>
(PQ(r), PQ(g), PQ(b)) → (r, g, b)
</p><p>
with PQ(L) = [(c1 + c2 ∙ L<sup>m1</sup>) / (1 + c3 ∙ L<sup>m1</sup>)]<sup>m2</sup> and m1 = 0.1593017578125, m2 = 78.84375, c1 = 0.8359375, c2 = 18.8515625, and c3 = 18.6875.
</p>
</item>
<item>
<p>
Apply opacity:
</p><p>
(1-a) ∙ (r, g, b) → (r, g, b)
</p>
</item>
<item>
<p>
Apply 10-bit full-range quantization:
</p><p>
(Q(r), Q(g), Q(b)) → (r, g, b)
</p><p>
where Q(N) = floor(1023 ∙ N + 0.5)
</p>
</item>
<item>
<p>
Composite to yield (R<sub>c</sub>, G<sub>c</sub>, B<sub>c</sub>)
</p><p>
(clamp(r + R), clamp(g + G), clamp(b + B)) → (R<sub>c</sub>, G<sub>c</sub>, B<sub>c</sub>)
</p><p>
1 + (1 - a) ∙ (A - 1) → A<sub>c</sub>
</p><p>
where clamp(x) = {x, if x ∈ [0, 1023]} or {1023, if x > 1023}
</p>
</item>
</olist>

</inform-div1>

<div1 id="png-hdr-signaling">
<head>Using ITU BT.2100 PQ full-range images with the PNG Format</head>
<p><emph>This appendix is normative.</emph></p>
<div2>
<head>Introduction</head>
<p>The <code>gAMA</code> chunk of the Portable Network Graphics (PNG) format (specified in <bibref ref="png"/>) parameterizes the transfer function of the image as a power law.
As such, it cannot model the PQ transfer function specified in <bibref ref="bt2100_1"/>, which is commonly used for HDR images.</p>
<p>The following specifies a means of storing iITU BT.2100 PQ full-range images in the PNG format, without
modification to existing chunks or the introduction of new chunks.</p>
</div2>


<div2>
<head>HDR PNG File</head>
<p>
The file shall conform to <bibref ref="png"/>.
</p><p>
The image type shall be <code>truecolor</code>.
</p><p>
The file shall contain an <code>iCCP</code> chunk with a profile name equal to
one of the values in <specref ref="hdr-systems"/>.
</p><p>
The embedded ICC profile of the <code>iCCP</code> chunk, the <code>cHRM</code> chunk and the <code>gAMA</code> chunk should be set according to the profile
name, as specified in <specref ref="hdr-systems"/>.
</p>
<note role="clarification">
<p>
The <code>gAMA</code>, <code>cHRM</code> and embedded ICC profile are provided
for compatibility with processors that do not conform to this Appendix.
</p>
</note>
<p>
The embedded ICC profile shall be compressed using Method 0, as specified in <bibref ref="png"/>.
</p>
<table id="hdr-systems" role="common">
<caption>HDR Systems</caption>
<thead>
<tr>
<th>Pixel Color Specifications</th>
<th><code>iCCP</code> Chunk Profile Name</th>
<th><code>iCCP</code> Chunk Embedded ICC Profile</th>
<th><code>gAMA</code> Chunk</th>
<th><code>cHRM</code> Chunk</th>
</tr>
</thead>
<tbody>
<tr>
<td>Full-range PQ as specified in <bibref ref="bt2100_1"/></td>
<td><code>TTML2_COLOR_ITUR2100PQFull</code></td>
<td><loc href="icc/TTML2_COLOR_ITUR2100PQFull.icc">TTML2_COLOR_ITUR2100PQFull.icc</loc></td>
<td>15000</td>
<td>

<table>
<thead>
<tr><th>Parameter</th><th>Value</th></tr>
</thead>
<tbody>
<tr><th>White point x</th><th>31270</th></tr>
<tr><th>White point y</th><th>32900</th></tr>
<tr><th>Red x</th><th>70800</th></tr>
<tr><th>Red y</th><th>29200</th></tr>
<tr><th>Green x</th><th>17000</th></tr>
<tr><th>Green y</th><th>79700</th></tr>
<tr><th>Blue x</th><th>13100</th></tr>
<tr><th>Blue y</th><th>4600</th></tr>
</tbody>
</table>

</td>
</tr>
</tbody>
</table>
<note role="clarification">
<p>
The value of the <code>gAMA</code> chunk is selected for a close match to the PQ EOTF below 100 nits.
</p>
</note>

</div2>

</div1>

&acknowledgements;
</back>
</spec>
Binary file modified spec/xsd/schema.zip
Binary file not shown.