summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorJayant Chowdhary <jchowdhary@google.com>2021-11-05 17:01:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-11-05 17:01:26 +0000
commitbc58869990fe6b926ed7f8501046a7ce3903becf (patch)
tree5fe1b6aea1c0913494a2f3d5e8910e80dca5a728 /core/java/android
parent75e2021aafad6c5780ad3a2e9ecd74bcb1be9cbe (diff)
parent7f789bc5038e0a920f38663e3363e21ac3c5e04b (diff)
Merge "Add CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION to allow for better preview stabilization."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/camera2/CameraMetadata.java12
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java17
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java17
3 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 4b35294826db..639abe9d1abf 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -2657,6 +2657,18 @@ public abstract class CameraMetadata<TKey> {
*/
public static final int CONTROL_VIDEO_STABILIZATION_MODE_ON = 1;
+ /**
+ * <p>Preview stabilization, where the preview in addition to all other non-RAW streams are
+ * stabilized with the same quality of stabilization, is enabled. This mode aims to give
+ * clients a 'what you see is what you get' effect. In this mode, the FoV reduction will
+ * be a maximum of 20 % both horizontally and vertically
+ * (10% from left, right, top, bottom) for the given zoom ratio / crop region.
+ * The resultant FoV will also be the same across all processed streams
+ * (that have the same aspect ratio).</p>
+ * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
+ */
+ public static final int CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION = 2;
+
//
// Enumeration values for CaptureRequest#CONTROL_EXTENDED_SCENE_MODE
//
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index 08276ac23032..86ae3a311c9b 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -2081,10 +2081,20 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
* produce undesirable interaction, so it is recommended not to enable
* both at the same time.</p>
+ * <p>If video stabilization is set to "PREVIEW_STABILIZATION",
+ * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
+ * to turn on hardware based image stabilization in addition to software based stabilization
+ * if it deems that appropriate.
+ * This key may be a part of the available session keys, which camera clients may
+ * query via
+ * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.
+ * If this is the case, changing this key over the life-time of a capture session may
+ * cause delays / glitches.</p>
* <p><b>Possible values:</b></p>
* <ul>
* <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
* <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
+ * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION PREVIEW_STABILIZATION}</li>
* </ul>
*
* <p>This key is available on all devices.</p>
@@ -2094,6 +2104,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* @see CaptureRequest#SCALER_CROP_REGION
* @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
* @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
+ * @see #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION
*/
@PublicKey
@NonNull
@@ -2785,6 +2796,11 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>If a camera device supports both OIS and digital image stabilization
* ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
* interaction, so it is recommended not to enable both at the same time.</p>
+ * <p>If {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} is set to "PREVIEW_STABILIZATION",
+ * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
+ * to turn on hardware based image stabilization in addition to software based stabilization
+ * if it deems that appropriate. This key's value in the capture result will reflect which
+ * OIS mode was chosen.</p>
* <p>Not all devices will support OIS; see
* {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
* available controls.</p>
@@ -2804,6 +2820,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
* @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
+ * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
* @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
* @see #LENS_OPTICAL_STABILIZATION_MODE_ON
*/
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 296bfbe2ba98..a0fb179add1c 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -2335,10 +2335,20 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may
* produce undesirable interaction, so it is recommended not to enable
* both at the same time.</p>
+ * <p>If video stabilization is set to "PREVIEW_STABILIZATION",
+ * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
+ * to turn on hardware based image stabilization in addition to software based stabilization
+ * if it deems that appropriate.
+ * This key may be a part of the available session keys, which camera clients may
+ * query via
+ * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.
+ * If this is the case, changing this key over the life-time of a capture session may
+ * cause delays / glitches.</p>
* <p><b>Possible values:</b></p>
* <ul>
* <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li>
* <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li>
+ * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION PREVIEW_STABILIZATION}</li>
* </ul>
*
* <p>This key is available on all devices.</p>
@@ -2348,6 +2358,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* @see CaptureRequest#SCALER_CROP_REGION
* @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF
* @see #CONTROL_VIDEO_STABILIZATION_MODE_ON
+ * @see #CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION
*/
@PublicKey
@NonNull
@@ -3072,6 +3083,11 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p>If a camera device supports both OIS and digital image stabilization
* ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable
* interaction, so it is recommended not to enable both at the same time.</p>
+ * <p>If {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} is set to "PREVIEW_STABILIZATION",
+ * {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode} is overridden. The camera sub-system may choose
+ * to turn on hardware based image stabilization in addition to software based stabilization
+ * if it deems that appropriate. This key's value in the capture result will reflect which
+ * OIS mode was chosen.</p>
* <p>Not all devices will support OIS; see
* {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
* available controls.</p>
@@ -3091,6 +3107,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
* @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
+ * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
* @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
* @see #LENS_OPTICAL_STABILIZATION_MODE_ON
*/