• 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_INTF_H__
31 #define __QCAMERA_INTF_H__
32 
33 #include <string.h>
34 #include <media/msmb_isp.h>
35 #include "cam_types.h"
36 
37 #define CAM_PRIV_IOCTL_BASE (V4L2_CID_PRIVATE_BASE + 14)
38 typedef enum {
39     /* session based parameters */
40     CAM_PRIV_PARM = CAM_PRIV_IOCTL_BASE,
41     /* session based action: do auto focus.*/
42     CAM_PRIV_DO_AUTO_FOCUS,
43     /* session based action: cancel auto focus.*/
44     CAM_PRIV_CANCEL_AUTO_FOCUS,
45     /* session based action: prepare for snapshot.*/
46     CAM_PRIV_PREPARE_SNAPSHOT,
47     /* sync stream info.*/
48     CAM_PRIV_STREAM_INFO_SYNC,
49     /* stream based parameters*/
50     CAM_PRIV_STREAM_PARM,
51     /* start ZSL snapshot.*/
52     CAM_PRIV_START_ZSL_SNAPSHOT,
53     /* stop ZSL snapshot.*/
54     CAM_PRIV_STOP_ZSL_SNAPSHOT,
55 } cam_private_ioctl_enum_t;
56 
57 /* capability struct definition for HAL 1*/
58 typedef struct{
59     cam_hal_version_t version;
60 
61     cam_position_t position;                                /* sensor position: front, back */
62 
63     uint8_t auto_hdr_supported;
64 
65     uint16_t isWnrSupported;
66     /* supported iso modes */
67     size_t supported_iso_modes_cnt;
68     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
69 
70     /* supported flash modes */
71     size_t supported_flash_modes_cnt;
72     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
73 
74     size_t zoom_ratio_tbl_cnt;                              /* table size for zoom ratios */
75     uint32_t zoom_ratio_tbl[MAX_ZOOMS_CNT];                 /* zoom ratios table */
76 
77     /* supported effect modes */
78     size_t supported_effects_cnt;
79     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
80 
81     /* supported scene modes */
82     size_t supported_scene_modes_cnt;
83     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
84 
85     /* supported auto exposure modes */
86     size_t supported_aec_modes_cnt;
87     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
88 
89     size_t fps_ranges_tbl_cnt;                              /* fps ranges table size */
90     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
91 
92     /* supported antibanding modes */
93     size_t supported_antibandings_cnt;
94     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
95 
96     /* supported white balance modes */
97     size_t supported_white_balances_cnt;
98     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
99 
100     /* supported manual wb cct */
101     int32_t min_wb_cct;
102     int32_t max_wb_cct;
103 
104     /* supported manual wb rgb gains */
105     float min_wb_gain;
106     float max_wb_gain;
107 
108     /* supported focus modes */
109     size_t supported_focus_modes_cnt;
110     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
111 
112     /* supported manual focus position */
113     float min_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
114     float max_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
115 
116     int32_t exposure_compensation_min;       /* min value of exposure compensation index */
117     int32_t exposure_compensation_max;       /* max value of exposure compensation index */
118     int32_t exposure_compensation_default;   /* default value of exposure compensation index */
119     float exposure_compensation_step;
120     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
121 
122     uint8_t video_stablization_supported; /* flag id video stablization is supported */
123 
124     size_t picture_sizes_tbl_cnt;                           /* picture sizes table size */
125     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
126     /* The minimum frame duration that is supported for each
127      * resolution in availableProcessedSizes. Should correspond
128      * to the frame duration when only that processed stream
129      * is active, with all processing set to FAST */
130     int64_t picture_min_duration[MAX_SIZES_CNT];
131 
132     /* capabilities specific to HAL 1 */
133 
134     int32_t modes_supported;                                /* mask of modes supported: 2D, 3D */
135     uint32_t sensor_mount_angle;                            /* sensor mount angle */
136 
137     float focal_length;                                     /* focal length */
138     float hor_view_angle;                                   /* horizontal view angle */
139     float ver_view_angle;                                   /* vertical view angle */
140 
141     size_t preview_sizes_tbl_cnt;                           /* preview sizes table size */
142     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
143 
144     size_t video_sizes_tbl_cnt;                             /* video sizes table size */
145     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
146 
147 
148     size_t livesnapshot_sizes_tbl_cnt;                      /* livesnapshot sizes table size */
149     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
150 
151     size_t hfr_tbl_cnt;                                     /* table size for HFR */
152     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
153 
154     /* supported preview formats */
155     size_t supported_preview_fmt_cnt;
156     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
157 
158     /* supported picture formats */
159     size_t supported_picture_fmt_cnt;
160     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
161 
162     uint8_t max_downscale_factor;
163 
164     /* dimension and supported output format of raw dump from camif */
165     size_t supported_raw_dim_cnt;
166     cam_dimension_t raw_dim[MAX_SIZES_CNT];
167     size_t supported_raw_fmt_cnt;
168     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
169     /* The minimum frame duration that is supported for above
170        raw resolution */
171     int64_t raw_min_duration[MAX_SIZES_CNT];
172 
173     /* 3A version*/
174     cam_q3a_version_t q3a_version;
175     /* supported focus algorithms */
176     size_t supported_focus_algos_cnt;
177     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
178 
179 
180     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
181     uint8_t zoom_supported;               /* flag if zoom is supported */
182     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
183     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
184     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
185 
186     uint8_t max_num_roi;                  /* max number of roi can be detected */
187     uint8_t max_num_focus_areas;          /* max num of focus areas */
188     uint8_t max_num_metering_areas;       /* max num opf metering areas */
189     uint8_t max_zoom_step;                /* max zoom step value */
190 
191     /* QCOM specific control */
192     cam_control_range_t brightness_ctrl;  /* brightness */
193     cam_control_range_t sharpness_ctrl;   /* sharpness */
194     cam_control_range_t contrast_ctrl;    /* contrast */
195     cam_control_range_t saturation_ctrl;  /* saturation */
196     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
197 
198     /* QCOM HDR specific control. Indicates number of frames and exposure needs for the frames */
199     cam_hdr_bracketing_info_t hdr_bracketing_setting;
200 
201     uint32_t qcom_supported_feature_mask; /* mask of qcom specific features supported:
202                                            * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
203     cam_padding_info_t padding_info;      /* padding information from PP */
204     uint32_t min_num_pp_bufs;             /* minimum number of buffers needed by postproc module */
205     uint32_t min_required_pp_mask;        /* min required pp feature masks for ZSL.
206                                            * depends on hardware limitation, i.e. for 8974,
207                                            * sharpness is required for all ZSL snapshot frames */
208     cam_format_t rdi_mode_stream_fmt;  /* stream format supported in rdi mode */
209 
210     /* capabilities specific to HAL 3 */
211 
212     float min_focus_distance;
213     float hyper_focal_distance;
214 
215     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
216     uint8_t focal_lengths_count;
217 
218     /* Needs to be regular f number instead of APEX */
219     float apertures[CAM_APERTURES_MAX];
220     uint8_t apertures_count;
221 
222     float filter_densities[CAM_FILTER_DENSITIES_MAX];
223     uint8_t filter_densities_count;
224 
225     uint8_t optical_stab_modes[CAM_OPT_STAB_MAX];
226     uint8_t optical_stab_modes_count;
227 
228     cam_dimension_t lens_shading_map_size;
229     float lens_shading_map[3 * CAM_MAX_MAP_WIDTH *
230               CAM_MAX_MAP_HEIGHT];
231 
232     cam_dimension_t geo_correction_map_size;
233     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
234               CAM_MAX_MAP_HEIGHT];
235 
236     float lens_position[3];
237 
238     /* nano seconds */
239     int64_t exposure_time_range[EXPOSURE_TIME_RANGE_CNT];
240 
241     /* nano seconds */
242     int64_t max_frame_duration;
243 
244     cam_color_filter_arrangement_t color_arrangement;
245     uint8_t num_color_channels;
246 
247     /* parameters required to calculate S and O co-efficients */
248     double gradient_S;
249     double offset_S;
250     double gradient_O;
251     double offset_O;
252 
253     float sensor_physical_size[SENSOR_PHYSICAL_SIZE_CNT];
254 
255     /* Dimensions of full pixel array, possibly including
256        black calibration pixels */
257     cam_dimension_t pixel_array_size;
258     /* Area of raw data which corresponds to only active
259        pixels; smaller or equal to pixelArraySize. */
260     cam_rect_t active_array_size;
261 
262     /* Maximum raw value output by sensor */
263     int32_t white_level;
264 
265     /* A fixed black level offset for each of the Bayer
266        mosaic channels */
267     int32_t black_level_pattern[BLACK_LEVEL_PATTERN_CNT];
268 
269     /* Time taken before flash can fire again in nano secs */
270     int64_t flash_charge_duration;
271 
272     /* flash firing power */
273     size_t supported_flash_firing_level_cnt;
274     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
275 
276     /* Flash Firing Time */
277     int64_t flash_firing_time;
278 
279     /* Flash Ciolor Temperature */
280     uint8_t flash_color_temp;
281 
282     /* Flash max Energy */
283     uint8_t flash_max_energy;
284 
285     /* Maximum number of supported points in the tonemap
286        curve */
287     int32_t max_tone_map_curve_points;
288 
289     /* supported formats */
290     size_t supported_scalar_format_cnt;
291     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
292 
293     uint32_t max_face_detection_count;
294     uint8_t hw_analysis_supported;
295 
296     uint8_t histogram_supported;
297     /* Number of histogram buckets supported */
298     int32_t histogram_size;
299     /* Maximum value possible for a histogram bucket */
300     int32_t max_histogram_count;
301 
302     cam_dimension_t sharpness_map_size;
303 
304     /* Maximum value possible for a sharpness map region */
305     int32_t max_sharpness_map_value;
306 
307     /*Autoexposure modes for camera 3 api*/
308     size_t supported_ae_modes_cnt;
309     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
310 
311 
312     cam_sensitivity_range_t sensitivity_range;
313     int32_t max_analog_sensitivity;
314 
315     /* picture sizes need scale*/
316     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
317     size_t scale_picture_sizes_cnt;
318     cam_dimension_t scale_picture_sizes[MAX_SCALE_SIZES_CNT];
319 
320     uint8_t flash_available;
321 
322     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
323     /* AF Bracketing info */
324     cam_af_bracketing_t  ubifocus_af_bracketing_need;
325     cam_af_bracketing_t  refocus_af_bracketing_need;
326     /* opti Zoom info */
327     cam_opti_zoom_t      opti_zoom_settings_need;
328     /* still more info */
329     cam_still_more_t  stillmore_settings_need;
330     /* chroma flash info */
331     cam_chroma_flash_t chroma_flash_settings_need;
332 
333     cam_rational_type_t forward_matrix[3][3];
334     cam_rational_type_t color_transform[3][3];
335 
336     uint8_t focus_dist_calibrated;
337     uint8_t supported_test_pattern_modes_cnt;
338     cam_test_pattern_mode_t supported_test_pattern_modes[MAX_TEST_PATTERN_CNT];
339 
340     int64_t stall_durations[MAX_SIZES_CNT];
341 
342     cam_illuminat_t reference_illuminant1;
343     cam_illuminat_t reference_illuminant2;
344 
345     int64_t jpeg_stall_durations[MAX_SIZES_CNT];
346     int64_t raw16_stall_durations[MAX_SIZES_CNT];
347     cam_rational_type_t forward_matrix1[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
348     cam_rational_type_t forward_matrix2[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
349     cam_rational_type_t color_transform1[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
350     cam_rational_type_t color_transform2[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
351     cam_rational_type_t calibration_transform1[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
352     cam_rational_type_t calibration_transform2[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
353     uint16_t isCacSupported;
354 
355     cam_opaque_raw_format_t opaque_raw_fmt;
356 
357     /* true Portrait info */
358     cam_true_portrait_t  true_portrait_settings_need;
359 
360     /* Sensor type information */
361     cam_sensor_type_t sensor_type;
362 
363     cam_aberration_mode_t aberration_modes[CAM_COLOR_CORRECTION_ABERRATION_MAX];
364     uint32_t aberration_modes_count;
365 
366     /* Can the sensor timestamp be compared to
367      * timestamps from other sub-systems (gyro, accelerometer etc.) */
368     uint8_t isTimestampCalibrated;
369 
370     /* Analysis stream max supported size */
371     cam_dimension_t analysis_max_res;
372     /* Analysis stream padding info */
373     cam_padding_info_t analysis_padding_info;
374     /* Max size supported by ISP viewfinder path */
375     cam_dimension_t max_viewfinder_size;
376 
377     /* Analysis recommended size */
378     cam_dimension_t analysis_recommended_res;
379 
380     /* Analysis recommended format */
381     cam_format_t analysis_recommended_format;
382 
383     /* This is set to 'true' if sensor cannot guarantee per frame control */
384     /* Default value of this capability is 'false' indicating per-frame */
385     /* control is supported */
386     uint8_t no_per_frame_control_support;
387 
388     /* EIS information */
389     uint8_t supported_is_types_cnt;
390     uint32_t supported_is_types[IS_TYPE_MAX];
391     /*for each type, specify the margin needed. Margin will be
392       the decimal representation of a percentage
393       ex: 10% margin = 0.1 */
394     float supported_is_type_margins[IS_TYPE_MAX];
395 
396     /* Max cpp batch size */
397     uint8_t max_batch_bufs_supported;
398     uint8_t flash_dev_name[QCAMERA_MAX_FILEPATH_LENGTH];
399     uint8_t eeprom_version_info[MAX_EEPROM_VERSION_INFO_LEN];
400 
401     /* maximum pixel bandwidth shared between cameras */
402     uint64_t max_pixel_bandwidth;
403 
404     /* Array of K integers, where K%4==0,
405       as a list of rectangles in the pixelArray co-ord system
406       left, top, right, bottom */
407     int32_t optical_black_regions[MAX_OPTICAL_BLACK_REGIONS * 4];
408     /* Count is K/4 */
409     uint8_t optical_black_region_count;
410 
411 } cam_capability_t;
412 
413 typedef enum {
414     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
415     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
416     CAM_STREAM_PARAM_TYPE_SET_FLIP = CAM_INTF_PARM_STREAM_FLIP,
417     CAM_STREAM_PARAM_TYPE_GET_OUTPUT_CROP = CAM_INTF_PARM_GET_OUTPUT_CROP,
418     CAM_STREAM_PARAM_TYPE_GET_IMG_PROP = CAM_INTF_PARM_GET_IMG_PROP,
419     CAM_STREAM_PARAM_TYPE_MAX
420 } cam_stream_param_type_e;
421 
422 typedef struct {
423     uint32_t buf_index;           /* buf index to the source frame buffer that needs reprocess,
424                                     (assume buffer is already mapped)*/
425     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
426     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
427                                      i.e., faceID in the case of face registration. */
428     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
429     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
430     uint32_t meta_buf_index;      /* buf index to meta data buffer. only valid if meta_present != 0 */
431 
432     /* opaque metadata required for reprocessing */
433     int32_t private_data[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
434     cam_rect_t crop_rect;
435 } cam_reprocess_param;
436 
437 typedef struct {
438     uint32_t flip_mask;
439 } cam_flip_mode_t;
440 
441 #define IMG_NAME_SIZE 32
442 typedef struct {
443     cam_rect_t crop;  /* crop info for the image */
444     cam_dimension_t input; /* input dimension of the image */
445     cam_dimension_t output; /* output dimension of the image */
446     char name[IMG_NAME_SIZE]; /* optional name of the ext*/
447     cam_format_t format; /* image format */
448 } cam_stream_img_prop_t;
449 
450 typedef struct {
451     cam_stream_param_type_e type;
452     union {
453         cam_reprocess_param reprocess;  /* do reprocess */
454         cam_bundle_config_t bundleInfo; /* set bundle info*/
455         cam_flip_mode_t flipInfo;       /* flip mode */
456         cam_crop_data_t outputCrop;     /* output crop for current frame */
457         cam_stream_img_prop_t imgProp;  /* image properties of current frame */
458     };
459 } cam_stream_parm_buffer_t;
460 
461 /* stream info */
462 typedef struct {
463     /* stream ID from server */
464     uint32_t stream_svr_id;
465 
466     /* stream type */
467     cam_stream_type_t stream_type;
468 
469     /* image format */
470     cam_format_t fmt;
471 
472     /* image dimension */
473     cam_dimension_t dim;
474 
475     /* buffer plane information, will be calc based on stream_type, fmt,
476        dim, and padding_info(from stream config). Info including:
477        offset_x, offset_y, stride, scanline, plane offset */
478     cam_stream_buf_plane_info_t buf_planes;
479 
480     /* number of stream bufs will be allocated */
481     uint32_t num_bufs;
482 
483     /* streaming type */
484     cam_streaming_mode_t streaming_mode;
485 
486     /* num of frames needs to be generated.
487      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
488     uint8_t num_of_burst;
489 
490     /* num of frames in one batch.
491      * only valid when streaming_mode = CAM_STREAMING_MODE_BATCH */
492     cam_stream_user_buf_info_t user_buf_info;
493 
494     /* stream specific pp config */
495     cam_pp_feature_config_t pp_config;
496 
497     /* this section is valid if offline reprocess type stream */
498     cam_stream_reproc_config_t reprocess_config;
499 
500     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
501 
502     uint8_t dis_enable;
503 
504     /* Image Stabilization type */
505     cam_is_type_t is_type;
506 
507     /* Signifies Secure stream mode */
508     cam_stream_secure_t is_secure;
509 
510     /* Preferred Performance mode */
511     cam_perf_mode_t perf_mode;
512 
513     /* if frames will not be received */
514     uint8_t noFrameExpected;
515 } cam_stream_info_t;
516 
517 /*****************************************************************************
518  *                 Code for Domain Socket Based Parameters                   *
519  ****************************************************************************/
520 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
521         DATATYPE member_variable_##PARAM_ID[ COUNT ]
522 
523 #define POINTER_OF_META(META_ID, TABLE_PTR) \
524         ((NULL != TABLE_PTR) ? \
525             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : (NULL))
526 
527 #define SIZE_OF_PARAM(META_ID, TABLE_PTR) \
528         sizeof(TABLE_PTR->data.member_variable_##META_ID)
529 
530 #define IF_META_AVAILABLE(META_TYPE, META_PTR_NAME, META_ID, TABLE_PTR) \
531         META_TYPE *META_PTR_NAME = \
532         (((NULL != TABLE_PTR) && (TABLE_PTR->is_valid[META_ID])) ? \
533             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : \
534             (NULL)); \
535         if (NULL != META_PTR_NAME) \
536 
537 #define ADD_SET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID, DATA) \
538     ((NULL != TABLE_PTR) ? \
539     ((TABLE_PTR->data.member_variable_##META_ID[ 0 ] = DATA), \
540     (TABLE_PTR->is_valid[META_ID] = 1), (0)) : \
541     ((ALOGE("%s: %d, Unable to set metadata TABLE_PTR:%p META_ID:%d", \
542     __func__, __LINE__, TABLE_PTR, META_ID)), (-1))) \
543 
544 #define ADD_SET_PARAM_ARRAY_TO_BATCH(TABLE_PTR, META_ID, PDATA, COUNT, RCOUNT) \
545 { \
546     if ((NULL != TABLE_PTR) && \
547             (0 < COUNT) && \
548             ((sizeof(TABLE_PTR->data.member_variable_##META_ID) / \
549             sizeof(TABLE_PTR->data.member_variable_##META_ID[ 0 ])) \
550             >= COUNT))  { \
551         for (size_t _i = 0; _i < COUNT ; _i++) { \
552             TABLE_PTR->data.member_variable_##META_ID[ _i ] = PDATA [ _i ]; \
553         } \
554         TABLE_PTR->is_valid[META_ID] = 1; \
555         RCOUNT = COUNT; \
556     } else { \
557         ALOGE("%s: %d, Unable to set metadata TABLE_PTR:%p META_ID:%d COUNT:%zu", \
558                 __func__, __LINE__, TABLE_PTR, META_ID, COUNT); \
559         RCOUNT = 0; \
560     } \
561 }
562 
563 #define ADD_GET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID) \
564 { \
565     if (NULL != TABLE_PTR) { \
566         TABLE_PTR->is_reqd[META_ID] = 1; \
567     } else { \
568         ALOGE("%s: %d, Unable to get metadata TABLE_PTR:%p META_ID:%d", \
569                 __func__, __LINE__, TABLE_PTR, META_ID); \
570     } \
571 }
572 
573 #define READ_PARAM_ENTRY(TABLE_PTR, META_ID, DATA) \
574 { \
575     if (NULL != TABLE_PTR) { \
576         DATA = TABLE_PTR->data.member_variable_##META_ID[ 0 ]; \
577     } else { \
578         ALOGE("%s: %d, Unable to read metadata TABLE_PTR:%p META_ID:%d", \
579                 __func__, __LINE__, TABLE_PTR, META_ID); \
580     } \
581 }
582 
583 typedef struct {
584 /**************************************************************************************
585  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
586  **************************************************************************************/
587     /* common between HAL1 and HAL3 */
588     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,               1);
589     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,      1);
590     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,          1);
591     INCLUDE(CAM_INTF_META_CDS_DATA,                     cam_cds_data_t,                 1);
592     INCLUDE(CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,           uint32_t,                       1);
593 
594     /* Specific to HAl1 */
595     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,                1);
596     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                        1);
597     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,          1);
598     INCLUDE(CAM_INTF_META_ASD_HDR_SCENE_DATA,           cam_asd_hdr_scene_data_t,       1);
599     INCLUDE(CAM_INTF_META_ASD_SCENE_TYPE,               int32_t,                        1);
600     INCLUDE(CAM_INTF_META_CURRENT_SCENE,                cam_scene_mode_type,            1);
601     INCLUDE(CAM_INTF_META_AWB_INFO,                     cam_awb_params_t,               1);
602     INCLUDE(CAM_INTF_META_FOCUS_POSITION,               cam_focus_pos_info_t,           1);
603     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ISP,           cam_chromatix_lite_isp_t,       1);
604     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_PP,            cam_chromatix_lite_pp_t,        1);
605     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AE,            cam_chromatix_lite_ae_stats_t,  1);
606     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AWB,           cam_chromatix_lite_awb_stats_t, 1);
607     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AF,            cam_chromatix_lite_af_stats_t,  1);
608     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ASD,           cam_chromatix_lite_asd_stats_t, 1);
609     INCLUDE(CAM_INTF_BUF_DIVERT_INFO,                   cam_buf_divert_info_t,          1);
610 
611     /* Specific to HAL3 */
612     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
613     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,    int32_t,                     1);
614     INCLUDE(CAM_INTF_META_FRAME_DROPPED,                cam_frame_dropped_t,         1);
615     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
616     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER,          uint32_t,                    1);
617     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint32_t,                    1);
618     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
619     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
620     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
621     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
622     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  1);
623     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint32_t,                    1);
624     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint32_t,                    1);
625     INCLUDE(CAM_INTF_PARM_MANUAL_FOCUS_POS,             cam_manual_focus_parm_t,     1);
626     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  1);
627     INCLUDE(CAM_INTF_META_AF_STATE,                     uint32_t,                    1);
628     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
629     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
630     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
631     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
632     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
633     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
634     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint32_t,                    1);
635     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
636     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint32_t,                    1);
637     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
638     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint32_t,                    1);
639     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
640     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
641     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
642     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
643     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
644     INCLUDE(CAM_INTF_META_LENS_STATE,                   cam_af_lens_state_t,         1);
645     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
646     INCLUDE(CAM_INTF_META_VIDEO_STAB_MODE,              uint32_t,                    1);
647     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint32_t,                    1);
648     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint32_t,                    1);
649     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH,     uint32_t,                    1);
650     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
651     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint32_t,                    1);
652     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
653     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
654     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
655     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             int64_t,                     1);
656     INCLUDE(CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,  int64_t,                     1);
657     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint32_t,                    1);
658     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint32_t,                    1);
659     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint32_t,                    1);
660     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint32_t,                    1);
661     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
662     INCLUDE(CAM_INTF_META_TONEMAP_CURVES,               cam_rgb_tonemap_curves,      1);
663     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
664     INCLUDE(CAM_INTF_META_AEC_INFO,                     cam_3a_params_t,             1);
665     INCLUDE(CAM_INTF_META_SENSOR_INFO,                  cam_sensor_params_t,         1);
666     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AE,                cam_ae_exif_debug_t,         1);
667     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AWB,               cam_awb_exif_debug_t,        1);
668     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AF,                cam_af_exif_debug_t,         1);
669     INCLUDE(CAM_INTF_META_EXIF_DEBUG_ASD,               cam_asd_exif_debug_t,        1);
670     INCLUDE(CAM_INTF_META_EXIF_DEBUG_STATS,             cam_stats_buffer_exif_debug_t, 1);
671     INCLUDE(CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,       cam_auto_scene_t,            1);
672     INCLUDE(CAM_INTF_PARM_EFFECT,                       uint32_t,                    1);
673     /* Defining as int32_t so that this array is 4 byte aligned */
674     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 int32_t,
675             MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES / 4);
676 
677     /* Following are Params only and not metadata currently */
678     INCLUDE(CAM_INTF_PARM_HAL_VERSION,                  int32_t,                     1);
679     /* Shared between HAL1 and HAL3 */
680     INCLUDE(CAM_INTF_PARM_ANTIBANDING,                  uint32_t,                    1);
681     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,        int32_t,                     1);
682     INCLUDE(CAM_INTF_PARM_EV_STEP,                      cam_rational_type_t,         1);
683     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                     uint32_t,                    1);
684     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                    cam_fps_range_t,             1);
685     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                     uint32_t,                    1);
686     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,                uint32_t,                    1);
687     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,                   int32_t,                     1);
688     INCLUDE(CAM_INTF_PARM_LED_MODE,                     int32_t,                     1);
689     INCLUDE(CAM_INTF_META_LED_MODE_OVERRIDE,            uint32_t,                    1);
690 
691     /* HAL1 specific */
692     /* read only */
693     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,             int32_t,                     1);
694     INCLUDE(CAM_INTF_PARM_EXPOSURE,                     int32_t,                     1);
695     INCLUDE(CAM_INTF_PARM_SHARPNESS,                    int32_t,                     1);
696     INCLUDE(CAM_INTF_PARM_CONTRAST,                     int32_t,                     1);
697     INCLUDE(CAM_INTF_PARM_SATURATION,                   int32_t,                     1);
698     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,                   int32_t,                     1);
699     INCLUDE(CAM_INTF_PARM_ISO,                          int32_t,                     1);
700     INCLUDE(CAM_INTF_PARM_EXPOSURE_TIME,                uint64_t,                    1);
701     INCLUDE(CAM_INTF_PARM_ZOOM,                         int32_t,                     1);
702     INCLUDE(CAM_INTF_PARM_ROLLOFF,                      int32_t,                     1);
703     INCLUDE(CAM_INTF_PARM_MODE,                         int32_t,                     1);
704     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,                int32_t,                     1);
705     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,              int32_t,                     1);
706     INCLUDE(CAM_INTF_PARM_AEC_ROI,                      cam_set_aec_roi_t,           1);
707     INCLUDE(CAM_INTF_PARM_AF_ROI,                       cam_roi_info_t,              1);
708     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,                   int32_t,                     1);
709     INCLUDE(CAM_INTF_PARM_FD,                           cam_fd_set_parm_t,           1);
710     INCLUDE(CAM_INTF_PARM_MCE,                          int32_t,                     1);
711     INCLUDE(CAM_INTF_PARM_HFR,                          int32_t,                     1);
712     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,             int32_t,                     1);
713     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,              cam_denoise_param_t,         1);
714     INCLUDE(CAM_INTF_PARM_TEMPORAL_DENOISE,             cam_denoise_param_t,         1);
715     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                    int32_t,                     1);
716     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,                   int32_t,                     1);
717     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,               int32_t,                     1);
718     INCLUDE(CAM_INTF_PARM_HDR,                          cam_exp_bracketing_t,        1);
719     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                    int32_t,                     1);
720     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                     int32_t,                     1);
721     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,                  int32_t,                     1);
722     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                     int32_t,                     1);
723     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                    int32_t,                     1);
724     INCLUDE(CAM_INTF_PARM_SENSOR_HDR,                   int32_t,                     1);
725     INCLUDE(CAM_INTF_PARM_VT,                           int32_t,                     1);
726     INCLUDE(CAM_INTF_PARM_GET_CHROMATIX,                tune_chromatix_t,            1);
727     INCLUDE(CAM_INTF_PARM_SET_RELOAD_CHROMATIX,         tune_chromatix_t,            1);
728     INCLUDE(CAM_INTF_PARM_GET_AFTUNE,                   tune_autofocus_t,            1);
729     INCLUDE(CAM_INTF_PARM_SET_RELOAD_AFTUNE,            tune_autofocus_t,            1);
730     INCLUDE(CAM_INTF_PARM_SET_AUTOFOCUSTUNING,          tune_actuator_t,             1);
731     INCLUDE(CAM_INTF_PARM_SET_VFE_COMMAND,              tune_cmd_t,                  1);
732     INCLUDE(CAM_INTF_PARM_SET_PP_COMMAND,               tune_cmd_t,                  1);
733     INCLUDE(CAM_INTF_PARM_MAX_DIMENSION,                cam_dimension_t,             1);
734     INCLUDE(CAM_INTF_PARM_RAW_DIMENSION,                cam_dimension_t,             1);
735     INCLUDE(CAM_INTF_PARM_TINTLESS,                     int32_t,                     1);
736     INCLUDE(CAM_INTF_PARM_WB_MANUAL,                    cam_manual_wb_parm_t,        1);
737     INCLUDE(CAM_INTF_PARM_CDS_MODE,                     int32_t,                     1);
738     INCLUDE(CAM_INTF_PARM_EZTUNE_CMD,                   cam_eztune_cmd_data_t,       1);
739     INCLUDE(CAM_INTF_PARM_INT_EVT,                      cam_int_evt_params_t,        1);
740     INCLUDE(CAM_INTF_PARM_RDI_MODE,                     int32_t,                     1);
741     INCLUDE(CAM_INTF_PARM_BURST_NUM,                    uint32_t,                    1);
742     INCLUDE(CAM_INTF_PARM_RETRO_BURST_NUM,              uint32_t,                    1);
743     INCLUDE(CAM_INTF_PARM_BURST_LED_ON_PERIOD,          uint32_t,                    1);
744     INCLUDE(CAM_INTF_PARM_LONGSHOT_ENABLE,              int8_t,                      1);
745     INCLUDE(CAM_INTF_PARM_TONE_MAP_MODE,                uint32_t,                    1);
746 
747     /* HAL3 specific */
748     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
749     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
750     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
751     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
752     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
753     INCLUDE(CAM_INTF_META_DEMOSAIC,                     int32_t,                     1);
754     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,           int32_t,                     1);
755     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,               uint32_t,                    1);
756     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,           uint32_t,                    1);
757     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
758     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
759     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
760     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
761     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
762     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
763     INCLUDE(CAM_INTF_PARM_FOCUS_BRACKETING,             cam_af_bracketing_t,         1);
764     INCLUDE(CAM_INTF_PARM_FLASH_BRACKETING,             cam_flash_bracketing_t,      1);
765     INCLUDE(CAM_INTF_META_JPEG_GPS_COORDINATES,         double,                      3);
766     INCLUDE(CAM_INTF_META_JPEG_GPS_PROC_METHODS,        uint8_t,                     GPS_PROCESSING_METHOD_SIZE);
767     INCLUDE(CAM_INTF_META_JPEG_GPS_TIMESTAMP,           int64_t,                     1);
768     INCLUDE(CAM_INTF_META_JPEG_ORIENTATION,             int32_t,                     1);
769     INCLUDE(CAM_INTF_META_JPEG_QUALITY,                 uint32_t,                    1);
770     INCLUDE(CAM_INTF_META_JPEG_THUMB_QUALITY,           uint32_t,                    1);
771     INCLUDE(CAM_INTF_META_JPEG_THUMB_SIZE,              cam_dimension_t,             1);
772     INCLUDE(CAM_INTF_META_TEST_PATTERN_DATA,            cam_test_pattern_data_t,     1);
773     INCLUDE(CAM_INTF_META_PROFILE_TONE_CURVE,           cam_profile_tone_curve,      1);
774     INCLUDE(CAM_INTF_META_OTP_WB_GRGB,                  float,                       1);
775     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
776     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
777     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
778     INCLUDE(CAM_INTF_META_IMGLIB,                       cam_intf_meta_imglib_t,      1);
779     INCLUDE(CAM_INTF_PARM_CAPTURE_FRAME_CONFIG,         cam_capture_frame_config_t,  1);
780     INCLUDE(CAM_INTF_PARM_FLIP,                         int32_t,                     1);
781     INCLUDE(CAM_INTF_META_USE_AV_TIMER,                 uint8_t,                     1);
782     INCLUDE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,    float,                       1);
783     INCLUDE(CAM_INTF_META_LDAF_EXIF,                    uint32_t,                    2);
784     INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,   cam_black_level_metadata_t,  1);
785     INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN,  cam_black_level_metadata_t,  1);
786 } metadata_data_t;
787 
788 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
789  * or removed from this structure */
790 typedef struct {
791     union{
792         /* Hash table of 'is valid' flags */
793         uint8_t         is_valid[CAM_INTF_PARM_MAX];
794 
795         /* Hash table of 'is required' flags for the GET PARAM */
796         uint8_t         is_reqd[CAM_INTF_PARM_MAX];
797     };
798     metadata_data_t data;
799     /*Tuning Data */
800     uint8_t is_tuning_params_valid;
801     tuning_params_t tuning_params;
802 
803     /* Mobicat Params */
804     uint8_t is_mobicat_aec_params_valid;
805     cam_3a_params_t mobicat_aec_params;
806 
807     /* Stats 3A Debug Params */
808     uint8_t is_statsdebug_ae_params_valid;
809     cam_ae_exif_debug_t statsdebug_ae_data;
810 
811     uint8_t is_statsdebug_awb_params_valid;
812     cam_awb_exif_debug_t statsdebug_awb_data;
813 
814     uint8_t is_statsdebug_af_params_valid;
815     cam_af_exif_debug_t statsdebug_af_data;
816 
817     uint8_t is_statsdebug_asd_params_valid;
818     cam_asd_exif_debug_t statsdebug_asd_data;
819 
820     uint8_t is_statsdebug_stats_params_valid;
821     cam_stats_buffer_exif_debug_t statsdebug_stats_buffer_data;
822 } metadata_buffer_t;
823 
824 typedef metadata_buffer_t parm_buffer_t;
825 
826 #ifdef  __cplusplus
827 extern "C" {
828 #endif
829 
830 /* Update this inline function when a new is_xxx_valid is added to
831  * or removed from metadata_buffer_t */
clear_metadata_buffer(metadata_buffer_t * meta)832 static inline void clear_metadata_buffer(metadata_buffer_t *meta)
833 {
834     memset(meta->is_valid, 0, CAM_INTF_PARM_MAX);
835     meta->is_tuning_params_valid = 0;
836     meta->is_mobicat_aec_params_valid = 0;
837     meta->is_statsdebug_ae_params_valid = 0;
838     meta->is_statsdebug_awb_params_valid = 0;
839     meta->is_statsdebug_af_params_valid = 0;
840     meta->is_statsdebug_asd_params_valid = 0;
841     meta->is_statsdebug_stats_params_valid = 0;
842 }
843 
844 #ifdef  __cplusplus
845 }
846 #endif
847 
848 #endif /* __QCAMERA_INTF_H__ */
849