Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 1 | /* |
| 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 Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 30 | |
| 31 | //#define LOG_NDEBUG 0 |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 32 | #define LOG_TAG "ExynosCamera2" |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 33 | #include <utils/Log.h> |
| 34 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 35 | #include "ExynosCamera2.h" |
| 36 | |
| 37 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 38 | |
| 39 | namespace android { |
| 40 | |
| 41 | class Sensor { |
| 42 | public: |
| 43 | /** |
| 44 | * Static sensor characteristics |
| 45 | */ |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 46 | static const unsigned int kResolution[2][2]; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 47 | |
| 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 Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 82 | |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 83 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 84 | const uint32_t Sensor::kAvailableSensitivities[5] = |
| 85 | {100, 200, 400, 800, 1600}; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 86 | const nsecs_t Sensor::kExposureTimeRange[2] = |
| 87 | {1000L, 30000000000L} ; // 1 us - 30 sec |
| 88 | const nsecs_t Sensor::kFrameDurationRange[2] = |
| 89 | {33331760L, 30000000000L}; // ~1/30 s - 30 sec |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 90 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 91 | const uint8_t Sensor::kColorFilterArrangement = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 92 | |
Sungjoong Kang | 13d8c7b | 2012-07-14 10:20:39 +0900 | [diff] [blame] | 93 | const uint32_t kAvailableFormats[5] = { |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 94 | HAL_PIXEL_FORMAT_RAW_SENSOR, |
Sungjoong Kang | 13d8c7b | 2012-07-14 10:20:39 +0900 | [diff] [blame] | 95 | HAL_PIXEL_FORMAT_BLOB, |
| 96 | HAL_PIXEL_FORMAT_RGBA_8888, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 97 | HAL_PIXEL_FORMAT_YV12, |
| 98 | HAL_PIXEL_FORMAT_YCrCb_420_SP |
| 99 | }; |
| 100 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 101 | // Output image data characteristics |
| 102 | const uint32_t Sensor::kMaxRawValue = 4000; |
| 103 | const uint32_t Sensor::kBlackLevel = 1000; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 104 | |
| 105 | const uint64_t kAvailableRawMinDurations[1] = { |
| 106 | Sensor::kFrameDurationRange[0] |
| 107 | }; |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 108 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 109 | const uint64_t kAvailableProcessedMinDurations[1] = { |
| 110 | Sensor::kFrameDurationRange[0] |
| 111 | }; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 112 | const uint64_t kAvailableJpegMinDurations[1] = { |
| 113 | Sensor::kFrameDurationRange[0] |
| 114 | }; |
| 115 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 116 | const int32_t scalerResolutionS5K4E5[] = |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 117 | { |
hyeonmyeong Choi | 0b7b757 | 2012-09-06 12:45:44 -0700 | [diff] [blame] | 118 | 1920, 1080, // 16:9 |
| 119 | 1440, 1080, // 4:3 |
| 120 | 1440, 960, // 3:2 |
| 121 | 1280, 1024, // 5:4 |
| 122 | 1280, 720, // 16:9 |
| 123 | 960, 720, // 4:3 |
| 124 | 800, 480, // 5:3 |
| 125 | 768, 576, // 4:3 |
| 126 | 720, 576, // 5:4 |
| 127 | 720, 480, // 3:2 |
| 128 | 640, 480, // 4:3 |
| 129 | 352, 288, // 11:9 |
| 130 | 320, 240, // 4:3 |
| 131 | 240, 160, // 3:2 |
| 132 | 176, 144, // 6:5 |
| 133 | 128, 96, // 4:3 |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 134 | }; |
| 135 | |
| 136 | const int32_t jpegResolutionS5K4E5[] = |
| 137 | { |
| 138 | 2560, 1920, |
Sungjoong Kang | e4657e3 | 2012-08-28 15:02:19 -0700 | [diff] [blame] | 139 | 2560, 1440, |
hyeonmyeong Choi | a44c336 | 2012-08-30 19:01:25 -0700 | [diff] [blame] | 140 | 2160, 1440, |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 141 | 2048, 1536, |
| 142 | 1600, 1200, |
| 143 | 1280, 1024, |
| 144 | 1280, 960, |
| 145 | 1152, 864, |
| 146 | 640, 480, |
| 147 | 320, 240, |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 148 | }; |
| 149 | |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 150 | const uint8_t availableAfModesS5K4E5[] = |
| 151 | { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 152 | ANDROID_CONTROL_AF_MODE_OFF, |
| 153 | ANDROID_CONTROL_AF_MODE_AUTO, |
| 154 | ANDROID_CONTROL_AF_MODE_MACRO, |
| 155 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, |
| 156 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 157 | }; |
| 158 | |
| 159 | const uint8_t sceneModeOverridesS5K4E5[] = |
| 160 | { |
| 161 | // ANDROID_CONTROL_SCENE_MODE_ACTION |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 162 | ANDROID_CONTROL_AE_MODE_ON, |
| 163 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 164 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 165 | // ANDROID_CONTROL_SCENE_MODE_NIGHT |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 166 | ANDROID_CONTROL_AE_MODE_ON, |
| 167 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 168 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 169 | // ANDROID_CONTROL_SCENE_MODE_SUNSET |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 170 | ANDROID_CONTROL_AE_MODE_ON, |
| 171 | ANDROID_CONTROL_AWB_MODE_DAYLIGHT, |
| 172 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 173 | // ANDROID_CONTROL_SCENE_MODE_PARTY |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 174 | ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH, |
| 175 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 176 | ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | const uint8_t availableAeModesS5K4E5[] = |
| 180 | { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 181 | ANDROID_CONTROL_AE_MODE_OFF, |
| 182 | ANDROID_CONTROL_AE_MODE_ON, |
| 183 | ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 184 | }; |
| 185 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 186 | ExynosCamera2InfoS5K4E5::ExynosCamera2InfoS5K4E5() |
| 187 | { |
| 188 | sensorW = 2560; |
| 189 | sensorH = 1920; |
| 190 | sensorRawW = (2560 + 16); |
| 191 | sensorRawH = (1920 + 10); |
| 192 | numScalerResolution = ARRAY_SIZE(scalerResolutionS5K4E5)/2; |
| 193 | scalerResolutions = scalerResolutionS5K4E5; |
| 194 | numJpegResolution = ARRAY_SIZE(jpegResolutionS5K4E5)/2; |
| 195 | jpegResolutions = jpegResolutionS5K4E5; |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 196 | minFocusDistance = 0.1f; |
| 197 | focalLength = 3.43f; |
| 198 | aperture = 2.7f; |
Sungjoong Kang | e00f659 | 2012-09-07 19:05:31 -0700 | [diff] [blame] | 199 | fnumber = 2.7f; |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 200 | availableAfModes = availableAfModesS5K4E5; |
| 201 | numAvailableAfModes = ARRAY_SIZE(availableAfModesS5K4E5); |
| 202 | sceneModeOverrides = sceneModeOverridesS5K4E5; |
| 203 | numSceneModeOverrides = ARRAY_SIZE(sceneModeOverridesS5K4E5); |
| 204 | availableAeModes = availableAeModesS5K4E5; |
| 205 | numAvailableAeModes = ARRAY_SIZE(availableAeModesS5K4E5); |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 208 | ExynosCamera2InfoS5K4E5::~ExynosCamera2InfoS5K4E5() |
| 209 | { |
| 210 | ALOGV("%s", __FUNCTION__); |
| 211 | } |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 212 | const int32_t scalerResolutionS5K6A3[] = |
| 213 | { |
hyeonmyeong Choi | 0b7b757 | 2012-09-06 12:45:44 -0700 | [diff] [blame] | 214 | 1344, 896, // 3:2 |
| 215 | 1280, 1024, // 5:4 |
Sungjoong Kang | 9c046e3 | 2012-10-09 12:00:51 -0700 | [diff] [blame] | 216 | 1024, 1024, // 1:1 |
hyeonmyeong Choi | 0b7b757 | 2012-09-06 12:45:44 -0700 | [diff] [blame] | 217 | 1280, 960, // 4:3 |
| 218 | 1280, 720, // 16:9 |
| 219 | 960, 720, // 4:3 |
| 220 | 800, 480, // 5:3 |
| 221 | 768, 576, // 4:3 |
| 222 | 720, 576, // 5:4 |
| 223 | 720, 480, // 3:2 |
| 224 | 640, 480, // 4:3 |
| 225 | 352, 288, // 11:9 |
| 226 | 320, 240, // 4:3 |
| 227 | 240, 160, // 3:2 |
| 228 | 176, 144, // 6:5 |
| 229 | 128, 96, // 4:3 |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | const int32_t jpegResolutionS5K6A3[] = |
| 233 | { |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 234 | 1392, 1392, |
| 235 | 1392, 1040, |
hyeonmyeong Choi | a44c336 | 2012-08-30 19:01:25 -0700 | [diff] [blame] | 236 | 1392, 928, |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 237 | 1392, 784, |
| 238 | 1280, 1024, |
Sungjoong Kang | ad37861 | 2012-08-17 12:34:33 -0700 | [diff] [blame] | 239 | 1280, 960, |
Sungjoong Kang | e4657e3 | 2012-08-28 15:02:19 -0700 | [diff] [blame] | 240 | 1280, 720, |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 241 | 1152, 864, |
| 242 | 640, 480, |
| 243 | 320, 240, |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 244 | }; |
| 245 | |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 246 | const uint8_t availableAfModesS5K6A3[] = |
| 247 | { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 248 | ANDROID_CONTROL_AF_MODE_OFF |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 249 | }; |
| 250 | |
| 251 | const uint8_t sceneModeOverridesS5K6A3[] = |
| 252 | { |
| 253 | // ANDROID_CONTROL_SCENE_MODE_ACTION |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 254 | ANDROID_CONTROL_AE_MODE_ON, |
| 255 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 256 | ANDROID_CONTROL_AF_MODE_OFF, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 257 | // ANDROID_CONTROL_SCENE_MODE_NIGHT |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 258 | ANDROID_CONTROL_AE_MODE_ON, |
| 259 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 260 | ANDROID_CONTROL_AF_MODE_OFF, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 261 | // ANDROID_CONTROL_SCENE_MODE_SUNSET |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 262 | ANDROID_CONTROL_AE_MODE_ON, |
| 263 | ANDROID_CONTROL_AWB_MODE_DAYLIGHT, |
| 264 | ANDROID_CONTROL_AF_MODE_OFF, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 265 | // ANDROID_CONTROL_SCENE_MODE_PARTY |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 266 | ANDROID_CONTROL_AE_MODE_ON, |
| 267 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 268 | ANDROID_CONTROL_AF_MODE_OFF |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 269 | }; |
| 270 | |
| 271 | const uint8_t availableAeModesS5K6A3[] = |
| 272 | { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 273 | ANDROID_CONTROL_AE_MODE_OFF, |
| 274 | ANDROID_CONTROL_AE_MODE_ON |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 275 | }; |
| 276 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 277 | ExynosCamera2InfoS5K6A3::ExynosCamera2InfoS5K6A3() |
| 278 | { |
| 279 | sensorW = 1392; |
| 280 | sensorH = 1392; |
| 281 | sensorRawW = (1392 + 16); |
| 282 | sensorRawH = (1392 + 10); |
| 283 | numScalerResolution = ARRAY_SIZE(scalerResolutionS5K6A3)/2; |
| 284 | scalerResolutions = scalerResolutionS5K6A3; |
| 285 | numJpegResolution = ARRAY_SIZE(jpegResolutionS5K6A3)/2; |
| 286 | jpegResolutions = jpegResolutionS5K6A3; |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 287 | minFocusDistance = 0.0f; |
| 288 | focalLength = 2.73f; |
| 289 | aperture = 2.8f; |
Sungjoong Kang | e00f659 | 2012-09-07 19:05:31 -0700 | [diff] [blame] | 290 | fnumber = 2.8f; |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 291 | availableAfModes = availableAfModesS5K6A3; |
| 292 | numAvailableAfModes = ARRAY_SIZE(availableAfModesS5K6A3); |
| 293 | sceneModeOverrides = sceneModeOverridesS5K6A3; |
| 294 | numSceneModeOverrides = ARRAY_SIZE(sceneModeOverridesS5K6A3); |
| 295 | availableAeModes = availableAeModesS5K6A3; |
| 296 | numAvailableAeModes = ARRAY_SIZE(availableAeModesS5K6A3); |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 297 | } |
| 298 | |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 299 | ExynosCamera2InfoS5K6A3::~ExynosCamera2InfoS5K6A3() |
| 300 | { |
| 301 | ALOGV("%s", __FUNCTION__); |
| 302 | } |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 303 | ExynosCamera2::ExynosCamera2(int cameraId): |
| 304 | m_cameraId(cameraId) |
| 305 | { |
| 306 | if (cameraId == 0) |
| 307 | m_curCameraInfo = new ExynosCamera2InfoS5K4E5; |
| 308 | else |
| 309 | m_curCameraInfo = new ExynosCamera2InfoS5K6A3; |
| 310 | } |
| 311 | |
| 312 | ExynosCamera2::~ExynosCamera2() |
| 313 | { |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 314 | ALOGV("%s", __FUNCTION__); |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 315 | delete m_curCameraInfo; |
Sungjoong Kang | 15fd823 | 2012-08-23 16:16:44 -0700 | [diff] [blame] | 316 | m_curCameraInfo = NULL; |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | int32_t ExynosCamera2::getSensorW() |
| 320 | { |
| 321 | return m_curCameraInfo->sensorW; |
| 322 | } |
| 323 | |
| 324 | int32_t ExynosCamera2::getSensorH() |
| 325 | { |
| 326 | return m_curCameraInfo->sensorH; |
| 327 | } |
| 328 | |
| 329 | int32_t ExynosCamera2::getSensorRawW() |
| 330 | { |
| 331 | return m_curCameraInfo->sensorRawW; |
| 332 | } |
| 333 | |
| 334 | int32_t ExynosCamera2::getSensorRawH() |
| 335 | { |
| 336 | return m_curCameraInfo->sensorRawH; |
| 337 | } |
| 338 | |
| 339 | bool ExynosCamera2::isSupportedResolution(int width, int height) |
| 340 | { |
| 341 | int i; |
| 342 | for (i = 0 ; i < m_curCameraInfo->numScalerResolution ; i++) { |
| 343 | if (m_curCameraInfo->scalerResolutions[2*i] == width |
| 344 | && m_curCameraInfo->scalerResolutions[2*i+1] == height) { |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 345 | return true; |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 346 | } |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 347 | } |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 348 | return false; |
| 349 | } |
| 350 | |
| 351 | bool ExynosCamera2::isSupportedJpegResolution(int width, int height) |
| 352 | { |
| 353 | int i; |
| 354 | for (i = 0 ; i < m_curCameraInfo->numJpegResolution ; i++) { |
| 355 | if (m_curCameraInfo->jpegResolutions[2*i] == width |
| 356 | && m_curCameraInfo->jpegResolutions[2*i+1] == height) { |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 357 | return true; |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 358 | } |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 359 | } |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 360 | return false; |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 361 | } |
| 362 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 363 | status_t addOrSize(camera_metadata_t *request, |
| 364 | bool sizeRequest, |
| 365 | size_t *entryCount, |
| 366 | size_t *dataCount, |
| 367 | uint32_t tag, |
| 368 | const void *entryData, |
| 369 | size_t entryDataCount) { |
| 370 | status_t res; |
| 371 | if (!sizeRequest) { |
| 372 | return add_camera_metadata_entry(request, tag, entryData, |
| 373 | entryDataCount); |
| 374 | } else { |
| 375 | int type = get_camera_metadata_tag_type(tag); |
| 376 | if (type < 0 ) return BAD_VALUE; |
| 377 | (*entryCount)++; |
| 378 | (*dataCount) += calculate_camera_metadata_entry_data_size(type, |
| 379 | entryDataCount); |
| 380 | return OK; |
| 381 | } |
| 382 | } |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 383 | |
| 384 | status_t ExynosCamera2::constructStaticInfo(camera_metadata_t **info, |
| 385 | int cameraId, bool sizeRequest) { |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 386 | |
| 387 | size_t entryCount = 0; |
| 388 | size_t dataCount = 0; |
| 389 | status_t ret; |
| 390 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 391 | #define ADD_OR_SIZE( tag, data, count ) \ |
| 392 | if ( ( ret = addOrSize(*info, sizeRequest, &entryCount, &dataCount, \ |
| 393 | tag, data, count) ) != OK ) return ret |
| 394 | |
| 395 | // android.lens |
| 396 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 397 | ADD_OR_SIZE(ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE, |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 398 | &(m_curCameraInfo->minFocusDistance), 1); |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 399 | ADD_OR_SIZE(ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE, |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 400 | &(m_curCameraInfo->minFocusDistance), 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 401 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 402 | ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 403 | &m_curCameraInfo->focalLength, 1); |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 404 | ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_APERTURES, |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 405 | &m_curCameraInfo->aperture, 1); |
| 406 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 407 | static const float filterDensity = 0; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 408 | ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 409 | &filterDensity, 1); |
| 410 | static const uint8_t availableOpticalStabilization = |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 411 | ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF; |
| 412 | ADD_OR_SIZE(ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 413 | &availableOpticalStabilization, 1); |
| 414 | |
| 415 | static const int32_t lensShadingMapSize[] = {1, 1}; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 416 | ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP_SIZE, lensShadingMapSize, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 417 | sizeof(lensShadingMapSize)/sizeof(int32_t)); |
| 418 | |
| 419 | static const float lensShadingMap[3 * 1 * 1 ] = |
| 420 | { 1.f, 1.f, 1.f }; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 421 | ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP, lensShadingMap, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 422 | sizeof(lensShadingMap)/sizeof(float)); |
| 423 | |
Sungjoong Kang | 9dd63e1 | 2012-07-24 00:25:51 +0900 | [diff] [blame] | 424 | int32_t lensFacing = cameraId ? |
| 425 | ANDROID_LENS_FACING_FRONT : ANDROID_LENS_FACING_BACK; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 426 | ADD_OR_SIZE(ANDROID_LENS_FACING, &lensFacing, 1); |
| 427 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 428 | // android.sensor |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 429 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 430 | Sensor::kExposureTimeRange, 2); |
| 431 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 432 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 433 | &Sensor::kFrameDurationRange[1], 1); |
| 434 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 435 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_AVAILABLE_SENSITIVITIES, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 436 | Sensor::kAvailableSensitivities, |
| 437 | sizeof(Sensor::kAvailableSensitivities) |
| 438 | /sizeof(uint32_t)); |
| 439 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 440 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 441 | &Sensor::kColorFilterArrangement, 1); |
| 442 | |
Eino-Ville Talvala | a7fe049 | 2013-04-30 13:32:53 -0700 | [diff] [blame^] | 443 | // Empirically derived to get correct FOV measurements |
| 444 | static const float sensorPhysicalSize[2] = {3.50f, 2.625f}; // mm |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 445 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_PHYSICAL_SIZE, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 446 | sensorPhysicalSize, 2); |
| 447 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 448 | int32_t pixelArraySize[2] = { |
| 449 | m_curCameraInfo->sensorW, m_curCameraInfo->sensorH |
| 450 | }; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 451 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, pixelArraySize, 2); |
| 452 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, pixelArraySize,2); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 453 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 454 | ADD_OR_SIZE(ANDROID_SENSOR_INFO_WHITE_LEVEL, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 455 | &Sensor::kMaxRawValue, 1); |
| 456 | |
| 457 | static const int32_t blackLevelPattern[4] = { |
| 458 | Sensor::kBlackLevel, Sensor::kBlackLevel, |
| 459 | Sensor::kBlackLevel, Sensor::kBlackLevel |
| 460 | }; |
| 461 | ADD_OR_SIZE(ANDROID_SENSOR_BLACK_LEVEL_PATTERN, |
| 462 | blackLevelPattern, sizeof(blackLevelPattern)/sizeof(int32_t)); |
| 463 | |
| 464 | //TODO: sensor color calibration fields |
| 465 | |
| 466 | // android.flash |
Younghwan Joo | 9a710a4 | 2012-09-05 17:52:08 -0700 | [diff] [blame] | 467 | uint8_t flashAvailable; |
| 468 | if (cameraId == 0) |
| 469 | flashAvailable = 1; |
| 470 | else |
| 471 | flashAvailable = 0; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 472 | ADD_OR_SIZE(ANDROID_FLASH_INFO_AVAILABLE, &flashAvailable, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 473 | |
| 474 | static const int64_t flashChargeDuration = 0; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 475 | ADD_OR_SIZE(ANDROID_FLASH_INFO_CHARGE_DURATION, &flashChargeDuration, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 476 | |
| 477 | // android.tonemap |
| 478 | |
| 479 | static const int32_t tonemapCurvePoints = 128; |
| 480 | ADD_OR_SIZE(ANDROID_TONEMAP_MAX_CURVE_POINTS, &tonemapCurvePoints, 1); |
| 481 | |
| 482 | // android.scaler |
| 483 | |
| 484 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_FORMATS, |
| 485 | kAvailableFormats, |
| 486 | sizeof(kAvailableFormats)/sizeof(uint32_t)); |
| 487 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 488 | int32_t availableRawSizes[2] = { |
| 489 | m_curCameraInfo->sensorRawW, m_curCameraInfo->sensorRawH |
| 490 | }; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 491 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_SIZES, |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 492 | availableRawSizes, 2); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 493 | |
| 494 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS, |
| 495 | kAvailableRawMinDurations, |
| 496 | sizeof(kAvailableRawMinDurations)/sizeof(uint64_t)); |
| 497 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 498 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 499 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES, |
| 500 | m_curCameraInfo->scalerResolutions, |
| 501 | (m_curCameraInfo->numScalerResolution)*2); |
| 502 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_SIZES, |
| 503 | m_curCameraInfo->jpegResolutions, |
| 504 | (m_curCameraInfo->numJpegResolution)*2); |
| 505 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 506 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS, |
| 507 | kAvailableProcessedMinDurations, |
| 508 | sizeof(kAvailableProcessedMinDurations)/sizeof(uint64_t)); |
| 509 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 510 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS, |
| 511 | kAvailableJpegMinDurations, |
| 512 | sizeof(kAvailableJpegMinDurations)/sizeof(uint64_t)); |
| 513 | |
Sungjoong Kang | e4657e3 | 2012-08-28 15:02:19 -0700 | [diff] [blame] | 514 | static const float maxZoom = 4; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 515 | ADD_OR_SIZE(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, &maxZoom, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 516 | |
| 517 | // android.jpeg |
| 518 | |
| 519 | static const int32_t jpegThumbnailSizes[] = { |
| 520 | 160, 120, |
Sungjoong Kang | 2d5e6ec | 2012-08-30 15:14:17 +0900 | [diff] [blame] | 521 | 160, 160, |
| 522 | 160, 90, |
Sungjoong Kang | 4017b08 | 2012-09-21 15:44:48 -0700 | [diff] [blame] | 523 | 144, 96, |
| 524 | 0, 0 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 525 | }; |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 526 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 527 | ADD_OR_SIZE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, |
| 528 | jpegThumbnailSizes, sizeof(jpegThumbnailSizes)/sizeof(int32_t)); |
| 529 | |
Sungjoong Kang | 3c006f8 | 2012-09-27 16:02:40 -0700 | [diff] [blame] | 530 | static const int32_t jpegMaxSize = 10 * 1024 * 1024; |
Sungjoong Kang | 13d8c7b | 2012-07-14 10:20:39 +0900 | [diff] [blame] | 531 | ADD_OR_SIZE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1); |
| 532 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 533 | // android.stats |
| 534 | |
| 535 | static const uint8_t availableFaceDetectModes[] = { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 536 | ANDROID_STATISTICS_FACE_DETECT_MODE_OFF, |
| 537 | ANDROID_STATISTICS_FACE_DETECT_MODE_FULL |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 538 | }; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 539 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 540 | availableFaceDetectModes, |
| 541 | sizeof(availableFaceDetectModes)); |
| 542 | |
Younghwan Joo | f3312f8 | 2012-09-20 13:56:59 -0700 | [diff] [blame] | 543 | m_curCameraInfo->maxFaceCount = CAMERA2_MAX_FACES; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 544 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, |
Sungjoong Kang | fd2d78a | 2012-08-26 17:44:25 -0700 | [diff] [blame] | 545 | &(m_curCameraInfo->maxFaceCount), 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 546 | |
| 547 | static const int32_t histogramSize = 64; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 548 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 549 | &histogramSize, 1); |
| 550 | |
| 551 | static const int32_t maxHistogramCount = 1000; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 552 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 553 | &maxHistogramCount, 1); |
| 554 | |
| 555 | static const int32_t sharpnessMapSize[2] = {64, 64}; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 556 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 557 | sharpnessMapSize, sizeof(sharpnessMapSize)/sizeof(int32_t)); |
| 558 | |
| 559 | static const int32_t maxSharpnessMapValue = 1000; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 560 | ADD_OR_SIZE(ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 561 | &maxSharpnessMapValue, 1); |
| 562 | |
| 563 | // android.control |
| 564 | |
| 565 | static const uint8_t availableSceneModes[] = { |
Sungjoong Kang | 2bdec06 | 2012-08-17 15:47:56 -0700 | [diff] [blame] | 566 | ANDROID_CONTROL_SCENE_MODE_ACTION, |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 567 | ANDROID_CONTROL_SCENE_MODE_NIGHT, |
Sungjoong Kang | 2bdec06 | 2012-08-17 15:47:56 -0700 | [diff] [blame] | 568 | ANDROID_CONTROL_SCENE_MODE_SUNSET, |
| 569 | ANDROID_CONTROL_SCENE_MODE_PARTY |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 570 | }; |
| 571 | ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_SCENE_MODES, |
| 572 | availableSceneModes, sizeof(availableSceneModes)); |
| 573 | |
| 574 | static const uint8_t availableEffects[] = { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 575 | ANDROID_CONTROL_EFFECT_MODE_OFF |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 576 | }; |
| 577 | ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_EFFECTS, |
| 578 | availableEffects, sizeof(availableEffects)); |
| 579 | |
Sungjoong Kang | 8e2c2fd | 2012-08-27 00:02:22 -0700 | [diff] [blame] | 580 | int32_t max3aRegions = 1; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 581 | ADD_OR_SIZE(ANDROID_CONTROL_MAX_REGIONS, |
| 582 | &max3aRegions, 1); |
| 583 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 584 | ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_MODES, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 585 | m_curCameraInfo->availableAeModes, m_curCameraInfo->numAvailableAeModes); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 586 | |
| 587 | static const camera_metadata_rational exposureCompensationStep = { |
Sungjoong Kang | 2bdec06 | 2012-08-17 15:47:56 -0700 | [diff] [blame] | 588 | 1, 1 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 589 | }; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 590 | ADD_OR_SIZE(ANDROID_CONTROL_AE_COMPENSATION_STEP, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 591 | &exposureCompensationStep, 1); |
| 592 | |
Sungjoong Kang | 2bdec06 | 2012-08-17 15:47:56 -0700 | [diff] [blame] | 593 | int32_t exposureCompensationRange[] = {-3, 3}; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 594 | ADD_OR_SIZE(ANDROID_CONTROL_AE_COMPENSATION_RANGE, |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 595 | exposureCompensationRange, |
| 596 | sizeof(exposureCompensationRange)/sizeof(int32_t)); |
| 597 | |
| 598 | static const int32_t availableTargetFpsRanges[] = { |
Sungjoong Kang | 3c17a3f | 2012-10-22 14:39:49 -0700 | [diff] [blame] | 599 | 15, 15, 24, 24, 25, 25, 15, 30, 30, 30 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 600 | }; |
| 601 | ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, |
| 602 | availableTargetFpsRanges, |
| 603 | sizeof(availableTargetFpsRanges)/sizeof(int32_t)); |
| 604 | |
| 605 | static const uint8_t availableAntibandingModes[] = { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 606 | ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF, |
| 607 | ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 608 | }; |
| 609 | ADD_OR_SIZE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, |
| 610 | availableAntibandingModes, sizeof(availableAntibandingModes)); |
| 611 | |
| 612 | static const uint8_t availableAwbModes[] = { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 613 | ANDROID_CONTROL_AWB_MODE_OFF, |
| 614 | ANDROID_CONTROL_AWB_MODE_AUTO, |
| 615 | ANDROID_CONTROL_AWB_MODE_INCANDESCENT, |
| 616 | ANDROID_CONTROL_AWB_MODE_FLUORESCENT, |
| 617 | ANDROID_CONTROL_AWB_MODE_DAYLIGHT, |
| 618 | ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 619 | }; |
| 620 | ADD_OR_SIZE(ANDROID_CONTROL_AWB_AVAILABLE_MODES, |
| 621 | availableAwbModes, sizeof(availableAwbModes)); |
| 622 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 623 | ADD_OR_SIZE(ANDROID_CONTROL_AF_AVAILABLE_MODES, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 624 | m_curCameraInfo->availableAfModes, m_curCameraInfo->numAvailableAfModes); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 625 | |
| 626 | static const uint8_t availableVstabModes[] = { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 627 | ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF, |
| 628 | ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 629 | }; |
| 630 | ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, |
| 631 | availableVstabModes, sizeof(availableVstabModes)); |
| 632 | |
Sungjoong Kang | c68cd00 | 2012-10-01 21:50:09 -0700 | [diff] [blame] | 633 | ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE_OVERRIDES, |
Sungjoong Kang | 73c6337 | 2012-10-04 21:51:47 -0700 | [diff] [blame] | 634 | m_curCameraInfo->sceneModeOverrides, m_curCameraInfo->numSceneModeOverrides); |
Sungjoong Kang | c68cd00 | 2012-10-01 21:50:09 -0700 | [diff] [blame] | 635 | |
| 636 | static const uint8_t quirkTriggerAuto = 1; |
| 637 | ADD_OR_SIZE(ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO, |
| 638 | &quirkTriggerAuto, 1); |
| 639 | |
| 640 | static const uint8_t quirkUseZslFormat = 1; |
| 641 | ADD_OR_SIZE(ANDROID_QUIRKS_USE_ZSL_FORMAT, |
| 642 | &quirkUseZslFormat, 1); |
| 643 | |
Sungjoong Kang | c605342 | 2012-10-03 16:10:53 -0700 | [diff] [blame] | 644 | static const uint8_t quirkMeteringCropRegion = 1; |
| 645 | ADD_OR_SIZE(ANDROID_QUIRKS_METERING_CROP_REGION, |
| 646 | &quirkMeteringCropRegion, 1); |
| 647 | |
| 648 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 649 | #undef ADD_OR_SIZE |
| 650 | /** Allocate metadata if sizing */ |
| 651 | if (sizeRequest) { |
| 652 | ALOGV("Allocating %d entries, %d extra bytes for " |
| 653 | "static camera info", |
| 654 | entryCount, dataCount); |
| 655 | *info = allocate_camera_metadata(entryCount, dataCount); |
| 656 | if (*info == NULL) { |
| 657 | ALOGE("Unable to allocate camera static info" |
| 658 | "(%d entries, %d bytes extra data)", |
| 659 | entryCount, dataCount); |
| 660 | return NO_MEMORY; |
| 661 | } |
| 662 | } |
| 663 | return OK; |
| 664 | } |
| 665 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 666 | status_t ExynosCamera2::constructDefaultRequest( |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 667 | int request_template, |
| 668 | camera_metadata_t **request, |
| 669 | bool sizeRequest) { |
| 670 | |
| 671 | size_t entryCount = 0; |
| 672 | size_t dataCount = 0; |
| 673 | status_t ret; |
| 674 | |
| 675 | #define ADD_OR_SIZE( tag, data, count ) \ |
| 676 | if ( ( ret = addOrSize(*request, sizeRequest, &entryCount, &dataCount, \ |
| 677 | tag, data, count) ) != OK ) return ret |
| 678 | |
| 679 | static const int64_t USEC = 1000LL; |
| 680 | static const int64_t MSEC = USEC * 1000LL; |
| 681 | static const int64_t SEC = MSEC * 1000LL; |
| 682 | |
| 683 | /** android.request */ |
| 684 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 685 | static const uint8_t metadataMode = ANDROID_REQUEST_METADATA_MODE_NONE; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 686 | ADD_OR_SIZE(ANDROID_REQUEST_METADATA_MODE, &metadataMode, 1); |
| 687 | |
| 688 | static const int32_t id = 0; |
| 689 | ADD_OR_SIZE(ANDROID_REQUEST_ID, &id, 1); |
| 690 | |
| 691 | static const int32_t frameCount = 0; |
| 692 | ADD_OR_SIZE(ANDROID_REQUEST_FRAME_COUNT, &frameCount, 1); |
| 693 | |
| 694 | // OUTPUT_STREAMS set by user |
| 695 | entryCount += 1; |
| 696 | dataCount += 5; // TODO: Should be maximum stream number |
| 697 | |
| 698 | /** android.lens */ |
| 699 | |
| 700 | static const float focusDistance = 0; |
| 701 | ADD_OR_SIZE(ANDROID_LENS_FOCUS_DISTANCE, &focusDistance, 1); |
| 702 | |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 703 | ADD_OR_SIZE(ANDROID_LENS_APERTURE, &m_curCameraInfo->aperture, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 704 | |
Sungjoong Kang | 0f26b20 | 2012-08-17 15:43:12 -0700 | [diff] [blame] | 705 | ADD_OR_SIZE(ANDROID_LENS_FOCAL_LENGTH, &m_curCameraInfo->focalLength, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 706 | |
| 707 | static const float filterDensity = 0; |
| 708 | ADD_OR_SIZE(ANDROID_LENS_FILTER_DENSITY, &filterDensity, 1); |
| 709 | |
| 710 | static const uint8_t opticalStabilizationMode = |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 711 | ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 712 | ADD_OR_SIZE(ANDROID_LENS_OPTICAL_STABILIZATION_MODE, |
| 713 | &opticalStabilizationMode, 1); |
| 714 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 715 | |
| 716 | /** android.sensor */ |
| 717 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 718 | |
| 719 | static const int64_t frameDuration = 33333333L; // 1/30 s |
| 720 | ADD_OR_SIZE(ANDROID_SENSOR_FRAME_DURATION, &frameDuration, 1); |
| 721 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 722 | |
| 723 | /** android.flash */ |
| 724 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 725 | static const uint8_t flashMode = ANDROID_FLASH_MODE_OFF; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 726 | ADD_OR_SIZE(ANDROID_FLASH_MODE, &flashMode, 1); |
| 727 | |
| 728 | static const uint8_t flashPower = 10; |
| 729 | ADD_OR_SIZE(ANDROID_FLASH_FIRING_POWER, &flashPower, 1); |
| 730 | |
| 731 | static const int64_t firingTime = 0; |
| 732 | ADD_OR_SIZE(ANDROID_FLASH_FIRING_TIME, &firingTime, 1); |
| 733 | |
| 734 | /** Processing block modes */ |
| 735 | uint8_t hotPixelMode = 0; |
| 736 | uint8_t demosaicMode = 0; |
| 737 | uint8_t noiseMode = 0; |
| 738 | uint8_t shadingMode = 0; |
| 739 | uint8_t geometricMode = 0; |
| 740 | uint8_t colorMode = 0; |
| 741 | uint8_t tonemapMode = 0; |
| 742 | uint8_t edgeMode = 0; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 743 | uint8_t vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF; |
Sungjoong Kang | fac627c | 2012-09-18 23:44:00 -0700 | [diff] [blame] | 744 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 745 | switch (request_template) { |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 746 | case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT: |
| 747 | vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON; |
| 748 | // fall-through |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 749 | case CAMERA2_TEMPLATE_STILL_CAPTURE: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 750 | // fall-through |
| 751 | case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG: |
| 752 | hotPixelMode = ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY; |
| 753 | demosaicMode = ANDROID_DEMOSAIC_MODE_HIGH_QUALITY; |
| 754 | noiseMode = ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY; |
| 755 | shadingMode = ANDROID_SHADING_MODE_HIGH_QUALITY; |
| 756 | geometricMode = ANDROID_GEOMETRIC_MODE_HIGH_QUALITY; |
| 757 | colorMode = ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY; |
| 758 | tonemapMode = ANDROID_TONEMAP_MODE_HIGH_QUALITY; |
| 759 | edgeMode = ANDROID_EDGE_MODE_HIGH_QUALITY; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 760 | break; |
| 761 | case CAMERA2_TEMPLATE_VIDEO_RECORD: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 762 | vstabMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON; |
| 763 | // fall-through |
| 764 | case CAMERA2_TEMPLATE_PREVIEW: |
| 765 | // fall-through |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 766 | default: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 767 | hotPixelMode = ANDROID_HOT_PIXEL_MODE_FAST; |
| 768 | demosaicMode = ANDROID_DEMOSAIC_MODE_FAST; |
| 769 | noiseMode = ANDROID_NOISE_REDUCTION_MODE_FAST; |
| 770 | shadingMode = ANDROID_SHADING_MODE_FAST; |
| 771 | geometricMode = ANDROID_GEOMETRIC_MODE_FAST; |
| 772 | colorMode = ANDROID_COLOR_CORRECTION_MODE_FAST; |
| 773 | tonemapMode = ANDROID_TONEMAP_MODE_FAST; |
| 774 | edgeMode = ANDROID_EDGE_MODE_FAST; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 775 | break; |
| 776 | } |
| 777 | ADD_OR_SIZE(ANDROID_HOT_PIXEL_MODE, &hotPixelMode, 1); |
| 778 | ADD_OR_SIZE(ANDROID_DEMOSAIC_MODE, &demosaicMode, 1); |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 779 | ADD_OR_SIZE(ANDROID_NOISE_REDUCTION_MODE, &noiseMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 780 | ADD_OR_SIZE(ANDROID_SHADING_MODE, &shadingMode, 1); |
| 781 | ADD_OR_SIZE(ANDROID_GEOMETRIC_MODE, &geometricMode, 1); |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 782 | ADD_OR_SIZE(ANDROID_COLOR_CORRECTION_MODE, &colorMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 783 | ADD_OR_SIZE(ANDROID_TONEMAP_MODE, &tonemapMode, 1); |
| 784 | ADD_OR_SIZE(ANDROID_EDGE_MODE, &edgeMode, 1); |
Sungjoong Kang | fac627c | 2012-09-18 23:44:00 -0700 | [diff] [blame] | 785 | ADD_OR_SIZE(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &vstabMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 786 | |
| 787 | /** android.noise */ |
| 788 | static const uint8_t noiseStrength = 5; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 789 | ADD_OR_SIZE(ANDROID_NOISE_REDUCTION_STRENGTH, &noiseStrength, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 790 | |
| 791 | /** android.color */ |
| 792 | static const float colorTransform[9] = { |
| 793 | 1.0f, 0.f, 0.f, |
| 794 | 0.f, 1.f, 0.f, |
| 795 | 0.f, 0.f, 1.f |
| 796 | }; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 797 | ADD_OR_SIZE(ANDROID_COLOR_CORRECTION_TRANSFORM, colorTransform, 9); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 798 | |
| 799 | /** android.tonemap */ |
| 800 | static const float tonemapCurve[4] = { |
| 801 | 0.f, 0.f, |
| 802 | 1.f, 1.f |
| 803 | }; |
| 804 | ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_RED, tonemapCurve, 32); // sungjoong |
| 805 | ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_GREEN, tonemapCurve, 32); |
| 806 | ADD_OR_SIZE(ANDROID_TONEMAP_CURVE_BLUE, tonemapCurve, 32); |
| 807 | |
| 808 | /** android.edge */ |
| 809 | static const uint8_t edgeStrength = 5; |
| 810 | ADD_OR_SIZE(ANDROID_EDGE_STRENGTH, &edgeStrength, 1); |
| 811 | |
| 812 | /** android.scaler */ |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 813 | int32_t cropRegion[3] = { |
| 814 | 0, 0, m_curCameraInfo->sensorW |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 815 | }; |
| 816 | ADD_OR_SIZE(ANDROID_SCALER_CROP_REGION, cropRegion, 3); |
| 817 | |
| 818 | /** android.jpeg */ |
Hyeonmyeong Choi | 87423e5 | 2012-10-04 16:34:55 +0900 | [diff] [blame] | 819 | static const int32_t jpegQuality = 100; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 820 | ADD_OR_SIZE(ANDROID_JPEG_QUALITY, &jpegQuality, 1); |
| 821 | |
| 822 | static const int32_t thumbnailSize[2] = { |
Sungjoong Kang | 2d5e6ec | 2012-08-30 15:14:17 +0900 | [diff] [blame] | 823 | 160, 120 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 824 | }; |
| 825 | ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_SIZE, thumbnailSize, 2); |
| 826 | |
Hyeonmyeong Choi | 87423e5 | 2012-10-04 16:34:55 +0900 | [diff] [blame] | 827 | static const int32_t thumbnailQuality = 100; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 828 | ADD_OR_SIZE(ANDROID_JPEG_THUMBNAIL_QUALITY, &thumbnailQuality, 1); |
| 829 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 830 | static const double gpsCoordinates[3] = { |
| 831 | 0, 0, 0 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 832 | }; |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 833 | ADD_OR_SIZE(ANDROID_JPEG_GPS_COORDINATES, gpsCoordinates, 3); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 834 | |
| 835 | static const uint8_t gpsProcessingMethod[32] = "None"; |
| 836 | ADD_OR_SIZE(ANDROID_JPEG_GPS_PROCESSING_METHOD, gpsProcessingMethod, 32); |
| 837 | |
| 838 | static const int64_t gpsTimestamp = 0; |
| 839 | ADD_OR_SIZE(ANDROID_JPEG_GPS_TIMESTAMP, &gpsTimestamp, 1); |
| 840 | |
| 841 | static const int32_t jpegOrientation = 0; |
| 842 | ADD_OR_SIZE(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1); |
| 843 | |
| 844 | /** android.stats */ |
| 845 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 846 | static const uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_FULL; |
| 847 | ADD_OR_SIZE(ANDROID_STATISTICS_FACE_DETECT_MODE, &faceDetectMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 848 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 849 | static const uint8_t histogramMode = ANDROID_STATISTICS_HISTOGRAM_MODE_OFF; |
| 850 | ADD_OR_SIZE(ANDROID_STATISTICS_HISTOGRAM_MODE, &histogramMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 851 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 852 | static const uint8_t sharpnessMapMode = ANDROID_STATISTICS_HISTOGRAM_MODE_OFF; |
| 853 | ADD_OR_SIZE(ANDROID_STATISTICS_SHARPNESS_MAP_MODE, &sharpnessMapMode, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 854 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 855 | |
| 856 | /** android.control */ |
| 857 | |
| 858 | uint8_t controlIntent = 0; |
| 859 | switch (request_template) { |
| 860 | case CAMERA2_TEMPLATE_PREVIEW: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 861 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 862 | break; |
| 863 | case CAMERA2_TEMPLATE_STILL_CAPTURE: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 864 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 865 | break; |
| 866 | case CAMERA2_TEMPLATE_VIDEO_RECORD: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 867 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 868 | break; |
| 869 | case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 870 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 871 | break; |
| 872 | case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 873 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 874 | break; |
| 875 | default: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 876 | controlIntent = ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 877 | break; |
| 878 | } |
| 879 | ADD_OR_SIZE(ANDROID_CONTROL_CAPTURE_INTENT, &controlIntent, 1); |
| 880 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 881 | static const uint8_t controlMode = ANDROID_CONTROL_MODE_AUTO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 882 | ADD_OR_SIZE(ANDROID_CONTROL_MODE, &controlMode, 1); |
| 883 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 884 | static const uint8_t effectMode = ANDROID_CONTROL_EFFECT_MODE_OFF; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 885 | ADD_OR_SIZE(ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1); |
| 886 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 887 | static const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 888 | ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1); |
| 889 | |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 890 | static const uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 891 | ADD_OR_SIZE(ANDROID_CONTROL_AE_MODE, &aeMode, 1); |
| 892 | |
Sungjoong Kang | daa1fcd | 2012-08-08 11:49:43 -0700 | [diff] [blame] | 893 | int32_t controlRegions[5] = { |
| 894 | 0, 0, m_curCameraInfo->sensorW, m_curCameraInfo->sensorH, 1000 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 895 | }; |
| 896 | ADD_OR_SIZE(ANDROID_CONTROL_AE_REGIONS, controlRegions, 5); |
| 897 | |
| 898 | static const int32_t aeExpCompensation = 0; |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 899 | ADD_OR_SIZE(ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, &aeExpCompensation, 1); |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 900 | |
| 901 | static const int32_t aeTargetFpsRange[2] = { |
Sungjoong Kang | b814687 | 2012-10-01 13:01:11 -0700 | [diff] [blame] | 902 | 15, 30 |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 903 | }; |
| 904 | ADD_OR_SIZE(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, aeTargetFpsRange, 2); |
| 905 | |
| 906 | static const uint8_t aeAntibandingMode = |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 907 | ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 908 | ADD_OR_SIZE(ANDROID_CONTROL_AE_ANTIBANDING_MODE, &aeAntibandingMode, 1); |
| 909 | |
| 910 | static const uint8_t awbMode = |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 911 | ANDROID_CONTROL_AWB_MODE_AUTO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 912 | ADD_OR_SIZE(ANDROID_CONTROL_AWB_MODE, &awbMode, 1); |
| 913 | |
| 914 | ADD_OR_SIZE(ANDROID_CONTROL_AWB_REGIONS, controlRegions, 5); |
| 915 | |
| 916 | uint8_t afMode = 0; |
| 917 | switch (request_template) { |
| 918 | case CAMERA2_TEMPLATE_PREVIEW: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 919 | afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 920 | break; |
| 921 | case CAMERA2_TEMPLATE_STILL_CAPTURE: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 922 | afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 923 | break; |
| 924 | case CAMERA2_TEMPLATE_VIDEO_RECORD: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 925 | afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 926 | break; |
| 927 | case CAMERA2_TEMPLATE_VIDEO_SNAPSHOT: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 928 | afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 929 | break; |
| 930 | case CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 931 | afMode = ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 932 | break; |
| 933 | default: |
Igor Murashkin | fd1276b | 2012-11-27 16:24:58 -0800 | [diff] [blame] | 934 | afMode = ANDROID_CONTROL_AF_MODE_AUTO; |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 935 | break; |
| 936 | } |
| 937 | ADD_OR_SIZE(ANDROID_CONTROL_AF_MODE, &afMode, 1); |
| 938 | |
| 939 | ADD_OR_SIZE(ANDROID_CONTROL_AF_REGIONS, controlRegions, 5); |
| 940 | |
Jiyoung Shin | c15a6b0 | 2012-06-05 01:08:14 -0700 | [diff] [blame] | 941 | if (sizeRequest) { |
| 942 | ALOGV("Allocating %d entries, %d extra bytes for " |
| 943 | "request template type %d", |
| 944 | entryCount, dataCount, request_template); |
| 945 | *request = allocate_camera_metadata(entryCount, dataCount); |
| 946 | if (*request == NULL) { |
| 947 | ALOGE("Unable to allocate new request template type %d " |
| 948 | "(%d entries, %d bytes extra data)", request_template, |
| 949 | entryCount, dataCount); |
| 950 | return NO_MEMORY; |
| 951 | } |
| 952 | } |
| 953 | return OK; |
| 954 | #undef ADD_OR_SIZE |
| 955 | } |
| 956 | |
| 957 | } |