1 /* Copyright (c) 2012-2014, 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 1024
40 
41 #define CEILING64(X) (((X) + 0x0003F) & 0xFFFFFFC0)
42 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
43 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
44 #define CEILING4(X)  (((X) + 0x0003) & 0xFFFC)
45 #define CEILING2(X)  (((X) + 0x0001) & 0xFFFE)
46 
47 #define CAM_FN_CNT 255
48 /** CAM_DUMP_TO_FILE:
49  *  @filename: file name
50  *  @name:filename
51  *  @index: index of the file
52  *  @extn: file extension
53  *  @p_addr: address of the buffer
54  *  @len: buffer length
55  *
56  *  dump the image to the file
57  **/
58 #define CAM_DUMP_TO_FILE(path, name, index, extn, p_addr, len) ({ \
59   int rc = 0; \
60   char filename[CAM_FN_CNT]; \
61   if (index >= 0) \
62     snprintf(filename, CAM_FN_CNT-1, "%s/%s%d.%s", path, name, index, extn); \
63   else \
64     snprintf(filename, CAM_FN_CNT-1, "%s/%s.%s", path, name, extn); \
65   FILE *fp = fopen(filename, "w+"); \
66   if (fp) { \
67     rc = fwrite(p_addr, 1, len, fp); \
68     ALOGE("%s:%d] written size %d", __func__, __LINE__, len); \
69     fclose(fp); \
70   } else { \
71     ALOGE("%s:%d] open %s failed", __func__, __LINE__, filename); \
72   } \
73 })
74 
75 #define MAX_ZOOMS_CNT 79
76 #define MAX_SIZES_CNT 30
77 #define MAX_EXP_BRACKETING_LENGTH 32
78 #define MAX_ROI 5
79 #define MAX_STREAM_NUM_IN_BUNDLE 4
80 #define MAX_NUM_STREAMS          8
81 #define CHROMATIX_SIZE 60000
82 #define COMMONCHROMATIX_SIZE 45000
83 #define CPPCHROMATIX_SIZE 36000
84 #define AFTUNE_SIZE  4608
85 #define MAX_SCALE_SIZES_CNT 8
86 #define MAX_SAMP_DECISION_CNT     64
87 
88 #define MAX_ISP_DATA_SIZE 11500
89 #define MAX_PP_DATA_SIZE 2000
90 #define MAX_AE_STATS_DATA_SIZE  1000
91 #define MAX_AWB_STATS_DATA_SIZE 1000
92 #define MAX_AF_STATS_DATA_SIZE  1000
93 #define MAX_ASD_STATS_DATA_SIZE 1000
94 
95 
96 #define TUNING_DATA_VERSION        3
97 #define TUNING_SENSOR_DATA_MAX     0x10000 /*(need value from sensor team)*/
98 #define TUNING_VFE_DATA_MAX        0x10000 /*(need value from vfe team)*/
99 #define TUNING_CPP_DATA_MAX        0x10000 /*(need value from pproc team)*/
100 #define TUNING_CAC_DATA_MAX        0x10000 /*(need value from imglib team)*/
101 #define TUNING_DATA_MAX            (TUNING_SENSOR_DATA_MAX + \
102                                    TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX + \
103                                    TUNING_CAC_DATA_MAX)
104 
105 #define TUNING_SENSOR_DATA_OFFSET  0
106 #define TUNING_VFE_DATA_OFFSET     TUNING_SENSOR_DATA_MAX
107 #define TUNING_CPP_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + TUNING_VFE_DATA_MAX)
108 #define TUNING_CAC_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
109                                    TUNING_VFE_DATA_MAX + TUNING_CPP_DATA_MAX)
110 #define MAX_STATS_DATA_SIZE 4000
111 
112 #define MAX_AF_BRACKETING_VALUES 5
113 #define MAX_TEST_PATTERN_CNT     8
114 #define MAX_AVAILABLE_CAPABILITIES 6
115 
116 #define GPS_PROCESSING_METHOD_SIZE 33
117 #define GPS_PROCESSING_METHOD_SIZE_IN_WORD (33+3)/4
118 
119 #define MAX_INFLIGHT_REQUESTS  6
120 #define MIN_INFLIGHT_REQUESTS  3
121 
122 typedef enum {
123     CAM_HAL_V1 = 1,
124     CAM_HAL_V3 = 3
125 } cam_hal_version_t;
126 
127 typedef enum {
128     CAM_STATUS_SUCCESS,       /* Operation Succeded */
129     CAM_STATUS_FAILED,        /* Failure in doing operation */
130     CAM_STATUS_INVALID_PARM,  /* Inavlid parameter provided */
131     CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */
132     CAM_STATUS_ACCEPTED,      /* Parameter accepted */
133     CAM_STATUS_MAX,
134 } cam_status_t;
135 
136 typedef enum {
137     CAM_POSITION_BACK,
138     CAM_POSITION_FRONT
139 } cam_position_t;
140 
141 typedef enum {
142     CAM_FLICKER_NONE,
143     CAM_FLICKER_50_HZ,
144     CAM_FLICKER_60_HZ
145 } cam_flicker_t;
146 
147 typedef enum {
148     CAM_FORMAT_JPEG = 0,
149     CAM_FORMAT_YUV_420_NV12 = 1,
150     CAM_FORMAT_YUV_420_NV21,
151     CAM_FORMAT_YUV_420_NV21_ADRENO,
152     CAM_FORMAT_YUV_420_YV12,
153     CAM_FORMAT_YUV_422_NV16,
154     CAM_FORMAT_YUV_422_NV61,
155     CAM_FORMAT_YUV_420_NV12_VENUS,
156 
157     /* Please note below are the defintions for raw image.
158      * Any format other than raw image format should be declared
159      * before this line!!!!!!!!!!!!! */
160 
161     /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */
162 
163     /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV.
164      * U and V are interleaved with Y: YUYV or YVYV */
165     CAM_FORMAT_YUV_RAW_8BIT_YUYV,
166     CAM_FORMAT_YUV_RAW_8BIT_YVYU,
167     CAM_FORMAT_YUV_RAW_8BIT_UYVY,
168     CAM_FORMAT_YUV_RAW_8BIT_VYUY,
169 
170     /* QCOM RAW formats where data is packed into 64bit word.
171      * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is
172      *       stored at LSB.
173      * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most
174      *       significant 4 bits are set to 0. P0 is stored at LSB.
175      * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most
176      *       significant 4 bits are set to 0. P0 is stored at LSB. */
177     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG,
178     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG,
179     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB,
180     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR,
181     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG,
182     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG,
183     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB,
184     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR,
185     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG,
186     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG,
187     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB,
188     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR,
189     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
190      * 8BPP: Each pixel occupies one bytes, starting at LSB.
191      *       Output with of image has no restrictons.
192      * 10BPP: Four pixels are held in every 5 bytes. The output
193      *       with of image must be a multiple of 4 pixels.
194      * 12BPP: Two pixels are held in every 3 bytes. The output
195      *       width of image must be a multiple of 2 pixels. */
196     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG,
197     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG,
198     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB,
199     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR,
200     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG,
201     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG,
202     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB,
203     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR,
204     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG,
205     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG,
206     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB,
207     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR,
208     /* Ideal raw formats where image data has gone through black
209      * correction, lens rolloff, demux/channel gain, bad pixel
210      * correction, and ABF.
211      * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW
212      * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and
213      * plain 16 12bpp */
214     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG,
215     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG,
216     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB,
217     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR,
218     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG,
219     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG,
220     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB,
221     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR,
222     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG,
223     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG,
224     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB,
225     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR,
226     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG,
227     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG,
228     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB,
229     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR,
230     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG,
231     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG,
232     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB,
233     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR,
234     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG,
235     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG,
236     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB,
237     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR,
238     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG,
239     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG,
240     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB,
241     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR,
242     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG,
243     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG,
244     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB,
245     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR,
246     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG,
247     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG,
248     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB,
249     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR,
250     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG,
251     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG,
252     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB,
253     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR,
254 
255     /* generic 8-bit raw */
256     CAM_FORMAT_JPEG_RAW_8BIT,
257     CAM_FORMAT_META_RAW_8BIT,
258 
259     CAM_FORMAT_MAX
260 } cam_format_t;
261 
262 typedef enum {
263     /* applies to HAL 1 */
264     CAM_STREAM_TYPE_DEFAULT,       /* default stream type */
265     CAM_STREAM_TYPE_PREVIEW,       /* preview */
266     CAM_STREAM_TYPE_POSTVIEW,      /* postview */
267     CAM_STREAM_TYPE_SNAPSHOT,      /* snapshot */
268     CAM_STREAM_TYPE_VIDEO,         /* video */
269 
270     /* applies to HAL 3 */
271     CAM_STREAM_TYPE_CALLBACK,      /* app requested callback */
272     CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */
273 
274     /* applies to both HAL 1 and HAL 3 */
275     CAM_STREAM_TYPE_METADATA,      /* meta data */
276     CAM_STREAM_TYPE_RAW,           /* raw dump from camif */
277     CAM_STREAM_TYPE_OFFLINE_PROC,  /* offline process */
278     CAM_STREAM_TYPE_PARM,         /* mct internal stream */
279     CAM_STREAM_TYPE_MAX,
280 } cam_stream_type_t;
281 
282 typedef enum {
283     CAM_PAD_NONE = 1,
284     CAM_PAD_TO_2 = 2,
285     CAM_PAD_TO_4 = 4,
286     CAM_PAD_TO_WORD = CAM_PAD_TO_4,
287     CAM_PAD_TO_8 = 8,
288     CAM_PAD_TO_16 = 16,
289     CAM_PAD_TO_32 = 32,
290     CAM_PAD_TO_64 = 64,
291     CAM_PAD_TO_1K = 1024,
292     CAM_PAD_TO_2K = 2048,
293     CAM_PAD_TO_4K = 4096,
294     CAM_PAD_TO_8K = 8192
295 } cam_pad_format_t;
296 
297 typedef enum {
298     /* followings are per camera */
299     CAM_MAPPING_BUF_TYPE_CAPABILITY,  /* mapping camera capability buffer */
300     CAM_MAPPING_BUF_TYPE_PARM_BUF,    /* mapping parameters buffer */
301 
302     /* followings are per stream */
303     CAM_MAPPING_BUF_TYPE_STREAM_BUF,        /* mapping stream buffers */
304     CAM_MAPPING_BUF_TYPE_STREAM_INFO,       /* mapping stream information buffer */
305     CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */
306     CAM_MAPPING_BUF_TYPE_OFFLINE_META_BUF,  /* mapping offline meta buffer */
307     CAM_MAPPING_BUF_TYPE_MAX
308 } cam_mapping_buf_type;
309 
310 typedef struct {
311     cam_mapping_buf_type type;
312     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
313     uint32_t frame_idx;   /* frame index: valid if type is STREAM_BUF */
314     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
315                            * -1 means all planners shanre the same fd;
316                            * otherwise, each planner has its own fd */
317     unsigned long cookie; /* could be job_id(uint32_t) to identify mapping job */
318     int fd;               /* origin fd */
319     uint32_t size;        /* size of the buffer */
320 } cam_buf_map_type;
321 
322 typedef struct {
323     cam_mapping_buf_type type;
324     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
325     uint32_t frame_idx;   /* frame index: valid if STREAM_BUF or HIST_BUF */
326     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
327                            * -1 means all planners shanre the same fd;
328                            * otherwise, each planner has its own fd */
329     unsigned long cookie; /* could be job_id(uint32_t) to identify unmapping job */
330 } cam_buf_unmap_type;
331 
332 typedef enum {
333     CAM_MAPPING_TYPE_FD_MAPPING,
334     CAM_MAPPING_TYPE_FD_UNMAPPING,
335     CAM_MAPPING_TYPE_MAX
336 } cam_mapping_type;
337 
338 typedef struct {
339     cam_mapping_type msg_type;
340     union {
341         cam_buf_map_type buf_map;
342         cam_buf_unmap_type buf_unmap;
343     } payload;
344 } cam_sock_packet_t;
345 
346 typedef enum {
347     CAM_MODE_2D = (1<<0),
348     CAM_MODE_3D = (1<<1)
349 } cam_mode_t;
350 
351 typedef struct {
352     uint32_t len;
353     uint32_t y_offset;
354     uint32_t cbcr_offset;
355 } cam_sp_len_offset_t;
356 
357 typedef struct{
358     uint32_t len;
359     uint32_t offset;
360     int32_t offset_x;
361     int32_t offset_y;
362     int32_t stride;
363     int32_t scanline;
364     int32_t width;    /* width without padding */
365     int32_t height;   /* height without padding */
366 } cam_mp_len_offset_t;
367 
368 typedef struct {
369     uint32_t width_padding;
370     uint32_t height_padding;
371     uint32_t plane_padding;
372 } cam_padding_info_t;
373 
374 typedef struct {
375     int num_planes;
376     union {
377         cam_sp_len_offset_t sp;
378         cam_mp_len_offset_t mp[VIDEO_MAX_PLANES];
379     };
380     uint32_t frame_len;
381 } cam_frame_len_offset_t;
382 
383 typedef struct {
384     int32_t width;
385     int32_t height;
386 } cam_dimension_t;
387 
388 typedef struct {
389     cam_frame_len_offset_t plane_info;
390 } cam_stream_buf_plane_info_t;
391 
392 typedef struct {
393     float min_fps;
394     float max_fps;
395     float video_min_fps;
396     float video_max_fps;
397 } cam_fps_range_t;
398 
399 typedef struct {
400     int32_t min_sensitivity;
401     int32_t max_sensitivity;
402 } cam_sensitivity_range_t;
403 
404 typedef enum {
405     CAM_HFR_MODE_OFF,
406     CAM_HFR_MODE_60FPS,
407     CAM_HFR_MODE_90FPS,
408     CAM_HFR_MODE_120FPS,
409     CAM_HFR_MODE_150FPS,
410     CAM_HFR_MODE_MAX
411 } cam_hfr_mode_t;
412 
413 typedef struct {
414     cam_hfr_mode_t mode;
415     cam_dimension_t dim;
416     uint8_t frame_skip;
417     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table size */
418     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
419 } cam_hfr_info_t;
420 
421 typedef enum {
422     CAM_WB_MODE_AUTO,
423     CAM_WB_MODE_CUSTOM,
424     CAM_WB_MODE_INCANDESCENT,
425     CAM_WB_MODE_FLUORESCENT,
426     CAM_WB_MODE_WARM_FLUORESCENT,
427     CAM_WB_MODE_DAYLIGHT,
428     CAM_WB_MODE_CLOUDY_DAYLIGHT,
429     CAM_WB_MODE_TWILIGHT,
430     CAM_WB_MODE_SHADE,
431     CAM_WB_MODE_OFF,
432     CAM_WB_MODE_MAX
433 } cam_wb_mode_type;
434 
435 typedef enum {
436     CAM_ANTIBANDING_MODE_OFF,
437     CAM_ANTIBANDING_MODE_60HZ,
438     CAM_ANTIBANDING_MODE_50HZ,
439     CAM_ANTIBANDING_MODE_AUTO,
440     CAM_ANTIBANDING_MODE_AUTO_50HZ,
441     CAM_ANTIBANDING_MODE_AUTO_60HZ,
442     CAM_ANTIBANDING_MODE_MAX,
443 } cam_antibanding_mode_type;
444 
445 /* Enum Type for different ISO Mode supported */
446 typedef enum {
447     CAM_ISO_MODE_AUTO,
448     CAM_ISO_MODE_DEBLUR,
449     CAM_ISO_MODE_100,
450     CAM_ISO_MODE_200,
451     CAM_ISO_MODE_400,
452     CAM_ISO_MODE_800,
453     CAM_ISO_MODE_1600,
454     CAM_ISO_MODE_MAX
455 } cam_iso_mode_type;
456 
457 typedef enum {
458     CAM_AEC_MODE_FRAME_AVERAGE,
459     CAM_AEC_MODE_CENTER_WEIGHTED,
460     CAM_AEC_MODE_SPOT_METERING,
461     CAM_AEC_MODE_SMART_METERING,
462     CAM_AEC_MODE_USER_METERING,
463     CAM_AEC_MODE_SPOT_METERING_ADV,
464     CAM_AEC_MODE_CENTER_WEIGHTED_ADV,
465     CAM_AEC_MODE_MAX
466 } cam_auto_exposure_mode_type;
467 
468 typedef enum {
469     CAM_AE_MODE_OFF,
470     CAM_AE_MODE_ON,
471     CAM_AE_MODE_MAX
472 } cam_ae_mode_type;
473 
474 typedef enum {
475     CAM_FOCUS_ALGO_AUTO,
476     CAM_FOCUS_ALGO_SPOT,
477     CAM_FOCUS_ALGO_CENTER_WEIGHTED,
478     CAM_FOCUS_ALGO_AVERAGE,
479     CAM_FOCUS_ALGO_MAX
480 } cam_focus_algorithm_type;
481 
482 /* Auto focus mode */
483 typedef enum {
484     CAM_FOCUS_MODE_OFF,
485     CAM_FOCUS_MODE_AUTO,
486     CAM_FOCUS_MODE_INFINITY,
487     CAM_FOCUS_MODE_MACRO,
488     CAM_FOCUS_MODE_FIXED,
489     CAM_FOCUS_MODE_EDOF,
490     CAM_FOCUS_MODE_CONTINOUS_VIDEO,
491     CAM_FOCUS_MODE_CONTINOUS_PICTURE,
492     CAM_FOCUS_MODE_MAX
493 } cam_focus_mode_type;
494 
495 typedef enum {
496     CAM_SCENE_MODE_OFF,
497     CAM_SCENE_MODE_AUTO,
498     CAM_SCENE_MODE_LANDSCAPE,
499     CAM_SCENE_MODE_SNOW,
500     CAM_SCENE_MODE_BEACH,
501     CAM_SCENE_MODE_SUNSET,
502     CAM_SCENE_MODE_NIGHT,
503     CAM_SCENE_MODE_PORTRAIT,
504     CAM_SCENE_MODE_BACKLIGHT,
505     CAM_SCENE_MODE_SPORTS,
506     CAM_SCENE_MODE_ANTISHAKE,
507     CAM_SCENE_MODE_FLOWERS,
508     CAM_SCENE_MODE_CANDLELIGHT,
509     CAM_SCENE_MODE_FIREWORKS,
510     CAM_SCENE_MODE_PARTY,
511     CAM_SCENE_MODE_NIGHT_PORTRAIT,
512     CAM_SCENE_MODE_THEATRE,
513     CAM_SCENE_MODE_ACTION,
514     CAM_SCENE_MODE_AR,
515     CAM_SCENE_MODE_FACE_PRIORITY,
516     CAM_SCENE_MODE_BARCODE,
517     CAM_SCENE_MODE_HDR,
518     CAM_SCENE_MODE_MAX
519 } cam_scene_mode_type;
520 
521 typedef enum {
522     CAM_EFFECT_MODE_OFF,
523     CAM_EFFECT_MODE_MONO,
524     CAM_EFFECT_MODE_NEGATIVE,
525     CAM_EFFECT_MODE_SOLARIZE,
526     CAM_EFFECT_MODE_SEPIA,
527     CAM_EFFECT_MODE_POSTERIZE,
528     CAM_EFFECT_MODE_WHITEBOARD,
529     CAM_EFFECT_MODE_BLACKBOARD,
530     CAM_EFFECT_MODE_AQUA,
531     CAM_EFFECT_MODE_EMBOSS,
532     CAM_EFFECT_MODE_SKETCH,
533     CAM_EFFECT_MODE_NEON,
534     CAM_EFFECT_MODE_MAX
535 } cam_effect_mode_type;
536 
537 typedef enum {
538     CAM_FLASH_MODE_OFF,
539     CAM_FLASH_MODE_AUTO,
540     CAM_FLASH_MODE_ON,
541     CAM_FLASH_MODE_TORCH,
542     CAM_FLASH_MODE_SINGLE,
543     CAM_FLASH_MODE_MAX
544 } cam_flash_mode_t;
545 
546 // Flash States
547 typedef enum {
548     CAM_FLASH_STATE_UNAVAILABLE,
549     CAM_FLASH_STATE_CHARGING,
550     CAM_FLASH_STATE_READY,
551     CAM_FLASH_STATE_FIRED,
552     CAM_FLASH_STATE_PARTIAL,
553     CAM_FLASH_STATE_MAX
554 } cam_flash_state_t;
555 
556 typedef enum {
557     CAM_FLASH_FIRING_LEVEL_0,
558     CAM_FLASH_FIRING_LEVEL_1,
559     CAM_FLASH_FIRING_LEVEL_2,
560     CAM_FLASH_FIRING_LEVEL_3,
561     CAM_FLASH_FIRING_LEVEL_4,
562     CAM_FLASH_FIRING_LEVEL_5,
563     CAM_FLASH_FIRING_LEVEL_6,
564     CAM_FLASH_FIRING_LEVEL_7,
565     CAM_FLASH_FIRING_LEVEL_8,
566     CAM_FLASH_FIRING_LEVEL_9,
567     CAM_FLASH_FIRING_LEVEL_10,
568     CAM_FLASH_FIRING_LEVEL_MAX
569 } cam_flash_firing_level_t;
570 
571 
572 typedef enum {
573     CAM_AEC_TRIGGER_IDLE,
574     CAM_AEC_TRIGGER_START
575 } cam_aec_trigger_type_t;
576 
577 typedef enum {
578     CAM_AF_TRIGGER_IDLE,
579     CAM_AF_TRIGGER_START,
580     CAM_AF_TRIGGER_CANCEL
581 } cam_af_trigger_type_t;
582 
583 typedef enum {
584     CAM_AE_STATE_INACTIVE,
585     CAM_AE_STATE_SEARCHING,
586     CAM_AE_STATE_CONVERGED,
587     CAM_AE_STATE_LOCKED,
588     CAM_AE_STATE_FLASH_REQUIRED,
589     CAM_AE_STATE_PRECAPTURE
590 } cam_ae_state_t;
591 
592 typedef enum {
593     CAM_NOISE_REDUCTION_MODE_OFF,
594     CAM_NOISE_REDUCTION_MODE_FAST,
595     CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY
596 } cam_noise_reduction_mode_t;
597 
598 typedef enum {
599     CAM_EDGE_MODE_OFF,
600     CAM_EDGE_MODE_FAST,
601     CAM_EDGE_MODE_HIGH_QUALITY,
602 } cam_edge_mode_t;
603 
604 typedef struct {
605    uint8_t edge_mode;
606    int32_t sharpness;
607 } cam_edge_application_t;
608 
609 typedef enum {
610     CAM_BLACK_LEVEL_LOCK_OFF,
611     CAM_BLACK_LEVEL_LOCK_ON,
612 } cam_black_level_lock_t;
613 
614 typedef enum {
615     CAM_LENS_SHADING_MAP_MODE_OFF,
616     CAM_LENS_SHADING_MAP_MODE_ON,
617 } cam_lens_shading_map_mode_t;
618 
619 typedef enum {
620     CAM_LENS_SHADING_MODE_OFF,
621     CAM_LENS_SHADING_MODE_FAST,
622     CAM_LENS_SHADING_MODE_HIGH_QUALITY,
623 } cam_lens_shading_mode_t;
624 
625 typedef enum {
626     CAM_FACE_DETECT_MODE_OFF,
627     CAM_FACE_DETECT_MODE_SIMPLE,
628     CAM_FACE_DETECT_MODE_FULL,
629 } cam_face_detect_mode_t;
630 
631 typedef enum {
632     CAM_TONEMAP_MODE_CONTRAST_CURVE,
633     CAM_TONEMAP_MODE_FAST,
634     CAM_TONEMAP_MODE_HIGH_QUALITY,
635 } cam_tonemap_mode_t;
636 
637 typedef enum {
638   CAM_CDS_MODE_OFF,
639   CAM_CDS_MODE_ON,
640   CAM_CDS_MODE_AUTO,
641   CAM_CDS_MODE_MAX
642 } cam_cds_mode_type_t;
643 
644 typedef struct  {
645     int32_t left;
646     int32_t top;
647     int32_t width;
648     int32_t height;
649 } cam_rect_t;
650 
651 typedef struct  {
652     cam_rect_t rect;
653     int32_t weight; /* weight of the area, valid for focusing/metering areas */
654 } cam_area_t;
655 
656 typedef enum {
657     CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */
658     CAM_STREAMING_MODE_BURST,      /* burst streaming */
659     CAM_STREAMING_MODE_MAX
660 } cam_streaming_mode_t;
661 
662 typedef enum {
663     IS_TYPE_NONE,
664     IS_TYPE_DIS,
665     IS_TYPE_GA_DIS,
666     IS_TYPE_EIS_1_0,
667     IS_TYPE_EIS_2_0
668 } cam_is_type_t;
669 
670 typedef enum {
671    DIS_DISABLE,
672    DIS_ENABLE
673 } cam_dis_mode_t;
674 
675 typedef enum {
676   NON_SECURE,
677   SECURE
678 } cam_stream_secure_t;
679 
680 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0)
681 
682 /* event from server */
683 typedef enum {
684     CAM_EVENT_TYPE_MAP_UNMAP_DONE  = (1<<0),
685     CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1),
686     CAM_EVENT_TYPE_ZOOM_DONE       = (1<<2),
687     CAM_EVENT_TYPE_DAEMON_DIED     = (1<<3),
688     CAM_EVENT_TYPE_DAEMON_PULL_REQ = (1<<4),
689     CAM_EVENT_TYPE_MAX
690 } cam_event_type_t;
691 
692 typedef enum {
693     CAM_EXP_BRACKETING_OFF,
694     CAM_EXP_BRACKETING_ON
695 } cam_bracket_mode;
696 
697 typedef struct {
698     cam_bracket_mode mode;
699     char values[MAX_EXP_BRACKETING_LENGTH];  /* user defined values */
700 } cam_exp_bracketing_t;
701 
702 typedef struct {
703   unsigned int num_frames;
704   cam_exp_bracketing_t exp_val;
705 } cam_hdr_bracketing_info_t;
706 
707 typedef struct {
708     uint8_t chromatixData[CHROMATIX_SIZE];
709     uint8_t snapchromatixData[CHROMATIX_SIZE];
710     uint8_t common_chromatixData[COMMONCHROMATIX_SIZE];
711     uint8_t cpp_chromatixData[CPPCHROMATIX_SIZE];
712 } tune_chromatix_t;
713 
714 typedef struct {
715     uint8_t af_tuneData[AFTUNE_SIZE];
716 } tune_autofocus_t;
717 
718 typedef struct {
719     uint8_t stepsize;
720     uint8_t direction;
721     int32_t num_steps;
722     uint8_t ttype;
723 } tune_actuator_t;
724 
725 typedef struct {
726     uint8_t module;
727     uint8_t type;
728     int32_t value;
729 } tune_cmd_t;
730 
731 typedef enum {
732     CAM_AEC_ROI_OFF,
733     CAM_AEC_ROI_ON
734 } cam_aec_roi_ctrl_t;
735 
736 typedef enum {
737     CAM_AEC_ROI_BY_INDEX,
738     CAM_AEC_ROI_BY_COORDINATE,
739 } cam_aec_roi_type_t;
740 
741 typedef struct {
742     uint32_t x;
743     uint32_t y;
744 } cam_coordinate_type_t;
745 
746 typedef struct {
747     int32_t numerator;
748     int32_t denominator;
749 } cam_rational_type_t;
750 
751 typedef struct {
752     cam_aec_roi_ctrl_t aec_roi_enable;
753     cam_aec_roi_type_t aec_roi_type;
754     union {
755         cam_coordinate_type_t coordinate[MAX_ROI];
756         uint32_t aec_roi_idx[MAX_ROI];
757     } cam_aec_roi_position;
758 } cam_set_aec_roi_t;
759 
760 typedef struct {
761     uint32_t frm_id;
762     uint8_t num_roi;
763     cam_rect_t roi[MAX_ROI];
764     int32_t weight[MAX_ROI];
765     uint8_t is_multiwindow;
766 } cam_roi_info_t;
767 
768 typedef enum {
769     CAM_WAVELET_DENOISE_YCBCR_PLANE,
770     CAM_WAVELET_DENOISE_CBCR_ONLY,
771     CAM_WAVELET_DENOISE_STREAMLINE_YCBCR,
772     CAM_WAVELET_DENOISE_STREAMLINED_CBCR
773 } cam_denoise_process_type_t;
774 
775 typedef struct {
776     int denoise_enable;
777     cam_denoise_process_type_t process_plates;
778 } cam_denoise_param_t;
779 
780 #define CAM_FACE_PROCESS_MASK_DETECTION    (1<<0)
781 #define CAM_FACE_PROCESS_MASK_RECOGNITION  (1<<1)
782 typedef struct {
783     int fd_mode;               /* mask of face process */
784     int num_fd;
785 } cam_fd_set_parm_t;
786 
787 typedef enum {
788     QCAMERA_FD_PREVIEW,
789     QCAMERA_FD_SNAPSHOT
790 }qcamera_face_detect_type_t;
791 
792 typedef struct {
793     int32_t face_id;            /* unique id for face tracking within view unless view changes */
794     int8_t score;              /* score of confidence (0, -100) */
795     cam_rect_t face_boundary;  /* boundary of face detected */
796     cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
797     cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
798     cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
799     uint8_t smile_degree;      /* smile degree (0, -100) */
800     uint8_t smile_confidence;  /* smile confidence (0, 100) */
801     uint8_t face_recognised;   /* if face is recognised */
802     int8_t gaze_angle;         /* -90 -45 0 45 90 for head left to rigth tilt */
803     int8_t updown_dir;         /* up down direction (-90, 90) */
804     int8_t leftright_dir;      /* left right direction (-90, 90) */
805     int8_t roll_dir;           /* roll direction (-90, 90) */
806     int8_t left_right_gaze;    /* left right gaze degree (-50, 50) */
807     int8_t top_bottom_gaze;    /* up down gaze degree (-50, 50) */
808     uint8_t blink_detected;    /* if blink is detected */
809     uint8_t left_blink;        /* left eye blink degeree (0, -100) */
810     uint8_t right_blink;       /* right eye blink degree (0, - 100) */
811 } cam_face_detection_info_t;
812 
813 typedef struct {
814     uint32_t frame_id;                         /* frame index of which faces are detected */
815     uint8_t num_faces_detected;                /* number of faces detected */
816     cam_face_detection_info_t faces[MAX_ROI];  /* detailed information of faces detected */
817     qcamera_face_detect_type_t fd_type;        /* face detect for preview or snapshot frame*/
818 } cam_face_detection_data_t;
819 
820 #define CAM_HISTOGRAM_STATS_SIZE 256
821 typedef struct {
822     uint32_t max_hist_value;
823     uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */
824 } cam_histogram_data_t;
825 
826 typedef struct {
827     cam_histogram_data_t r_stats;
828     cam_histogram_data_t b_stats;
829     cam_histogram_data_t gr_stats;
830     cam_histogram_data_t gb_stats;
831 } cam_bayer_hist_stats_t;
832 
833 typedef enum {
834     CAM_HISTOGRAM_TYPE_BAYER,
835     CAM_HISTOGRAM_TYPE_YUV
836 } cam_histogram_type_t;
837 
838 typedef struct {
839     cam_histogram_type_t type;
840     union {
841         cam_bayer_hist_stats_t bayer_stats;
842         cam_histogram_data_t yuv_stats;
843     };
844 } cam_hist_stats_t;
845 
846 enum cam_focus_distance_index{
847   CAM_FOCUS_DISTANCE_NEAR_INDEX,  /* 0 */
848   CAM_FOCUS_DISTANCE_OPTIMAL_INDEX,
849   CAM_FOCUS_DISTANCE_FAR_INDEX,
850   CAM_FOCUS_DISTANCE_MAX_INDEX
851 };
852 
853 typedef struct {
854   float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX];
855 } cam_focus_distances_info_t;
856 
857 /* Different autofocus cycle when calling do_autoFocus
858  * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep
859  * if one is ongoing, and lock.
860  * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless
861  * of the current state, and lock.
862  * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep.
863  * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED,
864  * or CAM_AF_NOT_FOCUSED.
865  * cancel_autoFocus stops any lens movement.
866  * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED
867  * event, not both.
868  */
869 typedef enum {
870     CAM_AF_COMPLETE_EXISTING_SWEEP,
871     CAM_AF_DO_ONE_FULL_SWEEP,
872     CAM_AF_START_CONTINUOUS_SWEEP
873 } cam_autofocus_cycle_t;
874 
875 typedef enum {
876     CAM_AF_SCANNING,
877     CAM_AF_FOCUSED,
878     CAM_AF_NOT_FOCUSED,
879     CAM_AF_CANCELLED
880 } cam_autofocus_state_t;
881 
882 typedef struct {
883     cam_autofocus_state_t focus_state;           /* state of focus */
884     cam_focus_distances_info_t focus_dist;       /* focus distance */
885 } cam_auto_focus_data_t;
886 
887 typedef struct {
888   uint32_t is_hdr_scene;
889   float    hdr_confidence;
890 } cam_asd_hdr_scene_data_t;
891 
892 typedef struct {
893     uint32_t stream_id;
894     cam_rect_t crop;
895 } cam_stream_crop_info_t;
896 
897 typedef struct {
898     uint8_t num_of_streams;
899     cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS];
900 } cam_crop_data_t;
901 
902 typedef enum {
903     DO_NOT_NEED_FUTURE_FRAME,
904     NEED_FUTURE_FRAME,
905 } cam_prep_snapshot_state_t;
906 
907 typedef struct {
908     float gains[4];
909 } cam_color_correct_gains_t;
910 
911 typedef struct {
912     // If LED is ON and Burst Num > 1, this is first LED ON frame
913     uint32_t min_frame_idx;
914     // If LED is ON and Burst Num > 1, this is first LED Off frame after ON
915     uint32_t max_frame_idx;
916     // Used only when LED Is ON and burst num > 1
917     uint32_t num_led_on_frames;
918     // Skip count after LED is turned OFF
919     uint32_t frame_skip_count;
920 } cam_frame_idx_range_t;
921 
922 typedef enum {
923   S_NORMAL = 0,
924   S_SCENERY,
925   S_PORTRAIT,
926   S_PORTRAIT_BACKLIGHT,
927   S_SCENERY_BACKLIGHT,
928   S_BACKLIGHT,
929   S_MAX,
930 } cam_auto_scene_t;
931 
932 typedef struct {
933    uint32_t meta_frame_id;
934 } cam_meta_valid_t;
935 
936 typedef struct {
937     cam_flash_mode_t flash_mode;
938     float            aperture_value;
939     cam_flash_state_t        flash_state;
940     float            focal_length;
941     float            f_number;
942     int              sensing_method;
943     float            crop_factor;
944 } cam_sensor_params_t;
945 
946 typedef struct {
947     float exp_time;
948     int iso_value;
949     uint32_t flash_needed;
950     int settled;
951     cam_wb_mode_type wb_mode;
952     uint32_t metering_mode;
953     uint32_t exposure_program;
954     uint32_t exposure_mode;
955     uint32_t scenetype;
956     float brightness;
957 } cam_3a_params_t;
958 
959 
960 
961 typedef struct {
962     uint32_t tuning_data_version;
963     uint32_t tuning_sensor_data_size;
964     uint32_t tuning_vfe_data_size;
965     uint32_t tuning_cpp_data_size;
966     uint32_t tuning_cac_data_size;
967     uint32_t tuning_mod3_data_size;
968     uint8_t  data[TUNING_DATA_MAX];
969 }tuning_params_t;
970 
971 typedef struct {
972   uint8_t private_isp_data[MAX_ISP_DATA_SIZE];
973 } cam_chromatix_lite_isp_t;
974 
975 typedef struct {
976   uint8_t private_pp_data[MAX_PP_DATA_SIZE];
977 } cam_chromatix_lite_pp_t;
978 
979 typedef struct {
980   uint8_t private_stats_data[MAX_AE_STATS_DATA_SIZE];
981 } cam_chromatix_lite_ae_stats_t;
982 
983 typedef struct {
984   uint8_t private_stats_data[MAX_AWB_STATS_DATA_SIZE];
985 } cam_chromatix_lite_awb_stats_t;
986 
987 typedef struct {
988   uint8_t private_stats_data[MAX_AF_STATS_DATA_SIZE];
989 } cam_chromatix_lite_af_stats_t;
990 
991 typedef struct {
992   uint8_t private_stats_data[MAX_ASD_STATS_DATA_SIZE];
993 } cam_chromatix_lite_asd_stats_t;
994 
995 typedef struct {
996     cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
997     uint32_t num_streams;
998     cam_stream_type_t type[MAX_NUM_STREAMS];
999     uint32_t postprocess_mask[MAX_NUM_STREAMS];
1000 } cam_stream_size_info_t;
1001 
1002 typedef struct {
1003     uint32_t num_streams;
1004     uint32_t streamID[MAX_NUM_STREAMS];
1005 } cam_stream_ID_t;
1006 
1007 typedef  struct {
1008     uint8_t is_stats_valid;               /* if histgram data is valid */
1009     cam_hist_stats_t stats_data;          /* histogram data */
1010 
1011     uint8_t is_faces_valid;               /* if face detection data is valid */
1012     cam_face_detection_data_t faces_data; /* face detection result */
1013 
1014     uint8_t is_focus_valid;               /* if focus data is valid */
1015     cam_auto_focus_data_t focus_data;     /* focus data */
1016 
1017     uint8_t is_crop_valid;                /* if crop data is valid */
1018     cam_crop_data_t crop_data;            /* crop data */
1019 
1020     uint8_t is_prep_snapshot_done_valid;  /* if prep snapshot done is valid */
1021     cam_prep_snapshot_state_t prep_snapshot_done_state;  /* prepare snapshot done state */
1022 
1023     /* if good frame idx range is valid */
1024     uint8_t is_good_frame_idx_range_valid;
1025     /* good frame idx range, make sure:
1026      * 1. good_frame_idx_range.min_frame_idx > current_frame_idx
1027      * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */
1028     cam_frame_idx_range_t good_frame_idx_range;
1029 
1030     uint32_t is_hdr_scene_data_valid;
1031     cam_asd_hdr_scene_data_t hdr_scene_data;
1032     uint8_t is_asd_decision_valid;
1033     cam_auto_scene_t scene; //scene type as decided by ASD
1034 
1035     char private_metadata[MAX_METADATA_PRIVATE_PAYLOAD_SIZE];
1036 
1037     /* AE parameters */
1038     uint8_t is_3a_params_valid;
1039     cam_3a_params_t cam_3a_params;
1040 
1041     /* sensor parameters */
1042     uint8_t is_sensor_params_valid;
1043     cam_sensor_params_t sensor_params;
1044 
1045     /* Meta valid params */
1046     uint8_t is_meta_valid;
1047     cam_meta_valid_t meta_valid_params;
1048 
1049     /*Tuning Data*/
1050     uint8_t is_tuning_params_valid;
1051     tuning_params_t tuning_params;
1052 
1053     uint8_t is_chromatix_lite_isp_valid;
1054     cam_chromatix_lite_isp_t chromatix_lite_isp_data;
1055 
1056     uint8_t is_chromatix_lite_pp_valid;
1057     cam_chromatix_lite_pp_t chromatix_lite_pp_data;
1058 
1059     uint8_t is_chromatix_lite_ae_stats_valid;
1060     cam_chromatix_lite_ae_stats_t chromatix_lite_ae_stats_data;
1061 
1062     uint8_t is_chromatix_lite_awb_stats_valid;
1063     cam_chromatix_lite_awb_stats_t chromatix_lite_awb_stats_data;
1064 
1065     uint8_t is_chromatix_lite_af_stats_valid;
1066     cam_chromatix_lite_af_stats_t chromatix_lite_af_stats_data;
1067 } cam_metadata_info_t;
1068 
1069 typedef enum {
1070     CAM_INTF_PARM_HAL_VERSION,
1071 
1072     /* Overall mode of 3A control routines. We need to have this parameter
1073      * because not all android.control.* have an OFF option, for example,
1074      * AE_FPS_Range, aePrecaptureTrigger */
1075     CAM_INTF_META_MODE,
1076     /* Whether AE is currently updating the sensor exposure and sensitivity
1077      * fields */
1078     CAM_INTF_META_AEC_MODE,
1079     CAM_INTF_PARM_WHITE_BALANCE,
1080     CAM_INTF_PARM_FOCUS_MODE,
1081 
1082     /* common between HAL1 and HAL3 */
1083     CAM_INTF_PARM_ANTIBANDING,
1084     CAM_INTF_PARM_EXPOSURE_COMPENSATION,
1085     CAM_INTF_PARM_EV_STEP,
1086     CAM_INTF_PARM_AEC_LOCK,
1087     CAM_INTF_PARM_FPS_RANGE,
1088     CAM_INTF_PARM_AWB_LOCK, /* 10 */
1089     CAM_INTF_PARM_EFFECT,
1090     CAM_INTF_PARM_BESTSHOT_MODE,
1091     CAM_INTF_PARM_DIS_ENABLE,
1092     CAM_INTF_PARM_LED_MODE,
1093     CAM_INTF_META_HISTOGRAM,
1094     CAM_INTF_META_FACE_DETECTION,
1095 
1096     /* specific to HAl1 */
1097     CAM_INTF_META_AUTOFOCUS_DATA,
1098     CAM_INTF_PARM_QUERY_FLASH4SNAP,
1099     CAM_INTF_PARM_EXPOSURE,
1100     CAM_INTF_PARM_SHARPNESS, /* 20 */
1101     CAM_INTF_PARM_CONTRAST,
1102     CAM_INTF_PARM_SATURATION,
1103     CAM_INTF_PARM_BRIGHTNESS,
1104     CAM_INTF_PARM_ISO,
1105     CAM_INTF_PARM_ZOOM,
1106     CAM_INTF_PARM_ROLLOFF,
1107     CAM_INTF_PARM_MODE,             /* camera mode */
1108     CAM_INTF_PARM_AEC_ALGO_TYPE,    /* auto exposure algorithm */
1109     CAM_INTF_PARM_FOCUS_ALGO_TYPE,  /* focus algorithm */
1110     CAM_INTF_PARM_AEC_ROI, /* 30 */
1111     CAM_INTF_PARM_AF_ROI,
1112     CAM_INTF_PARM_SCE_FACTOR,
1113     CAM_INTF_PARM_FD,
1114     CAM_INTF_PARM_MCE,
1115     CAM_INTF_PARM_HFR,
1116     CAM_INTF_PARM_REDEYE_REDUCTION,
1117     CAM_INTF_PARM_WAVELET_DENOISE,
1118     CAM_INTF_PARM_TEMPORAL_DENOISE,
1119     CAM_INTF_PARM_HISTOGRAM,
1120     CAM_INTF_PARM_ASD_ENABLE, /* 40 */
1121     CAM_INTF_PARM_RECORDING_HINT,
1122     CAM_INTF_PARM_HDR,
1123     CAM_INTF_PARM_MAX_DIMENSION,
1124     CAM_INTF_PARM_RAW_DIMENSION,
1125     CAM_INTF_PARM_FRAMESKIP,
1126     CAM_INTF_PARM_ZSL_MODE,  /* indicating if it's running in ZSL mode */
1127     CAM_INTF_PARM_BURST_NUM,
1128     CAM_INTF_PARM_RETRO_BURST_NUM,
1129     CAM_INTF_PARM_BURST_LED_ON_PERIOD,
1130     CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */ /* 50 */
1131     CAM_INTF_PARM_LOCK_CAF,
1132     CAM_INTF_PARM_VIDEO_HDR,
1133     CAM_INTF_PARM_SENSOR_HDR,
1134     CAM_INTF_PARM_ROTATION,
1135     CAM_INTF_PARM_SCALE,
1136     CAM_INTF_PARM_VT, /* indicating if it's a Video Call Apllication */
1137     CAM_INTF_META_CROP_DATA,
1138     CAM_INTF_META_PREP_SNAPSHOT_DONE,
1139     CAM_INTF_META_GOOD_FRAME_IDX_RANGE,
1140     CAM_INTF_META_ASD_HDR_SCENE_DATA, /* 60 */
1141     CAM_INTF_META_ASD_SCENE_TYPE,
1142     CAM_INTF_META_CURRENT_SCENE,
1143     CAM_INTF_META_AEC_INFO,
1144     CAM_INTF_META_SENSOR_INFO,
1145     CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,
1146     CAM_INTF_META_CHROMATIX_LITE_ISP,
1147     CAM_INTF_META_CHROMATIX_LITE_PP,
1148     CAM_INTF_META_CHROMATIX_LITE_AE,
1149     CAM_INTF_META_CHROMATIX_LITE_AWB,
1150     CAM_INTF_META_CHROMATIX_LITE_AF, /* 70 */
1151     CAM_INTF_META_CHROMATIX_LITE_ASD,
1152     CAM_INTF_PARM_GET_CHROMATIX,
1153     CAM_INTF_PARM_SET_RELOAD_CHROMATIX,
1154     CAM_INTF_PARM_SET_AUTOFOCUSTUNING,
1155     CAM_INTF_PARM_GET_AFTUNE,
1156     CAM_INTF_PARM_SET_RELOAD_AFTUNE,
1157     CAM_INTF_PARM_SET_VFE_COMMAND,
1158     CAM_INTF_PARM_SET_PP_COMMAND,
1159     CAM_INTF_PARM_TINTLESS,
1160     CAM_INTF_PARM_LONGSHOT_ENABLE, /* 80 */
1161     CAM_INTF_PARM_RDI_MODE,
1162     CAM_INTF_PARM_CDS_MODE,
1163 
1164     /* stream based parameters */
1165     CAM_INTF_PARM_DO_REPROCESS,
1166     CAM_INTF_PARM_SET_BUNDLE,
1167     CAM_INTF_PARM_STREAM_FLIP,
1168     CAM_INTF_PARM_GET_OUTPUT_CROP,
1169 
1170     CAM_INTF_PARM_EZTUNE_CMD,
1171 
1172     /* specific to HAL3 */
1173     /* Whether the metadata maps to a valid frame number */
1174     CAM_INTF_META_FRAME_NUMBER_VALID,
1175     /* Whether the urgent metadata maps to a valid frame number */
1176     CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,
1177     /* Whether the stream buffer corresponding this frame is dropped or not */
1178     CAM_INTF_META_FRAME_DROPPED, /* 90 */
1179     /* COLOR CORRECTION.*/
1180     CAM_INTF_META_COLOR_CORRECT_MODE,
1181     /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931)
1182      * color space from the scene illuminant to the sRGB-standard D65-illuminant. */
1183     CAM_INTF_META_COLOR_CORRECT_TRANSFORM,
1184     /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/
1185     CAM_INTF_META_COLOR_CORRECT_GAINS,
1186     /*The best fit color transform matrix calculated by the stats*/
1187     CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM,
1188     /*The best fit color channels gains calculated by the stats*/
1189     CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,
1190     /* CONTROL */
1191     /* A frame counter set by the framework. Must be maintained unchanged in
1192      * output frame. */
1193     CAM_INTF_META_FRAME_NUMBER,
1194     /* A frame counter set by the framework. Must be maintained unchanged in
1195      * output frame. */
1196     CAM_INTF_META_URGENT_FRAME_NUMBER,
1197     /*Number of streams and size of streams in current configuration*/
1198     CAM_INTF_META_STREAM_INFO,
1199     /* List of areas to use for metering */
1200     CAM_INTF_META_AEC_ROI,
1201     /* Whether the HAL must trigger precapture metering.*/
1202     CAM_INTF_META_AEC_PRECAPTURE_TRIGGER, /* 100 */
1203     /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */
1204     /* Current state of AE algorithm */
1205     CAM_INTF_META_AEC_STATE,
1206     /* List of areas to use for focus estimation */
1207     CAM_INTF_META_AF_ROI,
1208     /* Whether the HAL must trigger autofocus. */
1209     CAM_INTF_META_AF_TRIGGER,
1210     /* Current state of AF algorithm */
1211     CAM_INTF_META_AF_STATE,
1212     /* List of areas to use for illuminant estimation */
1213     CAM_INTF_META_AWB_REGIONS,
1214     /* Current state of AWB algorithm */
1215     CAM_INTF_META_AWB_STATE,
1216     /*Whether black level compensation is frozen or free to vary*/
1217     CAM_INTF_META_BLACK_LEVEL_LOCK,
1218     /* Information to 3A routines about the purpose of this capture, to help
1219      * decide optimal 3A strategy */
1220     CAM_INTF_META_CAPTURE_INTENT,
1221     /* DEMOSAIC */
1222     /* Controls the quality of the demosaicing processing */
1223     CAM_INTF_META_DEMOSAIC,
1224     /* EDGE */
1225     /* Operation mode for edge enhancement */
1226     CAM_INTF_META_EDGE_MODE, /* 110 */
1227     /* Control the amount of edge enhancement applied to the images.*/
1228     /* 1-10; 10 is maximum sharpening */
1229     CAM_INTF_META_SHARPNESS_STRENGTH,
1230     /* FLASH */
1231     /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */
1232     CAM_INTF_META_FLASH_POWER,
1233     /* Firing time of flash relative to start of exposure, in nanoseconds*/
1234     CAM_INTF_META_FLASH_FIRING_TIME,
1235     /* Current state of the flash unit */
1236     CAM_INTF_META_FLASH_STATE,
1237     /* GEOMETRIC */
1238     /* Operating mode of geometric correction */
1239     CAM_INTF_META_GEOMETRIC_MODE,
1240     /* Control the amount of shading correction applied to the images */
1241     CAM_INTF_META_GEOMETRIC_STRENGTH,
1242     /* HOT PIXEL */
1243     /* Set operational mode for hot pixel correction */
1244     CAM_INTF_META_HOTPIXEL_MODE,
1245     /* LENS */
1246     /* Size of the lens aperture */
1247     CAM_INTF_META_LENS_APERTURE,
1248     /* State of lens neutral density filter(s) */
1249     CAM_INTF_META_LENS_FILTERDENSITY,
1250     /* Lens optical zoom setting */
1251     CAM_INTF_META_LENS_FOCAL_LENGTH, /* 120 */
1252     /* Distance to plane of sharpest focus, measured from frontmost surface
1253      * of the lens */
1254     CAM_INTF_META_LENS_FOCUS_DISTANCE,
1255     /* The range of scene distances that are in sharp focus (depth of field) */
1256     CAM_INTF_META_LENS_FOCUS_RANGE,
1257     /* Whether optical image stabilization is enabled. */
1258     CAM_INTF_META_LENS_OPT_STAB_MODE,
1259     /*Whether the hal needs to output the lens shading map*/
1260     CAM_INTF_META_LENS_SHADING_MAP_MODE,
1261     /* Current lens status */
1262     CAM_INTF_META_LENS_STATE,
1263     /* NOISE REDUCTION */
1264     /* Mode of operation for the noise reduction algorithm */
1265     CAM_INTF_META_NOISE_REDUCTION_MODE,
1266    /* Control the amount of noise reduction applied to the images.
1267     * 1-10; 10 is max noise reduction */
1268     CAM_INTF_META_NOISE_REDUCTION_STRENGTH,
1269     /* SCALER */
1270     /* Top-left corner and width of the output region to select from the active
1271      * pixel array */
1272     CAM_INTF_META_SCALER_CROP_REGION,
1273     /* The estimated scene illumination lighting frequency */
1274     CAM_INTF_META_SCENE_FLICKER,
1275     /* SENSOR */
1276     /* Duration each pixel is exposed to light, in nanoseconds */
1277     CAM_INTF_META_SENSOR_EXPOSURE_TIME, /* 130 */
1278     /* Duration from start of frame exposure to start of next frame exposure,
1279      * in nanoseconds */
1280     CAM_INTF_META_SENSOR_FRAME_DURATION,
1281     /* Gain applied to image data. Must be implemented through analog gain only
1282      * if set to values below 'maximum analog sensitivity'. */
1283     CAM_INTF_META_SENSOR_SENSITIVITY,
1284     /* Time at start of exposure of first row */
1285     CAM_INTF_META_SENSOR_TIMESTAMP,
1286     /* Duration b/w start of first row exposure and the start of last
1287        row exposure in nanoseconds */
1288     CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,
1289     /* SHADING */
1290     /* Quality of lens shading correction applied to the image data */
1291     CAM_INTF_META_SHADING_MODE,
1292     /* Control the amount of shading correction applied to the images.
1293      * unitless: 1-10; 10 is full shading compensation */
1294     CAM_INTF_META_SHADING_STRENGTH,
1295     /* STATISTICS */
1296     /* State of the face detector unit */
1297     CAM_INTF_META_STATS_FACEDETECT_MODE,
1298     /* Operating mode for histogram generation */
1299     CAM_INTF_META_STATS_HISTOGRAM_MODE,
1300     /* Operating mode for sharpness map generation */
1301     CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,
1302     /* A 3-channel sharpness map, based on the raw sensor data,
1303      * If only a monochrome sharpness map is supported, all channels
1304      * should have the same data
1305      */
1306     CAM_INTF_META_STATS_SHARPNESS_MAP, /* 140 */
1307 
1308     /* TONEMAP */
1309     /* Tone map mode */
1310     CAM_INTF_META_TONEMAP_MODE,
1311     /* Table mapping RGB input values to output values */
1312     CAM_INTF_META_TONEMAP_CURVES,
1313 
1314     CAM_INTF_META_FLASH_MODE,
1315     /* 2D array of gain factors for each color channel that was used to
1316      * compensate for lens shading for this frame */
1317     CAM_INTF_META_LENS_SHADING_MAP,
1318     CAM_INTF_META_PRIVATE_DATA,
1319     CAM_INTF_PARM_STATS_DEBUG_MASK,
1320     CAM_INTF_PARM_STATS_AF_PAAF,
1321     /* Indicates streams ID of all the requested buffers */
1322     CAM_INTF_META_STREAM_ID,
1323     CAM_INTF_PARM_FOCUS_BRACKETING,
1324     CAM_INTF_PARM_FLASH_BRACKETING, /* 150 */
1325     CAM_INTF_PARM_GET_IMG_PROP,
1326     CAM_INTF_META_JPEG_GPS_COORDINATES,
1327     CAM_INTF_META_JPEG_GPS_PROC_METHODS,
1328     CAM_INTF_META_JPEG_GPS_TIMESTAMP,
1329     CAM_INTF_META_JPEG_ORIENTATION,
1330     CAM_INTF_META_JPEG_QUALITY,
1331     CAM_INTF_META_JPEG_THUMB_QUALITY,
1332     CAM_INTF_META_JPEG_THUMB_SIZE,
1333 
1334     CAM_INTF_META_TEST_PATTERN_DATA,
1335     /* DNG file support */
1336     CAM_INTF_META_PROFILE_TONE_CURVE, /* 160 */
1337     CAM_INTF_META_NEUTRAL_COL_POINT,
1338 
1339     /* OTP : WB gr/gb */
1340     CAM_INTF_META_OTP_WB_GRGB,
1341 
1342     /* CAC */
1343     CAM_INTF_PARM_CAC,
1344 
1345     CAM_INTF_PARM_MAX
1346 } cam_intf_parm_type_t;
1347 
1348 typedef struct {
1349     int   forced;
1350     union {
1351       uint32_t force_linecount_value;
1352       float    force_gain_value;
1353       float    force_snap_exp_value;
1354       float    force_exp_value;
1355       uint32_t force_snap_linecount_value;
1356       float    force_snap_gain_value;
1357     } u;
1358 } cam_ez_force_params_t;
1359 
1360 typedef enum {
1361     CAM_EZTUNE_CMD_STATUS,
1362     CAM_EZTUNE_CMD_AEC_ENABLE,
1363     CAM_EZTUNE_CMD_AWB_ENABLE,
1364     CAM_EZTUNE_CMD_AF_ENABLE,
1365     CAM_EZTUNE_CMD_AEC_FORCE_LINECOUNT,
1366     CAM_EZTUNE_CMD_AEC_FORCE_GAIN,
1367     CAM_EZTUNE_CMD_AEC_FORCE_EXP,
1368     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_LC,
1369     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_GAIN,
1370     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_EXP,
1371     CAM_EZTUNE_CMD_AWB_MODE,
1372 } cam_eztune_cmd_type_t;
1373 
1374 typedef struct {
1375   cam_eztune_cmd_type_t   cmd;
1376   union {
1377     int                   running;
1378     int                   aec_enable;
1379     int                   awb_enable;
1380     int                   af_enable;
1381     cam_ez_force_params_t ez_force_param;
1382     int                   awb_mode;
1383   } u;
1384 } cam_eztune_cmd_data_t;
1385 
1386 
1387 /*****************************************************************************
1388  *                 Code for HAL3 data types                                  *
1389  ****************************************************************************/
1390 typedef enum {
1391     CAM_INTF_METADATA_MAX
1392 } cam_intf_metadata_type_t;
1393 
1394 typedef enum {
1395     CAM_INTENT_CUSTOM,
1396     CAM_INTENT_PREVIEW,
1397     CAM_INTENT_STILL_CAPTURE,
1398     CAM_INTENT_VIDEO_RECORD,
1399     CAM_INTENT_VIDEO_SNAPSHOT,
1400     CAM_INTENT_ZERO_SHUTTER_LAG,
1401     CAM_INTENT_MAX,
1402 } cam_intent_t;
1403 
1404 typedef enum {
1405     /* Full application control of pipeline. All 3A routines are disabled,
1406      * no other settings in android.control.* have any effect */
1407     CAM_CONTROL_OFF,
1408     /* Use settings for each individual 3A routine. Manual control of capture
1409      * parameters is disabled. All controls in android.control.* besides sceneMode
1410      * take effect */
1411     CAM_CONTROL_AUTO,
1412     /* Use specific scene mode. Enabling this disables control.aeMode,
1413      * control.awbMode and control.afMode controls; the HAL must ignore those
1414      * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode).
1415      * Other control entries are still active. This setting can only be used if
1416      * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this
1417      * in HAL ?*/
1418     CAM_CONTROL_USE_SCENE_MODE,
1419     CAM_CONTROL_MAX
1420 } cam_control_mode_t;
1421 
1422 typedef enum {
1423     /* Use the android.colorCorrection.transform matrix to do color conversion */
1424     CAM_COLOR_CORRECTION_TRANSFORM_MATRIX,
1425     /* Must not slow down frame rate relative to raw bayer output */
1426     CAM_COLOR_CORRECTION_FAST,
1427     /* Frame rate may be reduced by high quality */
1428     CAM_COLOR_CORRECTION_HIGH_QUALITY,
1429 } cam_color_correct_mode_t;
1430 
1431 typedef enum {
1432     CAM_COLOR_CORRECTION_ABERRATION_OFF,
1433     CAM_COLOR_CORRECTION_ABERRATION_FAST,
1434     CAM_COLOR_CORRECTION_ABERRATION_HIGH_QUALITY,
1435     CAM_COLOR_CORRECTION_ABERRATION_MAX
1436 } cam_aberration_mode_t;
1437 
1438 typedef struct {
1439     /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */
1440     cam_rational_type_t transform_matrix[3][3];
1441 } cam_color_correct_matrix_t;
1442 
1443 #define CAM_FOCAL_LENGTHS_MAX     1
1444 #define CAM_APERTURES_MAX         1
1445 #define CAM_FILTER_DENSITIES_MAX  1
1446 #define CAM_MAX_MAP_HEIGHT        6
1447 #define CAM_MAX_MAP_WIDTH         6
1448 #define CAM_MAX_SHADING_MAP_WIDTH 17
1449 #define CAM_MAX_SHADING_MAP_HEIGHT 13
1450 #define CAM_MAX_TONEMAP_CURVE_SIZE    512
1451 
1452 typedef struct {
1453     /* A 1D array of pairs of floats.
1454      * Mapping a 0-1 input range to a 0-1 output range.
1455      * The input range must be monotonically increasing with N,
1456      * and values between entries should be linearly interpolated.
1457      * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0],
1458      * then the input->output mapping for a few sample points would be:
1459      * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */
1460     float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2];
1461 } cam_tonemap_curve_t;
1462 
1463 typedef struct {
1464    int tonemap_points_cnt;
1465    cam_tonemap_curve_t curves[3];
1466 } cam_rgb_tonemap_curves;
1467 
1468 typedef struct {
1469    int tonemap_points_cnt;
1470    cam_tonemap_curve_t curve;
1471 } cam_profile_tone_curve;
1472 
1473 typedef struct {
1474     cam_rational_type_t neutral_col_point[3];
1475 } cam_neutral_col_point_t;
1476 
1477 typedef enum {
1478     OFF,
1479     FAST,
1480     QUALITY,
1481 } cam_quality_preference_t;
1482 
1483 typedef enum {
1484     CAM_FLASH_CTRL_OFF,
1485     CAM_FLASH_CTRL_SINGLE,
1486     CAM_FLASH_CTRL_TORCH
1487 } cam_flash_ctrl_t;
1488 
1489 typedef struct {
1490     uint8_t frame_dropped; /*  This flag indicates whether any stream buffer is dropped or not */
1491     cam_stream_ID_t cam_stream_ID; /* if dropped, Stream ID of dropped streams */
1492 } cam_frame_dropped_t;
1493 
1494 typedef struct {
1495     uint8_t ae_mode;
1496     uint8_t awb_mode;
1497     uint8_t af_mode;
1498 } cam_scene_mode_overrides_t;
1499 
1500 typedef struct {
1501     int32_t left;
1502     int32_t top;
1503     int32_t width;
1504     int32_t height;
1505 } cam_crop_region_t;
1506 
1507 typedef struct {
1508     /* Estimated sharpness for each region of the input image.
1509      * Normalized to be between 0 and maxSharpnessMapValue.
1510      * Higher values mean sharper (better focused) */
1511     int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT];
1512 } cam_sharpness_map_t;
1513 
1514 typedef struct {
1515    float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH];
1516 } cam_lens_shading_map_t;
1517 
1518 typedef struct {
1519     int32_t min_value;
1520     int32_t max_value;
1521     int32_t def_value;
1522     int32_t step;
1523 } cam_control_range_t;
1524 
1525 #define CAM_QCOM_FEATURE_NONE            0
1526 #define CAM_QCOM_FEATURE_FACE_DETECTION (1<<0)
1527 #define CAM_QCOM_FEATURE_DENOISE2D      (1<<1)
1528 #define CAM_QCOM_FEATURE_CROP           (1<<2)
1529 #define CAM_QCOM_FEATURE_ROTATION       (1<<3)
1530 #define CAM_QCOM_FEATURE_FLIP           (1<<4)
1531 #define CAM_QCOM_FEATURE_HDR            (1<<5)
1532 #define CAM_QCOM_FEATURE_REGISTER_FACE  (1<<6)
1533 #define CAM_QCOM_FEATURE_SHARPNESS      (1<<7)
1534 #define CAM_QCOM_FEATURE_VIDEO_HDR      (1<<8)
1535 #define CAM_QCOM_FEATURE_CAC            (1<<9)
1536 #define CAM_QCOM_FEATURE_SCALE          (1<<10)
1537 #define CAM_QCOM_FEATURE_EFFECT         (1<<11)
1538 #define CAM_QCOM_FEATURE_UBIFOCUS       (1<<12)
1539 #define CAM_QCOM_FEATURE_CHROMA_FLASH   (1<<13)
1540 #define CAM_QCOM_FEATURE_OPTIZOOM       (1<<14)
1541 #define CAM_QCOM_FEATURE_SENSOR_HDR     (1<<15)
1542 #define CAM_QCOM_FEATURE_CPP_TNR        (1<<17)
1543 #define CAM_QCOM_FEATURE_PP_SUPERSET (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\
1544                                       CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\
1545                                       CAM_QCOM_FEATURE_SCALE)
1546 
1547 // Counter clock wise
1548 typedef enum {
1549     ROTATE_0 = 1<<0,
1550     ROTATE_90 = 1<<1,
1551     ROTATE_180 = 1<<2,
1552     ROTATE_270 = 1<<3,
1553 } cam_rotation_t;
1554 
1555 typedef struct {
1556    cam_rotation_t rotation;
1557    uint32_t streamId;
1558 } cam_rotation_info_t;
1559 
1560 typedef enum {
1561     FLIP_H = 1<<0,
1562     FLIP_V = 1<<1,
1563 } cam_flip_t;
1564 
1565 typedef struct {
1566     uint32_t bundle_id;                            /* bundle id */
1567     uint8_t num_of_streams;                        /* number of streams in the bundle */
1568     uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */
1569 } cam_bundle_config_t;
1570 
1571 typedef enum {
1572     CAM_ONLINE_REPROCESS_TYPE,    /* online reprocess, frames from running streams */
1573     CAM_OFFLINE_REPROCESS_TYPE,   /* offline reprocess, frames from external source */
1574 } cam_reprocess_type_enum_t;
1575 
1576 typedef enum {
1577     CAM_HDR_MODE_SINGLEFRAME,    /* Single frame HDR mode which does only tone mapping */
1578     CAM_HDR_MODE_MULTIFRAME,     /* Multi frame HDR mode which needs two frames with 0.5x and 2x exposure respectively */
1579 } cam_hdr_mode_enum_t;
1580 
1581 typedef struct {
1582     uint32_t hdr_enable;
1583     uint32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */
1584     cam_hdr_mode_enum_t hdr_mode;
1585 } cam_hdr_param_t;
1586 
1587 typedef struct {
1588     int32_t output_width;
1589     int32_t output_height;
1590 } cam_scale_param_t;
1591 
1592 typedef struct {
1593     uint8_t enable;
1594     uint8_t burst_count;
1595     uint8_t focus_steps[MAX_AF_BRACKETING_VALUES];
1596     uint8_t output_count;
1597 } cam_af_bracketing_t;
1598 
1599 typedef struct {
1600     uint8_t enable;
1601     uint8_t burst_count;
1602 } cam_flash_bracketing_t;
1603 
1604 typedef struct {
1605     uint8_t enable;
1606     uint8_t burst_count;
1607     uint8_t zoom_threshold;
1608 } cam_opti_zoom_t;
1609 
1610 typedef enum {
1611     CAM_FLASH_OFF,
1612     CAM_FLASH_ON
1613 } cam_flash_value_t;
1614 
1615 typedef enum {
1616     CAM_SENSOR_RAW,
1617     CAM_SENSOR_YUV
1618 } cam_sensor_t;
1619 
1620 typedef struct {
1621     cam_sensor_t sens_type;
1622     cam_format_t native_format;
1623 } cam_sensor_type_t;
1624 
1625 typedef struct {
1626     /* reprocess feature mask */
1627     uint32_t feature_mask;
1628 
1629     /* individual setting for features to be reprocessed */
1630     cam_denoise_param_t denoise2d;
1631     cam_rect_t input_crop;
1632     cam_rotation_t rotation;
1633     uint32_t flip;
1634     int32_t sharpness;
1635     int32_t effect;
1636     cam_hdr_param_t hdr_param;
1637     cam_scale_param_t scale_param;
1638 
1639     uint8_t zoom_level;
1640     cam_flash_value_t flash_value;
1641 
1642 } cam_pp_feature_config_t;
1643 
1644 typedef struct {
1645     uint32_t input_stream_id;
1646     /* input source stream type */
1647     cam_stream_type_t input_stream_type;
1648 } cam_pp_online_src_config_t;
1649 
1650 typedef struct {
1651     /* image format */
1652     cam_format_t input_fmt;
1653 
1654     /* image dimension */
1655     cam_dimension_t input_dim;
1656 
1657     /* buffer plane information, will be calc based on stream_type, fmt,
1658        dim, and padding_info(from stream config). Info including:
1659        offset_x, offset_y, stride, scanline, plane offset */
1660     cam_stream_buf_plane_info_t input_buf_planes;
1661 
1662     /* number of input reprocess buffers */
1663     uint8_t num_of_bufs;
1664 
1665     /* input source type */
1666     cam_stream_type_t input_type;
1667 
1668 } cam_pp_offline_src_config_t;
1669 
1670 /* reprocess stream input configuration */
1671 typedef struct {
1672     /* input source config */
1673     cam_reprocess_type_enum_t pp_type;
1674     union {
1675         cam_pp_online_src_config_t online;
1676         cam_pp_offline_src_config_t offline;
1677     };
1678 
1679     /* pp feature config */
1680     cam_pp_feature_config_t pp_feature_config;
1681 } cam_stream_reproc_config_t;
1682 
1683 typedef struct {
1684     uint8_t crop_enabled;
1685     cam_rect_t input_crop;
1686 } cam_crop_param_t;
1687 
1688 typedef struct {
1689     uint8_t trigger;
1690     int32_t trigger_id;
1691 } cam_trigger_t;
1692 
1693 typedef struct {
1694     cam_denoise_param_t denoise2d;
1695     cam_crop_param_t crop;
1696     uint32_t flip;     /* 0 means no flip */
1697     uint32_t uv_upsample; /* 0 means no chroma upsampling */
1698     int32_t sharpness; /* 0 means no sharpness */
1699     int32_t effect;
1700     cam_rotation_t rotation;
1701 } cam_per_frame_pp_config_t;
1702 
1703 typedef enum {
1704     CAM_OPT_STAB_OFF,
1705     CAM_OPT_STAB_ON,
1706     CAM_OPT_STAB_MAX
1707 } cam_optical_stab_modes_t;
1708 
1709 typedef enum {
1710     CAM_FILTER_ARRANGEMENT_RGGB,
1711     CAM_FILTER_ARRANGEMENT_GRBG,
1712     CAM_FILTER_ARRANGEMENT_GBRG,
1713     CAM_FILTER_ARRANGEMENT_BGGR,
1714 
1715     /* Sensor is not Bayer; output has 3 16-bit values for each pixel,
1716      * instead of just 1 16-bit value per pixel.*/
1717     CAM_FILTER_ARRANGEMENT_RGB
1718 } cam_color_filter_arrangement_t;
1719 
1720 typedef enum {
1721     CAM_AF_STATE_INACTIVE,
1722     CAM_AF_STATE_PASSIVE_SCAN,
1723     CAM_AF_STATE_PASSIVE_FOCUSED,
1724     CAM_AF_STATE_ACTIVE_SCAN,
1725     CAM_AF_STATE_FOCUSED_LOCKED,
1726     CAM_AF_STATE_NOT_FOCUSED_LOCKED,
1727     CAM_AF_STATE_PASSIVE_UNFOCUSED
1728 } cam_af_state_t;
1729 
1730 typedef enum {
1731   CAM_AF_LENS_STATE_STATIONARY,
1732   CAM_AF_LENS_STATE_MOVING,
1733 } cam_af_lens_state_t;
1734 
1735 typedef enum {
1736     CAM_AWB_STATE_INACTIVE,
1737     CAM_AWB_STATE_SEARCHING,
1738     CAM_AWB_STATE_CONVERGED,
1739     CAM_AWB_STATE_LOCKED
1740 } cam_awb_state_t;
1741 
1742 typedef enum {
1743     CAM_FOCUS_UNCALIBRATED,
1744     CAM_FOCUS_APPROXIMATE,
1745     CAM_FOCUS_CALIBRATED
1746 } cam_focus_calibration_t;
1747 
1748 typedef enum {
1749 CAM_TEST_PATTERN_OFF,
1750 CAM_TEST_PATTERN_SOLID_COLOR,
1751 CAM_TEST_PATTERN_COLOR_BARS,
1752 CAM_TEST_PATTERN_COLOR_BARS_FADE_TO_GRAY,
1753 CAM_TEST_PATTERN_PN9,
1754 } cam_test_pattern_mode_t;
1755 
1756 typedef struct {
1757 cam_test_pattern_mode_t mode;
1758 int32_t r;
1759 int32_t gr;
1760 int32_t gb;
1761 int32_t b;
1762 } cam_test_pattern_data_t;
1763 
1764 typedef enum {
1765     CAM_AWB_D50,
1766     CAM_AWB_D65,
1767     CAM_AWB_D75,
1768     CAM_AWB_A,
1769     CAM_AWB_CUSTOM_A,
1770     CAM_AWB_WARM_FLO,
1771     CAM_AWB_COLD_FLO,
1772     CAM_AWB_CUSTOM_FLO,
1773     CAM_AWB_NOON,
1774     CAM_AWB_CUSTOM_DAYLIGHT,
1775     CAM_AWB_INVALID_ALL_LIGHT,
1776 } cam_illuminat_t;
1777 
1778 typedef enum {
1779     LEGACY_RAW,
1780     MIPI_RAW,
1781 } cam_opaque_raw_format_t;
1782 
1783 #endif /* __QCAMERA_TYPES_H__ */
1784