blob: e62e3ce0e6b7d0df18b3a6bf8c5a8596c7d83ab4 [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 Kangdaa1fcd2012-08-08 11:49:43 -0700120 1280, 720,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700121 640, 480,
122 320, 240,
123 176, 144,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700124};
125
126const int32_t jpegResolutionS5K4E5[] =
127{
128 2560, 1920,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700129 2048, 1536,
130 1600, 1200,
131 1280, 1024,
132 1280, 960,
133 1152, 864,
134 640, 480,
135 320, 240,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700136};
137
138ExynosCamera2InfoS5K4E5::ExynosCamera2InfoS5K4E5()
139{
140 sensorW = 2560;
141 sensorH = 1920;
142 sensorRawW = (2560 + 16);
143 sensorRawH = (1920 + 10);
144 numScalerResolution = ARRAY_SIZE(scalerResolutionS5K4E5)/2;
145 scalerResolutions = scalerResolutionS5K4E5;
146 numJpegResolution = ARRAY_SIZE(jpegResolutionS5K4E5)/2;
147 jpegResolutions = jpegResolutionS5K4E5;
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700148 minFocusDistance = 0.1f;
149 focalLength = 3.43f;
150 aperture = 2.7f;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700151}
152
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700153ExynosCamera2InfoS5K4E5::~ExynosCamera2InfoS5K4E5()
154{
155 ALOGV("%s", __FUNCTION__);
156}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700157const int32_t scalerResolutionS5K6A3[] =
158{
Sungjoong Kangad378612012-08-17 12:34:33 -0700159 1280, 960,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700160 1280, 720,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700161 640, 480,
162 176, 144,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700163};
164
165const int32_t jpegResolutionS5K6A3[] =
166{
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700167 1392, 1392,
168 1392, 1040,
169 1392, 784,
170 1280, 1024,
Sungjoong Kangad378612012-08-17 12:34:33 -0700171 1280, 960,
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700172 1152, 864,
173 640, 480,
174 320, 240,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700175};
176
177ExynosCamera2InfoS5K6A3::ExynosCamera2InfoS5K6A3()
178{
179 sensorW = 1392;
180 sensorH = 1392;
181 sensorRawW = (1392 + 16);
182 sensorRawH = (1392 + 10);
183 numScalerResolution = ARRAY_SIZE(scalerResolutionS5K6A3)/2;
184 scalerResolutions = scalerResolutionS5K6A3;
185 numJpegResolution = ARRAY_SIZE(jpegResolutionS5K6A3)/2;
186 jpegResolutions = jpegResolutionS5K6A3;
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700187 minFocusDistance = 0.0f;
188 focalLength = 2.73f;
189 aperture = 2.8f;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700190}
191
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700192ExynosCamera2InfoS5K6A3::~ExynosCamera2InfoS5K6A3()
193{
194 ALOGV("%s", __FUNCTION__);
195}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700196ExynosCamera2::ExynosCamera2(int cameraId):
197 m_cameraId(cameraId)
198{
199 if (cameraId == 0)
200 m_curCameraInfo = new ExynosCamera2InfoS5K4E5;
201 else
202 m_curCameraInfo = new ExynosCamera2InfoS5K6A3;
203}
204
205ExynosCamera2::~ExynosCamera2()
206{
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700207 ALOGV("%s", __FUNCTION__);
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700208 delete m_curCameraInfo;
Sungjoong Kang15fd8232012-08-23 16:16:44 -0700209 m_curCameraInfo = NULL;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700210}
211
212int32_t ExynosCamera2::getSensorW()
213{
214 return m_curCameraInfo->sensorW;
215}
216
217int32_t ExynosCamera2::getSensorH()
218{
219 return m_curCameraInfo->sensorH;
220}
221
222int32_t ExynosCamera2::getSensorRawW()
223{
224 return m_curCameraInfo->sensorRawW;
225}
226
227int32_t ExynosCamera2::getSensorRawH()
228{
229 return m_curCameraInfo->sensorRawH;
230}
231
232bool ExynosCamera2::isSupportedResolution(int width, int height)
233{
234 int i;
235 for (i = 0 ; i < m_curCameraInfo->numScalerResolution ; i++) {
236 if (m_curCameraInfo->scalerResolutions[2*i] == width
237 && m_curCameraInfo->scalerResolutions[2*i+1] == height) {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900238 return true;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700239 }
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900240 }
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700241 return false;
242}
243
244bool ExynosCamera2::isSupportedJpegResolution(int width, int height)
245{
246 int i;
247 for (i = 0 ; i < m_curCameraInfo->numJpegResolution ; i++) {
248 if (m_curCameraInfo->jpegResolutions[2*i] == width
249 && m_curCameraInfo->jpegResolutions[2*i+1] == height) {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900250 return true;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700251 }
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900252 }
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700253 return false;
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900254}
255
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700256status_t addOrSize(camera_metadata_t *request,
257 bool sizeRequest,
258 size_t *entryCount,
259 size_t *dataCount,
260 uint32_t tag,
261 const void *entryData,
262 size_t entryDataCount) {
263 status_t res;
264 if (!sizeRequest) {
265 return add_camera_metadata_entry(request, tag, entryData,
266 entryDataCount);
267 } else {
268 int type = get_camera_metadata_tag_type(tag);
269 if (type < 0 ) return BAD_VALUE;
270 (*entryCount)++;
271 (*dataCount) += calculate_camera_metadata_entry_data_size(type,
272 entryDataCount);
273 return OK;
274 }
275}
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700276
277status_t ExynosCamera2::constructStaticInfo(camera_metadata_t **info,
278 int cameraId, bool sizeRequest) {
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700279
280 size_t entryCount = 0;
281 size_t dataCount = 0;
282 status_t ret;
283
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700284#define ADD_OR_SIZE( tag, data, count ) \
285 if ( ( ret = addOrSize(*info, sizeRequest, &entryCount, &dataCount, \
286 tag, data, count) ) != OK ) return ret
287
288 // android.lens
289
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700290 ADD_OR_SIZE(ANDROID_LENS_MINIMUM_FOCUS_DISTANCE,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700291 &(m_curCameraInfo->minFocusDistance), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700292 ADD_OR_SIZE(ANDROID_LENS_HYPERFOCAL_DISTANCE,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700293 &(m_curCameraInfo->minFocusDistance), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700294
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700295 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FOCAL_LENGTHS,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700296 &m_curCameraInfo->focalLength, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700297 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_APERTURES,
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700298 &m_curCameraInfo->aperture, 1);
299
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700300 static const float filterDensity = 0;
301 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_FILTER_DENSITY,
302 &filterDensity, 1);
303 static const uint8_t availableOpticalStabilization =
304 ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
305 ADD_OR_SIZE(ANDROID_LENS_AVAILABLE_OPTICAL_STABILIZATION,
306 &availableOpticalStabilization, 1);
307
308 static const int32_t lensShadingMapSize[] = {1, 1};
309 ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP_SIZE, lensShadingMapSize,
310 sizeof(lensShadingMapSize)/sizeof(int32_t));
311
312 static const float lensShadingMap[3 * 1 * 1 ] =
313 { 1.f, 1.f, 1.f };
314 ADD_OR_SIZE(ANDROID_LENS_SHADING_MAP, lensShadingMap,
315 sizeof(lensShadingMap)/sizeof(float));
316
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900317 int32_t lensFacing = cameraId ?
318 ANDROID_LENS_FACING_FRONT : ANDROID_LENS_FACING_BACK;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700319 ADD_OR_SIZE(ANDROID_LENS_FACING, &lensFacing, 1);
320
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700321 // android.sensor
322 ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME_RANGE,
323 Sensor::kExposureTimeRange, 2);
324
325 ADD_OR_SIZE(ANDROID_SENSOR_MAX_FRAME_DURATION,
326 &Sensor::kFrameDurationRange[1], 1);
327
328 ADD_OR_SIZE(ANDROID_SENSOR_AVAILABLE_SENSITIVITIES,
329 Sensor::kAvailableSensitivities,
330 sizeof(Sensor::kAvailableSensitivities)
331 /sizeof(uint32_t));
332
333 ADD_OR_SIZE(ANDROID_SENSOR_COLOR_FILTER_ARRANGEMENT,
334 &Sensor::kColorFilterArrangement, 1);
335
336 static const float sensorPhysicalSize[2] = {3.20f, 2.40f}; // mm
337 ADD_OR_SIZE(ANDROID_SENSOR_PHYSICAL_SIZE,
338 sensorPhysicalSize, 2);
339
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700340 int32_t pixelArraySize[2] = {
341 m_curCameraInfo->sensorW, m_curCameraInfo->sensorH
342 };
343 ADD_OR_SIZE(ANDROID_SENSOR_PIXEL_ARRAY_SIZE, pixelArraySize, 2);
344 ADD_OR_SIZE(ANDROID_SENSOR_ACTIVE_ARRAY_SIZE, pixelArraySize,2);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700345
346 ADD_OR_SIZE(ANDROID_SENSOR_WHITE_LEVEL,
347 &Sensor::kMaxRawValue, 1);
348
349 static const int32_t blackLevelPattern[4] = {
350 Sensor::kBlackLevel, Sensor::kBlackLevel,
351 Sensor::kBlackLevel, Sensor::kBlackLevel
352 };
353 ADD_OR_SIZE(ANDROID_SENSOR_BLACK_LEVEL_PATTERN,
354 blackLevelPattern, sizeof(blackLevelPattern)/sizeof(int32_t));
355
356 //TODO: sensor color calibration fields
357
358 // android.flash
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700359 static const uint8_t flashAvailable = 1;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700360 ADD_OR_SIZE(ANDROID_FLASH_AVAILABLE, &flashAvailable, 1);
361
362 static const int64_t flashChargeDuration = 0;
363 ADD_OR_SIZE(ANDROID_FLASH_CHARGE_DURATION, &flashChargeDuration, 1);
364
365 // android.tonemap
366
367 static const int32_t tonemapCurvePoints = 128;
368 ADD_OR_SIZE(ANDROID_TONEMAP_MAX_CURVE_POINTS, &tonemapCurvePoints, 1);
369
370 // android.scaler
371
372 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_FORMATS,
373 kAvailableFormats,
374 sizeof(kAvailableFormats)/sizeof(uint32_t));
375
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700376 int32_t availableRawSizes[2] = {
377 m_curCameraInfo->sensorRawW, m_curCameraInfo->sensorRawH
378 };
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700379 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_SIZES,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700380 availableRawSizes, 2);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700381
382 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS,
383 kAvailableRawMinDurations,
384 sizeof(kAvailableRawMinDurations)/sizeof(uint64_t));
385
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700386
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700387 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
388 m_curCameraInfo->scalerResolutions,
389 (m_curCameraInfo->numScalerResolution)*2);
390 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
391 m_curCameraInfo->jpegResolutions,
392 (m_curCameraInfo->numJpegResolution)*2);
393
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700394 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS,
395 kAvailableProcessedMinDurations,
396 sizeof(kAvailableProcessedMinDurations)/sizeof(uint64_t));
397
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700398 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS,
399 kAvailableJpegMinDurations,
400 sizeof(kAvailableJpegMinDurations)/sizeof(uint64_t));
401
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700402 static const float maxZoom = 1;
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700403 ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_ZOOM, &maxZoom, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700404
405 // android.jpeg
406
407 static const int32_t jpegThumbnailSizes[] = {
408 160, 120,
409 320, 240,
410 640, 480
411 };
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700412
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700413 ADD_OR_SIZE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,
414 jpegThumbnailSizes, sizeof(jpegThumbnailSizes)/sizeof(int32_t));
415
Sungjoong Kang13d8c7b2012-07-14 10:20:39 +0900416 static const int32_t jpegMaxSize = 5*1024*1024;
417 ADD_OR_SIZE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1);
418
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700419 // android.stats
420
421 static const uint8_t availableFaceDetectModes[] = {
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700422 ANDROID_STATS_FACE_DETECTION_OFF,
423 ANDROID_STATS_FACE_DETECTION_FULL
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700424 };
425 ADD_OR_SIZE(ANDROID_STATS_AVAILABLE_FACE_DETECT_MODES,
426 availableFaceDetectModes,
427 sizeof(availableFaceDetectModes));
428
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700429 m_curCameraInfo->maxFaceCount = 16;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700430 ADD_OR_SIZE(ANDROID_STATS_MAX_FACE_COUNT,
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700431 &(m_curCameraInfo->maxFaceCount), 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700432
433 static const int32_t histogramSize = 64;
434 ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_BUCKET_COUNT,
435 &histogramSize, 1);
436
437 static const int32_t maxHistogramCount = 1000;
438 ADD_OR_SIZE(ANDROID_STATS_MAX_HISTOGRAM_COUNT,
439 &maxHistogramCount, 1);
440
441 static const int32_t sharpnessMapSize[2] = {64, 64};
442 ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_SIZE,
443 sharpnessMapSize, sizeof(sharpnessMapSize)/sizeof(int32_t));
444
445 static const int32_t maxSharpnessMapValue = 1000;
446 ADD_OR_SIZE(ANDROID_STATS_MAX_SHARPNESS_MAP_VALUE,
447 &maxSharpnessMapValue, 1);
448
449 // android.control
450
451 static const uint8_t availableSceneModes[] = {
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700452 ANDROID_CONTROL_SCENE_MODE_ACTION,
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700453 ANDROID_CONTROL_SCENE_MODE_NIGHT,
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700454 ANDROID_CONTROL_SCENE_MODE_SUNSET,
455 ANDROID_CONTROL_SCENE_MODE_PARTY
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700456 };
457 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_SCENE_MODES,
458 availableSceneModes, sizeof(availableSceneModes));
459
460 static const uint8_t availableEffects[] = {
461 ANDROID_CONTROL_EFFECT_OFF
462 };
463 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_EFFECTS,
464 availableEffects, sizeof(availableEffects));
465
466 int32_t max3aRegions = 0;
467 ADD_OR_SIZE(ANDROID_CONTROL_MAX_REGIONS,
468 &max3aRegions, 1);
469
470 static const uint8_t availableAeModes[] = {
471 ANDROID_CONTROL_AE_OFF,
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700472 ANDROID_CONTROL_AE_ON,
473 ANDROID_CONTROL_AE_ON_AUTO_FLASH
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700474 };
475 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_MODES,
476 availableAeModes, sizeof(availableAeModes));
477
478 static const camera_metadata_rational exposureCompensationStep = {
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700479 1, 1
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700480 };
481 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_STEP,
482 &exposureCompensationStep, 1);
483
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700484 int32_t exposureCompensationRange[] = {-3, 3};
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700485 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION_RANGE,
486 exposureCompensationRange,
487 sizeof(exposureCompensationRange)/sizeof(int32_t));
488
489 static const int32_t availableTargetFpsRanges[] = {
Sungjoong Kang9dd63e12012-07-24 00:25:51 +0900490 5, 30, 30, 30
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700491 };
492 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES,
493 availableTargetFpsRanges,
494 sizeof(availableTargetFpsRanges)/sizeof(int32_t));
495
496 static const uint8_t availableAntibandingModes[] = {
497 ANDROID_CONTROL_AE_ANTIBANDING_OFF,
498 ANDROID_CONTROL_AE_ANTIBANDING_AUTO
499 };
500 ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES,
501 availableAntibandingModes, sizeof(availableAntibandingModes));
502
503 static const uint8_t availableAwbModes[] = {
504 ANDROID_CONTROL_AWB_OFF,
505 ANDROID_CONTROL_AWB_AUTO,
506 ANDROID_CONTROL_AWB_INCANDESCENT,
507 ANDROID_CONTROL_AWB_FLUORESCENT,
508 ANDROID_CONTROL_AWB_DAYLIGHT,
Sungjoong Kang2bdec062012-08-17 15:47:56 -0700509 ANDROID_CONTROL_AWB_CLOUDY_DAYLIGHT
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700510 };
511 ADD_OR_SIZE(ANDROID_CONTROL_AWB_AVAILABLE_MODES,
512 availableAwbModes, sizeof(availableAwbModes));
513
514 static const uint8_t availableAfModes[] = {
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700515 ANDROID_CONTROL_AF_OFF,
516 ANDROID_CONTROL_AF_AUTO,
517 ANDROID_CONTROL_AF_MACRO,
518 ANDROID_CONTROL_AF_CONTINUOUS_PICTURE,
519 ANDROID_CONTROL_AF_CONTINUOUS_VIDEO
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700520 };
521 ADD_OR_SIZE(ANDROID_CONTROL_AF_AVAILABLE_MODES,
522 availableAfModes, sizeof(availableAfModes));
523
524 static const uint8_t availableVstabModes[] = {
525 ANDROID_CONTROL_VIDEO_STABILIZATION_OFF
526 };
527 ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES,
528 availableVstabModes, sizeof(availableVstabModes));
529
530#undef ADD_OR_SIZE
531 /** Allocate metadata if sizing */
532 if (sizeRequest) {
533 ALOGV("Allocating %d entries, %d extra bytes for "
534 "static camera info",
535 entryCount, dataCount);
536 *info = allocate_camera_metadata(entryCount, dataCount);
537 if (*info == NULL) {
538 ALOGE("Unable to allocate camera static info"
539 "(%d entries, %d bytes extra data)",
540 entryCount, dataCount);
541 return NO_MEMORY;
542 }
543 }
544 return OK;
545}
546
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700547status_t ExynosCamera2::constructDefaultRequest(
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700548 int request_template,
549 camera_metadata_t **request,
550 bool sizeRequest) {
551
552 size_t entryCount = 0;
553 size_t dataCount = 0;
554 status_t ret;
555
556#define ADD_OR_SIZE( tag, data, count ) \
557 if ( ( ret = addOrSize(*request, sizeRequest, &entryCount, &dataCount, \
558 tag, data, count) ) != OK ) return ret
559
560 static const int64_t USEC = 1000LL;
561 static const int64_t MSEC = USEC * 1000LL;
562 static const int64_t SEC = MSEC * 1000LL;
563
564 /** android.request */
565
566 static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_NONE;
567 ADD_OR_SIZE(ANDROID_REQUEST_METADATA_MODE, &metadataMode, 1);
568
569 static const int32_t id = 0;
570 ADD_OR_SIZE(ANDROID_REQUEST_ID, &id, 1);
571
572 static const int32_t frameCount = 0;
573 ADD_OR_SIZE(ANDROID_REQUEST_FRAME_COUNT, &frameCount, 1);
574
575 // OUTPUT_STREAMS set by user
576 entryCount += 1;
577 dataCount += 5; // TODO: Should be maximum stream number
578
579 /** android.lens */
580
581 static const float focusDistance = 0;
582 ADD_OR_SIZE(ANDROID_LENS_FOCUS_DISTANCE, &focusDistance, 1);
583
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700584 ADD_OR_SIZE(ANDROID_LENS_APERTURE, &m_curCameraInfo->aperture, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700585
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700586 ADD_OR_SIZE(ANDROID_LENS_FOCAL_LENGTH, &m_curCameraInfo->focalLength, 1);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700587
588 static const float filterDensity = 0;
589 ADD_OR_SIZE(ANDROID_LENS_FILTER_DENSITY, &filterDensity, 1);
590
591 static const uint8_t opticalStabilizationMode =
592 ANDROID_LENS_OPTICAL_STABILIZATION_OFF;
593 ADD_OR_SIZE(ANDROID_LENS_OPTICAL_STABILIZATION_MODE,
594 &opticalStabilizationMode, 1);
595
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700596
597 /** android.sensor */
598
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700599
600 static const int64_t frameDuration = 33333333L; // 1/30 s
601 ADD_OR_SIZE(ANDROID_SENSOR_FRAME_DURATION, &frameDuration, 1);
602
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700603
604 /** android.flash */
605
606 static const uint8_t flashMode = ANDROID_FLASH_OFF;
607 ADD_OR_SIZE(ANDROID_FLASH_MODE, &flashMode, 1);
608
609 static const uint8_t flashPower = 10;
610 ADD_OR_SIZE(ANDROID_FLASH_FIRING_POWER, &flashPower, 1);
611
612 static const int64_t firingTime = 0;
613 ADD_OR_SIZE(ANDROID_FLASH_FIRING_TIME, &firingTime, 1);
614
615 /** Processing block modes */
616 uint8_t hotPixelMode = 0;
617 uint8_t demosaicMode = 0;
618 uint8_t noiseMode = 0;
619 uint8_t shadingMode = 0;
620 uint8_t geometricMode = 0;
621 uint8_t colorMode = 0;
622 uint8_t tonemapMode = 0;
623 uint8_t edgeMode = 0;
624 switch (request_template) {
625 case CAMERA2_TEMPLATE_PREVIEW:
626 hotPixelMode = ANDROID_PROCESSING_FAST;
627 demosaicMode = ANDROID_PROCESSING_FAST;
628 noiseMode = ANDROID_PROCESSING_FAST;
629 shadingMode = ANDROID_PROCESSING_FAST;
630 geometricMode = ANDROID_PROCESSING_FAST;
631 colorMode = ANDROID_PROCESSING_FAST;
632 tonemapMode = ANDROID_PROCESSING_FAST;
633 edgeMode = ANDROID_PROCESSING_FAST;
634 break;
635 case CAMERA2_TEMPLATE_STILL_CAPTURE:
636 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
637 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
638 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
639 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
640 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
641 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
642 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
643 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
644 break;
645 case CAMERA2_TEMPLATE_VIDEO_RECORD:
646 hotPixelMode = ANDROID_PROCESSING_FAST;
647 demosaicMode = ANDROID_PROCESSING_FAST;
648 noiseMode = ANDROID_PROCESSING_FAST;
649 shadingMode = ANDROID_PROCESSING_FAST;
650 geometricMode = ANDROID_PROCESSING_FAST;
651 colorMode = ANDROID_PROCESSING_FAST;
652 tonemapMode = ANDROID_PROCESSING_FAST;
653 edgeMode = ANDROID_PROCESSING_FAST;
654 break;
655 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
656 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
657 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
658 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
659 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
660 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
661 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
662 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
663 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
664 break;
665 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
666 hotPixelMode = ANDROID_PROCESSING_HIGH_QUALITY;
667 demosaicMode = ANDROID_PROCESSING_HIGH_QUALITY;
668 noiseMode = ANDROID_PROCESSING_HIGH_QUALITY;
669 shadingMode = ANDROID_PROCESSING_HIGH_QUALITY;
670 geometricMode = ANDROID_PROCESSING_HIGH_QUALITY;
671 colorMode = ANDROID_PROCESSING_HIGH_QUALITY;
672 tonemapMode = ANDROID_PROCESSING_HIGH_QUALITY;
673 edgeMode = ANDROID_PROCESSING_HIGH_QUALITY;
674 break;
675 default:
676 hotPixelMode = ANDROID_PROCESSING_FAST;
677 demosaicMode = ANDROID_PROCESSING_FAST;
678 noiseMode = ANDROID_PROCESSING_FAST;
679 shadingMode = ANDROID_PROCESSING_FAST;
680 geometricMode = ANDROID_PROCESSING_FAST;
681 colorMode = ANDROID_PROCESSING_FAST;
682 tonemapMode = ANDROID_PROCESSING_FAST;
683 edgeMode = ANDROID_PROCESSING_FAST;
684 break;
685 }
686 ADD_OR_SIZE(ANDROID_HOT_PIXEL_MODE, &hotPixelMode, 1);
687 ADD_OR_SIZE(ANDROID_DEMOSAIC_MODE, &demosaicMode, 1);
688 ADD_OR_SIZE(ANDROID_NOISE_MODE, &noiseMode, 1);
689 ADD_OR_SIZE(ANDROID_SHADING_MODE, &shadingMode, 1);
690 ADD_OR_SIZE(ANDROID_GEOMETRIC_MODE, &geometricMode, 1);
691 ADD_OR_SIZE(ANDROID_COLOR_MODE, &colorMode, 1);
692 ADD_OR_SIZE(ANDROID_TONEMAP_MODE, &tonemapMode, 1);
693 ADD_OR_SIZE(ANDROID_EDGE_MODE, &edgeMode, 1);
694
695 /** android.noise */
696 static const uint8_t noiseStrength = 5;
697 ADD_OR_SIZE(ANDROID_NOISE_STRENGTH, &noiseStrength, 1);
698
699 /** android.color */
700 static const float colorTransform[9] = {
701 1.0f, 0.f, 0.f,
702 0.f, 1.f, 0.f,
703 0.f, 0.f, 1.f
704 };
705 ADD_OR_SIZE(ANDROID_COLOR_TRANSFORM, colorTransform, 9);
706
707 /** android.tonemap */
708 static const float tonemapCurve[4] = {
709 0.f, 0.f,
710 1.f, 1.f
711 };
712 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_RED, tonemapCurve, 32); // sungjoong
713 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_GREEN, tonemapCurve, 32);
714 ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_BLUE, tonemapCurve, 32);
715
716 /** android.edge */
717 static const uint8_t edgeStrength = 5;
718 ADD_OR_SIZE(ANDROID_EDGE_STRENGTH, &edgeStrength, 1);
719
720 /** android.scaler */
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700721 int32_t cropRegion[3] = {
722 0, 0, m_curCameraInfo->sensorW
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700723 };
724 ADD_OR_SIZE(ANDROID_SCALER_CROP_REGION, cropRegion, 3);
725
726 /** android.jpeg */
727 static const int32_t jpegQuality = 80;
728 ADD_OR_SIZE(ANDROID_JPEG_QUALITY, &jpegQuality, 1);
729
730 static const int32_t thumbnailSize[2] = {
731 640, 480
732 };
733 ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnailSize, 2);
734
735 static const int32_t thumbnailQuality = 80;
736 ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_QUALITY, &thumbnailQuality, 1);
737
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700738 static const double gpsCoordinates[3] = {
739 0, 0, 0
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700740 };
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700741 ADD_OR_SIZE(ANDROID_JPEG_GPS_COORDINATES, gpsCoordinates, 3);
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700742
743 static const uint8_t gpsProcessingMethod[32] = "None";
744 ADD_OR_SIZE(ANDROID_JPEG_GPS_PROCESSING_METHOD, gpsProcessingMethod, 32);
745
746 static const int64_t gpsTimestamp = 0;
747 ADD_OR_SIZE(ANDROID_JPEG_GPS_TIMESTAMP, &gpsTimestamp, 1);
748
749 static const int32_t jpegOrientation = 0;
750 ADD_OR_SIZE(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1);
751
752 /** android.stats */
753
Sungjoong Kangfd2d78a2012-08-26 17:44:25 -0700754 static const uint8_t faceDetectMode = ANDROID_STATS_FACE_DETECTION_FULL;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700755 ADD_OR_SIZE(ANDROID_STATS_FACE_DETECT_MODE, &faceDetectMode, 1);
756
757 static const uint8_t histogramMode = ANDROID_STATS_OFF;
758 ADD_OR_SIZE(ANDROID_STATS_HISTOGRAM_MODE, &histogramMode, 1);
759
760 static const uint8_t sharpnessMapMode = ANDROID_STATS_OFF;
761 ADD_OR_SIZE(ANDROID_STATS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1);
762
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700763
764 /** android.control */
765
766 uint8_t controlIntent = 0;
767 switch (request_template) {
768 case CAMERA2_TEMPLATE_PREVIEW:
769 controlIntent = ANDROID_CONTROL_INTENT_PREVIEW;
770 break;
771 case CAMERA2_TEMPLATE_STILL_CAPTURE:
772 controlIntent = ANDROID_CONTROL_INTENT_STILL_CAPTURE;
773 break;
774 case CAMERA2_TEMPLATE_VIDEO_RECORD:
775 controlIntent = ANDROID_CONTROL_INTENT_VIDEO_RECORD;
776 break;
777 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
778 controlIntent = ANDROID_CONTROL_INTENT_VIDEO_SNAPSHOT;
779 break;
780 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
781 controlIntent = ANDROID_CONTROL_INTENT_ZERO_SHUTTER_LAG;
782 break;
783 default:
784 controlIntent = ANDROID_CONTROL_INTENT_CUSTOM;
785 break;
786 }
787 ADD_OR_SIZE(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1);
788
789 static const uint8_t controlMode = ANDROID_CONTROL_AUTO;
790 ADD_OR_SIZE(ANDROID_CONTROL_MODE, &controlMode, 1);
791
792 static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_OFF;
793 ADD_OR_SIZE(ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1);
794
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700795 static const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700796 ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1);
797
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700798 static const uint8_t aeMode = ANDROID_CONTROL_AE_ON;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700799 ADD_OR_SIZE(ANDROID_CONTROL_AE_MODE, &aeMode, 1);
800
Sungjoong Kangdaa1fcd2012-08-08 11:49:43 -0700801 int32_t controlRegions[5] = {
802 0, 0, m_curCameraInfo->sensorW, m_curCameraInfo->sensorH, 1000
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700803 };
804 ADD_OR_SIZE(ANDROID_CONTROL_AE_REGIONS, controlRegions, 5);
805
806 static const int32_t aeExpCompensation = 0;
807 ADD_OR_SIZE(ANDROID_CONTROL_AE_EXP_COMPENSATION, &aeExpCompensation, 1);
808
809 static const int32_t aeTargetFpsRange[2] = {
810 10, 30
811 };
812 ADD_OR_SIZE(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, aeTargetFpsRange, 2);
813
814 static const uint8_t aeAntibandingMode =
815 ANDROID_CONTROL_AE_ANTIBANDING_AUTO;
816 ADD_OR_SIZE(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &aeAntibandingMode, 1);
817
818 static const uint8_t awbMode =
819 ANDROID_CONTROL_AWB_AUTO;
820 ADD_OR_SIZE(ANDROID_CONTROL_AWB_MODE, &awbMode, 1);
821
822 ADD_OR_SIZE(ANDROID_CONTROL_AWB_REGIONS, controlRegions, 5);
823
824 uint8_t afMode = 0;
825 switch (request_template) {
826 case CAMERA2_TEMPLATE_PREVIEW:
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700827 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700828 break;
829 case CAMERA2_TEMPLATE_STILL_CAPTURE:
Sungjoong Kang0f26b202012-08-17 15:43:12 -0700830 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700831 break;
832 case CAMERA2_TEMPLATE_VIDEO_RECORD:
833 afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
834 break;
835 case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT:
836 afMode = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO;
837 break;
838 case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG:
839 afMode = ANDROID_CONTROL_AF_CONTINUOUS_PICTURE;
840 break;
841 default:
842 afMode = ANDROID_CONTROL_AF_AUTO;
843 break;
844 }
845 ADD_OR_SIZE(ANDROID_CONTROL_AF_MODE, &afMode, 1);
846
847 ADD_OR_SIZE(ANDROID_CONTROL_AF_REGIONS, controlRegions, 5);
848
849 static const uint8_t vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_OFF;
850 ADD_OR_SIZE(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vstabMode, 1);
851
Jiyoung Shinc15a6b02012-06-05 01:08:14 -0700852 if (sizeRequest) {
853 ALOGV("Allocating %d entries, %d extra bytes for "
854 "request template type %d",
855 entryCount, dataCount, request_template);
856 *request = allocate_camera_metadata(entryCount, dataCount);
857 if (*request == NULL) {
858 ALOGE("Unable to allocate new request template type %d "
859 "(%d entries, %d bytes extra data)", request_template,
860 entryCount, dataCount);
861 return NO_MEMORY;
862 }
863 }
864 return OK;
865#undef ADD_OR_SIZE
866}
867
868}