1 /*
2  *rk_aiq_types_adehaze_algo_prvt.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_TYPES_ADEHAZE_ALGO_PRVT_H_
21 #define _RK_AIQ_TYPES_ADEHAZE_ALGO_PRVT_H_
22 
23 #include "RkAiqCalibDbTypes.h"
24 #include "RkAiqCalibDbTypesV2.h"
25 #include "adehaze/rk_aiq_types_adehaze_algo_int.h"
26 #include "amerge/rk_aiq_types_amerge_algo_prvt.h"
27 #include "rk_aiq_algo_types.h"
28 #include "rk_aiq_types_adehaze_hw.h"
29 #include "rk_aiq_types_adehaze_stat.h"
30 #include "xcam_log.h"
31 
32 #define DEHAZE_GAUS_H0                              (2)
33 #define DEHAZE_GAUS_H1                              (4)
34 #define DEHAZE_GAUS_H2                              (2)
35 #define DEHAZE_GAUS_H3                              (4)
36 #define DEHAZE_GAUS_H4                              (8)
37 #define DEHAZE_GAUS_H5                              (4)
38 #define DEHAZE_GAUS_H6                              (2)
39 #define DEHAZE_GAUS_H7                              (4)
40 #define DEHAZE_GAUS_H8                              (2)
41 #define CFG_ALPHA_MAX                               (255)
42 #define CFG_ALPHA_MIN                               (NORMALIZE_MIN)
43 #define CFG_AIR_MAX                                 (255)
44 #define CFG_AIR_MIN                                 (NORMALIZE_MIN)
45 #define ENHANCE_VALUE_MAX                           (16.0)
46 #define ENHANCE_VALUE_MIN                           (1.0)
47 #define ENHANCE_CHROME_MAX                          (16.0)
48 #define ENHANCE_CHROME_MIN                          (1.0)
49 #define HSIT_WR_MIN_STEP                            (16)
50 #define HSIT_WR_X_MAX                               (1023)
51 
52 //define for dehaze local gain
53 #define YNR_BIT_CALIB (12)
54 #define YNR_ISO_CURVE_POINT_BIT             (4)
55 #define YNR_ISO_CURVE_SECT_VALUE   (1 << (YNR_BIT_CALIB - YNR_ISO_CURVE_POINT_BIT))
56 #define YNR_ISO_CURVE_SECT_VALUE1   (1 << YNR_BIT_CALIB)
57 #define YNR_CURVE_STEP             (16)
58 
59 typedef struct AdehazeExpInfo_s {
60     int hdr_mode;
61     float arTime[3];
62     float arAGain[3];
63     float arDGain[3];
64     int arIso[3];
65 } AdehazeExpInfo_t;
66 
67 typedef struct AdehazeAePreResV10_s {
68     float ISO;
69     CtrlDataType_t CtrlDataType;
70     dehaze_api_mode_t ApiMode;
71 } AdehazeAePreResV10_t;
72 
73 typedef struct AdehazeAePreResV11_s {
74     float EnvLv;
75     float ISO;
76     CtrlDataType_t CtrlDataType;
77     dehaze_api_mode_t ApiMode;
78 } AdehazeAePreResV11_t;
79 
80 typedef struct AdehazeHandle_s {
81     bool isCapture;
82     bool ifReCalcStAuto;
83     bool ifReCalcStManual;
84     bool is_multi_isp_mode;
85 #if RKAIQ_HAVE_DEHAZE_V10
86     adehaze_sw_v10_t AdehazeAtrrV10;
87     AdehazeAePreResV10_t CurrDataV10;
88     AdehazeAePreResV10_t PreDataV10;
89 #endif
90 #if RKAIQ_HAVE_DEHAZE_V11
91     adehaze_sw_v11_t AdehazeAtrrV11;
92     AdehazeAePreResV11_t CurrDataV11;
93     AdehazeAePreResV11_t PreDataV11;
94 #endif
95 #if RKAIQ_HAVE_DEHAZE_V11_DUO
96     adehaze_sw_v11_t AdehazeAtrrV11duo;
97     float YnrProcResV3_sigma[YNR_V3_ISO_CURVE_POINT_NUM];
98     AdehazeAePreResV11_t CurrDataV11duo;
99     AdehazeAePreResV11_t PreDataV11duo;
100 #endif
101 #if RKAIQ_HAVE_DEHAZE_V12
102     adehaze_sw_v12_t AdehazeAtrrV12;
103     float YnrProcResV22_sigma[YNR_V22_ISO_CURVE_POINT_NUM];
104     AdehazeAePreResV11_t CurrDataV12;
105     AdehazeAePreResV11_t PreDataV12;
106 #endif
107     int width;
108     int height;
109     int strength;
110     int working_mode;
111     FrameNumber_t FrameNumber;
112     uint32_t FrameID;
113 } AdehazeHandle_t;
114 
115 #endif
116