OSDN Git Service

camera_metadata: Update android.tonemap.* definitions
authorIgor Murashkin <iam@google.com>
Tue, 14 Jan 2014 00:51:17 +0000 (16:51 -0800)
committerIgor Murashkin <iam@google.com>
Sat, 18 Jan 2014 01:23:02 +0000 (17:23 -0800)
Change-Id: Icdabd02d892018b104955146a4d94b5042ea59d8

camera/docs/docs.html
camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png [new file with mode: 0644]
camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png [new file with mode: 0644]
camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png [new file with mode: 0644]
camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png [new file with mode: 0644]
camera/docs/metadata_properties.xml

index 16cc369..d037da4 100644 (file)
@@ -12761,6 +12761,32 @@ generation</p>
             </td>
 
           </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>When switching to an application-defined contrast curve by setting
+<a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> to CONTRAST_<wbr/>CURVE,<wbr/> the curve is defined
+per-channel with a set of <code>(in,<wbr/> out)</code> points that specify the
+mapping from input high-bit-depth pixel value to the output
+low-bit-depth value.<wbr/>  Since the actual pixel ranges of both input
+and output may change depending on the camera pipeline,<wbr/> the values
+are specified by normalized floating-point numbers.<wbr/></p>
+<p>More-complex color mapping operations such as 3D color look-up
+tables,<wbr/> selective chroma enhancement,<wbr/> or other non-linear color
+transforms will be disabled when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
+<p>When using either FAST or HIGH_<wbr/>QUALITY,<wbr/> the camera device will
+emit its own tonemap curve in <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a>,<wbr/>
+<a href="#controls_android.tonemap.curveGreen">android.<wbr/>tonemap.<wbr/>curve<wbr/>Green</a>,<wbr/> and <a href="#controls_android.tonemap.curveBlue">android.<wbr/>tonemap.<wbr/>curve<wbr/>Blue</a>.<wbr/>
+These values are always available,<wbr/> and as close as possible to the
+actually used nonlinear/<wbr/>nonglobal transforms.<wbr/></p>
+<p>If a request is sent with TRANSFORM_<wbr/>MATRIX with the camera device's
+provided curve in FAST or HIGH_<wbr/>QUALITY,<wbr/> the image's tonemap will be
+roughly the same.<wbr/></p>
+            </td>
+          </tr>
 
 
           <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
@@ -13161,8 +13187,9 @@ illumination</p>
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping blue input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the blue
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
@@ -13182,9 +13209,7 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the blue
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
+              <p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
             </td>
           </tr>
 
@@ -13211,8 +13236,9 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping green input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the green
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
@@ -13232,9 +13258,7 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the green
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
+              <p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
             </td>
           </tr>
 
@@ -13244,7 +13268,7 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
         
                 
           <tr class="entry" id="controls_android.tonemap.curveRed">
-            <td class="entry_name" rowspan="3">
+            <td class="entry_name" rowspan="5">
               android.<wbr/>tonemap.<wbr/>curve<wbr/>Red
             </td>
             <td class="entry_type">
@@ -13261,15 +13285,17 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping red input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the red
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
             </td>
 
             <td class="entry_range">
-              <p>0-1 on input and output coordinates.<wbr/></p>
+              <p>0-1 on both input and output coordinates,<wbr/> normalized
+as a floating-point value such that 0 == black and 1 == white.<wbr/></p>
             </td>
 
             <td class="entry_tags">
