]>
Commit | Line | Data |
---|---|---|
a49d2536 AC |
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_CTC_TYPES_H | |
16 | #define __IA_CSS_CTC_TYPES_H | |
17 | ||
d929fb4e | 18 | /* @file |
a49d2536 AC |
19 | * CSS-API header file for Chroma Tone Control parameters. |
20 | */ | |
21 | ||
d929fb4e | 22 | /* Fractional bits for CTC gain (used only for ISP1). |
a49d2536 AC |
23 | * |
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. | |
27 | * | |
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 | |
32 | */ | |
33 | #define IA_CSS_CTC_COEF_SHIFT 13 | |
34 | ||
d929fb4e | 35 | /* Number of elements in the CTC table. */ |
a49d2536 | 36 | #define IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2 10 |
d929fb4e | 37 | /* Number of elements in the CTC table. */ |
a49d2536 AC |
38 | #define IA_CSS_VAMEM_1_CTC_TABLE_SIZE (1U<<IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2) |
39 | ||
d929fb4e | 40 | /* Number of elements in the CTC table. */ |
a49d2536 | 41 | #define IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2 8 |
d929fb4e | 42 | /* Number of elements in the CTC table. */ |
a49d2536 AC |
43 | #define IA_CSS_VAMEM_2_CTC_TABLE_SIZE ((1U<<IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2) + 1) |
44 | ||
45 | enum ia_css_vamem_type { | |
46 | IA_CSS_VAMEM_TYPE_1, | |
47 | IA_CSS_VAMEM_TYPE_2 | |
48 | }; | |
49 | ||
d929fb4e | 50 | /* Chroma Tone Control configuration. |
a49d2536 AC |
51 | * |
52 | * ISP block: CTC2 (CTC by polygonal line approximation) | |
53 | * (ISP1: CTC1 (CTC by look-up table) is used.) | |
54 | * ISP2: CTC2 is used. | |
55 | */ | |
56 | struct ia_css_ctc_config { | |
d929fb4e | 57 | uint16_t y0; /** 1st kneepoint gain. |
a49d2536 AC |
58 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
59 | default/ineffective 4096(0.5) */ | |
d929fb4e | 60 | uint16_t y1; /** 2nd kneepoint gain. |
a49d2536 AC |
61 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
62 | default/ineffective 4096(0.5) */ | |
d929fb4e | 63 | uint16_t y2; /** 3rd kneepoint gain. |
a49d2536 AC |
64 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
65 | default/ineffective 4096(0.5) */ | |
d929fb4e | 66 | uint16_t y3; /** 4th kneepoint gain. |
a49d2536 AC |
67 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
68 | default/ineffective 4096(0.5) */ | |
d929fb4e | 69 | uint16_t y4; /** 5th kneepoint gain. |
a49d2536 AC |
70 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
71 | default/ineffective 4096(0.5) */ | |
d929fb4e | 72 | uint16_t y5; /** 6th kneepoint gain. |
a49d2536 AC |
73 | u[ce_gain_exp].[13-ce_gain_exp], [0,8191], |
74 | default/ineffective 4096(0.5) */ | |
d929fb4e | 75 | uint16_t ce_gain_exp; /** Common exponent of y-axis gain. |
a49d2536 AC |
76 | u8.0, [0,13], |
77 | default/ineffective 1 */ | |
d929fb4e | 78 | uint16_t x1; /** 2nd kneepoint luma. |
a49d2536 AC |
79 | u0.13, [0,8191], constraints: 0<x1<x2, |
80 | default/ineffective 1024 */ | |
d929fb4e | 81 | uint16_t x2; /** 3rd kneepoint luma. |
a49d2536 AC |
82 | u0.13, [0,8191], constraints: x1<x2<x3, |
83 | default/ineffective 2048 */ | |
d929fb4e | 84 | uint16_t x3; /** 4th kneepoint luma. |
a49d2536 AC |
85 | u0.13, [0,8191], constraints: x2<x3<x4, |
86 | default/ineffective 6144 */ | |
d929fb4e | 87 | uint16_t x4; /** 5tn kneepoint luma. |
a49d2536 AC |
88 | u0.13, [0,8191], constraints: x3<x4<8191, |
89 | default/ineffective 7168 */ | |
90 | }; | |
91 | ||
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]; | |
95 | }; | |
96 | ||
d929fb4e | 97 | /* CTC table, used for Chroma Tone Control. |
a49d2536 AC |
98 | * |
99 | * ISP block: CTC1 (CTC by look-up table) | |
100 | * ISP1: CTC1 is used. | |
101 | * (ISP2: CTC2 (CTC by polygonal line approximation) is used.) | |
102 | */ | |
103 | struct ia_css_ctc_table { | |
104 | enum ia_css_vamem_type vamem_type; | |
105 | union ia_css_ctc_data data; | |
106 | }; | |
107 | ||
108 | #endif /* __IA_CSS_CTC_TYPES_H */ | |
109 | ||
110 |