OSDN Git Service

Snap for 4683893 from c8e8062cbeec8f08050867db132fd8d1479ccfef to pi-release
authorandroid-build-team Robot <android-build-team-robot@google.com>
Wed, 28 Mar 2018 07:20:30 +0000 (07:20 +0000)
committerandroid-build-team Robot <android-build-team-robot@google.com>
Wed, 28 Mar 2018 07:20:30 +0000 (07:20 +0000)
Change-Id: I709cda2df1b63106ac70d7b1d79bf70fc77ea8f7

13 files changed:
audio/include/system/audio_effects/effect_dynamicsprocessing.h [new file with mode: 0644]
audio_effects/include/audio_effects/effect_dynamicsprocessing.h [new file with mode: 0644]
camera/docs/HidlMetadata.mako
camera/docs/camera_device_info.proto
camera/docs/docs.html
camera/docs/metadata_definitions.xml
camera/docs/metadata_definitions.xsd
camera/docs/metadata_model.py
camera/docs/metadata_parser_xml.py
camera/docs/metadata_template.mako
camera/docs/metadata_validate.py
camera/include/system/camera_metadata_tags.h
camera/src/camera_metadata_tag_info.c

diff --git a/audio/include/system/audio_effects/effect_dynamicsprocessing.h b/audio/include/system/audio_effects/effect_dynamicsprocessing.h
new file mode 100644 (file)
index 0000000..346e830
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_EFFECT_DYNAMICSPROCESSING_CORE_H_
+#define ANDROID_EFFECT_DYNAMICSPROCESSING_CORE_H_
+
+#include <system/audio_effect.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+#ifndef OPENSL_ES_H_
+static const effect_uuid_t SL_IID_DYNAMICSPROCESSING_ = { 0x7261676f, 0x6d75, 0x7369, 0x6364,
+        { 0x28, 0xe2, 0xfd, 0x3a, 0xc3, 0x9e } };
+const effect_uuid_t * const SL_IID_DYNAMICSPROCESSING = &SL_IID_DYNAMICSPROCESSING_;
+#endif //OPENSL_ES_H_
+
+/* enumerated parameters for dynamics processing effect */
+typedef enum
+{
+    DP_PARAM_GET_CHANNEL_COUNT = 0x10,
+    DP_PARAM_INPUT_GAIN = 0x20,
+    DP_PARAM_ENGINE_ARCHITECTURE = 0x30,
+    DP_PARAM_PRE_EQ = 0x40,
+    DP_PARAM_PRE_EQ_BAND = 0x45,
+    DP_PARAM_MBC = 0x50,
+    DP_PARAM_MBC_BAND = 0x55,
+    DP_PARAM_POST_EQ = 0x60,
+    DP_PARAM_POST_EQ_BAND = 0x65,
+    DP_PARAM_LIMITER = 0x70,
+} t_dynamicsprocessing_params;
+
+/* enumerated variants */
+typedef enum
+{
+    VARIANT_FAVOR_FREQUENCY_RESOLUTION = 0x00,
+    VARIANT_FAVOR_TIME_RESOLUTION = 0x01,
+} t_dynamicsprocessing_variants;
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+
+#endif /*ANDROID_EFFECT_DYNAMICSPROCESSING_CORE_H_*/
diff --git a/audio_effects/include/audio_effects/effect_dynamicsprocessing.h b/audio_effects/include/audio_effects/effect_dynamicsprocessing.h
new file mode 100644 (file)
index 0000000..d350d73
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * USAGE NOTE: Only include this header when _implementing_ a particular
+ * effect. When access to UUID and properties is enough, include the
+ * corresponding header from system/audio_effects/, which doesn't include
+ * hardware/audio_effect.h.
+ *
+ * Only code that immediately calls into HAL or implements an effect
+ * can import hardware/audio_effect.h.
+ */
+
+#ifndef ANDROID_EFFECT_DYNAMICSPROCESSING_H_
+#define ANDROID_EFFECT_DYNAMICSPROCESSING_H_
+
+#include <hardware/audio_effect.h>
+#include <system/audio_effects/effect_dynamicsprocessing.h>
+
+#endif /*ANDROID_EFFECT_DYNAMICSPROCESSING_H_*/
index 4a307cb..dcbbde7 100644 (file)
@@ -42,6 +42,7 @@ import android.hardware.camera.metadata@${hal_major_version()}.${i};
 
 % endif
 <%    gotSections = False %>\
