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