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