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