xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/include/iq_parser_v2/RkAiqCalibDbTypesV2.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (c) 2019-2022 Rockchip Eletronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef ___RK_AIQ_CALIB_DB_TYPES_V2_H__
17 #define ___RK_AIQ_CALIB_DB_TYPES_V2_H__
18 
19 #include "moduleinfo_head.h"
20 #include "sensorinfo_head.h"
21 #include "sys_static_cfg_head.h"
22 
23 #ifdef ISP_HW_V20
24 #include "RkAiqCalibDbV2TypesIsp20.h"
25 #endif
26 #ifdef ISP_HW_V21
27 #include "RkAiqCalibDbV2TypesIsp21.h"
28 #endif
29 #ifdef ISP_HW_V30
30 #include "RkAiqCalibDbV2TypesIsp3x.h"
31 #endif
32 #if defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
33 #include "RkAiqCalibDbV2TypesIsp32.h"
34 #endif
35 #include "RkAiqUapitypes.h"
36 
37 RKAIQ_BEGIN_DECLARE
38 
39 /************************************
40 
41 IQ
42 ├── common info
43 ├── main scene
44 │     ├─── name:SceneA
45 │     ├─── sub scene
46 │     │     ├── name:SubA0
47 │     │     ├── CalibV2
48 │     │     .
49 │     │     ├── name:SubA1
50 │     │     ├── CalibV2
51 │     ├─── name:SceneB
52 │     ├─── sub scene
53 │     │     ├── name:SubB0
54 │     │     ├── CalibV2
55 │     │     .
56 │     │     ├── name:SubB1
57 │     │     ├── CalibV2
58 │     ├─── name:SceneC
59 │     ├─── sub scene
60 │     │     ├── name:SubC0
61 │     │     ├── CalibV2
62 │     │     .
63 │     │     ├── name:SubC1
64 │     .     └── CalibV2
65 │     .
66 │     .
67 │     ├── name:sceneC
68 │     ├── ...
69 │     └── name:sceneN
70 
71 IQ JSON:{
72   platform common info: {},
73   sensor common info: {},
74   main scene: [
75   {
76     name: sceneA,
77     sub_scene: [
78           {
79             name: subsceneA0,
80                   CalibDbV2: {
81                     ae,
82                     awb,
83                     ...
84                   }
85           },
86           {
87             name: subsceneA1,
88                   CalibDbV2: {
89                     ae,
90                     awb,
91                     ...
92                   }
93           },
94           .
95           .
96           .
97           ],
98   },
99   {
100     name: sceneB,
101           sub_scene: [
102           {
103             name: subsceneA0,
104                   CalibDbV2: {
105                     ae,
106                     awb,
107                     ...
108                   }
109           },
110 
111           ],
112 
113   }
114   .
115   .
116   .
117   ]
118 }
119 ***********************************/
120 
121 typedef struct CamCalibDbModuleDes_s {
122     char* name;
123     int hw_ver;
124     char* sw_ver;
125 } CamCalibDbModuleDes_t;
126 
127 typedef struct CamCalibDbV2Context_s {
128     CalibDb_Sensor_ParaV2_t* sensor_info;
129     int sensor_info_len;
130     CalibDb_Module_ParaV2_t* module_info;
131     int module_info_len;
132     CalibDb_SysStaticCfg_ParaV2_t* sys_cfg;
133     int sys_cfg_len;
134     char* calib_scene;
135 } CamCalibDbV2Context_t;
136 
137 /**
138  * PC Tool's json patch is not based on CamCalibDbV2Context_t
139  * Then we define an struct most like to PC UI ARCH, when we got new json patch
140  * apply patch to CamCalibDbV2Tuning_t and convert to CamCalibDbV2Context_t
141  */
142 typedef struct CamCalibDbV2Tuning_s {
143     CalibDb_Sensor_ParaV2_t sensor_calib;
144     CalibDb_Module_ParaV2_t module_calib;
145     CalibDb_SysStaticCfg_ParaV2_t sys_static_cfg;
146 #if defined(ISP_HW_V20)
147     CamCalibDbV2ContextIsp20_t calib_scene;
148 #elif defined(ISP_HW_V21)
149     CamCalibDbV2ContextIsp21_t calib_scene;
150 #elif defined(ISP_HW_V30)
151     CamCalibDbV2ContextIsp30_t calib_scene;
152 #elif defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
153     CamCalibDbV2ContextIsp32_t calib_scene;
154 #else
155 #error "WRONG ISP_HW_VERSION, ONLY SUPPORT V20 AND V21 AND V30 NOW !"
156 #endif
157 } CamCalibDbV2Tuning_t;
158 
159 typedef struct CamCalibSubSceneList_s {
160     char* name;
161 #if 0 //TODO zyc Union has bugs
162     union {
163         CamCalibDbV2ContextIsp20_t scene_isp20;
164         CamCalibDbV2ContextIsp21_t scene_isp21;
165     };
166 #endif
167 
168 #if defined(ISP_HW_V20)
169     CamCalibDbV2ContextIsp20_t scene_isp20;
170 #elif defined(ISP_HW_V21)
171     CamCalibDbV2ContextIsp21_t scene_isp21;
172 #elif defined(ISP_HW_V30)
173     CamCalibDbV2ContextIsp30_t scene_isp30;
174 #elif defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
175     CamCalibDbV2ContextIsp32_t scene_isp32;
176 #else
177 #error "WRONG ISP_HW_VERSION, ONLY SUPPORT V20 AND V21 AND V30 NOW !"
178 #endif
179 
180 } CamCalibSubSceneList_t;
181 
182 typedef struct CamCalibMainSceneList_s {
183     char* name;
184     // 'sub_scene' means Scene list of Ai ...
185     CamCalibSubSceneList_t* sub_scene;
186     int sub_scene_len;
187 } CamCalibMainSceneList_t;
188 
189 typedef struct CamCalibDbProj_s {
190     // TODO: move sensor info module etc. to an common struct
191     // M4_STRUCT_DESC("SensorInfo", "normal_ui_style")
192     CalibDb_Sensor_ParaV2_t sensor_calib;
193     // M4_STRUCT_DESC("MoudleInfo", "normal_ui_style")
194     CalibDb_Module_ParaV2_t module_calib;
195     // 'main_scene' means Scene list of A,B,C ...,
196     CamCalibMainSceneList_t* main_scene;
197     int main_scene_len;
198     RkaiqUapi_t* uapi;
199     int uapi_len;
200     // M4_STRUCT_DESC("SysStaticCfg", "normal_ui_style")
201     CalibDb_SysStaticCfg_ParaV2_t sys_static_cfg;
202 } CamCalibDbProj_t;
203 
204 /*NOTE: SHOULD be defined next to CamCalibDbProj_t */
205 /*The storage struct of file camgroup.json */
206 typedef struct CamCalibDbCamgroup_s {
207     //test
208     int group_awb;
209 } CamCalibDbCamgroup_t;
210 
211 RKAIQ_END_DECLARE
212 
213 #endif  /*___RK_AIQ_CALIB_DB_TYPES_V2_H__*/
214