From a05e59d12b410638e97bc2d88c64442c47907fe3 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Tue, 8 Jul 2014 18:27:47 -0700 Subject: [PATCH] Camera2: Add aberration correction control Change-Id: I0a3530ee8d5550f0f2a58c4d7af284821d87cb4d --- api/current.txt | 6 ++++ .../camera2/CameraCharacteristics.java | 14 +++++++++ .../hardware/camera2/CameraMetadata.java | 31 +++++++++++++++++++ .../hardware/camera2/CaptureRequest.java | 23 ++++++++++++++ .../hardware/camera2/CaptureResult.java | 23 ++++++++++++++ 5 files changed, 97 insertions(+) diff --git a/api/current.txt b/api/current.txt index b3451d0fadd1a..1173035a4b180 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12354,6 +12354,7 @@ package android.hardware.camera2 { method public T get(android.hardware.camera2.CameraCharacteristics.Key); method public java.util.List> getAvailableCaptureRequestKeys(); method public java.util.List> 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 @@ package android.hardware.camera2 { public abstract class CameraMetadata { method public java.util.List 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 @@ package android.hardware.camera2 { 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 @@ package android.hardware.camera2 { 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 c9a88f830647b..0d85530e8342f 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -288,6 +288,20 @@ public final class CameraCharacteristics extends CameraMetadataThe set of aberration correction modes supported by this camera device.

+ *

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.

+ *

For FULL capability device ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} == FULL), OFF must be + * included.

+ * + * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE + * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL + */ + public static final Key COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES = + new Key("android.colorCorrection.availableAberrationCorrectionModes", int[].class); + /** *

The set of auto-exposure antibanding modes that are * supported by this camera device.

diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 53c8a52e2062a..6c3f7ddaf1b04 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -317,12 +317,19 @@ public abstract class CameraMetadata { *
  • android.lens.info.shadingMapSize
  • * * + *
  • Manual aberration correction control (if aberration correction is supported)
      + *
    • {@link CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE android.colorCorrection.aberrationCorrectionMode}
    • + *
    • {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}
    • + *
    + *
  • * *

    If auto white balance is enabled, then the camera device * will accurately report the values applied by AWB in the result.

    *

    A given camera device may also support additional post-processing * controls, but this capability only covers the above list of controls.

    * + * @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 @@ -663,6 +670,30 @@ public abstract class CameraMetadata { */ public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; + // + // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE + // + + /** + *

    No aberration correction is applied.

    + * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE + */ + public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_OFF = 0; + + /** + *

    Aberration correction will not slow down capture rate + * relative to sensor raw output.

    + * @see CaptureRequest#COLOR_CORRECTION_ABERRATION_CORRECTION_MODE + */ + public static final int COLOR_CORRECTION_ABERRATION_CORRECTION_MODE_FAST = 1; + + /** + *

    Aberration correction operates at improved quality but reduced + * capture rate (relative to sensor raw output).

    + * @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 27f7e3ada1e9f..e8014b0123649 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -557,6 +557,29 @@ public final class CaptureRequest extends CameraMetadata> public static final Key COLOR_CORRECTION_GAINS = new Key("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class); + /** + *

    Mode of operation for the chromatic aberration correction algorithm.

    + *

    This must be set to a valid mode from + * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.

    + *

    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.

    + *

    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.

    + * + * @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 COLOR_CORRECTION_ABERRATION_CORRECTION_MODE = + new Key("android.colorCorrection.aberrationCorrectionMode", int.class); + /** *

    The desired setting for the camera device's auto-exposure * algorithm's antibanding compensation.

    diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 533ef5d9212a5..956e64f0ed3aa 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -402,6 +402,29 @@ public class CaptureResult extends CameraMetadata> { public static final Key COLOR_CORRECTION_GAINS = new Key("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class); + /** + *

    Mode of operation for the chromatic aberration correction algorithm.

    + *

    This must be set to a valid mode from + * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_CORRECTION_MODES android.colorCorrection.availableAberrationCorrectionModes}.

    + *

    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.

    + *

    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.

    + * + * @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 COLOR_CORRECTION_ABERRATION_CORRECTION_MODE = + new Key("android.colorCorrection.aberrationCorrectionMode", int.class); + /** *

    The desired setting for the camera device's auto-exposure * algorithm's antibanding compensation.