Camera2: Add aberration correction control
Change-Id: I0a3530ee8d5550f0f2a58c4d7af284821d87cb4d
diff --git a/api/current.txt b/api/current.txt
index b3451d0..1173035 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12354,6 +12354,7 @@
method public T get(android.hardware.camera2.CameraCharacteristics.Key<T>);
method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableCaptureRequestKeys();
method public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getAvailableCaptureResultKeys();
+ field public static final android.hardware.camera2.CameraCharacteristics.Key COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES;
field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_MODES;
field public static final android.hardware.camera2.CameraCharacteristics.Key CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
@@ -12467,6 +12468,9 @@
public abstract class CameraMetadata {
method public java.util.List<TKey> getKeys();
+ field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1; // 0x1
+ field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
+ field public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0; // 0x0
field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
@@ -12656,6 +12660,7 @@
method public java.lang.Object getTag();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.hardware.camera2.CaptureRequest.Key BLACK_LEVEL_LOCK;
+ field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_GAINS;
field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_MODE;
field public static final android.hardware.camera2.CaptureRequest.Key COLOR_CORRECTION_TRANSFORM;
@@ -12727,6 +12732,7 @@
method public android.hardware.camera2.CaptureRequest getRequest();
method public int getSequenceId();
field public static final android.hardware.camera2.CaptureResult.Key BLACK_LEVEL_LOCK;
+ field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_ABERRATION_CORRECTION_MODE;
field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_GAINS;
field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_MODE;
field public static final android.hardware.camera2.CaptureResult.Key COLOR_CORRECTION_TRANSFORM;
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index c9a88f8..0d85530 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -289,6 +289,20 @@
/**
+ * <p>The set of aberration correction modes supported by this camera device.</p>
+ * <p>This metadata lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}.
+ * If no aberration correction modes are available for a device, this list will solely include
+ * OFF mode.</p>
+ * <p>For FULL capability device ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} <code>==</code> FULL), OFF must be
+ * included.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
+ */
+ public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES =
+ new Key<int[]>("android.colorCorrection.availableAberrationCorrectionModes", int[].class);
+
+ /**
* <p>The set of auto-exposure antibanding modes that are
* supported by this camera device.</p>
* <p>Not all of the auto-exposure anti-banding modes may be
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 53c8a52..6c3f7dd 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -317,12 +317,19 @@
* <li>android.lens.info.shadingMapSize</li>
* </ul>
* </li>
+ * <li>Manual aberration correction control (if aberration correction is supported)<ul>
+ * <li>{@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}</li>
+ * <li>{@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}</li>
+ * </ul>
+ * </li>
* </ul>
* <p>If auto white balance is enabled, then the camera device
* will accurately report the values applied by AWB in the result.</p>
* <p>A given camera device may also support additional post-processing
* controls, but this capability only covers the above list of controls.</p>
*
+ * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
* @see CaptureRequest#COLOR_CORRECTION_GAINS
* @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#SHADING_MODE
@@ -664,6 +671,30 @@
public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2;
//
+ // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ //
+
+ /**
+ * <p>No aberration correction is applied.</p>
+ * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ */
+ public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0;
+
+ /**
+ * <p>Aberration correction will not slow down capture rate
+ * relative to sensor raw output.</p>
+ * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ */
+ public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1;
+
+ /**
+ * <p>Aberration correction operates at improved quality but reduced
+ * capture rate (relative to sensor raw output).</p>
+ * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE
+ */
+ public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY = 2;
+
+ //
// Enumeration values for CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
//
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 27f7e3a..e8014b0 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -558,6 +558,29 @@
new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
/**
+ * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
+ * <p>This must be set to a valid mode from
+ * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+ * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
+ * can not focus on the same point after exiting from the lens. This metadata defines
+ * the high level control of chromatic aberration correction algorithm, which aims to
+ * minimize the chromatic artifacts that may occur along the object boundaries in an
+ * image.</p>
+ * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
+ * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
+ * use the highest-quality aberration correction algorithms, even if it slows down
+ * capture rate. FAST means the camera device will not slow down capture rate when
+ * applying aberration correction.</p>
+ *
+ * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+ */
+ public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
+ new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+
+ /**
* <p>The desired setting for the camera device's auto-exposure
* algorithm's antibanding compensation.</p>
* <p>Some kinds of lighting fixtures, such as some fluorescent
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 533ef5d..956e64f 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -403,6 +403,29 @@
new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class);
/**
+ * <p>Mode of operation for the chromatic aberration correction algorithm.</p>
+ * <p>This must be set to a valid mode from
+ * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.</p>
+ * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light
+ * can not focus on the same point after exiting from the lens. This metadata defines
+ * the high level control of chromatic aberration correction algorithm, which aims to
+ * minimize the chromatic artifacts that may occur along the object boundaries in an
+ * image.</p>
+ * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration
+ * correction will be applied. HIGH_QUALITY mode indicates that the camera device will
+ * use the highest-quality aberration correction algorithms, even if it slows down
+ * capture rate. FAST means the camera device will not slow down capture rate when
+ * applying aberration correction.</p>
+ *
+ * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST
+ * @see #COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_HIGH_QUALITY
+ */
+ public static final Key<Integer> COLOR_CORRECTION_ABERRATION_CORRECTION_MODE =
+ new Key<Integer>("android.colorCorrection.aberrationCorrectionMode", int.class);
+
+ /**
* <p>The desired setting for the camera device's auto-exposure
* algorithm's antibanding compensation.</p>
* <p>Some kinds of lighting fixtures, such as some fluorescent