@@ -13284,28 +13310,67 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the red
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>Since the input and output ranges may vary depending on
-the camera pipeline,<wbr/> the input and output pixel values
-are represented by normalized floating-point values
-between 0 and 1,<wbr/> with 0 == black and 1 == white.<wbr/></p>
-<p>The curve should be linearly interpolated between the
-defined points.<wbr/> The points will be listed in increasing
-order of P_<wbr/>IN.<wbr/> For example,<wbr/> if the array is: [0.<wbr/>0,<wbr/> 0.<wbr/>0,<wbr/>
-0.<wbr/>3,<wbr/> 0.<wbr/>5,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0],<wbr/> then the input-&gt;output mapping
-for a few sample points would be: 0 -&gt; 0,<wbr/> 0.<wbr/>15 -&gt;
-0.<wbr/>25,<wbr/> 0.<wbr/>3 -&gt; 0.<wbr/>5,<wbr/> 0.<wbr/>5 -&gt; 0.<wbr/>64</p>
+              <p>Each channel's curve is defined by an array of control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> =
+  [ P0in,<wbr/> P0out,<wbr/> P1in,<wbr/> P1out,<wbr/> P2in,<wbr/> P2out,<wbr/> P3in,<wbr/> P3out,<wbr/> ...,<wbr/> PNin,<wbr/> PNout ]
+2 &lt;= N &lt;= <a href="#static_android.tonemap.maxCurvePoints">android.<wbr/>tonemap.<wbr/>max<wbr/>Curve<wbr/>Points</a></code></pre>
+<p>These are sorted in order of increasing <code>Pin</code>; it is always
+guaranteed that input values 0.<wbr/>0 and 1.<wbr/>0 are included in the list to
+define a complete mapping.<wbr/> For input values between control points,<wbr/>
+the camera device must linearly interpolate between the control
+points.<wbr/></p>
+<p>Each curve can have an independent number of points,<wbr/> and the number
+of points can be less than max (that is,<wbr/> the request doesn't have to
+always provide a curve with number of points equivalent to
+<a href="#static_android.tonemap.maxCurvePoints">android.<wbr/>tonemap.<wbr/>max<wbr/>Curve<wbr/>Points</a>).<wbr/></p>
+<p>A few examples,<wbr/> and their corresponding graphical mappings; these
+only specify the red channel and the precision is limited to 4
+digits,<wbr/> for conciseness.<wbr/></p>
+<p>Linear mapping:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [ 0,<wbr/> 0,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0 ]
+</code></pre>
+<p><img alt="Linear mapping curve" src="images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png"/></p>
+<p>Invert mapping:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [ 0,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0,<wbr/> 0 ]
+</code></pre>
+<p><img alt="Inverting mapping curve" src="images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png"/></p>
+<p>Gamma 1/<wbr/>2.<wbr/>2 mapping,<wbr/> with 16 control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [
+  0.<wbr/>0000,<wbr/> 0.<wbr/>0000,<wbr/> 0.<wbr/>0667,<wbr/> 0.<wbr/>2920,<wbr/> 0.<wbr/>1333,<wbr/> 0.<wbr/>4002,<wbr/> 0.<wbr/>2000,<wbr/> 0.<wbr/>4812,<wbr/>
+  0.<wbr/>2667,<wbr/> 0.<wbr/>5484,<wbr/> 0.<wbr/>3333,<wbr/> 0.<wbr/>6069,<wbr/> 0.<wbr/>4000,<wbr/> 0.<wbr/>6594,<wbr/> 0.<wbr/>4667,<wbr/> 0.<wbr/>7072,<wbr/>
+  0.<wbr/>5333,<wbr/> 0.<wbr/>7515,<wbr/> 0.<wbr/>6000,<wbr/> 0.<wbr/>7928,<wbr/> 0.<wbr/>6667,<wbr/> 0.<wbr/>8317,<wbr/> 0.<wbr/>7333,<wbr/> 0.<wbr/>8685,<wbr/>
+  0.<wbr/>8000,<wbr/> 0.<wbr/>9035,<wbr/> 0.<wbr/>8667,<wbr/> 0.<wbr/>9370,<wbr/> 0.<wbr/>9333,<wbr/> 0.<wbr/>9691,<wbr/> 1.<wbr/>0000,<wbr/> 1.<wbr/>0000 ]
+</code></pre>
+<p><img alt="Gamma = 1/2.2 tonemapping curve" src="images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png"/></p>
+<p>Standard sRGB gamma mapping,<wbr/> per IEC 61966-2-1:1999,<wbr/> with 16 control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [
+  0.<wbr/>0000,<wbr/> 0.<wbr/>0000,<wbr/> 0.<wbr/>0667,<wbr/> 0.<wbr/>2864,<wbr/> 0.<wbr/>1333,<wbr/> 0.<wbr/>4007,<wbr/> 0.<wbr/>2000,<wbr/> 0.<wbr/>4845,<wbr/>
+  0.<wbr/>2667,<wbr/> 0.<wbr/>5532,<wbr/> 0.<wbr/>3333,<wbr/> 0.<wbr/>6125,<wbr/> 0.<wbr/>4000,<wbr/> 0.<wbr/>6652,<wbr/> 0.<wbr/>4667,<wbr/> 0.<wbr/>7130,<wbr/>
+  0.<wbr/>5333,<wbr/> 0.<wbr/>7569,<wbr/> 0.<wbr/>6000,<wbr/> 0.<wbr/>7977,<wbr/> 0.<wbr/>6667,<wbr/> 0.<wbr/>8360,<wbr/> 0.<wbr/>7333,<wbr/> 0.<wbr/>8721,<wbr/>
+  0.<wbr/>8000,<wbr/> 0.<wbr/>9063,<wbr/> 0.<wbr/>8667,<wbr/> 0.<wbr/>9389,<wbr/> 0.<wbr/>9333,<wbr/> 0.<wbr/>9701,<wbr/> 1.<wbr/>0000,<wbr/> 1.<wbr/>0000 ]
+</code></pre>
+<p><img alt="sRGB tonemapping curve" src="images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png"/></p>
             </td>
           </tr>
 
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">HAL Implementation Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>For good quality of mapping,<wbr/> at least 128 control points are
+preferred.<wbr/></p>
+<p>A typical use case of this would be a gamma-1/<wbr/>2.<wbr/>2 curve,<wbr/> with as many
+control points used as are available.<wbr/></p>
+            </td>
+          </tr>
 
           <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
            <!-- end of entry -->
         
                 
           <tr class="entry" id="controls_android.tonemap.mode">
