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