diff options
| author | Zhijun He <zhijunhe@google.com> | 2015-11-12 17:47:52 -0800 |
|---|---|---|
| committer | Zhijun He <zhijunhe@google.com> | 2015-11-23 12:09:10 -0800 |
| commit | cd950b682c5007119ab44bd8c822d28497e11fc6 (patch) | |
| tree | d341649ccb6a81867510626482a338d2dceaae3c /core/java/android | |
| parent | c0c73271b0034ba20b1b73cb633c99a86c504a01 (diff) | |
Camera2: add dynamic black level support
Also add the optical black regions static memtadata.
Bug: 23011454
Change-Id: I217f33e89e046991f4cded7f7213ce6793ec4e68
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/hardware/camera2/CameraCharacteristics.java | 45 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/CaptureResult.java | 63 |
2 files changed, 108 insertions, 0 deletions
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index a2ef078a6a71..6fc998f783da 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<CameraCharacteri * (8-14 bits is expected), or by the point where the sensor response * becomes too non-linear to be useful. The default value for this is * maximum representable value for a 16-bit raw sample (2^16 - 1).</p> + * <p>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.</p> * <p><b>Range of valid values:</b><br> * > 255 (8-bit output)</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN + * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL + * @see CaptureRequest#SENSOR_SENSITIVITY */ @PublicKey public static final Key<Integer> SENSOR_INFO_WHITE_LEVEL = @@ -2520,12 +2527,24 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri * 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.</p> + * <p>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.</p> * <p><b>Range of valid values:</b><br> * >= 0 for each.</p> * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> * + * @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<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN = @@ -2580,6 +2599,32 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<int[]>("android.sensor.availableTestPatternModes", int[].class); /** + * <p>List of disjoint rectangles indicating the sensor + * optically shielded black pixel regions.</p> + * <p>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.</p> + * <p>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.</p> + * <p>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.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> + * + * @see CameraCharacteristics#SENSOR_BLACK_LEVEL_PATTERN + * @see CaptureResult#SENSOR_DYNAMIC_BLACK_LEVEL + * @see CaptureResult#SENSOR_DYNAMIC_WHITE_LEVEL + */ + @PublicKey + public static final Key<android.graphics.Rect[]> SENSOR_OPTICAL_BLACK_REGIONS = + new Key<android.graphics.Rect[]>("android.sensor.opticalBlackRegions", android.graphics.Rect[].class); + + /** * <p>List of lens shading modes for {@link CaptureRequest#SHADING_MODE android.shading.mode} that are supported by this camera device.</p> * <p>This list contains lens shading modes that can be set for the camera device. * Camera devices that support the MANUAL_POST_PROCESSING capability will always diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index b3acf2b09784..5f27bcaabd61 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -3292,6 +3292,69 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { new Key<Long>("android.sensor.rollingShutterSkew", long.class); /** + * <p>A per-frame dynamic black level offset for each of the color filter + * arrangement (CFA) mosaic channels.</p> + * <p>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.</p> + * <p>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}.</p> + * <p>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.</p> + * <p>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 }.</p> + * <p><b>Range of valid values:</b><br> + * >= 0 for each.</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> + * + * @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<android.hardware.camera2.params.BlackLevelPattern> SENSOR_DYNAMIC_BLACK_LEVEL = + new Key<android.hardware.camera2.params.BlackLevelPattern>("android.sensor.dynamicBlackLevel", android.hardware.camera2.params.BlackLevelPattern.class); + + /** + * <p>Maximum raw value output by sensor for this frame.</p> + * <p>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.</p> + * <p>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 }.</p> + * <p><b>Range of valid values:</b><br> + * >= 0</p> + * <p><b>Optional</b> - This value may be {@code null} on some devices.</p> + * + * @see CameraCharacteristics#SENSOR_INFO_WHITE_LEVEL + * @see CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS + * @see CaptureRequest#SENSOR_SENSITIVITY + */ + @PublicKey + public static final Key<Integer> SENSOR_DYNAMIC_WHITE_LEVEL = + new Key<Integer>("android.sensor.dynamicWhiteLevel", int.class); + + /** * <p>Quality of lens shading correction applied * to the image data.</p> * <p>When set to OFF mode, no lens shading correction will be applied by the |
