Tizen 2.1 base
[adaptation/intel_mfld/libmfldadvci-blackbay-bin.git] / devel / usr / include / libmfldadvci / ia_3a_types.h
1 /*
2 **
3 ** Copyright 2012, Intel Corporation
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17
18 #ifndef _IA_3A_TYPES_H_
19 #define _IA_3A_TYPES_H_
20
21 #include <stdint.h>
22 #include <stdbool.h>
23
24 #define INTEL_CAF
25 #define IA_3A_S15_16_FROM_FLOAT(n) ((n)*65536.0)
26 #define IA_3A_S15_16_FROM_INT(n)   ((n)<<16)
27 #define IA_3A_S15_16_TO_FLOAT(n)   ((n)/65536.0)
28
29 typedef int ia_3a_s15_16;
30
31 typedef enum {
32         ia_3a_status_okay,
33         ia_3a_status_error,
34         ia_3a_status_unknown
35 } ia_3a_status;
36
37 typedef struct {
38         int infinity;   /*!< AF-lib value for INF position */
39         int macro;      /*!< AF-lib value for Macro position*/
40 } ia_3a_af_lens_range;
41
42 typedef enum {
43         ia_3a_isp_mode_preview,
44         ia_3a_isp_mode_video,
45         ia_3a_isp_mode_capture,
46         ia_3a_isp_mode_continuous
47 } ia_3a_isp_mode;
48
49 /* This one will come form ia_css_types.h in the near future. */
50 struct ia_css_3a_output {
51         int ae_y;
52         int awb_cnt;
53         int awb_gr;
54         int awb_r;
55         int awb_b;
56         int awb_gb;
57         int af_hpf1;
58         int af_hpf2;
59 };
60
61 /* 3A execution mode */
62 typedef enum {
63         ia_3a_exec_mode_movie,
64         ia_3a_exec_mode_preview,
65         ia_3a_exec_mode_still,
66         ia_3a_exec_mode_continuous
67 } ia_3a_exec_mode;
68
69 typedef struct {
70         unsigned int  num_windows_x;
71         unsigned int  num_windows_y;
72         /* This array of weights covers the entire frame.
73            The size of this weight array is NumWindowsX x NumWindowsY */
74         unsigned int *weights;
75 } ia_3a_weight_map;
76
77 typedef struct {
78         int x_left;
79         int x_right;
80         int y_top;
81         int y_bottom;
82         int weight;
83 } ia_3a_window;
84
85 /* This enum is defined the same value as enum v4l2_colorfx */
86 typedef enum {
87         ia_3a_image_effect_none = 0,
88         ia_3a_image_effect_bw,
89         ia_3a_image_effect_sepia,
90         ia_3a_image_effect_negative
91 } ia_3a_image_effect;
92
93 /* Lens Status */
94 typedef enum {
95         ia_3a_af_lens_status_stop,
96         ia_3a_af_lens_status_move
97 } ia_3a_af_lens_status;
98
99 /* Home Position state */
100 typedef enum {
101         ia_3a_af_hp_status_incomplete, /* HP Undetected */
102         ia_3a_af_hp_status_complete,   /* HP Reached */
103         ia_3a_af_hp_status_error       /* HP Detection failure */
104 } ia_3a_af_hp_status;
105
106 /* Callback function types */
107 typedef ia_3a_status         (*ia_3a_af_cb_move_focus_position)(short pos);
108 typedef ia_3a_af_lens_status (*ia_3a_af_cb_get_focus_status)(void);
109 typedef bool                 (*ia_3a_af_cb_focus_req_ready)(void);
110 typedef ia_3a_af_hp_status   (*ia_3a_af_cb_get_hp_status)(void);
111
112 /* Individual module variation calibration data */
113 typedef struct {
114         void        *data;
115         unsigned int size;
116 } ia_3a_private_data;
117
118 typedef struct {
119         ia_3a_af_cb_move_focus_position cb_move_focus_position;
120         ia_3a_af_cb_get_focus_status    cb_get_focus_status;
121         ia_3a_af_cb_focus_req_ready     cb_focus_req_ready;
122         ia_3a_af_cb_get_hp_status       cb_get_hp_status;
123         const ia_3a_private_data        *param_calibration;
124         const ia_3a_private_data        *motor_calibration;
125         const void                      *param_module;
126 } ia_3a_params;
127
128 /* Auto Exposure */
129 typedef enum {
130         ia_3a_ae_mode_auto,             /* Automatic */
131         ia_3a_ae_mode_manual,           /* Manual */
132         ia_3a_ae_mode_shutter_priority, /* Shutter priority */
133         ia_3a_ae_mode_aperture_priority /* Aperture priority */
134 } ia_3a_ae_mode;
135
136 /* Light metering method */
137 typedef enum {
138         ia_3a_ae_metering_mode_auto,       /* Automatic */
139         ia_3a_ae_metering_mode_spot,       /* Spot metering, the window is specified by ia_3a_ae_set_window() */
140         ia_3a_ae_metering_mode_center,     /* Center-weighted metering */
141         ia_3a_ae_metering_mode_customized, /* Customized, the weight map is specified by ia_3a_ae_set_weight_map() */
142         ia_3a_ae_metering_mode_average,    /* Average metering */
143 } ia_3a_ae_metering_mode;
144
145 /* Digital Flicker Cancel Mode */
146 typedef enum {
147         ia_3a_ae_flicker_mode_off,  /* No flicker correction */
148         ia_3a_ae_flicker_mode_50hz, /* Correct 50Hz flicker */
149         ia_3a_ae_flicker_mode_60hz, /* Correct 60Hz flicker */
150         ia_3a_ae_flicker_mode_auto  /* Auto detect and correct flicker */
151 } ia_3a_ae_flicker_mode;
152
153 typedef enum {
154         ia_3a_ae_exposure_program_auto,
155         ia_3a_ae_exposure_program_portrait,
156         ia_3a_ae_exposure_program_sports,
157         ia_3a_ae_exposure_program_landscape,
158         ia_3a_ae_exposure_program_night,
159         ia_3a_ae_exposure_program_fireworks
160 } ia_3a_ae_exposure_program;
161
162 typedef enum {
163         ia_3a_ae_flash_mode_auto,      /* Automatic (don't flash when it's dark) */
164         ia_3a_ae_flash_mode_off,       /* Off */
165         ia_3a_ae_flash_mode_on,        /* On */
166         ia_3a_ae_flash_mode_day_sync,  /* Day Sync */
167         ia_3a_ae_flash_mode_slow_sync, /* Slow Sync */
168 } ia_3a_ae_flash_mode;
169
170 typedef enum {
171         ia_3a_flash_stage_none,
172         ia_3a_flash_stage_pre,
173         ia_3a_flash_stage_main
174 } ia_3a_flash_stage;
175
176 /* Auto White Balance */
177 typedef enum {
178         ia_3a_awb_mode_auto,       /* Corrected colors are calibrated to match changes in illuminant color */
179         ia_3a_awb_mode_manual      /* The current color balance is retained */
180 } ia_3a_awb_mode;
181
182 typedef enum {
183         ia_3a_awb_light_source_other,
184         ia_3a_awb_light_source_filament_lamp,
185         ia_3a_awb_light_source_clear_sky,
186         ia_3a_awb_light_source_cloudiness,
187         ia_3a_awb_light_source_shadow_area,
188         ia_3a_awb_light_source_fluorlamp_w,
189         ia_3a_awb_light_source_fluorlamp_n,
190         ia_3a_awb_light_source_fluorlamp_d,
191 } ia_3a_awb_light_source;
192
193 typedef enum {
194         ia_3a_awb_map_auto,        /* Select based on scene brightness */
195         ia_3a_awb_map_indoor,      /* Always use Indoor map */
196         ia_3a_awb_map_outdoor      /* Always use Outdoor map */
197 } ia_3a_awb_map;
198
199 /* Auto Focus */
200 typedef enum {
201         ia_3a_af_mode_auto,
202         ia_3a_af_mode_manual,
203 #ifdef INTEL_CAF
204         ia_3a_af_mode_video
205 #endif
206 } ia_3a_af_mode;
207
208 typedef enum {
209         ia_3a_af_status_error,     /* Cannot focus */
210         ia_3a_af_status_success,   /* Successfully focussed */
211         ia_3a_af_status_cancelled, /* Canceled by user */
212         ia_3a_af_status_busy,      /* Busy focussing */
213         ia_3a_af_status_idle       /* AF not running */
214 } ia_3a_af_status;
215
216 typedef enum {
217         ia_3a_af_range_norm,
218         ia_3a_af_range_macro,
219         ia_3a_af_range_full
220 } ia_3a_af_range;
221
222 typedef enum {
223         ia_3a_af_metering_mode_auto,
224         ia_3a_af_metering_mode_spot, /* set window using ia_3a_af_set_window() */
225         ia_3a_af_metering_mode_multi,
226 } ia_3a_af_metering_mode;
227
228 /* Makernote support */
229
230 /*!
231  * \brief Maker note data target.
232  * Used in function ia_3a_mknote_get() to indicate  which data section is wanted from the makernote.
233 */
234 typedef enum {
235         ia_3a_mknote_mode_jpeg,   /* Returns makernote data for JPEG EXIF */
236         ia_3a_mknote_mode_raw     /* Returns makernote data for RAW Header */
237 } ia_3a_mknote_mode;
238
239 /*!
240  * \brief Structure containing the pointer and size of the makernote data section.
241  * Function ia_3a_mknote_get() returns this structure filled.
242  */
243 typedef struct {
244         char *data;
245         unsigned int bytes;
246 } ia_3a_mknote;
247
248 /*!
249  * \brief Data Format ID (DFID) enumeration describes data type of the Data field in the MKN record.
250  * This enum must not be modified.
251 */
252 typedef enum {
253         ia_3a_mknote_field_type_first_record = 0,
254
255         /*! Standard integer data types */
256         ia_3a_mknote_field_type_int8,         /*!< 8-bit, int. values, range: -1128 to 127 */
257         ia_3a_mknote_field_type_uint8,        /*!< 8-bit, int. values, range: 0 to 255 */
258         ia_3a_mknote_field_type_int16,        /*!< 16-bit, int. values, range: -32768 to 32767 */
259         ia_3a_mknote_field_type_uint16,       /*!< 16-bit, int. values, range: 0 to 65535 */
260         ia_3a_mknote_field_type_int32,        /*!< 32-bit, int. values, range: -2147483648 to 2147483647 */
261         ia_3a_mknote_field_type_uint32,       /*!< 32-bit, int. values, range: 0 to 4294967295 */
262         /* TODO: do we need these lint32 and ulint32? */
263         ia_3a_mknote_field_type_lint32,       /*!< 32-bit, int. values, range: -2147483648 to 2147483647 */
264         ia_3a_mknote_field_type_ulint32,      /*!< 32-bit, int. values, range: 0 to 4294967295 */
265         ia_3a_mknote_field_type_int64,        /*!< 64-bit, int. values, range: -9223372036854775808 to 9223372036854775807 */
266         ia_3a_mknote_field_type_uint64,       /*!< 64-bit, int. values, range: 0 to 18446744073709551615 */
267
268         /*! Non-standard data type */
269         ia_3a_mknote_field_type_uint8_array,  /*!< Binary array with unsigned char data */
270         ia_3a_mknote_field_type_ascii_string, /*!< NULL-terminated string in ASCII format */
271 } ia_3a_mknote_field_type;
272
273 /*!
274  * \brief Data Name ID (DNID) enumeration describes a name (or functionality) of data in the Data field.
275 */
276 typedef enum {
277         ia_3a_mknote_field_name_first_record = 255,  /* <----- Do not remove this! */
278         ia_3a_mknote_field_name_raw_info,
279 } ia_3a_mknote_field_name;
280
281 /*!
282  * \brief NVM parsing status codes.
283  * Note. This is a copy of enum used in the NVM parser. Make sure this is in sync.
284  */
285 typedef enum
286 {
287         ia_3a_nvm_semco_error_none,     /*!< No error. */
288         ia_3a_nvm_semco_error_internal, /*!< Parser internal failure (not enough memory). */
289         ia_3a_nvm_semco_error_no_data,  /*!< NULL pointer as input. */
290         ia_3a_nvm_semco_error_af,       /*!< Error parsing AF parameters. */
291         ia_3a_nvm_semco_error_lsc,      /*!< Error parsing AF parameters. (lsc dimensions, lsc data) */
292         ia_3a_nvm_semco_error_awb,      /*!< Error parsing AWB parameters (sensitivities, n_lights). */
293         ia_3a_nvm_semco_error_crc,      /*!< CRC check error. */
294         ia_3a_nvm_semco_error_not_used,  /*!< No error in NVM data but NVM data is not used. */
295 } ia_3a_nvm_semco_error;
296
297 #endif /* _IA_3A_TYPES_H_ */