From 379af01292ecf4a46a465c48a7da55a68c0a9f49 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Tue, 6 May 2014 11:54:54 -0700 Subject: [PATCH] Camera2: Add missing capture result tags All capture request tags should be available in capture result. Bug: 14059883 Change-Id: I0aa8d7341b14fbbd627b17eb316bb016ff1fc316 --- api/current.txt | 14 + .../android/hardware/camera2/CaptureResult.java | 315 +++++++++++++++++++++ 2 files changed, 329 insertions(+) diff --git a/api/current.txt b/api/current.txt index a711896062ea..aca2add8f151 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12171,17 +12171,29 @@ package android.hardware.camera2 { method public int getSequenceId(); field public static final android.hardware.camera2.CameraMetadata.Key BLACK_LEVEL_LOCK; field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_GAINS; + field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_MODE; field public static final android.hardware.camera2.CameraMetadata.Key COLOR_CORRECTION_TRANSFORM; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_ANTIBANDING_MODE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_EXPOSURE_COMPENSATION; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_LOCK; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_MODE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_PRECAPTURE_TRIGGER; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_REGIONS; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_STATE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AE_TARGET_FPS_RANGE; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AF_MODE; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AF_REGIONS; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AF_STATE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AF_TRIGGER; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AWB_LOCK; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AWB_MODE; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AWB_REGIONS; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_AWB_STATE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_CAPTURE_INTENT; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_EFFECT_MODE; field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_MODE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_SCENE_MODE; + field public static final android.hardware.camera2.CameraMetadata.Key CONTROL_VIDEO_STABILIZATION_MODE; field public static final android.hardware.camera2.CameraMetadata.Key EDGE_MODE; field public static final android.hardware.camera2.CameraMetadata.Key FLASH_MODE; field public static final android.hardware.camera2.CameraMetadata.Key FLASH_STATE; @@ -12212,6 +12224,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_PROFILE_TONE_CURVE; field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_SENSITIVITY; field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_TEMPERATURE; + field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_TEST_PATTERN_DATA; field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_TEST_PATTERN_MODE; field public static final android.hardware.camera2.CameraMetadata.Key SENSOR_TIMESTAMP; field public static final android.hardware.camera2.CameraMetadata.Key SHADING_MODE; @@ -12220,6 +12233,7 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CameraMetadata.Key STATISTICS_HOT_PIXEL_MAP; field public static final android.hardware.camera2.CameraMetadata.Key STATISTICS_HOT_PIXEL_MAP_MODE; field public static final android.hardware.camera2.CameraMetadata.Key STATISTICS_LENS_SHADING_MAP; + field public static final android.hardware.camera2.CameraMetadata.Key STATISTICS_LENS_SHADING_MAP_MODE; field public static final android.hardware.camera2.CameraMetadata.Key STATISTICS_SCENE_FLICKER; field public static final android.hardware.camera2.CameraMetadata.Key TONEMAP_CURVE_BLUE; field public static final android.hardware.camera2.CameraMetadata.Key TONEMAP_CURVE_GREEN; diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index d8981c82546a..1d2d0e999b8b 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -124,6 +124,58 @@ public final class CaptureResult extends CameraMetadata { /** + *

The mode control selects how the image data is converted from the + * sensor's native color into linear sRGB color.

+ *

When auto-white balance is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this + * control is overridden by the AWB routine. When AWB is disabled, the + * application controls how the color mapping is performed.

+ *

We define the expected processing pipeline below. For consistency + * across devices, this is always the case with TRANSFORM_MATRIX.

+ *

When either FULL or HIGH_QUALITY is used, the camera device may + * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and + * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the + * camera device (in the results) and be roughly correct.

+ *

Switching to TRANSFORM_MATRIX and using the data provided from + * FAST or HIGH_QUALITY will yield a picture with the same white point + * as what was produced by the camera device in the earlier frame.

+ *

The expected processing pipeline is as follows:

+ *

White balance processing pipeline

+ *

The white balance is encoded by two values, a 4-channel white-balance + * gain vector (applied in the Bayer domain), and a 3x3 color transform + * matrix (applied after demosaic).

+ *

The 4-channel white-balance gains are defined as:

+ *
{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ]
+     * 
+ *

where G_even is the gain for green pixels on even rows of the + * output, and G_odd is the gain for green pixels on the odd rows. + * These may be identical for a given camera device implementation; if + * the camera device does not support a separate gain for even/odd green + * channels, it will use the G_even value, and write G_odd equal to + * G_even in the output result metadata.

+ *

The matrices for color transforms are defined as a 9-entry vector:

+ *
{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ]
+     * 
+ *

which define a transform from input sensor colors, P_in = [ r g b ], + * to output linear sRGB, P_out = [ r' g' b' ],

+ *

with colors as follows:

+ *
r' = I0r + I1g + I2b
+     * g' = I3r + I4g + I5b
+     * b' = I6r + I7g + I8b
+     * 
+ *

Both the input and output value ranges must match. Overflow/underflow + * values are clipped to fit within the range.

+ * + * @see CaptureRequest#COLOR_CORRECTION_GAINS + * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM + * @see CaptureRequest#CONTROL_AWB_MODE + * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX + * @see #COLOR_CORRECTION_MODE_FAST + * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY + */ + public static final Key COLOR_CORRECTION_MODE = + new Key("android.colorCorrection.mode", int.class); + + /** *

A color transform matrix to use to transform * from sensor RGB color space to output linear sRGB color space

*

This matrix is either set by the camera device when the request @@ -176,6 +228,82 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.aePrecaptureId", int.class); /** + *

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

+ *

Some kinds of lighting fixtures, such as some fluorescent + * lights, flicker at the rate of the power supply frequency + * (60Hz or 50Hz, depending on country). While this is + * typically not noticeable to a person, it can be visible to + * a camera device. If a camera sets its exposure time to the + * wrong value, the flicker may become visible in the + * viewfinder as flicker or in a final captured image, as a + * set of variable-brightness bands across the image.

+ *

Therefore, the auto-exposure routines of camera devices + * include antibanding routines that ensure that the chosen + * exposure value will not cause such banding. The choice of + * exposure time depends on the rate of flicker, which the + * camera device can detect automatically, or the expected + * rate can be selected by the application using this + * control.

+ *

A given camera device may not support all of the possible + * options for the antibanding mode. The + * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains + * the available modes for a given camera device.

+ *

The default mode is AUTO, which must be supported by all + * camera devices.

+ *

If manual exposure control is enabled (by setting + * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF), + * then this setting has no effect, and the application must + * ensure it selects exposure times that do not cause banding + * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist + * the application in this.

+ * + * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES + * @see CaptureRequest#CONTROL_AE_MODE + * @see CaptureRequest#CONTROL_MODE + * @see CaptureResult#STATISTICS_SCENE_FLICKER + * @see #CONTROL_AE_ANTIBANDING_MODE_OFF + * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ + * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ + * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO + */ + public static final Key CONTROL_AE_ANTIBANDING_MODE = + new Key("android.control.aeAntibandingMode", int.class); + + /** + *

Adjustment to AE target image + * brightness

+ *

For example, if EV step is 0.333, '6' will mean an + * exposure compensation of +2 EV; -3 will mean an exposure + * compensation of -1

+ */ + public static final Key CONTROL_AE_EXPOSURE_COMPENSATION = + new Key("android.control.aeExposureCompensation", int.class); + + /** + *

Whether AE is currently locked to its latest + * calculated values.

+ *

Note that even when AE is locked, the flash may be + * fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH / ON_ALWAYS_FLASH / + * ON_AUTO_FLASH_REDEYE.

+ *

If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) + * when AE is already locked, the camera device will not change the exposure time + * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}) + * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} + * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the + * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed.

+ *

See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.

+ * + * @see CaptureRequest#CONTROL_AE_MODE + * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER + * @see CaptureResult#CONTROL_AE_STATE + * @see CaptureRequest#SENSOR_EXPOSURE_TIME + * @see CaptureRequest#SENSOR_SENSITIVITY + */ + public static final Key CONTROL_AE_LOCK = + new Key("android.control.aeLock", boolean.class); + + /** *

The desired mode for the camera device's * auto-exposure routine.

*

This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is @@ -237,6 +365,35 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.aeRegions", int[].class); /** + *

Range over which fps can be adjusted to + * maintain exposure

+ *

Only constrains AE algorithm, not manual control + * of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}

+ * + * @see CaptureRequest#SENSOR_EXPOSURE_TIME + */ + public static final Key CONTROL_AE_TARGET_FPS_RANGE = + new Key("android.control.aeTargetFpsRange", int[].class); + + /** + *

Whether the camera device will trigger a precapture + * metering sequence when it processes this request.

+ *

This entry is normally set to IDLE, or is not + * included at all in the request settings. When included and + * set to START, the camera device will trigger the autoexposure + * precapture metering sequence.

+ *

The effect of AE precapture trigger depends on the current + * AE mode and state; see {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture + * state transition details.

+ * + * @see CaptureResult#CONTROL_AE_STATE + * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE + * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START + */ + public static final Key CONTROL_AE_PRECAPTURE_TRIGGER = + new Key("android.control.aePrecaptureTrigger", int.class); + + /** *

Current state of AE algorithm

*

Switching between or enabling AE modes ({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}) always * resets the AE state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode}, @@ -481,6 +638,24 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.afRegions", int[].class); /** + *

Whether the camera device will trigger autofocus for this request.

+ *

This entry is normally set to IDLE, or is not + * included at all in the request settings.

+ *

When included and set to START, the camera device will trigger the + * autofocus algorithm. If autofocus is disabled, this trigger has no effect.

+ *

When set to CANCEL, the camera device will cancel any active trigger, + * and return to its initial AF state.

+ *

See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what that means for each AF mode.

+ * + * @see CaptureResult#CONTROL_AF_STATE + * @see #CONTROL_AF_TRIGGER_IDLE + * @see #CONTROL_AF_TRIGGER_START + * @see #CONTROL_AF_TRIGGER_CANCEL + */ + public static final Key CONTROL_AF_TRIGGER = + new Key("android.control.afTrigger", int.class); + + /** *

Current state of AF algorithm.

*

Switching between or enabling AF modes ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) always * resets the AF state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode}, @@ -889,6 +1064,16 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.afTriggerId", int.class); /** + *

Whether AWB is currently locked to its + * latest calculated values.

+ *

Note that AWB lock is only meaningful for AUTO + * mode; in other modes, AWB is already fixed to a specific + * setting.

+ */ + public static final Key CONTROL_AWB_LOCK = + new Key("android.control.awbLock", boolean.class); + + /** *

Whether AWB is currently setting the color * transform fields, and what its illumination target * is.

@@ -948,6 +1133,30 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.awbRegions", int[].class); /** + *

Information to the camera device 3A (auto-exposure, + * auto-focus, auto-white balance) routines about the purpose + * of this capture, to help the camera device to decide optimal 3A + * strategy.

+ *

This control (except for MANUAL) is only effective if + * {@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF and any 3A routine is active.

+ *

ZERO_SHUTTER_LAG must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} + * contains ZSL. MANUAL must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} + * contains MANUAL_SENSOR.

+ * + * @see CaptureRequest#CONTROL_MODE + * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES + * @see #CONTROL_CAPTURE_INTENT_CUSTOM + * @see #CONTROL_CAPTURE_INTENT_PREVIEW + * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE + * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD + * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT + * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG + * @see #CONTROL_CAPTURE_INTENT_MANUAL + */ + public static final Key CONTROL_CAPTURE_INTENT = + new Key("android.control.captureIntent", int.class); + + /** *

Current state of AWB algorithm

*

Switching between or enabling AWB modes ({@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}) always * resets the AWB state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode}, @@ -1078,6 +1287,31 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.awbState", int.class); /** + *

A special color effect to apply.

+ *

When this mode is set, a color effect will be applied + * to images produced by the camera device. The interpretation + * and implementation of these color effects is left to the + * implementor of the camera device, and should not be + * depended on to be consistent (or present) across all + * devices.

+ *

A color effect will only be applied if + * {@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF.

+ * + * @see CaptureRequest#CONTROL_MODE + * @see #CONTROL_EFFECT_MODE_OFF + * @see #CONTROL_EFFECT_MODE_MONO + * @see #CONTROL_EFFECT_MODE_NEGATIVE + * @see #CONTROL_EFFECT_MODE_SOLARIZE + * @see #CONTROL_EFFECT_MODE_SEPIA + * @see #CONTROL_EFFECT_MODE_POSTERIZE + * @see #CONTROL_EFFECT_MODE_WHITEBOARD + * @see #CONTROL_EFFECT_MODE_BLACKBOARD + * @see #CONTROL_EFFECT_MODE_AQUA + */ + public static final Key CONTROL_EFFECT_MODE = + new Key("android.control.effectMode", int.class); + + /** *

Overall mode of 3A control * routines.

*

High-level 3A control. When set to OFF, all 3A control @@ -1106,6 +1340,57 @@ public final class CaptureResult extends CameraMetadata { new Key("android.control.mode", int.class); /** + *

A camera mode optimized for conditions typical in a particular + * capture setting.

+ *

This is the mode that that is active when + * {@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE. Aside from FACE_PRIORITY, + * these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}, + * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.

+ *

The interpretation and implementation of these scene modes is left + * to the implementor of the camera device. Their behavior will not be + * consistent across all devices, and any given device may only implement + * a subset of these modes.

+ * + * @see CaptureRequest#CONTROL_AE_MODE + * @see CaptureRequest#CONTROL_AF_MODE + * @see CaptureRequest#CONTROL_AWB_MODE + * @see CaptureRequest#CONTROL_MODE + * @see #CONTROL_SCENE_MODE_DISABLED + * @see #CONTROL_SCENE_MODE_FACE_PRIORITY + * @see #CONTROL_SCENE_MODE_ACTION + * @see #CONTROL_SCENE_MODE_PORTRAIT + * @see #CONTROL_SCENE_MODE_LANDSCAPE + * @see #CONTROL_SCENE_MODE_NIGHT + * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT + * @see #CONTROL_SCENE_MODE_THEATRE + * @see #CONTROL_SCENE_MODE_BEACH + * @see #CONTROL_SCENE_MODE_SNOW + * @see #CONTROL_SCENE_MODE_SUNSET + * @see #CONTROL_SCENE_MODE_STEADYPHOTO + * @see #CONTROL_SCENE_MODE_FIREWORKS + * @see #CONTROL_SCENE_MODE_SPORTS + * @see #CONTROL_SCENE_MODE_PARTY + * @see #CONTROL_SCENE_MODE_CANDLELIGHT + * @see #CONTROL_SCENE_MODE_BARCODE + */ + public static final Key CONTROL_SCENE_MODE = + new Key("android.control.sceneMode", int.class); + + /** + *

Whether video stabilization is + * active

+ *

If enabled, video stabilization can modify the + * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream + * stabilized

+ * + * @see CaptureRequest#SCALER_CROP_REGION + * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF + * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON + */ + public static final Key CONTROL_VIDEO_STABILIZATION_MODE = + new Key("android.control.videoStabilizationMode", int.class); + + /** *

Operation mode for edge * enhancement.

*

Edge/sharpness/detail enhancement. OFF means no @@ -1688,6 +1973,22 @@ public final class CaptureResult extends CameraMetadata { new Key("android.sensor.greenSplit", float.class); /** + *

A pixel [R, G_even, G_odd, B] that supplies the test pattern + * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.

+ *

Each color channel is treated as an unsigned 32-bit integer. + * The camera device then uses the most significant X bits + * that correspond to how many bits are in its Bayer raw sensor + * output.

+ *

For example, a sensor with RAW10 Bayer output would use the + * 10 most significant bits from each color channel.

+ *

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

+ * + * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE + */ + public static final Key SENSOR_TEST_PATTERN_DATA = + new Key("android.sensor.testPatternData", int[].class); + + /** *

When enabled, the sensor sends a test pattern instead of * doing a real exposure from the camera.

*

When a test pattern is enabled, all manual sensor controls specified @@ -1936,6 +2237,20 @@ public final class CaptureResult extends CameraMetadata { new Key("android.statistics.hotPixelMap", int[].class); /** + *

Whether the camera device will output the lens + * shading map in output result metadata.

+ *

When set to ON, + * {@link CaptureResult#STATISTICS_LENS_SHADING_MAP android.statistics.lensShadingMap} must be provided in + * the output result metadata.

+ * + * @see CaptureResult#STATISTICS_LENS_SHADING_MAP + * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF + * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON + */ + public static final Key STATISTICS_LENS_SHADING_MAP_MODE = + new Key("android.statistics.lensShadingMapMode", int.class); + + /** *

Tonemapping / contrast / gamma curve for the blue * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is * CONTRAST_CURVE.

-- 2.11.0