2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include "ia_css_types.h"
16 #include "sh_css_defs.h"
17 #include "ia_css_debug.h"
18 #include "sh_css_frac.h"
20 #include "ia_css_dp.host.h"
23 /* We use a different set of DPC configuration parameters when
24 * DPC is used before OBC and NORM. Currently these parameters
25 * are used in usecases which selects both BDS and DPC.
27 const struct ia_css_dp_config default_dp_10bpp_config = {
36 const struct ia_css_dp_config default_dp_config = {
47 struct sh_css_isp_dp_params *to,
48 const struct ia_css_dp_config *from,
51 int gain = from->gain;
58 to->threshold_single =
60 to->threshold_2adjacent =
61 uDIGIT_FITTING(from->threshold, 16, SH_CSS_BAYER_BITS);
63 uDIGIT_FITTING(from->gain, 8, SH_CSS_DP_GAIN_SHIFT);
66 uDIGIT_FITTING (gain * gr / r, 8, SH_CSS_DP_GAIN_SHIFT);
68 uDIGIT_FITTING (gain * gb / r, 8, SH_CSS_DP_GAIN_SHIFT);
70 uDIGIT_FITTING (gain * gb / b, 8, SH_CSS_DP_GAIN_SHIFT);
72 uDIGIT_FITTING (gain * gr / b, 8, SH_CSS_DP_GAIN_SHIFT);
74 uDIGIT_FITTING (gain * r / gr, 8, SH_CSS_DP_GAIN_SHIFT);
76 uDIGIT_FITTING (gain * b / gr, 8, SH_CSS_DP_GAIN_SHIFT);
78 uDIGIT_FITTING (gain * b / gb, 8, SH_CSS_DP_GAIN_SHIFT);
80 uDIGIT_FITTING (gain * r / gb, 8, SH_CSS_DP_GAIN_SHIFT);
85 const struct sh_css_isp_dp_params *dp,
89 ia_css_debug_dtrace(level, "Defect Pixel Correction:\n");
90 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
91 "dp_threshold_single_w_2adj_on",
92 dp->threshold_single);
93 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
94 "dp_threshold_2adj_w_2adj_on",
95 dp->threshold_2adjacent);
96 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
98 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
99 "dpc_coef_rr_gr", dp->coef_rr_gr);
100 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
101 "dpc_coef_rr_gb", dp->coef_rr_gb);
102 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
103 "dpc_coef_bb_gb", dp->coef_bb_gb);
104 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
105 "dpc_coef_bb_gr", dp->coef_bb_gr);
106 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
107 "dpc_coef_gr_rr", dp->coef_gr_rr);
108 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
109 "dpc_coef_gr_bb", dp->coef_gr_bb);
110 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
111 "dpc_coef_gb_bb", dp->coef_gb_bb);
112 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
113 "dpc_coef_gb_rr", dp->coef_gb_rr);
117 ia_css_dp_debug_dtrace(
118 const struct ia_css_dp_config *config,
121 ia_css_debug_dtrace(level,
122 "config.threshold=%d, config.gain=%d\n",
123 config->threshold, config->gain);
127 ia_css_init_dp_state(
128 void/*struct sh_css_isp_dp_vmem_state*/ *state,
131 memset(state, 0, size);