cam_types.h revision 2dd2f652b9cdd9e1d3db1d4157e38756370d7409
1/* Copyright (c) 2012-2013, 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 24
39#define MAX_METADATA_PAYLOAD_SIZE 1024
40
41#define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
42#define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
43#define CEILING4(X)  (((X) + 0x0003) & 0xFFFC)
44#define CEILING2(X)  (((X) + 0x0001) & 0xFFFE)
45
46#define MAX_ZOOMS_CNT 64
47#define MAX_SIZES_CNT 24
48#define MAX_EXP_BRACKETING_LENGTH 32
49#define MAX_ROI 5
50#define MAX_STREAM_NUM_IN_BUNDLE 4
51#define MAX_NUM_STREAMS          8
52
53typedef enum {
54    CAM_HAL_V1 = 1,
55    CAM_HAL_V3 = 3
56} cam_hal_version_t;
57
58typedef enum {
59    CAM_STATUS_SUCCESS,       /* Operation Succeded */
60    CAM_STATUS_FAILED,        /* Failure in doing operation */
61    CAM_STATUS_INVALID_PARM,  /* Inavlid parameter provided */
62    CAM_STATUS_NOT_SUPPORTED, /* Parameter/operation not supported */
63    CAM_STATUS_ACCEPTED,      /* Parameter accepted */
64    CAM_STATUS_MAX,
65} cam_status_t;
66
67typedef enum {
68    CAM_POSITION_BACK,
69    CAM_POSITION_FRONT
70} cam_position_t;
71
72typedef enum {
73    CAM_FORMAT_JPEG = 0,
74    CAM_FORMAT_YUV_420_NV12 = 1,
75    CAM_FORMAT_YUV_420_NV21,
76    CAM_FORMAT_YUV_420_NV21_ADRENO,
77    CAM_FORMAT_YUV_420_YV12,
78    CAM_FORMAT_YUV_422_NV16,
79    CAM_FORMAT_YUV_422_NV61,
80
81    /* Please note below are the defintions for raw image.
82     * Any format other than raw image format should be declared
83     * before this line!!!!!!!!!!!!! */
84
85    /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */
86
87    /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV.
88     * U and V are interleaved with Y: YUYV or YVYV */
89    CAM_FORMAT_YUV_RAW_8BIT_YUYV,
90    CAM_FORMAT_YUV_RAW_8BIT_YVYU,
91    CAM_FORMAT_YUV_RAW_8BIT_UYVY,
92    CAM_FORMAT_YUV_RAW_8BIT_VYUY,
93
94    /* QCOM RAW formats where data is packed into 64bit word.
95     * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is
96     *       stored at LSB.
97     * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most
98     *       significant 4 bits are set to 0. P0 is stored at LSB.
99     * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most
100     *       significant 4 bits are set to 0. P0 is stored at LSB. */
101    CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG,
102    CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG,
103    CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB,
104    CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR,
105    CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG,
106    CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG,
107    CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB,
108    CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR,
109    CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG,
110    CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG,
111    CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB,
112    CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR,
113    /* MIPI RAW formats based on MIPI CSI-2 specifiction.
114     * 8BPP: Each pixel occupies one bytes, starting at LSB.
115     *       Output with of image has no restrictons.
116     * 10BPP: Four pixels are held in every 5 bytes. The output
117     *       with of image must be a multiple of 4 pixels.
118     * 12BPP: Two pixels are held in every 3 bytes. The output
119     *       width of image must be a multiple of 2 pixels. */
120    CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG,
121    CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG,
122    CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB,
123    CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR,
124    CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG,
125    CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG,
126    CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB,
127    CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR,
128    CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG,
129    CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG,
130    CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB,
131    CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR,
132    /* Ideal raw formats where image data has gone through black
133     * correction, lens rolloff, demux/channel gain, bad pixel
134     * correction, and ABF.
135     * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW
136     * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and
137     * plain 16 12bpp */
138    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG,
139    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG,
140    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB,
141    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR,
142    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG,
143    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG,
144    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB,
145    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR,
146    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG,
147    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG,
148    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB,
149    CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR,
150    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG,
151    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG,
152    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB,
153    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR,
154    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG,
155    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG,
156    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB,
157    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR,
158    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG,
159    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG,
160    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB,
161    CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR,
162    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG,
163    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG,
164    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB,
165    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR,
166    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG,
167    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG,
168    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB,
169    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR,
170    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG,
171    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG,
172    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB,
173    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR,
174    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG,
175    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG,
176    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB,
177    CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR,
178
179    /* generic 8-bit raw */
180    CAM_FORMAT_JPEG_RAW_8BIT,
181    CAM_FORMAT_META_RAW_8BIT,
182
183    CAM_FORMAT_MAX
184} cam_format_t;
185
186typedef enum {
187    /* applies to HAL 1 */
188    CAM_STREAM_TYPE_DEFAULT,       /* default stream type */
189    CAM_STREAM_TYPE_PREVIEW,       /* preview */
190    CAM_STREAM_TYPE_POSTVIEW,      /* postview */
191    CAM_STREAM_TYPE_SNAPSHOT,      /* snapshot */
192    CAM_STREAM_TYPE_VIDEO,         /* video */
193
194    /* applies to HAL 3 */
195    CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */
196    CAM_STREAM_TYPE_YUV,          /* app requested callback stream type */
197
198    /* applies to both HAL 1 and HAL 3 */
199    CAM_STREAM_TYPE_METADATA,      /* meta data */
200    CAM_STREAM_TYPE_RAW,           /* raw dump from camif */
201    CAM_STREAM_TYPE_OFFLINE_PROC,  /* offline process */
202    CAM_STREAM_TYPE_MAX,
203} cam_stream_type_t;
204
205typedef enum {
206    CAM_PAD_NONE = 1,
207    CAM_PAD_TO_2 = 2,
208    CAM_PAD_TO_4 = 4,
209    CAM_PAD_TO_WORD = CAM_PAD_TO_4,
210    CAM_PAD_TO_8 = 8,
211    CAM_PAD_TO_16 = 16,
212    CAM_PAD_TO_32 = 32,
213    CAM_PAD_TO_64 = 64,
214    CAM_PAD_TO_1K = 1024,
215    CAM_PAD_TO_2K = 2048,
216    CAM_PAD_TO_4K = 4096,
217    CAM_PAD_TO_8K = 8192
218} cam_pad_format_t;
219
220typedef enum {
221    /* followings are per camera */
222    CAM_MAPPING_BUF_TYPE_CAPABILITY,  /* mapping camera capability buffer */
223    CAM_MAPPING_BUF_TYPE_PARM_BUF,    /* mapping parameters buffer */
224
225    /* followings are per stream */
226    CAM_MAPPING_BUF_TYPE_STREAM_BUF,        /* mapping stream buffers */
227    CAM_MAPPING_BUF_TYPE_STREAM_INFO,       /* mapping stream information buffer */
228    CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */
229    CAM_MAPPING_BUF_TYPE_MAX
230} cam_mapping_buf_type;
231
232typedef struct {
233    cam_mapping_buf_type type;
234    uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
235    uint32_t frame_idx;   /* frame index: valid if type is STREAM_BUF */
236    int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
237                           * -1 means all planners shanre the same fd;
238                           * otherwise, each planner has its own fd */
239    unsigned long cookie; /* could be job_id(uint32_t) to identify mapping job */
240    int fd;               /* origin fd */
241    uint32_t size;        /* size of the buffer */
242} cam_buf_map_type;
243
244typedef struct {
245    cam_mapping_buf_type type;
246    uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
247    uint32_t frame_idx;   /* frame index: valid if STREAM_BUF or HIST_BUF */
248    int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
249                           * -1 means all planners shanre the same fd;
250                           * otherwise, each planner has its own fd */
251    unsigned long cookie; /* could be job_id(uint32_t) to identify unmapping job */
252} cam_buf_unmap_type;
253
254typedef enum {
255    CAM_MAPPING_TYPE_FD_MAPPING,
256    CAM_MAPPING_TYPE_FD_UNMAPPING,
257    CAM_MAPPING_TYPE_MAX
258} cam_mapping_type;
259
260typedef struct {
261    cam_mapping_type msg_type;
262    union {
263        cam_buf_map_type buf_map;
264        cam_buf_unmap_type buf_unmap;
265    } payload;
266} cam_sock_packet_t;
267
268typedef enum {
269    CAM_MODE_2D = (1<<0),
270    CAM_MODE_3D = (1<<1)
271} cam_mode_t;
272
273typedef struct {
274    uint32_t len;
275    uint32_t y_offset;
276    uint32_t cbcr_offset;
277} cam_sp_len_offset_t;
278
279typedef struct{
280    uint32_t len;
281    uint32_t offset;
282    int32_t offset_x;
283    int32_t offset_y;
284    int32_t stride;
285    int32_t scanline;
286} cam_mp_len_offset_t;
287
288typedef struct {
289    uint32_t width_padding;
290    uint32_t height_padding;
291    uint32_t plane_padding;
292} cam_padding_info_t;
293
294typedef struct {
295    int num_planes;
296    union {
297        cam_sp_len_offset_t sp;
298        cam_mp_len_offset_t mp[VIDEO_MAX_PLANES];
299    };
300    uint32_t frame_len;
301} cam_frame_len_offset_t;
302
303typedef struct {
304    int32_t width;
305    int32_t height;
306} cam_dimension_t;
307
308typedef struct {
309    cam_frame_len_offset_t plane_info;
310} cam_stream_buf_plane_info_t;
311
312typedef struct {
313    float min_fps;
314    float max_fps;
315} cam_fps_range_t;
316
317typedef enum {
318    CAM_HFR_MODE_OFF,
319    CAM_HFR_MODE_60FPS,
320    CAM_HFR_MODE_90FPS,
321    CAM_HFR_MODE_120FPS,
322    CAM_HFR_MODE_150FPS,
323    CAM_HFR_MODE_MAX
324} cam_hfr_mode_t;
325
326typedef struct {
327    cam_hfr_mode_t mode;
328    cam_dimension_t dim;
329    uint8_t frame_skip;
330    uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table size */
331    cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
332} cam_hfr_info_t;
333
334typedef enum {
335    CAM_WB_MODE_OFF,
336    CAM_WB_MODE_AUTO,
337    CAM_WB_MODE_CUSTOM,
338    CAM_WB_MODE_INCANDESCENT,
339    CAM_WB_MODE_FLUORESCENT,
340    CAM_WB_MODE_WARM_FLUORESCENT,
341    CAM_WB_MODE_DAYLIGHT,
342    CAM_WB_MODE_CLOUDY_DAYLIGHT,
343    CAM_WB_MODE_TWILIGHT,
344    CAM_WB_MODE_SHADE,
345    CAM_WB_MODE_MAX
346} cam_wb_mode_type;
347
348typedef enum {
349    CAM_ANTIBANDING_MODE_OFF,
350    CAM_ANTIBANDING_MODE_60HZ,
351    CAM_ANTIBANDING_MODE_50HZ,
352    CAM_ANTIBANDING_MODE_AUTO,
353    CAM_ANTIBANDING_MODE_AUTO_50HZ,
354    CAM_ANTIBANDING_MODE_AUTO_60HZ,
355    CAM_ANTIBANDING_MODE_MAX,
356} cam_antibanding_mode_type;
357
358/* Enum Type for different ISO Mode supported */
359typedef enum {
360    CAM_ISO_MODE_AUTO,
361    CAM_ISO_MODE_DEBLUR,
362    CAM_ISO_MODE_100,
363    CAM_ISO_MODE_200,
364    CAM_ISO_MODE_400,
365    CAM_ISO_MODE_800,
366    CAM_ISO_MODE_1600,
367    CAM_ISO_MODE_MAX
368} cam_iso_mode_type;
369
370typedef enum {
371    CAM_AEC_MODE_OFF,
372    CAM_AEC_MODE_FRAME_AVERAGE,
373    CAM_AEC_MODE_CENTER_WEIGHTED,
374    CAM_AEC_MODE_SPOT_METERING,
375    CAM_AEC_MODE_SMART_METERING,
376    CAM_AEC_MODE_USER_METERING,
377    CAM_AEC_MODE_SPOT_METERING_ADV,
378    CAM_AEC_MODE_CENTER_WEIGHTED_ADV,
379    CAM_AEC_MODE_MAX
380} cam_auto_exposure_mode_type;
381
382typedef enum {
383    CAM_AE_MODE_OFF,
384    CAM_AE_MODE_ON,
385    CAM_AE_MODE_ON_AUTO_FLASH,
386    CAM_AE_MODE_ON_ALWAYS_FLASH,
387    CAM_AE_MODE_ON_AUTO_FLASH_REDEYE,
388    CAM_AE_MODE_MAX
389} cam_ae_mode_type;
390
391typedef enum {
392    CAM_FOCUS_MODE_OFF,
393    CAM_FOCUS_ALGO_AUTO,
394    CAM_FOCUS_ALGO_SPOT,
395    CAM_FOCUS_ALGO_CENTER_WEIGHTED,
396    CAM_FOCUS_ALGO_AVERAGE,
397    CAM_FOCUS_ALGO_MAX
398} cam_focus_algorithm_type;
399
400/* Auto focus mode */
401typedef enum {
402    CAM_FOCUS_MODE_AUTO,
403    CAM_FOCUS_MODE_INFINITY,
404    CAM_FOCUS_MODE_MACRO,
405    CAM_FOCUS_MODE_FIXED,
406    CAM_FOCUS_MODE_EDOF,
407    CAM_FOCUS_MODE_CONTINOUS_VIDEO,
408    CAM_FOCUS_MODE_CONTINOUS_PICTURE,
409    CAM_FOCUS_MODE_MAX
410} cam_focus_mode_type;
411
412typedef enum {
413    CAM_SCENE_MODE_OFF,
414    CAM_SCENE_MODE_AUTO,
415    CAM_SCENE_MODE_LANDSCAPE,
416    CAM_SCENE_MODE_SNOW,
417    CAM_SCENE_MODE_BEACH,
418    CAM_SCENE_MODE_SUNSET,
419    CAM_SCENE_MODE_NIGHT,
420    CAM_SCENE_MODE_PORTRAIT,
421    CAM_SCENE_MODE_BACKLIGHT,
422    CAM_SCENE_MODE_SPORTS,
423    CAM_SCENE_MODE_ANTISHAKE,
424    CAM_SCENE_MODE_FLOWERS,
425    CAM_SCENE_MODE_CANDLELIGHT,
426    CAM_SCENE_MODE_FIREWORKS,
427    CAM_SCENE_MODE_PARTY,
428    CAM_SCENE_MODE_NIGHT_PORTRAIT,
429    CAM_SCENE_MODE_THEATRE,
430    CAM_SCENE_MODE_ACTION,
431    CAM_SCENE_MODE_AR,
432    CAM_SCENE_MODE_FACE_PRIORITY,
433    CAM_SCENE_MODE_BARCODE,
434    CAM_SCENE_MODE_MAX
435} cam_scene_mode_type;
436
437typedef enum {
438    CAM_EFFECT_MODE_OFF,
439    CAM_EFFECT_MODE_MONO,
440    CAM_EFFECT_MODE_NEGATIVE,
441    CAM_EFFECT_MODE_SOLARIZE,
442    CAM_EFFECT_MODE_SEPIA,
443    CAM_EFFECT_MODE_POSTERIZE,
444    CAM_EFFECT_MODE_WHITEBOARD,
445    CAM_EFFECT_MODE_BLACKBOARD,
446    CAM_EFFECT_MODE_AQUA,
447    CAM_EFFECT_MODE_EMBOSS,
448    CAM_EFFECT_MODE_SKETCH,
449    CAM_EFFECT_MODE_NEON,
450    CAM_EFFECT_MODE_MAX
451} cam_effect_mode_type;
452
453typedef enum {
454    CAM_FLASH_MODE_OFF,
455    CAM_FLASH_MODE_AUTO,
456    CAM_FLASH_MODE_ON,
457    CAM_FLASH_MODE_TORCH,
458    CAM_FLASH_MODE_MAX
459} cam_flash_mode_t;
460
461typedef enum {
462    CAM_AEC_TRIGGER_IDLE,
463    CAM_AEC_TRIGGER_START
464} cam_aec_trigger_type_t;
465
466typedef enum {
467    CAM_AF_TRIGGER_IDLE,
468    CAM_AF_TRIGGER_START,
469    CAM_AF_TRIGGER_CANCEL
470} cam_af_trigger_type_t;
471
472typedef enum {
473    CAM_AE_STATE_INACTIVE,
474    CAM_AE_STATE_SEARCHING,
475    CAM_AE_STATE_CONVERGED,
476    CAM_AE_STATE_LOCKED,
477    CAM_AE_STATE_FLASH_REQUIRED,
478    CAM_AE_STATE_PRECAPTURE
479} cam_ae_state_t;
480
481typedef struct  {
482    int32_t left;
483    int32_t top;
484    int32_t width;
485    int32_t height;
486} cam_rect_t;
487
488typedef struct  {
489    cam_rect_t rect;
490    int32_t weight; /* weight of the area, valid for focusing/metering areas */
491} cam_area_t;
492
493typedef enum {
494    CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */
495    CAM_STREAMING_MODE_BURST,      /* burst streaming */
496    CAM_STREAMING_MODE_MAX
497} cam_streaming_mode_t;
498
499#define CAM_REPROCESS_MASK_TYPE_WNR (1<<0)
500
501/* event from server */
502typedef enum {
503    CAM_EVENT_TYPE_MAP_UNMAP_DONE  = (1<<0),
504    CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1),
505    CAM_EVENT_TYPE_ZOOM_DONE       = (1<<2),
506    CAM_EVENT_TYPE_DAEMON_DIED     = (1<<3),
507    CAM_EVENT_TYPE_MAX
508} cam_event_type_t;
509
510typedef enum {
511    CAM_EXP_BRACKETING_OFF,
512    CAM_EXP_BRACKETING_ON
513} cam_bracket_mode;
514
515typedef struct {
516    cam_bracket_mode mode;
517    char values[MAX_EXP_BRACKETING_LENGTH];  /* user defined values */
518} cam_exp_bracketing_t;
519
520typedef enum {
521    CAM_AEC_ROI_OFF,
522    CAM_AEC_ROI_ON
523} cam_aec_roi_ctrl_t;
524
525typedef enum {
526    CAM_AEC_ROI_BY_INDEX,
527    CAM_AEC_ROI_BY_COORDINATE,
528} cam_aec_roi_type_t;
529
530typedef struct {
531    uint32_t x;
532    uint32_t y;
533} cam_coordinate_type_t;
534
535typedef struct {
536    int32_t numerator;
537    int32_t denominator;
538} cam_rational_type_t;
539
540typedef struct {
541    cam_aec_roi_ctrl_t aec_roi_enable;
542    cam_aec_roi_type_t aec_roi_type;
543    union {
544        cam_coordinate_type_t coordinate[MAX_ROI];
545        uint32_t aec_roi_idx[MAX_ROI];
546    } cam_aec_roi_position;
547} cam_set_aec_roi_t;
548
549typedef struct {
550    uint32_t frm_id;
551    uint8_t num_roi;
552    cam_rect_t roi[MAX_ROI];
553    int32_t weight[MAX_ROI];
554    uint8_t is_multiwindow;
555} cam_roi_info_t;
556
557typedef enum {
558    CAM_WAVELET_DENOISE_YCBCR_PLANE,
559    CAM_WAVELET_DENOISE_CBCR_ONLY,
560    CAM_WAVELET_DENOISE_STREAMLINE_YCBCR,
561    CAM_WAVELET_DENOISE_STREAMLINED_CBCR
562} cam_denoise_process_type_t;
563
564typedef struct {
565    int denoise_enable;
566    cam_denoise_process_type_t process_plates;
567} cam_denoise_param_t;
568
569#define CAM_FACE_PROCESS_MASK_DETECTION    (1<<0)
570#define CAM_FACE_PROCESS_MASK_RECOGNITION  (1<<1)
571typedef struct {
572    int fd_mode;               /* mask of face process */
573    int num_fd;
574} cam_fd_set_parm_t;
575
576typedef struct {
577    int8_t face_id;            /* unique id for face tracking within view unless view changes */
578    int8_t score;              /* score of confidence (0, -100) */
579    cam_rect_t face_boundary;  /* boundary of face detected */
580    cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
581    cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
582    cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
583    uint8_t smile_degree;      /* smile degree (0, -100) */
584    uint8_t smile_confidence;  /* smile confidence (0, 100) */
585    uint8_t face_recognised;   /* if face is recognised */
586    int8_t gaze_angle;         /* -90 -45 0 45 90 for head left to rigth tilt */
587    int8_t updown_dir;         /* up down direction (-90, 90) */
588    int8_t leftright_dir;      /* left right direction (-90, 90) */
589    int8_t roll_dir;           /* roll direction (-90, 90) */
590    int8_t left_right_gaze;    /* left right gaze degree (-50, 50) */
591    int8_t top_bottom_gaze;    /* up down gaze degree (-50, 50) */
592    uint8_t blink_detected;    /* if blink is detected */
593    uint8_t left_blink;        /* left eye blink degeree (0, -100) */
594    uint8_t right_blink;       /* right eye blink degree (0, - 100) */
595} cam_face_detection_info_t;
596
597typedef struct {
598    uint32_t frame_id;                         /* frame index of which faces are detected */
599    uint8_t num_faces_detected;                /* number of faces detected */
600    cam_face_detection_info_t faces[MAX_ROI];  /* detailed information of faces detected */
601} cam_face_detection_data_t;
602
603#define CAM_HISTOGRAM_STATS_SIZE 256
604typedef struct {
605    uint32_t max_hist_value;
606    uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */
607} cam_histogram_data_t;
608
609typedef struct {
610    cam_histogram_data_t r_stats;
611    cam_histogram_data_t b_stats;
612    cam_histogram_data_t gr_stats;
613    cam_histogram_data_t gb_stats;
614} cam_bayer_hist_stats_t;
615
616typedef enum {
617    CAM_HISTOGRAM_TYPE_BAYER,
618    CAM_HISTOGRAM_TYPE_YUV
619} cam_histogram_type_t;
620
621typedef struct {
622    cam_histogram_type_t type;
623    union {
624        cam_bayer_hist_stats_t bayer_stats;
625        cam_histogram_data_t yuv_stats;
626    };
627} cam_hist_stats_t;
628
629enum cam_focus_distance_index{
630  CAM_FOCUS_DISTANCE_NEAR_INDEX,  /* 0 */
631  CAM_FOCUS_DISTANCE_OPTIMAL_INDEX,
632  CAM_FOCUS_DISTANCE_FAR_INDEX,
633  CAM_FOCUS_DISTANCE_MAX_INDEX
634};
635
636typedef struct {
637  float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX];
638} cam_focus_distances_info_t;
639
640/* Different autofocus cycle when calling do_autoFocus
641 * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep
642 * if one is ongoing, and lock.
643 * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless
644 * of the current state, and lock.
645 * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep.
646 * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED,
647 * or CAM_AF_NOT_FOCUSED.
648 * cancel_autoFocus stops any lens movement.
649 * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED
650 * event, not both.
651 */
652typedef enum {
653    CAM_AF_COMPLETE_EXISTING_SWEEP,
654    CAM_AF_DO_ONE_FULL_SWEEP,
655    CAM_AF_START_CONTINUOUS_SWEEP
656} cam_autofocus_cycle_t;
657
658typedef enum {
659    CAM_AF_SCANNING,
660    CAM_AF_FOCUSED,
661    CAM_AF_NOT_FOCUSED
662} cam_autofocus_state_t;
663
664typedef struct {
665    cam_autofocus_state_t focus_state;           /* state of focus */
666    cam_focus_distances_info_t focus_dist;       /* focus distance */
667} cam_auto_focus_data_t;
668
669typedef struct {
670    uint32_t stream_id;
671    cam_rect_t crop;
672} cam_stream_crop_info_t;
673
674typedef struct {
675    uint8_t num_of_streams;
676    cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS];
677} cam_crop_data_t;
678
679typedef enum {
680    DO_NOT_NEED_FUTURE_FRAME,
681    NEED_FUTURE_FRAME,
682} cam_prep_snapshot_state_t;
683
684typedef struct {
685    uint32_t min_frame_idx;
686    uint32_t max_frame_idx;
687} cam_frame_idx_range_t;
688
689typedef  struct {
690    uint8_t is_stats_valid;               /* if histgram data is valid */
691    cam_hist_stats_t stats_data;          /* histogram data */
692
693    uint8_t is_faces_valid;               /* if face detection data is valid */
694    cam_face_detection_data_t faces_data; /* face detection result */
695
696    uint8_t is_focus_valid;               /* if focus data is valid */
697    cam_auto_focus_data_t focus_data;     /* focus data */
698
699    uint8_t is_crop_valid;                /* if crop data is valid */
700    cam_crop_data_t crop_data;            /* crop data */
701
702    uint8_t is_prep_snapshot_done_valid;  /* if prep snapshot done is valid */
703    cam_prep_snapshot_state_t prep_snapshot_done_state;  /* prepare snapshot done state */
704
705    /* if good frame idx range is valid */
706    uint8_t is_good_frame_idx_range_valid;
707    /* good frame idx range, make sure:
708     * 1. good_frame_idx_range.min_frame_idx > current_frame_idx
709     * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */
710    cam_frame_idx_range_t good_frame_idx_range;
711
712    char private_metadata[MAX_METADATA_PAYLOAD_SIZE];
713
714} cam_metadata_info_t;
715
716typedef enum {
717    CAM_INTF_PARM_HAL_VERSION,
718    /* common between HAL1 and HAL3 */
719    CAM_INTF_PARM_ANTIBANDING,
720    CAM_INTF_PARM_EXPOSURE_COMPENSATION,
721    CAM_INTF_PARM_AEC_LOCK,
722    CAM_INTF_PARM_FPS_RANGE,
723    CAM_INTF_PARM_AWB_LOCK,
724    CAM_INTF_PARM_WHITE_BALANCE,
725    CAM_INTF_PARM_EFFECT,
726    CAM_INTF_PARM_BESTSHOT_MODE,
727    CAM_INTF_PARM_DIS_ENABLE,
728    CAM_INTF_PARM_LED_MODE,
729    CAM_INTF_META_HISTOGRAM, /* 10 */
730    CAM_INTF_META_FACE_DETECTION,
731    CAM_INTF_META_AUTOFOCUS_DATA,
732
733    /* specific to HAl1 */
734    CAM_INTF_PARM_QUERY_FLASH4SNAP,
735    CAM_INTF_PARM_EXPOSURE,
736    CAM_INTF_PARM_SHARPNESS,
737    CAM_INTF_PARM_CONTRAST,
738    CAM_INTF_PARM_SATURATION,
739    CAM_INTF_PARM_BRIGHTNESS,
740    CAM_INTF_PARM_ISO,
741    CAM_INTF_PARM_ZOOM, /* 20 */
742    CAM_INTF_PARM_ROLLOFF,
743    CAM_INTF_PARM_MODE,             /* camera mode */
744    CAM_INTF_PARM_AEC_ALGO_TYPE,    /* auto exposure algorithm */
745    CAM_INTF_PARM_FOCUS_ALGO_TYPE,  /* focus algorithm */
746    CAM_INTF_PARM_AEC_ROI,
747    CAM_INTF_PARM_AF_ROI,
748    CAM_INTF_PARM_FOCUS_MODE,
749    CAM_INTF_PARM_SCE_FACTOR,
750    CAM_INTF_PARM_FD,
751    CAM_INTF_PARM_MCE, /* 30 */
752    CAM_INTF_PARM_HFR,
753    CAM_INTF_PARM_REDEYE_REDUCTION,
754    CAM_INTF_PARM_WAVELET_DENOISE,
755    CAM_INTF_PARM_HISTOGRAM,
756    CAM_INTF_PARM_ASD_ENABLE,
757    CAM_INTF_PARM_RECORDING_HINT,
758    CAM_INTF_PARM_HDR,
759    CAM_INTF_PARM_FRAMESKIP,
760    CAM_INTF_PARM_ZSL_MODE,  /* indicating if it's running in ZSL mode */
761    CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */ /* 40 */
762    CAM_INTF_PARM_LOCK_CAF,
763    CAM_INTF_PARM_VIDEO_HDR,
764    CAM_INTF_PARM_ROTATION,
765    CAM_INTF_META_CROP_DATA,
766    CAM_INTF_META_PREP_SNAPSHOT_DONE,
767    CAM_INTF_META_GOOD_FRAME_IDX_RANGE,
768
769    /* stream based parameters */
770    CAM_INTF_PARM_DO_REPROCESS,
771    CAM_INTF_PARM_SET_BUNDLE,
772
773    /* specific to HAL3 */
774    /* Whether the metadata maps to a valid frame number */
775    CAM_INTF_META_FRAME_NUMBER_VALID,
776    /* COLOR CORRECTION.*/
777    CAM_INTF_META_COLOR_CORRECT_MODE,
778    /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931)
779     * color space from the scene illuminant to the sRGB-standard D65-illuminant. */
780    CAM_INTF_META_COLOR_CORRECT_TRANSFORM, /* 50 */
781    /* CONTROL */
782//    CAM_INTF_META_REQUEST_ID,
783    /* A frame counter set by the framework. Must be maintained unchanged in
784     * output frame. */
785    CAM_INTF_META_FRAME_NUMBER,
786    /* Whether AE is currently updating the sensor exposure and sensitivity
787     * fields */
788    CAM_INTF_META_AEC_MODE,
789    /* List of areas to use for metering */
790    CAM_INTF_META_AEC_ROI,
791    /* Whether the HAL must trigger precapture metering.*/
792    CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,
793    /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */
794    CAM_INTF_META_AEC_PRECAPTURE_ID,
795    /* Current state of AE algorithm */
796    CAM_INTF_META_AEC_STATE,
797    /* List of areas to use for focus estimation */
798    CAM_INTF_META_AF_ROI,
799    /* Whether the HAL must trigger autofocus. */
800    CAM_INTF_META_AF_TRIGGER,
801    /* Current state of AF algorithm */
802    CAM_INTF_META_AF_STATE,
803    /* The ID sent with the latest CAMERA2_TRIGGER_AUTOFOCUS call */
804    CAM_INTF_META_AF_TRIGGER_ID,
805    /* List of areas to use for illuminant estimation */
806    CAM_INTF_META_AWB_REGIONS,
807    /* Current state of AWB algorithm */
808    CAM_INTF_META_AWB_STATE,
809    /* Information to 3A routines about the purpose of this capture, to help
810     * decide optimal 3A strategy */
811    CAM_INTF_META_CAPTURE_INTENT,
812    /* Overall mode of 3A control routines. We need to have this parameter
813     * because not all android.control.* have an OFF option, for example,
814     * AE_FPS_Range, aePrecaptureTrigger */
815    CAM_INTF_META_MODE,
816    /* DEMOSAIC */
817    /* Controls the quality of the demosaicing processing */
818    CAM_INTF_META_DEMOSAIC,
819    /* EDGE */
820    /* Operation mode for edge enhancement */
821    CAM_INTF_META_EDGE,
822    /* Control the amount of edge enhancement applied to the images.*/
823    /* 1-10; 10 is maximum sharpening */
824    CAM_INTF_META_SHARPNESS_STRENGTH,
825    /* FLASH */
826    /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */
827    CAM_INTF_META_FLASH_POWER,
828    /* Firing time of flash relative to start of exposure, in nanoseconds*/
829    CAM_INTF_META_FLASH_FIRING_TIME,
830    /* Current state of the flash unit */
831    CAM_INTF_META_FLASH_STATE,
832    /* GEOMETRIC */
833    /* Operating mode of geometric correction */
834    CAM_INTF_META_GEOMETRIC_MODE,
835    /* Control the amount of shading correction applied to the images */
836    CAM_INTF_META_GEOMETRIC_STRENGTH,
837    /* HOT PIXEL */
838    /* Set operational mode for hot pixel correction */
839    CAM_INTF_META_HOTPIXEL_MODE,
840    /* LENS */
841    /* Size of the lens aperture */
842    CAM_INTF_META_LENS_APERTURE,
843    /* State of lens neutral density filter(s) */
844    CAM_INTF_META_LENS_FILTERDENSITY,
845    /* Lens optical zoom setting */
846    CAM_INTF_META_LENS_FOCAL_LENGTH,
847    /* Distance to plane of sharpest focus, measured from frontmost surface
848     * of the lens */
849    CAM_INTF_META_LENS_FOCUS_DISTANCE,
850    /* The range of scene distances that are in sharp focus (depth of field) */
851    CAM_INTF_META_LENS_FOCUS_RANGE,
852    /* Whether optical image stabilization is enabled. */
853    CAM_INTF_META_LENS_OPT_STAB_MODE,
854    /* Current lens status */
855    CAM_INTF_META_LENS_STATE,
856    /* NOISE REDUCTION */
857    /* Mode of operation for the noise reduction algorithm */
858    CAM_INTF_META_NOISE_REDUCTION_MODE,
859   /* Control the amount of noise reduction applied to the images.
860    * 1-10; 10 is max noise reduction */
861    CAM_INTF_META_NOISE_REDUCTION_STRENGTH,
862    /* SCALER */
863    /* Top-left corner and width of the output region to select from the active
864     * pixel array */
865    CAM_INTF_META_SCALER_CROP_REGION,
866    /* SENSOR */
867    /* Duration each pixel is exposed to light, in nanoseconds */
868    CAM_INTF_META_SENSOR_EXPOSURE_TIME,
869    /* Duration from start of frame exposure to start of next frame exposure,
870     * in nanoseconds */
871    CAM_INTF_META_SENSOR_FRAME_DURATION,
872    /* Gain applied to image data. Must be implemented through analog gain only
873     * if set to values below 'maximum analog sensitivity'. */
874    CAM_INTF_META_SENSOR_SENSITIVITY,
875    /* Time at start of exposure of first row */
876    CAM_INTF_META_SENSOR_TIMESTAMP,
877    /* SHADING */
878    /* Quality of lens shading correction applied to the image data */
879    CAM_INTF_META_SHADING_MODE,
880    /* Control the amount of shading correction applied to the images.
881     * unitless: 1-10; 10 is full shading compensation */
882    CAM_INTF_META_SHADING_STRENGTH,
883    /* STATISTICS */
884    /* State of the face detector unit */
885    CAM_INTF_META_STATS_FACEDETECT_MODE,
886    /* Operating mode for histogram generation */
887    CAM_INTF_META_STATS_HISTOGRAM_MODE,
888    /* Operating mode for sharpness map generation */
889    CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,
890    /* A 3-channel sharpness map, based on the raw sensor data,
891     * If only a monochrome sharpness map is supported, all channels
892     * should have the same data
893     */
894    CAM_INTF_META_STATS_SHARPNESS_MAP,
895
896    /* TONEMAP */
897    /* Table mapping blue input values to output values */
898    CAM_INTF_META_TONEMAP_CURVE_BLUE,
899    /* Table mapping green input values to output values */
900    CAM_INTF_META_TONEMAP_CURVE_GREEN,
901    /* Table mapping red input values to output values */
902    CAM_INTF_META_TONEMAP_CURVE_RED,
903    /* Tone map mode */
904    CAM_INTF_META_TONEMAP_MODE,
905    CAM_INTF_META_PRIVATE_DATA,
906    CAM_INTF_PARM_MAX
907} cam_intf_parm_type_t;
908
909/*****************************************************************************
910 *                 Code for HAL3 data types                                  *
911 ****************************************************************************/
912typedef enum {
913    CAM_INTF_METADATA_MAX
914} cam_intf_metadata_type_t;
915
916typedef enum {
917    CAM_INTENT_CUSTOM,
918    CAM_INTENT_PREVIEW,
919    CAM_INTENT_STILL_CAPTURE,
920    CAM_INTENT_VIDEO_RECORD,
921    CAM_INTENT_VIDEO_SNAPSHOT,
922    CAM_INTENT_ZERO_SHUTTER_LAG,
923    CAM_INTENT_MAX,
924} cam_intent_t;
925
926typedef enum {
927    /* Full application control of pipeline. All 3A routines are disabled,
928     * no other settings in android.control.* have any effect */
929    CAM_CONTROL_OFF,
930    /* Use settings for each individual 3A routine. Manual control of capture
931     * parameters is disabled. All controls in android.control.* besides sceneMode
932     * take effect */
933    CAM_CONTROL_AUTO,
934    /* Use specific scene mode. Enabling this disables control.aeMode,
935     * control.awbMode and control.afMode controls; the HAL must ignore those
936     * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode).
937     * Other control entries are still active. This setting can only be used if
938     * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this
939     * in HAL ?*/
940    CAM_CONTROL_USE_SCENE_MODE,
941    CAM_CONTROL_MAX
942} cam_control_mode_t;
943
944typedef enum {
945    /* Use the android.colorCorrection.transform matrix to do color conversion */
946    CAM_COLOR_CORRECTION_TRANSFORM_MATRIX,
947    /* Must not slow down frame rate relative to raw bayer output */
948    CAM_COLOR_CORRECTION_FAST,
949    /* Frame rate may be reduced by high quality */
950    CAM_COLOR_CORRECTION_HIGH_QUALITY,
951} cam_color_correct_mode_t;
952
953typedef struct {
954    /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */
955    float transform[3][3];
956} cam_color_correct_matrix_t;
957
958#define CAM_FOCAL_LENGTHS_MAX     1
959#define CAM_APERTURES_MAX         1
960#define CAM_FILTER_DENSITIES_MAX  1
961#define CAM_MAX_MAP_HEIGHT        6
962#define CAM_MAX_MAP_WIDTH         6
963
964#define CAM_MAX_TONEMAP_CURVE_SIZE    128
965
966typedef struct {
967    int tonemap_points_cnt;
968
969    /* A 1D array of pairs of floats.
970     * Mapping a 0-1 input range to a 0-1 output range.
971     * The input range must be monotonically increasing with N,
972     * and values between entries should be linearly interpolated.
973     * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0],
974     * then the input->output mapping for a few sample points would be:
975     * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */
976    float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2];
977} cam_tonemap_curve_t;
978
979typedef enum {
980    OFF,
981    FAST,
982    QUALITY,
983} cam_quality_preference_t;
984
985typedef struct {
986    uint8_t ae_mode;
987    uint8_t awb_mode;
988    uint8_t af_mode;
989} cam_scene_mode_overrides_t;
990
991typedef struct {
992    int32_t left;
993    int32_t top;
994    int32_t width;
995} cam_crop_region_t;
996
997typedef struct {
998    /* Estimated sharpness for each region of the input image.
999     * Normalized to be between 0 and maxSharpnessMapValue.
1000     * Higher values mean sharper (better focused) */
1001    int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT];
1002} cam_sharpness_map_t;
1003
1004typedef struct {
1005    int32_t min_value;
1006    int32_t max_value;
1007    int32_t def_value;
1008    int32_t step;
1009} cam_control_range_t;
1010
1011#define CAM_QCOM_FEATURE_FACE_DETECTION (1<<0)
1012#define CAM_QCOM_FEATURE_DENOISE2D      (1<<1)
1013#define CAM_QCOM_FEATURE_CROP           (1<<2)
1014#define CAM_QCOM_FEATURE_ROTATION       (1<<3)
1015#define CAM_QCOM_FEATURE_FLIP           (1<<4)
1016#define CAM_QCOM_FEATURE_HDR            (1<<5)
1017#define CAM_QCOM_FEATURE_REGISTER_FACE  (1<<6)
1018#define CAM_QCOM_FEATURE_SHARPNESS      (1<<7)
1019#define CAM_QCOM_FEATURE_VIDEO_HDR      (1<<8)
1020#define CAM_QCOM_FEATURE_CAC            (1<<9)
1021
1022// Counter clock wise
1023typedef enum {
1024    ROTATE_0 = 1<<0,
1025    ROTATE_90 = 1<<1,
1026    ROTATE_180 = 1<<2,
1027    ROTATE_270 = 1<<3,
1028} cam_rotation_t;
1029
1030typedef enum {
1031    FLIP_H = 1<<0,
1032    FLIP_V = 1<<1,
1033} cam_flip_t;
1034
1035typedef struct {
1036    uint32_t bundle_id;                            /* bundle id */
1037    uint8_t num_of_streams;                        /* number of streams in the bundle */
1038    uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */
1039} cam_bundle_config_t;
1040
1041typedef enum {
1042    CAM_ONLINE_REPROCESS_TYPE,    /* online reprocess, frames from running streams */
1043    CAM_OFFLINE_REPROCESS_TYPE,   /* offline reprocess, frames from external source */
1044} cam_reprocess_type_enum_t;
1045
1046typedef struct {
1047    /* reprocess feature mask */
1048    uint32_t feature_mask;
1049
1050    /* individual setting for features to be reprocessed */
1051    cam_denoise_param_t denoise2d;
1052    cam_rect_t input_crop;
1053    cam_rotation_t rotation;
1054    uint32_t flip;
1055    int32_t sharpness;
1056    int32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */
1057} cam_pp_feature_config_t;
1058
1059typedef struct {
1060    uint32_t input_stream_id;
1061    /* input source stream type */
1062    cam_stream_type_t input_stream_type;
1063} cam_pp_online_src_config_t;
1064
1065typedef struct {
1066    /* image format */
1067    cam_format_t input_fmt;
1068
1069    /* image dimension */
1070    cam_dimension_t input_dim;
1071
1072    /* buffer plane information, will be calc based on stream_type, fmt,
1073       dim, and padding_info(from stream config). Info including:
1074       offset_x, offset_y, stride, scanline, plane offset */
1075    cam_stream_buf_plane_info_t input_buf_planes;
1076
1077    /* number of input reprocess buffers */
1078    uint8_t num_of_bufs;
1079} cam_pp_offline_src_config_t;
1080
1081/* reprocess stream input configuration */
1082typedef struct {
1083    /* input source config */
1084    cam_reprocess_type_enum_t pp_type;
1085    union {
1086        cam_pp_online_src_config_t online;
1087        cam_pp_offline_src_config_t offline;
1088    };
1089
1090    /* pp feature config */
1091    cam_pp_feature_config_t pp_feature_config;
1092} cam_stream_reproc_config_t;
1093
1094typedef struct {
1095    uint8_t crop_enabled;
1096    cam_rect_t input_crop;
1097} cam_crop_param_t;
1098
1099typedef struct {
1100    uint8_t trigger;
1101    int32_t trigger_id;
1102} cam_trigger_t;
1103
1104typedef struct {
1105    cam_denoise_param_t denoise;
1106    cam_crop_param_t crop;
1107    uint32_t flip;     /* 0 means no flip */
1108    int32_t sharpness; /* 0 means no sharpness */
1109} cam_per_frame_pp_config_t;
1110
1111typedef enum {
1112    CAM_OPT_STAB_OFF,
1113    CAM_OPT_STAB_ON,
1114    CAM_OPT_STAB_MAX
1115} cam_optical_stab_modes_t;
1116
1117typedef enum {
1118    CAM_FILTER_ARRANGEMENT_RGGB,
1119    CAM_FILTER_ARRANGEMENT_GRBG,
1120    CAM_FILTER_ARRANGEMENT_GBRG,
1121    CAM_FILTER_ARRANGEMENT_BGGR,
1122
1123    /* Sensor is not Bayer; output has 3 16-bit values for each pixel,
1124     * instead of just 1 16-bit value per pixel.*/
1125    CAM_FILTER_ARRANGEMENT_RGB
1126} cam_color_filter_arrangement_t;
1127
1128typedef enum {
1129    CAM_AF_STATE_INACTIVE,
1130    CAM_AF_STATE_PASSIVE_SCAN,
1131    CAM_AF_STATE_PASSIVE_FOCUSED,
1132    CAM_AF_STATE_ACTIVE_SCAN,
1133    CAM_AF_STATE_FOCUSED_LOCKED,
1134    CAM_AF_STATE_NOT_FOCUSED_LOCKED
1135} cam_af_state_t;
1136
1137typedef enum {
1138    CAM_AWB_STATE_INACTIVE,
1139    CAM_AWB_STATE_SEARCHING,
1140    CAM_AWB_STATE_CONVERGED,
1141    CAM_AWB_STATE_LOCKED
1142} cam_awb_state_t;
1143
1144#endif /* __QCAMERA_TYPES_H__ */
1145