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