-            <td class="entry_name" rowspan="1">
+            <td class="entry_name" rowspan="3">
               android.<wbr/>tonemap.<wbr/>mode
             </td>
             <td class="entry_type">
@@ -13317,23 +13382,30 @@ for a few sample points would be: 0 -&gt; 0,<wbr/> 0.<wbr/>15 -&gt;
                   <li>
                     <span class="entry_type_enum_name">CONTRAST_CURVE</span>
                     <span class="entry_type_enum_notes"><p>Use the tone mapping curve specified in
-android.<wbr/>tonemap.<wbr/>curve</p></span>
+android.<wbr/>tonemap.<wbr/>curve.<wbr/></p>
+<p>All color enhancement and tonemapping must be disabled,<wbr/> except
+for applying the tonemapping curve specified by
+<a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a>,<wbr/> <a href="#controls_android.tonemap.curveBlue">android.<wbr/>tonemap.<wbr/>curve<wbr/>Blue</a>,<wbr/> or
+<a href="#controls_android.tonemap.curveGreen">android.<wbr/>tonemap.<wbr/>curve<wbr/>Green</a>.<wbr/></p>
+<p>Must not slow down frame rate relative to raw
+sensor output.<wbr/></p></span>
                   </li>
                   <li>
                     <span class="entry_type_enum_name">FAST</span>
-                    <span class="entry_type_enum_notes"><p>Must not slow down frame rate relative to raw
-bayer output</p></span>
+                    <span class="entry_type_enum_notes"><p>Advanced gamma mapping and color enhancement may be applied.<wbr/></p>
+<p>Should not slow down frame rate relative to raw sensor output.<wbr/></p></span>
                   </li>
                   <li>
                     <span class="entry_type_enum_name">HIGH_QUALITY</span>
-                    <span class="entry_type_enum_notes"><p>Frame rate may be reduced by high
-quality</p></span>
+                    <span class="entry_type_enum_notes"><p>Advanced gamma mapping and color enhancement may be applied.<wbr/></p>
+<p>May slow down frame rate relative to raw sensor output.<wbr/></p></span>
                   </li>
                 </ul>
 
             </td> <!-- entry_type -->
 
             <td class="entry_description">
+              <p>High-level global contrast/<wbr/>gamma/<wbr/>tonemapping control.<wbr/></p>
             </td>
 
             <td class="entry_units">
@@ -13346,6 +13418,32 @@ quality</p></span>
             </td>
 
           </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>When switching to an application-defined contrast curve by setting
+<a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> to CONTRAST_<wbr/>CURVE,<wbr/> the curve is defined
+per-channel with a set of <code>(in,<wbr/> out)</code> points that specify the
+mapping from input high-bit-depth pixel value to the output
+low-bit-depth value.<wbr/>  Since the actual pixel ranges of both input
+and output may change depending on the camera pipeline,<wbr/> the values
+are specified by normalized floating-point numbers.<wbr/></p>
+<p>More-complex color mapping operations such as 3D color look-up
+tables,<wbr/> selective chroma enhancement,<wbr/> or other non-linear color
+transforms will be disabled when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
+<p>When using either FAST or HIGH_<wbr/>QUALITY,<wbr/> the camera device will
+emit its own tonemap curve in <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a>,<wbr/>
+<a href="#controls_android.tonemap.curveGreen">android.<wbr/>tonemap.<wbr/>curve<wbr/>Green</a>,<wbr/> and <a href="#controls_android.tonemap.curveBlue">android.<wbr/>tonemap.<wbr/>curve<wbr/>Blue</a>.<wbr/>
+These values are always available,<wbr/> and as close as possible to the
+actually used nonlinear/<wbr/>nonglobal transforms.<wbr/></p>
+<p>If a request is sent with TRANSFORM_<wbr/>MATRIX with the camera device's
+provided curve in FAST or HIGH_<wbr/>QUALITY,<wbr/> the image's tonemap will be
+roughly the same.<wbr/></p>
+            </td>
+          </tr>
 
 
           <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
