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