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