2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
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.
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
15 #ifndef __IA_CSS_CTC_TYPES_H
16 #define __IA_CSS_CTC_TYPES_H
19 * CSS-API header file for Chroma Tone Control parameters.
22 /** Fractional bits for CTC gain (used only for ISP1).
24 * IA_CSS_CTC_COEF_SHIFT(=13) includes not only the fractional bits
25 * of gain(=8), but also the bits(=5) to convert chroma
26 * from 13bit precision to 8bit precision.
28 * Gain (struct ia_css_ctc_table) : u5.8
29 * Input(Chorma) : s0.12 (13bit precision)
30 * Output(Chorma): s0.7 (8bit precision)
31 * Output = (Input * Gain) >> IA_CSS_CTC_COEF_SHIFT
33 #define IA_CSS_CTC_COEF_SHIFT 13
35 /** Number of elements in the CTC table. */
36 #define IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2 10
37 /** Number of elements in the CTC table. */
38 #define IA_CSS_VAMEM_1_CTC_TABLE_SIZE (1U<<IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2)
40 /** Number of elements in the CTC table. */
41 #define IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2 8
42 /** Number of elements in the CTC table. */
43 #define IA_CSS_VAMEM_2_CTC_TABLE_SIZE ((1U<<IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2) + 1)
45 enum ia_css_vamem_type {
50 /** Chroma Tone Control configuration.
52 * ISP block: CTC2 (CTC by polygonal line approximation)
53 * (ISP1: CTC1 (CTC by look-up table) is used.)
56 struct ia_css_ctc_config {
57 uint16_t y0; /**< 1st kneepoint gain.
58 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
59 default/ineffective 4096(0.5) */
60 uint16_t y1; /**< 2nd kneepoint gain.
61 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
62 default/ineffective 4096(0.5) */
63 uint16_t y2; /**< 3rd kneepoint gain.
64 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
65 default/ineffective 4096(0.5) */
66 uint16_t y3; /**< 4th kneepoint gain.
67 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
68 default/ineffective 4096(0.5) */
69 uint16_t y4; /**< 5th kneepoint gain.
70 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
71 default/ineffective 4096(0.5) */
72 uint16_t y5; /**< 6th kneepoint gain.
73 u[ce_gain_exp].[13-ce_gain_exp], [0,8191],
74 default/ineffective 4096(0.5) */
75 uint16_t ce_gain_exp; /**< Common exponent of y-axis gain.
77 default/ineffective 1 */
78 uint16_t x1; /**< 2nd kneepoint luma.
79 u0.13, [0,8191], constraints: 0<x1<x2,
80 default/ineffective 1024 */
81 uint16_t x2; /**< 3rd kneepoint luma.
82 u0.13, [0,8191], constraints: x1<x2<x3,
83 default/ineffective 2048 */
84 uint16_t x3; /**< 4th kneepoint luma.
85 u0.13, [0,8191], constraints: x2<x3<x4,
86 default/ineffective 6144 */
87 uint16_t x4; /**< 5tn kneepoint luma.
88 u0.13, [0,8191], constraints: x3<x4<8191,
89 default/ineffective 7168 */
92 union ia_css_ctc_data {
93 uint16_t vamem_1[IA_CSS_VAMEM_1_CTC_TABLE_SIZE];
94 uint16_t vamem_2[IA_CSS_VAMEM_2_CTC_TABLE_SIZE];
97 /** CTC table, used for Chroma Tone Control.
99 * ISP block: CTC1 (CTC by look-up table)
100 * ISP1: CTC1 is used.
101 * (ISP2: CTC2 (CTC by polygonal line approximation) is used.)
103 struct ia_css_ctc_table {
104 enum ia_css_vamem_type vamem_type;
105 union ia_css_ctc_data data;
108 #endif /* __IA_CSS_CTC_TYPES_H */