@@ -13380,7 +13478,7 @@ quality</p></span>
 
                 
           <tr class="entry" id="static_android.tonemap.maxCurvePoints">
-            <td class="entry_name" rowspan="1">
+            <td class="entry_name" rowspan="5">
               android.<wbr/>tonemap.<wbr/>max<wbr/>Curve<wbr/>Points
             </td>
             <td class="entry_type">
@@ -13393,21 +13491,44 @@ quality</p></span>
 
             <td class="entry_description">
               <p>Maximum number of supported points in the
-tonemap curve</p>
+tonemap curve that can be used for <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a>,<wbr/> or
+<a href="#controls_android.tonemap.curveGreen">android.<wbr/>tonemap.<wbr/>curve<wbr/>Green</a>,<wbr/> or <a href="#controls_android.tonemap.curveBlue">android.<wbr/>tonemap.<wbr/>curve<wbr/>Blue</a>.<wbr/></p>
             </td>
 
             <td class="entry_units">
             </td>
 
             <td class="entry_range">
-              <p>&gt;= 128</p>
+              <p>&gt;= 64</p>
             </td>
 
             <td class="entry_tags">
             </td>
 
           </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>If the actual number of points provided by the application (in
+android.<wbr/>tonemap.<wbr/>curve*)  is less than max,<wbr/> the camera device will
+resample the curve to its internal representation,<wbr/> using linear
+interpolation.<wbr/></p>
+<p>The output curves in the result metadata may have a different number
+of points than the input curves,<wbr/> and will represent the actual
+hardware curves used as closely as possible when linearly interpolated.<wbr/></p>
+            </td>
+          </tr>
 
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">HAL Implementation Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>This value must be at least 64.<wbr/> This should be at least 128.<wbr/></p>
+            </td>
+          </tr>
 
           <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
            <!-- end of entry -->
@@ -13458,8 +13579,9 @@ tonemap curve</p>
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping blue input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the blue
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
@@ -13479,9 +13601,7 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the blue
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
+              <p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
             </td>
           </tr>
 
@@ -13508,8 +13628,9 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping green input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the green
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
@@ -13529,9 +13650,7 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the green
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
+              <p>See <a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> for more details.<wbr/></p>
             </td>
           </tr>
 
@@ -13541,7 +13660,7 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
         
                 
           <tr class="entry" id="dynamic_android.tonemap.curveRed">
-            <td class="entry_name" rowspan="3">
+            <td class="entry_name" rowspan="5">
               android.<wbr/>tonemap.<wbr/>curve<wbr/>Red
             </td>
             <td class="entry_type">
@@ -13558,15 +13677,17 @@ channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr
             </td> <!-- entry_type -->
 
             <td class="entry_description">
-              <p>Table mapping red input values to output
-values</p>
+              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the red
+channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is
+CONTRAST_<wbr/>CURVE.<wbr/></p>
             </td>
 
             <td class="entry_units">
             </td>
 
             <td class="entry_range">
-              <p>0-1 on input and output coordinates.<wbr/></p>
+              <p>0-1 on both input and output coordinates,<wbr/> normalized
+as a floating-point value such that 0 == black and 1 == white.<wbr/></p>
             </td>
 
             <td class="entry_tags">
@@ -13581,28 +13702,67 @@ values</p>
           </tr>
           <tr class="entry_cont">
             <td class="entry_details" colspan="5">
