Camera2: lens shading related update for HAL3.3
1. Define android.shading.availableMode and
android.statistics.info.availableLensShadingMapModes for
checking availablity of corresponding controls.
2. Define android.sensor.info.lensShadingApplied to allow for
lens shading correction baked in the RAW image data.
Change-Id: I57bc94cec351388337c8f7532c357ea9b70395af
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index f8ab916..24e201b 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -754,6 +754,8 @@
><a href="#static_android.sensor.info.whiteLevel">android.sensor.info.whiteLevel</a></li>
<li
><a href="#static_android.sensor.info.timestampSource">android.sensor.info.timestampSource</a></li>
+ <li
+ ><a href="#static_android.sensor.info.lensShadingApplied">android.sensor.info.lensShadingApplied</a></li>
<li
><a href="#static_android.sensor.referenceIlluminant1">android.sensor.referenceIlluminant1</a></li>
@@ -837,6 +839,13 @@
><a href="#dynamic_android.shading.mode">android.shading.mode</a></li>
</ul>
</li>
+ <li>
+ <span class="toc_kind_header">static</span>
+ <ul class="toc_section">
+ <li
+ ><a href="#static_android.shading.availableModes">android.shading.availableModes</a></li>
+ </ul>
+ </li>
</ul> <!-- toc_section -->
</li>
<li>
@@ -875,6 +884,8 @@
><a href="#static_android.statistics.info.sharpnessMapSize">android.statistics.info.sharpnessMapSize</a></li>
<li
><a href="#static_android.statistics.info.availableHotPixelMapModes">android.statistics.info.availableHotPixelMapModes</a></li>
+ <li
+ ><a href="#static_android.statistics.info.availableLensShadingMapModes">android.statistics.info.availableLensShadingMapModes</a></li>
</ul>
</li>
@@ -17706,6 +17717,65 @@
<tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
<!-- end of entry -->
+
+ <tr class="entry" id="static_android.sensor.info.lensShadingApplied">
+ <td class="entry_name
+ " rowspan="3">
+ android.<wbr/>sensor.<wbr/>info.<wbr/>lens<wbr/>Shading<wbr/>Applied
+ </td>
+ <td class="entry_type">
+ <span class="entry_type_name entry_type_name_enum">byte</span>
+
+ <span class="entry_type_visibility"> [public as boolean]</span>
+
+
+
+
+
+ <ul class="entry_type_enum">
+ <li>
+ <span class="entry_type_enum_name">FALSE</span>
+ </li>
+ <li>
+ <span class="entry_type_enum_name">TRUE</span>
+ </li>
+ </ul>
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ <p>Whether the RAW images output from this camera device are subject to
+lens shading correction.<wbr/></p>
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ </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 TRUE,<wbr/> all images produced by the camera device in the RAW image formats will
+have lens shading correction already applied to it.<wbr/> If FALSE,<wbr/> the images will
+not be adjusted for lens shading correction.<wbr/>
+See <a href="#static_android.request.maxNumOutputRaw">android.<wbr/>request.<wbr/>max<wbr/>Num<wbr/>Output<wbr/>Raw</a> for a list of RAW image formats.<wbr/></p>
+<p>This key will be <code>null</code> for all devices do not report this information.<wbr/>
+Devices with RAW capability will always report this information in this key.<wbr/></p>
+ </td>
+ </tr>
+
+
+ <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
+ <!-- end of entry -->
+
@@ -19778,6 +19848,7 @@
</td>
<td class="entry_range">
+ <p><a href="#static_android.shading.availableModes">android.<wbr/>shading.<wbr/>available<wbr/>Modes</a></p>
</td>
<td class="entry_tags">
@@ -19933,6 +20004,7 @@
</td>
<td class="entry_range">
+ <p><a href="#static_android.shading.availableModes">android.<wbr/>shading.<wbr/>available<wbr/>Modes</a></p>
</td>
<td class="entry_tags">
@@ -19978,6 +20050,88 @@
<!-- end of kind -->
</tbody>
+ <tr><td colspan="6" class="kind">static</td></tr>
+
+ <thead class="entries_header">
+ <tr>
+ <th class="th_name">Property Name</th>
+ <th class="th_type">Type</th>
+ <th class="th_description">Description</th>
+ <th class="th_units">Units</th>
+ <th class="th_range">Range</th>
+ <th class="th_tags">Tags</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+
+
+
+
+
+
+
+
+ <tr class="entry" id="static_android.shading.availableModes">
+ <td class="entry_name
+ " rowspan="3">
+ android.<wbr/>shading.<wbr/>available<wbr/>Modes
+ </td>
+ <td class="entry_type">
+ <span class="entry_type_name">byte</span>
+ <span class="entry_type_container">x</span>
+
+ <span class="entry_type_array">
+ n
+ </span>
+ <span class="entry_type_visibility"> [public as enumList]</span>
+
+
+ <span class="entry_type_hwlevel">[legacy] </span>
+
+
+ <div class="entry_type_notes">List of enums (android.<wbr/>shading.<wbr/>mode).<wbr/></div>
+
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ <p>List of lens shading modes for <a href="#controls_android.shading.mode">android.<wbr/>shading.<wbr/>mode</a> that are supported by this camera device.<wbr/></p>
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ <p>Any value listed in <a href="#controls_android.shading.mode">android.<wbr/>shading.<wbr/>mode</a></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>This list contains lens shading modes that can be set for the camera device.<wbr/>
+Camera devices that support the MANUAL_<wbr/>POST_<wbr/>PROCESSING capability will always
+list OFF and FAST mode.<wbr/> This includes all FULL level devices.<wbr/>
+LEGACY devices will always only support FAST mode.<wbr/></p>
+ </td>
+ </tr>
+
+
+ <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
+ <!-- end of entry -->
+
+
+
+ <!-- end of kind -->
+ </tbody>
<!-- end of section -->
<tr><td colspan="6" id="section_statistics" class="section">statistics</td></tr>
@@ -20286,6 +20440,7 @@
</td>
<td class="entry_range">
+ <p><a href="#static_android.statistics.info.availableLensShadingMapModes">android.<wbr/>statistics.<wbr/>info.<wbr/>available<wbr/>Lens<wbr/>Shading<wbr/>Map<wbr/>Modes</a></p>
</td>
<td class="entry_tags">
@@ -20667,6 +20822,61 @@
<tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
<!-- end of entry -->
+
+ <tr class="entry" id="static_android.statistics.info.availableLensShadingMapModes">
+ <td class="entry_name
+ " rowspan="3">
+ android.<wbr/>statistics.<wbr/>info.<wbr/>available<wbr/>Lens<wbr/>Shading<wbr/>Map<wbr/>Modes
+ </td>
+ <td class="entry_type">
+ <span class="entry_type_name">byte</span>
+ <span class="entry_type_container">x</span>
+
+ <span class="entry_type_array">
+ n
+ </span>
+ <span class="entry_type_visibility"> [public]</span>
+
+
+
+
+ <div class="entry_type_notes">list of enums</div>
+
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ <p>List of lens shading map output modes for <a href="#controls_android.statistics.lensShadingMapMode">android.<wbr/>statistics.<wbr/>lens<wbr/>Shading<wbr/>Map<wbr/>Mode</a> that
+are supported by this camera device.<wbr/></p>
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ <p>Any value listed in <a href="#controls_android.statistics.lensShadingMapMode">android.<wbr/>statistics.<wbr/>lens<wbr/>Shading<wbr/>Map<wbr/>Mode</a></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 no lens shading map output is available for this camera device,<wbr/> this key will
+contain only OFF.<wbr/></p>
+<p>ON is always supported on devices with the RAW capability.<wbr/>
+LEGACY mode devices will always only support OFF.<wbr/></p>
+ </td>
+ </tr>
+
+
+ <tr class="entry_spacer"><td class="entry_spacer" colspan="6"></td></tr>
+ <!-- end of entry -->
+
@@ -21387,7 +21597,7 @@
<td class="entry_description">
<p>The shading map is a low-resolution floating-point map
that lists the coefficients used to correct for vignetting,<wbr/> for each
-Bayer color channel.<wbr/></p>
+Bayer color channel of RAW image data.<wbr/></p>
</td>
<td class="entry_units">
@@ -21441,8 +21651,20 @@
<img alt="Green (odd rows) lens shading map" src="images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png"/>
<img alt="Blue lens shading map" src="images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png"/></p>
<p>As a visualization only,<wbr/> inverting the full-color map to recover an
-image of a gray wall (using bicubic interpolation for visual quality) as captured by the sensor gives:</p>
+image of a gray wall (using bicubic interpolation for visual quality)
+as captured by the sensor gives:</p>
<p><img alt="Image of a uniform white wall (inverse shading map)" src="images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png"/></p>
+<p>Note that the RAW image data might be subject to lens shading
+correction not reported on this map.<wbr/> Query
+<a href="#static_android.sensor.info.lensShadingApplied">android.<wbr/>sensor.<wbr/>info.<wbr/>lens<wbr/>Shading<wbr/>Applied</a> to see if RAW image data has subject
+to lens shading correction.<wbr/> If <a href="#static_android.sensor.info.lensShadingApplied">android.<wbr/>sensor.<wbr/>info.<wbr/>lens<wbr/>Shading<wbr/>Applied</a>
+is TRUE,<wbr/> the RAW image data is subject to partial or full lens shading
+correction.<wbr/> In the case full lens shading correction is applied to RAW
+images,<wbr/> the gain factor map reported in this key will contain all 1.<wbr/>0 gains.<wbr/>
+In other words,<wbr/> the map reported in this key is the remaining lens shading
+that needs to be applied on the RAW image to get images without lens shading
+artifacts.<wbr/> See <a href="#static_android.request.maxNumOutputRaw">android.<wbr/>request.<wbr/>max<wbr/>Num<wbr/>Output<wbr/>Raw</a> for a list of RAW image
+formats.<wbr/></p>
</td>
</tr>
@@ -21844,6 +22066,7 @@
</td>
<td class="entry_range">
+ <p><a href="#static_android.statistics.info.availableLensShadingMapModes">android.<wbr/>statistics.<wbr/>info.<wbr/>available<wbr/>Lens<wbr/>Shading<wbr/>Map<wbr/>Modes</a></p>
</td>
<td class="entry_tags">
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index 637be79..0d40187 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -5448,6 +5448,24 @@
</details>
<tag id="V1" />
</entry>
+ <entry name="lensShadingApplied" type="byte" visibility="public" enum="true"
+ typedef="boolean">
+ <enum>
+ <value>FALSE</value>
+ <value>TRUE</value>
+ </enum>
+ <description>Whether the RAW images output from this camera device are subject to
+ lens shading correction.</description>
+ <details>
+ If TRUE, all images produced by the camera device in the RAW image formats will
+ have lens shading correction already applied to it. If FALSE, the images will
+ not be adjusted for lens shading correction.
+ See android.request.maxNumOutputRaw for a list of RAW image formats.
+
+ This key will be `null` for all devices do not report this information.
+ Devices with RAW capability will always report this information in this key.
+ </details>
+ </entry>
</namespace>
<entry name="referenceIlluminant1" type="byte" visibility="public"
enum="true">
@@ -6242,6 +6260,7 @@
</enum>
<description>Quality of lens shading correction applied
to the image data.</description>
+ <range>android.shading.availableModes</range>
<details>
When set to OFF mode, no lens shading correction will be applied by the
camera device, and an identity lens shading map data will be provided
@@ -6282,6 +6301,25 @@
<clone entry="android.shading.mode" kind="controls">
</clone>
</dynamic>
+ <static>
+ <entry name="availableModes" type="byte" visibility="public"
+ type_notes="List of enums (android.shading.mode)." container="array"
+ typedef="enumList" hwlevel="legacy">
+ <array>
+ <size>n</size>
+ </array>
+ <description>
+ List of lens shading modes for android.shading.mode that are supported by this camera device.
+ </description>
+ <range>Any value listed in android.shading.mode</range>
+ <details>
+ This list contains lens shading modes that can be set for the camera device.
+ Camera devices that support the MANUAL_POST_PROCESSING capability will always
+ list OFF and FAST mode. This includes all FULL level devices.
+ LEGACY devices will always only support FAST mode.
+ </details>
+ </entry>
+ </static>
</section>
<section name="statistics">
<controls>
@@ -6426,6 +6464,24 @@
<tag id="V1" />
<tag id="RAW" />
</entry>
+ <entry name="availableLensShadingMapModes" type="byte" visibility="public"
+ type_notes="list of enums" container="array">
+ <array>
+ <size>n</size>
+ </array>
+ <description>
+ List of lens shading map output modes for android.statistics.lensShadingMapMode that
+ are supported by this camera device.
+ </description>
+ <range>Any value listed in android.statistics.lensShadingMapMode</range>
+ <details>
+ If no lens shading map output is available for this camera device, this key will
+ contain only OFF.
+
+ ON is always supported on devices with the RAW capability.
+ LEGACY mode devices will always only support OFF.
+ </details>
+ </entry>
</namespace>
</static>
<dynamic>
@@ -6599,7 +6655,7 @@
</array>
<description>The shading map is a low-resolution floating-point map
that lists the coefficients used to correct for vignetting, for each
- Bayer color channel.</description>
+ Bayer color channel of RAW image data.</description>
<range>Each gain factor is &gt;= 1</range>
<details>The least shaded section of the image should have a gain factor
of 1; all other sections should have gains above 1.
@@ -6644,9 +6700,22 @@

