• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __QCAMERA_TYPES_H__
31 #define __QCAMERA_TYPES_H__
32 
33 #include <stdint.h>
34 #include <pthread.h>
35 #include <inttypes.h>
36 #include <media/msmb_camera.h>
37 
38 #define CAM_MAX_NUM_BUFS_PER_STREAM 64
39 #define MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES 8096
40 #define AWB_DEBUG_DATA_SIZE               (69189)
41 #define AEC_DEBUG_DATA_SIZE               (3921)
42 #define AF_DEBUG_DATA_SIZE                (8487)
43 #define ASD_DEBUG_DATA_SIZE               (100)
44 #define STATS_BUFFER_DEBUG_DATA_SIZE      (74773)
45 
46 #define CEILING64(X) (((X) + 0x0003F) & 0xFFFFFFC0)
47 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
48 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
49 #define CEILING4(X)  (((X) + 0x0003) & 0xFFFC)
50 #define CEILING2(X)  (((X) + 0x0001) & 0xFFFE)
51 
52 #define MAX_ZOOMS_CNT 91
53 #define MAX_SIZES_CNT 30
54 #define MAX_EXP_BRACKETING_LENGTH 32
55 #define MAX_ROI 5
56 #define MAX_STREAM_NUM_IN_BUNDLE 8
57 #define MAX_NUM_STREAMS          8
58 #define CHROMATIX_SIZE 60000
59 #define COMMONCHROMATIX_SIZE 45000
60 #define CPPCHROMATIX_SIZE 36000
61 #define SWPOSTPROCCHROMATIX_SIZE 36000
62 #define AFTUNE_SIZE  10700
63 #define MAX_SCALE_SIZES_CNT 8
64 #define MAX_SAMP_DECISION_CNT     64
65 #define SENSOR_PHYSICAL_SIZE_CNT  2
66 #define EXPOSURE_TIME_RANGE_CNT   2
67 #define BLACK_LEVEL_PATTERN_CNT   4
68 #define FORWARD_MATRIX_COLS       3
69 #define FORWARD_MATRIX_ROWS       3
70 #define COLOR_TRANSFORM_COLS      3
71 #define COLOR_TRANSFORM_ROWS      3
72 #define CAL_TRANSFORM_COLS        3
73 #define CAL_TRANSFORM_ROWS        3
74 
75 #define MAX_ISP_DATA_SIZE (20*1024)
76 #define MAX_PP_DATA_SIZE  16384
77 #define MAX_AE_STATS_DATA_SIZE  1000
78 #define MAX_AWB_STATS_DATA_SIZE 1000
79 #define MAX_AF_STATS_DATA_SIZE  1000
80 #define MAX_ASD_STATS_DATA_SIZE 1000
81 
82 #define MAX_CAPTURE_BATCH_NUM 32
83 
84 #define TUNING_DATA_VERSION        3
85 #define TUNING_SENSOR_DATA_MAX     0x10000 /*(need value from sensor team)*/
86 #define TUNING_VFE_DATA_MAX        0x10000 /*(need value from vfe team)*/
87 #define TUNING_CPP_DATA_MAX        0x10000 /*(need value from pproc team)*/
88 #define TUNING_CAC_DATA_MAX        0x10000 /*(need value from imglib team)*/
89 #define TUNING_DATA_MAX            (TUNING_SENSOR_DATA_MAX + \
90                                    TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX + \
91                                    TUNING_CAC_DATA_MAX)
92 
93 #define TUNING_SENSOR_DATA_OFFSET  0
94 #define TUNING_VFE_DATA_OFFSET     TUNING_SENSOR_DATA_MAX
95 #define TUNING_CPP_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + TUNING_VFE_DATA_MAX)
96 #define TUNING_CAC_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
97                                    TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX)
98 #define MAX_STATS_DATA_SIZE 4000
99 
100 #define MAX_AF_BRACKETING_VALUES 5
101 #define MAX_TEST_PATTERN_CNT     8
102 
103 #define GPS_PROCESSING_METHOD_SIZE 33
104 #define EXIF_IMAGE_DESCRIPTION_SIZE 100
105 
106 #define MAX_INFLIGHT_REQUESTS  6
107 #define MAX_INFLIGHT_BLOB      2
108 
109 #ifdef OPTIMIZE_BUF_COUNT
110 #undef MAX_INFLIGHT_BLOB
111 #define MAX_INFLIGHT_BLOB      1
112 #endif
113 
114 #define MIN_INFLIGHT_REQUESTS  3
115 #define MAX_INFLIGHT_REPROCESS_REQUESTS 1
116 #define MAX_INFLIGHT_HFR_REQUESTS (48)
117 #define MIN_INFLIGHT_HFR_REQUESTS (40)
118 
119 #define QCAMERA_DUMP_FRM_LOCATION "/data/misc/camera/"
120 #define QCAMERA_MAX_FILEPATH_LENGTH 64
121 
122 #define CAM_INTF_AEC_DATA_MAX   (10)
123 #define LIKELY(x)       __builtin_expect((x), true)
124 #define UNLIKELY(x)     __builtin_expect((x), false)
125 
126 #define MAX_REPROCESS_STALL 2
127 
128 #define QCAMERA_MAX_FILEPATH_LENGTH 64
129 
130 #define MAX_EEPROM_VERSION_INFO_LEN 32
131 
132 #define MAX_OPTICAL_BLACK_REGIONS 5
133 
134 /*reprocess pipeline stages are pproc and jpeg */
135 #define MAX_REPROCESS_PIPELINE_STAGES 2
136 
137 typedef enum {
138     CAM_HAL_V1 = 1,
139     CAM_HAL_V3 = 3
140 } cam_hal_version_t;
141 
142 typedef enum {
143     CAM_STATUS_SUCCESS,       /* Operation Succeded */
144     CAM_STATUS_FAILED,        /* Failure in doing operation */
145     CAM_STATUS_INVALID_PARM,  /* Inavlid parameter provided */
146     CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */
147     CAM_STATUS_ACCEPTED,      /* Parameter accepted */
148     CAM_STATUS_MAX,
149 } cam_status_t;
150 
151 typedef enum {
152     CAM_POSITION_BACK,
153     CAM_POSITION_FRONT
154 } cam_position_t;
155 
156 typedef enum {
157     CAM_FLICKER_NONE,
158     CAM_FLICKER_50_HZ,
159     CAM_FLICKER_60_HZ
160 } cam_flicker_t;
161 
162 typedef enum {
163     CAM_FORMAT_JPEG = 0,
164     CAM_FORMAT_YUV_420_NV12 = 1,
165     CAM_FORMAT_YUV_420_NV21,
166     CAM_FORMAT_YUV_420_NV21_ADRENO,
167     CAM_FORMAT_YUV_420_YV12,
168     CAM_FORMAT_YUV_422_NV16,
169     CAM_FORMAT_YUV_422_NV61,
170     CAM_FORMAT_YUV_420_NV12_VENUS,
171 
172     /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */
173 
174     /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV.
175      * U and V are interleaved with Y: YUYV or YVYV */
176     CAM_FORMAT_YUV_RAW_8BIT_YUYV,
177     CAM_FORMAT_YUV_RAW_8BIT_YVYU,
178     CAM_FORMAT_YUV_RAW_8BIT_UYVY,
179     CAM_FORMAT_YUV_RAW_8BIT_VYUY,
180 
181     /* QCOM RAW formats where data is packed into 64bit word.
182      * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is
183      *       stored at LSB.
184      * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most
185      *       significant 4 bits are set to 0. P0 is stored at LSB.
186      * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most
187      *       significant 4 bits are set to 0. P0 is stored at LSB. */
188     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG,
189     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG,
190     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB,
191     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR,
192     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG,
193     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG,
194     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB,
195     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR,
196     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG,
197     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG,
198     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB,
199     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR,
200     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
201      * 8BPP: Each pixel occupies one bytes, starting at LSB.
202      *       Output with of image has no restrictons.
203      * 10BPP: Four pixels are held in every 5 bytes. The output
204      *       with of image must be a multiple of 4 pixels.
205      * 12BPP: Two pixels are held in every 3 bytes. The output
206      *       width of image must be a multiple of 2 pixels. */
207     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG,
208     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG,
209     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB,
210     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR,
211     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG,
212     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG,
213     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB,
214     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR,
215     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG,
216     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG,
217     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB,
218     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR,
219     /* Ideal raw formats where image data has gone through black
220      * correction, lens rolloff, demux/channel gain, bad pixel
221      * correction, and ABF.
222      * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW
223      * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and
224      * plain 16 12bpp */
225     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG,
226     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG,
227     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB,
228     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR,
229     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG,
230     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG,
231     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB,
232     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR,
233     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG,
234     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG,
235     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB,
236     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR,
237     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG,
238     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG,
239     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB,
240     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR,
241     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG,
242     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG,
243     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB,
244     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR,
245     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG,
246     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG,
247     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB,
248     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR,
249     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG,
250     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG,
251     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB,
252     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR,
253     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG,
254     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG,
255     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB,
256     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR,
257     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG,
258     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG,
259     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB,
260     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR,
261     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG,
262     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG,
263     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB,
264     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR,
265 
266     /* generic 8-bit raw */
267     CAM_FORMAT_JPEG_RAW_8BIT,
268     CAM_FORMAT_META_RAW_8BIT,
269 
270     /* QCOM RAW formats where data is packed into 64bit word.
271      * 14BPP: 1 64-bit word contains 4 pixels p0 - p3, where most
272      *       significant 4 bits are set to 0. P0 is stored at LSB.
273      */
274     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GBRG,
275     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GRBG,
276     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_RGGB,
277     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_BGGR,
278     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
279      * 14 BPPP: 1st byte: P0 [13:6]
280      *          2nd byte: P1 [13:6]
281      *          3rd byte: P2 [13:6]
282      *          4th byte: P3 [13:6]
283      *          5th byte: P0 [5:0]
284      *          7th byte: P1 [5:0]
285      *          8th byte: P2 [5:0]
286      *          9th byte: P3 [5:0]
287      */
288     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GBRG,
289     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GRBG,
290     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_RGGB,
291     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_BGGR,
292     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GBRG,
293     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GRBG,
294     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_RGGB,
295     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_BGGR,
296     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GBRG,
297     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GRBG,
298     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_RGGB,
299     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_BGGR,
300     /* 14BPP: 1st byte: P0 [8:0]
301      *        2nd byte: P0 [13:9]
302      *        3rd byte: P1 [8:0]
303      *        4th byte: P1 [13:9]
304      */
305     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GBRG,
306     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GRBG,
307     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_RGGB,
308     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_BGGR,
309 
310     CAM_FORMAT_YUV_444_NV24,
311     CAM_FORMAT_YUV_444_NV42,
312 
313     /* Y plane only, used for FD */
314     CAM_FORMAT_Y_ONLY,
315 
316     CAM_FORMAT_MAX
317 } cam_format_t;
318 
319 typedef enum {
320     /* applies to HAL 1 */
321     CAM_STREAM_TYPE_DEFAULT,       /* default stream type */
322     CAM_STREAM_TYPE_PREVIEW,       /* preview */
323     CAM_STREAM_TYPE_POSTVIEW,      /* postview */
324     CAM_STREAM_TYPE_SNAPSHOT,      /* snapshot */
325     CAM_STREAM_TYPE_VIDEO,         /* video */
326 
327     /* applies to HAL 3 */
328     CAM_STREAM_TYPE_CALLBACK,      /* app requested callback */
329     CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */
330 
331     /* applies to both HAL 1 and HAL 3 */
332     CAM_STREAM_TYPE_METADATA,      /* meta data */
333     CAM_STREAM_TYPE_RAW,           /* raw dump from camif */
334     CAM_STREAM_TYPE_OFFLINE_PROC,  /* offline process */
335     CAM_STREAM_TYPE_PARM,         /* mct internal stream */
336     CAM_STREAM_TYPE_ANALYSIS,     /* analysis stream */
337     CAM_STREAM_TYPE_MAX,
338 } cam_stream_type_t;
339 
340 typedef enum {
341     CAM_PAD_NONE = 1,
342     CAM_PAD_TO_2 = 2,
343     CAM_PAD_TO_4 = 4,
344     CAM_PAD_TO_WORD = CAM_PAD_TO_4,
345     CAM_PAD_TO_8 = 8,
346     CAM_PAD_TO_16 = 16,
347     CAM_PAD_TO_32 = 32,
348     CAM_PAD_TO_64 = 64,
349     CAM_PAD_TO_1K = 1024,
350     CAM_PAD_TO_2K = 2048,
351     CAM_PAD_TO_4K = 4096,
352     CAM_PAD_TO_8K = 8192
353 } cam_pad_format_t;
354 
355 typedef enum {
356     /* followings are per camera */
357     CAM_MAPPING_BUF_TYPE_CAPABILITY,  /* mapping camera capability buffer */
358     CAM_MAPPING_BUF_TYPE_PARM_BUF,    /* mapping parameters buffer */
359 
360     /* followings are per stream */
361     CAM_MAPPING_BUF_TYPE_STREAM_BUF,        /* mapping stream buffers */
362     CAM_MAPPING_BUF_TYPE_STREAM_INFO,       /* mapping stream information buffer */
363     CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */
364     CAM_MAPPING_BUF_TYPE_OFFLINE_META_BUF,  /* mapping offline meta buffer */
365     CAM_MAPPING_BUF_TYPE_MISC_BUF,          /* mapping offline miscellaneous buffer */
366     CAM_MAPPING_BUF_TYPE_STREAM_USER_BUF,   /* mapping user ptr stream buffers */
367     CAM_MAPPING_BUF_TYPE_MAX
368 } cam_mapping_buf_type;
369 
370 typedef enum {
371     CAM_STREAM_BUF_TYPE_MPLANE,  /* Multiplanar Buffer type */
372     CAM_STREAM_BUF_TYPE_USERPTR, /* User specific structure pointer*/
373     CAM_STREAM_BUF_TYPE_MAX
374 } cam_stream_buf_type;
375 
376 /* values that persist.camera.global.debug can be set to */
377 /* all camera modules need to map their internal debug levels to this range */
378 typedef enum {
379     CAM_GLBL_DBG_ERR    = 0,
380     CAM_GLBL_DBG_HIGH   = 1,
381     CAM_GLBL_DBG_LOW    = 2,
382 } cam_global_debug_level_t;
383 
384 typedef struct {
385     cam_mapping_buf_type type;
386     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
387     uint32_t frame_idx;   /* frame index: valid if type is STREAM_BUF */
388     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
389                            * -1 means all planners shanre the same fd;
390                            * otherwise, each planner has its own fd */
391     uint32_t cookie;      /* could be job_id(uint32_t) to identify mapping job */
392     int32_t fd;           /* origin fd */
393     size_t size;          /* size of the buffer */
394 } cam_buf_map_type;
395 
396 typedef struct {
397     cam_mapping_buf_type type;
398     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
399     uint32_t frame_idx;   /* frame index: valid if STREAM_BUF or HIST_BUF */
400     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
401                            * -1 means all planners shanre the same fd;
402                            * otherwise, each planner has its own fd */
403     uint32_t cookie;      /* could be job_id(uint32_t) to identify unmapping job */
404 } cam_buf_unmap_type;
405 
406 typedef enum {
407     CAM_MAPPING_TYPE_FD_MAPPING,
408     CAM_MAPPING_TYPE_FD_UNMAPPING,
409     CAM_MAPPING_TYPE_MAX
410 } cam_mapping_type;
411 
412 typedef struct {
413     cam_mapping_type msg_type;
414     union {
415         cam_buf_map_type buf_map;
416         cam_buf_unmap_type buf_unmap;
417     } payload;
418 } cam_sock_packet_t;
419 
420 typedef enum {
421     CAM_MODE_2D = (1<<0),
422     CAM_MODE_3D = (1<<1)
423 } cam_mode_t;
424 
425 typedef struct {
426     uint32_t len;
427     uint32_t y_offset;
428     uint32_t cbcr_offset;
429 } cam_sp_len_offset_t;
430 
431 typedef struct{
432     uint32_t len;
433     uint32_t offset;
434     int32_t offset_x;
435     int32_t offset_y;
436     int32_t stride;
437     int32_t stride_in_bytes;
438     int32_t scanline;
439     int32_t width;    /* width without padding */
440     int32_t height;   /* height without padding */
441 } cam_mp_len_offset_t;
442 
443 typedef struct {
444     uint32_t width_padding;
445     uint32_t height_padding;
446     uint32_t plane_padding;
447     uint32_t min_stride;
448     uint32_t min_scanline;
449 } cam_padding_info_t;
450 
451 typedef struct {
452     uint32_t num_planes;    /*Number of planes in planar buffer*/
453     union {
454         cam_sp_len_offset_t sp;
455         cam_mp_len_offset_t mp[VIDEO_MAX_PLANES];
456     };
457     uint32_t frame_len;
458 } cam_frame_len_offset_t;
459 
460 typedef struct {
461     uint8_t frame_buf_cnt;  /*Total plane frames present in 1 batch*/
462     uint32_t size;          /*Size of 1 batch buffer. Kernel structure size*/
463     long frameInterval;     /*frame interval between each frame*/
464 } cam_stream_user_buf_info_t;
465 
466 typedef struct {
467     int32_t width;
468     int32_t height;
469 } cam_dimension_t;
470 
471 typedef struct {
472     cam_frame_len_offset_t plane_info;
473 } cam_stream_buf_plane_info_t;
474 
475 typedef struct {
476     float min_fps;
477     float max_fps;
478     float video_min_fps;
479     float video_max_fps;
480 } cam_fps_range_t;
481 
482 typedef struct {
483     int32_t min_sensitivity;
484     int32_t max_sensitivity;
485 } cam_sensitivity_range_t;
486 
487 typedef enum {
488     CAM_HFR_MODE_OFF,
489     CAM_HFR_MODE_60FPS,
490     CAM_HFR_MODE_90FPS,
491     CAM_HFR_MODE_120FPS,
492     CAM_HFR_MODE_150FPS,
493     CAM_HFR_MODE_180FPS,
494     CAM_HFR_MODE_210FPS,
495     CAM_HFR_MODE_240FPS,
496     CAM_HFR_MODE_480FPS,
497     CAM_HFR_MODE_MAX
498 } cam_hfr_mode_t;
499 
500 typedef struct {
501     cam_hfr_mode_t mode;
502     cam_dimension_t dim;
503     uint8_t frame_skip;
504     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table size */
505     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
506 } cam_hfr_info_t;
507 
508 typedef enum {
509     CAM_WB_MODE_AUTO,
510     CAM_WB_MODE_CUSTOM,
511     CAM_WB_MODE_INCANDESCENT,
512     CAM_WB_MODE_FLUORESCENT,
513     CAM_WB_MODE_WARM_FLUORESCENT,
514     CAM_WB_MODE_DAYLIGHT,
515     CAM_WB_MODE_CLOUDY_DAYLIGHT,
516     CAM_WB_MODE_TWILIGHT,
517     CAM_WB_MODE_SHADE,
518     CAM_WB_MODE_MANUAL,
519     CAM_WB_MODE_OFF,
520     CAM_WB_MODE_MAX
521 } cam_wb_mode_type;
522 
523 typedef enum {
524     CAM_ANTIBANDING_MODE_OFF,
525     CAM_ANTIBANDING_MODE_60HZ,
526     CAM_ANTIBANDING_MODE_50HZ,
527     CAM_ANTIBANDING_MODE_AUTO,
528     CAM_ANTIBANDING_MODE_AUTO_50HZ,
529     CAM_ANTIBANDING_MODE_AUTO_60HZ,
530     CAM_ANTIBANDING_MODE_MAX,
531 } cam_antibanding_mode_type;
532 
533 /* Enum Type for different ISO Mode supported */
534 typedef enum {
535     CAM_ISO_MODE_AUTO,
536     CAM_ISO_MODE_DEBLUR,
537     CAM_ISO_MODE_100,
538     CAM_ISO_MODE_200,
539     CAM_ISO_MODE_400,
540     CAM_ISO_MODE_800,
541     CAM_ISO_MODE_1600,
542     CAM_ISO_MODE_3200,
543     CAM_ISO_MODE_MAX
544 } cam_iso_mode_type;
545 
546 typedef enum {
547     CAM_AEC_MODE_FRAME_AVERAGE,
548     CAM_AEC_MODE_CENTER_WEIGHTED,
549     CAM_AEC_MODE_SPOT_METERING,
550     CAM_AEC_MODE_SMART_METERING,
551     CAM_AEC_MODE_USER_METERING,
552     CAM_AEC_MODE_SPOT_METERING_ADV,
553     CAM_AEC_MODE_CENTER_WEIGHTED_ADV,
554     CAM_AEC_MODE_MAX
555 } cam_auto_exposure_mode_type;
556 
557 typedef enum {
558     CAM_AE_MODE_OFF,
559     CAM_AE_MODE_ON,
560     CAM_AE_MODE_MAX
561 } cam_ae_mode_type;
562 
563 typedef enum {
564     CAM_FOCUS_ALGO_AUTO,
565     CAM_FOCUS_ALGO_SPOT,
566     CAM_FOCUS_ALGO_CENTER_WEIGHTED,
567     CAM_FOCUS_ALGO_AVERAGE,
568     CAM_FOCUS_ALGO_MAX
569 } cam_focus_algorithm_type;
570 
571 /* Auto focus mode */
572 typedef enum {
573     CAM_FOCUS_MODE_OFF,
574     CAM_FOCUS_MODE_AUTO,
575     CAM_FOCUS_MODE_INFINITY,
576     CAM_FOCUS_MODE_MACRO,
577     CAM_FOCUS_MODE_FIXED,
578     CAM_FOCUS_MODE_EDOF,
579     CAM_FOCUS_MODE_CONTINOUS_VIDEO,
580     CAM_FOCUS_MODE_CONTINOUS_PICTURE,
581     CAM_FOCUS_MODE_MANUAL,
582     CAM_FOCUS_MODE_MAX
583 } cam_focus_mode_type;
584 
585 typedef enum {
586     CAM_MANUAL_FOCUS_MODE_INDEX,
587     CAM_MANUAL_FOCUS_MODE_DAC_CODE,
588     CAM_MANUAL_FOCUS_MODE_RATIO,
589     CAM_MANUAL_FOCUS_MODE_DIOPTER,
590     CAM_MANUAL_FOCUS_MODE_MAX
591 } cam_manual_focus_mode_type;
592 
593 typedef struct {
594     cam_manual_focus_mode_type flag;
595     union{
596         int32_t af_manual_lens_position_index;
597         int32_t af_manual_lens_position_dac;
598         int32_t af_manual_lens_position_ratio;
599         float af_manual_diopter;
600     };
601 } cam_manual_focus_parm_t;
602 
603 typedef enum {
604     CAM_MANUAL_WB_MODE_CCT,
605     CAM_MANUAL_WB_MODE_GAIN,
606     CAM_MANUAL_WB_MODE_MAX
607 } cam_manual_wb_mode_type;
608 
609 typedef struct {
610     float r_gain;
611     float g_gain;
612     float b_gain;
613 } cam_awb_gain_t;
614 
615 typedef struct {
616     cam_manual_wb_mode_type type;
617     union{
618         int32_t cct;
619         cam_awb_gain_t gains;
620     };
621 } cam_manual_wb_parm_t;
622 
623 typedef enum {
624     CAM_SCENE_MODE_OFF,
625     CAM_SCENE_MODE_AUTO,
626     CAM_SCENE_MODE_LANDSCAPE,
627     CAM_SCENE_MODE_SNOW,
628     CAM_SCENE_MODE_BEACH,
629     CAM_SCENE_MODE_SUNSET,
630     CAM_SCENE_MODE_NIGHT,
631     CAM_SCENE_MODE_PORTRAIT,
632     CAM_SCENE_MODE_BACKLIGHT,
633     CAM_SCENE_MODE_SPORTS,
634     CAM_SCENE_MODE_ANTISHAKE,
635     CAM_SCENE_MODE_FLOWERS,
636     CAM_SCENE_MODE_CANDLELIGHT,
637     CAM_SCENE_MODE_FIREWORKS,
638     CAM_SCENE_MODE_PARTY,
639     CAM_SCENE_MODE_NIGHT_PORTRAIT,
640     CAM_SCENE_MODE_THEATRE,
641     CAM_SCENE_MODE_ACTION,
642     CAM_SCENE_MODE_AR,
643     CAM_SCENE_MODE_FACE_PRIORITY,
644     CAM_SCENE_MODE_BARCODE,
645     CAM_SCENE_MODE_HDR,
646     CAM_SCENE_MODE_MAX
647 } cam_scene_mode_type;
648 
649 typedef enum {
650     CAM_EFFECT_MODE_OFF,
651     CAM_EFFECT_MODE_MONO,
652     CAM_EFFECT_MODE_NEGATIVE,
653     CAM_EFFECT_MODE_SOLARIZE,
654     CAM_EFFECT_MODE_SEPIA,
655     CAM_EFFECT_MODE_POSTERIZE,
656     CAM_EFFECT_MODE_WHITEBOARD,
657     CAM_EFFECT_MODE_BLACKBOARD,
658     CAM_EFFECT_MODE_AQUA,
659     CAM_EFFECT_MODE_EMBOSS,
660     CAM_EFFECT_MODE_SKETCH,
661     CAM_EFFECT_MODE_NEON,
662     CAM_EFFECT_MODE_MAX
663 } cam_effect_mode_type;
664 
665 typedef enum {
666     CAM_FLASH_MODE_OFF,
667     CAM_FLASH_MODE_AUTO,
668     CAM_FLASH_MODE_ON,
669     CAM_FLASH_MODE_TORCH,
670     CAM_FLASH_MODE_SINGLE,
671     CAM_FLASH_MODE_MAX
672 } cam_flash_mode_t;
673 
674 // Flash States
675 typedef enum {
676     CAM_FLASH_STATE_UNAVAILABLE,
677     CAM_FLASH_STATE_CHARGING,
678     CAM_FLASH_STATE_READY,
679     CAM_FLASH_STATE_FIRED,
680     CAM_FLASH_STATE_PARTIAL,
681     CAM_FLASH_STATE_MAX
682 } cam_flash_state_t;
683 
684 typedef enum {
685     CAM_FLASH_FIRING_LEVEL_0,
686     CAM_FLASH_FIRING_LEVEL_1,
687     CAM_FLASH_FIRING_LEVEL_2,
688     CAM_FLASH_FIRING_LEVEL_3,
689     CAM_FLASH_FIRING_LEVEL_4,
690     CAM_FLASH_FIRING_LEVEL_5,
691     CAM_FLASH_FIRING_LEVEL_6,
692     CAM_FLASH_FIRING_LEVEL_7,
693     CAM_FLASH_FIRING_LEVEL_8,
694     CAM_FLASH_FIRING_LEVEL_9,
695     CAM_FLASH_FIRING_LEVEL_10,
696     CAM_FLASH_FIRING_LEVEL_MAX
697 } cam_flash_firing_level_t;
698 
699 
700 typedef enum {
701     CAM_AEC_TRIGGER_IDLE,
702     CAM_AEC_TRIGGER_START,
703     CAM_AEC_TRIGGER_CANCEL
704 } cam_aec_trigger_type_t;
705 
706 typedef enum {
707     CAM_AF_TRIGGER_IDLE,
708     CAM_AF_TRIGGER_START,
709     CAM_AF_TRIGGER_CANCEL
710 } cam_af_trigger_type_t;
711 
712 typedef enum {
713     CAM_AE_STATE_INACTIVE,
714     CAM_AE_STATE_SEARCHING,
715     CAM_AE_STATE_CONVERGED,
716     CAM_AE_STATE_LOCKED,
717     CAM_AE_STATE_FLASH_REQUIRED,
718     CAM_AE_STATE_PRECAPTURE
719 } cam_ae_state_t;
720 
721 typedef enum {
722     CAM_NOISE_REDUCTION_MODE_OFF,
723     CAM_NOISE_REDUCTION_MODE_FAST,
724     CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY,
725     CAM_NOISE_REDUCTION_MODE_MINIMAL,
726     CAM_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
727 } cam_noise_reduction_mode_t;
728 
729 typedef enum {
730     CAM_EDGE_MODE_OFF,
731     CAM_EDGE_MODE_FAST,
732     CAM_EDGE_MODE_HIGH_QUALITY,
733     CAM_EDGE_MODE_ZERO_SHUTTER_LAG,
734 } cam_edge_mode_t;
735 
736 typedef struct {
737    uint8_t edge_mode;
738    int32_t sharpness;
739 } cam_edge_application_t;
740 
741 typedef enum {
742     CAM_BLACK_LEVEL_LOCK_OFF,
743     CAM_BLACK_LEVEL_LOCK_ON,
744 } cam_black_level_lock_t;
745 
746 typedef enum {
747     CAM_HOTPIXEL_MODE_OFF,
748     CAM_HOTPIXEL_MODE_FAST,
749     CAM_HOTPIXEL_MODE_HIGH_QUALITY,
750 } cam_hotpixel_mode_t;
751 
752 typedef enum {
753     CAM_LENS_SHADING_MAP_MODE_OFF,
754     CAM_LENS_SHADING_MAP_MODE_ON,
755 } cam_lens_shading_map_mode_t;
756 
757 typedef enum {
758     CAM_LENS_SHADING_MODE_OFF,
759     CAM_LENS_SHADING_MODE_FAST,
760     CAM_LENS_SHADING_MODE_HIGH_QUALITY,
761 } cam_lens_shading_mode_t;
762 
763 typedef enum {
764     CAM_FACE_DETECT_MODE_OFF,
765     CAM_FACE_DETECT_MODE_SIMPLE,
766     CAM_FACE_DETECT_MODE_FULL,
767 } cam_face_detect_mode_t;
768 
769 typedef enum {
770     CAM_TONEMAP_MODE_CONTRAST_CURVE,
771     CAM_TONEMAP_MODE_FAST,
772     CAM_TONEMAP_MODE_HIGH_QUALITY,
773 } cam_tonemap_mode_t;
774 
775 typedef enum {
776   CAM_CDS_MODE_OFF,
777   CAM_CDS_MODE_ON,
778   CAM_CDS_MODE_AUTO,
779   CAM_CDS_MODE_MAX
780 } cam_cds_mode_type_t;
781 
782 typedef struct  {
783     int32_t left;
784     int32_t top;
785     int32_t width;
786     int32_t height;
787 } cam_rect_t;
788 
789 typedef struct  {
790     cam_rect_t rect;
791     int32_t weight; /* weight of the area, valid for focusing/metering areas */
792 } cam_area_t;
793 
794 typedef enum {
795     CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */
796     CAM_STREAMING_MODE_BURST,      /* burst streaming */
797     CAM_STREAMING_MODE_BATCH,      /* stream frames in batches */
798     CAM_STREAMING_MODE_MAX
799 } cam_streaming_mode_t;
800 
801 typedef enum {
802     IS_TYPE_NONE,
803     IS_TYPE_DIS,
804     IS_TYPE_GA_DIS,
805     IS_TYPE_EIS_1_0,
806     IS_TYPE_EIS_2_0,
807     IS_TYPE_MAX
808 } cam_is_type_t;
809 
810 typedef enum {
811     DIS_DISABLE,
812     DIS_ENABLE
813 } cam_dis_mode_t;
814 
815 typedef enum {
816   NON_SECURE,
817   SECURE
818 } cam_stream_secure_t;
819 
820 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0)
821 
822 /* event from server */
823 typedef enum {
824     CAM_EVENT_TYPE_MAP_UNMAP_DONE  = (1<<0),
825     CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1),
826     CAM_EVENT_TYPE_ZOOM_DONE       = (1<<2),
827     CAM_EVENT_TYPE_DAEMON_DIED     = (1<<3),
828     CAM_EVENT_TYPE_INT_TAKE_JPEG   = (1<<4),
829     CAM_EVENT_TYPE_INT_TAKE_RAW    = (1<<5),
830     CAM_EVENT_TYPE_DAEMON_PULL_REQ = (1<<6),
831     CAM_EVENT_TYPE_MAX
832 } cam_event_type_t;
833 
834 typedef enum {
835     CAM_EXP_BRACKETING_OFF,
836     CAM_EXP_BRACKETING_ON
837 } cam_bracket_mode;
838 
839 typedef struct {
840     cam_bracket_mode mode;
841     char values[MAX_EXP_BRACKETING_LENGTH];  /* user defined values */
842 } cam_exp_bracketing_t;
843 
844 typedef struct {
845   uint32_t num_frames;
846   cam_exp_bracketing_t exp_val;
847 } cam_hdr_bracketing_info_t;
848 
849  typedef struct {
850     cam_bracket_mode mode;
851     int32_t values;  /* user defined values */
852 } cam_capture_bracketing_t;
853 
854 typedef enum {
855     CAM_CAPTURE_NORMAL,
856     CAM_CAPTURE_FLASH,
857     CAM_CAPTURE_BRACKETING,
858     CAM_CAPTURE_MAX
859 } cam_capture_type;
860 
861 typedef struct {
862     int32_t num_frames;     /*Num of frames requested on this quality*/
863     cam_capture_type type;  /*type of the capture request*/
864 
865     /*union to strore values of capture type*/
866     union {
867         cam_flash_mode_t flash_mode;
868         cam_capture_bracketing_t hdr_mode;
869     };
870 } cam_capture_settings_t;
871 
872 typedef struct {
873     uint32_t num_batch;  /*Number of frames batch requested*/
874     cam_capture_settings_t configs[MAX_CAPTURE_BATCH_NUM];
875 } cam_capture_frame_config_t;
876 
877 typedef struct {
878     uint8_t chromatixData[CHROMATIX_SIZE];
879     uint8_t snapchromatixData[CHROMATIX_SIZE];
880     uint8_t common_chromatixData[COMMONCHROMATIX_SIZE];
881     uint8_t cpp_chromatixData[CPPCHROMATIX_SIZE];
882     uint8_t cpp_chromatixSnapData[CPPCHROMATIX_SIZE];
883     uint8_t postproc_chromatixData[SWPOSTPROCCHROMATIX_SIZE];
884 } tune_chromatix_t;
885 
886 typedef struct {
887     uint8_t af_tuneData[AFTUNE_SIZE];
888 } tune_autofocus_t;
889 
890 typedef struct {
891     uint8_t stepsize;
892     uint8_t direction;
893     int32_t num_steps;
894     uint8_t ttype;
895 } tune_actuator_t;
896 
897 typedef struct {
898     uint8_t module;
899     uint8_t type;
900     int32_t value;
901 } tune_cmd_t;
902 
903 typedef enum {
904     CAM_AEC_ROI_OFF,
905     CAM_AEC_ROI_ON
906 } cam_aec_roi_ctrl_t;
907 
908 typedef enum {
909     CAM_AEC_ROI_BY_INDEX,
910     CAM_AEC_ROI_BY_COORDINATE,
911 } cam_aec_roi_type_t;
912 
913 typedef struct {
914     uint32_t x;
915     uint32_t y;
916 } cam_coordinate_type_t;
917 
918 typedef struct {
919     int32_t numerator;
920     int32_t denominator;
921 } cam_rational_type_t;
922 
923 typedef struct {
924     cam_aec_roi_ctrl_t aec_roi_enable;
925     cam_aec_roi_type_t aec_roi_type;
926     union {
927         cam_coordinate_type_t coordinate[MAX_ROI];
928         uint32_t aec_roi_idx[MAX_ROI];
929     } cam_aec_roi_position;
930 } cam_set_aec_roi_t;
931 
932 typedef struct {
933     uint32_t frm_id;
934     uint8_t num_roi;
935     cam_rect_t roi[MAX_ROI];
936     int32_t weight[MAX_ROI];
937     uint8_t is_multiwindow;
938 } cam_roi_info_t;
939 
940 typedef enum {
941     CAM_WAVELET_DENOISE_YCBCR_PLANE,
942     CAM_WAVELET_DENOISE_CBCR_ONLY,
943     CAM_WAVELET_DENOISE_STREAMLINE_YCBCR,
944     CAM_WAVELET_DENOISE_STREAMLINED_CBCR
945 } cam_denoise_process_type_t;
946 
947 typedef struct {
948     uint8_t denoise_enable;
949     cam_denoise_process_type_t process_plates;
950 } cam_denoise_param_t;
951 
952 #define CAM_FACE_PROCESS_MASK_DETECTION    (1U<<0)
953 #define CAM_FACE_PROCESS_MASK_RECOGNITION  (1U<<1)
954 typedef struct {
955     uint32_t fd_mode;          /* mask of face process */
956     uint32_t num_fd;
957 } cam_fd_set_parm_t;
958 
959 typedef enum {
960     QCAMERA_FD_PREVIEW,
961     QCAMERA_FD_SNAPSHOT
962 }qcamera_face_detect_type_t;
963 
964 typedef enum {
965     CAM_FACE_CT_POINT_EYE_L_PUPIL,
966     CAM_FACE_CT_POINT_EYE_L_IN,
967     CAM_FACE_CT_POINT_EYE_L_OUT,
968     CAM_FACE_CT_POINT_EYE_L_UP,
969     CAM_FACE_CT_POINT_EYE_L_DOWN,
970     CAM_FACE_CT_POINT_EYE_R_PUPIL,
971     CAM_FACE_CT_POINT_EYE_R_IN,
972     CAM_FACE_CT_POINT_EYE_R_OUT,
973     CAM_FACE_CT_POINT_EYE_R_UP,
974     CAM_FACE_CT_POINT_EYE_R_DOWN,
975     CAM_FACE_CT_POINT_EYE_MAX
976 } cam_face_ct_point_eye_t;
977 
978 typedef enum {
979     CAM_FACE_CT_POINT_FOREHEAD,
980     CAM_FACE_CT_POINT_FOREHEAD_MAX
981 } cam_face_ct_point_forh_t;
982 
983 typedef enum {
984     CAM_FACE_CT_POINT_NOSE,
985     CAM_FACE_CT_POINT_NOSE_TIP,
986     CAM_FACE_CT_POINT_NOSE_L,
987     CAM_FACE_CT_POINT_NOSE_R,
988     CAM_FACE_CT_POINT_NOSE_L_0,
989     CAM_FACE_CT_POINT_NOSE_R_0,
990     CAM_FACE_CT_POINT_NOSE_L_1,
991     CAM_FACE_CT_POINT_NOSE_R_1,
992     CAM_FACE_CT_POINT_NOSE_MAX
993 } cam_face_ct_point_nose_t;
994 
995 typedef enum {
996     CAM_FACE_CT_POINT_MOUTH_L,
997     CAM_FACE_CT_POINT_MOUTH_R,
998     CAM_FACE_CT_POINT_MOUTH_UP,
999     CAM_FACE_CT_POINT_MOUTH_DOWN,
1000     CAM_FACE_CT_POINT_MOUTH_MAX
1001 } cam_face_ct_point_mouth_t;
1002 
1003 typedef enum {
1004     CAM_FACE_CT_POINT_LIP_UP,
1005     CAM_FACE_CT_POINT_LIP_DOWN,
1006     CAM_FACE_CT_POINT_LIP_MAX
1007 } cam_face_ct_point_lip_t;
1008 
1009 typedef enum {
1010     CAM_FACE_CT_POINT_BROW_L_UP,
1011     CAM_FACE_CT_POINT_BROW_L_DOWN,
1012     CAM_FACE_CT_POINT_BROW_L_IN,
1013     CAM_FACE_CT_POINT_BROW_L_OUT,
1014     CAM_FACE_CT_POINT_BROW_R_UP,
1015     CAM_FACE_CT_POINT_BROW_R_DOWN,
1016     CAM_FACE_CT_POINT_BROW_R_IN,
1017     CAM_FACE_CT_POINT_BROW_R_OUT,
1018     CAM_FACE_CT_POINT_BROW_MAX
1019 } cam_face_ct_point_brow_t;
1020 
1021 typedef enum {
1022     CAM_FACE_CT_POINT_CHIN,
1023     CAM_FACE_CT_POINT_CHIN_L,
1024     CAM_FACE_CT_POINT_CHIN_R,
1025     CAM_FACE_CT_POINT_CHIN_MAX
1026 } cam_face_ct_point_chin_t;
1027 
1028 typedef enum {
1029     CAM_FACE_CT_POINT_EAR_L_DOWN,
1030     CAM_FACE_CT_POINT_EAR_R_DOWN,
1031     CAM_FACE_CT_POINT_EAR_L_UP,
1032     CAM_FACE_CT_POINT_EAR_R_UP,
1033     CAM_FACE_CT_POINT_EAR_MAX
1034 } cam_face_ct_point_ear_t;
1035 
1036 typedef struct {
1037   uint8_t is_eye_valid;
1038   cam_coordinate_type_t contour_eye_pt[CAM_FACE_CT_POINT_EYE_MAX];
1039   uint8_t is_forehead_valid;
1040   cam_coordinate_type_t contour_forh_pt[CAM_FACE_CT_POINT_FOREHEAD_MAX];
1041   uint8_t is_nose_valid;
1042   cam_coordinate_type_t contour_nose_pt[CAM_FACE_CT_POINT_NOSE_MAX];
1043   uint8_t is_mouth_valid;
1044   cam_coordinate_type_t contour_mouth_pt[CAM_FACE_CT_POINT_MOUTH_MAX];
1045   uint8_t is_lip_valid;
1046   cam_coordinate_type_t contour_lip_pt[CAM_FACE_CT_POINT_LIP_MAX];
1047   uint8_t is_brow_valid;
1048   cam_coordinate_type_t contour_brow_pt[CAM_FACE_CT_POINT_BROW_MAX];
1049   uint8_t is_chin_valid;
1050   cam_coordinate_type_t contour_chin_pt[CAM_FACE_CT_POINT_CHIN_MAX];
1051   uint8_t is_ear_valid;
1052   cam_coordinate_type_t contour_ear_pt[CAM_FACE_CT_POINT_EAR_MAX];
1053 } cam_face_detect_contour_t;
1054 
1055 typedef struct {
1056     int32_t face_id;            /* unique id for face tracking within view unless view changes */
1057     int8_t score;              /* score of confidence (0, -100) */
1058     cam_rect_t face_boundary;  /* boundary of face detected */
1059     cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
1060     cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
1061     cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
1062     cam_face_detect_contour_t contour_info; /* face detection contour info */
1063     uint8_t smile_degree;      /* smile degree (0, -100) */
1064     uint8_t smile_confidence;  /* smile confidence (0, 100) */
1065     uint8_t face_recognised;   /* if face is recognised */
1066     int8_t gaze_angle;         /* -90 -45 0 45 90 for head left to rigth tilt */
1067     int8_t updown_dir;         /* up down direction (-90, 90) */
1068     int8_t leftright_dir;      /* left right direction (-90, 90) */
1069     int8_t roll_dir;           /* roll direction (-90, 90) */
1070     int8_t left_right_gaze;    /* left right gaze degree (-50, 50) */
1071     int8_t top_bottom_gaze;    /* up down gaze degree (-50, 50) */
1072     uint8_t blink_detected;    /* if blink is detected */
1073     uint8_t left_blink;        /* left eye blink degeree (0, -100) */
1074     uint8_t right_blink;       /* right eye blink degree (0, - 100) */
1075 } cam_face_detection_info_t;
1076 
1077 typedef struct {
1078     uint32_t frame_id;                         /* frame index of which faces are detected */
1079     uint8_t num_faces_detected;                /* number of faces detected */
1080     cam_face_detection_info_t faces[MAX_ROI];  /* detailed information of faces detected */
1081     qcamera_face_detect_type_t fd_type;        /* face detect for preview or snapshot frame*/
1082     cam_dimension_t fd_frame_dim;              /* frame dims on which fd is applied */
1083 } cam_face_detection_data_t;
1084 
1085 #define CAM_HISTOGRAM_STATS_SIZE 256
1086 typedef struct {
1087     uint32_t max_hist_value;
1088     uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */
1089 } cam_histogram_data_t;
1090 
1091 typedef struct {
1092     cam_histogram_data_t r_stats;
1093     cam_histogram_data_t b_stats;
1094     cam_histogram_data_t gr_stats;
1095     cam_histogram_data_t gb_stats;
1096 } cam_bayer_hist_stats_t;
1097 
1098 typedef enum {
1099     CAM_HISTOGRAM_TYPE_BAYER,
1100     CAM_HISTOGRAM_TYPE_YUV
1101 } cam_histogram_type_t;
1102 
1103 typedef struct {
1104     cam_histogram_type_t type;
1105     union {
1106         cam_bayer_hist_stats_t bayer_stats;
1107         cam_histogram_data_t yuv_stats;
1108     };
1109 } cam_hist_stats_t;
1110 
1111 enum cam_focus_distance_index{
1112   CAM_FOCUS_DISTANCE_NEAR_INDEX,  /* 0 */
1113   CAM_FOCUS_DISTANCE_OPTIMAL_INDEX,
1114   CAM_FOCUS_DISTANCE_FAR_INDEX,
1115   CAM_FOCUS_DISTANCE_MAX_INDEX
1116 };
1117 
1118 typedef struct {
1119   float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX];
1120 } cam_focus_distances_info_t;
1121 
1122 typedef struct {
1123     uint32_t scale;
1124     float diopter;
1125 } cam_focus_pos_info_t ;
1126 
1127 /* Different autofocus cycle when calling do_autoFocus
1128  * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep
1129  * if one is ongoing, and lock.
1130  * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless
1131  * of the current state, and lock.
1132  * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep.
1133  * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED,
1134  * or CAM_AF_NOT_FOCUSED.
1135  * cancel_autoFocus stops any lens movement.
1136  * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED
1137  * event, not both.
1138  */
1139 typedef enum {
1140     CAM_AF_COMPLETE_EXISTING_SWEEP,
1141     CAM_AF_DO_ONE_FULL_SWEEP,
1142     CAM_AF_START_CONTINUOUS_SWEEP
1143 } cam_autofocus_cycle_t;
1144 
1145 typedef enum {
1146     CAM_AF_SCANNING,
1147     CAM_AF_FOCUSED,
1148     CAM_AF_NOT_FOCUSED,
1149     CAM_AF_INACTIVE
1150 } cam_autofocus_state_t;
1151 
1152 typedef struct {
1153     cam_autofocus_state_t focus_state;           /* state of focus */
1154     cam_focus_distances_info_t focus_dist;       /* focus distance */
1155     cam_focus_mode_type focus_mode;        /* focus mode from backend */
1156     uint32_t focused_frame_idx;
1157     int32_t focus_pos;
1158 } cam_auto_focus_data_t;
1159 
1160 typedef struct {
1161   uint32_t is_hdr_scene;
1162   float    hdr_confidence;
1163 } cam_asd_hdr_scene_data_t;
1164 
1165 typedef struct {
1166     uint32_t stream_id;
1167     cam_rect_t crop;
1168     cam_rect_t roi_map;
1169 } cam_stream_crop_info_t;
1170 
1171 typedef struct {
1172     uint8_t num_of_streams;
1173     cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS];
1174 } cam_crop_data_t;
1175 
1176 typedef struct {
1177     uint32_t stream_id;
1178     uint32_t cds_enable;
1179 } cam_stream_cds_info_t;
1180 
1181 typedef struct {
1182     uint8_t session_cds_enable;
1183     uint8_t num_of_streams;
1184     cam_stream_cds_info_t cds_info[MAX_NUM_STREAMS];
1185 } cam_cds_data_t;
1186 
1187 typedef enum {
1188     DO_NOT_NEED_FUTURE_FRAME,
1189     NEED_FUTURE_FRAME,
1190 } cam_prep_snapshot_state_t;
1191 
1192 #define CC_GAINS_COUNT  4
1193 
1194 typedef struct {
1195     float gains[CC_GAINS_COUNT];
1196 } cam_color_correct_gains_t;
1197 
1198 typedef struct {
1199     // If LED is ON and Burst Num > 1, this is first LED ON frame
1200     uint32_t min_frame_idx;
1201     // If LED is ON and Burst Num > 1, this is first LED Off frame after ON
1202     uint32_t max_frame_idx;
1203     // Used only when LED Is ON and burst num > 1
1204     uint32_t num_led_on_frames;
1205     // Skip count after LED is turned OFF
1206     uint32_t frame_skip_count;
1207     // Batch id for each picture request
1208     uint32_t config_batch_idx;
1209 } cam_frame_idx_range_t;
1210 
1211 typedef enum {
1212   S_NORMAL = 0,
1213   S_SCENERY,
1214   S_PORTRAIT,
1215   S_PORTRAIT_BACKLIGHT,
1216   S_SCENERY_BACKLIGHT,
1217   S_BACKLIGHT,
1218   S_MAX,
1219 } cam_auto_scene_t;
1220 
1221 typedef struct {
1222    uint32_t meta_frame_id;
1223 } cam_meta_valid_t;
1224 
1225 typedef enum {
1226     CAM_SENSOR_RAW,
1227     CAM_SENSOR_YUV
1228 } cam_sensor_t;
1229 
1230 typedef struct {
1231     cam_flash_mode_t flash_mode;
1232     float            aperture_value;
1233     cam_flash_state_t        flash_state;
1234     float            focal_length;
1235     float            f_number;
1236     int32_t          sensing_method;
1237     float            crop_factor;
1238     cam_sensor_t sens_type;
1239 } cam_sensor_params_t;
1240 
1241 typedef enum {
1242     CAM_METERING_MODE_UNKNOWN = 0,
1243     CAM_METERING_MODE_AVERAGE = 1,
1244     CAM_METERING_MODE_CENTER_WEIGHTED_AVERAGE = 2,
1245     CAM_METERING_MODE_SPOT = 3,
1246     CAM_METERING_MODE_MULTI_SPOT = 4,
1247     CAM_METERING_MODE_PATTERN = 5,
1248     CAM_METERING_MODE_PARTIAL = 6,
1249     CAM_METERING_MODE_OTHER = 255,
1250 } cam_metering_mode_t;
1251 
1252 typedef struct {
1253     float exp_time;
1254     int32_t iso_value;
1255     uint32_t flash_needed;
1256     uint32_t settled;
1257     cam_wb_mode_type wb_mode;
1258     uint32_t metering_mode;
1259     uint32_t exposure_program;
1260     uint32_t exposure_mode;
1261     uint32_t scenetype;
1262     float brightness;
1263 } cam_3a_params_t;
1264 
1265 typedef struct {
1266     uint64_t sw_version_number;
1267     int32_t aec_debug_data_size;
1268     char aec_private_debug_data[AEC_DEBUG_DATA_SIZE];
1269 } cam_ae_exif_debug_t;
1270 
1271 typedef struct {
1272     int32_t cct_value;
1273     cam_awb_gain_t rgb_gains;
1274 } cam_awb_params_t;
1275 
1276 typedef struct {
1277     int32_t awb_debug_data_size;
1278     char awb_private_debug_data[AWB_DEBUG_DATA_SIZE];
1279 } cam_awb_exif_debug_t;
1280 
1281 typedef struct {
1282     int32_t af_debug_data_size;
1283     int32_t haf_debug_data_size;
1284     int32_t tof_debug_data_size;
1285     int32_t dciaf_debug_data_size;
1286     int32_t pdaf_debug_data_size;
1287     char af_private_debug_data[AF_DEBUG_DATA_SIZE];
1288 } cam_af_exif_debug_t;
1289 
1290 typedef struct {
1291     int32_t asd_debug_data_size;
1292     char asd_private_debug_data[ASD_DEBUG_DATA_SIZE];
1293 } cam_asd_exif_debug_t;
1294 
1295 typedef struct {
1296     int32_t bg_stats_buffer_size;
1297     int32_t bhist_stats_buffer_size;
1298     int32_t bg_config_buffer_size;
1299     char stats_buffer_private_debug_data[STATS_BUFFER_DEBUG_DATA_SIZE];
1300 } cam_stats_buffer_exif_debug_t;
1301 
1302 /* 3A version*/
1303 typedef struct {
1304     uint16_t major_version;
1305     uint16_t minor_version;
1306     uint16_t patch_version;
1307     uint16_t new_feature_des;
1308 } cam_q3a_version_t;
1309 
1310 typedef struct {
1311     uint32_t tuning_data_version;
1312     size_t tuning_sensor_data_size;
1313     size_t tuning_vfe_data_size;
1314     size_t tuning_cpp_data_size;
1315     size_t tuning_cac_data_size;
1316     size_t tuning_cac_data_size2;
1317     size_t tuning_mod3_data_size;
1318     uint8_t  data[TUNING_DATA_MAX];
1319 }tuning_params_t;
1320 
1321 typedef struct {
1322     int32_t event_type;
1323     cam_dimension_t dim;
1324     size_t size;
1325     char path[QCAMERA_MAX_FILEPATH_LENGTH];
1326 } cam_int_evt_params_t;
1327 
1328 typedef struct {
1329   uint8_t private_isp_data[MAX_ISP_DATA_SIZE];
1330 } cam_chromatix_lite_isp_t;
1331 
1332 typedef struct {
1333   uint8_t private_pp_data[MAX_PP_DATA_SIZE];
1334 } cam_chromatix_lite_pp_t;
1335 
1336 typedef struct {
1337   uint8_t private_stats_data[MAX_AE_STATS_DATA_SIZE];
1338 } cam_chromatix_lite_ae_stats_t;
1339 
1340 typedef struct {
1341   uint8_t private_stats_data[MAX_AWB_STATS_DATA_SIZE];
1342 } cam_chromatix_lite_awb_stats_t;
1343 
1344 typedef struct {
1345   uint8_t private_stats_data[MAX_AF_STATS_DATA_SIZE];
1346 } cam_chromatix_lite_af_stats_t;
1347 
1348 typedef struct {
1349   uint8_t private_stats_data[MAX_ASD_STATS_DATA_SIZE];
1350 } cam_chromatix_lite_asd_stats_t;
1351 
1352 typedef struct {
1353    uint32_t min_buffers;
1354    uint32_t max_buffers;
1355 } cam_buffer_info_t;
1356 
1357 typedef struct {
1358     cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
1359     uint32_t num_streams;
1360     cam_stream_type_t type[MAX_NUM_STREAMS];
1361     uint32_t postprocess_mask[MAX_NUM_STREAMS];
1362     cam_buffer_info_t buffer_info;
1363     cam_is_type_t is_type;
1364 } cam_stream_size_info_t;
1365 
1366 typedef struct {
1367     uint32_t num_streams;
1368     uint32_t streamID[MAX_NUM_STREAMS];
1369 } cam_stream_ID_t;
1370 
1371 typedef struct {
1372     uint32_t frame_id;
1373     uint32_t num_streams;
1374     uint32_t stream_id[MAX_NUM_STREAMS];
1375 } cam_buf_divert_info_t;
1376 
1377 typedef  struct {
1378     uint8_t is_stats_valid;               /* if histgram data is valid */
1379     cam_hist_stats_t stats_data;          /* histogram data */
1380 
1381     uint8_t is_faces_valid;               /* if face detection data is valid */
1382     cam_face_detection_data_t faces_data; /* face detection result */
1383 
1384     uint8_t is_focus_valid;               /* if focus data is valid */
1385     cam_auto_focus_data_t focus_data;     /* focus data */
1386 
1387     uint8_t is_crop_valid;                /* if crop data is valid */
1388     cam_crop_data_t crop_data;            /* crop data */
1389 
1390     uint8_t is_prep_snapshot_done_valid;  /* if prep snapshot done is valid */
1391     cam_prep_snapshot_state_t prep_snapshot_done_state;  /* prepare snapshot done state */
1392 
1393     /* if good frame idx range is valid */
1394     uint8_t is_good_frame_idx_range_valid;
1395     /* good frame idx range, make sure:
1396      * 1. good_frame_idx_range.min_frame_idx > current_frame_idx
1397      * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */
1398     cam_frame_idx_range_t good_frame_idx_range;
1399 
1400     uint32_t is_hdr_scene_data_valid;
1401     cam_asd_hdr_scene_data_t hdr_scene_data;
1402     uint8_t is_asd_decision_valid;
1403     cam_auto_scene_t scene; //scene type as decided by ASD
1404 
1405     char private_metadata[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
1406 
1407     /* AE parameters */
1408     uint8_t is_3a_params_valid;
1409     cam_3a_params_t cam_3a_params;
1410 
1411     /* AE exif debug parameters */
1412     uint8_t is_ae_exif_debug_valid;
1413     cam_ae_exif_debug_t ae_exif_debug_params;
1414 
1415     /* AWB exif debug parameters */
1416     uint8_t is_awb_exif_debug_valid;
1417     cam_awb_exif_debug_t awb_exif_debug_params;
1418 
1419     /* AF exif debug parameters */
1420     uint8_t is_af_exif_debug_valid;
1421     cam_af_exif_debug_t af_exif_debug_params;
1422 
1423     /* ASD exif debug parameters */
1424     uint8_t is_asd_exif_debug_valid;
1425     cam_asd_exif_debug_t asd_exif_debug_params;
1426 
1427     /* Stats buffer exif debug parameters */
1428     uint8_t is_stats_buffer_exif_debug_valid;
1429     cam_stats_buffer_exif_debug_t stats_buffer_exif_debug_params;
1430 
1431     /* AWB parameters */
1432     uint8_t is_awb_params_valid;
1433     cam_awb_params_t awb_params;
1434 
1435     /* sensor parameters */
1436     uint8_t is_sensor_params_valid;
1437     cam_sensor_params_t sensor_params;
1438 
1439     /* Meta valid params */
1440     uint8_t is_meta_valid;
1441     cam_meta_valid_t meta_valid_params;
1442 
1443     /*Tuning Data*/
1444     uint8_t is_tuning_params_valid;
1445     tuning_params_t tuning_params;
1446 
1447     uint8_t is_chromatix_lite_isp_valid;
1448     cam_chromatix_lite_isp_t chromatix_lite_isp_data;
1449 
1450     uint8_t is_chromatix_lite_pp_valid;
1451     cam_chromatix_lite_pp_t chromatix_lite_pp_data;
1452 
1453     uint8_t is_chromatix_lite_ae_stats_valid;
1454     cam_chromatix_lite_ae_stats_t chromatix_lite_ae_stats_data;
1455 
1456     uint8_t is_chromatix_lite_awb_stats_valid;
1457     cam_chromatix_lite_awb_stats_t chromatix_lite_awb_stats_data;
1458 
1459     uint8_t is_chromatix_lite_af_stats_valid;
1460     cam_chromatix_lite_af_stats_t chromatix_lite_af_stats_data;
1461 } cam_metadata_info_t;
1462 
1463 typedef enum {
1464     CAM_INTF_PARM_HAL_VERSION,
1465 
1466     /* Overall mode of 3A control routines. We need to have this parameter
1467      * because not all android.control.* have an OFF option, for example,
1468      * AE_FPS_Range, aePrecaptureTrigger */
1469     CAM_INTF_META_MODE,
1470     /* Whether AE is currently updating the sensor exposure and sensitivity
1471      * fields */
1472     CAM_INTF_META_AEC_MODE,
1473     CAM_INTF_PARM_WHITE_BALANCE,
1474     CAM_INTF_PARM_FOCUS_MODE,
1475 
1476     /* common between HAL1 and HAL3 */
1477     CAM_INTF_PARM_ANTIBANDING,
1478     CAM_INTF_PARM_EXPOSURE_COMPENSATION,
1479     CAM_INTF_PARM_EV_STEP,
1480     CAM_INTF_PARM_AEC_LOCK,
1481     CAM_INTF_PARM_FPS_RANGE,
1482     CAM_INTF_PARM_AWB_LOCK, /* 10 */
1483     CAM_INTF_PARM_EFFECT,
1484     CAM_INTF_PARM_BESTSHOT_MODE,
1485     CAM_INTF_PARM_DIS_ENABLE,
1486     CAM_INTF_PARM_LED_MODE,
1487     CAM_INTF_META_HISTOGRAM,
1488     CAM_INTF_META_FACE_DETECTION,
1489     /* Whether optical image stabilization is enabled. */
1490     CAM_INTF_META_LENS_OPT_STAB_MODE,
1491     /* specific to HAl1 */
1492     CAM_INTF_META_AUTOFOCUS_DATA,
1493     CAM_INTF_PARM_QUERY_FLASH4SNAP,
1494     CAM_INTF_PARM_EXPOSURE, /* 20 */
1495     CAM_INTF_PARM_SHARPNESS,
1496     CAM_INTF_PARM_CONTRAST,
1497     CAM_INTF_PARM_SATURATION,
1498     CAM_INTF_PARM_BRIGHTNESS,
1499     CAM_INTF_PARM_ISO,
1500     CAM_INTF_PARM_ZOOM,
1501     CAM_INTF_PARM_ROLLOFF,
1502     CAM_INTF_PARM_MODE,             /* camera mode */
1503     CAM_INTF_PARM_AEC_ALGO_TYPE,    /* auto exposure algorithm */
1504     CAM_INTF_PARM_FOCUS_ALGO_TYPE, /* 30 */ /* focus algorithm */
1505     CAM_INTF_PARM_AEC_ROI,
1506     CAM_INTF_PARM_AF_ROI,
1507     CAM_INTF_PARM_SCE_FACTOR,
1508     CAM_INTF_PARM_FD,
1509     CAM_INTF_PARM_MCE,
1510     CAM_INTF_PARM_HFR,
1511     CAM_INTF_PARM_REDEYE_REDUCTION,
1512     CAM_INTF_PARM_WAVELET_DENOISE,
1513     CAM_INTF_PARM_TEMPORAL_DENOISE,
1514     CAM_INTF_PARM_HISTOGRAM, /* 40 */
1515     CAM_INTF_PARM_ASD_ENABLE,
1516     CAM_INTF_PARM_RECORDING_HINT,
1517     CAM_INTF_PARM_HDR,
1518     CAM_INTF_PARM_MAX_DIMENSION,
1519     CAM_INTF_PARM_RAW_DIMENSION,
1520     CAM_INTF_PARM_FRAMESKIP,
1521     CAM_INTF_PARM_ZSL_MODE,  /* indicating if it's running in ZSL mode */
1522     CAM_INTF_PARM_BURST_NUM,
1523     CAM_INTF_PARM_RETRO_BURST_NUM,
1524     CAM_INTF_PARM_BURST_LED_ON_PERIOD, /* 50 */
1525     CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */
1526     CAM_INTF_PARM_LOCK_CAF,
1527     CAM_INTF_PARM_VIDEO_HDR,
1528     CAM_INTF_PARM_SENSOR_HDR,
1529     CAM_INTF_PARM_ROTATION,
1530     CAM_INTF_PARM_SCALE,
1531     CAM_INTF_PARM_VT, /* indicating if it's a Video Call Apllication */
1532     CAM_INTF_META_CROP_DATA,
1533     CAM_INTF_META_PREP_SNAPSHOT_DONE,
1534     CAM_INTF_META_GOOD_FRAME_IDX_RANGE, /* 60 */
1535     CAM_INTF_META_ASD_HDR_SCENE_DATA,
1536     CAM_INTF_META_ASD_SCENE_TYPE,
1537     CAM_INTF_META_CURRENT_SCENE,
1538     CAM_INTF_META_AEC_INFO,
1539     CAM_INTF_META_SENSOR_INFO,
1540     CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,
1541     CAM_INTF_META_CHROMATIX_LITE_ISP,
1542     CAM_INTF_META_CHROMATIX_LITE_PP,
1543     CAM_INTF_META_CHROMATIX_LITE_AE,
1544     CAM_INTF_META_CHROMATIX_LITE_AWB, /* 70 */
1545     CAM_INTF_META_CHROMATIX_LITE_AF,
1546     CAM_INTF_META_CHROMATIX_LITE_ASD,
1547     CAM_INTF_META_EXIF_DEBUG_AE,
1548     CAM_INTF_META_EXIF_DEBUG_AWB,
1549     CAM_INTF_META_EXIF_DEBUG_AF,
1550     CAM_INTF_META_EXIF_DEBUG_ASD,
1551     CAM_INTF_META_EXIF_DEBUG_STATS,
1552     CAM_INTF_PARM_GET_CHROMATIX,
1553     CAM_INTF_PARM_SET_RELOAD_CHROMATIX,
1554     CAM_INTF_PARM_SET_AUTOFOCUSTUNING, /* 80 */
1555     CAM_INTF_PARM_GET_AFTUNE,
1556     CAM_INTF_PARM_SET_RELOAD_AFTUNE,
1557     CAM_INTF_PARM_SET_VFE_COMMAND,
1558     CAM_INTF_PARM_SET_PP_COMMAND,
1559     CAM_INTF_PARM_TINTLESS,
1560     CAM_INTF_PARM_LONGSHOT_ENABLE,
1561     CAM_INTF_PARM_RDI_MODE,
1562     CAM_INTF_PARM_CDS_MODE,
1563     CAM_INTF_PARM_TONE_MAP_MODE,
1564     CAM_INTF_BUF_DIVERT_INFO,
1565     CAM_INTF_PARM_CAPTURE_FRAME_CONFIG,
1566 
1567     /* stream based parameters */
1568     CAM_INTF_PARM_DO_REPROCESS,
1569     CAM_INTF_PARM_SET_BUNDLE, /* 90 */
1570     CAM_INTF_PARM_STREAM_FLIP,
1571     CAM_INTF_PARM_GET_OUTPUT_CROP,
1572 
1573     CAM_INTF_PARM_EZTUNE_CMD,
1574     CAM_INTF_PARM_INT_EVT,
1575 
1576     /* specific to HAL3 */
1577     /* Whether the metadata maps to a valid frame number */
1578     CAM_INTF_META_FRAME_NUMBER_VALID,
1579     /* Whether the urgent metadata maps to a valid frame number */
1580     CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,
1581     /* Whether the stream buffer corresponding this frame is dropped or not */
1582     CAM_INTF_META_FRAME_DROPPED,
1583     /* COLOR CORRECTION.*/
1584     CAM_INTF_META_COLOR_CORRECT_MODE,
1585     /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931)
1586      * color space from the scene illuminant to the sRGB-standard D65-illuminant. */
1587     CAM_INTF_META_COLOR_CORRECT_TRANSFORM,
1588     /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/
1589     CAM_INTF_META_COLOR_CORRECT_GAINS, /* 100 */
1590     /*The best fit color transform matrix calculated by the stats*/
1591     CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM,
1592     /*The best fit color channels gains calculated by the stats*/
1593     CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,
1594     /* CONTROL */
1595     /* A frame counter set by the framework. Must be maintained unchanged in
1596      * output frame. */
1597     CAM_INTF_META_FRAME_NUMBER,
1598     /* A frame counter set by the framework. Must be maintained unchanged in
1599      * output frame. */
1600     CAM_INTF_META_URGENT_FRAME_NUMBER,
1601     /*Number of streams and size of streams in current configuration*/
1602     CAM_INTF_META_STREAM_INFO,
1603     /* List of areas to use for metering */
1604     CAM_INTF_META_AEC_ROI,
1605     /* Whether the HAL must trigger precapture metering.*/
1606     CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,
1607     /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */
1608     /* Current state of AE algorithm */
1609     CAM_INTF_META_AEC_STATE,
1610     /* List of areas to use for focus estimation */
1611     CAM_INTF_META_AF_ROI,
1612     /* Whether the HAL must trigger autofocus. */
1613     CAM_INTF_META_AF_TRIGGER, /* 110 */
1614     /* Current state of AF algorithm */
1615     CAM_INTF_META_AF_STATE,
1616     /* List of areas to use for illuminant estimation */
1617     CAM_INTF_META_AWB_REGIONS,
1618     /* Current state of AWB algorithm */
1619     CAM_INTF_META_AWB_STATE,
1620     /*Whether black level compensation is frozen or free to vary*/
1621     CAM_INTF_META_BLACK_LEVEL_LOCK,
1622     /* Information to 3A routines about the purpose of this capture, to help
1623      * decide optimal 3A strategy */
1624     CAM_INTF_META_CAPTURE_INTENT,
1625     /* DEMOSAIC */
1626     /* Controls the quality of the demosaicing processing */
1627     CAM_INTF_META_DEMOSAIC,
1628     /* EDGE */
1629     /* Operation mode for edge enhancement */
1630     CAM_INTF_META_EDGE_MODE,
1631     /* Control the amount of edge enhancement applied to the images.*/
1632     /* 1-10; 10 is maximum sharpening */
1633     CAM_INTF_META_SHARPNESS_STRENGTH,
1634     /* FLASH */
1635     /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */
1636     CAM_INTF_META_FLASH_POWER,
1637     /* Firing time of flash relative to start of exposure, in nanoseconds*/
1638     CAM_INTF_META_FLASH_FIRING_TIME, /* 120 */
1639     /* Current state of the flash unit */
1640     CAM_INTF_META_FLASH_STATE,
1641     /* GEOMETRIC */
1642     /* Operating mode of geometric correction */
1643     CAM_INTF_META_GEOMETRIC_MODE,
1644     /* Control the amount of shading correction applied to the images */
1645     CAM_INTF_META_GEOMETRIC_STRENGTH,
1646     /* HOT PIXEL */
1647     /* Set operational mode for hot pixel correction */
1648     CAM_INTF_META_HOTPIXEL_MODE,
1649     /* LENS */
1650     /* Size of the lens aperture */
1651     CAM_INTF_META_LENS_APERTURE,
1652     /* State of lens neutral density filter(s) */
1653     CAM_INTF_META_LENS_FILTERDENSITY,
1654     /* Lens optical zoom setting */
1655     CAM_INTF_META_LENS_FOCAL_LENGTH,
1656     /* Distance to plane of sharpest focus, measured from frontmost surface
1657      * of the lens */
1658     CAM_INTF_META_LENS_FOCUS_DISTANCE,
1659     /* The range of scene distances that are in sharp focus (depth of field) */
1660     CAM_INTF_META_LENS_FOCUS_RANGE,
1661     /*Whether the hal needs to output the lens shading map*/
1662     CAM_INTF_META_LENS_SHADING_MAP_MODE, /* 130 */
1663     /* Current lens status */
1664     CAM_INTF_META_LENS_STATE,
1665     /* NOISE REDUCTION */
1666     /* Mode of operation for the noise reduction algorithm */
1667     CAM_INTF_META_NOISE_REDUCTION_MODE,
1668    /* Control the amount of noise reduction applied to the images.
1669     * 1-10; 10 is max noise reduction */
1670     CAM_INTF_META_NOISE_REDUCTION_STRENGTH,
1671     /* SCALER */
1672     /* Top-left corner and width of the output region to select from the active
1673      * pixel array */
1674     CAM_INTF_META_SCALER_CROP_REGION,
1675     /* The estimated scene illumination lighting frequency */
1676     CAM_INTF_META_SCENE_FLICKER,
1677     /* SENSOR */
1678     /* Duration each pixel is exposed to light, in nanoseconds */
1679     CAM_INTF_META_SENSOR_EXPOSURE_TIME,
1680     /* Duration from start of frame exposure to start of next frame exposure,
1681      * in nanoseconds */
1682     CAM_INTF_META_SENSOR_FRAME_DURATION,
1683     /* Gain applied to image data. Must be implemented through analog gain only
1684      * if set to values below 'maximum analog sensitivity'. */
1685     CAM_INTF_META_SENSOR_SENSITIVITY,
1686     /* Time at start of exposure of first row */
1687     CAM_INTF_META_SENSOR_TIMESTAMP,
1688     /* Duration b/w start of first row exposure and the start of last
1689        row exposure in nanoseconds */
1690     CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW, /* 140 */
1691     /* SHADING */
1692     /* Quality of lens shading correction applied to the image data */
1693     CAM_INTF_META_SHADING_MODE,
1694     /* Control the amount of shading correction applied to the images.
1695      * unitless: 1-10; 10 is full shading compensation */
1696     CAM_INTF_META_SHADING_STRENGTH,
1697     /* STATISTICS */
1698     /* State of the face detector unit */
1699     CAM_INTF_META_STATS_FACEDETECT_MODE,
1700     /* Operating mode for histogram generation */
1701     CAM_INTF_META_STATS_HISTOGRAM_MODE,
1702     /* Operating mode for sharpness map generation */
1703     CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,
1704     /* A 3-channel sharpness map, based on the raw sensor data,
1705      * If only a monochrome sharpness map is supported, all channels
1706      * should have the same data
1707      */
1708     CAM_INTF_META_STATS_SHARPNESS_MAP,
1709 
1710     /* TONEMAP */
1711     /* Tone map mode */
1712     CAM_INTF_META_TONEMAP_MODE,
1713     /* Table mapping RGB input values to output values */
1714     CAM_INTF_META_TONEMAP_CURVES,
1715 
1716     CAM_INTF_META_FLASH_MODE,
1717     /* 2D array of gain factors for each color channel that was used to
1718      * compensate for lens shading for this frame */
1719     CAM_INTF_META_LENS_SHADING_MAP, /* 150 */
1720     CAM_INTF_META_PRIVATE_DATA,
1721     CAM_INTF_PARM_STATS_DEBUG_MASK,
1722     CAM_INTF_PARM_STATS_AF_PAAF,
1723     /* Indicates streams ID of all the requested buffers */
1724     CAM_INTF_META_STREAM_ID,
1725     CAM_INTF_PARM_FOCUS_BRACKETING,
1726     CAM_INTF_PARM_FLASH_BRACKETING,
1727     CAM_INTF_PARM_GET_IMG_PROP,
1728     CAM_INTF_META_JPEG_GPS_COORDINATES,
1729     CAM_INTF_META_JPEG_GPS_PROC_METHODS,
1730     CAM_INTF_META_JPEG_GPS_TIMESTAMP, /* 160 */
1731     CAM_INTF_META_JPEG_ORIENTATION,
1732     CAM_INTF_META_JPEG_QUALITY,
1733     CAM_INTF_META_JPEG_THUMB_QUALITY,
1734     CAM_INTF_META_JPEG_THUMB_SIZE,
1735 
1736     CAM_INTF_META_TEST_PATTERN_DATA,
1737     /* DNG file support */
1738     CAM_INTF_META_PROFILE_TONE_CURVE,
1739     CAM_INTF_META_NEUTRAL_COL_POINT,
1740 
1741     /* CAC */
1742     CAM_INTF_PARM_CAC,
1743 
1744     /* trigger for all modules to read the debug/log level properties */
1745     CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,
1746 
1747     /* OTP : WB gr/gb */
1748     CAM_INTF_META_OTP_WB_GRGB, /* 170 */
1749     /* LED override for EZTUNE */
1750     CAM_INTF_META_LED_MODE_OVERRIDE,
1751     /* auto lens position info */
1752     CAM_INTF_META_FOCUS_POSITION,
1753     /* Manual exposure time */
1754     CAM_INTF_PARM_EXPOSURE_TIME,
1755     /* AWB meta data info */
1756     CAM_INTF_META_AWB_INFO,
1757     /* Manual lens position info */
1758     CAM_INTF_PARM_MANUAL_FOCUS_POS,
1759     /* Manual White balance gains */
1760     CAM_INTF_PARM_WB_MANUAL,
1761     /* IMG LIB reprocess debug section */
1762     CAM_INTF_META_IMGLIB, /* cam_intf_meta_imglib_t */
1763     /* FLIP mode parameter*/
1764     CAM_INTF_PARM_FLIP,
1765     CAM_INTF_META_USE_AV_TIMER,
1766 
1767     CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,
1768 
1769     /*Black level parameters*/
1770     CAM_INTF_META_LDAF_EXIF,
1771     CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,
1772     CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN,
1773     CAM_INTF_META_CDS_DATA,
1774 
1775     /* Whether EIS is enabled */
1776     CAM_INTF_META_VIDEO_STAB_MODE,
1777     CAM_INTF_PARM_MAX
1778 } cam_intf_parm_type_t;
1779 
1780 typedef struct {
1781     uint32_t forced;
1782     union {
1783       uint32_t force_linecount_value;
1784       float    force_gain_value;
1785       float    force_snap_exp_value;
1786       float    force_exp_value;
1787       uint32_t force_snap_linecount_value;
1788       float    force_snap_gain_value;
1789     } u;
1790 } cam_ez_force_params_t;
1791 
1792 typedef struct {
1793     float cam_black_level[4];
1794 } cam_black_level_metadata_t;
1795 
1796 typedef enum {
1797     CAM_EZTUNE_CMD_STATUS,
1798     CAM_EZTUNE_CMD_AEC_ENABLE,
1799     CAM_EZTUNE_CMD_AWB_ENABLE,
1800     CAM_EZTUNE_CMD_AF_ENABLE,
1801     CAM_EZTUNE_CMD_AEC_FORCE_LINECOUNT,
1802     CAM_EZTUNE_CMD_AEC_FORCE_GAIN,
1803     CAM_EZTUNE_CMD_AEC_FORCE_EXP,
1804     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_LC,
1805     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_GAIN,
1806     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_EXP,
1807     CAM_EZTUNE_CMD_AWB_MODE,
1808     CAM_EZTUNE_CMD_AWB_FORCE_DUAL_LED_IDX,
1809 } cam_eztune_cmd_type_t;
1810 
1811 typedef struct {
1812   cam_eztune_cmd_type_t   cmd;
1813   union {
1814     int32_t running;
1815     int32_t aec_enable;
1816     int32_t awb_enable;
1817     int32_t af_enable;
1818     cam_ez_force_params_t ez_force_param;
1819     int32_t awb_mode;
1820     int32_t ez_force_dual_led_idx;
1821   } u;
1822 } cam_eztune_cmd_data_t;
1823 
1824 
1825 /*****************************************************************************
1826  *                 Code for HAL3 data types                                  *
1827  ****************************************************************************/
1828 typedef enum {
1829     CAM_INTF_METADATA_MAX
1830 } cam_intf_metadata_type_t;
1831 
1832 typedef enum {
1833     CAM_INTENT_CUSTOM,
1834     CAM_INTENT_PREVIEW,
1835     CAM_INTENT_STILL_CAPTURE,
1836     CAM_INTENT_VIDEO_RECORD,
1837     CAM_INTENT_VIDEO_SNAPSHOT,
1838     CAM_INTENT_ZERO_SHUTTER_LAG,
1839     CAM_INTENT_MAX,
1840 } cam_intent_t;
1841 
1842 typedef enum {
1843     /* Full application control of pipeline. All 3A routines are disabled,
1844      * no other settings in android.control.* have any effect */
1845     CAM_CONTROL_OFF,
1846     /* Use settings for each individual 3A routine. Manual control of capture
1847      * parameters is disabled. All controls in android.control.* besides sceneMode
1848      * take effect */
1849     CAM_CONTROL_AUTO,
1850     /* Use specific scene mode. Enabling this disables control.aeMode,
1851      * control.awbMode and control.afMode controls; the HAL must ignore those
1852      * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode).
1853      * Other control entries are still active. This setting can only be used if
1854      * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this
1855      * in HAL ?*/
1856     CAM_CONTROL_USE_SCENE_MODE,
1857     CAM_CONTROL_MAX
1858 } cam_control_mode_t;
1859 
1860 typedef enum {
1861     /* Use the android.colorCorrection.transform matrix to do color conversion */
1862     CAM_COLOR_CORRECTION_TRANSFORM_MATRIX,
1863     /* Must not slow down frame rate relative to raw bayer output */
1864     CAM_COLOR_CORRECTION_FAST,
1865     /* Frame rate may be reduced by high quality */
1866     CAM_COLOR_CORRECTION_HIGH_QUALITY,
1867 } cam_color_correct_mode_t;
1868 
1869 typedef enum {
1870     CAM_COLOR_CORRECTION_ABERRATION_OFF,
1871     CAM_COLOR_CORRECTION_ABERRATION_FAST,
1872     CAM_COLOR_CORRECTION_ABERRATION_HIGH_QUALITY,
1873     CAM_COLOR_CORRECTION_ABERRATION_MAX
1874 } cam_aberration_mode_t;
1875 
1876 #define CC_MATRIX_ROWS 3
1877 #define CC_MATRIX_COLS 3
1878 
1879 typedef struct {
1880     /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */
1881     cam_rational_type_t transform_matrix[CC_MATRIX_ROWS][CC_MATRIX_COLS];
1882 } cam_color_correct_matrix_t;
1883 
1884 #define CAM_FOCAL_LENGTHS_MAX     1
1885 #define CAM_APERTURES_MAX         1
1886 #define CAM_FILTER_DENSITIES_MAX  1
1887 #define CAM_MAX_MAP_HEIGHT        6
1888 #define CAM_MAX_MAP_WIDTH         6
1889 #define CAM_MAX_SHADING_MAP_WIDTH 17
1890 #define CAM_MAX_SHADING_MAP_HEIGHT 13
1891 #define CAM_MAX_TONEMAP_CURVE_SIZE    512
1892 #define CAM_MAX_FLASH_BRACKETING    5
1893 
1894 typedef struct {
1895     /* A 1D array of pairs of floats.
1896      * Mapping a 0-1 input range to a 0-1 output range.
1897      * The input range must be monotonically increasing with N,
1898      * and values between entries should be linearly interpolated.
1899      * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0],
1900      * then the input->output mapping for a few sample points would be:
1901      * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */
1902     float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2];
1903 } cam_tonemap_curve_t;
1904 
1905 typedef struct {
1906    size_t tonemap_points_cnt;
1907    cam_tonemap_curve_t curves[3];
1908 } cam_rgb_tonemap_curves;
1909 
1910 typedef struct {
1911    size_t tonemap_points_cnt;
1912    cam_tonemap_curve_t curve;
1913 } cam_profile_tone_curve;
1914 
1915 #define NEUTRAL_COL_POINTS 3
1916 
1917 typedef struct {
1918     cam_rational_type_t neutral_col_point[NEUTRAL_COL_POINTS];
1919 } cam_neutral_col_point_t;
1920 
1921 typedef enum {
1922     OFF,
1923     FAST,
1924     QUALITY,
1925 } cam_quality_preference_t;
1926 
1927 typedef enum {
1928     CAM_FLASH_CTRL_OFF,
1929     CAM_FLASH_CTRL_SINGLE,
1930     CAM_FLASH_CTRL_TORCH
1931 } cam_flash_ctrl_t;
1932 
1933 typedef struct {
1934     uint8_t frame_dropped; /*  This flag indicates whether any stream buffer is dropped or not */
1935     cam_stream_ID_t cam_stream_ID; /* if dropped, Stream ID of dropped streams */
1936 } cam_frame_dropped_t;
1937 
1938 typedef struct {
1939     uint8_t ae_mode;
1940     uint8_t awb_mode;
1941     uint8_t af_mode;
1942 } cam_scene_mode_overrides_t;
1943 
1944 typedef struct {
1945     int32_t left;
1946     int32_t top;
1947     int32_t width;
1948     int32_t height;
1949 } cam_crop_region_t;
1950 
1951 typedef struct {
1952     /* Estimated sharpness for each region of the input image.
1953      * Normalized to be between 0 and maxSharpnessMapValue.
1954      * Higher values mean sharper (better focused) */
1955     int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT];
1956 } cam_sharpness_map_t;
1957 
1958 typedef struct {
1959    float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH];
1960 } cam_lens_shading_map_t;
1961 
1962 typedef struct {
1963     int32_t min_value;
1964     int32_t max_value;
1965     int32_t def_value;
1966     int32_t step;
1967 } cam_control_range_t;
1968 
1969 #define CAM_QCOM_FEATURE_NONE            0U
1970 #define CAM_QCOM_FEATURE_FACE_DETECTION (1U<<0)
1971 #define CAM_QCOM_FEATURE_DENOISE2D      (1U<<1)
1972 #define CAM_QCOM_FEATURE_CROP           (1U<<2)
1973 #define CAM_QCOM_FEATURE_ROTATION       (1U<<3)
1974 #define CAM_QCOM_FEATURE_FLIP           (1U<<4)
1975 #define CAM_QCOM_FEATURE_HDR            (1U<<5)
1976 #define CAM_QCOM_FEATURE_REGISTER_FACE  (1U<<6)
1977 #define CAM_QCOM_FEATURE_SHARPNESS      (1U<<7)
1978 #define CAM_QCOM_FEATURE_VIDEO_HDR      (1U<<8)
1979 #define CAM_QCOM_FEATURE_CAC            (1U<<9)
1980 #define CAM_QCOM_FEATURE_SCALE          (1U<<10)
1981 #define CAM_QCOM_FEATURE_EFFECT         (1U<<11)
1982 #define CAM_QCOM_FEATURE_UBIFOCUS       (1U<<12)
1983 #define CAM_QCOM_FEATURE_CHROMA_FLASH   (1U<<13)
1984 #define CAM_QCOM_FEATURE_OPTIZOOM       (1U<<14)
1985 #define CAM_QCOM_FEATURE_SENSOR_HDR     (1U<<15)
1986 #define CAM_QCOM_FEATURE_REFOCUS        (1U<<16)
1987 #define CAM_QCOM_FEATURE_CPP_TNR        (1U<<17)
1988 #define CAM_QCOM_FEATURE_RAW_PROCESSING (1U<<18)
1989 #define CAM_QCOM_FEATURE_TRUEPORTRAIT   (1U<<19)
1990 #define CAM_QCOM_FEATURE_LLVD           (1U<<20)
1991 #define CAM_QCOM_FEATURE_DIS20          (1U<<21)
1992 #define CAM_QCOM_FEATURE_STILLMORE      (1U<<22)
1993 #define CAM_QCOM_FEATURE_CDS            (1U<<23)
1994 #define CAM_QCOM_FEATURE_MAX            (1U<<24)
1995 #define CAM_QCOM_FEATURE_PP_SUPERSET    (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\
1996                                          CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\
1997                                          CAM_QCOM_FEATURE_SCALE|CAM_QCOM_FEATURE_CAC)
1998 
1999 #define CAM_QCOM_FEATURE_PP_PASS_1      CAM_QCOM_FEATURE_PP_SUPERSET
2000 #define CAM_QCOM_FEATURE_PP_PASS_2      CAM_QCOM_FEATURE_SCALE | CAM_QCOM_FEATURE_CROP;
2001 
2002 
2003 // Counter clock wise
2004 typedef enum {
2005     ROTATE_0 = 1<<0,
2006     ROTATE_90 = 1<<1,
2007     ROTATE_180 = 1<<2,
2008     ROTATE_270 = 1<<3,
2009 } cam_rotation_t;
2010 
2011 typedef struct {
2012    cam_rotation_t rotation;         /* jpeg rotation */
2013    cam_rotation_t device_rotation;  /* device rotation */
2014    uint32_t streamId;
2015 } cam_rotation_info_t;
2016 
2017 typedef enum {
2018     FLIP_NONE = 0, /* 00b */
2019     FLIP_H = 1,    /* 01b */
2020     FLIP_V = 2,    /* 10b */
2021     FLIP_V_H = 3,  /* 11b */
2022 } cam_flip_t;
2023 
2024 typedef struct {
2025     uint32_t bundle_id;                            /* bundle id */
2026     uint8_t num_of_streams;                        /* number of streams in the bundle */
2027     uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */
2028 } cam_bundle_config_t;
2029 
2030 typedef enum {
2031     CAM_ONLINE_REPROCESS_TYPE,    /* online reprocess, frames from running streams */
2032     CAM_OFFLINE_REPROCESS_TYPE,   /* offline reprocess, frames from external source */
2033 } cam_reprocess_type_enum_t;
2034 
2035 typedef struct {
2036     uint8_t burst_count;
2037     uint8_t min_burst_count;
2038     uint8_t max_burst_count;
2039 } cam_still_more_t;
2040 
2041 typedef struct {
2042     uint8_t burst_count;
2043     uint8_t output_count;
2044     uint8_t flash_bracketing[CAM_MAX_FLASH_BRACKETING];
2045     uint8_t metadata_index;
2046 } cam_chroma_flash_t;
2047 
2048 typedef enum {
2049     CAM_HDR_MODE_SINGLEFRAME,    /* Single frame HDR mode which does only tone mapping */
2050     CAM_HDR_MODE_MULTIFRAME,     /* Multi frame HDR mode which needs two frames with 0.5x and 2x exposure respectively */
2051 } cam_hdr_mode_enum_t;
2052 
2053 typedef struct {
2054     uint32_t hdr_enable;
2055     uint32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */
2056     cam_hdr_mode_enum_t hdr_mode;
2057 } cam_hdr_param_t;
2058 
2059 typedef struct {
2060     int32_t output_width;
2061     int32_t output_height;
2062 } cam_scale_param_t;
2063 
2064 typedef struct {
2065     uint8_t enable;
2066     uint8_t burst_count;
2067     uint8_t focus_steps[MAX_AF_BRACKETING_VALUES];
2068     uint8_t output_count;
2069     uint32_t meta_max_size;
2070 } cam_af_bracketing_t;
2071 
2072 typedef struct {
2073     uint8_t enable;
2074     uint8_t burst_count;
2075 } cam_flash_bracketing_t;
2076 
2077 typedef struct {
2078     uint8_t enable;
2079     uint8_t burst_count;
2080     uint8_t zoom_threshold;
2081 } cam_opti_zoom_t;
2082 
2083 typedef struct {
2084     size_t meta_max_size;
2085 } cam_true_portrait_t;
2086 
2087 typedef enum {
2088     CAM_FLASH_OFF,
2089     CAM_FLASH_ON
2090 } cam_flash_value_t;
2091 
2092 typedef struct {
2093     cam_sensor_t sens_type;
2094     cam_format_t native_format;
2095 } cam_sensor_type_t;
2096 
2097 typedef struct {
2098     uint32_t result;
2099     uint32_t header_size;
2100     uint32_t width;
2101     uint32_t height;
2102     uint8_t data[0];
2103 } cam_misc_buf_t;
2104 
2105 typedef struct {
2106     uint32_t misc_buffer_index;
2107 } cam_misc_buf_param_t;
2108 
2109 typedef struct {
2110     /* reprocess feature mask */
2111     uint32_t feature_mask;
2112 
2113     /* individual setting for features to be reprocessed */
2114     cam_denoise_param_t denoise2d;
2115     cam_rect_t input_crop;
2116     cam_rotation_t rotation;
2117     uint32_t flip;
2118     int32_t sharpness;
2119     int32_t effect;
2120     cam_hdr_param_t hdr_param;
2121     cam_scale_param_t scale_param;
2122 
2123     uint8_t zoom_level;
2124     cam_flash_value_t flash_value;
2125     cam_misc_buf_param_t misc_buf_param;
2126     uint32_t burst_cnt;
2127 } cam_pp_feature_config_t;
2128 
2129 typedef struct {
2130     uint32_t input_stream_id;
2131     /* input source stream type */
2132     cam_stream_type_t input_stream_type;
2133 } cam_pp_online_src_config_t;
2134 
2135 typedef struct {
2136     /* image format */
2137     cam_format_t input_fmt;
2138 
2139     /* image dimension */
2140     cam_dimension_t input_dim;
2141 
2142     /* buffer plane information, will be calc based on stream_type, fmt,
2143        dim, and padding_info(from stream config). Info including:
2144        offset_x, offset_y, stride, scanline, plane offset */
2145     cam_stream_buf_plane_info_t input_buf_planes;
2146 
2147     /* number of input reprocess buffers */
2148     uint8_t num_of_bufs;
2149 
2150     /* input source type */
2151     cam_stream_type_t input_type;
2152 
2153 } cam_pp_offline_src_config_t;
2154 
2155 /* reprocess stream input configuration */
2156 typedef struct {
2157     /* input source config */
2158     cam_reprocess_type_enum_t pp_type;
2159     union {
2160         cam_pp_online_src_config_t online;
2161         cam_pp_offline_src_config_t offline;
2162     };
2163 
2164     /* pp feature config */
2165     cam_pp_feature_config_t pp_feature_config;
2166 } cam_stream_reproc_config_t;
2167 
2168 typedef struct {
2169     uint8_t crop_enabled;
2170     cam_rect_t input_crop;
2171 } cam_crop_param_t;
2172 
2173 typedef struct {
2174     uint8_t trigger;
2175     int32_t trigger_id;
2176 } cam_trigger_t;
2177 
2178 typedef struct {
2179     cam_denoise_param_t denoise2d;
2180     cam_crop_param_t crop;
2181     uint32_t flip;     /* 0 means no flip */
2182     uint32_t uv_upsample; /* 0 means no chroma upsampling */
2183     int32_t sharpness; /* 0 means no sharpness */
2184     int32_t effect;
2185     cam_rotation_t rotation;
2186     cam_rotation_t device_rotation;
2187 } cam_per_frame_pp_config_t;
2188 
2189 typedef enum {
2190     CAM_OPT_STAB_OFF,
2191     CAM_OPT_STAB_ON,
2192     CAM_OPT_STAB_MAX
2193 } cam_optical_stab_modes_t;
2194 
2195 typedef enum {
2196     CAM_FILTER_ARRANGEMENT_RGGB,
2197     CAM_FILTER_ARRANGEMENT_GRBG,
2198     CAM_FILTER_ARRANGEMENT_GBRG,
2199     CAM_FILTER_ARRANGEMENT_BGGR,
2200 
2201     /* Sensor is not Bayer; output has 3 16-bit values for each pixel,
2202      * instead of just 1 16-bit value per pixel.*/
2203     CAM_FILTER_ARRANGEMENT_RGB,
2204     /* Sensor is YUV; SW do not have access to actual RAW,
2205      * output is interleaved UYVY */
2206     CAM_FILTER_ARRANGEMENT_UYVY,
2207     CAM_FILTER_ARRANGEMENT_YUYV,
2208 } cam_color_filter_arrangement_t;
2209 
2210 typedef enum {
2211     CAM_AF_STATE_INACTIVE,
2212     CAM_AF_STATE_PASSIVE_SCAN,
2213     CAM_AF_STATE_PASSIVE_FOCUSED,
2214     CAM_AF_STATE_ACTIVE_SCAN,
2215     CAM_AF_STATE_FOCUSED_LOCKED,
2216     CAM_AF_STATE_NOT_FOCUSED_LOCKED,
2217     CAM_AF_STATE_PASSIVE_UNFOCUSED
2218 } cam_af_state_t;
2219 
2220 typedef enum {
2221   CAM_AF_LENS_STATE_STATIONARY,
2222   CAM_AF_LENS_STATE_MOVING,
2223 } cam_af_lens_state_t;
2224 
2225 typedef enum {
2226     CAM_AWB_STATE_INACTIVE,
2227     CAM_AWB_STATE_SEARCHING,
2228     CAM_AWB_STATE_CONVERGED,
2229     CAM_AWB_STATE_LOCKED
2230 } cam_awb_state_t;
2231 
2232 typedef enum {
2233     CAM_FOCUS_UNCALIBRATED,
2234     CAM_FOCUS_APPROXIMATE,
2235     CAM_FOCUS_CALIBRATED
2236 } cam_focus_calibration_t;
2237 
2238 typedef enum {
2239     CAM_TEST_PATTERN_OFF,
2240     CAM_TEST_PATTERN_SOLID_COLOR,
2241     CAM_TEST_PATTERN_COLOR_BARS,
2242     CAM_TEST_PATTERN_COLOR_BARS_FADE_TO_GRAY,
2243     CAM_TEST_PATTERN_PN9,
2244 } cam_test_pattern_mode_t;
2245 
2246 typedef struct {
2247     cam_test_pattern_mode_t mode;
2248     int32_t r;
2249     int32_t gr;
2250     int32_t gb;
2251     int32_t b;
2252 } cam_test_pattern_data_t;
2253 
2254 typedef enum {
2255     CAM_AWB_D50,
2256     CAM_AWB_D65,
2257     CAM_AWB_D75,
2258     CAM_AWB_A,
2259     CAM_AWB_CUSTOM_A,
2260     CAM_AWB_WARM_FLO,
2261     CAM_AWB_COLD_FLO,
2262     CAM_AWB_CUSTOM_FLO,
2263     CAM_AWB_NOON,
2264     CAM_AWB_CUSTOM_DAYLIGHT,
2265     CAM_AWB_INVALID_ALL_LIGHT,
2266 } cam_illuminat_t;
2267 
2268 typedef enum {
2269     LEGACY_RAW,
2270     MIPI_RAW,
2271 } cam_opaque_raw_format_t;
2272 
2273 typedef enum {
2274     CAM_PERF_NORMAL = 0,
2275     CAM_PERF_HIGH_PERFORMANCE,
2276 } cam_perf_mode_t;
2277 
2278 typedef struct {
2279     float real_gain;
2280     float lux_idx;
2281     float exp_time;
2282 } cam_intf_aec_t;
2283 
2284 typedef struct {
2285     uint32_t frame_count;
2286     cam_intf_aec_t aec_data[CAM_INTF_AEC_DATA_MAX];
2287 } cam_intf_meta_imglib_input_aec_t;
2288 
2289 typedef struct {
2290     cam_intf_meta_imglib_input_aec_t meta_imglib_input_aec;
2291 } cam_intf_meta_imglib_t;
2292 
2293 #endif /* __QCAMERA_TYPES_H__ */
2294