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_ABAYER2DNR_ALGO_INT_V23_H_
21 #define _RK_AIQ_TYPE_ABAYER2DNR_ALGO_INT_V23_H_
22 
23 #include <math.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #include "rk_aiq_comm.h"
27 #include "RkAiqCalibDbTypes.h"
28 #include "abayer2dnrV23/rk_aiq_types_abayer2dnr_algo_v23.h"
29 #include "bayer2dnr_head_v23.h"
30 #include "bayer2dnr_uapi_head_v23.h"
31 
32 //RKAIQ_BEGIN_DECLARE
33 
34 #define RK_BAYER2DNR_V23_MAX_ISO_NUM  CALIBDB_MAX_ISO_LEVEL
35 #define ABAYER2DNRV23_RECALCULATE_DELTA_ISO (10)
36 
37 typedef enum Abayer2dnr_result_V23_e {
38     ABAYER2DNR_V23_RET_SUCCESS             = 0,   // this has to be 0, if clauses rely on it
39     ABAYER2DNR_V23_RET_FAILURE             = 1,   // process failure
40     ABAYER2DNR_V23_RET_INVALID_PARM        = 2,   // invalid parameter
41     ABAYER2DNR_V23_RET_WRONG_CONFIG        = 3,   // feature not supported
42     ABAYER2DNR_V23_RET_BUSY                = 4,   // there's already something going on...
43     ABAYER2DNR_V23_RET_CANCELED            = 5,   // operation canceled
44     ABAYER2DNR_V23_RET_OUTOFMEM            = 6,   // out of memory
45     ABAYER2DNR_V23_RET_OUTOFRANGE          = 7,   // parameter/value out of range
46     ABAYER2DNR_V23_RET_NULL_POINTER        = 8,   // the/one/all parameter(s) is a(are) NULL pointer(s)
47     ABAYER2DNR_V23_RET_DIVISION_BY_ZERO    = 9,   // a divisor equals ZERO
48     ABAYER2DNR_V23_RET_NO_INPUTIMAGE       = 10   // no input image
49 } Abayer2dnr_result_V23_t;
50 
51 typedef enum Abayer2dnr_State_V23_e {
52     ABAYER2DNR_V23_STATE_INVALID           = 0,                   /**< initialization value */
53     ABAYER2DNR_V23_STATE_INITIALIZED       = 1,                   /**< instance is created, but not initialized */
54     ABAYER2DNR_V23_STATE_STOPPED           = 2,                   /**< instance is confiured (ready to start) or stopped */
55     ABAYER2DNR_V23_STATE_RUNNING           = 3,                   /**< instance is running (processes frames) */
56     ABAYER2DNR_V23_STATE_LOCKED            = 4,                   /**< instance is locked (for taking snapshots) */
57     ABAYER2DNR_V23_STATE_MAX                                      /**< max */
58 } Abayer2dnr_State_V23_t;
59 
60 typedef enum Abayer2dnr_OPMode_V23_e {
61     ABAYER2DNR_V23_OP_MODE_INVALID           = 0,                   /**< initialization value */
62     ABAYER2DNR_V23_OP_MODE_AUTO              = 1,                   /**< instance is created, but not initialized */
63     ABAYER2DNR_V23_OP_MODE_MANUAL            = 2,                   /**< instance is confiured (ready to start) or stopped */
64     ABAYER2DNR_V23_OP_MODE_REG_MANUAL        = 3,                   /**< instance is confiured (ready to start) or stopped */
65     ABAYER2DNR_V23_OP_MODE_MAX                                      /**< max */
66 } Abayer2dnr_OPMode_V23_t;
67 
68 typedef enum Abayer2dnr_ParamMode_V23_e {
69     ABAYER2DNR_V23_PARAM_MODE_INVALID           = 0,
70     ABAYER2DNR_V23_PARAM_MODE_NORMAL          = 1,                   /**< initialization value */
71     ABAYER2DNR_V23_PARAM_MODE_HDR              = 2,                   /**< instance is created, but not initialized */
72     ABAYER2DNR_V23_PARAM_MODE_GRAY            = 3,                   /**< instance is confiured (ready to start) or stopped */
73     ABAYER2DNR_V23_PARAM_MODE_MAX                                      /**< max */
74 } Abayer2dnr_ParamMode_V23_t;
75 
76 
77 
78 #if 0
79 typedef struct RK_Bayer2dnr_Params_V23_Select_s {
80     // v23 version register // edge filter params
81     int enable;
82     bool hdrdgain_ctrl_en;
83 
84     float filter_strength;
85     int   lumapoint[16];
86     int   sigma[16];
87     int   gain_bypass;
88     float gain_scale;
89     int   gain_lumapoint[16];
90     int   gain_adj[16];
91     float edgesofts;
92     float ratio;
93     float weight;
94     int   gauss_guide;
95     int   pix_diff;
96     int   diff_thld;
97 
98     //int   trans_en;
99     int   trans_mode;
100     int   trans_offset;
101     int   itrans_offset;
102     int   trans_datmax;
103 
104     float hdr_dgain_scale_s;
105     float hdr_dgain_scale_m;
106 } RK_Bayer2dnrV23_Params_Select_t;
107 #endif
108 
109 typedef struct RK_Bayer2dnr_Params_V23_s
110 {
111     // bayernr version
112     int enable;
113     bool hdrdgain_ctrl_en;
114     // v23 parse
115     float iso[RK_BAYER2DNR_V23_MAX_ISO_NUM];
116 
117     RK_Bayer2dnrV23_Params_Select_t Bayer2dnrParamsISO[RK_BAYER2DNR_V23_MAX_ISO_NUM];
118 
119 } RK_Bayer2dnr_Params_V23_t;
120 
121 
122 typedef struct Abayer2dnr_Manual_Attr_V23_s
123 {
124     RK_Bayer2dnrV23_Params_Select_t st2DSelect;
125     RK_Bayer2dnr_Fix_V23_t st2Dfix;
126 
127 } Abayer2dnr_Manual_Attr_V23_t;
128 
129 typedef struct Abayer2dnr_Auto_Attr_V23_s
130 {
131     //all ISO params and select param
132 
133     RK_Bayer2dnr_Params_V23_t st2DParams;
134     RK_Bayer2dnrV23_Params_Select_t st2DSelect;
135 
136 } Abayer2dnr_Auto_Attr_V23_t;
137 
138 typedef struct Abayer2dnr_ProcResult_V23_s {
139 
140     //for sw simultaion
141     //RK_Bayer2dnrV23_Params_Select_t st2DSelect;
142 
143     //for hw register
144     RK_Bayer2dnr_Fix_V23_t* st2DFix;
145 } Abayer2dnr_ProcResult_V23_t;
146 
147 
148 typedef struct Abayer2dnr_Config_V23_s {
149     Abayer2dnr_State_V23_t eState;
150     Abayer2dnr_OPMode_V23_t eMode;
151 } Abayer2dnr_Config_V23_t;
152 
153 
154 typedef struct rk_aiq_bayer2dnr_attrib_v23_s {
155     rk_aiq_uapi_sync_t sync;
156 
157     Abayer2dnr_OPMode_V23_t eMode;
158     Abayer2dnr_Auto_Attr_V23_t stAuto;
159     Abayer2dnr_Manual_Attr_V23_t stManual;
160 } rk_aiq_bayer2dnr_attrib_v23_t;
161 
162 
163 typedef struct rk_aiq_bayer2dnr_strength_v23_s {
164     rk_aiq_uapi_sync_t sync;
165 
166     float percent;
167     bool strength_enable;
168 } rk_aiq_bayer2dnr_strength_v23_t;
169 
170 
171 
172 
173 //RKAIQ_END_DECLARE
174 
175 #endif
176 
177