diff options
| author | 2024-10-31 23:08:15 +0000 | |
|---|---|---|
| committer | 2024-10-31 23:08:15 +0000 | |
| commit | 7799ecf1e60a924f703a0e9a842dd5a48cff2e0c (patch) | |
| tree | 0c643d80c45bd9409c08c1acbbcb1541ca45b0db | |
| parent | 70a45498fdc862dea6ca4323bf71445dfe81497f (diff) | |
| parent | 717bc6d59f6d39daa3939209431e95ccf1ff5279 (diff) | |
Merge "Camera: Add keys for color temperature feature" into main
| -rw-r--r-- | core/api/current.txt | 7 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CameraCharacteristics.java | 40 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CameraMetadata.java | 16 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CaptureRequest.java | 60 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CaptureResult.java | 60 |
5 files changed, 183 insertions, 0 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 6ee574a9d524..7aea6a6d375f 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -19333,6 +19333,8 @@ package android.hardware.camera2 { field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> AUTOMOTIVE_LENS_FACING; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> AUTOMOTIVE_LOCATION; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> COLOR_CORRECTION_AVAILABLE_MODES; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_ANTIBANDING_MODES; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_MODES; field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES; @@ -19634,6 +19636,7 @@ package android.hardware.camera2 { field public static final int COLOR_CORRECTION_ABERRATION_MODE_FAST = 1; // 0x1 field public static final int COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2; // 0x2 field public static final int COLOR_CORRECTION_ABERRATION_MODE_OFF = 0; // 0x0 + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") public static final int COLOR_CORRECTION_MODE_CCT = 3; // 0x3 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 @@ -19920,6 +19923,8 @@ package android.hardware.camera2 { method public void writeToParcel(android.os.Parcel, int); field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> BLACK_LEVEL_LOCK; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_COLOR_TEMPERATURE; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_COLOR_TINT; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_MODE; field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM; @@ -20010,6 +20015,8 @@ package android.hardware.camera2 { method public int getSequenceId(); field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> BLACK_LEVEL_LOCK; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_COLOR_TEMPERATURE; + field @FlaggedApi("com.android.internal.camera.flags.color_temperature") @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_COLOR_TINT; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_MODE; field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM; diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 1137e1e89f67..16d82caa6c1a 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -775,6 +775,46 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<int[]>("android.colorCorrection.availableAberrationModes", int[].class); /** + * <p>The range of supported color temperature values for + * {@link CaptureRequest#COLOR_CORRECTION_COLOR_TEMPERATURE android.colorCorrection.colorTemperature}.</p> + * <p>This key lists the valid range of color temperature values for + * {@link CaptureRequest#COLOR_CORRECTION_COLOR_TEMPERATURE android.colorCorrection.colorTemperature} supported by this camera device.</p> + * <p>This key will be null on devices that do not support CCT mode for + * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p> + * <p><b>Range of valid values:</b><br></p> + * <p>The minimum supported range will be [2856K,6500K]. The maximum supported + * range will be [1000K,40000K].</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CaptureRequest#COLOR_CORRECTION_COLOR_TEMPERATURE + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<android.util.Range<Integer>> COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE = + new Key<android.util.Range<Integer>>("android.colorCorrection.colorTemperatureRange", new TypeReference<android.util.Range<Integer>>() {{ }}); + + /** + * <p>List of color correction modes for {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} that are + * supported by this camera device.</p> + * <p>This key lists the valid modes for {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. If no + * color correction modes are available for a device, this key will be null.</p> + * <p>Camera devices that have a FULL hardware level will always include at least + * FAST, HIGH_QUALITY, and TRANSFORM_MATRIX modes.</p> + * <p><b>Range of valid values:</b><br> + * Any value listed in {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<int[]> COLOR_CORRECTION_AVAILABLE_MODES = + new Key<int[]>("android.colorCorrection.availableModes", int[].class); + + /** * <p>List of auto-exposure antibanding modes for {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} 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 acb48f328f1a..86bbd4a57a63 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -2169,6 +2169,22 @@ public abstract class CameraMetadata<TKey> { */ public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; + /** + * <p>Use + * {@link CaptureRequest#COLOR_CORRECTION_COLOR_TEMPERATURE android.colorCorrection.colorTemperature} and + * {@link CaptureRequest#COLOR_CORRECTION_COLOR_TINT android.colorCorrection.colorTint} to adjust the white balance based + * on correlated color temperature.</p> + * <p>If AWB is enabled with <code>{@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} != OFF</code>, then + * CCT is ignored.</p> + * + * @see CaptureRequest#COLOR_CORRECTION_COLOR_TEMPERATURE + * @see CaptureRequest#COLOR_CORRECTION_COLOR_TINT + * @see CaptureRequest#CONTROL_AWB_MODE + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final int COLOR_CORRECTION_MODE_CCT = 3; + // // Enumeration values for CaptureRequest#COLOR_CORRECTION_ABERRATION_MODE // diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index a5c5a9952879..8142bbe9b838 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -1086,11 +1086,17 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> * </ul> * + * <p><b>Available values for this device:</b><br> + * Starting from API level 36, {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_MODES android.colorCorrection.availableModes} + * can be used to check the list of supported values. Prior to API level 36, + * TRANSFORM_MATRIX, HIGH_QUALITY, and FAST are guaranteed to be available + * as valid modes on devices that support this key.</p> * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> * <p><b>Full capability</b> - * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> * + * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_MODES * @see CaptureRequest#COLOR_CORRECTION_GAINS * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM * @see CaptureRequest#CONTROL_AWB_MODE @@ -1195,6 +1201,60 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> new Key<Integer>("android.colorCorrection.aberrationMode", int.class); /** + * <p>Specifies the color temperature for CCT mode in Kelvin + * to adjust the white balance of the image.</p> + * <p>Sets the color temperature in Kelvin units for when + * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is CCT to adjust the + * white balance of the image.</p> + * <p>If CCT mode is enabled without a requested color temperature, + * a default value will be set by the camera device. The default value can be + * retrieved by checking the corresponding capture result. Color temperatures + * requested outside the advertised {@link CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE android.colorCorrection.colorTemperatureRange} + * will be clamped.</p> + * <p><b>Units</b>: Kelvin</p> + * <p><b>Range of valid values:</b><br> + * {@link CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE android.colorCorrection.colorTemperatureRange}</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<Integer> COLOR_CORRECTION_COLOR_TEMPERATURE = + new Key<Integer>("android.colorCorrection.colorTemperature", int.class); + + /** + * <p>Specifies the color tint for CCT mode to adjust the white + * balance of the image.</p> + * <p>Sets the color tint for when {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} + * is CCT to adjust the white balance of the image.</p> + * <p>If CCT mode is enabled without a requested color tint, + * a default value will be set by the camera device. The default value can be + * retrieved by checking the corresponding capture result. Color tints requested + * outside the supported range will be clamped to the nearest limit (-50 or +50).</p> + * <p><b>Units</b>: D_uv defined as the distance from the Planckian locus on the CIE 1931 xy + * chromaticity diagram, with the range ±50 mapping to ±0.01 D_uv</p> + * <p><b>Range of valid values:</b><br> + * The supported range, -50 to +50, corresponds to a D_uv distance + * of ±0.01 below and above the Planckian locus. Some camera devices may have + * limitations to achieving the full ±0.01 D_uv range at some color temperatures + * (e.g., below 1500K). In these cases, the applied D_uv value may be clamped and + * the actual color tint will be reported in the {@link CaptureRequest#COLOR_CORRECTION_COLOR_TINT android.colorCorrection.colorTint} + * result.</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CaptureRequest#COLOR_CORRECTION_COLOR_TINT + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<Integer> COLOR_CORRECTION_COLOR_TINT = + new Key<Integer>("android.colorCorrection.colorTint", 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 a6bdb3f1bb07..ae72ca40fc5a 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -487,11 +487,17 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> * </ul> * + * <p><b>Available values for this device:</b><br> + * Starting from API level 36, {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_MODES android.colorCorrection.availableModes} + * can be used to check the list of supported values. Prior to API level 36, + * TRANSFORM_MATRIX, HIGH_QUALITY, and FAST are guaranteed to be available + * as valid modes on devices that support this key.</p> * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> * <p><b>Full capability</b> - * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> * + * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_MODES * @see CaptureRequest#COLOR_CORRECTION_GAINS * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM * @see CaptureRequest#CONTROL_AWB_MODE @@ -596,6 +602,60 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { new Key<Integer>("android.colorCorrection.aberrationMode", int.class); /** + * <p>Specifies the color temperature for CCT mode in Kelvin + * to adjust the white balance of the image.</p> + * <p>Sets the color temperature in Kelvin units for when + * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is CCT to adjust the + * white balance of the image.</p> + * <p>If CCT mode is enabled without a requested color temperature, + * a default value will be set by the camera device. The default value can be + * retrieved by checking the corresponding capture result. Color temperatures + * requested outside the advertised {@link CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE android.colorCorrection.colorTemperatureRange} + * will be clamped.</p> + * <p><b>Units</b>: Kelvin</p> + * <p><b>Range of valid values:</b><br> + * {@link CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE android.colorCorrection.colorTemperatureRange}</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CameraCharacteristics#COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<Integer> COLOR_CORRECTION_COLOR_TEMPERATURE = + new Key<Integer>("android.colorCorrection.colorTemperature", int.class); + + /** + * <p>Specifies the color tint for CCT mode to adjust the white + * balance of the image.</p> + * <p>Sets the color tint for when {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} + * is CCT to adjust the white balance of the image.</p> + * <p>If CCT mode is enabled without a requested color tint, + * a default value will be set by the camera device. The default value can be + * retrieved by checking the corresponding capture result. Color tints requested + * outside the supported range will be clamped to the nearest limit (-50 or +50).</p> + * <p><b>Units</b>: D_uv defined as the distance from the Planckian locus on the CIE 1931 xy + * chromaticity diagram, with the range ±50 mapping to ±0.01 D_uv</p> + * <p><b>Range of valid values:</b><br> + * The supported range, -50 to +50, corresponds to a D_uv distance + * of ±0.01 below and above the Planckian locus. Some camera devices may have + * limitations to achieving the full ±0.01 D_uv range at some color temperatures + * (e.g., below 1500K). In these cases, the applied D_uv value may be clamped and + * the actual color tint will be reported in the {@link CaptureRequest#COLOR_CORRECTION_COLOR_TINT android.colorCorrection.colorTint} + * result.</p> + * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> + * + * @see CaptureRequest#COLOR_CORRECTION_COLOR_TINT + * @see CaptureRequest#COLOR_CORRECTION_MODE + */ + @PublicKey + @NonNull + @FlaggedApi(Flags.FLAG_COLOR_TEMPERATURE) + public static final Key<Integer> COLOR_CORRECTION_COLOR_TINT = + new Key<Integer>("android.colorCorrection.colorTint", 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 |