GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / isp / kernels / gc / gc_1.0 / ia_css_gc_types.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __IA_CSS_GC_TYPES_H
16 #define __IA_CSS_GC_TYPES_H
17
18 /** @file
19 * CSS-API header file for Gamma Correction parameters.
20 */
21
22 #include "isp/kernels/ctc/ctc_1.0/ia_css_ctc_types.h"  /* FIXME: Needed for ia_css_vamem_type */
23
24 /** Fractional bits for GAMMA gain */
25 #define IA_CSS_GAMMA_GAIN_K_SHIFT      13
26
27 /** Number of elements in the gamma table. */
28 #define IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE_LOG2    10
29 #define IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE         (1U<<IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE_LOG2)
30
31 /** Number of elements in the gamma table. */
32 #define IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE_LOG2    8
33 #define IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE         ((1U<<IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE_LOG2) + 1)
34
35 /** Gamma table, used for Y(Luma) Gamma Correction.
36  *
37  *  ISP block: GC1 (YUV Gamma Correction)
38  *  ISP1: GC1 is used.
39  * (ISP2: GC2(sRGB Gamma Correction) is used.)
40  */
41 /**< IA_CSS_VAMEM_TYPE_1(ISP2300) or
42      IA_CSS_VAMEM_TYPE_2(ISP2400) */
43 union ia_css_gc_data {
44         uint16_t vamem_1[IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE];
45         /**< Y(Luma) Gamma table on vamem type 1. u0.8, [0,255] */
46         uint16_t vamem_2[IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE];
47         /**< Y(Luma) Gamma table on vamem type 2. u0.8, [0,255] */
48 };
49
50 struct ia_css_gamma_table {
51         enum ia_css_vamem_type vamem_type;
52         union ia_css_gc_data data;
53 };
54
55 /** Gamma Correction configuration (used only for YUV Gamma Correction).
56  *
57  *  ISP block: GC1 (YUV Gamma Correction)
58  *  ISP1: GC1 is used.
59  * (ISP2: GC2 (sRGB Gamma Correction) is used.)
60   */
61 struct ia_css_gc_config {
62         uint16_t gain_k1; /**< Gain to adjust U after YUV Gamma Correction.
63                                 u0.16, [0,65535],
64                                 default/ineffective 19000(0.29) */
65         uint16_t gain_k2; /**< Gain to adjust V after YUV Gamma Correction.
66                                 u0.16, [0,65535],
67                                 default/ineffective 19000(0.29) */
68 };
69
70 /** Chroma Enhancement configuration.
71  *
72  *  This parameter specifies range of chroma output level.
73  *  The standard range is [0,255] or [16,240].
74  *
75  *  ISP block: CE1
76  *  ISP1: CE1 is used.
77  * (ISP2: CE1 is not used.)
78  */
79 struct ia_css_ce_config {
80         uint8_t uv_level_min; /**< Minimum of chroma output level.
81                                 u0.8, [0,255], default/ineffective 0 */
82         uint8_t uv_level_max; /**< Maximum of chroma output level.
83                                 u0.8, [0,255], default/ineffective 255 */
84 };
85
86 /** Multi-Axes Color Correction (MACC) configuration.
87  *
88  *  ISP block: MACC2 (MACC by matrix and exponent(ia_css_macc_config))
89  * (ISP1: MACC1 (MACC by only matrix) is used.)
90  *  ISP2: MACC2 is used.
91  */
92 struct ia_css_macc_config {
93         uint8_t exp;    /**< Common exponent of ia_css_macc_table.
94                                 u8.0, [0,13], default 1, ineffective 1 */
95 };
96
97 #endif /* __IA_CSS_GC_TYPES_H */