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_bnr.host.h"
24 struct sh_css_isp_bnr_params *to,
25 const struct ia_css_nr_config *from,
29 /* BNR (Bayer Noise Reduction) */
31 uDIGIT_FITTING(from->direction, 16, SH_CSS_BAYER_BITS);
32 to->threshold_width_log2 = uFRACTION_BITS_FITTING(8);
34 1 << to->threshold_width_log2;
36 uDIGIT_FITTING(from->bnr_gain, 16, SH_CSS_BNR_GAIN_SHIFT);
38 uDIGIT_FITTING(from->bnr_gain, 16, SH_CSS_BNR_GAIN_SHIFT);
39 to->clip = uDIGIT_FITTING((unsigned)16384, 16, SH_CSS_BAYER_BITS);
44 const struct sh_css_isp_bnr_params *bnr,
48 ia_css_debug_dtrace(level, "Bayer Noise Reduction:\n");
49 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
50 "bnr_gain_all", bnr->gain_all);
51 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
52 "bnr_gain_dir", bnr->gain_dir);
53 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
56 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
57 "bnr_threshold_width_log2",
58 bnr->threshold_width_log2);
59 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
60 "bnr_threshold_width",
61 bnr->threshold_width);
62 ia_css_debug_dtrace(level, "\t%-32s = %d\n",
63 "bnr_clip", bnr->clip);