Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Eino-Ville Talvala | 2f1a2e4 | 2013-07-25 17:12:05 -0700 | [diff] [blame] | 17 | package android.hardware.camera2; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 18 | |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
| 20 | import android.annotation.Nullable; |
Artur Satayev | 2695800 | 2019-12-10 17:47:52 +0000 | [diff] [blame] | 21 | import android.compat.annotation.UnsupportedAppUsage; |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 22 | import android.hardware.camera2.impl.CameraMetadataNative; |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 23 | import android.hardware.camera2.impl.PublicKey; |
| 24 | import android.hardware.camera2.impl.SyntheticKey; |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 25 | import android.hardware.camera2.params.OutputConfiguration; |
Ruben Brunk | 5776aaf | 2014-06-19 13:42:40 -0700 | [diff] [blame] | 26 | import android.hardware.camera2.utils.HashCodeHelpers; |
Yin-Chia Yeh | 4f15147 | 2018-02-21 12:38:19 -0800 | [diff] [blame] | 27 | import android.hardware.camera2.utils.SurfaceUtils; |
Shuzhen Wang | a8d3603 | 2018-10-15 12:01:53 -0700 | [diff] [blame] | 28 | import android.hardware.camera2.utils.TypeReference; |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 29 | import android.os.Parcel; |
| 30 | import android.os.Parcelable; |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 31 | import android.util.ArraySet; |
| 32 | import android.util.Log; |
| 33 | import android.util.SparseArray; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 34 | import android.view.Surface; |
| 35 | |
Ruben Brunk | feb50af | 2014-05-09 19:58:49 -0700 | [diff] [blame] | 36 | import java.util.Collection; |
| 37 | import java.util.Collections; |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 38 | import java.util.HashMap; |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 39 | import java.util.List; |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 40 | import java.util.Map; |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 41 | import java.util.Objects; |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 42 | import java.util.Set; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 43 | |
| 44 | /** |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 45 | * <p>An immutable package of settings and outputs needed to capture a single |
| 46 | * image from the camera device.</p> |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 47 | * |
| 48 | * <p>Contains the configuration for the capture hardware (sensor, lens, flash), |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 49 | * the processing pipeline, the control algorithms, and the output buffers. Also |
| 50 | * contains the list of target Surfaces to send image data to for this |
| 51 | * capture.</p> |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 52 | * |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 53 | * <p>CaptureRequests can be created by using a {@link Builder} instance, |
| 54 | * obtained by calling {@link CameraDevice#createCaptureRequest}</p> |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 55 | * |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 56 | * <p>CaptureRequests are given to {@link CameraCaptureSession#capture} or |
| 57 | * {@link CameraCaptureSession#setRepeatingRequest} to capture images from a camera.</p> |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 58 | * |
| 59 | * <p>Each request can specify a different subset of target Surfaces for the |
| 60 | * camera to send the captured data to. All the surfaces used in a request must |
| 61 | * be part of the surface list given to the last call to |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 62 | * {@link CameraDevice#createCaptureSession}, when the request is submitted to the |
| 63 | * session.</p> |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 64 | * |
| 65 | * <p>For example, a request meant for repeating preview might only include the |
| 66 | * Surface for the preview SurfaceView or SurfaceTexture, while a |
| 67 | * high-resolution still capture would also include a Surface from a ImageReader |
| 68 | * configured for high-resolution JPEG images.</p> |
| 69 | * |
Eino-Ville Talvala | 0aa2bde | 2015-05-19 17:25:54 -0700 | [diff] [blame] | 70 | * <p>A reprocess capture request allows a previously-captured image from the camera device to be |
| 71 | * sent back to the device for further processing. It can be created with |
Eino-Ville Talvala | bd7f34f | 2015-05-21 11:10:51 -0700 | [diff] [blame] | 72 | * {@link CameraDevice#createReprocessCaptureRequest}, and used with a reprocessable capture session |
Eino-Ville Talvala | 0aa2bde | 2015-05-19 17:25:54 -0700 | [diff] [blame] | 73 | * created with {@link CameraDevice#createReprocessableCaptureSession}.</p> |
| 74 | * |
| 75 | * @see CameraCaptureSession#capture |
| 76 | * @see CameraCaptureSession#setRepeatingRequest |
| 77 | * @see CameraCaptureSession#captureBurst |
| 78 | * @see CameraCaptureSession#setRepeatingBurst |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 79 | * @see CameraDevice#createCaptureRequest |
Eino-Ville Talvala | 0aa2bde | 2015-05-19 17:25:54 -0700 | [diff] [blame] | 80 | * @see CameraDevice#createReprocessCaptureRequest |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 81 | */ |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 82 | public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> |
| 83 | implements Parcelable { |
| 84 | |
| 85 | /** |
| 86 | * A {@code Key} is used to do capture request field lookups with |
| 87 | * {@link CaptureResult#get} or to set fields with |
| 88 | * {@link CaptureRequest.Builder#set(Key, Object)}. |
| 89 | * |
| 90 | * <p>For example, to set the crop rectangle for the next capture: |
| 91 | * <code><pre> |
| 92 | * Rect cropRectangle = new Rect(0, 0, 640, 480); |
| 93 | * captureRequestBuilder.set(SCALER_CROP_REGION, cropRectangle); |
| 94 | * </pre></code> |
| 95 | * </p> |
| 96 | * |
| 97 | * <p>To enumerate over all possible keys for {@link CaptureResult}, see |
| 98 | * {@link CameraCharacteristics#getAvailableCaptureResultKeys}.</p> |
| 99 | * |
| 100 | * @see CaptureResult#get |
| 101 | * @see CameraCharacteristics#getAvailableCaptureResultKeys |
| 102 | */ |
| 103 | public final static class Key<T> { |
| 104 | private final CameraMetadataNative.Key<T> mKey; |
| 105 | |
| 106 | /** |
| 107 | * Visible for testing and vendor extensions only. |
| 108 | * |
| 109 | * @hide |
| 110 | */ |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 111 | @UnsupportedAppUsage |
Emilian Peev | de62d84 | 2017-03-23 19:20:40 +0000 | [diff] [blame] | 112 | public Key(String name, Class<T> type, long vendorId) { |
| 113 | mKey = new CameraMetadataNative.Key<T>(name, type, vendorId); |
| 114 | } |
| 115 | |
| 116 | /** |
Eino-Ville Talvala | 1cf59fd | 2019-01-25 17:33:05 -0800 | [diff] [blame] | 117 | * Construct a new Key with a given name and type. |
Emilian Peev | de62d84 | 2017-03-23 19:20:40 +0000 | [diff] [blame] | 118 | * |
Eino-Ville Talvala | 1cf59fd | 2019-01-25 17:33:05 -0800 | [diff] [blame] | 119 | * <p>Normally, applications should use the existing Key definitions in |
| 120 | * {@link CaptureRequest}, and not need to construct their own Key objects. However, they |
| 121 | * may be useful for testing purposes and for defining custom capture request fields.</p> |
Emilian Peev | de62d84 | 2017-03-23 19:20:40 +0000 | [diff] [blame] | 122 | */ |
Eino-Ville Talvala | 79d4aac | 2019-03-06 14:26:10 -0800 | [diff] [blame] | 123 | public Key(@NonNull String name, @NonNull Class<T> type) { |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 124 | mKey = new CameraMetadataNative.Key<T>(name, type); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Visible for testing and vendor extensions only. |
| 129 | * |
| 130 | * @hide |
| 131 | */ |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 132 | @UnsupportedAppUsage |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 133 | public Key(String name, TypeReference<T> typeReference) { |
| 134 | mKey = new CameraMetadataNative.Key<T>(name, typeReference); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Return a camelCase, period separated name formatted like: |
| 139 | * {@code "root.section[.subsections].name"}. |
| 140 | * |
| 141 | * <p>Built-in keys exposed by the Android SDK are always prefixed with {@code "android."}; |
| 142 | * keys that are device/platform-specific are prefixed with {@code "com."}.</p> |
| 143 | * |
| 144 | * <p>For example, {@code CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP} would |
| 145 | * have a name of {@code "android.scaler.streamConfigurationMap"}; whereas a device |
| 146 | * specific key might look like {@code "com.google.nexus.data.private"}.</p> |
| 147 | * |
| 148 | * @return String representation of the key name |
| 149 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 150 | @NonNull |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 151 | public String getName() { |
| 152 | return mKey.getName(); |
| 153 | } |
| 154 | |
| 155 | /** |
Emilian Peev | de62d84 | 2017-03-23 19:20:40 +0000 | [diff] [blame] | 156 | * Return vendor tag id. |
| 157 | * |
| 158 | * @hide |
| 159 | */ |
| 160 | public long getVendorId() { |
| 161 | return mKey.getVendorId(); |
| 162 | } |
| 163 | |
| 164 | /** |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 165 | * {@inheritDoc} |
| 166 | */ |
| 167 | @Override |
| 168 | public final int hashCode() { |
| 169 | return mKey.hashCode(); |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * {@inheritDoc} |
| 174 | */ |
| 175 | @SuppressWarnings("unchecked") |
| 176 | @Override |
| 177 | public final boolean equals(Object o) { |
| 178 | return o instanceof Key && ((Key<T>)o).mKey.equals(mKey); |
| 179 | } |
| 180 | |
| 181 | /** |
Chien-Yu Chen | 12a8385 | 2015-07-07 12:17:22 -0700 | [diff] [blame] | 182 | * Return this {@link Key} as a string representation. |
| 183 | * |
| 184 | * <p>{@code "CaptureRequest.Key(%s)"}, where {@code %s} represents |
| 185 | * the name of this key as returned by {@link #getName}.</p> |
| 186 | * |
| 187 | * @return string representation of {@link Key} |
| 188 | */ |
| 189 | @NonNull |
| 190 | @Override |
| 191 | public String toString() { |
| 192 | return String.format("CaptureRequest.Key(%s)", mKey.getName()); |
| 193 | } |
| 194 | |
| 195 | /** |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 196 | * Visible for CameraMetadataNative implementation only; do not use. |
| 197 | * |
| 198 | * TODO: Make this private or remove it altogether. |
| 199 | * |
| 200 | * @hide |
| 201 | */ |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 202 | @UnsupportedAppUsage |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 203 | public CameraMetadataNative.Key<T> getNativeKey() { |
| 204 | return mKey; |
| 205 | } |
| 206 | |
| 207 | @SuppressWarnings({ "unchecked" }) |
| 208 | /*package*/ Key(CameraMetadataNative.Key<?> nativeKey) { |
| 209 | mKey = (CameraMetadataNative.Key<T>) nativeKey; |
| 210 | } |
| 211 | } |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 212 | |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 213 | private final String TAG = "CaptureRequest-JV"; |
| 214 | |
| 215 | private final ArraySet<Surface> mSurfaceSet = new ArraySet<Surface>(); |
| 216 | |
| 217 | // Speed up sending CaptureRequest across IPC: |
| 218 | // mSurfaceConverted should only be set to true during capture request |
| 219 | // submission by {@link #convertSurfaceToStreamId}. The method will convert |
| 220 | // surfaces to stream/surface indexes based on passed in stream configuration at that time. |
| 221 | // This will save significant unparcel time for remote camera device. |
| 222 | // Once the request is submitted, camera device will call {@link #recoverStreamIdToSurface} |
| 223 | // to reset the capture request back to its original state. |
| 224 | private final Object mSurfacesLock = new Object(); |
| 225 | private boolean mSurfaceConverted = false; |
| 226 | private int[] mStreamIdxArray; |
| 227 | private int[] mSurfaceIdxArray; |
| 228 | |
| 229 | private static final ArraySet<Surface> mEmptySurfaceSet = new ArraySet<Surface>(); |
| 230 | |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 231 | private String mLogicalCameraId; |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 232 | @UnsupportedAppUsage |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 233 | private CameraMetadataNative mLogicalCameraSettings; |
| 234 | private final HashMap<String, CameraMetadataNative> mPhysicalCameraSettings = |
| 235 | new HashMap<String, CameraMetadataNative>(); |
| 236 | |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 237 | private boolean mIsReprocess; |
Shuzhen Wang | b45449b | 2019-04-17 13:32:03 -0700 | [diff] [blame] | 238 | |
| 239 | // |
| 240 | // Enumeration values for types of CaptureRequest |
| 241 | // |
| 242 | |
| 243 | /** |
| 244 | * @hide |
| 245 | */ |
| 246 | public static final int REQUEST_TYPE_REGULAR = 0; |
| 247 | |
| 248 | /** |
| 249 | * @hide |
| 250 | */ |
| 251 | public static final int REQUEST_TYPE_REPROCESS = 1; |
| 252 | |
| 253 | /** |
| 254 | * @hide |
| 255 | */ |
| 256 | public static final int REQUEST_TYPE_ZSL_STILL = 2; |
| 257 | |
| 258 | /** |
| 259 | * Note: To add another request type, the FrameNumberTracker in CameraDeviceImpl must be |
| 260 | * adjusted accordingly. |
| 261 | * @hide |
| 262 | */ |
| 263 | public static final int REQUEST_TYPE_COUNT = 3; |
| 264 | |
| 265 | |
| 266 | private int mRequestType = -1; |
| 267 | |
| 268 | /** |
| 269 | * Get the type of the capture request |
| 270 | * |
| 271 | * Return one of REGULAR, ZSL_STILL, or REPROCESS. |
| 272 | * @hide |
| 273 | */ |
| 274 | public int getRequestType() { |
| 275 | if (mRequestType == -1) { |
| 276 | if (mIsReprocess) { |
| 277 | mRequestType = REQUEST_TYPE_REPROCESS; |
| 278 | } else { |
| 279 | Boolean enableZsl = mLogicalCameraSettings.get(CaptureRequest.CONTROL_ENABLE_ZSL); |
| 280 | boolean isZslStill = false; |
| 281 | if (enableZsl != null && enableZsl) { |
| 282 | int captureIntent = mLogicalCameraSettings.get( |
| 283 | CaptureRequest.CONTROL_CAPTURE_INTENT); |
| 284 | if (captureIntent == CameraMetadata.CONTROL_CAPTURE_INTENT_STILL_CAPTURE) { |
| 285 | isZslStill = true; |
| 286 | } |
| 287 | } |
| 288 | mRequestType = isZslStill ? REQUEST_TYPE_ZSL_STILL : REQUEST_TYPE_REGULAR; |
| 289 | } |
| 290 | } |
| 291 | return mRequestType; |
| 292 | } |
| 293 | |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 294 | // If this request is part of constrained high speed request list that was created by |
Eino-Ville Talvala | 639fffe | 2015-06-30 10:34:48 -0700 | [diff] [blame] | 295 | // {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList} |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 296 | private boolean mIsPartOfCHSRequestList = false; |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 297 | // Each reprocess request must be tied to a reprocessable session ID. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 298 | // Valid only for reprocess requests (mIsReprocess == true). |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 299 | private int mReprocessableSessionId; |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 300 | |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 301 | private Object mUserTag; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 302 | |
| 303 | /** |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 304 | * Construct empty request. |
| 305 | * |
| 306 | * Used by Binder to unparcel this object only. |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 307 | */ |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 308 | private CaptureRequest() { |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 309 | mIsReprocess = false; |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 310 | mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | /** |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 314 | * Clone from source capture request. |
| 315 | * |
| 316 | * Used by the Builder to create an immutable copy. |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 317 | */ |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 318 | @SuppressWarnings("unchecked") |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 319 | private CaptureRequest(CaptureRequest source) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 320 | mLogicalCameraId = new String(source.mLogicalCameraId); |
| 321 | for (Map.Entry<String, CameraMetadataNative> entry : |
| 322 | source.mPhysicalCameraSettings.entrySet()) { |
| 323 | mPhysicalCameraSettings.put(new String(entry.getKey()), |
| 324 | new CameraMetadataNative(entry.getValue())); |
| 325 | } |
| 326 | mLogicalCameraSettings = mPhysicalCameraSettings.get(mLogicalCameraId); |
| 327 | setNativeInstance(mLogicalCameraSettings); |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 328 | mSurfaceSet.addAll(source.mSurfaceSet); |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 329 | mIsReprocess = source.mIsReprocess; |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 330 | mIsPartOfCHSRequestList = source.mIsPartOfCHSRequestList; |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 331 | mReprocessableSessionId = source.mReprocessableSessionId; |
Eino-Ville Talvala | 7b01c5c | 2013-10-08 19:34:29 -0700 | [diff] [blame] | 332 | mUserTag = source.mUserTag; |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | /** |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 336 | * Take ownership of passed-in settings. |
| 337 | * |
| 338 | * Used by the Builder to create a mutable CaptureRequest. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 339 | * |
| 340 | * @param settings Settings for this capture request. |
| 341 | * @param isReprocess Indicates whether to create a reprocess capture request. {@code true} |
| 342 | * to create a reprocess capture request. {@code false} to create a regular |
| 343 | * capture request. |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 344 | * @param reprocessableSessionId The ID of the camera capture session this capture is created |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 345 | * for. This is used to validate if the application submits a |
| 346 | * reprocess capture request to the same session where |
| 347 | * the {@link TotalCaptureResult}, used to create the reprocess |
| 348 | * capture, came from. |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 349 | * @param logicalCameraId Camera Id of the actively open camera that instantiates the |
| 350 | * Builder. |
| 351 | * |
| 352 | * @param physicalCameraIdSet A set of physical camera ids that can be used to customize |
| 353 | * the request for a specific physical camera. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 354 | * |
| 355 | * @throws IllegalArgumentException If creating a reprocess capture request with an invalid |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 356 | * reprocessableSessionId, or multiple physical cameras. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 357 | * |
| 358 | * @see CameraDevice#createReprocessCaptureRequest |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 359 | */ |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 360 | private CaptureRequest(CameraMetadataNative settings, boolean isReprocess, |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 361 | int reprocessableSessionId, String logicalCameraId, Set<String> physicalCameraIdSet) { |
| 362 | if ((physicalCameraIdSet != null) && isReprocess) { |
| 363 | throw new IllegalArgumentException("Create a reprocess capture request with " + |
| 364 | "with more than one physical camera is not supported!"); |
| 365 | } |
| 366 | |
| 367 | mLogicalCameraId = logicalCameraId; |
| 368 | mLogicalCameraSettings = CameraMetadataNative.move(settings); |
| 369 | mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings); |
| 370 | if (physicalCameraIdSet != null) { |
| 371 | for (String physicalId : physicalCameraIdSet) { |
| 372 | mPhysicalCameraSettings.put(physicalId, new CameraMetadataNative( |
| 373 | mLogicalCameraSettings)); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | setNativeInstance(mLogicalCameraSettings); |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 378 | mIsReprocess = isReprocess; |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 379 | if (isReprocess) { |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 380 | if (reprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) { |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 381 | throw new IllegalArgumentException("Create a reprocess capture request with an " + |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 382 | "invalid session ID: " + reprocessableSessionId); |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 383 | } |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 384 | mReprocessableSessionId = reprocessableSessionId; |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 385 | } else { |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 386 | mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE; |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 387 | } |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 388 | } |
| 389 | |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 390 | /** |
| 391 | * Get a capture request field value. |
| 392 | * |
| 393 | * <p>The field definitions can be found in {@link CaptureRequest}.</p> |
| 394 | * |
| 395 | * <p>Querying the value for the same key more than once will return a value |
| 396 | * which is equal to the previous queried value.</p> |
| 397 | * |
| 398 | * @throws IllegalArgumentException if the key was not valid |
| 399 | * |
| 400 | * @param key The result field to read. |
| 401 | * @return The value of that key, or {@code null} if the field is not set. |
| 402 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 403 | @Nullable |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 404 | public <T> T get(Key<T> key) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 405 | return mLogicalCameraSettings.get(key); |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | /** |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 409 | * {@inheritDoc} |
| 410 | * @hide |
| 411 | */ |
| 412 | @SuppressWarnings("unchecked") |
| 413 | @Override |
| 414 | protected <T> T getProtected(Key<?> key) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 415 | return (T) mLogicalCameraSettings.get(key); |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | /** |
| 419 | * {@inheritDoc} |
| 420 | * @hide |
| 421 | */ |
| 422 | @SuppressWarnings("unchecked") |
| 423 | @Override |
| 424 | protected Class<Key<?>> getKeyClass() { |
| 425 | Object thisClass = Key.class; |
| 426 | return (Class<Key<?>>)thisClass; |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * {@inheritDoc} |
| 431 | */ |
| 432 | @Override |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 433 | @NonNull |
Igor Murashkin | d6d6515 | 2014-05-19 16:31:02 -0700 | [diff] [blame] | 434 | public List<Key<?>> getKeys() { |
| 435 | // Force the javadoc for this function to show up on the CaptureRequest page |
| 436 | return super.getKeys(); |
| 437 | } |
| 438 | |
| 439 | /** |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 440 | * Retrieve the tag for this request, if any. |
| 441 | * |
| 442 | * <p>This tag is not used for anything by the camera device, but can be |
| 443 | * used by an application to easily identify a CaptureRequest when it is |
| 444 | * returned by |
Eino-Ville Talvala | fd88743 | 2014-09-04 13:07:40 -0700 | [diff] [blame] | 445 | * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted} |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 446 | * </p> |
| 447 | * |
| 448 | * @return the last tag Object set on this request, or {@code null} if |
| 449 | * no tag has been set. |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 450 | * @see Builder#setTag |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 451 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 452 | @Nullable |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 453 | public Object getTag() { |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 454 | return mUserTag; |
Eino-Ville Talvala | 4068388 | 2013-08-08 16:56:28 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 457 | /** |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 458 | * Determine if this is a reprocess capture request. |
| 459 | * |
| 460 | * <p>A reprocess capture request produces output images from an input buffer from the |
| 461 | * {@link CameraCaptureSession}'s input {@link Surface}. A reprocess capture request can be |
| 462 | * created by {@link CameraDevice#createReprocessCaptureRequest}.</p> |
| 463 | * |
| 464 | * @return {@code true} if this is a reprocess capture request. {@code false} if this is not a |
| 465 | * reprocess capture request. |
| 466 | * |
| 467 | * @see CameraDevice#createReprocessCaptureRequest |
| 468 | */ |
| 469 | public boolean isReprocess() { |
| 470 | return mIsReprocess; |
| 471 | } |
| 472 | |
| 473 | /** |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 474 | * <p>Determine if this request is part of a constrained high speed request list that was |
Eino-Ville Talvala | 639fffe | 2015-06-30 10:34:48 -0700 | [diff] [blame] | 475 | * created by |
| 476 | * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}. |
| 477 | * A constrained high speed request list contains some constrained high speed capture requests |
| 478 | * with certain interleaved pattern that is suitable for high speed preview/video streaming. An |
| 479 | * active constrained high speed capture session only accepts constrained high speed request |
| 480 | * lists. This method can be used to do the sanity check when a constrained high speed capture |
| 481 | * session receives a request list via {@link CameraCaptureSession#setRepeatingBurst} or |
| 482 | * {@link CameraCaptureSession#captureBurst}. </p> |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 483 | * |
| 484 | * |
| 485 | * @return {@code true} if this request is part of a constrained high speed request list, |
| 486 | * {@code false} otherwise. |
| 487 | * |
| 488 | * @hide |
| 489 | */ |
| 490 | public boolean isPartOfCRequestList() { |
| 491 | return mIsPartOfCHSRequestList; |
| 492 | } |
| 493 | |
| 494 | /** |
| 495 | * Returns a copy of the underlying {@link CameraMetadataNative}. |
| 496 | * @hide |
| 497 | */ |
| 498 | public CameraMetadataNative getNativeCopy() { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 499 | return new CameraMetadataNative(mLogicalCameraSettings); |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | /** |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 503 | * Get the reprocessable session ID this reprocess capture request is associated with. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 504 | * |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 505 | * @return the reprocessable session ID this reprocess capture request is associated with |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 506 | * |
| 507 | * @throws IllegalStateException if this capture request is not a reprocess capture request. |
| 508 | * @hide |
| 509 | */ |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 510 | public int getReprocessableSessionId() { |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 511 | if (mIsReprocess == false || |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 512 | mReprocessableSessionId == CameraCaptureSession.SESSION_ID_NONE) { |
| 513 | throw new IllegalStateException("Getting the reprocessable session ID for a "+ |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 514 | "non-reprocess capture request is illegal."); |
| 515 | } |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 516 | return mReprocessableSessionId; |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | /** |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 520 | * Determine whether this CaptureRequest is equal to another CaptureRequest. |
| 521 | * |
| 522 | * <p>A request is considered equal to another is if it's set of key/values is equal, it's |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 523 | * list of output surfaces is equal, the user tag is equal, and the return values of |
| 524 | * isReprocess() are equal.</p> |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 525 | * |
| 526 | * @param other Another instance of CaptureRequest. |
| 527 | * |
| 528 | * @return True if the requests are the same, false otherwise. |
| 529 | */ |
| 530 | @Override |
| 531 | public boolean equals(Object other) { |
| 532 | return other instanceof CaptureRequest |
| 533 | && equals((CaptureRequest)other); |
| 534 | } |
| 535 | |
| 536 | private boolean equals(CaptureRequest other) { |
| 537 | return other != null |
| 538 | && Objects.equals(mUserTag, other.mUserTag) |
| 539 | && mSurfaceSet.equals(other.mSurfaceSet) |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 540 | && mPhysicalCameraSettings.equals(other.mPhysicalCameraSettings) |
| 541 | && mLogicalCameraId.equals(other.mLogicalCameraId) |
| 542 | && mLogicalCameraSettings.equals(other.mLogicalCameraSettings) |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 543 | && mIsReprocess == other.mIsReprocess |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 544 | && mReprocessableSessionId == other.mReprocessableSessionId; |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | @Override |
| 548 | public int hashCode() { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 549 | return HashCodeHelpers.hashCodeGeneric(mPhysicalCameraSettings, mSurfaceSet, mUserTag); |
Igor Murashkin | 6bbf9dc | 2013-09-05 12:22:00 -0700 | [diff] [blame] | 550 | } |
| 551 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 552 | public static final @android.annotation.NonNull Parcelable.Creator<CaptureRequest> CREATOR = |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 553 | new Parcelable.Creator<CaptureRequest>() { |
| 554 | @Override |
| 555 | public CaptureRequest createFromParcel(Parcel in) { |
| 556 | CaptureRequest request = new CaptureRequest(); |
| 557 | request.readFromParcel(in); |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 558 | |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 559 | return request; |
| 560 | } |
| 561 | |
| 562 | @Override |
| 563 | public CaptureRequest[] newArray(int size) { |
| 564 | return new CaptureRequest[size]; |
| 565 | } |
| 566 | }; |
| 567 | |
| 568 | /** |
| 569 | * Expand this object from a Parcel. |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 570 | * Hidden since this breaks the immutability of CaptureRequest, but is |
| 571 | * needed to receive CaptureRequests with aidl. |
| 572 | * |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 573 | * @param in The parcel from which the object should be read |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 574 | * @hide |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 575 | */ |
Igor Murashkin | 72f9f0a | 2014-05-14 15:46:10 -0700 | [diff] [blame] | 576 | private void readFromParcel(Parcel in) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 577 | int physicalCameraCount = in.readInt(); |
| 578 | if (physicalCameraCount <= 0) { |
| 579 | throw new RuntimeException("Physical camera count" + physicalCameraCount + |
| 580 | " should always be positive"); |
| 581 | } |
| 582 | |
| 583 | //Always start with the logical camera id |
| 584 | mLogicalCameraId = in.readString(); |
| 585 | mLogicalCameraSettings = new CameraMetadataNative(); |
| 586 | mLogicalCameraSettings.readFromParcel(in); |
| 587 | setNativeInstance(mLogicalCameraSettings); |
| 588 | mPhysicalCameraSettings.put(mLogicalCameraId, mLogicalCameraSettings); |
| 589 | for (int i = 1; i < physicalCameraCount; i++) { |
| 590 | String physicalId = in.readString(); |
| 591 | CameraMetadataNative physicalCameraSettings = new CameraMetadataNative(); |
| 592 | physicalCameraSettings.readFromParcel(in); |
| 593 | mPhysicalCameraSettings.put(physicalId, physicalCameraSettings); |
| 594 | } |
| 595 | |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 596 | mIsReprocess = (in.readInt() == 0) ? false : true; |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 597 | mReprocessableSessionId = CameraCaptureSession.SESSION_ID_NONE; |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 598 | |
| 599 | synchronized (mSurfacesLock) { |
| 600 | mSurfaceSet.clear(); |
| 601 | Parcelable[] parcelableArray = in.readParcelableArray(Surface.class.getClassLoader()); |
| 602 | if (parcelableArray != null) { |
| 603 | for (Parcelable p : parcelableArray) { |
| 604 | Surface s = (Surface) p; |
| 605 | mSurfaceSet.add(s); |
| 606 | } |
| 607 | } |
| 608 | // Intentionally disallow java side readFromParcel to receive streamIdx/surfaceIdx |
| 609 | // Since there is no good way to convert indexes back to Surface |
| 610 | int streamSurfaceSize = in.readInt(); |
| 611 | if (streamSurfaceSize != 0) { |
| 612 | throw new RuntimeException("Reading cached CaptureRequest is not supported"); |
| 613 | } |
| 614 | } |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | @Override |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 618 | public int describeContents() { |
| 619 | return 0; |
| 620 | } |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 621 | |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 622 | @Override |
| 623 | public void writeToParcel(Parcel dest, int flags) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 624 | int physicalCameraCount = mPhysicalCameraSettings.size(); |
| 625 | dest.writeInt(physicalCameraCount); |
| 626 | //Logical camera id and settings always come first. |
| 627 | dest.writeString(mLogicalCameraId); |
| 628 | mLogicalCameraSettings.writeToParcel(dest, flags); |
| 629 | for (Map.Entry<String, CameraMetadataNative> entry : mPhysicalCameraSettings.entrySet()) { |
| 630 | if (entry.getKey().equals(mLogicalCameraId)) { |
| 631 | continue; |
| 632 | } |
| 633 | dest.writeString(entry.getKey()); |
| 634 | entry.getValue().writeToParcel(dest, flags); |
| 635 | } |
| 636 | |
Chien-Yu Chen | 5398a67 | 2015-03-19 14:48:43 -0700 | [diff] [blame] | 637 | dest.writeInt(mIsReprocess ? 1 : 0); |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 638 | |
| 639 | synchronized (mSurfacesLock) { |
| 640 | final ArraySet<Surface> surfaces = mSurfaceConverted ? mEmptySurfaceSet : mSurfaceSet; |
| 641 | dest.writeParcelableArray(surfaces.toArray(new Surface[surfaces.size()]), flags); |
| 642 | if (mSurfaceConverted) { |
| 643 | dest.writeInt(mStreamIdxArray.length); |
| 644 | for (int i = 0; i < mStreamIdxArray.length; i++) { |
| 645 | dest.writeInt(mStreamIdxArray[i]); |
| 646 | dest.writeInt(mSurfaceIdxArray[i]); |
| 647 | } |
| 648 | } else { |
| 649 | dest.writeInt(0); |
| 650 | } |
| 651 | } |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 652 | } |
| 653 | |
| 654 | /** |
Ruben Brunk | feb50af | 2014-05-09 19:58:49 -0700 | [diff] [blame] | 655 | * @hide |
| 656 | */ |
| 657 | public boolean containsTarget(Surface surface) { |
| 658 | return mSurfaceSet.contains(surface); |
| 659 | } |
| 660 | |
| 661 | /** |
| 662 | * @hide |
| 663 | */ |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 664 | @UnsupportedAppUsage |
Ruben Brunk | feb50af | 2014-05-09 19:58:49 -0700 | [diff] [blame] | 665 | public Collection<Surface> getTargets() { |
| 666 | return Collections.unmodifiableCollection(mSurfaceSet); |
| 667 | } |
| 668 | |
| 669 | /** |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 670 | * Retrieves the logical camera id. |
| 671 | * @hide |
| 672 | */ |
| 673 | public String getLogicalCameraId() { |
| 674 | return mLogicalCameraId; |
| 675 | } |
| 676 | |
| 677 | /** |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 678 | * @hide |
| 679 | */ |
| 680 | public void convertSurfaceToStreamId( |
| 681 | final SparseArray<OutputConfiguration> configuredOutputs) { |
| 682 | synchronized (mSurfacesLock) { |
| 683 | if (mSurfaceConverted) { |
| 684 | Log.v(TAG, "Cannot convert already converted surfaces!"); |
| 685 | return; |
| 686 | } |
| 687 | |
| 688 | mStreamIdxArray = new int[mSurfaceSet.size()]; |
| 689 | mSurfaceIdxArray = new int[mSurfaceSet.size()]; |
| 690 | int i = 0; |
| 691 | for (Surface s : mSurfaceSet) { |
| 692 | boolean streamFound = false; |
| 693 | for (int j = 0; j < configuredOutputs.size(); ++j) { |
| 694 | int streamId = configuredOutputs.keyAt(j); |
| 695 | OutputConfiguration outConfig = configuredOutputs.valueAt(j); |
| 696 | int surfaceId = 0; |
| 697 | for (Surface outSurface : outConfig.getSurfaces()) { |
| 698 | if (s == outSurface) { |
| 699 | streamFound = true; |
| 700 | mStreamIdxArray[i] = streamId; |
| 701 | mSurfaceIdxArray[i] = surfaceId; |
| 702 | i++; |
| 703 | break; |
| 704 | } |
| 705 | surfaceId++; |
| 706 | } |
| 707 | if (streamFound) { |
| 708 | break; |
| 709 | } |
| 710 | } |
Yin-Chia Yeh | 4f15147 | 2018-02-21 12:38:19 -0800 | [diff] [blame] | 711 | |
| 712 | if (!streamFound) { |
| 713 | // Check if we can match s by native object ID |
| 714 | long reqSurfaceId = SurfaceUtils.getSurfaceId(s); |
| 715 | for (int j = 0; j < configuredOutputs.size(); ++j) { |
| 716 | int streamId = configuredOutputs.keyAt(j); |
| 717 | OutputConfiguration outConfig = configuredOutputs.valueAt(j); |
| 718 | int surfaceId = 0; |
| 719 | for (Surface outSurface : outConfig.getSurfaces()) { |
| 720 | if (reqSurfaceId == SurfaceUtils.getSurfaceId(outSurface)) { |
| 721 | streamFound = true; |
| 722 | mStreamIdxArray[i] = streamId; |
| 723 | mSurfaceIdxArray[i] = surfaceId; |
| 724 | i++; |
| 725 | break; |
| 726 | } |
| 727 | surfaceId++; |
| 728 | } |
| 729 | if (streamFound) { |
| 730 | break; |
| 731 | } |
| 732 | } |
| 733 | } |
| 734 | |
Yin-Chia Yeh | c60af90 | 2017-11-10 20:02:29 -0800 | [diff] [blame] | 735 | if (!streamFound) { |
| 736 | mStreamIdxArray = null; |
| 737 | mSurfaceIdxArray = null; |
| 738 | throw new IllegalArgumentException( |
| 739 | "CaptureRequest contains unconfigured Input/Output Surface!"); |
| 740 | } |
| 741 | } |
| 742 | mSurfaceConverted = true; |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | /** |
| 747 | * @hide |
| 748 | */ |
| 749 | public void recoverStreamIdToSurface() { |
| 750 | synchronized (mSurfacesLock) { |
| 751 | if (!mSurfaceConverted) { |
| 752 | Log.v(TAG, "Cannot convert already converted surfaces!"); |
| 753 | return; |
| 754 | } |
| 755 | |
| 756 | mStreamIdxArray = null; |
| 757 | mSurfaceIdxArray = null; |
| 758 | mSurfaceConverted = false; |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | /** |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 763 | * A builder for capture requests. |
| 764 | * |
| 765 | * <p>To obtain a builder instance, use the |
| 766 | * {@link CameraDevice#createCaptureRequest} method, which initializes the |
| 767 | * request fields to one of the templates defined in {@link CameraDevice}. |
| 768 | * |
| 769 | * @see CameraDevice#createCaptureRequest |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 770 | * @see CameraDevice#TEMPLATE_PREVIEW |
| 771 | * @see CameraDevice#TEMPLATE_RECORD |
| 772 | * @see CameraDevice#TEMPLATE_STILL_CAPTURE |
| 773 | * @see CameraDevice#TEMPLATE_VIDEO_SNAPSHOT |
| 774 | * @see CameraDevice#TEMPLATE_MANUAL |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 775 | */ |
| 776 | public final static class Builder { |
| 777 | |
Igor Murashkin | 7a36a0f | 2013-09-10 18:13:09 -0700 | [diff] [blame] | 778 | private final CaptureRequest mRequest; |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 779 | |
| 780 | /** |
| 781 | * Initialize the builder using the template; the request takes |
| 782 | * ownership of the template. |
| 783 | * |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 784 | * @param template Template settings for this capture request. |
| 785 | * @param reprocess Indicates whether to create a reprocess capture request. {@code true} |
| 786 | * to create a reprocess capture request. {@code false} to create a regular |
| 787 | * capture request. |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 788 | * @param reprocessableSessionId The ID of the camera capture session this capture is |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 789 | * created for. This is used to validate if the application |
| 790 | * submits a reprocess capture request to the same session |
| 791 | * where the {@link TotalCaptureResult}, used to create the |
| 792 | * reprocess capture, came from. |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 793 | * @param logicalCameraId Camera Id of the actively open camera that instantiates the |
| 794 | * Builder. |
| 795 | * @param physicalCameraIdSet A set of physical camera ids that can be used to customize |
| 796 | * the request for a specific physical camera. |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 797 | * |
| 798 | * @throws IllegalArgumentException If creating a reprocess capture request with an invalid |
Chien-Yu Chen | 8062d31 | 2015-05-12 14:24:10 -0700 | [diff] [blame] | 799 | * reprocessableSessionId. |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 800 | * @hide |
| 801 | */ |
Chien-Yu Chen | 7a316f6b | 2015-04-13 14:31:45 -0700 | [diff] [blame] | 802 | public Builder(CameraMetadataNative template, boolean reprocess, |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 803 | int reprocessableSessionId, String logicalCameraId, |
| 804 | Set<String> physicalCameraIdSet) { |
| 805 | mRequest = new CaptureRequest(template, reprocess, reprocessableSessionId, |
| 806 | logicalCameraId, physicalCameraIdSet); |
Igor Murashkin | 7072550 | 2013-06-25 20:27:06 +0000 | [diff] [blame] | 807 | } |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 808 | |
| 809 | /** |
| 810 | * <p>Add a surface to the list of targets for this request</p> |
| 811 | * |
| 812 | * <p>The Surface added must be one of the surfaces included in the most |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 813 | * recent call to {@link CameraDevice#createCaptureSession}, when the |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 814 | * request is given to the camera device.</p> |
| 815 | * |
| 816 | * <p>Adding a target more than once has no effect.</p> |
| 817 | * |
| 818 | * @param outputTarget Surface to use as an output target for this request |
| 819 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 820 | public void addTarget(@NonNull Surface outputTarget) { |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 821 | mRequest.mSurfaceSet.add(outputTarget); |
| 822 | } |
| 823 | |
| 824 | /** |
| 825 | * <p>Remove a surface from the list of targets for this request.</p> |
| 826 | * |
| 827 | * <p>Removing a target that is not currently added has no effect.</p> |
| 828 | * |
| 829 | * @param outputTarget Surface to use as an output target for this request |
| 830 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 831 | public void removeTarget(@NonNull Surface outputTarget) { |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 832 | mRequest.mSurfaceSet.remove(outputTarget); |
| 833 | } |
| 834 | |
| 835 | /** |
| 836 | * Set a capture request field to a value. The field definitions can be |
| 837 | * found in {@link CaptureRequest}. |
| 838 | * |
Eino-Ville Talvala | d840727 | 2015-11-08 18:27:20 -0800 | [diff] [blame] | 839 | * <p>Setting a field to {@code null} will remove that field from the capture request. |
| 840 | * Unless the field is optional, removing it will likely produce an error from the camera |
| 841 | * device when the request is submitted.</p> |
| 842 | * |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 843 | * @param key The metadata field to write. |
| 844 | * @param value The value to set the field to, which must be of a matching |
| 845 | * type to the key. |
| 846 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 847 | public <T> void set(@NonNull Key<T> key, T value) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 848 | mRequest.mLogicalCameraSettings.set(key, value); |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 849 | } |
| 850 | |
| 851 | /** |
| 852 | * Get a capture request field value. The field definitions can be |
| 853 | * found in {@link CaptureRequest}. |
| 854 | * |
| 855 | * @throws IllegalArgumentException if the key was not valid |
| 856 | * |
| 857 | * @param key The metadata field to read. |
| 858 | * @return The value of that key, or {@code null} if the field is not set. |
| 859 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 860 | @Nullable |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 861 | public <T> T get(Key<T> key) { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 862 | return mRequest.mLogicalCameraSettings.get(key); |
| 863 | } |
| 864 | |
| 865 | /** |
| 866 | * Set a capture request field to a value. The field definitions can be |
| 867 | * found in {@link CaptureRequest}. |
| 868 | * |
| 869 | * <p>Setting a field to {@code null} will remove that field from the capture request. |
| 870 | * Unless the field is optional, removing it will likely produce an error from the camera |
| 871 | * device when the request is submitted.</p> |
| 872 | * |
| 873 | *<p>This method can be called for logical camera devices, which are devices that have |
| 874 | * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to |
Shuzhen Wang | bde1397 | 2018-03-19 10:30:45 -0700 | [diff] [blame] | 875 | * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty set of |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 876 | * physical devices that are backing the logical camera. The camera Id included in the |
| 877 | * 'physicalCameraId' argument selects an individual physical device that will receive |
| 878 | * the customized capture request field.</p> |
| 879 | * |
| 880 | * @throws IllegalArgumentException if the physical camera id is not valid |
| 881 | * |
| 882 | * @param key The metadata field to write. |
Emilian Peev | ca57d30 | 2019-09-13 15:58:43 -0700 | [diff] [blame] | 883 | * @param value The value to set the field to, which must be of a matching type to the key. |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 884 | * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained |
| 885 | * via calls to {@link CameraCharacteristics#getPhysicalCameraIds}. |
| 886 | * @return The builder object. |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 887 | */ |
| 888 | public <T> Builder setPhysicalCameraKey(@NonNull Key<T> key, T value, |
| 889 | @NonNull String physicalCameraId) { |
| 890 | if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) { |
| 891 | throw new IllegalArgumentException("Physical camera id: " + physicalCameraId + |
| 892 | " is not valid!"); |
| 893 | } |
| 894 | |
| 895 | mRequest.mPhysicalCameraSettings.get(physicalCameraId).set(key, value); |
| 896 | |
| 897 | return this; |
| 898 | } |
| 899 | |
| 900 | /** |
| 901 | * Get a capture request field value for a specific physical camera Id. The field |
| 902 | * definitions can be found in {@link CaptureRequest}. |
| 903 | * |
| 904 | *<p>This method can be called for logical camera devices, which are devices that have |
| 905 | * REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA capability and calls to |
| 906 | * {@link CameraCharacteristics#getPhysicalCameraIds} return a non-empty list of |
| 907 | * physical devices that are backing the logical camera. The camera Id included in the |
| 908 | * 'physicalCameraId' argument selects an individual physical device and returns |
| 909 | * its specific capture request field.</p> |
| 910 | * |
| 911 | * @throws IllegalArgumentException if the key or physical camera id were not valid |
| 912 | * |
| 913 | * @param key The metadata field to read. |
| 914 | * @param physicalCameraId A valid physical camera Id. The valid camera Ids can be obtained |
| 915 | * via calls to {@link CameraCharacteristics#getPhysicalCameraIds}. |
| 916 | * @return The value of that key, or {@code null} if the field is not set. |
| 917 | */ |
| 918 | @Nullable |
| 919 | public <T> T getPhysicalCameraKey(Key<T> key,@NonNull String physicalCameraId) { |
| 920 | if (!mRequest.mPhysicalCameraSettings.containsKey(physicalCameraId)) { |
| 921 | throw new IllegalArgumentException("Physical camera id: " + physicalCameraId + |
| 922 | " is not valid!"); |
| 923 | } |
| 924 | |
| 925 | return mRequest.mPhysicalCameraSettings.get(physicalCameraId).get(key); |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 926 | } |
| 927 | |
| 928 | /** |
| 929 | * Set a tag for this request. |
| 930 | * |
| 931 | * <p>This tag is not used for anything by the camera device, but can be |
| 932 | * used by an application to easily identify a CaptureRequest when it is |
| 933 | * returned by |
Eino-Ville Talvala | fd88743 | 2014-09-04 13:07:40 -0700 | [diff] [blame] | 934 | * {@link CameraCaptureSession.CaptureCallback#onCaptureCompleted CaptureCallback.onCaptureCompleted} |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 935 | * |
| 936 | * @param tag an arbitrary Object to store with this request |
| 937 | * @see CaptureRequest#getTag |
| 938 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 939 | public void setTag(@Nullable Object tag) { |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 940 | mRequest.mUserTag = tag; |
| 941 | } |
| 942 | |
| 943 | /** |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 944 | * <p>Mark this request as part of a constrained high speed request list created by |
Eino-Ville Talvala | 639fffe | 2015-06-30 10:34:48 -0700 | [diff] [blame] | 945 | * {@link android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession#createHighSpeedRequestList}. |
| 946 | * A constrained high speed request list contains some constrained high speed capture |
| 947 | * requests with certain interleaved pattern that is suitable for high speed preview/video |
| 948 | * streaming.</p> |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 949 | * |
| 950 | * @hide |
| 951 | */ |
Mathew Inwood | bcbe440 | 2018-08-08 15:42:59 +0100 | [diff] [blame] | 952 | @UnsupportedAppUsage |
Zhijun He | a767772 | 2015-06-01 16:36:06 -0700 | [diff] [blame] | 953 | public void setPartOfCHSRequestList(boolean partOfCHSList) { |
| 954 | mRequest.mIsPartOfCHSRequestList = partOfCHSList; |
| 955 | } |
| 956 | |
| 957 | /** |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 958 | * Build a request using the current target Surfaces and settings. |
Sol Boucher | edeab40 | 2014-07-09 18:36:28 -0700 | [diff] [blame] | 959 | * <p>Note that, although it is possible to create a {@code CaptureRequest} with no target |
| 960 | * {@link Surface}s, passing such a request into {@link CameraCaptureSession#capture}, |
| 961 | * {@link CameraCaptureSession#captureBurst}, |
| 962 | * {@link CameraCaptureSession#setRepeatingBurst}, or |
| 963 | * {@link CameraCaptureSession#setRepeatingRequest} will cause that method to throw an |
| 964 | * {@link IllegalArgumentException}.</p> |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 965 | * |
| 966 | * @return A new capture request instance, ready for submission to the |
| 967 | * camera device. |
| 968 | */ |
Eino-Ville Talvala | 8b90557 | 2015-05-14 15:43:01 -0700 | [diff] [blame] | 969 | @NonNull |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 970 | public CaptureRequest build() { |
| 971 | return new CaptureRequest(mRequest); |
| 972 | } |
| 973 | |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 974 | /** |
| 975 | * @hide |
| 976 | */ |
| 977 | public boolean isEmpty() { |
Emilian Peev | 2100ae7 | 2018-01-12 16:56:25 +0000 | [diff] [blame] | 978 | return mRequest.mLogicalCameraSettings.isEmpty(); |
Eino-Ville Talvala | 70c2207 | 2013-08-27 12:09:04 -0700 | [diff] [blame] | 979 | } |
| 980 | |
Eino-Ville Talvala | b267554 | 2012-12-12 13:29:45 -0800 | [diff] [blame] | 981 | } |
| 982 | |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 983 | /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ |
| 984 | * The key entries below this point are generated from metadata |
| 985 | * definitions in /system/media/camera/docs. Do not modify by hand or |
| 986 | * modify the comment blocks at the start or end. |
| 987 | *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ |
| 988 | |
| 989 | /** |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 990 | * <p>The mode control selects how the image data is converted from the |
| 991 | * sensor's native color into linear sRGB color.</p> |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 992 | * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 993 | * control is overridden by the AWB routine. When AWB is disabled, the |
| 994 | * application controls how the color mapping is performed.</p> |
| 995 | * <p>We define the expected processing pipeline below. For consistency |
| 996 | * across devices, this is always the case with TRANSFORM_MATRIX.</p> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 997 | * <p>When either FAST or HIGH_QUALITY is used, the camera device may |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 998 | * do additional processing but {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and |
| 999 | * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} will still be provided by the |
| 1000 | * camera device (in the results) and be roughly correct.</p> |
| 1001 | * <p>Switching to TRANSFORM_MATRIX and using the data provided from |
| 1002 | * FAST or HIGH_QUALITY will yield a picture with the same white point |
| 1003 | * as what was produced by the camera device in the earlier frame.</p> |
| 1004 | * <p>The expected processing pipeline is as follows:</p> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 1005 | * <p><img alt="White balance processing pipeline" src="/reference/images/camera2/metadata/android.colorCorrection.mode/processing_pipeline.png" /></p> |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 1006 | * <p>The white balance is encoded by two values, a 4-channel white-balance |
| 1007 | * gain vector (applied in the Bayer domain), and a 3x3 color transform |
| 1008 | * matrix (applied after demosaic).</p> |
| 1009 | * <p>The 4-channel white-balance gains are defined as:</p> |
| 1010 | * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} = [ R G_even G_odd B ] |
| 1011 | * </code></pre> |
| 1012 | * <p>where <code>G_even</code> is the gain for green pixels on even rows of the |
| 1013 | * output, and <code>G_odd</code> is the gain for green pixels on the odd rows. |
| 1014 | * These may be identical for a given camera device implementation; if |
| 1015 | * the camera device does not support a separate gain for even/odd green |
| 1016 | * channels, it will use the <code>G_even</code> value, and write <code>G_odd</code> equal to |
| 1017 | * <code>G_even</code> in the output result metadata.</p> |
| 1018 | * <p>The matrices for color transforms are defined as a 9-entry vector:</p> |
| 1019 | * <pre><code>{@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform} = [ I0 I1 I2 I3 I4 I5 I6 I7 I8 ] |
| 1020 | * </code></pre> |
| 1021 | * <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>, |
| 1022 | * to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p> |
| 1023 | * <p>with colors as follows:</p> |
| 1024 | * <pre><code>r' = I0r + I1g + I2b |
| 1025 | * g' = I3r + I4g + I5b |
| 1026 | * b' = I6r + I7g + I8b |
| 1027 | * </code></pre> |
| 1028 | * <p>Both the input and output value ranges must match. Overflow/underflow |
| 1029 | * values are clipped to fit within the range.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1030 | * <p><b>Possible values:</b> |
| 1031 | * <ul> |
| 1032 | * <li>{@link #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX TRANSFORM_MATRIX}</li> |
| 1033 | * <li>{@link #COLOR_CORRECTION_MODE_FAST FAST}</li> |
| 1034 | * <li>{@link #COLOR_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
| 1035 | * </ul></p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1036 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1037 | * <p><b>Full capability</b> - |
| 1038 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 1039 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1040 | * |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 1041 | * @see CaptureRequest#COLOR_CORRECTION_GAINS |
| 1042 | * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1043 | * @see CaptureRequest#CONTROL_AWB_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1044 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1045 | * @see #COLOR_CORRECTION_MODE_TRANSFORM_MATRIX |
| 1046 | * @see #COLOR_CORRECTION_MODE_FAST |
| 1047 | * @see #COLOR_CORRECTION_MODE_HIGH_QUALITY |
| 1048 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1049 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1050 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1051 | public static final Key<Integer> COLOR_CORRECTION_MODE = |
| 1052 | new Key<Integer>("android.colorCorrection.mode", int.class); |
| 1053 | |
| 1054 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 1055 | * <p>A color transform matrix to use to transform |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1056 | * from sensor RGB color space to output linear sRGB color space.</p> |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1057 | * <p>This matrix is either set by the camera device when the request |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1058 | * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1059 | * directly by the application in the request when the |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1060 | * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is TRANSFORM_MATRIX.</p> |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1061 | * <p>In the latter case, the camera device may round the matrix to account |
| 1062 | * for precision issues; the final rounded matrix should be reported back |
| 1063 | * in this matrix result metadata. The transform should keep the magnitude |
| 1064 | * of the output color values within <code>[0, 1.0]</code> (assuming input color |
| 1065 | * values is within the normalized range <code>[0, 1.0]</code>), or clipping may occur.</p> |
Yin-Chia Yeh | d9fc67c | 2015-01-30 10:47:22 -0800 | [diff] [blame] | 1066 | * <p>The valid range of each matrix element varies on different devices, but |
| 1067 | * values within [-1.5, 3.0] are guaranteed not to be clipped.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1068 | * <p><b>Units</b>: Unitless scale factors</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1069 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1070 | * <p><b>Full capability</b> - |
| 1071 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 1072 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1073 | * |
| 1074 | * @see CaptureRequest#COLOR_CORRECTION_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1075 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1076 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1077 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1078 | @NonNull |
Eino-Ville Talvala | 2bb91a7 | 2014-05-27 18:16:53 -0700 | [diff] [blame] | 1079 | public static final Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM = |
| 1080 | new Key<android.hardware.camera2.params.ColorSpaceTransform>("android.colorCorrection.transform", android.hardware.camera2.params.ColorSpaceTransform.class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1081 | |
| 1082 | /** |
Igor Murashkin | 7d2a5c5 | 2014-01-17 15:07:52 -0800 | [diff] [blame] | 1083 | * <p>Gains applying to Bayer raw color channels for |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1084 | * white-balance.</p> |
Eino-Ville Talvala | 2bb91a7 | 2014-05-27 18:16:53 -0700 | [diff] [blame] | 1085 | * <p>These per-channel gains are either set by the camera device |
| 1086 | * when the request {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not |
| 1087 | * TRANSFORM_MATRIX, or directly by the application in the |
| 1088 | * request when the {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is |
| 1089 | * TRANSFORM_MATRIX.</p> |
| 1090 | * <p>The gains in the result metadata are the gains actually |
| 1091 | * applied by the camera device to the current frame.</p> |
Yin-Chia Yeh | d9fc67c | 2015-01-30 10:47:22 -0800 | [diff] [blame] | 1092 | * <p>The valid range of gains varies on different devices, but gains |
| 1093 | * between [1.0, 3.0] are guaranteed not to be clipped. Even if a given |
| 1094 | * device allows gains below 1.0, this is usually not recommended because |
| 1095 | * this can create color artifacts.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1096 | * <p><b>Units</b>: Unitless gain factors</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1097 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1098 | * <p><b>Full capability</b> - |
| 1099 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 1100 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1101 | * |
| 1102 | * @see CaptureRequest#COLOR_CORRECTION_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1103 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1104 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1105 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1106 | @NonNull |
Eino-Ville Talvala | 2bb91a7 | 2014-05-27 18:16:53 -0700 | [diff] [blame] | 1107 | public static final Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS = |
| 1108 | new Key<android.hardware.camera2.params.RggbChannelVector>("android.colorCorrection.gains", android.hardware.camera2.params.RggbChannelVector.class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1109 | |
| 1110 | /** |
Zhijun He | a05e59d | 2014-07-08 18:27:47 -0700 | [diff] [blame] | 1111 | * <p>Mode of operation for the chromatic aberration correction algorithm.</p> |
Zhijun He | a05e59d | 2014-07-08 18:27:47 -0700 | [diff] [blame] | 1112 | * <p>Chromatic (color) aberration is caused by the fact that different wavelengths of light |
| 1113 | * can not focus on the same point after exiting from the lens. This metadata defines |
| 1114 | * the high level control of chromatic aberration correction algorithm, which aims to |
| 1115 | * minimize the chromatic artifacts that may occur along the object boundaries in an |
| 1116 | * image.</p> |
| 1117 | * <p>FAST/HIGH_QUALITY both mean that camera device determined aberration |
| 1118 | * correction will be applied. HIGH_QUALITY mode indicates that the camera device will |
| 1119 | * use the highest-quality aberration correction algorithms, even if it slows down |
| 1120 | * capture rate. FAST means the camera device will not slow down capture rate when |
| 1121 | * applying aberration correction.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1122 | * <p>LEGACY devices will always be in FAST mode.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1123 | * <p><b>Possible values:</b> |
| 1124 | * <ul> |
| 1125 | * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_OFF OFF}</li> |
| 1126 | * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_FAST FAST}</li> |
| 1127 | * <li>{@link #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
| 1128 | * </ul></p> |
| 1129 | * <p><b>Available values for this device:</b><br> |
| 1130 | * {@link CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES android.colorCorrection.availableAberrationModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1131 | * <p>This key is available on all devices.</p> |
Zhijun He | a05e59d | 2014-07-08 18:27:47 -0700 | [diff] [blame] | 1132 | * |
Zhijun He | 9e4e439 | 2014-08-18 11:12:32 -0700 | [diff] [blame] | 1133 | * @see CameraCharacteristics#COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES |
| 1134 | * @see #COLOR_CORRECTION_ABERRATION_MODE_OFF |
| 1135 | * @see #COLOR_CORRECTION_ABERRATION_MODE_FAST |
| 1136 | * @see #COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY |
Zhijun He | a05e59d | 2014-07-08 18:27:47 -0700 | [diff] [blame] | 1137 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1138 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1139 | @NonNull |
Zhijun He | 9e4e439 | 2014-08-18 11:12:32 -0700 | [diff] [blame] | 1140 | public static final Key<Integer> COLOR_CORRECTION_ABERRATION_MODE = |
| 1141 | new Key<Integer>("android.colorCorrection.aberrationMode", int.class); |
Zhijun He | a05e59d | 2014-07-08 18:27:47 -0700 | [diff] [blame] | 1142 | |
| 1143 | /** |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1144 | * <p>The desired setting for the camera device's auto-exposure |
| 1145 | * algorithm's antibanding compensation.</p> |
| 1146 | * <p>Some kinds of lighting fixtures, such as some fluorescent |
| 1147 | * lights, flicker at the rate of the power supply frequency |
| 1148 | * (60Hz or 50Hz, depending on country). While this is |
| 1149 | * typically not noticeable to a person, it can be visible to |
| 1150 | * a camera device. If a camera sets its exposure time to the |
| 1151 | * wrong value, the flicker may become visible in the |
| 1152 | * viewfinder as flicker or in a final captured image, as a |
| 1153 | * set of variable-brightness bands across the image.</p> |
| 1154 | * <p>Therefore, the auto-exposure routines of camera devices |
| 1155 | * include antibanding routines that ensure that the chosen |
| 1156 | * exposure value will not cause such banding. The choice of |
| 1157 | * exposure time depends on the rate of flicker, which the |
| 1158 | * camera device can detect automatically, or the expected |
| 1159 | * rate can be selected by the application using this |
| 1160 | * control.</p> |
| 1161 | * <p>A given camera device may not support all of the possible |
| 1162 | * options for the antibanding mode. The |
| 1163 | * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes} key contains |
| 1164 | * the available modes for a given camera device.</p> |
Yin-Chia Yeh | 7b2cae6 | 2014-11-25 11:54:18 -0800 | [diff] [blame] | 1165 | * <p>AUTO mode is the default if it is available on given |
| 1166 | * camera device. When AUTO mode is not available, the |
| 1167 | * default will be either 50HZ or 60HZ, and both 50HZ |
| 1168 | * and 60HZ will be available.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1169 | * <p>If manual exposure control is enabled (by setting |
| 1170 | * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} to OFF), |
| 1171 | * then this setting has no effect, and the application must |
| 1172 | * ensure it selects exposure times that do not cause banding |
| 1173 | * issues. The {@link CaptureResult#STATISTICS_SCENE_FLICKER android.statistics.sceneFlicker} key can assist |
| 1174 | * the application in this.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1175 | * <p><b>Possible values:</b> |
| 1176 | * <ul> |
| 1177 | * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_OFF OFF}</li> |
| 1178 | * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_50HZ 50HZ}</li> |
| 1179 | * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_60HZ 60HZ}</li> |
| 1180 | * <li>{@link #CONTROL_AE_ANTIBANDING_MODE_AUTO AUTO}</li> |
| 1181 | * </ul></p> |
| 1182 | * <p><b>Available values for this device:</b><br></p> |
| 1183 | * <p>{@link CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES android.control.aeAvailableAntibandingModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1184 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1185 | * |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 1186 | * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_ANTIBANDING_MODES |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 1187 | * @see CaptureRequest#CONTROL_AE_MODE |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1188 | * @see CaptureRequest#CONTROL_MODE |
| 1189 | * @see CaptureResult#STATISTICS_SCENE_FLICKER |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1190 | * @see #CONTROL_AE_ANTIBANDING_MODE_OFF |
| 1191 | * @see #CONTROL_AE_ANTIBANDING_MODE_50HZ |
| 1192 | * @see #CONTROL_AE_ANTIBANDING_MODE_60HZ |
| 1193 | * @see #CONTROL_AE_ANTIBANDING_MODE_AUTO |
| 1194 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1195 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1196 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1197 | public static final Key<Integer> CONTROL_AE_ANTIBANDING_MODE = |
| 1198 | new Key<Integer>("android.control.aeAntibandingMode", int.class); |
| 1199 | |
| 1200 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1201 | * <p>Adjustment to auto-exposure (AE) target image |
| 1202 | * brightness.</p> |
| 1203 | * <p>The adjustment is measured as a count of steps, with the |
| 1204 | * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the |
| 1205 | * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p> |
| 1206 | * <p>For example, if the exposure value (EV) step is 0.333, '6' |
| 1207 | * will mean an exposure compensation of +2 EV; -3 will mean an |
| 1208 | * exposure compensation of -1 EV. One EV represents a doubling |
| 1209 | * of image brightness. Note that this control will only be |
| 1210 | * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control |
| 1211 | * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p> |
Yin-Chia Yeh | a4227df | 2014-05-05 14:27:39 -0700 | [diff] [blame] | 1212 | * <p>In the event of exposure compensation value being changed, camera device |
| 1213 | * may take several frames to reach the newly requested exposure target. |
| 1214 | * During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING |
| 1215 | * state. Once the new exposure target is reached, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} will |
| 1216 | * change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or |
| 1217 | * FLASH_REQUIRED (if the scene is too dark for still capture).</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1218 | * <p><b>Units</b>: Compensation steps</p> |
| 1219 | * <p><b>Range of valid values:</b><br> |
| 1220 | * {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1221 | * <p>This key is available on all devices.</p> |
Yin-Chia Yeh | a4227df | 2014-05-05 14:27:39 -0700 | [diff] [blame] | 1222 | * |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1223 | * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE |
| 1224 | * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP |
Yin-Chia Yeh | a4227df | 2014-05-05 14:27:39 -0700 | [diff] [blame] | 1225 | * @see CaptureRequest#CONTROL_AE_LOCK |
| 1226 | * @see CaptureRequest#CONTROL_AE_MODE |
| 1227 | * @see CaptureResult#CONTROL_AE_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1228 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1229 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1230 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1231 | public static final Key<Integer> CONTROL_AE_EXPOSURE_COMPENSATION = |
| 1232 | new Key<Integer>("android.control.aeExposureCompensation", int.class); |
| 1233 | |
| 1234 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1235 | * <p>Whether auto-exposure (AE) is currently locked to its latest |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1236 | * calculated values.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1237 | * <p>When set to <code>true</code> (ON), the AE algorithm is locked to its latest parameters, |
| 1238 | * and will not change exposure settings until the lock is set to <code>false</code> (OFF).</p> |
| 1239 | * <p>Note that even when AE is locked, the flash may be fired if |
| 1240 | * the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH / |
| 1241 | * ON_ALWAYS_FLASH / ON_AUTO_FLASH_REDEYE.</p> |
Yin-Chia Yeh | a4227df | 2014-05-05 14:27:39 -0700 | [diff] [blame] | 1242 | * <p>When {@link CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION android.control.aeExposureCompensation} is changed, even if the AE lock |
| 1243 | * is ON, the camera device will still adjust its exposure value.</p> |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1244 | * <p>If AE precapture is triggered (see {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) |
| 1245 | * when AE is already locked, the camera device will not change the exposure time |
| 1246 | * ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}) and sensitivity ({@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}) |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 1247 | * parameters. The flash may be fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1248 | * is ON_AUTO_FLASH/ON_AUTO_FLASH_REDEYE and the scene is too dark. If the |
Zhijun He | fa95b04 | 2015-02-09 10:40:49 -0800 | [diff] [blame] | 1249 | * {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_ALWAYS_FLASH, the scene may become overexposed. |
| 1250 | * Similarly, AE precapture trigger CANCEL has no effect when AE is already locked.</p> |
| 1251 | * <p>When an AE precapture sequence is triggered, AE unlock will not be able to unlock |
| 1252 | * the AE if AE is locked by the camera device internally during precapture metering |
| 1253 | * sequence In other words, submitting requests with AE unlock has no effect for an |
| 1254 | * ongoing precapture metering sequence. Otherwise, the precapture metering sequence |
| 1255 | * will never succeed in a sequence of preview requests where AE lock is always set |
| 1256 | * to <code>false</code>.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1257 | * <p>Since the camera device has a pipeline of in-flight requests, the settings that |
| 1258 | * get locked do not necessarily correspond to the settings that were present in the |
| 1259 | * latest capture result received from the camera device, since additional captures |
| 1260 | * and AE updates may have occurred even before the result was sent out. If an |
| 1261 | * application is switching between automatic and manual control and wishes to eliminate |
| 1262 | * any flicker during the switch, the following procedure is recommended:</p> |
| 1263 | * <ol> |
| 1264 | * <li>Starting in auto-AE mode:</li> |
| 1265 | * <li>Lock AE</li> |
| 1266 | * <li>Wait for the first result to be output that has the AE locked</li> |
| 1267 | * <li>Copy exposure settings from that result into a request, set the request to manual AE</li> |
| 1268 | * <li>Submit the capture request, proceed to run manual AE as desired.</li> |
| 1269 | * </ol> |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1270 | * <p>See {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE lock related state transition details.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1271 | * <p>This key is available on all devices.</p> |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1272 | * |
Yin-Chia Yeh | a4227df | 2014-05-05 14:27:39 -0700 | [diff] [blame] | 1273 | * @see CaptureRequest#CONTROL_AE_EXPOSURE_COMPENSATION |
Zhijun He | 49a3ca9 | 2014-02-05 13:48:09 -0800 | [diff] [blame] | 1274 | * @see CaptureRequest#CONTROL_AE_MODE |
| 1275 | * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER |
| 1276 | * @see CaptureResult#CONTROL_AE_STATE |
| 1277 | * @see CaptureRequest#SENSOR_EXPOSURE_TIME |
| 1278 | * @see CaptureRequest#SENSOR_SENSITIVITY |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1279 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1280 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1281 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1282 | public static final Key<Boolean> CONTROL_AE_LOCK = |
| 1283 | new Key<Boolean>("android.control.aeLock", boolean.class); |
| 1284 | |
| 1285 | /** |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1286 | * <p>The desired mode for the camera device's |
| 1287 | * auto-exposure routine.</p> |
| 1288 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is |
| 1289 | * AUTO.</p> |
| 1290 | * <p>When set to any of the ON modes, the camera device's |
| 1291 | * auto-exposure routine is enabled, overriding the |
| 1292 | * application's selected exposure time, sensor sensitivity, |
| 1293 | * and frame duration ({@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, |
| 1294 | * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and |
| 1295 | * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}). If one of the FLASH modes |
| 1296 | * is selected, the camera device's flash unit controls are |
| 1297 | * also overridden.</p> |
| 1298 | * <p>The FLASH modes are only available if the camera device |
| 1299 | * has a flash unit ({@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} is <code>true</code>).</p> |
| 1300 | * <p>If flash TORCH mode is desired, this field must be set to |
| 1301 | * ON or OFF, and {@link CaptureRequest#FLASH_MODE android.flash.mode} set to TORCH.</p> |
| 1302 | * <p>When set to any of the ON modes, the values chosen by the |
| 1303 | * camera device auto-exposure routine for the overridden |
| 1304 | * fields for a given capture will be available in its |
| 1305 | * CaptureResult.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1306 | * <p><b>Possible values:</b> |
| 1307 | * <ul> |
| 1308 | * <li>{@link #CONTROL_AE_MODE_OFF OFF}</li> |
| 1309 | * <li>{@link #CONTROL_AE_MODE_ON ON}</li> |
| 1310 | * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH ON_AUTO_FLASH}</li> |
| 1311 | * <li>{@link #CONTROL_AE_MODE_ON_ALWAYS_FLASH ON_ALWAYS_FLASH}</li> |
| 1312 | * <li>{@link #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE ON_AUTO_FLASH_REDEYE}</li> |
Chien-Yu Chen | 2cf3357 | 2018-01-11 11:35:41 -0800 | [diff] [blame] | 1313 | * <li>{@link #CONTROL_AE_MODE_ON_EXTERNAL_FLASH ON_EXTERNAL_FLASH}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1314 | * </ul></p> |
| 1315 | * <p><b>Available values for this device:</b><br> |
| 1316 | * {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES android.control.aeAvailableModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1317 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1318 | * |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1319 | * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 1320 | * @see CaptureRequest#CONTROL_MODE |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1321 | * @see CameraCharacteristics#FLASH_INFO_AVAILABLE |
| 1322 | * @see CaptureRequest#FLASH_MODE |
Igor Murashkin | aef3b7e | 2014-01-15 13:20:37 -0800 | [diff] [blame] | 1323 | * @see CaptureRequest#SENSOR_EXPOSURE_TIME |
| 1324 | * @see CaptureRequest#SENSOR_FRAME_DURATION |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 1325 | * @see CaptureRequest#SENSOR_SENSITIVITY |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1326 | * @see #CONTROL_AE_MODE_OFF |
| 1327 | * @see #CONTROL_AE_MODE_ON |
| 1328 | * @see #CONTROL_AE_MODE_ON_AUTO_FLASH |
| 1329 | * @see #CONTROL_AE_MODE_ON_ALWAYS_FLASH |
| 1330 | * @see #CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE |
Chien-Yu Chen | 2cf3357 | 2018-01-11 11:35:41 -0800 | [diff] [blame] | 1331 | * @see #CONTROL_AE_MODE_ON_EXTERNAL_FLASH |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1332 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1333 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1334 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1335 | public static final Key<Integer> CONTROL_AE_MODE = |
| 1336 | new Key<Integer>("android.control.aeMode", int.class); |
| 1337 | |
| 1338 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1339 | * <p>List of metering areas to use for auto-exposure adjustment.</p> |
| 1340 | * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe} is 0. |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1341 | * Otherwise will always be present.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1342 | * <p>The maximum number of regions supported by the device is determined by the value |
| 1343 | * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AE android.control.maxRegionsAe}.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1344 | * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1345 | * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being |
| 1346 | * the top-left pixel in the active pixel array, and |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1347 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1348 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1349 | * active pixel array.</p> |
| 1350 | * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1351 | * system depends on the mode being set. |
| 1352 | * When the distortion correction mode is OFF, the coordinate system follows |
| 1353 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with |
| 1354 | * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and |
| 1355 | * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, |
| 1356 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right |
| 1357 | * pixel in the pre-correction active pixel array. |
| 1358 | * When the distortion correction mode is not OFF, the coordinate system follows |
| 1359 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with |
| 1360 | * <code>(0, 0)</code> being the top-left pixel of the active array, and |
| 1361 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
| 1362 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1363 | * active pixel array.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1364 | * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight |
Yin-Chia Yeh | 97f1c85 | 2014-05-28 16:36:05 -0700 | [diff] [blame] | 1365 | * for every pixel in the area. This means that a large metering area |
| 1366 | * with the same weight as a smaller area will have more effect in |
| 1367 | * the metering result. Metering areas can partially overlap and the |
| 1368 | * camera device will add the weights in the overlap region.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1369 | * <p>The weights are relative to weights of other exposure metering regions, so if only one |
| 1370 | * region is used, all non-zero weights will have the same effect. A region with 0 |
| 1371 | * weight is ignored.</p> |
| 1372 | * <p>If all regions have 0 weight, then no specific metering area needs to be used by the |
| 1373 | * camera device.</p> |
| 1374 | * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in |
| 1375 | * capture result metadata, the camera device will ignore the sections outside the crop |
| 1376 | * region and output only the intersection rectangle as the metering region in the result |
| 1377 | * metadata. If the region is entirely outside the crop region, it will be ignored and |
| 1378 | * not reported in the result metadata.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1379 | * <p>Starting from API level 30, the coordinate system of activeArraySize or |
| 1380 | * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not |
| 1381 | * pre-zoom field of view. This means that the same aeRegions values at different |
| 1382 | * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The aeRegions |
| 1383 | * coordinates are relative to the activeArray/preCorrectionActiveArray representing the |
| 1384 | * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same |
| 1385 | * aeRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the |
| 1386 | * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use |
| 1387 | * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction |
| 1388 | * mode.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1389 | * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or |
| 1390 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on |
| 1391 | * distortion correction capability and mode</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1392 | * <p><b>Range of valid values:</b><br> |
| 1393 | * Coordinates must be between <code>[(0,0), (width, height))</code> of |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1394 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} |
| 1395 | * depending on distortion correction capability and mode</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1396 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1397 | * |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1398 | * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AE |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1399 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1400 | * @see CaptureRequest#DISTORTION_CORRECTION_MODE |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1401 | * @see CaptureRequest#SCALER_CROP_REGION |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1402 | * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1403 | * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1404 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1405 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1406 | @NonNull |
Yin-Chia Yeh | 817f893 | 2014-05-19 10:23:27 -0700 | [diff] [blame] | 1407 | public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS = |
| 1408 | new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.aeRegions", android.hardware.camera2.params.MeteringRectangle[].class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1409 | |
| 1410 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1411 | * <p>Range over which the auto-exposure routine can |
| 1412 | * adjust the capture frame rate to maintain good |
| 1413 | * exposure.</p> |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1414 | * <p>Only constrains auto-exposure (AE) algorithm, not |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1415 | * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime} and |
| 1416 | * {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration}.</p> |
| 1417 | * <p><b>Units</b>: Frames per second (FPS)</p> |
| 1418 | * <p><b>Range of valid values:</b><br> |
| 1419 | * Any of the entries in {@link CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES android.control.aeAvailableTargetFpsRanges}</p> |
| 1420 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1421 | * |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1422 | * @see CameraCharacteristics#CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1423 | * @see CaptureRequest#SENSOR_EXPOSURE_TIME |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1424 | * @see CaptureRequest#SENSOR_FRAME_DURATION |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1425 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1426 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1427 | @NonNull |
Igor Murashkin | 78712a8 | 2014-05-27 18:32:18 -0700 | [diff] [blame] | 1428 | public static final Key<android.util.Range<Integer>> CONTROL_AE_TARGET_FPS_RANGE = |
| 1429 | new Key<android.util.Range<Integer>>("android.control.aeTargetFpsRange", new TypeReference<android.util.Range<Integer>>() {{ }}); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1430 | |
| 1431 | /** |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1432 | * <p>Whether the camera device will trigger a precapture |
| 1433 | * metering sequence when it processes this request.</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 1434 | * <p>This entry is normally set to IDLE, or is not |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1435 | * included at all in the request settings. When included and |
Zhijun He | dd72be5 | 2015-02-06 13:49:51 -0800 | [diff] [blame] | 1436 | * set to START, the camera device will trigger the auto-exposure (AE) |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 1437 | * precapture metering sequence.</p> |
Zhijun He | fa95b04 | 2015-02-09 10:40:49 -0800 | [diff] [blame] | 1438 | * <p>When set to CANCEL, the camera device will cancel any active |
| 1439 | * precapture metering trigger, and return to its initial AE state. |
| 1440 | * If a precapture metering sequence is already completed, and the camera |
| 1441 | * device has implicitly locked the AE for subsequent still capture, the |
| 1442 | * CANCEL trigger will unlock the AE and return to its initial AE state.</p> |
Zhijun He | dd72be5 | 2015-02-06 13:49:51 -0800 | [diff] [blame] | 1443 | * <p>The precapture sequence should be triggered before starting a |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1444 | * high-quality still capture for final metering decisions to |
| 1445 | * be made, and for firing pre-capture flash pulses to estimate |
| 1446 | * scene brightness and required final capture flash power, when |
| 1447 | * the flash is enabled.</p> |
| 1448 | * <p>Normally, this entry should be set to START for only a |
| 1449 | * single request, and the application should wait until the |
| 1450 | * sequence completes before starting a new one.</p> |
Zhijun He | dd72be5 | 2015-02-06 13:49:51 -0800 | [diff] [blame] | 1451 | * <p>When a precapture metering sequence is finished, the camera device |
| 1452 | * may lock the auto-exposure routine internally to be able to accurately expose the |
| 1453 | * subsequent still capture image (<code>{@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE</code>). |
| 1454 | * For this case, the AE may not resume normal scan if no subsequent still capture is |
| 1455 | * submitted. To ensure that the AE routine restarts normal scan, the application should |
| 1456 | * submit a request with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == true</code>, followed by a request |
| 1457 | * with <code>{@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} == false</code>, if the application decides not to submit a |
Zhijun He | fa95b04 | 2015-02-09 10:40:49 -0800 | [diff] [blame] | 1458 | * still capture request after the precapture sequence completes. Alternatively, for |
| 1459 | * API level 23 or newer devices, the CANCEL can be used to unlock the camera device |
| 1460 | * internally locked AE if the application doesn't submit a still capture request after |
| 1461 | * the AE precapture trigger. Note that, the CANCEL was added in API level 23, and must not |
| 1462 | * be used in devices that have earlier API levels.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1463 | * <p>The exact effect of auto-exposure (AE) precapture trigger |
| 1464 | * depends on the current AE mode and state; see |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1465 | * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition |
| 1466 | * details.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1467 | * <p>On LEGACY-level devices, the precapture trigger is not supported; |
| 1468 | * capturing a high-resolution JPEG image will automatically trigger a |
| 1469 | * precapture sequence before the high-resolution capture, including |
| 1470 | * potentially firing a pre-capture flash.</p> |
Eino-Ville Talvala | f8a2f57 | 2015-06-24 15:36:38 -0700 | [diff] [blame] | 1471 | * <p>Using the precapture trigger and the auto-focus trigger {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} |
| 1472 | * simultaneously is allowed. However, since these triggers often require cooperation between |
| 1473 | * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a |
| 1474 | * focus sweep), the camera device may delay acting on a later trigger until the previous |
| 1475 | * trigger has been fully handled. This may lead to longer intervals between the trigger and |
| 1476 | * changes to {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} indicating the start of the precapture sequence, for |
| 1477 | * example.</p> |
| 1478 | * <p>If both the precapture and the auto-focus trigger are activated on the same request, then |
| 1479 | * the camera device will complete them in the optimal order for that device.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1480 | * <p><b>Possible values:</b> |
| 1481 | * <ul> |
| 1482 | * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE IDLE}</li> |
| 1483 | * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_START START}</li> |
Zhijun He | fa95b04 | 2015-02-09 10:40:49 -0800 | [diff] [blame] | 1484 | * <li>{@link #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL CANCEL}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1485 | * </ul></p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1486 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1487 | * <p><b>Limited capability</b> - |
| 1488 | * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the |
| 1489 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1490 | * |
Zhijun He | dd72be5 | 2015-02-06 13:49:51 -0800 | [diff] [blame] | 1491 | * @see CaptureRequest#CONTROL_AE_LOCK |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1492 | * @see CaptureResult#CONTROL_AE_STATE |
Eino-Ville Talvala | f8a2f57 | 2015-06-24 15:36:38 -0700 | [diff] [blame] | 1493 | * @see CaptureRequest#CONTROL_AF_TRIGGER |
Zhijun He | dd72be5 | 2015-02-06 13:49:51 -0800 | [diff] [blame] | 1494 | * @see CaptureRequest#CONTROL_CAPTURE_INTENT |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1495 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1496 | * @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE |
| 1497 | * @see #CONTROL_AE_PRECAPTURE_TRIGGER_START |
Zhijun He | fa95b04 | 2015-02-09 10:40:49 -0800 | [diff] [blame] | 1498 | * @see #CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1499 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1500 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1501 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1502 | public static final Key<Integer> CONTROL_AE_PRECAPTURE_TRIGGER = |
| 1503 | new Key<Integer>("android.control.aePrecaptureTrigger", int.class); |
| 1504 | |
| 1505 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1506 | * <p>Whether auto-focus (AF) is currently enabled, and what |
| 1507 | * mode it is set to.</p> |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1508 | * <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1509 | * (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} > 0</code>). Also note that |
| 1510 | * when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, the behavior of AF is device |
| 1511 | * dependent. It is recommended to lock AF by using {@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger} before |
| 1512 | * setting {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} to OFF, or set AF mode to OFF when AE is OFF.</p> |
Zhijun He | 78146ec | 2014-01-14 18:12:13 -0800 | [diff] [blame] | 1513 | * <p>If the lens is controlled by the camera device auto-focus algorithm, |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 1514 | * the camera device will report the current AF status in {@link CaptureResult#CONTROL_AF_STATE android.control.afState} |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1515 | * in result metadata.</p> |
| 1516 | * <p><b>Possible values:</b> |
| 1517 | * <ul> |
| 1518 | * <li>{@link #CONTROL_AF_MODE_OFF OFF}</li> |
| 1519 | * <li>{@link #CONTROL_AF_MODE_AUTO AUTO}</li> |
| 1520 | * <li>{@link #CONTROL_AF_MODE_MACRO MACRO}</li> |
| 1521 | * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_VIDEO CONTINUOUS_VIDEO}</li> |
| 1522 | * <li>{@link #CONTROL_AF_MODE_CONTINUOUS_PICTURE CONTINUOUS_PICTURE}</li> |
| 1523 | * <li>{@link #CONTROL_AF_MODE_EDOF EDOF}</li> |
| 1524 | * </ul></p> |
| 1525 | * <p><b>Available values for this device:</b><br> |
| 1526 | * {@link CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES android.control.afAvailableModes}</p> |
| 1527 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1528 | * |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1529 | * @see CaptureRequest#CONTROL_AE_MODE |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1530 | * @see CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 1531 | * @see CaptureResult#CONTROL_AF_STATE |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1532 | * @see CaptureRequest#CONTROL_AF_TRIGGER |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1533 | * @see CaptureRequest#CONTROL_MODE |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1534 | * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1535 | * @see #CONTROL_AF_MODE_OFF |
| 1536 | * @see #CONTROL_AF_MODE_AUTO |
| 1537 | * @see #CONTROL_AF_MODE_MACRO |
| 1538 | * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO |
| 1539 | * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE |
| 1540 | * @see #CONTROL_AF_MODE_EDOF |
| 1541 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1542 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1543 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1544 | public static final Key<Integer> CONTROL_AF_MODE = |
| 1545 | new Key<Integer>("android.control.afMode", int.class); |
| 1546 | |
| 1547 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1548 | * <p>List of metering areas to use for auto-focus.</p> |
| 1549 | * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf} is 0. |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1550 | * Otherwise will always be present.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1551 | * <p>The maximum number of focus areas supported by the device is determined by the value |
| 1552 | * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AF android.control.maxRegionsAf}.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1553 | * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1554 | * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being |
| 1555 | * the top-left pixel in the active pixel array, and |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1556 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1557 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1558 | * active pixel array.</p> |
| 1559 | * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1560 | * system depends on the mode being set. |
| 1561 | * When the distortion correction mode is OFF, the coordinate system follows |
| 1562 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with |
| 1563 | * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and |
| 1564 | * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, |
| 1565 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right |
| 1566 | * pixel in the pre-correction active pixel array. |
| 1567 | * When the distortion correction mode is not OFF, the coordinate system follows |
| 1568 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with |
| 1569 | * <code>(0, 0)</code> being the top-left pixel of the active array, and |
| 1570 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
| 1571 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1572 | * active pixel array.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1573 | * <p>The weight must be within <code>[0, 1000]</code>, and represents a weight |
Yin-Chia Yeh | 97f1c85 | 2014-05-28 16:36:05 -0700 | [diff] [blame] | 1574 | * for every pixel in the area. This means that a large metering area |
| 1575 | * with the same weight as a smaller area will have more effect in |
| 1576 | * the metering result. Metering areas can partially overlap and the |
| 1577 | * camera device will add the weights in the overlap region.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1578 | * <p>The weights are relative to weights of other metering regions, so if only one region |
| 1579 | * is used, all non-zero weights will have the same effect. A region with 0 weight is |
| 1580 | * ignored.</p> |
| 1581 | * <p>If all regions have 0 weight, then no specific metering area needs to be used by the |
Shuzhen Wang | a31d58f | 2018-02-08 12:44:47 -0800 | [diff] [blame] | 1582 | * camera device. The capture result will either be a zero weight region as well, or |
| 1583 | * the region selected by the camera device as the focus area of interest.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1584 | * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in |
| 1585 | * capture result metadata, the camera device will ignore the sections outside the crop |
| 1586 | * region and output only the intersection rectangle as the metering region in the result |
| 1587 | * metadata. If the region is entirely outside the crop region, it will be ignored and |
| 1588 | * not reported in the result metadata.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1589 | * <p>Starting from API level 30, the coordinate system of activeArraySize or |
| 1590 | * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not |
| 1591 | * pre-zoom field of view. This means that the same afRegions values at different |
| 1592 | * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The afRegions |
| 1593 | * coordinates are relative to the activeArray/preCorrectionActiveArray representing the |
| 1594 | * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same |
| 1595 | * afRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of the |
| 1596 | * scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use |
| 1597 | * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction |
| 1598 | * mode.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1599 | * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or |
| 1600 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on |
| 1601 | * distortion correction capability and mode</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1602 | * <p><b>Range of valid values:</b><br> |
| 1603 | * Coordinates must be between <code>[(0,0), (width, height))</code> of |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1604 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} |
| 1605 | * depending on distortion correction capability and mode</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1606 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1607 | * |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1608 | * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AF |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1609 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1610 | * @see CaptureRequest#DISTORTION_CORRECTION_MODE |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1611 | * @see CaptureRequest#SCALER_CROP_REGION |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1612 | * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1613 | * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1614 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1615 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1616 | @NonNull |
Yin-Chia Yeh | 817f893 | 2014-05-19 10:23:27 -0700 | [diff] [blame] | 1617 | public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS = |
| 1618 | new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.afRegions", android.hardware.camera2.params.MeteringRectangle[].class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1619 | |
| 1620 | /** |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1621 | * <p>Whether the camera device will trigger autofocus for this request.</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 1622 | * <p>This entry is normally set to IDLE, or is not |
| 1623 | * included at all in the request settings.</p> |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1624 | * <p>When included and set to START, the camera device will trigger the |
| 1625 | * autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p> |
| 1626 | * <p>When set to CANCEL, the camera device will cancel any active trigger, |
| 1627 | * and return to its initial AF state.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1628 | * <p>Generally, applications should set this entry to START or CANCEL for only a |
| 1629 | * single capture, and then return it to IDLE (or not set at all). Specifying |
| 1630 | * START for multiple captures in a row means restarting the AF operation over |
| 1631 | * and over again.</p> |
| 1632 | * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p> |
Eino-Ville Talvala | f8a2f57 | 2015-06-24 15:36:38 -0700 | [diff] [blame] | 1633 | * <p>Using the autofocus trigger and the precapture trigger {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} |
| 1634 | * simultaneously is allowed. However, since these triggers often require cooperation between |
| 1635 | * the auto-focus and auto-exposure routines (for example, the may need to be enabled for a |
| 1636 | * focus sweep), the camera device may delay acting on a later trigger until the previous |
| 1637 | * trigger has been fully handled. This may lead to longer intervals between the trigger and |
| 1638 | * changes to {@link CaptureResult#CONTROL_AF_STATE android.control.afState}, for example.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1639 | * <p><b>Possible values:</b> |
| 1640 | * <ul> |
| 1641 | * <li>{@link #CONTROL_AF_TRIGGER_IDLE IDLE}</li> |
| 1642 | * <li>{@link #CONTROL_AF_TRIGGER_START START}</li> |
| 1643 | * <li>{@link #CONTROL_AF_TRIGGER_CANCEL CANCEL}</li> |
| 1644 | * </ul></p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1645 | * <p>This key is available on all devices.</p> |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1646 | * |
Eino-Ville Talvala | f8a2f57 | 2015-06-24 15:36:38 -0700 | [diff] [blame] | 1647 | * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER |
Zhijun He | 228f4f9 | 2014-01-16 17:22:05 -0800 | [diff] [blame] | 1648 | * @see CaptureResult#CONTROL_AF_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1649 | * @see #CONTROL_AF_TRIGGER_IDLE |
| 1650 | * @see #CONTROL_AF_TRIGGER_START |
| 1651 | * @see #CONTROL_AF_TRIGGER_CANCEL |
| 1652 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1653 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1654 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1655 | public static final Key<Integer> CONTROL_AF_TRIGGER = |
| 1656 | new Key<Integer>("android.control.afTrigger", int.class); |
| 1657 | |
| 1658 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1659 | * <p>Whether auto-white balance (AWB) is currently locked to its |
Zhijun He | 2d5e897 | 2014-02-07 16:13:46 -0800 | [diff] [blame] | 1660 | * latest calculated values.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1661 | * <p>When set to <code>true</code> (ON), the AWB algorithm is locked to its latest parameters, |
| 1662 | * and will not change color balance settings until the lock is set to <code>false</code> (OFF).</p> |
| 1663 | * <p>Since the camera device has a pipeline of in-flight requests, the settings that |
| 1664 | * get locked do not necessarily correspond to the settings that were present in the |
| 1665 | * latest capture result received from the camera device, since additional captures |
| 1666 | * and AWB updates may have occurred even before the result was sent out. If an |
| 1667 | * application is switching between automatic and manual control and wishes to eliminate |
| 1668 | * any flicker during the switch, the following procedure is recommended:</p> |
| 1669 | * <ol> |
| 1670 | * <li>Starting in auto-AWB mode:</li> |
| 1671 | * <li>Lock AWB</li> |
| 1672 | * <li>Wait for the first result to be output that has the AWB locked</li> |
| 1673 | * <li>Copy AWB settings from that result into a request, set the request to manual AWB</li> |
| 1674 | * <li>Submit the capture request, proceed to run manual AWB as desired.</li> |
| 1675 | * </ol> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1676 | * <p>Note that AWB lock is only meaningful when |
| 1677 | * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes, |
| 1678 | * AWB is already fixed to a specific setting.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1679 | * <p>Some LEGACY devices may not support ON; the value is then overridden to OFF.</p> |
| 1680 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1681 | * |
| 1682 | * @see CaptureRequest#CONTROL_AWB_MODE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1683 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1684 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1685 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1686 | public static final Key<Boolean> CONTROL_AWB_LOCK = |
| 1687 | new Key<Boolean>("android.control.awbLock", boolean.class); |
| 1688 | |
| 1689 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 1690 | * <p>Whether auto-white balance (AWB) is currently setting the color |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1691 | * transform fields, and what its illumination target |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1692 | * is.</p> |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 1693 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1694 | * <p>When set to the ON mode, the camera device's auto-white balance |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 1695 | * routine is enabled, overriding the application's selected |
| 1696 | * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1697 | * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}. Note that when {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} |
| 1698 | * is OFF, the behavior of AWB is device dependent. It is recommened to |
| 1699 | * also set AWB mode to OFF or lock AWB by using {@link CaptureRequest#CONTROL_AWB_LOCK android.control.awbLock} before |
| 1700 | * setting AE mode to OFF.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1701 | * <p>When set to the OFF mode, the camera device's auto-white balance |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1702 | * routine is disabled. The application manually controls the white |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 1703 | * balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 1704 | * and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1705 | * <p>When set to any other modes, the camera device's auto-white |
| 1706 | * balance routine is disabled. The camera device uses each |
| 1707 | * particular illumination target for white balance |
| 1708 | * adjustment. The application's values for |
| 1709 | * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, |
| 1710 | * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and |
| 1711 | * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1712 | * <p><b>Possible values:</b> |
| 1713 | * <ul> |
| 1714 | * <li>{@link #CONTROL_AWB_MODE_OFF OFF}</li> |
| 1715 | * <li>{@link #CONTROL_AWB_MODE_AUTO AUTO}</li> |
| 1716 | * <li>{@link #CONTROL_AWB_MODE_INCANDESCENT INCANDESCENT}</li> |
| 1717 | * <li>{@link #CONTROL_AWB_MODE_FLUORESCENT FLUORESCENT}</li> |
| 1718 | * <li>{@link #CONTROL_AWB_MODE_WARM_FLUORESCENT WARM_FLUORESCENT}</li> |
| 1719 | * <li>{@link #CONTROL_AWB_MODE_DAYLIGHT DAYLIGHT}</li> |
| 1720 | * <li>{@link #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT CLOUDY_DAYLIGHT}</li> |
| 1721 | * <li>{@link #CONTROL_AWB_MODE_TWILIGHT TWILIGHT}</li> |
| 1722 | * <li>{@link #CONTROL_AWB_MODE_SHADE SHADE}</li> |
| 1723 | * </ul></p> |
| 1724 | * <p><b>Available values for this device:</b><br> |
| 1725 | * {@link CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES android.control.awbAvailableModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1726 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1727 | * |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1728 | * @see CaptureRequest#COLOR_CORRECTION_GAINS |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 1729 | * @see CaptureRequest#COLOR_CORRECTION_MODE |
| 1730 | * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1731 | * @see CaptureRequest#CONTROL_AE_MODE |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1732 | * @see CameraCharacteristics#CONTROL_AWB_AVAILABLE_MODES |
Yin-Chia Yeh | 7144b5d | 2014-11-12 11:42:49 -0800 | [diff] [blame] | 1733 | * @see CaptureRequest#CONTROL_AWB_LOCK |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1734 | * @see CaptureRequest#CONTROL_MODE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1735 | * @see #CONTROL_AWB_MODE_OFF |
| 1736 | * @see #CONTROL_AWB_MODE_AUTO |
| 1737 | * @see #CONTROL_AWB_MODE_INCANDESCENT |
| 1738 | * @see #CONTROL_AWB_MODE_FLUORESCENT |
| 1739 | * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT |
| 1740 | * @see #CONTROL_AWB_MODE_DAYLIGHT |
| 1741 | * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT |
| 1742 | * @see #CONTROL_AWB_MODE_TWILIGHT |
| 1743 | * @see #CONTROL_AWB_MODE_SHADE |
| 1744 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1745 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1746 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1747 | public static final Key<Integer> CONTROL_AWB_MODE = |
| 1748 | new Key<Integer>("android.control.awbMode", int.class); |
| 1749 | |
| 1750 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1751 | * <p>List of metering areas to use for auto-white-balance illuminant |
Ruben Brunk | f59521d | 2014-02-03 17:14:33 -0800 | [diff] [blame] | 1752 | * estimation.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1753 | * <p>Not available if {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb} is 0. |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1754 | * Otherwise will always be present.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1755 | * <p>The maximum number of regions supported by the device is determined by the value |
| 1756 | * of {@link CameraCharacteristics#CONTROL_MAX_REGIONS_AWB android.control.maxRegionsAwb}.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1757 | * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1758 | * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with (0,0) being |
| 1759 | * the top-left pixel in the active pixel array, and |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1760 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1761 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1762 | * active pixel array.</p> |
| 1763 | * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 1764 | * system depends on the mode being set. |
| 1765 | * When the distortion correction mode is OFF, the coordinate system follows |
| 1766 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with |
| 1767 | * <code>(0, 0)</code> being the top-left pixel of the pre-correction active array, and |
| 1768 | * ({@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.width - 1, |
| 1769 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}.height - 1) being the bottom-right |
| 1770 | * pixel in the pre-correction active pixel array. |
| 1771 | * When the distortion correction mode is not OFF, the coordinate system follows |
| 1772 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with |
| 1773 | * <code>(0, 0)</code> being the top-left pixel of the active array, and |
| 1774 | * ({@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.width - 1, |
| 1775 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.height - 1) being the bottom-right pixel in the |
| 1776 | * active pixel array.</p> |
Yin-Chia Yeh | 97f1c85 | 2014-05-28 16:36:05 -0700 | [diff] [blame] | 1777 | * <p>The weight must range from 0 to 1000, and represents a weight |
| 1778 | * for every pixel in the area. This means that a large metering area |
| 1779 | * with the same weight as a smaller area will have more effect in |
| 1780 | * the metering result. Metering areas can partially overlap and the |
| 1781 | * camera device will add the weights in the overlap region.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1782 | * <p>The weights are relative to weights of other white balance metering regions, so if |
| 1783 | * only one region is used, all non-zero weights will have the same effect. A region with |
| 1784 | * 0 weight is ignored.</p> |
| 1785 | * <p>If all regions have 0 weight, then no specific metering area needs to be used by the |
| 1786 | * camera device.</p> |
| 1787 | * <p>If the metering region is outside the used {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} returned in |
| 1788 | * capture result metadata, the camera device will ignore the sections outside the crop |
| 1789 | * region and output only the intersection rectangle as the metering region in the result |
| 1790 | * metadata. If the region is entirely outside the crop region, it will be ignored and |
| 1791 | * not reported in the result metadata.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1792 | * <p>Starting from API level 30, the coordinate system of activeArraySize or |
| 1793 | * preCorrectionActiveArraySize is used to represent post-zoomRatio field of view, not |
| 1794 | * pre-zoom field of view. This means that the same awbRegions values at different |
| 1795 | * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} represent different parts of the scene. The awbRegions |
| 1796 | * coordinates are relative to the activeArray/preCorrectionActiveArray representing the |
| 1797 | * zoomed field of view. If {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} is set to 1.0 (default), the same |
| 1798 | * awbRegions at different {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} still represent the same parts of |
| 1799 | * the scene as they do before. See {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details. Whether to use |
| 1800 | * activeArraySize or preCorrectionActiveArraySize still depends on distortion correction |
| 1801 | * mode.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1802 | * <p><b>Units</b>: Pixel coordinates within {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or |
| 1803 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on |
| 1804 | * distortion correction capability and mode</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1805 | * <p><b>Range of valid values:</b><br> |
| 1806 | * Coordinates must be between <code>[(0,0), (width, height))</code> of |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1807 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} |
| 1808 | * depending on distortion correction capability and mode</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1809 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1810 | * |
Yin-Chia Yeh | 808150f | 2014-09-08 15:48:47 -0700 | [diff] [blame] | 1811 | * @see CameraCharacteristics#CONTROL_MAX_REGIONS_AWB |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 1812 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1813 | * @see CaptureRequest#DISTORTION_CORRECTION_MODE |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1814 | * @see CaptureRequest#SCALER_CROP_REGION |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 1815 | * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 1816 | * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1817 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1818 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1819 | @NonNull |
Yin-Chia Yeh | 817f893 | 2014-05-19 10:23:27 -0700 | [diff] [blame] | 1820 | public static final Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS = |
| 1821 | new Key<android.hardware.camera2.params.MeteringRectangle[]>("android.control.awbRegions", android.hardware.camera2.params.MeteringRectangle[].class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1822 | |
| 1823 | /** |
Zhijun He | 66d065a | 2014-01-16 18:18:50 -0800 | [diff] [blame] | 1824 | * <p>Information to the camera device 3A (auto-exposure, |
| 1825 | * auto-focus, auto-white balance) routines about the purpose |
| 1826 | * of this capture, to help the camera device to decide optimal 3A |
| 1827 | * strategy.</p> |
Zhijun He | e30adb7 | 2014-04-09 19:04:31 -0700 | [diff] [blame] | 1828 | * <p>This control (except for MANUAL) is only effective if |
| 1829 | * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p> |
Eino-Ville Talvala | ec99efa | 2017-11-29 15:35:42 -0800 | [diff] [blame] | 1830 | * <p>All intents are supported by all devices, except that: |
| 1831 | * * ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains |
| 1832 | * PRIVATE_REPROCESSING or YUV_REPROCESSING. |
| 1833 | * * MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains |
| 1834 | * MANUAL_SENSOR. |
| 1835 | * * MOTION_TRACKING will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains |
| 1836 | * MOTION_TRACKING.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1837 | * <p><b>Possible values:</b> |
| 1838 | * <ul> |
| 1839 | * <li>{@link #CONTROL_CAPTURE_INTENT_CUSTOM CUSTOM}</li> |
| 1840 | * <li>{@link #CONTROL_CAPTURE_INTENT_PREVIEW PREVIEW}</li> |
| 1841 | * <li>{@link #CONTROL_CAPTURE_INTENT_STILL_CAPTURE STILL_CAPTURE}</li> |
| 1842 | * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_RECORD VIDEO_RECORD}</li> |
| 1843 | * <li>{@link #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT VIDEO_SNAPSHOT}</li> |
| 1844 | * <li>{@link #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> |
| 1845 | * <li>{@link #CONTROL_CAPTURE_INTENT_MANUAL MANUAL}</li> |
Eino-Ville Talvala | ec99efa | 2017-11-29 15:35:42 -0800 | [diff] [blame] | 1846 | * <li>{@link #CONTROL_CAPTURE_INTENT_MOTION_TRACKING MOTION_TRACKING}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1847 | * </ul></p> |
| 1848 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1849 | * |
| 1850 | * @see CaptureRequest#CONTROL_MODE |
Zhijun He | e30adb7 | 2014-04-09 19:04:31 -0700 | [diff] [blame] | 1851 | * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1852 | * @see #CONTROL_CAPTURE_INTENT_CUSTOM |
| 1853 | * @see #CONTROL_CAPTURE_INTENT_PREVIEW |
| 1854 | * @see #CONTROL_CAPTURE_INTENT_STILL_CAPTURE |
| 1855 | * @see #CONTROL_CAPTURE_INTENT_VIDEO_RECORD |
| 1856 | * @see #CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT |
| 1857 | * @see #CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG |
Zhijun He | e30adb7 | 2014-04-09 19:04:31 -0700 | [diff] [blame] | 1858 | * @see #CONTROL_CAPTURE_INTENT_MANUAL |
Eino-Ville Talvala | ec99efa | 2017-11-29 15:35:42 -0800 | [diff] [blame] | 1859 | * @see #CONTROL_CAPTURE_INTENT_MOTION_TRACKING |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1860 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1861 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1862 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1863 | public static final Key<Integer> CONTROL_CAPTURE_INTENT = |
| 1864 | new Key<Integer>("android.control.captureIntent", int.class); |
| 1865 | |
| 1866 | /** |
Ruben Brunk | 5f1dcfe | 2014-01-17 16:42:51 -0800 | [diff] [blame] | 1867 | * <p>A special color effect to apply.</p> |
| 1868 | * <p>When this mode is set, a color effect will be applied |
| 1869 | * to images produced by the camera device. The interpretation |
| 1870 | * and implementation of these color effects is left to the |
| 1871 | * implementor of the camera device, and should not be |
| 1872 | * depended on to be consistent (or present) across all |
| 1873 | * devices.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1874 | * <p><b>Possible values:</b> |
| 1875 | * <ul> |
| 1876 | * <li>{@link #CONTROL_EFFECT_MODE_OFF OFF}</li> |
| 1877 | * <li>{@link #CONTROL_EFFECT_MODE_MONO MONO}</li> |
| 1878 | * <li>{@link #CONTROL_EFFECT_MODE_NEGATIVE NEGATIVE}</li> |
| 1879 | * <li>{@link #CONTROL_EFFECT_MODE_SOLARIZE SOLARIZE}</li> |
| 1880 | * <li>{@link #CONTROL_EFFECT_MODE_SEPIA SEPIA}</li> |
| 1881 | * <li>{@link #CONTROL_EFFECT_MODE_POSTERIZE POSTERIZE}</li> |
| 1882 | * <li>{@link #CONTROL_EFFECT_MODE_WHITEBOARD WHITEBOARD}</li> |
| 1883 | * <li>{@link #CONTROL_EFFECT_MODE_BLACKBOARD BLACKBOARD}</li> |
| 1884 | * <li>{@link #CONTROL_EFFECT_MODE_AQUA AQUA}</li> |
| 1885 | * </ul></p> |
| 1886 | * <p><b>Available values for this device:</b><br> |
| 1887 | * {@link CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS android.control.availableEffects}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1888 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1889 | * |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1890 | * @see CameraCharacteristics#CONTROL_AVAILABLE_EFFECTS |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1891 | * @see #CONTROL_EFFECT_MODE_OFF |
| 1892 | * @see #CONTROL_EFFECT_MODE_MONO |
| 1893 | * @see #CONTROL_EFFECT_MODE_NEGATIVE |
| 1894 | * @see #CONTROL_EFFECT_MODE_SOLARIZE |
| 1895 | * @see #CONTROL_EFFECT_MODE_SEPIA |
| 1896 | * @see #CONTROL_EFFECT_MODE_POSTERIZE |
| 1897 | * @see #CONTROL_EFFECT_MODE_WHITEBOARD |
| 1898 | * @see #CONTROL_EFFECT_MODE_BLACKBOARD |
| 1899 | * @see #CONTROL_EFFECT_MODE_AQUA |
| 1900 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1901 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1902 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1903 | public static final Key<Integer> CONTROL_EFFECT_MODE = |
| 1904 | new Key<Integer>("android.control.effectMode", int.class); |
| 1905 | |
| 1906 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1907 | * <p>Overall mode of 3A (auto-exposure, auto-white-balance, auto-focus) control |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 1908 | * routines.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1909 | * <p>This is a top-level 3A control switch. When set to OFF, all 3A control |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 1910 | * by the camera device is disabled. The application must set the fields for |
Zhijun He | f353742 | 2013-12-16 16:56:35 -0800 | [diff] [blame] | 1911 | * capture parameters itself.</p> |
| 1912 | * <p>When set to AUTO, the individual algorithm controls in |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1913 | * android.control.* are in effect, such as {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 1914 | * <p>When set to USE_SCENE_MODE or USE_EXTENDED_SCENE_MODE, the individual controls in |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 1915 | * android.control.* are mostly disabled, and the camera device |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 1916 | * implements one of the scene mode or extended scene mode settings (such as ACTION, |
| 1917 | * SUNSET, PARTY, or BOKEH) as it wishes. The camera device scene mode |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 1918 | * 3A settings are provided by {@link android.hardware.camera2.CaptureResult capture results}.</p> |
Zhijun He | 2d5e897 | 2014-02-07 16:13:46 -0800 | [diff] [blame] | 1919 | * <p>When set to OFF_KEEP_STATE, it is similar to OFF mode, the only difference |
| 1920 | * is that this frame will not be used by camera device background 3A statistics |
| 1921 | * update, as if this frame is never captured. This mode can be used in the scenario |
| 1922 | * where the application doesn't want a 3A manual control capture to affect |
| 1923 | * the subsequent auto 3A capture results.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1924 | * <p><b>Possible values:</b> |
| 1925 | * <ul> |
| 1926 | * <li>{@link #CONTROL_MODE_OFF OFF}</li> |
| 1927 | * <li>{@link #CONTROL_MODE_AUTO AUTO}</li> |
| 1928 | * <li>{@link #CONTROL_MODE_USE_SCENE_MODE USE_SCENE_MODE}</li> |
| 1929 | * <li>{@link #CONTROL_MODE_OFF_KEEP_STATE OFF_KEEP_STATE}</li> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 1930 | * <li>{@link #CONTROL_MODE_USE_EXTENDED_SCENE_MODE USE_EXTENDED_SCENE_MODE}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1931 | * </ul></p> |
Yin-Chia Yeh | d9fc67c | 2015-01-30 10:47:22 -0800 | [diff] [blame] | 1932 | * <p><b>Available values for this device:</b><br> |
| 1933 | * {@link CameraCharacteristics#CONTROL_AVAILABLE_MODES android.control.availableModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1934 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1935 | * |
| 1936 | * @see CaptureRequest#CONTROL_AF_MODE |
Yin-Chia Yeh | d9fc67c | 2015-01-30 10:47:22 -0800 | [diff] [blame] | 1937 | * @see CameraCharacteristics#CONTROL_AVAILABLE_MODES |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1938 | * @see #CONTROL_MODE_OFF |
| 1939 | * @see #CONTROL_MODE_AUTO |
| 1940 | * @see #CONTROL_MODE_USE_SCENE_MODE |
Zhijun He | 2d5e897 | 2014-02-07 16:13:46 -0800 | [diff] [blame] | 1941 | * @see #CONTROL_MODE_OFF_KEEP_STATE |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 1942 | * @see #CONTROL_MODE_USE_EXTENDED_SCENE_MODE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1943 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 1944 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 1945 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1946 | public static final Key<Integer> CONTROL_MODE = |
| 1947 | new Key<Integer>("android.control.mode", int.class); |
| 1948 | |
| 1949 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1950 | * <p>Control for which scene mode is currently active.</p> |
| 1951 | * <p>Scene modes are custom camera modes optimized for a certain set of conditions and |
| 1952 | * capture settings.</p> |
Ruben Brunk | e667936 | 2014-01-17 17:05:54 -0800 | [diff] [blame] | 1953 | * <p>This is the mode that that is active when |
Zhijun He | ee2ebde | 2015-06-16 19:58:11 -0700 | [diff] [blame] | 1954 | * <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY, these modes will |
| 1955 | * 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} |
| 1956 | * while in use.</p> |
Ruben Brunk | e667936 | 2014-01-17 17:05:54 -0800 | [diff] [blame] | 1957 | * <p>The interpretation and implementation of these scene modes is left |
| 1958 | * to the implementor of the camera device. Their behavior will not be |
| 1959 | * consistent across all devices, and any given device may only implement |
| 1960 | * a subset of these modes.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1961 | * <p><b>Possible values:</b> |
| 1962 | * <ul> |
| 1963 | * <li>{@link #CONTROL_SCENE_MODE_DISABLED DISABLED}</li> |
| 1964 | * <li>{@link #CONTROL_SCENE_MODE_FACE_PRIORITY FACE_PRIORITY}</li> |
| 1965 | * <li>{@link #CONTROL_SCENE_MODE_ACTION ACTION}</li> |
| 1966 | * <li>{@link #CONTROL_SCENE_MODE_PORTRAIT PORTRAIT}</li> |
| 1967 | * <li>{@link #CONTROL_SCENE_MODE_LANDSCAPE LANDSCAPE}</li> |
| 1968 | * <li>{@link #CONTROL_SCENE_MODE_NIGHT NIGHT}</li> |
| 1969 | * <li>{@link #CONTROL_SCENE_MODE_NIGHT_PORTRAIT NIGHT_PORTRAIT}</li> |
| 1970 | * <li>{@link #CONTROL_SCENE_MODE_THEATRE THEATRE}</li> |
| 1971 | * <li>{@link #CONTROL_SCENE_MODE_BEACH BEACH}</li> |
| 1972 | * <li>{@link #CONTROL_SCENE_MODE_SNOW SNOW}</li> |
| 1973 | * <li>{@link #CONTROL_SCENE_MODE_SUNSET SUNSET}</li> |
| 1974 | * <li>{@link #CONTROL_SCENE_MODE_STEADYPHOTO STEADYPHOTO}</li> |
| 1975 | * <li>{@link #CONTROL_SCENE_MODE_FIREWORKS FIREWORKS}</li> |
| 1976 | * <li>{@link #CONTROL_SCENE_MODE_SPORTS SPORTS}</li> |
| 1977 | * <li>{@link #CONTROL_SCENE_MODE_PARTY PARTY}</li> |
| 1978 | * <li>{@link #CONTROL_SCENE_MODE_CANDLELIGHT CANDLELIGHT}</li> |
| 1979 | * <li>{@link #CONTROL_SCENE_MODE_BARCODE BARCODE}</li> |
| 1980 | * <li>{@link #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO HIGH_SPEED_VIDEO}</li> |
Eino-Ville Talvala | f4eac12 | 2014-12-05 11:10:15 -0800 | [diff] [blame] | 1981 | * <li>{@link #CONTROL_SCENE_MODE_HDR HDR}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 1982 | * </ul></p> |
| 1983 | * <p><b>Available values for this device:</b><br> |
| 1984 | * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 1985 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1986 | * |
Ruben Brunk | e667936 | 2014-01-17 17:05:54 -0800 | [diff] [blame] | 1987 | * @see CaptureRequest#CONTROL_AE_MODE |
| 1988 | * @see CaptureRequest#CONTROL_AF_MODE |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 1989 | * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES |
Ruben Brunk | e667936 | 2014-01-17 17:05:54 -0800 | [diff] [blame] | 1990 | * @see CaptureRequest#CONTROL_AWB_MODE |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 1991 | * @see CaptureRequest#CONTROL_MODE |
Ruben Brunk | e667936 | 2014-01-17 17:05:54 -0800 | [diff] [blame] | 1992 | * @see #CONTROL_SCENE_MODE_DISABLED |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 1993 | * @see #CONTROL_SCENE_MODE_FACE_PRIORITY |
| 1994 | * @see #CONTROL_SCENE_MODE_ACTION |
| 1995 | * @see #CONTROL_SCENE_MODE_PORTRAIT |
| 1996 | * @see #CONTROL_SCENE_MODE_LANDSCAPE |
| 1997 | * @see #CONTROL_SCENE_MODE_NIGHT |
| 1998 | * @see #CONTROL_SCENE_MODE_NIGHT_PORTRAIT |
| 1999 | * @see #CONTROL_SCENE_MODE_THEATRE |
| 2000 | * @see #CONTROL_SCENE_MODE_BEACH |
| 2001 | * @see #CONTROL_SCENE_MODE_SNOW |
| 2002 | * @see #CONTROL_SCENE_MODE_SUNSET |
| 2003 | * @see #CONTROL_SCENE_MODE_STEADYPHOTO |
| 2004 | * @see #CONTROL_SCENE_MODE_FIREWORKS |
| 2005 | * @see #CONTROL_SCENE_MODE_SPORTS |
| 2006 | * @see #CONTROL_SCENE_MODE_PARTY |
| 2007 | * @see #CONTROL_SCENE_MODE_CANDLELIGHT |
| 2008 | * @see #CONTROL_SCENE_MODE_BARCODE |
Zhijun He | e040418 | 2014-06-26 13:17:09 -0700 | [diff] [blame] | 2009 | * @see #CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO |
Eino-Ville Talvala | f4eac12 | 2014-12-05 11:10:15 -0800 | [diff] [blame] | 2010 | * @see #CONTROL_SCENE_MODE_HDR |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2011 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2012 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2013 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2014 | public static final Key<Integer> CONTROL_SCENE_MODE = |
| 2015 | new Key<Integer>("android.control.sceneMode", int.class); |
| 2016 | |
| 2017 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2018 | * <p>Whether video stabilization is |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2019 | * active.</p> |
Jianing Wei | 2813b0f | 2015-09-29 14:24:36 -0700 | [diff] [blame] | 2020 | * <p>Video stabilization automatically warps images from |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2021 | * the camera in order to stabilize motion between consecutive frames.</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2022 | * <p>If enabled, video stabilization can modify the |
Zhijun He | 45fa43a1 | 2014-06-13 18:29:37 -0700 | [diff] [blame] | 2023 | * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream stabilized.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2024 | * <p>Switching between different video stabilization modes may take several |
| 2025 | * frames to initialize, the camera device will report the current mode |
| 2026 | * in capture result metadata. For example, When "ON" mode is requested, |
| 2027 | * the video stabilization modes in the first several capture results may |
| 2028 | * still be "OFF", and it will become "ON" when the initialization is |
| 2029 | * done.</p> |
Jianing Wei | 2813b0f | 2015-09-29 14:24:36 -0700 | [diff] [blame] | 2030 | * <p>In addition, not all recording sizes or frame rates may be supported for |
| 2031 | * stabilization by a device that reports stabilization support. It is guaranteed |
| 2032 | * that an output targeting a MediaRecorder or MediaCodec will be stabilized if |
| 2033 | * the recording resolution is less than or equal to 1920 x 1080 (width less than |
| 2034 | * or equal to 1920, height less than or equal to 1080), and the recording |
| 2035 | * frame rate is less than or equal to 30fps. At other sizes, the CaptureResult |
| 2036 | * {@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode} field will return |
| 2037 | * OFF if the recording output is not stabilized, or if there are no output |
| 2038 | * Surface types that can be stabilized.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2039 | * <p>If a camera device supports both this mode and OIS |
| 2040 | * ({@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}), turning both modes on may |
| 2041 | * produce undesirable interaction, so it is recommended not to enable |
| 2042 | * both at the same time.</p> |
| 2043 | * <p><b>Possible values:</b> |
| 2044 | * <ul> |
| 2045 | * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_OFF OFF}</li> |
| 2046 | * <li>{@link #CONTROL_VIDEO_STABILIZATION_MODE_ON ON}</li> |
| 2047 | * </ul></p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2048 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 2049 | * |
Jianing Wei | 2813b0f | 2015-09-29 14:24:36 -0700 | [diff] [blame] | 2050 | * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE |
Zhijun He | 45fa43a1 | 2014-06-13 18:29:37 -0700 | [diff] [blame] | 2051 | * @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 2052 | * @see CaptureRequest#SCALER_CROP_REGION |
Zhijun He | 4793af5 | 2014-05-05 10:39:12 -0700 | [diff] [blame] | 2053 | * @see #CONTROL_VIDEO_STABILIZATION_MODE_OFF |
| 2054 | * @see #CONTROL_VIDEO_STABILIZATION_MODE_ON |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2055 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2056 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2057 | @NonNull |
Zhijun He | 4793af5 | 2014-05-05 10:39:12 -0700 | [diff] [blame] | 2058 | public static final Key<Integer> CONTROL_VIDEO_STABILIZATION_MODE = |
| 2059 | new Key<Integer>("android.control.videoStabilizationMode", int.class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2060 | |
| 2061 | /** |
Yin-Chia Yeh | 33052d3 | 2016-04-11 16:39:02 -0700 | [diff] [blame] | 2062 | * <p>The amount of additional sensitivity boost applied to output images |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 2063 | * after RAW sensor data is captured.</p> |
| 2064 | * <p>Some camera devices support additional digital sensitivity boosting in the |
| 2065 | * camera processing pipeline after sensor RAW image is captured. |
| 2066 | * Such a boost will be applied to YUV/JPEG format output images but will not |
| 2067 | * have effect on RAW output formats like RAW_SENSOR, RAW10, RAW12 or RAW_OPAQUE.</p> |
Yin-Chia Yeh | 33052d3 | 2016-04-11 16:39:02 -0700 | [diff] [blame] | 2068 | * <p>This key will be <code>null</code> for devices that do not support any RAW format |
| 2069 | * outputs. For devices that do support RAW format outputs, this key will always |
| 2070 | * present, and if a device does not support post RAW sensitivity boost, it will |
| 2071 | * list <code>100</code> in this key.</p> |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 2072 | * <p>If the camera device cannot apply the exact boost requested, it will reduce the |
| 2073 | * boost to the nearest supported value. |
| 2074 | * The final boost value used will be available in the output capture result.</p> |
| 2075 | * <p>For devices that support post RAW sensitivity boost, the YUV/JPEG output images |
| 2076 | * of such device will have the total sensitivity of |
Yin-Chia Yeh | 67e61b6 | 2016-01-26 13:27:35 -0800 | [diff] [blame] | 2077 | * <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost} / 100</code> |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 2078 | * The sensitivity of RAW format images will always be <code>{@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</code></p> |
| 2079 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to |
| 2080 | * OFF; otherwise the auto-exposure algorithm will override this value.</p> |
| 2081 | * <p><b>Units</b>: ISO arithmetic units, the same as {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}</p> |
| 2082 | * <p><b>Range of valid values:</b><br> |
| 2083 | * {@link CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE android.control.postRawSensitivityBoostRange}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2084 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 2085 | * |
| 2086 | * @see CaptureRequest#CONTROL_AE_MODE |
| 2087 | * @see CaptureRequest#CONTROL_MODE |
| 2088 | * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST |
| 2089 | * @see CameraCharacteristics#CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE |
| 2090 | * @see CaptureRequest#SENSOR_SENSITIVITY |
| 2091 | */ |
| 2092 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2093 | @NonNull |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 2094 | public static final Key<Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST = |
| 2095 | new Key<Integer>("android.control.postRawSensitivityBoost", int.class); |
| 2096 | |
| 2097 | /** |
Chien-Yu Chen | e449171 | 2017-01-11 11:14:06 -0800 | [diff] [blame] | 2098 | * <p>Allow camera device to enable zero-shutter-lag mode for requests with |
| 2099 | * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} == STILL_CAPTURE.</p> |
| 2100 | * <p>If enableZsl is <code>true</code>, the camera device may enable zero-shutter-lag mode for requests with |
| 2101 | * STILL_CAPTURE capture intent. The camera device may use images captured in the past to |
| 2102 | * produce output images for a zero-shutter-lag request. The result metadata including the |
| 2103 | * {@link CaptureResult#SENSOR_TIMESTAMP android.sensor.timestamp} reflects the source frames used to produce output images. |
| 2104 | * Therefore, the contents of the output images and the result metadata may be out of order |
| 2105 | * compared to previous regular requests. enableZsl does not affect requests with other |
| 2106 | * capture intents.</p> |
| 2107 | * <p>For example, when requests are submitted in the following order: |
| 2108 | * Request A: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is PREVIEW |
| 2109 | * Request B: enableZsl is ON, {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} is STILL_CAPTURE</p> |
| 2110 | * <p>The output images for request B may have contents captured before the output images for |
| 2111 | * request A, and the result metadata for request B may be older than the result metadata for |
| 2112 | * request A.</p> |
Chien-Yu Chen | 1d72ee3 | 2017-04-18 15:23:06 -0700 | [diff] [blame] | 2113 | * <p>Note that when enableZsl is <code>true</code>, it is not guaranteed to get output images captured in |
| 2114 | * the past for requests with STILL_CAPTURE capture intent.</p> |
| 2115 | * <p>For applications targeting SDK versions O and newer, the value of enableZsl in |
| 2116 | * TEMPLATE_STILL_CAPTURE template may be <code>true</code>. The value in other templates is always |
| 2117 | * <code>false</code> if present.</p> |
| 2118 | * <p>For applications targeting SDK versions older than O, the value of enableZsl in all |
| 2119 | * capture templates is always <code>false</code> if present.</p> |
Chien-Yu Chen | 8102638 | 2017-05-03 12:30:58 -0700 | [diff] [blame] | 2120 | * <p>For application-operated ZSL, use CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG template.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2121 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Chien-Yu Chen | e449171 | 2017-01-11 11:14:06 -0800 | [diff] [blame] | 2122 | * |
| 2123 | * @see CaptureRequest#CONTROL_CAPTURE_INTENT |
| 2124 | * @see CaptureResult#SENSOR_TIMESTAMP |
| 2125 | */ |
| 2126 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2127 | @NonNull |
Chien-Yu Chen | e449171 | 2017-01-11 11:14:06 -0800 | [diff] [blame] | 2128 | public static final Key<Boolean> CONTROL_ENABLE_ZSL = |
| 2129 | new Key<Boolean>("android.control.enableZsl", boolean.class); |
| 2130 | |
| 2131 | /** |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2132 | * <p>Whether extended scene mode is enabled for a particular capture request.</p> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2133 | * <p>With bokeh mode, the camera device may blur out the parts of scene that are not in |
| 2134 | * focus, creating a bokeh (or shallow depth of field) effect for people or objects.</p> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2135 | * <p>When set to BOKEH_STILL_CAPTURE mode with STILL_CAPTURE capture intent, due to the extra |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2136 | * processing needed for high quality bokeh effect, the stall may be longer than when |
| 2137 | * capture intent is not STILL_CAPTURE.</p> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2138 | * <p>When set to BOKEH_STILL_CAPTURE mode with PREVIEW capture intent,</p> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2139 | * <ul> |
| 2140 | * <li>If the camera device has BURST_CAPTURE capability, the frame rate requirement of |
| 2141 | * BURST_CAPTURE must still be met.</li> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2142 | * <li>All streams not larger than the maximum streaming dimension for BOKEH_STILL_CAPTURE mode |
| 2143 | * (queried via {@link android.hardware.camera2.CameraCharacteristics#CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES }) |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2144 | * will have preview bokeh effect applied.</li> |
| 2145 | * </ul> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2146 | * <p>When set to BOKEH_CONTINUOUS mode, configured streams dimension should not exceed this mode's |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2147 | * maximum streaming dimension in order to have bokeh effect applied. Bokeh effect may not |
| 2148 | * be available for streams larger than the maximum streaming dimension.</p> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2149 | * <p>Switching between different extended scene modes may involve reconfiguration of the camera |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2150 | * pipeline, resulting in long latency. The application should check this key against the |
| 2151 | * available session keys queried via |
| 2152 | * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</p> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2153 | * <p>For a logical multi-camera, bokeh may be implemented by stereo vision from sub-cameras |
| 2154 | * with different field of view. As a result, when bokeh mode is enabled, the camera device |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2155 | * may override {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, and the field of |
| 2156 | * view may be smaller than when bokeh mode is off.</p> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2157 | * <p><b>Possible values:</b> |
| 2158 | * <ul> |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2159 | * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_DISABLED DISABLED}</li> |
| 2160 | * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE BOKEH_STILL_CAPTURE}</li> |
| 2161 | * <li>{@link #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS BOKEH_CONTINUOUS}</li> |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2162 | * </ul></p> |
| 2163 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2164 | * |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2165 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2166 | * @see CaptureRequest#SCALER_CROP_REGION |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2167 | * @see #CONTROL_EXTENDED_SCENE_MODE_DISABLED |
| 2168 | * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE |
| 2169 | * @see #CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2170 | */ |
| 2171 | @PublicKey |
| 2172 | @NonNull |
Shuzhen Wang | 796863a | 2020-03-16 16:00:18 -0700 | [diff] [blame] | 2173 | public static final Key<Integer> CONTROL_EXTENDED_SCENE_MODE = |
| 2174 | new Key<Integer>("android.control.extendedSceneMode", int.class); |
Shuzhen Wang | 1ab8514 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 2175 | |
| 2176 | /** |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2177 | * <p>The desired zoom ratio</p> |
| 2178 | * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} with dual purposes of crop and zoom, the |
| 2179 | * application can now choose to use this tag to specify the desired zoom level. The |
| 2180 | * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} can still be used to specify the horizontal or vertical |
| 2181 | * crop to achieve aspect ratios different than the native camera sensor.</p> |
| 2182 | * <p>By using this control, the application gains a simpler way to control zoom, which can |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2183 | * be a combination of optical and digital zoom. For example, a multi-camera system may |
| 2184 | * contain more than one lens with different focal lengths, and the user can use optical |
| 2185 | * zoom by switching between lenses. Using zoomRatio has benefits in the scenarios below: |
| 2186 | * <em> Zooming in from a wide-angle lens to a telephoto lens: A floating-point ratio provides |
| 2187 | * better precision compared to an integer value of {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}. |
| 2188 | * </em> Zooming out from a wide lens to an ultrawide lens: zoomRatio supports zoom-out whereas |
| 2189 | * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} doesn't.</p> |
| 2190 | * <p>To illustrate, here are several scenarios of different zoom ratios, crop regions, |
| 2191 | * and output streams, for a hypothetical camera device with an active array of size |
| 2192 | * <code>(2000,1500)</code>.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2193 | * <ul> |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2194 | * <li>Camera Configuration:<ul> |
| 2195 | * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li> |
| 2196 | * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li> |
| 2197 | * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2198 | * </ul> |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2199 | * </li> |
| 2200 | * <li>Case #1: 4:3 crop region with 2.0x zoom ratio<ul> |
| 2201 | * <li>Zoomed field of view: 1/4 of original field of view</li> |
| 2202 | * <li>Crop region: <code>Rect(0, 0, 2000, 1500) // (left, top, right, bottom)</code> (post zoom)</li> |
| 2203 | * </ul> |
| 2204 | * </li> |
| 2205 | * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-43.png" /><ul> |
| 2206 | * <li><code>640x480</code> stream source area: <code>(0, 0, 2000, 1500)</code> (equal to crop region)</li> |
| 2207 | * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (letterboxed)</li> |
| 2208 | * </ul> |
| 2209 | * </li> |
| 2210 | * <li>Case #2: 16:9 crop region with 2.0x zoom.<ul> |
| 2211 | * <li>Zoomed field of view: 1/4 of original field of view</li> |
| 2212 | * <li>Crop region: <code>Rect(0, 187, 2000, 1312)</code></li> |
| 2213 | * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-2-crop-169.png" /></li> |
| 2214 | * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (pillarboxed)</li> |
| 2215 | * <li><code>1280x720</code> stream source area: <code>(0, 187, 2000, 1312)</code> (equal to crop region)</li> |
| 2216 | * </ul> |
| 2217 | * </li> |
| 2218 | * <li>Case #3: 1:1 crop region with 0.5x zoom out to ultrawide lens.<ul> |
| 2219 | * <li>Zoomed field of view: 4x of original field of view (switched from wide lens to ultrawide lens)</li> |
| 2220 | * <li>Crop region: <code>Rect(250, 0, 1750, 1500)</code></li> |
| 2221 | * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.control.zoomRatio/zoom-ratio-0.5-crop-11.png" /></li> |
| 2222 | * <li><code>640x480</code> stream source area: <code>(250, 187, 1750, 1312)</code> (letterboxed)</li> |
| 2223 | * <li><code>1280x720</code> stream source area: <code>(250, 328, 1750, 1172)</code> (letterboxed)</li> |
| 2224 | * </ul> |
| 2225 | * </li> |
| 2226 | * </ul> |
| 2227 | * <p>As seen from the graphs above, the coordinate system of cropRegion now changes to the |
| 2228 | * effective after-zoom field-of-view, and is represented by the rectangle of (0, 0, |
| 2229 | * activeArrayWith, activeArrayHeight). The same applies to AE/AWB/AF regions, and faces. |
| 2230 | * This coordinate system change isn't applicable to RAW capture and its related |
| 2231 | * metadata such as intrinsicCalibration and lensShadingMap.</p> |
| 2232 | * <p>Using the same hypothetical example above, and assuming output stream #1 (640x480) is |
| 2233 | * the viewfinder stream, the application can achieve 2.0x zoom in one of two ways:</p> |
| 2234 | * <ul> |
| 2235 | * <li>zoomRatio = 2.0, scaler.cropRegion = (0, 0, 2000, 1500)</li> |
| 2236 | * <li>zoomRatio = 1.0 (default), scaler.cropRegion = (500, 375, 1500, 1125)</li> |
| 2237 | * </ul> |
| 2238 | * <p>If the application intends to set aeRegions to be top-left quarter of the viewfinder |
| 2239 | * field-of-view, the {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions} should be set to (0, 0, 1000, 750) with |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2240 | * zoomRatio set to 2.0. Alternatively, the application can set aeRegions to the equivalent |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2241 | * region of (500, 375, 1000, 750) for zoomRatio of 1.0. If the application doesn't |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2242 | * explicitly set {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}, its value defaults to 1.0.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2243 | * <p>One limitation of controlling zoom using zoomRatio is that the {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} |
| 2244 | * must only be used for letterboxing or pillarboxing of the sensor active array, and no |
| 2245 | * FREEFORM cropping can be used with {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} other than 1.0.</p> |
| 2246 | * <p><b>Range of valid values:</b><br> |
| 2247 | * {@link CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE android.control.zoomRatioRange}</p> |
| 2248 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
| 2249 | * <p><b>Limited capability</b> - |
| 2250 | * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the |
| 2251 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
| 2252 | * |
| 2253 | * @see CaptureRequest#CONTROL_AE_REGIONS |
| 2254 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
| 2255 | * @see CameraCharacteristics#CONTROL_ZOOM_RATIO_RANGE |
| 2256 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
| 2257 | * @see CaptureRequest#SCALER_CROP_REGION |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2258 | */ |
| 2259 | @PublicKey |
| 2260 | @NonNull |
| 2261 | public static final Key<Float> CONTROL_ZOOM_RATIO = |
| 2262 | new Key<Float>("android.control.zoomRatio", float.class); |
| 2263 | |
| 2264 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2265 | * <p>Operation mode for edge |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 2266 | * enhancement.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2267 | * <p>Edge enhancement improves sharpness and details in the captured image. OFF means |
| 2268 | * no enhancement will be applied by the camera device.</p> |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 2269 | * <p>FAST/HIGH_QUALITY both mean camera device determined enhancement |
Zhijun He | 2807936 | 2013-12-17 10:35:40 -0800 | [diff] [blame] | 2270 | * will be applied. HIGH_QUALITY mode indicates that the |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 2271 | * camera device will use the highest-quality enhancement algorithms, |
| 2272 | * even if it slows down capture rate. FAST means the camera device will |
Chien-Yu Chen | 9c9167e | 2015-07-14 16:38:25 -0700 | [diff] [blame] | 2273 | * not slow down capture rate when applying edge enhancement. FAST may be the same as OFF if |
| 2274 | * edge enhancement will slow down capture rate. Every output stream will have a similar |
| 2275 | * amount of enhancement applied.</p> |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2276 | * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular |
| 2277 | * buffer of high-resolution images during preview and reprocess image(s) from that buffer |
| 2278 | * into a final capture when triggered by the user. In this mode, the camera device applies |
| 2279 | * edge enhancement to low-resolution streams (below maximum recording resolution) to |
| 2280 | * maximize preview quality, but does not apply edge enhancement to high-resolution streams, |
| 2281 | * since those will be reprocessed later if necessary.</p> |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2282 | * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera |
| 2283 | * device will apply FAST/HIGH_QUALITY YUV-domain edge enhancement, respectively. |
Chien-Yu Chen | 9c9167e | 2015-07-14 16:38:25 -0700 | [diff] [blame] | 2284 | * The camera device may adjust its internal edge enhancement parameters for best |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2285 | * image quality based on the {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor}, if it is set.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2286 | * <p><b>Possible values:</b> |
| 2287 | * <ul> |
| 2288 | * <li>{@link #EDGE_MODE_OFF OFF}</li> |
| 2289 | * <li>{@link #EDGE_MODE_FAST FAST}</li> |
| 2290 | * <li>{@link #EDGE_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2291 | * <li>{@link #EDGE_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2292 | * </ul></p> |
| 2293 | * <p><b>Available values for this device:</b><br> |
| 2294 | * {@link CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES android.edge.availableEdgeModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2295 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2296 | * <p><b>Full capability</b> - |
| 2297 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2298 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Ruben Brunk | 6dc379c | 2014-03-04 15:04:00 -0800 | [diff] [blame] | 2299 | * |
| 2300 | * @see CameraCharacteristics#EDGE_AVAILABLE_EDGE_MODES |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2301 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2302 | * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2303 | * @see #EDGE_MODE_OFF |
| 2304 | * @see #EDGE_MODE_FAST |
| 2305 | * @see #EDGE_MODE_HIGH_QUALITY |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2306 | * @see #EDGE_MODE_ZERO_SHUTTER_LAG |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2307 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2308 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2309 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2310 | public static final Key<Integer> EDGE_MODE = |
| 2311 | new Key<Integer>("android.edge.mode", int.class); |
| 2312 | |
| 2313 | /** |
Zhijun He | 66d065a | 2014-01-16 18:18:50 -0800 | [diff] [blame] | 2314 | * <p>The desired mode for for the camera device's flash control.</p> |
| 2315 | * <p>This control is only effective when flash unit is available |
Zhijun He | 153ac10 | 2014-02-03 12:25:12 -0800 | [diff] [blame] | 2316 | * (<code>{@link CameraCharacteristics#FLASH_INFO_AVAILABLE android.flash.info.available} == true</code>).</p> |
Zhijun He | 66d065a | 2014-01-16 18:18:50 -0800 | [diff] [blame] | 2317 | * <p>When this control is used, the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} must be set to ON or OFF. |
| 2318 | * Otherwise, the camera device auto-exposure related flash control (ON_AUTO_FLASH, |
| 2319 | * ON_ALWAYS_FLASH, or ON_AUTO_FLASH_REDEYE) will override this control.</p> |
| 2320 | * <p>When set to OFF, the camera device will not fire flash for this capture.</p> |
| 2321 | * <p>When set to SINGLE, the camera device will fire flash regardless of the camera |
| 2322 | * device's auto-exposure routine's result. When used in still capture case, this |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2323 | * control should be used along with auto-exposure (AE) precapture metering sequence |
Zhijun He | 66d065a | 2014-01-16 18:18:50 -0800 | [diff] [blame] | 2324 | * ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p> |
| 2325 | * <p>When set to TORCH, the flash will be on continuously. This mode can be used |
| 2326 | * for use cases such as preview, auto-focus assist, still capture, or video recording.</p> |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2327 | * <p>The flash status will be reported by {@link CaptureResult#FLASH_STATE android.flash.state} in the capture result metadata.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2328 | * <p><b>Possible values:</b> |
| 2329 | * <ul> |
| 2330 | * <li>{@link #FLASH_MODE_OFF OFF}</li> |
| 2331 | * <li>{@link #FLASH_MODE_SINGLE SINGLE}</li> |
| 2332 | * <li>{@link #FLASH_MODE_TORCH TORCH}</li> |
| 2333 | * </ul></p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2334 | * <p>This key is available on all devices.</p> |
Zhijun He | 66d065a | 2014-01-16 18:18:50 -0800 | [diff] [blame] | 2335 | * |
| 2336 | * @see CaptureRequest#CONTROL_AE_MODE |
| 2337 | * @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER |
| 2338 | * @see CameraCharacteristics#FLASH_INFO_AVAILABLE |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2339 | * @see CaptureResult#FLASH_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2340 | * @see #FLASH_MODE_OFF |
| 2341 | * @see #FLASH_MODE_SINGLE |
| 2342 | * @see #FLASH_MODE_TORCH |
| 2343 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2344 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2345 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2346 | public static final Key<Integer> FLASH_MODE = |
| 2347 | new Key<Integer>("android.flash.mode", int.class); |
| 2348 | |
| 2349 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2350 | * <p>Operational mode for hot pixel correction.</p> |
Ruben Brunk | eba1b3a | 2014-02-07 18:23:50 -0800 | [diff] [blame] | 2351 | * <p>Hotpixel correction interpolates out, or otherwise removes, pixels |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2352 | * that do not accurately measure the incoming light (i.e. pixels that |
| 2353 | * are stuck at an arbitrary value or are oversensitive).</p> |
| 2354 | * <p><b>Possible values:</b> |
| 2355 | * <ul> |
| 2356 | * <li>{@link #HOT_PIXEL_MODE_OFF OFF}</li> |
| 2357 | * <li>{@link #HOT_PIXEL_MODE_FAST FAST}</li> |
| 2358 | * <li>{@link #HOT_PIXEL_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
| 2359 | * </ul></p> |
| 2360 | * <p><b>Available values for this device:</b><br> |
| 2361 | * {@link CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES android.hotPixel.availableHotPixelModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2362 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Ruben Brunk | 9d454fd | 2014-03-04 14:11:52 -0800 | [diff] [blame] | 2363 | * |
| 2364 | * @see CameraCharacteristics#HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES |
Ruben Brunk | eba1b3a | 2014-02-07 18:23:50 -0800 | [diff] [blame] | 2365 | * @see #HOT_PIXEL_MODE_OFF |
| 2366 | * @see #HOT_PIXEL_MODE_FAST |
| 2367 | * @see #HOT_PIXEL_MODE_HIGH_QUALITY |
| 2368 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2369 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2370 | @NonNull |
Ruben Brunk | eba1b3a | 2014-02-07 18:23:50 -0800 | [diff] [blame] | 2371 | public static final Key<Integer> HOT_PIXEL_MODE = |
| 2372 | new Key<Integer>("android.hotPixel.mode", int.class); |
| 2373 | |
| 2374 | /** |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2375 | * <p>A location object to use when generating image GPS metadata.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2376 | * <p>Setting a location object in a request will include the GPS coordinates of the location |
| 2377 | * into any JPEG images captured based on the request. These coordinates can then be |
| 2378 | * viewed by anyone who receives the JPEG image.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2379 | * <p>This tag is also used for HEIC image capture.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2380 | * <p>This key is available on all devices.</p> |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2381 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2382 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2383 | @NonNull |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2384 | @SyntheticKey |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2385 | public static final Key<android.location.Location> JPEG_GPS_LOCATION = |
| 2386 | new Key<android.location.Location>("android.jpeg.gpsLocation", android.location.Location.class); |
| 2387 | |
| 2388 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2389 | * <p>GPS coordinates to include in output JPEG |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2390 | * EXIF.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2391 | * <p>This tag is also used for HEIC image capture.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2392 | * <p><b>Range of valid values:</b><br> |
| 2393 | * (-180 - 180], [-90,90], [-inf, inf]</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2394 | * <p>This key is available on all devices.</p> |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2395 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2396 | */ |
| 2397 | public static final Key<double[]> JPEG_GPS_COORDINATES = |
| 2398 | new Key<double[]>("android.jpeg.gpsCoordinates", double[].class); |
| 2399 | |
| 2400 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2401 | * <p>32 characters describing GPS algorithm to |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2402 | * include in EXIF.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2403 | * <p>This tag is also used for HEIC image capture.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2404 | * <p>This key is available on all devices.</p> |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2405 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2406 | */ |
| 2407 | public static final Key<String> JPEG_GPS_PROCESSING_METHOD = |
| 2408 | new Key<String>("android.jpeg.gpsProcessingMethod", String.class); |
| 2409 | |
| 2410 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2411 | * <p>Time GPS fix was made to include in |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2412 | * EXIF.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2413 | * <p>This tag is also used for HEIC image capture.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2414 | * <p><b>Units</b>: UTC in seconds since January 1, 1970</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2415 | * <p>This key is available on all devices.</p> |
Ruben Brunk | 5749368 | 2014-05-27 18:58:08 -0700 | [diff] [blame] | 2416 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2417 | */ |
| 2418 | public static final Key<Long> JPEG_GPS_TIMESTAMP = |
| 2419 | new Key<Long>("android.jpeg.gpsTimestamp", long.class); |
| 2420 | |
| 2421 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2422 | * <p>The orientation for a JPEG image.</p> |
| 2423 | * <p>The clockwise rotation angle in degrees, relative to the orientation |
| 2424 | * to the camera, that the JPEG picture needs to be rotated by, to be viewed |
| 2425 | * upright.</p> |
| 2426 | * <p>Camera devices may either encode this value into the JPEG EXIF header, or |
Yin-Chia Yeh | d49ebcc | 2015-03-27 13:54:04 -0700 | [diff] [blame] | 2427 | * rotate the image data to match this orientation. When the image data is rotated, |
| 2428 | * the thumbnail data will also be rotated.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2429 | * <p>Note that this orientation is relative to the orientation of the camera sensor, given |
| 2430 | * by {@link CameraCharacteristics#SENSOR_ORIENTATION android.sensor.orientation}.</p> |
Emilian Peev | 3abc751 | 2018-03-28 11:22:26 +0100 | [diff] [blame] | 2431 | * <p>To translate from the device orientation given by the Android sensor APIs for camera |
| 2432 | * sensors which are not EXTERNAL, the following sample code may be used:</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2433 | * <pre><code>private int getJpegOrientation(CameraCharacteristics c, int deviceOrientation) { |
| 2434 | * if (deviceOrientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) return 0; |
| 2435 | * int sensorOrientation = c.get(CameraCharacteristics.SENSOR_ORIENTATION); |
| 2436 | * |
| 2437 | * // Round device orientation to a multiple of 90 |
| 2438 | * deviceOrientation = (deviceOrientation + 45) / 90 * 90; |
| 2439 | * |
| 2440 | * // Reverse device orientation for front-facing cameras |
| 2441 | * boolean facingFront = c.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT; |
| 2442 | * if (facingFront) deviceOrientation = -deviceOrientation; |
| 2443 | * |
| 2444 | * // Calculate desired JPEG orientation relative to camera orientation to make |
| 2445 | * // the image upright relative to the device orientation |
| 2446 | * int jpegOrientation = (sensorOrientation + deviceOrientation + 360) % 360; |
| 2447 | * |
| 2448 | * return jpegOrientation; |
| 2449 | * } |
| 2450 | * </code></pre> |
Emilian Peev | 3abc751 | 2018-03-28 11:22:26 +0100 | [diff] [blame] | 2451 | * <p>For EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will |
| 2452 | * also be set to EXTERNAL. The above code is not relevant in such case.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2453 | * <p>This tag is also used to describe the orientation of the HEIC image capture, in which |
| 2454 | * case the rotation is reflected by |
| 2455 | * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by |
| 2456 | * rotating the image data itself.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2457 | * <p><b>Units</b>: Degrees in multiples of 90</p> |
| 2458 | * <p><b>Range of valid values:</b><br> |
| 2459 | * 0, 90, 180, 270</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2460 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2461 | * |
| 2462 | * @see CameraCharacteristics#SENSOR_ORIENTATION |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2463 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2464 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2465 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2466 | public static final Key<Integer> JPEG_ORIENTATION = |
| 2467 | new Key<Integer>("android.jpeg.orientation", int.class); |
| 2468 | |
| 2469 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2470 | * <p>Compression quality of the final JPEG |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2471 | * image.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2472 | * <p>85-95 is typical usage range. This tag is also used to describe the quality |
| 2473 | * of the HEIC image capture.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2474 | * <p><b>Range of valid values:</b><br> |
| 2475 | * 1-100; larger is higher quality</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2476 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2477 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2478 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2479 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2480 | public static final Key<Byte> JPEG_QUALITY = |
| 2481 | new Key<Byte>("android.jpeg.quality", byte.class); |
| 2482 | |
| 2483 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2484 | * <p>Compression quality of JPEG |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2485 | * thumbnail.</p> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2486 | * <p>This tag is also used to describe the quality of the HEIC image capture.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2487 | * <p><b>Range of valid values:</b><br> |
| 2488 | * 1-100; larger is higher quality</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2489 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2490 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2491 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2492 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2493 | public static final Key<Byte> JPEG_THUMBNAIL_QUALITY = |
| 2494 | new Key<Byte>("android.jpeg.thumbnailQuality", byte.class); |
| 2495 | |
| 2496 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2497 | * <p>Resolution of embedded JPEG thumbnail.</p> |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 2498 | * <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail, |
| 2499 | * but the captured JPEG will still be a valid image.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2500 | * <p>For best results, when issuing a request for a JPEG image, the thumbnail size selected |
| 2501 | * should have the same aspect ratio as the main JPEG output.</p> |
Zhijun He | 50f7243 | 2014-05-28 13:52:04 -0700 | [diff] [blame] | 2502 | * <p>If the thumbnail image aspect ratio differs from the JPEG primary image aspect |
| 2503 | * ratio, the camera device creates the thumbnail by cropping it from the primary image. |
| 2504 | * For example, if the primary image has 4:3 aspect ratio, the thumbnail image has |
| 2505 | * 16:9 aspect ratio, the primary image will be cropped vertically (letterbox) to |
| 2506 | * generate the thumbnail image. The thumbnail image will always have a smaller Field |
| 2507 | * Of View (FOV) than the primary image when aspect ratios differ.</p> |
Yin-Chia Yeh | 5988311 | 2015-06-22 15:51:40 -0700 | [diff] [blame] | 2508 | * <p>When an {@link CaptureRequest#JPEG_ORIENTATION android.jpeg.orientation} of non-zero degree is requested, |
| 2509 | * the camera device will handle thumbnail rotation in one of the following ways:</p> |
| 2510 | * <ul> |
| 2511 | * <li>Set the {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag} |
| 2512 | * and keep jpeg and thumbnail image data unrotated.</li> |
| 2513 | * <li>Rotate the jpeg and thumbnail image data and not set |
| 2514 | * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}. In this |
| 2515 | * case, LIMITED or FULL hardware level devices will report rotated thumnail size in |
| 2516 | * capture result, so the width and height will be interchanged if 90 or 270 degree |
| 2517 | * orientation is requested. LEGACY device will always report unrotated thumbnail |
| 2518 | * size.</li> |
| 2519 | * </ul> |
Shuzhen Wang | f655b1c | 2018-12-28 15:40:36 -0800 | [diff] [blame] | 2520 | * <p>The tag is also used as thumbnail size for HEIC image format capture, in which case the |
| 2521 | * the thumbnail rotation is reflected by |
| 2522 | * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by |
| 2523 | * rotating the thumbnail data itself.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2524 | * <p><b>Range of valid values:</b><br> |
| 2525 | * {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2526 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2527 | * |
| 2528 | * @see CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES |
Yin-Chia Yeh | 5988311 | 2015-06-22 15:51:40 -0700 | [diff] [blame] | 2529 | * @see CaptureRequest#JPEG_ORIENTATION |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2530 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2531 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2532 | @NonNull |
Igor Murashkin | 72f9f0a | 2014-05-14 15:46:10 -0700 | [diff] [blame] | 2533 | public static final Key<android.util.Size> JPEG_THUMBNAIL_SIZE = |
| 2534 | new Key<android.util.Size>("android.jpeg.thumbnailSize", android.util.Size.class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2535 | |
| 2536 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2537 | * <p>The desired lens aperture size, as a ratio of lens focal length to the |
| 2538 | * effective aperture diameter.</p> |
| 2539 | * <p>Setting this value is only supported on the camera devices that have a variable |
| 2540 | * aperture lens.</p> |
Zhijun He | fb46c64 | 2014-01-14 17:57:23 -0800 | [diff] [blame] | 2541 | * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is OFF, |
| 2542 | * this can be set along with {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 2543 | * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration} |
Zhijun He | fb46c64 | 2014-01-14 17:57:23 -0800 | [diff] [blame] | 2544 | * to achieve manual exposure control.</p> |
| 2545 | * <p>The requested aperture value may take several frames to reach the |
| 2546 | * requested value; the camera device will report the current (intermediate) |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2547 | * aperture size in capture result metadata while the aperture is changing. |
| 2548 | * While the aperture is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> |
Zhijun He | fb46c64 | 2014-01-14 17:57:23 -0800 | [diff] [blame] | 2549 | * <p>When this is supported and {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is one of |
| 2550 | * the ON modes, this will be overridden by the camera device |
| 2551 | * auto-exposure algorithm, the overridden values are then provided |
| 2552 | * back to the user in the corresponding result.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2553 | * <p><b>Units</b>: The f-number (f/N)</p> |
| 2554 | * <p><b>Range of valid values:</b><br> |
| 2555 | * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES android.lens.info.availableApertures}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2556 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2557 | * <p><b>Full capability</b> - |
| 2558 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2559 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Zhijun He | fb46c64 | 2014-01-14 17:57:23 -0800 | [diff] [blame] | 2560 | * |
Zhijun He | 399f05d | 2014-01-15 11:31:30 -0800 | [diff] [blame] | 2561 | * @see CaptureRequest#CONTROL_AE_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2562 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 2563 | * @see CameraCharacteristics#LENS_INFO_AVAILABLE_APERTURES |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2564 | * @see CaptureResult#LENS_STATE |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 2565 | * @see CaptureRequest#SENSOR_EXPOSURE_TIME |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 2566 | * @see CaptureRequest#SENSOR_FRAME_DURATION |
Eino-Ville Talvala | 265b34c | 2014-01-16 16:18:52 -0800 | [diff] [blame] | 2567 | * @see CaptureRequest#SENSOR_SENSITIVITY |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2568 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2569 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2570 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2571 | public static final Key<Float> LENS_APERTURE = |
| 2572 | new Key<Float>("android.lens.aperture", float.class); |
| 2573 | |
| 2574 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2575 | * <p>The desired setting for the lens neutral density filter(s).</p> |
| 2576 | * <p>This control will not be supported on most camera devices.</p> |
Ruben Brunk | 855bae4 | 2014-01-17 10:30:32 -0800 | [diff] [blame] | 2577 | * <p>Lens filters are typically used to lower the amount of light the |
| 2578 | * sensor is exposed to (measured in steps of EV). As used here, an EV |
| 2579 | * step is the standard logarithmic representation, which are |
| 2580 | * non-negative, and inversely proportional to the amount of light |
| 2581 | * hitting the sensor. For example, setting this to 0 would result |
| 2582 | * in no reduction of the incoming light, and setting this to 2 would |
| 2583 | * mean that the filter is set to reduce incoming light by two stops |
| 2584 | * (allowing 1/4 of the prior amount of light to the sensor).</p> |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2585 | * <p>It may take several frames before the lens filter density changes |
| 2586 | * to the requested value. While the filter density is still changing, |
| 2587 | * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2588 | * <p><b>Units</b>: Exposure Value (EV)</p> |
| 2589 | * <p><b>Range of valid values:</b><br> |
| 2590 | * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES android.lens.info.availableFilterDensities}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2591 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2592 | * <p><b>Full capability</b> - |
| 2593 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2594 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Ruben Brunk | 855bae4 | 2014-01-17 10:30:32 -0800 | [diff] [blame] | 2595 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2596 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Ruben Brunk | 855bae4 | 2014-01-17 10:30:32 -0800 | [diff] [blame] | 2597 | * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FILTER_DENSITIES |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2598 | * @see CaptureResult#LENS_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2599 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2600 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2601 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2602 | public static final Key<Float> LENS_FILTER_DENSITY = |
| 2603 | new Key<Float>("android.lens.filterDensity", float.class); |
| 2604 | |
| 2605 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2606 | * <p>The desired lens focal length; used for optical zoom.</p> |
Ruben Brunk | a20f4c2 | 2014-01-17 15:21:13 -0800 | [diff] [blame] | 2607 | * <p>This setting controls the physical focal length of the camera |
| 2608 | * device's lens. Changing the focal length changes the field of |
| 2609 | * view of the camera device, and is usually used for optical zoom.</p> |
| 2610 | * <p>Like {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} and {@link CaptureRequest#LENS_APERTURE android.lens.aperture}, this |
| 2611 | * setting won't be applied instantaneously, and it may take several |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2612 | * frames before the lens can change to the requested focal length. |
Ruben Brunk | a20f4c2 | 2014-01-17 15:21:13 -0800 | [diff] [blame] | 2613 | * While the focal length is still changing, {@link CaptureResult#LENS_STATE android.lens.state} will |
| 2614 | * be set to MOVING.</p> |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2615 | * <p>Optical zoom via this control will not be supported on most devices. Starting from API |
| 2616 | * level 30, the camera device may combine optical and digital zoom through the |
| 2617 | * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} control.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2618 | * <p><b>Units</b>: Millimeters</p> |
| 2619 | * <p><b>Range of valid values:</b><br> |
| 2620 | * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS android.lens.info.availableFocalLengths}</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2621 | * <p>This key is available on all devices.</p> |
Ruben Brunk | a20f4c2 | 2014-01-17 15:21:13 -0800 | [diff] [blame] | 2622 | * |
Shuzhen Wang | 69cf0fd | 2020-03-13 09:40:58 -0700 | [diff] [blame] | 2623 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Ruben Brunk | a20f4c2 | 2014-01-17 15:21:13 -0800 | [diff] [blame] | 2624 | * @see CaptureRequest#LENS_APERTURE |
| 2625 | * @see CaptureRequest#LENS_FOCUS_DISTANCE |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2626 | * @see CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS |
Ruben Brunk | a20f4c2 | 2014-01-17 15:21:13 -0800 | [diff] [blame] | 2627 | * @see CaptureResult#LENS_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2628 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2629 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2630 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2631 | public static final Key<Float> LENS_FOCAL_LENGTH = |
| 2632 | new Key<Float>("android.lens.focalLength", float.class); |
| 2633 | |
| 2634 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2635 | * <p>Desired distance to plane of sharpest focus, |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2636 | * measured from frontmost surface of the lens.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2637 | * <p>This control can be used for setting manual focus, on devices that support |
| 2638 | * the MANUAL_SENSOR capability and have a variable-focus lens (see |
| 2639 | * {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}).</p> |
| 2640 | * <p>A value of <code>0.0f</code> means infinity focus. The value set will be clamped to |
| 2641 | * <code>[0.0f, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}]</code>.</p> |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2642 | * <p>Like {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, this setting won't be applied |
| 2643 | * instantaneously, and it may take several frames before the lens |
| 2644 | * can move to the requested focus distance. While the lens is still moving, |
| 2645 | * {@link CaptureResult#LENS_STATE android.lens.state} will be set to MOVING.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2646 | * <p>LEGACY devices support at most setting this to <code>0.0f</code> |
| 2647 | * for infinity focus.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2648 | * <p><b>Units</b>: See {@link CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION android.lens.info.focusDistanceCalibration} for details</p> |
| 2649 | * <p><b>Range of valid values:</b><br> |
| 2650 | * >= 0</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2651 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2652 | * <p><b>Full capability</b> - |
| 2653 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2654 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2655 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2656 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2657 | * @see CaptureRequest#LENS_FOCAL_LENGTH |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2658 | * @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION |
Zhijun He | ca1b73a | 2014-02-03 12:39:53 -0800 | [diff] [blame] | 2659 | * @see CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE |
| 2660 | * @see CaptureResult#LENS_STATE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2661 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2662 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2663 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2664 | public static final Key<Float> LENS_FOCUS_DISTANCE = |
| 2665 | new Key<Float>("android.lens.focusDistance", float.class); |
| 2666 | |
| 2667 | /** |
Ruben Brunk | 00849b3 | 2014-01-17 18:30:23 -0800 | [diff] [blame] | 2668 | * <p>Sets whether the camera device uses optical image stabilization (OIS) |
| 2669 | * when capturing images.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2670 | * <p>OIS is used to compensate for motion blur due to small |
| 2671 | * movements of the camera during capture. Unlike digital image |
| 2672 | * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS |
| 2673 | * makes use of mechanical elements to stabilize the camera |
| 2674 | * sensor, and thus allows for longer exposure times before |
| 2675 | * camera shake becomes apparent.</p> |
Zhijun He | 45fa43a1 | 2014-06-13 18:29:37 -0700 | [diff] [blame] | 2676 | * <p>Switching between different optical stabilization modes may take several |
| 2677 | * frames to initialize, the camera device will report the current mode in |
| 2678 | * capture result metadata. For example, When "ON" mode is requested, the |
| 2679 | * optical stabilization modes in the first several capture results may still |
| 2680 | * be "OFF", and it will become "ON" when the initialization is done.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2681 | * <p>If a camera device supports both OIS and digital image stabilization |
| 2682 | * ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), turning both modes on may produce undesirable |
| 2683 | * interaction, so it is recommended not to enable both at the same time.</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2684 | * <p>Not all devices will support OIS; see |
| 2685 | * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for |
| 2686 | * available controls.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2687 | * <p><b>Possible values:</b> |
| 2688 | * <ul> |
| 2689 | * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_OFF OFF}</li> |
| 2690 | * <li>{@link #LENS_OPTICAL_STABILIZATION_MODE_ON ON}</li> |
| 2691 | * </ul></p> |
| 2692 | * <p><b>Available values for this device:</b><br> |
| 2693 | * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2694 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2695 | * <p><b>Limited capability</b> - |
| 2696 | * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the |
| 2697 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2698 | * |
| 2699 | * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2700 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2701 | * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2702 | * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF |
| 2703 | * @see #LENS_OPTICAL_STABILIZATION_MODE_ON |
| 2704 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2705 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2706 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2707 | public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE = |
| 2708 | new Key<Integer>("android.lens.opticalStabilizationMode", int.class); |
| 2709 | |
| 2710 | /** |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2711 | * <p>Mode of operation for the noise reduction algorithm.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2712 | * <p>The noise reduction algorithm attempts to improve image quality by removing |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2713 | * excessive noise added by the capture process, especially in dark conditions.</p> |
| 2714 | * <p>OFF means no noise reduction will be applied by the camera device, for both raw and |
| 2715 | * YUV domain.</p> |
| 2716 | * <p>MINIMAL means that only sensor raw domain basic noise reduction is enabled ,to remove |
| 2717 | * demosaicing or other processing artifacts. For YUV_REPROCESSING, MINIMAL is same as OFF. |
| 2718 | * This mode is optional, may not be support by all devices. The application should check |
| 2719 | * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes} before using it.</p> |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 2720 | * <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering |
| 2721 | * will be applied. HIGH_QUALITY mode indicates that the camera device |
| 2722 | * will use the highest-quality noise filtering algorithms, |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 2723 | * even if it slows down capture rate. FAST means the camera device will not |
Chien-Yu Chen | 9c9167e | 2015-07-14 16:38:25 -0700 | [diff] [blame] | 2724 | * slow down capture rate when applying noise filtering. FAST may be the same as MINIMAL if |
| 2725 | * MINIMAL is listed, or the same as OFF if any noise filtering will slow down capture rate. |
| 2726 | * Every output stream will have a similar amount of enhancement applied.</p> |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2727 | * <p>ZERO_SHUTTER_LAG is meant to be used by applications that maintain a continuous circular |
| 2728 | * buffer of high-resolution images during preview and reprocess image(s) from that buffer |
| 2729 | * into a final capture when triggered by the user. In this mode, the camera device applies |
| 2730 | * noise reduction to low-resolution streams (below maximum recording resolution) to maximize |
| 2731 | * preview quality, but does not apply noise reduction to high-resolution streams, since |
| 2732 | * those will be reprocessed later if necessary.</p> |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2733 | * <p>For YUV_REPROCESSING, these FAST/HIGH_QUALITY modes both mean that the camera device |
| 2734 | * will apply FAST/HIGH_QUALITY YUV domain noise reduction, respectively. The camera device |
| 2735 | * may adjust the noise reduction parameters for best image quality based on the |
| 2736 | * {@link CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR android.reprocess.effectiveExposureFactor} if it is set.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2737 | * <p><b>Possible values:</b> |
| 2738 | * <ul> |
| 2739 | * <li>{@link #NOISE_REDUCTION_MODE_OFF OFF}</li> |
| 2740 | * <li>{@link #NOISE_REDUCTION_MODE_FAST FAST}</li> |
| 2741 | * <li>{@link #NOISE_REDUCTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2742 | * <li>{@link #NOISE_REDUCTION_MODE_MINIMAL MINIMAL}</li> |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2743 | * <li>{@link #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG ZERO_SHUTTER_LAG}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2744 | * </ul></p> |
| 2745 | * <p><b>Available values for this device:</b><br> |
| 2746 | * {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2747 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2748 | * <p><b>Full capability</b> - |
| 2749 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2750 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Ruben Brunk | 6dc379c | 2014-03-04 15:04:00 -0800 | [diff] [blame] | 2751 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2752 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Ruben Brunk | 6dc379c | 2014-03-04 15:04:00 -0800 | [diff] [blame] | 2753 | * @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2754 | * @see CaptureRequest#REPROCESS_EFFECTIVE_EXPOSURE_FACTOR |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2755 | * @see #NOISE_REDUCTION_MODE_OFF |
| 2756 | * @see #NOISE_REDUCTION_MODE_FAST |
| 2757 | * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 2758 | * @see #NOISE_REDUCTION_MODE_MINIMAL |
Eino-Ville Talvala | 0dd1750 | 2015-07-07 10:43:07 -0700 | [diff] [blame] | 2759 | * @see #NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2760 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2761 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2762 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2763 | public static final Key<Integer> NOISE_REDUCTION_MODE = |
| 2764 | new Key<Integer>("android.noiseReduction.mode", int.class); |
| 2765 | |
| 2766 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2767 | * <p>An application-specified ID for the current |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2768 | * request. Must be maintained unchanged in output |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2769 | * frame</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2770 | * <p><b>Units</b>: arbitrary integer assigned by application</p> |
| 2771 | * <p><b>Range of valid values:</b><br> |
| 2772 | * Any int</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2773 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2774 | * @hide |
| 2775 | */ |
| 2776 | public static final Key<Integer> REQUEST_ID = |
| 2777 | new Key<Integer>("android.request.id", int.class); |
| 2778 | |
| 2779 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2780 | * <p>The desired region of the sensor to read out for this capture.</p> |
| 2781 | * <p>This control can be used to implement digital zoom.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2782 | * <p>For devices not supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate |
| 2783 | * system always follows that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being |
| 2784 | * the top-left pixel of the active array.</p> |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2785 | * <p>For devices supporting {@link CaptureRequest#DISTORTION_CORRECTION_MODE android.distortionCorrection.mode} control, the coordinate system |
| 2786 | * depends on the mode being set. When the distortion correction mode is OFF, the |
| 2787 | * coordinate system follows {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, with <code>(0, |
| 2788 | * 0)</code> being the top-left pixel of the pre-correction active array. When the distortion |
| 2789 | * correction mode is not OFF, the coordinate system follows |
| 2790 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the top-left pixel of the |
| 2791 | * active array.</p> |
| 2792 | * <p>Output streams use this rectangle to produce their output, cropping to a smaller region |
| 2793 | * if necessary to maintain the stream's aspect ratio, then scaling the sensor input to |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2794 | * match the output's configured resolution.</p> |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2795 | * <p>The crop region is applied after the RAW to other color space (e.g. YUV) |
| 2796 | * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage, they are not |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2797 | * croppable. The crop region will be ignored by raw streams.</p> |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2798 | * <p>For non-raw streams, any additional per-stream cropping will be done to maximize the |
| 2799 | * final pixel area of the stream.</p> |
| 2800 | * <p>For example, if the crop region is set to a 4:3 aspect ratio, then 4:3 streams will use |
| 2801 | * the exact crop region. 16:9 streams will further crop vertically (letterbox).</p> |
| 2802 | * <p>Conversely, if the crop region is set to a 16:9, then 4:3 outputs will crop horizontally |
| 2803 | * (pillarbox), and 16:9 streams will match exactly. These additional crops will be |
| 2804 | * centered within the crop region.</p> |
| 2805 | * <p>To illustrate, here are several scenarios of different crop regions and output streams, |
| 2806 | * for a hypothetical camera device with an active array of size <code>(2000,1500)</code>. Note that |
| 2807 | * several of these examples use non-centered crop regions for ease of illustration; such |
| 2808 | * regions are only supported on devices with FREEFORM capability |
| 2809 | * ({@link CameraCharacteristics#SCALER_CROPPING_TYPE android.scaler.croppingType} <code>== FREEFORM</code>), but this does not affect the way the crop |
| 2810 | * rules work otherwise.</p> |
| 2811 | * <ul> |
| 2812 | * <li>Camera Configuration:<ul> |
| 2813 | * <li>Active array size: <code>2000x1500</code> (3 MP, 4:3 aspect ratio)</li> |
| 2814 | * <li>Output stream #1: <code>640x480</code> (VGA, 4:3 aspect ratio)</li> |
| 2815 | * <li>Output stream #2: <code>1280x720</code> (720p, 16:9 aspect ratio)</li> |
| 2816 | * </ul> |
| 2817 | * </li> |
| 2818 | * <li>Case #1: 4:3 crop region with 2x digital zoom<ul> |
| 2819 | * <li>Crop region: <code>Rect(500, 375, 1500, 1125) // (left, top, right, bottom)</code></li> |
| 2820 | * <li><img alt="4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-ratio.png" /></li> |
| 2821 | * <li><code>640x480</code> stream source area: <code>(500, 375, 1500, 1125)</code> (equal to crop region)</li> |
| 2822 | * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li> |
| 2823 | * </ul> |
| 2824 | * </li> |
| 2825 | * <li>Case #2: 16:9 crop region with ~1.5x digital zoom.<ul> |
| 2826 | * <li>Crop region: <code>Rect(500, 375, 1833, 1125)</code></li> |
| 2827 | * <li><img alt="16:9 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-169-ratio.png" /></li> |
| 2828 | * <li><code>640x480</code> stream source area: <code>(666, 375, 1666, 1125)</code> (pillarboxed)</li> |
| 2829 | * <li><code>1280x720</code> stream source area: <code>(500, 375, 1833, 1125)</code> (equal to crop region)</li> |
| 2830 | * </ul> |
| 2831 | * </li> |
| 2832 | * <li>Case #3: 1:1 crop region with ~2.6x digital zoom.<ul> |
| 2833 | * <li>Crop region: <code>Rect(500, 375, 1250, 1125)</code></li> |
| 2834 | * <li><img alt="1:1 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-11-ratio.png" /></li> |
| 2835 | * <li><code>640x480</code> stream source area: <code>(500, 469, 1250, 1031)</code> (letterboxed)</li> |
| 2836 | * <li><code>1280x720</code> stream source area: <code>(500, 543, 1250, 957)</code> (letterboxed)</li> |
| 2837 | * </ul> |
| 2838 | * </li> |
| 2839 | * <li>Case #4: Replace <code>640x480</code> stream with <code>1024x1024</code> stream, with 4:3 crop region:<ul> |
| 2840 | * <li>Crop region: <code>Rect(500, 375, 1500, 1125)</code></li> |
| 2841 | * <li><img alt="Square output, 4:3 aspect ratio crop diagram" src="/reference/images/camera2/metadata/android.scaler.cropRegion/crop-region-43-square-ratio.png" /></li> |
| 2842 | * <li><code>1024x1024</code> stream source area: <code>(625, 375, 1375, 1125)</code> (pillarboxed)</li> |
| 2843 | * <li><code>1280x720</code> stream source area: <code>(500, 469, 1500, 1031)</code> (letterboxed)</li> |
| 2844 | * <li>Note that in this case, neither of the two outputs is a subset of the other, with |
| 2845 | * each containing image data the other doesn't have.</li> |
| 2846 | * </ul> |
| 2847 | * </li> |
| 2848 | * </ul> |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 2849 | * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, the width and height |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2850 | * of the crop region cannot be set to be smaller than |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2851 | * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and |
| 2852 | * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2853 | * <p>If the coordinate system is {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}, the width |
| 2854 | * and height of the crop region cannot be set to be smaller than |
| 2855 | * <code>floor( preCorrectionActiveArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> |
| 2856 | * and |
| 2857 | * <code>floor( preCorrectionActiveArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, |
| 2858 | * respectively.</p> |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2859 | * <p>The camera device may adjust the crop region to account for rounding and other hardware |
| 2860 | * requirements; the final crop region used will be included in the output capture result.</p> |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2861 | * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} |
| 2862 | * to take advantage of better support for zoom with logical multi-camera. The benefits |
| 2863 | * include better precision with optical-digital zoom combination, and ability to do |
| 2864 | * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in |
| 2865 | * the capture request must be either letterboxing or pillarboxing (but not both). The |
| 2866 | * coordinate system is post-zoom, meaning that the activeArraySize or |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2867 | * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom. See |
| 2868 | * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2869 | * <p><b>Units</b>: Pixel coordinates relative to |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2870 | * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} or |
| 2871 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize} depending on distortion correction |
| 2872 | * capability and mode</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2873 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 2874 | * |
Shuzhen Wang | 55c1c3f | 2019-11-13 11:25:20 -0800 | [diff] [blame] | 2875 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2876 | * @see CaptureRequest#DISTORTION_CORRECTION_MODE |
Eino-Ville Talvala | d8fd679 | 2014-02-10 12:41:04 -0800 | [diff] [blame] | 2877 | * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM |
Eino-Ville Talvala | d2d749a | 2020-01-06 16:10:29 -0800 | [diff] [blame] | 2878 | * @see CameraCharacteristics#SCALER_CROPPING_TYPE |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 2879 | * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 2880 | * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2881 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2882 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2883 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2884 | public static final Key<android.graphics.Rect> SCALER_CROP_REGION = |
| 2885 | new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class); |
| 2886 | |
| 2887 | /** |
Eino-Ville Talvala | a9b1d60 | 2020-01-06 13:10:22 -0800 | [diff] [blame] | 2888 | * <p>Whether a rotation-and-crop operation is applied to processed |
| 2889 | * outputs from the camera.</p> |
| 2890 | * <p>This control is primarily intended to help camera applications with no support for |
| 2891 | * multi-window modes to work correctly on devices where multi-window scenarios are |
| 2892 | * unavoidable, such as foldables or other devices with variable display geometry or more |
| 2893 | * free-form window placement (such as laptops, which often place portrait-orientation apps |
| 2894 | * in landscape with pillarboxing).</p> |
| 2895 | * <p>If supported, the default value is <code>ROTATE_AND_CROP_AUTO</code>, which allows the camera API |
| 2896 | * to enable backwards-compatibility support for applications that do not support resizing |
| 2897 | * / multi-window modes, when the device is in fact in a multi-window mode (such as inset |
| 2898 | * portrait on laptops, or on a foldable device in some fold states). In addition, |
| 2899 | * <code>ROTATE_AND_CROP_NONE</code> and <code>ROTATE_AND_CROP_90</code> will always be available if this control |
| 2900 | * is supported by the device. If not supported, devices API level 30 or higher will always |
| 2901 | * list only <code>ROTATE_AND_CROP_NONE</code>.</p> |
| 2902 | * <p>When <code>CROP_AUTO</code> is in use, and the camera API activates backward-compatibility mode, |
| 2903 | * several metadata fields will also be parsed differently to ensure that coordinates are |
| 2904 | * correctly handled for features like drawing face detection boxes or passing in |
| 2905 | * tap-to-focus coordinates. The camera API will convert positions in the active array |
| 2906 | * coordinate system to/from the cropped-and-rotated coordinate system to make the |
| 2907 | * operation transparent for applications. The following controls are affected:</p> |
| 2908 | * <ul> |
| 2909 | * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li> |
| 2910 | * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li> |
| 2911 | * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li> |
| 2912 | * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li> |
| 2913 | * </ul> |
| 2914 | * <p>Capture results will contain the actual value selected by the API; |
| 2915 | * <code>ROTATE_AND_CROP_AUTO</code> will never be seen in a capture result.</p> |
| 2916 | * <p>Applications can also select their preferred cropping mode, either to opt out of the |
| 2917 | * backwards-compatibility treatment, or to use the cropping feature themselves as needed. |
| 2918 | * In this case, no coordinate translation will be done automatically, and all controls |
| 2919 | * will continue to use the normal active array coordinates.</p> |
| 2920 | * <p>Cropping and rotating is done after the application of digital zoom (via either |
| 2921 | * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} or {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio}), but before each individual |
| 2922 | * output is further cropped and scaled. It only affects processed outputs such as |
| 2923 | * YUV, PRIVATE, and JPEG. It has no effect on RAW outputs.</p> |
| 2924 | * <p>When <code>CROP_90</code> or <code>CROP_270</code> are selected, there is a significant loss to the field of |
| 2925 | * view. For example, with a 4:3 aspect ratio output of 1600x1200, <code>CROP_90</code> will still |
| 2926 | * produce 1600x1200 output, but these buffers are cropped from a vertical 3:4 slice at the |
| 2927 | * center of the 4:3 area, then rotated to be 4:3, and then upscaled to 1600x1200. Only |
| 2928 | * 56.25% of the original FOV is still visible. In general, for an aspect ratio of <code>w:h</code>, |
| 2929 | * the crop and rotate operation leaves <code>(h/w)^2</code> of the field of view visible. For 16:9, |
| 2930 | * this is ~31.6%.</p> |
| 2931 | * <p>As a visual example, the figure below shows the effect of <code>ROTATE_AND_CROP_90</code> on the |
| 2932 | * outputs for the following parameters:</p> |
| 2933 | * <ul> |
| 2934 | * <li>Sensor active array: <code>2000x1500</code></li> |
| 2935 | * <li>Crop region: top-left: <code>(500, 375)</code>, size: <code>(1000, 750)</code> (4:3 aspect ratio)</li> |
| 2936 | * <li>Output streams: YUV <code>640x480</code> and YUV <code>1280x720</code></li> |
| 2937 | * <li><code>ROTATE_AND_CROP_90</code></li> |
| 2938 | * </ul> |
| 2939 | * <p><img alt="Effect of ROTATE_AND_CROP_90" src="/reference/images/camera2/metadata/android.scaler.rotateAndCrop/crop-region-rotate-90-43-ratio.png" /></p> |
| 2940 | * <p>With these settings, the regions of the active array covered by the output streams are:</p> |
| 2941 | * <ul> |
| 2942 | * <li>640x480 stream crop: top-left: <code>(219, 375)</code>, size: <code>(562, 750)</code></li> |
| 2943 | * <li>1280x720 stream crop: top-left: <code>(289, 375)</code>, size: <code>(422, 750)</code></li> |
| 2944 | * </ul> |
| 2945 | * <p>Since the buffers are rotated, the buffers as seen by the application are:</p> |
| 2946 | * <ul> |
| 2947 | * <li>640x480 stream: top-left: <code>(781, 375)</code> on active array, size: <code>(640, 480)</code>, downscaled 1.17x from sensor pixels</li> |
| 2948 | * <li>1280x720 stream: top-left: <code>(711, 375)</code> on active array, size: <code>(1280, 720)</code>, upscaled 1.71x from sensor pixels</li> |
| 2949 | * </ul> |
| 2950 | * <p><b>Possible values:</b> |
| 2951 | * <ul> |
| 2952 | * <li>{@link #SCALER_ROTATE_AND_CROP_NONE NONE}</li> |
| 2953 | * <li>{@link #SCALER_ROTATE_AND_CROP_90 90}</li> |
| 2954 | * <li>{@link #SCALER_ROTATE_AND_CROP_180 180}</li> |
| 2955 | * <li>{@link #SCALER_ROTATE_AND_CROP_270 270}</li> |
| 2956 | * <li>{@link #SCALER_ROTATE_AND_CROP_AUTO AUTO}</li> |
| 2957 | * </ul></p> |
| 2958 | * <p><b>Available values for this device:</b><br> |
Eino-Ville Talvala | 9f9bb3b | 2020-03-18 13:31:03 -0700 | [diff] [blame] | 2959 | * android.scaler.availableRotateAndCropModes</p> |
Eino-Ville Talvala | a9b1d60 | 2020-01-06 13:10:22 -0800 | [diff] [blame] | 2960 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
| 2961 | * |
| 2962 | * @see CaptureRequest#CONTROL_AE_REGIONS |
| 2963 | * @see CaptureRequest#CONTROL_AF_REGIONS |
| 2964 | * @see CaptureRequest#CONTROL_AWB_REGIONS |
| 2965 | * @see CaptureRequest#CONTROL_ZOOM_RATIO |
Eino-Ville Talvala | a9b1d60 | 2020-01-06 13:10:22 -0800 | [diff] [blame] | 2966 | * @see CaptureRequest#SCALER_CROP_REGION |
| 2967 | * @see CaptureResult#STATISTICS_FACES |
| 2968 | * @see #SCALER_ROTATE_AND_CROP_NONE |
| 2969 | * @see #SCALER_ROTATE_AND_CROP_90 |
| 2970 | * @see #SCALER_ROTATE_AND_CROP_180 |
| 2971 | * @see #SCALER_ROTATE_AND_CROP_270 |
| 2972 | * @see #SCALER_ROTATE_AND_CROP_AUTO |
Eino-Ville Talvala | 9f9bb3b | 2020-03-18 13:31:03 -0700 | [diff] [blame] | 2973 | * @hide |
Eino-Ville Talvala | a9b1d60 | 2020-01-06 13:10:22 -0800 | [diff] [blame] | 2974 | */ |
Eino-Ville Talvala | a9b1d60 | 2020-01-06 13:10:22 -0800 | [diff] [blame] | 2975 | public static final Key<Integer> SCALER_ROTATE_AND_CROP = |
| 2976 | new Key<Integer>("android.scaler.rotateAndCrop", int.class); |
| 2977 | |
| 2978 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 2979 | * <p>Duration each pixel is exposed to |
| 2980 | * light.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2981 | * <p>If the sensor can't expose this exact duration, it will shorten the |
| 2982 | * duration exposed to the nearest possible value (rather than expose longer). |
| 2983 | * The final exposure time used will be available in the output capture result.</p> |
| 2984 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to |
| 2985 | * OFF; otherwise the auto-exposure algorithm will override this value.</p> |
| 2986 | * <p><b>Units</b>: Nanoseconds</p> |
| 2987 | * <p><b>Range of valid values:</b><br> |
| 2988 | * {@link CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE android.sensor.info.exposureTimeRange}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 2989 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2990 | * <p><b>Full capability</b> - |
| 2991 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 2992 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
| 2993 | * |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2994 | * @see CaptureRequest#CONTROL_AE_MODE |
| 2995 | * @see CaptureRequest#CONTROL_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 2996 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 2997 | * @see CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 2998 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 2999 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3000 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3001 | public static final Key<Long> SENSOR_EXPOSURE_TIME = |
| 3002 | new Key<Long>("android.sensor.exposureTime", long.class); |
| 3003 | |
| 3004 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3005 | * <p>Duration from start of frame exposure to |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3006 | * start of next frame exposure.</p> |
| 3007 | * <p>The maximum frame rate that can be supported by a camera subsystem is |
| 3008 | * a function of many factors:</p> |
| 3009 | * <ul> |
| 3010 | * <li>Requested resolutions of output image streams</li> |
| 3011 | * <li>Availability of binning / skipping modes on the imager</li> |
| 3012 | * <li>The bandwidth of the imager interface</li> |
| 3013 | * <li>The bandwidth of the various ISP processing blocks</li> |
| 3014 | * </ul> |
| 3015 | * <p>Since these factors can vary greatly between different ISPs and |
| 3016 | * sensors, the camera abstraction tries to represent the bandwidth |
| 3017 | * restrictions with as simple a model as possible.</p> |
| 3018 | * <p>The model presented has the following characteristics:</p> |
| 3019 | * <ul> |
| 3020 | * <li>The image sensor is always configured to output the smallest |
| 3021 | * resolution possible given the application's requested output stream |
| 3022 | * sizes. The smallest resolution is defined as being at least as large |
| 3023 | * as the largest requested output stream size; the camera pipeline must |
| 3024 | * never digitally upsample sensor data when the crop region covers the |
| 3025 | * whole sensor. In general, this means that if only small output stream |
| 3026 | * resolutions are configured, the sensor can provide a higher frame |
| 3027 | * rate.</li> |
| 3028 | * <li>Since any request may use any or all the currently configured |
| 3029 | * output streams, the sensor and ISP must be configured to support |
| 3030 | * scaling a single capture to all the streams at the same time. This |
| 3031 | * means the camera pipeline must be ready to produce the largest |
| 3032 | * requested output size without any delay. Therefore, the overall |
| 3033 | * frame rate of a given configured stream set is governed only by the |
| 3034 | * largest requested stream resolution.</li> |
| 3035 | * <li>Using more than one output stream in a request does not affect the |
| 3036 | * frame duration.</li> |
Igor Murashkin | a23ffb5 | 2014-02-07 18:52:34 -0800 | [diff] [blame] | 3037 | * <li>Certain format-streams may need to do additional background processing |
| 3038 | * before data is consumed/produced by that stream. These processors |
| 3039 | * can run concurrently to the rest of the camera pipeline, but |
| 3040 | * cannot process more than 1 capture at a time.</li> |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3041 | * </ul> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3042 | * <p>The necessary information for the application, given the model above, is provided via |
Eino-Ville Talvala | b6eb52f | 2015-04-16 16:39:45 -0700 | [diff] [blame] | 3043 | * {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration }. |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3044 | * These are used to determine the maximum frame rate / minimum frame duration that is |
| 3045 | * possible for a given stream configuration.</p> |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3046 | * <p>Specifically, the application can use the following rules to |
Igor Murashkin | a23ffb5 | 2014-02-07 18:52:34 -0800 | [diff] [blame] | 3047 | * determine the minimum frame duration it can request from the camera |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3048 | * device:</p> |
| 3049 | * <ol> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3050 | * <li>Let the set of currently configured input/output streams be called <code>S</code>.</li> |
| 3051 | * <li>Find the minimum frame durations for each stream in <code>S</code>, by looking it up in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputMinFrameDuration } |
| 3052 | * (with its respective size/format). Let this set of frame durations be called <code>F</code>.</li> |
| 3053 | * <li>For any given request <code>R</code>, the minimum frame duration allowed for <code>R</code> is the maximum |
| 3054 | * out of all values in <code>F</code>. Let the streams used in <code>R</code> be called <code>S_r</code>.</li> |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3055 | * </ol> |
Eino-Ville Talvala | b6eb52f | 2015-04-16 16:39:45 -0700 | [diff] [blame] | 3056 | * <p>If none of the streams in <code>S_r</code> have a stall time (listed in {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration } |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3057 | * using its respective size/format), then the frame duration in <code>F</code> determines the steady |
| 3058 | * state frame rate that the application will get if it uses <code>R</code> as a repeating request. Let |
| 3059 | * this special kind of request be called <code>Rsimple</code>.</p> |
| 3060 | * <p>A repeating request <code>Rsimple</code> can be <em>occasionally</em> interleaved by a single capture of a |
| 3061 | * new request <code>Rstall</code> (which has at least one in-use stream with a non-0 stall time) and if |
| 3062 | * <code>Rstall</code> has the same minimum frame duration this will not cause a frame rate loss if all |
| 3063 | * buffers from the previous <code>Rstall</code> have already been delivered.</p> |
| 3064 | * <p>For more details about stalling, see {@link android.hardware.camera2.params.StreamConfigurationMap#getOutputStallDuration }.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3065 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to |
| 3066 | * OFF; otherwise the auto-exposure algorithm will override this value.</p> |
| 3067 | * <p><b>Units</b>: Nanoseconds</p> |
| 3068 | * <p><b>Range of valid values:</b><br> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3069 | * See {@link CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION android.sensor.info.maxFrameDuration}, {@link android.hardware.camera2.params.StreamConfigurationMap }. |
| 3070 | * The duration is capped to <code>max(duration, exposureTime + overhead)</code>.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3071 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3072 | * <p><b>Full capability</b> - |
| 3073 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3074 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Igor Murashkin | 143aa0b | 2014-01-17 15:02:34 -0800 | [diff] [blame] | 3075 | * |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3076 | * @see CaptureRequest#CONTROL_AE_MODE |
| 3077 | * @see CaptureRequest#CONTROL_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3078 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3079 | * @see CameraCharacteristics#SENSOR_INFO_MAX_FRAME_DURATION |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3080 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3081 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3082 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3083 | public static final Key<Long> SENSOR_FRAME_DURATION = |
| 3084 | new Key<Long>("android.sensor.frameDuration", long.class); |
| 3085 | |
| 3086 | /** |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 3087 | * <p>The amount of gain applied to sensor data |
| 3088 | * before processing.</p> |
| 3089 | * <p>The sensitivity is the standard ISO sensitivity value, |
| 3090 | * as defined in ISO 12232:2006.</p> |
| 3091 | * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and |
| 3092 | * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device |
| 3093 | * is guaranteed to use only analog amplification for applying the gain.</p> |
| 3094 | * <p>If the camera device cannot apply the exact sensitivity |
| 3095 | * requested, it will reduce the gain to the nearest supported |
| 3096 | * value. The final sensitivity used will be available in the |
| 3097 | * output capture result.</p> |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 3098 | * <p>This control is only effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} or {@link CaptureRequest#CONTROL_MODE android.control.mode} is set to |
| 3099 | * OFF; otherwise the auto-exposure algorithm will override this value.</p> |
Shuzhen Wang | 252fa53 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 3100 | * <p>Note that for devices supporting postRawSensitivityBoost, the total sensitivity applied |
| 3101 | * to the final processed image is the combination of {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} and |
| 3102 | * {@link CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST android.control.postRawSensitivityBoost}. In case the application uses the sensor |
| 3103 | * sensitivity from last capture result of an auto request for a manual request, in order |
| 3104 | * to achieve the same brightness in the output image, the application should also |
| 3105 | * set postRawSensitivityBoost.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3106 | * <p><b>Units</b>: ISO arithmetic units</p> |
| 3107 | * <p><b>Range of valid values:</b><br> |
| 3108 | * {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3109 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3110 | * <p><b>Full capability</b> - |
| 3111 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3112 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 3113 | * |
Yin-Chia Yeh | 1ee1a0a | 2016-01-18 19:13:47 -0800 | [diff] [blame] | 3114 | * @see CaptureRequest#CONTROL_AE_MODE |
| 3115 | * @see CaptureRequest#CONTROL_MODE |
Shuzhen Wang | 252fa53 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 3116 | * @see CaptureRequest#CONTROL_POST_RAW_SENSITIVITY_BOOST |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3117 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 3118 | * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE |
| 3119 | * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY |
Shuzhen Wang | 252fa53 | 2019-07-08 15:14:16 -0700 | [diff] [blame] | 3120 | * @see CaptureRequest#SENSOR_SENSITIVITY |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3121 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3122 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3123 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3124 | public static final Key<Integer> SENSOR_SENSITIVITY = |
| 3125 | new Key<Integer>("android.sensor.sensitivity", int.class); |
| 3126 | |
| 3127 | /** |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3128 | * <p>A pixel <code>[R, G_even, G_odd, B]</code> that supplies the test pattern |
| 3129 | * when {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode} is SOLID_COLOR.</p> |
| 3130 | * <p>Each color channel is treated as an unsigned 32-bit integer. |
| 3131 | * The camera device then uses the most significant X bits |
| 3132 | * that correspond to how many bits are in its Bayer raw sensor |
| 3133 | * output.</p> |
| 3134 | * <p>For example, a sensor with RAW10 Bayer output would use the |
| 3135 | * 10 most significant bits from each color channel.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3136 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3137 | * |
| 3138 | * @see CaptureRequest#SENSOR_TEST_PATTERN_MODE |
| 3139 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3140 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3141 | @NonNull |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3142 | public static final Key<int[]> SENSOR_TEST_PATTERN_DATA = |
| 3143 | new Key<int[]>("android.sensor.testPatternData", int[].class); |
| 3144 | |
| 3145 | /** |
| 3146 | * <p>When enabled, the sensor sends a test pattern instead of |
| 3147 | * doing a real exposure from the camera.</p> |
| 3148 | * <p>When a test pattern is enabled, all manual sensor controls specified |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 3149 | * by android.sensor.* will be ignored. All other controls should |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3150 | * work as normal.</p> |
| 3151 | * <p>For example, if manual flash is enabled, flash firing should still |
| 3152 | * occur (and that the test pattern remain unmodified, since the flash |
| 3153 | * would not actually affect it).</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3154 | * <p>Defaults to OFF.</p> |
| 3155 | * <p><b>Possible values:</b> |
| 3156 | * <ul> |
| 3157 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_OFF OFF}</li> |
| 3158 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR SOLID_COLOR}</li> |
| 3159 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS COLOR_BARS}</li> |
| 3160 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY COLOR_BARS_FADE_TO_GRAY}</li> |
| 3161 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_PN9 PN9}</li> |
| 3162 | * <li>{@link #SENSOR_TEST_PATTERN_MODE_CUSTOM1 CUSTOM1}</li> |
| 3163 | * </ul></p> |
| 3164 | * <p><b>Available values for this device:</b><br> |
| 3165 | * {@link CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES android.sensor.availableTestPatternModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3166 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3167 | * |
| 3168 | * @see CameraCharacteristics#SENSOR_AVAILABLE_TEST_PATTERN_MODES |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3169 | * @see #SENSOR_TEST_PATTERN_MODE_OFF |
| 3170 | * @see #SENSOR_TEST_PATTERN_MODE_SOLID_COLOR |
| 3171 | * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS |
| 3172 | * @see #SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY |
| 3173 | * @see #SENSOR_TEST_PATTERN_MODE_PN9 |
| 3174 | * @see #SENSOR_TEST_PATTERN_MODE_CUSTOM1 |
| 3175 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3176 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3177 | @NonNull |
Igor Murashkin | c127f05 | 2014-01-17 18:06:02 -0800 | [diff] [blame] | 3178 | public static final Key<Integer> SENSOR_TEST_PATTERN_MODE = |
| 3179 | new Key<Integer>("android.sensor.testPatternMode", int.class); |
| 3180 | |
| 3181 | /** |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3182 | * <p>Quality of lens shading correction applied |
| 3183 | * to the image data.</p> |
| 3184 | * <p>When set to OFF mode, no lens shading correction will be applied by the |
| 3185 | * camera device, and an identity lens shading map data will be provided |
| 3186 | * if <code>{@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} == ON</code>. For example, for lens |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3187 | * shading map with size of <code>[ 4, 3 ]</code>, |
| 3188 | * the output {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap} for this case will be an identity |
| 3189 | * map shown below:</p> |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3190 | * <pre><code>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3191 | * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
| 3192 | * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
| 3193 | * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
| 3194 | * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, |
| 3195 | * 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3196 | * </code></pre> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3197 | * <p>When set to other modes, lens shading correction will be applied by the camera |
| 3198 | * device. Applications can request lens shading map data by setting |
| 3199 | * {@link CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE android.statistics.lensShadingMapMode} to ON, and then the camera device will provide lens |
| 3200 | * shading map data in {@link CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP android.statistics.lensShadingCorrectionMap}; the returned shading map |
| 3201 | * data will be the one applied by the camera device for this capture request.</p> |
| 3202 | * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore |
| 3203 | * the reliability of the map data may be affected by the AE and AWB algorithms. When AE and |
| 3204 | * AWB are in AUTO modes({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF and {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} <code>!=</code> |
| 3205 | * OFF), to get best results, it is recommended that the applications wait for the AE and AWB |
| 3206 | * to be converged before using the returned shading map data.</p> |
| 3207 | * <p><b>Possible values:</b> |
| 3208 | * <ul> |
| 3209 | * <li>{@link #SHADING_MODE_OFF OFF}</li> |
| 3210 | * <li>{@link #SHADING_MODE_FAST FAST}</li> |
| 3211 | * <li>{@link #SHADING_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
| 3212 | * </ul></p> |
Yin-Chia Yeh | e4aa283 | 2015-02-06 15:15:53 -0800 | [diff] [blame] | 3213 | * <p><b>Available values for this device:</b><br> |
| 3214 | * {@link CameraCharacteristics#SHADING_AVAILABLE_MODES android.shading.availableModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3215 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3216 | * <p><b>Full capability</b> - |
| 3217 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3218 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3219 | * |
Zhijun He | fa7c755 | 2014-05-22 16:36:02 -0700 | [diff] [blame] | 3220 | * @see CaptureRequest#CONTROL_AE_MODE |
| 3221 | * @see CaptureRequest#CONTROL_AWB_MODE |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3222 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Yin-Chia Yeh | e4aa283 | 2015-02-06 15:15:53 -0800 | [diff] [blame] | 3223 | * @see CameraCharacteristics#SHADING_AVAILABLE_MODES |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3224 | * @see CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3225 | * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE |
| 3226 | * @see #SHADING_MODE_OFF |
| 3227 | * @see #SHADING_MODE_FAST |
| 3228 | * @see #SHADING_MODE_HIGH_QUALITY |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3229 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3230 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3231 | @NonNull |
Zhijun He | ba93fe6 | 2014-01-17 16:43:05 -0800 | [diff] [blame] | 3232 | public static final Key<Integer> SHADING_MODE = |
| 3233 | new Key<Integer>("android.shading.mode", int.class); |
| 3234 | |
| 3235 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3236 | * <p>Operating mode for the face detector |
Eino-Ville Talvala | b67a3b3 | 2014-06-06 13:07:20 -0700 | [diff] [blame] | 3237 | * unit.</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3238 | * <p>Whether face detection is enabled, and whether it |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3239 | * should output just the basic fields or the full set of |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3240 | * fields.</p> |
| 3241 | * <p><b>Possible values:</b> |
| 3242 | * <ul> |
| 3243 | * <li>{@link #STATISTICS_FACE_DETECT_MODE_OFF OFF}</li> |
| 3244 | * <li>{@link #STATISTICS_FACE_DETECT_MODE_SIMPLE SIMPLE}</li> |
| 3245 | * <li>{@link #STATISTICS_FACE_DETECT_MODE_FULL FULL}</li> |
| 3246 | * </ul></p> |
| 3247 | * <p><b>Available values for this device:</b><br> |
| 3248 | * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES android.statistics.info.availableFaceDetectModes}</p> |
| 3249 | * <p>This key is available on all devices.</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 3250 | * |
| 3251 | * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3252 | * @see #STATISTICS_FACE_DETECT_MODE_OFF |
| 3253 | * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE |
| 3254 | * @see #STATISTICS_FACE_DETECT_MODE_FULL |
| 3255 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3256 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3257 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3258 | public static final Key<Integer> STATISTICS_FACE_DETECT_MODE = |
| 3259 | new Key<Integer>("android.statistics.faceDetectMode", int.class); |
| 3260 | |
| 3261 | /** |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3262 | * <p>Operating mode for hot pixel map generation.</p> |
| 3263 | * <p>If set to <code>true</code>, a hot pixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}. |
| 3264 | * If set to <code>false</code>, no hot pixel map will be returned.</p> |
| 3265 | * <p><b>Range of valid values:</b><br> |
| 3266 | * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3267 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Ruben Brunk | 9d454fd | 2014-03-04 14:11:52 -0800 | [diff] [blame] | 3268 | * |
| 3269 | * @see CaptureResult#STATISTICS_HOT_PIXEL_MAP |
| 3270 | * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES |
| 3271 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3272 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3273 | @NonNull |
Ruben Brunk | 9d454fd | 2014-03-04 14:11:52 -0800 | [diff] [blame] | 3274 | public static final Key<Boolean> STATISTICS_HOT_PIXEL_MAP_MODE = |
| 3275 | new Key<Boolean>("android.statistics.hotPixelMapMode", boolean.class); |
| 3276 | |
| 3277 | /** |
Zhijun He | cc28a41 | 2014-02-24 15:11:23 -0800 | [diff] [blame] | 3278 | * <p>Whether the camera device will output the lens |
| 3279 | * shading map in output result metadata.</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3280 | * <p>When set to ON, |
Eino-Ville Talvala | e600d6a | 2014-06-09 14:25:50 -0700 | [diff] [blame] | 3281 | * android.statistics.lensShadingMap will be provided in |
Igor Murashkin | 7a9b30e | 2013-12-11 13:31:38 -0800 | [diff] [blame] | 3282 | * the output result metadata.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3283 | * <p>ON is always supported on devices with the RAW capability.</p> |
| 3284 | * <p><b>Possible values:</b> |
| 3285 | * <ul> |
| 3286 | * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_OFF OFF}</li> |
| 3287 | * <li>{@link #STATISTICS_LENS_SHADING_MAP_MODE_ON ON}</li> |
| 3288 | * </ul></p> |
Yin-Chia Yeh | e4aa283 | 2015-02-06 15:15:53 -0800 | [diff] [blame] | 3289 | * <p><b>Available values for this device:</b><br> |
| 3290 | * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES android.statistics.info.availableLensShadingMapModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3291 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3292 | * <p><b>Full capability</b> - |
| 3293 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3294 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
| 3295 | * |
| 3296 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Yin-Chia Yeh | e4aa283 | 2015-02-06 15:15:53 -0800 | [diff] [blame] | 3297 | * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES |
Eino-Ville Talvala | d96748b | 2013-09-12 11:11:27 -0700 | [diff] [blame] | 3298 | * @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF |
| 3299 | * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON |
| 3300 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3301 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3302 | @NonNull |
Eino-Ville Talvala | d96748b | 2013-09-12 11:11:27 -0700 | [diff] [blame] | 3303 | public static final Key<Integer> STATISTICS_LENS_SHADING_MAP_MODE = |
| 3304 | new Key<Integer>("android.statistics.lensShadingMapMode", int.class); |
| 3305 | |
| 3306 | /** |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 3307 | * <p>A control for selecting whether optical stabilization (OIS) position |
| 3308 | * information is included in output result metadata.</p> |
| 3309 | * <p>Since optical image stabilization generally involves motion much faster than the duration |
| 3310 | * of individualq image exposure, multiple OIS samples can be included for a single capture |
| 3311 | * result. For example, if the OIS reporting operates at 200 Hz, a typical camera operating |
| 3312 | * at 30fps may have 6-7 OIS samples per capture result. This information can be combined |
| 3313 | * with the rolling shutter skew to account for lens motion during image exposure in |
| 3314 | * post-processing algorithms.</p> |
Chien-Yu Chen | c9cf5b9 | 2018-01-18 12:24:40 -0800 | [diff] [blame] | 3315 | * <p><b>Possible values:</b> |
| 3316 | * <ul> |
| 3317 | * <li>{@link #STATISTICS_OIS_DATA_MODE_OFF OFF}</li> |
| 3318 | * <li>{@link #STATISTICS_OIS_DATA_MODE_ON ON}</li> |
| 3319 | * </ul></p> |
| 3320 | * <p><b>Available values for this device:</b><br> |
Eino-Ville Talvala | 915f504 | 2018-03-13 19:08:01 -0700 | [diff] [blame] | 3321 | * {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES android.statistics.info.availableOisDataModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3322 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 915f504 | 2018-03-13 19:08:01 -0700 | [diff] [blame] | 3323 | * |
| 3324 | * @see CameraCharacteristics#STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES |
Chien-Yu Chen | c9cf5b9 | 2018-01-18 12:24:40 -0800 | [diff] [blame] | 3325 | * @see #STATISTICS_OIS_DATA_MODE_OFF |
| 3326 | * @see #STATISTICS_OIS_DATA_MODE_ON |
| 3327 | */ |
| 3328 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3329 | @NonNull |
Chien-Yu Chen | c9cf5b9 | 2018-01-18 12:24:40 -0800 | [diff] [blame] | 3330 | public static final Key<Integer> STATISTICS_OIS_DATA_MODE = |
| 3331 | new Key<Integer>("android.statistics.oisDataMode", int.class); |
| 3332 | |
| 3333 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3334 | * <p>Tonemapping / contrast / gamma curve for the blue |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3335 | * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3336 | * CONTRAST_CURVE.</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3337 | * <p>See android.tonemap.curveRed for more details.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3338 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3339 | * <p><b>Full capability</b> - |
| 3340 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3341 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 3342 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3343 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 3344 | * @see CaptureRequest#TONEMAP_MODE |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3345 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3346 | */ |
Zhijun He | 3ffd705 | 2013-08-19 15:45:08 -0700 | [diff] [blame] | 3347 | public static final Key<float[]> TONEMAP_CURVE_BLUE = |
| 3348 | new Key<float[]>("android.tonemap.curveBlue", float[].class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3349 | |
| 3350 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3351 | * <p>Tonemapping / contrast / gamma curve for the green |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3352 | * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3353 | * CONTRAST_CURVE.</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3354 | * <p>See android.tonemap.curveRed for more details.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3355 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3356 | * <p><b>Full capability</b> - |
| 3357 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3358 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 3359 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3360 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Zhijun He | 5f2a47f | 2014-01-16 15:44:41 -0800 | [diff] [blame] | 3361 | * @see CaptureRequest#TONEMAP_MODE |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3362 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3363 | */ |
Zhijun He | 3ffd705 | 2013-08-19 15:45:08 -0700 | [diff] [blame] | 3364 | public static final Key<float[]> TONEMAP_CURVE_GREEN = |
| 3365 | new Key<float[]>("android.tonemap.curveGreen", float[].class); |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3366 | |
| 3367 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3368 | * <p>Tonemapping / contrast / gamma curve for the red |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3369 | * channel, to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3370 | * CONTRAST_CURVE.</p> |
| 3371 | * <p>Each channel's curve is defined by an array of control points:</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3372 | * <pre><code>android.tonemap.curveRed = |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3373 | * [ P0in, P0out, P1in, P1out, P2in, P2out, P3in, P3out, ..., PNin, PNout ] |
Zhijun He | 870922b | 2014-02-15 21:47:51 -0800 | [diff] [blame] | 3374 | * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3375 | * <p>These are sorted in order of increasing <code>Pin</code>; it is |
| 3376 | * required that input values 0.0 and 1.0 are included in the list to |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3377 | * define a complete mapping. For input values between control points, |
| 3378 | * the camera device must linearly interpolate between the control |
| 3379 | * points.</p> |
| 3380 | * <p>Each curve can have an independent number of points, and the number |
| 3381 | * of points can be less than max (that is, the request doesn't have to |
| 3382 | * always provide a curve with number of points equivalent to |
| 3383 | * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p> |
Shuzhen Wang | a8d3603 | 2018-10-15 12:01:53 -0700 | [diff] [blame] | 3384 | * <p>For devices with MONOCHROME capability, all three channels must have the same set of |
| 3385 | * control points.</p> |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3386 | * <p>A few examples, and their corresponding graphical mappings; these |
| 3387 | * only specify the red channel and the precision is limited to 4 |
| 3388 | * digits, for conciseness.</p> |
| 3389 | * <p>Linear mapping:</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3390 | * <pre><code>android.tonemap.curveRed = [ 0, 0, 1.0, 1.0 ] |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3391 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3392 | * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p> |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3393 | * <p>Invert mapping:</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3394 | * <pre><code>android.tonemap.curveRed = [ 0, 1.0, 1.0, 0 ] |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3395 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3396 | * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p> |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3397 | * <p>Gamma 1/2.2 mapping, with 16 control points:</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3398 | * <pre><code>android.tonemap.curveRed = [ |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3399 | * 0.0000, 0.0000, 0.0667, 0.2920, 0.1333, 0.4002, 0.2000, 0.4812, |
| 3400 | * 0.2667, 0.5484, 0.3333, 0.6069, 0.4000, 0.6594, 0.4667, 0.7072, |
| 3401 | * 0.5333, 0.7515, 0.6000, 0.7928, 0.6667, 0.8317, 0.7333, 0.8685, |
| 3402 | * 0.8000, 0.9035, 0.8667, 0.9370, 0.9333, 0.9691, 1.0000, 1.0000 ] |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3403 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3404 | * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p> |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3405 | * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3406 | * <pre><code>android.tonemap.curveRed = [ |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3407 | * 0.0000, 0.0000, 0.0667, 0.2864, 0.1333, 0.4007, 0.2000, 0.4845, |
| 3408 | * 0.2667, 0.5532, 0.3333, 0.6125, 0.4000, 0.6652, 0.4667, 0.7130, |
| 3409 | * 0.5333, 0.7569, 0.6000, 0.7977, 0.6667, 0.8360, 0.7333, 0.8721, |
| 3410 | * 0.8000, 0.9063, 0.8667, 0.9389, 0.9333, 0.9701, 1.0000, 1.0000 ] |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3411 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3412 | * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3413 | * <p><b>Range of valid values:</b><br> |
| 3414 | * 0-1 on both input and output coordinates, normalized |
| 3415 | * as a floating-point value such that 0 == black and 1 == white.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3416 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3417 | * <p><b>Full capability</b> - |
| 3418 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3419 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 3420 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3421 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3422 | * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS |
Eino-Ville Talvala | 0da8bf5 | 2014-01-08 16:18:35 -0800 | [diff] [blame] | 3423 | * @see CaptureRequest#TONEMAP_MODE |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3424 | * @hide |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3425 | */ |
| 3426 | public static final Key<float[]> TONEMAP_CURVE_RED = |
| 3427 | new Key<float[]>("android.tonemap.curveRed", float[].class); |
| 3428 | |
| 3429 | /** |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3430 | * <p>Tonemapping / contrast / gamma curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} |
| 3431 | * is CONTRAST_CURVE.</p> |
| 3432 | * <p>The tonemapCurve consist of three curves for each of red, green, and blue |
| 3433 | * channels respectively. The following example uses the red channel as an |
| 3434 | * example. The same logic applies to green and blue channel. |
| 3435 | * Each channel's curve is defined by an array of control points:</p> |
| 3436 | * <pre><code>curveRed = |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3437 | * [ P0(in, out), P1(in, out), P2(in, out), P3(in, out), ..., PN(in, out) ] |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3438 | * 2 <= N <= {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}</code></pre> |
| 3439 | * <p>These are sorted in order of increasing <code>Pin</code>; it is always |
| 3440 | * guaranteed that input values 0.0 and 1.0 are included in the list to |
| 3441 | * define a complete mapping. For input values between control points, |
| 3442 | * the camera device must linearly interpolate between the control |
| 3443 | * points.</p> |
| 3444 | * <p>Each curve can have an independent number of points, and the number |
| 3445 | * of points can be less than max (that is, the request doesn't have to |
| 3446 | * always provide a curve with number of points equivalent to |
| 3447 | * {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}).</p> |
Shuzhen Wang | a8d3603 | 2018-10-15 12:01:53 -0700 | [diff] [blame] | 3448 | * <p>For devices with MONOCHROME capability, all three channels must have the same set of |
| 3449 | * control points.</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3450 | * <p>A few examples, and their corresponding graphical mappings; these |
| 3451 | * only specify the red channel and the precision is limited to 4 |
| 3452 | * digits, for conciseness.</p> |
| 3453 | * <p>Linear mapping:</p> |
| 3454 | * <pre><code>curveRed = [ (0, 0), (1.0, 1.0) ] |
| 3455 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3456 | * <p><img alt="Linear mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png" /></p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3457 | * <p>Invert mapping:</p> |
| 3458 | * <pre><code>curveRed = [ (0, 1.0), (1.0, 0) ] |
| 3459 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3460 | * <p><img alt="Inverting mapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png" /></p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3461 | * <p>Gamma 1/2.2 mapping, with 16 control points:</p> |
| 3462 | * <pre><code>curveRed = [ |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3463 | * (0.0000, 0.0000), (0.0667, 0.2920), (0.1333, 0.4002), (0.2000, 0.4812), |
| 3464 | * (0.2667, 0.5484), (0.3333, 0.6069), (0.4000, 0.6594), (0.4667, 0.7072), |
| 3465 | * (0.5333, 0.7515), (0.6000, 0.7928), (0.6667, 0.8317), (0.7333, 0.8685), |
| 3466 | * (0.8000, 0.9035), (0.8667, 0.9370), (0.9333, 0.9691), (1.0000, 1.0000) ] |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3467 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3468 | * <p><img alt="Gamma = 1/2.2 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png" /></p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3469 | * <p>Standard sRGB gamma mapping, per IEC 61966-2-1:1999, with 16 control points:</p> |
| 3470 | * <pre><code>curveRed = [ |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3471 | * (0.0000, 0.0000), (0.0667, 0.2864), (0.1333, 0.4007), (0.2000, 0.4845), |
| 3472 | * (0.2667, 0.5532), (0.3333, 0.6125), (0.4000, 0.6652), (0.4667, 0.7130), |
| 3473 | * (0.5333, 0.7569), (0.6000, 0.7977), (0.6667, 0.8360), (0.7333, 0.8721), |
| 3474 | * (0.8000, 0.9063), (0.8667, 0.9389), (0.9333, 0.9701), (1.0000, 1.0000) ] |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3475 | * </code></pre> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3476 | * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3477 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3478 | * <p><b>Full capability</b> - |
| 3479 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3480 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3481 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3482 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3483 | * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS |
| 3484 | * @see CaptureRequest#TONEMAP_MODE |
| 3485 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3486 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3487 | @NonNull |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3488 | @SyntheticKey |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3489 | public static final Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE = |
| 3490 | new Key<android.hardware.camera2.params.TonemapCurve>("android.tonemap.curve", android.hardware.camera2.params.TonemapCurve.class); |
| 3491 | |
| 3492 | /** |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3493 | * <p>High-level global contrast/gamma/tonemapping control.</p> |
| 3494 | * <p>When switching to an application-defined contrast curve by setting |
| 3495 | * {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} to CONTRAST_CURVE, the curve is defined |
| 3496 | * per-channel with a set of <code>(in, out)</code> points that specify the |
| 3497 | * mapping from input high-bit-depth pixel value to the output |
| 3498 | * low-bit-depth value. Since the actual pixel ranges of both input |
| 3499 | * and output may change depending on the camera pipeline, the values |
| 3500 | * are specified by normalized floating-point numbers.</p> |
| 3501 | * <p>More-complex color mapping operations such as 3D color look-up |
| 3502 | * tables, selective chroma enhancement, or other non-linear color |
| 3503 | * transforms will be disabled when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3504 | * CONTRAST_CURVE.</p> |
| 3505 | * <p>When using either FAST or HIGH_QUALITY, the camera device will |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3506 | * emit its own tonemap curve in {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}. |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3507 | * These values are always available, and as close as possible to the |
| 3508 | * actually used nonlinear/nonglobal transforms.</p> |
Zhijun He | fa7c755 | 2014-05-22 16:36:02 -0700 | [diff] [blame] | 3509 | * <p>If a request is sent with CONTRAST_CURVE with the camera device's |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3510 | * provided curve in FAST or HIGH_QUALITY, the image's tonemap will be |
| 3511 | * roughly the same.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3512 | * <p><b>Possible values:</b> |
| 3513 | * <ul> |
| 3514 | * <li>{@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}</li> |
| 3515 | * <li>{@link #TONEMAP_MODE_FAST FAST}</li> |
| 3516 | * <li>{@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3517 | * <li>{@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}</li> |
| 3518 | * <li>{@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}</li> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3519 | * </ul></p> |
| 3520 | * <p><b>Available values for this device:</b><br> |
| 3521 | * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3522 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3523 | * <p><b>Full capability</b> - |
| 3524 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3525 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Igor Murashkin | 3242f4f | 2014-01-15 12:27:41 -0800 | [diff] [blame] | 3526 | * |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3527 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Ruben Brunk | 6dc379c | 2014-03-04 15:04:00 -0800 | [diff] [blame] | 3528 | * @see CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES |
Yin-Chia Yeh | 8490ace | 2014-05-27 10:04:54 -0700 | [diff] [blame] | 3529 | * @see CaptureRequest#TONEMAP_CURVE |
Igor Murashkin | e006093 | 2014-01-17 17:24:11 -0800 | [diff] [blame] | 3530 | * @see CaptureRequest#TONEMAP_MODE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3531 | * @see #TONEMAP_MODE_CONTRAST_CURVE |
| 3532 | * @see #TONEMAP_MODE_FAST |
| 3533 | * @see #TONEMAP_MODE_HIGH_QUALITY |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3534 | * @see #TONEMAP_MODE_GAMMA_VALUE |
| 3535 | * @see #TONEMAP_MODE_PRESET_CURVE |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3536 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3537 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3538 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3539 | public static final Key<Integer> TONEMAP_MODE = |
| 3540 | new Key<Integer>("android.tonemap.mode", int.class); |
| 3541 | |
| 3542 | /** |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3543 | * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3544 | * GAMMA_VALUE</p> |
| 3545 | * <p>The tonemap curve will be defined the following formula: |
| 3546 | * * OUT = pow(IN, 1.0 / gamma) |
| 3547 | * where IN and OUT is the input pixel value scaled to range [0.0, 1.0], |
| 3548 | * pow is the power function and gamma is the gamma value specified by this |
| 3549 | * key.</p> |
| 3550 | * <p>The same curve will be applied to all color channels. The camera device |
| 3551 | * may clip the input gamma value to its supported range. The actual applied |
| 3552 | * value will be returned in capture result.</p> |
| 3553 | * <p>The valid range of gamma value varies on different devices, but values |
| 3554 | * within [1.0, 5.0] are guaranteed not to be clipped.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3555 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3556 | * |
| 3557 | * @see CaptureRequest#TONEMAP_MODE |
| 3558 | */ |
| 3559 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3560 | @NonNull |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3561 | public static final Key<Float> TONEMAP_GAMMA = |
| 3562 | new Key<Float>("android.tonemap.gamma", float.class); |
| 3563 | |
| 3564 | /** |
| 3565 | * <p>Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is |
| 3566 | * PRESET_CURVE</p> |
| 3567 | * <p>The tonemap curve will be defined by specified standard.</p> |
| 3568 | * <p>sRGB (approximated by 16 control points):</p> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3569 | * <p><img alt="sRGB tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png" /></p> |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3570 | * <p>Rec. 709 (approximated by 16 control points):</p> |
Eino-Ville Talvala | 9dc7ec1 | 2017-11-10 15:23:00 -0800 | [diff] [blame] | 3571 | * <p><img alt="Rec. 709 tonemapping curve" src="/reference/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png" /></p> |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3572 | * <p>Note that above figures show a 16 control points approximation of preset |
| 3573 | * curves. Camera devices may apply a different approximation to the curve.</p> |
| 3574 | * <p><b>Possible values:</b> |
| 3575 | * <ul> |
| 3576 | * <li>{@link #TONEMAP_PRESET_CURVE_SRGB SRGB}</li> |
| 3577 | * <li>{@link #TONEMAP_PRESET_CURVE_REC709 REC709}</li> |
| 3578 | * </ul></p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3579 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3580 | * |
| 3581 | * @see CaptureRequest#TONEMAP_MODE |
| 3582 | * @see #TONEMAP_PRESET_CURVE_SRGB |
| 3583 | * @see #TONEMAP_PRESET_CURVE_REC709 |
| 3584 | */ |
| 3585 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3586 | @NonNull |
Yin-Chia Yeh | 956c52b | 2015-02-06 11:23:25 -0800 | [diff] [blame] | 3587 | public static final Key<Integer> TONEMAP_PRESET_CURVE = |
| 3588 | new Key<Integer>("android.tonemap.presetCurve", int.class); |
| 3589 | |
| 3590 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3591 | * <p>This LED is nominally used to indicate to the user |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3592 | * that the camera is powered on and may be streaming images back to the |
| 3593 | * Application Processor. In certain rare circumstances, the OS may |
| 3594 | * disable this when video is processed locally and not transmitted to |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3595 | * any untrusted applications.</p> |
| 3596 | * <p>In particular, the LED <em>must</em> always be on when the data could be |
| 3597 | * transmitted off the device. The LED <em>should</em> always be on whenever |
| 3598 | * data is stored locally on the device.</p> |
| 3599 | * <p>The LED <em>may</em> be off if a trusted application is using the data that |
| 3600 | * doesn't violate the above rules.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3601 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3602 | * @hide |
| 3603 | */ |
| 3604 | public static final Key<Boolean> LED_TRANSMIT = |
| 3605 | new Key<Boolean>("android.led.transmit", boolean.class); |
| 3606 | |
| 3607 | /** |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3608 | * <p>Whether black-level compensation is locked |
Eino-Ville Talvala | 0956af5 | 2013-12-26 13:19:10 -0800 | [diff] [blame] | 3609 | * to its current values, or is free to vary.</p> |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3610 | * <p>When set to <code>true</code> (ON), the values used for black-level |
Eino-Ville Talvala | 0956af5 | 2013-12-26 13:19:10 -0800 | [diff] [blame] | 3611 | * compensation will not change until the lock is set to |
Eino-Ville Talvala | fd3e289 | 2014-10-06 10:23:55 -0700 | [diff] [blame] | 3612 | * <code>false</code> (OFF).</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3613 | * <p>Since changes to certain capture parameters (such as |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3614 | * exposure time) may require resetting of black level |
Eino-Ville Talvala | 0956af5 | 2013-12-26 13:19:10 -0800 | [diff] [blame] | 3615 | * compensation, the camera device must report whether setting |
| 3616 | * the black level lock was successful in the output result |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3617 | * metadata.</p> |
| 3618 | * <p>For example, if a sequence of requests is as follows:</p> |
| 3619 | * <ul> |
| 3620 | * <li>Request 1: Exposure = 10ms, Black level lock = OFF</li> |
| 3621 | * <li>Request 2: Exposure = 10ms, Black level lock = ON</li> |
| 3622 | * <li>Request 3: Exposure = 10ms, Black level lock = ON</li> |
| 3623 | * <li>Request 4: Exposure = 20ms, Black level lock = ON</li> |
| 3624 | * <li>Request 5: Exposure = 20ms, Black level lock = ON</li> |
| 3625 | * <li>Request 6: Exposure = 20ms, Black level lock = ON</li> |
| 3626 | * </ul> |
Eino-Ville Talvala | 0956af5 | 2013-12-26 13:19:10 -0800 | [diff] [blame] | 3627 | * <p>And the exposure change in Request 4 requires the camera |
| 3628 | * device to reset the black level offsets, then the output |
| 3629 | * result metadata is expected to be:</p> |
Igor Murashkin | ace5bf0 | 2013-12-10 17:36:40 -0800 | [diff] [blame] | 3630 | * <ul> |
| 3631 | * <li>Result 1: Exposure = 10ms, Black level lock = OFF</li> |
| 3632 | * <li>Result 2: Exposure = 10ms, Black level lock = ON</li> |
| 3633 | * <li>Result 3: Exposure = 10ms, Black level lock = ON</li> |
| 3634 | * <li>Result 4: Exposure = 20ms, Black level lock = OFF</li> |
| 3635 | * <li>Result 5: Exposure = 20ms, Black level lock = ON</li> |
| 3636 | * <li>Result 6: Exposure = 20ms, Black level lock = ON</li> |
| 3637 | * </ul> |
Eino-Ville Talvala | 0956af5 | 2013-12-26 13:19:10 -0800 | [diff] [blame] | 3638 | * <p>This indicates to the application that on frame 4, black |
| 3639 | * levels were reset due to exposure value changes, and pixel |
| 3640 | * values may not be consistent across captures.</p> |
| 3641 | * <p>The camera device will maintain the lock to the extent |
| 3642 | * possible, only overriding the lock to OFF when changes to |
| 3643 | * other request parameters require a black level recalculation |
| 3644 | * or reset.</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3645 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3646 | * <p><b>Full capability</b> - |
| 3647 | * Present on all camera devices that report being {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_FULL HARDWARE_LEVEL_FULL} devices in the |
| 3648 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
| 3649 | * |
| 3650 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3651 | */ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3652 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3653 | @NonNull |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3654 | public static final Key<Boolean> BLACK_LEVEL_LOCK = |
| 3655 | new Key<Boolean>("android.blackLevel.lock", boolean.class); |
| 3656 | |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 3657 | /** |
| 3658 | * <p>The amount of exposure time increase factor applied to the original output |
| 3659 | * frame by the application processing before sending for reprocessing.</p> |
| 3660 | * <p>This is optional, and will be supported if the camera device supports YUV_REPROCESSING |
| 3661 | * capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities} contains YUV_REPROCESSING).</p> |
| 3662 | * <p>For some YUV reprocessing use cases, the application may choose to filter the original |
| 3663 | * output frames to effectively reduce the noise to the same level as a frame that was |
| 3664 | * captured with longer exposure time. To be more specific, assuming the original captured |
| 3665 | * images were captured with a sensitivity of S and an exposure time of T, the model in |
| 3666 | * the camera device is that the amount of noise in the image would be approximately what |
| 3667 | * would be expected if the original capture parameters had been a sensitivity of |
| 3668 | * S/effectiveExposureFactor and an exposure time of T*effectiveExposureFactor, rather |
| 3669 | * than S and T respectively. If the captured images were processed by the application |
| 3670 | * before being sent for reprocessing, then the application may have used image processing |
| 3671 | * algorithms and/or multi-frame image fusion to reduce the noise in the |
| 3672 | * application-processed images (input images). By using the effectiveExposureFactor |
| 3673 | * control, the application can communicate to the camera device the actual noise level |
| 3674 | * improvement in the application-processed image. With this information, the camera |
| 3675 | * device can select appropriate noise reduction and edge enhancement parameters to avoid |
| 3676 | * excessive noise reduction ({@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}) and insufficient edge |
| 3677 | * enhancement ({@link CaptureRequest#EDGE_MODE android.edge.mode}) being applied to the reprocessed frames.</p> |
| 3678 | * <p>For example, for multi-frame image fusion use case, the application may fuse |
| 3679 | * multiple output frames together to a final frame for reprocessing. When N image are |
| 3680 | * fused into 1 image for reprocessing, the exposure time increase factor could be up to |
| 3681 | * square root of N (based on a simple photon shot noise model). The camera device will |
| 3682 | * adjust the reprocessing noise reduction and edge enhancement parameters accordingly to |
| 3683 | * produce the best quality images.</p> |
| 3684 | * <p>This is relative factor, 1.0 indicates the application hasn't processed the input |
| 3685 | * buffer in a way that affects its effective exposure time.</p> |
| 3686 | * <p>This control is only effective for YUV reprocessing capture request. For noise |
| 3687 | * reduction reprocessing, it is only effective when <code>{@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode} != OFF</code>. |
| 3688 | * Similarly, for edge enhancement reprocessing, it is only effective when |
| 3689 | * <code>{@link CaptureRequest#EDGE_MODE android.edge.mode} != OFF</code>.</p> |
| 3690 | * <p><b>Units</b>: Relative exposure time increase factor.</p> |
| 3691 | * <p><b>Range of valid values:</b><br> |
| 3692 | * >= 1.0</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3693 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Zhijun He | 513f7c3 | 2015-04-24 18:23:54 -0700 | [diff] [blame] | 3694 | * <p><b>Limited capability</b> - |
| 3695 | * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the |
| 3696 | * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key</p> |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 3697 | * |
| 3698 | * @see CaptureRequest#EDGE_MODE |
Zhijun He | 513f7c3 | 2015-04-24 18:23:54 -0700 | [diff] [blame] | 3699 | * @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 3700 | * @see CaptureRequest#NOISE_REDUCTION_MODE |
| 3701 | * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES |
| 3702 | */ |
| 3703 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3704 | @NonNull |
Zhijun He | 0e99c22 | 2015-01-29 15:26:05 -0800 | [diff] [blame] | 3705 | public static final Key<Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = |
| 3706 | new Key<Float>("android.reprocess.effectiveExposureFactor", float.class); |
| 3707 | |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3708 | /** |
| 3709 | * <p>Mode of operation for the lens distortion correction block.</p> |
| 3710 | * <p>The lens distortion correction block attempts to improve image quality by fixing |
| 3711 | * radial, tangential, or other geometric aberrations in the camera device's optics. If |
| 3712 | * available, the {@link CameraCharacteristics#LENS_DISTORTION android.lens.distortion} field documents the lens's distortion parameters.</p> |
| 3713 | * <p>OFF means no distortion correction is done.</p> |
| 3714 | * <p>FAST/HIGH_QUALITY both mean camera device determined distortion correction will be |
| 3715 | * applied. HIGH_QUALITY mode indicates that the camera device will use the highest-quality |
| 3716 | * correction algorithms, even if it slows down capture rate. FAST means the camera device |
| 3717 | * will not slow down capture rate when applying correction. FAST may be the same as OFF if |
| 3718 | * any correction at all would slow down capture rate. Every output stream will have a |
| 3719 | * similar amount of enhancement applied.</p> |
Shuzhen Wang | ec5e8d2 | 2018-09-28 09:28:48 -0700 | [diff] [blame] | 3720 | * <p>The correction only applies to processed outputs such as YUV, Y8, JPEG, or DEPTH16; it is |
| 3721 | * not applied to any RAW output.</p> |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 3722 | * <p>This control will be on by default on devices that support this control. Applications |
| 3723 | * disabling distortion correction need to pay extra attention with the coordinate system of |
| 3724 | * metering regions, crop region, and face rectangles. When distortion correction is OFF, |
| 3725 | * metadata coordinates follow the coordinate system of |
| 3726 | * {@link CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE android.sensor.info.preCorrectionActiveArraySize}. When distortion is not OFF, metadata |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 3727 | * coordinates follow the coordinate system of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. The |
| 3728 | * camera device will map these metadata fields to match the corrected image produced by the |
| 3729 | * camera device, for both capture requests and results. However, this mapping is not very |
| 3730 | * precise, since rectangles do not generally map to rectangles when corrected. Only linear |
| 3731 | * scaling between the active array and precorrection active array coordinates is |
| 3732 | * performed. Applications that require precise correction of metadata need to undo that |
| 3733 | * linear scaling, and apply a more complete correction that takes into the account the app's |
| 3734 | * own requirements.</p> |
| 3735 | * <p>The full list of metadata that is affected in this way by distortion correction is:</p> |
| 3736 | * <ul> |
| 3737 | * <li>{@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}</li> |
| 3738 | * <li>{@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}</li> |
| 3739 | * <li>{@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}</li> |
| 3740 | * <li>{@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}</li> |
| 3741 | * <li>{@link CaptureResult#STATISTICS_FACES android.statistics.faces}</li> |
| 3742 | * </ul> |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3743 | * <p><b>Possible values:</b> |
| 3744 | * <ul> |
| 3745 | * <li>{@link #DISTORTION_CORRECTION_MODE_OFF OFF}</li> |
| 3746 | * <li>{@link #DISTORTION_CORRECTION_MODE_FAST FAST}</li> |
| 3747 | * <li>{@link #DISTORTION_CORRECTION_MODE_HIGH_QUALITY HIGH_QUALITY}</li> |
| 3748 | * </ul></p> |
| 3749 | * <p><b>Available values for this device:</b><br> |
| 3750 | * {@link CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES android.distortionCorrection.availableModes}</p> |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3751 | * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p> |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3752 | * |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 3753 | * @see CaptureRequest#CONTROL_AE_REGIONS |
| 3754 | * @see CaptureRequest#CONTROL_AF_REGIONS |
| 3755 | * @see CaptureRequest#CONTROL_AWB_REGIONS |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3756 | * @see CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES |
| 3757 | * @see CameraCharacteristics#LENS_DISTORTION |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 3758 | * @see CaptureRequest#SCALER_CROP_REGION |
Yin-Chia Yeh | 6c73e40 | 2018-06-15 15:37:08 -0700 | [diff] [blame] | 3759 | * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE |
| 3760 | * @see CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE |
Eino-Ville Talvala | 08bd163 | 2018-08-01 17:23:09 -0700 | [diff] [blame] | 3761 | * @see CaptureResult#STATISTICS_FACES |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3762 | * @see #DISTORTION_CORRECTION_MODE_OFF |
| 3763 | * @see #DISTORTION_CORRECTION_MODE_FAST |
| 3764 | * @see #DISTORTION_CORRECTION_MODE_HIGH_QUALITY |
| 3765 | */ |
| 3766 | @PublicKey |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3767 | @NonNull |
Eino-Ville Talvala | 4167072 | 2018-03-13 19:43:07 -0700 | [diff] [blame] | 3768 | public static final Key<Integer> DISTORTION_CORRECTION_MODE = |
| 3769 | new Key<Integer>("android.distortionCorrection.mode", int.class); |
| 3770 | |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3771 | /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ |
| 3772 | * End generated code |
| 3773 | *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ |
Igor Murashkin | 6c76f58 | 2014-07-15 17:19:49 -0700 | [diff] [blame] | 3774 | |
Igor Murashkin | 4b8cd6b | 2014-10-02 16:00:52 -0700 | [diff] [blame] | 3775 | |
| 3776 | |
Shuzhen Wang | 1484a21e | 2019-02-28 10:01:00 -0800 | [diff] [blame] | 3777 | |
| 3778 | |
| 3779 | |
Eino-Ville Talvala | 5a32b20c | 2013-08-08 12:38:36 -0700 | [diff] [blame] | 3780 | } |