xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/include/iq_parser_v2/agamma_uapi_compact.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *  Copyright (c) 2023 Rockchip Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __AGAMMA_UAPI_COMPACT_H__
19 #define __AGAMMA_UAPI_COMPACT_H__
20 
21 #define CALIBDB_AGAMMA_KNOTS_NUM     45
22 #define CALIBDB_AGAMMA_KNOTS_NUM_V30 49
23 
24 typedef enum gamma_op_mode_s {
25     GAMMA_MODE_OFF    = 0,
26     GAMMA_MODE_MANUAL = 1,
27     GAMMA_MODE_FAST   = 2,
28 } gamma_op_mode_t;
29 
30 typedef struct Agamma_api_Fast_s {
31     // M4_BOOL_DESC("en", "1")
32     bool en;
33     // M4_NUMBER_DESC("GammaCoef", "f32", M4_RANGE(0,100), "2.2", M4_DIGIT(2))
34     float GammaCoef;
35     // M4_NUMBER_DESC("SlopeAtZero", "f32", M4_RANGE(-0.05,0.05), "0", M4_DIGIT(2))
36     float SlopeAtZero;
37 } Agamma_api_Fast_t;
38 
39 typedef struct Agamma_api_manualV21_s {
40     // M4_BOOL_DESC("Gamma_en", "1")
41     bool Gamma_en;
42     // M4_ENUM_DESC("Gamma_out_segnum", "GammaType_t", "GAMMATYPE_LOG")
43     GammaType_t Gamma_out_segnum;
44     // M4_NUMBER_DESC("Gamma_out_offset", "u16", M4_RANGE(0,4095), "0", M4_DIGIT(0))
45     uint16_t Gamma_out_offset;
46     // M4_ARRAY_MARK_DESC("Gamma_curve", "u16", M4_SIZE(1,45),  M4_RANGE(0, 4095), "[0, 6, 11, 17, 22, 28, 33, 39, 44, 55, 66, 77, 88, 109, 130, 150, 170, 210, 248, 286, 323, 393, 460, 525, 586, 702, 809, 909, 1002, 1172, 1325, 1462, 1588, 1811, 2004, 2174, 2327, 2590, 2813, 3006, 3177, 3467, 3708, 3915, 4095.0000]", M4_DIGIT(4), M4_DYNAMIC(0), "curve_table")
47     uint16_t Gamma_curve[CALIBDB_AGAMMA_KNOTS_NUM];
48 } Agamma_api_manualV21_t;
49 
50 typedef struct Agamma_api_manualV30_s {
51     // M4_BOOL_DESC("Gamma_en", "1")
52     bool Gamma_en;
53     // M4_NUMBER_DESC("Gamma_out_offset", "u16", M4_RANGE(0,4095), "0", M4_DIGIT(0))
54     uint16_t Gamma_out_offset;
55     // M4_ARRAY_MARK_DESC("Gamma_curve", "u16", M4_SIZE(1,49),  M4_RANGE(0, 4095), "[0, 93, 128, 154, 175, 194, 211, 226, 240, 266, 289, 310, 329, 365, 396, 425, 451, 499, 543, 582, 618, 684, 744, 798, 848, 938, 1019, 1093, 1161, 1285, 1396, 1498, 1592, 1761, 1914, 2052, 2181, 2414, 2622, 2813, 2989, 3153, 3308, 3454, 3593, 3727, 3854, 3977, 4095]", M4_DIGIT(0), M4_DYNAMIC(0), "curve_table")
56     uint16_t Gamma_curve[CALIBDB_AGAMMA_KNOTS_NUM_V30];
57 } Agamma_api_manualV30_t;
58 
59 typedef struct rk_aiq_gamma_attrV21_s {
60     gamma_op_mode_t mode;
61     Agamma_api_manualV21_t stManual;
62     Agamma_api_Fast_t stFast;
63 } rk_aiq_gamma_attrV21_t;
64 
65 typedef struct rk_aiq_gamma_attrV30_s {
66     gamma_op_mode_t mode;
67     Agamma_api_manualV30_t stManual;
68     Agamma_api_Fast_t stFast;
69 } rk_aiq_gamma_attrV30_t;
70 
71 typedef struct rk_aiq_gamma_attr_s {
72     rk_aiq_uapi_sync_t sync;
73 
74     rk_aiq_gamma_attrV21_t atrrV21;
75     rk_aiq_gamma_attrV30_t atrrV30;
76 } rk_aiq_gamma_attr_t;
77 
78 typedef rk_aiq_gamma_attr_t rk_aiq_gamma_attrib_V2_t;
79 
80 #endif /*__AGAMMA_UAPI_COMPACT_H__*/
81