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_PARAM_H
17 #define __IA_CSS_XNR3_PARAM_H
18 
19 #include "type_support.h"
20 #include "vmem.h" /* ISP2401: needed for VMEM_ARRAY */
21 
22 /* Scaling factor of the alpha values: which fixed-point value represents 1.0?
23  * It must be chosen such that 1/min_sigma still fits in an ISP vector
24  * element. */
25 #define XNR_ALPHA_SCALE_LOG2        5
26 #define XNR_ALPHA_SCALE_FACTOR      BIT(XNR_ALPHA_SCALE_LOG2)
27 
28 /* Scaling factor of the coring values on the ISP. */
29 #define XNR_CORING_SCALE_LOG2       (ISP_VEC_ELEMBITS - 1)
30 #define XNR_CORING_SCALE_FACTOR     BIT(XNR_CORING_SCALE_LOG2)
31 
32 /* Scaling factor of the blending strength on the ISP. */
33 #define XNR_BLENDING_SCALE_LOG2     (ISP_VEC_ELEMBITS - 1)
34 #define XNR_BLENDING_SCALE_FACTOR   BIT(XNR_BLENDING_SCALE_LOG2)
35 
36 /* XNR3 filter size. Must be 11x11, 9x9 or 5x5. */
37 #define XNR_FILTER_SIZE             5
38 
39 /* XNR3 alpha (1/sigma) parameters on the ISP, expressed as a base (0) value
40  * for dark areas, and a scaled diff towards the value for bright areas. */
41 struct sh_css_xnr3_alpha_params {
42 	s32 y0;
43 	s32 u0;
44 	s32 v0;
45 	s32 ydiff;
46 	s32 udiff;
47 	s32 vdiff;
48 };
49 
50 /* XNR3 coring parameters on the ISP, expressed as a base (0) value
51  * for dark areas, and a scaled diff towards the value for bright areas. */
52 struct sh_css_xnr3_coring_params {
53 	s32 u0;
54 	s32 v0;
55 	s32 udiff;
56 	s32 vdiff;
57 };
58 
59 /* XNR3 blending strength on the ISP. */
60 struct sh_css_xnr3_blending_params {
61 	s32 strength;
62 };
63 
64 /* XNR3 ISP parameters */
65 struct sh_css_isp_xnr3_params {
66 	struct sh_css_xnr3_alpha_params    alpha;
67 	struct sh_css_xnr3_coring_params   coring;
68 	struct sh_css_xnr3_blending_params blending;
69 };
70 
71 /* ISP2401 */
72 /*
73  * STRUCT sh_css_isp_xnr3_vmem_params
74  * -----------------------------------------------
75  * ISP VMEM parameters
76  */
77 struct sh_css_isp_xnr3_vmem_params {
78 	VMEM_ARRAY(x, ISP_VEC_NELEMS);
79 	VMEM_ARRAY(a, ISP_VEC_NELEMS);
80 	VMEM_ARRAY(b, ISP_VEC_NELEMS);
81 	VMEM_ARRAY(c, ISP_VEC_NELEMS);
82 };
83 
84 #endif  /*__IA_CSS_XNR3_PARAM_H */
85