blob: 554dfef613287c664110d731cc250ad4d18da2ba [file] [log] [blame]
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -07001/*
2**
3** Copyright 2008, The Android Open Source Project
4** Copyright 2012, Samsung Electronics Co. LTD
5**
6** Licensed under the Apache License, Version 2.0 (the "License");
7** you may not use this file except in compliance with the License.
8** You may obtain a copy of the License at
9**
10** http://www.apache.org/licenses/LICENSE-2.0
11**
12** Unless required by applicable law or agreed to in writing, software
13** distributed under the License is distributed on an "AS IS" BASIS,
14** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15** See the License for the specific language governing permissions and
16** limitations under the License.
17*/
18
19/*!
20 * \file ExynosCamera2.cpp
21 * \brief source file for static information of camera2
22 * \author Sungjoong Kang(sj3.kang@samsung.com)
23 * \date 2012/08/06
24 *
25 * <b>Revision History: </b>
26 * - 2012/08/06 : Sungjoong Kang(sj3.kang@samsung.com) \n
27 * Initial Release
28 *
29 */
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070030
31//#define LOG_NDEBUG 0
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -070032#define LOG_TAG "ExynosCamera2"
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070033#include <utils/Log.h>
34
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -070035#include "ExynosCamera2.h"
36
37#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070038
39namespace android {
40
41class Sensor {
42public:
43 /**
44 * Static sensor characteristics
45 */
Sungjoong Kang9dd63e12012-07-24 00:25:51 +090046 static const unsigned int kResolution[2][2];
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070047
48 static const nsecs_t kExposureTimeRange[2];
49 static const nsecs_t kFrameDurationRange[2];
50 static const nsecs_t kMinVerticalBlank;
51
52 static const uint8_t kColorFilterArrangement;
53
54 // Output image data characteristics
55 static const uint32_t kMaxRawValue;
56 static const uint32_t kBlackLevel;
57 // Sensor sensitivity, approximate
58
59 static const float kSaturationVoltage;
60 static const uint32_t kSaturationElectrons;
61 static const float kVoltsPerLuxSecond;
62 static const float kElectronsPerLuxSecond;
63
64 static const float kBaseGainFactor;
65
66 static const float kReadNoiseStddevBeforeGain; // In electrons
67 static const float kReadNoiseStddevAfterGain; // In raw digital units
68 static const float kReadNoiseVarBeforeGain;
69 static const float kReadNoiseVarAfterGain;
70
71 // While each row has to read out, reset, and then expose, the (reset +
72 // expose) sequence can be overlapped by other row readouts, so the final
73 // minimum frame duration is purely a function of row readout time, at least
74 // if there's a reasonable number of rows.
75 static const nsecs_t kRowReadoutTime;
76
77 static const uint32_t kAvailableSensitivities[5];
78 static const uint32_t kDefaultSensitivity;
79
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070080};
81
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070082
Sungjoong Kang9dd63e12012-07-24 00:25:51 +090083
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -070084const uint32_t Sensor::kAvailableSensitivities[5] =
85 {100, 200, 400, 800, 1600};
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070086const nsecs_t Sensor::kExposureTimeRange[2] =
87 {1000L, 30000000000L} ; // 1 us - 30 sec
88const nsecs_t Sensor::kFrameDurationRange[2] =
89 {33331760L, 30000000000L}; // ~1/30 s - 30 sec
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070090
91const uint8_t Sensor::kColorFilterArrangement = ANDROID_SENSOR_RGGB;
92
Sungjoong Kang13d8c7b2012-07-14 10:20:39 +090093const uint32_t kAvailableFormats[5] = {
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070094 HAL_PIXEL_FORMAT_RAW_SENSOR,
Sungjoong Kang13d8c7b2012-07-14 10:20:39 +090095 HAL_PIXEL_FORMAT_BLOB,
96 HAL_PIXEL_FORMAT_RGBA_8888,
Jiyoung Shinc15a6b02012-06-05 01:08:14 -070097 HAL_PIXEL_FORMAT_YV12,
98 HAL_PIXEL_FORMAT_YCrCb_420_SP
99};
100
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700101// Output image data characteristics
102const uint32_t Sensor::kMaxRawValue = 4000;
103const uint32_t Sensor::kBlackLevel = 1000;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700104
105const uint64_t kAvailableRawMinDurations[1] = {
106 Sensor::kFrameDurationRange[0]
107};
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900108
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700109const uint64_t kAvailableProcessedMinDurations[1] = {
110 Sensor::kFrameDurationRange[0]
111};
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700112const uint64_t kAvailableJpegMinDurations[1] = {
113 Sensor::kFrameDurationRange[0]
114};
115
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700116const int32_t scalerResolutionS5K4E5[] =
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900117{
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700118 1920, 1080,
Sungjoong Kangad378612012-08-17 12:34:33 -0700119 1440, 1080,
Sungjoong Kange4657e32012-08-28 15:02:19 -0700120 1280, 1024,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700121 1280, 720,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700122 640, 480,
123 320, 240,
124 176, 144,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700125};
126
127const int32_t jpegResolutionS5K4E5[] =
128{
129 2560, 1920,
Sungjoong Kange4657e32012-08-28 15:02:19 -0700130 2560, 1440,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700131 2048, 1536,
132 1600, 1200,
133 1280, 1024,
134 1280, 960,
135 1152, 864,
136 640, 480,
137 320, 240,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700138};
139
140ExynosCamera2InfoS5K4E5::ExynosCamera2InfoS5K4E5()
141{
142 sensorW = 2560;
143 sensorH = 1920;
144 sensorRawW = (2560 + 16);
145 sensorRawH = (1920 + 10);
146 numScalerResolution = ARRAY_SIZE(scalerResolutionS5K4E5)/2;
147 scalerResolutions = scalerResolutionS5K4E5;
148 numJpegResolution = ARRAY_SIZE(jpegResolutionS5K4E5)/2;
149 jpegResolutions = jpegResolutionS5K4E5;
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700150 minFocusDistance = 0.1f;
151 focalLength = 3.43f;
152 aperture = 2.7f;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700153}
154
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700155ExynosCamera2InfoS5K4E5::~ExynosCamera2InfoS5K4E5()
156{
157 ALOGV("%s", __FUNCTION__);
158}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700159const int32_t scalerResolutionS5K6A3[] =
160{
Sungjoong Kange4657e32012-08-28 15:02:19 -0700161 1392, 1392,
162 1280, 1024,
Sungjoong Kangad378612012-08-17 12:34:33 -0700163 1280, 960,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700164 1280, 720,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700165 640, 480,
166 176, 144,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700167};
168
169const int32_t jpegResolutionS5K6A3[] =
170{
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700171 1392, 1392,
172 1392, 1040,
173 1392, 784,
174 1280, 1024,
Sungjoong Kangad378612012-08-17 12:34:33 -0700175 1280, 960,
Sungjoong Kange4657e32012-08-28 15:02:19 -0700176 1280, 720,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700177 1152, 864,
178 640, 480,
179 320, 240,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700180};
181
182ExynosCamera2InfoS5K6A3::ExynosCamera2InfoS5K6A3()
183{
184 sensorW = 1392;
185 sensorH = 1392;
186 sensorRawW = (1392 + 16);
187 sensorRawH = (1392 + 10);
188 numScalerResolution = ARRAY_SIZE(scalerResolutionS5K6A3)/2;
189 scalerResolutions = scalerResolutionS5K6A3;
190 numJpegResolution = ARRAY_SIZE(jpegResolutionS5K6A3)/2;
191 jpegResolutions = jpegResolutionS5K6A3;
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700192 minFocusDistance = 0.0f;
193 focalLength = 2.73f;
194 aperture = 2.8f;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700195}
196
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700197ExynosCamera2InfoS5K6A3::~ExynosCamera2InfoS5K6A3()
198{
199 ALOGV("%s", __FUNCTION__);
200}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700201ExynosCamera2::ExynosCamera2(int cameraId):
202 m_cameraId(cameraId)
203{
204 if (cameraId == 0)
205 m_curCameraInfo = new ExynosCamera2InfoS5K4E5;
206 else
207 m_curCameraInfo = new ExynosCamera2InfoS5K6A3;
208}
209
210ExynosCamera2::~ExynosCamera2()
211{
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700212 ALOGV("%s", __FUNCTION__);
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700213 delete m_curCameraInfo;
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700214 m_curCameraInfo = NULL;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700215}
216
217int32_t ExynosCamera2::getSensorW()
218{
219 return m_curCameraInfo->sensorW;
220}
221
222int32_t ExynosCamera2::getSensorH()
223{
224 return m_curCameraInfo->sensorH;
225}
226
227int32_t ExynosCamera2::getSensorRawW()
228{
229 return m_curCameraInfo->sensorRawW;
230}
231
232int32_t ExynosCamera2::getSensorRawH()
233{
234 return m_curCameraInfo->sensorRawH;
235}
236
237bool ExynosCamera2::isSupportedResolution(int width, int height)
238{
239 int i;
240 for (i = 0 ; i < m_curCameraInfo->numScalerResolution ; i++) {
241 if (m_curCameraInfo->scalerResolutions[2*i] == width
242 && m_curCameraInfo->scalerResolutions[2*i+1] == height) {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900243 return true;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700244 }
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900245 }
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700246 return false;
247}
248
249bool ExynosCamera2::isSupportedJpegResolution(int width, int height)
250{
251 int i;
252 for (i = 0 ; i < m_curCameraInfo->numJpegResolution ; i++) {
253 if (m_curCameraInfo->jpegResolutions[2*i] == width
254 && m_curCameraInfo->jpegResolutions[2*i+1] == height) {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900255 return true;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700256 }
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900257 }
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700258 return false;
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900259}
260
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700261status_t addOrSize(camera_metadata_t *request,
262 bool sizeRequest,
263 size_t *entryCount,
264 size_t *dataCount,
265 uint32_t tag,
266 const void *entryData,
267 size_t entryDataCount) {
268 status_t res;
269 if (!sizeRequest) {
270 return add_camera_metadata_entry(request, tag, entryData,
271 entryDataCount);
272 } else {
273 int type = get_camera_metadata_tag_type(tag);
274 if (type < 0 ) return BAD_VALUE;
275 (*entryCount)++;
276 (*dataCount) += calculate_camera_metadata_entry_data_size(type,
277 entryDataCount);
278 return OK;
279 }
280}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700281
282status_t ExynosCamera2::constructStaticInfo(camera_metadata_t **info,
283 int cameraId, bool sizeRequest) {
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700284
285 size_t entryCount = 0;
286 size_t dataCount = 0;
287 status_t ret;
288
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700289#define ADD_OR_SIZE( tag, data, count ) \
290 if ( ( ret = addOrSize(*info, sizeRequest, &entryCount, &dataCount, \
291 tag, data, count) ) != OK ) return ret
292
293 // android.lens
294
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700295 ADD_OR_SIZE(ANDROID_LENS_MINIMUM_FOCUS_DISTANCE,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700296 &(m_curCameraInfo->minFocusDistance), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700297 ADD_OR_SIZE(ANDROID_LENS_HYPERFOCAL_DISTANCE,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700298 &(m_curCameraInfo->minFocusDistance), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700299
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700300 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FOCAL_LENGTHS,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700301 &m_curCameraInfo->focalLength, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700302 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_APERTURES,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700303 &m_curCameraInfo->aperture, 1);
304
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700305 static const float filterDensity = 0;
306 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FILTER_DENSITY,
307 &filterDensity, 1);
308 static const uint8_t availableOpticalStabilization =
309 ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
310 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_OPTICAL_STABILIZATION,
311 &availableOpticalStabilization, 1);
312
313 static const int32_t lensShadingMapSize[] = {1, 1};
314 ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP_SIZE, lensShadingMapSize,
315 sizeof(lensShadingMapSize)/sizeof(int32_t));
316
317 static const float lensShadingMap[3 * 1 * 1 ] =
318 { 1.f, 1.f, 1.f };
319 ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP, lensShadingMap,
320 sizeof(lensShadingMap)/sizeof(float));
321
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900322 int32_t lensFacing = cameraId ?
323 ANDROID_LENS_FACING_FRONT : ANDROID_LENS_FACING_BACK;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700324 ADD_OR_SIZE(ANDROID_LENS_FACING, &lensFacing, 1);
325
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700326 // android.sensor
327 ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME_RANGE,
328 Sensor::kExposureTimeRange, 2);
329
330 ADD_OR_SIZE(ANDROID_SENSOR_MAX_FRAME_DURATION,
331 &Sensor::kFrameDurationRange[1], 1);
332
333 ADD_OR_SIZE(ANDROID_SENSOR_AVAILABLE_SENSITIVITIES,
334 Sensor::kAvailableSensitivities,
335 sizeof(Sensor::kAvailableSensitivities)
336 /sizeof(uint32_t));
337
338 ADD_OR_SIZE(ANDROID_SENSOR_COLOR_FILTER_ARRANGEMENT,
339 &Sensor::kColorFilterArrangement, 1);
340
341 static const float sensorPhysicalSize[2] = {3.20f, 2.40f}; // mm
342 ADD_OR_SIZE(ANDROID_SENSOR_PHYSICAL_SIZE,
343 sensorPhysicalSize, 2);
344
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700345 int32_t pixelArraySize[2] = {
346 m_curCameraInfo->sensorW, m_curCameraInfo->sensorH
347 };
348 ADD_OR_SIZE(ANDROID_SENSOR_PIXEL_ARRAY_SIZE, pixelArraySize, 2);
349 ADD_OR_SIZE(ANDROID_SENSOR_ACTIVE_ARRAY_SIZE, pixelArraySize,2);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700350
351 ADD_OR_SIZE(ANDROID_SENSOR_WHITE_LEVEL,
352 &Sensor::kMaxRawValue, 1);
353
354 static const int32_t blackLevelPattern[4] = {
355 Sensor::kBlackLevel, Sensor::kBlackLevel,
356 Sensor::kBlackLevel, Sensor::kBlackLevel
357 };
358 ADD_OR_SIZE(ANDROID_SENSOR_BLACK_LEVEL_PATTERN,
359 blackLevelPattern, sizeof(blackLevelPattern)/sizeof(int32_t));
360
361 //TODO: sensor color calibration fields
362
363 // android.flash
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700364 static const uint8_t flashAvailable = 1;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700365 ADD_OR_SIZE(ANDROID_FLASH_AVAILABLE, &flashAvailable, 1);
366
367 static const int64_t flashChargeDuration = 0;
368 ADD_OR_SIZE(ANDROID_FLASH_CHARGE_DURATION, &flashChargeDuration, 1);
369
370 // android.tonemap
371
372 static const int32_t tonemapCurvePoints = 128;
373 ADD_OR_SIZE(ANDROID_TONEMAP_MAX_CURVE_POINTS, &tonemapCurvePoints, 1);
374
375 // android.scaler
376
377 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_FORMATS,
378 kAvailableFormats,
379 sizeof(kAvailableFormats)/sizeof(uint32_t));
380
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700381 int32_t availableRawSizes[2] = {
382 m_curCameraInfo->sensorRawW, m_curCameraInfo->sensorRawH
383 };
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700384 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_SIZES,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700385 availableRawSizes, 2);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700386
387 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS,
388 kAvailableRawMinDurations,
389 sizeof(kAvailableRawMinDurations)/sizeof(uint64_t));
390
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700391
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700392 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
393 m_curCameraInfo->scalerResolutions,
394 (m_curCameraInfo->numScalerResolution)*2);
395 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
396 m_curCameraInfo->jpegResolutions,
397 (m_curCameraInfo->numJpegResolution)*2);
398
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700399 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS,
400 kAvailableProcessedMinDurations,
401 sizeof(kAvailableProcessedMinDurations)/sizeof(uint64_t));
402
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700403 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS,
404 kAvailableJpegMinDurations,
405 sizeof(kAvailableJpegMinDurations)/sizeof(uint64_t));
406
Sungjoong Kange4657e32012-08-28 15:02:19 -0700407 static const float maxZoom = 4;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700408 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_ZOOM, &maxZoom, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700409
410 // android.jpeg
411
412 static const int32_t jpegThumbnailSizes[] = {
413 160, 120,
414 320, 240,
415 640, 480
416 };
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700417
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700418 ADD_OR_SIZE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,
419 jpegThumbnailSizes, sizeof(jpegThumbnailSizes)/sizeof(int32_t));
420
Sungjoong Kang13d8c7b2012-07-14 10:20:39 +0900421 static const int32_t jpegMaxSize = 5*1024*1024;
422 ADD_OR_SIZE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1);
423
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700424 // android.stats
425
426 static const uint8_t availableFaceDetectModes[] = {
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700427 ANDROID_STATS_FACE_DETECTION_OFF,
428 ANDROID_STATS_FACE_DETECTION_FULL
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700429 };
430 ADD_OR_SIZE(ANDROID_STATS_AVAILABLE_FACE_DETECT_MODES,
431 availableFaceDetectModes,
432 sizeof(availableFaceDetectModes));
433
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700434 m_curCameraInfo->maxFaceCount = 16;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700435 ADD_OR_SIZE(ANDROID_STATS_MAX_FACE_COUNT,
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700436 &(m_curCameraInfo->maxFaceCount), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700437
438 static const int32_t histogramSize = 64;
439 ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_BUCKET_COUNT,
440 &histogramSize, 1);
441
442 static const int32_t maxHistogramCount = 1000;
443 ADD_OR_SIZE(ANDROID_STATS_MAX_HISTOGRAM_COUNT,
444 &maxHistogramCount, 1);
445
446 static const int32_t sharpnessMapSize[2] = {64, 64};
447 ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_SIZE,
448 sharpnessMapSize, sizeof(sharpnessMapSize)/sizeof(int32_t));
449
450 static const int32_t maxSharpnessMapValue = 1000;
451 ADD_OR_SIZE(ANDROID_STATS_MAX_SHARPNESS_MAP_VALUE,
452 &maxSharpnessMapValue, 1);
453
454 // android.control
455
456 static const uint8_t availableSceneModes[] = {
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700457 ANDROID_CONTROL_SCENE_MODE_ACTION,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700458 ANDROID_CONTROL_SCENE_MODE_NIGHT,
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700459 ANDROID_CONTROL_SCENE_MODE_SUNSET,
460 ANDROID_CONTROL_SCENE_MODE_PARTY
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700461 };
462 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_SCENE_MODES,
463 availableSceneModes, sizeof(availableSceneModes));
464
465 static const uint8_t availableEffects[] = {
466 ANDROID_CONTROL_EFFECT_OFF
467 };
468 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_EFFECTS,
469 availableEffects, sizeof(availableEffects));
470
Sungjoong Kang8e2c2fd2012-08-27 00:02:22 -0700471 int32_t max3aRegions = 1;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700472 ADD_OR_SIZE(ANDROID_CONTROL_MAX_REGIONS,
473 &max3aRegions, 1);
474
475 static const uint8_t availableAeModes[] = {
476 ANDROID_CONTROL_AE_OFF,
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700477 ANDROID_CONTROL_AE_ON,
478 ANDROID_CONTROL_AE_ON_AUTO_FLASH
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700479 };
480 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_MODES,
481 availableAeModes, sizeof(availableAeModes));
482
483 static const camera_metadata_rational exposureCompensationStep = {
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700484 1, 1
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700485 };
486 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_STEP,
487 &exposureCompensationStep, 1);
488
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700489 int32_t exposureCompensationRange[] = {-3, 3};
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700490 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_RANGE,
491 exposureCompensationRange,
492 sizeof(exposureCompensationRange)/sizeof(int32_t));
493
494 static const int32_t availableTargetFpsRanges[] = {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900495 5, 30, 30, 30
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700496 };
497 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,
498 availableTargetFpsRanges,
499 sizeof(availableTargetFpsRanges)/sizeof(int32_t));
500
501 static const uint8_t availableAntibandingModes[] = {
502 ANDROID_CONTROL_AE_ANTIBANDING_OFF,
503 ANDROID_CONTROL_AE_ANTIBANDING_AUTO
504 };
505 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,
506 availableAntibandingModes, sizeof(availableAntibandingModes));
507
508 static const uint8_t availableAwbModes[] = {
509 ANDROID_CONTROL_AWB_OFF,
510 ANDROID_CONTROL_AWB_AUTO,
511 ANDROID_CONTROL_AWB_INCANDESCENT,
512 ANDROID_CONTROL_AWB_FLUORESCENT,
513 ANDROID_CONTROL_AWB_DAYLIGHT,
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700514 ANDROID_CONTROL_AWB_CLOUDY_DAYLIGHT
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700515 };
516 ADD_OR_SIZE(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
517 availableAwbModes, sizeof(availableAwbModes));
518
519 static const uint8_t availableAfModes[] = {
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700520 ANDROID_CONTROL_AF_OFF,
521 ANDROID_CONTROL_AF_AUTO,
522 ANDROID_CONTROL_AF_MACRO,
523 ANDROID_CONTROL_AF_CONTINUOUS_PICTURE,
524 ANDROID_CONTROL_AF_CONTINUOUS_VIDEO
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700525 };
526 ADD_OR_SIZE(ANDROID_CONTROL_AF_AVAILABLE_MODES,
527 availableAfModes, sizeof(availableAfModes));
528
529 static const uint8_t availableVstabModes[] = {
530 ANDROID_CONTROL_VIDEO_STABILIZATION_OFF
531 };
532 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
533 availableVstabModes, sizeof(availableVstabModes));
534
535#undef ADD_OR_SIZE
536 /** Allocate metadata if sizing */
537 if (sizeRequest) {
538 ALOGV("Allocating %d entries, %d extra bytes for "
539 "static camera info",
540 entryCount, dataCount);
541 *info = allocate_camera_metadata(entryCount, dataCount);
542 if (*info == NULL) {
543 ALOGE("Unable to allocate camera static info"
544 "(%d entries, %d bytes extra data)",
545 entryCount, dataCount);
546 return NO_MEMORY;
547 }
548 }
549 return OK;
550}
551
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700552status_t ExynosCamera2::constructDefaultRequest(
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700553 int request_template,
554 camera_metadata_t **request,
555 bool sizeRequest) {
556
557 size_t entryCount = 0;
558 size_t dataCount = 0;
559 status_t ret;
560
561#define ADD_OR_SIZE( tag, data, count ) \
562 if ( ( ret = addOrSize(*request, sizeRequest, &entryCount, &dataCount, \
563 tag, data, count) ) != OK ) return ret
564
565 static const int64_t USEC = 1000LL;
566 static const int64_t MSEC = USEC * 1000LL;
567 static const int64_t SEC = MSEC * 1000LL;
568
569 /** android.request */
570
571 static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_NONE;
572 ADD_OR_SIZE(ANDROID_REQUEST_METADATA_MODE, &metadataMode, 1);
573
574 static const int32_t id = 0;
575 ADD_OR_SIZE(ANDROID_REQUEST_ID, &id, 1);
576
577 static const int32_t frameCount = 0;
578 ADD_OR_SIZE(ANDROID_REQUEST_FRAME_COUNT, &frameCount, 1);
579
580 // OUTPUT_STREAMS set by user
581 entryCount += 1;
582 dataCount += 5; // TODO: Should be maximum stream number
583
584 /** android.lens */
585
586 static const float focusDistance = 0;
587 ADD_OR_SIZE(ANDROID_LENS_FOCUS_DISTANCE, &focusDistance, 1);
588
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700589 ADD_OR_SIZE(ANDROID_LENS_APERTURE, &m_curCameraInfo->aperture, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700590
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700591 ADD_OR_SIZE(ANDROID_LENS_FOCAL_LENGTH, &m_curCameraInfo->focalLength, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700592
593 static const float filterDensity = 0;
594 ADD_OR_SIZE(ANDROID_LENS_FILTER_DENSITY, &filterDensity, 1);
595
596 static const uint8_t opticalStabilizationMode =
597 ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
598 ADD_OR_SIZE(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
599 &opticalStabilizationMode, 1);
600
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700601
602 /** android.sensor */
603
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700604
605 static const int64_t frameDuration = 33333333L; // 1/30 s
606 ADD_OR_SIZE(ANDROID_SENSOR_FRAME_DURATION, &frameDuration, 1);
607
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700608
609 /** android.flash */
610
611 static const uint8_t flashMode = ANDROID_FLASH_OFF;
612 ADD_OR_SIZE(ANDROID_FLASH_MODE, &flashMode, 1);
613
614 static const uint8_t flashPower = 10;
615 ADD_OR_SIZE(ANDROID_FLASH_FIRING_POWER, &flashPower, 1);
616
617 static const int64_t firingTime = 0;
618 ADD_OR_SIZE(ANDROID_FLASH_FIRING_TIME, &firingTime, 1);
619
620 /** Processing block modes */
621 uint8_t hotPixelMode = 0;
622 uint8_t demosaicMode = 0;
623 uint8_t noiseMode = 0;
624 uint8_t shadingMode = 0;
625 uint8_t geometricMode = 0;
626 uint8_t colorMode = 0;
627 uint8_t tonemapMode = 0;
628 uint8_t edgeMode = 0;
629 switch (request_template) {
630 case CAMERA2_TEMPLATE_PREVIEW:
631 hotPixelMode = ANDROID_PROCESSING_FAST;
632 demosaicMode = ANDROID_PROCESSING_FAST;
633 noiseMode = ANDROID_PROCESSING_FAST;
634 shadingMode = ANDROID_PROCESSING_FAST;
635 geometricMode = ANDROID_PROCESSING_FAST;
636 colorMode = ANDROID_PROCESSING_FAST;
637 tonemapMode = ANDROID_PROCESSING_FAST;
638 edgeMode = ANDROID_PROCESSING_FAST;
639 break;
640 case CAMERA2_TEMPLATE_STILL_CAPTURE:
641 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
642 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
643 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
644 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
645 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
646 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
647 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
648 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
649 break;
650 case CAMERA2_TEMPLATE_VIDEO_RECORD:
651 hotPixelMode = ANDROID_PROCESSING_FAST;
652 demosaicMode = ANDROID_PROCESSING_FAST;
653 noiseMode = ANDROID_PROCESSING_FAST;
654 shadingMode = ANDROID_PROCESSING_FAST;
655 geometricMode = ANDROID_PROCESSING_FAST;
656 colorMode = ANDROID_PROCESSING_FAST;
657 tonemapMode = ANDROID_PROCESSING_FAST;
658 edgeMode = ANDROID_PROCESSING_FAST;
659 break;
660 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
661 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
662 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
663 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
664 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
665 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
666 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
667 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
668 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
669 break;
670 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
671 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
672 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
673 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
674 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
675 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
676 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
677 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
678 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
679 break;
680 default:
681 hotPixelMode = ANDROID_PROCESSING_FAST;
682 demosaicMode = ANDROID_PROCESSING_FAST;
683 noiseMode = ANDROID_PROCESSING_FAST;
684 shadingMode = ANDROID_PROCESSING_FAST;
685 geometricMode = ANDROID_PROCESSING_FAST;
686 colorMode = ANDROID_PROCESSING_FAST;
687 tonemapMode = ANDROID_PROCESSING_FAST;
688 edgeMode = ANDROID_PROCESSING_FAST;
689 break;
690 }
691 ADD_OR_SIZE(ANDROID_HOT_PIXEL_MODE, &hotPixelMode, 1);
692 ADD_OR_SIZE(ANDROID_DEMOSAIC_MODE, &demosaicMode, 1);
693 ADD_OR_SIZE(ANDROID_NOISE_MODE, &noiseMode, 1);
694 ADD_OR_SIZE(ANDROID_SHADING_MODE, &shadingMode, 1);
695 ADD_OR_SIZE(ANDROID_GEOMETRIC_MODE, &geometricMode, 1);
696 ADD_OR_SIZE(ANDROID_COLOR_MODE, &colorMode, 1);
697 ADD_OR_SIZE(ANDROID_TONEMAP_MODE, &tonemapMode, 1);
698 ADD_OR_SIZE(ANDROID_EDGE_MODE, &edgeMode, 1);
699
700 /** android.noise */
701 static const uint8_t noiseStrength = 5;
702 ADD_OR_SIZE(ANDROID_NOISE_STRENGTH, &noiseStrength, 1);
703
704 /** android.color */
705 static const float colorTransform[9] = {
706 1.0f, 0.f, 0.f,
707 0.f, 1.f, 0.f,
708 0.f, 0.f, 1.f
709 };
710 ADD_OR_SIZE(ANDROID_COLOR_TRANSFORM, colorTransform, 9);
711
712 /** android.tonemap */
713 static const float tonemapCurve[4] = {
714 0.f, 0.f,
715 1.f, 1.f
716 };
717 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_RED, tonemapCurve, 32); // sungjoong
718 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_GREEN, tonemapCurve, 32);
719 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_BLUE, tonemapCurve, 32);
720
721 /** android.edge */
722 static const uint8_t edgeStrength = 5;
723 ADD_OR_SIZE(ANDROID_EDGE_STRENGTH, &edgeStrength, 1);
724
725 /** android.scaler */
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700726 int32_t cropRegion[3] = {
727 0, 0, m_curCameraInfo->sensorW
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700728 };
729 ADD_OR_SIZE(ANDROID_SCALER_CROP_REGION, cropRegion, 3);
730
731 /** android.jpeg */
732 static const int32_t jpegQuality = 80;
733 ADD_OR_SIZE(ANDROID_JPEG_QUALITY, &jpegQuality, 1);
734
735 static const int32_t thumbnailSize[2] = {
736 640, 480
737 };
738 ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnailSize, 2);
739
740 static const int32_t thumbnailQuality = 80;
741 ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_QUALITY, &thumbnailQuality, 1);
742
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700743 static const double gpsCoordinates[3] = {
744 0, 0, 0
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700745 };
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700746 ADD_OR_SIZE(ANDROID_JPEG_GPS_COORDINATES, gpsCoordinates, 3);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700747
748 static const uint8_t gpsProcessingMethod[32] = "None";
749 ADD_OR_SIZE(ANDROID_JPEG_GPS_PROCESSING_METHOD, gpsProcessingMethod, 32);
750
751 static const int64_t gpsTimestamp = 0;
752 ADD_OR_SIZE(ANDROID_JPEG_GPS_TIMESTAMP, &gpsTimestamp, 1);
753
754 static const int32_t jpegOrientation = 0;
755 ADD_OR_SIZE(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1);
756
757 /** android.stats */
758
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700759 static const uint8_t faceDetectMode = ANDROID_STATS_FACE_DETECTION_FULL;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700760 ADD_OR_SIZE(ANDROID_STATS_FACE_DETECT_MODE, &faceDetectMode, 1);
761
762 static const uint8_t histogramMode = ANDROID_STATS_OFF;
763 ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_MODE, &histogramMode, 1);
764
765 static const uint8_t sharpnessMapMode = ANDROID_STATS_OFF;
766 ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1);
767
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700768
769 /** android.control */
770
771 uint8_t controlIntent = 0;
772 switch (request_template) {
773 case CAMERA2_TEMPLATE_PREVIEW:
774 controlIntent = ANDROID_CONTROL_INTENT_PREVIEW;
775 break;
776 case CAMERA2_TEMPLATE_STILL_CAPTURE:
777 controlIntent = ANDROID_CONTROL_INTENT_STILL_CAPTURE;
778 break;
779 case CAMERA2_TEMPLATE_VIDEO_RECORD:
780 controlIntent = ANDROID_CONTROL_INTENT_VIDEO_RECORD;
781 break;
782 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
783 controlIntent = ANDROID_CONTROL_INTENT_VIDEO_SNAPSHOT;
784 break;
785 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
786 controlIntent = ANDROID_CONTROL_INTENT_ZERO_SHUTTER_LAG;
787 break;
788 default:
789 controlIntent = ANDROID_CONTROL_INTENT_CUSTOM;
790 break;
791 }
792 ADD_OR_SIZE(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1);
793
794 static const uint8_t controlMode = ANDROID_CONTROL_AUTO;
795 ADD_OR_SIZE(ANDROID_CONTROL_MODE, &controlMode, 1);
796
797 static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_OFF;
798 ADD_OR_SIZE(ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1);
799
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700800 static const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700801 ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1);
802
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700803 static const uint8_t aeMode = ANDROID_CONTROL_AE_ON;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700804 ADD_OR_SIZE(ANDROID_CONTROL_AE_MODE, &aeMode, 1);
805
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700806 int32_t controlRegions[5] = {
807 0, 0, m_curCameraInfo->sensorW, m_curCameraInfo->sensorH, 1000
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700808 };
809 ADD_OR_SIZE(ANDROID_CONTROL_AE_REGIONS, controlRegions, 5);
810
811 static const int32_t aeExpCompensation = 0;
812 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION, &aeExpCompensation, 1);
813
814 static const int32_t aeTargetFpsRange[2] = {
815 10, 30
816 };
817 ADD_OR_SIZE(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, aeTargetFpsRange, 2);
818
819 static const uint8_t aeAntibandingMode =
820 ANDROID_CONTROL_AE_ANTIBANDING_AUTO;
821 ADD_OR_SIZE(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &aeAntibandingMode, 1);
822
823 static const uint8_t awbMode =
824 ANDROID_CONTROL_AWB_AUTO;
825 ADD_OR_SIZE(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);
826
827 ADD_OR_SIZE(ANDROID_CONTROL_AWB_REGIONS, controlRegions, 5);
828
829 uint8_t afMode = 0;
830 switch (request_template) {
831 case CAMERA2_TEMPLATE_PREVIEW:
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700832 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700833 break;
834 case CAMERA2_TEMPLATE_STILL_CAPTURE:
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700835 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700836 break;
837 case CAMERA2_TEMPLATE_VIDEO_RECORD:
838 afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
839 break;
840 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
841 afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
842 break;
843 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
844 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
845 break;
846 default:
847 afMode = ANDROID_CONTROL_AF_AUTO;
848 break;
849 }
850 ADD_OR_SIZE(ANDROID_CONTROL_AF_MODE, &afMode, 1);
851
852 ADD_OR_SIZE(ANDROID_CONTROL_AF_REGIONS, controlRegions, 5);
853
854 static const uint8_t vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_OFF;
855 ADD_OR_SIZE(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vstabMode, 1);
856
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700857 if (sizeRequest) {
858 ALOGV("Allocating %d entries, %d extra bytes for "
859 "request template type %d",
860 entryCount, dataCount, request_template);
861 *request = allocate_camera_metadata(entryCount, dataCount);
862 if (*request == NULL) {
863 ALOGE("Unable to allocate new request template type %d "
864 "(%d entries, %d bytes extra data)", request_template,
865 entryCount, dataCount);
866 return NO_MEMORY;
867 }
868 }
869 return OK;
870#undef ADD_OR_SIZE
871}
872
873}