Camera: Add color temperature metadata tags
- Add metadata for manual color temperature feature
- Update COLOR_CORRECTION_AVAILABLE_MODES tag to include
existing supported color correction modes
Bug: 359409044
Flag: com.android.internal.camera.flags.color_temperature
Test: Camera CTS with flag disabled and enabled
Change-Id: Iabfa21cecc1dd1708dcd8ef0e72338d095ebcfc7
diff --git a/camera/camera_platform.aconfig b/camera/camera_platform.aconfig
index c9e8ffd..323b23a 100644
--- a/camera/camera_platform.aconfig
+++ b/camera/camera_platform.aconfig
@@ -195,3 +195,10 @@
bug: "338621560"
}
+flag {
+ namespace: "camera_platform"
+ name: "color_temperature"
+ description: "Add keys to manually set color temperature and color tint"
+ bug: "359409044"
+}
+
diff --git a/camera/ndk/impl/ACameraMetadata.cpp b/camera/ndk/impl/ACameraMetadata.cpp
index 69b30f7..fef6443 100644
--- a/camera/ndk/impl/ACameraMetadata.cpp
+++ b/camera/ndk/impl/ACameraMetadata.cpp
@@ -536,6 +536,8 @@
case ACAMERA_COLOR_CORRECTION_TRANSFORM:
case ACAMERA_COLOR_CORRECTION_GAINS:
case ACAMERA_COLOR_CORRECTION_ABERRATION_MODE:
+ case ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE:
+ case ACAMERA_COLOR_CORRECTION_COLOR_TINT:
case ACAMERA_CONTROL_AE_ANTIBANDING_MODE:
case ACAMERA_CONTROL_AE_EXPOSURE_COMPENSATION:
case ACAMERA_CONTROL_AE_LOCK:
diff --git a/camera/ndk/include/camera/NdkCameraMetadataTags.h b/camera/ndk/include/camera/NdkCameraMetadataTags.h
index acc3c7c..44aac29 100644
--- a/camera/ndk/include/camera/NdkCameraMetadataTags.h
+++ b/camera/ndk/include/camera/NdkCameraMetadataTags.h
@@ -307,6 +307,100 @@
*/
ACAMERA_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES = // byte[n]
ACAMERA_COLOR_CORRECTION_START + 4,
+ /**
+ * <p>Specifies the color temperature for CCT mode in Kelvin
+ * to adjust the white balance of the image.</p>
+ *
+ * <p>Type: int32</p>
+ *
+ * <p>This tag may appear in:
+ * <ul>
+ * <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
+ * <li>ACaptureRequest</li>
+ * </ul></p>
+ *
+ * <p>Sets the color temperature in Kelvin units for when
+ * ACAMERA_COLOR_CORRECTION_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 ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE
+ * will be clamped.</p>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE
+ * @see ACAMERA_COLOR_CORRECTION_MODE
+ */
+ ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE = // int32
+ ACAMERA_COLOR_CORRECTION_START + 5,
+ /**
+ * <p>Specifies the color tint for CCT mode to adjust the white
+ * balance of the image.</p>
+ *
+ * <p>Type: int32</p>
+ *
+ * <p>This tag may appear in:
+ * <ul>
+ * <li>ACameraMetadata from ACameraCaptureSession_captureCallback_result callbacks</li>
+ * <li>ACaptureRequest</li>
+ * </ul></p>
+ *
+ * <p>Sets the color tint for when ACAMERA_COLOR_CORRECTION_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>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_MODE
+ */
+ ACAMERA_COLOR_CORRECTION_COLOR_TINT = // int32
+ ACAMERA_COLOR_CORRECTION_START + 6,
+ /**
+ * <p>The range of supported color temperature values for
+ * ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE.</p>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE
+ *
+ * <p>Type: int32[2]</p>
+ *
+ * <p>This tag may appear in:
+ * <ul>
+ * <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
+ * </ul></p>
+ *
+ * <p>This key lists the valid range of color temperature values for
+ * ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE supported by this camera device.</p>
+ * <p>This key will be null on devices that do not support CCT mode for
+ * ACAMERA_COLOR_CORRECTION_MODE.</p>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE
+ * @see ACAMERA_COLOR_CORRECTION_MODE
+ */
+ ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE_RANGE = // int32[2]
+ ACAMERA_COLOR_CORRECTION_START + 7,
+ /**
+ * <p>List of color correction modes for ACAMERA_COLOR_CORRECTION_MODE that are
+ * supported by this camera device.</p>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_MODE
+ *
+ * <p>Type: byte[n]</p>
+ *
+ * <p>This tag may appear in:
+ * <ul>
+ * <li>ACameraMetadata from ACameraManager_getCameraCharacteristics</li>
+ * </ul></p>
+ *
+ * <p>This key lists the valid modes for ACAMERA_COLOR_CORRECTION_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>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_MODE
+ */
+ ACAMERA_COLOR_CORRECTION_AVAILABLE_MODES = // byte[n]
+ ACAMERA_COLOR_CORRECTION_START + 8,
ACAMERA_COLOR_CORRECTION_END,
/**
@@ -8137,6 +8231,20 @@
*/
ACAMERA_COLOR_CORRECTION_MODE_HIGH_QUALITY = 2,
+ /**
+ * <p>Use
+ * ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE and
+ * ACAMERA_COLOR_CORRECTION_COLOR_TINT to adjust the white balance based
+ * on correlated color temperature.</p>
+ * <p>If AWB is enabled with <code>ACAMERA_CONTROL_AWB_MODE != OFF</code>, then
+ * CCT is ignored.</p>
+ *
+ * @see ACAMERA_COLOR_CORRECTION_COLOR_TEMPERATURE
+ * @see ACAMERA_COLOR_CORRECTION_COLOR_TINT
+ * @see ACAMERA_CONTROL_AWB_MODE
+ */
+ ACAMERA_COLOR_CORRECTION_MODE_CCT = 3,
+
} acamera_metadata_enum_android_color_correction_mode_t;
// ACAMERA_COLOR_CORRECTION_ABERRATION_MODE