diff --git a/camera/ndk/impl/ACameraMetadata.cpp b/camera/ndk/impl/ACameraMetadata.cpp index 62b0ec919d..fc00a2d2ba 100644 --- a/camera/ndk/impl/ACameraMetadata.cpp +++ b/camera/ndk/impl/ACameraMetadata.cpp @@ -313,6 +313,7 @@ ACameraMetadata::isCaptureRequestTag(const uint32_t tag) { case ACAMERA_TONEMAP_GAMMA: case ACAMERA_TONEMAP_PRESET_CURVE: case ACAMERA_BLACK_LEVEL_LOCK: + case ACAMERA_DISTORTION_CORRECTION_MODE: return true; default: return false; diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h index 9c81dd17e8..a40cd11635 100644 --- a/camera/ndk/include/camera/NdkCameraMetadataTags.h +++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h @@ -70,6 +70,7 @@ typedef enum acamera_metadata_section { ACAMERA_REPROCESS, ACAMERA_DEPTH, ACAMERA_LOGICAL_MULTI_CAMERA, + ACAMERA_DISTORTION_CORRECTION, ACAMERA_SECTION_COUNT, ACAMERA_VENDOR = 0x8000 @@ -108,6 +109,9 @@ typedef enum acamera_metadata_section_start { ACAMERA_LOGICAL_MULTI_CAMERA_START = ACAMERA_LOGICAL_MULTI_CAMERA << 16, + ACAMERA_DISTORTION_CORRECTION_START + = ACAMERA_DISTORTION_CORRECTION + << 16, ACAMERA_VENDOR_START = ACAMERA_VENDOR << 16 } acamera_metadata_section_start_t; @@ -5284,6 +5288,63 @@ typedef enum acamera_metadata_tag { ACAMERA_LOGICAL_MULTI_CAMERA_START + 1, ACAMERA_LOGICAL_MULTI_CAMERA_END, + /** + *

Mode of operation for the lens distortion correction block.

+ * + *

Type: byte (acamera_metadata_enum_android_distortion_correction_mode_t)

+ * + *

This tag may appear in: + *

+ * + *

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 ACAMERA_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 ACAMERA_LENS_DISTORTION to the image buffer tap coordinates to properly + * calculate the tap position on the sensor active array to be used with + * ACAMERA_CONTROL_AF_REGIONS. The same applies in reverse to detected face rectangles if + * they need to be drawn on top of the corrected output buffers.

+ * + * @see ACAMERA_CONTROL_AF_REGIONS + * @see ACAMERA_LENS_DISTORTION + */ + ACAMERA_DISTORTION_CORRECTION_MODE = // byte (acamera_metadata_enum_android_distortion_correction_mode_t) + ACAMERA_DISTORTION_CORRECTION_START, + /** + *

List of distortion correction modes for ACAMERA_DISTORTION_CORRECTION_MODE that are + * supported by this camera device.

+ * + * @see ACAMERA_DISTORTION_CORRECTION_MODE + * + *

Type: byte[n]

+ * + *

This tag may appear in: + *

+ * + *

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.

+ */ + ACAMERA_DISTORTION_CORRECTION_AVAILABLE_MODES = // byte[n] + ACAMERA_DISTORTION_CORRECTION_START + 1, + ACAMERA_DISTORTION_CORRECTION_END, + } acamera_metadata_tag_t; /** @@ -7679,6 +7740,29 @@ typedef enum acamera_metadata_enum_acamera_logical_multi_camera_sensor_sync_type } acamera_metadata_enum_android_logical_multi_camera_sensor_sync_type_t; +// ACAMERA_DISTORTION_CORRECTION_MODE +typedef enum acamera_metadata_enum_acamera_distortion_correction_mode { + /** + *

No distortion correction is applied.

+ */ + ACAMERA_DISTORTION_CORRECTION_MODE_OFF = 0, + + /** + *

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.

+ */ + ACAMERA_DISTORTION_CORRECTION_MODE_FAST = 1, + + /** + *

High-quality distortion correction is applied, at the cost of + * possibly reduced frame rate relative to sensor output.

+ */ + ACAMERA_DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2, + +} acamera_metadata_enum_android_distortion_correction_mode_t; + + #endif /* __ANDROID_API__ >= 24 */ __END_DECLS