xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/RkAiqCoreConfigV30.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 
2 /*
3  * Copyright (c) 2019-2022 Rockchip Eletronics Co., Ltd.
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 #ifndef RK_AIQ_CORE_CONFIG_V30_H
18 #define RK_AIQ_CORE_CONFIG_V30_H
19 
20 #include "a3dlut/rk_aiq_algo_a3dlut_itf.h"
21 #include "abayer2dnr2/rk_aiq_abayer2dnr_algo_itf_v2.h"
22 #include "abayertnr2/rk_aiq_abayertnr_algo_itf_v2.h"
23 #include "ablc/rk_aiq_algo_ablc_itf.h"
24 #include "acac/rk_aiq_algo_acac_itf.h"
25 #include "accm/rk_aiq_algo_accm_itf.h"
26 #include "acgc/rk_aiq_algo_acgc_itf.h"
27 #include "acnr2/rk_aiq_acnr_algo_itf_v2.h"
28 #include "acp/rk_aiq_algo_acp_itf.h"
29 #include "acsm/rk_aiq_algo_acsm_itf.h"
30 #include "adebayer/rk_aiq_algo_adebayer_itf.h"
31 #include "adegamma/rk_aiq_algo_adegamma_itf.h"
32 #include "adehaze/rk_aiq_algo_adehaze_itf.h"
33 #include "adpcc/rk_aiq_algo_adpcc_itf.h"
34 #include "adrc/rk_aiq_algo_adrc_itf.h"
35 #include "ae/rk_aiq_algo_ae_itf.h"
36 #include "af/rk_aiq_algo_af_itf.h"
37 #include "afec/rk_aiq_algo_afec_itf.h"
38 #include "again2/rk_aiq_again_algo_itf_v2.h"
39 #include "agamma/rk_aiq_algo_agamma_itf.h"
40 #include "agic/rk_aiq_algo_agic_itf.h"
41 #include "aie/rk_aiq_algo_aie_itf.h"
42 #include "aldch/rk_aiq_algo_aldch_itf.h"
43 #include "alsc/rk_aiq_algo_alsc_itf.h"
44 #include "amerge/rk_aiq_algo_amerge_itf.h"
45 #include "asd/rk_aiq_algo_asd_itf.h"
46 #include "asharp4/rk_aiq_asharp_algo_itf_v4.h"
47 #include "awb/rk_aiq_algo_awb_itf.h"
48 #include "awdr/rk_aiq_algo_awdr_itf.h"
49 #include "aynr3/rk_aiq_aynr_algo_itf_v3.h"
50 #include "afd/rk_aiq_algo_afd_itf.h"
51 
52 #if RKAIQ_ENABLE_CAMGROUP
53 #include "algos_camgroup/abayer2dnr2/rk_aiq_algo_camgroup_abayer2dnr_itf_v2.h"
54 #include "algos_camgroup/abayertnr2/rk_aiq_algo_camgroup_abayertnr_itf_v2.h"
55 #include "algos_camgroup/acnr2/rk_aiq_algo_camgroup_acnr_itf_v2.h"
56 #include "algos_camgroup/ae/rk_aiq_algo_camgroup_ae_itf.h"
57 #include "algos_camgroup/again2/rk_aiq_algo_camgroup_again_itf_v2.h"
58 #include "algos_camgroup/asharp4/rk_aiq_algo_camgroup_asharp_itf_v4.h"
59 #include "algos_camgroup/awb/rk_aiq_algo_camgroup_awb_itf.h"
60 #include "algos_camgroup/aynr3/rk_aiq_algo_camgroup_aynr_itf_v3.h"
61 #include "algos_camgroup/misc/rk_aiq_algo_camgroup_misc_itf.h"
62 #endif
63 
64 namespace RkCam {
65 
66 /*
67  * isp gets the stats from frame n-1,
68  * and the new parameters take effect on frame n+1
69  */
70 #define ISP_PARAMS_EFFECT_DELAY_CNT 2
71 
72 static RkAiqGrpCondition_t aeGrpCondV3x[] = {
73     [0] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
74 };
75 static RkAiqGrpConditions_t aeGrpCondsV3x = {grp_conds_array_info(aeGrpCondV3x)};
76 
77 static RkAiqGrpCondition_t awbGrpCond[] = {
78     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
79     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
80     [2] = {XCAM_MESSAGE_AWB_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
81     [3] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
82 };
83 static RkAiqGrpConditions_t awbGrpConds = {grp_conds_array_info(awbGrpCond)};
84 
85 static RkAiqGrpCondition_t afGrpCondV3x[] = {
86     [0] = {XCAM_MESSAGE_AF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
87 #if RKAIQ_HAVE_PDAF
88     [1] = {XCAM_MESSAGE_PDAF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
89 #endif
90 };
91 static RkAiqGrpConditions_t afGrpCondsV3x = {grp_conds_array_info(afGrpCondV3x)};
92 
93 static RkAiqGrpCondition_t otherGrpCondV21[] = {
94     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
95 };
96 static RkAiqGrpConditions_t otherGrpCondsV21 = {grp_conds_array_info(otherGrpCondV21)};
97 
98 static RkAiqGrpCondition_t grp0Cond[] = {
99     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
100     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
101     [2] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
102     [3] = {XCAM_MESSAGE_AWB_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
103 };
104 static RkAiqGrpConditions_t grp0Conds = {grp_conds_array_info(grp0Cond)};
105 
106 static RkAiqGrpCondition_t grpDhazCond[] = {
107     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
108     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
109     [2] = {XCAM_MESSAGE_ADEHAZE_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
110     [3] = {XCAM_MESSAGE_YNR_V3_PROC_RES_OK, 0},
111 };
112 static RkAiqGrpConditions_t grpDhazConds = {grp_conds_array_info(grpDhazCond)};
113 
114 static RkAiqGrpCondition_t grp1Cond[] = {
115     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
116     [1] = {XCAM_MESSAGE_AWB_PROC_RES_OK, 0},
117 };
118 static RkAiqGrpConditions_t grp1Conds = {grp_conds_array_info(grp1Cond)};
119 
120 static RkAiqGrpCondition_t otherGrpCondV3x[] = {
121     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
122 };
123 static RkAiqGrpConditions_t otherGrpCondsV3x = {grp_conds_array_info(otherGrpCondV3x)};
124 
125 static RkAiqGrpCondition_t grpAfdCond[] = {
126     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
127     [1] = {XCAM_MESSAGE_VICAP_POLL_SCL_OK, 0},
128 };
129 
130 static RkAiqGrpConditions_t grpAfdConds = {grp_conds_array_info(grpAfdCond)};
131 
132 static struct RkAiqAlgoDesCommExt g_default_3a_des[] = {
133 // clang-format off
134 #if RKAIQ_HAVE_AE_V1
135     { &g_RkIspAlgoDescAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0, 2, 0,    aeGrpCondsV3x      },
136 #endif
137 #if RKAIQ_HAVE_BLC_V1
138     { &g_RkIspAlgoDescAblc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0, 0, 0,    awbGrpConds        },
139 #endif
140 #if RKAIQ_HAVE_AWB_V21
141     { &g_RkIspAlgoDescAwb.common,           RK_AIQ_CORE_ANALYZE_AWB,    1, 1, 21,   awbGrpConds        },
142 #endif
143 #if RKAIQ_HAVE_DEBAYER_V1
144     { &g_RkIspAlgoDescAdebayer.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
145 #endif
146 #if RKAIQ_HAVE_GAMMA_V11
147     { &g_RkIspAlgoDescAgamma.common,        RK_AIQ_CORE_ANALYZE_OTHER,   0, 0, 0,    otherGrpCondsV3x          },
148 #endif
149 #if RKAIQ_HAVE_DEGAMMA_V1
150     { &g_RkIspAlgoDescAdegamma.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
151 #endif
152 #if RKAIQ_HAVE_MERGE_V11
153     { &g_RkIspAlgoDescAmerge.common,        RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
154 #endif
155 #if RKAIQ_HAVE_CAC_V03
156     { &g_RkIspAlgoDescAcac.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 3,    grp0Conds          },
157 #endif
158 
159 #if RKAIQ_HAVE_CAC_V10
160     { &g_RkIspAlgoDescAcac.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
161 #endif
162 #if RKAIQ_HAVE_DEHAZE_V11_DUO
163     { &g_RkIspAlgoDescAdhaz.common,         RK_AIQ_CORE_ANALYZE_DHAZ,   0, 1, 0,    grpDhazConds          },
164 #endif
165 #if RKAIQ_HAVE_BAYER2DNR_V2
166     { &g_RkIspAlgoDescAbayer2dnrV2.common,  RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,    grp0Conds          },
167 #endif
168 #if RKAIQ_HAVE_BAYERTNR_V2
169     { &g_RkIspAlgoDescAbayertnrV2.common,   RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,    grp0Conds          },
170 #endif
171 #if RKAIQ_HAVE_YNR_V3
172     { &g_RkIspAlgoDescAynrV3.common,        RK_AIQ_CORE_ANALYZE_GRP0,   3, 3, 3,    grp0Conds          },
173 #endif
174 #if RKAIQ_HAVE_CNR_V2
175     { &g_RkIspAlgoDescAcnrV2.common,        RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,    grp0Conds          },
176 #endif
177 #if RKAIQ_HAVE_SHARP_V4
178     { &g_RkIspAlgoDescAsharpV4.common,      RK_AIQ_CORE_ANALYZE_GRP0,   4, 4, 4,    grp0Conds          },
179 #endif
180 #if RKAIQ_HAVE_DRC_V11
181     { &g_RkIspAlgoDescAdrc.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
182 #endif
183 #if RKAIQ_HAVE_3DLUT_V1
184     { &g_RkIspAlgoDescA3dlut.common,        RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp1Conds          },
185 #endif
186 #if RKAIQ_HAVE_LSC_V2
187     { &g_RkIspAlgoDescAlsc.common,          RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp1Conds          },
188 #endif
189 #if RKAIQ_HAVE_CCM_V1
190     { &g_RkIspAlgoDescAccm.common,          RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,    grp1Conds          },
191 #endif
192 #if RKAIQ_HAVE_ACP_V10
193     { &g_RkIspAlgoDescAcp.common,           RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
194 #endif
195 #if RKAIQ_HAVE_AIE_V10
196     { &g_RkIspAlgoDescAie.common,           RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
197 #endif
198     { &g_RkIspAlgoDescAdpcc.common,         RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
199 #if RKAIQ_HAVE_LDCH_V10
200     { &g_RkIspAlgoDescAldch.common,         RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
201 #endif
202 #if RKAIQ_HAVE_CGC_V1
203     { &g_RkIspAlgoDescAcgc.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
204 #endif
205 #if RKAIQ_HAVE_CSM_V1
206     { &g_RkIspAlgoDescAcsm.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
207 #endif
208 #if RKAIQ_HAVE_AF_V30 || RKAIQ_ONLY_AF_STATS_V30
209     { &g_RkIspAlgoDescAf.common,            RK_AIQ_CORE_ANALYZE_AF,     0, 1, 0,    afGrpCondsV3x      },
210 #endif
211 #if RKAIQ_HAVE_GIC_V2
212     { &g_RkIspAlgoDescAgic.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 1, 0,    otherGrpCondsV3x   },
213 #endif
214 #if RKAIQ_HAVE_WDR_V1
215     { &g_RkIspAlgoDescAwdr.common,          RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,    otherGrpCondsV3x   },
216 #endif
217 #if RKAIQ_HAVE_ASD_V10
218     { &g_RkIspAlgoDescAsd.common,           RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,    grp0Conds          },
219 #endif
220 #if RKAIQ_HAVE_GAIN_V2
221     { &g_RkIspAlgoDescAgainV2.common,       RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,    grp0Conds          },
222 #endif
223 #if RKAIQ_HAVE_FEC_V10
224     { &g_RkIspAlgoDescAfec.common,          RK_AIQ_CORE_ANALYZE_OTHER, 0, 0, 0,     otherGrpCondsV3x   },
225 #endif
226 #if (RKAIQ_HAVE_AFD_V2)
227 	{ &g_RkIspAlgoDescAfd.common,			 RK_AIQ_CORE_ANALYZE_AFD,	  0, 1, 0,	  grpAfdConds	   },
228 #endif
229     { NULL,                                 RK_AIQ_CORE_ANALYZE_ALL,    0, 0, 0,    {0, 0}             },
230     // clang-format on
231 };
232 
233 #if RKAIQ_ENABLE_CAMGROUP
234 const static struct RkAiqAlgoDesCommExt g_camgroup_algos[] = {
235     // clang-format off
236     { &g_RkIspAlgoDescCamgroupAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0,  3,  0, {0, 0} },
237     { &g_RkIspAlgoDescCamgroupAblc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
238     { &g_RkIspAlgoDescCamgroupAwb.common,           RK_AIQ_CORE_ANALYZE_AWB,    1,  2, 32, {0, 0} },
239     { &g_RkIspAlgoDescCamgroupAlsc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
240     { &g_RkIspAlgoDescCamgroupAccm.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
241     { &g_RkIspAlgoDescCamgroupA3dlut.common,        RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
242     // { &g_RkIspAlgoDescCamgroupAdpcc.common,      RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
243     // { &g_RkIspAlgoDescamgroupAgamma.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
244     { &g_RkIspAlgoDescCamgroupAdrc.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0,  1,  0, {0, 0} },
245     // { &g_RkIspAlgoDescCamgroupAmerge.common,     RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
246     { &g_RkIspAlgoDescCamgroupAynrV3.common,        RK_AIQ_CORE_ANALYZE_OTHER,  3,  3,  3, {0, 0} },
247     { &g_RkIspAlgoDescCamgroupAcnrV2.common,        RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
248     { &g_RkIspAlgoDescCamgroupAbayertnrV2.common,   RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
249     { &g_RkIspAlgoDescCamgroupAbayer2dnrV2.common,  RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
250     { &g_RkIspAlgoDescCamgroupAsharpV4.common,      RK_AIQ_CORE_ANALYZE_OTHER,  4,  4,  4, {0, 0} },
251     { &g_RkIspAlgoDescCamgroupAgainV2.common,       RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
252     { &g_RkIspAlgoDescCamgroupAdhaz.common,         RK_AIQ_CORE_ANALYZE_DHAZ,   0,  1,  0, {0, 0} },
253     { NULL,                                         RK_AIQ_CORE_ANALYZE_ALL,    0,  0,  0, {0, 0} },
254     // clang-format on
255 };
256 #endif
257 
258 }  // namespace RkCam
259 
260 #endif  // RK_AIQ_CORE_CONFIG_V30_H
261