-              <p>Tonemapping /<wbr/> contrast /<wbr/> gamma curve for the red
-channel,<wbr/> to use when <a href="#controls_android.tonemap.mode">android.<wbr/>tonemap.<wbr/>mode</a> is CONTRAST_<wbr/>CURVE.<wbr/></p>
-<p>Since the input and output ranges may vary depending on
-the camera pipeline,<wbr/> the input and output pixel values
-are represented by normalized floating-point values
-between 0 and 1,<wbr/> with 0 == black and 1 == white.<wbr/></p>
-<p>The curve should be linearly interpolated between the
-defined points.<wbr/> The points will be listed in increasing
-order of P_<wbr/>IN.<wbr/> For example,<wbr/> if the array is: [0.<wbr/>0,<wbr/> 0.<wbr/>0,<wbr/>
-0.<wbr/>3,<wbr/> 0.<wbr/>5,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0],<wbr/> then the input-&gt;output mapping
-for a few sample points would be: 0 -&gt; 0,<wbr/> 0.<wbr/>15 -&gt;
-0.<wbr/>25,<wbr/> 0.<wbr/>3 -&gt; 0.<wbr/>5,<wbr/> 0.<wbr/>5 -&gt; 0.<wbr/>64</p>
+              <p>Each channel's curve is defined by an array of control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> =
+  [ P0in,<wbr/> P0out,<wbr/> P1in,<wbr/> P1out,<wbr/> P2in,<wbr/> P2out,<wbr/> P3in,<wbr/> P3out,<wbr/> ...,<wbr/> PNin,<wbr/> PNout ]
+2 &lt;= N &lt;= <a href="#static_android.tonemap.maxCurvePoints">android.<wbr/>tonemap.<wbr/>max<wbr/>Curve<wbr/>Points</a></code></pre>
+<p>These are sorted in order of increasing <code>Pin</code>; it is always
+guaranteed that input values 0.<wbr/>0 and 1.<wbr/>0 are included in the list to
+define a complete mapping.<wbr/> For input values between control points,<wbr/>
+the camera device must linearly interpolate between the control
+points.<wbr/></p>
+<p>Each curve can have an independent number of points,<wbr/> and the number
+of points can be less than max (that is,<wbr/> the request doesn't have to
+always provide a curve with number of points equivalent to
+<a href="#static_android.tonemap.maxCurvePoints">android.<wbr/>tonemap.<wbr/>max<wbr/>Curve<wbr/>Points</a>).<wbr/></p>
+<p>A few examples,<wbr/> and their corresponding graphical mappings; these
+only specify the red channel and the precision is limited to 4
+digits,<wbr/> for conciseness.<wbr/></p>
+<p>Linear mapping:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [ 0,<wbr/> 0,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0 ]
+</code></pre>
+<p><img alt="Linear mapping curve" src="images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png"/></p>
+<p>Invert mapping:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [ 0,<wbr/> 1.<wbr/>0,<wbr/> 1.<wbr/>0,<wbr/> 0 ]
+</code></pre>
+<p><img alt="Inverting mapping curve" src="images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png"/></p>
+<p>Gamma 1/<wbr/>2.<wbr/>2 mapping,<wbr/> with 16 control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [
+  0.<wbr/>0000,<wbr/> 0.<wbr/>0000,<wbr/> 0.<wbr/>0667,<wbr/> 0.<wbr/>2920,<wbr/> 0.<wbr/>1333,<wbr/> 0.<wbr/>4002,<wbr/> 0.<wbr/>2000,<wbr/> 0.<wbr/>4812,<wbr/>
+  0.<wbr/>2667,<wbr/> 0.<wbr/>5484,<wbr/> 0.<wbr/>3333,<wbr/> 0.<wbr/>6069,<wbr/> 0.<wbr/>4000,<wbr/> 0.<wbr/>6594,<wbr/> 0.<wbr/>4667,<wbr/> 0.<wbr/>7072,<wbr/>
+  0.<wbr/>5333,<wbr/> 0.<wbr/>7515,<wbr/> 0.<wbr/>6000,<wbr/> 0.<wbr/>7928,<wbr/> 0.<wbr/>6667,<wbr/> 0.<wbr/>8317,<wbr/> 0.<wbr/>7333,<wbr/> 0.<wbr/>8685,<wbr/>
+  0.<wbr/>8000,<wbr/> 0.<wbr/>9035,<wbr/> 0.<wbr/>8667,<wbr/> 0.<wbr/>9370,<wbr/> 0.<wbr/>9333,<wbr/> 0.<wbr/>9691,<wbr/> 1.<wbr/>0000,<wbr/> 1.<wbr/>0000 ]
+</code></pre>
+<p><img alt="Gamma = 1/2.2 tonemapping curve" src="images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png"/></p>
+<p>Standard sRGB gamma mapping,<wbr/> per IEC 61966-2-1:1999,<wbr/> with 16 control points:</p>
+<pre><code><a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a> = [
+  0.<wbr/>0000,<wbr/> 0.<wbr/>0000,<wbr/> 0.<wbr/>0667,<wbr/> 0.<wbr/>2864,<wbr/> 0.<wbr/>1333,<wbr/> 0.<wbr/>4007,<wbr/> 0.<wbr/>2000,<wbr/> 0.<wbr/>4845,<wbr/>
+  0.<wbr/>2667,<wbr/> 0.<wbr/>5532,<wbr/> 0.<wbr/>3333,<wbr/> 0.<wbr/>6125,<wbr/> 0.<wbr/>4000,<wbr/> 0.<wbr/>6652,<wbr/> 0.<wbr/>4667,<wbr/> 0.<wbr/>7130,<wbr/>
+  0.<wbr/>5333,<wbr/> 0.<wbr/>7569,<wbr/> 0.<wbr/>6000,<wbr/> 0.<wbr/>7977,<wbr/> 0.<wbr/>6667,<wbr/> 0.<wbr/>8360,<wbr/> 0.<wbr/>7333,<wbr/> 0.<wbr/>8721,<wbr/>
+  0.<wbr/>8000,<wbr/> 0.<wbr/>9063,<wbr/> 0.<wbr/>8667,<wbr/> 0.<wbr/>9389,<wbr/> 0.<wbr/>9333,<wbr/> 0.<wbr/>9701,<wbr/> 1.<wbr/>0000,<wbr/> 1.<wbr/>0000 ]
+</code></pre>
+<p><img alt="sRGB tonemapping curve" src="images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png"/></p>
             </td>
           </tr>
 
