xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/RkAiqCoreConfigV32.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_CORE_CONFIG_V32_H
17 #define RK_AIQ_CORE_CONFIG_V32_H
18 
19 #include "a3dlut/rk_aiq_algo_a3dlut_itf.h"
20 #include "abayer2dnr2/rk_aiq_abayer2dnr_algo_itf_v2.h"
21 #include "abayer2dnrV23/rk_aiq_abayer2dnr_algo_itf_v23.h"
22 #include "abayertnr2/rk_aiq_abayertnr_algo_itf_v2.h"
23 #include "abayertnrV23/rk_aiq_abayertnr_algo_itf_v23.h"
24 #include "ablc/rk_aiq_algo_ablc_itf.h"
25 #include "ablcV32/rk_aiq_ablc_algo_itf_v32.h"
26 #include "acac/rk_aiq_algo_acac_itf.h"
27 #include "accm/rk_aiq_algo_accm_itf.h"
28 #include "acgc/rk_aiq_algo_acgc_itf.h"
29 #include "acnr2/rk_aiq_acnr_algo_itf_v2.h"
30 #include "acnrV30/rk_aiq_acnr_algo_itf_v30.h"
31 #include "acp/rk_aiq_algo_acp_itf.h"
32 #include "acsm/rk_aiq_algo_acsm_itf.h"
33 #include "adebayer/rk_aiq_algo_adebayer_itf.h"
34 #include "adegamma/rk_aiq_algo_adegamma_itf.h"
35 #include "adehaze/rk_aiq_algo_adehaze_itf.h"
36 #include "adpcc/rk_aiq_algo_adpcc_itf.h"
37 #include "adrc/rk_aiq_algo_adrc_itf.h"
38 #include "ae/rk_aiq_algo_ae_itf.h"
39 #include "af/rk_aiq_algo_af_itf.h"
40 #include "afec/rk_aiq_algo_afec_itf.h"
41 #include "again2/rk_aiq_again_algo_itf_v2.h"
42 #include "agamma/rk_aiq_algo_agamma_itf.h"
43 #include "agic/rk_aiq_algo_agic_itf.h"
44 #include "aie/rk_aiq_algo_aie_itf.h"
45 #include "aldch/rk_aiq_algo_aldch_itf.h"
46 #include "alsc/rk_aiq_algo_alsc_itf.h"
47 #include "amerge/rk_aiq_algo_amerge_itf.h"
48 #include "asd/rk_aiq_algo_asd_itf.h"
49 #include "asharp4/rk_aiq_asharp_algo_itf_v4.h"
50 #include "asharpV33/rk_aiq_asharp_algo_itf_v33.h"
51 #include "awb/rk_aiq_algo_awb_itf.h"
52 #include "awdr/rk_aiq_algo_awdr_itf.h"
53 #include "aynr3/rk_aiq_aynr_algo_itf_v3.h"
54 #include "aynrV22/rk_aiq_aynr_algo_itf_v22.h"
55 #include "afd/rk_aiq_algo_afd_itf.h"
56 
57 #if RKAIQ_ENABLE_CAMGROUP
58 #include "algos_camgroup/abayer2dnrV23/rk_aiq_algo_camgroup_abayer2dnr_itf_v23.h"
59 #include "algos_camgroup/abayertnrV23/rk_aiq_algo_camgroup_abayertnr_itf_v23.h"
60 #include "algos_camgroup/acnrV30/rk_aiq_algo_camgroup_acnr_itf_v30.h"
61 #include "algos_camgroup/ae/rk_aiq_algo_camgroup_ae_itf.h"
62 #include "algos_camgroup/again2/rk_aiq_algo_camgroup_again_itf_v2.h"
63 #include "algos_camgroup/asharpV33/rk_aiq_algo_camgroup_asharp_itf_v33.h"
64 #include "algos_camgroup/awb/rk_aiq_algo_camgroup_awb_itf.h"
65 #include "algos_camgroup/aynrV22/rk_aiq_algo_camgroup_aynr_itf_v22.h"
66 #include "algos_camgroup/misc/rk_aiq_algo_camgroup_misc_itf.h"
67 #endif
68 
69 namespace RkCam {
70 
71 /*
72  * isp gets the stats from frame n-1,
73  * and the new parameters take effect on frame n+1
74  */
75 #define ISP_PARAMS_EFFECT_DELAY_CNT 2
76 
77 static RkAiqGrpCondition_t aeGrpCondV3x[] = {
78     [0] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
79 };
80 static RkAiqGrpConditions_t aeGrpCondsV3x = {grp_conds_array_info(aeGrpCondV3x)};
81 
82 static RkAiqGrpCondition_t awbGrpCond[] = {
83     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
84     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
85     [2] = {XCAM_MESSAGE_AWB_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
86     [3] = {XCAM_MESSAGE_BLC_V32_PROC_RES_OK, 0},
87     [4] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
88 };
89 static RkAiqGrpConditions_t awbGrpConds = {grp_conds_array_info(awbGrpCond)};
90 
91 static RkAiqGrpCondition_t afGrpCondV3x[] = {
92     [0] = {XCAM_MESSAGE_AF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
93 #if RKAIQ_HAVE_PDAF
94     [1] = {XCAM_MESSAGE_PDAF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
95 #endif
96 };
97 static RkAiqGrpConditions_t afGrpCondsV3x = {grp_conds_array_info(afGrpCondV3x)};
98 
99 static RkAiqGrpCondition_t otherGrpCondV21[] = {
100     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
101 };
102 static RkAiqGrpConditions_t otherGrpCondsV21 = {grp_conds_array_info(otherGrpCondV21)};
103 
104 static RkAiqGrpCondition_t grp0Cond[] = {
105     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
106     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
107     [2] = {XCAM_MESSAGE_BLC_V32_PROC_RES_OK, 0},
108     [3] = {XCAM_MESSAGE_AWB_PROC_RES_OK, 0},
109 };
110 static RkAiqGrpConditions_t grp0Conds = {grp_conds_array_info(grp0Cond)};
111 
112 static RkAiqGrpCondition_t grpDhazCond[] = {
113     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
114     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
115     [2] = {XCAM_MESSAGE_BLC_V32_PROC_RES_OK, 0},
116     [3] = {XCAM_MESSAGE_ADEHAZE_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
117     [4] = {XCAM_MESSAGE_YNR_V22_PROC_RES_OK, 0},
118 };
119 static RkAiqGrpConditions_t grpDhazConds = {grp_conds_array_info(grpDhazCond)};
120 
121 static RkAiqGrpCondition_t grp1Cond[] = {
122     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
123     [1] = {XCAM_MESSAGE_AWB_PROC_RES_OK, 0},
124     [2] = {XCAM_MESSAGE_BLC_V32_PROC_RES_OK, 0},
125 };
126 static RkAiqGrpConditions_t grp1Conds = {grp_conds_array_info(grp1Cond)};
127 
128 static RkAiqGrpCondition_t otherGrpCondV3x[] = {
129     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
130 };
131 static RkAiqGrpConditions_t otherGrpCondsV3x = {grp_conds_array_info(otherGrpCondV3x)};
132 
133 static RkAiqGrpCondition_t grpAfdCond[] = {
134     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
135     [1] = {XCAM_MESSAGE_VICAP_POLL_SCL_OK, 0},
136 };
137 
138 static RkAiqGrpConditions_t grpAfdConds = {grp_conds_array_info(grpAfdCond)};
139 
140 
141 static struct RkAiqAlgoDesCommExt g_default_3a_des[] = {
142 // clang-format off
143 
144 #if RKAIQ_HAVE_AE_V1
145 #if defined(ISP_HW_V32_LITE)
146     { &g_RkIspAlgoDescAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0, 4, 0,    aeGrpCondsV3x      },
147 #else
148     { &g_RkIspAlgoDescAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0, 3, 0,    aeGrpCondsV3x      },
149 #endif
150 #endif
151 
152 #if RKAIQ_HAVE_BLC_V32
153     { &g_RkIspAlgoDescAblcV32.common,          RK_AIQ_CORE_ANALYZE_OTHER,    32, 32, 32,    otherGrpCondsV3x        },
154 #endif
155 
156 #if RKAIQ_HAVE_AWB_V32
157     { &g_RkIspAlgoDescAwb.common,           RK_AIQ_CORE_ANALYZE_AWB,    1, 2, 32,   awbGrpConds        },
158 #endif
159 #if defined(ISP_HW_V32)
160 #if RKAIQ_HAVE_CAC_V11
161     { &g_RkIspAlgoDescAcac.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 11,   grp0Conds          },
162 #endif
163 #endif
164 
165 #if RKAIQ_HAVE_DEBAYER_V2
166     { &g_RkIspAlgoDescAdebayer.common,      RK_AIQ_CORE_ANALYZE_OTHER,   0, 1, 0,    otherGrpCondsV3x          },
167 #endif
168 #if RKAIQ_HAVE_DEBAYER_V2_LITE
169     { &g_RkIspAlgoDescAdebayer.common,      RK_AIQ_CORE_ANALYZE_OTHER,   0, 2, 0,    otherGrpCondsV3x          },
170 #endif
171 
172 #if RKAIQ_HAVE_GAMMA_V11
173     { &g_RkIspAlgoDescAgamma.common,        RK_AIQ_CORE_ANALYZE_OTHER,   0, 0, 0,    otherGrpCondsV3x          },
174 #endif
175 #if RKAIQ_HAVE_DEHAZE_V12
176     { &g_RkIspAlgoDescAdhaz.common,         RK_AIQ_CORE_ANALYZE_DHAZ,   0, 1, 0,    grpDhazConds         },
177 #endif
178 #if RKAIQ_HAVE_MERGE_V12
179     { &g_RkIspAlgoDescAmerge.common,        RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
180 #endif
181 #if RKAIQ_HAVE_DRC_V12 || RKAIQ_HAVE_DRC_V12_LITE
182     { &g_RkIspAlgoDescAdrc.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
183 #endif
184 #if RKAIQ_HAVE_GAIN_V2
185     { &g_RkIspAlgoDescAgainV2.common,       RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,    grp0Conds          },
186 #endif
187 #if RKAIQ_HAVE_CCM_V2
188     { &g_RkIspAlgoDescAccm.common,          RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp0Conds          },
189 #endif
190 #if RKAIQ_HAVE_3DLUT_V1
191     { &g_RkIspAlgoDescA3dlut.common,        RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp0Conds          },
192 #endif
193 #if RKAIQ_HAVE_LSC_V3
194     { &g_RkIspAlgoDescAlsc.common,          RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp0Conds          },
195 #endif
196 #if RKAIQ_HAVE_DPCC_V1
197     { &g_RkIspAlgoDescAdpcc.common,         RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
198 #endif
199 #if 0
200     { &g_RkIspAlgoDescAdegamma.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
201 #if RKAIQ_HAVE_CAC_V10
202     { &g_RkIspAlgoDescAcac.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
203 #endif
204 #endif
205 #if RKAIQ_HAVE_ACP_V10
206     { &g_RkIspAlgoDescAcp.common,           RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
207 #endif
208 #if RKAIQ_HAVE_AIE_V10
209     { &g_RkIspAlgoDescAie.common,           RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
210 #endif
211 #if RKAIQ_HAVE_LDCH_V21
212     { &g_RkIspAlgoDescAldch.common,         RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
213 #endif
214 #if RKAIQ_HAVE_CGC_V1
215     { &g_RkIspAlgoDescAcgc.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
216 #endif
217 #if RKAIQ_HAVE_CSM_V1
218     { &g_RkIspAlgoDescAcsm.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
219 #endif
220 
221 #if RKAIQ_HAVE_AF_V31 || RKAIQ_ONLY_AF_STATS_V31
222     { &g_RkIspAlgoDescAf.common,            RK_AIQ_CORE_ANALYZE_AF,     0, 2, 0,    afGrpCondsV3x      },
223 #elif RKAIQ_HAVE_AF_V32_LITE || RKAIQ_ONLY_AF_STATS_V32_LITE
224     { &g_RkIspAlgoDescAf.common,            RK_AIQ_CORE_ANALYZE_AF,     0, 3, 0,    afGrpCondsV3x      },
225 #endif
226 #if defined(ISP_HW_V32)
227 #if RKAIQ_HAVE_GIC_V2
228     { &g_RkIspAlgoDescAgic.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 1, 0,    otherGrpCondsV3x   },
229 #endif
230 #endif
231 #if defined(ISP_HW_V32)
232 #if RKAIQ_HAVE_ASD_V10
233     { &g_RkIspAlgoDescAsd.common,           RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
234 #endif
235 #endif
236 #if 0
237     { &g_RkIspAlgoDescAwdr.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
238 #endif
239 #if (RKAIQ_HAVE_BAYERTNR_V23 || RKAIQ_HAVE_BAYERTNR_V23_LITE)
240     { &g_RkIspAlgoDescAbayertnrV23.common, RK_AIQ_CORE_ANALYZE_GRP0,    23, 23, 23, grp0Conds          },
241 #endif
242 #if defined(ISP_HW_V32)
243 #if RKAIQ_HAVE_BAYER2DNR_V23
244     { &g_RkIspAlgoDescAbayer2dnrV23.common, RK_AIQ_CORE_ANALYZE_GRP0,   23, 23, 23, grp0Conds          },
245 #endif
246 #endif
247 #if RKAIQ_HAVE_YNR_V22
248     { &g_RkIspAlgoDescAynrV22.common,       RK_AIQ_CORE_ANALYZE_GRP0,   22, 22, 22, grp0Conds          },
249 #endif
250 #if (RKAIQ_HAVE_CNR_V30 ||RKAIQ_HAVE_CNR_V30_LITE)
251     { &g_RkIspAlgoDescAcnrV30.common, RK_AIQ_CORE_ANALYZE_GRP0,    30, 30, 30, grp0Conds          },
252 #endif
253 #if (RKAIQ_HAVE_SHARP_V33 || RKAIQ_HAVE_SHARP_V33_LITE)
254     { &g_RkIspAlgoDescAsharpV33.common,       RK_AIQ_CORE_ANALYZE_GRP0,   33, 33, 33,    grp0Conds          },
255 #endif
256 #if (RKAIQ_HAVE_AFD_V2)
257     { &g_RkIspAlgoDescAfd.common,            RK_AIQ_CORE_ANALYZE_AFD,     0, 1, 0,    grpAfdConds      },
258 #endif
259     { NULL,                                 RK_AIQ_CORE_ANALYZE_ALL,    0, 0, 0,    {0, 0}             },
260     // clang-format on
261 
262 };
263 
264 #if RKAIQ_ENABLE_CAMGROUP
265 const static struct RkAiqAlgoDesCommExt g_camgroup_algos[] = {
266     // clang-format off
267     { &g_RkIspAlgoDescCamgroupAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0,  3,  0, {0, 0} },
268     { &g_RkIspAlgoDescCamgroupAblcV32.common,       RK_AIQ_CORE_ANALYZE_GRP0,  32, 32, 32, {0, 0} },
269     { &g_RkIspAlgoDescCamgroupAwb.common,           RK_AIQ_CORE_ANALYZE_AWB,    1,  2, 32, {0, 0} },
270     { &g_RkIspAlgoDescCamgroupAlsc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
271     { &g_RkIspAlgoDescCamgroupAccm.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
272     { &g_RkIspAlgoDescCamgroupA3dlut.common,        RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
273     // { &g_RkIspAlgoDescCamgroupAdpcc.common,      RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
274     // { &g_RkIspAlgoDescamgroupAgamma.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
275     { &g_RkIspAlgoDescCamgroupAdrc.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0,  1,  0, {0, 0} },
276     // { &g_RkIspAlgoDescCamgroupAmerge.common,     RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
277     { &g_RkIspAlgoDescCamgroupAynrV22.common,       RK_AIQ_CORE_ANALYZE_OTHER, 22, 22, 22, {0, 0} },
278     { &g_RkIspAlgoDescCamgroupAcnrV30.common,       RK_AIQ_CORE_ANALYZE_OTHER, 30, 30, 30, {0, 0} },
279     { &g_RkIspAlgoDescCamgroupAbayertnrV23.common,  RK_AIQ_CORE_ANALYZE_OTHER, 23, 23, 23, {0, 0} },
280 #if RKAIQ_HAVE_BAYER2DNR_V23
281     { &g_RkIspAlgoDescCamgroupAbayer2dnrV23.common, RK_AIQ_CORE_ANALYZE_OTHER, 23, 23, 23, {0, 0} },
282 #endif
283     { &g_RkIspAlgoDescCamgroupAsharpV33.common,     RK_AIQ_CORE_ANALYZE_OTHER, 33, 33, 33, {0, 0} },
284     { &g_RkIspAlgoDescCamgroupAgainV2.common,       RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
285     { &g_RkIspAlgoDescCamgroupAdhaz.common,         RK_AIQ_CORE_ANALYZE_DHAZ,   0,  1,  0, {0, 0} },
286     { NULL,                                         RK_AIQ_CORE_ANALYZE_ALL,    0,  0,  0, {0, 0} },
287     // clang-format on
288 };
289 #endif
290 
291 }  // namespace RkCam
292 
293 #endif  // RK_AIQ_CORE_CONFIG_V32_H
294