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