1 /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 */ 29 30 #ifndef __QCAMERA_TYPES_H__ 31 #define __QCAMERA_TYPES_H__ 32 33 #include <stdint.h> 34 #include <string.h> 35 #include <pthread.h> 36 #include <inttypes.h> 37 #include <media/msmb_camera.h> 38 39 #define CAM_MAX_NUM_BUFS_PER_STREAM 64 40 #define MAX_METADATA_PRIVATE_PAYLOAD_SIZE 1024 41 42 #define CEILING64(X) (((X) + 0x0003F) & 0xFFFFFFC0) 43 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0) 44 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0) 45 #define CEILING4(X) (((X) + 0x0003) & 0xFFFC) 46 #define CEILING2(X) (((X) + 0x0001) & 0xFFFE) 47 48 #define CAM_FN_CNT 255 49 /** CAM_DUMP_TO_FILE: 50 * @filename: file name 51 * @name:filename 52 * @index: index of the file 53 * @extn: file extension 54 * @p_addr: address of the buffer 55 * @len: buffer length 56 * 57 * dump the image to the file 58 **/ 59 #define CAM_DUMP_TO_FILE(path, name, index, extn, p_addr, len) ({ \ 60 char filename[CAM_FN_CNT]; \ 61 if (index >= 0) \ 62 snprintf(filename, CAM_FN_CNT-1, "%s/%s%d.%s", path, name, index, extn); \ 63 else \ 64 snprintf(filename, CAM_FN_CNT-1, "%s/%s.%s", path, name, extn); \ 65 FILE *fp = fopen(filename, "w+"); \ 66 if (fp) { \ 67 fwrite(p_addr, 1, len, fp); \ 68 ALOGE("%s:%d] written size %d", __func__, __LINE__, len); \ 69 fclose(fp); \ 70 } else { \ 71 ALOGE("%s:%d] open %s failed", __func__, __LINE__, filename); \ 72 } \ 73 }) 74 75 #define MAX_ZOOMS_CNT 79 76 #define MAX_SIZES_CNT 30 77 #define MAX_EXP_BRACKETING_LENGTH 32 78 #define MAX_ROI 5 79 #define MAX_STREAM_NUM_IN_BUNDLE 4 80 #define MAX_NUM_STREAMS 8 81 #define CHROMATIX_SIZE 60000 82 #define COMMONCHROMATIX_SIZE 45000 83 #define CPPCHROMATIX_SIZE 36000 84 #define AFTUNE_SIZE 4608 85 #define MAX_SCALE_SIZES_CNT 8 86 #define MAX_SAMP_DECISION_CNT 64 87 88 #define MAX_ISP_DATA_SIZE 11500 89 #define MAX_PP_DATA_SIZE 2000 90 #define MAX_AE_STATS_DATA_SIZE 1000 91 #define MAX_AWB_STATS_DATA_SIZE 1000 92 #define MAX_AF_STATS_DATA_SIZE 1000 93 #define MAX_ASD_STATS_DATA_SIZE 1000 94 95 96 #define TUNING_DATA_VERSION 3 97 #define TUNING_SENSOR_DATA_MAX 0x10000 /*(need value from sensor team)*/ 98 #define TUNING_VFE_DATA_MAX 0x10000 /*(need value from vfe team)*/ 99 #define TUNING_CPP_DATA_MAX 0x10000 /*(need value from pproc team)*/ 100 #define TUNING_CAC_DATA_MAX 0x10000 /*(need value from imglib team)*/ 101 #define TUNING_DATA_MAX (TUNING_SENSOR_DATA_MAX + \ 102 TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX + \ 103 TUNING_CAC_DATA_MAX) 104 105 #define TUNING_SENSOR_DATA_OFFSET 0 106 #define TUNING_VFE_DATA_OFFSET TUNING_SENSOR_DATA_MAX 107 #define TUNING_CPP_DATA_OFFSET (TUNING_SENSOR_DATA_MAX + TUNING_VFE_DATA_MAX) 108 #define TUNING_CAC_DATA_OFFSET (TUNING_SENSOR_DATA_MAX + \ 109 TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX) 110 #define MAX_STATS_DATA_SIZE 4000 111 112 #define MAX_AF_BRACKETING_VALUES 5 113 #define MAX_TEST_PATTERN_CNT 8 114 #define MAX_AVAILABLE_CAPABILITIES 8 115 116 #define GPS_PROCESSING_METHOD_SIZE 33 117 #define GPS_PROCESSING_METHOD_SIZE_IN_WORD (33+3)/4 118 119 #define MAX_INFLIGHT_REQUESTS 6 120 #define MIN_INFLIGHT_REQUESTS 3 121 #define MAX_INFLIGHT_REPROCESS_REQUESTS 1 122 123 #define QCAMERA_MAX_FILEPATH_LENGTH 64 124 125 #define MAX_REPROCESS_STALL 2 126 127 typedef enum { 128 CAM_HAL_V1 = 1, 129 CAM_HAL_V3 = 3 130 } cam_hal_version_t; 131 132 typedef enum { 133 CAM_STATUS_SUCCESS, /* Operation Succeded */ 134 CAM_STATUS_FAILED, /* Failure in doing operation */ 135 CAM_STATUS_INVALID_PARM, /* Inavlid parameter provided */ 136 CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */ 137 CAM_STATUS_ACCEPTED, /* Parameter accepted */ 138 CAM_STATUS_MAX, 139 } cam_status_t; 140 141 typedef enum { 142 CAM_POSITION_BACK, 143 CAM_POSITION_FRONT 144 } cam_position_t; 145 146 typedef enum { 147 CAM_FLICKER_NONE, 148 CAM_FLICKER_50_HZ, 149 CAM_FLICKER_60_HZ 150 } cam_flicker_t; 151 152 typedef enum { 153 CAM_FORMAT_JPEG = 0, 154 CAM_FORMAT_YUV_420_NV12 = 1, 155 CAM_FORMAT_YUV_420_NV21, 156 CAM_FORMAT_YUV_420_NV21_ADRENO, 157 CAM_FORMAT_YUV_420_YV12, 158 CAM_FORMAT_YUV_422_NV16, 159 CAM_FORMAT_YUV_422_NV61, 160 CAM_FORMAT_YUV_420_NV12_VENUS, 161 162 /* Please note below are the defintions for raw image. 163 * Any format other than raw image format should be declared 164 * before this line!!!!!!!!!!!!! */ 165 166 /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */ 167 168 /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV. 169 * U and V are interleaved with Y: YUYV or YVYV */ 170 CAM_FORMAT_YUV_RAW_8BIT_YUYV, 171 CAM_FORMAT_YUV_RAW_8BIT_YVYU, 172 CAM_FORMAT_YUV_RAW_8BIT_UYVY, 173 CAM_FORMAT_YUV_RAW_8BIT_VYUY, 174 175 /* QCOM RAW formats where data is packed into 64bit word. 176 * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is 177 * stored at LSB. 178 * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most 179 * significant 4 bits are set to 0. P0 is stored at LSB. 180 * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most 181 * significant 4 bits are set to 0. P0 is stored at LSB. */ 182 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG, 183 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG, 184 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB, 185 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR, 186 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG, 187 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG, 188 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB, 189 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR, 190 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG, 191 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG, 192 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB, 193 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR, 194 /* MIPI RAW formats based on MIPI CSI-2 specifiction. 195 * 8BPP: Each pixel occupies one bytes, starting at LSB. 196 * Output with of image has no restrictons. 197 * 10BPP: Four pixels are held in every 5 bytes. The output 198 * with of image must be a multiple of 4 pixels. 199 * 12BPP: Two pixels are held in every 3 bytes. The output 200 * width of image must be a multiple of 2 pixels. */ 201 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG, 202 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG, 203 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB, 204 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR, 205 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG, 206 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG, 207 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB, 208 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR, 209 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG, 210 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG, 211 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB, 212 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR, 213 /* Ideal raw formats where image data has gone through black 214 * correction, lens rolloff, demux/channel gain, bad pixel 215 * correction, and ABF. 216 * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW 217 * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and 218 * plain 16 12bpp */ 219 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG, 220 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG, 221 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB, 222 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR, 223 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG, 224 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG, 225 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB, 226 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR, 227 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG, 228 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG, 229 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB, 230 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR, 231 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG, 232 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG, 233 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB, 234 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR, 235 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG, 236 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG, 237 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB, 238 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR, 239 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG, 240 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG, 241 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB, 242 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR, 243 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG, 244 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG, 245 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB, 246 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR, 247 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG, 248 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG, 249 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB, 250 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR, 251 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG, 252 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG, 253 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB, 254 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR, 255 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG, 256 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG, 257 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB, 258 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR, 259 260 /* generic 8-bit raw */ 261 CAM_FORMAT_JPEG_RAW_8BIT, 262 CAM_FORMAT_META_RAW_8BIT, 263 264 CAM_FORMAT_MAX 265 } cam_format_t; 266 267 typedef enum { 268 /* applies to HAL 1 */ 269 CAM_STREAM_TYPE_DEFAULT, /* default stream type */ 270 CAM_STREAM_TYPE_PREVIEW, /* preview */ 271 CAM_STREAM_TYPE_POSTVIEW, /* postview */ 272 CAM_STREAM_TYPE_SNAPSHOT, /* snapshot */ 273 CAM_STREAM_TYPE_VIDEO, /* video */ 274 275 /* applies to HAL 3 */ 276 CAM_STREAM_TYPE_CALLBACK, /* app requested callback */ 277 CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */ 278 279 /* applies to both HAL 1 and HAL 3 */ 280 CAM_STREAM_TYPE_METADATA, /* meta data */ 281 CAM_STREAM_TYPE_RAW, /* raw dump from camif */ 282 CAM_STREAM_TYPE_OFFLINE_PROC, /* offline process */ 283 CAM_STREAM_TYPE_PARM, /* mct internal stream */ 284 CAM_STREAM_TYPE_MAX, 285 } cam_stream_type_t; 286 287 typedef enum { 288 CAM_PAD_NONE = 1, 289 CAM_PAD_TO_2 = 2, 290 CAM_PAD_TO_4 = 4, 291 CAM_PAD_TO_WORD = CAM_PAD_TO_4, 292 CAM_PAD_TO_8 = 8, 293 CAM_PAD_TO_16 = 16, 294 CAM_PAD_TO_32 = 32, 295 CAM_PAD_TO_64 = 64, 296 CAM_PAD_TO_1K = 1024, 297 CAM_PAD_TO_2K = 2048, 298 CAM_PAD_TO_4K = 4096, 299 CAM_PAD_TO_8K = 8192 300 } cam_pad_format_t; 301 302 typedef enum { 303 /* followings are per camera */ 304 CAM_MAPPING_BUF_TYPE_CAPABILITY, /* mapping camera capability buffer */ 305 CAM_MAPPING_BUF_TYPE_PARM_BUF, /* mapping parameters buffer */ 306 307 /* followings are per stream */ 308 CAM_MAPPING_BUF_TYPE_STREAM_BUF, /* mapping stream buffers */ 309 CAM_MAPPING_BUF_TYPE_STREAM_INFO, /* mapping stream information buffer */ 310 CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */ 311 CAM_MAPPING_BUF_TYPE_OFFLINE_META_BUF, /* mapping offline meta buffer */ 312 CAM_MAPPING_BUF_TYPE_MAX 313 } cam_mapping_buf_type; 314 315 typedef struct { 316 cam_mapping_buf_type type; 317 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 318 uint32_t frame_idx; /* frame index: valid if type is STREAM_BUF */ 319 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 320 * -1 means all planners shanre the same fd; 321 * otherwise, each planner has its own fd */ 322 unsigned long cookie; /* could be job_id(uint32_t) to identify mapping job */ 323 int fd; /* origin fd */ 324 uint32_t size; /* size of the buffer */ 325 } cam_buf_map_type; 326 327 typedef struct { 328 cam_mapping_buf_type type; 329 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 330 uint32_t frame_idx; /* frame index: valid if STREAM_BUF or HIST_BUF */ 331 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 332 * -1 means all planners shanre the same fd; 333 * otherwise, each planner has its own fd */ 334 unsigned long cookie; /* could be job_id(uint32_t) to identify unmapping job */ 335 } cam_buf_unmap_type; 336 337 typedef enum { 338 CAM_MAPPING_TYPE_FD_MAPPING, 339 CAM_MAPPING_TYPE_FD_UNMAPPING, 340 CAM_MAPPING_TYPE_MAX 341 } cam_mapping_type; 342 343 typedef struct { 344 cam_mapping_type msg_type; 345 union { 346 cam_buf_map_type buf_map; 347 cam_buf_unmap_type buf_unmap; 348 } payload; 349 } cam_sock_packet_t; 350 351 typedef enum { 352 CAM_MODE_2D = (1<<0), 353 CAM_MODE_3D = (1<<1) 354 } cam_mode_t; 355 356 typedef struct { 357 uint32_t len; 358 uint32_t y_offset; 359 uint32_t cbcr_offset; 360 } cam_sp_len_offset_t; 361 362 typedef struct{ 363 uint32_t len; 364 uint32_t offset; 365 int32_t offset_x; 366 int32_t offset_y; 367 int32_t stride; 368 int32_t scanline; 369 int32_t width; /* width without padding */ 370 int32_t height; /* height without padding */ 371 } cam_mp_len_offset_t; 372 373 typedef struct { 374 uint32_t width_padding; 375 uint32_t height_padding; 376 uint32_t plane_padding; 377 } cam_padding_info_t; 378 379 typedef struct { 380 int num_planes; 381 union { 382 cam_sp_len_offset_t sp; 383 cam_mp_len_offset_t mp[VIDEO_MAX_PLANES]; 384 }; 385 uint32_t frame_len; 386 } cam_frame_len_offset_t; 387 388 typedef struct { 389 int32_t width; 390 int32_t height; 391 } cam_dimension_t; 392 393 typedef struct { 394 cam_frame_len_offset_t plane_info; 395 } cam_stream_buf_plane_info_t; 396 397 typedef struct { 398 float min_fps; 399 float max_fps; 400 float video_min_fps; 401 float video_max_fps; 402 } cam_fps_range_t; 403 404 typedef struct { 405 int32_t min_sensitivity; 406 int32_t max_sensitivity; 407 } cam_sensitivity_range_t; 408 409 typedef enum { 410 CAM_HFR_MODE_OFF, 411 CAM_HFR_MODE_60FPS, 412 CAM_HFR_MODE_90FPS, 413 CAM_HFR_MODE_120FPS, 414 CAM_HFR_MODE_150FPS, 415 CAM_HFR_MODE_MAX 416 } cam_hfr_mode_t; 417 418 typedef struct { 419 cam_hfr_mode_t mode; 420 cam_dimension_t dim; 421 uint8_t frame_skip; 422 uint8_t livesnapshot_sizes_tbl_cnt; /* livesnapshot sizes table size */ 423 cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT]; /* livesnapshot sizes table */ 424 } cam_hfr_info_t; 425 426 typedef enum { 427 CAM_WB_MODE_AUTO, 428 CAM_WB_MODE_CUSTOM, 429 CAM_WB_MODE_INCANDESCENT, 430 CAM_WB_MODE_FLUORESCENT, 431 CAM_WB_MODE_WARM_FLUORESCENT, 432 CAM_WB_MODE_DAYLIGHT, 433 CAM_WB_MODE_CLOUDY_DAYLIGHT, 434 CAM_WB_MODE_TWILIGHT, 435 CAM_WB_MODE_SHADE, 436 CAM_WB_MODE_OFF, 437 CAM_WB_MODE_MAX 438 } cam_wb_mode_type; 439 440 typedef enum { 441 CAM_ANTIBANDING_MODE_OFF, 442 CAM_ANTIBANDING_MODE_60HZ, 443 CAM_ANTIBANDING_MODE_50HZ, 444 CAM_ANTIBANDING_MODE_AUTO, 445 CAM_ANTIBANDING_MODE_AUTO_50HZ, 446 CAM_ANTIBANDING_MODE_AUTO_60HZ, 447 CAM_ANTIBANDING_MODE_MAX, 448 } cam_antibanding_mode_type; 449 450 /* Enum Type for different ISO Mode supported */ 451 typedef enum { 452 CAM_ISO_MODE_AUTO, 453 CAM_ISO_MODE_DEBLUR, 454 CAM_ISO_MODE_100, 455 CAM_ISO_MODE_200, 456 CAM_ISO_MODE_400, 457 CAM_ISO_MODE_800, 458 CAM_ISO_MODE_1600, 459 CAM_ISO_MODE_MAX 460 } cam_iso_mode_type; 461 462 typedef enum { 463 CAM_AEC_MODE_FRAME_AVERAGE, 464 CAM_AEC_MODE_CENTER_WEIGHTED, 465 CAM_AEC_MODE_SPOT_METERING, 466 CAM_AEC_MODE_SMART_METERING, 467 CAM_AEC_MODE_USER_METERING, 468 CAM_AEC_MODE_SPOT_METERING_ADV, 469 CAM_AEC_MODE_CENTER_WEIGHTED_ADV, 470 CAM_AEC_MODE_MAX 471 } cam_auto_exposure_mode_type; 472 473 typedef enum { 474 CAM_AE_MODE_OFF, 475 CAM_AE_MODE_ON, 476 CAM_AE_MODE_MAX 477 } cam_ae_mode_type; 478 479 typedef enum { 480 CAM_FOCUS_ALGO_AUTO, 481 CAM_FOCUS_ALGO_SPOT, 482 CAM_FOCUS_ALGO_CENTER_WEIGHTED, 483 CAM_FOCUS_ALGO_AVERAGE, 484 CAM_FOCUS_ALGO_MAX 485 } cam_focus_algorithm_type; 486 487 /* Auto focus mode */ 488 typedef enum { 489 CAM_FOCUS_MODE_OFF, 490 CAM_FOCUS_MODE_AUTO, 491 CAM_FOCUS_MODE_INFINITY, 492 CAM_FOCUS_MODE_MACRO, 493 CAM_FOCUS_MODE_FIXED, 494 CAM_FOCUS_MODE_EDOF, 495 CAM_FOCUS_MODE_CONTINOUS_VIDEO, 496 CAM_FOCUS_MODE_CONTINOUS_PICTURE, 497 CAM_FOCUS_MODE_MAX 498 } cam_focus_mode_type; 499 500 typedef enum { 501 CAM_SCENE_MODE_OFF, 502 CAM_SCENE_MODE_AUTO, 503 CAM_SCENE_MODE_LANDSCAPE, 504 CAM_SCENE_MODE_SNOW, 505 CAM_SCENE_MODE_BEACH, 506 CAM_SCENE_MODE_SUNSET, 507 CAM_SCENE_MODE_NIGHT, 508 CAM_SCENE_MODE_PORTRAIT, 509 CAM_SCENE_MODE_BACKLIGHT, 510 CAM_SCENE_MODE_SPORTS, 511 CAM_SCENE_MODE_ANTISHAKE, 512 CAM_SCENE_MODE_FLOWERS, 513 CAM_SCENE_MODE_CANDLELIGHT, 514 CAM_SCENE_MODE_FIREWORKS, 515 CAM_SCENE_MODE_PARTY, 516 CAM_SCENE_MODE_NIGHT_PORTRAIT, 517 CAM_SCENE_MODE_THEATRE, 518 CAM_SCENE_MODE_ACTION, 519 CAM_SCENE_MODE_AR, 520 CAM_SCENE_MODE_FACE_PRIORITY, 521 CAM_SCENE_MODE_BARCODE, 522 CAM_SCENE_MODE_HDR, 523 CAM_SCENE_MODE_MAX 524 } cam_scene_mode_type; 525 526 typedef enum { 527 CAM_EFFECT_MODE_OFF, 528 CAM_EFFECT_MODE_MONO, 529 CAM_EFFECT_MODE_NEGATIVE, 530 CAM_EFFECT_MODE_SOLARIZE, 531 CAM_EFFECT_MODE_SEPIA, 532 CAM_EFFECT_MODE_POSTERIZE, 533 CAM_EFFECT_MODE_WHITEBOARD, 534 CAM_EFFECT_MODE_BLACKBOARD, 535 CAM_EFFECT_MODE_AQUA, 536 CAM_EFFECT_MODE_EMBOSS, 537 CAM_EFFECT_MODE_SKETCH, 538 CAM_EFFECT_MODE_NEON, 539 CAM_EFFECT_MODE_MAX 540 } cam_effect_mode_type; 541 542 typedef enum { 543 CAM_FLASH_MODE_OFF, 544 CAM_FLASH_MODE_AUTO, 545 CAM_FLASH_MODE_ON, 546 CAM_FLASH_MODE_TORCH, 547 CAM_FLASH_MODE_SINGLE, 548 CAM_FLASH_MODE_MAX 549 } cam_flash_mode_t; 550 551 // Flash States 552 typedef enum { 553 CAM_FLASH_STATE_UNAVAILABLE, 554 CAM_FLASH_STATE_CHARGING, 555 CAM_FLASH_STATE_READY, 556 CAM_FLASH_STATE_FIRED, 557 CAM_FLASH_STATE_PARTIAL, 558 CAM_FLASH_STATE_MAX 559 } cam_flash_state_t; 560 561 typedef enum { 562 CAM_FLASH_FIRING_LEVEL_0, 563 CAM_FLASH_FIRING_LEVEL_1, 564 CAM_FLASH_FIRING_LEVEL_2, 565 CAM_FLASH_FIRING_LEVEL_3, 566 CAM_FLASH_FIRING_LEVEL_4, 567 CAM_FLASH_FIRING_LEVEL_5, 568 CAM_FLASH_FIRING_LEVEL_6, 569 CAM_FLASH_FIRING_LEVEL_7, 570 CAM_FLASH_FIRING_LEVEL_8, 571 CAM_FLASH_FIRING_LEVEL_9, 572 CAM_FLASH_FIRING_LEVEL_10, 573 CAM_FLASH_FIRING_LEVEL_MAX 574 } cam_flash_firing_level_t; 575 576 577 typedef enum { 578 CAM_AEC_TRIGGER_IDLE, 579 CAM_AEC_TRIGGER_START, 580 CAM_AEC_TRIGGER_CANCEL 581 } cam_aec_trigger_type_t; 582 583 typedef enum { 584 CAM_AF_TRIGGER_IDLE, 585 CAM_AF_TRIGGER_START, 586 CAM_AF_TRIGGER_CANCEL 587 } cam_af_trigger_type_t; 588 589 typedef enum { 590 CAM_AE_STATE_INACTIVE, 591 CAM_AE_STATE_SEARCHING, 592 CAM_AE_STATE_CONVERGED, 593 CAM_AE_STATE_LOCKED, 594 CAM_AE_STATE_FLASH_REQUIRED, 595 CAM_AE_STATE_PRECAPTURE 596 } cam_ae_state_t; 597 598 typedef enum { 599 CAM_NOISE_REDUCTION_MODE_OFF, 600 CAM_NOISE_REDUCTION_MODE_FAST, 601 CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY, 602 CAM_NOISE_REDUCTION_MODE_MINIMAL 603 } cam_noise_reduction_mode_t; 604 605 typedef enum { 606 CAM_EDGE_MODE_OFF, 607 CAM_EDGE_MODE_FAST, 608 CAM_EDGE_MODE_HIGH_QUALITY, 609 } cam_edge_mode_t; 610 611 typedef struct { 612 uint8_t edge_mode; 613 int32_t sharpness; 614 } cam_edge_application_t; 615 616 typedef enum { 617 CAM_BLACK_LEVEL_LOCK_OFF, 618 CAM_BLACK_LEVEL_LOCK_ON, 619 } cam_black_level_lock_t; 620 621 typedef enum { 622 CAM_HOTPIXEL_MODE_OFF, 623 CAM_HOTPIXEL_MODE_FAST, 624 CAM_HOTPIXEL_MODE_HIGH_QUALITY, 625 } cam_hotpixel_mode_t; 626 627 typedef enum { 628 CAM_LENS_SHADING_MAP_MODE_OFF, 629 CAM_LENS_SHADING_MAP_MODE_ON, 630 } cam_lens_shading_map_mode_t; 631 632 typedef enum { 633 CAM_LENS_SHADING_MODE_OFF, 634 CAM_LENS_SHADING_MODE_FAST, 635 CAM_LENS_SHADING_MODE_HIGH_QUALITY, 636 } cam_lens_shading_mode_t; 637 638 typedef enum { 639 CAM_FACE_DETECT_MODE_OFF, 640 CAM_FACE_DETECT_MODE_SIMPLE, 641 CAM_FACE_DETECT_MODE_FULL, 642 } cam_face_detect_mode_t; 643 644 typedef enum { 645 CAM_TONEMAP_MODE_CONTRAST_CURVE, 646 CAM_TONEMAP_MODE_FAST, 647 CAM_TONEMAP_MODE_HIGH_QUALITY, 648 } cam_tonemap_mode_t; 649 650 typedef enum { 651 CAM_CDS_MODE_OFF, 652 CAM_CDS_MODE_ON, 653 CAM_CDS_MODE_AUTO, 654 CAM_CDS_MODE_MAX 655 } cam_cds_mode_type_t; 656 657 typedef struct { 658 int32_t left; 659 int32_t top; 660 int32_t width; 661 int32_t height; 662 } cam_rect_t; 663 664 typedef struct { 665 cam_rect_t rect; 666 int32_t weight; /* weight of the area, valid for focusing/metering areas */ 667 } cam_area_t; 668 669 typedef enum { 670 CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */ 671 CAM_STREAMING_MODE_BURST, /* burst streaming */ 672 CAM_STREAMING_MODE_MAX 673 } cam_streaming_mode_t; 674 675 typedef enum { 676 IS_TYPE_NONE, 677 IS_TYPE_DIS, 678 IS_TYPE_GA_DIS, 679 IS_TYPE_EIS_1_0, 680 IS_TYPE_EIS_2_0 681 } cam_is_type_t; 682 683 typedef enum { 684 DIS_DISABLE, 685 DIS_ENABLE 686 } cam_dis_mode_t; 687 688 typedef enum { 689 NON_SECURE, 690 SECURE 691 } cam_stream_secure_t; 692 693 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0) 694 695 /* event from server */ 696 typedef enum { 697 CAM_EVENT_TYPE_MAP_UNMAP_DONE = (1<<0), 698 CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1), 699 CAM_EVENT_TYPE_ZOOM_DONE = (1<<2), 700 CAM_EVENT_TYPE_DAEMON_DIED = (1<<3), 701 CAM_EVENT_TYPE_DAEMON_PULL_REQ = (1<<4), 702 CAM_EVENT_TYPE_MAX 703 } cam_event_type_t; 704 705 typedef enum { 706 CAM_EXP_BRACKETING_OFF, 707 CAM_EXP_BRACKETING_ON 708 } cam_bracket_mode; 709 710 typedef struct { 711 cam_bracket_mode mode; 712 char values[MAX_EXP_BRACKETING_LENGTH]; /* user defined values */ 713 } cam_exp_bracketing_t; 714 715 typedef struct { 716 unsigned int num_frames; 717 cam_exp_bracketing_t exp_val; 718 } cam_hdr_bracketing_info_t; 719 720 typedef struct { 721 uint8_t chromatixData[CHROMATIX_SIZE]; 722 uint8_t snapchromatixData[CHROMATIX_SIZE]; 723 uint8_t common_chromatixData[COMMONCHROMATIX_SIZE]; 724 uint8_t cpp_chromatixData[CPPCHROMATIX_SIZE]; 725 } tune_chromatix_t; 726 727 typedef struct { 728 uint8_t af_tuneData[AFTUNE_SIZE]; 729 } tune_autofocus_t; 730 731 typedef struct { 732 uint8_t stepsize; 733 uint8_t direction; 734 int32_t num_steps; 735 uint8_t ttype; 736 } tune_actuator_t; 737 738 typedef struct { 739 uint8_t module; 740 uint8_t type; 741 int32_t value; 742 } tune_cmd_t; 743 744 typedef enum { 745 CAM_AEC_ROI_OFF, 746 CAM_AEC_ROI_ON 747 } cam_aec_roi_ctrl_t; 748 749 typedef enum { 750 CAM_AEC_ROI_BY_INDEX, 751 CAM_AEC_ROI_BY_COORDINATE, 752 } cam_aec_roi_type_t; 753 754 typedef struct { 755 uint32_t x; 756 uint32_t y; 757 } cam_coordinate_type_t; 758 759 typedef struct { 760 int32_t numerator; 761 int32_t denominator; 762 } cam_rational_type_t; 763 764 typedef struct { 765 cam_aec_roi_ctrl_t aec_roi_enable; 766 cam_aec_roi_type_t aec_roi_type; 767 union { 768 cam_coordinate_type_t coordinate[MAX_ROI]; 769 uint32_t aec_roi_idx[MAX_ROI]; 770 } cam_aec_roi_position; 771 } cam_set_aec_roi_t; 772 773 typedef struct { 774 uint32_t frm_id; 775 uint8_t num_roi; 776 cam_rect_t roi[MAX_ROI]; 777 int32_t weight[MAX_ROI]; 778 uint8_t is_multiwindow; 779 } cam_roi_info_t; 780 781 typedef enum { 782 CAM_WAVELET_DENOISE_YCBCR_PLANE, 783 CAM_WAVELET_DENOISE_CBCR_ONLY, 784 CAM_WAVELET_DENOISE_STREAMLINE_YCBCR, 785 CAM_WAVELET_DENOISE_STREAMLINED_CBCR 786 } cam_denoise_process_type_t; 787 788 typedef struct { 789 int denoise_enable; 790 cam_denoise_process_type_t process_plates; 791 } cam_denoise_param_t; 792 793 #define CAM_FACE_PROCESS_MASK_DETECTION (1<<0) 794 #define CAM_FACE_PROCESS_MASK_RECOGNITION (1<<1) 795 typedef struct { 796 int fd_mode; /* mask of face process */ 797 int num_fd; 798 } cam_fd_set_parm_t; 799 800 typedef enum { 801 QCAMERA_FD_PREVIEW, 802 QCAMERA_FD_SNAPSHOT 803 }qcamera_face_detect_type_t; 804 805 typedef struct { 806 int32_t face_id; /* unique id for face tracking within view unless view changes */ 807 int8_t score; /* score of confidence (0, -100) */ 808 cam_rect_t face_boundary; /* boundary of face detected */ 809 cam_coordinate_type_t left_eye_center; /* coordinate of center of left eye */ 810 cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */ 811 cam_coordinate_type_t mouth_center; /* coordinate of center of mouth */ 812 uint8_t smile_degree; /* smile degree (0, -100) */ 813 uint8_t smile_confidence; /* smile confidence (0, 100) */ 814 uint8_t face_recognised; /* if face is recognised */ 815 int8_t gaze_angle; /* -90 -45 0 45 90 for head left to rigth tilt */ 816 int8_t updown_dir; /* up down direction (-90, 90) */ 817 int8_t leftright_dir; /* left right direction (-90, 90) */ 818 int8_t roll_dir; /* roll direction (-90, 90) */ 819 int8_t left_right_gaze; /* left right gaze degree (-50, 50) */ 820 int8_t top_bottom_gaze; /* up down gaze degree (-50, 50) */ 821 uint8_t blink_detected; /* if blink is detected */ 822 uint8_t left_blink; /* left eye blink degeree (0, -100) */ 823 uint8_t right_blink; /* right eye blink degree (0, - 100) */ 824 } cam_face_detection_info_t; 825 826 typedef struct { 827 uint32_t frame_id; /* frame index of which faces are detected */ 828 uint8_t num_faces_detected; /* number of faces detected */ 829 cam_face_detection_info_t faces[MAX_ROI]; /* detailed information of faces detected */ 830 qcamera_face_detect_type_t fd_type; /* face detect for preview or snapshot frame*/ 831 } cam_face_detection_data_t; 832 833 #define CAM_HISTOGRAM_STATS_SIZE 256 834 typedef struct { 835 uint32_t max_hist_value; 836 uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */ 837 } cam_histogram_data_t; 838 839 typedef struct { 840 cam_histogram_data_t r_stats; 841 cam_histogram_data_t b_stats; 842 cam_histogram_data_t gr_stats; 843 cam_histogram_data_t gb_stats; 844 } cam_bayer_hist_stats_t; 845 846 typedef enum { 847 CAM_HISTOGRAM_TYPE_BAYER, 848 CAM_HISTOGRAM_TYPE_YUV 849 } cam_histogram_type_t; 850 851 typedef struct { 852 cam_histogram_type_t type; 853 union { 854 cam_bayer_hist_stats_t bayer_stats; 855 cam_histogram_data_t yuv_stats; 856 }; 857 } cam_hist_stats_t; 858 859 enum cam_focus_distance_index{ 860 CAM_FOCUS_DISTANCE_NEAR_INDEX, /* 0 */ 861 CAM_FOCUS_DISTANCE_OPTIMAL_INDEX, 862 CAM_FOCUS_DISTANCE_FAR_INDEX, 863 CAM_FOCUS_DISTANCE_MAX_INDEX 864 }; 865 866 typedef struct { 867 float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX]; 868 } cam_focus_distances_info_t; 869 870 /* Different autofocus cycle when calling do_autoFocus 871 * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep 872 * if one is ongoing, and lock. 873 * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless 874 * of the current state, and lock. 875 * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep. 876 * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED, 877 * or CAM_AF_NOT_FOCUSED. 878 * cancel_autoFocus stops any lens movement. 879 * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED 880 * event, not both. 881 */ 882 typedef enum { 883 CAM_AF_COMPLETE_EXISTING_SWEEP, 884 CAM_AF_DO_ONE_FULL_SWEEP, 885 CAM_AF_START_CONTINUOUS_SWEEP 886 } cam_autofocus_cycle_t; 887 888 typedef enum { 889 CAM_AF_SCANNING, 890 CAM_AF_FOCUSED, 891 CAM_AF_NOT_FOCUSED, 892 CAM_AF_CANCELLED 893 } cam_autofocus_state_t; 894 895 typedef struct { 896 cam_autofocus_state_t focus_state; /* state of focus */ 897 cam_focus_distances_info_t focus_dist; /* focus distance */ 898 } cam_auto_focus_data_t; 899 900 typedef struct { 901 uint32_t is_hdr_scene; 902 float hdr_confidence; 903 } cam_asd_hdr_scene_data_t; 904 905 typedef struct { 906 uint32_t stream_id; 907 cam_rect_t crop; 908 } cam_stream_crop_info_t; 909 910 typedef struct { 911 uint8_t num_of_streams; 912 cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS]; 913 } cam_crop_data_t; 914 915 typedef enum { 916 DO_NOT_NEED_FUTURE_FRAME, 917 NEED_FUTURE_FRAME, 918 } cam_prep_snapshot_state_t; 919 920 typedef struct { 921 float gains[4]; 922 } cam_color_correct_gains_t; 923 924 typedef struct { 925 // If LED is ON and Burst Num > 1, this is first LED ON frame 926 uint32_t min_frame_idx; 927 // If LED is ON and Burst Num > 1, this is first LED Off frame after ON 928 uint32_t max_frame_idx; 929 // Used only when LED Is ON and burst num > 1 930 uint32_t num_led_on_frames; 931 // Skip count after LED is turned OFF 932 uint32_t frame_skip_count; 933 } cam_frame_idx_range_t; 934 935 typedef enum { 936 S_NORMAL = 0, 937 S_SCENERY, 938 S_PORTRAIT, 939 S_PORTRAIT_BACKLIGHT, 940 S_SCENERY_BACKLIGHT, 941 S_BACKLIGHT, 942 S_MAX, 943 } cam_auto_scene_t; 944 945 typedef struct { 946 uint32_t meta_frame_id; 947 } cam_meta_valid_t; 948 949 typedef struct { 950 cam_flash_mode_t flash_mode; 951 float aperture_value; 952 cam_flash_state_t flash_state; 953 float focal_length; 954 float f_number; 955 int sensing_method; 956 float crop_factor; 957 } cam_sensor_params_t; 958 959 typedef struct { 960 float exp_time; 961 int iso_value; 962 uint32_t flash_needed; 963 int settled; 964 cam_wb_mode_type wb_mode; 965 uint32_t metering_mode; 966 uint32_t exposure_program; 967 uint32_t exposure_mode; 968 uint32_t scenetype; 969 float brightness; 970 } cam_3a_params_t; 971 972 973 974 typedef struct { 975 uint32_t tuning_data_version; 976 uint32_t tuning_sensor_data_size; 977 uint32_t tuning_vfe_data_size; 978 uint32_t tuning_cpp_data_size; 979 uint32_t tuning_cac_data_size; 980 uint32_t tuning_mod3_data_size; 981 uint8_t data[TUNING_DATA_MAX]; 982 }tuning_params_t; 983 984 typedef struct { 985 uint8_t private_isp_data[MAX_ISP_DATA_SIZE]; 986 } cam_chromatix_lite_isp_t; 987 988 typedef struct { 989 uint8_t private_pp_data[MAX_PP_DATA_SIZE]; 990 } cam_chromatix_lite_pp_t; 991 992 typedef struct { 993 uint8_t private_stats_data[MAX_AE_STATS_DATA_SIZE]; 994 } cam_chromatix_lite_ae_stats_t; 995 996 typedef struct { 997 uint8_t private_stats_data[MAX_AWB_STATS_DATA_SIZE]; 998 } cam_chromatix_lite_awb_stats_t; 999 1000 typedef struct { 1001 uint8_t private_stats_data[MAX_AF_STATS_DATA_SIZE]; 1002 } cam_chromatix_lite_af_stats_t; 1003 1004 typedef struct { 1005 uint8_t private_stats_data[MAX_ASD_STATS_DATA_SIZE]; 1006 } cam_chromatix_lite_asd_stats_t; 1007 1008 typedef struct { 1009 cam_dimension_t stream_sizes[MAX_NUM_STREAMS]; 1010 uint32_t num_streams; 1011 cam_stream_type_t type[MAX_NUM_STREAMS]; 1012 uint32_t postprocess_mask[MAX_NUM_STREAMS]; 1013 } cam_stream_size_info_t; 1014 1015 typedef struct { 1016 uint32_t num_streams; 1017 uint32_t streamID[MAX_NUM_STREAMS]; 1018 } cam_stream_ID_t; 1019 1020 typedef struct { 1021 uint8_t is_stats_valid; /* if histgram data is valid */ 1022 cam_hist_stats_t stats_data; /* histogram data */ 1023 1024 uint8_t is_faces_valid; /* if face detection data is valid */ 1025 cam_face_detection_data_t faces_data; /* face detection result */ 1026 1027 uint8_t is_focus_valid; /* if focus data is valid */ 1028 cam_auto_focus_data_t focus_data; /* focus data */ 1029 1030 uint8_t is_crop_valid; /* if crop data is valid */ 1031 cam_crop_data_t crop_data; /* crop data */ 1032 1033 uint8_t is_prep_snapshot_done_valid; /* if prep snapshot done is valid */ 1034 cam_prep_snapshot_state_t prep_snapshot_done_state; /* prepare snapshot done state */ 1035 1036 /* if good frame idx range is valid */ 1037 uint8_t is_good_frame_idx_range_valid; 1038 /* good frame idx range, make sure: 1039 * 1. good_frame_idx_range.min_frame_idx > current_frame_idx 1040 * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */ 1041 cam_frame_idx_range_t good_frame_idx_range; 1042 1043 uint32_t is_hdr_scene_data_valid; 1044 cam_asd_hdr_scene_data_t hdr_scene_data; 1045 uint8_t is_asd_decision_valid; 1046 cam_auto_scene_t scene; //scene type as decided by ASD 1047 1048 char private_metadata[MAX_METADATA_PRIVATE_PAYLOAD_SIZE]; 1049 1050 /* AE parameters */ 1051 uint8_t is_3a_params_valid; 1052 cam_3a_params_t cam_3a_params; 1053 1054 /* sensor parameters */ 1055 uint8_t is_sensor_params_valid; 1056 cam_sensor_params_t sensor_params; 1057 1058 /* Meta valid params */ 1059 uint8_t is_meta_valid; 1060 cam_meta_valid_t meta_valid_params; 1061 1062 /*Tuning Data*/ 1063 uint8_t is_tuning_params_valid; 1064 tuning_params_t tuning_params; 1065 1066 uint8_t is_chromatix_lite_isp_valid; 1067 cam_chromatix_lite_isp_t chromatix_lite_isp_data; 1068 1069 uint8_t is_chromatix_lite_pp_valid; 1070 cam_chromatix_lite_pp_t chromatix_lite_pp_data; 1071 1072 uint8_t is_chromatix_lite_ae_stats_valid; 1073 cam_chromatix_lite_ae_stats_t chromatix_lite_ae_stats_data; 1074 1075 uint8_t is_chromatix_lite_awb_stats_valid; 1076 cam_chromatix_lite_awb_stats_t chromatix_lite_awb_stats_data; 1077 1078 uint8_t is_chromatix_lite_af_stats_valid; 1079 cam_chromatix_lite_af_stats_t chromatix_lite_af_stats_data; 1080 } cam_metadata_info_t; 1081 1082 typedef enum { 1083 CAM_INTF_PARM_HAL_VERSION, 1084 1085 /* Overall mode of 3A control routines. We need to have this parameter 1086 * because not all android.control.* have an OFF option, for example, 1087 * AE_FPS_Range, aePrecaptureTrigger */ 1088 CAM_INTF_META_MODE, 1089 /* Whether AE is currently updating the sensor exposure and sensitivity 1090 * fields */ 1091 CAM_INTF_META_AEC_MODE, 1092 CAM_INTF_PARM_WHITE_BALANCE, 1093 CAM_INTF_PARM_FOCUS_MODE, 1094 1095 /* common between HAL1 and HAL3 */ 1096 CAM_INTF_PARM_ANTIBANDING, 1097 CAM_INTF_PARM_EXPOSURE_COMPENSATION, 1098 CAM_INTF_PARM_EV_STEP, 1099 CAM_INTF_PARM_AEC_LOCK, 1100 CAM_INTF_PARM_FPS_RANGE, 1101 CAM_INTF_PARM_AWB_LOCK, /* 10 */ 1102 CAM_INTF_PARM_EFFECT, 1103 CAM_INTF_PARM_BESTSHOT_MODE, 1104 CAM_INTF_PARM_DIS_ENABLE, 1105 CAM_INTF_PARM_LED_MODE, 1106 CAM_INTF_META_HISTOGRAM, 1107 CAM_INTF_META_FACE_DETECTION, 1108 1109 /* specific to HAl1 */ 1110 CAM_INTF_META_AUTOFOCUS_DATA, 1111 CAM_INTF_PARM_QUERY_FLASH4SNAP, 1112 CAM_INTF_PARM_EXPOSURE, 1113 CAM_INTF_PARM_SHARPNESS, /* 20 */ 1114 CAM_INTF_PARM_CONTRAST, 1115 CAM_INTF_PARM_SATURATION, 1116 CAM_INTF_PARM_BRIGHTNESS, 1117 CAM_INTF_PARM_ISO, 1118 CAM_INTF_PARM_ZOOM, 1119 CAM_INTF_PARM_ROLLOFF, 1120 CAM_INTF_PARM_MODE, /* camera mode */ 1121 CAM_INTF_PARM_AEC_ALGO_TYPE, /* auto exposure algorithm */ 1122 CAM_INTF_PARM_FOCUS_ALGO_TYPE, /* focus algorithm */ 1123 CAM_INTF_PARM_AEC_ROI, /* 30 */ 1124 CAM_INTF_PARM_AF_ROI, 1125 CAM_INTF_PARM_SCE_FACTOR, 1126 CAM_INTF_PARM_FD, 1127 CAM_INTF_PARM_MCE, 1128 CAM_INTF_PARM_HFR, 1129 CAM_INTF_PARM_REDEYE_REDUCTION, 1130 CAM_INTF_PARM_WAVELET_DENOISE, 1131 CAM_INTF_PARM_TEMPORAL_DENOISE, 1132 CAM_INTF_PARM_HISTOGRAM, 1133 CAM_INTF_PARM_ASD_ENABLE, /* 40 */ 1134 CAM_INTF_PARM_RECORDING_HINT, 1135 CAM_INTF_PARM_HDR, 1136 CAM_INTF_PARM_MAX_DIMENSION, 1137 CAM_INTF_PARM_RAW_DIMENSION, 1138 CAM_INTF_PARM_FRAMESKIP, 1139 CAM_INTF_PARM_ZSL_MODE, /* indicating if it's running in ZSL mode */ 1140 CAM_INTF_PARM_BURST_NUM, 1141 CAM_INTF_PARM_RETRO_BURST_NUM, 1142 CAM_INTF_PARM_BURST_LED_ON_PERIOD, 1143 CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */ /* 50 */ 1144 CAM_INTF_PARM_LOCK_CAF, 1145 CAM_INTF_PARM_VIDEO_HDR, 1146 CAM_INTF_PARM_SENSOR_HDR, 1147 CAM_INTF_PARM_ROTATION, 1148 CAM_INTF_PARM_SCALE, 1149 CAM_INTF_PARM_VT, /* indicating if it's a Video Call Apllication */ 1150 CAM_INTF_META_CROP_DATA, 1151 CAM_INTF_META_PREP_SNAPSHOT_DONE, 1152 CAM_INTF_META_GOOD_FRAME_IDX_RANGE, 1153 CAM_INTF_META_ASD_HDR_SCENE_DATA, /* 60 */ 1154 CAM_INTF_META_ASD_SCENE_TYPE, 1155 CAM_INTF_META_CURRENT_SCENE, 1156 CAM_INTF_META_AEC_INFO, 1157 CAM_INTF_META_SENSOR_INFO, 1158 CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE, 1159 CAM_INTF_META_CHROMATIX_LITE_ISP, 1160 CAM_INTF_META_CHROMATIX_LITE_PP, 1161 CAM_INTF_META_CHROMATIX_LITE_AE, 1162 CAM_INTF_META_CHROMATIX_LITE_AWB, 1163 CAM_INTF_META_CHROMATIX_LITE_AF, /* 70 */ 1164 CAM_INTF_META_CHROMATIX_LITE_ASD, 1165 CAM_INTF_PARM_GET_CHROMATIX, 1166 CAM_INTF_PARM_SET_RELOAD_CHROMATIX, 1167 CAM_INTF_PARM_SET_AUTOFOCUSTUNING, 1168 CAM_INTF_PARM_GET_AFTUNE, 1169 CAM_INTF_PARM_SET_RELOAD_AFTUNE, 1170 CAM_INTF_PARM_SET_VFE_COMMAND, 1171 CAM_INTF_PARM_SET_PP_COMMAND, 1172 CAM_INTF_PARM_TINTLESS, 1173 CAM_INTF_PARM_LONGSHOT_ENABLE, /* 80 */ 1174 CAM_INTF_PARM_RDI_MODE, 1175 CAM_INTF_PARM_CDS_MODE, 1176 1177 /* stream based parameters */ 1178 CAM_INTF_PARM_DO_REPROCESS, 1179 CAM_INTF_PARM_SET_BUNDLE, 1180 CAM_INTF_PARM_STREAM_FLIP, 1181 CAM_INTF_PARM_GET_OUTPUT_CROP, 1182 1183 CAM_INTF_PARM_EZTUNE_CMD, 1184 1185 /* specific to HAL3 */ 1186 /* Whether the metadata maps to a valid frame number */ 1187 CAM_INTF_META_FRAME_NUMBER_VALID, 1188 /* Whether the urgent metadata maps to a valid frame number */ 1189 CAM_INTF_META_URGENT_FRAME_NUMBER_VALID, 1190 /* Whether the stream buffer corresponding this frame is dropped or not */ 1191 CAM_INTF_META_FRAME_DROPPED, /* 90 */ 1192 /* COLOR CORRECTION.*/ 1193 CAM_INTF_META_COLOR_CORRECT_MODE, 1194 /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931) 1195 * color space from the scene illuminant to the sRGB-standard D65-illuminant. */ 1196 CAM_INTF_META_COLOR_CORRECT_TRANSFORM, 1197 /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/ 1198 CAM_INTF_META_COLOR_CORRECT_GAINS, 1199 /*The best fit color transform matrix calculated by the stats*/ 1200 CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, 1201 /*The best fit color channels gains calculated by the stats*/ 1202 CAM_INTF_META_PRED_COLOR_CORRECT_GAINS, 1203 /* CONTROL */ 1204 /* A frame counter set by the framework. Must be maintained unchanged in 1205 * output frame. */ 1206 CAM_INTF_META_FRAME_NUMBER, 1207 /* A frame counter set by the framework. Must be maintained unchanged in 1208 * output frame. */ 1209 CAM_INTF_META_URGENT_FRAME_NUMBER, 1210 /*Number of streams and size of streams in current configuration*/ 1211 CAM_INTF_META_STREAM_INFO, 1212 /* List of areas to use for metering */ 1213 CAM_INTF_META_AEC_ROI, 1214 /* Whether the HAL must trigger precapture metering.*/ 1215 CAM_INTF_META_AEC_PRECAPTURE_TRIGGER, /* 100 */ 1216 /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */ 1217 /* Current state of AE algorithm */ 1218 CAM_INTF_META_AEC_STATE, 1219 /* List of areas to use for focus estimation */ 1220 CAM_INTF_META_AF_ROI, 1221 /* Whether the HAL must trigger autofocus. */ 1222 CAM_INTF_META_AF_TRIGGER, 1223 /* Current state of AF algorithm */ 1224 CAM_INTF_META_AF_STATE, 1225 /* List of areas to use for illuminant estimation */ 1226 CAM_INTF_META_AWB_REGIONS, 1227 /* Current state of AWB algorithm */ 1228 CAM_INTF_META_AWB_STATE, 1229 /*Whether black level compensation is frozen or free to vary*/ 1230 CAM_INTF_META_BLACK_LEVEL_LOCK, 1231 /* Information to 3A routines about the purpose of this capture, to help 1232 * decide optimal 3A strategy */ 1233 CAM_INTF_META_CAPTURE_INTENT, 1234 /* DEMOSAIC */ 1235 /* Controls the quality of the demosaicing processing */ 1236 CAM_INTF_META_DEMOSAIC, 1237 /* EDGE */ 1238 /* Operation mode for edge enhancement */ 1239 CAM_INTF_META_EDGE_MODE, /* 110 */ 1240 /* Control the amount of edge enhancement applied to the images.*/ 1241 /* 1-10; 10 is maximum sharpening */ 1242 CAM_INTF_META_SHARPNESS_STRENGTH, 1243 /* FLASH */ 1244 /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */ 1245 CAM_INTF_META_FLASH_POWER, 1246 /* Firing time of flash relative to start of exposure, in nanoseconds*/ 1247 CAM_INTF_META_FLASH_FIRING_TIME, 1248 /* Current state of the flash unit */ 1249 CAM_INTF_META_FLASH_STATE, 1250 /* GEOMETRIC */ 1251 /* Operating mode of geometric correction */ 1252 CAM_INTF_META_GEOMETRIC_MODE, 1253 /* Control the amount of shading correction applied to the images */ 1254 CAM_INTF_META_GEOMETRIC_STRENGTH, 1255 /* HOT PIXEL */ 1256 /* Set operational mode for hot pixel correction */ 1257 CAM_INTF_META_HOTPIXEL_MODE, 1258 /* LENS */ 1259 /* Size of the lens aperture */ 1260 CAM_INTF_META_LENS_APERTURE, 1261 /* State of lens neutral density filter(s) */ 1262 CAM_INTF_META_LENS_FILTERDENSITY, 1263 /* Lens optical zoom setting */ 1264 CAM_INTF_META_LENS_FOCAL_LENGTH, /* 120 */ 1265 /* Distance to plane of sharpest focus, measured from frontmost surface 1266 * of the lens */ 1267 CAM_INTF_META_LENS_FOCUS_DISTANCE, 1268 /* The range of scene distances that are in sharp focus (depth of field) */ 1269 CAM_INTF_META_LENS_FOCUS_RANGE, 1270 /* Whether optical image stabilization is enabled. */ 1271 CAM_INTF_META_LENS_OPT_STAB_MODE, 1272 /*Whether the hal needs to output the lens shading map*/ 1273 CAM_INTF_META_LENS_SHADING_MAP_MODE, 1274 /* Current lens status */ 1275 CAM_INTF_META_LENS_STATE, 1276 /* NOISE REDUCTION */ 1277 /* Mode of operation for the noise reduction algorithm */ 1278 CAM_INTF_META_NOISE_REDUCTION_MODE, 1279 /* Control the amount of noise reduction applied to the images. 1280 * 1-10; 10 is max noise reduction */ 1281 CAM_INTF_META_NOISE_REDUCTION_STRENGTH, 1282 /* SCALER */ 1283 /* Top-left corner and width of the output region to select from the active 1284 * pixel array */ 1285 CAM_INTF_META_SCALER_CROP_REGION, 1286 /* The estimated scene illumination lighting frequency */ 1287 CAM_INTF_META_SCENE_FLICKER, 1288 /* SENSOR */ 1289 /* Duration each pixel is exposed to light, in nanoseconds */ 1290 CAM_INTF_META_SENSOR_EXPOSURE_TIME, /* 130 */ 1291 /* Duration from start of frame exposure to start of next frame exposure, 1292 * in nanoseconds */ 1293 CAM_INTF_META_SENSOR_FRAME_DURATION, 1294 /* Gain applied to image data. Must be implemented through analog gain only 1295 * if set to values below 'maximum analog sensitivity'. */ 1296 CAM_INTF_META_SENSOR_SENSITIVITY, 1297 /* Time at start of exposure of first row */ 1298 CAM_INTF_META_SENSOR_TIMESTAMP, 1299 /* Duration b/w start of first row exposure and the start of last 1300 row exposure in nanoseconds */ 1301 CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW, 1302 /* SHADING */ 1303 /* Quality of lens shading correction applied to the image data */ 1304 CAM_INTF_META_SHADING_MODE, 1305 /* Control the amount of shading correction applied to the images. 1306 * unitless: 1-10; 10 is full shading compensation */ 1307 CAM_INTF_META_SHADING_STRENGTH, 1308 /* STATISTICS */ 1309 /* State of the face detector unit */ 1310 CAM_INTF_META_STATS_FACEDETECT_MODE, 1311 /* Operating mode for histogram generation */ 1312 CAM_INTF_META_STATS_HISTOGRAM_MODE, 1313 /* Operating mode for sharpness map generation */ 1314 CAM_INTF_META_STATS_SHARPNESS_MAP_MODE, 1315 /* A 3-channel sharpness map, based on the raw sensor data, 1316 * If only a monochrome sharpness map is supported, all channels 1317 * should have the same data 1318 */ 1319 CAM_INTF_META_STATS_SHARPNESS_MAP, /* 140 */ 1320 1321 /* TONEMAP */ 1322 /* Tone map mode */ 1323 CAM_INTF_META_TONEMAP_MODE, 1324 /* Table mapping RGB input values to output values */ 1325 CAM_INTF_META_TONEMAP_CURVES, 1326 1327 CAM_INTF_META_FLASH_MODE, 1328 /* 2D array of gain factors for each color channel that was used to 1329 * compensate for lens shading for this frame */ 1330 CAM_INTF_META_LENS_SHADING_MAP, 1331 CAM_INTF_META_PRIVATE_DATA, 1332 CAM_INTF_PARM_STATS_DEBUG_MASK, 1333 CAM_INTF_PARM_STATS_AF_PAAF, 1334 /* Indicates streams ID of all the requested buffers */ 1335 CAM_INTF_META_STREAM_ID, 1336 CAM_INTF_PARM_FOCUS_BRACKETING, 1337 CAM_INTF_PARM_FLASH_BRACKETING, /* 150 */ 1338 CAM_INTF_PARM_GET_IMG_PROP, 1339 CAM_INTF_META_JPEG_GPS_COORDINATES, 1340 CAM_INTF_META_JPEG_GPS_PROC_METHODS, 1341 CAM_INTF_META_JPEG_GPS_TIMESTAMP, 1342 CAM_INTF_META_JPEG_ORIENTATION, 1343 CAM_INTF_META_JPEG_QUALITY, 1344 CAM_INTF_META_JPEG_THUMB_QUALITY, 1345 CAM_INTF_META_JPEG_THUMB_SIZE, 1346 1347 CAM_INTF_META_TEST_PATTERN_DATA, 1348 /* DNG file support */ 1349 CAM_INTF_META_PROFILE_TONE_CURVE, /* 160 */ 1350 CAM_INTF_META_NEUTRAL_COL_POINT, 1351 1352 /* OTP : WB gr/gb */ 1353 CAM_INTF_META_OTP_WB_GRGB, 1354 1355 /* CAC */ 1356 CAM_INTF_PARM_CAC, 1357 CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR, 1358 CAM_INTF_META_USE_AV_TIMER, 1359 /* Whether HAL has run into DRAIN error */ 1360 CAM_INTF_META_DAEMON_RESTART, 1361 CAM_INTF_PARM_MAX 1362 } cam_intf_parm_type_t; 1363 1364 typedef struct { 1365 int forced; 1366 union { 1367 uint32_t force_linecount_value; 1368 float force_gain_value; 1369 float force_snap_exp_value; 1370 float force_exp_value; 1371 uint32_t force_snap_linecount_value; 1372 float force_snap_gain_value; 1373 } u; 1374 } cam_ez_force_params_t; 1375 1376 typedef enum { 1377 CAM_EZTUNE_CMD_STATUS, 1378 CAM_EZTUNE_CMD_AEC_ENABLE, 1379 CAM_EZTUNE_CMD_AWB_ENABLE, 1380 CAM_EZTUNE_CMD_AF_ENABLE, 1381 CAM_EZTUNE_CMD_AEC_FORCE_LINECOUNT, 1382 CAM_EZTUNE_CMD_AEC_FORCE_GAIN, 1383 CAM_EZTUNE_CMD_AEC_FORCE_EXP, 1384 CAM_EZTUNE_CMD_AEC_FORCE_SNAP_LC, 1385 CAM_EZTUNE_CMD_AEC_FORCE_SNAP_GAIN, 1386 CAM_EZTUNE_CMD_AEC_FORCE_SNAP_EXP, 1387 CAM_EZTUNE_CMD_AWB_MODE, 1388 } cam_eztune_cmd_type_t; 1389 1390 typedef struct { 1391 cam_eztune_cmd_type_t cmd; 1392 union { 1393 int running; 1394 int aec_enable; 1395 int awb_enable; 1396 int af_enable; 1397 cam_ez_force_params_t ez_force_param; 1398 int awb_mode; 1399 } u; 1400 } cam_eztune_cmd_data_t; 1401 1402 1403 /***************************************************************************** 1404 * Code for HAL3 data types * 1405 ****************************************************************************/ 1406 typedef enum { 1407 CAM_INTF_METADATA_MAX 1408 } cam_intf_metadata_type_t; 1409 1410 typedef enum { 1411 CAM_INTENT_CUSTOM, 1412 CAM_INTENT_PREVIEW, 1413 CAM_INTENT_STILL_CAPTURE, 1414 CAM_INTENT_VIDEO_RECORD, 1415 CAM_INTENT_VIDEO_SNAPSHOT, 1416 CAM_INTENT_ZERO_SHUTTER_LAG, 1417 CAM_INTENT_MAX, 1418 } cam_intent_t; 1419 1420 typedef enum { 1421 /* Full application control of pipeline. All 3A routines are disabled, 1422 * no other settings in android.control.* have any effect */ 1423 CAM_CONTROL_OFF, 1424 /* Use settings for each individual 3A routine. Manual control of capture 1425 * parameters is disabled. All controls in android.control.* besides sceneMode 1426 * take effect */ 1427 CAM_CONTROL_AUTO, 1428 /* Use specific scene mode. Enabling this disables control.aeMode, 1429 * control.awbMode and control.afMode controls; the HAL must ignore those 1430 * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode). 1431 * Other control entries are still active. This setting can only be used if 1432 * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this 1433 * in HAL ?*/ 1434 CAM_CONTROL_USE_SCENE_MODE, 1435 CAM_CONTROL_MAX 1436 } cam_control_mode_t; 1437 1438 typedef enum { 1439 /* Use the android.colorCorrection.transform matrix to do color conversion */ 1440 CAM_COLOR_CORRECTION_TRANSFORM_MATRIX, 1441 /* Must not slow down frame rate relative to raw bayer output */ 1442 CAM_COLOR_CORRECTION_FAST, 1443 /* Frame rate may be reduced by high quality */ 1444 CAM_COLOR_CORRECTION_HIGH_QUALITY, 1445 } cam_color_correct_mode_t; 1446 1447 typedef enum { 1448 CAM_COLOR_CORRECTION_ABERRATION_OFF, 1449 CAM_COLOR_CORRECTION_ABERRATION_FAST, 1450 CAM_COLOR_CORRECTION_ABERRATION_HIGH_QUALITY, 1451 CAM_COLOR_CORRECTION_ABERRATION_MAX 1452 } cam_aberration_mode_t; 1453 1454 typedef struct { 1455 /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */ 1456 cam_rational_type_t transform_matrix[3][3]; 1457 } cam_color_correct_matrix_t; 1458 1459 #define CAM_FOCAL_LENGTHS_MAX 1 1460 #define CAM_APERTURES_MAX 1 1461 #define CAM_FILTER_DENSITIES_MAX 1 1462 #define CAM_MAX_MAP_HEIGHT 6 1463 #define CAM_MAX_MAP_WIDTH 6 1464 #define CAM_MAX_SHADING_MAP_WIDTH 17 1465 #define CAM_MAX_SHADING_MAP_HEIGHT 13 1466 #define CAM_MAX_TONEMAP_CURVE_SIZE 512 1467 1468 typedef struct { 1469 /* A 1D array of pairs of floats. 1470 * Mapping a 0-1 input range to a 0-1 output range. 1471 * The input range must be monotonically increasing with N, 1472 * and values between entries should be linearly interpolated. 1473 * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0], 1474 * then the input->output mapping for a few sample points would be: 1475 * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */ 1476 float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2]; 1477 } cam_tonemap_curve_t; 1478 1479 typedef struct { 1480 int tonemap_points_cnt; 1481 cam_tonemap_curve_t curves[3]; 1482 } cam_rgb_tonemap_curves; 1483 1484 typedef struct { 1485 int tonemap_points_cnt; 1486 cam_tonemap_curve_t curve; 1487 } cam_profile_tone_curve; 1488 1489 typedef struct { 1490 cam_rational_type_t neutral_col_point[3]; 1491 } cam_neutral_col_point_t; 1492 1493 typedef enum { 1494 OFF, 1495 FAST, 1496 QUALITY, 1497 } cam_quality_preference_t; 1498 1499 typedef enum { 1500 CAM_FLASH_CTRL_OFF, 1501 CAM_FLASH_CTRL_SINGLE, 1502 CAM_FLASH_CTRL_TORCH 1503 } cam_flash_ctrl_t; 1504 1505 typedef struct { 1506 uint8_t frame_dropped; /* This flag indicates whether any stream buffer is dropped or not */ 1507 cam_stream_ID_t cam_stream_ID; /* if dropped, Stream ID of dropped streams */ 1508 } cam_frame_dropped_t; 1509 1510 typedef struct { 1511 uint8_t ae_mode; 1512 uint8_t awb_mode; 1513 uint8_t af_mode; 1514 } cam_scene_mode_overrides_t; 1515 1516 typedef struct { 1517 int32_t left; 1518 int32_t top; 1519 int32_t width; 1520 int32_t height; 1521 } cam_crop_region_t; 1522 1523 typedef struct { 1524 /* Estimated sharpness for each region of the input image. 1525 * Normalized to be between 0 and maxSharpnessMapValue. 1526 * Higher values mean sharper (better focused) */ 1527 int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT]; 1528 } cam_sharpness_map_t; 1529 1530 typedef struct { 1531 float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH]; 1532 } cam_lens_shading_map_t; 1533 1534 typedef struct { 1535 int32_t min_value; 1536 int32_t max_value; 1537 int32_t def_value; 1538 int32_t step; 1539 } cam_control_range_t; 1540 1541 #define CAM_QCOM_FEATURE_NONE 0 1542 #define CAM_QCOM_FEATURE_FACE_DETECTION (1<<0) 1543 #define CAM_QCOM_FEATURE_DENOISE2D (1<<1) 1544 #define CAM_QCOM_FEATURE_CROP (1<<2) 1545 #define CAM_QCOM_FEATURE_ROTATION (1<<3) 1546 #define CAM_QCOM_FEATURE_FLIP (1<<4) 1547 #define CAM_QCOM_FEATURE_HDR (1<<5) 1548 #define CAM_QCOM_FEATURE_REGISTER_FACE (1<<6) 1549 #define CAM_QCOM_FEATURE_SHARPNESS (1<<7) 1550 #define CAM_QCOM_FEATURE_VIDEO_HDR (1<<8) 1551 #define CAM_QCOM_FEATURE_CAC (1<<9) 1552 #define CAM_QCOM_FEATURE_SCALE (1<<10) 1553 #define CAM_QCOM_FEATURE_EFFECT (1<<11) 1554 #define CAM_QCOM_FEATURE_UBIFOCUS (1<<12) 1555 #define CAM_QCOM_FEATURE_CHROMA_FLASH (1<<13) 1556 #define CAM_QCOM_FEATURE_OPTIZOOM (1<<14) 1557 #define CAM_QCOM_FEATURE_SENSOR_HDR (1<<15) 1558 #define CAM_QCOM_FEATURE_CPP_TNR (1<<17) 1559 #define CAM_QCOM_FEATURE_PP_SUPERSET (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\ 1560 CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\ 1561 CAM_QCOM_FEATURE_SCALE) 1562 1563 // Counter clock wise 1564 typedef enum { 1565 ROTATE_0 = 1<<0, 1566 ROTATE_90 = 1<<1, 1567 ROTATE_180 = 1<<2, 1568 ROTATE_270 = 1<<3, 1569 } cam_rotation_t; 1570 1571 typedef struct { 1572 cam_rotation_t rotation; 1573 uint32_t streamId; 1574 } cam_rotation_info_t; 1575 1576 typedef enum { 1577 FLIP_H = 1<<0, 1578 FLIP_V = 1<<1, 1579 } cam_flip_t; 1580 1581 typedef struct { 1582 uint32_t bundle_id; /* bundle id */ 1583 uint8_t num_of_streams; /* number of streams in the bundle */ 1584 uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */ 1585 } cam_bundle_config_t; 1586 1587 typedef enum { 1588 CAM_ONLINE_REPROCESS_TYPE, /* online reprocess, frames from running streams */ 1589 CAM_OFFLINE_REPROCESS_TYPE, /* offline reprocess, frames from external source */ 1590 } cam_reprocess_type_enum_t; 1591 1592 typedef enum { 1593 CAM_HDR_MODE_SINGLEFRAME, /* Single frame HDR mode which does only tone mapping */ 1594 CAM_HDR_MODE_MULTIFRAME, /* Multi frame HDR mode which needs two frames with 0.5x and 2x exposure respectively */ 1595 } cam_hdr_mode_enum_t; 1596 1597 typedef struct { 1598 uint32_t hdr_enable; 1599 uint32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */ 1600 cam_hdr_mode_enum_t hdr_mode; 1601 } cam_hdr_param_t; 1602 1603 typedef struct { 1604 int32_t output_width; 1605 int32_t output_height; 1606 } cam_scale_param_t; 1607 1608 typedef struct { 1609 uint8_t enable; 1610 uint8_t burst_count; 1611 uint8_t focus_steps[MAX_AF_BRACKETING_VALUES]; 1612 uint8_t output_count; 1613 } cam_af_bracketing_t; 1614 1615 typedef struct { 1616 uint8_t enable; 1617 uint8_t burst_count; 1618 } cam_flash_bracketing_t; 1619 1620 typedef struct { 1621 uint8_t enable; 1622 uint8_t burst_count; 1623 uint8_t zoom_threshold; 1624 } cam_opti_zoom_t; 1625 1626 typedef enum { 1627 CAM_FLASH_OFF, 1628 CAM_FLASH_ON 1629 } cam_flash_value_t; 1630 1631 typedef enum { 1632 CAM_SENSOR_RAW, 1633 CAM_SENSOR_YUV 1634 } cam_sensor_t; 1635 1636 typedef struct { 1637 cam_sensor_t sens_type; 1638 cam_format_t native_format; 1639 } cam_sensor_type_t; 1640 1641 typedef struct { 1642 /* reprocess feature mask */ 1643 uint32_t feature_mask; 1644 1645 /* individual setting for features to be reprocessed */ 1646 cam_denoise_param_t denoise2d; 1647 cam_rect_t input_crop; 1648 cam_rotation_t rotation; 1649 uint32_t flip; 1650 int32_t sharpness; 1651 int32_t effect; 1652 cam_hdr_param_t hdr_param; 1653 cam_scale_param_t scale_param; 1654 1655 uint8_t zoom_level; 1656 cam_flash_value_t flash_value; 1657 1658 } cam_pp_feature_config_t; 1659 1660 typedef struct { 1661 uint32_t input_stream_id; 1662 /* input source stream type */ 1663 cam_stream_type_t input_stream_type; 1664 } cam_pp_online_src_config_t; 1665 1666 typedef struct { 1667 /* image format */ 1668 cam_format_t input_fmt; 1669 1670 /* image dimension */ 1671 cam_dimension_t input_dim; 1672 1673 /* buffer plane information, will be calc based on stream_type, fmt, 1674 dim, and padding_info(from stream config). Info including: 1675 offset_x, offset_y, stride, scanline, plane offset */ 1676 cam_stream_buf_plane_info_t input_buf_planes; 1677 1678 /* number of input reprocess buffers */ 1679 uint8_t num_of_bufs; 1680 1681 /* input source type */ 1682 cam_stream_type_t input_type; 1683 1684 } cam_pp_offline_src_config_t; 1685 1686 /* reprocess stream input configuration */ 1687 typedef struct { 1688 /* input source config */ 1689 cam_reprocess_type_enum_t pp_type; 1690 union { 1691 cam_pp_online_src_config_t online; 1692 cam_pp_offline_src_config_t offline; 1693 }; 1694 1695 /* pp feature config */ 1696 cam_pp_feature_config_t pp_feature_config; 1697 } cam_stream_reproc_config_t; 1698 1699 typedef struct { 1700 uint8_t crop_enabled; 1701 cam_rect_t input_crop; 1702 } cam_crop_param_t; 1703 1704 typedef struct { 1705 uint8_t trigger; 1706 int32_t trigger_id; 1707 } cam_trigger_t; 1708 1709 typedef struct { 1710 cam_denoise_param_t denoise2d; 1711 cam_crop_param_t crop; 1712 uint32_t flip; /* 0 means no flip */ 1713 uint32_t uv_upsample; /* 0 means no chroma upsampling */ 1714 int32_t sharpness; /* 0 means no sharpness */ 1715 int32_t effect; 1716 cam_rotation_t rotation; 1717 } cam_per_frame_pp_config_t; 1718 1719 typedef enum { 1720 CAM_OPT_STAB_OFF, 1721 CAM_OPT_STAB_ON, 1722 CAM_OPT_STAB_MAX 1723 } cam_optical_stab_modes_t; 1724 1725 typedef enum { 1726 CAM_FILTER_ARRANGEMENT_RGGB, 1727 CAM_FILTER_ARRANGEMENT_GRBG, 1728 CAM_FILTER_ARRANGEMENT_GBRG, 1729 CAM_FILTER_ARRANGEMENT_BGGR, 1730 1731 /* Sensor is not Bayer; output has 3 16-bit values for each pixel, 1732 * instead of just 1 16-bit value per pixel.*/ 1733 CAM_FILTER_ARRANGEMENT_RGB 1734 } cam_color_filter_arrangement_t; 1735 1736 typedef enum { 1737 CAM_AF_STATE_INACTIVE, 1738 CAM_AF_STATE_PASSIVE_SCAN, 1739 CAM_AF_STATE_PASSIVE_FOCUSED, 1740 CAM_AF_STATE_ACTIVE_SCAN, 1741 CAM_AF_STATE_FOCUSED_LOCKED, 1742 CAM_AF_STATE_NOT_FOCUSED_LOCKED, 1743 CAM_AF_STATE_PASSIVE_UNFOCUSED 1744 } cam_af_state_t; 1745 1746 typedef enum { 1747 CAM_AF_LENS_STATE_STATIONARY, 1748 CAM_AF_LENS_STATE_MOVING, 1749 } cam_af_lens_state_t; 1750 1751 typedef enum { 1752 CAM_AWB_STATE_INACTIVE, 1753 CAM_AWB_STATE_SEARCHING, 1754 CAM_AWB_STATE_CONVERGED, 1755 CAM_AWB_STATE_LOCKED 1756 } cam_awb_state_t; 1757 1758 typedef enum { 1759 CAM_FOCUS_UNCALIBRATED, 1760 CAM_FOCUS_APPROXIMATE, 1761 CAM_FOCUS_CALIBRATED 1762 } cam_focus_calibration_t; 1763 1764 typedef enum { 1765 CAM_TEST_PATTERN_OFF, 1766 CAM_TEST_PATTERN_SOLID_COLOR, 1767 CAM_TEST_PATTERN_COLOR_BARS, 1768 CAM_TEST_PATTERN_COLOR_BARS_FADE_TO_GRAY, 1769 CAM_TEST_PATTERN_PN9, 1770 } cam_test_pattern_mode_t; 1771 1772 typedef struct { 1773 cam_test_pattern_mode_t mode; 1774 int32_t r; 1775 int32_t gr; 1776 int32_t gb; 1777 int32_t b; 1778 } cam_test_pattern_data_t; 1779 1780 typedef enum { 1781 CAM_AWB_D50, 1782 CAM_AWB_D65, 1783 CAM_AWB_D75, 1784 CAM_AWB_A, 1785 CAM_AWB_CUSTOM_A, 1786 CAM_AWB_WARM_FLO, 1787 CAM_AWB_COLD_FLO, 1788 CAM_AWB_CUSTOM_FLO, 1789 CAM_AWB_NOON, 1790 CAM_AWB_CUSTOM_DAYLIGHT, 1791 CAM_AWB_INVALID_ALL_LIGHT, 1792 } cam_illuminat_t; 1793 1794 typedef enum { 1795 LEGACY_RAW, 1796 MIPI_RAW, 1797 } cam_opaque_raw_format_t; 1798 1799 #endif /* __QCAMERA_TYPES_H__ */ 1800