As a visualization only, inverting the full-color map to recover an
- image of a gray wall (using bicubic interpolation for visual quality) as captured by the sensor gives:
+ image of a gray wall (using bicubic interpolation for visual quality)
+ as captured by the sensor gives:

+
+ Note that the RAW image data might be subject to lens shading
+ correction not reported on this map. Query
+ android.sensor.info.lensShadingApplied to see if RAW image data has subject
+ to lens shading correction. If android.sensor.info.lensShadingApplied
+ is TRUE, the RAW image data is subject to partial or full lens shading
+ correction. In the case full lens shading correction is applied to RAW
+ images, the gain factor map reported in this key will contain all 1.0 gains.
+ In other words, the map reported in this key is the remaining lens shading
+ that needs to be applied on the RAW image to get images without lens shading
+ artifacts. See android.request.maxNumOutputRaw for a list of RAW image
+ formats.
</details>
<hal_details>
The lens shading map calculation may depend on exposure and white balance statistics.
@@ -6796,6 +6865,7 @@
</enum>
<description>Whether the camera device will output the lens
shading map in output result metadata.</description>
+ <range>android.statistics.info.availableLensShadingMapModes</range>
<details>When set to ON,
android.statistics.lensShadingMap will be provided in
the output result metadata.
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index 53db535..926beac 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -315,11 +315,13 @@
ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, // int32[] | public
ANDROID_SENSOR_INFO_WHITE_LEVEL, // int32 | public
ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, // enum | public
+ ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED, // enum | public
ANDROID_SENSOR_INFO_END,
ANDROID_SHADING_MODE = // enum | public
ANDROID_SHADING_START,
ANDROID_SHADING_STRENGTH, // byte | system
+ ANDROID_SHADING_AVAILABLE_MODES, // byte[] | public
ANDROID_SHADING_END,
ANDROID_STATISTICS_FACE_DETECT_MODE = // enum | public
@@ -352,6 +354,8 @@
ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE, // int32[] | system
ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES,
// byte[] | public
+ ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES,
+ // byte[] | public
ANDROID_STATISTICS_INFO_END,
ANDROID_TONEMAP_CURVE_BLUE = // float[] | hidden
@@ -767,6 +771,12 @@
ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME,
} camera_metadata_enum_android_sensor_info_timestamp_source_t;
+// ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED
+typedef enum camera_metadata_enum_android_sensor_info_lens_shading_applied {
+ ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE,
+ ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE,
+} camera_metadata_enum_android_sensor_info_lens_shading_applied_t;
+
// ANDROID_SHADING_MODE
typedef enum camera_metadata_enum_android_shading_mode {
diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c
index 0a5479e..eacce79 100644
--- a/camera/src/camera_metadata_tag_info.c
+++ b/camera/src/camera_metadata_tag_info.c
@@ -507,6 +507,8 @@
{ "whiteLevel", TYPE_INT32 },
[ ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE - ANDROID_SENSOR_INFO_START ] =
{ "timestampSource", TYPE_BYTE },
+ [ ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED - ANDROID_SENSOR_INFO_START ] =
+ { "lensShadingApplied", TYPE_BYTE },
};
static tag_info_t android_shading[ANDROID_SHADING_END -
@@ -515,6 +517,8 @@
{ "mode", TYPE_BYTE },
[ ANDROID_SHADING_STRENGTH - ANDROID_SHADING_START ] =
{ "strength", TYPE_BYTE },
+ [ ANDROID_SHADING_AVAILABLE_MODES - ANDROID_SHADING_START ] =
+ { "availableModes", TYPE_BYTE },
};
static tag_info_t android_statistics[ANDROID_STATISTICS_END -
@@ -572,6 +576,8 @@
{ "sharpnessMapSize", TYPE_INT32 },
[ ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES - ANDROID_STATISTICS_INFO_START ] =
{ "availableHotPixelMapModes", TYPE_BYTE },
+ [ ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES - ANDROID_STATISTICS_INFO_START ] =
+ { "availableLensShadingMapModes", TYPE_BYTE },
};
static tag_info_t android_tonemap[ANDROID_TONEMAP_END -
@@ -2092,6 +2098,21 @@
}
break;
}
+ case ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED: {
+ switch (value) {
+ case ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE:
+ msg = "FALSE";
+ ret = 0;
+ break;
+ case ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE:
+ msg = "TRUE";
+ ret = 0;
+ break;
+ default:
+ msg = "error: enum value out of range";
+ }
+ break;
+ }
case ANDROID_SHADING_MODE: {
switch (value) {
@@ -2115,6 +2136,9 @@
case ANDROID_SHADING_STRENGTH: {
break;
}
+ case ANDROID_SHADING_AVAILABLE_MODES: {
+ break;
+ }
case ANDROID_STATISTICS_FACE_DETECT_MODE: {
switch (value) {
@@ -2269,6 +2293,9 @@
case ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES: {
break;
}
+ case ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES: {
+ break;
+ }
case ANDROID_TONEMAP_CURVE_BLUE: {
break;