xref: /linux/drivers/staging/media/atomisp/pci/isp/kernels/macc/macc_1.0/ia_css_macc_types.h (revision b83deaa741558babf4b8d51d34f6637ccfff1b26)
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_MACC_TYPES_H
17 #define __IA_CSS_MACC_TYPES_H
18 
19 /* @file
20 * CSS-API header file for Multi-Axis Color Correction (MACC) parameters.
21 */
22 
23 /* Number of axes in the MACC table. */
24 #define IA_CSS_MACC_NUM_AXES           16
25 /* Number of coefficients per MACC axes. */
26 #define IA_CSS_MACC_NUM_COEFS          4
27 /* The number of planes in the morphing table. */
28 
29 /* Multi-Axis Color Correction (MACC) table.
30  *
31  *  ISP block: MACC1 (MACC by only matrix)
32  *             MACC2 (MACC by matrix and exponent(ia_css_macc_config))
33  *  ISP1: MACC1 is used.
34  *  ISP2: MACC2 is used.
35  *
36  *  [MACC1]
37  *   OutU = (data00 * InU + data01 * InV) >> 13
38  *   OutV = (data10 * InU + data11 * InV) >> 13
39  *
40  *   default/ineffective:
41  *   OutU = (8192 * InU +    0 * InV) >> 13
42  *   OutV = (   0 * InU + 8192 * InV) >> 13
43  *
44  *  [MACC2]
45  *   OutU = (data00 * InU + data01 * InV) >> (13 - exp)
46  *   OutV = (data10 * InU + data11 * InV) >> (13 - exp)
47  *
48  *   default/ineffective: (exp=1)
49  *   OutU = (4096 * InU +    0 * InV) >> (13 - 1)
50  *   OutV = (   0 * InU + 4096 * InV) >> (13 - 1)
51  */
52 
53 struct ia_css_macc_table {
54 	s16 data[IA_CSS_MACC_NUM_COEFS * IA_CSS_MACC_NUM_AXES];
55 	/** 16 of 2x2 matix
56 	  MACC1: s2.13, [-65536,65535]
57 	    default/ineffective:
58 		16 of "identity 2x2 matix" {8192,0,0,8192}
59 	  MACC2: s[macc_config.exp].[13-macc_config.exp], [-8192,8191]
60 	    default/ineffective: (s1.12)
61 		16 of "identity 2x2 matix" {4096,0,0,4096} */
62 };
63 
64 #endif /* __IA_CSS_MACC_TYPES_H */
65