1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __IA_CSS_BNLM_TYPES_H
8 #define __IA_CSS_BNLM_TYPES_H
9 
10 /* @file
11 * CSS-API header file for Bayer Non-Linear Mean parameters.
12 */
13 
14 #include "type_support.h" /* int32_t */
15 
16 /* Bayer Non-Linear Mean configuration
17  *
18  * \brief BNLM public parameters.
19  * \details Struct with all parameters for the BNLM kernel that can be set
20  * from the CSS API.
21  *
22  * ISP2.6.1: BNLM is used.
23  */
24 struct ia_css_bnlm_config {
25 	bool		rad_enable;	/** Enable a radial dependency in a weight calculation */
26 	s32		rad_x_origin;	/** Initial x coordinate for a radius calculation */
27 	s32		rad_y_origin;	/** Initial x coordinate for a radius calculation */
28 	/* a threshold for average of weights if this < Th, do not denoise pixel */
29 	s32		avg_min_th;
30 	/* minimum weight for denoising if max < th, do not denoise pixel */
31 	s32		max_min_th;
32 
33 	/**@{*/
34 	/* Coefficient for approximation, in the form of (1 + x / N)^N,
35 	 * that fits the first-order exp() to default exp_lut in BNLM sheet
36 	 * */
37 	s32		exp_coeff_a;
38 	u32	exp_coeff_b;
39 	s32		exp_coeff_c;
40 	u32	exp_exponent;
41 	/**@}*/
42 
43 	s32 nl_th[3];	/** Detail thresholds */
44 
45 	/* Index for n-th maximum candidate weight for each detail group */
46 	s32 match_quality_max_idx[4];
47 
48 	/**@{*/
49 	/* A lookup table for 1/sqrt(1+mu) approximation */
50 	s32 mu_root_lut_thr[15];
51 	s32 mu_root_lut_val[16];
52 	/**@}*/
53 	/**@{*/
54 	/* A lookup table for SAD normalization */
55 	s32 sad_norm_lut_thr[15];
56 	s32 sad_norm_lut_val[16];
57 	/**@}*/
58 	/**@{*/
59 	/* A lookup table that models a weight's dependency on textures */
60 	s32 sig_detail_lut_thr[15];
61 	s32 sig_detail_lut_val[16];
62 	/**@}*/
63 	/**@{*/
64 	/* A lookup table that models a weight's dependency on a pixel's radial distance */
65 	s32 sig_rad_lut_thr[15];
66 	s32 sig_rad_lut_val[16];
67 	/**@}*/
68 	/**@{*/
69 	/* A lookup table to control denoise power depending on a pixel's radial distance */
70 	s32 rad_pow_lut_thr[15];
71 	s32 rad_pow_lut_val[16];
72 	/**@}*/
73 	/**@{*/
74 	/* Non linear transfer functions to calculate the blending coefficient depending on detail group */
75 	/* detail group 0 */
76 	/**@{*/
77 	s32 nl_0_lut_thr[15];
78 	s32 nl_0_lut_val[16];
79 	/**@}*/
80 	/**@{*/
81 	/* detail group 1 */
82 	s32 nl_1_lut_thr[15];
83 	s32 nl_1_lut_val[16];
84 	/**@}*/
85 	/**@{*/
86 	/* detail group 2 */
87 	s32 nl_2_lut_thr[15];
88 	s32 nl_2_lut_val[16];
89 	/**@}*/
90 	/**@{*/
91 	/* detail group 3 */
92 	s32 nl_3_lut_thr[15];
93 	s32 nl_3_lut_val[16];
94 	/**@}*/
95 	/**@}*/
96 };
97 
98 #endif /* __IA_CSS_BNLM_TYPES_H */
99