+          <tr class="entries_header">
+            <th class="th_details" colspan="5">HAL Implementation Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="5">
+              <p>For good quality of mapping,<wbr/> at least 128 control points are
+preferred.<wbr/></p>
+<p>A typical use case of this would be a gamma-1/<wbr/>2.<wbr/>2 curve,<wbr/> with as many
+control points used as are available.<wbr/></p>
+            </td>
+          </tr>
 
           <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
            <!-- end of entry -->
         
                 
           <tr class="entry" id="dynamic_android.tonemap.mode">
-            <td class="entry_name" rowspan="1">
+            <td class="entry_name" rowspan="3">
               android.<wbr/>tonemap.<wbr/>mode
             </td>
             <td class="entry_type">
@@ -13614,23 +13774,30 @@ for a few sample points would be: 0 -&gt; 0,<wbr/> 0.<wbr/>15 -&gt;
                   <li>
                     <span class="entry_type_enum_name">CONTRAST_CURVE</span>
                     <span class="entry_type_enum_notes"><p>Use the tone mapping curve specified in
-android.<wbr/>tonemap.<wbr/>curve</p></span>
+android.<wbr/>tonemap.<wbr/>curve.<wbr/></p>
+<p>All color enhancement and tonemapping must be disabled,<wbr/> except
+for applying the tonemapping curve specified by
+<a href="#controls_android.tonemap.curveRed">android.<wbr/>tonemap.<wbr/>curve<wbr/>Red</a>,<wbr/> <a href="#controls_android.tonemap.curveBlue">android.<wbr/>tonemap.<wbr/>curve<wbr/>Blue</a>,<wbr/> or
+<a href="#controls_android.tonemap.curveGreen">android.<wbr/>tonemap.<wbr/>curve<wbr/>Green</a>.<wbr/></p>
+<p>Must not slow down frame rate relative to raw
+sensor output.<wbr/></p></span>
                   </li>
                   <li>
                     <span class="entry_type_enum_name">FAST</span>
-                    <span class="entry_type_enum_notes"><p>Must not slow down frame rate relative to raw
-bayer output</p></span>
+                    <span class="entry_type_enum_notes"><p>Advanced gamma mapping and color enhancement may be applied.<wbr/></p>
+<p>Should not slow down frame rate relative to raw sensor output.<wbr/></p></span>
                   </li>
                   <li>
                     <span class="entry_type_enum_name">HIGH_QUALITY</span>
-                    <span class="entry_type_enum_notes"><p>Frame rate may be reduced by high
-quality</p></span>
+                    <span class="entry_type_enum_notes"><p>Advanced gamma mapping and color enhancement may be applied.<wbr/></p>
+<p>May slow down frame rate relative to raw sensor output.<wbr/></p></span>
                   </li>
                 </ul>
 
             </td> <!-- entry_type -->
 
             <td class="entry_description">
+              <p>High-level global contrast/<wbr/>gamma/<wbr/>tonemapping control.<wbr/></p>
             </td>
 
             <td class="entry_units">
