xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/include/algos/alsc/rk_aiq_types_alsc_algo_int.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  *rk_aiq_types_alsc_algo_int.h
3  *
4  *  Copyright (c) 2019 Rockchip Corporation
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 
20 #ifndef _RK_AIQ_TYPE_ALSC_ALGO_INT_H_
21 #define _RK_AIQ_TYPE_ALSC_ALGO_INT_H_
22 #include "alsc/rk_aiq_types_alsc_algo.h"
23 #include "alsc_uapi_head.h"
24 #include "rk_aiq_types_alsc_common.h"
25 
26 
27 RKAIQ_BEGIN_DECLARE
28 
29 /** @brief LSC will use these data from other module*/
30 typedef struct {
31     uint32_t flag;
32 
33     uint16_t width;
34     uint16_t height;
35     uint16_t table_size;
36 
37     uint16_t *lsc_r;
38     uint16_t *lsc_b;
39     uint16_t *lsc_gr;
40     uint16_t *lsc_gb;
41 } AlscOtpInfo_t;
42 
43 typedef struct alsc_sw_info_s {
44     float sensorGain;
45     float awbGain[2];
46     float awbIIRDampCoef;
47     float varianceLuma;
48     bool grayMode;
49     bool awbConverged;
50     int prepare_type;
51     RkAiqBayerPattern_t bayerPattern;
52     AlscOtpInfo_t otpInfo;
53 } alsc_sw_info_t;
54 
55 /**
56  * @brief Remember, 4 channel data array must be in the head of struct,
57  * and with the order of (r, gr, gb, b)!
58 */
59 typedef struct rk_aiq_lsc_table_s rk_aiq_lsc_mlsc_attrib_t;
60 
61 typedef enum rk_aiq_lsc_op_mode_s {
62     RK_AIQ_LSC_MODE_INVALID                     = 0,        /**< initialization value */
63     RK_AIQ_LSC_MODE_MANUAL                      = 1,        /**< run manual lens shading correction */
64     RK_AIQ_LSC_MODE_AUTO                        = 2,        /**< run auto lens shading correction */
65     RK_AIQ_LSC_MODE_MAX
66 } rk_aiq_lsc_op_mode_t;
67 
68 typedef struct Lsc_v2_Resolution_s {
69     char        name[LSC_NAME];
70     uint16_t    lsc_sect_size_x[16];
71     uint16_t    lsc_sect_size_y[16];
72 } Lsc_v2_Resolution_t;
73 
74 typedef struct CalibDbV2_Lsc_Common_fixed_s {
75     bool enable;
76     Lsc_v2_Resolution_t resolutionAll[LSC_MAX_RESOLUTION];
77     int resolutionAll_len;
78 } CalibDbV2_Lsc_Common_fixed_t;
79 
80 typedef struct CalibDbV2_AlscCof_ill_fixed_s {
81     uint32_t    usedForCase;
82     char        name[LSC_NAME];
83     float       wbGain[2];
84     lsc_name_t tableUsed[LSC_MAX_ILLUMINANT*LSC_MAX_RESOLUTION];
85     int         tableUsed_len;
86     float      gains[100];
87     int         gains_len;
88     float      vig[100];
89     int         vig_len;
90 } CalibDbV2_AlscCof_ill_fixed_t;
91 
92 typedef struct CalibDbV2_AlscCof_fixed_s {
93     bool damp_enable;
94     CalibDbV2_AlscCof_ill_fixed_t illAll[LSC_MAX_ILLUMINANT];
95     int illAll_len;
96 } CalibDbV2_AlscCof_fixed_t;
97 
98 typedef struct CalibDbV2_LscTable_fixed_s {
99     CalibDbV2_LscTableProfile_t tableAll[LSC_MAX_ILLUMINANT*LSC_MAX_RESOLUTION];
100     int tableAll_len;
101 } CalibDbV2_LscTable_fixed_t;
102 
103 typedef struct rk_aiq_lsc_alsc_attrib_s {
104    CalibDbV2_Lsc_Common_fixed_t common;
105    CalibDbV2_AlscCof_fixed_t alscCoef;
106    CalibDbV2_LscTable_fixed_t tbl;
107 } rk_aiq_lsc_alsc_attrib_t;
108 
109 /** @brief struct for setting-api, should careful consider when want to modify it*/
110 typedef struct rk_aiq_lsc_attrib_s {
111     bool byPass;
112     rk_aiq_lsc_op_mode_t mode;
113     rk_aiq_lsc_mlsc_attrib_t stManual;
114     rk_aiq_lsc_alsc_attrib_t stAuto;
115     rk_aiq_uapi_sync_t sync;
116 } rk_aiq_lsc_attrib_t;
117 
118 /** @brief struct for setting-api, should careful consider when want to modify it*/
119 typedef struct rk_aiq_lsc_querry_info_s {
120     bool lsc_en;
121     unsigned short r_data_tbl[LSC_DATA_TBL_SIZE];
122     unsigned short gr_data_tbl[LSC_DATA_TBL_SIZE];
123     unsigned short gb_data_tbl[LSC_DATA_TBL_SIZE];
124     unsigned short b_data_tbl[LSC_DATA_TBL_SIZE];
125 } rk_aiq_lsc_querry_info_t;
126 
127 RKAIQ_END_DECLARE
128 
129 #endif
130 
131