1 /*
2  *rk_aiq_types_adegamma_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_ADEGAMMA_ALGO_INT_H_
21 #define _RK_AIQ_TYPE_ADEGAMMA_ALGO_INT_H_
22 #include "adegamma/rk_aiq_types_adegamma_algo.h"
23 #include "RkAiqCalibDbTypes.h"
24 #include "adegamma_head.h"
25 
26 #define DEGAMMA_CRUVE_KNOTS                   (17)
27 #define DEGAMMA_CRUVE_X_KNOTS                 (16)
28 #define DEGAMMA_CRUVE_X_NORMALIZE_FACTOR     (4)
29 #define DEGAMMA_CRUVE_X_MAX                    (7)
30 #define DEGAMMA_CRUVE_X_MIN                    (0)
31 #define DEGAMMA_CRUVE_Y_KNOTS                  (17)
32 #define DEGAMMA_CRUVE_Y_MAX                    (4095)
33 #define DEGAMMA_CRUVE_Y_MIN                    (0)
34 
35 
36 enum {
37     DEGAMMA_OUT_NORMAL = 0,
38     DEGAMMA_OUT_HDR = 1,
39     DEGAMMA_OUT_NIGHT = 2
40 };
41 
42 typedef enum rk_aiq_degamma_op_mode_s {
43     RK_AIQ_DEGAMMA_MODE_OFF                     = 0,        /**< run iq degamma */
44     RK_AIQ_DEGAMMA_MODE_MANUAL                  = 1,        /**< run manual degamma */
45     RK_AIQ_DEGAMMA_MODE_TOOL                    = 2,        /**< for tool*/
46 } rk_aiq_degamma_op_mode_t;
47 
48 typedef struct Adegamma_api_manual_s {
49     bool en;
50     int X_axis[DEGAMMA_CRUVE_KNOTS];
51     int curve_R[DEGAMMA_CRUVE_KNOTS];
52     int curve_G[DEGAMMA_CRUVE_KNOTS];
53     int curve_B[DEGAMMA_CRUVE_KNOTS];
54 }  Adegamma_api_manual_t;
55 
56 typedef struct rk_aiq_degamma_cfg_s {
57     bool degamma_en;
58     int degamma_X[DEGAMMA_CRUVE_X_KNOTS];
59     int degamma_tableR[DEGAMMA_CRUVE_Y_KNOTS];
60     int degamma_tableG[DEGAMMA_CRUVE_Y_KNOTS];
61     int degamma_tableB[DEGAMMA_CRUVE_Y_KNOTS];
62 }  rk_aiq_degamma_cfg_t;
63 
64 typedef struct rk_aiq_degamma_attr_s {
65     rk_aiq_degamma_op_mode_t mode;
66     Adegamma_api_manual_t stManual;
67     CalibDbV2_Adegmma_t stTool;
68     int Scene_mode;
69 }  rk_aiq_degamma_attr_t;
70 
71 typedef struct AdegammaProcRes_s {
72     bool degamma_en;
73     int degamma_X_d0;
74     int degamma_X_d1;
75     int degamma_tableR[DEGAMMA_CRUVE_Y_KNOTS];
76     int degamma_tableG[DEGAMMA_CRUVE_Y_KNOTS];
77     int degamma_tableB[DEGAMMA_CRUVE_Y_KNOTS];
78 }  AdegammaProcRes_t;
79 
80 #endif
81