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