1 /*
2  * Copyright (c) 2019-2022 Rockchip Eletronics Co., Ltd.
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 #ifndef _RK_AIQ_TYPES_ABLC_ALGO_INT_V32_H_
17 #define _RK_AIQ_TYPES_ABLC_ALGO_INT_V32_H_
18 #include "RkAiqCalibDbTypes.h"
19 #include "ablcV32/rk_aiq_types_ablc_algo_v32.h"
20 #include "ablc_head_V32.h"
21 #include "ablc_uapi_head_v32.h"
22 
23 #define ABLC_V32_RECALCULATE_DELTE_ISO (10)
24 
25 typedef enum AblcResult_V32_e {
26     ABLC_V32_RET_SUCCESS          = 0,  // this has to be 0, if clauses rely on it
27     ABLC_V32_RET_FAILURE          = 1,  // process failure
28     ABLC_V32_RET_INVALID_PARM     = 2,  // invalid parameter
29     ABLC_V32_RET_WRONG_CONFIG     = 3,  // feature not supported
30     ABLC_V32_RET_BUSY             = 4,  // there's already something going on...
31     ABLC_V32_RET_CANCELED         = 5,  // operation canceled
32     ABLC_V32_RET_OUTOFMEM         = 6,  // out of memory
33     ABLC_V32_RET_OUTOFRANGE       = 7,  // parameter/value out of range
34     ABLC_V32_RET_NULL_POINTER     = 8,  // the/one/all parameter(s) is a(are) NULL pointer(s)
35     ABLC_V32_RET_DIVISION_BY_ZERO = 9,  // a divisor equals ZERO
36     ABLC_V32_RET_NO_INPUTIMAGE    = 10  // no input image
37 } AblcResult_V32_t;
38 
39 typedef enum AblcState_V32_e {
40     ABLC_V32_STATE_INVALID     = 0, /**< initialization value */
41     ABLC_V32_STATE_INITIALIZED = 1, /**< instance is created, but not initialized */
42     ABLC_V32_STATE_STOPPED     = 2, /**< instance is confiured (ready to start) or stopped */
43     ABLC_V32_STATE_RUNNING     = 3, /**< instance is running (processes frames) */
44     ABLC_V32_STATE_LOCKED      = 4, /**< instance is locked (for taking snapshots) */
45     ABLC_V32_STATE_MAX              /**< max */
46 } AblcState_V32_t;
47 
48 typedef enum AblcOPMode_V32_e {
49     ABLC_V32_OP_MODE_OFF    = 0, /**< initialization value */
50     ABLC_V32_OP_MODE_AUTO   = 1, /**< instance is created, but not initialized */
51     ABLC_V32_OP_MODE_MANUAL = 2, /**< instance is confiured (ready to start) or stopped */
52     ABLC_V32_OP_MODE_MAX         /**< max */
53 } AblcOPMode_V32_t;
54 
55 typedef enum AblcParamMode_V32_e {
56     ABLC_V32_PARAM_MODE_INVALID = 0, /**< initialization value */
57     ABLC_V32_PARAM_MODE_NORMAL  = 1, /**< instance is created, but not initialized */
58     ABLC_V32_PARAM_MODE_HDR     = 2, /**< instance is confiured (ready to start) or stopped */
59     ABLC_V32_PARAM_MODE_MAX          /**< max */
60 } AblcParamMode_V32_t;
61 
62 typedef struct AblcParams_V32_s {
63     bool enable;
64     float iso[ABLCV32_MAX_ISO_LEVEL];
65     float blc_r[ABLCV32_MAX_ISO_LEVEL];
66     float blc_gr[ABLCV32_MAX_ISO_LEVEL];
67     float blc_gb[ABLCV32_MAX_ISO_LEVEL];
68     float blc_b[ABLCV32_MAX_ISO_LEVEL];
69 } AblcParams_V32_t;
70 
71 typedef struct AblcRefParams_V32_s {
72     float iso[ABLCV32_MAX_ISO_LEVEL];
73     float Reference_r[ABLCV32_MAX_ISO_LEVEL];
74     float Reference_gr[ABLCV32_MAX_ISO_LEVEL];
75     float Reference_gb[ABLCV32_MAX_ISO_LEVEL];
76     float Reference_b[ABLCV32_MAX_ISO_LEVEL];
77 } AblcRefParams_V32_t;
78 
79 
80 typedef struct AblcOBParams_V32_s {
81     bool enable;
82     float iso[ABLCV32_MAX_ISO_LEVEL];
83     float ob_offset[ABLCV32_MAX_ISO_LEVEL];
84     float ob_predgain[ABLCV32_MAX_ISO_LEVEL];
85 } AblcOBParams_V32_t;
86 
87 
88 typedef AblcSelect_V32_t AblcManualAttr_V32_t;
89 typedef AblcOBSelect_V32_t AblcManualOBAttr_V32_t;
90 typedef struct AblcProc_V32_s {
91     bool enable;
92     short int blc_r;
93     short int blc_gr;
94     short int blc_gb;
95     short int blc_b;
96 
97     bool blc1_enable;
98     short int blc1_r;
99     short int blc1_gr;
100     short int blc1_gb;
101     short int blc1_b;
102 
103     bool blc_ob_enable;
104     short int isp_ob_offset;
105     float isp_ob_predgain;
106     int isp_ob_max;
107 } AblcProc_V32_t;
108 
109 typedef struct rk_aiq_blc_attrib_V32_s {
110     rk_aiq_uapi_sync_t sync;
111     AblcOPMode_V32_t eMode;
112     AblcParams_V32_t stBlc0Auto;
113     AblcParams_V32_t stBlc1Auto;
114     AblcOBParams_V32_t stBlcOBAuto;
115     AblcManualAttr_V32_t stBlc0Manual;
116     AblcManualAttr_V32_t stBlc1Manual;
117     AblcManualOBAttr_V32_t stBlcOBManual;
118 } rk_aiq_blc_attrib_V32_t;
119 
120 
121 #endif
122