cam_types.h revision 952814655ca2cc65dd6fd5b981a0d0f87c5b9483
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_STATUS_SUCCESS, /* Operation Succeded */ 55 CAM_STATUS_FAILED, /* Failure in doing operation */ 56 CAM_STATUS_INVALID_PARM, /* Inavlid parameter provided */ 57 CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */ 58 CAM_STATUS_ACCEPTED, /* Parameter accepted */ 59 CAM_STATUS_MAX, 60} cam_status_t; 61 62typedef enum { 63 CAM_POSITION_BACK, 64 CAM_POSITION_FRONT 65} cam_position_t; 66 67typedef enum { 68 CAM_FORMAT_JPEG = 0, 69 CAM_FORMAT_YUV_420_NV12 = 1, 70 CAM_FORMAT_YUV_420_NV21, 71 CAM_FORMAT_YUV_420_NV21_ADRENO, 72 CAM_FORMAT_YUV_420_YV12, 73 CAM_FORMAT_YUV_422_NV16, 74 CAM_FORMAT_YUV_422_NV61, 75 76 /* Please note below are the defintions for raw image. 77 * Any format other than raw image format should be declared 78 * before this line!!!!!!!!!!!!! */ 79 80 /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */ 81 82 /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV. 83 * U and V are interleaved with Y: YUYV or YVYV */ 84 CAM_FORMAT_YUV_RAW_8BIT_YUYV, 85 CAM_FORMAT_YUV_RAW_8BIT_YVYU, 86 CAM_FORMAT_YUV_RAW_8BIT_UYVY, 87 CAM_FORMAT_YUV_RAW_8BIT_VYUY, 88 89 /* QCOM RAW formats where data is packed into 64bit word. 90 * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is 91 * stored at LSB. 92 * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most 93 * significant 4 bits are set to 0. P0 is stored at LSB. 94 * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most 95 * significant 4 bits are set to 0. P0 is stored at LSB. */ 96 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG, 97 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG, 98 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB, 99 CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR, 100 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG, 101 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG, 102 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB, 103 CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR, 104 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG, 105 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG, 106 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB, 107 CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR, 108 /* MIPI RAW formats based on MIPI CSI-2 specifiction. 109 * 8BPP: Each pixel occupies one bytes, starting at LSB. 110 * Output with of image has no restrictons. 111 * 10BPP: Four pixels are held in every 5 bytes. The output 112 * with of image must be a multiple of 4 pixels. 113 * 12BPP: Two pixels are held in every 3 bytes. The output 114 * width of image must be a multiple of 2 pixels. */ 115 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG, 116 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG, 117 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB, 118 CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR, 119 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG, 120 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG, 121 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB, 122 CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR, 123 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG, 124 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG, 125 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB, 126 CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR, 127 /* Ideal raw formats where image data has gone through black 128 * correction, lens rolloff, demux/channel gain, bad pixel 129 * correction, and ABF. 130 * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW 131 * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and 132 * plain 16 12bpp */ 133 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG, 134 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG, 135 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB, 136 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR, 137 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG, 138 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG, 139 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB, 140 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR, 141 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG, 142 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG, 143 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB, 144 CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR, 145 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG, 146 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG, 147 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB, 148 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR, 149 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG, 150 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG, 151 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB, 152 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR, 153 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG, 154 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG, 155 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB, 156 CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR, 157 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG, 158 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG, 159 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB, 160 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR, 161 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG, 162 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG, 163 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB, 164 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR, 165 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG, 166 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG, 167 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB, 168 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR, 169 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG, 170 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG, 171 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB, 172 CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR, 173 174 CAM_FORMAT_MAX 175} cam_format_t; 176 177typedef enum { 178 CAM_STREAM_TYPE_DEFAULT, /* default stream type */ 179 CAM_STREAM_TYPE_PREVIEW, /* preview */ 180 CAM_STREAM_TYPE_POSTVIEW, /* postview */ 181 CAM_STREAM_TYPE_SNAPSHOT, /* snapshot */ 182 CAM_STREAM_TYPE_VIDEO, /* video */ 183 CAM_STREAM_TYPE_RAW, /* raw dump from camif */ 184 CAM_STREAM_TYPE_METADATA, /* meta data */ 185 CAM_STREAM_TYPE_OFFLINE_PROC, /* offline process */ 186 CAM_STREAM_TYPE_MAX, 187} cam_stream_type_t; 188 189typedef enum { 190 CAM_PAD_NONE = 1, 191 CAM_PAD_TO_2 = 2, 192 CAM_PAD_TO_4 = 4, 193 CAM_PAD_TO_WORD = CAM_PAD_TO_4, 194 CAM_PAD_TO_8 = 8, 195 CAM_PAD_TO_16 = 16, 196 CAM_PAD_TO_32 = 32, 197 CAM_PAD_TO_64 = 64, 198 CAM_PAD_TO_1K = 1024, 199 CAM_PAD_TO_2K = 2048, 200 CAM_PAD_TO_4K = 4096, 201 CAM_PAD_TO_8K = 8192 202} cam_pad_format_t; 203 204typedef enum { 205 /* followings are per camera */ 206 CAM_MAPPING_BUF_TYPE_CAPABILITY, /* mapping camera capability buffer */ 207 CAM_MAPPING_BUF_TYPE_PARM_BUF, /* mapping parameters buffer */ 208 209 /* followings are per stream */ 210 CAM_MAPPING_BUF_TYPE_STREAM_BUF, /* mapping stream buffers */ 211 CAM_MAPPING_BUF_TYPE_STREAM_INFO, /* mapping stream information buffer */ 212 CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */ 213 CAM_MAPPING_BUF_TYPE_MAX 214} cam_mapping_buf_type; 215 216typedef struct { 217 cam_mapping_buf_type type; 218 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 219 uint32_t frame_idx; /* frame index: valid if type is STREAM_BUF */ 220 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 221 * -1 means all planners shanre the same fd; 222 * otherwise, each planner has its own fd */ 223 unsigned long cookie; /* could be job_id(uint32_t) to identify mapping job */ 224 int fd; /* origin fd */ 225 uint32_t size; /* size of the buffer */ 226} cam_buf_map_type; 227 228typedef struct { 229 cam_mapping_buf_type type; 230 uint32_t stream_id; /* stream id: valid if STREAM_BUF */ 231 uint32_t frame_idx; /* frame index: valid if STREAM_BUF or HIST_BUF */ 232 int32_t plane_idx; /* planner index. valid if type is STREAM_BUF. 233 * -1 means all planners shanre the same fd; 234 * otherwise, each planner has its own fd */ 235 unsigned long cookie; /* could be job_id(uint32_t) to identify unmapping job */ 236} cam_buf_unmap_type; 237 238typedef enum { 239 CAM_MAPPING_TYPE_FD_MAPPING, 240 CAM_MAPPING_TYPE_FD_UNMAPPING, 241 CAM_MAPPING_TYPE_MAX 242} cam_mapping_type; 243 244typedef struct { 245 cam_mapping_type msg_type; 246 union { 247 cam_buf_map_type buf_map; 248 cam_buf_unmap_type buf_unmap; 249 } payload; 250} cam_sock_packet_t; 251 252typedef enum { 253 CAM_MODE_2D = (1<<0), 254 CAM_MODE_3D = (1<<1) 255} cam_mode_t; 256 257typedef struct { 258 uint32_t len; 259 uint32_t y_offset; 260 uint32_t cbcr_offset; 261} cam_sp_len_offset_t; 262 263typedef struct{ 264 uint32_t len; 265 uint32_t offset; 266 int32_t offset_x; 267 int32_t offset_y; 268 int32_t stride; 269 int32_t scanline; 270} cam_mp_len_offset_t; 271 272typedef struct { 273 uint32_t width_padding; 274 uint32_t height_padding; 275 uint32_t plane_padding; 276} cam_padding_info_t; 277 278typedef struct { 279 int num_planes; 280 union { 281 cam_sp_len_offset_t sp; 282 cam_mp_len_offset_t mp[VIDEO_MAX_PLANES]; 283 }; 284 uint32_t frame_len; 285} cam_frame_len_offset_t; 286 287typedef struct { 288 int32_t width; 289 int32_t height; 290} cam_dimension_t; 291 292typedef struct { 293 cam_frame_len_offset_t plane_info; 294} cam_stream_buf_plane_info_t; 295 296typedef struct { 297 float min_fps; 298 float max_fps; 299} cam_fps_range_t; 300 301typedef enum { 302 CAM_HFR_MODE_OFF, 303 CAM_HFR_MODE_60FPS, 304 CAM_HFR_MODE_90FPS, 305 CAM_HFR_MODE_120FPS, 306 CAM_HFR_MODE_150FPS, 307 CAM_HFR_MODE_MAX 308} cam_hfr_mode_t; 309 310typedef struct { 311 cam_hfr_mode_t mode; 312 cam_dimension_t dim; 313 uint8_t frame_skip; 314 uint8_t livesnapshot_sizes_tbl_cnt; /* livesnapshot sizes table size */ 315 cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT]; /* livesnapshot sizes table */ 316} cam_hfr_info_t; 317 318typedef enum { 319 CAM_WB_MODE_AUTO, 320 CAM_WB_MODE_CUSTOM, 321 CAM_WB_MODE_INCANDESCENT, 322 CAM_WB_MODE_FLUORESCENT, 323 CAM_WB_MODE_WARM_FLUORESCENT, 324 CAM_WB_MODE_DAYLIGHT, 325 CAM_WB_MODE_CLOUDY_DAYLIGHT, 326 CAM_WB_MODE_TWILIGHT, 327 CAM_WB_MODE_SHADE, 328 CAM_WB_MODE_MAX 329} cam_wb_mode_type; 330 331typedef enum { 332 CAM_ANTIBANDING_MODE_OFF, 333 CAM_ANTIBANDING_MODE_60HZ, 334 CAM_ANTIBANDING_MODE_50HZ, 335 CAM_ANTIBANDING_MODE_AUTO, 336 CAM_ANTIBANDING_MODE_AUTO_50HZ, 337 CAM_ANTIBANDING_MODE_AUTO_60HZ, 338 CAM_ANTIBANDING_MODE_MAX, 339} cam_antibanding_mode_type; 340 341/* Enum Type for different ISO Mode supported */ 342typedef enum { 343 CAM_ISO_MODE_AUTO, 344 CAM_ISO_MODE_DEBLUR, 345 CAM_ISO_MODE_100, 346 CAM_ISO_MODE_200, 347 CAM_ISO_MODE_400, 348 CAM_ISO_MODE_800, 349 CAM_ISO_MODE_1600, 350 CAM_ISO_MODE_MAX 351} cam_iso_mode_type; 352 353typedef enum { 354 CAM_AEC_MODE_FRAME_AVERAGE, 355 CAM_AEC_MODE_CENTER_WEIGHTED, 356 CAM_AEC_MODE_SPOT_METERING, 357 CAM_AEC_MODE_SMART_METERING, 358 CAM_AEC_MODE_USER_METERING, 359 CAM_AEC_MODE_SPOT_METERING_ADV, 360 CAM_AEC_MODE_CENTER_WEIGHTED_ADV, 361 CAM_AEC_MODE_MAX 362} cam_auto_exposure_mode_type; 363 364typedef enum { 365 CAM_FOCUS_ALGO_AUTO, 366 CAM_FOCUS_ALGO_SPOT, 367 CAM_FOCUS_ALGO_CENTER_WEIGHTED, 368 CAM_FOCUS_ALGO_AVERAGE, 369 CAM_FOCUS_ALGO_MAX 370} cam_focus_algorithm_type; 371 372/* Auto focus mode */ 373typedef enum { 374 CAM_FOCUS_MODE_AUTO, 375 CAM_FOCUS_MODE_INFINITY, 376 CAM_FOCUS_MODE_MACRO, 377 CAM_FOCUS_MODE_FIXED, 378 CAM_FOCUS_MODE_EDOF, 379 CAM_FOCUS_MODE_CONTINOUS_VIDEO, 380 CAM_FOCUS_MODE_CONTINOUS_PICTURE, 381 CAM_FOCUS_MODE_MAX 382} cam_focus_mode_type; 383 384typedef enum { 385 CAM_SCENE_MODE_OFF, 386 CAM_SCENE_MODE_AUTO, 387 CAM_SCENE_MODE_LANDSCAPE, 388 CAM_SCENE_MODE_SNOW, 389 CAM_SCENE_MODE_BEACH, 390 CAM_SCENE_MODE_SUNSET, 391 CAM_SCENE_MODE_NIGHT, 392 CAM_SCENE_MODE_PORTRAIT, 393 CAM_SCENE_MODE_BACKLIGHT, 394 CAM_SCENE_MODE_SPORTS, 395 CAM_SCENE_MODE_ANTISHAKE, 396 CAM_SCENE_MODE_FLOWERS, 397 CAM_SCENE_MODE_CANDLELIGHT, 398 CAM_SCENE_MODE_FIREWORKS, 399 CAM_SCENE_MODE_PARTY, 400 CAM_SCENE_MODE_NIGHT_PORTRAIT, 401 CAM_SCENE_MODE_THEATRE, 402 CAM_SCENE_MODE_ACTION, 403 CAM_SCENE_MODE_AR, 404 CAM_SCENE_MODE_MAX 405} cam_scene_mode_type; 406 407typedef enum { 408 CAM_EFFECT_MODE_OFF, 409 CAM_EFFECT_MODE_MONO, 410 CAM_EFFECT_MODE_NEGATIVE, 411 CAM_EFFECT_MODE_SOLARIZE, 412 CAM_EFFECT_MODE_SEPIA, 413 CAM_EFFECT_MODE_POSTERIZE, 414 CAM_EFFECT_MODE_WHITEBOARD, 415 CAM_EFFECT_MODE_BLACKBOARD, 416 CAM_EFFECT_MODE_AQUA, 417 CAM_EFFECT_MODE_EMBOSS, 418 CAM_EFFECT_MODE_SKETCH, 419 CAM_EFFECT_MODE_NEON, 420 CAM_EFFECT_MODE_MAX 421} cam_effect_mode_type; 422 423typedef enum { 424 CAM_FLASH_MODE_OFF, 425 CAM_FLASH_MODE_AUTO, 426 CAM_FLASH_MODE_ON, 427 CAM_FLASH_MODE_TORCH, 428 CAM_FLASH_MODE_MAX 429} cam_flash_mode_t; 430 431typedef struct { 432 int32_t left; 433 int32_t top; 434 int32_t width; 435 int32_t height; 436} cam_rect_t; 437 438typedef struct { 439 cam_rect_t rect; 440 int32_t weight; /* weight of the area, valid for focusing/metering areas */ 441} cam_area_t; 442 443typedef enum { 444 CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */ 445 CAM_STREAMING_MODE_BURST, /* burst streaming */ 446 CAM_STREAMING_MODE_MAX 447} cam_streaming_mode_t; 448 449#define CAM_REPROCESS_MASK_TYPE_WNR (1<<0) 450 451/* event from server */ 452typedef enum { 453 CAM_EVENT_TYPE_MAP_UNMAP_DONE = (1<<0), 454 CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1), 455 CAM_EVENT_TYPE_ZOOM_DONE = (1<<2), 456 CAM_EVENT_TYPE_MAX 457} cam_event_type_t; 458 459typedef enum { 460 CAM_EXP_BRACKETING_OFF, 461 CAM_EXP_BRACKETING_ON 462} cam_bracket_mode; 463 464typedef struct { 465 cam_bracket_mode mode; 466 char values[MAX_EXP_BRACKETING_LENGTH]; /* user defined values */ 467} cam_exp_bracketing_t; 468 469typedef enum { 470 CAM_AEC_ROI_OFF, 471 CAM_AEC_ROI_ON 472} cam_aec_roi_ctrl_t; 473 474typedef enum { 475 CAM_AEC_ROI_BY_INDEX, 476 CAM_AEC_ROI_BY_COORDINATE, 477} cam_aec_roi_type_t; 478 479typedef struct { 480 uint32_t x; 481 uint32_t y; 482} cam_coordinate_type_t; 483 484typedef struct { 485 cam_aec_roi_ctrl_t aec_roi_enable; 486 cam_aec_roi_type_t aec_roi_type; 487 union { 488 cam_coordinate_type_t coordinate[MAX_ROI]; 489 uint32_t aec_roi_idx[MAX_ROI]; 490 } cam_aec_roi_position; 491} cam_set_aec_roi_t; 492 493typedef struct { 494 uint32_t frm_id; 495 uint8_t num_roi; 496 cam_rect_t roi[MAX_ROI]; 497 int32_t weight[MAX_ROI]; 498 uint8_t is_multiwindow; 499} cam_roi_info_t; 500 501typedef enum { 502 CAM_WAVELET_DENOISE_YCBCR_PLANE, 503 CAM_WAVELET_DENOISE_CBCR_ONLY, 504 CAM_WAVELET_DENOISE_STREAMLINE_YCBCR, 505 CAM_WAVELET_DENOISE_STREAMLINED_CBCR 506} cam_denoise_process_type_t; 507 508typedef struct { 509 int denoise_enable; 510 cam_denoise_process_type_t process_plates; 511} cam_denoise_param_t; 512 513#define CAM_FACE_PROCESS_MASK_DETECTION (1<<0) 514#define CAM_FACE_PROCESS_MASK_RECOGNITION (1<<1) 515typedef struct { 516 int fd_mode; /* mask of face process */ 517 int num_fd; 518} cam_fd_set_parm_t; 519 520typedef struct { 521 int8_t face_id; /* unique id for face tracking within view unless view changes */ 522 int8_t score; /* score of confidence (0, -100) */ 523 cam_rect_t face_boundary; /* boundary of face detected */ 524 cam_coordinate_type_t left_eye_center; /* coordinate of center of left eye */ 525 cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */ 526 cam_coordinate_type_t mouth_center; /* coordinate of center of mouth */ 527 uint8_t smile_degree; /* smile degree (0, -100) */ 528 uint8_t smile_confidence; /* smile confidence (0, 100) */ 529 uint8_t face_recognised; /* if face is recognised */ 530 int8_t gaze_angle; /* -90 -45 0 45 90 for head left to rigth tilt */ 531 int8_t updown_dir; /* up down direction (-90, 90) */ 532 int8_t leftright_dir; /* left right direction (-90, 90) */ 533 int8_t roll_dir; /* roll direction (-90, 90) */ 534 int8_t left_right_gaze; /* left right gaze degree (-50, 50) */ 535 int8_t top_bottom_gaze; /* up down gaze degree (-50, 50) */ 536 uint8_t blink_detected; /* if blink is detected */ 537 uint8_t left_blink; /* left eye blink degeree (0, -100) */ 538 uint8_t right_blink; /* right eye blink degree (0, - 100) */ 539} cam_face_detection_info_t; 540 541typedef struct { 542 uint32_t frame_id; /* frame index of which faces are detected */ 543 uint8_t num_faces_detected; /* number of faces detected */ 544 cam_face_detection_info_t faces[MAX_ROI]; /* detailed information of faces detected */ 545} cam_face_detection_data_t; 546 547#define CAM_HISTOGRAM_STATS_SIZE 256 548typedef struct { 549 uint32_t max_hist_value; 550 uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */ 551} cam_histogram_data_t; 552 553typedef struct { 554 cam_histogram_data_t r_stats; 555 cam_histogram_data_t b_stats; 556 cam_histogram_data_t gr_stats; 557 cam_histogram_data_t gb_stats; 558} cam_bayer_hist_stats_t; 559 560typedef enum { 561 CAM_HISTOGRAM_TYPE_BAYER, 562 CAM_HISTOGRAM_TYPE_YUV 563} cam_histogram_type_t; 564 565typedef struct { 566 cam_histogram_type_t type; 567 union { 568 cam_bayer_hist_stats_t bayer_stats; 569 cam_histogram_data_t yuv_stats; 570 }; 571} cam_hist_stats_t; 572 573enum cam_focus_distance_index{ 574 CAM_FOCUS_DISTANCE_NEAR_INDEX, /* 0 */ 575 CAM_FOCUS_DISTANCE_OPTIMAL_INDEX, 576 CAM_FOCUS_DISTANCE_FAR_INDEX, 577 CAM_FOCUS_DISTANCE_MAX_INDEX 578}; 579 580typedef struct { 581 float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX]; 582} cam_focus_distances_info_t; 583 584/* Different autofocus cycle when calling do_autoFocus 585 * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep 586 * if one is ongoing, and lock. 587 * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless 588 * of the current state, and lock. 589 * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep. 590 * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED, 591 * or CAM_AF_NOT_FOCUSED. 592 * cancel_autoFocus stops any lens movement. 593 * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED 594 * event, not both. 595 */ 596typedef enum { 597 CAM_AF_COMPLETE_EXISTING_SWEEP, 598 CAM_AF_DO_ONE_FULL_SWEEP, 599 CAM_AF_START_CONTINUOUS_SWEEP 600} cam_autofocus_cycle_t; 601 602typedef enum { 603 CAM_AF_SCANNING, 604 CAM_AF_FOCUSED, 605 CAM_AF_NOT_FOCUSED 606} cam_autofocus_state_t; 607 608typedef struct { 609 cam_autofocus_state_t focus_state; /* state of focus */ 610 cam_focus_distances_info_t focus_dist; /* focus distance */ 611} cam_auto_focus_data_t; 612 613typedef struct { 614 uint32_t stream_id; 615 cam_rect_t crop; 616} cam_stream_crop_info_t; 617 618typedef struct { 619 uint8_t num_of_streams; 620 cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS]; 621} cam_crop_data_t; 622 623typedef enum { 624 DO_NOT_NEED_FUTURE_FRAME, 625 NEED_FUTURE_FRAME, 626} cam_prep_snapshot_state_t; 627 628typedef struct { 629 uint32_t min_frame_idx; 630 uint32_t max_frame_idx; 631} cam_frame_idx_range_t; 632 633typedef struct { 634 uint8_t is_stats_valid; /* if histgram data is valid */ 635 cam_hist_stats_t stats_data; /* histogram data */ 636 637 uint8_t is_faces_valid; /* if face detection data is valid */ 638 cam_face_detection_data_t faces_data; /* face detection result */ 639 640 uint8_t is_focus_valid; /* if focus data is valid */ 641 cam_auto_focus_data_t focus_data; /* focus data */ 642 643 uint8_t is_crop_valid; /* if crop data is valid */ 644 cam_crop_data_t crop_data; /* crop data */ 645 646 uint8_t is_prep_snapshot_done_valid; /* if prep snapshot done is valid */ 647 cam_prep_snapshot_state_t prep_snapshot_done_state; /* prepare snapshot done state */ 648 649 /* if good frame idx range is valid */ 650 uint8_t is_good_frame_idx_range_valid; 651 /* good frame idx range, make sure: 652 * 1. good_frame_idx_range.min_frame_idx > current_frame_idx 653 * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */ 654 cam_frame_idx_range_t good_frame_idx_range; 655 656 char private_metadata[MAX_METADATA_PAYLOAD_SIZE]; 657 658} cam_metadata_info_t; 659 660typedef enum { 661 CAM_INTF_PARM_QUERY_FLASH4SNAP, 662 CAM_INTF_PARM_EXPOSURE, 663 CAM_INTF_PARM_SHARPNESS, 664 CAM_INTF_PARM_CONTRAST, 665 CAM_INTF_PARM_SATURATION, 666 CAM_INTF_PARM_BRIGHTNESS, 667 CAM_INTF_PARM_WHITE_BALANCE, 668 CAM_INTF_PARM_ISO, 669 CAM_INTF_PARM_ZOOM, 670 CAM_INTF_PARM_ANTIBANDING, 671 CAM_INTF_PARM_EFFECT, 672 CAM_INTF_PARM_FPS_RANGE, 673 CAM_INTF_PARM_EXPOSURE_COMPENSATION, 674 CAM_INTF_PARM_LED_MODE, 675 CAM_INTF_PARM_ROLLOFF, 676 CAM_INTF_PARM_MODE, /* camera mode */ 677 CAM_INTF_PARM_AEC_ALGO_TYPE, /* auto exposure algorithm */ 678 CAM_INTF_PARM_FOCUS_ALGO_TYPE, /* focus algorithm */ 679 CAM_INTF_PARM_AEC_ROI, 680 CAM_INTF_PARM_AF_ROI, 681 CAM_INTF_PARM_FOCUS_MODE, 682 CAM_INTF_PARM_BESTSHOT_MODE, 683 CAM_INTF_PARM_SCE_FACTOR, 684 CAM_INTF_PARM_FD, 685 CAM_INTF_PARM_AEC_LOCK, 686 CAM_INTF_PARM_AWB_LOCK, 687 CAM_INTF_PARM_MCE, 688 CAM_INTF_PARM_HFR, 689 CAM_INTF_PARM_REDEYE_REDUCTION, 690 CAM_INTF_PARM_WAVELET_DENOISE, 691 CAM_INTF_PARM_HISTOGRAM, 692 CAM_INTF_PARM_ASD_ENABLE, 693 CAM_INTF_PARM_RECORDING_HINT, 694 CAM_INTF_PARM_DIS_ENABLE, 695 CAM_INTF_PARM_HDR, 696 CAM_INTF_PARM_SET_BUNDLE, 697 CAM_INTF_PARM_FRAMESKIP, 698 CAM_INTF_PARM_ZSL_MODE, /* indicating if it's running in ZSL mode */ 699 CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */ 700 CAM_INTF_PARM_LOCK_CAF, 701 CAM_INTF_PARM_VIDEO_HDR, 702 CAM_INTF_PARM_MAX 703} cam_intf_parm_type_t; 704 705typedef struct { 706 int32_t min_value; 707 int32_t max_value; 708 int32_t def_value; 709 int32_t step; 710} cam_control_range_t; 711 712#define CAM_QCOM_FEATURE_FACE_DETECTION (1<<0) 713#define CAM_QCOM_FEATURE_DENOISE2D (1<<1) 714#define CAM_QCOM_FEATURE_CROP (1<<2) 715#define CAM_QCOM_FEATURE_ROTATION (1<<3) 716#define CAM_QCOM_FEATURE_FLIP (1<<4) 717#define CAM_QCOM_FEATURE_HDR (1<<5) 718#define CAM_QCOM_FEATURE_REGISTER_FACE (1<<6) 719#define CAM_QCOM_FEATURE_SHARPNESS (1<<7) 720#define CAM_QCOM_FEATURE_VIDEO_HDR (1<<8) 721 722// Counter clock wise 723typedef enum { 724 ROTATE_0 = 1<<0, 725 ROTATE_90 = 1<<1, 726 ROTATE_180 = 1<<2, 727 ROTATE_270 = 1<<3, 728} cam_rotation_t; 729 730typedef enum { 731 FLIP_H = 1<<0, 732 FLIP_V = 1<<1, 733} cam_flip_t; 734 735typedef struct { 736 uint32_t bundle_id; /* bundle id */ 737 uint8_t num_of_streams; /* number of streams in the bundle */ 738 uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */ 739} cam_bundle_config_t; 740 741typedef enum { 742 CAM_ONLINE_REPROCESS_TYPE, /* online reprocess, frames from running streams */ 743 CAM_OFFLINE_REPROCESS_TYPE, /* offline reprocess, frames from external source */ 744} cam_reprocess_type_enum_t; 745 746typedef struct { 747 /* reprocess feature mask */ 748 uint32_t feature_mask; 749 750 /* individual setting for features to be reprocessed */ 751 cam_denoise_param_t denoise2d; 752 cam_rect_t input_crop; 753 cam_rotation_t rotation; 754 uint32_t flip; 755 int32_t sharpness; 756 int32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */ 757} cam_pp_feature_config_t; 758 759typedef struct { 760 uint32_t input_stream_id; 761 /* input source stream type */ 762 cam_stream_type_t input_stream_type; 763} cam_pp_online_src_config_t; 764 765typedef struct { 766 /* image format */ 767 cam_format_t input_fmt; 768 769 /* image dimension */ 770 cam_dimension_t input_dim; 771 772 /* buffer plane information, will be calc based on stream_type, fmt, 773 dim, and padding_info(from stream config). Info including: 774 offset_x, offset_y, stride, scanline, plane offset */ 775 cam_stream_buf_plane_info_t input_buf_planes; 776 777 /* number of input reprocess buffers */ 778 uint8_t num_of_bufs; 779} cam_pp_offline_src_config_t; 780 781/* reprocess stream input configuration */ 782typedef struct { 783 /* input source config */ 784 cam_reprocess_type_enum_t pp_type; 785 union { 786 cam_pp_online_src_config_t online; 787 cam_pp_offline_src_config_t offline; 788 }; 789 790 /* pp feature config */ 791 cam_pp_feature_config_t pp_feature_config; 792} cam_stream_reproc_config_t; 793 794#endif /* __QCAMERA_TYPES_H__ */ 795