diff --git a/api/current.txt b/api/current.txt index c58219d93355f..3ed2bb5c105e4 100644 --- a/api/current.txt +++ b/api/current.txt @@ -13466,6 +13466,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_TIMESTAMP_SOURCE; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_WHITE_LEVEL; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_MAX_ANALOG_SENSITIVITY; + field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_OPTICAL_BLACK_REGIONS; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_ORIENTATION; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_REFERENCE_ILLUMINANT1; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_REFERENCE_ILLUMINANT2; @@ -13878,6 +13879,8 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key REPROCESS_EFFECTIVE_EXPOSURE_FACTOR; field public static final android.hardware.camera2.CaptureResult.Key REQUEST_PIPELINE_DEPTH; field public static final android.hardware.camera2.CaptureResult.Key SCALER_CROP_REGION; + field public static final android.hardware.camera2.CaptureResult.Key SENSOR_DYNAMIC_BLACK_LEVEL; + field public static final android.hardware.camera2.CaptureResult.Key SENSOR_DYNAMIC_WHITE_LEVEL; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_EXPOSURE_TIME; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_FRAME_DURATION; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_GREEN_SPLIT; diff --git a/api/system-current.txt b/api/system-current.txt index 5b976a90e280c..08009c8efe45e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -13814,6 +13814,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_TIMESTAMP_SOURCE; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_INFO_WHITE_LEVEL; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_MAX_ANALOG_SENSITIVITY; + field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_OPTICAL_BLACK_REGIONS; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_ORIENTATION; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_REFERENCE_ILLUMINANT1; field public static final android.hardware.camera2.CameraCharacteristics.Key SENSOR_REFERENCE_ILLUMINANT2; @@ -14226,6 +14227,8 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key REPROCESS_EFFECTIVE_EXPOSURE_FACTOR; field public static final android.hardware.camera2.CaptureResult.Key REQUEST_PIPELINE_DEPTH; field public static final android.hardware.camera2.CaptureResult.Key SCALER_CROP_REGION; + field public static final android.hardware.camera2.CaptureResult.Key SENSOR_DYNAMIC_BLACK_LEVEL; + field public static final android.hardware.camera2.CaptureResult.Key SENSOR_DYNAMIC_WHITE_LEVEL; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_EXPOSURE_TIME; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_FRAME_DURATION; field public static final android.hardware.camera2.CaptureResult.Key SENSOR_GREEN_SPLIT; diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index a2ef078a6a71a..6fc998f783da2 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -2178,11 +2178,18 @@ public final class CameraCharacteristics extends CameraMetadata + *

The white level values of captured images may vary for different + * capture settings (e.g., {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}). This key + * represents a coarse approximation for such case. It is recommended + * to use {@link CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL android.sensor.dynamicWhiteLevel} for captures when supported + * by the camera device, which provides more accurate white level values.

*

Range of valid values:
* > 255 (8-bit output)

*

Optional - This value may be {@code null} on some devices.

* * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN + * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL + * @see CaptureRequest#SENSOR_SENSITIVITY */ @PublicKey public static final Key SENSOR_INFO_WHITE_LEVEL = @@ -2520,12 +2527,24 @@ public final class CameraCharacteristics extends CameraMetadata + *

The black level values of captured images may vary for different + * capture settings (e.g., {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}). This key + * represents a coarse approximation for such case. It is recommended to + * use {@link CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL android.sensor.dynamicBlackLevel} or use pixels from + * {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} directly for captures when + * supported by the camera device, which provides more accurate black + * level values. For raw capture in particular, it is recommended to use + * pixels from {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} to calculate black + * level values for each frame.

*

Range of valid values:
* >= 0 for each.

*

Optional - This value may be {@code null} on some devices.

* + * @see CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT * @see CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL + * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS + * @see CaptureRequest#SENSOR_SENSITIVITY */ @PublicKey public static final Key SENSOR_BLACK_LEVEL_PATTERN = @@ -2579,6 +2598,32 @@ public final class CameraCharacteristics extends CameraMetadata SENSOR_AVAILABLE_TEST_PATTERN_MODES = new Key("android.sensor.availableTestPatternModes", int[].class); + /** + *