diff --git a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png
new file mode 100644 (file)
index 0000000..ec89e37
Binary files /dev/null and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png differ
diff --git a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png
new file mode 100644 (file)
index 0000000..cf0c63d
Binary files /dev/null and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png differ
diff --git a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png
new file mode 100644 (file)
index 0000000..f226a54
Binary files /dev/null and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png differ
diff --git a/camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png
new file mode 100644 (file)
index 0000000..ded0645
Binary files /dev/null and b/camera/docs/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png differ
index 045cf43..174461a 100644 (file)
@@ -3401,14 +3401,12 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata
             <size>n</size>
             <size>2</size>
           </array>
-          <description>Table mapping blue input values to output
-          values</description>
+          <description>Tonemapping / contrast / gamma curve for the blue
+          channel, to use when android.tonemap.mode is
+          CONTRAST_CURVE.</description>
           <units>same as android.tonemap.curveRed</units>
           <range>same as android.tonemap.curveRed</range>
-          <details>Tonemapping / contrast / gamma curve for the blue
-          channel, to use when android.tonemap.mode is CONTRAST_CURVE.
-
-          See android.tonemap.curveRed for more details.</details>
+          <details>See android.tonemap.curveRed for more details.</details>
         </entry>
         <entry name="curveGreen" type="float" visibility="public"
         type_notes="1D array of float pairs (P_IN, P_OUT). The maximum number of pairs is specified by android.tonemap.maxCurvePoints."
@@ -3417,14 +3415,12 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata
             <size>n</size>
             <size>2</size>
           </array>
-          <description>Table mapping green input values to output
-          values</description>
+          <description>Tonemapping / contrast / gamma curve for the green
+          channel, to use when android.tonemap.mode is
+          CONTRAST_CURVE.</description>
           <units>same as android.tonemap.curveRed</units>
           <range>same as android.tonemap.curveRed</range>
-          <details>Tonemapping / contrast / gamma curve for the green
-          channel, to use when android.tonemap.mode is CONTRAST_CURVE.
-
-          See android.tonemap.curveRed for more details.</details>
+          <details>See android.tonemap.curveRed for more details.</details>
         </entry>
         <entry name="curveRed" type="float" visibility="public"
         type_notes="1D array of float pairs (P_IN, P_OUT). The maximum number of pairs is specified by android.tonemap.maxCurvePoints."
@@ -3433,44 +3429,152 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata
             <size>n</size>
             <size>2</size>
           </array>
-          <description>Table mapping red input values to output
-          values</description>
-          <range>0-1 on input and output coordinates.</range>
-          <details>Tonemapping / contrast / gamma curve for the red
-          channel, to use when android.tonemap.mode is CONTRAST_CURVE.
-
-          Since the input and output ranges may vary depending on
-          the camera pipeline, the input and output pixel values
-          are represented by normalized floating-point values
-          between 0 and 1, with 0 == black and 1 == white.
-
-          The curve should be linearly interpolated between the
-          defined points. The points will be listed in increasing
-          order of P_IN. For example, if the array is: [0.0, 0.0,
-          0.3, 0.5, 1.0, 1.0], then the input-&amp;gt;output mapping
-          for a few sample points would be: 0 -&amp;gt; 0, 0.15 -&amp;gt;
-          0.25, 0.3 -&amp;gt; 0.5, 0.5 -&amp;gt; 0.64</details>
+          <description>Tonemapping / contrast / gamma curve for the red
+          channel, to use when android.tonemap.mode is
+          CONTRAST_CURVE.</description>
+          <range>0-1 on both input and output coordinates, normalized
+          as a floating-point value such that 0 == black and 1 == white.
+          </range>
+          <details>
+          Each channel's curve is defined by an array of control points:
+
+              android.tonemap.curveRed =
+                [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ]
+              2 &amp;lt;= N &amp;lt;= android.tonemap.maxCurvePoints
+
+          These are sorted in order of increasing `Pin`; it is always
+          guaranteed that input values 0.0 and 1.0 are included in the list to
+          define a complete mapping. For input values between control points,
+          the camera device must linearly interpolate between the control
+          points.
+
+          Each curve can have an independent number of points, and the number
+          of points can be less than max (that is, the request doesn't have to
+          always provide a curve with number of points equivalent to
+          android.tonemap.maxCurvePoints).
+
+          A few examples, and their corresponding graphical mappings; these
+          only specify the red channel and the precision is limited to 4
+          digits, for conciseness.
+
+          Linear mapping:
+
+              android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ]
+
+          ![Linear mapping curve](android.tonemap.curveRed/linear_tonemap.png)
+
+          Invert mapping:
+
+              android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ]
+
+          ![Inverting mapping curve](android.tonemap.curveRed/inverse_tonemap.png)
+
+          Gamma 1/2.2 mapping, with 16 control points:
+
+              android.tonemap.curveRed = [
+                0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812,
+                0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072,
+                0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685,
+                0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ]
+
+          ![Gamma = 1/2.2 tonemapping curve](android.tonemap.curveRed/gamma_tonemap.png)
+
+          Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:
+
+              android.tonemap.curveRed = [
+                0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845,
+                0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130,
+                0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721,
+                0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ]
+
+          ![sRGB tonemapping curve](android.tonemap.curveRed/srgb_tonemap.png)
+        </details>
+        <hal_details>
+          For good quality of mapping, at least 128 control points are
+          preferred.
+
+          A typical use case of this would be a gamma-1/2.2 curve, with as many
+          control points used as are available.
+        </hal_details>
           <tag id="DNG" />
         </entry>
         <entry name="mode" type="byte" visibility="public" enum="true">
           <enum>
             <value>CONTRAST_CURVE
