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"
22 /* We use a different set of DPC configuration parameters when
23 * DPC is used before OBC and NORM. Currently these parameters
24 * are used in usecases which selects both BDS and DPC.
26 const struct ia_css_dp_config default_dp_10bpp_config = {
35 const struct ia_css_dp_config default_dp_config = {
46 struct sh_css_isp_dp_params *to,
47 const struct ia_css_dp_config *from,
50 int gain = from->gain;
57 to->threshold_single =
59 to->threshold_2adjacent =
60 uDIGIT_FITTING(from->threshold, 16, SH_CSS_BAYER_BITS);
62 uDIGIT_FITTING(from->gain, 8, SH_CSS_DP_GAIN_SHIFT);
65 uDIGIT_FITTING(gain * gr / r, 8, SH_CSS_DP_GAIN_SHIFT);
67 uDIGIT_FITTING(gain * gb / r, 8, SH_CSS_DP_GAIN_SHIFT);
69 uDIGIT_FITTING(gain * gb / b, 8, SH_CSS_DP_GAIN_SHIFT);
71 uDIGIT_FITTING(gain * gr / b, 8, SH_CSS_DP_GAIN_SHIFT);
73 uDIGIT_FITTING(gain * r / gr, 8, SH_CSS_DP_GAIN_SHIFT);
75 uDIGIT_FITTING(gain * b / gr, 8, SH_CSS_DP_GAIN_SHIFT);
77 uDIGIT_FITTING(gain * b / gb, 8, SH_CSS_DP_GAIN_SHIFT);
79 uDIGIT_FITTING(gain * r / gb, 8, SH_CSS_DP_GAIN_SHIFT);
84 const struct sh_css_isp_dp_params *dp,
88 ia_css_debug_dtrace(level, "Defect Pixel Correction:\n");
89 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
90 "dp_threshold_single_w_2adj_on",
91 dp->threshold_single);
92 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
93 "dp_threshold_2adj_w_2adj_on",
94 dp->threshold_2adjacent);
95 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
97 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
98 "dpc_coef_rr_gr", dp->coef_rr_gr);
99 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
100 "dpc_coef_rr_gb", dp->coef_rr_gb);
101 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
102 "dpc_coef_bb_gb", dp->coef_bb_gb);
103 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
104 "dpc_coef_bb_gr", dp->coef_bb_gr);
105 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
106 "dpc_coef_gr_rr", dp->coef_gr_rr);
107 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
108 "dpc_coef_gr_bb", dp->coef_gr_bb);
109 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
110 "dpc_coef_gb_bb", dp->coef_gb_bb);
111 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
112 "dpc_coef_gb_rr", dp->coef_gb_rr);
116 ia_css_dp_debug_dtrace(
117 const struct ia_css_dp_config *config,
120 ia_css_debug_dtrace(level,
121 "config.threshold=%d, config.gain=%d\n",
122 config->threshold, config->gain);
126 ia_css_init_dp_state(
127 void/*struct sh_css_isp_dp_vmem_state*/ * state,
130 memset(state, 0, size);