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