1 /*
2 * Copyright (c) 2021-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 */
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <assert.h>
21 #include <errno.h>
22 #include "sample_comm.h"
23 #include "sample_misc_modules.h"
24 #include "sample_ae_module.h"
25 #include "sample_awb_module.h"
26 #include "sample_accm_module.h"
27 #include "sample_a3dlut_module.h"
28 #include "sample_adrc_module.h"
29 #include "sample_amerge_module.h"
30 #include "sample_agamma_module.h"
31 #include "sample_adehaze_module.h"
32 #include "sample_af_module.h"
33 #include "sample_image_process.h"
34 #include "sample_aynr_module.h"
35 #include "sample_acnr_module.h"
36 #include "sample_asharp_module.h"
37 #include "sample_abayer2dnr_module.h"
38 #include "sample_abayertnr_module.h"
39 #include "sample_csm_module.h"
40 #include "sample_ablc_module.h"
41 #include "sample_agic_module.h"
42 #include "sample_aldch_module.h"
43 #include "sample_aldch_v21_module.h"
44 #include "sample_adebayer_module.h"
45 #include "sample_alsc_module.h"
46 #include "sample_acp_module.h"
47 #include "sample_aie_module.h"
48 #include "sample_adpcc_module.h"
49 #include "sample_cgc_module.h"
50 #include "sample_cac_module.h"
51 #include "sample_again_module.h"
52 #include "sample_smartIr.h"
53
54 struct module_sample_info {
55 const char * const name;
56 XCamReturn (*func)(const void *arg);
57 void (*debug)(const void *arg);
58 };
59
60 #define MODULE_INFO(_modele_id, _func, _debug) \
61 [_modele_id] = { \
62 .name = #_modele_id, \
63 .func = _func, \
64 .debug = _debug, \
65 }
66
67 static struct module_sample_info module_samples[] = {
68 MODULE_INFO(RK_ISP_AE, sample_ae_module, sample_print_ae_info),
69 MODULE_INFO(RK_ISP_AWB, sample_awb_module, sample_print_awb_info),
70 MODULE_INFO(RK_ISP_AWB32, sample_awb32_module, sample_print_awb32_info),
71 MODULE_INFO(RK_ISP_AF, sample_af_module, sample_print_af_info),
72 MODULE_INFO(RK_ISP_ACCM, sample_accm_module, sample_print_accm_info),
73 MODULE_INFO(RK_ISP_A3DLUT, sample_a3dlut_module, sample_print_a3dlut_info),
74 MODULE_INFO(RK_ISP_ADRC, sample_adrc_module, sample_print_adrc_info),
75 MODULE_INFO(RK_ISP_AMERGE, sample_amerge_module, sample_print_amerge_info),
76 MODULE_INFO(RK_ISP_AGAMMA, sample_agamma_module, sample_print_agamma_info),
77 MODULE_INFO(RK_ISP_ADEHAZE, sample_adehaze_module, sample_print_adehaze_info),
78 MODULE_INFO(RK_ISP_AYNR, sample_aynr_module, sample_print_aynr_info),
79 MODULE_INFO(RK_ISP_ACNR, sample_acnr_module, sample_print_acnr_info),
80 MODULE_INFO(RK_ISP_ASHARP, sample_asharp_module, sample_print_asharp_info),
81 MODULE_INFO(RK_ISP_ABAYER2DNR, sample_abayer2dnr_module, sample_print_abayer2dnr_info),
82 MODULE_INFO(RK_ISP_ABAYERTNR, sample_abayertnr_module, sample_print_abayertnr_info),
83 MODULE_INFO(RK_ISP_CSM, sample_csm_module, sample_print_csm_info),
84 MODULE_INFO(RK_ISP_ABLC, sample_ablc_module, sample_print_ablc_info),
85 MODULE_INFO(RK_ISP_AGIC, sample_agic_module, sample_print_agic_info),
86 MODULE_INFO(RK_ISP_ALDCH, sample_aldch_module, sample_print_aldch_info),
87 MODULE_INFO(RK_ISP_ADEBAYER, sample_adebayer_module, sample_print_adebayer_info),
88 MODULE_INFO(RK_ISP_ACP, sample_acp_module, sample_print_acp_info),
89 MODULE_INFO(RK_ISP_AIE, sample_aie_module, sample_print_aie_info),
90 MODULE_INFO(RK_ISP_CGC, sample_cgc_module, sample_print_cgc_info),
91 MODULE_INFO(RK_ISP_CAC, sample_cac_module, sample_print_cac_info),
92 MODULE_INFO(RK_ISP_AGAIN, sample_again_module, sample_print_again_info),
93 MODULE_INFO(RK_ISP_ACCM_V2, sample_accm_v2_module, sample_print_accm_v2_info),
94 MODULE_INFO(RK_ISP_ALDCH_V21, sample_aldch_v21_module, sample_print_aldch_v21_info),
95 MODULE_INFO(RK_SMARTIR, sample_smartIr_module, sample_print_smartIr_info),
96 };
97
sample_usage()98 static void sample_usage()
99 {
100 CLEAR ();
101
102 printf("Usage : \n");
103 printf("\t 0) AE: module test sample.\n");
104 printf("\t 1) AWB: module test sample.\n");
105 printf("\t 2) AF: module test sample.\n");
106 printf("\t 3) ACCM: module test sample.\n");
107 printf("\t 4) A3DLUT: module test sample.\n");
108 printf("\t 5) ADRC: module test sample.\n");
109 printf("\t 6) AMERGE: module test sample.\n");
110 printf("\t 7) AGAMMA: module test sample.\n");
111 printf("\t 8) ADEHAZE: module test sample.\n");
112 printf("\t 9) AYNR: module test sample.\n");
113 printf("\t a) ACNR: module test sample.\n");
114 printf("\t b) ASHARP: module test sample.\n");
115 printf("\t c) ABAYER2DNR: module test sample.\n");
116 printf("\t d) ABAYERTNR: module test sample.\n");
117 printf("\t e) CSM: module test sample.\n");
118 printf("\t f) ABLC: module test sample.\n");
119 printf("\t g) AGIC: module test sample.\n");
120 printf("\t h) ALDCH: module test sample.\n");
121 printf("\t i) ADEBAYER: module test sample.\n");
122 printf("\t j) ALSC: module test sample.\n");
123 printf("\t k) ACP: module test sample.\n");
124 printf("\t l) AIE: module test sample.\n");
125 printf("\t m) CGC: module test sample.\n");
126 printf("\t n) CAC: module test sample.\n");
127 printf("\t o) AGAIN: module test sample.\n");
128 printf("\t p) AWBV32: module test sample.\n");
129 printf("\t r) CCMV2: module test sample.\n");
130 printf("\t s) ALDCHV32: module test sample.\n");
131 printf("\t t) SMARTIR: module test sample.\n");
132 printf("\t u) DPCC: module test sample.\n");
133 printf("\n");
134 printf("\t please press the key: ");
135
136 return;
137 }
138
sample_main(const void * arg)139 XCamReturn sample_main (const void *arg)
140 {
141 if (arg == NULL) {
142 ERR ("%s, arg is nullptr\n", __FUNCTION__);
143 return XCAM_RETURN_ERROR_PARAM;
144 }
145
146 sample_usage ();
147
148 int key = getchar ();
149 while (key == '\n' || key == '\r')
150 key = getchar ();
151
152 switch (key)
153 {
154 case '0': {
155 struct module_sample_info *info = &module_samples[RK_ISP_AE];
156 info->debug (nullptr);
157 info->func (arg);
158 break;
159 }
160 case '1': {
161 struct module_sample_info *info = &module_samples[RK_ISP_AWB];
162 info->debug (nullptr);
163 info->func (arg);
164 break;
165 }
166 case '2': {
167 struct module_sample_info *info = &module_samples[RK_ISP_AF];
168 info->debug (nullptr);
169 info->func (arg);
170 break;
171 }
172 case '3': {
173 struct module_sample_info *info = &module_samples[RK_ISP_ACCM];
174 info->debug (nullptr);
175 info->func (arg);
176 break;
177 }
178 case '4': {
179 struct module_sample_info *info = &module_samples[RK_ISP_A3DLUT];
180 info->debug (nullptr);
181 info->func (arg);
182 break;
183 }
184 case '5': {
185 printf("enter DRC module test\n");
186 struct module_sample_info *info = &module_samples[RK_ISP_ADRC];
187 info->debug (nullptr);
188 info->func (arg);
189 break;
190 }
191 case '6': {
192 struct module_sample_info *info = &module_samples[RK_ISP_AMERGE];
193 info->debug (nullptr);
194 info->func (arg);
195 break;
196 }
197 case '7': {
198 struct module_sample_info *info = &module_samples[RK_ISP_AGAMMA];
199 info->debug (nullptr);
200 info->func (arg);
201 break;
202 }
203 case '8': {
204 struct module_sample_info *info = &module_samples[RK_ISP_ADEHAZE];
205 info->debug (nullptr);
206 info->func (arg);
207 break;
208 }
209 case '9': {
210 printf("enter AYNR module test\n");
211 struct module_sample_info *info = &module_samples[RK_ISP_AYNR];
212 info->debug (nullptr);
213 info->func (arg);
214 break;
215 }
216 case 'a': {
217 printf("enter ACNR module test\n");
218 struct module_sample_info *info = &module_samples[RK_ISP_ACNR];
219 info->debug (nullptr);
220 info->func (arg);
221 break;
222 }
223 case 'b': {
224 printf("enter ASHARP module test\n");
225 struct module_sample_info *info = &module_samples[RK_ISP_ASHARP];
226 info->debug (nullptr);
227 info->func (arg);
228 break;
229 }
230 case 'c': {
231 printf("enter ABAYER2DNR module test\n");
232 struct module_sample_info *info = &module_samples[RK_ISP_ABAYER2DNR];
233 info->debug (nullptr);
234 info->func (arg);
235 break;
236 }
237 case 'd': {
238 printf("enter ABAYERTNR module test\n");
239 struct module_sample_info *info = &module_samples[RK_ISP_ABAYERTNR];
240 info->debug (nullptr);
241 info->func (arg);
242 break;
243 }
244 case 'e': {
245 printf("enter CSM module test\n");
246 struct module_sample_info *info = &module_samples[RK_ISP_CSM];
247 info->debug (nullptr);
248 info->func (arg);
249 break;
250 }
251 case 'f': {
252 printf("enter ABLC module test\n");
253 struct module_sample_info *info = &module_samples[RK_ISP_ABLC];
254 info->debug (nullptr);
255 info->func (arg);
256 break;
257 }
258 case 'g': {
259 printf("enter AGIC module test\n");
260 struct module_sample_info *info = &module_samples[RK_ISP_AGIC];
261 info->debug (nullptr);
262 info->func (arg);
263 break;
264 }
265 case 'h': {
266 struct module_sample_info *info = &module_samples[RK_ISP_ALDCH];
267 info->debug (nullptr);
268 info->func (arg);
269 break;
270 }
271 case 'i': {
272 struct module_sample_info *info = &module_samples[RK_ISP_ADEBAYER];
273 info->debug (nullptr);
274 info->func (arg);
275 break;
276 }
277 case 'j': {
278 printf("enter LSC module test\n");
279 sample_alsc_module(arg);
280 break;
281 }
282 case 'k': {
283 struct module_sample_info *info = &module_samples[RK_ISP_ACP];
284 info->debug (nullptr);
285 info->func (arg);
286 break;
287 }
288 case 'l': {
289 struct module_sample_info *info = &module_samples[RK_ISP_AIE];
290 info->debug (nullptr);
291 info->func (arg);
292 break;
293 }
294 case 'm': {
295 printf("enter CGC module test\n");
296 struct module_sample_info *info = &module_samples[RK_ISP_CGC];
297 info->debug (nullptr);
298 info->func (arg);
299 break;
300 }
301 case 'n': {
302 struct module_sample_info *info = &module_samples[RK_ISP_CAC];
303 info->debug (nullptr);
304 info->func (arg);
305 break;
306 }
307 case 'o': {
308 printf("enter GAIN module test\n");
309 struct module_sample_info *info = &module_samples[RK_ISP_AGAIN];
310 info->debug (nullptr);
311 info->func (arg);
312 break;
313 }
314 case 'p': {
315 struct module_sample_info *info = &module_samples[RK_ISP_AWB32];
316 info->debug (nullptr);
317 info->func (arg);
318 break;
319 }
320 case 'r': {
321 struct module_sample_info *info = &module_samples[RK_ISP_ACCM_V2];
322 info->debug (nullptr);
323 info->func (arg);
324 break;
325 }
326 case 's': {
327 struct module_sample_info *info = &module_samples[RK_ISP_ALDCH_V21];
328 info->debug (nullptr);
329 info->func (arg);
330 break;
331 }
332 case 't': {
333 struct module_sample_info *info = &module_samples[RK_SMARTIR];
334 info->debug (nullptr);
335 info->func (arg);
336 break;
337 }
338 case 'u': {
339 printf("enter DPCC module test\n");
340 sample_adpcc_module(arg);
341 break;
342 }
343 default:
344 break;
345 }
346
347 return XCAM_RETURN_NO_ERROR;
348 }
349