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_H
17 #define RK_AIQ_CORE_CONFIG_H
18
19 #include <unordered_map>
20
21 #include "MessageBus.h"
22 #include "rk_aiq_algo_des.h"
23 #include "rk_aiq_types_priv.h"
24
25 #define grp_array_size(x) (sizeof(x) / sizeof(x[0]))
26 #define grp_conds_array_info(x) x, grp_array_size(x)
27
28 namespace RkCam {
29
30 typedef struct RkAiqGrpCondition_s {
31 XCamMessageType cond;
32 int8_t delay;
33 } RkAiqGrpCondition_t;
34
35 typedef struct RkAiqGrpConditions_s {
36 RkAiqGrpCondition_t* conds;
37 u32 size;
38 } RkAiqGrpConditions_t;
39
40 struct RkAiqAlgoDesCommExt {
41 RkAiqAlgoDesComm* des;
42 enum rk_aiq_core_analyze_type_e group;
43 uint8_t algo_ver;
44 uint8_t module_hw_ver;
45 uint8_t handle_ver;
46 RkAiqGrpConditions_t grpConds;
47 };
48
AlgoTypeToString(RkAiqAlgoType_t type)49 inline std::string AlgoTypeToString(RkAiqAlgoType_t type) {
50 static std::unordered_map<uint32_t, std::string> str_map = {
51 // clang-format off
52 { RK_AIQ_ALGO_TYPE_AE, "Ae" },
53 { RK_AIQ_ALGO_TYPE_AWB, "Awb" },
54 { RK_AIQ_ALGO_TYPE_AF, "Af" },
55 { RK_AIQ_ALGO_TYPE_ABLC, "Ablc" },
56 { RK_AIQ_ALGO_TYPE_ADPCC, "Adpcc" },
57 { RK_AIQ_ALGO_TYPE_AMERGE, "Amerge" },
58 { RK_AIQ_ALGO_TYPE_ATMO, "Atmo" },
59 { RK_AIQ_ALGO_TYPE_ANR, "Anr" },
60 { RK_AIQ_ALGO_TYPE_ALSC, "Alsc" },
61 { RK_AIQ_ALGO_TYPE_AGIC, "Agic" },
62 { RK_AIQ_ALGO_TYPE_ADEBAYER, "Adebayer" },
63 { RK_AIQ_ALGO_TYPE_ACCM, "Accm" },
64 { RK_AIQ_ALGO_TYPE_AGAMMA, "Agamma" },
65 { RK_AIQ_ALGO_TYPE_AWDR, "Awdr" },
66 { RK_AIQ_ALGO_TYPE_ADHAZ, "Adehaze" },
67 { RK_AIQ_ALGO_TYPE_A3DLUT, "A3dlut" },
68 { RK_AIQ_ALGO_TYPE_ALDCH, "Aldch" },
69 { RK_AIQ_ALGO_TYPE_ACSM, "Acsm" },
70 { RK_AIQ_ALGO_TYPE_ACP, "Acp" },
71 { RK_AIQ_ALGO_TYPE_AIE, "Aie" },
72 { RK_AIQ_ALGO_TYPE_ASHARP, "Asharp" },
73 { RK_AIQ_ALGO_TYPE_AORB, "Aorb" },
74 { RK_AIQ_ALGO_TYPE_ACGC, "Acgc" },
75 { RK_AIQ_ALGO_TYPE_ASD, "Asd" },
76 { RK_AIQ_ALGO_TYPE_ADRC, "Adrc" },
77 { RK_AIQ_ALGO_TYPE_ADEGAMMA, "Adegamma" },
78 #if defined(ISP_HW_V30) || defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
79 { RK_AIQ_ALGO_TYPE_ARAWNR, "Abayer2dnr"},
80 { RK_AIQ_ALGO_TYPE_AMFNR, "Abayertnr" },
81 #else
82 { RK_AIQ_ALGO_TYPE_ARAWNR, "Arawnr" },
83 { RK_AIQ_ALGO_TYPE_AMFNR, "Amfnr" },
84 #endif
85 { RK_AIQ_ALGO_TYPE_AYNR, "Aynr" },
86 { RK_AIQ_ALGO_TYPE_ACNR, "Acnr" },
87 { RK_AIQ_ALGO_TYPE_AEIS, "Aeis" },
88 { RK_AIQ_ALGO_TYPE_AFEC, "Afec" },
89 { RK_AIQ_ALGO_TYPE_AMD, "Amd" },
90 { RK_AIQ_ALGO_TYPE_AGAIN, "Again" },
91 { RK_AIQ_ALGO_TYPE_ACAC, "Acac" },
92 { RK_AIQ_ALGO_TYPE_AFD, "Afd" },
93 // clang-format oon
94 };
95
96 return str_map[uint32_t(type)];
97 }
98
99
100 } // namespace RkCam
101
102 #if defined(__GNUC__) && !defined(__clang__)
103 #pragma GCC diagnostic push
104 #pragma GCC diagnostic ignored "-Wpedantic"
105 #endif
106 #ifdef ISP_HW_V20
107 #include "RkAiqCoreConfigV20.h"
108 #endif
109
110 #ifdef ISP_HW_V21
111 #include "RkAiqCoreConfigV21.h"
112 #endif
113
114 #ifdef ISP_HW_V30
115 #include "RkAiqCoreConfigV30.h"
116 #endif
117
118 #if defined(ISP_HW_V32) || defined(ISP_HW_V32_LITE)
119 #include "RkAiqCoreConfigV32.h"
120 #endif
121
122 #if defined(__GNUC__) && !defined(__clang__)
123 #pragma GCC diagnostic pop
124 #endif
125
126 #endif // RK_AIQ_CORE_CONFIG_H
127