1 /* Copyright (c) 2012-2013, 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 24 40 #define MAX_METADATA_PAYLOAD_SIZE 1024 41 42 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0) 43 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0) 44 #define CEILING4(X) (((X) + 0x0003) & 0xFFFC) 45 #define CEILING2(X) (((X) + 0x0001) & 0xFFFE) 46 47 #define MAX_ZOOMS_CNT 64 48 #define MAX_SIZES_CNT 24 49 #define MAX_EXP_BRACKETING_LENGTH 32 50 #define MAX_ROI 5 51 #define MAX_STREAM_NUM_IN_BUNDLE 4 52 #define MAX_NUM_STREAMS 8 53 54 typedef enum { 55 CAM_HAL_V1 = 1, 56 CAM_HAL_V3 = 3 57 } cam_hal_version_t; 58 59 typedef enum { 60 CAM_STATUS_SUCCESS, /* Operation Succeded */ 61 CAM_STATUS_FAILED, /* Failure in doing operation */ 62 CAM_STATUS_INVALID_PARM, /* Inavlid parameter provided */ 63 CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */ 64 CAM_STATUS_ACCEPTED, /* Parameter accepted */ 65 CAM_STATUS_MAX, 66 } cam_status_t; 67 68 typedef enum { 69 CAM_POSITION_BACK, 70 CAM_POSITION_FRONT 71 } cam_position_t; 72 73 typedef enum { 74 CAM_FLICKER_NONE, 75 CAM_FLICKER_50_HZ, 76 CAM_FLICKER_60_HZ 77 } cam_flicker_t; 78 79 typedef enum { 80 CAM_FORMAT_JPEG = 0, 81 CAM_FORMAT_YUV_420_NV12 = 1, 82 CAM_FORMAT_YUV_420_NV21, 83 CAM_FORMAT_YUV_420_NV21_ADRENO, 84 CAM_FORMAT_YUV_420_YV12, 85 CAM_FORMAT_YUV_422_NV16, 86 CAM_FORMAT_YUV_422_NV61, 87 CAM_FORMAT_YUV_420_NV12_VENUS, 88 89 /* Please note below are the defintions for raw image. 90 * Any format other than raw image format should be declared 91 * before this line!!!!!!!!!!!!! */ 92 93 /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */ 94 95 /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV. 96 * U and V are interleaved with Y: YUYV or YVYV */ 97 CAM_FORMAT_YUV_RAW_8BIT_YUYV, 98 CAM_FORMAT_YUV_RAW_8BIT_YVYU, 99 CAM_FORMAT_YUV_RAW_8BIT_UYVY, 100 CAM_FORMAT_YUV_RAW_8BIT_VYUY, 101 102 /* QCOM RAW formats where data is packed into 64bit word. 103 * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is 104 * stored at LSB. 105 * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most 106 * significant 4 bits are set to 0. P0 is stored at LSB. 107 * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most 108 * significant 4 bits are set to 0. P0 is stored at LSB. */ 109 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG, 110 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG, 111 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB, 112 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR, 113 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG, 114 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG, 115 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB, 116 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR, 117 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG, 118 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG, 119 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB, 120 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR, 121 /* MIPI RAW formats based on MIPI CSI-2 specifiction. 122 * 8BPP: Each pixel occupies one bytes, starting at LSB. 123 * Output with of image has no restrictons. 124 * 10BPP: Four pixels are held in every 5 bytes. The output 125 * with of image must be a multiple of 4 pixels. 126 * 12BPP: Two pixels are held in every 3 bytes. The output 127 * width of image must be a multiple of 2 pixels. */ 128 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG, 129 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG, 130 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB, 131 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR, 132 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG, 133 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG, 134 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB, 135 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR, 136 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG, 137 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG, 138 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB, 139 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR, 140 /* Ideal raw formats where image data has gone through black 141 * correction, lens rolloff, demux/channel gain, bad pixel 142 * correction, and ABF. 143 * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW 144 * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and 145 * plain 16 12bpp */ 146 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG, 147 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG, 148 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB, 149 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR, 150 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG, 151 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG, 152 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB, 153 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR, 154 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG, 155 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG, 156 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB, 157 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR, 158 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG, 159 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG, 160 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB, 161 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR, 162 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG, 163 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG, 164 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB, 165 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR, 166 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG, 167 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG, 168 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB, 169 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR, 170 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG, 171 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG, 172 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB, 173 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR, 174 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG, 175 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG, 176 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB, 177 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR, 178 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG, 179 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG, 180 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB, 181 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR, 182 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG, 183 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG, 184 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB, 185 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR, 186 187 /* generic 8-bit raw */ 188 CAM_FORMAT_JPEG_RAW_8BIT, 189 CAM_FORMAT_META_RAW_8BIT, 190 191 CAM_FORMAT_MAX 192 } cam_format_t; 193 194 typedef enum { 195 /* applies to HAL 1 */ 196 CAM_STREAM_TYPE_DEFAULT, /* default stream type */ 197 CAM_STREAM_TYPE_PREVIEW, /* preview */ 198 CAM_STREAM_TYPE_POSTVIEW, /* postview */ 199 CAM_STREAM_TYPE_SNAPSHOT, /* snapshot */ 200 CAM_STREAM_TYPE_VIDEO, /* video */ 201 202 /* applies to HAL 3 */ 203 CAM_STREAM_TYPE_CALLBACK, /* app requested callback */ 204 CAM_STREAM_TYPE_NON_ZSL_SNAPSHOT, /* non zsl snapshot */ 205 CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */ 206 207 /* applies to both HAL 1 and HAL 3 */ 208 CAM_STREAM_TYPE_METADATA, /* meta data */ 209 CAM_STREAM_TYPE_RAW, /* raw dump from camif */ 210 CAM_STREAM_TYPE_OFFLINE_PROC, /* offline process */ 211 CAM_STREAM_TYPE_MAX, 212 } cam_stream_type_t; 213 214 typedef enum { 215 CAM_PAD_NONE = 1, 216 CAM_PAD_TO_2 = 2, 217 CAM_PAD_TO_4 = 4, 218 CAM_PAD_TO_WORD = CAM_PAD_TO_4, 219 CAM_PAD_TO_8 = 8, 220 CAM_PAD_TO_16 = 16, 221 CAM_PAD_TO_32 = 32, 222 CAM_PAD_TO_64 = 64, 223 CAM_PAD_TO_1K = 1024, 224 CAM_PAD_TO_2K = 2048, 225 CAM_PAD_TO_4K = 4096, 226 CAM_PAD_TO_8K = 8192 227 } cam_pad_format_t; 228 229 typedef enum { 230 /* followings are per camera */ 231 CAM_MAPPING_BUF_TYPE_CAPABILITY, /* mapping camera capability buffer */ 232 CAM_MAPPING_BUF_TYPE_PARM_BUF, /* mapping parameters buffer */ 233 234 /* followings are per stream */ 235 CAM_MAPPING_BUF_TYPE_STREAM_BUF, /* mapping stream buffers */ 236 CAM_MAPPING_BUF_TYPE_STREAM_INFO, /* mapping stream information buffer */ 237 CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */ 238 CAM_MAPPING_BUF_TYPE_MAX 239 } cam_mapping_buf_type; 240 241 typedef struct { 242 cam_mapping_buf_type type; 243 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 244 uint32_t frame_idx; /* frame index: valid if type is STREAM_BUF */ 245 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 246 * -1 means all planners shanre the same fd; 247 * otherwise, each planner has its own fd */ 248 unsigned long cookie; /* could be job_id(uint32_t) to identify mapping job */ 249 int fd; /* origin fd */ 250 uint32_t size; /* size of the buffer */ 251 } cam_buf_map_type; 252 253 typedef struct { 254 cam_mapping_buf_type type; 255 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 256 uint32_t frame_idx; /* frame index: valid if STREAM_BUF or HIST_BUF */ 257 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 258 * -1 means all planners shanre the same fd; 259 * otherwise, each planner has its own fd */ 260 unsigned long cookie; /* could be job_id(uint32_t) to identify unmapping job */ 261 } cam_buf_unmap_type; 262 263 typedef enum { 264 CAM_MAPPING_TYPE_FD_MAPPING, 265 CAM_MAPPING_TYPE_FD_UNMAPPING, 266 CAM_MAPPING_TYPE_MAX 267 } cam_mapping_type; 268 269 typedef struct { 270 cam_mapping_type msg_type; 271 union { 272 cam_buf_map_type buf_map; 273 cam_buf_unmap_type buf_unmap; 274 } payload; 275 } cam_sock_packet_t; 276 277 typedef enum { 278 CAM_MODE_2D = (1<<0), 279 CAM_MODE_3D = (1<<1) 280 } cam_mode_t; 281 282 typedef struct { 283 uint32_t len; 284 uint32_t y_offset; 285 uint32_t cbcr_offset; 286 } cam_sp_len_offset_t; 287 288 typedef struct{ 289 uint32_t len; 290 uint32_t offset; 291 int32_t offset_x; 292 int32_t offset_y; 293 int32_t stride; 294 int32_t scanline; 295 } cam_mp_len_offset_t; 296 297 typedef struct { 298 uint32_t width_padding; 299 uint32_t height_padding; 300 uint32_t plane_padding; 301 } cam_padding_info_t; 302 303 typedef struct { 304 int num_planes; 305 union { 306 cam_sp_len_offset_t sp; 307 cam_mp_len_offset_t mp[VIDEO_MAX_PLANES]; 308 }; 309 uint32_t frame_len; 310 } cam_frame_len_offset_t; 311 312 typedef struct { 313 int32_t width; 314 int32_t height; 315 } cam_dimension_t; 316 317 typedef struct { 318 cam_frame_len_offset_t plane_info; 319 } cam_stream_buf_plane_info_t; 320 321 typedef struct { 322 float min_fps; 323 float max_fps; 324 } cam_fps_range_t; 325 326 typedef struct { 327 int32_t min_sensitivity; 328 int32_t max_sensitivity; 329 } cam_sensitivity_range_t; 330 331 typedef enum { 332 CAM_HFR_MODE_OFF, 333 CAM_HFR_MODE_60FPS, 334 CAM_HFR_MODE_90FPS, 335 CAM_HFR_MODE_120FPS, 336 CAM_HFR_MODE_150FPS, 337 CAM_HFR_MODE_MAX 338 } cam_hfr_mode_t; 339 340 typedef struct { 341 cam_hfr_mode_t mode; 342 cam_dimension_t dim; 343 uint8_t frame_skip; 344 uint8_t livesnapshot_sizes_tbl_cnt; /* livesnapshot sizes table size */ 345 cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT]; /* livesnapshot sizes table */ 346 } cam_hfr_info_t; 347 348 typedef enum { 349 CAM_WB_MODE_AUTO, 350 CAM_WB_MODE_CUSTOM, 351 CAM_WB_MODE_INCANDESCENT, 352 CAM_WB_MODE_FLUORESCENT, 353 CAM_WB_MODE_WARM_FLUORESCENT, 354 CAM_WB_MODE_DAYLIGHT, 355 CAM_WB_MODE_CLOUDY_DAYLIGHT, 356 CAM_WB_MODE_TWILIGHT, 357 CAM_WB_MODE_SHADE, 358 CAM_WB_MODE_OFF, 359 CAM_WB_MODE_MAX 360 } cam_wb_mode_type; 361 362 typedef enum { 363 CAM_ANTIBANDING_MODE_OFF, 364 CAM_ANTIBANDING_MODE_60HZ, 365 CAM_ANTIBANDING_MODE_50HZ, 366 CAM_ANTIBANDING_MODE_AUTO, 367 CAM_ANTIBANDING_MODE_AUTO_50HZ, 368 CAM_ANTIBANDING_MODE_AUTO_60HZ, 369 CAM_ANTIBANDING_MODE_MAX, 370 } cam_antibanding_mode_type; 371 372 /* Enum Type for different ISO Mode supported */ 373 typedef enum { 374 CAM_ISO_MODE_AUTO, 375 CAM_ISO_MODE_DEBLUR, 376 CAM_ISO_MODE_100, 377 CAM_ISO_MODE_200, 378 CAM_ISO_MODE_400, 379 CAM_ISO_MODE_800, 380 CAM_ISO_MODE_1600, 381 CAM_ISO_MODE_MAX 382 } cam_iso_mode_type; 383 384 typedef enum { 385 CAM_AEC_MODE_FRAME_AVERAGE, 386 CAM_AEC_MODE_CENTER_WEIGHTED, 387 CAM_AEC_MODE_SPOT_METERING, 388 CAM_AEC_MODE_SMART_METERING, 389 CAM_AEC_MODE_USER_METERING, 390 CAM_AEC_MODE_SPOT_METERING_ADV, 391 CAM_AEC_MODE_CENTER_WEIGHTED_ADV, 392 CAM_AEC_MODE_MAX 393 } cam_auto_exposure_mode_type; 394 395 typedef enum { 396 CAM_AE_MODE_OFF, 397 CAM_AE_MODE_ON, 398 CAM_AE_MODE_MAX 399 } cam_ae_mode_type; 400 401 typedef enum { 402 CAM_FOCUS_ALGO_AUTO, 403 CAM_FOCUS_ALGO_SPOT, 404 CAM_FOCUS_ALGO_CENTER_WEIGHTED, 405 CAM_FOCUS_ALGO_AVERAGE, 406 CAM_FOCUS_ALGO_MAX 407 } cam_focus_algorithm_type; 408 409 /* Auto focus mode */ 410 typedef enum { 411 CAM_FOCUS_MODE_AUTO, 412 CAM_FOCUS_MODE_INFINITY, 413 CAM_FOCUS_MODE_MACRO, 414 CAM_FOCUS_MODE_FIXED, 415 CAM_FOCUS_MODE_EDOF, 416 CAM_FOCUS_MODE_CONTINOUS_VIDEO, 417 CAM_FOCUS_MODE_CONTINOUS_PICTURE, 418 CAM_FOCUS_MODE_MAX 419 } cam_focus_mode_type; 420 421 typedef enum { 422 CAM_SCENE_MODE_OFF, 423 CAM_SCENE_MODE_AUTO, 424 CAM_SCENE_MODE_LANDSCAPE, 425 CAM_SCENE_MODE_SNOW, 426 CAM_SCENE_MODE_BEACH, 427 CAM_SCENE_MODE_SUNSET, 428 CAM_SCENE_MODE_NIGHT, 429 CAM_SCENE_MODE_PORTRAIT, 430 CAM_SCENE_MODE_BACKLIGHT, 431 CAM_SCENE_MODE_SPORTS, 432 CAM_SCENE_MODE_ANTISHAKE, 433 CAM_SCENE_MODE_FLOWERS, 434 CAM_SCENE_MODE_CANDLELIGHT, 435 CAM_SCENE_MODE_FIREWORKS, 436 CAM_SCENE_MODE_PARTY, 437 CAM_SCENE_MODE_NIGHT_PORTRAIT, 438 CAM_SCENE_MODE_THEATRE, 439 CAM_SCENE_MODE_ACTION, 440 CAM_SCENE_MODE_AR, 441 CAM_SCENE_MODE_FACE_PRIORITY, 442 CAM_SCENE_MODE_BARCODE, 443 CAM_SCENE_MODE_MAX 444 } cam_scene_mode_type; 445 446 typedef enum { 447 CAM_EFFECT_MODE_OFF, 448 CAM_EFFECT_MODE_MONO, 449 CAM_EFFECT_MODE_NEGATIVE, 450 CAM_EFFECT_MODE_SOLARIZE, 451 CAM_EFFECT_MODE_SEPIA, 452 CAM_EFFECT_MODE_POSTERIZE, 453 CAM_EFFECT_MODE_WHITEBOARD, 454 CAM_EFFECT_MODE_BLACKBOARD, 455 CAM_EFFECT_MODE_AQUA, 456 CAM_EFFECT_MODE_EMBOSS, 457 CAM_EFFECT_MODE_SKETCH, 458 CAM_EFFECT_MODE_NEON, 459 CAM_EFFECT_MODE_MAX 460 } cam_effect_mode_type; 461 462 typedef enum { 463 CAM_FLASH_MODE_OFF, 464 CAM_FLASH_MODE_AUTO, 465 CAM_FLASH_MODE_ON, 466 CAM_FLASH_MODE_TORCH, 467 CAM_FLASH_MODE_SINGLE, 468 CAM_FLASH_MODE_MAX 469 } cam_flash_mode_t; 470 471 typedef enum { 472 CAM_FLASH_FIRING_LEVEL_0, 473 CAM_FLASH_FIRING_LEVEL_1, 474 CAM_FLASH_FIRING_LEVEL_2, 475 CAM_FLASH_FIRING_LEVEL_3, 476 CAM_FLASH_FIRING_LEVEL_4, 477 CAM_FLASH_FIRING_LEVEL_5, 478 CAM_FLASH_FIRING_LEVEL_6, 479 CAM_FLASH_FIRING_LEVEL_7, 480 CAM_FLASH_FIRING_LEVEL_8, 481 CAM_FLASH_FIRING_LEVEL_9, 482 CAM_FLASH_FIRING_LEVEL_10, 483 CAM_FLASH_FIRING_LEVEL_MAX 484 } cam_flash_firing_level_t; 485 486 487 typedef enum { 488 CAM_AEC_TRIGGER_IDLE, 489 CAM_AEC_TRIGGER_START 490 } cam_aec_trigger_type_t; 491 492 typedef enum { 493 CAM_AF_TRIGGER_IDLE, 494 CAM_AF_TRIGGER_START, 495 CAM_AF_TRIGGER_CANCEL 496 } cam_af_trigger_type_t; 497 498 typedef enum { 499 CAM_AE_STATE_INACTIVE, 500 CAM_AE_STATE_SEARCHING, 501 CAM_AE_STATE_CONVERGED, 502 CAM_AE_STATE_LOCKED, 503 CAM_AE_STATE_FLASH_REQUIRED, 504 CAM_AE_STATE_PRECAPTURE 505 } cam_ae_state_t; 506 507 typedef enum { 508 CAM_NOISE_REDUCTION_MODE_OFF, 509 CAM_NOISE_REDUCTION_MODE_FAST, 510 CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY 511 } cam_noise_reduction_mode_t; 512 513 typedef enum { 514 CAM_EDGE_MODE_OFF, 515 CAM_EDGE_MODE_FAST, 516 CAM_EDGE_MODE_HIGH_QUALITY, 517 } cam_edge_mode_t; 518 519 typedef enum { 520 CAM_BLACK_LEVEL_LOCK_OFF, 521 CAM_BLACK_LEVEL_LOCK_ON, 522 } cam_black_level_lock_t; 523 524 typedef enum { 525 CAM_LENS_SHADING_MAP_MODE_OFF, 526 CAM_LENS_SHADING_MAP_MODE_ON, 527 } cam_lens_shading_map_mode_t; 528 529 typedef enum { 530 CAM_FACE_DETECT_MODE_OFF, 531 CAM_FACE_DETECT_MODE_SIMPLE, 532 CAM_FACE_DETECT_MODE_FULL, 533 } cam_face_detect_mode_t; 534 535 typedef enum { 536 CAM_TONEMAP_MODE_CONTRAST_CURVE, 537 CAM_TONEMAP_MODE_FAST, 538 CAM_TONEMAP_MODE_HIGH_QUALITY, 539 } cam_tonemap_mode_t; 540 541 typedef struct { 542 int32_t left; 543 int32_t top; 544 int32_t width; 545 int32_t height; 546 } cam_rect_t; 547 548 typedef struct { 549 cam_rect_t rect; 550 int32_t weight; /* weight of the area, valid for focusing/metering areas */ 551 } cam_area_t; 552 553 typedef enum { 554 CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */ 555 CAM_STREAMING_MODE_BURST, /* burst streaming */ 556 CAM_STREAMING_MODE_MAX 557 } cam_streaming_mode_t; 558 559 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0) 560 561 /* event from server */ 562 typedef enum { 563 CAM_EVENT_TYPE_MAP_UNMAP_DONE = (1<<0), 564 CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1), 565 CAM_EVENT_TYPE_ZOOM_DONE = (1<<2), 566 CAM_EVENT_TYPE_DAEMON_DIED = (1<<3), 567 CAM_EVENT_TYPE_MAX 568 } cam_event_type_t; 569 570 typedef enum { 571 CAM_EXP_BRACKETING_OFF, 572 CAM_EXP_BRACKETING_ON 573 } cam_bracket_mode; 574 575 typedef struct { 576 cam_bracket_mode mode; 577 char values[MAX_EXP_BRACKETING_LENGTH]; /* user defined values */ 578 } cam_exp_bracketing_t; 579 580 typedef enum { 581 CAM_AEC_ROI_OFF, 582 CAM_AEC_ROI_ON 583 } cam_aec_roi_ctrl_t; 584 585 typedef enum { 586 CAM_AEC_ROI_BY_INDEX, 587 CAM_AEC_ROI_BY_COORDINATE, 588 } cam_aec_roi_type_t; 589 590 typedef struct { 591 uint32_t x; 592 uint32_t y; 593 } cam_coordinate_type_t; 594 595 typedef struct { 596 int32_t numerator; 597 int32_t denominator; 598 } cam_rational_type_t; 599 600 typedef struct { 601 cam_aec_roi_ctrl_t aec_roi_enable; 602 cam_aec_roi_type_t aec_roi_type; 603 union { 604 cam_coordinate_type_t coordinate[MAX_ROI]; 605 uint32_t aec_roi_idx[MAX_ROI]; 606 } cam_aec_roi_position; 607 } cam_set_aec_roi_t; 608 609 typedef struct { 610 uint32_t frm_id; 611 uint8_t num_roi; 612 cam_rect_t roi[MAX_ROI]; 613 int32_t weight[MAX_ROI]; 614 uint8_t is_multiwindow; 615 } cam_roi_info_t; 616 617 typedef enum { 618 CAM_WAVELET_DENOISE_YCBCR_PLANE, 619 CAM_WAVELET_DENOISE_CBCR_ONLY, 620 CAM_WAVELET_DENOISE_STREAMLINE_YCBCR, 621 CAM_WAVELET_DENOISE_STREAMLINED_CBCR 622 } cam_denoise_process_type_t; 623 624 typedef struct { 625 int denoise_enable; 626 cam_denoise_process_type_t process_plates; 627 } cam_denoise_param_t; 628 629 #define CAM_FACE_PROCESS_MASK_DETECTION (1<<0) 630 #define CAM_FACE_PROCESS_MASK_RECOGNITION (1<<1) 631 typedef struct { 632 int fd_mode; /* mask of face process */ 633 int num_fd; 634 } cam_fd_set_parm_t; 635 636 typedef struct { 637 int8_t face_id; /* unique id for face tracking within view unless view changes */ 638 int8_t score; /* score of confidence (0, -100) */ 639 cam_rect_t face_boundary; /* boundary of face detected */ 640 cam_coordinate_type_t left_eye_center; /* coordinate of center of left eye */ 641 cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */ 642 cam_coordinate_type_t mouth_center; /* coordinate of center of mouth */ 643 uint8_t smile_degree; /* smile degree (0, -100) */ 644 uint8_t smile_confidence; /* smile confidence (0, 100) */ 645 uint8_t face_recognised; /* if face is recognised */ 646 int8_t gaze_angle; /* -90 -45 0 45 90 for head left to rigth tilt */ 647 int8_t updown_dir; /* up down direction (-90, 90) */ 648 int8_t leftright_dir; /* left right direction (-90, 90) */ 649 int8_t roll_dir; /* roll direction (-90, 90) */ 650 int8_t left_right_gaze; /* left right gaze degree (-50, 50) */ 651 int8_t top_bottom_gaze; /* up down gaze degree (-50, 50) */ 652 uint8_t blink_detected; /* if blink is detected */ 653 uint8_t left_blink; /* left eye blink degeree (0, -100) */ 654 uint8_t right_blink; /* right eye blink degree (0, - 100) */ 655 } cam_face_detection_info_t; 656 657 typedef struct { 658 uint32_t frame_id; /* frame index of which faces are detected */ 659 uint8_t num_faces_detected; /* number of faces detected */ 660 cam_face_detection_info_t faces[MAX_ROI]; /* detailed information of faces detected */ 661 } cam_face_detection_data_t; 662 663 #define CAM_HISTOGRAM_STATS_SIZE 256 664 typedef struct { 665 uint32_t max_hist_value; 666 uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */ 667 } cam_histogram_data_t; 668 669 typedef struct { 670 cam_histogram_data_t r_stats; 671 cam_histogram_data_t b_stats; 672 cam_histogram_data_t gr_stats; 673 cam_histogram_data_t gb_stats; 674 } cam_bayer_hist_stats_t; 675 676 typedef enum { 677 CAM_HISTOGRAM_TYPE_BAYER, 678 CAM_HISTOGRAM_TYPE_YUV 679 } cam_histogram_type_t; 680 681 typedef struct { 682 cam_histogram_type_t type; 683 union { 684 cam_bayer_hist_stats_t bayer_stats; 685 cam_histogram_data_t yuv_stats; 686 }; 687 } cam_hist_stats_t; 688 689 enum cam_focus_distance_index{ 690 CAM_FOCUS_DISTANCE_NEAR_INDEX, /* 0 */ 691 CAM_FOCUS_DISTANCE_OPTIMAL_INDEX, 692 CAM_FOCUS_DISTANCE_FAR_INDEX, 693 CAM_FOCUS_DISTANCE_MAX_INDEX 694 }; 695 696 typedef struct { 697 float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX]; 698 } cam_focus_distances_info_t; 699 700 /* Different autofocus cycle when calling do_autoFocus 701 * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep 702 * if one is ongoing, and lock. 703 * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless 704 * of the current state, and lock. 705 * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep. 706 * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED, 707 * or CAM_AF_NOT_FOCUSED. 708 * cancel_autoFocus stops any lens movement. 709 * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED 710 * event, not both. 711 */ 712 typedef enum { 713 CAM_AF_COMPLETE_EXISTING_SWEEP, 714 CAM_AF_DO_ONE_FULL_SWEEP, 715 CAM_AF_START_CONTINUOUS_SWEEP 716 } cam_autofocus_cycle_t; 717 718 typedef enum { 719 CAM_AF_SCANNING, 720 CAM_AF_FOCUSED, 721 CAM_AF_NOT_FOCUSED 722 } cam_autofocus_state_t; 723 724 typedef struct { 725 cam_autofocus_state_t focus_state; /* state of focus */ 726 cam_focus_distances_info_t focus_dist; /* focus distance */ 727 } cam_auto_focus_data_t; 728 729 typedef struct { 730 uint32_t stream_id; 731 cam_rect_t crop; 732 } cam_stream_crop_info_t; 733 734 typedef struct { 735 uint8_t num_of_streams; 736 cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS]; 737 } cam_crop_data_t; 738 739 typedef enum { 740 DO_NOT_NEED_FUTURE_FRAME, 741 NEED_FUTURE_FRAME, 742 } cam_prep_snapshot_state_t; 743 744 typedef struct { 745 float gains[4]; 746 } cam_color_correct_gains_t; 747 748 typedef struct { 749 uint32_t min_frame_idx; 750 uint32_t max_frame_idx; 751 } cam_frame_idx_range_t; 752 753 typedef struct { 754 uint8_t is_stats_valid; /* if histgram data is valid */ 755 cam_hist_stats_t stats_data; /* histogram data */ 756 757 uint8_t is_faces_valid; /* if face detection data is valid */ 758 cam_face_detection_data_t faces_data; /* face detection result */ 759 760 uint8_t is_focus_valid; /* if focus data is valid */ 761 cam_auto_focus_data_t focus_data; /* focus data */ 762 763 uint8_t is_crop_valid; /* if crop data is valid */ 764 cam_crop_data_t crop_data; /* crop data */ 765 766 uint8_t is_prep_snapshot_done_valid; /* if prep snapshot done is valid */ 767 cam_prep_snapshot_state_t prep_snapshot_done_state; /* prepare snapshot done state */ 768 769 /* if good frame idx range is valid */ 770 uint8_t is_good_frame_idx_range_valid; 771 /* good frame idx range, make sure: 772 * 1. good_frame_idx_range.min_frame_idx > current_frame_idx 773 * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */ 774 cam_frame_idx_range_t good_frame_idx_range; 775 776 char private_metadata[MAX_METADATA_PAYLOAD_SIZE]; 777 778 } cam_metadata_info_t; 779 780 typedef enum { 781 CAM_INTF_PARM_HAL_VERSION, 782 /* common between HAL1 and HAL3 */ 783 CAM_INTF_PARM_ANTIBANDING, 784 CAM_INTF_PARM_EXPOSURE_COMPENSATION, 785 CAM_INTF_PARM_AEC_LOCK, 786 CAM_INTF_PARM_FPS_RANGE, 787 CAM_INTF_PARM_AWB_LOCK, 788 CAM_INTF_PARM_WHITE_BALANCE, 789 CAM_INTF_PARM_EFFECT, 790 CAM_INTF_PARM_BESTSHOT_MODE, 791 CAM_INTF_PARM_DIS_ENABLE, 792 CAM_INTF_PARM_LED_MODE, 793 CAM_INTF_META_HISTOGRAM, /* 10 */ 794 CAM_INTF_META_FACE_DETECTION, 795 CAM_INTF_META_AUTOFOCUS_DATA, 796 797 /* specific to HAl1 */ 798 CAM_INTF_PARM_QUERY_FLASH4SNAP, 799 CAM_INTF_PARM_EXPOSURE, 800 CAM_INTF_PARM_SHARPNESS, 801 CAM_INTF_PARM_CONTRAST, 802 CAM_INTF_PARM_SATURATION, 803 CAM_INTF_PARM_BRIGHTNESS, 804 CAM_INTF_PARM_ISO, 805 CAM_INTF_PARM_ZOOM, /* 20 */ 806 CAM_INTF_PARM_ROLLOFF, 807 CAM_INTF_PARM_MODE, /* camera mode */ 808 CAM_INTF_PARM_AEC_ALGO_TYPE, /* auto exposure algorithm */ 809 CAM_INTF_PARM_FOCUS_ALGO_TYPE, /* focus algorithm */ 810 CAM_INTF_PARM_AEC_ROI, 811 CAM_INTF_PARM_AF_ROI, 812 CAM_INTF_PARM_FOCUS_MODE, 813 CAM_INTF_PARM_SCE_FACTOR, 814 CAM_INTF_PARM_FD, 815 CAM_INTF_PARM_MCE, /* 30 */ 816 CAM_INTF_PARM_HFR, 817 CAM_INTF_PARM_REDEYE_REDUCTION, 818 CAM_INTF_PARM_WAVELET_DENOISE, 819 CAM_INTF_PARM_HISTOGRAM, 820 CAM_INTF_PARM_ASD_ENABLE, 821 CAM_INTF_PARM_RECORDING_HINT, 822 CAM_INTF_PARM_HDR, 823 CAM_INTF_PARM_FRAMESKIP, 824 CAM_INTF_PARM_ZSL_MODE, /* indicating if it's running in ZSL mode */ 825 CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */ /* 40 */ 826 CAM_INTF_PARM_LOCK_CAF, 827 CAM_INTF_PARM_VIDEO_HDR, 828 CAM_INTF_PARM_ROTATION, 829 CAM_INTF_META_CROP_DATA, 830 CAM_INTF_META_PREP_SNAPSHOT_DONE, 831 CAM_INTF_META_GOOD_FRAME_IDX_RANGE, 832 833 /* stream based parameters */ 834 CAM_INTF_PARM_DO_REPROCESS, 835 CAM_INTF_PARM_SET_BUNDLE, 836 837 /* specific to HAL3 */ 838 /* Whether the metadata maps to a valid frame number */ 839 CAM_INTF_META_FRAME_NUMBER_VALID, 840 /* Number of pending requests yet to be processed */ 841 CAM_INTF_META_PENDING_REQUESTS, 842 /* COLOR CORRECTION.*/ 843 CAM_INTF_META_COLOR_CORRECT_MODE, 844 /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931) 845 * color space from the scene illuminant to the sRGB-standard D65-illuminant. */ 846 CAM_INTF_META_COLOR_CORRECT_TRANSFORM, /* 50 */ 847 /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/ 848 CAM_INTF_META_COLOR_CORRECT_GAINS, 849 /*The best fit color transform matrix calculated by the stats*/ 850 CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, 851 /*The best fit color channels gains calculated by the stats*/ 852 CAM_INTF_META_PRED_COLOR_CORRECT_GAINS, 853 /* CONTROL */ 854 // CAM_INTF_META_REQUEST_ID, 855 /* A frame counter set by the framework. Must be maintained unchanged in 856 * output frame. */ 857 CAM_INTF_META_FRAME_NUMBER, 858 /* Whether AE is currently updating the sensor exposure and sensitivity 859 * fields */ 860 CAM_INTF_META_AEC_MODE, 861 /* List of areas to use for metering */ 862 CAM_INTF_META_AEC_ROI, 863 /* Whether the HAL must trigger precapture metering.*/ 864 CAM_INTF_META_AEC_PRECAPTURE_TRIGGER, 865 /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */ 866 CAM_INTF_META_AEC_PRECAPTURE_ID, 867 /* Current state of AE algorithm */ 868 CAM_INTF_META_AEC_STATE, 869 /* List of areas to use for focus estimation */ 870 CAM_INTF_META_AF_ROI, 871 /* Whether the HAL must trigger autofocus. */ 872 CAM_INTF_META_AF_TRIGGER, 873 /* Current state of AF algorithm */ 874 CAM_INTF_META_AF_STATE, 875 /* The ID sent with the latest CAMERA2_TRIGGER_AUTOFOCUS call */ 876 CAM_INTF_META_AF_TRIGGER_ID, 877 /* List of areas to use for illuminant estimation */ 878 CAM_INTF_META_AWB_REGIONS, 879 /* Current state of AWB algorithm */ 880 CAM_INTF_META_AWB_STATE, 881 /*Whether black level compensation is frozen or free to vary*/ 882 CAM_INTF_META_BLACK_LEVEL_LOCK, 883 /* Information to 3A routines about the purpose of this capture, to help 884 * decide optimal 3A strategy */ 885 CAM_INTF_META_CAPTURE_INTENT, 886 /* Overall mode of 3A control routines. We need to have this parameter 887 * because not all android.control.* have an OFF option, for example, 888 * AE_FPS_Range, aePrecaptureTrigger */ 889 CAM_INTF_META_MODE, 890 /* DEMOSAIC */ 891 /* Controls the quality of the demosaicing processing */ 892 CAM_INTF_META_DEMOSAIC, 893 /* EDGE */ 894 /* Operation mode for edge enhancement */ 895 CAM_INTF_META_EDGE_MODE, 896 /* Control the amount of edge enhancement applied to the images.*/ 897 /* 1-10; 10 is maximum sharpening */ 898 CAM_INTF_META_SHARPNESS_STRENGTH, 899 /* FLASH */ 900 /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */ 901 CAM_INTF_META_FLASH_POWER, 902 /* Firing time of flash relative to start of exposure, in nanoseconds*/ 903 CAM_INTF_META_FLASH_FIRING_TIME, 904 /* Current state of the flash unit */ 905 CAM_INTF_META_FLASH_STATE, 906 /* GEOMETRIC */ 907 /* Operating mode of geometric correction */ 908 CAM_INTF_META_GEOMETRIC_MODE, 909 /* Control the amount of shading correction applied to the images */ 910 CAM_INTF_META_GEOMETRIC_STRENGTH, 911 /* HOT PIXEL */ 912 /* Set operational mode for hot pixel correction */ 913 CAM_INTF_META_HOTPIXEL_MODE, 914 /* LENS */ 915 /* Size of the lens aperture */ 916 CAM_INTF_META_LENS_APERTURE, 917 /* State of lens neutral density filter(s) */ 918 CAM_INTF_META_LENS_FILTERDENSITY, 919 /* Lens optical zoom setting */ 920 CAM_INTF_META_LENS_FOCAL_LENGTH, 921 /* Distance to plane of sharpest focus, measured from frontmost surface 922 * of the lens */ 923 CAM_INTF_META_LENS_FOCUS_DISTANCE, 924 /* The range of scene distances that are in sharp focus (depth of field) */ 925 CAM_INTF_META_LENS_FOCUS_RANGE, 926 /* Whether optical image stabilization is enabled. */ 927 CAM_INTF_META_LENS_OPT_STAB_MODE, 928 /*Whether the hal needs to output the lens shading map*/ 929 CAM_INTF_META_LENS_SHADING_MAP_MODE, 930 /* Current lens status */ 931 CAM_INTF_META_LENS_STATE, 932 /* NOISE REDUCTION */ 933 /* Mode of operation for the noise reduction algorithm */ 934 CAM_INTF_META_NOISE_REDUCTION_MODE, 935 /* Control the amount of noise reduction applied to the images. 936 * 1-10; 10 is max noise reduction */ 937 CAM_INTF_META_NOISE_REDUCTION_STRENGTH, 938 /* SCALER */ 939 /* Top-left corner and width of the output region to select from the active 940 * pixel array */ 941 CAM_INTF_META_SCALER_CROP_REGION, 942 /* The estimated scene illumination lighting frequency */ 943 CAM_INTF_META_SCENE_FLICKER, 944 /* SENSOR */ 945 /* Duration each pixel is exposed to light, in nanoseconds */ 946 CAM_INTF_META_SENSOR_EXPOSURE_TIME, 947 /* Duration from start of frame exposure to start of next frame exposure, 948 * in nanoseconds */ 949 CAM_INTF_META_SENSOR_FRAME_DURATION, 950 /* Gain applied to image data. Must be implemented through analog gain only 951 * if set to values below 'maximum analog sensitivity'. */ 952 CAM_INTF_META_SENSOR_SENSITIVITY, 953 /* Time at start of exposure of first row */ 954 CAM_INTF_META_SENSOR_TIMESTAMP, 955 /* SHADING */ 956 /* Quality of lens shading correction applied to the image data */ 957 CAM_INTF_META_SHADING_MODE, 958 /* Control the amount of shading correction applied to the images. 959 * unitless: 1-10; 10 is full shading compensation */ 960 CAM_INTF_META_SHADING_STRENGTH, 961 /* STATISTICS */ 962 /* State of the face detector unit */ 963 CAM_INTF_META_STATS_FACEDETECT_MODE, 964 /* Operating mode for histogram generation */ 965 CAM_INTF_META_STATS_HISTOGRAM_MODE, 966 /* Operating mode for sharpness map generation */ 967 CAM_INTF_META_STATS_SHARPNESS_MAP_MODE, 968 /* A 3-channel sharpness map, based on the raw sensor data, 969 * If only a monochrome sharpness map is supported, all channels 970 * should have the same data 971 */ 972 CAM_INTF_META_STATS_SHARPNESS_MAP, 973 974 /* TONEMAP */ 975 /* Table mapping blue input values to output values */ 976 CAM_INTF_META_TONEMAP_CURVE_BLUE, 977 /* Table mapping green input values to output values */ 978 CAM_INTF_META_TONEMAP_CURVE_GREEN, 979 /* Table mapping red input values to output values */ 980 CAM_INTF_META_TONEMAP_CURVE_RED, 981 /* Tone map mode */ 982 CAM_INTF_META_TONEMAP_MODE, 983 CAM_INTF_META_FLASH_MODE, 984 /* 2D array of gain factors for each color channel that was used to 985 * compensate for lens shading for this frame */ 986 CAM_INTF_META_LENS_SHADING_MAP, 987 CAM_INTF_META_PRIVATE_DATA, 988 /* Indicates streams this request needs buffers on */ 989 CAM_INTF_META_STREAM_TYPE_MASK, 990 CAM_INTF_PARM_MAX 991 } cam_intf_parm_type_t; 992 993 /***************************************************************************** 994 * Code for HAL3 data types * 995 ****************************************************************************/ 996 typedef enum { 997 CAM_INTF_METADATA_MAX 998 } cam_intf_metadata_type_t; 999 1000 typedef enum { 1001 CAM_INTENT_CUSTOM, 1002 CAM_INTENT_PREVIEW, 1003 CAM_INTENT_STILL_CAPTURE, 1004 CAM_INTENT_VIDEO_RECORD, 1005 CAM_INTENT_VIDEO_SNAPSHOT, 1006 CAM_INTENT_ZERO_SHUTTER_LAG, 1007 CAM_INTENT_MAX, 1008 } cam_intent_t; 1009 1010 typedef enum { 1011 /* Full application control of pipeline. All 3A routines are disabled, 1012 * no other settings in android.control.* have any effect */ 1013 CAM_CONTROL_OFF, 1014 /* Use settings for each individual 3A routine. Manual control of capture 1015 * parameters is disabled. All controls in android.control.* besides sceneMode 1016 * take effect */ 1017 CAM_CONTROL_AUTO, 1018 /* Use specific scene mode. Enabling this disables control.aeMode, 1019 * control.awbMode and control.afMode controls; the HAL must ignore those 1020 * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode). 1021 * Other control entries are still active. This setting can only be used if 1022 * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this 1023 * in HAL ?*/ 1024 CAM_CONTROL_USE_SCENE_MODE, 1025 CAM_CONTROL_MAX 1026 } cam_control_mode_t; 1027 1028 typedef enum { 1029 /* Use the android.colorCorrection.transform matrix to do color conversion */ 1030 CAM_COLOR_CORRECTION_TRANSFORM_MATRIX, 1031 /* Must not slow down frame rate relative to raw bayer output */ 1032 CAM_COLOR_CORRECTION_FAST, 1033 /* Frame rate may be reduced by high quality */ 1034 CAM_COLOR_CORRECTION_HIGH_QUALITY, 1035 } cam_color_correct_mode_t; 1036 1037 typedef struct { 1038 /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */ 1039 cam_rational_type_t transform_matrix[3][3]; 1040 } cam_color_correct_matrix_t; 1041 1042 #define CAM_FOCAL_LENGTHS_MAX 1 1043 #define CAM_APERTURES_MAX 1 1044 #define CAM_FILTER_DENSITIES_MAX 1 1045 #define CAM_MAX_MAP_HEIGHT 6 1046 #define CAM_MAX_MAP_WIDTH 6 1047 #define CAM_MAX_SHADING_MAP_WIDTH 17 1048 #define CAM_MAX_SHADING_MAP_HEIGHT 13 1049 #define CAM_MAX_TONEMAP_CURVE_SIZE 128 1050 1051 typedef struct { 1052 int tonemap_points_cnt; 1053 1054 /* A 1D array of pairs of floats. 1055 * Mapping a 0-1 input range to a 0-1 output range. 1056 * The input range must be monotonically increasing with N, 1057 * and values between entries should be linearly interpolated. 1058 * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0], 1059 * then the input->output mapping for a few sample points would be: 1060 * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */ 1061 float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2]; 1062 } cam_tonemap_curve_t; 1063 1064 typedef enum { 1065 OFF, 1066 FAST, 1067 QUALITY, 1068 } cam_quality_preference_t; 1069 1070 typedef enum { 1071 CAM_FLASH_CTRL_OFF, 1072 CAM_FLASH_CTRL_SINGLE, 1073 CAM_FLASH_CTRL_TORCH 1074 } cam_flash_ctrl_t; 1075 1076 typedef struct { 1077 uint8_t ae_mode; 1078 uint8_t awb_mode; 1079 uint8_t af_mode; 1080 } cam_scene_mode_overrides_t; 1081 1082 typedef struct { 1083 int32_t left; 1084 int32_t top; 1085 int32_t width; 1086 int32_t height; 1087 } cam_crop_region_t; 1088 1089 typedef struct { 1090 /* Estimated sharpness for each region of the input image. 1091 * Normalized to be between 0 and maxSharpnessMapValue. 1092 * Higher values mean sharper (better focused) */ 1093 int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT]; 1094 } cam_sharpness_map_t; 1095 1096 typedef struct { 1097 float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH]; 1098 } cam_lens_shading_map_t; 1099 1100 typedef struct { 1101 int32_t min_value; 1102 int32_t max_value; 1103 int32_t def_value; 1104 int32_t step; 1105 } cam_control_range_t; 1106 1107 #define CAM_QCOM_FEATURE_FACE_DETECTION (1<<0) 1108 #define CAM_QCOM_FEATURE_DENOISE2D (1<<1) 1109 #define CAM_QCOM_FEATURE_CROP (1<<2) 1110 #define CAM_QCOM_FEATURE_ROTATION (1<<3) 1111 #define CAM_QCOM_FEATURE_FLIP (1<<4) 1112 #define CAM_QCOM_FEATURE_HDR (1<<5) 1113 #define CAM_QCOM_FEATURE_REGISTER_FACE (1<<6) 1114 #define CAM_QCOM_FEATURE_SHARPNESS (1<<7) 1115 #define CAM_QCOM_FEATURE_VIDEO_HDR (1<<8) 1116 #define CAM_QCOM_FEATURE_CAC (1<<9) 1117 1118 // Counter clock wise 1119 typedef enum { 1120 ROTATE_0 = 1<<0, 1121 ROTATE_90 = 1<<1, 1122 ROTATE_180 = 1<<2, 1123 ROTATE_270 = 1<<3, 1124 } cam_rotation_t; 1125 1126 typedef enum { 1127 FLIP_H = 1<<0, 1128 FLIP_V = 1<<1, 1129 } cam_flip_t; 1130 1131 typedef struct { 1132 uint32_t bundle_id; /* bundle id */ 1133 uint8_t num_of_streams; /* number of streams in the bundle */ 1134 uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */ 1135 } cam_bundle_config_t; 1136 1137 typedef enum { 1138 CAM_ONLINE_REPROCESS_TYPE, /* online reprocess, frames from running streams */ 1139 CAM_OFFLINE_REPROCESS_TYPE, /* offline reprocess, frames from external source */ 1140 } cam_reprocess_type_enum_t; 1141 1142 typedef struct { 1143 /* reprocess feature mask */ 1144 uint32_t feature_mask; 1145 1146 /* individual setting for features to be reprocessed */ 1147 cam_denoise_param_t denoise2d; 1148 cam_rect_t input_crop; 1149 cam_rotation_t rotation; 1150 uint32_t flip; 1151 int32_t sharpness; 1152 int32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */ 1153 } cam_pp_feature_config_t; 1154 1155 typedef struct { 1156 uint32_t input_stream_id; 1157 /* input source stream type */ 1158 cam_stream_type_t input_stream_type; 1159 } cam_pp_online_src_config_t; 1160 1161 typedef struct { 1162 /* image format */ 1163 cam_format_t input_fmt; 1164 1165 /* image dimension */ 1166 cam_dimension_t input_dim; 1167 1168 /* buffer plane information, will be calc based on stream_type, fmt, 1169 dim, and padding_info(from stream config). Info including: 1170 offset_x, offset_y, stride, scanline, plane offset */ 1171 cam_stream_buf_plane_info_t input_buf_planes; 1172 1173 /* number of input reprocess buffers */ 1174 uint8_t num_of_bufs; 1175 } cam_pp_offline_src_config_t; 1176 1177 /* reprocess stream input configuration */ 1178 typedef struct { 1179 /* input source config */ 1180 cam_reprocess_type_enum_t pp_type; 1181 union { 1182 cam_pp_online_src_config_t online; 1183 cam_pp_offline_src_config_t offline; 1184 }; 1185 1186 /* pp feature config */ 1187 cam_pp_feature_config_t pp_feature_config; 1188 } cam_stream_reproc_config_t; 1189 1190 typedef struct { 1191 uint8_t crop_enabled; 1192 cam_rect_t input_crop; 1193 } cam_crop_param_t; 1194 1195 typedef struct { 1196 uint8_t trigger; 1197 int32_t trigger_id; 1198 } cam_trigger_t; 1199 1200 typedef struct { 1201 cam_denoise_param_t denoise; 1202 cam_crop_param_t crop; 1203 uint32_t flip; /* 0 means no flip */ 1204 int32_t sharpness; /* 0 means no sharpness */ 1205 } cam_per_frame_pp_config_t; 1206 1207 typedef enum { 1208 CAM_OPT_STAB_OFF, 1209 CAM_OPT_STAB_ON, 1210 CAM_OPT_STAB_MAX 1211 } cam_optical_stab_modes_t; 1212 1213 typedef enum { 1214 CAM_FILTER_ARRANGEMENT_RGGB, 1215 CAM_FILTER_ARRANGEMENT_GRBG, 1216 CAM_FILTER_ARRANGEMENT_GBRG, 1217 CAM_FILTER_ARRANGEMENT_BGGR, 1218 1219 /* Sensor is not Bayer; output has 3 16-bit values for each pixel, 1220 * instead of just 1 16-bit value per pixel.*/ 1221 CAM_FILTER_ARRANGEMENT_RGB 1222 } cam_color_filter_arrangement_t; 1223 1224 typedef enum { 1225 CAM_AF_STATE_INACTIVE, 1226 CAM_AF_STATE_PASSIVE_SCAN, 1227 CAM_AF_STATE_PASSIVE_FOCUSED, 1228 CAM_AF_STATE_ACTIVE_SCAN, 1229 CAM_AF_STATE_FOCUSED_LOCKED, 1230 CAM_AF_STATE_NOT_FOCUSED_LOCKED 1231 } cam_af_state_t; 1232 1233 typedef enum { 1234 CAM_AWB_STATE_INACTIVE, 1235 CAM_AWB_STATE_SEARCHING, 1236 CAM_AWB_STATE_CONVERGED, 1237 CAM_AWB_STATE_LOCKED 1238 } cam_awb_state_t; 1239 1240 #endif /* __QCAMERA_TYPES_H__ */ 1241