List of disjoint rectangles indicating the sensor + * optically shielded black pixel regions.

+ *

In most camera sensors, the active array is surrounded by some + * optically shielded pixel areas. By blocking light, these pixels + * provides a reliable black reference for black level compensation + * in active array region.

+ *

This key provides a list of disjoint rectangles specifying the + * regions of optically shielded (with metal shield) black pixel + * regions if the camera device is capable of reading out these black + * pixels in the output raw images. In comparison to the fixed black + * level values reported by {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern}, this key + * may provide a more accurate way for the application to calculate + * black level of each captured raw images.

+ *

When this key is reported, the {@link CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL android.sensor.dynamicBlackLevel} and + * {@link CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL android.sensor.dynamicWhiteLevel} will also be reported.

+ *

Optional - This value may be {@code null} on some devices.

+ * + * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN + * @see CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL + * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL + */ + @PublicKey + public static final Key SENSOR_OPTICAL_BLACK_REGIONS = + new Key("android.sensor.opticalBlackRegions", android.graphics.Rect[].class); + /** *

List of lens shading modes for {@link CaptureRequest#SHADING_MODE android.shading.mode} that are supported by this camera device.

*

This list contains lens shading modes that can be set for the camera device. diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index b3acf2b09784b..5f27bcaabd61e 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -3291,6 +3291,69 @@ public class CaptureResult extends CameraMetadata> { public static final Key SENSOR_ROLLING_SHUTTER_SKEW = new Key("android.sensor.rollingShutterSkew", long.class); + /** + *

A per-frame dynamic black level offset for each of the color filter + * arrangement (CFA) mosaic channels.

+ *

Camera sensor black levels may vary dramatically for different + * capture settings (e.g. {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}). The fixed black + * level reported by {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern} may be too + * inaccurate to represent the actual value on a per-frame basis. The + * camera device internal pipeline relies on reliable black level values + * to process the raw images appropriately. To get the best image + * quality, the camera device may choose to estimate the per frame black + * level values either based on optically shielded black regions + * ({@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions}) or its internal model.

+ *

This key reports the camera device estimated per-frame zero light + * value for each of the CFA mosaic channels in the camera sensor. The + * {@link CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN android.sensor.blackLevelPattern} may only represent a coarse + * approximation of the actual black level values. This value is the + * black level used in camera device internal image processing pipeline + * and generally more accurate than the fixed black level values. + * However, since they are estimated values by the camera device, they + * may not be as accurate as the black level values calculated from the + * optical black pixels reported by {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions}.

+ *

The values are given in the same order as channels listed for the CFA + * layout key (see {@link CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT android.sensor.info.colorFilterArrangement}), i.e. the + * nth value given corresponds to the black level offset for the nth + * color channel listed in the CFA.

+ *

This key will be available if {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} is + * available or the camera device advertises this key via + * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys }.

+ *

Range of valid values:
+ * >= 0 for each.

+ *

Optional - This value may be {@code null} on some devices.

+ * + * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN + * @see CameraCharacteristics#SENSOR_INFO_COLOR_FILTER_ARRANGEMENT + * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS + * @see CaptureRequest#SENSOR_SENSITIVITY + */ + @PublicKey + public static final Key SENSOR_DYNAMIC_BLACK_LEVEL = + new Key("android.sensor.dynamicBlackLevel", android.hardware.camera2.params.BlackLevelPattern.class); + + /** + *

Maximum raw value output by sensor for this frame.

+ *

Since the android.sensor.blackLevel may change for different + * capture settings (e.g., {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}), the white + * level will change accordingly. This key is similar to + * {@link CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL android.sensor.info.whiteLevel}, but specifies the camera device + * estimated white level for each frame.

+ *

This key will be available if {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} is + * available or the camera device advertises this key via + * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys }.

+ *

Range of valid values:
+ * >= 0

+ *

Optional - This value may be {@code null} on some devices.

+ * + * @see CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL + * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS + * @see CaptureRequest#SENSOR_SENSITIVITY + */ + @PublicKey + public static final Key SENSOR_DYNAMIC_WHITE_LEVEL = + new Key("android.sensor.dynamicWhiteLevel", int.class); + /** *

Quality of lens shading correction applied * to the image data.