1 #include "rk_aiq_adpcc_algo.h"
2 #include "rk_aiq_algo_adpcc_itf.h"
3
4 #define DPCC_RK_MODE
5
AdpccInterpolation(int inPara,int * inMatrixX,int * inMatrixY)6 int AdpccInterpolation(int inPara, int* inMatrixX, int* inMatrixY)
7 {
8 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
9 int returnValue = 1;
10
11 float value = 1.0;
12 for(int i = 0; i < DPCC_MAX_ISO_LEVEL - 1; i++) {
13 if(inPara >= inMatrixX[i] && inPara < inMatrixX[i + 1]) {
14 value = ((float)inMatrixY[i] - (float)inMatrixY[i + 1])
15 / ((float)inMatrixX[i] - (float)inMatrixX[i + 1]);
16 value *= ((float)inPara - (float)inMatrixX[i] );
17 value += (float)inMatrixY[i];
18 break;
19 }
20 }
21
22 if(inPara < inMatrixX[0] ) {
23 value = (float)inMatrixY[0];
24 }
25
26 if(inPara >= inMatrixX[DPCC_MAX_ISO_LEVEL - 1] ) {
27 value = (float)inMatrixY[DPCC_MAX_ISO_LEVEL - 1];
28 }
29
30 returnValue = (int)(value + 0.5);
31
32 LOGI_ADPCC("%s(%d): inPara %d, returnValue %d", __FUNCTION__, __LINE__, inPara, returnValue);
33
34 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
35 return returnValue;
36 }
37
html_params_init(Adpcc_html_param_t * pParams)38 AdpccResult_t html_params_init(Adpcc_html_param_t *pParams)
39 {
40 AdpccResult_t ret = ADPCC_RET_SUCCESS;
41 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
42
43 if(pParams == NULL) {
44 ret = ADPCC_RET_NULL_POINTER;
45 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
46 return ret;
47 }
48
49 Adpcc_basic_params_t *pBasic = &pParams->stBasic;
50 Adpcc_bpt_params_t *pBpt = &pParams->stBpt;
51 Adpcc_pdaf_params_t *pPdaf = &pParams->stPdaf;
52 int iso_base = 50;
53
54 for(int i = 0; i < DPCC_MAX_ISO_LEVEL; i++) {
55 pBasic->arBasic[i].iso = iso_base * ( 1 << i);
56
57 #ifdef DPCC_RK_MODE
58 //mode 0x0000
59 pBasic->arBasic[i].stage1_enable = 1;
60 pBasic->arBasic[i].grayscale_mode = 0;
61 pBasic->arBasic[i].enable = 1;
62
63 //output_mode 0x0004
64 pBasic->arBasic[i].sw_rk_out_sel = 1;
65 pBasic->arBasic[i].sw_dpcc_output_sel = 1;
66 pBasic->arBasic[i].stage1_rb_3x3 = 0;
67 pBasic->arBasic[i].stage1_g_3x3 = 0;
68 pBasic->arBasic[i].stage1_incl_rb_center = 1;
69 pBasic->arBasic[i].stage1_incl_green_center = 1;
70
71 //set_use 0x0008
72 pBasic->arBasic[i].stage1_use_fix_set = 0;
73 pBasic->arBasic[i].stage1_use_set_3 = 0;
74 pBasic->arBasic[i].stage1_use_set_2 = 1;
75 pBasic->arBasic[i].stage1_use_set_1 = 0;
76
77 //methods_set_1 0x000c
78 pBasic->arBasic[i].sw_rk_red_blue1_en = 0;
79 pBasic->arBasic[i].rg_red_blue1_enable = 1;
80 pBasic->arBasic[i].rnd_red_blue1_enable = 1;
81 pBasic->arBasic[i].ro_red_blue1_enable = 1;
82 pBasic->arBasic[i].lc_red_blue1_enable = 0;
83 pBasic->arBasic[i].pg_red_blue1_enable = 1;
84 pBasic->arBasic[i].sw_rk_green1_en = 0;
85 pBasic->arBasic[i].rg_green1_enable = 1;
86 pBasic->arBasic[i].rnd_green1_enable = 1;
87 pBasic->arBasic[i].ro_green1_enable = 1;
88 pBasic->arBasic[i].lc_green1_enable = 0;
89 pBasic->arBasic[i].pg_green1_enable = 1;
90
91 //methods_set_2 0x0010
92 pBasic->arBasic[i].sw_rk_red_blue2_en = 1;
93 pBasic->arBasic[i].rg_red_blue2_enable = 0;
94 pBasic->arBasic[i].rnd_red_blue2_enable = 0;
95 pBasic->arBasic[i].ro_red_blue2_enable = 1;
96 pBasic->arBasic[i].lc_red_blue2_enable = 1;
97 pBasic->arBasic[i].pg_red_blue2_enable = 1;
98 pBasic->arBasic[i].sw_rk_green2_en = 1;
99 pBasic->arBasic[i].rg_green2_enable = 0;
100 pBasic->arBasic[i].rnd_green2_enable = 0;
101 pBasic->arBasic[i].ro_green2_enable = 1;
102 pBasic->arBasic[i].lc_green2_enable = 1;
103 pBasic->arBasic[i].pg_green2_enable = 1;
104
105 //methods_set_3 0x0014
106 pBasic->arBasic[i].sw_rk_red_blue3_en = 0;
107 pBasic->arBasic[i].rg_red_blue3_enable = 1;
108 pBasic->arBasic[i].rnd_red_blue3_enable = 1;
109 pBasic->arBasic[i].ro_red_blue3_enable = 1;
110 pBasic->arBasic[i].lc_red_blue3_enable = 1;
111 pBasic->arBasic[i].pg_red_blue3_enable = 1;
112 pBasic->arBasic[i].sw_rk_green3_en = 0;
113 pBasic->arBasic[i].rg_green3_enable = 1;
114 pBasic->arBasic[i].rnd_green3_enable = 1;
115 pBasic->arBasic[i].ro_green3_enable = 1;
116 pBasic->arBasic[i].lc_green3_enable = 1;
117 pBasic->arBasic[i].pg_green3_enable = 1;
118
119 //line_thresh_1 0x0018
120 pBasic->arBasic[i].sw_mindis1_rb = 0;
121 pBasic->arBasic[i].sw_mindis1_g = 0;
122 pBasic->arBasic[i].line_thr_1_rb = 8;
123 pBasic->arBasic[i].line_thr_1_g = 8;
124
125 //line_mad_fac_1 0x001c
126 pBasic->arBasic[i].sw_dis_scale_min1 = 0;
127 pBasic->arBasic[i].sw_dis_scale_max1 = 0;
128 pBasic->arBasic[i].line_mad_fac_1_rb = 4;
129 pBasic->arBasic[i].line_mad_fac_1_g = 4;
130
131 //pg_fac_1 0x0020
132 pBasic->arBasic[i].pg_fac_1_rb = 8;
133 pBasic->arBasic[i].pg_fac_1_g = 8;
134
135 //rnd_thresh_1 0x0024
136 pBasic->arBasic[i].rnd_thr_1_rb = 10;
137 pBasic->arBasic[i].rnd_thr_1_g = 10;
138
139 //rg_fac_1 0x0028
140 pBasic->arBasic[i].rg_fac_1_rb = 32;
141 pBasic->arBasic[i].rg_fac_1_g = 32;
142
143
144 //line_thresh_2 0x002c
145 pBasic->arBasic[i].sw_mindis2_rb = 20;
146 pBasic->arBasic[i].sw_mindis2_g = 20;
147 pBasic->arBasic[i].line_thr_2_rb = 20;
148 pBasic->arBasic[i].line_thr_2_g = 20;
149
150 //line_mad_fac_2 0x0030
151 pBasic->arBasic[i].sw_dis_scale_min2 = 12;
152 pBasic->arBasic[i].sw_dis_scale_max2 = 12;
153 pBasic->arBasic[i].line_mad_fac_2_rb = 10;
154 pBasic->arBasic[i].line_mad_fac_2_g = 10;
155
156 //pg_fac_2 0x0034
157 pBasic->arBasic[i].pg_fac_2_rb = 5;
158 pBasic->arBasic[i].pg_fac_2_g = 4;
159
160 //rnd_thresh_2 0x0038
161 pBasic->arBasic[i].rnd_thr_2_rb = 0;
162 pBasic->arBasic[i].rnd_thr_2_g = 0;
163
164 //rg_fac_2 0x003c
165 pBasic->arBasic[i].rg_fac_2_rb = 0;
166 pBasic->arBasic[i].rg_fac_2_g = 0;
167
168
169 //line_thresh_3 0x0040
170 pBasic->arBasic[i].sw_mindis3_rb = 0;
171 pBasic->arBasic[i].sw_mindis3_g = 0;
172 pBasic->arBasic[i].line_thr_3_rb = 32;
173 pBasic->arBasic[i].line_thr_3_g = 32;
174
175 //line_mad_fac_3 0x0044
176 pBasic->arBasic[i].sw_dis_scale_min3 = 0;
177 pBasic->arBasic[i].sw_dis_scale_max3 = 0;
178 pBasic->arBasic[i].line_mad_fac_3_rb = 4;
179 pBasic->arBasic[i].line_mad_fac_3_g = 4;
180
181 //pg_fac_3 0x0048
182 pBasic->arBasic[i].pg_fac_3_rb = 10;
183 pBasic->arBasic[i].pg_fac_3_g = 10;
184
185 //rnd_thresh_3 0x004c
186 pBasic->arBasic[i].rnd_thr_3_rb = 8;
187 pBasic->arBasic[i].rnd_thr_3_g = 6;
188
189 //rg_fac_3 0x0050
190 pBasic->arBasic[i].rg_fac_3_rb = 4;
191 pBasic->arBasic[i].rg_fac_3_g = 4;
192
193 //ro_limits 0x0054
194 pBasic->arBasic[i].ro_lim_3_rb = 2;
195 pBasic->arBasic[i].ro_lim_3_g = 1;
196 pBasic->arBasic[i].ro_lim_2_rb = 2;
197 pBasic->arBasic[i].ro_lim_2_g = 2;
198 pBasic->arBasic[i].ro_lim_1_rb = 1;
199 pBasic->arBasic[i].ro_lim_1_g = 1;
200
201 //rnd_offs 0x0058
202 pBasic->arBasic[i].rnd_offs_3_rb = 2;
203 pBasic->arBasic[i].rnd_offs_3_g = 2;
204 pBasic->arBasic[i].rnd_offs_2_rb = 0;
205 pBasic->arBasic[i].rnd_offs_2_g = 0;
206 pBasic->arBasic[i].rnd_offs_1_rb = 2;
207 pBasic->arBasic[i].rnd_offs_1_g = 2;
208 #else
209
210 //mode 0x0000
211 pBasic->arBasic[i].stage1_enable = 1;
212 pBasic->arBasic[i].grayscale_mode = 0;
213 pBasic->arBasic[i].enable = 1;
214
215 //output_mode 0x0004
216 pBasic->arBasic[i].sw_rk_out_sel = 0;
217 pBasic->arBasic[i].sw_dpcc_output_sel = 0;
218 pBasic->arBasic[i].stage1_rb_3x3 = 0;
219 pBasic->arBasic[i].stage1_g_3x3 = 0;
220 pBasic->arBasic[i].stage1_incl_rb_center = 1;
221 pBasic->arBasic[i].stage1_incl_green_center = 1;
222
223 //set_use 0x0008
224 pBasic->arBasic[i].SetEnable.fix_set = 0;
225 pBasic->arBasic[i].stage1_use_set_3 = 1;
226 pBasic->arBasic[i].stage1_use_set_2 = 1;
227 pBasic->arBasic[i].stage1_use_set_1 = 1;
228
229 //methods_set_1 0x000c
230 pBasic->arBasic[i].sw_rk_red_blue1_en = 0;
231 pBasic->arBasic[i].rg_red_blue1_enable = 1;
232 pBasic->arBasic[i].rnd_red_blue1_enable = 1;
233 pBasic->arBasic[i].ro_red_blue1_enable = 1;
234 pBasic->arBasic[i].lc_red_blue1_enable = 0;
235 pBasic->arBasic[i].pg_red_blue1_enable = 1;
236 pBasic->arBasic[i].sw_rk_green1_en = 0;
237 pBasic->arBasic[i].rg_green1_enable = 1;
238 pBasic->arBasic[i].rnd_green1_enable = 1;
239 pBasic->arBasic[i].ro_green1_enable = 1;
240 pBasic->arBasic[i].lc_green1_enable = 0;
241 pBasic->arBasic[i].pg_green1_enable = 1;
242
243 //methods_set_2 0x0010
244 pBasic->arBasic[i].sw_rk_red_blue2_en = 0;
245 pBasic->arBasic[i].rg_red_blue2_enable = 0;
246 pBasic->arBasic[i].rnd_red_blue2_enable = 0;
247 pBasic->arBasic[i].ro_red_blue2_enable = 1;
248 pBasic->arBasic[i].lc_red_blue2_enable = 1;
249 pBasic->arBasic[i].pg_red_blue2_enable = 1;
250 pBasic->arBasic[i].sw_rk_green2_en = 0;
251 pBasic->arBasic[i].rg_green2_enable = 0;
252 pBasic->arBasic[i].rnd_green2_enable = 0;
253 pBasic->arBasic[i].ro_green2_enable = 1;
254 pBasic->arBasic[i].lc_green2_enable = 1;
255 pBasic->arBasic[i].pg_green2_enable = 1;
256
257 //methods_set_3 0x0014
258 pBasic->arBasic[i].sw_rk_red_blue3_en = 0;
259 pBasic->arBasic[i].rg_red_blue3_enable = 1;
260 pBasic->arBasic[i].rnd_red_blue3_enable = 1;
261 pBasic->arBasic[i].ro_red_blue3_enable = 1;
262 pBasic->arBasic[i].lc_red_blue3_enable = 1;
263 pBasic->arBasic[i].pg_red_blue3_enable = 1;
264 pBasic->arBasic[i].sw_rk_green3_en = 0;
265 pBasic->arBasic[i].rg_green3_enable = 1;
266 pBasic->arBasic[i].rnd_green3_enable = 1;
267 pBasic->arBasic[i].ro_green3_enable = 1;
268 pBasic->arBasic[i].lc_green3_enable = 1;
269 pBasic->arBasic[i].pg_green3_enable = 1;
270
271 //line_thresh_1 0x0018
272 pBasic->arBasic[i].sw_mindis1_rb = 0;
273 pBasic->arBasic[i].sw_mindis1_g = 0;
274 pBasic->arBasic[i].line_thr_1_rb = 8;
275 pBasic->arBasic[i].line_thr_1_g = 8;
276
277 //line_mad_fac_1 0x001c
278 pBasic->arBasic[i].sw_dis_scale_min1 = 0;
279 pBasic->arBasic[i].sw_dis_scale_max1 = 0;
280 pBasic->arBasic[i].line_mad_fac_1_rb = 4;
281 pBasic->arBasic[i].line_mad_fac_1_g = 4;
282
283 //pg_fac_1 0x0020
284 pBasic->arBasic[i].pg_fac_1_rb = 8;
285 pBasic->arBasic[i].pg_fac_1_g = 8;
286
287 //rnd_thresh_1 0x0024
288 pBasic->arBasic[i].rnd_thr_1_rb = 10;
289 pBasic->arBasic[i].rnd_thr_1_g = 10;
290
291 //rg_fac_1 0x0028
292 pBasic->arBasic[i].rg_fac_1_rb = 32;
293 pBasic->arBasic[i].rg_fac_1_g = 32;
294
295
296 //line_thresh_2 0x002c
297 pBasic->arBasic[i].sw_mindis2_rb = 0;
298 pBasic->arBasic[i].sw_mindis2_g = 0;
299 pBasic->arBasic[i].line_thr_2_rb = 20;
300 pBasic->arBasic[i].line_thr_2_g = 20;
301
302 //line_mad_fac_2 0x0030
303 pBasic->arBasic[i].sw_dis_scale_min2 = 0;
304 pBasic->arBasic[i].sw_dis_scale_max2 = 0;
305 pBasic->arBasic[i].line_mad_fac_2_rb = 10;
306 pBasic->arBasic[i].line_mad_fac_2_g = 10;
307
308 //pg_fac_2 0x0034
309 pBasic->arBasic[i].pg_fac_2_rb = 4;
310 pBasic->arBasic[i].pg_fac_2_g = 5;
311
312 //rnd_thresh_2 0x0038
313 pBasic->arBasic[i].rnd_thr_2_rb = 0;
314 pBasic->arBasic[i].rnd_thr_2_g = 0;
315
316 //rg_fac_2 0x003c
317 pBasic->arBasic[i].rg_fac_2_rb = 0;
318 pBasic->arBasic[i].rg_fac_2_g = 0;
319
320
321 //line_thresh_3 0x0040
322 pBasic->arBasic[i].sw_mindis3_rb = 0;
323 pBasic->arBasic[i].sw_mindis3_g = 0;
324 pBasic->arBasic[i].line_thr_3_rb = 32;
325 pBasic->arBasic[i].line_thr_3_g = 32;
326
327 //line_mad_fac_3 0x0044
328 pBasic->arBasic[i].sw_dis_scale_min3 = 0;
329 pBasic->arBasic[i].sw_dis_scale_max3 = 0;
330 pBasic->arBasic[i].line_mad_fac_3_rb = 4;
331 pBasic->arBasic[i].line_mad_fac_3_g = 4;
332
333 //pg_fac_3 0x0048
334 pBasic->arBasic[i].pg_fac_3_rb = 10;
335 pBasic->arBasic[i].pg_fac_3_g = 10;
336
337 //rnd_thresh_3 0x004c
338 pBasic->arBasic[i].rnd_thr_3_rb = 8;
339 pBasic->arBasic[i].rnd_thr_3_g = 6;
340
341 //rg_fac_3 0x0050
342 pBasic->arBasic[i].rg_fac_3_rb = 4;
343 pBasic->arBasic[i].rg_fac_3_g = 4;
344
345 //ro_limits 0x0054
346 pBasic->arBasic[i].ro_lim_3_rb = 2;
347 pBasic->arBasic[i].ro_lim_3_g = 1;
348 pBasic->arBasic[i].ro_lim_2_rb = 2;
349 pBasic->arBasic[i].ro_lim_2_g = 2;
350 pBasic->arBasic[i].ro_lim_1_rb = 1;
351 pBasic->arBasic[i].ro_lim_1_g = 1;
352
353 //rnd_offs 0x0058
354 pBasic->arBasic[i].rnd_offs_3_rb = 2;
355 pBasic->arBasic[i].rnd_offs_3_g = 2;
356 pBasic->arBasic[i].rnd_offs_2_rb = 2;
357 pBasic->arBasic[i].rnd_offs_2_g = 2;
358 pBasic->arBasic[i].rnd_offs_1_rb = 2;
359 pBasic->arBasic[i].rnd_offs_1_g = 2;
360 #endif
361 }
362
363 memset(pBpt, 0x00, sizeof(Adpcc_bpt_params_t));
364 memset(pPdaf, 0x00, sizeof(Adpcc_pdaf_params_t));
365
366 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
367 return ret;
368
369 }
370
dpcc_sensor_params_init(CalibDb_Dpcc_Sensor_t * pSensor,CalibDbV2_Dpcc_t * pCalib)371 AdpccResult_t dpcc_sensor_params_init(CalibDb_Dpcc_Sensor_t *pSensor, CalibDbV2_Dpcc_t *pCalib)
372 {
373 AdpccResult_t ret = ADPCC_RET_SUCCESS;
374 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
375
376 if(pSensor == NULL) {
377 ret = ADPCC_RET_NULL_POINTER;
378 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
379 return ret;
380 }
381
382 if(pCalib == NULL) {
383 ret = ADPCC_RET_NULL_POINTER;
384 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
385 return ret;
386 }
387
388 pSensor->en = pCalib->DpccTuningPara.Sensor_dpcc.sensor_dpcc_auto_en ? 1.0 : 0.0;
389 pSensor->max_level = (float)(pCalib->DpccTuningPara.Sensor_dpcc.max_level);
390
391 for(int i = 0; i < pCalib->DpccTuningPara.Sensor_dpcc.SensorDpcc_Data.ISO_len; i++) {
392 pSensor->iso[i] = pCalib->DpccTuningPara.Sensor_dpcc.SensorDpcc_Data.ISO[i];
393 pSensor->level_single[i] = (float)(pCalib->DpccTuningPara.Sensor_dpcc.SensorDpcc_Data.level_single[i]);
394 pSensor->level_multiple[i] = (float)(pCalib->DpccTuningPara.Sensor_dpcc.SensorDpcc_Data.level_multiple[i]);
395 }
396
397 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
398 return ret;
399
400 }
401
dpcc_fast_mode_basic_params_init(CalibDb_Dpcc_Fast_Mode_t * pFast,CalibDbV2_Dpcc_t * pCalib)402 AdpccResult_t dpcc_fast_mode_basic_params_init(CalibDb_Dpcc_Fast_Mode_t *pFast, CalibDbV2_Dpcc_t *pCalib)
403 {
404 AdpccResult_t ret = ADPCC_RET_SUCCESS;
405 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
406
407 if(pFast == NULL) {
408 ret = ADPCC_RET_NULL_POINTER;
409 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
410 return ret;
411 }
412
413 if(pCalib == NULL) {
414 ret = ADPCC_RET_NULL_POINTER;
415 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
416 return ret;
417 }
418
419 pFast->fast_mode_en = pCalib->DpccTuningPara.Fast_Mode.Fast_mode_en ? 1 : 0;
420 pFast->fast_mode_single_en = pCalib->DpccTuningPara.Fast_Mode.Single_enable;
421 pFast->fast_mode_double_en = pCalib->DpccTuningPara.Fast_Mode.Double_enable;
422 pFast->fast_mode_triple_en = pCalib->DpccTuningPara.Fast_Mode.Triple_enable;
423
424 for(int i = 0; i < pCalib->DpccTuningPara.Fast_Mode.Fast_Data.ISO_len; i++) {
425 pFast->ISO[i] = pCalib->DpccTuningPara.Fast_Mode.Fast_Data.ISO[i];
426 pFast->fast_mode_single_level[i] = pCalib->DpccTuningPara.Fast_Mode.Fast_Data.Single_level[i];
427 pFast->fast_mode_double_level[i] = pCalib->DpccTuningPara.Fast_Mode.Fast_Data.Double_level[i];
428 pFast->fast_mode_triple_level[i] = pCalib->DpccTuningPara.Fast_Mode.Fast_Data.Triple_level[i];
429 }
430
431 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
432 return ret;
433
434 }
435
dpcc_expert_mode_basic_params_init(Adpcc_basic_params_t * pBasic,CalibDbV2_Dpcc_t * pCalib)436 AdpccResult_t dpcc_expert_mode_basic_params_init(Adpcc_basic_params_t *pBasic, CalibDbV2_Dpcc_t *pCalib)
437 {
438 AdpccResult_t ret = ADPCC_RET_SUCCESS;
439 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
440
441 if(pBasic == NULL) {
442 ret = ADPCC_RET_NULL_POINTER;
443 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
444 return ret;
445 }
446
447 if(pCalib == NULL) {
448 ret = ADPCC_RET_NULL_POINTER;
449 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
450 return ret;
451 }
452
453 for(int i = 0; i < DPCC_MAX_ISO_LEVEL; i++) {
454 pBasic->arBasic[i].iso = pCalib->DpccTuningPara.Expert_Mode.SetEnable.ISO[i];
455
456 //mode 0x0000
457 pBasic->arBasic[i].stage1_enable = pCalib->DpccTuningPara.Expert_Mode.stage1_Enable ? 1 : 0;
458 pBasic->arBasic[i].grayscale_mode = pCalib->DpccTuningPara.Expert_Mode.grayscale_mode ? 1 : 0;
459 pBasic->arBasic[i].enable = pCalib->DpccTuningPara.Enable ? 1 : 0;
460
461 //output_mode 0x0004
462 pBasic->arBasic[i].sw_rk_out_sel = pCalib->DpccTuningPara.Expert_Mode.rk_out_sel;
463 pBasic->arBasic[i].sw_dpcc_output_sel = pCalib->DpccTuningPara.Expert_Mode.dpcc_out_sel ? 1 : 0;
464 pBasic->arBasic[i].stage1_rb_3x3 = pCalib->DpccTuningPara.Expert_Mode.stage1_rb_3x3 ? 1 : 0;
465 pBasic->arBasic[i].stage1_g_3x3 = pCalib->DpccTuningPara.Expert_Mode.stage1_g_3x3 ? 1 : 0;
466 pBasic->arBasic[i].stage1_incl_rb_center = pCalib->DpccTuningPara.Expert_Mode.stage1_inc_rb_center ? 1 : 0;
467 pBasic->arBasic[i].stage1_incl_green_center = pCalib->DpccTuningPara.Expert_Mode.stage1_inc_g_center ? 1 : 0;
468
469 //set_use 0x0008
470 pBasic->arBasic[i].stage1_use_fix_set = pCalib->DpccTuningPara.Expert_Mode.SetEnable.fix_set[i];
471 pBasic->arBasic[i].stage1_use_set_3 = pCalib->DpccTuningPara.Expert_Mode.SetEnable.set3[i];
472 pBasic->arBasic[i].stage1_use_set_2 = pCalib->DpccTuningPara.Expert_Mode.SetEnable.set2[i];
473 pBasic->arBasic[i].stage1_use_set_1 = pCalib->DpccTuningPara.Expert_Mode.SetEnable.set1[i];
474
475 //methods_set_1 0x000c
476 pBasic->arBasic[i].sw_rk_red_blue1_en = pCalib->DpccTuningPara.Expert_Mode.set1.RK.RK_enable[i];
477 pBasic->arBasic[i].rg_red_blue1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RG.RG_enable[i];
478 pBasic->arBasic[i].rnd_red_blue1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RND.RND_enable[i];
479 pBasic->arBasic[i].ro_red_blue1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RO.RO_enable[i];
480 pBasic->arBasic[i].lc_red_blue1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.LC.LC_enable[i];
481 pBasic->arBasic[i].pg_red_blue1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.PG.PG_enable[i];
482 pBasic->arBasic[i].sw_rk_green1_en = pCalib->DpccTuningPara.Expert_Mode.set1.RK.RK_enable[i];
483 pBasic->arBasic[i].rg_green1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RG.RG_enable[i];
484 pBasic->arBasic[i].rnd_green1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RND.RND_enable[i];
485 pBasic->arBasic[i].ro_green1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.RO.RO_enable[i];
486 pBasic->arBasic[i].lc_green1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.LC.LC_enable[i];
487 pBasic->arBasic[i].pg_green1_enable = pCalib->DpccTuningPara.Expert_Mode.set1.PG.PG_enable[i];
488
489 //methods_set_2 0x0010
490 pBasic->arBasic[i].sw_rk_red_blue2_en = pCalib->DpccTuningPara.Expert_Mode.set2.RK.RK_enable[i];
491 pBasic->arBasic[i].rg_red_blue2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RG.RG_enable[i];
492 pBasic->arBasic[i].rnd_red_blue2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RND.RND_enable[i];
493 pBasic->arBasic[i].ro_red_blue2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RO.RO_enable[i];
494 pBasic->arBasic[i].lc_red_blue2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.LC.LC_enable[i];
495 pBasic->arBasic[i].pg_red_blue2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.PG.PG_enable[i];
496 pBasic->arBasic[i].sw_rk_green2_en = pCalib->DpccTuningPara.Expert_Mode.set2.RK.RK_enable[i];
497 pBasic->arBasic[i].rg_green2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RG.RG_enable[i];
498 pBasic->arBasic[i].rnd_green2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RND.RND_enable[i];
499 pBasic->arBasic[i].ro_green2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.RO.RO_enable[i];
500 pBasic->arBasic[i].lc_green2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.LC.LC_enable[i];
501 pBasic->arBasic[i].pg_green2_enable = pCalib->DpccTuningPara.Expert_Mode.set2.PG.PG_enable[i];
502
503 //methods_set_3 0x0014
504 pBasic->arBasic[i].sw_rk_red_blue3_en = pCalib->DpccTuningPara.Expert_Mode.set3.RK.RK_enable[i];
505 pBasic->arBasic[i].rg_red_blue3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RG.RG_enable[i];
506 pBasic->arBasic[i].rnd_red_blue3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RND.RND_enable[i];
507 pBasic->arBasic[i].ro_red_blue3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RO.RO_enable[i];
508 pBasic->arBasic[i].lc_red_blue3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.LC.LC_enable[i];
509 pBasic->arBasic[i].pg_red_blue3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.PG.PG_enable[i];
510 pBasic->arBasic[i].sw_rk_green3_en = pCalib->DpccTuningPara.Expert_Mode.set3.RK.RK_enable[i];
511 pBasic->arBasic[i].rg_green3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RG.RG_enable[i];
512 pBasic->arBasic[i].rnd_green3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RND.RND_enable[i];
513 pBasic->arBasic[i].ro_green3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.RO.RO_enable[i];
514 pBasic->arBasic[i].lc_green3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.LC.LC_enable[i];
515 pBasic->arBasic[i].pg_green3_enable = pCalib->DpccTuningPara.Expert_Mode.set3.PG.PG_enable[i];
516
517 //line_thresh_1 0x0018
518 pBasic->arBasic[i].sw_mindis1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.RK.rb_sw_mindis[i];
519 pBasic->arBasic[i].sw_mindis1_g = pCalib->DpccTuningPara.Expert_Mode.set1.RK.g_sw_mindis[i];
520 pBasic->arBasic[i].line_thr_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.LC.rb_line_thr[i];
521 pBasic->arBasic[i].line_thr_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.LC.g_line_thr[i];
522
523 //line_mad_fac_1 0x001c
524 pBasic->arBasic[i].sw_dis_scale_min1 = pCalib->DpccTuningPara.Expert_Mode.set1.RK.sw_dis_scale_min[i];
525 pBasic->arBasic[i].sw_dis_scale_max1 = pCalib->DpccTuningPara.Expert_Mode.set1.RK.sw_dis_scale_max[i];
526 pBasic->arBasic[i].line_mad_fac_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.LC.rb_line_mad_fac[i];
527 pBasic->arBasic[i].line_mad_fac_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.LC.g_line_mad_fac[i];
528
529 //pg_fac_1 0x0020
530 pBasic->arBasic[i].pg_fac_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.PG.rb_pg_fac[i];
531 pBasic->arBasic[i].pg_fac_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.PG.g_pg_fac[i];
532
533 //rnd_thresh_1 0x0024
534 pBasic->arBasic[i].rnd_thr_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.RND.rb_rnd_thr[i];
535 pBasic->arBasic[i].rnd_thr_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.RND.g_rnd_thr[i];
536
537 //rg_fac_1 0x0028
538 pBasic->arBasic[i].rg_fac_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.RG.rb_rg_fac[i];
539 pBasic->arBasic[i].rg_fac_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.RG.g_rg_fac[i];
540
541
542 //line_thresh_2 0x002c
543 pBasic->arBasic[i].sw_mindis2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.RK.rb_sw_mindis[i];
544 pBasic->arBasic[i].sw_mindis2_g = pCalib->DpccTuningPara.Expert_Mode.set2.RK.g_sw_mindis[i];
545 pBasic->arBasic[i].line_thr_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.LC.rb_line_thr[i];
546 pBasic->arBasic[i].line_thr_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.LC.g_line_thr[i];
547
548 //line_mad_fac_2 0x0030
549 pBasic->arBasic[i].sw_dis_scale_min2 = pCalib->DpccTuningPara.Expert_Mode.set2.RK.sw_dis_scale_min[i];
550 pBasic->arBasic[i].sw_dis_scale_max2 = pCalib->DpccTuningPara.Expert_Mode.set2.RK.sw_dis_scale_max[i];
551 pBasic->arBasic[i].line_mad_fac_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.LC.rb_line_mad_fac[i];
552 pBasic->arBasic[i].line_mad_fac_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.LC.g_line_mad_fac[i];
553
554 //pg_fac_2 0x0034
555 pBasic->arBasic[i].pg_fac_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.PG.rb_pg_fac[i];
556 pBasic->arBasic[i].pg_fac_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.PG.g_pg_fac[i];
557
558 //rnd_thresh_2 0x0038
559 pBasic->arBasic[i].rnd_thr_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.RND.rb_rnd_thr[i];
560 pBasic->arBasic[i].rnd_thr_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.RND.g_rnd_thr[i];
561
562 //rg_fac_2 0x003c
563 pBasic->arBasic[i].rg_fac_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.RG.rb_rg_fac[i];
564 pBasic->arBasic[i].rg_fac_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.RG.g_rg_fac[i];
565
566
567 //line_thresh_3 0x0040
568 pBasic->arBasic[i].sw_mindis3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.RK.rb_sw_mindis[i];
569 pBasic->arBasic[i].sw_mindis3_g = pCalib->DpccTuningPara.Expert_Mode.set3.RK.g_sw_mindis[i];
570 pBasic->arBasic[i].line_thr_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.LC.rb_line_thr[i];
571 pBasic->arBasic[i].line_thr_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.LC.g_line_thr[i];
572
573 //line_mad_fac_3 0x0044
574 pBasic->arBasic[i].sw_dis_scale_min3 = pCalib->DpccTuningPara.Expert_Mode.set3.RK.sw_dis_scale_min[i];
575 pBasic->arBasic[i].sw_dis_scale_max3 = pCalib->DpccTuningPara.Expert_Mode.set3.RK.sw_dis_scale_max[i];
576 pBasic->arBasic[i].line_mad_fac_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.LC.rb_line_mad_fac[i];
577 pBasic->arBasic[i].line_mad_fac_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.LC.g_line_mad_fac[i];
578
579 //pg_fac_3 0x0048
580 pBasic->arBasic[i].pg_fac_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.PG.rb_pg_fac[i];
581 pBasic->arBasic[i].pg_fac_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.PG.g_pg_fac[i];
582
583 //rnd_thresh_3 0x004c
584 pBasic->arBasic[i].rnd_thr_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.RND.rb_rnd_thr[i];
585 pBasic->arBasic[i].rnd_thr_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.RND.g_rnd_thr[i];
586
587 //rg_fac_3 0x0050
588 pBasic->arBasic[i].rg_fac_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.RG.rb_rg_fac[i];
589 pBasic->arBasic[i].rg_fac_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.RG.g_rg_fac[i];
590
591 //ro_limits 0x0054
592 pBasic->arBasic[i].ro_lim_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.RO.rb_ro_lim[i];
593 pBasic->arBasic[i].ro_lim_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.RO.g_ro_lim[i];
594 pBasic->arBasic[i].ro_lim_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.RO.rb_ro_lim[i];
595 pBasic->arBasic[i].ro_lim_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.RO.g_ro_lim[i];
596 pBasic->arBasic[i].ro_lim_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.RO.rb_ro_lim[i];
597 pBasic->arBasic[i].ro_lim_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.RO.g_ro_lim[i];
598
599 //rnd_offs 0x0058
600 pBasic->arBasic[i].rnd_offs_3_rb = pCalib->DpccTuningPara.Expert_Mode.set3.RND.rb_rnd_offs[i];
601 pBasic->arBasic[i].rnd_offs_3_g = pCalib->DpccTuningPara.Expert_Mode.set3.RND.g_rnd_offs[i];
602 pBasic->arBasic[i].rnd_offs_2_rb = pCalib->DpccTuningPara.Expert_Mode.set2.RND.rb_rnd_offs[i];
603 pBasic->arBasic[i].rnd_offs_2_g = pCalib->DpccTuningPara.Expert_Mode.set2.RND.g_rnd_offs[i];
604 pBasic->arBasic[i].rnd_offs_1_rb = pCalib->DpccTuningPara.Expert_Mode.set1.RND.rb_rnd_offs[i];
605 pBasic->arBasic[i].rnd_offs_1_g = pCalib->DpccTuningPara.Expert_Mode.set1.RND.g_rnd_offs[i];
606
607 }
608
609 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
610 return ret;
611
612 }
613
dpcc_pdaf_params_init(Adpcc_pdaf_params_t * pPdaf,CalibDb_Dpcc_Pdaf_V20_t * pCalib)614 AdpccResult_t dpcc_pdaf_params_init(Adpcc_pdaf_params_t *pPdaf, CalibDb_Dpcc_Pdaf_V20_t *pCalib)
615 {
616 AdpccResult_t ret = ADPCC_RET_SUCCESS;
617 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
618
619 if(pPdaf == NULL) {
620 ret = ADPCC_RET_NULL_POINTER;
621 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
622 return ret;
623 }
624
625 if(pCalib == NULL) {
626 ret = ADPCC_RET_NULL_POINTER;
627 LOGE_ADPCC("%s(%d): invalid input params", __FUNCTION__, __LINE__);
628 return ret;
629 }
630
631 pPdaf->sw_pdaf_en = pCalib->en;
632
633 for(int i = 0; i < 16; i++) {
634 pPdaf->pdaf_point_en[i] = pCalib->point_en[i] ? 1 : 0;
635 pPdaf->point[i].x = pCalib->point_x[i];
636 pPdaf->point[i].y = pCalib->point_y[i];
637 }
638
639 pPdaf->pdaf_offsetx = pCalib->offsetx;
640 pPdaf->pdaf_offsety = pCalib->offsety;
641 pPdaf->pdaf_wrapx = pCalib->wrapx;
642 pPdaf->pdaf_wrapy = pCalib->wrapy;
643 pPdaf->pdaf_wrapx_num = pCalib->wrapx_num;
644 pPdaf->pdaf_wrapy_num = pCalib->wrapy_num;
645 pPdaf->pdaf_forward_med = pCalib->forward_med;
646
647 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
648 return ret;
649 }
650
Api_Expert_mode_select(Adpcc_basic_cfg_params_t * pSelect,Adpcc_Manual_Attr_t * pstmaunal)651 AdpccResult_t Api_Expert_mode_select(
652 Adpcc_basic_cfg_params_t *pSelect,
653 Adpcc_Manual_Attr_t *pstmaunal)
654 {
655 AdpccResult_t ret = ADPCC_RET_SUCCESS;
656
657 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
658
659 if(pSelect == NULL) {
660 ret = ADPCC_RET_NULL_POINTER;
661 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
662 return ret;
663 }
664
665 if(pstmaunal == NULL) {
666 ret = ADPCC_RET_NULL_POINTER;
667 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
668 return ret;
669 }
670
671 //mode 0x0000
672 pSelect->stage1_enable = pstmaunal->stOnfly.expert_mode.stage1_enable;
673 pSelect->grayscale_mode = pstmaunal->stOnfly.expert_mode.grayscale_mode;
674 pSelect->enable = pstmaunal->stOnfly.expert_mode.enable;
675
676 //output_mode 0x0004
677 pSelect->sw_rk_out_sel = pstmaunal->stOnfly.expert_mode.sw_rk_out_sel;
678 pSelect->sw_dpcc_output_sel = pstmaunal->stOnfly.expert_mode.sw_dpcc_output_sel;
679 pSelect->stage1_rb_3x3 = pstmaunal->stOnfly.expert_mode.stage1_rb_3x3;
680 pSelect->stage1_g_3x3 = pstmaunal->stOnfly.expert_mode.stage1_g_3x3;
681 pSelect->stage1_incl_rb_center = pstmaunal->stOnfly.expert_mode.stage1_incl_rb_center;
682 pSelect->stage1_incl_green_center = pstmaunal->stOnfly.expert_mode.stage1_incl_green_center;
683
684 //set_use 0x0008
685 pSelect->stage1_use_fix_set = pstmaunal->stOnfly.expert_mode.stage1_use_fix_set;
686 pSelect->stage1_use_set_3 = pstmaunal->stOnfly.expert_mode.stage1_use_set_3;
687 pSelect->stage1_use_set_2 = pstmaunal->stOnfly.expert_mode.stage1_use_set_2;
688 pSelect->stage1_use_set_1 = pstmaunal->stOnfly.expert_mode.stage1_use_set_1;
689
690 //methods_set_1 0x000c
691 pSelect->sw_rk_red_blue1_en = pstmaunal->stOnfly.expert_mode.sw_rk_red_blue1_en;
692 pSelect->rg_red_blue1_enable = pstmaunal->stOnfly.expert_mode.rg_red_blue1_enable;
693 pSelect->rnd_red_blue1_enable = pstmaunal->stOnfly.expert_mode.rnd_red_blue1_enable;
694 pSelect->ro_red_blue1_enable = pstmaunal->stOnfly.expert_mode.ro_red_blue1_enable;
695 pSelect->lc_red_blue1_enable = pstmaunal->stOnfly.expert_mode.lc_red_blue1_enable;
696 pSelect->pg_red_blue1_enable = pstmaunal->stOnfly.expert_mode.pg_red_blue1_enable;
697 pSelect->sw_rk_green1_en = pstmaunal->stOnfly.expert_mode.sw_rk_green1_en;
698 pSelect->rg_green1_enable = pstmaunal->stOnfly.expert_mode.rg_green1_enable;
699 pSelect->rnd_green1_enable = pstmaunal->stOnfly.expert_mode.rnd_green1_enable;
700 pSelect->ro_green1_enable = pstmaunal->stOnfly.expert_mode.ro_green1_enable;
701 pSelect->lc_green1_enable = pstmaunal->stOnfly.expert_mode.lc_green1_enable;
702 pSelect->pg_green1_enable = pstmaunal->stOnfly.expert_mode.pg_green1_enable;
703
704 //methods_set_2 0x0010
705 pSelect->sw_rk_red_blue2_en = pstmaunal->stOnfly.expert_mode.sw_rk_red_blue2_en;
706 pSelect->rg_red_blue2_enable = pstmaunal->stOnfly.expert_mode.rg_red_blue2_enable;
707 pSelect->rnd_red_blue2_enable = pstmaunal->stOnfly.expert_mode.rnd_red_blue2_enable;
708 pSelect->ro_red_blue2_enable = pstmaunal->stOnfly.expert_mode.ro_red_blue2_enable;
709 pSelect->lc_red_blue2_enable = pstmaunal->stOnfly.expert_mode.lc_red_blue2_enable;
710 pSelect->pg_red_blue2_enable = pstmaunal->stOnfly.expert_mode.pg_red_blue2_enable;
711 pSelect->sw_rk_green2_en = pstmaunal->stOnfly.expert_mode.sw_rk_green2_en;
712 pSelect->rg_green2_enable = pstmaunal->stOnfly.expert_mode.rg_green2_enable;
713 pSelect->rnd_green2_enable = pstmaunal->stOnfly.expert_mode.rnd_green2_enable;
714 pSelect->ro_green2_enable = pstmaunal->stOnfly.expert_mode.ro_green2_enable;
715 pSelect->lc_green2_enable = pstmaunal->stOnfly.expert_mode.lc_green2_enable;
716 pSelect->pg_green2_enable = pstmaunal->stOnfly.expert_mode.pg_green2_enable;
717
718 //methods_set_3 0x0014
719 pSelect->sw_rk_red_blue3_en = pstmaunal->stOnfly.expert_mode.sw_rk_red_blue3_en;
720 pSelect->rg_red_blue3_enable = pstmaunal->stOnfly.expert_mode.rg_red_blue3_enable;
721 pSelect->rnd_red_blue3_enable = pstmaunal->stOnfly.expert_mode.rnd_red_blue3_enable;
722 pSelect->ro_red_blue3_enable = pstmaunal->stOnfly.expert_mode.ro_red_blue3_enable;
723 pSelect->lc_red_blue3_enable = pstmaunal->stOnfly.expert_mode.lc_red_blue3_enable;
724 pSelect->pg_red_blue3_enable = pstmaunal->stOnfly.expert_mode.pg_red_blue3_enable;
725 pSelect->sw_rk_green3_en = pstmaunal->stOnfly.expert_mode.sw_rk_green3_en;
726 pSelect->rg_green3_enable = pstmaunal->stOnfly.expert_mode.rg_green3_enable;
727 pSelect->rnd_green3_enable = pstmaunal->stOnfly.expert_mode.rnd_green3_enable;
728 pSelect->ro_green3_enable = pstmaunal->stOnfly.expert_mode.ro_green3_enable;
729 pSelect->lc_green3_enable = pstmaunal->stOnfly.expert_mode.lc_green3_enable;
730 pSelect->pg_green3_enable = pstmaunal->stOnfly.expert_mode.pg_green3_enable;
731
732 //line_thresh_1 0x0018
733 pSelect->sw_mindis1_rb = pstmaunal->stOnfly.expert_mode.sw_mindis1_rb;
734 pSelect->sw_mindis1_g = pstmaunal->stOnfly.expert_mode.sw_mindis1_g;
735 pSelect->line_thr_1_rb = pstmaunal->stOnfly.expert_mode.line_thr_1_rb;
736 pSelect->line_thr_1_g = pstmaunal->stOnfly.expert_mode.line_thr_1_g;
737
738 //line_mad_fac_1 0x001c
739 pSelect->sw_dis_scale_min1 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_min1;
740 pSelect->sw_dis_scale_max1 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_max1;
741 pSelect->line_mad_fac_1_rb = pstmaunal->stOnfly.expert_mode.line_mad_fac_1_rb;
742 pSelect->line_mad_fac_1_g = pstmaunal->stOnfly.expert_mode.line_mad_fac_1_g;
743
744 //pg_fac_1 0x0020
745 pSelect->pg_fac_1_rb = pstmaunal->stOnfly.expert_mode.pg_fac_1_rb;
746 pSelect->pg_fac_1_g = pstmaunal->stOnfly.expert_mode.pg_fac_1_g;
747
748 //rnd_thresh_1 0x0024
749 pSelect->rnd_thr_1_rb = pstmaunal->stOnfly.expert_mode.rnd_thr_1_rb;
750 pSelect->rnd_thr_1_g = pstmaunal->stOnfly.expert_mode.rnd_thr_1_g;
751
752 //rg_fac_1 0x0028
753 pSelect->rg_fac_1_rb = pstmaunal->stOnfly.expert_mode.rg_fac_1_rb;
754 pSelect->rg_fac_1_g = pstmaunal->stOnfly.expert_mode.rg_fac_1_g;
755
756
757 //line_thresh_2 0x002c
758 pSelect->sw_mindis2_rb = pstmaunal->stOnfly.expert_mode.sw_mindis2_rb;
759 pSelect->sw_mindis2_g = pstmaunal->stOnfly.expert_mode.sw_mindis2_g;
760 pSelect->line_thr_2_rb = pstmaunal->stOnfly.expert_mode.line_thr_2_rb;
761 pSelect->line_thr_2_g = pstmaunal->stOnfly.expert_mode.line_thr_2_g;
762
763 //line_mad_fac_2 0x0030
764 pSelect->sw_dis_scale_min2 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_min2;
765 pSelect->sw_dis_scale_max2 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_max2;
766 pSelect->line_mad_fac_2_rb = pstmaunal->stOnfly.expert_mode.line_mad_fac_2_rb;
767 pSelect->line_mad_fac_2_g = pstmaunal->stOnfly.expert_mode.line_mad_fac_2_g;
768
769 //pg_fac_2 0x0034
770 pSelect->pg_fac_2_rb = pstmaunal->stOnfly.expert_mode.pg_fac_2_rb;
771 pSelect->pg_fac_2_g = pstmaunal->stOnfly.expert_mode.pg_fac_2_g;
772
773 //rnd_thresh_2 0x0038
774 pSelect->rnd_thr_2_rb = pstmaunal->stOnfly.expert_mode.rnd_thr_2_rb;
775 pSelect->rnd_thr_2_g = pstmaunal->stOnfly.expert_mode.rnd_thr_2_g;
776
777 //rg_fac_2 0x003c
778 pSelect->rg_fac_2_rb = pstmaunal->stOnfly.expert_mode.rg_fac_2_rb;
779 pSelect->rg_fac_2_g = pstmaunal->stOnfly.expert_mode.rg_fac_2_g;
780
781
782 //line_thresh_3 0x0040
783 pSelect->sw_mindis3_rb = pstmaunal->stOnfly.expert_mode.sw_mindis3_rb;
784 pSelect->sw_mindis3_g = pstmaunal->stOnfly.expert_mode.sw_mindis3_g;
785 pSelect->line_thr_3_rb = pstmaunal->stOnfly.expert_mode.line_thr_3_rb;
786 pSelect->line_thr_3_g = pstmaunal->stOnfly.expert_mode.line_thr_3_g;
787
788 //line_mad_fac_3 0x0044
789 pSelect->sw_dis_scale_min3 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_min3;
790 pSelect->sw_dis_scale_max3 = pstmaunal->stOnfly.expert_mode.sw_dis_scale_max3;
791 pSelect->line_mad_fac_3_rb = pstmaunal->stOnfly.expert_mode.line_mad_fac_3_rb;
792 pSelect->line_mad_fac_3_g = pstmaunal->stOnfly.expert_mode.line_mad_fac_3_g;
793
794 //pg_fac_3 0x0048
795 pSelect->pg_fac_3_rb = pstmaunal->stOnfly.expert_mode.pg_fac_3_rb;
796 pSelect->pg_fac_3_g = pstmaunal->stOnfly.expert_mode.pg_fac_3_g;
797
798 //rnd_thresh_3 0x004c
799 pSelect->rnd_thr_3_rb = pstmaunal->stOnfly.expert_mode.rnd_thr_3_rb;
800 pSelect->rnd_thr_3_g = pstmaunal->stOnfly.expert_mode.rnd_thr_3_g;
801
802 //rg_fac_3 0x0050
803 pSelect->rg_fac_3_rb = pstmaunal->stOnfly.expert_mode.rg_fac_3_rb;
804 pSelect->rg_fac_3_g = pstmaunal->stOnfly.expert_mode.rg_fac_3_g;
805
806 //ro_limits 0x0054
807 pSelect->ro_lim_3_rb = pstmaunal->stOnfly.expert_mode.ro_lim_3_rb;
808 pSelect->ro_lim_3_g = pstmaunal->stOnfly.expert_mode.ro_lim_3_g;
809 pSelect->ro_lim_2_rb = pstmaunal->stOnfly.expert_mode.ro_lim_2_rb;
810 pSelect->ro_lim_2_g = pstmaunal->stOnfly.expert_mode.ro_lim_2_g;
811 pSelect->ro_lim_1_rb = pstmaunal->stOnfly.expert_mode.ro_lim_1_rb;
812 pSelect->ro_lim_1_g = pstmaunal->stOnfly.expert_mode.ro_lim_1_g;
813
814 //rnd_offs 0x0058
815 pSelect->rnd_offs_3_rb = pstmaunal->stOnfly.expert_mode.rnd_offs_3_rb;
816 pSelect->rnd_offs_3_g = pstmaunal->stOnfly.expert_mode.rnd_offs_3_g;
817 pSelect->rnd_offs_2_rb = pstmaunal->stOnfly.expert_mode.rnd_offs_2_rb;
818 pSelect->rnd_offs_2_g = pstmaunal->stOnfly.expert_mode.rnd_offs_2_g;
819 pSelect->rnd_offs_1_rb = pstmaunal->stOnfly.expert_mode.rnd_offs_1_rb;
820 pSelect->rnd_offs_1_g = pstmaunal->stOnfly.expert_mode.rnd_offs_1_g;
821
822
823 LOGD_ADPCC("%s:(%d) %d %d %d %d %d", __FUNCTION__, __LINE__,
824 pSelect->enable, pSelect->line_thr_2_g, pSelect->line_mad_fac_2_rb,
825 pSelect->ro_lim_2_g, pSelect->rnd_offs_2_g);
826
827 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
828 return ret;
829 }
830
Expert_mode_param_cpy(Adpcc_basic_cfg_params_t * pSelect,Adpcc_basic_params_select_t * pParams)831 AdpccResult_t Expert_mode_param_cpy(
832 Adpcc_basic_cfg_params_t *pSelect,
833 Adpcc_basic_params_select_t *pParams)
834 {
835 AdpccResult_t ret = ADPCC_RET_SUCCESS;
836
837 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
838
839 if(pSelect == NULL) {
840 ret = ADPCC_RET_NULL_POINTER;
841 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
842 return ret;
843 }
844
845 if(pParams == NULL) {
846 ret = ADPCC_RET_NULL_POINTER;
847 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
848 return ret;
849 }
850
851 //mode 0x0000
852 pSelect->stage1_enable = pParams->stage1_enable;
853 pSelect->grayscale_mode = pParams->grayscale_mode;
854 pSelect->enable = pParams->enable;
855
856 //output_mode 0x0004
857 pSelect->sw_rk_out_sel = pParams->sw_rk_out_sel;
858 pSelect->sw_dpcc_output_sel = pParams->sw_dpcc_output_sel;
859 pSelect->stage1_rb_3x3 = pParams->stage1_rb_3x3;
860 pSelect->stage1_g_3x3 = pParams->stage1_g_3x3;
861 pSelect->stage1_incl_rb_center = pParams->stage1_incl_rb_center;
862 pSelect->stage1_incl_green_center = pParams->stage1_incl_green_center;
863
864 //set_use 0x0008
865 pSelect->stage1_use_fix_set = pParams->stage1_use_fix_set;
866 pSelect->stage1_use_set_3 = pParams->stage1_use_set_3;
867 pSelect->stage1_use_set_2 = pParams->stage1_use_set_2;
868 pSelect->stage1_use_set_1 = pParams->stage1_use_set_1;
869
870 //methods_set_1 0x000c
871 pSelect->sw_rk_red_blue1_en = pParams->sw_rk_red_blue1_en;
872 pSelect->rg_red_blue1_enable = pParams->rg_red_blue1_enable;
873 pSelect->rnd_red_blue1_enable = pParams->rnd_red_blue1_enable;
874 pSelect->ro_red_blue1_enable = pParams->ro_red_blue1_enable;
875 pSelect->lc_red_blue1_enable = pParams->lc_red_blue1_enable;
876 pSelect->pg_red_blue1_enable = pParams->pg_red_blue1_enable;
877 pSelect->sw_rk_green1_en = pParams->sw_rk_green1_en;
878 pSelect->rg_green1_enable = pParams->rg_green1_enable;
879 pSelect->rnd_green1_enable = pParams->rnd_green1_enable;
880 pSelect->ro_green1_enable = pParams->ro_green1_enable;
881 pSelect->lc_green1_enable = pParams->lc_green1_enable;
882 pSelect->pg_green1_enable = pParams->pg_green1_enable;
883
884 //methods_set_2 0x0010
885 pSelect->sw_rk_red_blue2_en = pParams->sw_rk_red_blue2_en;
886 pSelect->rg_red_blue2_enable = pParams->rg_red_blue2_enable;
887 pSelect->rnd_red_blue2_enable = pParams->rnd_red_blue2_enable;
888 pSelect->ro_red_blue2_enable = pParams->ro_red_blue2_enable;
889 pSelect->lc_red_blue2_enable = pParams->lc_red_blue2_enable;
890 pSelect->pg_red_blue2_enable = pParams->pg_red_blue2_enable;
891 pSelect->sw_rk_green2_en = pParams->sw_rk_green2_en;
892 pSelect->rg_green2_enable = pParams->rg_green2_enable;
893 pSelect->rnd_green2_enable = pParams->rnd_green2_enable;
894 pSelect->ro_green2_enable = pParams->ro_green2_enable;
895 pSelect->lc_green2_enable = pParams->lc_green2_enable;
896 pSelect->pg_green2_enable = pParams->pg_green2_enable;
897
898 //methods_set_3 0x0014
899 pSelect->sw_rk_red_blue3_en = pParams->sw_rk_red_blue3_en;
900 pSelect->rg_red_blue3_enable = pParams->rg_red_blue3_enable;
901 pSelect->rnd_red_blue3_enable = pParams->rnd_red_blue3_enable;
902 pSelect->ro_red_blue3_enable = pParams->ro_red_blue3_enable;
903 pSelect->lc_red_blue3_enable = pParams->lc_red_blue3_enable;
904 pSelect->pg_red_blue3_enable = pParams->pg_red_blue3_enable;
905 pSelect->sw_rk_green3_en = pParams->sw_rk_green3_en;
906 pSelect->rg_green3_enable = pParams->rg_green3_enable;
907 pSelect->rnd_green3_enable = pParams->rnd_green3_enable;
908 pSelect->ro_green3_enable = pParams->ro_green3_enable;
909 pSelect->lc_green3_enable = pParams->lc_green3_enable;
910 pSelect->pg_green3_enable = pParams->pg_green3_enable;
911
912 //line_thresh_1 0x0018
913 pSelect->sw_mindis1_rb = pParams->sw_mindis1_rb;
914 pSelect->sw_mindis1_g = pParams->sw_mindis1_g;
915 pSelect->line_thr_1_rb = pParams->line_thr_1_rb;
916 pSelect->line_thr_1_g = pParams->line_thr_1_g;
917
918 //line_mad_fac_1 0x001c
919 pSelect->sw_dis_scale_min1 = pParams->sw_dis_scale_min1;
920 pSelect->sw_dis_scale_max1 = pParams->sw_dis_scale_max1;
921 pSelect->line_mad_fac_1_rb = pParams->line_mad_fac_1_rb;
922 pSelect->line_mad_fac_1_g = pParams->line_mad_fac_1_g;
923
924 //pg_fac_1 0x0020
925 pSelect->pg_fac_1_rb = pParams->pg_fac_1_rb;
926 pSelect->pg_fac_1_g = pParams->pg_fac_1_g;
927
928 //rnd_thresh_1 0x0024
929 pSelect->rnd_thr_1_rb = pParams->rnd_thr_1_rb;
930 pSelect->rnd_thr_1_g = pParams->rnd_thr_1_g;
931
932 //rg_fac_1 0x0028
933 pSelect->rg_fac_1_rb = pParams->rg_fac_1_rb;
934 pSelect->rg_fac_1_g = pParams->rg_fac_1_g;
935
936
937 //line_thresh_2 0x002c
938 pSelect->sw_mindis2_rb = pParams->sw_mindis2_rb;
939 pSelect->sw_mindis2_g = pParams->sw_mindis2_g;
940 pSelect->line_thr_2_rb = pParams->line_thr_2_rb;
941 pSelect->line_thr_2_g = pParams->line_thr_2_g;
942
943 //line_mad_fac_2 0x0030
944 pSelect->sw_dis_scale_min2 = pParams->sw_dis_scale_min2;
945 pSelect->sw_dis_scale_max2 = pParams->sw_dis_scale_max2;
946 pSelect->line_mad_fac_2_rb = pParams->line_mad_fac_2_rb;
947 pSelect->line_mad_fac_2_g = pParams->line_mad_fac_2_g;
948
949 //pg_fac_2 0x0034
950 pSelect->pg_fac_2_rb = pParams->pg_fac_2_rb;
951 pSelect->pg_fac_2_g = pParams->pg_fac_2_g;
952
953 //rnd_thresh_2 0x0038
954 pSelect->rnd_thr_2_rb = pParams->rnd_thr_2_rb;
955 pSelect->rnd_thr_2_g = pParams->rnd_thr_2_g;
956
957 //rg_fac_2 0x003c
958 pSelect->rg_fac_2_rb = pParams->rg_fac_2_rb;
959 pSelect->rg_fac_2_g = pParams->rg_fac_2_g;
960
961
962 //line_thresh_3 0x0040
963 pSelect->sw_mindis3_rb = pParams->sw_mindis3_rb;
964 pSelect->sw_mindis3_g = pParams->sw_mindis3_g;
965 pSelect->line_thr_3_rb = pParams->line_thr_3_rb;
966 pSelect->line_thr_3_g = pParams->line_thr_3_g;
967
968 //line_mad_fac_3 0x0044
969 pSelect->sw_dis_scale_min3 = pParams->sw_dis_scale_min3;
970 pSelect->sw_dis_scale_max3 = pParams->sw_dis_scale_max3;
971 pSelect->line_mad_fac_3_rb = pParams->line_mad_fac_3_rb;
972 pSelect->line_mad_fac_3_g = pParams->line_mad_fac_3_g;
973
974 //pg_fac_3 0x0048
975 pSelect->pg_fac_3_rb = pParams->pg_fac_3_rb;
976 pSelect->pg_fac_3_g = pParams->pg_fac_3_g;
977
978 //rnd_thresh_3 0x004c
979 pSelect->rnd_thr_3_rb = pParams->rnd_thr_3_rb;
980 pSelect->rnd_thr_3_g = pParams->rnd_thr_3_g;
981
982 //rg_fac_3 0x0050
983 pSelect->rg_fac_3_rb = pParams->rg_fac_3_rb;
984 pSelect->rg_fac_3_g = pParams->rg_fac_3_g;
985
986 //ro_limits 0x0054
987 pSelect->ro_lim_3_rb = pParams->ro_lim_3_rb;
988 pSelect->ro_lim_3_g = pParams->ro_lim_3_g;
989 pSelect->ro_lim_2_rb = pParams->ro_lim_2_rb;
990 pSelect->ro_lim_2_g = pParams->ro_lim_2_g;
991 pSelect->ro_lim_1_rb = pParams->ro_lim_1_rb;
992 pSelect->ro_lim_1_g = pParams->ro_lim_1_g;
993
994 //rnd_offs 0x0058
995 pSelect->rnd_offs_3_rb = pParams->rnd_offs_3_rb;
996 pSelect->rnd_offs_3_g = pParams->rnd_offs_3_g;
997 pSelect->rnd_offs_2_rb = pParams->rnd_offs_2_rb;
998 pSelect->rnd_offs_2_g = pParams->rnd_offs_2_g;
999 pSelect->rnd_offs_1_rb = pParams->rnd_offs_1_rb;
1000 pSelect->rnd_offs_1_g = pParams->rnd_offs_1_g;
1001
1002
1003 LOGD_ADPCC("%s:(%d) %d %d %d %d %d", __FUNCTION__, __LINE__,
1004 pSelect->enable, pSelect->line_thr_2_g, pSelect->line_mad_fac_2_rb,
1005 pSelect->ro_lim_2_g, pSelect->rnd_offs_2_g);
1006
1007 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
1008 return ret;
1009 }
1010
Expert_mode_select_basic_params_by_ISO(Adpcc_basic_params_t * pParams,Adpcc_basic_cfg_params_t * pSelect,AdpccExpInfo_t * pExpInfo)1011 AdpccResult_t Expert_mode_select_basic_params_by_ISO(
1012 Adpcc_basic_params_t *pParams,
1013 Adpcc_basic_cfg_params_t *pSelect,
1014 AdpccExpInfo_t *pExpInfo)
1015 {
1016 AdpccResult_t ret = ADPCC_RET_SUCCESS;
1017 int lowLevel = 0;
1018 int highLevel = 0;
1019 int lowIso = 0;
1020 int highIso = 0;
1021 float ratio = 0.0;
1022 int iso = 50;
1023
1024 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1025
1026 if(pParams == NULL) {
1027 ret = ADPCC_RET_NULL_POINTER;
1028 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
1029 return ret;
1030 }
1031
1032 if(pSelect == NULL) {
1033 ret = ADPCC_RET_NULL_POINTER;
1034 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
1035 return ret;
1036 }
1037
1038 if(pExpInfo == NULL) {
1039 ret = ADPCC_RET_NULL_POINTER;
1040 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
1041 return ret;
1042 }
1043
1044 iso = pExpInfo->arPreResIso[pExpInfo->hdr_mode];
1045
1046 for(int i = 0; i < DPCC_MAX_ISO_LEVEL - 1; i++) {
1047 LOGD_ADPCC("%s:(%d) iso:%d %d %d", __FUNCTION__, __LINE__,
1048 iso, pParams->arBasic[i].iso, pParams->arBasic[i + 1].iso);
1049 if(iso >= pParams->arBasic[i].iso && iso < pParams->arBasic[i + 1].iso) {
1050 lowLevel = i;
1051 highLevel = i + 1;
1052 lowIso = pParams->arBasic[i].iso;
1053 highIso = pParams->arBasic[i + 1].iso;
1054 //ratio = (iso -lowIso ) / (float)(highIso - lowIso);
1055 ratio = 0.0;
1056 break;
1057 }
1058 }
1059
1060 if(iso < pParams->arBasic[0].iso ) {
1061 lowLevel = 0;
1062 highLevel = 0;
1063 ratio = 0.0;
1064 }
1065
1066 if(iso >= pParams->arBasic[DPCC_MAX_ISO_LEVEL - 1].iso ) {
1067 lowLevel = DPCC_MAX_ISO_LEVEL - 1;
1068 highLevel = DPCC_MAX_ISO_LEVEL - 1;
1069 ratio = 1.0;
1070 }
1071
1072 LOGD_ADPCC("%s:(%d) iso:%d lowLevel:%d hightLevel:%d lowIso:%d HighIso:%d ratio:%f",
1073 __FUNCTION__, __LINE__, iso, lowLevel, highLevel, lowIso, highIso, ratio);
1074
1075 // copy param from pParams->arBasic[lowLevel]
1076 ret = Expert_mode_param_cpy(pSelect, &pParams->arBasic[lowLevel]);
1077 if (ret != ADPCC_RET_SUCCESS) {
1078 LOGE_ADPCC("%s(%d): failed to copy Expert mode params", __FUNCTION__, __LINE__);
1079 return ret;
1080 }
1081
1082 LOGD_ADPCC("%s:(%d) %d %d %d %d %d", __FUNCTION__, __LINE__,
1083 pSelect->enable, pSelect->line_thr_2_g, pSelect->line_mad_fac_2_rb,
1084 pSelect->ro_lim_2_g, pSelect->rnd_offs_2_g);
1085
1086 LOG1_ADPCC("%s(%d): exit!\n", __FUNCTION__, __LINE__);
1087 return ret;
1088 }
1089
Fast_mode_Triple_level_Setting(Adpcc_basic_cfg_params_t * pSelect,int level)1090 void Fast_mode_Triple_level_Setting(
1091 Adpcc_basic_cfg_params_t *pSelect,
1092 int level)
1093 {
1094 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1095
1096 switch (level)
1097 {
1098 case 1:
1099 pSelect->sw_rk_green3_en = 1;
1100 pSelect->sw_mindis3_rb = 0x5;
1101 pSelect->sw_mindis3_g = 0x5;
1102 pSelect->sw_dis_scale_min3 = 0x3;
1103 pSelect->sw_dis_scale_max3 = 0x3;
1104
1105 pSelect->rg_red_blue3_enable = 0;
1106 pSelect->rg_green3_enable = 0;
1107 pSelect->rg_fac_3_rb = 0;
1108 pSelect->rg_fac_3_g = 0;
1109
1110 pSelect->rnd_red_blue3_enable = 1;
1111 pSelect->rnd_green3_enable = 1;
1112 pSelect->rnd_thr_3_rb = 4;
1113 pSelect->rnd_thr_3_g = 4;
1114 pSelect->rnd_offs_3_rb = 2;
1115 pSelect->rnd_offs_3_g = 2;
1116
1117 pSelect->ro_red_blue3_enable = 1;
1118 pSelect->ro_green3_enable = 1;
1119 pSelect->ro_lim_3_rb = 2;
1120 pSelect->ro_lim_3_g = 2;
1121
1122 pSelect->lc_red_blue3_enable = 1;
1123 pSelect->lc_green3_enable = 0;
1124 pSelect->line_thr_3_rb = 0x3;
1125 pSelect->line_thr_3_g = 0;
1126 pSelect->line_mad_fac_3_rb = 0x3;
1127 pSelect->line_mad_fac_3_g = 0;
1128
1129 pSelect->pg_red_blue3_enable = 1;
1130 pSelect->pg_green3_enable = 1;
1131 pSelect->pg_fac_3_rb = 0x3;
1132 pSelect->pg_fac_3_g = 0x3;
1133 break;
1134 case 2:
1135 pSelect->sw_rk_green3_en = 1;
1136 pSelect->sw_mindis3_rb = 0x5;
1137 pSelect->sw_mindis3_g = 0x5;
1138 pSelect->sw_dis_scale_min3 = 0x3;
1139 pSelect->sw_dis_scale_max3 = 0x3;
1140
1141 pSelect->rg_red_blue3_enable = 0;
1142 pSelect->rg_green3_enable = 0;
1143 pSelect->rg_fac_3_rb = 0;
1144 pSelect->rg_fac_3_g = 0;
1145
1146 pSelect->rnd_red_blue3_enable = 1;
1147 pSelect->rnd_green3_enable = 1;
1148 pSelect->rnd_thr_3_rb = 4;
1149 pSelect->rnd_thr_3_g = 4;
1150 pSelect->rnd_offs_3_rb = 2;
1151 pSelect->rnd_offs_3_g = 2;
1152
1153 pSelect->ro_red_blue3_enable = 1;
1154 pSelect->ro_green3_enable = 1;
1155 pSelect->ro_lim_3_rb = 2;
1156 pSelect->ro_lim_3_g = 2;
1157
1158 pSelect->lc_red_blue3_enable = 1;
1159 pSelect->lc_green3_enable = 0;
1160 pSelect->line_thr_3_rb = 0x2;
1161 pSelect->line_thr_3_g = 0;
1162 pSelect->line_mad_fac_3_rb = 0x2;
1163 pSelect->line_mad_fac_3_g = 0;
1164
1165 pSelect->pg_red_blue3_enable = 1;
1166 pSelect->pg_green3_enable = 1;
1167 pSelect->pg_fac_3_rb = 0x3;
1168 pSelect->pg_fac_3_g = 0x3;
1169 break;
1170 case 3:
1171 pSelect->sw_rk_green3_en = 1;
1172 pSelect->sw_mindis3_rb = 0x5;
1173 pSelect->sw_mindis3_g = 0x5;
1174 pSelect->sw_dis_scale_min3 = 0x3;
1175 pSelect->sw_dis_scale_max3 = 0x3;
1176
1177 pSelect->rg_red_blue3_enable = 0;
1178 pSelect->rg_green3_enable = 0;
1179 pSelect->rg_fac_3_rb = 0;
1180 pSelect->rg_fac_3_g = 0;
1181
1182 pSelect->rnd_red_blue3_enable = 1;
1183 pSelect->rnd_green3_enable = 1;
1184 pSelect->rnd_thr_3_rb = 4;
1185 pSelect->rnd_thr_3_g = 4;
1186 pSelect->rnd_offs_3_rb = 2;
1187 pSelect->rnd_offs_3_g = 2;
1188
1189 pSelect->ro_red_blue3_enable = 1;
1190 pSelect->ro_green3_enable = 1;
1191 pSelect->ro_lim_3_rb = 2;
1192 pSelect->ro_lim_3_g = 2;
1193
1194 pSelect->lc_red_blue3_enable = 0;
1195 pSelect->lc_green3_enable = 0;
1196 pSelect->line_thr_3_rb = 0;
1197 pSelect->line_thr_3_g = 0;
1198 pSelect->line_mad_fac_3_rb = 0;
1199 pSelect->line_mad_fac_3_g = 0;
1200
1201 pSelect->pg_red_blue3_enable = 1;
1202 pSelect->pg_green3_enable = 1;
1203 pSelect->pg_fac_3_rb = 0x3;
1204 pSelect->pg_fac_3_g = 0x3;
1205 break;
1206 case 4:
1207 pSelect->sw_rk_green3_en = 1;
1208 pSelect->sw_mindis3_rb = 0x5;
1209 pSelect->sw_mindis3_g = 0x5;
1210 pSelect->sw_dis_scale_min3 = 0x3;
1211 pSelect->sw_dis_scale_max3 = 0x3;
1212
1213 pSelect->rg_red_blue3_enable = 0;
1214 pSelect->rg_green3_enable = 0;
1215 pSelect->rg_fac_3_rb = 0;
1216 pSelect->rg_fac_3_g = 0;
1217
1218 pSelect->rnd_red_blue3_enable = 1;
1219 pSelect->rnd_green3_enable = 1;
1220 pSelect->rnd_thr_3_rb = 4;
1221 pSelect->rnd_thr_3_g = 4;
1222 pSelect->rnd_offs_3_rb = 2;
1223 pSelect->rnd_offs_3_g = 2;
1224
1225 pSelect->ro_red_blue3_enable = 1;
1226 pSelect->ro_green3_enable = 1;
1227 pSelect->ro_lim_3_rb = 2;
1228 pSelect->ro_lim_3_g = 2;
1229
1230 pSelect->lc_red_blue3_enable = 0;
1231 pSelect->lc_green3_enable = 0;
1232 pSelect->line_thr_3_rb = 0;
1233 pSelect->line_thr_3_g = 0;
1234 pSelect->line_mad_fac_3_rb = 0;
1235 pSelect->line_mad_fac_3_g = 0;
1236
1237 pSelect->pg_red_blue3_enable = 1;
1238 pSelect->pg_green3_enable = 1;
1239 pSelect->pg_fac_3_rb = 0x2;
1240 pSelect->pg_fac_3_g = 0x2;
1241 break;
1242 case 5:
1243 pSelect->sw_rk_green3_en = 1;
1244 pSelect->sw_mindis3_rb = 0x5;
1245 pSelect->sw_mindis3_g = 0x5;
1246 pSelect->sw_dis_scale_min3 = 0x3;
1247 pSelect->sw_dis_scale_max3 = 0x3;
1248
1249 pSelect->rg_red_blue3_enable = 0;
1250 pSelect->rg_green3_enable = 0;
1251 pSelect->rg_fac_3_rb = 0;
1252 pSelect->rg_fac_3_g = 0;
1253
1254 pSelect->rnd_red_blue3_enable = 1;
1255 pSelect->rnd_green3_enable = 1;
1256 pSelect->rnd_thr_3_rb = 4;
1257 pSelect->rnd_thr_3_g = 4;
1258 pSelect->rnd_offs_3_rb = 2;
1259 pSelect->rnd_offs_3_g = 2;
1260
1261 pSelect->ro_red_blue3_enable = 1;
1262 pSelect->ro_green3_enable = 1;
1263 pSelect->ro_lim_3_rb = 2;
1264 pSelect->ro_lim_3_g = 2;
1265
1266 pSelect->lc_red_blue3_enable = 0;
1267 pSelect->lc_green3_enable = 0;
1268 pSelect->line_thr_3_rb = 0;
1269 pSelect->line_thr_3_g = 0;
1270 pSelect->line_mad_fac_3_rb = 0;
1271 pSelect->line_mad_fac_3_g = 0;
1272
1273 pSelect->pg_red_blue3_enable = 0;
1274 pSelect->pg_green3_enable = 0;
1275 pSelect->pg_fac_3_rb = 0;
1276 pSelect->pg_fac_3_g = 0;
1277 break;
1278 case 6:
1279 pSelect->stage1_use_fix_set = 0x1;
1280 pSelect->sw_rk_red_blue3_en = 1;
1281 pSelect->sw_rk_green3_en = 1;
1282 pSelect->sw_mindis3_rb = 0x5;
1283 pSelect->sw_mindis3_g = 0x5;
1284 pSelect->sw_dis_scale_min3 = 0x3;
1285 pSelect->sw_dis_scale_max3 = 0x3;
1286
1287 pSelect->rg_red_blue3_enable = 0;
1288 pSelect->rg_green3_enable = 0;
1289 pSelect->rg_fac_3_rb = 0;
1290 pSelect->rg_fac_3_g = 0;
1291
1292 pSelect->rnd_red_blue3_enable = 1;
1293 pSelect->rnd_green3_enable = 1;
1294 pSelect->rnd_thr_3_rb = 4;
1295 pSelect->rnd_thr_3_g = 4;
1296 pSelect->rnd_offs_3_rb = 2;
1297 pSelect->rnd_offs_3_g = 2;
1298
1299 pSelect->ro_red_blue3_enable = 1;
1300 pSelect->ro_green3_enable = 1;
1301 pSelect->ro_lim_3_rb = 2;
1302 pSelect->ro_lim_3_g = 2;
1303
1304 pSelect->lc_red_blue3_enable = 0;
1305 pSelect->lc_green3_enable = 0;
1306 pSelect->line_thr_3_rb = 0;
1307 pSelect->line_thr_3_g = 0;
1308 pSelect->line_mad_fac_3_rb = 0;
1309 pSelect->line_mad_fac_3_g = 0;
1310
1311 pSelect->pg_red_blue3_enable = 0;
1312 pSelect->pg_green3_enable = 0;
1313 pSelect->pg_fac_3_rb = 0;
1314 pSelect->pg_fac_3_g = 0;
1315 break;
1316 case 7:
1317 pSelect->stage1_use_fix_set = 0x1;
1318 pSelect->sw_rk_red_blue3_en = 1;
1319 pSelect->sw_rk_green3_en = 1;
1320 pSelect->sw_mindis3_rb = 0x5;
1321 pSelect->sw_mindis3_g = 0x5;
1322 pSelect->sw_dis_scale_min3 = 0x3;
1323 pSelect->sw_dis_scale_max3 = 0x3;
1324
1325 pSelect->rg_red_blue3_enable = 0;
1326 pSelect->rg_green3_enable = 0;
1327 pSelect->rg_fac_3_rb = 0;
1328 pSelect->rg_fac_3_g = 0;
1329
1330 pSelect->rnd_red_blue3_enable = 1;
1331 pSelect->rnd_green3_enable = 1;
1332 pSelect->rnd_thr_3_rb = 4;
1333 pSelect->rnd_thr_3_g = 4;
1334 pSelect->rnd_offs_3_rb = 2;
1335 pSelect->rnd_offs_3_g = 2;
1336
1337 pSelect->ro_red_blue3_enable = 1;
1338 pSelect->ro_green3_enable = 1;
1339 pSelect->ro_lim_3_rb = 2;
1340 pSelect->ro_lim_3_g = 2;
1341
1342 pSelect->lc_red_blue3_enable = 0;
1343 pSelect->lc_green3_enable = 0;
1344 pSelect->line_thr_3_rb = 0;
1345 pSelect->line_thr_3_g = 0;
1346 pSelect->line_mad_fac_3_rb = 0;
1347 pSelect->line_mad_fac_3_g = 0;
1348
1349 pSelect->pg_red_blue3_enable = 0;
1350 pSelect->pg_green3_enable = 0;
1351 pSelect->pg_fac_3_rb = 0;
1352 pSelect->pg_fac_3_g = 0;
1353 break;
1354 case 8:
1355 pSelect->stage1_use_fix_set = 0x1;
1356 pSelect->sw_rk_red_blue3_en = 1;
1357 pSelect->sw_rk_green3_en = 1;
1358 pSelect->sw_mindis3_rb = 0x3;
1359 pSelect->sw_mindis3_g = 0x3;
1360 pSelect->sw_dis_scale_min3 = 0x2;
1361 pSelect->sw_dis_scale_max3 = 0x2;
1362
1363 pSelect->rg_red_blue3_enable = 0;
1364 pSelect->rg_green3_enable = 0;
1365 pSelect->rg_fac_3_rb = 0;
1366 pSelect->rg_fac_3_g = 0;
1367
1368 pSelect->rnd_red_blue3_enable = 1;
1369 pSelect->rnd_green3_enable = 1;
1370 pSelect->rnd_thr_3_rb = 0x4;
1371 pSelect->rnd_thr_3_g = 0x4;
1372 pSelect->rnd_offs_3_rb = 0x2;
1373 pSelect->rnd_offs_3_g = 0x2;
1374
1375 pSelect->ro_red_blue3_enable = 1;
1376 pSelect->ro_green3_enable = 1;
1377 pSelect->ro_lim_3_rb = 0x2;
1378 pSelect->ro_lim_3_g = 0x2;
1379
1380 pSelect->lc_red_blue3_enable = 0;
1381 pSelect->lc_green3_enable = 0;
1382 pSelect->line_thr_3_rb = 0;
1383 pSelect->line_thr_3_g = 0;
1384 pSelect->line_mad_fac_3_rb = 0;
1385 pSelect->line_mad_fac_3_g = 0;
1386
1387 pSelect->pg_red_blue3_enable = 0;
1388 pSelect->pg_green3_enable = 0;
1389 pSelect->pg_fac_3_rb = 0;
1390 pSelect->pg_fac_3_g = 0;
1391 break;
1392 case 9:
1393 pSelect->stage1_use_fix_set = 0x1;
1394 pSelect->sw_rk_red_blue3_en = 0;
1395 pSelect->sw_rk_green3_en = 0;
1396 pSelect->sw_mindis3_rb = 0;
1397 pSelect->sw_mindis3_g = 0;
1398 pSelect->sw_dis_scale_min3 = 0;
1399 pSelect->sw_dis_scale_max3 = 0;
1400
1401 pSelect->rg_red_blue3_enable = 0;
1402 pSelect->rg_green3_enable = 0;
1403 pSelect->rg_fac_3_rb = 0;
1404 pSelect->rg_fac_3_g = 0;
1405
1406 pSelect->rnd_red_blue3_enable = 1;
1407 pSelect->rnd_green3_enable = 1;
1408 pSelect->rnd_thr_3_rb = 0x4;
1409 pSelect->rnd_thr_3_g = 0x4;
1410 pSelect->rnd_offs_3_rb = 0x2;
1411 pSelect->rnd_offs_3_g = 0x2;
1412
1413 pSelect->ro_red_blue3_enable = 1;
1414 pSelect->ro_green3_enable = 1;
1415 pSelect->ro_lim_3_rb = 0x2;
1416 pSelect->ro_lim_3_g = 0x2;
1417
1418 pSelect->lc_red_blue3_enable = 0;
1419 pSelect->lc_green3_enable = 0;
1420 pSelect->line_thr_3_rb = 0;
1421 pSelect->line_thr_3_g = 0;
1422 pSelect->line_mad_fac_3_rb = 0;
1423 pSelect->line_mad_fac_3_g = 0;
1424
1425 pSelect->pg_red_blue3_enable = 0;
1426 pSelect->pg_green3_enable = 0;
1427 pSelect->pg_fac_3_rb = 0;
1428 pSelect->pg_fac_3_g = 0;
1429 break;
1430 case 10:
1431 pSelect->stage1_use_fix_set = 0x1;
1432 pSelect->sw_rk_red_blue3_en = 0;
1433 pSelect->sw_rk_green3_en = 0;
1434 pSelect->sw_mindis3_rb = 0;
1435 pSelect->sw_mindis3_g = 0;
1436 pSelect->sw_dis_scale_min3 = 0;
1437 pSelect->sw_dis_scale_max3 = 0;
1438
1439 pSelect->rg_red_blue3_enable = 0;
1440 pSelect->rg_green3_enable = 0;
1441 pSelect->rg_fac_3_rb = 0;
1442 pSelect->rg_fac_3_g = 0;
1443
1444 pSelect->rnd_red_blue3_enable = 1;
1445 pSelect->rnd_green3_enable = 1;
1446 pSelect->rnd_thr_3_rb = 0x3;
1447 pSelect->rnd_thr_3_g = 0x3;
1448 pSelect->rnd_offs_3_rb = 0x1;
1449 pSelect->rnd_offs_3_g = 0x1;
1450
1451 pSelect->ro_red_blue3_enable = 1;
1452 pSelect->ro_green3_enable = 1;
1453 pSelect->ro_lim_3_rb = 0x2;
1454 pSelect->ro_lim_3_g = 0x1;
1455
1456 pSelect->lc_red_blue3_enable = 0;
1457 pSelect->lc_green3_enable = 0;
1458 pSelect->line_thr_3_rb = 0;
1459 pSelect->line_thr_3_g = 0;
1460 pSelect->line_mad_fac_3_rb = 0;
1461 pSelect->line_mad_fac_3_g = 0;
1462
1463 pSelect->pg_red_blue3_enable = 0;
1464 pSelect->pg_green3_enable = 0;
1465 pSelect->pg_fac_3_rb = 0;
1466 pSelect->pg_fac_3_g = 0;
1467 break;
1468 default:
1469 LOGE_ADPCC("%s(%d): Wrong fast mode level!!!", __FUNCTION__, __LINE__);
1470 break;
1471 }
1472
1473 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
1474
1475 }
1476
Fast_mode_Triple_Setting(AdpccContext_t * pParams,Adpcc_basic_cfg_params_t * pSelect,int iso)1477 void Fast_mode_Triple_Setting(
1478 AdpccContext_t *pParams,
1479 Adpcc_basic_cfg_params_t *pSelect,
1480 int iso)
1481 {
1482 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1483
1484 int level = AdpccInterpolation(iso, pParams->stAuto.stFastMode.ISO, pParams->stAuto.stFastMode.fast_mode_triple_level);
1485
1486 if(pParams->stAuto.stFastMode.fast_mode_triple_en != 0)
1487 pSelect->stage1_use_set_3 = 0x1;
1488 else
1489 pSelect->stage1_use_set_3 = 0x0;
1490
1491 level = LIMIT_VALUE(level, FASTMODELEVELMAX, FASTMODELEVELMIN);
1492 Fast_mode_Triple_level_Setting(pSelect, level);
1493
1494 LOGD_ADPCC("%s(%d): Dpcc fast mode triple en:%d level:%d", __FUNCTION__, __LINE__,
1495 pParams->stAuto.stFastMode.fast_mode_triple_en, level);
1496
1497 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
1498
1499 }
1500
Fast_mode_Double_level_Setting(Adpcc_basic_cfg_params_t * pSelect,int level)1501 void Fast_mode_Double_level_Setting(
1502 Adpcc_basic_cfg_params_t *pSelect,
1503 int level)
1504 {
1505 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1506
1507 switch (level)
1508 {
1509 case 1:
1510 pSelect->sw_rk_red_blue2_en = 1;
1511 pSelect->sw_rk_green2_en = 1;
1512 pSelect->sw_mindis2_rb = 0x15;
1513 pSelect->sw_mindis2_g = 0x20;
1514 pSelect->sw_dis_scale_min2 = 0x10;
1515 pSelect->sw_dis_scale_max2 = 0x12;
1516
1517 pSelect->rg_red_blue2_enable = 1;
1518 pSelect->rg_green2_enable = 1;
1519 pSelect->rg_fac_2_rb = 0x15;
1520 pSelect->rg_fac_2_g = 0x20;
1521
1522 pSelect->rnd_red_blue2_enable = 1;
1523 pSelect->rnd_green2_enable = 1;
1524 pSelect->rnd_thr_2_rb = 0x9;
1525 pSelect->rnd_thr_2_g = 0xa;
1526 pSelect->rnd_offs_2_rb = 0x1;
1527 pSelect->rnd_offs_2_g = 0x1;
1528
1529 pSelect->ro_red_blue2_enable = 1;
1530 pSelect->ro_green2_enable = 1;
1531 pSelect->ro_lim_2_rb = 0x1;
1532 pSelect->ro_lim_2_g = 0x2;
1533
1534 pSelect->lc_red_blue2_enable = 1;
1535 pSelect->lc_green2_enable = 1;
1536 pSelect->line_thr_2_rb = 0x6;
1537 pSelect->line_thr_2_g = 0x8;
1538 pSelect->line_mad_fac_2_rb = 0x3;
1539 pSelect->line_mad_fac_2_g = 0x4;
1540
1541 pSelect->pg_red_blue2_enable = 1;
1542 pSelect->pg_green1_enable = 1;
1543 pSelect->pg_fac_2_rb = 0x6;
1544 pSelect->pg_fac_2_g = 0x8;
1545 break;
1546 case 2:
1547 pSelect->sw_rk_red_blue2_en = 1;
1548 pSelect->sw_rk_green2_en = 1;
1549 pSelect->sw_mindis2_rb = 0x12;
1550 pSelect->sw_mindis2_g = 0x16;
1551 pSelect->sw_dis_scale_min2 = 0x6;
1552 pSelect->sw_dis_scale_max2 = 0x8;
1553
1554 pSelect->rg_red_blue2_enable = 1;
1555 pSelect->rg_green2_enable = 1;
1556 pSelect->rg_fac_2_rb = 0x7;
1557 pSelect->rg_fac_2_g = 0x10;
1558
1559 pSelect->rnd_red_blue2_enable = 1;
1560 pSelect->rnd_green2_enable = 1;
1561 pSelect->rnd_thr_2_rb = 0x5;
1562 pSelect->rnd_thr_2_g = 0x6;
1563 pSelect->rnd_offs_2_rb = 0x1;
1564 pSelect->rnd_offs_2_g = 0x1;
1565
1566 pSelect->ro_red_blue2_enable = 1;
1567 pSelect->ro_green2_enable = 1;
1568 pSelect->ro_lim_2_rb = 0x3;
1569 pSelect->ro_lim_2_g = 0x2;
1570
1571 pSelect->lc_red_blue2_enable = 1;
1572 pSelect->lc_green2_enable = 1;
1573 pSelect->line_thr_2_rb = 0x12;
1574 pSelect->line_thr_2_g = 0x16;
1575 pSelect->line_mad_fac_2_rb = 0x8;
1576 pSelect->line_mad_fac_2_g = 0x10;
1577
1578 pSelect->pg_red_blue2_enable = 1;
1579 pSelect->pg_green2_enable = 1;
1580 pSelect->pg_fac_2_rb = 0x5;
1581 pSelect->pg_fac_2_g = 0x6;
1582 break;
1583 case 3:
1584 pSelect->sw_rk_red_blue2_en = 1;
1585 pSelect->sw_rk_green2_en = 1;
1586 pSelect->sw_mindis2_rb = 0x12;
1587 pSelect->sw_mindis2_g = 0x16;
1588 pSelect->sw_dis_scale_min2 = 0x6;
1589 pSelect->sw_dis_scale_max2 = 0x8;
1590
1591 pSelect->rg_red_blue2_enable = 0;
1592 pSelect->rg_green2_enable = 0;
1593 pSelect->rg_fac_2_rb = 0;
1594 pSelect->rg_fac_2_g = 0;
1595
1596 pSelect->rnd_red_blue2_enable = 1;
1597 pSelect->rnd_green2_enable = 1;
1598 pSelect->rnd_thr_2_rb = 0x5;
1599 pSelect->rnd_thr_2_g = 0x6;
1600 pSelect->rnd_offs_2_rb = 0x1;
1601 pSelect->rnd_offs_2_g = 0x1;
1602
1603 pSelect->ro_red_blue2_enable = 1;
1604 pSelect->ro_green2_enable = 1;
1605 pSelect->ro_lim_2_rb = 0x3;
1606 pSelect->ro_lim_2_g = 0x2;
1607
1608 pSelect->lc_red_blue2_enable = 1;
1609 pSelect->lc_green2_enable = 1;
1610 pSelect->line_thr_2_rb = 0x12;
1611 pSelect->line_thr_2_g = 0x16;
1612 pSelect->line_mad_fac_2_rb = 0x8;
1613 pSelect->line_mad_fac_2_g = 0x10;
1614
1615 pSelect->pg_red_blue2_enable = 1;
1616 pSelect->pg_green2_enable = 1;
1617 pSelect->pg_fac_2_rb = 0x5;
1618 pSelect->pg_fac_2_g = 0x6;
1619 break;
1620 case 4:
1621 pSelect->sw_rk_red_blue2_en = 1;
1622 pSelect->sw_rk_green2_en = 1;
1623 pSelect->sw_mindis2_rb = 0x12;
1624 pSelect->sw_mindis2_g = 0x16;
1625 pSelect->sw_dis_scale_min2 = 0x6;
1626 pSelect->sw_dis_scale_max2 = 0x8;
1627
1628 pSelect->rg_red_blue2_enable = 0;
1629 pSelect->rg_green2_enable = 0;
1630 pSelect->rg_fac_2_rb = 0;
1631 pSelect->rg_fac_2_g = 0;
1632
1633 pSelect->rnd_red_blue2_enable = 0;
1634 pSelect->rnd_green2_enable = 0;
1635 pSelect->rnd_thr_2_rb = 0;
1636 pSelect->rnd_thr_2_g = 0;
1637 pSelect->rnd_offs_2_rb = 0;
1638 pSelect->rnd_offs_2_g = 0;
1639
1640 pSelect->ro_red_blue2_enable = 1;
1641 pSelect->ro_green2_enable = 1;
1642 pSelect->ro_lim_2_rb = 0x3;
1643 pSelect->ro_lim_2_g = 0x2;
1644
1645 pSelect->lc_red_blue2_enable = 1;
1646 pSelect->lc_green2_enable = 1;
1647 pSelect->line_thr_2_rb = 0x12;
1648 pSelect->line_thr_2_g = 0x16;
1649 pSelect->line_mad_fac_2_rb = 0x8;
1650 pSelect->line_mad_fac_2_g = 0x10;
1651
1652 pSelect->pg_red_blue2_enable = 1;
1653 pSelect->pg_green2_enable = 1;
1654 pSelect->pg_fac_2_rb = 0x5;
1655 pSelect->pg_fac_2_g = 0x6;
1656 break;
1657 case 5:
1658 pSelect->sw_rk_red_blue2_en = 1;
1659 pSelect->sw_rk_green2_en = 1;
1660 pSelect->sw_mindis2_rb = 0x10;
1661 pSelect->sw_mindis2_g = 0x14;
1662 pSelect->sw_dis_scale_min2 = 0x6;
1663 pSelect->sw_dis_scale_max2 = 0xc;
1664
1665 pSelect->rg_red_blue2_enable = 0;
1666 pSelect->rg_green2_enable = 0;
1667 pSelect->rg_fac_2_rb = 0;
1668 pSelect->rg_fac_2_g = 0;
1669
1670 pSelect->rnd_red_blue2_enable = 0;
1671 pSelect->rnd_green2_enable = 0;
1672 pSelect->rnd_thr_2_rb = 0;
1673 pSelect->rnd_thr_2_g = 0;
1674 pSelect->rnd_offs_2_rb = 0;
1675 pSelect->rnd_offs_2_g = 0;
1676
1677 pSelect->ro_red_blue2_enable = 1;
1678 pSelect->ro_green2_enable = 1;
1679 pSelect->ro_lim_2_rb = 0x3;
1680 pSelect->ro_lim_2_g = 0x3;
1681
1682 pSelect->lc_red_blue2_enable = 1;
1683 pSelect->lc_green2_enable = 1;
1684 pSelect->line_thr_2_rb = 0x7;
1685 pSelect->line_thr_2_g = 0xc;
1686 pSelect->line_mad_fac_2_rb = 0x7;
1687 pSelect->line_mad_fac_2_g = 0x9;
1688
1689 pSelect->pg_red_blue2_enable = 1;
1690 pSelect->pg_green2_enable = 1;
1691 pSelect->pg_fac_2_rb = 0x3;
1692 pSelect->pg_fac_2_g = 0x4;
1693 break;
1694 case 6:
1695 pSelect->sw_rk_red_blue2_en = 1;
1696 pSelect->sw_rk_green2_en = 1;
1697 pSelect->sw_mindis2_rb = 0x7;
1698 pSelect->sw_mindis2_g = 0x10;
1699 pSelect->sw_dis_scale_min2 = 0x6;
1700 pSelect->sw_dis_scale_max2 = 0x8;
1701
1702 pSelect->rg_red_blue2_enable = 0;
1703 pSelect->rg_green2_enable = 0;
1704 pSelect->rg_fac_2_rb = 0;
1705 pSelect->rg_fac_2_g = 0;
1706
1707 pSelect->rnd_red_blue2_enable = 0;
1708 pSelect->rnd_green2_enable = 0;
1709 pSelect->rnd_thr_2_rb = 0;
1710 pSelect->rnd_thr_2_g = 0;
1711 pSelect->rnd_offs_2_rb = 0;
1712 pSelect->rnd_offs_2_g = 0;
1713
1714 pSelect->ro_red_blue2_enable = 1;
1715 pSelect->ro_green2_enable = 1;
1716 pSelect->ro_lim_2_rb = 0x3;
1717 pSelect->ro_lim_2_g = 0x3;
1718
1719 pSelect->lc_red_blue2_enable = 1;
1720 pSelect->lc_green2_enable = 1;
1721 pSelect->line_thr_2_rb = 0x7;
1722 pSelect->line_thr_2_g = 0x9;
1723 pSelect->line_mad_fac_2_rb = 0x5;
1724 pSelect->line_mad_fac_2_g = 0x7;
1725
1726 pSelect->pg_red_blue2_enable = 1;
1727 pSelect->pg_green2_enable = 1;
1728 pSelect->pg_fac_2_rb = 0x3;
1729 pSelect->pg_fac_2_g = 0x4;
1730 break;
1731 case 7:
1732 pSelect->sw_rk_red_blue2_en = 1;
1733 pSelect->sw_rk_green2_en = 1;
1734 pSelect->sw_mindis2_rb = 0x5;
1735 pSelect->sw_mindis2_g = 0x8;
1736 pSelect->sw_dis_scale_min2 = 0x3;
1737 pSelect->sw_dis_scale_max2 = 0x6;
1738
1739 pSelect->rg_red_blue2_enable = 0;
1740 pSelect->rg_green2_enable = 0;
1741 pSelect->rg_fac_2_rb = 0;
1742 pSelect->rg_fac_2_g = 0;
1743
1744 pSelect->rnd_red_blue2_enable = 0;
1745 pSelect->rnd_green2_enable = 0;
1746 pSelect->rnd_thr_2_rb = 0;
1747 pSelect->rnd_thr_2_g = 0;
1748 pSelect->rnd_offs_2_rb = 0;
1749 pSelect->rnd_offs_2_g = 0;
1750
1751 pSelect->ro_red_blue2_enable = 1;
1752 pSelect->ro_green2_enable = 1;
1753 pSelect->ro_lim_2_rb = 0x4;
1754 pSelect->ro_lim_2_g = 0x3;
1755
1756 pSelect->lc_red_blue2_enable = 1;
1757 pSelect->lc_green2_enable = 1;
1758 pSelect->line_thr_2_rb = 0x5;
1759 pSelect->line_thr_2_g = 0x7;
1760 pSelect->line_mad_fac_2_rb = 0x3;
1761 pSelect->line_mad_fac_2_g = 0x5;
1762
1763 pSelect->pg_red_blue2_enable = 1;
1764 pSelect->pg_green2_enable = 1;
1765 pSelect->pg_fac_2_rb = 0x2;
1766 pSelect->pg_fac_2_g = 0x1;
1767 break;
1768 case 8:
1769 pSelect->sw_rk_red_blue2_en = 1;
1770 pSelect->sw_rk_green2_en = 1;
1771 pSelect->sw_mindis2_rb = 0x5;
1772 pSelect->sw_mindis2_g = 0x8;
1773 pSelect->sw_dis_scale_min2 = 0x3;
1774 pSelect->sw_dis_scale_max2 = 0x6;
1775
1776 pSelect->rg_red_blue2_enable = 0;
1777 pSelect->rg_green2_enable = 0;
1778 pSelect->rg_fac_2_rb = 0;
1779 pSelect->rg_fac_2_g = 0;
1780
1781 pSelect->rnd_red_blue2_enable = 0;
1782 pSelect->rnd_green2_enable = 0;
1783 pSelect->rnd_thr_2_rb = 0;
1784 pSelect->rnd_thr_2_g = 0;
1785 pSelect->rnd_offs_2_rb = 0;
1786 pSelect->rnd_offs_2_g = 0;
1787
1788 pSelect->ro_red_blue2_enable = 1;
1789 pSelect->ro_green2_enable = 1;
1790 pSelect->ro_lim_2_rb = 0x1;
1791 pSelect->ro_lim_2_g = 0x3;
1792
1793 pSelect->lc_red_blue2_enable = 1;
1794 pSelect->lc_green2_enable = 1;
1795 pSelect->line_thr_2_rb = 0x5;
1796 pSelect->line_thr_2_g = 0x7;
1797 pSelect->line_mad_fac_2_rb = 0x3;
1798 pSelect->line_mad_fac_2_g = 0x5;
1799
1800 pSelect->pg_red_blue2_enable = 0;
1801 pSelect->pg_green2_enable = 0;
1802 pSelect->pg_fac_2_rb = 0;
1803 pSelect->pg_fac_2_g = 0;
1804 break;
1805 case 9:
1806 pSelect->sw_rk_red_blue2_en = 1;
1807 pSelect->sw_rk_green2_en = 1;
1808 pSelect->sw_mindis2_rb = 0x4;
1809 pSelect->sw_mindis2_g = 0x8;
1810 pSelect->sw_dis_scale_min2 = 0x2;
1811 pSelect->sw_dis_scale_max2 = 0x6;
1812
1813 pSelect->rg_red_blue2_enable = 0;
1814 pSelect->rg_green2_enable = 0;
1815 pSelect->rg_fac_2_rb = 0;
1816 pSelect->rg_fac_2_g = 0;
1817
1818 pSelect->rnd_red_blue2_enable = 0;
1819 pSelect->rnd_green2_enable = 0;
1820 pSelect->rnd_thr_2_rb = 0;
1821 pSelect->rnd_thr_2_g = 0;
1822 pSelect->rnd_offs_2_rb = 0;
1823 pSelect->rnd_offs_2_g = 0;
1824
1825 pSelect->ro_red_blue2_enable = 1;
1826 pSelect->ro_green2_enable = 1;
1827 pSelect->ro_lim_2_rb = 0x4;
1828 pSelect->ro_lim_2_g = 0x3;
1829
1830 pSelect->lc_red_blue2_enable = 1;
1831 pSelect->lc_green2_enable = 1;
1832 pSelect->line_thr_2_rb = 0x1;
1833 pSelect->line_thr_2_g = 0x3;
1834 pSelect->line_mad_fac_2_rb = 0x2;
1835 pSelect->line_mad_fac_2_g = 0x2;
1836
1837 pSelect->pg_red_blue2_enable = 0;
1838 pSelect->pg_green2_enable = 0;
1839 pSelect->pg_fac_2_rb = 0;
1840 pSelect->pg_fac_2_g = 0;
1841 break;
1842 case 10:
1843 pSelect->sw_rk_red_blue2_en = 1;
1844 pSelect->sw_rk_green2_en = 1;
1845 pSelect->sw_mindis2_rb = 0x4;
1846 pSelect->sw_mindis2_g = 0x8;
1847 pSelect->sw_dis_scale_min2 = 0x3;
1848 pSelect->sw_dis_scale_max2 = 0x6;
1849
1850 pSelect->rg_red_blue2_enable = 0;
1851 pSelect->rg_green2_enable = 0;
1852 pSelect->rg_fac_2_rb = 0;
1853 pSelect->rg_fac_2_g = 0;
1854
1855 pSelect->rnd_red_blue2_enable = 0;
1856 pSelect->rnd_green2_enable = 0;
1857 pSelect->rnd_thr_2_rb = 0;
1858 pSelect->rnd_thr_2_g = 0;
1859 pSelect->rnd_offs_2_rb = 0;
1860 pSelect->rnd_offs_2_g = 0;
1861
1862 pSelect->ro_red_blue2_enable = 1;
1863 pSelect->ro_green2_enable = 1;
1864 pSelect->ro_lim_2_rb = 0x4;
1865 pSelect->ro_lim_2_g = 0x3;
1866
1867 pSelect->lc_red_blue2_enable = 0;
1868 pSelect->lc_green2_enable = 0;
1869 pSelect->line_thr_2_rb = 0;
1870 pSelect->line_thr_2_g = 0;
1871 pSelect->line_mad_fac_2_rb = 0;
1872 pSelect->line_mad_fac_2_g = 0;
1873
1874 pSelect->pg_red_blue2_enable = 0;
1875 pSelect->pg_green2_enable = 0;
1876 pSelect->pg_fac_2_rb = 0;
1877 pSelect->pg_fac_2_g = 0;
1878 break;
1879 default:
1880 LOGE_ADPCC("%s(%d): Wrong fast mode level!!!", __FUNCTION__, __LINE__);
1881 break;
1882 }
1883
1884
1885 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
1886
1887 }
1888
Fast_mode_Double_Setting(AdpccContext_t * pParams,Adpcc_basic_cfg_params_t * pSelect,int iso)1889 void Fast_mode_Double_Setting(
1890 AdpccContext_t *pParams,
1891 Adpcc_basic_cfg_params_t *pSelect,
1892 int iso)
1893 {
1894 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1895
1896
1897 int level = AdpccInterpolation(iso, pParams->stAuto.stFastMode.ISO, pParams->stAuto.stFastMode.fast_mode_double_level);
1898
1899 if(pParams->stAuto.stFastMode.fast_mode_double_en != 0)
1900 pSelect->stage1_use_set_2 = 0x1;
1901 else
1902 pSelect->stage1_use_set_2 = 0x0;
1903
1904 level = LIMIT_VALUE(level, FASTMODELEVELMAX, FASTMODELEVELMIN);
1905 Fast_mode_Double_level_Setting(pSelect, level);
1906
1907 LOGD_ADPCC("%s(%d): Dpcc fast mode double en:%d level:%d", __FUNCTION__, __LINE__,
1908 pParams->stAuto.stFastMode.fast_mode_double_en, level);
1909
1910 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
1911
1912 }
1913
Fast_mode_Single_level_Setting(Adpcc_basic_cfg_params_t * pSelect,int level)1914 void Fast_mode_Single_level_Setting(
1915 Adpcc_basic_cfg_params_t *pSelect,
1916 int level)
1917 {
1918 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
1919
1920 switch (level)
1921 {
1922 case 1:
1923 pSelect->sw_rk_red_blue1_en = 1;
1924 pSelect->sw_rk_green1_en = 1;
1925 pSelect->sw_mindis1_rb = 0x20;
1926 pSelect->sw_mindis1_g = 0x20;
1927 pSelect->sw_dis_scale_min1 = 0x12;
1928 pSelect->sw_dis_scale_max1 = 0x12;
1929
1930 pSelect->rg_red_blue1_enable = 1;
1931 pSelect->rg_green1_enable = 1;
1932 pSelect->rg_fac_1_rb = 0x20;
1933 pSelect->rg_fac_1_g = 0x20;
1934
1935 pSelect->rnd_red_blue1_enable = 1;
1936 pSelect->rnd_green1_enable = 1;
1937 pSelect->rnd_thr_1_rb = 0xa;
1938 pSelect->rnd_thr_1_g = 0xa;
1939 pSelect->rnd_offs_1_rb = 0x1;
1940 pSelect->rnd_offs_1_g = 0x1;
1941
1942 pSelect->ro_red_blue1_enable = 1;
1943 pSelect->ro_green1_enable = 1;
1944 pSelect->ro_lim_1_rb = 0x2;
1945 pSelect->ro_lim_1_g = 0x2;
1946
1947 pSelect->lc_red_blue1_enable = 1;
1948 pSelect->lc_green1_enable = 1;
1949 pSelect->line_thr_1_rb = 0x8;
1950 pSelect->line_thr_1_g = 0x8;
1951 pSelect->line_mad_fac_1_rb = 0x4;
1952 pSelect->line_mad_fac_1_g = 0x4;
1953
1954 pSelect->pg_red_blue1_enable = 1;
1955 pSelect->pg_green1_enable = 1;
1956 pSelect->pg_fac_1_rb = 0x8;
1957 pSelect->pg_fac_1_g = 0x8;
1958 break;
1959 case 2:
1960 pSelect->sw_rk_red_blue1_en = 1;
1961 pSelect->sw_rk_green1_en = 1;
1962 pSelect->sw_mindis1_rb = 0x16;
1963 pSelect->sw_mindis1_g = 0x16;
1964 pSelect->sw_dis_scale_min1 = 0x8;
1965 pSelect->sw_dis_scale_max1 = 0x8;
1966
1967 pSelect->rg_red_blue1_enable = 1;
1968 pSelect->rg_green1_enable = 1;
1969 pSelect->rg_fac_1_rb = 0x10;
1970 pSelect->rg_fac_1_g = 0x10;
1971
1972 pSelect->rnd_red_blue1_enable = 1;
1973 pSelect->rnd_green1_enable = 1;
1974 pSelect->rnd_thr_1_rb = 0x6;
1975 pSelect->rnd_thr_1_g = 0x6;
1976 pSelect->rnd_offs_1_rb = 0x1;
1977 pSelect->rnd_offs_1_g = 0x1;
1978
1979 pSelect->ro_red_blue1_enable = 1;
1980 pSelect->ro_green1_enable = 1;
1981 pSelect->ro_lim_1_rb = 0x2;
1982 pSelect->ro_lim_1_g = 0x2;
1983
1984 pSelect->lc_red_blue1_enable = 1;
1985 pSelect->lc_green1_enable = 1;
1986 pSelect->line_thr_1_rb = 0x16;
1987 pSelect->line_thr_1_g = 0x16;
1988 pSelect->line_mad_fac_1_rb = 0x10;
1989 pSelect->line_mad_fac_1_g = 0x10;
1990
1991 pSelect->pg_red_blue1_enable = 1;
1992 pSelect->pg_green1_enable = 1;
1993 pSelect->pg_fac_1_rb = 0x6;
1994 pSelect->pg_fac_1_g = 0x6;
1995 break;
1996 case 3:
1997 pSelect->sw_rk_red_blue1_en = 1;
1998 pSelect->sw_rk_green1_en = 1;
1999 pSelect->sw_mindis1_rb = 0x16;
2000 pSelect->sw_mindis1_g = 0x16;
2001 pSelect->sw_dis_scale_min1 = 0x8;
2002 pSelect->sw_dis_scale_max1 = 0x8;
2003
2004 pSelect->rg_red_blue1_enable = 0;
2005 pSelect->rg_green1_enable = 0;
2006 pSelect->rg_fac_1_rb = 0;
2007 pSelect->rg_fac_1_g = 0;
2008
2009 pSelect->rnd_red_blue1_enable = 1;
2010 pSelect->rnd_green1_enable = 1;
2011 pSelect->rnd_thr_1_rb = 0x6;
2012 pSelect->rnd_thr_1_g = 0x6;
2013 pSelect->rnd_offs_1_rb = 0x1;
2014 pSelect->rnd_offs_1_g = 0x1;
2015
2016 pSelect->ro_red_blue1_enable = 1;
2017 pSelect->ro_green1_enable = 1;
2018 pSelect->ro_lim_1_rb = 0x2;
2019 pSelect->ro_lim_1_g = 0x2;
2020
2021 pSelect->lc_red_blue1_enable = 1;
2022 pSelect->lc_green1_enable = 1;
2023 pSelect->line_thr_1_rb = 0x16;
2024 pSelect->line_thr_1_g = 0x16;
2025 pSelect->line_mad_fac_1_rb = 0x10;
2026 pSelect->line_mad_fac_1_g = 0x10;
2027
2028 pSelect->pg_red_blue1_enable = 1;
2029 pSelect->pg_green1_enable = 1;
2030 pSelect->pg_fac_1_rb = 0x6;
2031 pSelect->pg_fac_1_g = 0x6;
2032 break;
2033 case 4:
2034 pSelect->sw_rk_red_blue1_en = 1;
2035 pSelect->sw_rk_green1_en = 1;
2036 pSelect->sw_mindis1_rb = 0x16;
2037 pSelect->sw_mindis1_g = 0x16;
2038 pSelect->sw_dis_scale_min1 = 0x8;
2039 pSelect->sw_dis_scale_max1 = 0x8;
2040
2041 pSelect->rg_red_blue1_enable = 0;
2042 pSelect->rg_green1_enable = 0;
2043 pSelect->rg_fac_1_rb = 0;
2044 pSelect->rg_fac_1_g = 0;
2045
2046 pSelect->rnd_red_blue1_enable = 0;
2047 pSelect->rnd_green1_enable = 0;
2048 pSelect->rnd_thr_1_rb = 0;
2049 pSelect->rnd_thr_1_g = 0;
2050 pSelect->rnd_offs_1_rb = 0;
2051 pSelect->rnd_offs_1_g = 0;
2052
2053 pSelect->ro_red_blue1_enable = 1;
2054 pSelect->ro_green1_enable = 1;
2055 pSelect->ro_lim_1_rb = 0x2;
2056 pSelect->ro_lim_1_g = 0x2;
2057
2058 pSelect->lc_red_blue1_enable = 1;
2059 pSelect->lc_green1_enable = 1;
2060 pSelect->line_thr_1_rb = 0x16;
2061 pSelect->line_thr_1_g = 0x16;
2062 pSelect->line_mad_fac_1_rb = 0x10;
2063 pSelect->line_mad_fac_1_g = 0x10;
2064
2065 pSelect->pg_red_blue1_enable = 1;
2066 pSelect->pg_green1_enable = 1;
2067 pSelect->pg_fac_1_rb = 0x6;
2068 pSelect->pg_fac_1_g = 0x6;
2069 break;
2070 case 5:
2071 pSelect->sw_rk_red_blue1_en = 1;
2072 pSelect->sw_rk_green1_en = 1;
2073 pSelect->sw_mindis1_rb = 0x14;
2074 pSelect->sw_mindis1_g = 0x14;
2075 pSelect->sw_dis_scale_min1 = 0xc;
2076 pSelect->sw_dis_scale_max1 = 0xc;
2077
2078 pSelect->rg_red_blue1_enable = 0;
2079 pSelect->rg_green1_enable = 0;
2080 pSelect->rg_fac_1_rb = 0;
2081 pSelect->rg_fac_1_g = 0;
2082
2083 pSelect->rnd_red_blue1_enable = 0;
2084 pSelect->rnd_green1_enable = 0;
2085 pSelect->rnd_thr_1_rb = 0;
2086 pSelect->rnd_thr_1_g = 0;
2087 pSelect->rnd_offs_1_rb = 0;
2088 pSelect->rnd_offs_1_g = 0;
2089
2090 pSelect->ro_red_blue1_enable = 1;
2091 pSelect->ro_green1_enable = 1;
2092 pSelect->ro_lim_1_rb = 0x3;
2093 pSelect->ro_lim_1_g = 0x3;
2094
2095 pSelect->lc_red_blue1_enable = 1;
2096 pSelect->lc_green1_enable = 1;
2097 pSelect->line_thr_1_rb = 0xc;
2098 pSelect->line_thr_1_g = 0xc;
2099 pSelect->line_mad_fac_1_rb = 0x9;
2100 pSelect->line_mad_fac_1_g = 0x9;
2101
2102 pSelect->pg_red_blue1_enable = 1;
2103 pSelect->pg_green1_enable = 1;
2104 pSelect->pg_fac_1_rb = 0x5;
2105 pSelect->pg_fac_1_g = 0x4;
2106 break;
2107 case 6:
2108 pSelect->sw_rk_red_blue1_en = 1;
2109 pSelect->sw_rk_green1_en = 1;
2110 pSelect->sw_mindis1_rb = 0x10;
2111 pSelect->sw_mindis1_g = 0x10;
2112 pSelect->sw_dis_scale_min1 = 0x8;
2113 pSelect->sw_dis_scale_max1 = 0x8;
2114
2115 pSelect->rg_red_blue1_enable = 0;
2116 pSelect->rg_green1_enable = 0;
2117 pSelect->rg_fac_1_rb = 0;
2118 pSelect->rg_fac_1_g = 0;
2119
2120 pSelect->rnd_red_blue1_enable = 0;
2121 pSelect->rnd_green1_enable = 0;
2122 pSelect->rnd_thr_1_rb = 0;
2123 pSelect->rnd_thr_1_g = 0;
2124 pSelect->rnd_offs_1_rb = 0;
2125 pSelect->rnd_offs_1_g = 0;
2126
2127 pSelect->ro_red_blue1_enable = 1;
2128 pSelect->ro_green1_enable = 1;
2129 pSelect->ro_lim_1_rb = 0x3;
2130 pSelect->ro_lim_1_g = 0x3;
2131
2132 pSelect->lc_red_blue1_enable = 1;
2133 pSelect->lc_green1_enable = 1;
2134 pSelect->line_thr_1_rb = 0x9;
2135 pSelect->line_thr_1_g = 0x9;
2136 pSelect->line_mad_fac_1_rb = 0x7;
2137 pSelect->line_mad_fac_1_g = 0x7;
2138
2139 pSelect->pg_red_blue1_enable = 1;
2140 pSelect->pg_green1_enable = 1;
2141 pSelect->pg_fac_1_rb = 0x5;
2142 pSelect->pg_fac_1_g = 0x4;
2143 break;
2144 case 7:
2145 pSelect->sw_rk_red_blue1_en = 1;
2146 pSelect->sw_rk_green1_en = 1;
2147 pSelect->sw_mindis1_rb = 0x8;
2148 pSelect->sw_mindis1_g = 0x8;
2149 pSelect->sw_dis_scale_min1 = 0x6;
2150 pSelect->sw_dis_scale_max1 = 0x6;
2151
2152 pSelect->rg_red_blue1_enable = 0;
2153 pSelect->rg_green1_enable = 0;
2154 pSelect->rg_fac_1_rb = 0;
2155 pSelect->rg_fac_1_g = 0;
2156
2157 pSelect->rnd_red_blue1_enable = 0;
2158 pSelect->rnd_green1_enable = 0;
2159 pSelect->rnd_thr_1_rb = 0;
2160 pSelect->rnd_thr_1_g = 0;
2161 pSelect->rnd_offs_1_rb = 0;
2162 pSelect->rnd_offs_1_g = 0;
2163
2164 pSelect->ro_red_blue1_enable = 1;
2165 pSelect->ro_green1_enable = 1;
2166 pSelect->ro_lim_1_rb = 0x3;
2167 pSelect->ro_lim_1_g = 0x3;
2168
2169 pSelect->lc_red_blue1_enable = 1;
2170 pSelect->lc_green1_enable = 1;
2171 pSelect->line_thr_1_rb = 0x7;
2172 pSelect->line_thr_1_g = 0x7;
2173 pSelect->line_mad_fac_1_rb = 0x5;
2174 pSelect->line_mad_fac_1_g = 0x5;
2175
2176 pSelect->pg_red_blue1_enable = 1;
2177 pSelect->pg_green1_enable = 1;
2178 pSelect->pg_fac_1_rb = 0x3;
2179 pSelect->pg_fac_1_g = 0x1;
2180 break;
2181 case 8:
2182 pSelect->sw_rk_red_blue1_en = 1;
2183 pSelect->sw_rk_green1_en = 1;
2184 pSelect->sw_mindis1_rb = 0x8;
2185 pSelect->sw_mindis1_g = 0x8;
2186 pSelect->sw_dis_scale_min1 = 0x6;
2187 pSelect->sw_dis_scale_max1 = 0x6;
2188
2189 pSelect->rg_red_blue1_enable = 0;
2190 pSelect->rg_green1_enable = 0;
2191 pSelect->rg_fac_1_rb = 0;
2192 pSelect->rg_fac_1_g = 0;
2193
2194 pSelect->rnd_red_blue1_enable = 0;
2195 pSelect->rnd_green1_enable = 0;
2196 pSelect->rnd_thr_1_rb = 0;
2197 pSelect->rnd_thr_1_g = 0;
2198 pSelect->rnd_offs_1_rb = 0;
2199 pSelect->rnd_offs_1_g = 0;
2200
2201 pSelect->ro_red_blue1_enable = 1;
2202 pSelect->ro_green1_enable = 1;
2203 pSelect->ro_lim_1_rb = 0x3;
2204 pSelect->ro_lim_1_g = 0x3;
2205
2206 pSelect->lc_red_blue1_enable = 1;
2207 pSelect->lc_green1_enable = 1;
2208 pSelect->line_thr_1_rb = 0x7;
2209 pSelect->line_thr_1_g = 0x7;
2210 pSelect->line_mad_fac_1_rb = 0x5;
2211 pSelect->line_mad_fac_1_g = 0x5;
2212
2213 pSelect->pg_red_blue1_enable = 0;
2214 pSelect->pg_green1_enable = 0;
2215 pSelect->pg_fac_1_rb = 0;
2216 pSelect->pg_fac_1_g = 0;
2217 break;
2218 case 9:
2219 pSelect->sw_rk_red_blue1_en = 1;
2220 pSelect->sw_rk_green1_en = 1;
2221 pSelect->sw_mindis1_rb = 0x8;
2222 pSelect->sw_mindis1_g = 0x8;
2223 pSelect->sw_dis_scale_min1 = 0x6;
2224 pSelect->sw_dis_scale_max1 = 0x6;
2225
2226 pSelect->rg_red_blue1_enable = 0;
2227 pSelect->rg_green1_enable = 0;
2228 pSelect->rg_fac_1_rb = 0;
2229 pSelect->rg_fac_1_g = 0;
2230
2231 pSelect->rnd_red_blue1_enable = 0;
2232 pSelect->rnd_green1_enable = 0;
2233 pSelect->rnd_thr_1_rb = 0;
2234 pSelect->rnd_thr_1_g = 0;
2235 pSelect->rnd_offs_1_rb = 0;
2236 pSelect->rnd_offs_1_g = 0;
2237
2238 pSelect->ro_red_blue1_enable = 1;
2239 pSelect->ro_green1_enable = 1;
2240 pSelect->ro_lim_1_rb = 0x3;
2241 pSelect->ro_lim_1_g = 0x3;
2242
2243 pSelect->lc_red_blue1_enable = 1;
2244 pSelect->lc_green1_enable = 1;
2245 pSelect->line_thr_1_rb = 0x3;
2246 pSelect->line_thr_1_g = 0x3;
2247 pSelect->line_mad_fac_1_rb = 0x2;
2248 pSelect->line_mad_fac_1_g = 0x2;
2249
2250 pSelect->pg_red_blue1_enable = 0;
2251 pSelect->pg_green1_enable = 0;
2252 pSelect->pg_fac_1_rb = 0;
2253 pSelect->pg_fac_1_g = 0;
2254 break;
2255 case 10:
2256 pSelect->sw_rk_red_blue1_en = 1;
2257 pSelect->sw_rk_green1_en = 1;
2258 pSelect->sw_mindis1_rb = 0x8;
2259 pSelect->sw_mindis1_g = 0x8;
2260 pSelect->sw_dis_scale_min1 = 0x6;
2261 pSelect->sw_dis_scale_max1 = 0x6;
2262
2263 pSelect->rg_red_blue1_enable = 0;
2264 pSelect->rg_green1_enable = 0;
2265 pSelect->rg_fac_1_rb = 0;
2266 pSelect->rg_fac_1_g = 0;
2267
2268 pSelect->rnd_red_blue1_enable = 0;
2269 pSelect->rnd_green1_enable = 0;
2270 pSelect->rnd_thr_1_rb = 0;
2271 pSelect->rnd_thr_1_g = 0;
2272 pSelect->rnd_offs_1_rb = 0;
2273 pSelect->rnd_offs_1_g = 0;
2274
2275 pSelect->ro_red_blue1_enable = 1;
2276 pSelect->ro_green1_enable = 1;
2277 pSelect->ro_lim_1_rb = 0x3;
2278 pSelect->ro_lim_1_g = 0x3;
2279
2280 pSelect->lc_red_blue1_enable = 0;
2281 pSelect->lc_green1_enable = 0;
2282 pSelect->line_thr_1_rb = 0;
2283 pSelect->line_thr_1_g = 0;
2284 pSelect->line_mad_fac_1_rb = 0;
2285 pSelect->line_mad_fac_1_g = 0;
2286
2287 pSelect->pg_red_blue1_enable = 0;
2288 pSelect->pg_green1_enable = 0;
2289 pSelect->pg_fac_1_rb = 0;
2290 pSelect->pg_fac_1_g = 0;
2291 break;
2292 default:
2293 LOGE_ADPCC("%s(%d): Wrong fast mode level!!!", __FUNCTION__, __LINE__);
2294 break;
2295 }
2296
2297 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2298
2299 }
2300
Fast_mode_Single_Setting(AdpccContext_t * pParams,Adpcc_basic_cfg_params_t * pSelect,int iso)2301 void Fast_mode_Single_Setting(
2302 AdpccContext_t *pParams,
2303 Adpcc_basic_cfg_params_t *pSelect,
2304 int iso)
2305 {
2306 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2307
2308 int level = AdpccInterpolation(iso, pParams->stAuto.stFastMode.ISO, pParams->stAuto.stFastMode.fast_mode_single_level);
2309
2310 if(pParams->stAuto.stFastMode.fast_mode_single_en != 0)
2311 pSelect->stage1_use_set_1 = 0x1;
2312 else
2313 pSelect->stage1_use_set_1 = 0x0;
2314
2315 level = LIMIT_VALUE(level, FASTMODELEVELMAX, FASTMODELEVELMIN);
2316 Fast_mode_Single_level_Setting(pSelect, level);
2317
2318
2319 LOGD_ADPCC("%s(%d): Dpcc fast mode single en:%d level:%d", __FUNCTION__, __LINE__, pParams->stAuto.stFastMode.fast_mode_single_en, level);
2320
2321 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2322
2323 }
2324
Fast_mode_select_basic_params_by_ISO(AdpccContext_t * pParams,Adpcc_basic_cfg_params_t * pSelect,AdpccExpInfo_t * pExpInfo)2325 AdpccResult_t Fast_mode_select_basic_params_by_ISO(
2326 AdpccContext_t *pParams,
2327 Adpcc_basic_cfg_params_t *pSelect,
2328 AdpccExpInfo_t *pExpInfo)
2329 {
2330 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2331 int iso = 50;
2332
2333 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2334
2335 if(pParams == NULL) {
2336 ret = ADPCC_RET_NULL_POINTER;
2337 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2338 return ret;
2339 }
2340
2341 if(pSelect == NULL) {
2342 ret = ADPCC_RET_NULL_POINTER;
2343 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2344 return ret;
2345 }
2346
2347 if(pExpInfo == NULL) {
2348 ret = ADPCC_RET_NULL_POINTER;
2349 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2350 return ret;
2351 }
2352
2353 iso = pExpInfo->arPreResIso[pExpInfo->hdr_mode];
2354
2355 //set dpcc ctrl params
2356 //mode 0x0000
2357 pSelect->stage1_enable = 1;
2358
2359 if(pParams->isBlackSensor)
2360 pSelect->grayscale_mode = 0x1;
2361 else
2362 pSelect->grayscale_mode = 0x0;
2363
2364 pSelect->enable = 0x1;
2365
2366 //output_mode 0x0004
2367 pSelect->sw_rk_out_sel = 1;
2368 pSelect->sw_dpcc_output_sel = 1;
2369 pSelect->stage1_rb_3x3 = 0;
2370 pSelect->stage1_g_3x3 = 0;
2371 pSelect->stage1_incl_rb_center = 1;
2372 pSelect->stage1_incl_green_center = 1;
2373
2374 //set_use 0x0008
2375 pSelect->stage1_use_fix_set = 0x0;
2376
2377 //get current fast mode single level
2378 Fast_mode_Single_Setting(pParams, pSelect, iso);
2379
2380 //get current fast mode double level
2381 Fast_mode_Double_Setting(pParams, pSelect, iso);
2382
2383 //get current fast mode triple level
2384 Fast_mode_Triple_Setting(pParams, pSelect, iso);
2385
2386
2387 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2388 return ret;
2389 }
2390
Api_Fast_mode_select(AdpccContext_t * pParams,Adpcc_basic_cfg_params_t * pSelect,Adpcc_fast_mode_attr_t * pAttr)2391 AdpccResult_t Api_Fast_mode_select(
2392 AdpccContext_t *pParams,
2393 Adpcc_basic_cfg_params_t *pSelect,
2394 Adpcc_fast_mode_attr_t *pAttr)
2395 {
2396 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2397
2398 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2399
2400 if(pParams == NULL) {
2401 ret = ADPCC_RET_NULL_POINTER;
2402 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2403 return ret;
2404 }
2405
2406 if(pSelect == NULL) {
2407 ret = ADPCC_RET_NULL_POINTER;
2408 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2409 return ret;
2410 }
2411
2412 if(pAttr == NULL) {
2413 ret = ADPCC_RET_NULL_POINTER;
2414 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2415 return ret;
2416 }
2417
2418 //set dpcc ctrl params
2419 //mode 0x0000
2420 pSelect->stage1_enable = 1;
2421
2422 if(pParams->isBlackSensor)
2423 pSelect->grayscale_mode = 0x1;
2424 else
2425 pSelect->grayscale_mode = 0x0;
2426
2427 pSelect->enable = 0x1;
2428
2429 //output_mode 0x0004
2430 pSelect->sw_rk_out_sel = 1;
2431 pSelect->sw_dpcc_output_sel = 1;
2432 pSelect->stage1_rb_3x3 = 0;
2433 pSelect->stage1_g_3x3 = 0;
2434 pSelect->stage1_incl_rb_center = 1;
2435 pSelect->stage1_incl_green_center = 1;
2436
2437 //set_use 0x0008
2438 pSelect->stage1_use_fix_set = 0x0;
2439
2440 //get current fast mode single level
2441 if(pAttr->fast_mode_single_en)
2442 pSelect->stage1_use_set_1 = 0x1;
2443 Fast_mode_Single_level_Setting(pSelect, pAttr->fast_mode_single_level);
2444
2445 //get current fast mode double level
2446 if(pAttr->fast_mode_double_en)
2447 pSelect->stage1_use_set_2 = 0x1;
2448 Fast_mode_Double_level_Setting(pSelect, pAttr->fast_mode_double_level);
2449
2450 //get current fast mode triple level
2451 if(pAttr->fast_mode_triple_en)
2452 pSelect->stage1_use_set_3 = 0x1;
2453 Fast_mode_Triple_level_Setting(pSelect, pAttr->fast_mode_triple_level);
2454
2455
2456 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2457 return ret;
2458 }
2459
Api_select_bpt_params(Adpcc_bpt_params_t * pSelect,Adpcc_Manual_Attr_t * pstmaunal)2460 AdpccResult_t Api_select_bpt_params(
2461 Adpcc_bpt_params_t *pSelect,
2462 Adpcc_Manual_Attr_t *pstmaunal)
2463 {
2464 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2465
2466 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2467
2468 if(pSelect == NULL) {
2469 ret = ADPCC_RET_NULL_POINTER;
2470 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2471 return ret;
2472 }
2473
2474 if(pstmaunal == NULL) {
2475 ret = ADPCC_RET_NULL_POINTER;
2476 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2477 return ret;
2478 }
2479
2480 memcpy(pSelect, &pstmaunal->stBpt, sizeof(Adpcc_bpt_params_t));
2481
2482 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2483 return ret;
2484 }
2485
select_bpt_params_by_ISO(Adpcc_bpt_params_t * pParams,Adpcc_bpt_params_t * pSelect,AdpccExpInfo_t * pExpInfo)2486 AdpccResult_t select_bpt_params_by_ISO(
2487 Adpcc_bpt_params_t *pParams,
2488 Adpcc_bpt_params_t *pSelect,
2489 AdpccExpInfo_t *pExpInfo)
2490 {
2491 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2492
2493 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2494
2495 if(pParams == NULL) {
2496 ret = ADPCC_RET_NULL_POINTER;
2497 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2498 return ret;
2499 }
2500
2501 if(pSelect == NULL) {
2502 ret = ADPCC_RET_NULL_POINTER;
2503 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2504 return ret;
2505 }
2506
2507 if(pExpInfo == NULL) {
2508 ret = ADPCC_RET_NULL_POINTER;
2509 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2510 return ret;
2511 }
2512
2513 memcpy(pSelect, pParams, sizeof(Adpcc_bpt_params_t));
2514
2515 LOG1_ADPCC("%s(%d): exit!\n", __FUNCTION__, __LINE__);
2516 return ret;
2517 }
2518
Api_select_pdaf_params(Adpcc_pdaf_params_t * pSelect,Adpcc_Manual_Attr_t * pstmaunal)2519 AdpccResult_t Api_select_pdaf_params(
2520 Adpcc_pdaf_params_t *pSelect,
2521 Adpcc_Manual_Attr_t *pstmaunal)
2522 {
2523 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2524
2525 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2526
2527 if(pSelect == NULL) {
2528 ret = ADPCC_RET_NULL_POINTER;
2529 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2530 return ret;
2531 }
2532
2533 if(pstmaunal == NULL) {
2534 ret = ADPCC_RET_NULL_POINTER;
2535 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2536 return ret;
2537 }
2538
2539 memcpy(pSelect, &pstmaunal->stPdaf, sizeof(Adpcc_pdaf_params_t));
2540
2541 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2542 return ret;
2543 }
2544
select_pdaf_params_by_ISO(Adpcc_pdaf_params_t * pParams,Adpcc_pdaf_params_t * pSelect,AdpccExpInfo_t * pExpInfo)2545 AdpccResult_t select_pdaf_params_by_ISO(
2546 Adpcc_pdaf_params_t *pParams,
2547 Adpcc_pdaf_params_t *pSelect,
2548 AdpccExpInfo_t *pExpInfo)
2549 {
2550 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2551
2552 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2553
2554 if(pParams == NULL) {
2555 ret = ADPCC_RET_NULL_POINTER;
2556 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2557 return ret;
2558 }
2559
2560 if(pSelect == NULL) {
2561 ret = ADPCC_RET_NULL_POINTER;
2562 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2563 return ret;
2564 }
2565
2566 if(pExpInfo == NULL) {
2567 ret = ADPCC_RET_NULL_POINTER;
2568 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2569 return ret;
2570 }
2571
2572 memcpy(pSelect, pParams, sizeof(Adpcc_pdaf_params_t));
2573
2574 LOG1_ADPCC("%s(%d): exit!\n", __FUNCTION__, __LINE__);
2575 return ret;
2576 }
2577
DpccExpertMode(Adpcc_pdaf_params_t * pParams,Adpcc_pdaf_params_t * pSelect,AdpccExpInfo_t * pExpInfo)2578 AdpccResult_t DpccExpertMode(
2579 Adpcc_pdaf_params_t *pParams,
2580 Adpcc_pdaf_params_t *pSelect,
2581 AdpccExpInfo_t *pExpInfo)
2582 {
2583 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2584
2585 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2586
2587 if(pParams == NULL) {
2588 ret = ADPCC_RET_NULL_POINTER;
2589 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2590 return ret;
2591 }
2592
2593 if(pSelect == NULL) {
2594 ret = ADPCC_RET_NULL_POINTER;
2595 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2596 return ret;
2597 }
2598
2599 if(pExpInfo == NULL) {
2600 ret = ADPCC_RET_NULL_POINTER;
2601 LOGE_ADPCC("%s(%d): invalid inputparams\n", __FUNCTION__, __LINE__);
2602 return ret;
2603 }
2604
2605 memcpy(pSelect, pParams, sizeof(Adpcc_pdaf_params_t));
2606
2607 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2608 return ret;
2609 }
2610
GetCurrDpccValue(int inPara,float max,float inMatrixX[13],float inMatrixY[13])2611 int GetCurrDpccValue
2612 (
2613 int inPara,
2614 float max,
2615 float inMatrixX[13],
2616 float inMatrixY[13]
2617 ) {
2618 LOG1_ADPCC( "%s:enter!", __FUNCTION__);
2619 float x1 = 0.0f;
2620 float x2 = 0.0f;
2621 float value1 = 0.0f;
2622 float value2 = 0.0f;
2623 float outPara = 0.0f;
2624
2625 for(int i = 0; i < 12; i++)
2626 inMatrixY[i] > max ? inMatrixY[i] = max : inMatrixY[i] = inMatrixY[i] ;
2627
2628 if(inPara < inMatrixX[0])
2629 outPara = inMatrixY[0];
2630 else if (inPara >= inMatrixX[12])
2631 outPara = inMatrixY[12];
2632 else
2633 for(int i = 0 ; i < 11;)
2634 {
2635 if(inPara >= inMatrixX[i] && inPara < inMatrixX[i + 1])
2636 {
2637 x1 = inMatrixX[i];
2638 x2 = inMatrixX[i + 1];
2639 value1 = inMatrixY[i];
2640 value2 = inMatrixY[i + 1];
2641 outPara = value1 + (inPara - x1) * (value1 - value2) / (x1 - x2);
2642 break;
2643 }
2644 else
2645 i++;
2646 }
2647
2648 int out = (int)(outPara + 0.5);
2649
2650 return out;
2651 LOG1_ADPCC( "%s:exit!", __FUNCTION__);
2652 }
2653
Api_Sensor_dpcc_process(AdpccContext_t * pAdpccCtx)2654 void Api_Sensor_dpcc_process(AdpccContext_t *pAdpccCtx)
2655 {
2656 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2657
2658 pAdpccCtx->SenDpccRes.enable = pAdpccCtx->stManual.stSensorDpcc.en;
2659 pAdpccCtx->SenDpccRes.cur_single_dpcc = pAdpccCtx->stManual.stSensorDpcc.single_level;
2660 pAdpccCtx->SenDpccRes.cur_multiple_dpcc = pAdpccCtx->stManual.stSensorDpcc.double_level;
2661 pAdpccCtx->SenDpccRes.total_dpcc = pAdpccCtx->stManual.stSensorDpcc.max_level;
2662
2663 if (pAdpccCtx->SenDpccRes.enable == false) {
2664 LOGD_ADPCC("%s(%d):sensor dpcc setting off!!", __FUNCTION__, __LINE__);
2665 } else {
2666 LOGD_ADPCC("%s(%d):sensor dpcc setting on!!", __FUNCTION__, __LINE__);
2667 }
2668
2669 LOGD_ADPCC("%s(%d):Api sensor dpcc cur_s_dpcc:%d cur_m_dpcc:%d total_dpcc:%d!!", __FUNCTION__, __LINE__,
2670 pAdpccCtx->SenDpccRes.cur_single_dpcc, pAdpccCtx->SenDpccRes.cur_multiple_dpcc, pAdpccCtx->SenDpccRes.total_dpcc);
2671
2672 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2673
2674 }
2675
Sensor_dpcc_process(AdpccContext_t * pAdpccCtx)2676 void Sensor_dpcc_process(AdpccContext_t *pAdpccCtx)
2677 {
2678
2679
2680 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2681 int iso = 0;
2682 if(pAdpccCtx->stExpInfo.hdr_mode == 0)
2683 iso = pAdpccCtx->stExpInfo.arProcResIso[0];
2684 else if(pAdpccCtx->stExpInfo.hdr_mode == 1)
2685 iso = pAdpccCtx->stExpInfo.arProcResIso[1];
2686 else if(pAdpccCtx->stExpInfo.hdr_mode == 2)
2687 iso = pAdpccCtx->stExpInfo.arProcResIso[2];
2688
2689 float sensor_dpcc_level_single = GetCurrDpccValue(iso, pAdpccCtx->stAuto.stSensorDpcc.max_level,
2690 pAdpccCtx->stAuto.stSensorDpcc.iso, pAdpccCtx->stAuto.stSensorDpcc.level_single);
2691 float sensor_dpcc_level_multi = GetCurrDpccValue(iso, pAdpccCtx->stAuto.stSensorDpcc.max_level,
2692 pAdpccCtx->stAuto.stSensorDpcc.iso, pAdpccCtx->stAuto.stSensorDpcc.level_multiple);
2693
2694 pAdpccCtx->SenDpccRes.enable = pAdpccCtx->stAuto.stSensorDpcc.en;
2695 pAdpccCtx->SenDpccRes.cur_single_dpcc = (int)(sensor_dpcc_level_single + 0.5);
2696 pAdpccCtx->SenDpccRes.cur_multiple_dpcc = (int)(sensor_dpcc_level_multi + 0.5);
2697 pAdpccCtx->SenDpccRes.total_dpcc = (int)(pAdpccCtx->stAuto.stSensorDpcc.max_level + 0.5);
2698
2699 if (pAdpccCtx->SenDpccRes.enable == false) {
2700 LOGD_ADPCC("%s(%d):sensor dpcc setting off!!", __FUNCTION__, __LINE__);
2701 } else {
2702 LOGD_ADPCC("%s(%d):sensor dpcc setting on!!", __FUNCTION__, __LINE__);
2703 }
2704
2705 LOGD_ADPCC("%s(%d):ISO:%d sensor dpcc cur_s_dpcc:%d cur_m_dpcc:%d total_dpcc:%d!!", __FUNCTION__, __LINE__, iso,
2706 pAdpccCtx->SenDpccRes.cur_single_dpcc, pAdpccCtx->SenDpccRes.cur_multiple_dpcc, pAdpccCtx->SenDpccRes.total_dpcc);
2707
2708 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2709
2710 }
2711
AdpccReloadPara(AdpccContext_t * pAdpccCtx,CamCalibDbV2Context_t * pCalibDb)2712 AdpccResult_t AdpccReloadPara(AdpccContext_t *pAdpccCtx, CamCalibDbV2Context_t *pCalibDb)
2713 {
2714 LOG1_ADPCC(" %s(%d): enter!", __FUNCTION__, __LINE__);
2715 LOGD_ADPCC(" %s(%d): Adpcc Reload Para, prepare type is %d!", __FUNCTION__, __LINE__, pAdpccCtx->prepare_type);
2716
2717 //init fix param for algo
2718 CalibDbV2_Dpcc_t* calibv2_adpcc_calib =
2719 (CalibDbV2_Dpcc_t*)(CALIBDBV2_GET_MODULE_PTR(pCalibDb, adpcc_calib));
2720 memcpy(&pAdpccCtx->stDpccCalib, calibv2_adpcc_calib, sizeof(CalibDbV2_Dpcc_t));//reload iq
2721 memcpy(&pAdpccCtx->stTool, calibv2_adpcc_calib, sizeof(CalibDbV2_Dpcc_t));
2722 dpcc_expert_mode_basic_params_init(&pAdpccCtx->stAuto.stBasicParams, &pAdpccCtx->stDpccCalib);
2723 dpcc_fast_mode_basic_params_init(&pAdpccCtx->stAuto.stFastMode, &pAdpccCtx->stDpccCalib);
2724 dpcc_pdaf_params_init(&pAdpccCtx->stAuto.stPdafParams, &pAdpccCtx->stDpccCalib.DpccTuningPara.Dpcc_pdaf);
2725 dpcc_sensor_params_init(&pAdpccCtx->stAuto.stSensorDpcc, &pAdpccCtx->stDpccCalib);
2726
2727 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2728 return ADPCC_RET_SUCCESS;
2729 }
2730
AdpccInit(AdpccContext_t ** ppAdpccCtx,CamCalibDbV2Context_t * pCalibDb)2731 AdpccResult_t AdpccInit(AdpccContext_t **ppAdpccCtx, CamCalibDbV2Context_t *pCalibDb)
2732 {
2733 AdpccContext_t * pAdpccCtx;
2734
2735 LOG1_ADPCC(" %s(%d): enter!", __FUNCTION__, __LINE__);
2736
2737 pAdpccCtx = (AdpccContext_t *)malloc(sizeof(AdpccContext_t));
2738 if(pAdpccCtx == NULL) {
2739 LOGE_ADPCC("%s(%d): invalid inputparams", __FUNCTION__, __LINE__);
2740 return ADPCC_RET_NULL_POINTER;
2741 }
2742
2743 memset(pAdpccCtx, 0x00, sizeof(AdpccContext_t));
2744 pAdpccCtx->eState = ADPCC_STATE_INITIALIZED;
2745
2746 *ppAdpccCtx = pAdpccCtx;
2747
2748 pAdpccCtx->eMode = ADPCC_OP_MODE_AUTO;
2749
2750 #if 1
2751 //init fix param for algo
2752 CalibDbV2_Dpcc_t* calibv2_adpcc_calib =
2753 (CalibDbV2_Dpcc_t*)(CALIBDBV2_GET_MODULE_PTR(pCalibDb, adpcc_calib));
2754 memcpy(&pAdpccCtx->stDpccCalib, calibv2_adpcc_calib, sizeof(CalibDbV2_Dpcc_t));//load iq
2755 memcpy(&pAdpccCtx->stTool, calibv2_adpcc_calib, sizeof(CalibDbV2_Dpcc_t));
2756 dpcc_expert_mode_basic_params_init(&pAdpccCtx->stAuto.stBasicParams, &pAdpccCtx->stDpccCalib);
2757 dpcc_fast_mode_basic_params_init(&pAdpccCtx->stAuto.stFastMode, &pAdpccCtx->stDpccCalib);
2758 dpcc_pdaf_params_init(&pAdpccCtx->stAuto.stPdafParams, &pAdpccCtx->stDpccCalib.DpccTuningPara.Dpcc_pdaf);
2759 dpcc_sensor_params_init(&pAdpccCtx->stAuto.stSensorDpcc, &pAdpccCtx->stDpccCalib);
2760 #else
2761 //static init
2762 html_params_init(&pAdpccCtx->stParams);
2763 memcpy(&pAdpccCtx->stAuto.stBasicParams, &pAdpccCtx->stParams.stBasic, sizeof(Adpcc_basic_params_t));
2764 memcpy(&pAdpccCtx->stAuto.stBptParams, &pAdpccCtx->stParams.stBpt, sizeof(Adpcc_bpt_params_t));
2765 memcpy(&pAdpccCtx->stAuto.stPdafParams, &pAdpccCtx->stParams.stPdaf, sizeof(Adpcc_pdaf_params_t));
2766 #endif
2767
2768 for(int i = 0; i < 3; i++) {
2769 pAdpccCtx->PreAe.arProcResIso[i] = 50;
2770 pAdpccCtx->PreAe.arProcResAGain[i] = 1.0;
2771 pAdpccCtx->PreAe.arProcResDGain[i] = 1.0;
2772 pAdpccCtx->PreAe.arProcResTime[i] = 0.01;
2773 }
2774
2775 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2776 return ADPCC_RET_SUCCESS;
2777
2778 }
2779
AdpccRelease(AdpccContext_t * pAdpccCtx)2780 AdpccResult_t AdpccRelease(AdpccContext_t *pAdpccCtx)
2781 {
2782 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2783 if(pAdpccCtx == NULL) {
2784 LOGE_ADPCC("%s(%d): null pointer", __FUNCTION__, __LINE__);
2785 return ADPCC_RET_NULL_POINTER;
2786 }
2787
2788 memset(pAdpccCtx, 0x00, sizeof(AdpccContext_t));
2789 free(pAdpccCtx);
2790
2791 LOG1_ADPCC("%s(%d): exit!\n", __FUNCTION__, __LINE__);
2792 return ADPCC_RET_SUCCESS;
2793 }
2794
AdpccConfig(AdpccContext_t * pAdpccCtx,AdpccConfig_t * pAdpccConfig)2795 AdpccResult_t AdpccConfig(AdpccContext_t *pAdpccCtx, AdpccConfig_t* pAdpccConfig)
2796 {
2797 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2798
2799 if(pAdpccCtx == NULL) {
2800 LOGE_ADPCC("%s(%d): null pointer", __FUNCTION__, __LINE__);
2801 return ADPCC_RET_INVALID_PARM;
2802 }
2803
2804 if(pAdpccConfig == NULL) {
2805 LOGE_ADPCC("%s(%d): null pointer", __FUNCTION__, __LINE__);
2806 return ADPCC_RET_INVALID_PARM;
2807 }
2808
2809 //pAdpccCtx->eMode = pAdpccConfig->eMode;
2810 //pAdpccCtx->eState = pAdpccConfig->eState;
2811
2812 LOG1_ADPCC("%s(%d): exit!\n", __FUNCTION__, __LINE__);
2813 return ADPCC_RET_SUCCESS;
2814 }
2815
AdpccReConfig(AdpccContext_t * pAdpccCtx,AdpccConfig_t * pAdpccConfig)2816 AdpccResult_t AdpccReConfig(AdpccContext_t *pAdpccCtx, AdpccConfig_t* pAdpccConfig)
2817 {
2818 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2819 //need todo what?
2820
2821 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2822 return ADPCC_RET_SUCCESS;
2823 }
2824
AdpccPreProcess(AdpccContext_t * pAdpccCtx)2825 AdpccResult_t AdpccPreProcess(AdpccContext_t *pAdpccCtx)
2826 {
2827 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2828 //need todo what?
2829
2830 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2831 return ADPCC_RET_SUCCESS;
2832 }
2833
AdpccProcess(AdpccContext_t * pAdpccCtx,AdpccExpInfo_t * pExpInfo,AdpccProcResult_t * pAdpccResult)2834 AdpccResult_t AdpccProcess(AdpccContext_t *pAdpccCtx, AdpccExpInfo_t *pExpInfo, AdpccProcResult_t* pAdpccResult)
2835 {
2836 LOG1_ADPCC("%s(%d): enter!", __FUNCTION__, __LINE__);
2837 AdpccResult_t ret = ADPCC_RET_SUCCESS;
2838
2839 if(pAdpccCtx == NULL) {
2840 LOGE_ADPCC("%s(%d): null pointer", __FUNCTION__, __LINE__);
2841 return ADPCC_RET_INVALID_PARM;
2842 }
2843
2844 if(pExpInfo == NULL) {
2845 LOGE_ADPCC("%s(%d): null pointer\n", __FUNCTION__, __LINE__);
2846 return ADPCC_RET_INVALID_PARM;
2847 }
2848
2849 memcpy(&pAdpccCtx->stExpInfo, pExpInfo, sizeof(AdpccExpInfo_t));
2850
2851 if(pAdpccCtx->eMode == ADPCC_OP_MODE_AUTO) {
2852 LOGD_ADPCC("%s(%d): Adpcc Auto mode!!!", __FUNCTION__, __LINE__);
2853 bool fast_enable = pAdpccCtx->stAuto.stFastMode.fast_mode_en == 0 ? false : true;
2854
2855 if(fast_enable == false)
2856 ret = Expert_mode_select_basic_params_by_ISO(&pAdpccCtx->stAuto.stBasicParams, &pAdpccResult->stBasic, pExpInfo);
2857 else
2858 ret = Fast_mode_select_basic_params_by_ISO(pAdpccCtx, &pAdpccResult->stBasic, pExpInfo);
2859
2860 ret = select_bpt_params_by_ISO(&pAdpccCtx->stAuto.stBptParams, &pAdpccResult->stBpt, pExpInfo);
2861 ret = select_pdaf_params_by_ISO(&pAdpccCtx->stAuto.stPdafParams, &pAdpccResult->stPdaf, pExpInfo);
2862
2863 //sensor dpcc
2864 if(pAdpccCtx->stAuto.stSensorDpcc.en != 0 )
2865 Sensor_dpcc_process(pAdpccCtx);
2866
2867 } else if(pAdpccCtx->eMode == ADPCC_OP_MODE_MANUAL) {
2868 //TODO
2869 LOGD_ADPCC("%s(%d): Adpcc Manual mode!!!", __FUNCTION__, __LINE__);
2870 if(pAdpccCtx->stManual.stOnfly.mode == ADPCC_ONFLY_MODE_FAST)
2871 ret = Api_Fast_mode_select(pAdpccCtx, &pAdpccResult->stBasic, &pAdpccCtx->stManual.stOnfly.fast_mode);
2872 else
2873 ret = Api_Expert_mode_select(&pAdpccResult->stBasic, &pAdpccCtx->stManual);
2874
2875 ret = Api_select_bpt_params(&pAdpccResult->stBpt, &pAdpccCtx->stManual);
2876 ret = Api_select_pdaf_params(&pAdpccResult->stPdaf, &pAdpccCtx->stManual);
2877
2878 //sensor dpcc api
2879 if(pAdpccCtx->stManual.stSensorDpcc.en)
2880 Api_Sensor_dpcc_process(pAdpccCtx);
2881 }
2882 /*else if(pAdpccCtx->eMode == ADPCC_OP_MODE_TOOL) {
2883 LOGD_ADPCC("%s(%d): Adpcc Tool mode!!!\n", __FUNCTION__, __LINE__);
2884 dpcc_expert_mode_basic_params_init(&pAdpccCtx->stAuto.stBasicParams, &pAdpccCtx->stTool);
2885 dpcc_fast_mode_basic_params_init(&pAdpccCtx->stAuto.stFastMode, &pAdpccCtx->stTool);
2886 dpcc_pdaf_params_init(&pAdpccCtx->stAuto.stPdafParams, &pAdpccCtx->stTool.DpccTuningPara.Dpcc_pdaf);
2887 dpcc_sensor_params_init(&pAdpccCtx->stAuto.stSensorDpcc, &pAdpccCtx->stTool);
2888 memset(&pAdpccCtx->stAuto.stPdafParams, 0x00, sizeof(pAdpccCtx->stAuto.stPdafParams));
2889
2890 bool fast_enable = pAdpccCtx->stAuto.stFastMode.fast_mode_en == 0 ? false : true;
2891 if(fast_enable == false)
2892 ret = Expert_mode_select_basic_params_by_ISO(&pAdpccCtx->stAuto.stBasicParams, &pAdpccCtx->stAuto.stBasicSelect, pExpInfo);
2893 else
2894 ret = Fast_mode_select_basic_params_by_ISO(pAdpccCtx, &pAdpccCtx->stAuto.stBasicSelect, pExpInfo);
2895
2896 ret = select_bpt_params_by_ISO(&pAdpccCtx->stAuto.stBptParams, &pAdpccCtx->stAuto.stBptSelect, pExpInfo);
2897 ret = select_pdaf_params_by_ISO(&pAdpccCtx->stAuto.stPdafParams, &pAdpccCtx->stAuto.stPdafSelect, pExpInfo);
2898
2899 //sensor dpcc
2900 if(pAdpccCtx->stAuto.stSensorDpcc.en != 0 )
2901 Sensor_dpcc_process(pAdpccCtx);
2902 }*/
2903 else
2904 LOGE_ADPCC("%s(%d): Wrong api mode in dpcc!!!", __FUNCTION__, __LINE__);
2905
2906
2907 LOG1_ADPCC("%s(%d): exit!", __FUNCTION__, __LINE__);
2908 return ret;
2909 }
2910
2911
2912