-            <notes>Use the tone mapping curve specified in
-            android.tonemap.curve</notes></value>
+              <notes>Use the tone mapping curve specified in
+              android.tonemap.curve.
+
+              All color enhancement and tonemapping must be disabled, except
+              for applying the tonemapping curve specified by
+              android.tonemap.curveRed, android.tonemap.curveBlue, or
+              android.tonemap.curveGreen.
+
+              Must not slow down frame rate relative to raw
+              sensor output.
+              </notes>
+            </value>
             <value>FAST
-            <notes>Must not slow down frame rate relative to raw
-            bayer output</notes></value>
+              <notes>
+              Advanced gamma mapping and color enhancement may be applied.
+
+              Should not slow down frame rate relative to raw sensor output.
+              </notes>
+            </value>
             <value>HIGH_QUALITY
-            <notes>Frame rate may be reduced by high
-            quality</notes></value>
+              <notes>
+              Advanced gamma mapping and color enhancement may be applied.
+
+              May slow down frame rate relative to raw sensor output.
+              </notes>
+            </value>
           </enum>
+          <description>High-level global contrast/gamma/tonemapping control.
+          </description>
+          <details>
+          When switching to an application-defined contrast curve by setting
+          android.tonemap.mode to CONTRAST_CURVE, the curve is defined
+          per-channel with a set of `(in, out)` points that specify the
+          mapping from input high-bit-depth pixel value to the output
+          low-bit-depth value.  Since the actual pixel ranges of both input
+          and output may change depending on the camera pipeline, the values
+          are specified by normalized floating-point numbers.
+
+          More-complex color mapping operations such as 3D color look-up
+          tables, selective chroma enhancement, or other non-linear color
+          transforms will be disabled when android.tonemap.mode is
+          CONTRAST_CURVE.
+
+          When using either FAST or HIGH_QUALITY, the camera device will
+          emit its own tonemap curve in android.tonemap.curveRed,
+          android.tonemap.curveGreen, and android.tonemap.curveBlue.
+          These values are always available, and as close as possible to the
+          actually used nonlinear/nonglobal transforms.
+
+          If a request is sent with TRANSFORM_MATRIX with the camera device's
+          provided curve in FAST or HIGH_QUALITY, the image's tonemap will be
+          roughly the same.</details>
         </entry>
       </controls>
       <static>
         <entry name="maxCurvePoints" type="int32" visibility="public" >
           <description>Maximum number of supported points in the
-          tonemap curve</description>
-          <range>&amp;gt;= 128</range>
+            tonemap curve that can be used for android.tonemap.curveRed, or
+            android.tonemap.curveGreen, or android.tonemap.curveBlue.
+          </description>
+          <range>&amp;gt;= 64</range>
+          <details>
+          If the actual number of points provided by the application (in
+          android.tonemap.curve*)  is less than max, the camera device will
+          resample the curve to its internal representation, using linear
+          interpolation.
+
+          The output curves in the result metadata may have a different number
+          of points than the input curves, and will represent the actual
+          hardware curves used as closely as possible when linearly interpolated.
+          </details>
+          <hal_details>
+          This value must be at least 64. This should be at least 128.
+          </hal_details>
         </entry>
       </static>
       <dynamic>