Home | History | Annotate | Download | only in common
      1 /* Copyright (c) 2012-2017, 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 // System dependencies
     34 #include <stdint.h>
     35 #include <media/msmb_camera.h>
     36 
     37 #define CAM_MAX_NUM_BUFS_PER_STREAM 64
     38 #define MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES 11224
     39 #define AWB_DEBUG_DATA_SIZE               (45000)
     40 #define AEC_DEBUG_DATA_SIZE               (5000)
     41 #define AF_DEBUG_DATA_SIZE                (60000)
     42 #define ASD_DEBUG_DATA_SIZE               (100)
     43 #define STATS_BUFFER_DEBUG_DATA_SIZE      (75000)
     44 #define BESTATS_BUFFER_DEBUG_DATA_SIZE    (150000)
     45 #define BHIST_STATS_DEBUG_DATA_SIZE       (70000)
     46 #define TUNING_INFO_DEBUG_DATA_SIZE       (4)
     47 #define OIS_DATA_MAX_SIZE                 (32)
     48 #define MAX_OIS_SAMPLE_NUM_PER_FRAME      (20)
     49 #define MAX_MAKERNOTE_LENGTH              (65535)
     50 
     51 #define PD_DATA_SIZE                      (4032*2*758)
     52 
     53 #define MAX_PDAF_CALIB_GAINS              (25*19)
     54 #define MAX_PDAF_CALIB_COEFF              (200)
     55 
     56 #define CEILING64(X) (((X) + 0x0003F) & 0xFFFFFFC0)
     57 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
     58 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
     59 #define CEILING4(X)  (((X) + 0x0003) & 0xFFFC)
     60 #define CEILING2(X)  (((X) + 0x0001) & 0xFFFE)
     61 
     62 #define MAX_ZOOMS_CNT 91
     63 #define MAX_SIZES_CNT 40
     64 #define MAX_EXP_BRACKETING_LENGTH 32
     65 #define MAX_ROI 10
     66 #define MAX_STREAM_NUM_IN_BUNDLE 8
     67 #define MAX_NUM_STREAMS          8
     68 #define CHROMATIX_SIZE 60000
     69 #define COMMONCHROMATIX_SIZE 45000
     70 #define CPPCHROMATIX_SIZE 36000
     71 #define SWPOSTPROCCHROMATIX_SIZE 36000
     72 #define AFTUNE_SIZE  32768
     73 #define A3CHROMATIX_SIZE 30000
     74 #define MAX_SCALE_SIZES_CNT 8
     75 #define MAX_SAMP_DECISION_CNT     64
     76 #define SENSOR_PHYSICAL_SIZE_CNT  2
     77 #define EXPOSURE_TIME_RANGE_CNT   2
     78 #define BLACK_LEVEL_PATTERN_CNT   4
     79 #define FORWARD_MATRIX_COLS       3
     80 #define FORWARD_MATRIX_ROWS       3
     81 #define COLOR_TRANSFORM_COLS      3
     82 #define COLOR_TRANSFORM_ROWS      3
     83 #define CAL_TRANSFORM_COLS        3
     84 #define CAL_TRANSFORM_ROWS        3
     85 
     86 #define MAX_ISP_DATA_SIZE (20*1024)
     87 #define MAX_PP_DATA_SIZE  16384
     88 #define MAX_AE_STATS_DATA_SIZE  1000
     89 #define MAX_AWB_STATS_DATA_SIZE 1000
     90 #define MAX_AF_STATS_DATA_SIZE  1000
     91 #define MAX_ASD_STATS_DATA_SIZE 1000
     92 
     93 #define MAX_CAPTURE_BATCH_NUM 32
     94 
     95 #define TUNING_DATA_VERSION        6
     96 #define TUNING_SENSOR_DATA_MAX     0x10000 /*(need value from sensor team)*/
     97 #define TUNING_VFE_DATA_MAX        0x10000 /*(need value from vfe team)*/
     98 #define TUNING_CPP_DATA_MAX        0x10000 /*(need value from pproc team)*/
     99 #define TUNING_CAC_DATA_MAX        0x10000 /*(need value from imglib team)*/
    100 #define TUNING_MOD1_AEC_DATA_MAX   ((16*(sizeof(int))) + (16*(sizeof(float))))
    101 #define TUNING_MOD1_AWB_DATA_MAX   ((16*(sizeof(int))) + (16*(sizeof(float))))
    102 #define TUNING_MOD1_AF_DATA_MAX    ((16*(sizeof(int))) + (16*(sizeof(float))))
    103 #define TUNING_MOD1_STATS_DATA_MAX (TUNING_MOD1_AEC_DATA_MAX + \
    104                                    TUNING_MOD1_AEC_DATA_MAX + \
    105                                    TUNING_MOD1_AEC_DATA_MAX)
    106 
    107 #define TUNING_DATA_MAX            (TUNING_SENSOR_DATA_MAX + \
    108                                    TUNING_VFE_DATA_MAX + \
    109                                    TUNING_MOD1_STATS_DATA_MAX + \
    110                                    TUNING_CPP_DATA_MAX + \
    111                                    TUNING_CAC_DATA_MAX)
    112 
    113 #define TUNING_SENSOR_DATA_OFFSET  0
    114 #define TUNING_VFE_DATA_OFFSET     TUNING_SENSOR_DATA_MAX
    115 #define TUNING_MOD1_AEC_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
    116                                      TUNING_VFE_DATA_MAX)
    117 
    118 #define TUNING_MOD1_AWB_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
    119                                       TUNING_VFE_DATA_MAX + \
    120                                       TUNING_MOD1_AEC_DATA_MAX)
    121 
    122 #define TUNING_MOD1_AF_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
    123                                      TUNING_VFE_DATA_MAX + \
    124                                      TUNING_MOD1_AEC_DATA_MAX + \
    125                                      TUNING_MOD1_AWB_DATA_MAX)
    126 
    127 #define TUNING_CPP_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
    128                                     TUNING_VFE_DATA_MAX + \
    129                                     TUNING_MOD1_AEC_DATA_MAX + \
    130                                     TUNING_MOD1_AWB_DATA_MAX + \
    131                                     TUNING_MOD1_AF_DATA_MAX)
    132 #define TUNING_CAC_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
    133                                     TUNING_VFE_DATA_MAX + \
    134                                     TUNING_MOD1_AEC_DATA_MAX + \
    135                                     TUNING_MOD1_AWB_DATA_MAX + \
    136                                     TUNING_MOD1_AF_DATA_MAX + \
    137                                     TUNING_CPP_DATA_MAX)
    138 
    139 #define MAX_STATS_DATA_SIZE 4000
    140 
    141 #define MAX_AF_BRACKETING_VALUES 5
    142 #define MAX_TEST_PATTERN_CNT     8
    143 
    144 #define GPS_PROCESSING_METHOD_SIZE 33
    145 #define EXIF_IMAGE_DESCRIPTION_SIZE 100
    146 
    147 #define MAX_INFLIGHT_REQUESTS  6
    148 #define MAX_INFLIGHT_BLOB      3
    149 #define MIN_INFLIGHT_REQUESTS  3
    150 #define MIN_INFLIGHT_60FPS_REQUESTS (6)
    151 #define MAX_INFLIGHT_REPROCESS_REQUESTS 1
    152 #define MAX_INFLIGHT_HFR_REQUESTS (48)
    153 #define MIN_INFLIGHT_HFR_REQUESTS (40)
    154 
    155 // Max allowed video buffer count for all cases
    156 #define MAX_VIDEO_BUFFERS 24
    157 // Max allowed video buffer count for 30fps
    158 #define MAX_30FPS_VIDEO_BUFFERS 18
    159 
    160 #define QCAMERA_DUMP_FRM_LOCATION "/data/vendor/camera/"
    161 #define QCAMERA_MAX_FILEPATH_LENGTH 64
    162 
    163 #define LIKELY(x)       __builtin_expect((x), true)
    164 #define UNLIKELY(x)     __builtin_expect((x), false)
    165 
    166 #define RELCAM_CALIB_ROT_MATRIX_MAX 9
    167 #define RELCAM_CALIB_SURFACE_PARMS_MAX 32
    168 #define RELCAM_CALIB_RESERVED_MAX 50
    169 
    170 #define MAX_NUM_CAMERA_PER_BUNDLE    2 /* Max number of cameras per bundle */
    171 #define EXTRA_FRAME_SYNC_BUFFERS     4 /* Extra frame sync buffers in dc mode*/
    172 #define MM_CAMERA_FRAME_SYNC_NODES   EXTRA_FRAME_SYNC_BUFFERS
    173 
    174 #define MAX_REPROCESS_STALL 2
    175 
    176 #define QCAMERA_MAX_FILEPATH_LENGTH 64
    177 
    178 #define MAX_EEPROM_VERSION_INFO_LEN 128
    179 
    180 #define MAX_OPTICAL_BLACK_REGIONS 5
    181 
    182 /*reprocess pipeline stages are pproc and jpeg */
    183 #define MAX_REPROCESS_PIPELINE_STAGES 2
    184 
    185 /* Defines the number of rows in the color correction matrix (CCM) */
    186 #define AWB_NUM_CCM_ROWS (3)
    187 
    188 /* Defines the number of columns in the color correction matrix (CCM) */
    189 #define AWB_NUM_CCM_COLS (3)
    190 
    191 #define CPU_HAS_READ  (1 << 0)
    192 #define CPU_HAS_WRITTEN  (1 << 1)
    193 #define CPU_HAS_READ_WRITTEN (CPU_HAS_READ |CPU_HAS_WRITTEN)
    194 
    195 /* Index to switch H/W to consume to free-run Q*/
    196 #define CAM_FREERUN_IDX 0xFFFFFFFF
    197 
    198 typedef uint64_t cam_feature_mask_t;
    199 
    200 typedef enum {
    201     CAM_HAL_V1 = 1,
    202     CAM_HAL_V3 = 3
    203 } cam_hal_version_t;
    204 
    205  typedef enum {
    206     CAM_STATUS_INVALID_PARM  = -4, /* Inavlid parameter provided */
    207     CAM_STATUS_NOT_SUPPORTED = -3, /* Parameter/operation not supported */
    208     CAM_STATUS_BUSY          = -2, /* operation busy */
    209     CAM_STATUS_FAILED        = -1, /* Failure in doing operation */
    210     CAM_STATUS_SUCCESS       =  0, /* Operation Succeded */
    211     CAM_STATUS_ACCEPTED      =  1, /* Parameter accepted */
    212     CAM_STATUS_MAX           =  2,
    213 } cam_status_t;
    214 
    215 typedef enum {
    216     /*back main camera*/
    217     CAM_POSITION_BACK,
    218     /*front main camera*/
    219     CAM_POSITION_FRONT,
    220     /*back aux camera*/
    221     CAM_POSITION_BACK_AUX,
    222     /*front aux camera*/
    223     CAM_POSITION_FRONT_AUX
    224 } cam_position_t;
    225 
    226 // Counter clock wise
    227 typedef enum {
    228     ROTATE_0 = 1<<0,
    229     ROTATE_90 = 1<<1,
    230     ROTATE_180 = 1<<2,
    231     ROTATE_270 = 1<<3,
    232 } cam_rotation_t;
    233 
    234 typedef enum {
    235     CAM_LENS_NORMAL,
    236     CAM_LENS_WIDE,
    237     CAM_LENS_TELE
    238 } cam_lens_type_t;
    239 
    240 typedef enum {
    241     CAM_FLICKER_NONE,
    242     CAM_FLICKER_50_HZ,
    243     CAM_FLICKER_60_HZ
    244 } cam_flicker_t;
    245 
    246 typedef enum {
    247     CAM_PD_DATA_DISABLED = 0,
    248     CAM_PD_DATA_ENABLED = 1,
    249     CAM_PD_DATA_SKIP = 2,
    250 } cam_sensor_pd_data_t;
    251 
    252 typedef enum {
    253     CAM_FORMAT_JPEG = 0,
    254     CAM_FORMAT_YUV_420_NV12 = 1,
    255     CAM_FORMAT_YUV_420_NV21,
    256     CAM_FORMAT_YUV_420_NV21_ADRENO,
    257     CAM_FORMAT_YUV_420_YV12,
    258     CAM_FORMAT_YUV_422_NV16,
    259     CAM_FORMAT_YUV_422_NV61,
    260     CAM_FORMAT_YUV_420_NV12_VENUS,
    261     /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */
    262 
    263     /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV.
    264      * U and V are interleaved with Y: YUYV or YVYV */
    265     CAM_FORMAT_YUV_RAW_8BIT_YUYV,
    266     CAM_FORMAT_YUV_RAW_8BIT_YVYU,
    267     CAM_FORMAT_YUV_RAW_8BIT_UYVY, //10
    268     CAM_FORMAT_YUV_RAW_8BIT_VYUY,
    269 
    270     /* QCOM RAW formats where data is packed into 64bit word.
    271      * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is
    272      *       stored at LSB.
    273      * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most
    274      *       significant 4 bits are set to 0. P0 is stored at LSB.
    275      * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most
    276      *       significant 4 bits are set to 0. P0 is stored at LSB. */
    277     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG,
    278     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG,
    279     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB,
    280     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR,
    281     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG,
    282     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG,
    283     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB,
    284     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR,
    285     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG,  //20
    286     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG,
    287     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB,
    288     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR,
    289     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
    290      * 8BPP: Each pixel occupies one bytes, starting at LSB.
    291      *       Output with of image has no restrictons.
    292      * 10BPP: Four pixels are held in every 5 bytes. The output
    293      *       with of image must be a multiple of 4 pixels.
    294      * 12BPP: Two pixels are held in every 3 bytes. The output
    295      *       width of image must be a multiple of 2 pixels. */
    296     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG,
    297     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG,
    298     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB,
    299     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR,
    300     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG,
    301     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG,
    302     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB, //30
    303     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR,
    304     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG,
    305     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG,
    306     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB,
    307     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR,
    308     /* Ideal raw formats where image data has gone through black
    309      * correction, lens rolloff, demux/channel gain, bad pixel
    310      * correction, and ABF.
    311      * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW
    312      * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and
    313      * plain 16 12bpp */
    314     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG,
    315     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG,
    316     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB,
    317     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR,
    318     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG, //40
    319     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG,
    320     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB,
    321     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR,
    322     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG,
    323     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG,
    324     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB,
    325     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR,
    326     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG,
    327     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG,
    328     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB, //50
    329     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR,
    330     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG,
    331     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG,
    332     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB,
    333     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR,
    334     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG,
    335     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG,
    336     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB,
    337     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR,
    338     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG, //60
    339     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG,
    340     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB,
    341     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR,
    342     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG,
    343     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG,
    344     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB,
    345     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR,
    346     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG,
    347     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG,
    348     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB, //70
    349     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR,
    350     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG,
    351     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG,
    352     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB,
    353     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR,
    354 
    355     /* generic 8-bit raw */
    356     CAM_FORMAT_JPEG_RAW_8BIT,
    357     CAM_FORMAT_META_RAW_8BIT,
    358 
    359     /* generic 10-bit raw */
    360     CAM_FORMAT_META_RAW_10BIT,
    361 
    362     /* QCOM RAW formats where data is packed into 64bit word.
    363      * 14BPP: 1 64-bit word contains 4 pixels p0 - p3, where most
    364      *       significant 4 bits are set to 0. P0 is stored at LSB.
    365      */
    366     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GBRG,
    367     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GRBG,
    368     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_RGGB, //80
    369     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_BGGR,
    370     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
    371      * 14 BPPP: 1st byte: P0 [13:6]
    372      *          2nd byte: P1 [13:6]
    373      *          3rd byte: P2 [13:6]
    374      *          4th byte: P3 [13:6]
    375      *          5th byte: P0 [5:0]
    376      *          7th byte: P1 [5:0]
    377      *          8th byte: P2 [5:0]
    378      *          9th byte: P3 [5:0]
    379      */
    380     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GBRG,
    381     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GRBG,
    382     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_RGGB,
    383     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_BGGR,
    384     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GBRG,
    385     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GRBG,
    386     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_RGGB,
    387     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_BGGR,
    388     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GBRG, //90
    389     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GRBG,
    390     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_RGGB,
    391     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_BGGR,
    392     /* 14BPP: 1st byte: P0 [8:0]
    393      *        2nd byte: P0 [13:9]
    394      *        3rd byte: P1 [8:0]
    395      *        4th byte: P1 [13:9]
    396      */
    397     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GBRG,
    398     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GRBG,
    399     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_RGGB,
    400     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_BGGR,
    401 
    402     CAM_FORMAT_YUV_444_NV24,
    403     CAM_FORMAT_YUV_444_NV42,
    404 
    405     /* Y plane only, used for FD, 8BPP */
    406     CAM_FORMAT_Y_ONLY, //100
    407 
    408     /* UBWC format */
    409     CAM_FORMAT_YUV_420_NV12_UBWC,
    410 
    411     CAM_FORMAT_YUV_420_NV21_VENUS,
    412 
    413     /* RGB formats */
    414     CAM_FORMAT_8888_ARGB,
    415 
    416     /* Y plane only */
    417     CAM_FORMAT_Y_ONLY_10_BPP,
    418     CAM_FORMAT_Y_ONLY_12_BPP,
    419     CAM_FORMAT_Y_ONLY_14_BPP,
    420     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GREY,
    421     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GREY,
    422     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GREY,
    423     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GREY,
    424     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GREY,
    425     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GREY,
    426     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GREY,
    427     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GREY,
    428     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GREY,
    429     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GREY,
    430     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GREY,
    431     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GREY,
    432     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GREY,
    433     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GREY,
    434     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GREY,
    435     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GREY,
    436 
    437     CAM_FORMAT_MAX
    438 } cam_format_t;
    439 
    440 typedef enum {
    441     CAM_FORMAT_SUBTYPE_HDR_STATS,
    442     CAM_FORMAT_SUBTYPE_PDAF_STATS,
    443     CAM_FORMAT_SUBTYPE_MAX
    444 } cam_sub_format_type_t;
    445 
    446 typedef enum {
    447     CAM_STREAM_TYPE_DEFAULT,       /* default stream type */
    448     CAM_STREAM_TYPE_PREVIEW,       /* preview */
    449     CAM_STREAM_TYPE_POSTVIEW,      /* postview */
    450     CAM_STREAM_TYPE_SNAPSHOT,      /* snapshot */
    451     CAM_STREAM_TYPE_VIDEO,         /* video */
    452     CAM_STREAM_TYPE_CALLBACK,      /* app requested callback */
    453     CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */
    454     CAM_STREAM_TYPE_METADATA,      /* meta data */
    455     CAM_STREAM_TYPE_RAW,           /* raw dump from camif */
    456     CAM_STREAM_TYPE_OFFLINE_PROC,  /* offline process */
    457     CAM_STREAM_TYPE_PARM,         /* mct internal stream */
    458     CAM_STREAM_TYPE_ANALYSIS,     /* analysis stream */
    459     CAM_STREAM_TYPE_MAX,
    460 } cam_stream_type_t;
    461 
    462 typedef enum {
    463     CAM_PAD_NONE = 1,
    464     CAM_PAD_TO_2 = 2,
    465     CAM_PAD_TO_4 = 4,
    466     CAM_PAD_TO_WORD = CAM_PAD_TO_4,
    467     CAM_PAD_TO_8 = 8,
    468     CAM_PAD_TO_16 = 16,
    469     CAM_PAD_TO_32 = 32,
    470     CAM_PAD_TO_64 = 64,
    471     CAM_PAD_TO_128 = 128,
    472     CAM_PAD_TO_256 = 256,
    473     CAM_PAD_TO_512 = 512,
    474     CAM_PAD_TO_1K = 1024,
    475     CAM_PAD_TO_2K = 2048,
    476     CAM_PAD_TO_4K = 4096,
    477     CAM_PAD_TO_8K = 8192
    478 } cam_pad_format_t;
    479 
    480 typedef enum {
    481     /* followings are per camera */
    482     CAM_MAPPING_BUF_TYPE_CAPABILITY,  /* mapping camera capability buffer */
    483     CAM_MAPPING_BUF_TYPE_PARM_BUF,    /* mapping parameters buffer */
    484     /* this buffer is needed for the payload to be sent with bundling related cameras cmd */
    485     CAM_MAPPING_BUF_TYPE_SYNC_RELATED_SENSORS_BUF, /* mapping sync buffer.*/
    486     CAM_MAPPING_BUF_TYPE_DUAL_CAM_CMD_BUF, /*Dual camera cmd ion memory*/
    487 
    488     /* followings are per stream */
    489     CAM_MAPPING_BUF_TYPE_STREAM_BUF,        /* mapping stream buffers */
    490     CAM_MAPPING_BUF_TYPE_STREAM_INFO,       /* mapping stream information buffer */
    491     CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */
    492     CAM_MAPPING_BUF_TYPE_OFFLINE_META_BUF,  /* mapping offline meta buffer */
    493     CAM_MAPPING_BUF_TYPE_MISC_BUF,          /* mapping offline miscellaneous buffer */
    494     CAM_MAPPING_BUF_TYPE_STREAM_USER_BUF,   /* mapping user ptr stream buffers */
    495     CAM_MAPPING_BUF_TYPE_MAX
    496 } cam_mapping_buf_type;
    497 
    498 typedef enum {
    499     CAM_STREAM_BUF_TYPE_MPLANE,  /* Multiplanar Buffer type */
    500     CAM_STREAM_BUF_TYPE_USERPTR, /* User specific structure pointer*/
    501     CAM_STREAM_BUF_TYPE_MAX
    502 } cam_stream_buf_type;
    503 
    504 typedef struct {
    505     cam_mapping_buf_type type;
    506     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
    507     uint32_t frame_idx;   /* frame index: valid if type is STREAM_BUF */
    508     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
    509                            * -1 means all planners shanre the same fd;
    510                            * otherwise, each planner has its own fd */
    511     uint32_t cookie;      /* could be job_id(uint32_t) to identify mapping job */
    512     int32_t fd;           /* origin fd */
    513     size_t size;          /* size of the buffer */
    514     void *buffer;         /* Buffer pointer */
    515 } cam_buf_map_type;
    516 
    517 typedef struct {
    518     uint32_t length;
    519     cam_buf_map_type buf_maps[CAM_MAX_NUM_BUFS_PER_STREAM];
    520 } cam_buf_map_type_list;
    521 
    522 typedef struct {
    523     cam_mapping_buf_type type;
    524     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
    525     uint32_t frame_idx;   /* frame index: valid if STREAM_BUF or HIST_BUF */
    526     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
    527                            * -1 means all planners shanre the same fd;
    528                            * otherwise, each planner has its own fd */
    529     uint32_t cookie;      /* could be job_id(uint32_t) to identify unmapping job */
    530 } cam_buf_unmap_type;
    531 
    532 typedef struct {
    533     uint32_t length;
    534     cam_buf_unmap_type buf_unmaps[CAM_MAX_NUM_BUFS_PER_STREAM];
    535 } cam_buf_unmap_type_list;
    536 
    537 typedef enum {
    538     CAM_MAPPING_TYPE_FD_MAPPING,
    539     CAM_MAPPING_TYPE_FD_UNMAPPING,
    540     CAM_MAPPING_TYPE_FD_BUNDLED_MAPPING,
    541     CAM_MAPPING_TYPE_FD_BUNDLED_UNMAPPING,
    542     CAM_MAPPING_TYPE_MAX
    543 } cam_mapping_type;
    544 
    545 typedef struct {
    546     cam_mapping_type msg_type;
    547     union {
    548         cam_buf_map_type buf_map;
    549         cam_buf_unmap_type buf_unmap;
    550         cam_buf_map_type_list buf_map_list;
    551         cam_buf_unmap_type_list buf_unmap_list;
    552     } payload;
    553 } cam_sock_packet_t;
    554 typedef cam_sock_packet_t cam_reg_buf_t;
    555 
    556 typedef enum {
    557     CAM_MODE_2D = (1<<0),
    558     CAM_MODE_3D = (1<<1)
    559 } cam_mode_t;
    560 
    561 typedef struct {
    562     uint32_t len;
    563     uint32_t y_offset;
    564     uint32_t cbcr_offset;
    565 } cam_sp_len_offset_t;
    566 
    567 typedef struct{
    568     uint32_t len;
    569     uint32_t offset;
    570     int32_t offset_x;
    571     int32_t offset_y;
    572     int32_t stride;
    573     int32_t stride_in_bytes;
    574     int32_t scanline;
    575     int32_t width;    /* width without padding */
    576     int32_t height;   /* height without padding */
    577     int32_t meta_stride;   /*Meta stride*/
    578     int32_t meta_scanline; /*Meta Scanline*/
    579     int32_t meta_len;   /*Meta plane length including 4k padding*/
    580 } cam_mp_len_offset_t;
    581 
    582 typedef struct {
    583     uint32_t offset_x;
    584     uint32_t offset_y;
    585 } cam_offset_info_t;
    586 
    587 typedef struct {
    588     uint32_t width_padding;
    589     uint32_t height_padding;
    590     uint32_t plane_padding;
    591     uint32_t min_stride;
    592     uint32_t min_scanline;
    593     cam_offset_info_t offset_info;
    594 } cam_padding_info_t;
    595 
    596 typedef struct {
    597     uint32_t num_planes;    /*Number of planes in planar buffer*/
    598     union {
    599         cam_sp_len_offset_t sp;
    600         cam_mp_len_offset_t mp[VIDEO_MAX_PLANES];
    601     };
    602     uint32_t frame_len;
    603 } cam_frame_len_offset_t;
    604 
    605 typedef struct {
    606     uint8_t frame_buf_cnt;  /*Total plane frames present in 1 batch*/
    607     uint32_t size;          /*Size of 1 batch buffer. Kernel structure size*/
    608     long frameInterval;     /*frame interval between each frame*/
    609 } cam_stream_user_buf_info_t;
    610 
    611 typedef struct {
    612     int32_t width;
    613     int32_t height;
    614 } cam_dimension_t;
    615 
    616 typedef struct {
    617     cam_dimension_t active_array_size; // Size of the active array.
    618     cam_dimension_t pixel_array_size;  // Size of the pixel array.
    619     uint32_t op_pixel_clk;             // Sensor output rate.
    620     uint32_t num_raw_bits;             // Number of bits for RAW. 0 if not RAW.
    621     int64_t  timestamp_offset;         // Timestamp offset with gyro sensor. 0 if uncalibrated.
    622     int64_t  timestamp_crop_offset;    // Timestamp offset due to crop on top of active array.
    623 } cam_sensor_mode_info_t;
    624 
    625 typedef struct {
    626     uint16_t left_gain_map[MAX_PDAF_CALIB_GAINS];
    627     uint16_t right_gain_map[MAX_PDAF_CALIB_GAINS];
    628     int16_t conversion_coeff[MAX_PDAF_CALIB_COEFF];
    629 } cam_pd_calibration_t;
    630 
    631 typedef struct {
    632     cam_frame_len_offset_t plane_info;
    633 } cam_stream_buf_plane_info_t;
    634 
    635 typedef struct {
    636     float min_fps;
    637     float max_fps;
    638     float video_min_fps;
    639     float video_max_fps;
    640 } cam_fps_range_t;
    641 
    642 typedef struct {
    643     int32_t min_sensitivity;
    644     int32_t max_sensitivity;
    645 } cam_sensitivity_range_t;
    646 
    647 typedef enum {
    648     CAM_ISO_PRIORITY,
    649     CAM_EXP_PRIORITY,
    650     CAM_DEFAULT_OFF,
    651 } cam_priority_mode_t;
    652 
    653 typedef enum {
    654     CAM_HFR_MODE_OFF,
    655     CAM_HFR_MODE_60FPS,
    656     CAM_HFR_MODE_90FPS,
    657     CAM_HFR_MODE_120FPS,
    658     CAM_HFR_MODE_150FPS,
    659     CAM_HFR_MODE_180FPS,
    660     CAM_HFR_MODE_210FPS,
    661     CAM_HFR_MODE_240FPS,
    662     CAM_HFR_MODE_480FPS,
    663     CAM_HFR_MODE_MAX
    664 } cam_hfr_mode_t;
    665 
    666 typedef struct {
    667     cam_hfr_mode_t mode;
    668     uint8_t dim_cnt;                                        /* hfr sizes table count */
    669     cam_dimension_t dim[MAX_SIZES_CNT];                     /* hfr sizes table */
    670     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table count */
    671     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
    672 } cam_hfr_info_t;
    673 
    674 typedef enum {
    675     CAM_WB_MODE_AUTO,
    676     CAM_WB_MODE_CUSTOM,
    677     CAM_WB_MODE_INCANDESCENT,
    678     CAM_WB_MODE_FLUORESCENT,
    679     CAM_WB_MODE_WARM_FLUORESCENT,
    680     CAM_WB_MODE_DAYLIGHT,
    681     CAM_WB_MODE_CLOUDY_DAYLIGHT,
    682     CAM_WB_MODE_TWILIGHT,
    683     CAM_WB_MODE_SHADE,
    684     CAM_WB_MODE_MANUAL,
    685     CAM_WB_MODE_OFF,
    686     CAM_WB_MODE_MAX
    687 } cam_wb_mode_type;
    688 
    689 typedef enum {
    690     CAM_ANTIBANDING_MODE_OFF,
    691     CAM_ANTIBANDING_MODE_60HZ,
    692     CAM_ANTIBANDING_MODE_50HZ,
    693     CAM_ANTIBANDING_MODE_AUTO,
    694     CAM_ANTIBANDING_MODE_AUTO_50HZ,
    695     CAM_ANTIBANDING_MODE_AUTO_60HZ,
    696     CAM_ANTIBANDING_MODE_MAX,
    697 } cam_antibanding_mode_type;
    698 
    699 /* Enum Type for different ISO Mode supported */
    700 typedef enum {
    701     CAM_ISO_MODE_AUTO,
    702     CAM_ISO_MODE_DEBLUR,
    703     CAM_ISO_MODE_100,
    704     CAM_ISO_MODE_200,
    705     CAM_ISO_MODE_400,
    706     CAM_ISO_MODE_800,
    707     CAM_ISO_MODE_1600,
    708     CAM_ISO_MODE_3200,
    709     CAM_ISO_MODE_MAX
    710 } cam_iso_mode_type;
    711 
    712 typedef enum {
    713     CAM_AEC_MODE_FRAME_AVERAGE,
    714     CAM_AEC_MODE_CENTER_WEIGHTED,
    715     CAM_AEC_MODE_SPOT_METERING,
    716     CAM_AEC_MODE_SMART_METERING,
    717     CAM_AEC_MODE_USER_METERING,
    718     CAM_AEC_MODE_SPOT_METERING_ADV,
    719     CAM_AEC_MODE_CENTER_WEIGHTED_ADV,
    720     CAM_AEC_MODE_MAX
    721 } cam_auto_exposure_mode_type;
    722 
    723 /* enum to select AEC convergence type */
    724 typedef enum {
    725     /* Normal AEC connvergence */
    726     CAM_AEC_NORMAL_CONVERGENCE = 0,
    727     /* Aggressive AEC connvergence */
    728     CAM_AEC_AGGRESSIVE_CONVERGENCE,
    729     /* Fast AEC convergence */
    730     CAM_AEC_FAST_CONVERGENCE,
    731     CAM_AEC_CONVERGENCE_MAX
    732 } cam_aec_convergence_type;
    733 
    734 typedef enum {
    735     CAM_AE_MODE_OFF,
    736     CAM_AE_MODE_ON,
    737     CAM_AE_MODE_ON_EXTERNAL_FLASH,
    738     CAM_AE_MODE_MAX
    739 } cam_ae_mode_type;
    740 
    741 typedef enum {
    742     CAM_FOCUS_ALGO_AUTO,
    743     CAM_FOCUS_ALGO_SPOT,
    744     CAM_FOCUS_ALGO_CENTER_WEIGHTED,
    745     CAM_FOCUS_ALGO_AVERAGE,
    746     CAM_FOCUS_ALGO_MAX
    747 } cam_focus_algorithm_type;
    748 
    749 /* Auto focus mode */
    750 typedef enum {
    751     CAM_FOCUS_MODE_OFF,
    752     CAM_FOCUS_MODE_AUTO,
    753     CAM_FOCUS_MODE_INFINITY,
    754     CAM_FOCUS_MODE_MACRO,
    755     CAM_FOCUS_MODE_FIXED,
    756     CAM_FOCUS_MODE_EDOF,
    757     CAM_FOCUS_MODE_CONTINOUS_VIDEO,
    758     CAM_FOCUS_MODE_CONTINOUS_PICTURE,
    759     CAM_FOCUS_MODE_MANUAL,
    760     CAM_FOCUS_MODE_MAX
    761 } cam_focus_mode_type;
    762 
    763 typedef enum {
    764     CAM_MANUAL_FOCUS_MODE_INDEX,
    765     CAM_MANUAL_FOCUS_MODE_DAC_CODE,
    766     CAM_MANUAL_FOCUS_MODE_RATIO,
    767     CAM_MANUAL_FOCUS_MODE_DIOPTER,
    768     CAM_MANUAL_FOCUS_MODE_MAX
    769 } cam_manual_focus_mode_type;
    770 
    771 typedef struct {
    772     cam_manual_focus_mode_type flag;
    773     union{
    774         int32_t af_manual_lens_position_index;
    775         int32_t af_manual_lens_position_dac;
    776         int32_t af_manual_lens_position_ratio;
    777         float af_manual_diopter;
    778     };
    779 } cam_manual_focus_parm_t;
    780 
    781 typedef enum {
    782     CAM_MANUAL_WB_MODE_CCT,
    783     CAM_MANUAL_WB_MODE_GAIN,
    784     CAM_MANUAL_WB_MODE_MAX
    785 } cam_manual_wb_mode_type;
    786 
    787 typedef struct {
    788     float r_gain;
    789     float g_gain;
    790     float b_gain;
    791 } cam_awb_gain_t;
    792 
    793 typedef struct {
    794     cam_manual_wb_mode_type type;
    795     union{
    796         int32_t cct;
    797         cam_awb_gain_t gains;
    798     };
    799 } cam_manual_wb_parm_t;
    800 
    801 typedef enum {
    802     CAM_SCENE_MODE_OFF,
    803     CAM_SCENE_MODE_AUTO,
    804     CAM_SCENE_MODE_LANDSCAPE,
    805     CAM_SCENE_MODE_SNOW,
    806     CAM_SCENE_MODE_BEACH,
    807     CAM_SCENE_MODE_SUNSET,
    808     CAM_SCENE_MODE_NIGHT,
    809     CAM_SCENE_MODE_PORTRAIT,
    810     CAM_SCENE_MODE_BACKLIGHT,
    811     CAM_SCENE_MODE_SPORTS,
    812     CAM_SCENE_MODE_ANTISHAKE,
    813     CAM_SCENE_MODE_FLOWERS,
    814     CAM_SCENE_MODE_CANDLELIGHT,
    815     CAM_SCENE_MODE_FIREWORKS,
    816     CAM_SCENE_MODE_PARTY,
    817     CAM_SCENE_MODE_NIGHT_PORTRAIT,
    818     CAM_SCENE_MODE_THEATRE,
    819     CAM_SCENE_MODE_ACTION,
    820     CAM_SCENE_MODE_AR,
    821     CAM_SCENE_MODE_FACE_PRIORITY,
    822     CAM_SCENE_MODE_BARCODE,
    823     CAM_SCENE_MODE_HDR,
    824     CAM_SCENE_MODE_AQUA,
    825     CAM_SCENE_MODE_MAX
    826 } cam_scene_mode_type;
    827 
    828 typedef enum {
    829     CAM_EFFECT_MODE_OFF,
    830     CAM_EFFECT_MODE_MONO,
    831     CAM_EFFECT_MODE_NEGATIVE,
    832     CAM_EFFECT_MODE_SOLARIZE,
    833     CAM_EFFECT_MODE_SEPIA,
    834     CAM_EFFECT_MODE_POSTERIZE,
    835     CAM_EFFECT_MODE_WHITEBOARD,
    836     CAM_EFFECT_MODE_BLACKBOARD,
    837     CAM_EFFECT_MODE_AQUA,
    838     CAM_EFFECT_MODE_EMBOSS,
    839     CAM_EFFECT_MODE_SKETCH,
    840     CAM_EFFECT_MODE_NEON,
    841     CAM_EFFECT_MODE_BEAUTY,
    842     CAM_EFFECT_MODE_MAX
    843 } cam_effect_mode_type;
    844 
    845 typedef enum {
    846     CAM_FLASH_MODE_OFF,
    847     CAM_FLASH_MODE_AUTO,
    848     CAM_FLASH_MODE_ON,
    849     CAM_FLASH_MODE_TORCH,
    850     CAM_FLASH_MODE_SINGLE,
    851     CAM_FLASH_MODE_MAX
    852 } cam_flash_mode_t;
    853 
    854 // Flash States
    855 typedef enum {
    856     CAM_FLASH_STATE_UNAVAILABLE,
    857     CAM_FLASH_STATE_CHARGING,
    858     CAM_FLASH_STATE_READY,
    859     CAM_FLASH_STATE_FIRED,
    860     CAM_FLASH_STATE_PARTIAL,
    861     CAM_FLASH_STATE_MAX
    862 } cam_flash_state_t;
    863 
    864 typedef enum {
    865     CAM_FLASH_FIRING_LEVEL_0,
    866     CAM_FLASH_FIRING_LEVEL_1,
    867     CAM_FLASH_FIRING_LEVEL_2,
    868     CAM_FLASH_FIRING_LEVEL_3,
    869     CAM_FLASH_FIRING_LEVEL_4,
    870     CAM_FLASH_FIRING_LEVEL_5,
    871     CAM_FLASH_FIRING_LEVEL_6,
    872     CAM_FLASH_FIRING_LEVEL_7,
    873     CAM_FLASH_FIRING_LEVEL_8,
    874     CAM_FLASH_FIRING_LEVEL_9,
    875     CAM_FLASH_FIRING_LEVEL_10,
    876     CAM_FLASH_FIRING_LEVEL_MAX
    877 } cam_flash_firing_level_t;
    878 
    879 
    880 typedef enum {
    881     CAM_AEC_TRIGGER_IDLE,
    882     CAM_AEC_TRIGGER_START
    883 } cam_aec_trigger_type_t;
    884 
    885 typedef enum {
    886     CAM_AF_TRIGGER_IDLE,
    887     CAM_AF_TRIGGER_START,
    888     CAM_AF_TRIGGER_CANCEL
    889 } cam_af_trigger_type_t;
    890 
    891 // This enum must match nexus_experimental_2017_tracking_af_trigger
    892 typedef enum {
    893     CAM_TRACKING_AF_TRIGGER_IDLE,
    894     CAM_TRACKING_AF_TRIGGER_START,
    895     CAM_TRACKING_AF_TRIGGER_STOP,
    896 } cam_tracking_af_trigger_t;
    897 
    898 typedef enum {
    899     CAM_AE_STATE_INACTIVE,
    900     CAM_AE_STATE_SEARCHING,
    901     CAM_AE_STATE_CONVERGED,
    902     CAM_AE_STATE_LOCKED,
    903     CAM_AE_STATE_FLASH_REQUIRED,
    904     CAM_AE_STATE_PRECAPTURE
    905 } cam_ae_state_t;
    906 
    907 typedef enum {
    908     CAM_NOISE_REDUCTION_MODE_OFF,
    909     CAM_NOISE_REDUCTION_MODE_FAST,
    910     CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY,
    911     CAM_NOISE_REDUCTION_MODE_MINIMAL,
    912     CAM_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
    913 } cam_noise_reduction_mode_t;
    914 
    915 typedef enum {
    916     CAM_EDGE_MODE_OFF,
    917     CAM_EDGE_MODE_FAST,
    918     CAM_EDGE_MODE_HIGH_QUALITY,
    919     CAM_EDGE_MODE_ZERO_SHUTTER_LAG,
    920 } cam_edge_mode_t;
    921 
    922 typedef struct {
    923    uint8_t edge_mode;
    924    int32_t sharpness;
    925 } cam_edge_application_t;
    926 
    927 typedef enum {
    928     CAM_BLACK_LEVEL_LOCK_OFF,
    929     CAM_BLACK_LEVEL_LOCK_ON,
    930 } cam_black_level_lock_t;
    931 
    932 typedef enum {
    933     CAM_HOTPIXEL_MODE_OFF,
    934     CAM_HOTPIXEL_MODE_FAST,
    935     CAM_HOTPIXEL_MODE_HIGH_QUALITY,
    936 } cam_hotpixel_mode_t;
    937 
    938 typedef enum {
    939     CAM_LENS_SHADING_MAP_MODE_OFF,
    940     CAM_LENS_SHADING_MAP_MODE_ON,
    941 } cam_lens_shading_map_mode_t;
    942 
    943 typedef enum {
    944     CAM_LENS_SHADING_MODE_OFF,
    945     CAM_LENS_SHADING_MODE_FAST,
    946     CAM_LENS_SHADING_MODE_HIGH_QUALITY,
    947 } cam_lens_shading_mode_t;
    948 
    949 typedef enum {
    950     CAM_FACE_DETECT_MODE_OFF,
    951     CAM_FACE_DETECT_MODE_SIMPLE,
    952     CAM_FACE_DETECT_MODE_FULL,
    953 } cam_face_detect_mode_t;
    954 
    955 typedef enum {
    956     CAM_TONEMAP_MODE_CONTRAST_CURVE,
    957     CAM_TONEMAP_MODE_FAST,
    958     CAM_TONEMAP_MODE_HIGH_QUALITY,
    959 } cam_tonemap_mode_t;
    960 
    961 typedef enum {
    962     CAM_CDS_MODE_OFF,
    963     CAM_CDS_MODE_ON,
    964     CAM_CDS_MODE_AUTO,
    965     CAM_CDS_MODE_LOCK,
    966     CAM_CDS_MODE_MAX
    967 } cam_cds_mode_type_t;
    968 
    969 typedef enum {
    970     CAM_IR_MODE_OFF,
    971     CAM_IR_MODE_ON,
    972     CAM_IR_MODE_AUTO,
    973     CAM_IR_MODE_MAX
    974 } cam_ir_mode_type_t;
    975 
    976 typedef enum {
    977     CAM_SENSOR_HDR_OFF,
    978     CAM_SENSOR_HDR_IN_SENSOR = 1,
    979     CAM_SENSOR_HDR_ZIGZAG,
    980     CAM_SENSOR_HDR_STAGGERED,
    981     CAM_SENSOR_HDR_MAX,
    982 } cam_sensor_hdr_type_t;
    983 
    984 typedef enum {
    985     CAM_VIDEO_HDR_MODE_OFF,
    986     CAM_VIDEO_HDR_MODE_ON,
    987     CAM_VIDEO_HDR_MODE_MAX,
    988 } cam_video_hdr_mode_t;
    989 
    990 typedef enum {
    991     CAM_BINNING_CORRECTION_MODE_OFF,
    992     CAM_BINNING_CORRECTION_MODE_ON,
    993     CAM_BINNING_CORRECTION_MODE_MAX,
    994 } cam_binning_correction_mode_t;
    995 
    996 typedef struct {
    997     uint32_t size;
    998     uint8_t data[OIS_DATA_MAX_SIZE];
    999 } cam_ois_data_t;
   1000 
   1001 typedef struct {
   1002     int64_t frame_sof_timestamp_boottime;
   1003     int32_t num_ois_sample;
   1004     int64_t ois_sample_timestamp_boottime[MAX_OIS_SAMPLE_NUM_PER_FRAME];
   1005     float ois_sample_shift_pixel_x[MAX_OIS_SAMPLE_NUM_PER_FRAME];
   1006     float ois_sample_shift_pixel_y[MAX_OIS_SAMPLE_NUM_PER_FRAME];
   1007 } cam_frame_ois_info_t;
   1008 
   1009 typedef struct  {
   1010     int32_t left;
   1011     int32_t top;
   1012     int32_t width;
   1013     int32_t height;
   1014 } cam_rect_t;
   1015 
   1016 typedef struct  {
   1017     cam_rect_t rect;
   1018     int32_t weight; /* weight of the area, valid for focusing/metering areas */
   1019 } cam_area_t;
   1020 
   1021 typedef enum {
   1022     CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */
   1023     CAM_STREAMING_MODE_BURST,      /* burst streaming */
   1024     CAM_STREAMING_MODE_BATCH,      /* stream frames in batches */
   1025     CAM_STREAMING_MODE_MAX
   1026 } cam_streaming_mode_t;
   1027 
   1028 typedef enum {
   1029     IS_TYPE_NONE,
   1030     IS_TYPE_CROP,
   1031     IS_TYPE_DIS,
   1032     IS_TYPE_GA_DIS,
   1033     IS_TYPE_EIS_2_0,
   1034     IS_TYPE_EIS_3_0,
   1035     IS_TYPE_MAX
   1036 } cam_is_type_t;
   1037 
   1038 typedef enum {
   1039     DIS_DISABLE,
   1040     DIS_ENABLE
   1041 } cam_dis_mode_t;
   1042 
   1043 typedef enum {
   1044   NON_SECURE,
   1045   SECURE
   1046 } cam_stream_secure_t;
   1047 
   1048 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0)
   1049 
   1050 /* event from server */
   1051 typedef enum {
   1052     CAM_EVENT_TYPE_MAP_UNMAP_DONE  = (1<<0),
   1053     CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1),
   1054     CAM_EVENT_TYPE_ZOOM_DONE       = (1<<2),
   1055     CAM_EVENT_TYPE_DAEMON_DIED     = (1<<3),
   1056     CAM_EVENT_TYPE_INT_TAKE_JPEG   = (1<<4),
   1057     CAM_EVENT_TYPE_INT_TAKE_RAW    = (1<<5),
   1058     CAM_EVENT_TYPE_DAEMON_PULL_REQ = (1<<6),
   1059     CAM_EVENT_TYPE_CAC_DONE        = (1<<7),
   1060     CAM_EVENT_TYPE_MAX
   1061 } cam_event_type_t;
   1062 
   1063 typedef enum {
   1064     CAM_EXP_BRACKETING_OFF,
   1065     CAM_EXP_BRACKETING_ON
   1066 } cam_bracket_mode;
   1067 
   1068 typedef enum {
   1069     CAM_LOW_LIGHT_OFF = 0,
   1070     CAM_LOW_LIGHT_ON,
   1071 } cam_low_light_mode_t;
   1072 
   1073 typedef struct {
   1074     cam_bracket_mode mode;
   1075     char values[MAX_EXP_BRACKETING_LENGTH];  /* user defined values */
   1076 } cam_exp_bracketing_t;
   1077 
   1078 typedef struct {
   1079   uint32_t num_frames;
   1080   cam_exp_bracketing_t exp_val;
   1081 } cam_hdr_bracketing_info_t;
   1082 
   1083  typedef struct {
   1084     cam_bracket_mode mode;
   1085     int32_t values;  /* user defined values */
   1086 } cam_capture_bracketing_t;
   1087 
   1088 typedef enum {
   1089     CAM_SETTINGS_TYPE_OFF,
   1090     CAM_SETTINGS_TYPE_ON,
   1091     CAM_SETTINGS_TYPE_AUTO
   1092 } cam_manual_setting_mode;
   1093 
   1094 typedef struct {
   1095     cam_manual_setting_mode exp_mode;
   1096     int64_t exp_time;
   1097     cam_manual_setting_mode iso_mode;
   1098     int32_t iso_value;
   1099 } cam_capture_manual_3A_t;
   1100 
   1101 typedef enum {
   1102     CAM_CAPTURE_NORMAL,
   1103     CAM_CAPTURE_FLASH,
   1104     CAM_CAPTURE_BRACKETING,
   1105     CAM_CAPTURE_LOW_LIGHT,
   1106     CAM_CAPTURE_RESET,
   1107     CAM_CAPTURE_MANUAL_3A,
   1108     CAM_CAPTURE_LED_CAL,
   1109     CAM_CAPTURE_MAX
   1110 } cam_capture_type;
   1111 
   1112 typedef struct {
   1113     int32_t num_frames;     /*Num of frames requested on this quality*/
   1114     cam_capture_type type;  /*type of the capture request*/
   1115 
   1116     /*union to strore values of capture type*/
   1117     union {
   1118         cam_flash_mode_t flash_mode;
   1119         cam_capture_bracketing_t hdr_mode;
   1120         cam_low_light_mode_t low_light_mode;
   1121         cam_capture_manual_3A_t manual_3A_mode;
   1122     };
   1123 } cam_capture_settings_t;
   1124 
   1125 typedef struct {
   1126     uint32_t num_batch;  /*Number of frames batch requested*/
   1127     cam_capture_settings_t configs[MAX_CAPTURE_BATCH_NUM];
   1128 } cam_capture_frame_config_t;
   1129 
   1130 typedef struct {
   1131     uint8_t stepsize;
   1132     uint8_t direction;
   1133     int32_t num_steps;
   1134     uint8_t ttype;
   1135 } tune_actuator_t;
   1136 
   1137 typedef struct {
   1138     uint8_t module;
   1139     uint8_t type;
   1140     int32_t value;
   1141 } tune_cmd_t;
   1142 
   1143 typedef enum {
   1144     CAM_AEC_ROI_OFF,
   1145     CAM_AEC_ROI_ON
   1146 } cam_aec_roi_ctrl_t;
   1147 
   1148 typedef enum {
   1149     CAM_AEC_ROI_BY_INDEX,
   1150     CAM_AEC_ROI_BY_COORDINATE,
   1151 } cam_aec_roi_type_t;
   1152 
   1153 typedef struct {
   1154     uint32_t x;
   1155     uint32_t y;
   1156 } cam_coordinate_type_t;
   1157 
   1158 typedef struct {
   1159     int32_t numerator;
   1160     int32_t denominator;
   1161 } cam_rational_type_t;
   1162 
   1163 typedef struct {
   1164     cam_aec_roi_ctrl_t aec_roi_enable;
   1165     cam_aec_roi_type_t aec_roi_type;
   1166     uint8_t num_roi;
   1167     union {
   1168         cam_coordinate_type_t coordinate[MAX_ROI];
   1169         uint32_t aec_roi_idx[MAX_ROI];
   1170     } cam_aec_roi_position;
   1171 } cam_set_aec_roi_t;
   1172 
   1173 typedef struct {
   1174     uint32_t frm_id;
   1175     uint8_t num_roi;
   1176     cam_rect_t roi[MAX_ROI];
   1177     int32_t weight[MAX_ROI];
   1178     uint8_t is_multiwindow;
   1179 } cam_roi_info_t;
   1180 
   1181 typedef enum {
   1182     CAM_WAVELET_DENOISE_YCBCR_PLANE,
   1183     CAM_WAVELET_DENOISE_CBCR_ONLY,
   1184     CAM_WAVELET_DENOISE_STREAMLINE_YCBCR,
   1185     CAM_WAVELET_DENOISE_STREAMLINED_CBCR
   1186 } cam_denoise_process_type_t;
   1187 
   1188 typedef struct {
   1189     uint8_t denoise_enable;
   1190     cam_denoise_process_type_t process_plates;
   1191 } cam_denoise_param_t;
   1192 
   1193 #define CAM_FACE_PROCESS_MASK_DETECTION     (1U<<0)
   1194 #define CAM_FACE_PROCESS_MASK_RECOGNITION   (1U<<1)
   1195 #define CAM_FACE_PROCESS_MASK_FOCUS         (1U<<2)
   1196 #define CAM_FACE_PROCESS_MASK_BLINK         (1U<<3)
   1197 #define CAM_FACE_PROCESS_MASK_SMILE         (1U<<4)
   1198 #define CAM_FACE_PROCESS_MASK_GAZE          (1U<<5)
   1199 
   1200 /* Keep this in sync with invalid landmark value : system/core/include/system/camera.h */
   1201 #define FACE_INVALID_POINT -2000
   1202 
   1203 typedef struct {
   1204     uint32_t fd_mode;          /* mask of face process */
   1205     uint32_t num_fd;
   1206 } cam_fd_set_parm_t;
   1207 
   1208 typedef enum {
   1209     QCAMERA_FD_PREVIEW,
   1210     QCAMERA_FD_SNAPSHOT
   1211 }qcamera_face_detect_type_t;
   1212 
   1213 typedef enum {
   1214     CAM_FACE_CT_POINT_EYE_L_PUPIL,
   1215     CAM_FACE_CT_POINT_EYE_L_IN,
   1216     CAM_FACE_CT_POINT_EYE_L_OUT,
   1217     CAM_FACE_CT_POINT_EYE_L_UP,
   1218     CAM_FACE_CT_POINT_EYE_L_DOWN,
   1219     CAM_FACE_CT_POINT_EYE_R_PUPIL,
   1220     CAM_FACE_CT_POINT_EYE_R_IN,
   1221     CAM_FACE_CT_POINT_EYE_R_OUT,
   1222     CAM_FACE_CT_POINT_EYE_R_UP,
   1223     CAM_FACE_CT_POINT_EYE_R_DOWN,
   1224     CAM_FACE_CT_POINT_EYE_MAX
   1225 } cam_face_ct_point_eye_t;
   1226 
   1227 typedef enum {
   1228     CAM_FACE_CT_POINT_FOREHEAD,
   1229     CAM_FACE_CT_POINT_FOREHEAD_MAX
   1230 } cam_face_ct_point_forh_t;
   1231 
   1232 typedef enum {
   1233     CAM_FACE_CT_POINT_NOSE,
   1234     CAM_FACE_CT_POINT_NOSE_TIP,
   1235     CAM_FACE_CT_POINT_NOSE_L,
   1236     CAM_FACE_CT_POINT_NOSE_R,
   1237     CAM_FACE_CT_POINT_NOSE_L_0,
   1238     CAM_FACE_CT_POINT_NOSE_R_0,
   1239     CAM_FACE_CT_POINT_NOSE_L_1,
   1240     CAM_FACE_CT_POINT_NOSE_R_1,
   1241     CAM_FACE_CT_POINT_NOSE_MAX
   1242 } cam_face_ct_point_nose_t;
   1243 
   1244 typedef enum {
   1245     CAM_FACE_CT_POINT_MOUTH_L,
   1246     CAM_FACE_CT_POINT_MOUTH_R,
   1247     CAM_FACE_CT_POINT_MOUTH_UP,
   1248     CAM_FACE_CT_POINT_MOUTH_DOWN,
   1249     CAM_FACE_CT_POINT_MOUTH_MAX
   1250 } cam_face_ct_point_mouth_t;
   1251 
   1252 typedef enum {
   1253     CAM_FACE_CT_POINT_LIP_UP,
   1254     CAM_FACE_CT_POINT_LIP_DOWN,
   1255     CAM_FACE_CT_POINT_LIP_MAX
   1256 } cam_face_ct_point_lip_t;
   1257 
   1258 typedef enum {
   1259     CAM_FACE_CT_POINT_BROW_L_UP,
   1260     CAM_FACE_CT_POINT_BROW_L_DOWN,
   1261     CAM_FACE_CT_POINT_BROW_L_IN,
   1262     CAM_FACE_CT_POINT_BROW_L_OUT,
   1263     CAM_FACE_CT_POINT_BROW_R_UP,
   1264     CAM_FACE_CT_POINT_BROW_R_DOWN,
   1265     CAM_FACE_CT_POINT_BROW_R_IN,
   1266     CAM_FACE_CT_POINT_BROW_R_OUT,
   1267     CAM_FACE_CT_POINT_BROW_MAX
   1268 } cam_face_ct_point_brow_t;
   1269 
   1270 typedef enum {
   1271     CAM_FACE_CT_POINT_CHIN,
   1272     CAM_FACE_CT_POINT_CHIN_L,
   1273     CAM_FACE_CT_POINT_CHIN_R,
   1274     CAM_FACE_CT_POINT_CHIN_MAX
   1275 } cam_face_ct_point_chin_t;
   1276 
   1277 typedef enum {
   1278     CAM_FACE_CT_POINT_EAR_L_DOWN,
   1279     CAM_FACE_CT_POINT_EAR_R_DOWN,
   1280     CAM_FACE_CT_POINT_EAR_L_UP,
   1281     CAM_FACE_CT_POINT_EAR_R_UP,
   1282     CAM_FACE_CT_POINT_EAR_MAX
   1283 } cam_face_ct_point_ear_t;
   1284 
   1285 typedef struct {
   1286   uint8_t is_eye_valid;
   1287   cam_coordinate_type_t contour_eye_pt[CAM_FACE_CT_POINT_EYE_MAX];
   1288   uint8_t is_forehead_valid;
   1289   cam_coordinate_type_t contour_forh_pt[CAM_FACE_CT_POINT_FOREHEAD_MAX];
   1290   uint8_t is_nose_valid;
   1291   cam_coordinate_type_t contour_nose_pt[CAM_FACE_CT_POINT_NOSE_MAX];
   1292   uint8_t is_mouth_valid;
   1293   cam_coordinate_type_t contour_mouth_pt[CAM_FACE_CT_POINT_MOUTH_MAX];
   1294   uint8_t is_lip_valid;
   1295   cam_coordinate_type_t contour_lip_pt[CAM_FACE_CT_POINT_LIP_MAX];
   1296   uint8_t is_brow_valid;
   1297   cam_coordinate_type_t contour_brow_pt[CAM_FACE_CT_POINT_BROW_MAX];
   1298   uint8_t is_chin_valid;
   1299   cam_coordinate_type_t contour_chin_pt[CAM_FACE_CT_POINT_CHIN_MAX];
   1300   uint8_t is_ear_valid;
   1301   cam_coordinate_type_t contour_ear_pt[CAM_FACE_CT_POINT_EAR_MAX];
   1302 } cam_face_contour_info_t;
   1303 
   1304 typedef struct {
   1305     cam_face_contour_info_t face_contour[MAX_ROI];
   1306 } cam_face_contour_data_t;
   1307 
   1308 typedef struct {
   1309     uint8_t is_left_eye_valid;
   1310     cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
   1311     uint8_t is_right_eye_valid;
   1312     cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
   1313     uint8_t is_mouth_valid;
   1314     cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
   1315 } cam_face_landmarks_info_t;
   1316 
   1317 typedef struct {
   1318     cam_face_landmarks_info_t face_landmarks[MAX_ROI];
   1319 } cam_face_landmarks_data_t;
   1320 
   1321 typedef struct {
   1322     uint8_t smile_degree;      /* smile degree (0, -100) */
   1323     uint8_t smile_confidence;  /* smile confidence (0, 100) */
   1324 } cam_face_smile_info_t;
   1325 
   1326 typedef struct {
   1327     cam_face_smile_info_t smile[MAX_ROI];
   1328 } cam_face_smile_data_t;
   1329 
   1330 typedef struct {
   1331     int8_t gaze_angle;         /* -90 -45 0 45 90 for head left to rigth tilt */
   1332     int32_t updown_dir;        /* up down direction (-180, 179) */
   1333     int32_t leftright_dir;     /* left right direction (-180, 179) */
   1334     int32_t roll_dir;          /* roll direction (-180, 179) */
   1335     int8_t left_right_gaze;    /* left right gaze degree (-50, 50) */
   1336     int8_t top_bottom_gaze;    /* up down gaze degree (-50, 50) */
   1337 } cam_face_gaze_info_t;
   1338 
   1339 typedef struct {
   1340     cam_face_gaze_info_t gaze[MAX_ROI];
   1341 } cam_face_gaze_data_t;
   1342 
   1343 typedef struct {
   1344     uint8_t blink_detected;    /* if blink is detected */
   1345     uint8_t left_blink;        /* left eye blink degeree (0, -100) */
   1346     uint8_t right_blink;       /* right eye blink degree (0, - 100) */
   1347 } cam_face_blink_info_t;
   1348 
   1349 typedef struct {
   1350     cam_face_blink_info_t blink[MAX_ROI];
   1351 } cam_face_blink_data_t;
   1352 
   1353 typedef struct {
   1354     uint8_t face_recognised;   /* if face is recognised */
   1355     uint32_t unique_id;   /* if face is recognised */
   1356 } cam_face_recog_info_t;
   1357 
   1358 typedef struct {
   1359     cam_face_recog_info_t face_rec[MAX_ROI];
   1360 } cam_face_recog_data_t;
   1361 
   1362 typedef struct {
   1363     int32_t face_id;            /* unique id for face tracking within view unless view changes */
   1364     int8_t score;              /* score of confidence (0, -100) */
   1365     cam_rect_t face_boundary;  /* boundary of face detected */
   1366 } cam_face_detection_info_t;
   1367 
   1368 typedef struct {
   1369     uint32_t frame_id;                         /* frame index of which faces are detected */
   1370     uint8_t num_faces_detected;                /* number of faces detected */
   1371     cam_face_detection_info_t faces[MAX_ROI];  /* detailed information of faces detected */
   1372     qcamera_face_detect_type_t fd_type;        /* face detect for preview or snapshot frame*/
   1373     cam_dimension_t fd_frame_dim;              /* frame dims on which fd is applied */
   1374     uint8_t update_flag;                       /* flag to inform whether HAL needs to send cb
   1375                                                 * to app or not */
   1376 } cam_face_detection_data_t;
   1377 
   1378 // definition of composite face detection data
   1379 typedef struct {
   1380     cam_face_detection_data_t detection_data;
   1381 
   1382     int8_t recog_valid;
   1383     cam_face_recog_data_t recog_data;
   1384 
   1385     int8_t blink_valid;
   1386     cam_face_blink_data_t blink_data;
   1387 
   1388     int8_t gaze_valid;
   1389     cam_face_gaze_data_t gaze_data;
   1390 
   1391     int8_t smile_valid;
   1392     cam_face_smile_data_t smile_data;
   1393 
   1394     int8_t landmark_valid;
   1395     cam_face_landmarks_data_t landmark_data;
   1396 
   1397     int8_t contour_valid;
   1398     cam_face_contour_data_t contour_data;
   1399 } cam_faces_data_t;
   1400 
   1401 #define CAM_HISTOGRAM_STATS_SIZE 256
   1402 #define MIN_CAM_HISTOGRAM_STATS_SIZE 16
   1403 
   1404 typedef enum {
   1405   CAM_STATS_CHANNEL_Y,
   1406   CAM_STATS_CHANNEL_GR,
   1407   CAM_STATS_CHANNEL_GB,
   1408   CAM_STATS_CHANNEL_R,
   1409   CAM_STATS_CHANNEL_B,
   1410   CAM_STATS_CHANNEL_ALL,
   1411   CAM_STATS_CHANNEL_MAX
   1412 } cam_histogram_data_type;
   1413 
   1414 typedef struct {
   1415     uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */
   1416 } cam_histogram_data_t;
   1417 
   1418 typedef struct {
   1419     cam_histogram_data_type data_type;
   1420     cam_histogram_data_t r_stats;
   1421     cam_histogram_data_t b_stats;
   1422     cam_histogram_data_t gr_stats;
   1423     cam_histogram_data_t gb_stats;
   1424 } cam_bayer_hist_stats_t;
   1425 
   1426 typedef enum {
   1427     CAM_HISTOGRAM_TYPE_BAYER,
   1428     CAM_HISTOGRAM_TYPE_YUV
   1429 } cam_histogram_type_t;
   1430 
   1431 typedef struct {
   1432     cam_histogram_type_t type;
   1433     union {
   1434         cam_bayer_hist_stats_t bayer_stats;
   1435         cam_histogram_data_t yuv_stats;
   1436     };
   1437 } cam_hist_stats_t;
   1438 
   1439 enum cam_focus_distance_index{
   1440   CAM_FOCUS_DISTANCE_NEAR_INDEX,  /* 0 */
   1441   CAM_FOCUS_DISTANCE_OPTIMAL_INDEX,
   1442   CAM_FOCUS_DISTANCE_FAR_INDEX,
   1443   CAM_FOCUS_DISTANCE_MAX_INDEX
   1444 };
   1445 
   1446 typedef struct {
   1447   float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX];
   1448 } cam_focus_distances_info_t;
   1449 
   1450 typedef struct {
   1451     uint32_t scale;
   1452     float diopter;
   1453 } cam_focus_pos_info_t ;
   1454 
   1455 typedef struct {
   1456     float lens_shift_um;
   1457     uint32_t object_distance_cm;
   1458     uint32_t near_field_cm;
   1459     uint32_t far_field_cm;
   1460 } cam_af_focus_pos_t ;
   1461 
   1462 typedef struct {
   1463     float focalLengthRatio;
   1464 } cam_focal_length_ratio_t;
   1465 
   1466 typedef struct {
   1467     uint8_t needFlush;
   1468     uint32_t focused_frame_idx;
   1469 } cam_af_flush_info_t;
   1470 
   1471 /* Different autofocus cycle when calling do_autoFocus
   1472  * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep
   1473  * if one is ongoing, and lock.
   1474  * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless
   1475  * of the current state, and lock.
   1476  * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep.
   1477  * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED,
   1478  * or CAM_AF_NOT_FOCUSED.
   1479  * cancel_autoFocus stops any lens movement.
   1480  * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED
   1481  * event, not both.
   1482  */
   1483 typedef enum {
   1484     CAM_AF_COMPLETE_EXISTING_SWEEP,
   1485     CAM_AF_DO_ONE_FULL_SWEEP,
   1486     CAM_AF_START_CONTINUOUS_SWEEP
   1487 } cam_autofocus_cycle_t;
   1488 
   1489 typedef enum {
   1490     CAM_AF_SCANNING,
   1491     CAM_AF_FOCUSED,
   1492     CAM_AF_NOT_FOCUSED,
   1493     CAM_CAF_SCANNING,
   1494     CAM_CAF_FOCUSED,
   1495     CAM_CAF_NOT_FOCUSED,
   1496     CAM_AF_INACTIVE
   1497 } cam_autofocus_state_t;
   1498 
   1499 //Don't change the order of the AF states below. It should match
   1500 //with the corresponding enum in frameworks (camera3.h and
   1501 //CameraMetadata.java)
   1502 typedef enum {
   1503     CAM_AF_STATE_INACTIVE,
   1504     CAM_AF_STATE_PASSIVE_SCAN,
   1505     CAM_AF_STATE_PASSIVE_FOCUSED,
   1506     CAM_AF_STATE_ACTIVE_SCAN,
   1507     CAM_AF_STATE_FOCUSED_LOCKED,
   1508     CAM_AF_STATE_NOT_FOCUSED_LOCKED,
   1509     CAM_AF_STATE_PASSIVE_UNFOCUSED
   1510 } cam_af_state_t;
   1511 
   1512 typedef struct {
   1513     cam_af_state_t focus_state;           /* state of focus */
   1514     cam_focus_distances_info_t focus_dist;       /* focus distance */
   1515     cam_focus_mode_type focus_mode;        /* focus mode from backend */
   1516     int32_t focus_pos;
   1517     cam_af_flush_info_t flush_info;
   1518     uint8_t isDepth;
   1519     float focus_value;
   1520     uint8_t spot_light_detected;
   1521 } cam_auto_focus_data_t;
   1522 
   1523 typedef struct {
   1524     uint32_t stream_id;
   1525     cam_rect_t crop;
   1526     cam_rect_t roi_map;
   1527 } cam_stream_crop_info_t;
   1528 
   1529 typedef struct {
   1530     float widthMargins;  /*Width margin in %*/
   1531     float heightMargins; /*Height margin in %*/
   1532 } cam_frame_margins_t;
   1533 
   1534 typedef struct {
   1535     uint8_t num_of_streams;
   1536     uint8_t ignore_crop; // CPP ignores the CROP in this special mode
   1537     cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS];
   1538     cam_frame_margins_t margins; // Margins used by dual camera with spatial alignment block
   1539 } cam_crop_data_t;
   1540 
   1541 typedef struct {
   1542     uint32_t stream_id;
   1543     uint32_t cds_enable;
   1544 } cam_stream_cds_info_t;
   1545 
   1546 typedef struct {
   1547     uint8_t session_cds_enable;
   1548     uint8_t num_of_streams;
   1549     cam_stream_cds_info_t cds_info[MAX_NUM_STREAMS];
   1550 } cam_cds_data_t;
   1551 
   1552 typedef enum {
   1553     DO_NOT_NEED_FUTURE_FRAME,
   1554     NEED_FUTURE_FRAME,
   1555 } cam_prep_snapshot_state_t;
   1556 
   1557 typedef enum {
   1558     CC_RED_GAIN,
   1559     CC_GREEN_RED_GAIN,
   1560     CC_GREEN_BLUE_GAIN,
   1561     CC_BLUE_GAIN,
   1562     CC_GAIN_MAX
   1563 } cam_cc_gains_type_t;
   1564 
   1565 typedef struct {
   1566     float gains[CC_GAIN_MAX];
   1567 } cam_color_correct_gains_t;
   1568 
   1569 typedef struct {
   1570     // If LED is ON and Burst Num > 1, this is first LED ON frame
   1571     uint32_t min_frame_idx;
   1572     // If LED is ON and Burst Num > 1, this is first LED Off frame after ON
   1573     uint32_t max_frame_idx;
   1574     // Used only when LED Is ON and burst num > 1
   1575     uint32_t num_led_on_frames;
   1576     // Skip count after LED is turned OFF
   1577     uint32_t frame_skip_count;
   1578     // Batch id for each picture request
   1579     uint32_t config_batch_idx;
   1580 } cam_frame_idx_range_t;
   1581 
   1582 typedef enum {
   1583   S_NORMAL = 0,
   1584   S_SCENERY,
   1585   S_PORTRAIT,
   1586   S_PORTRAIT_BACKLIGHT,
   1587   S_SCENERY_BACKLIGHT,
   1588   S_BACKLIGHT,
   1589   S_HDR,
   1590   S_MAX_DEFAULT,
   1591   S_CUSTOM0 = S_MAX_DEFAULT,
   1592   S_CUSTOM1,
   1593   S_CUSTOM2,
   1594   S_CUSTOM3,
   1595   S_CUSTOM4,
   1596   S_CUSTOM5,
   1597   S_CUSTOM6,
   1598   S_CUSTOM7,
   1599   S_CUSTOM8,
   1600   S_CUSTOM9,
   1601   S_MAX,
   1602 } cam_auto_scene_t;
   1603 
   1604 typedef struct {
   1605   uint32_t is_hdr_scene;
   1606   float    hdr_confidence;
   1607 } cam_asd_hdr_scene_data_t;
   1608 
   1609 typedef struct {
   1610   uint32_t          detected;
   1611   float             confidence;
   1612   uint32_t          auto_compensation;
   1613 } cam_asd_scene_info_t;
   1614 
   1615 typedef struct {
   1616   cam_auto_scene_t      detected_scene;
   1617   uint8_t               max_n_scenes;
   1618   cam_asd_scene_info_t  scene_info[S_MAX];
   1619 } cam_asd_decision_t;
   1620 
   1621 
   1622 typedef struct {
   1623    uint32_t meta_frame_id;
   1624 } cam_meta_valid_t;
   1625 
   1626 typedef enum {
   1627     CAM_SENSOR_RAW,
   1628     CAM_SENSOR_YUV,
   1629     CAM_SENSOR_MONO
   1630 } cam_sensor_t;
   1631 
   1632 typedef struct {
   1633     cam_flash_mode_t flash_mode;
   1634     float            aperture_value;
   1635     cam_flash_state_t        flash_state;
   1636     float            focal_length;
   1637     float            f_number;
   1638     int32_t          sensing_method;
   1639     float            crop_factor;
   1640     cam_sensor_t sens_type;
   1641 } cam_sensor_params_t;
   1642 
   1643 typedef enum {
   1644     CAM_METERING_MODE_UNKNOWN = 0,
   1645     CAM_METERING_MODE_AVERAGE = 1,
   1646     CAM_METERING_MODE_CENTER_WEIGHTED_AVERAGE = 2,
   1647     CAM_METERING_MODE_SPOT = 3,
   1648     CAM_METERING_MODE_MULTI_SPOT = 4,
   1649     CAM_METERING_MODE_PATTERN = 5,
   1650     CAM_METERING_MODE_PARTIAL = 6,
   1651     CAM_METERING_MODE_OTHER = 255,
   1652 } cam_metering_mode_t;
   1653 
   1654 typedef struct {
   1655     float exp_time;
   1656     int32_t iso_value;
   1657     uint32_t flash_needed;
   1658     uint32_t settled;
   1659     cam_wb_mode_type wb_mode;
   1660     uint32_t metering_mode;
   1661     uint32_t exposure_program;
   1662     uint32_t exposure_mode;
   1663     uint32_t scenetype;
   1664     float brightness;
   1665     float est_snap_exp_time;
   1666     int32_t est_snap_iso_value;
   1667     uint32_t est_snap_luma;
   1668     uint32_t est_snap_target;
   1669 } cam_3a_params_t;
   1670 
   1671 typedef struct {
   1672     uint64_t sw_version_number;
   1673     int32_t aec_debug_data_size;
   1674     char aec_private_debug_data[AEC_DEBUG_DATA_SIZE];
   1675 } cam_ae_exif_debug_t;
   1676 
   1677 typedef struct {
   1678     int8_t awb_ccm_enable;
   1679     int8_t hard_awb_ccm_flag;
   1680     int8_t ccm_update_flag;
   1681     float  ccm[AWB_NUM_CCM_ROWS][AWB_NUM_CCM_COLS];
   1682     float  ccm_offset[AWB_NUM_CCM_ROWS];
   1683 } cam_awb_ccm_update_t;
   1684 
   1685 typedef struct {
   1686     int32_t cct_value;
   1687     cam_awb_gain_t rgb_gains;
   1688     cam_awb_ccm_update_t ccm_update;
   1689 } cam_awb_params_t;
   1690 
   1691 typedef struct {
   1692     int32_t awb_debug_data_size;
   1693     char awb_private_debug_data[AWB_DEBUG_DATA_SIZE];
   1694 } cam_awb_exif_debug_t;
   1695 
   1696 /* AF debug data for exif*/
   1697 typedef struct {
   1698     int32_t af_debug_data_size;
   1699     char af_private_debug_data[AF_DEBUG_DATA_SIZE];
   1700 } cam_af_exif_debug_t;
   1701 
   1702 typedef struct {
   1703     int32_t asd_debug_data_size;
   1704     char asd_private_debug_data[ASD_DEBUG_DATA_SIZE];
   1705 } cam_asd_exif_debug_t;
   1706 
   1707 typedef struct {
   1708     int32_t bg_stats_buffer_size;
   1709     int32_t bg_config_buffer_size;
   1710     char stats_buffer_private_debug_data[STATS_BUFFER_DEBUG_DATA_SIZE];
   1711 } cam_stats_buffer_exif_debug_t;
   1712 
   1713 typedef struct {
   1714     int32_t be_stats_buffer_size;
   1715     int32_t be_config_buffer_size;
   1716     char bestats_buffer_private_debug_data[BESTATS_BUFFER_DEBUG_DATA_SIZE];
   1717 } cam_bestats_buffer_exif_debug_t;
   1718 
   1719 typedef struct {
   1720     int32_t bhist_stats_buffer_size;
   1721     char bhist_private_debug_data[BHIST_STATS_DEBUG_DATA_SIZE];
   1722 } cam_bhist_buffer_exif_debug_t;
   1723 
   1724 /* 3A version*/
   1725 typedef struct {
   1726     uint16_t major_version;
   1727     uint16_t minor_version;
   1728     uint16_t patch_version;
   1729     uint16_t new_feature_des;
   1730 } cam_q3a_version_t;
   1731 
   1732 typedef struct {
   1733     int32_t tuning_info_buffer_size;
   1734     char tuning_info_private_debug_data[TUNING_INFO_DEBUG_DATA_SIZE];
   1735 } cam_q3a_tuning_info_t;
   1736 
   1737 typedef struct {
   1738     uint32_t tuning_data_version;
   1739     size_t tuning_sensor_data_size;
   1740     size_t tuning_vfe_data_size;
   1741     size_t tuning_mod1_stats_data_size; //Stats data
   1742     size_t tuning_cpp_data_size;
   1743     size_t tuning_cac_data_size;
   1744     size_t tuning_cac_data_size2;
   1745     size_t tuning_mod3_data_size;
   1746     uint8_t  data[TUNING_DATA_MAX];
   1747 }tuning_params_t;
   1748 
   1749 typedef struct {
   1750     int32_t event_type;
   1751     cam_dimension_t dim;
   1752     size_t size;
   1753     char path[QCAMERA_MAX_FILEPATH_LENGTH];
   1754     cam_format_t picture_format;
   1755 } cam_int_evt_params_t;
   1756 
   1757 typedef struct {
   1758   uint8_t private_isp_data[MAX_ISP_DATA_SIZE];
   1759 } cam_chromatix_lite_isp_t;
   1760 
   1761 typedef struct {
   1762   uint8_t private_pp_data[MAX_PP_DATA_SIZE];
   1763 } cam_chromatix_lite_pp_t;
   1764 
   1765 typedef struct {
   1766   uint8_t private_stats_data[MAX_AE_STATS_DATA_SIZE];
   1767 } cam_chromatix_lite_ae_stats_t;
   1768 
   1769 typedef struct {
   1770   uint8_t private_stats_data[MAX_AWB_STATS_DATA_SIZE];
   1771 } cam_chromatix_lite_awb_stats_t;
   1772 
   1773 typedef struct {
   1774   uint8_t private_stats_data[MAX_AF_STATS_DATA_SIZE];
   1775 } cam_chromatix_lite_af_stats_t;
   1776 
   1777 typedef struct {
   1778   uint8_t private_stats_data[MAX_ASD_STATS_DATA_SIZE];
   1779 } cam_chromatix_lite_asd_stats_t;
   1780 
   1781 typedef struct {
   1782    uint32_t min_buffers;
   1783    uint32_t max_buffers;
   1784 } cam_buffer_info_t;
   1785 
   1786 typedef struct {
   1787     uint32_t frame_id;
   1788     size_t length;
   1789     uint8_t *depth_data;
   1790 } cam_depth_data_t;
   1791 
   1792 typedef enum {
   1793     /* cmd to bundle cameras*/
   1794     CAM_DUAL_CAMERA_BUNDLE_INFO,
   1795     /*cmd to suspend or resume cameras*/
   1796     CAM_DUAL_CAMERA_LOW_POWER_MODE,
   1797     /*cmd to send information about role switch*/
   1798     CAM_DUAL_CAMERA_MASTER_INFO,
   1799     /*Command to Defer dual camera session*/
   1800     CAM_DUAL_CAMERA_DEFER_INFO,
   1801 } cam_dual_camera_cmd_type;
   1802 
   1803 typedef enum {
   1804     /* Standalone camera (won't be linked) */
   1805     CAM_TYPE_STANDALONE=0,
   1806 
   1807     /* Main camera of the related cam subsystem which controls
   1808        HW sync at sensor level*/
   1809     CAM_TYPE_MAIN = (1 << 0),
   1810 
   1811     /* Aux camera of the related cam subsystem */
   1812     CAM_TYPE_AUX = (1 << 1),
   1813 
   1814     /*Secure camera. Is not published*/
   1815     CAM_TYPE_SECURE = (1 << 2),
   1816 } cam_sync_type_t;
   1817 
   1818 typedef enum {
   1819     CAM_3A_SYNC_NONE,     /* Default for single camera, not link */
   1820     CAM_3A_SYNC_FOLLOW,   /* Master->Slave: Master updates slave */
   1821     CAM_3A_SYNC_ALGO_CTRL,/* Algorithm updated cameras directly */
   1822 } cam_3a_sync_mode_t;
   1823 
   1824 typedef struct {
   1825     cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
   1826     uint32_t num_streams;
   1827     cam_stream_type_t type[MAX_NUM_STREAMS];
   1828     cam_feature_mask_t postprocess_mask[MAX_NUM_STREAMS];
   1829     cam_buffer_info_t buffer_info;
   1830     cam_is_type_t is_type[MAX_NUM_STREAMS];
   1831     cam_hfr_mode_t hfr_mode;
   1832     cam_format_t format[MAX_NUM_STREAMS];
   1833     cam_rotation_t rotation[MAX_NUM_STREAMS];
   1834     uint32_t buf_alignment;
   1835     uint32_t min_stride;
   1836     uint32_t min_scanline;
   1837     uint8_t batch_size;
   1838     cam_sync_type_t sync_type;
   1839     uint32_t dt[MAX_NUM_STREAMS];
   1840     uint32_t vc[MAX_NUM_STREAMS];
   1841     cam_sub_format_type_t sub_format_type[MAX_NUM_STREAMS];
   1842     cam_frame_margins_t margins[MAX_NUM_STREAMS];
   1843     cam_dimension_t stream_sz_plus_margin[MAX_NUM_STREAMS]; /*stream sizes + margin*/
   1844     uint8_t is_secure;
   1845 } cam_stream_size_info_t;
   1846 
   1847 typedef enum {
   1848     CAM_INTF_OVERWRITE_MINI_CHROMATIX_OFFLINE,
   1849     CAM_INTF_OVERWRITE_ISP_HW_DATA_OFFLINE,
   1850     CAM_INTF_OVERWRITE_MINI_CHROMATIX_ONLINE,
   1851     CAM_INTF_OVERWRITE_ISP_HW_DATA_ONLINE,
   1852     CAM_INTF_OVERWRITE_MAX,
   1853 } cam_intf_overwrite_type_t;
   1854 
   1855 typedef struct {
   1856   uint8_t lds_enabled;
   1857   float rnr_sampling_factor;
   1858 } cam_img_hysterisis_info_t;
   1859 
   1860 typedef struct {
   1861   /* dynamic feature enablement */
   1862   uint64_t dyn_feature_mask;
   1863   /* input frame count for stacking */
   1864   uint32_t input_count;
   1865   /* reserved for future use */
   1866   uint8_t  reserved[32];
   1867 } cam_dyn_img_data_t;
   1868 
   1869 typedef struct {
   1870   cam_intf_overwrite_type_t overwrite_type;
   1871   char isp_hw_data_list[4096];     /*add upper bound memory, customer to fill*/
   1872   char chromatix_data_overwrite[4096]; /*add bound memory, customer fill*/
   1873 } cam_hw_data_overwrite_t;
   1874 
   1875 typedef struct {
   1876     uint32_t streamID;
   1877     uint32_t buf_index;
   1878 } cam_stream_request_t;
   1879 
   1880 typedef struct {
   1881     uint32_t num_streams;
   1882     cam_stream_request_t stream_request[MAX_NUM_STREAMS];
   1883 } cam_stream_ID_t;
   1884 
   1885 /*CAC Message posted during pipeline*/
   1886 typedef struct {
   1887     uint32_t frame_id;
   1888     int32_t buf_idx;
   1889 } cam_cac_info_t;
   1890 
   1891 typedef struct
   1892 {
   1893   uint32_t id;            /* Frame ID */
   1894   uint64_t timestamp;    /* Time stamp */
   1895   uint32_t distance_in_mm; /* Distance of object in ROI's in milimeters */
   1896   uint32_t confidence;     /* Confidence on distance from 0(No confidence)to 1024(max) */
   1897   uint32_t status;        /* Status of DCRF library execution call */
   1898   cam_rect_t focused_roi; /* ROI's for which distance is estimated */
   1899   uint32_t focused_x;     /* Focus location X inside ROI with distance estimation */
   1900   uint32_t focused_y;     /* Focus location Y inside ROI with distance estimation */
   1901 } cam_dcrf_result_t;
   1902 
   1903 typedef struct {
   1904     uint32_t frame_id;
   1905     uint32_t num_streams;
   1906     uint32_t stream_id[MAX_NUM_STREAMS];
   1907 } cam_buf_divert_info_t;
   1908 
   1909 typedef enum {
   1910     CAM_SPATIAL_ALIGN_QTI  = 1 << 0,
   1911     CAM_SPATIAL_ALIGN_OEM  = 1 << 1
   1912 } cam_spatial_align_type_t;
   1913 
   1914 typedef struct {
   1915     int32_t shift_horz;
   1916     int32_t shift_vert;
   1917 } cam_sac_output_shift_t;
   1918 
   1919 typedef struct {
   1920     uint8_t                is_master_hint_valid;
   1921     uint8_t                master_hint;
   1922     uint8_t                is_master_preview_valid;
   1923     uint8_t                master_preview;
   1924     uint8_t                is_master_3A_valid;
   1925     uint8_t                master_3A;
   1926     uint8_t                is_ready_status_valid;
   1927     uint8_t                ready_status;
   1928     uint8_t                is_output_shift_valid;
   1929     cam_sac_output_shift_t output_shift;
   1930     cam_dimension_t        reference_res_for_output_shift;
   1931     uint8_t                is_focus_roi_shift_valid;
   1932     cam_sac_output_shift_t focus_roi_shift;
   1933     cam_dimension_t        reference_res_for_focus_roi_shift;
   1934 } cam_sac_output_info_t;
   1935 
   1936 
   1937 typedef  struct {
   1938     uint8_t is_stats_valid;               /* if histgram data is valid */
   1939     cam_hist_stats_t stats_data;          /* histogram data */
   1940 
   1941     uint8_t is_faces_valid;               /* if face detection data is valid */
   1942     cam_face_detection_data_t faces_data; /* face detection result */
   1943 
   1944     uint8_t is_focus_valid;               /* if focus data is valid */
   1945     cam_auto_focus_data_t focus_data;     /* focus data */
   1946 
   1947     uint8_t is_crop_valid;                /* if crop data is valid */
   1948     cam_crop_data_t crop_data;            /* crop data */
   1949 
   1950     uint8_t is_prep_snapshot_done_valid;  /* if prep snapshot done is valid */
   1951     cam_prep_snapshot_state_t prep_snapshot_done_state;  /* prepare snapshot done state */
   1952 
   1953     uint8_t is_cac_valid;                 /* if cac info is valid */
   1954     cam_cac_info_t cac_info;              /* cac info */
   1955 
   1956     /* Hysterisis data from Img modules */
   1957     uint8_t is_hyst_info_valid;           /* if hyst info is valid */
   1958     cam_img_hysterisis_info_t img_hyst_info; /* hyst info */
   1959 
   1960     /* if good frame idx range is valid */
   1961     uint8_t is_good_frame_idx_range_valid;
   1962     /* good frame idx range, make sure:
   1963      * 1. good_frame_idx_range.min_frame_idx > current_frame_idx
   1964      * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */
   1965     cam_frame_idx_range_t good_frame_idx_range;
   1966 
   1967     cam_asd_decision_t cam_asd_info;
   1968 
   1969     char private_metadata[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
   1970 
   1971     /* AE parameters */
   1972     uint8_t is_3a_params_valid;
   1973     cam_3a_params_t cam_3a_params;
   1974 
   1975     /* AE exif debug parameters */
   1976     uint8_t is_ae_exif_debug_valid;
   1977     cam_ae_exif_debug_t ae_exif_debug_params;
   1978 
   1979     /* AWB exif debug parameters */
   1980     uint8_t is_awb_exif_debug_valid;
   1981     cam_awb_exif_debug_t awb_exif_debug_params;
   1982 
   1983     /* AF exif debug parameters */
   1984     uint8_t is_af_exif_debug_valid;
   1985     cam_af_exif_debug_t af_exif_debug_params;
   1986 
   1987     /* ASD exif debug parameters */
   1988     uint8_t is_asd_exif_debug_valid;
   1989     cam_asd_exif_debug_t asd_exif_debug_params;
   1990 
   1991     /* Stats buffer exif debug parameters */
   1992     uint8_t is_stats_buffer_exif_debug_valid;
   1993     cam_stats_buffer_exif_debug_t stats_buffer_exif_debug_params;
   1994 
   1995     /* BE stats buffer exif debug parameters */
   1996     uint8_t is_bestats_buffer_exif_debug_valid;
   1997     cam_bestats_buffer_exif_debug_t bestats_buffer_exif_debug_params;
   1998 
   1999     /* Bhist exif debug parameters. */
   2000     uint8_t is_bhist_exif_debug_valid;
   2001     cam_bhist_buffer_exif_debug_t bhist_exif_debug_params;
   2002 
   2003     /* AWB parameters */
   2004     uint8_t is_awb_params_valid;
   2005     cam_awb_params_t awb_params;
   2006 
   2007     /* sensor parameters */
   2008     uint8_t is_sensor_params_valid;
   2009     cam_sensor_params_t sensor_params;
   2010 
   2011     /* Meta valid params */
   2012     uint8_t is_meta_valid;
   2013     cam_meta_valid_t meta_valid_params;
   2014 
   2015     /*Tuning Data*/
   2016     uint8_t is_tuning_params_valid;
   2017     tuning_params_t tuning_params;
   2018 
   2019     uint8_t is_chromatix_lite_isp_valid;
   2020     cam_chromatix_lite_isp_t chromatix_lite_isp_data;
   2021 
   2022     uint8_t is_chromatix_lite_pp_valid;
   2023     cam_chromatix_lite_pp_t chromatix_lite_pp_data;
   2024 
   2025     uint8_t is_chromatix_lite_ae_stats_valid;
   2026     cam_chromatix_lite_ae_stats_t chromatix_lite_ae_stats_data;
   2027 
   2028     uint8_t is_chromatix_lite_awb_stats_valid;
   2029     cam_chromatix_lite_awb_stats_t chromatix_lite_awb_stats_data;
   2030 
   2031     uint8_t is_chromatix_lite_af_stats_valid;
   2032     cam_chromatix_lite_af_stats_t chromatix_lite_af_stats_data;
   2033 
   2034     uint8_t is_dcrf_result_valid;
   2035     cam_dcrf_result_t dcrf_result;
   2036 
   2037     /* Dynamic feature enablement from postprocessing modules */
   2038     uint8_t is_dyn_img_data_valid;
   2039     cam_dyn_img_data_t dyn_img_data;
   2040 
   2041 } cam_metadata_info_t;
   2042 
   2043 typedef enum {
   2044     CAM_INTF_PARM_HAL_VERSION = 0x1,
   2045 
   2046     /* Overall mode of 3A control routines. We need to have this parameter
   2047      * because not all android.control.* have an OFF option, for example,
   2048      * AE_FPS_Range, aePrecaptureTrigger */
   2049     CAM_INTF_META_MODE,
   2050     /* Whether AE is currently updating the sensor exposure and sensitivity
   2051      * fields */
   2052     CAM_INTF_META_AEC_MODE,
   2053     CAM_INTF_PARM_WHITE_BALANCE,
   2054     CAM_INTF_PARM_FOCUS_MODE,
   2055 
   2056     /* common between HAL1 and HAL3 */
   2057     CAM_INTF_PARM_ANTIBANDING,
   2058     CAM_INTF_PARM_EXPOSURE_COMPENSATION,
   2059     CAM_INTF_PARM_EV_STEP,
   2060     CAM_INTF_PARM_AEC_LOCK,
   2061     CAM_INTF_PARM_FPS_RANGE, /* 10 */
   2062     CAM_INTF_PARM_AWB_LOCK,
   2063     CAM_INTF_PARM_EFFECT,
   2064     CAM_INTF_PARM_BESTSHOT_MODE,
   2065     CAM_INTF_PARM_DIS_ENABLE,
   2066     CAM_INTF_PARM_LED_MODE,
   2067     CAM_INTF_META_HISTOGRAM,
   2068     CAM_INTF_META_FACE_DETECTION,
   2069     /* Whether optical image stabilization is enabled. */
   2070     CAM_INTF_META_LENS_OPT_STAB_MODE,
   2071     /* specific to HAl1 */
   2072     CAM_INTF_META_AUTOFOCUS_DATA,
   2073     CAM_INTF_PARM_QUERY_FLASH4SNAP, /* 20 */
   2074     CAM_INTF_PARM_EXPOSURE,
   2075     CAM_INTF_PARM_SHARPNESS,
   2076     CAM_INTF_PARM_CONTRAST,
   2077     CAM_INTF_PARM_SATURATION,
   2078     CAM_INTF_PARM_BRIGHTNESS,
   2079     CAM_INTF_PARM_ISO,
   2080     CAM_INTF_PARM_ZOOM,
   2081     CAM_INTF_PARM_ROLLOFF,
   2082     CAM_INTF_PARM_MODE,             /* camera mode */
   2083     CAM_INTF_PARM_AEC_ALGO_TYPE, /* 30 */ /* auto exposure algorithm */
   2084     CAM_INTF_PARM_FOCUS_ALGO_TYPE,  /* focus algorithm */
   2085     CAM_INTF_PARM_AEC_ROI,
   2086     CAM_INTF_PARM_AF_ROI,
   2087     CAM_INTF_PARM_SCE_FACTOR,
   2088     CAM_INTF_PARM_FD,
   2089     CAM_INTF_PARM_MCE,
   2090     CAM_INTF_PARM_HFR,
   2091     CAM_INTF_PARM_REDEYE_REDUCTION,
   2092     CAM_INTF_PARM_WAVELET_DENOISE,
   2093     CAM_INTF_PARM_TEMPORAL_DENOISE, /* 40 */
   2094     CAM_INTF_PARM_HISTOGRAM,
   2095     CAM_INTF_PARM_ASD_ENABLE,
   2096     CAM_INTF_PARM_RECORDING_HINT,
   2097     CAM_INTF_PARM_HDR,
   2098     CAM_INTF_PARM_MAX_DIMENSION,
   2099     CAM_INTF_PARM_SENSOR_MODE_INFO,
   2100     CAM_INTF_PARM_CURRENT_SENSOR_MODE_INFO,
   2101     CAM_INTF_PARM_FRAMESKIP,
   2102     CAM_INTF_PARM_ZSL_MODE,  /* indicating if it's running in ZSL mode */
   2103     CAM_INTF_PARM_BURST_NUM,
   2104     CAM_INTF_PARM_RETRO_BURST_NUM, /* 50 */
   2105     CAM_INTF_PARM_BURST_LED_ON_PERIOD,
   2106     CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */
   2107     CAM_INTF_PARM_LOCK_CAF,
   2108     CAM_INTF_PARM_VIDEO_HDR,
   2109     CAM_INTF_PARM_SENSOR_HDR,
   2110     CAM_INTF_PARM_ROTATION,
   2111     CAM_INTF_PARM_SCALE,
   2112     CAM_INTF_PARM_VT, /* indicating if it's a Video Call Apllication */
   2113     CAM_INTF_META_CROP_DATA,
   2114     CAM_INTF_META_PREP_SNAPSHOT_DONE, /* 60 */
   2115     CAM_INTF_META_GOOD_FRAME_IDX_RANGE,
   2116     CAM_INTF_META_ASD_HDR_SCENE_DATA,
   2117     CAM_INTF_META_ASD_SCENE_INFO,
   2118     CAM_INTF_META_CURRENT_SCENE,
   2119     CAM_INTF_META_AEC_INFO,
   2120     CAM_INTF_META_SENSOR_INFO,
   2121     CAM_INTF_META_CHROMATIX_LITE_ISP,
   2122     CAM_INTF_META_CHROMATIX_LITE_PP,
   2123     CAM_INTF_META_CHROMATIX_LITE_AE,
   2124     CAM_INTF_META_CHROMATIX_LITE_AWB, /* 70 */
   2125     CAM_INTF_META_CHROMATIX_LITE_AF,
   2126     CAM_INTF_META_CHROMATIX_LITE_ASD,
   2127     CAM_INTF_META_EXIF_DEBUG_AE,
   2128     CAM_INTF_META_EXIF_DEBUG_AWB,
   2129     CAM_INTF_META_EXIF_DEBUG_AF,
   2130     CAM_INTF_META_EXIF_DEBUG_ASD,
   2131     CAM_INTF_META_EXIF_DEBUG_STATS,
   2132     CAM_INTF_META_EXIF_DEBUG_BESTATS,
   2133     CAM_INTF_META_EXIF_DEBUG_BHIST,
   2134     CAM_INTF_META_EXIF_DEBUG_3A_TUNING,
   2135     CAM_INTF_PARM_GET_CHROMATIX,
   2136     CAM_INTF_PARM_SET_RELOAD_CHROMATIX,
   2137     CAM_INTF_PARM_SET_AUTOFOCUSTUNING, /* 80 */
   2138     CAM_INTF_PARM_GET_AFTUNE,
   2139     CAM_INTF_PARM_SET_RELOAD_AFTUNE,
   2140     CAM_INTF_PARM_SET_VFE_COMMAND,
   2141     CAM_INTF_PARM_SET_PP_COMMAND,
   2142     CAM_INTF_PARM_TINTLESS,
   2143     CAM_INTF_PARM_LONGSHOT_ENABLE,
   2144     CAM_INTF_PARM_RDI_MODE,
   2145     CAM_INTF_PARM_CDS_MODE,
   2146     CAM_INTF_PARM_TONE_MAP_MODE,
   2147     CAM_INTF_PARM_CAPTURE_FRAME_CONFIG, /* 90 */
   2148     CAM_INTF_PARM_DUAL_LED_CALIBRATION,
   2149     CAM_INTF_PARM_ADV_CAPTURE_MODE,
   2150 
   2151     /* stream based parameters */
   2152     CAM_INTF_PARM_DO_REPROCESS,
   2153     CAM_INTF_PARM_SET_BUNDLE,
   2154     CAM_INTF_PARM_STREAM_FLIP,
   2155     CAM_INTF_PARM_GET_OUTPUT_CROP,
   2156 
   2157     CAM_INTF_PARM_EZTUNE_CMD,
   2158     CAM_INTF_PARM_INT_EVT,
   2159 
   2160     /* specific to HAL3 */
   2161     /* Whether the metadata maps to a valid frame number */
   2162     CAM_INTF_META_FRAME_NUMBER_VALID,
   2163     /* Whether the urgent metadata maps to a valid frame number */
   2164     CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,
   2165     /* Whether the stream buffer corresponding this frame is dropped or not */
   2166     CAM_INTF_META_FRAME_DROPPED, /* 100 */
   2167     /* COLOR CORRECTION.*/
   2168     CAM_INTF_META_COLOR_CORRECT_MODE,
   2169     /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931)
   2170      * color space from the scene illuminant to the sRGB-standard D65-illuminant. */
   2171     CAM_INTF_META_COLOR_CORRECT_TRANSFORM,
   2172     /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/
   2173     CAM_INTF_META_COLOR_CORRECT_GAINS,
   2174     /*The best fit color transform matrix calculated by the stats*/
   2175     CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM,
   2176     /*The best fit color channels gains calculated by the stats*/
   2177     CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,
   2178     /* CONTROL */
   2179     /* A frame counter set by the framework. Must be maintained unchanged in
   2180      * output frame. */
   2181     CAM_INTF_META_FRAME_NUMBER,
   2182     /* A frame counter set by the framework. Must be maintained unchanged in
   2183      * output frame. */
   2184     CAM_INTF_META_URGENT_FRAME_NUMBER,
   2185     /* Choose sensor mode which has Full FOV when multiple modes satisfy the
   2186      * other requirements. MUST be defined before CAM_INTF_META_STREAM_INFO */
   2187     CAM_INTF_META_SENSOR_MODE_FULLFOV,
   2188     /*Number of streams and size of streams in current configuration*/
   2189     CAM_INTF_META_STREAM_INFO,
   2190     /* List of areas to use for metering */
   2191     CAM_INTF_META_AEC_ROI,
   2192     /* Whether the HAL must trigger precapture metering.*/
   2193     CAM_INTF_META_AEC_PRECAPTURE_TRIGGER, /* 110 */
   2194     /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */
   2195     /* Current state of AE algorithm */
   2196     CAM_INTF_META_AEC_STATE,
   2197     /* Tracking AF trigger. This has to be before AF_ROI so that the behavior of
   2198      * AF_ROI depends on TRACKING_AF_TRIGGER.*/
   2199     CAM_INTF_META_TRACKING_AF_TRIGGER,
   2200     /* List of areas to use for focus estimation */
   2201     CAM_INTF_META_AF_ROI,
   2202     /* Default ROI of the camera to be sent to FOV control*/
   2203     CAM_INTF_META_AF_DEFAULT_ROI,
   2204     /* Whether the HAL must trigger autofocus. */
   2205     CAM_INTF_META_AF_TRIGGER,
   2206     /* Current state of AF algorithm */
   2207     CAM_INTF_META_AF_STATE,
   2208     /* List of areas to use for illuminant estimation */
   2209     CAM_INTF_META_AWB_REGIONS,
   2210     /* Current state of AWB algorithm */
   2211     CAM_INTF_META_AWB_STATE,
   2212     /*Whether black level compensation is frozen or free to vary*/
   2213     CAM_INTF_META_BLACK_LEVEL_LOCK,
   2214     /* Information to 3A routines about the purpose of this capture, to help
   2215      * decide optimal 3A strategy */
   2216     CAM_INTF_META_CAPTURE_INTENT,
   2217     /* DEMOSAIC */
   2218     /* Controls the quality of the demosaicing processing */
   2219     CAM_INTF_META_DEMOSAIC,
   2220     /* EDGE */
   2221     /* Operation mode for edge enhancement */
   2222     CAM_INTF_META_EDGE_MODE, /* 120 */
   2223     /* Control the amount of edge enhancement applied to the images.*/
   2224     /* 1-10; 10 is maximum sharpening */
   2225     CAM_INTF_META_SHARPNESS_STRENGTH,
   2226     /* FLASH */
   2227     /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */
   2228     CAM_INTF_META_FLASH_POWER,
   2229     /* Firing time of flash relative to start of exposure, in nanoseconds*/
   2230     CAM_INTF_META_FLASH_FIRING_TIME,
   2231     /* Current state of the flash unit */
   2232     CAM_INTF_META_FLASH_STATE,
   2233     /* GEOMETRIC */
   2234     /* Operating mode of geometric correction */
   2235     CAM_INTF_META_GEOMETRIC_MODE,
   2236     /* Control the amount of shading correction applied to the images */
   2237     CAM_INTF_META_GEOMETRIC_STRENGTH,
   2238     /* HOT PIXEL */
   2239     /* Set operational mode for hot pixel correction */
   2240     CAM_INTF_META_HOTPIXEL_MODE,
   2241     /* LENS */
   2242     /* Size of the lens aperture */
   2243     CAM_INTF_META_LENS_APERTURE,
   2244     /* State of lens neutral density filter(s) */
   2245     CAM_INTF_META_LENS_FILTERDENSITY,
   2246     /* Lens optical zoom setting */
   2247     CAM_INTF_META_LENS_FOCAL_LENGTH, /* 130 */
   2248     /* Distance to plane of sharpest focus, measured from frontmost surface
   2249      * of the lens */
   2250     CAM_INTF_META_LENS_FOCUS_DISTANCE,
   2251     /* The range of scene distances that are in sharp focus (depth of field) */
   2252     CAM_INTF_META_LENS_FOCUS_RANGE,
   2253     /*Whether the hal needs to output the lens shading map*/
   2254     CAM_INTF_META_LENS_SHADING_MAP_MODE,
   2255     /* Current lens status */
   2256     CAM_INTF_META_LENS_STATE,
   2257     /* NOISE REDUCTION */
   2258     /* Mode of operation for the noise reduction algorithm */
   2259     CAM_INTF_META_NOISE_REDUCTION_MODE,
   2260    /* Control the amount of noise reduction applied to the images.
   2261     * 1-10; 10 is max noise reduction */
   2262     CAM_INTF_META_NOISE_REDUCTION_STRENGTH,
   2263     /* SCALER */
   2264     /* Top-left corner and width of the output region to select from the active
   2265      * pixel array */
   2266     CAM_INTF_META_SCALER_CROP_REGION,
   2267     /* The estimated scene illumination lighting frequency */
   2268     CAM_INTF_META_SCENE_FLICKER,
   2269     /* SENSOR */
   2270     /* Duration each pixel is exposed to light, in nanoseconds */
   2271     CAM_INTF_META_SENSOR_EXPOSURE_TIME,
   2272     /* Duration from start of frame exposure to start of next frame exposure,
   2273      * in nanoseconds */
   2274     CAM_INTF_META_SENSOR_FRAME_DURATION, /* 140 */
   2275     /* Gain applied to image data. Must be implemented through analog gain only
   2276      * if set to values below 'maximum analog sensitivity'. */
   2277     CAM_INTF_META_SENSOR_SENSITIVITY,
   2278     /* Time at start of exposure of first row */
   2279     CAM_INTF_META_SENSOR_TIMESTAMP,
   2280     /* Time at start of exposure of first row, AV timestamp */
   2281     CAM_INTF_META_SENSOR_TIMESTAMP_AV,
   2282     /* Duration b/w start of first row exposure and the start of last
   2283        row exposure in nanoseconds */
   2284     CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,
   2285     /* SHADING */
   2286     /* Quality of lens shading correction applied to the image data */
   2287     CAM_INTF_META_SHADING_MODE,
   2288     /* Control the amount of shading correction applied to the images.
   2289      * unitless: 1-10; 10 is full shading compensation */
   2290     CAM_INTF_META_SHADING_STRENGTH,
   2291     /* STATISTICS */
   2292     /* State of the face detector unit */
   2293     CAM_INTF_META_STATS_FACEDETECT_MODE,
   2294     /* Operating mode for histogram generation */
   2295     CAM_INTF_META_STATS_HISTOGRAM_MODE,
   2296     /* Operating mode for sharpness map generation */
   2297     CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,
   2298     /* A 3-channel sharpness map, based on the raw sensor data,
   2299      * If only a monochrome sharpness map is supported, all channels
   2300      * should have the same data
   2301      */
   2302     CAM_INTF_META_STATS_SHARPNESS_MAP,
   2303 
   2304     /* TONEMAP */
   2305     /* Tone map mode */
   2306     CAM_INTF_META_TONEMAP_MODE, /* 150 */
   2307     /* Table mapping RGB input values to output values */
   2308     CAM_INTF_META_TONEMAP_CURVES,
   2309 
   2310     CAM_INTF_META_FLASH_MODE,
   2311     /* 2D array of gain factors for each color channel that was used to
   2312      * compensate for lens shading for this frame */
   2313     CAM_INTF_META_LENS_SHADING_MAP,
   2314     CAM_INTF_META_PRIVATE_DATA,
   2315     CAM_INTF_PARM_STATS_DEBUG_MASK,
   2316     CAM_INTF_PARM_STATS_AF_PAAF,
   2317     /* Indicates streams ID of all the requested buffers */
   2318     CAM_INTF_META_STREAM_ID,
   2319     CAM_INTF_PARM_FOCUS_BRACKETING,
   2320     CAM_INTF_PARM_FLASH_BRACKETING,
   2321     CAM_INTF_PARM_GET_IMG_PROP, /* 160 */
   2322     CAM_INTF_META_JPEG_GPS_COORDINATES,
   2323     CAM_INTF_META_JPEG_GPS_PROC_METHODS,
   2324     CAM_INTF_META_JPEG_GPS_TIMESTAMP,
   2325     CAM_INTF_META_JPEG_ORIENTATION,
   2326     CAM_INTF_META_JPEG_QUALITY,
   2327     CAM_INTF_META_JPEG_THUMB_QUALITY,
   2328     CAM_INTF_META_JPEG_THUMB_SIZE,
   2329 
   2330     CAM_INTF_META_TEST_PATTERN_DATA,
   2331     /* DNG file support */
   2332     CAM_INTF_META_PROFILE_TONE_CURVE,
   2333     CAM_INTF_META_NEUTRAL_COL_POINT, /* 170 */
   2334 
   2335     /* CAC */
   2336     CAM_INTF_META_CAC_INFO,
   2337     CAM_INTF_PARM_CAC,
   2338     CAM_INTF_META_IMG_HYST_INFO,
   2339 
   2340     /* trigger for all modules to read the debug/log level properties */
   2341     CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,
   2342 
   2343     /* OTP : WB gr/gb */
   2344     CAM_INTF_META_OTP_WB_GRGB,
   2345     /* LED override for EZTUNE */
   2346     CAM_INTF_META_LED_MODE_OVERRIDE,
   2347     /* auto lens position info */
   2348     CAM_INTF_META_FOCUS_POSITION,
   2349     /* Manual exposure time */
   2350     CAM_INTF_PARM_EXPOSURE_TIME,
   2351     /* AWB meta data info */
   2352     CAM_INTF_META_AWB_INFO,
   2353     /* Manual lens position info */
   2354     CAM_INTF_PARM_MANUAL_FOCUS_POS, /* 180 */
   2355     /* Manual White balance gains */
   2356     CAM_INTF_PARM_WB_MANUAL,
   2357     /* Offline Data Overwrite */
   2358     CAM_INTF_PARM_HW_DATA_OVERWRITE,
   2359     /* IMG LIB reprocess debug section */
   2360     CAM_INTF_META_IMGLIB, /* cam_intf_meta_imglib_t */
   2361     /* OEM specific parameters */
   2362     CAM_INTF_PARM_CUSTOM,
   2363     /* parameters added for related cameras */
   2364     /* fetch calibration info for related cam subsystem */
   2365     CAM_INTF_PARM_RELATED_SENSORS_CALIBRATION,
   2366     /* focal length ratio info */
   2367     CAM_INTF_META_AF_FOCAL_LENGTH_RATIO,
   2368     /* crop for binning & FOV adjust */
   2369     CAM_INTF_META_SNAP_CROP_INFO_SENSOR,
   2370     /* crop for trimming edge pixels */
   2371     CAM_INTF_META_SNAP_CROP_INFO_CAMIF,
   2372     /* crop for FOV adjust and zoom */
   2373     CAM_INTF_META_SNAP_CROP_INFO_ISP,
   2374     /* crop for image-stabilization and zoom */
   2375     CAM_INTF_META_SNAP_CROP_INFO_CPP, /* 190 */
   2376     /* parameter for enabling DCRF */
   2377     CAM_INTF_PARM_DCRF,
   2378     /* metadata tag for DCRF info */
   2379     CAM_INTF_META_DCRF,
   2380     /* FLIP mode parameter*/
   2381     CAM_INTF_PARM_FLIP,
   2382     /*Frame divert info from ISP*/
   2383     CAM_INTF_BUF_DIVERT_INFO,
   2384     /* Use AV timer */
   2385     CAM_INTF_META_USE_AV_TIMER,
   2386     CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,
   2387     /* Special event to request stream frames*/
   2388     CAM_INTF_PARM_REQUEST_FRAMES,
   2389     /* Special event to request operational mode*/
   2390     CAM_INTF_PARM_REQUEST_OPS_MODE,
   2391     /*Black level parameters*/
   2392     CAM_INTF_META_LDAF_EXIF,
   2393     CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,
   2394     /* Applied black level pattern in RGGB order */
   2395     CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN, /* 200 */
   2396     CAM_INTF_META_CDS_DATA,
   2397     /*3A low light level information*/
   2398     CAM_INTF_META_LOW_LIGHT,
   2399     /* dynamic feature detection */
   2400     CAM_INTF_META_IMG_DYN_FEAT, /* 200 */
   2401     /*Parameter entry to communicate manual
   2402     capture type*/
   2403     CAM_INTF_PARM_MANUAL_CAPTURE_TYPE,
   2404     /*AF state change detected by AF module*/
   2405     CAM_INTF_AF_STATE_TRANSITION,
   2406     /* face recognition */
   2407     CAM_INTF_META_FACE_RECOG,
   2408     /* face blink detection */
   2409     CAM_INTF_META_FACE_BLINK,
   2410     /* face gaze detection */
   2411     CAM_INTF_META_FACE_GAZE,
   2412     /* face smile detection */
   2413     CAM_INTF_META_FACE_SMILE,
   2414     /* face landmark detection */
   2415     CAM_INTF_META_FACE_LANDMARK, /* 210 */
   2416     /* face contour detection */
   2417     CAM_INTF_META_FACE_CONTOUR,
   2418     /* Whether EIS is enabled */
   2419     CAM_INTF_META_VIDEO_STAB_MODE,
   2420     /* Touch exposure compensation (EV) status */
   2421     CAM_INTF_META_TOUCH_AE_RESULT,
   2422     /* Param for updating initial exposure index value*/
   2423     CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,
   2424     /* Gain applied post raw captrue prior to stats collection.
   2425        ISP digital gain */
   2426     CAM_INTF_META_ISP_SENSITIVITY,
   2427     /* Param for enabling instant aec*/
   2428     CAM_INTF_PARM_INSTANT_AEC,
   2429     /* Param for tracking previous reprocessing activity */
   2430     CAM_INTF_META_REPROCESS_FLAGS,
   2431     /* Param of cropping information for JPEG encoder */
   2432     CAM_INTF_PARM_JPEG_ENCODE_CROP,
   2433     /* Param of scaling information for JPEG encoder */
   2434     CAM_INTF_PARM_JPEG_SCALE_DIMENSION,
   2435     /*Param for updating Quadra CFA mode */
   2436     CAM_INTF_PARM_QUADRA_CFA,
   2437     /* Meta Raw Dim */
   2438     CAM_INTF_META_RAW,
   2439     /* Number of streams and size of streams in
   2440        current configuration for pic res*/
   2441     CAM_INTF_META_STREAM_INFO_FOR_PIC_RES,
   2442     CAM_INTF_META_FOCUS_DEPTH_INFO,
   2443     /* Operation Mode for IR */
   2444     CAM_INTF_META_IR_MODE,
   2445     /* AEC,AWB Speed control enabled */
   2446     CAM_INTF_META_AEC_CONVERGENCE_SPEED,
   2447     CAM_INTF_META_AWB_CONVERGENCE_SPEED,
   2448     /*Focus value output from af core*/
   2449     CAM_INTF_META_FOCUS_VALUE,
   2450     /*Spot light detection result output from af core*/
   2451     CAM_INTF_META_SPOT_LIGHT_DETECT,
   2452     /* HAL based HDR*/
   2453     CAM_INTF_PARM_HAL_BRACKETING_HDR,
   2454     /* Dual camera - Spatial Alignment Compute/Correction output info*/
   2455     CAM_INTF_META_DC_SAC_OUTPUT_INFO,
   2456     /* Dual camera - enable low power mode for the slave camera */
   2457     CAM_INTF_META_DC_LOW_POWER_ENABLE,
   2458     /* Dual camera - indicate if in the snapshot postprocess zoom range */
   2459     CAM_INTF_META_DC_IN_SNAPSHOT_PP_ZOOM_RANGE,
   2460     /* Dual camera - indicate if snapshot bokeh mode is selected */
   2461     CAM_INTF_META_DC_BOKEH_MODE,
   2462     CAM_INTF_PARM_FOV_COMP_ENABLE,
   2463     /*Meta to update dual LED calibration results to app*/
   2464     CAM_INTF_META_LED_CALIB_RESULT,
   2465     /* Whether to enable hybrid ae mode */
   2466     CAM_INTF_META_HYBRID_AE,
   2467     /* DevCamDebug metadata CAM_TYPES.h */
   2468     CAM_INTF_META_DEV_CAM_ENABLE,
   2469     /* DevCamDebug metadata CAM_TYPES.h AF */
   2470     CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,
   2471     CAM_INTF_META_AF_TOF_CONFIDENCE,
   2472     CAM_INTF_META_AF_TOF_DISTANCE,
   2473     CAM_INTF_META_DEV_CAM_AF_LUMA,
   2474     CAM_INTF_META_DEV_CAM_AF_HAF_STATE,
   2475     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_TARGET_POS,
   2476     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_CONFIDENCE,
   2477     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_REFOCUS,
   2478     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_TARGET_POS,
   2479     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_CONFIDENCE,
   2480     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_REFOCUS,
   2481     CAM_INTF_META_DEV_CAM_AF_MONITOR_TYPE_SELECT,
   2482     CAM_INTF_META_DEV_CAM_AF_MONITOR_REFOCUS,
   2483     CAM_INTF_META_DEV_CAM_AF_MONITOR_TARGET_POS,
   2484     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_TARGET_POS,
   2485     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEXT_POS,
   2486     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEAR_POS,
   2487     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_FAR_POS,
   2488     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_CONFIDENCE,
   2489     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_TARGET_POS,
   2490     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEXT_POS,
   2491     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEAR_POS,
   2492     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_FAR_POS,
   2493     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_CONFIDENCE,
   2494     CAM_INTF_META_DEV_CAM_AF_SEARCH_TYPE_SELECT,
   2495     CAM_INTF_META_DEV_CAM_AF_SEARCH_NEXT_POS,
   2496     CAM_INTF_META_DEV_CAM_AF_SEARCH_TARGET_POS,
   2497     /* DevCamDebug metadata CAM_TYPES.h AEC */
   2498     CAM_INTF_META_DEV_CAM_AEC_TARGET_LUMA,
   2499     CAM_INTF_META_DEV_CAM_AEC_COMP_LUMA,
   2500     CAM_INTF_META_DEV_CAM_AEC_AVG_LUMA,
   2501     CAM_INTF_META_DEV_CAM_AEC_CUR_LUMA,
   2502     CAM_INTF_META_DEV_CAM_AEC_LINECOUNT,
   2503     CAM_INTF_META_DEV_CAM_AEC_REAL_GAIN,
   2504     CAM_INTF_META_DEV_CAM_AEC_EXP_INDEX,
   2505     CAM_INTF_META_DEV_CAM_AEC_LUX_IDX,
   2506     /* DevCamDebug metadata CAM_TYPES.h zzHDR */
   2507     CAM_INTF_META_DEV_CAM_AEC_L_REAL_GAIN,
   2508     CAM_INTF_META_DEV_CAM_AEC_L_LINECOUNT,
   2509     CAM_INTF_META_DEV_CAM_AEC_S_REAL_GAIN,
   2510     CAM_INTF_META_DEV_CAM_AEC_S_LINECOUNT,
   2511     CAM_INTF_META_DEV_CAM_AEC_HDR_SENSITIVITY_RATIO,
   2512     CAM_INTF_META_DEV_CAM_AEC_HDR_EXP_TIME_RATIO,
   2513     /* DevCamDebug metadata CAM_TYPES.h ARDC */
   2514     CAM_INTF_META_DEV_CAM_AEC_TOTAL_DRC_GAIN,
   2515     CAM_INTF_META_DEV_CAM_AEC_COLOR_DRC_GAIN,
   2516     CAM_INTF_META_DEV_CAM_AEC_GTM_RATIO,
   2517     CAM_INTF_META_DEV_CAM_AEC_LTM_RATIO,
   2518     CAM_INTF_META_DEV_CAM_AEC_LA_RATIO,
   2519     CAM_INTF_META_DEV_CAM_AEC_GAMMA_RATIO,
   2520     /* DevCamDebug metadata CAM_INTF.H AEC MOTION */
   2521     CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DX,
   2522     CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DY,
   2523     CAM_INTF_META_DEV_CAM_AEC_SUBJECT_MOTION,
   2524     /* DevCamDebug metadata CAM_TYPES.h AWB */
   2525     CAM_INTF_META_DEV_CAM_AWB_R_GAIN,
   2526     CAM_INTF_META_DEV_CAM_AWB_G_GAIN,
   2527     CAM_INTF_META_DEV_CAM_AWB_B_GAIN,
   2528     CAM_INTF_META_DEV_CAM_AWB_CCT,
   2529     CAM_INTF_META_DEV_CAM_AWB_DECISION,
   2530     /* DevCamDebug metadata end */
   2531     /* AF scene change */
   2532     CAM_INTF_META_AF_SCENE_CHANGE,
   2533     /* Gain applied post stats collection in ISP */
   2534     CAM_INTF_META_ISP_POST_STATS_SENSITIVITY,
   2535     /* Dual camera - user zoom value. This will always be the wider camera zoom value */
   2536     CAM_INTF_PARM_DC_USERZOOM,
   2537     /* Dual camera sync parameter */
   2538     CAM_INTF_PARM_SYNC_DC_PARAMETERS,
   2539     /* AF focus position info */
   2540     CAM_INTF_META_AF_FOCUS_POS,
   2541     /* AEC LUX index */
   2542     CAM_INTF_META_AEC_LUX_INDEX,
   2543     /* Object's focus distance in cm*/
   2544     CAM_INTF_META_AF_OBJ_DIST_CM,
   2545     /* Binning Correction Algorithm */
   2546     CAM_INTF_META_BINNING_CORRECTION_MODE,
   2547     /* Read Sensor OIS data */
   2548     CAM_INTF_META_OIS_READ_DATA,
   2549     /* OIS data info within frame */
   2550     CAM_INTF_META_FRAME_OIS_DATA,
   2551     CAM_INTF_META_PDAF_DATA_ENABLE,
   2552     /*event to flush stream buffers*/
   2553     CAM_INTF_PARM_FLUSH_FRAMES,
   2554     /* Number of histogram bins */
   2555     CAM_INTF_META_STATS_HISTOGRAM_BINS,
   2556     /* AF regions condidence */
   2557     CAM_INTF_META_AF_REGIONS_CONFIDENCE,
   2558     /* Early AF state due to trigger */
   2559     CAM_INTF_META_EARLY_AF_STATE,
   2560     /* Exposure time boost */
   2561     CAM_INTF_META_EXP_TIME_BOOST,
   2562     /* Easel HDR+ makernote */
   2563     CAM_INTF_META_MAKERNOTE,
   2564     CAM_INTF_PARM_MAX
   2565 } cam_intf_parm_type_t;
   2566 
   2567 typedef struct {
   2568     uint32_t forced;
   2569     union {
   2570       uint32_t force_linecount_value;
   2571       float    force_gain_value;
   2572       float    force_snap_exp_value;
   2573       float    force_exp_value;
   2574       uint32_t force_snap_linecount_value;
   2575       float    force_snap_gain_value;
   2576     } u;
   2577 } cam_ez_force_params_t;
   2578 
   2579 typedef struct {
   2580     float cam_black_level[4];
   2581 } cam_black_level_metadata_t;
   2582 
   2583 typedef enum {
   2584     CAM_EZTUNE_CMD_STATUS,
   2585     CAM_EZTUNE_CMD_AEC_ENABLE,
   2586     CAM_EZTUNE_CMD_AWB_ENABLE,
   2587     CAM_EZTUNE_CMD_AF_ENABLE,
   2588     CAM_EZTUNE_CMD_AEC_FORCE_LINECOUNT,
   2589     CAM_EZTUNE_CMD_AEC_FORCE_GAIN,
   2590     CAM_EZTUNE_CMD_AEC_FORCE_EXP,
   2591     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_LC,
   2592     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_GAIN,
   2593     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_EXP,
   2594     CAM_EZTUNE_CMD_AWB_MODE,
   2595     CAM_EZTUNE_CMD_AWB_FORCE_DUAL_LED_IDX,
   2596 } cam_eztune_cmd_type_t;
   2597 
   2598 typedef struct {
   2599   cam_eztune_cmd_type_t   cmd;
   2600   union {
   2601     int32_t running;
   2602     int32_t aec_enable;
   2603     int32_t awb_enable;
   2604     int32_t af_enable;
   2605     cam_ez_force_params_t ez_force_param;
   2606     int32_t awb_mode;
   2607     int32_t ez_force_dual_led_idx;
   2608   } u;
   2609 } cam_eztune_cmd_data_t;
   2610 
   2611 
   2612 /*****************************************************************************
   2613  *                 Code for HAL3 data types                                  *
   2614  ****************************************************************************/
   2615 typedef enum {
   2616     CAM_INTF_METADATA_MAX
   2617 } cam_intf_metadata_type_t;
   2618 
   2619 typedef enum {
   2620     CAM_INTENT_CUSTOM,
   2621     CAM_INTENT_PREVIEW,
   2622     CAM_INTENT_STILL_CAPTURE,
   2623     CAM_INTENT_VIDEO_RECORD,
   2624     CAM_INTENT_VIDEO_SNAPSHOT,
   2625     CAM_INTENT_ZERO_SHUTTER_LAG,
   2626     CAM_INTENT_MAX,
   2627 } cam_intent_t;
   2628 
   2629 typedef enum {
   2630     /* Full application control of pipeline. All 3A routines are disabled,
   2631      * no other settings in android.control.* have any effect */
   2632     CAM_CONTROL_OFF,
   2633     /* Use settings for each individual 3A routine. Manual control of capture
   2634      * parameters is disabled. All controls in android.control.* besides sceneMode
   2635      * take effect */
   2636     CAM_CONTROL_AUTO,
   2637     /* Use specific scene mode. Enabling this disables control.aeMode,
   2638      * control.awbMode and control.afMode controls; the HAL must ignore those
   2639      * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode).
   2640      * Other control entries are still active. This setting can only be used if
   2641      * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this
   2642      * in HAL ?*/
   2643     CAM_CONTROL_USE_SCENE_MODE,
   2644     CAM_CONTROL_MAX
   2645 } cam_control_mode_t;
   2646 
   2647 typedef enum {
   2648     /* Use the android.colorCorrection.transform matrix to do color conversion */
   2649     CAM_COLOR_CORRECTION_TRANSFORM_MATRIX,
   2650     /* Must not slow down frame rate relative to raw bayer output */
   2651     CAM_COLOR_CORRECTION_FAST,
   2652     /* Frame rate may be reduced by high quality */
   2653     CAM_COLOR_CORRECTION_HIGH_QUALITY,
   2654 } cam_color_correct_mode_t;
   2655 
   2656 typedef enum {
   2657     CAM_COLOR_CORRECTION_ABERRATION_OFF,
   2658     CAM_COLOR_CORRECTION_ABERRATION_FAST,
   2659     CAM_COLOR_CORRECTION_ABERRATION_HIGH_QUALITY,
   2660     CAM_COLOR_CORRECTION_ABERRATION_MAX
   2661 } cam_aberration_mode_t;
   2662 
   2663 #define CC_MATRIX_ROWS 3
   2664 #define CC_MATRIX_COLS 3
   2665 
   2666 typedef struct {
   2667     /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */
   2668     cam_rational_type_t transform_matrix[CC_MATRIX_ROWS][CC_MATRIX_COLS];
   2669 } cam_color_correct_matrix_t;
   2670 
   2671 #define CAM_FOCAL_LENGTHS_MAX     1
   2672 #define CAM_APERTURES_MAX         1
   2673 #define CAM_FILTER_DENSITIES_MAX  1
   2674 #define CAM_MAX_MAP_HEIGHT        6
   2675 #define CAM_MAX_MAP_WIDTH         6
   2676 #define CAM_MAX_SHADING_MAP_WIDTH 17
   2677 #define CAM_MAX_SHADING_MAP_HEIGHT 13
   2678 #define CAM_MAX_TONEMAP_CURVE_SIZE 64
   2679 #define CAM_MAX_FLASH_BRACKETING    5
   2680 
   2681 typedef struct {
   2682     /* A 1D array of pairs of floats.
   2683      * Mapping a 0-1 input range to a 0-1 output range.
   2684      * The input range must be monotonically increasing with N,
   2685      * and values between entries should be linearly interpolated.
   2686      * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0],
   2687      * then the input->output mapping for a few sample points would be:
   2688      * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */
   2689     float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2];
   2690 } cam_tonemap_curve_t;
   2691 
   2692 typedef struct {
   2693    size_t tonemap_points_cnt;
   2694    cam_tonemap_curve_t curves[3];
   2695 } cam_rgb_tonemap_curves;
   2696 
   2697 typedef struct {
   2698    size_t tonemap_points_cnt;
   2699    cam_tonemap_curve_t curve;
   2700 } cam_profile_tone_curve;
   2701 
   2702 #define NEUTRAL_COL_POINTS 3
   2703 
   2704 typedef struct {
   2705     cam_rational_type_t neutral_col_point[NEUTRAL_COL_POINTS];
   2706 } cam_neutral_col_point_t;
   2707 
   2708 typedef enum {
   2709     OFF,
   2710     FAST,
   2711     QUALITY,
   2712 } cam_quality_preference_t;
   2713 
   2714 typedef enum {
   2715     CAM_FLASH_CTRL_OFF,
   2716     CAM_FLASH_CTRL_SINGLE,
   2717     CAM_FLASH_CTRL_TORCH
   2718 } cam_flash_ctrl_t;
   2719 
   2720 typedef struct {
   2721     uint8_t ae_mode;
   2722     uint8_t awb_mode;
   2723     uint8_t af_mode;
   2724 } cam_scene_mode_overrides_t;
   2725 
   2726 typedef struct {
   2727     int32_t left;
   2728     int32_t top;
   2729     int32_t width;
   2730     int32_t height;
   2731 } cam_crop_region_t;
   2732 
   2733 typedef struct {
   2734     /* Estimated sharpness for each region of the input image.
   2735      * Normalized to be between 0 and maxSharpnessMapValue.
   2736      * Higher values mean sharper (better focused) */
   2737     int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT];
   2738 } cam_sharpness_map_t;
   2739 
   2740 typedef struct {
   2741    float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH];
   2742 } cam_lens_shading_map_t;
   2743 
   2744 typedef struct {
   2745     int32_t min_value;
   2746     int32_t max_value;
   2747     int32_t def_value;
   2748     int32_t step;
   2749 } cam_control_range_t;
   2750 
   2751 #define CAM_QCOM_FEATURE_NONE            (cam_feature_mask_t)0UL
   2752 #define CAM_QCOM_FEATURE_FACE_DETECTION ((cam_feature_mask_t)1UL<<0)
   2753 #define CAM_QCOM_FEATURE_DENOISE2D      ((cam_feature_mask_t)1UL<<1)
   2754 #define CAM_QCOM_FEATURE_CROP           ((cam_feature_mask_t)1UL<<2)
   2755 #define CAM_QCOM_FEATURE_ROTATION       ((cam_feature_mask_t)1UL<<3)
   2756 #define CAM_QCOM_FEATURE_FLIP           ((cam_feature_mask_t)1UL<<4)
   2757 #define CAM_QCOM_FEATURE_HDR            ((cam_feature_mask_t)1UL<<5)
   2758 #define CAM_QCOM_FEATURE_REGISTER_FACE  ((cam_feature_mask_t)1UL<<6)
   2759 #define CAM_QCOM_FEATURE_SHARPNESS      ((cam_feature_mask_t)1UL<<7)
   2760 #define CAM_QCOM_FEATURE_VIDEO_HDR      ((cam_feature_mask_t)1UL<<8)
   2761 #define CAM_QCOM_FEATURE_CAC            ((cam_feature_mask_t)1UL<<9)
   2762 #define CAM_QCOM_FEATURE_SCALE          ((cam_feature_mask_t)1UL<<10)
   2763 #define CAM_QCOM_FEATURE_EFFECT         ((cam_feature_mask_t)1UL<<11)
   2764 #define CAM_QCOM_FEATURE_UBIFOCUS       ((cam_feature_mask_t)1UL<<12)
   2765 #define CAM_QCOM_FEATURE_CHROMA_FLASH   ((cam_feature_mask_t)1UL<<13)
   2766 #define CAM_QCOM_FEATURE_OPTIZOOM       ((cam_feature_mask_t)1UL<<14)
   2767 #define CAM_QCOM_FEATURE_SENSOR_HDR     ((cam_feature_mask_t)1UL<<15)
   2768 #define CAM_QCOM_FEATURE_REFOCUS        ((cam_feature_mask_t)1UL<<16)
   2769 #define CAM_QCOM_FEATURE_CPP_TNR        ((cam_feature_mask_t)1UL<<17)
   2770 #define CAM_QCOM_FEATURE_RAW_PROCESSING ((cam_feature_mask_t)1UL<<18)
   2771 #define CAM_QCOM_FEATURE_TRUEPORTRAIT   ((cam_feature_mask_t)1UL<<19)
   2772 #define CAM_QCOM_FEATURE_LLVD           ((cam_feature_mask_t)1UL<<20)
   2773 #define CAM_QCOM_FEATURE_DIS20          ((cam_feature_mask_t)1UL<<21)
   2774 #define CAM_QCOM_FEATURE_STILLMORE      ((cam_feature_mask_t)1UL<<22)
   2775 #define CAM_QCOM_FEATURE_DCRF           ((cam_feature_mask_t)1UL<<23)
   2776 #define CAM_QCOM_FEATURE_CDS            ((cam_feature_mask_t)1UL<<24)
   2777 #define CAM_QCOM_FEATURE_EZTUNE         ((cam_feature_mask_t)1UL<<25)
   2778 #define CAM_QCOM_FEATURE_DSDN           ((cam_feature_mask_t)1UL<<26) //Special CDS in CPP block
   2779 #define CAM_QCOM_FEATURE_SW2D           ((cam_feature_mask_t)1UL<<27)
   2780 #define CAM_OEM_FEATURE_1               ((cam_feature_mask_t)1UL<<28)
   2781 #define CAM_OEM_FEATURE_2               ((cam_feature_mask_t)1UL<<29)
   2782 #define CAM_QTI_FEATURE_SW_TNR          ((cam_feature_mask_t)1UL<<30)
   2783 #define CAM_QCOM_FEATURE_METADATA_PROCESSING ((cam_feature_mask_t)1UL<<31)
   2784 #define CAM_QCOM_FEATURE_PAAF           (((cam_feature_mask_t)1UL)<<32)
   2785 #define CAM_QCOM_FEATURE_QUADRA_CFA     (((cam_feature_mask_t)1UL)<<33)
   2786 #define CAM_QTI_FEATURE_PPEISCORE       (((cam_feature_mask_t)1UL)<<34)
   2787 #define CAM_QCOM_FEATURE_ZIGZAG_HDR     (((cam_feature_mask_t)1UL)<<35)
   2788 #define CAM_QCOM_FEATURE_STAGGERED_VIDEO_HDR (((cam_feature_mask_t)1UL)<<36)
   2789 #define CAM_QCOM_FEATURE_METADATA_BYPASS (((cam_feature_mask_t)1UL)<<37)
   2790 #define CAM_QTI_FEATURE_SAT             (((cam_feature_mask_t)1UL)<<38)
   2791 #define CAM_QTI_FEATURE_CPP_DOWNSCALE   (((cam_feature_mask_t)1UL)<<39)
   2792 #define CAM_QTI_FEATURE_FIXED_FOVC      (((cam_feature_mask_t)1UL) << 40)
   2793 #define CAM_QCOM_FEATURE_IR             (((cam_feature_mask_t)1UL)<<41)
   2794 #define CAM_QTI_FEATURE_SAC             (((cam_feature_mask_t)1UL)<<42)
   2795 #define CAM_QTI_FEATURE_RTBDM           (((cam_feature_mask_t)1UL)<<43)
   2796 #define CAM_QTI_FEATURE_BINNING_CORRECTION (((cam_feature_mask_t)1UL)<<44)
   2797 #define CAM_QTI_FEATURE_RTB             (((cam_feature_mask_t)1UL)<<45)
   2798 #define CAM_QCOM_FEATURE_GOOG_ZOOM      (((cam_feature_mask_t)1UL)<<46)
   2799 #define CAM_QCOM_FEATURE_PP_SUPERSET    (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\
   2800                                          CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\
   2801                                          CAM_QCOM_FEATURE_SCALE|CAM_QCOM_FEATURE_CAC|\
   2802                                          CAM_QCOM_FEATURE_EZTUNE|CAM_QCOM_FEATURE_CPP_TNR|\
   2803                                          CAM_QCOM_FEATURE_LLVD|CAM_QCOM_FEATURE_QUADRA_CFA)
   2804 
   2805 #define CAM_QCOM_FEATURE_PP_PASS_1      CAM_QCOM_FEATURE_PP_SUPERSET
   2806 #define CAM_QCOM_FEATURE_PP_PASS_2      CAM_QCOM_FEATURE_SCALE | CAM_QCOM_FEATURE_CROP;
   2807 
   2808 typedef struct {
   2809    cam_rotation_t rotation;         /* jpeg rotation */
   2810    cam_rotation_t device_rotation;  /* device rotation */
   2811    uint32_t streamId;
   2812 } cam_rotation_info_t;
   2813 
   2814 typedef enum {
   2815     FLIP_NONE = 0, /* 00b */
   2816     FLIP_H = 1,    /* 01b */
   2817     FLIP_V = 2,    /* 10b */
   2818     FLIP_V_H = 3,  /* 11b */
   2819 } cam_flip_t;
   2820 
   2821 typedef struct {
   2822     uint32_t bundle_id;                            /* bundle id */
   2823     uint8_t num_of_streams;                        /* number of streams in the bundle */
   2824     uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */
   2825 } cam_bundle_config_t;
   2826 
   2827 typedef enum {
   2828     CAM_ONLINE_REPROCESS_TYPE,    /* online reprocess, frames from running streams */
   2829     CAM_OFFLINE_REPROCESS_TYPE,   /* offline reprocess, frames from external source */
   2830 } cam_reprocess_type_enum_t;
   2831 
   2832 typedef struct {
   2833     uint8_t burst_count;
   2834     uint8_t min_burst_count;
   2835     uint8_t max_burst_count;
   2836 } cam_still_more_t;
   2837 
   2838 typedef struct {
   2839     uint8_t burst_count;
   2840     uint8_t output_count;
   2841     uint8_t flash_bracketing[CAM_MAX_FLASH_BRACKETING];
   2842     uint8_t metadata_index;
   2843 } cam_chroma_flash_t;
   2844 
   2845 typedef enum {
   2846     CAM_HDR_MODE_SINGLEFRAME,    /* Single frame HDR mode which does only tone mapping */
   2847     CAM_HDR_MODE_MULTIFRAME,     /* Multi frame HDR mode which needs two frames with 0.5x and 2x exposure respectively */
   2848 } cam_hdr_mode_enum_t;
   2849 
   2850 typedef struct {
   2851     uint32_t hdr_enable;
   2852     uint32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */
   2853     cam_hdr_mode_enum_t hdr_mode;
   2854 } cam_hdr_param_t;
   2855 
   2856 typedef struct {
   2857     int32_t output_width;
   2858     int32_t output_height;
   2859 } cam_scale_param_t;
   2860 
   2861 typedef struct {
   2862     uint8_t enable;
   2863     uint8_t burst_count;
   2864     uint8_t focus_steps[MAX_AF_BRACKETING_VALUES];
   2865     uint8_t output_count;
   2866     uint32_t meta_max_size;
   2867 } cam_af_bracketing_t;
   2868 
   2869 typedef struct {
   2870     uint8_t enable;
   2871     uint8_t burst_count;
   2872 } cam_flash_bracketing_t;
   2873 
   2874 typedef struct {
   2875     uint8_t enable;
   2876     uint8_t burst_count;
   2877     uint8_t zoom_threshold;
   2878 } cam_opti_zoom_t;
   2879 
   2880 typedef struct {
   2881     size_t meta_max_size;
   2882 } cam_true_portrait_t;
   2883 
   2884 typedef enum {
   2885     CAM_FLASH_OFF,
   2886     CAM_FLASH_ON
   2887 } cam_flash_value_t;
   2888 
   2889 typedef struct {
   2890     cam_sensor_t sens_type;
   2891     cam_format_t native_format;
   2892 } cam_sensor_type_t;
   2893 
   2894 typedef struct {
   2895     uint32_t result;
   2896     uint32_t header_size;
   2897     uint32_t width;
   2898     uint32_t height;
   2899     uint8_t data[0];
   2900 } cam_misc_buf_t;
   2901 
   2902 typedef struct {
   2903     uint32_t misc_buffer_index;
   2904 } cam_misc_buf_param_t;
   2905 
   2906 typedef struct {
   2907     /* reprocess feature mask */
   2908     cam_feature_mask_t feature_mask;
   2909 
   2910     /* individual setting for features to be reprocessed */
   2911     cam_denoise_param_t denoise2d;
   2912     cam_rect_t input_crop;
   2913     cam_rotation_t rotation;
   2914     uint32_t flip;
   2915     int32_t sharpness;
   2916     int32_t effect;
   2917     cam_hdr_param_t hdr_param;
   2918     cam_scale_param_t scale_param;
   2919 
   2920     uint8_t zoom_level;
   2921     cam_flash_value_t flash_value;
   2922     cam_misc_buf_param_t misc_buf_param;
   2923     uint32_t burst_cnt;
   2924     uint8_t cur_reproc_count;
   2925     uint8_t total_reproc_count;
   2926 } cam_pp_feature_config_t;
   2927 
   2928 typedef struct {
   2929     uint32_t input_stream_id;
   2930     /* input source stream type */
   2931     cam_stream_type_t input_stream_type;
   2932 } cam_pp_online_src_config_t;
   2933 
   2934 typedef struct {
   2935     /* image format */
   2936     cam_format_t input_fmt;
   2937 
   2938     /* image dimension */
   2939     cam_dimension_t input_dim;
   2940 
   2941     /* buffer plane information, will be calc based on stream_type, fmt,
   2942        dim, and padding_info(from stream config). Info including:
   2943        offset_x, offset_y, stride, scanline, plane offset */
   2944     cam_stream_buf_plane_info_t input_buf_planes;
   2945 
   2946     /* number of input reprocess buffers */
   2947     uint8_t num_of_bufs;
   2948 
   2949     /* input source type */
   2950     cam_stream_type_t input_type;
   2951 
   2952 } cam_pp_offline_src_config_t;
   2953 
   2954 /* reprocess stream input configuration */
   2955 typedef struct {
   2956     /* input source config */
   2957     cam_reprocess_type_enum_t pp_type;
   2958     union {
   2959         cam_pp_online_src_config_t online;
   2960         cam_pp_offline_src_config_t offline;
   2961     };
   2962 
   2963     /* pp feature config */
   2964     cam_pp_feature_config_t pp_feature_config;
   2965 } cam_stream_reproc_config_t;
   2966 
   2967 typedef struct {
   2968     uint8_t crop_enabled;
   2969     cam_rect_t input_crop;
   2970 } cam_crop_param_t;
   2971 
   2972 typedef struct {
   2973     uint8_t trigger;
   2974     int32_t trigger_id;
   2975 } cam_trigger_t;
   2976 
   2977 typedef struct {
   2978     cam_denoise_param_t denoise2d;
   2979     cam_crop_param_t crop;
   2980     uint32_t flip;     /* 0 means no flip */
   2981     uint32_t uv_upsample; /* 0 means no chroma upsampling */
   2982     int32_t sharpness; /* 0 means no sharpness */
   2983     int32_t effect;
   2984     cam_rotation_t rotation;
   2985     cam_rotation_t device_rotation;
   2986 } cam_per_frame_pp_config_t;
   2987 
   2988 typedef enum {
   2989     CAM_OPT_STAB_OFF,
   2990     CAM_OPT_STAB_ON,
   2991     CAM_OPT_STAB_MAX
   2992 } cam_optical_stab_modes_t;
   2993 
   2994 typedef enum {
   2995     CAM_FILTER_ARRANGEMENT_RGGB,
   2996     CAM_FILTER_ARRANGEMENT_GRBG,
   2997     CAM_FILTER_ARRANGEMENT_GBRG,
   2998     CAM_FILTER_ARRANGEMENT_BGGR,
   2999 
   3000     /* Sensor is not Bayer; output has 3 16-bit values for each pixel,
   3001      * instead of just 1 16-bit value per pixel.*/
   3002     CAM_FILTER_ARRANGEMENT_RGB,
   3003     /* Sensor is YUV; SW do not have access to actual RAW,
   3004      * output is interleaved UYVY */
   3005     CAM_FILTER_ARRANGEMENT_UYVY,
   3006     CAM_FILTER_ARRANGEMENT_YUYV,
   3007     CAM_FILTER_ARRANGEMENT_Y
   3008 } cam_color_filter_arrangement_t;
   3009 
   3010 typedef enum {
   3011   CAM_AF_LENS_STATE_STATIONARY,
   3012   CAM_AF_LENS_STATE_MOVING,
   3013 } cam_af_lens_state_t;
   3014 
   3015 typedef enum {
   3016     CAM_AWB_STATE_INACTIVE,
   3017     CAM_AWB_STATE_SEARCHING,
   3018     CAM_AWB_STATE_CONVERGED,
   3019     CAM_AWB_STATE_LOCKED
   3020 } cam_awb_state_t;
   3021 
   3022 typedef enum {
   3023     CAM_FOCUS_UNCALIBRATED,
   3024     CAM_FOCUS_APPROXIMATE,
   3025     CAM_FOCUS_CALIBRATED
   3026 } cam_focus_calibration_t;
   3027 
   3028 typedef enum {
   3029     CAM_TEST_PATTERN_OFF,
   3030     CAM_TEST_PATTERN_SOLID_COLOR,
   3031     CAM_TEST_PATTERN_COLOR_BARS,
   3032     CAM_TEST_PATTERN_COLOR_BARS_FADE_TO_GRAY,
   3033     CAM_TEST_PATTERN_PN9,
   3034     CAM_TEST_PATTERN_CUSTOM1 = 256
   3035 } cam_test_pattern_mode_t;
   3036 
   3037 typedef struct {
   3038     cam_test_pattern_mode_t mode;
   3039     int32_t r;
   3040     int32_t gr;
   3041     int32_t gb;
   3042     int32_t b;
   3043 } cam_test_pattern_data_t;
   3044 
   3045 typedef enum {
   3046     CAM_AWB_D50,
   3047     CAM_AWB_D65,
   3048     CAM_AWB_D75,
   3049     CAM_AWB_A,
   3050     CAM_AWB_CUSTOM_A,
   3051     CAM_AWB_WARM_FLO,
   3052     CAM_AWB_COLD_FLO,
   3053     CAM_AWB_CUSTOM_FLO,
   3054     CAM_AWB_NOON,
   3055     CAM_AWB_CUSTOM_DAYLIGHT,
   3056     CAM_AWB_INVALID_ALL_LIGHT,
   3057 } cam_illuminat_t;
   3058 
   3059 typedef enum {
   3060     LEGACY_RAW,
   3061     MIPI_RAW,
   3062 } cam_opaque_raw_format_t;
   3063 
   3064 typedef enum {
   3065     CAM_PERF_NORMAL = 0,
   3066     CAM_PERF_HIGH,
   3067     CAM_PERF_HIGH_PERFORMANCE,
   3068 } cam_perf_mode_t;
   3069 
   3070 typedef struct {
   3071     float real_gain;
   3072     float lux_idx;
   3073     float exp_time;
   3074 } cam_intf_aec_t;
   3075 
   3076 #define CAM_INTF_AEC_DATA_MAX   (10)
   3077 
   3078 typedef struct {
   3079     uint32_t frame_count;
   3080     cam_intf_aec_t aec_data[CAM_INTF_AEC_DATA_MAX];
   3081 } cam_intf_meta_imglib_input_aec_t;
   3082 
   3083 typedef struct {
   3084     cam_intf_meta_imglib_input_aec_t meta_imglib_input_aec;
   3085 } cam_intf_meta_imglib_t;
   3086 
   3087 typedef struct {
   3088     uint8_t previewOnly;
   3089     uint64_t value;
   3090 } cam_intf_parm_manual_3a_t;
   3091 
   3092 typedef enum {
   3093     CAM_MANUAL_CAPTURE_TYPE_OFF, /*Manual capture mode disabled*/
   3094     CAM_MANUAL_CAPTURE_TYPE_1,   /*Normal ZSL capture with limited 3A settings*/
   3095     CAM_MANUAL_CAPTURE_TYPE_2,   /*Low light capture mode */
   3096     CAM_MANUAL_CAPTURE_TYPE_3,   /*Offline RAW processing */
   3097     CAM_MANUAL_CAPTURE_TYPE_4    /*Offline RAW processing with multiple RAW*/
   3098 } cam_manual_capture_type;
   3099 
   3100 typedef enum {
   3101     CAM_ANALYSIS_INFO_FD_STILL,   /*Analysis requirements for STILL PREVIEW*/
   3102     CAM_ANALYSIS_INFO_FD_VIDEO,   /*Analysis requirements for VIDEO*/
   3103     CAM_ANALYSIS_INFO_PAAF,       /*Analysis requirements for PAAF*/
   3104     CAM_ANALYSIS_INFO_MAX,     /*Max number*/
   3105 } cam_analysis_info_type;
   3106 
   3107 typedef struct {
   3108     /* Whether the information here is valid or not */
   3109     uint8_t valid;
   3110 
   3111     /* Whether analysis supported by hw */
   3112     uint8_t hw_analysis_supported;
   3113 
   3114     /* Analysis stream max supported size */
   3115     cam_dimension_t analysis_max_res;
   3116 
   3117     /* Analysis stream padding info */
   3118     cam_padding_info_t analysis_padding_info;
   3119 
   3120     /* Analysis format */
   3121     cam_format_t analysis_format;
   3122 
   3123     /* Analysis recommended size */
   3124     cam_dimension_t analysis_recommended_res;
   3125 } cam_analysis_info_t;
   3126 
   3127 /** mm_camera_event_t: structure for event
   3128 *    @server_event_type : event type from serer
   3129 *    @status : status of an event, value could be
   3130 *              CAM_STATUS_SUCCESS
   3131 *              CAM_STATUS_FAILED
   3132 **/
   3133 typedef struct {
   3134     cam_event_type_t server_event_type;
   3135     uint32_t status;
   3136 } cam_event_t;
   3137 
   3138 typedef struct {
   3139     /* Information for DDM metadata*/
   3140     cam_stream_crop_info_t   sensor_crop_info; /* sensor crop info */
   3141     cam_stream_crop_info_t   camif_crop_info; /* CAMIF crop info */
   3142     cam_stream_crop_info_t   isp_crop_info; /* ISP crop info */
   3143     cam_stream_crop_info_t   cpp_crop_info; /* CPP crop info */
   3144     cam_focal_length_ratio_t af_focal_length_ratio; /* AF focal length ratio */
   3145     int32_t                  pipeline_flip; /* current pipeline flip and rotational parameters */
   3146     cam_rotation_info_t      rotation_info; /* rotation information */
   3147     cam_area_t               af_roi;        /* AF roi info */
   3148     /* Information for CPP reprocess */
   3149     cam_dyn_img_data_t       dyn_mask;      /* Post processing dynamic feature mask */
   3150 } cam_reprocess_info_t;
   3151 
   3152 /***********************************
   3153 * ENUM definition for custom parameter type
   3154 ************************************/
   3155 typedef enum {
   3156     CAM_CUSTOM_PARM_EXAMPLE,
   3157     CAM_CUSTOM_PARM_MAX,
   3158 } cam_custom_parm_type;
   3159 
   3160 typedef enum {
   3161     CAM_STREAM_CACHE_OPS_CLEAR_FLAGS,
   3162     CAM_STREAM_CACHE_OPS_HONOUR_FLAGS,
   3163     CAM_STREAM_CACHE_OPS_DISABLED
   3164 } cam_stream_cache_ops_t;
   3165 
   3166 typedef struct {
   3167   int reserved_i[16];
   3168   float reserved_f[16];
   3169 }tuning_mod1_data_AWB;
   3170 
   3171 typedef struct {
   3172   int reserved_i[16];
   3173   float reserved_f[16];
   3174 }tuning_mod1_data_AEC;
   3175 
   3176 typedef struct {
   3177   int reserved_i[16];
   3178   float reserved_f[16];
   3179 }tuning_mod1_data_AF;
   3180 
   3181 
   3182 // Used with MSM_CAMERA_PRIV_STREAM_ON.
   3183 typedef enum {
   3184     CAM_STREAM_ON_TYPE_CONFIG, // Configure modules for stream ON without starting sensor streaming.
   3185     CAM_STREAM_ON_TYPE_START_SENSOR_STREAMING, // Start sensor streaming.
   3186 } cam_stream_on_type_t;
   3187 
   3188 
   3189 // Used with CAM_INTF_META_MAKERNOTE.
   3190 typedef struct {
   3191     char data[MAX_MAKERNOTE_LENGTH];
   3192     uint32_t length;
   3193 } cam_makernote_t;
   3194 
   3195 #endif /* __QCAMERA_TYPES_H__ */
   3196