+<%    gotFirstNewSection = False %>\
 % for idx, section in enumerate(find_all_sections_added_in_hal(metadata, hal_major_version(), hal_minor_version())):
   % if idx == 0:
 <%    gotSections = True %>\
@@ -51,9 +52,10 @@ import android.hardware.camera.metadata@${hal_major_version()}.${i};
  */
 enum CameraMetadataSection : ${'uint32_t' if first_hal_minor_version(hal_major_version()) == hal_minor_version() else '@%d.%d::CameraMetadataSection' % (hal_major_version(), hal_minor_version()-1)} {
   % endif
-  % if first_hal_minor_version(hal_major_version()) != hal_minor_version():
+  % if first_hal_minor_version(hal_major_version()) != hal_minor_version() and not gotFirstNewSection:
     ${path_name(section) | csym} =
         android.hardware.camera.metadata@${hal_major_version()}.${hal_minor_version()-1}::CameraMetadataSection:ANDROID_SECTION_COUNT,
+<% gotFirstNewSection = True %>\
   % else:
     ${path_name(section) | csym},
   % endif
index 392bad9..10b8f87 100644 (file)
@@ -155,6 +155,7 @@ message CameraDeviceInfo {
     optional int32 android_reprocess_maxCaptureStall = 1638400;
     optional bool android_depth_depthIsExclusive = 1703936;
     optional int32 android_logicalMultiCamera_sensorSyncType = 1769472;
+    repeated int32 android_distortionCorrection_availableModes = 1835008;
     // End of codegen fields
   }
 
index 6719a54..81469ae 100644 (file)
         </li>
       </ul> <!-- toc_section -->
     </li>
+    <li>
+      <span class="toc_section_header"><a href="#section_distortionCorrection">distortionCorrection</a></span>
+      <ul class="toc_section">
+        <li>
+          <span class="toc_kind_header">controls</span>
+          <ul class="toc_section">
+            <li
+            ><a href="#controls_android.distortionCorrection.mode">android.distortionCorrection.mode</a></li>
+          </ul>
+        </li>
+        <li>
+          <span class="toc_kind_header">static</span>
+          <ul class="toc_section">
+            <li
+            ><a href="#static_android.distortionCorrection.availableModes">android.distortionCorrection.availableModes</a></li>
+          </ul>
+        </li>
+        <li>
+          <span class="toc_kind_header">dynamic</span>
+          <ul class="toc_section">
+            <li
+            ><a href="#dynamic_android.distortionCorrection.mode">android.distortionCorrection.mode</a></li>
+          </ul>
+        </li>
+      </ul> <!-- toc_section -->
+    </li>
   </ul>
 
 
@@ -29772,6 +29798,339 @@ onCaptureStarted callback.<wbr/></p>
       </tbody>
 
   <!-- end of section -->
+  <tr><td colspan="7" id="section_distortionCorrection" class="section">distortionCorrection</td></tr>
+
+
+      <tr><td colspan="7" class="kind">controls</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_hal_version">Initial HIDL HAL version</th>
+          <th class="th_tags">Tags</th>
+        </tr>
+      </thead>
+
+      <tbody>
+
+        
+
+        
+
+        
+
+        
+
+                
+          <tr class="entry" id="controls_android.distortionCorrection.mode">
+            <td class="entry_name
+             " rowspan="3">
+              android.<wbr/>distortion<wbr/>Correction.<wbr/>mode
+            </td>
+            <td class="entry_type">
+                <span class="entry_type_name entry_type_name_enum">byte</span>
+
+              <span class="entry_type_visibility"> [public]</span>
+
+
+
+
+
+                <ul class="entry_type_enum">
+                  <li>
+                    <span class="entry_type_enum_name">OFF (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>No distortion correction is applied.<wbr/></p></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">FAST (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>Lens distortion correction is applied without reducing frame rate
+relative to sensor output.<wbr/> It may be the same as OFF if distortion correction would
+reduce frame rate relative to sensor.<wbr/></p></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">HIGH_QUALITY (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>High-quality distortion correction is applied,<wbr/> at the cost of
+possibly reduced frame rate relative to sensor output.<wbr/></p></span>
+                  </li>
+                </ul>
+
+            </td> <!-- entry_type -->
+
+            <td class="entry_description">
+              <p>Mode of operation for the lens distortion correction block.<wbr/></p>
+            </td>
+
+            <td class="entry_units">
+            </td>
+
+            <td class="entry_range">
+              <p><a href="#static_android.distortionCorrection.availableModes">android.<wbr/>distortion<wbr/>Correction.<wbr/>available<wbr/>Modes</a></p>
+            </td>
+
+            <td class="entry_hal_version">
+              <p>3.<wbr/>3</p>
+            </td>
+
+            <td class="entry_tags">
+            </td>
+
+          </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="6">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="6">
+              <p>The lens distortion correction block attempts to improve image quality by fixing
+radial,<wbr/> tangential,<wbr/> or other geometric aberrations in the camera device's optics.<wbr/>  If
+available,<wbr/> the <a href="#static_android.lens.distortion">android.<wbr/>lens.<wbr/>distortion</a> field documents the lens's distortion parameters.<wbr/></p>
+<p>OFF means no distortion correction is done.<wbr/></p>
+<p>FAST/<wbr/>HIGH_<wbr/>QUALITY both mean camera device determined distortion correction will be
+applied.<wbr/> HIGH_<wbr/>QUALITY mode indicates that the camera device will use the highest-quality
+correction algorithms,<wbr/> even if it slows down capture rate.<wbr/> FAST means the camera device
+will not slow down capture rate when applying correction.<wbr/> FAST may be the same as OFF if
+any correction at all would slow down capture rate.<wbr/>  Every output stream will have a
+similar amount of enhancement applied.<wbr/></p>
+<p>The correction only applies to processed outputs such as YUV,<wbr/> JPEG,<wbr/> or DEPTH16; it is not
+applied to any RAW output.<wbr/>  Metadata coordinates such as face rectangles or metering
+regions are also not affected by correction.<wbr/></p>
+<p>Applications enabling distortion correction need to pay extra attention when converting
+image coordinates between corrected output buffers and the sensor array.<wbr/> For example,<wbr/> if
+the app supports tap-to-focus and enables correction,<wbr/> it then has to apply the distortion
+model described in <a href="#static_android.lens.distortion">android.<wbr/>lens.<wbr/>distortion</a> to the image buffer tap coordinates to properly
+calculate the tap position on the sensor active array to be used with
+<a href="#controls_android.control.afRegions">android.<wbr/>control.<wbr/>af<wbr/>Regions</a>.<wbr/> The same applies in reverse to detected face rectangles if
+they need to be drawn on top of the corrected output buffers.<wbr/></p>
+            </td>
+          </tr>
+
+
+          <tr class="entry_spacer"><td class="entry_spacer" colspan="7"></td></tr>
+           <!-- end of entry -->
+        
+        
+
+      <!-- end of kind -->
+      </tbody>
+      <tr><td colspan="7" 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_hal_version">Initial HIDL HAL version</th>
+          <th class="th_tags">Tags</th>
+        </tr>
+      </thead>
+
+      <tbody>
+
+        
+
+        
+
+        
+
+        
+
+                
+          <tr class="entry" id="static_android.distortionCorrection.availableModes">
+            <td class="entry_name
+             " rowspan="5">
+              android.<wbr/>distortion<wbr/>Correction.<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>
+
+
+
+
+                <div class="entry_type_notes">list of enums</div>
+
+
+            </td> <!-- entry_type -->
+
+            <td class="entry_description">
+              <p>List of distortion correction modes for <a href="#controls_android.distortionCorrection.mode">android.<wbr/>distortion<wbr/>Correction.<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.distortionCorrection.mode">android.<wbr/>distortion<wbr/>Correction.<wbr/>mode</a></p>
+            </td>
+
+            <td class="entry_hal_version">
+              <p>3.<wbr/>3</p>
+            </td>
+
+            <td class="entry_tags">
+              <ul class="entry_tags">
+                  <li><a href="#tag_V1">V1</a></li>
+                  <li><a href="#tag_REPROC">REPROC</a></li>
+              </ul>
+            </td>
+
+          </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="6">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="6">
+              <p>No device is required to support this API; such devices will always list only 'OFF'.<wbr/>
+All devices that support this API will list both FAST and HIGH_<wbr/>QUALITY.<wbr/></p>
+            </td>
+          </tr>
+
+          <tr class="entries_header">
+            <th class="th_details" colspan="6">HAL Implementation Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="6">
+              <p>HAL must support both FAST and HIGH_<wbr/>QUALITY if distortion correction is available
+on the camera device,<wbr/> but the underlying implementation can be the same for both modes.<wbr/>
+That is,<wbr/> if the highest quality implementation on the camera device does not slow down
+capture rate,<wbr/> then FAST and HIGH_<wbr/>QUALITY will generate the same output.<wbr/></p>
+            </td>
+          </tr>
+
+          <tr class="entry_spacer"><td class="entry_spacer" colspan="7"></td></tr>
+           <!-- end of entry -->
+        
+        
+
+      <!-- end of kind -->
+      </tbody>
+      <tr><td colspan="7" class="kind">dynamic</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_hal_version">Initial HIDL HAL version</th>
+          <th class="th_tags">Tags</th>
+        </tr>
+      </thead>
+
+      <tbody>
+
+        
+
+        
+
+        
+
+        
+
+                
+          <tr class="entry" id="dynamic_android.distortionCorrection.mode">
+            <td class="entry_name
+             " rowspan="3">
+              android.<wbr/>distortion<wbr/>Correction.<wbr/>mode
+            </td>
+            <td class="entry_type">
+                <span class="entry_type_name entry_type_name_enum">byte</span>
+
+              <span class="entry_type_visibility"> [public]</span>
+
+
+
+
+
+                <ul class="entry_type_enum">
+                  <li>
+                    <span class="entry_type_enum_name">OFF (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>No distortion correction is applied.<wbr/></p></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">FAST (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>Lens distortion correction is applied without reducing frame rate
+relative to sensor output.<wbr/> It may be the same as OFF if distortion correction would
+reduce frame rate relative to sensor.<wbr/></p></span>
+                  </li>
+                  <li>
+                    <span class="entry_type_enum_name">HIGH_QUALITY (v3.3)</span>
+                    <span class="entry_type_enum_notes"><p>High-quality distortion correction is applied,<wbr/> at the cost of
+possibly reduced frame rate relative to sensor output.<wbr/></p></span>
+                  </li>
+                </ul>
+
+            </td> <!-- entry_type -->
+
+            <td class="entry_description">
+              <p>Mode of operation for the lens distortion correction block.<wbr/></p>
+            </td>
+
+            <td class="entry_units">
+            </td>
+
+            <td class="entry_range">
+              <p><a href="#static_android.distortionCorrection.availableModes">android.<wbr/>distortion<wbr/>Correction.<wbr/>available<wbr/>Modes</a></p>
+            </td>
+
+            <td class="entry_hal_version">
+              <p>3.<wbr/>3</p>
+            </td>
+
+            <td class="entry_tags">
+            </td>
+
+          </tr>
+          <tr class="entries_header">
+            <th class="th_details" colspan="6">Details</th>
+          </tr>
+          <tr class="entry_cont">
+            <td class="entry_details" colspan="6">
+              <p>The lens distortion correction block attempts to improve image quality by fixing
+radial,<wbr/> tangential,<wbr/> or other geometric aberrations in the camera device's optics.<wbr/>  If
+available,<wbr/> the <a href="#static_android.lens.distortion">android.<wbr/>lens.<wbr/>distortion</a> field documents the lens's distortion parameters.<wbr/></p>
+<p>OFF means no distortion correction is done.<wbr/></p>
+<p>FAST/<wbr/>HIGH_<wbr/>QUALITY both mean camera device determined distortion correction will be
+applied.<wbr/> HIGH_<wbr/>QUALITY mode indicates that the camera device will use the highest-quality
+correction algorithms,<wbr/> even if it slows down capture rate.<wbr/> FAST means the camera device
+will not slow down capture rate when applying correction.<wbr/> FAST may be the same as OFF if
+any correction at all would slow down capture rate.<wbr/>  Every output stream will have a
+similar amount of enhancement applied.<wbr/></p>
+<p>The correction only applies to processed outputs such as YUV,<wbr/> JPEG,<wbr/> or DEPTH16; it is not
+applied to any RAW output.<wbr/>  Metadata coordinates such as face rectangles or metering
+regions are also not affected by correction.<wbr/></p>
+<p>Applications enabling distortion correction need to pay extra attention when converting
+image coordinates between corrected output buffers and the sensor array.<wbr/> For example,<wbr/> if
+the app supports tap-to-focus and enables correction,<wbr/> it then has to apply the distortion
+model described in <a href="#static_android.lens.distortion">android.<wbr/>lens.<wbr/>distortion</a> to the image buffer tap coordinates to properly
+calculate the tap position on the sensor active array to be used with
+<a href="#controls_android.control.afRegions">android.<wbr/>control.<wbr/>af<wbr/>Regions</a>.<wbr/> The same applies in reverse to detected face rectangles if
+they need to be drawn on top of the corrected output buffers.<wbr/></p>
+            </td>
+          </tr>
+
+
+          <tr class="entry_spacer"><td class="entry_spacer" colspan="7"></td></tr>
+           <!-- end of entry -->
+        
+        
+
+      <!-- end of kind -->
+      </tbody>
+
+  <!-- end of section -->
 <!-- </namespace> -->
   </table>
 
@@ -29894,6 +30253,7 @@ onCaptureStarted callback.<wbr/></p>
           <li><a href="#dynamic_android.statistics.hotPixelMap">android.statistics.hotPixelMap</a> (dynamic)</li>
           <li><a href="#dynamic_android.sync.frameNumber">android.sync.frameNumber</a> (dynamic)</li>
           <li><a href="#static_android.sync.maxLatency">android.sync.maxLatency</a> (static)</li>
+          <li><a href="#static_android.distortionCorrection.availableModes">android.distortionCorrection.availableModes</a> (static)</li>
           <li><a href="#dynamic_android.edge.mode">android.edge.mode</a> (dynamic)</li>
           <li><a href="#dynamic_android.hotPixel.mode">android.hotPixel.mode</a> (dynamic)</li>
           <li><a href="#dynamic_android.lens.aperture">android.lens.aperture</a> (dynamic)</li>
@@ -29982,6 +30342,7 @@ onCaptureStarted callback.<wbr/></p>
           <li><a href="#static_android.scaler.availableInputOutputFormatsMap">android.scaler.availableInputOutputFormatsMap</a> (static)</li>
           <li><a href="#controls_android.reprocess.effectiveExposureFactor">android.reprocess.effectiveExposureFactor</a> (controls)</li>
           <li><a href="#static_android.reprocess.maxCaptureStall">android.reprocess.maxCaptureStall</a> (static)</li>
+          <li><a href="#static_android.distortionCorrection.availableModes">android.distortionCorrection.availableModes</a> (static)</li>
           <li><a href="#dynamic_android.edge.mode">android.edge.mode</a> (dynamic)</li>
           <li><a href="#dynamic_android.noiseReduction.mode">android.noiseReduction.mode</a> (dynamic)</li>
         </ul>
index e96a0a6..48cb694 100644 (file)
@@ -9662,5 +9662,76 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata
         </entry>
       </static>
     </section>
+    <section name="distortionCorrection">
+      <controls>
+        <entry name="mode" type="byte" visibility="public" enum="true" hal_version="3.3">
+          <enum>
+            <value>OFF
+            <notes>No distortion correction is applied.</notes></value>
+            <value>FAST <notes>Lens distortion correction is applied without reducing frame rate
+            relative to sensor output. It may be the same as OFF if distortion correction would
+            reduce frame rate relative to sensor.</notes></value>
+            <value>HIGH_QUALITY <notes>High-quality distortion correction is applied, at the cost of
+            possibly reduced frame rate relative to sensor output.</notes></value>
+          </enum>
+          <description>Mode of operation for the lens distortion correction block.</description>
+          <range>android.distortionCorrection.availableModes</range>
+          <details>The lens distortion correction block attempts to improve image quality by fixing
+          radial, tangential, or other geometric aberrations in the camera device's optics.  If
+          available, the android.lens.distortion field documents the lens's distortion parameters.
+
+          OFF means no distortion correction is done.
+
+          FAST/HIGH_QUALITY both mean camera device determined distortion correction will be
+          applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality
+          correction algorithms, even if it slows down capture rate. FAST means the camera device
+          will not slow down capture rate when applying correction. FAST may be the same as OFF if
+          any correction at all would slow down capture rate.  Every output stream will have a
+          similar amount of enhancement applied.
+
+          The correction only applies to processed outputs such as YUV, JPEG, or DEPTH16; it is not
+          applied to any RAW output.  Metadata coordinates such as face rectangles or metering
+          regions are also not affected by correction.
+
+          Applications enabling distortion correction need to pay extra attention when converting
+          image coordinates between corrected output buffers and the sensor array. For example, if
+          the app supports tap-to-focus and enables correction, it then has to apply the distortion
+          model described in android.lens.distortion to the image buffer tap coordinates to properly
+          calculate the tap position on the sensor active array to be used with
+          android.control.afRegions. The same applies in reverse to detected face rectangles if
+          they need to be drawn on top of the corrected output buffers.
+          </details>
+        </entry>
+      </controls>
+      <static>
+        <entry name="availableModes" type="byte" visibility="public"
+        type_notes="list of enums" container="array" typedef="enumList" hal_version="3.3">
+          <array>
+            <size>n</size>
+          </array>
+          <description>
+          List of distortion correction modes for android.distortionCorrection.mode that are
+          supported by this camera device.
+          </description>
+          <range>Any value listed in android.distortionCorrection.mode</range>
+          <details>
+            No device is required to support this API; such devices will always list only 'OFF'.
+            All devices that support this API will list both FAST and HIGH_QUALITY.
+          </details>
+          <hal_details>
+          HAL must support both FAST and HIGH_QUALITY if distortion correction is available
+          on the camera device, but the underlying implementation can be the same for both modes.
+          That is, if the highest quality implementation on the camera device does not slow down
+          capture rate, then FAST and HIGH_QUALITY will generate the same output.
+          </hal_details>
+          <tag id="V1" />
+          <tag id="REPROC" />
+        </entry>
+      </static>
+      <dynamic>
+        <clone entry="android.distortionCorrection.mode" kind="controls" hal_version="3.3">
+        </clone>
+      </dynamic>
+    </section>
   </namespace>
 </metadata>
index cd021bd..8e46cb1 100644 (file)
                 </restriction>
             </simpleType>
         </attribute>
+        <attribute name="hal_version" type="decimal" default="3.2" />
     </complexType>
 </schema>
index daebcb2..398e43a 100644 (file)
@@ -416,7 +416,9 @@ class Metadata(Node):
       target_kind = p.target_kind
       target_entry = self._entry_map[target_kind].get(p.name)
       p._entry = target_entry
-
+      if (p.hal_major_version == 0):
+        p._hal_major_version = target_entry._hal_major_version
+        p._hal_minor_version = target_entry._hal_minor_version
       # should not throw if we pass validation
       # but can happen when importing obsolete CSV entries
       if target_entry is None:
@@ -1365,8 +1367,12 @@ class Entry(Node):
 
     hal_version = kwargs.get('hal_version')
     if hal_version is None:
-      self._hal_major_version = 3
-      self._hal_minor_version = 2
+      if self.is_clone():
+        self._hal_major_version = 0
+        self._hal_minor_version = 0
+      else:
+        self._hal_major_version = 3
+        self._hal_minor_version = 2
     else:
       self._hal_major_version = int(hal_version.partition('.')[0])
       self._hal_minor_version = int(hal_version.partition('.')[2])
index db2c154..91af192 100755 (executable)
@@ -156,6 +156,8 @@ class MetadataParserXml:
           # no type_notes since its the same
         }
         d2 = {}
+        if 'hal_version' in entry.attrs:
+          d2['hal_version'] = entry['hal_version']
 
         insert = self.metadata.insert_clone
 
index 22c68a5..02689f0 100644 (file)
 
         <%def name="insert_entry(prop)">
         % if prop.is_clone():
-            <clone entry="${prop.name}" kind="${prop.target_kind}">
+            <clone entry="${prop.name}" kind="${prop.target_kind}"
+          % if ('hal_version' in prop._property_keys):
+                hal_version="${prop.hal_major_version}.${prop.hal_minor_version}"
+          % endif
+            >
 
               % if prop.details is not None:
                 <details>${prop.details}</details>
index 44f860a..ede1449 100755 (executable)
@@ -222,6 +222,29 @@ def validate_clones(soup):
       validate_error(error_msg)
       success = False
 
+    if matching_entry is not None:
+      entry_hal_major_version = 3
+      entry_hal_minor_version = 2
+      entry_hal_version = matching_entry.get('hal_version')
+      if entry_hal_version is not None:
+        entry_hal_major_version = int(entry_hal_version.partition('.')[0])
+        entry_hal_minor_version = int(entry_hal_version.partition('.')[2])
+
+      clone_hal_major_version = entry_hal_major_version
+      clone_hal_minor_version = entry_hal_minor_version
+      clone_hal_version = clone.get('hal_version')
+      if clone_hal_version is not None:
+        clone_hal_major_version = int(clone_hal_version.partition('.')[0])
+        clone_hal_minor_version = int(clone_hal_version.partition('.')[2])
+
+      if clone_hal_major_version < entry_hal_major_version or \
+          (clone_hal_major_version == entry_hal_major_version and \
+           clone_hal_minor_version < entry_hal_minor_version):
+        error_msg = ("Clone '%s' HAL version '%d.%d' is older than entry target HAL version '%d.%d'" \
+                   % (clone_name, clone_hal_major_version, clone_hal_minor_version, entry_hal_major_version, entry_hal_minor_version))
+        validate_error(error_msg)
+        success = False
+
   return success
 
 # All <entry> elements with container=$foo have a <$foo> child
index 823c414..d8cd02e 100644 (file)
@@ -62,6 +62,7 @@ typedef enum camera_metadata_section {
     ANDROID_REPROCESS,
     ANDROID_DEPTH,
     ANDROID_LOGICAL_MULTI_CAMERA,
+    ANDROID_DISTORTION_CORRECTION,
     ANDROID_SECTION_COUNT,
 
     VENDOR_SECTION = 0x8000
@@ -101,6 +102,9 @@ typedef enum camera_metadata_section_start {
     ANDROID_LOGICAL_MULTI_CAMERA_START
                                    = ANDROID_LOGICAL_MULTI_CAMERA
                                                                 << 16,
+    ANDROID_DISTORTION_CORRECTION_START
+                                   = ANDROID_DISTORTION_CORRECTION
+                                                                << 16,
     VENDOR_SECTION_START           = VENDOR_SECTION            << 16
 } camera_metadata_section_start_t;
 
@@ -435,6 +439,11 @@ typedef enum camera_metadata_tag {
     ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE,    // enum         | public       | HIDL v3.3
     ANDROID_LOGICAL_MULTI_CAMERA_END,
 
+    ANDROID_DISTORTION_CORRECTION_MODE =              // enum         | public       | HIDL v3.3
+            ANDROID_DISTORTION_CORRECTION_START,
+    ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES,    // byte[]       | public       | HIDL v3.3
+    ANDROID_DISTORTION_CORRECTION_END,
+
 } camera_metadata_tag_t;
 
 /**
@@ -985,3 +994,11 @@ typedef enum camera_metadata_enum_android_logical_multi_camera_sensor_sync_type
 } camera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t;
 
 
+// ANDROID_DISTORTION_CORRECTION_MODE
+typedef enum camera_metadata_enum_android_distortion_correction_mode {
+    ANDROID_DISTORTION_CORRECTION_MODE_OFF                          , // HIDL v3.3
+    ANDROID_DISTORTION_CORRECTION_MODE_FAST                         , // HIDL v3.3
+    ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY                 , // HIDL v3.3
+} camera_metadata_enum_android_distortion_correction_mode_t;
+
+
index b420fc1..0d7b679 100644 (file)
@@ -58,6 +58,8 @@ const char *camera_metadata_section_names[ANDROID_SECTION_COUNT] = {
     [ANDROID_REPROCESS]            = "android.reprocess",
     [ANDROID_DEPTH]                = "android.depth",
     [ANDROID_LOGICAL_MULTI_CAMERA] = "android.logicalMultiCamera",
+    [ANDROID_DISTORTION_CORRECTION]
+                                    = "android.distortionCorrection",
 };
 
 unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = {
@@ -115,6 +117,9 @@ unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = {
                                        ANDROID_DEPTH_END },
     [ANDROID_LOGICAL_MULTI_CAMERA] = { ANDROID_LOGICAL_MULTI_CAMERA_START,
                                        ANDROID_LOGICAL_MULTI_CAMERA_END },
+    [ANDROID_DISTORTION_CORRECTION]
+                                    = { ANDROID_DISTORTION_CORRECTION_START,
+                                       ANDROID_DISTORTION_CORRECTION_END },
 };
 
 static tag_info_t android_color_correction[ANDROID_COLOR_CORRECTION_END -
@@ -709,6 +714,14 @@ static tag_info_t android_logical_multi_camera[ANDROID_LOGICAL_MULTI_CAMERA_END
     { "sensorSyncType",                TYPE_BYTE   },
 };
 
+static tag_info_t android_distortion_correction[ANDROID_DISTORTION_CORRECTION_END -
+        ANDROID_DISTORTION_CORRECTION_START] = {
+    [ ANDROID_DISTORTION_CORRECTION_MODE - ANDROID_DISTORTION_CORRECTION_START ] =
+    { "mode",                          TYPE_BYTE   },
+    [ ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES - ANDROID_DISTORTION_CORRECTION_START ] =
+    { "availableModes",                TYPE_BYTE   },
+};
+
 
 tag_info_t *tag_info[ANDROID_SECTION_COUNT] = {
     android_color_correction,
@@ -738,6 +751,7 @@ tag_info_t *tag_info[ANDROID_SECTION_COUNT] = {
     android_reprocess,
     android_depth,
     android_logical_multi_camera,
+    android_distortion_correction,
 };
 
 int camera_metadata_enum_snprint(uint32_t tag,
@@ -2758,6 +2772,29 @@ int camera_metadata_enum_snprint(uint32_t tag,
             break;
         }
 
+        case ANDROID_DISTORTION_CORRECTION_MODE: {
+            switch (value) {
+                case ANDROID_DISTORTION_CORRECTION_MODE_OFF:
+                    msg = "OFF";
+                    ret = 0;
+                    break;
+                case ANDROID_DISTORTION_CORRECTION_MODE_FAST:
+                    msg = "FAST";
+                    ret = 0;
+                    break;
+                case ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY:
+                    msg = "HIGH_QUALITY";
+                    ret = 0;
+                    break;
+                default:
+                    msg = "error: enum value out of range";
+            }
+            break;
+        }
+        case ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES: {
+            break;
+        }
+
     }
 
     strncpy(dst, msg, size - 1);