08b47283cda9b2b9dfd14d8dff53c2112578addf
[adaptation/intel_mfld/gst-plugins-atomisp.git] / gst-libs / atomisphal / gstv4l2mfldadvci.h
1 /* GStreamer MFLD ADVIC API
2
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  */
21
22 #ifndef _GST_V4L2MFLDADVCI_H_
23 #define _GST_V4L2MFLDADVCI_H_
24
25 /* LIBMFLDADVCI_VERSION define the version number between camera source and
26  * libmfldadvci.
27  * Update this version number when you update the GstV4l2MFLDAdvCI structure
28  */
29
30 #define LIBMFLDADVCI_VERSION    20110128
31
32 #include <stdlib.h>
33 #include <stdio.h>
34
35 #include "atomisp.h"
36
37
38 #include "ci_adv_pub.h"
39 #include "ia_types.h"
40 #include "ia_redeye.h"
41 #include "ia_dvs.h"
42 #include "ia_dis.h"
43
44
45 typedef enum {
46   ci_adv_Success,
47   ci_adv_NotImplemented,
48   ci_adv_GeneralError,
49   ci_adv_InvalidArgument,
50   ci_adv_OutOfMemory,
51   /* extend this enum with error identifiers needed to correctly
52      report all possible errors. */
53 } ci_adv_Err;
54
55
56 enum {
57     SENSOR_TYPE_RAW = 1,
58     SENSOR_TYPE_SOC
59 };
60
61 typedef struct _GstV4l2MFLDAdvCI GstV4l2MFLDAdvCI;
62 /**
63  * GstV4l2MFLDAdvCI
64  */
65 struct _GstV4l2MFLDAdvCI
66 {
67   void *advci_priv;
68   int initialized;
69
70   /* 3A control API */
71
72   int (*mode_spec_init)(void);
73   void (*switch_mode)(ia_3a_isp_mode mode, float frame_rate);
74   void (*init) (void);
75   void (*uninit) (void);
76   int (*isp_set_fd)(int fd, const char *sensor_id);
77
78   void (*get_statistics)(void);
79
80   void (*AeAfAwb_process)( struct timeval *frame_timestamp);
81
82   void (*ae_calc_for_flash)(void);
83   void (*ae_calc_without_flash)(void);
84   void (*ae_calc_with_flash)(void);
85   void (*ae_is_flash_needed) (bool *useflash);
86   void (*ae_apply_results)(void);
87
88   void (*af_start)(void);
89   void (*af_stop)(void);
90   bool (*af_is_complete)(void);
91
92   void (*awb_apply_results)(void);
93   void (*awb_calc_flash)(void);
94
95   void (*dis_read_statistics)(void);
96   void (*update_dis_results)(void);
97
98   void (*dis_process)(struct atomisp_dis_statistics *stats, struct atomisp_dis_vector *motion_vector);
99
100   void (*dis_calc_still)(struct atomisp_dis_vector *vector, int frame_number);
101
102   void (*do_redeye_removal) (ia_frame *user_buf);
103
104   void (*still_compose) (ia_frame *com_buf, ia_frame bufs[],
105                    int frame_dis, struct atomisp_dis_vector vectors[]);
106
107   void (*load_gdc_table)(void);
108
109   /* 3A property API */
110   ci_adv_Err (*AeSetBias)(int bias); /* bias: -2.0(EV) to +2.0(EV) */
111   ci_adv_Err (*AeGetBias)(int *bias); /* bias: -2.0(EV) to +2.0(EV) */
112   void (*AeSetFlickerMode)(ia_3a_ae_flicker_mode mode);
113   void (*AeGetFlickerMode)(ia_3a_ae_flicker_mode *mode);
114   void (*AeSetExposureProgram)(ia_3a_ae_exposure_program program);
115   void (*AeGetExposureProgram)(ia_3a_ae_exposure_program *program);
116   void (*AeSetMeteringMode)(ia_3a_ae_metering_mode mode);
117   void (*AeGetMeteringMode)(ia_3a_ae_metering_mode *mode);
118   void (*AeSetWindow)(ia_3a_window *window);
119   void (*AeGetWindow)(ia_3a_window *window);
120   ci_adv_Err (*AeSetIso)(int sensitivity);
121   ci_adv_Err (*AeGetIso)(int *sensitivity);
122
123   void (*AfSetMode)(ia_3a_af_mode mode);
124   void (*AfGetMode)(ia_3a_af_mode *mode);
125   void (*AfSetMeteringMode)(ia_3a_af_metering_mode mode);
126   void (*AfGetMeteringMode)(ia_3a_af_metering_mode *mode);
127   void (*AfSetWindow)(ia_3a_window *window);
128   void (*AfGetWindow)(ia_3a_window *window);
129
130   /*
131   ci_adv_Err (*AfStartStillAf)(void);
132   ci_adv_Err (*AfStopStillAf)(void);
133   ci_adv_Err (*AfGetStillAfStatus)(ci_adv_AfStatus *status);
134   */
135   void (*AfSetRange)(ia_3a_af_range range);
136   void (*AfGetRange)(ia_3a_af_range *range);
137
138   /* AWB mode */
139   void (*AwbSetMode)(ia_3a_awb_mode mode);
140   void (*AwbGetMode)(ia_3a_awb_mode *mode);
141
142   /* color tone */
143   void (*AwbSetImageEffect) (ia_3a_image_effect effect);
144   void (*AwbGetImageEffect)(ia_3a_image_effect *effect);
145
146
147   /* AWB Light Source */
148   void (*AwbSetLightSource)(ia_3a_awb_light_source ls);
149   void (*AwbGetLightSource)(ia_3a_awb_light_source *ls);
150
151   ci_adv_Err (*AeGetWindowsNum)(int *num);
152   void (*AwbVersion)(int * major, int * minor);
153   void (*AeVersion)(int * major, int * minor);
154   void (*AfVersion)(int * major, int * minor);
155   void (*AfGetStillAfStatus)(ia_3a_af_status *status);
156   void (*RerVersion)(int * major, int * minor);
157   ci_adv_Err (*AeGetManualShutter)(int *time);
158   void (*Awbdata)(unsigned * num_p, unsigned * avg_r, unsigned * avg_gr,
159                     unsigned * avg_b, unsigned * avg_gb);
160   void (*AeGetManualAperture)(int *aperture);
161   void (*AeGetFlashMode)(ia_3a_ae_flash_mode *mode);
162   void (*AeSetFlashMode)(ia_3a_ae_flash_mode mode);
163   void (*AwbGetManualColorTemperature)(int *ctemp);
164   void (*Awbmatrix)(int msqWbGain[3], int msqCcMtrx[9], unsigned short * shift);
165   void (*GetGridInfo) (void * grid_info);
166   void (*GetMakerNote) (ia_3a_mknote_mode mknMode, ia_3a_mknote * note);
167   void (*AddMakerNoteRecord) (ia_3a_mknote_field_type mkn_format_id,
168                                    ia_3a_mknote_field_name mkn_name_id,
169                                    const void *record,
170                                    unsigned short record_size);
171   void (*PutMakerNote)(ia_3a_mknote *mknData);
172   void (*ResetMakerNote)(void);
173
174
175
176
177   int fd;
178 };
179
180
181 void lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci);
182
183 #endif