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