blob: b82104d59e352eb8e4f5563be9ec25d58ae21df7 [file] [log] [blame]
Eino-Ville Talvalab2675542012-12-12 13:29:45 -08001/*
2 * Copyright (C) 2012 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 Talvala2f1a2e42013-07-25 17:12:05 -070017package android.hardware.camera2;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080018
19import android.graphics.Point;
20import android.graphics.Rect;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070021import android.hardware.camera2.impl.CameraMetadataNative;
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080022
23/**
24 * <p>The results of a single image capture from the image sensor.</p>
25 *
26 * <p>Contains the final configuration for the capture hardware (sensor, lens,
27 * flash), the processing pipeline, the control algorithms, and the output
28 * buffers.</p>
29 *
30 * <p>CaptureResults are produced by a {@link CameraDevice} after processing a
31 * {@link CaptureRequest}. All properties listed for capture requests can also
32 * be queried on the capture result, to determine the final values used for
33 * capture. The result also includes additional metadata about the state of the
34 * camera device during the capture.</p>
35 *
36 */
37public final class CaptureResult extends CameraMetadata {
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070038
39 private final CameraMetadataNative mResults;
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -070040 private final CaptureRequest mRequest;
41 private final int mSequenceId;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070042
Igor Murashkin70725502013-06-25 20:27:06 +000043 /**
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070044 * Takes ownership of the passed-in properties object
Igor Murashkin70725502013-06-25 20:27:06 +000045 * @hide
46 */
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -070047 public CaptureResult(CameraMetadataNative results, CaptureRequest parent, int sequenceId) {
48 if (results == null) {
49 throw new IllegalArgumentException("results was null");
50 }
51
52 if (parent == null) {
53 throw new IllegalArgumentException("parent was null");
54 }
55
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070056 mResults = results;
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -070057 mRequest = parent;
58 mSequenceId = sequenceId;
Eino-Ville Talvala70c22072013-08-27 12:09:04 -070059 }
60
61 @Override
62 public <T> T get(Key<T> key) {
63 return mResults.get(key);
Eino-Ville Talvalab2675542012-12-12 13:29:45 -080064 }
65
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -070066 /**
67 * Get the request associated with this result.
68 *
69 * <p>Whenever a request is successfully captured, with
70 * {@link CameraDevice.CaptureListener#onCaptureCompleted},
71 * the {@code result}'s {@code getRequest()} will return that {@code request}.
72 * </p>
73 *
74 * <p>In particular,
75 * <code><pre>cameraDevice.capture(someRequest, new CaptureListener() {
76 * {@literal @}Override
77 * void onCaptureCompleted(CaptureRequest myRequest, CaptureResult myResult) {
78 * assert(myResult.getRequest.equals(myRequest) == true);
79 * }
80 * };
81 * </code></pre>
82 * </p>
83 *
84 * @return The request associated with this result. Never {@code null}.
85 */
86 public CaptureRequest getRequest() {
87 return mRequest;
88 }
89
90 /**
91 * Get the frame number associated with this result.
92 *
93 * <p>Whenever a request has been processed, regardless of failure or success,
94 * it gets a unique frame number assigned to its future result/failure.</p>
95 *
96 * <p>This value monotonically increments, starting with 0,
97 * for every new result or failure; and the scope is the lifetime of the
98 * {@link CameraDevice}.</p>
99 *
100 * @return int frame number
101 */
102 public int getFrameNumber() {
103 return get(REQUEST_FRAME_COUNT);
104 }
105
106 /**
107 * The sequence ID for this failure that was returned by the
108 * {@link CameraDevice#capture} family of functions.
109 *
110 * <p>The sequence ID is a unique monotonically increasing value starting from 0,
111 * incremented every time a new group of requests is submitted to the CameraDevice.</p>
112 *
113 * @return int The ID for the sequence of requests that this capture result is a part of
114 *
115 * @see CameraDevice.CaptureListener#onCaptureSequenceCompleted
116 */
117 public int getSequenceId() {
118 return mSequenceId;
119 }
120
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700121 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
122 * The key entries below this point are generated from metadata
123 * definitions in /system/media/camera/docs. Do not modify by hand or
124 * modify the comment blocks at the start or end.
125 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
126
127 /**
128 * <p>
129 * A color transform matrix to use to transform
130 * from sensor RGB color space to output linear sRGB color space
131 * </p>
132 * <p>
133 * This matrix is either set by HAL when the request
134 * android.colorCorrection.mode is not TRANSFORM_MATRIX, or
135 * directly by the application in the request when the
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700136 * android.colorCorrection.mode is TRANSFORM_MATRIX.
137 * </p><p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700138 * In the latter case, the HAL may round the matrix to account
139 * for precision issues; the final rounded matrix should be
140 * reported back in this matrix result metadata.
141 * </p>
142 */
143 public static final Key<Rational[]> COLOR_CORRECTION_TRANSFORM =
144 new Key<Rational[]>("android.colorCorrection.transform", Rational[].class);
145
146 /**
147 * <p>
148 * Gains applying to Bayer color channels for
149 * white-balance
150 * </p>
151 * <p>
152 * The 4-channel white-balance gains are defined in
153 * the order of [R G_even G_odd B], where G_even is the gain
154 * for green pixels on even rows of the output, and G_odd
155 * is the gain for greenpixels on the odd rows. if a HAL
156 * does not support a separate gain for even/odd green channels,
157 * it should use the G_even value,and write G_odd equal to
158 * G_even in the output result metadata.
159 * </p><p>
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700160 * This array is either set by HAL when the request
161 * android.colorCorrection.mode is not TRANSFORM_MATRIX, or
162 * directly by the application in the request when the
163 * android.colorCorrection.mode is TRANSFORM_MATRIX.
164 * </p><p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700165 * The ouput should be the gains actually applied by the HAL to
166 * the current frame.
167 * </p>
168 */
169 public static final Key<float[]> COLOR_CORRECTION_GAINS =
170 new Key<float[]>("android.colorCorrection.gains", float[].class);
171
172 /**
173 * <p>
174 * The ID sent with the latest
175 * CAMERA2_TRIGGER_PRECAPTURE_METERING call
176 * </p>
177 * <p>
178 * Must be 0 if no
179 * CAMERA2_TRIGGER_PRECAPTURE_METERING trigger received yet
180 * by HAL. Always updated even if AE algorithm ignores the
181 * trigger
182 * </p>
183 *
184 * @hide
185 */
186 public static final Key<Integer> CONTROL_AE_PRECAPTURE_ID =
187 new Key<Integer>("android.control.aePrecaptureId", int.class);
188
189 /**
190 * <p>
191 * List of areas to use for
192 * metering
193 * </p>
194 * <p>
195 * Each area is a rectangle plus weight: xmin, ymin,
Timothy Knight2629f272013-09-03 17:23:23 -0700196 * xmax, ymax, weight. The rectangle is defined inclusive of the
197 * specified coordinates.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700198 * </p><p>
199 * The coordinate system is based on the active pixel array,
Timothy Knight2629f272013-09-03 17:23:23 -0700200 * with (0,0) being the top-left pixel in the active pixel array, and
201 * (android.sensor.info.activeArraySize.width - 1,
202 * android.sensor.info.activeArraySize.height - 1) being the
203 * bottom-right pixel in the active pixel array. The weight
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700204 * should be nonnegative.
205 * </p><p>
206 * If all regions have 0 weight, then no specific metering area
207 * needs to be used by the HAL. If the metering region is
208 * outside the current android.scaler.cropRegion, the HAL
209 * should ignore the sections outside the region and output the
210 * used sections in the frame metadata
211 * </p>
212 */
213 public static final Key<int[]> CONTROL_AE_REGIONS =
214 new Key<int[]>("android.control.aeRegions", int[].class);
215
216 /**
217 * <p>
218 * Current state of AE algorithm
219 * </p>
220 * <p>
221 * Whenever the AE algorithm state changes, a
222 * MSG_AUTOEXPOSURE notification must be send if a
223 * notification callback is registered.
224 * </p>
225 * @see #CONTROL_AE_STATE_INACTIVE
226 * @see #CONTROL_AE_STATE_SEARCHING
227 * @see #CONTROL_AE_STATE_CONVERGED
228 * @see #CONTROL_AE_STATE_LOCKED
229 * @see #CONTROL_AE_STATE_FLASH_REQUIRED
230 * @see #CONTROL_AE_STATE_PRECAPTURE
231 */
232 public static final Key<Integer> CONTROL_AE_STATE =
233 new Key<Integer>("android.control.aeState", int.class);
234
235 /**
236 * <p>
237 * Whether AF is currently enabled, and what
238 * mode it is set to
239 * </p>
240 * @see #CONTROL_AF_MODE_OFF
241 * @see #CONTROL_AF_MODE_AUTO
242 * @see #CONTROL_AF_MODE_MACRO
243 * @see #CONTROL_AF_MODE_CONTINUOUS_VIDEO
244 * @see #CONTROL_AF_MODE_CONTINUOUS_PICTURE
245 * @see #CONTROL_AF_MODE_EDOF
246 */
247 public static final Key<Integer> CONTROL_AF_MODE =
248 new Key<Integer>("android.control.afMode", int.class);
249
250 /**
251 * <p>
252 * List of areas to use for focus
253 * estimation
254 * </p>
255 * <p>
256 * Each area is a rectangle plus weight: xmin, ymin,
Timothy Knight2629f272013-09-03 17:23:23 -0700257 * xmax, ymax, weight. The rectangle is defined inclusive of the
258 * specified coordinates.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700259 * </p><p>
260 * The coordinate system is based on the active pixel array,
Timothy Knight2629f272013-09-03 17:23:23 -0700261 * with (0,0) being the top-left pixel in the active pixel array, and
262 * (android.sensor.info.activeArraySize.width - 1,
263 * android.sensor.info.activeArraySize.height - 1) being the
264 * bottom-right pixel in the active pixel array. The weight
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700265 * should be nonnegative.
266 * </p><p>
267 * If all regions have 0 weight, then no specific focus area
268 * needs to be used by the HAL. If the focusing region is
269 * outside the current android.scaler.cropRegion, the HAL
270 * should ignore the sections outside the region and output the
271 * used sections in the frame metadata
272 * </p>
273 */
274 public static final Key<int[]> CONTROL_AF_REGIONS =
275 new Key<int[]>("android.control.afRegions", int[].class);
276
277 /**
278 * <p>
279 * Current state of AF algorithm
280 * </p>
281 * <p>
282 * Whenever the AF algorithm state changes, a
283 * MSG_AUTOFOCUS notification must be send if a notification
284 * callback is registered.
285 * </p>
286 * @see #CONTROL_AF_STATE_INACTIVE
287 * @see #CONTROL_AF_STATE_PASSIVE_SCAN
288 * @see #CONTROL_AF_STATE_PASSIVE_FOCUSED
289 * @see #CONTROL_AF_STATE_ACTIVE_SCAN
290 * @see #CONTROL_AF_STATE_FOCUSED_LOCKED
291 * @see #CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
292 */
293 public static final Key<Integer> CONTROL_AF_STATE =
294 new Key<Integer>("android.control.afState", int.class);
295
296 /**
297 * <p>
298 * The ID sent with the latest
299 * CAMERA2_TRIGGER_AUTOFOCUS call
300 * </p>
301 * <p>
302 * Must be 0 if no CAMERA2_TRIGGER_AUTOFOCUS trigger
303 * received yet by HAL. Always updated even if AF algorithm
304 * ignores the trigger
305 * </p>
306 *
307 * @hide
308 */
309 public static final Key<Integer> CONTROL_AF_TRIGGER_ID =
310 new Key<Integer>("android.control.afTriggerId", int.class);
311
312 /**
313 * <p>
314 * Whether AWB is currently setting the color
315 * transform fields, and what its illumination target
316 * is
317 * </p>
318 * <p>
319 * [BC - AWB lock,AWB modes]
320 * </p>
321 * @see #CONTROL_AWB_MODE_OFF
322 * @see #CONTROL_AWB_MODE_AUTO
323 * @see #CONTROL_AWB_MODE_INCANDESCENT
324 * @see #CONTROL_AWB_MODE_FLUORESCENT
325 * @see #CONTROL_AWB_MODE_WARM_FLUORESCENT
326 * @see #CONTROL_AWB_MODE_DAYLIGHT
327 * @see #CONTROL_AWB_MODE_CLOUDY_DAYLIGHT
328 * @see #CONTROL_AWB_MODE_TWILIGHT
329 * @see #CONTROL_AWB_MODE_SHADE
330 */
331 public static final Key<Integer> CONTROL_AWB_MODE =
332 new Key<Integer>("android.control.awbMode", int.class);
333
334 /**
335 * <p>
336 * List of areas to use for illuminant
337 * estimation
338 * </p>
339 * <p>
340 * Only used in AUTO mode.
341 * </p><p>
Timothy Knight2629f272013-09-03 17:23:23 -0700342 * Each area is a rectangle plus weight: xmin, ymin,
343 * xmax, ymax, weight. The rectangle is defined inclusive of the
344 * specified coordinates.
345 * </p><p>
346 * The coordinate system is based on the active pixel array,
347 * with (0,0) being the top-left pixel in the active pixel array, and
348 * (android.sensor.info.activeArraySize.width - 1,
349 * android.sensor.info.activeArraySize.height - 1) being the
350 * bottom-right pixel in the active pixel array. The weight
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700351 * should be nonnegative.
352 * </p><p>
353 * If all regions have 0 weight, then no specific metering area
354 * needs to be used by the HAL. If the metering region is
355 * outside the current android.scaler.cropRegion, the HAL
356 * should ignore the sections outside the region and output the
357 * used sections in the frame metadata
358 * </p>
359 */
360 public static final Key<int[]> CONTROL_AWB_REGIONS =
361 new Key<int[]>("android.control.awbRegions", int[].class);
362
363 /**
364 * <p>
365 * Current state of AWB algorithm
366 * </p>
367 * <p>
368 * Whenever the AWB algorithm state changes, a
369 * MSG_AUTOWHITEBALANCE notification must be send if a
370 * notification callback is registered.
371 * </p>
372 * @see #CONTROL_AWB_STATE_INACTIVE
373 * @see #CONTROL_AWB_STATE_SEARCHING
374 * @see #CONTROL_AWB_STATE_CONVERGED
375 * @see #CONTROL_AWB_STATE_LOCKED
376 */
377 public static final Key<Integer> CONTROL_AWB_STATE =
378 new Key<Integer>("android.control.awbState", int.class);
379
380 /**
381 * <p>
382 * Overall mode of 3A control
383 * routines
384 * </p>
385 * @see #CONTROL_MODE_OFF
386 * @see #CONTROL_MODE_AUTO
387 * @see #CONTROL_MODE_USE_SCENE_MODE
388 */
389 public static final Key<Integer> CONTROL_MODE =
390 new Key<Integer>("android.control.mode", int.class);
391
392 /**
393 * <p>
394 * Operation mode for edge
395 * enhancement
396 * </p>
397 * @see #EDGE_MODE_OFF
398 * @see #EDGE_MODE_FAST
399 * @see #EDGE_MODE_HIGH_QUALITY
400 */
401 public static final Key<Integer> EDGE_MODE =
402 new Key<Integer>("android.edge.mode", int.class);
403
404 /**
405 * <p>
406 * Select flash operation mode
407 * </p>
408 * @see #FLASH_MODE_OFF
409 * @see #FLASH_MODE_SINGLE
410 * @see #FLASH_MODE_TORCH
411 */
412 public static final Key<Integer> FLASH_MODE =
413 new Key<Integer>("android.flash.mode", int.class);
414
415 /**
416 * <p>
417 * Current state of the flash
418 * unit
419 * </p>
420 * @see #FLASH_STATE_UNAVAILABLE
421 * @see #FLASH_STATE_CHARGING
422 * @see #FLASH_STATE_READY
423 * @see #FLASH_STATE_FIRED
424 */
425 public static final Key<Integer> FLASH_STATE =
426 new Key<Integer>("android.flash.state", int.class);
427
428 /**
429 * <p>
430 * GPS coordinates to include in output JPEG
431 * EXIF
432 * </p>
433 */
434 public static final Key<double[]> JPEG_GPS_COORDINATES =
435 new Key<double[]>("android.jpeg.gpsCoordinates", double[].class);
436
437 /**
438 * <p>
439 * 32 characters describing GPS algorithm to
440 * include in EXIF
441 * </p>
442 */
443 public static final Key<String> JPEG_GPS_PROCESSING_METHOD =
444 new Key<String>("android.jpeg.gpsProcessingMethod", String.class);
445
446 /**
447 * <p>
448 * Time GPS fix was made to include in
449 * EXIF
450 * </p>
451 */
452 public static final Key<Long> JPEG_GPS_TIMESTAMP =
453 new Key<Long>("android.jpeg.gpsTimestamp", long.class);
454
455 /**
456 * <p>
457 * Orientation of JPEG image to
458 * write
459 * </p>
460 */
461 public static final Key<Integer> JPEG_ORIENTATION =
462 new Key<Integer>("android.jpeg.orientation", int.class);
463
464 /**
465 * <p>
466 * Compression quality of the final JPEG
467 * image
468 * </p>
469 * <p>
470 * 85-95 is typical usage range
471 * </p>
472 */
473 public static final Key<Byte> JPEG_QUALITY =
474 new Key<Byte>("android.jpeg.quality", byte.class);
475
476 /**
477 * <p>
478 * Compression quality of JPEG
479 * thumbnail
480 * </p>
481 */
482 public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
483 new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
484
485 /**
486 * <p>
487 * Resolution of embedded JPEG
488 * thumbnail
489 * </p>
490 */
491 public static final Key<android.hardware.camera2.Size> JPEG_THUMBNAIL_SIZE =
492 new Key<android.hardware.camera2.Size>("android.jpeg.thumbnailSize", android.hardware.camera2.Size.class);
493
494 /**
495 * <p>
496 * Size of the lens aperture
497 * </p>
498 * <p>
499 * Will not be supported on most devices. Can only
500 * pick from supported list
501 * </p>
502 */
503 public static final Key<Float> LENS_APERTURE =
504 new Key<Float>("android.lens.aperture", float.class);
505
506 /**
507 * <p>
508 * State of lens neutral density
509 * filter(s)
510 * </p>
511 * <p>
512 * Will not be supported on most devices. Can only
513 * pick from supported list
514 * </p>
515 */
516 public static final Key<Float> LENS_FILTER_DENSITY =
517 new Key<Float>("android.lens.filterDensity", float.class);
518
519 /**
520 * <p>
521 * Lens optical zoom setting
522 * </p>
523 * <p>
524 * Will not be supported on most devices.
525 * </p>
526 */
527 public static final Key<Float> LENS_FOCAL_LENGTH =
528 new Key<Float>("android.lens.focalLength", float.class);
529
530 /**
531 * <p>
532 * Distance to plane of sharpest focus,
533 * measured from frontmost surface of the lens
534 * </p>
535 * <p>
536 * Should be zero for fixed-focus cameras
537 * </p>
538 */
539 public static final Key<Float> LENS_FOCUS_DISTANCE =
540 new Key<Float>("android.lens.focusDistance", float.class);
541
542 /**
543 * <p>
544 * The range of scene distances that are in
545 * sharp focus (depth of field)
546 * </p>
547 * <p>
548 * If variable focus not supported, can still report
549 * fixed depth of field range
550 * </p>
551 */
552 public static final Key<Float> LENS_FOCUS_RANGE =
553 new Key<Float>("android.lens.focusRange", float.class);
554
555 /**
556 * <p>
557 * Whether optical image stabilization is
558 * enabled.
559 * </p>
560 * <p>
561 * Will not be supported on most devices.
562 * </p>
563 * @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
564 * @see #LENS_OPTICAL_STABILIZATION_MODE_ON
565 */
566 public static final Key<Integer> LENS_OPTICAL_STABILIZATION_MODE =
567 new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
568
569 /**
570 * <p>
571 * Current lens status
572 * </p>
573 * @see #LENS_STATE_STATIONARY
Igor Murashkin9ea4ae62013-09-11 21:40:11 -0700574 * @see #LENS_STATE_MOVING
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700575 */
576 public static final Key<Integer> LENS_STATE =
577 new Key<Integer>("android.lens.state", int.class);
578
579 /**
580 * <p>
581 * Mode of operation for the noise reduction
582 * algorithm
583 * </p>
584 * @see #NOISE_REDUCTION_MODE_OFF
585 * @see #NOISE_REDUCTION_MODE_FAST
586 * @see #NOISE_REDUCTION_MODE_HIGH_QUALITY
587 */
588 public static final Key<Integer> NOISE_REDUCTION_MODE =
589 new Key<Integer>("android.noiseReduction.mode", int.class);
590
591 /**
592 * <p>
Igor Murashkin6bbf9dc2013-09-05 12:22:00 -0700593 * A frame counter set by the framework. This value monotonically
594 * increases with every new result (that is, each new result has a unique
595 * frameCount value).
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700596 * </p>
597 * <p>
598 * Reset on release()
599 * </p>
600 */
601 public static final Key<Integer> REQUEST_FRAME_COUNT =
602 new Key<Integer>("android.request.frameCount", int.class);
603
604 /**
605 * <p>
606 * An application-specified ID for the current
607 * request. Must be maintained unchanged in output
608 * frame
609 * </p>
610 *
611 * @hide
612 */
613 public static final Key<Integer> REQUEST_ID =
614 new Key<Integer>("android.request.id", int.class);
615
616 /**
617 * <p>
618 * (x, y, width, height).
619 * </p><p>
620 * A rectangle with the top-level corner of (x,y) and size
621 * (width, height). The region of the sensor that is used for
622 * output. Each stream must use this rectangle to produce its
623 * output, cropping to a smaller region if necessary to
624 * maintain the stream's aspect ratio.
625 * </p><p>
626 * HAL2.x uses only (x, y, width)
627 * </p>
628 * <p>
629 * Any additional per-stream cropping must be done to
630 * maximize the final pixel area of the stream.
631 * </p><p>
632 * For example, if the crop region is set to a 4:3 aspect
633 * ratio, then 4:3 streams should use the exact crop
634 * region. 16:9 streams should further crop vertically
635 * (letterbox).
636 * </p><p>
637 * Conversely, if the crop region is set to a 16:9, then 4:3
638 * outputs should crop horizontally (pillarbox), and 16:9
639 * streams should match exactly. These additional crops must
640 * be centered within the crop region.
641 * </p><p>
642 * The output streams must maintain square pixels at all
643 * times, no matter what the relative aspect ratios of the
644 * crop region and the stream are. Negative values for
645 * corner are allowed for raw output if full pixel array is
646 * larger than active pixel array. Width and height may be
647 * rounded to nearest larger supportable width, especially
648 * for raw output, where only a few fixed scales may be
649 * possible. The width and height of the crop region cannot
650 * be set to be smaller than floor( activeArraySize.width /
651 * android.scaler.maxDigitalZoom ) and floor(
652 * activeArraySize.height / android.scaler.maxDigitalZoom),
653 * respectively.
654 * </p>
655 */
656 public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
657 new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
658
659 /**
660 * <p>
661 * Duration each pixel is exposed to
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700662 * light.
663 * </p><p>
664 * If the sensor can't expose this exact duration, it should shorten the
665 * duration exposed to the nearest possible value (rather than expose longer).
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700666 * </p>
667 * <p>
668 * 1/10000 - 30 sec range. No bulb mode
669 * </p>
670 */
671 public static final Key<Long> SENSOR_EXPOSURE_TIME =
672 new Key<Long>("android.sensor.exposureTime", long.class);
673
674 /**
675 * <p>
676 * Duration from start of frame exposure to
677 * start of next frame exposure
678 * </p>
679 * <p>
680 * Exposure time has priority, so duration is set to
681 * max(duration, exposure time + overhead)
682 * </p>
683 */
684 public static final Key<Long> SENSOR_FRAME_DURATION =
685 new Key<Long>("android.sensor.frameDuration", long.class);
686
687 /**
688 * <p>
689 * Gain applied to image data. Must be
690 * implemented through analog gain only if set to values
691 * below 'maximum analog sensitivity'.
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700692 * </p><p>
693 * If the sensor can't apply this exact gain, it should lessen the
694 * gain to the nearest possible value (rather than gain more).
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700695 * </p>
696 * <p>
697 * ISO 12232:2006 REI method
698 * </p>
699 */
700 public static final Key<Integer> SENSOR_SENSITIVITY =
701 new Key<Integer>("android.sensor.sensitivity", int.class);
702
703 /**
704 * <p>
705 * Time at start of exposure of first
706 * row
707 * </p>
708 * <p>
709 * Monotonic, should be synced to other timestamps in
710 * system
711 * </p>
712 */
713 public static final Key<Long> SENSOR_TIMESTAMP =
714 new Key<Long>("android.sensor.timestamp", long.class);
715
716 /**
717 * <p>
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700718 * The temperature of the sensor, sampled at the time
719 * exposure began for this frame.
720 * </p><p>
721 * The thermal diode being queried should be inside the sensor PCB, or
722 * somewhere close to it.
723 * </p>
724 */
725 public static final Key<Float> SENSOR_TEMPERATURE =
726 new Key<Float>("android.sensor.temperature", float.class);
727
728 /**
729 * <p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700730 * State of the face detector
731 * unit
732 * </p>
733 * <p>
734 * Whether face detection is enabled, and whether it
735 * should output just the basic fields or the full set of
736 * fields. Value must be one of the
737 * android.statistics.info.availableFaceDetectModes.
738 * </p>
739 * @see #STATISTICS_FACE_DETECT_MODE_OFF
740 * @see #STATISTICS_FACE_DETECT_MODE_SIMPLE
741 * @see #STATISTICS_FACE_DETECT_MODE_FULL
742 */
743 public static final Key<Integer> STATISTICS_FACE_DETECT_MODE =
744 new Key<Integer>("android.statistics.faceDetectMode", int.class);
745
746 /**
747 * <p>
748 * List of unique IDs for detected
749 * faces
750 * </p>
751 * <p>
752 * Only available if faceDetectMode == FULL
753 * </p>
754 */
755 public static final Key<int[]> STATISTICS_FACE_IDS =
756 new Key<int[]>("android.statistics.faceIds", int[].class);
757
758 /**
759 * <p>
760 * List of landmarks for detected
761 * faces
762 * </p>
763 * <p>
764 * Only available if faceDetectMode == FULL
765 * </p>
766 */
767 public static final Key<int[]> STATISTICS_FACE_LANDMARKS =
768 new Key<int[]>("android.statistics.faceLandmarks", int[].class);
769
770 /**
771 * <p>
772 * List of the bounding rectangles for detected
773 * faces
774 * </p>
775 * <p>
776 * Only available if faceDetectMode != OFF
777 * </p>
778 */
779 public static final Key<android.graphics.Rect[]> STATISTICS_FACE_RECTANGLES =
780 new Key<android.graphics.Rect[]>("android.statistics.faceRectangles", android.graphics.Rect[].class);
781
782 /**
783 * <p>
784 * List of the face confidence scores for
785 * detected faces
786 * </p>
787 * <p>
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700788 * Only available if faceDetectMode != OFF. The value should be
789 * meaningful (for example, setting 100 at all times is illegal).
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700790 * </p>
791 */
792 public static final Key<byte[]> STATISTICS_FACE_SCORES =
793 new Key<byte[]>("android.statistics.faceScores", byte[].class);
794
795 /**
796 * <p>
797 * A low-resolution map of lens shading, per
798 * color channel
799 * </p>
800 * <p>
801 * Assume bilinear interpolation of map. The least
802 * shaded section of the image should have a gain factor
803 * of 1; all other sections should have gains above 1.
804 * the map should be on the order of 30-40 rows, and
805 * must be smaller than 64x64.
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700806 * </p><p>
807 * When android.colorCorrection.mode = TRANSFORM_MATRIX, the map
808 * must take into account the colorCorrection settings.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700809 * </p>
810 */
811 public static final Key<float[]> STATISTICS_LENS_SHADING_MAP =
812 new Key<float[]>("android.statistics.lensShadingMap", float[].class);
813
814 /**
815 * <p>
816 * The best-fit color channel gains calculated
817 * by the HAL's statistics units for the current output frame
818 * </p>
819 * <p>
820 * This may be different than the gains used for this frame,
821 * since statistics processing on data from a new frame
822 * typically completes after the transform has already been
823 * applied to that frame.
824 * </p><p>
825 * The 4 channel gains are defined in Bayer domain,
826 * see android.colorCorrection.gains for details.
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700827 * </p><p>
828 * This value should always be calculated by the AWB block,
829 * regardless of the android.control.* current values.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700830 * </p>
831 */
832 public static final Key<float[]> STATISTICS_PREDICTED_COLOR_GAINS =
833 new Key<float[]>("android.statistics.predictedColorGains", float[].class);
834
835 /**
836 * <p>
837 * The best-fit color transform matrix estimate
838 * calculated by the HAL's statistics units for the current
839 * output frame
840 * </p>
841 * <p>
842 * The HAL must provide the estimate from its
843 * statistics unit on the white balance transforms to use
844 * for the next frame. These are the values the HAL believes
845 * are the best fit for the current output frame. This may
846 * be different than the transform used for this frame, since
847 * statistics processing on data from a new frame typically
848 * completes after the transform has already been applied to
849 * that frame.
850 * </p><p>
851 * These estimates must be provided for all frames, even if
852 * capture settings and color transforms are set by the application.
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700853 * </p><p>
854 * This value should always be calculated by the AWB block,
855 * regardless of the android.control.* current values.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700856 * </p>
857 */
858 public static final Key<Rational[]> STATISTICS_PREDICTED_COLOR_TRANSFORM =
859 new Key<Rational[]>("android.statistics.predictedColorTransform", Rational[].class);
860
861 /**
862 * <p>
863 * The HAL estimated scene illumination lighting
864 * frequency
865 * </p>
866 * <p>
867 * Report NONE if there doesn't appear to be flickering
868 * illumination
869 * </p>
870 * @see #STATISTICS_SCENE_FLICKER_NONE
871 * @see #STATISTICS_SCENE_FLICKER_50HZ
872 * @see #STATISTICS_SCENE_FLICKER_60HZ
873 */
874 public static final Key<Integer> STATISTICS_SCENE_FLICKER =
875 new Key<Integer>("android.statistics.sceneFlicker", int.class);
876
877 /**
878 * <p>
879 * Table mapping blue input values to output
880 * values
881 * </p>
Zhijun He3ffd7052013-08-19 15:45:08 -0700882 * <p>
883 * Tonemapping / contrast / gamma curve for the blue
884 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
885 * </p><p>
886 * See android.tonemap.curveRed for more details.
887 * </p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700888 */
Zhijun He3ffd7052013-08-19 15:45:08 -0700889 public static final Key<float[]> TONEMAP_CURVE_BLUE =
890 new Key<float[]>("android.tonemap.curveBlue", float[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700891
892 /**
893 * <p>
894 * Table mapping green input values to output
895 * values
896 * </p>
Zhijun He3ffd7052013-08-19 15:45:08 -0700897 * <p>
898 * Tonemapping / contrast / gamma curve for the green
899 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
900 * </p><p>
901 * See android.tonemap.curveRed for more details.
902 * </p>
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700903 */
Zhijun He3ffd7052013-08-19 15:45:08 -0700904 public static final Key<float[]> TONEMAP_CURVE_GREEN =
905 new Key<float[]>("android.tonemap.curveGreen", float[].class);
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700906
907 /**
908 * <p>
909 * Table mapping red input values to output
910 * values
911 * </p>
912 * <p>
Zhijun He3ffd7052013-08-19 15:45:08 -0700913 * Tonemapping / contrast / gamma curve for the red
914 * channel, to use when android.tonemap.mode is CONTRAST_CURVE.
915 * </p><p>
916 * Since the input and output ranges may vary depending on
917 * the camera pipeline, the input and output pixel values
918 * are represented by normalized floating-point values
919 * between 0 and 1, with 0 == black and 1 == white.
920 * </p><p>
921 * The curve should be linearly interpolated between the
922 * defined points. The points will be listed in increasing
923 * order of P_IN. For example, if the array is: [0.0, 0.0,
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700924 * 0.3, 0.5, 1.0, 1.0], then the input->output mapping
925 * for a few sample points would be: 0 -> 0, 0.15 ->
926 * 0.25, 0.3 -> 0.5, 0.5 -> 0.64
927 * </p>
928 */
929 public static final Key<float[]> TONEMAP_CURVE_RED =
930 new Key<float[]>("android.tonemap.curveRed", float[].class);
931
932 /**
933 * @see #TONEMAP_MODE_CONTRAST_CURVE
934 * @see #TONEMAP_MODE_FAST
935 * @see #TONEMAP_MODE_HIGH_QUALITY
936 */
937 public static final Key<Integer> TONEMAP_MODE =
938 new Key<Integer>("android.tonemap.mode", int.class);
939
940 /**
941 * <p>
942 * This LED is nominally used to indicate to the user
943 * that the camera is powered on and may be streaming images back to the
944 * Application Processor. In certain rare circumstances, the OS may
945 * disable this when video is processed locally and not transmitted to
946 * any untrusted applications.
947 * </p><p>
948 * In particular, the LED *must* always be on when the data could be
949 * transmitted off the device. The LED *should* always be on whenever
950 * data is stored locally on the device.
951 * </p><p>
952 * The LED *may* be off if a trusted application is using the data that
953 * doesn't violate the above rules.
954 * </p>
955 *
956 * @hide
957 */
958 public static final Key<Boolean> LED_TRANSMIT =
959 new Key<Boolean>("android.led.transmit", boolean.class);
960
961 /**
962 * <p>
963 * Whether black-level compensation is locked
964 * to its current values, or is free to vary
965 * </p>
966 * <p>
967 * When set to ON, the values used for black-level
968 * compensation must not change until the lock is set to
969 * OFF
970 * </p><p>
971 * Since changes to certain capture parameters (such as
972 * exposure time) may require resetting of black level
973 * compensation, the HAL must report whether setting the
974 * black level lock was successful in the output result
975 * metadata.
Igor Murashkind5ff06a2013-08-20 15:15:06 -0700976 * </p><p>
977 * The black level locking must happen at the sensor, and not at the ISP.
978 * If for some reason black level locking is no longer legal (for example,
979 * the analog gain has changed, which forces black levels to be
980 * recalculated), then the HAL is free to override this request (and it
981 * must report 'OFF' when this does happen) until the next time locking
982 * is legal again.
Eino-Ville Talvala5a32b20c2013-08-08 12:38:36 -0700983 * </p>
984 */
985 public static final Key<Boolean> BLACK_LEVEL_LOCK =
986 new Key<Boolean>("android.blackLevel.lock", boolean.class);
987
988 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
989 * End generated code
990 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
Igor Murashkinb779ac12013-09-05 12:40:19 -0700991
992 /**
993 * <p>
994 * List of the {@link Face Faces} detected through camera face detection
995 * in this result.
996 * </p>
997 * <p>
998 * Only available if {@link #STATISTICS_FACE_DETECT_MODE} {@code !=}
999 * {@link CameraMetadata#STATISTICS_FACE_DETECT_MODE_OFF OFF}.
1000 * </p>
1001 *
1002 * @see Face
1003 */
1004 public static final Key<Face[]> STATISTICS_FACES =
1005 new Key<Face[]>("android.statistics.faces", Face[].class);
Eino-Ville Talvalab2675542012-12-12 13:29:45 -08001006}