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_MACC1_5_TYPES_H
17#define __IA_CSS_MACC1_5_TYPES_H
18
19/* @file
20* CSS-API header file for Multi-Axis Color Conversion algorithm parameters.
21*/
22
23/* Multi-Axis Color Conversion configuration
24 *
25 * ISP2.6.1: MACC1_5 is used.
26 */
27
28/* Number of axes in the MACC table. */
29#define IA_CSS_MACC_NUM_AXES           16
30/* Number of coefficients per MACC axes. */
31#define IA_CSS_MACC_NUM_COEFS          4
32
33/* Multi-Axes Color Correction (MACC) table.
34 *
35 *  ISP block: MACC (MACC by only matrix)
36 *             MACC1_5 (MACC by matrix and exponent(ia_css_macc_config))
37 *  ISP1: MACC is used.
38 *  ISP2: MACC1_5 is used.
39 *
40 *  [MACC]
41 *   OutU = (data00 * InU + data01 * InV) >> 13
42 *   OutV = (data10 * InU + data11 * InV) >> 13
43 *
44 *   default/ineffective:
45 *   OutU = (8192 * InU +    0 * InV) >> 13
46 *   OutV = (   0 * InU + 8192 * InV) >> 13
47 *
48 *  [MACC1_5]
49 *   OutU = (data00 * InU + data01 * InV) >> (13 - exp)
50 *   OutV = (data10 * InU + data11 * InV) >> (13 - exp)
51 *
52 *   default/ineffective: (exp=1)
53 *   OutU = (4096 * InU +    0 * InV) >> (13 - 1)
54 *   OutV = (   0 * InU + 4096 * InV) >> (13 - 1)
55 */
56struct ia_css_macc1_5_table {
57	s16 data[IA_CSS_MACC_NUM_COEFS * IA_CSS_MACC_NUM_AXES];
58	/** 16 of 2x2 matix
59	  MACC1_5: 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/* Multi-Axes Color Correction (MACC) configuration.
65 *
66 *  ISP block: MACC1_5 (MACC by matrix and exponent(ia_css_macc_config))
67 *  ISP2: MACC1_5 is used.
68 */
69struct ia_css_macc1_5_config {
70	u8 exp;	/** Common exponent of ia_css_macc_table.
71				u8.0, [0,13], default 1, ineffective 1 */
72};
73
74#endif /* __IA_CSS_MACC1_5_TYPES_H */
75