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_XNR3_TYPES_H
8 #define __IA_CSS_XNR3_TYPES_H
9 
10 /* @file
11 * CSS-API header file for Extra Noise Reduction (XNR) parameters.
12 */
13 
14 /**
15  * \brief Scale of the XNR sigma parameters.
16  * \details The define specifies which fixed-point value represents 1.0.
17  */
18 #define IA_CSS_XNR3_SIGMA_SCALE  BIT(10)
19 
20 /**
21  * \brief Scale of the XNR coring parameters.
22  * \details The define specifies which fixed-point value represents 1.0.
23  */
24 #define IA_CSS_XNR3_CORING_SCALE BIT(15)
25 
26 /**
27  * \brief Scale of the XNR blending parameter.
28  * \details The define specifies which fixed-point value represents 1.0.
29  */
30 #define IA_CSS_XNR3_BLENDING_SCALE BIT(11)
31 
32 /**
33  * \brief XNR3 Sigma Parameters.
34  * \details Sigma parameters define the strength of the XNR filter.
35  * A higher number means stronger filtering. There are two values for each of
36  * the three YUV planes: one for dark areas and one for bright areas. All
37  * sigma parameters are fixed-point values between 0.0 and 1.0, scaled with
38  * IA_CSS_XNR3_SIGMA_SCALE.
39  */
40 struct ia_css_xnr3_sigma_params {
41 	int y0;     /** Sigma for Y range similarity in dark area */
42 	int y1;     /** Sigma for Y range similarity in bright area */
43 	int u0;     /** Sigma for U range similarity in dark area */
44 	int u1;     /** Sigma for U range similarity in bright area */
45 	int v0;     /** Sigma for V range similarity in dark area */
46 	int v1;     /** Sigma for V range similarity in bright area */
47 };
48 
49 /**
50  * \brief XNR3 Coring Parameters
51  * \details Coring parameters define the "coring" strength, which is a soft
52  * thresholding technique to avoid false coloring. There are two values for
53  * each of the two chroma planes: one for dark areas and one for bright areas.
54  * All coring parameters are fixed-point values between 0.0 and 1.0, scaled
55  * with IA_CSS_XNR3_CORING_SCALE. The ineffective value is 0.
56  */
57 struct ia_css_xnr3_coring_params {
58 	int u0;     /** Coring threshold of U channel in dark area */
59 	int u1;     /** Coring threshold of U channel in bright area */
60 	int v0;     /** Coring threshold of V channel in dark area */
61 	int v1;     /** Coring threshold of V channel in bright area */
62 };
63 
64 /**
65  * \brief XNR3 Blending Parameters
66  * \details Blending parameters define the blending strength of filtered
67  * output pixels with the original chroma pixels from before xnr3. The
68  * blending strength is a fixed-point value between 0.0 and 1.0 (inclusive),
69  * scaled with IA_CSS_XNR3_BLENDING_SCALE.
70  * A higher number applies xnr filtering more strongly. A value of 1.0
71  * disables the blending and returns the xnr3 filtered output, while a
72  * value of 0.0 bypasses the entire xnr3 filter.
73  */
74 struct ia_css_xnr3_blending_params {
75 	int strength;   /** Blending strength */
76 };
77 
78 /**
79  * \brief XNR3 public parameters.
80  * \details Struct with all parameters for the XNR3 kernel that can be set
81  * from the CSS API.
82  */
83 struct ia_css_xnr3_config {
84 	struct ia_css_xnr3_sigma_params    sigma;    /** XNR3 sigma parameters */
85 	struct ia_css_xnr3_coring_params   coring;   /** XNR3 coring parameters */
86 	struct ia_css_xnr3_blending_params blending; /** XNR3 blending parameters */
87 };
88 
89 #endif /* __IA_CSS_XNR3_TYPES_H */
90