xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/aiq_core/RkAiqCoreConfigV21.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_V21_H
17 #define RK_AIQ_CORE_CONFIG_V21_H
18 
19 #include "a3dlut/rk_aiq_algo_a3dlut_itf.h"
20 #include "ablc/rk_aiq_algo_ablc_itf.h"
21 #include "accm/rk_aiq_algo_accm_itf.h"
22 #include "acgc/rk_aiq_algo_acgc_itf.h"
23 #include "acnr/rk_aiq_acnr_algo_itf_v1.h"
24 #include "acp/rk_aiq_algo_acp_itf.h"
25 #include "acsm/rk_aiq_algo_acsm_itf.h"
26 #include "adebayer/rk_aiq_algo_adebayer_itf.h"
27 #include "adegamma/rk_aiq_algo_adegamma_itf.h"
28 #include "adehaze/rk_aiq_algo_adehaze_itf.h"
29 #include "adpcc/rk_aiq_algo_adpcc_itf.h"
30 #include "adrc/rk_aiq_algo_adrc_itf.h"
31 #include "ae/rk_aiq_algo_ae_itf.h"
32 #include "af/rk_aiq_algo_af_itf.h"
33 #include "agamma/rk_aiq_algo_agamma_itf.h"
34 #include "agic/rk_aiq_algo_agic_itf.h"
35 #include "aie/rk_aiq_algo_aie_itf.h"
36 #include "aldch/rk_aiq_algo_aldch_itf.h"
37 #include "alsc/rk_aiq_algo_alsc_itf.h"
38 #include "amerge/rk_aiq_algo_amerge_itf.h"
39 #include "arawnr2/rk_aiq_abayernr_algo_itf_v2.h"
40 #include "asd/rk_aiq_algo_asd_itf.h"
41 #include "asharp3/rk_aiq_asharp_algo_itf_v3.h"
42 #include "awb/rk_aiq_algo_awb_itf.h"
43 #include "awdr/rk_aiq_algo_awdr_itf.h"
44 #include "aynr2/rk_aiq_aynr_algo_itf_v2.h"
45 
46 #if RKAIQ_ENABLE_CAMGROUP
47 #include "algos_camgroup/abayernr2/rk_aiq_algo_camgroup_abayernr_itf_v2.h"
48 #include "algos_camgroup/acnr/rk_aiq_algo_camgroup_acnr_itf.h"
49 #include "algos_camgroup/ae/rk_aiq_algo_camgroup_ae_itf.h"
50 #include "algos_camgroup/asharp3/rk_aiq_algo_camgroup_asharp_itf_v3.h"
51 #include "algos_camgroup/awb/rk_aiq_algo_camgroup_awb_itf.h"
52 #include "algos_camgroup/aynr2/rk_aiq_algo_camgroup_aynr_itf_v2.h"
53 #include "algos_camgroup/misc/rk_aiq_algo_camgroup_misc_itf.h"
54 #endif
55 
56 namespace RkCam {
57 
58 /*
59  * isp gets the stats from frame n-1,
60  * and the new parameters take effect on frame n+1
61  */
62 #define ISP_PARAMS_EFFECT_DELAY_CNT 2
63 
64 static RkAiqGrpCondition_t aeGrpCondV21[] = {
65     [0] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
66 };
67 static RkAiqGrpConditions_t aeGrpCondsV21 = {grp_conds_array_info(aeGrpCondV21)};
68 
69 static RkAiqGrpCondition_t awbGrpCond[] = {
70     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
71     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
72     [2] = {XCAM_MESSAGE_AWB_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
73     [3] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
74 };
75 static RkAiqGrpConditions_t awbGrpConds = {grp_conds_array_info(awbGrpCond)};
76 
77 static RkAiqGrpCondition_t afGrpCondV21[] = {
78     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
79     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
80     [2] = {XCAM_MESSAGE_AF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
81     [3] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
82 #if RKAIQ_HAVE_PDAF
83     [4] = {XCAM_MESSAGE_PDAF_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
84 #endif
85 };
86 static RkAiqGrpConditions_t afGrpCondsV21 = {grp_conds_array_info(afGrpCondV21)};
87 
88 static RkAiqGrpCondition_t otherGrpCondV21[] = {
89     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
90 };
91 static RkAiqGrpConditions_t otherGrpCondsV21 = {grp_conds_array_info(otherGrpCondV21)};
92 
93 static RkAiqGrpCondition_t grp0Cond[] = {
94     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
95     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
96     [2] = {XCAM_MESSAGE_AEC_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
97     [3] = {XCAM_MESSAGE_AWB_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
98 };
99 static RkAiqGrpConditions_t grp0Conds = {grp_conds_array_info(grp0Cond)};
100 
101 static RkAiqGrpCondition_t grpDhazCond[] = {
102     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
103     [1] = {XCAM_MESSAGE_AE_PRE_RES_OK, 0},
104     [2] = {XCAM_MESSAGE_ADEHAZE_STATS_OK, ISP_PARAMS_EFFECT_DELAY_CNT},
105 };
106 static RkAiqGrpConditions_t grpDhazConds = {grp_conds_array_info(grpDhazCond)};
107 
108 static RkAiqGrpCondition_t grp1Cond[] = {
109     [0] = {XCAM_MESSAGE_SOF_INFO_OK, 0},
110     [1] = {XCAM_MESSAGE_AWB_PROC_RES_OK, 0},
111 };
112 static RkAiqGrpConditions_t grp1Conds = {grp_conds_array_info(grp1Cond)};
113 
114 static struct RkAiqAlgoDesCommExt g_default_3a_des[] = {
115 // clang-format off
116 #if RKAIQ_HAVE_AE_V1
117     { &g_RkIspAlgoDescAe.common,        RK_AIQ_CORE_ANALYZE_AE,     0, 1, 0,  aeGrpCondsV21    },
118 #endif
119 #if RKAIQ_HAVE_AWB_V21
120     { &g_RkIspAlgoDescAwb.common,       RK_AIQ_CORE_ANALYZE_AWB,    1, 1, 21, awbGrpConds      },
121 #endif
122 #if RKAIQ_HAVE_DEBAYER_V1
123     { &g_RkIspAlgoDescAdebayer.common,  RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,  grp0Conds        },
124 #endif
125 #if RKAIQ_HAVE_GAMMA_V10
126     { &g_RkIspAlgoDescAgamma.common,    RK_AIQ_CORE_ANALYZE_OTHER,   0, 0, 0,  otherGrpCondsV21        },
127 #endif
128 #if RKAIQ_HAVE_DEGAMMA_V1
129     { &g_RkIspAlgoDescAdegamma.common,  RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,  grp0Conds        },
130 #endif
131 #if RKAIQ_HAVE_MERGE_V10
132     { &g_RkIspAlgoDescAmerge.common,    RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,  grp0Conds        },
133 #endif
134 #if RKAIQ_HAVE_DEHAZE_V11
135     { &g_RkIspAlgoDescAdhaz.common,     RK_AIQ_CORE_ANALYZE_DHAZ,   0, 1, 0,  grpDhazConds        },
136 #endif
137 #if RKAIQ_HAVE_BAYERNR_V2
138     { &g_RkIspAlgoDescArawnrV2.common,  RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,  grp0Conds        },
139 #endif
140 #if RKAIQ_HAVE_YNR_V2
141     { &g_RkIspAlgoDescAynrV2.common,    RK_AIQ_CORE_ANALYZE_GRP0,   2, 2, 2,  grp0Conds        },
142 #endif
143 #if RKAIQ_HAVE_CNR_V1
144     { &g_RkIspAlgoDescAcnrV1.common,    RK_AIQ_CORE_ANALYZE_GRP0,   1, 1, 1,  grp0Conds        },
145 #endif
146 #if RKAIQ_HAVE_SHARP_V3
147     { &g_RkIspAlgoDescAsharpV3.common,  RK_AIQ_CORE_ANALYZE_GRP0,   3, 3, 3,  grp0Conds        },
148 #endif
149 #if RKAIQ_HAVE_DRC_V10
150     { &g_RkIspAlgoDescAdrc.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,  grp0Conds        },
151 #endif
152 #if RKAIQ_HAVE_3DLUT_V1
153     { &g_RkIspAlgoDescA3dlut.common,    RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,  grp1Conds        },
154 #endif
155 #if RKAIQ_HAVE_LSC_V1
156     { &g_RkIspAlgoDescAlsc.common,      RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,  grp1Conds        },
157 #endif
158 #if RKAIQ_HAVE_CCM_V1
159     { &g_RkIspAlgoDescAccm.common,      RK_AIQ_CORE_ANALYZE_GRP1,   0, 0, 0,  grp1Conds        },
160 #endif
161 #if RKAIQ_HAVE_ACP_V10
162     { &g_RkIspAlgoDescAcp.common,       RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
163 #endif
164 #if RKAIQ_HAVE_AIE_V10
165     { &g_RkIspAlgoDescAie.common,       RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
166 #endif
167     { &g_RkIspAlgoDescAdpcc.common,     RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
168 #if RKAIQ_HAVE_LDCH_V10
169     { &g_RkIspAlgoDescAldch.common,     RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
170 #endif
171 #if RKAIQ_HAVE_CGC_V1
172     { &g_RkIspAlgoDescAcgc.common,      RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
173 #endif
174 #if RKAIQ_HAVE_CSM_V1
175     { &g_RkIspAlgoDescAcsm.common,      RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
176 #endif
177 #if RKAIQ_HAVE_AF_V20 || RKAIQ_ONLY_AF_STATS_V20
178     { &g_RkIspAlgoDescAf.common,        RK_AIQ_CORE_ANALYZE_AF,     0, 0, 0,  afGrpCondsV21    },
179 #endif
180 #if RKAIQ_HAVE_BLC_V1
181     { &g_RkIspAlgoDescAblc.common,      RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
182 #endif
183 #if RKAIQ_HAVE_GIC_V2
184     { &g_RkIspAlgoDescAgic.common,      RK_AIQ_CORE_ANALYZE_OTHER,  0, 1, 0,  otherGrpCondsV21 },
185 #endif
186 #if RKAIQ_HAVE_WDR_V1
187     { &g_RkIspAlgoDescAwdr.common,      RK_AIQ_CORE_ANALYZE_OTHER,  0, 0, 0,  otherGrpCondsV21 },
188 #endif
189 #if RKAIQ_HAVE_ASD_V10
190     { &g_RkIspAlgoDescAsd.common,       RK_AIQ_CORE_ANALYZE_GRP0,   0, 0, 0,  grp0Conds        },
191 #endif
192     { NULL,                             RK_AIQ_CORE_ANALYZE_ALL,    0, 0, 0,  {0, 0}           },
193     // clang-format on
194 };
195 
196 #if RKAIQ_ENABLE_CAMGROUP
197 const static struct RkAiqAlgoDesCommExt g_camgroup_algos[] = {
198     // clang-format off
199     { &g_RkIspAlgoDescCamgroupAe.common,            RK_AIQ_CORE_ANALYZE_AE,     0,  3,  0, {0, 0} },
200     { &g_RkIspAlgoDescCamgroupAblc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
201     { &g_RkIspAlgoDescCamgroupAwb.common,           RK_AIQ_CORE_ANALYZE_AWB,    1,  2, 32, {0, 0} },
202     { &g_RkIspAlgoDescCamgroupAlsc.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
203     { &g_RkIspAlgoDescCamgroupAccm.common,          RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
204     { &g_RkIspAlgoDescCamgroupA3dlut.common,        RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
205     // { &g_RkIspAlgoDescCamgroupAdpcc.common,      RK_AIQ_CORE_ANALYZE_AWB,    0,  0,  0, {0, 0} },
206     { &g_RkIspAlgoDescCamgroupAdhaz.common,         RK_AIQ_CORE_ANALYZE_DHAZ,   0,  1,  0, {0, 0} },
207     // { &g_RkIspAlgoDescamgroupAgamma.common,      RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
208     { &g_RkIspAlgoDescCamgroupAdrc.common,          RK_AIQ_CORE_ANALYZE_GRP0,   0,  1,  0, {0, 0} },
209     // { &g_RkIspAlgoDescCamgroupAmerge.common,     RK_AIQ_CORE_ANALYZE_GRP0,   0,  0,  0, {0, 0} },
210     { &g_RkIspAlgoDescCamgroupAynrV2.common,        RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
211     { &g_RkIspAlgoDescCamgroupAcnr.common,          RK_AIQ_CORE_ANALYZE_OTHER,  1,  1,  1, {0, 0} },
212     { &g_RkIspAlgoDescCamgroupAbayernrV2.common,    RK_AIQ_CORE_ANALYZE_OTHER,  2,  2,  2, {0, 0} },
213     { &g_RkIspAlgoDescCamgroupAsharpV3.common,      RK_AIQ_CORE_ANALYZE_OTHER,  3,  3,  3, {0, 0} },
214     { NULL,                                         RK_AIQ_CORE_ANALYZE_ALL,    0,  0,  0, {0, 0} },
215     // clang-format on
216 };
217 #endif
218 
219 }  // namespace RkCam
220 
221 #endif  // RK_AIQ_CORE_CONFIG_V21_H
222