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_AGAIN_ALGO_INT_V1_H_ 21 #define _RK_AIQ_TYPE_AGAIN_ALGO_INT_V1_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 "again/rk_aiq_types_again_algo.h" 29 30 //RKAIQ_BEGIN_DECLARE 31 32 #define GAIN_SIGMA_BITS_ACT_V1 (10) 33 34 #define GAIN_HDR_MERGE_IN_FIX_BITS_DECI_V1 (6) 35 #define GAIN_HDR_MERGE_IN2_FIX_BITS_INTE_V1 (12) 36 #define GAIN_HDR_MERGE_IN0_FIX_BITS_INTE_V1 (8) 37 38 #define GAIN_MAX_INTEPORATATION_LUMAPOINT (17) 39 40 typedef enum Again_result_e { 41 AGAIN_RET_SUCCESS = 0, // this has to be 0, if clauses rely on it 42 AGAIN_RET_FAILURE = 1, // process failure 43 AGAIN_RET_INVALID_PARM = 2, // invalid parameter 44 AGAIN_RET_WRONG_CONFIG = 3, // feature not supported 45 AGAIN_RET_BUSY = 4, // there's already something going on... 46 AGAIN_RET_CANCELED = 5, // operation canceled 47 AGAIN_RET_OUTOFMEM = 6, // out of memory 48 AGAIN_RET_OUTOFRANGE = 7, // parameter/value out of range 49 AGAIN_RET_NULL_POINTER = 8, // the/one/all parameter(s) is a(are) NULL pointer(s) 50 AGAIN_RET_DIVISION_BY_ZERO = 9, // a divisor equals ZERO 51 AGAIN_RET_NO_INPUTIMAGE = 10 // no input image 52 } Again_result_t; 53 54 typedef enum Again_State_e { 55 AGAIN_STATE_INVALID = 0, /**< initialization value */ 56 AGAIN_STATE_INITIALIZED = 1, /**< instance is created, but not initialized */ 57 AGAIN_STATE_STOPPED = 2, /**< instance is confiured (ready to start) or stopped */ 58 AGAIN_STATE_RUNNING = 3, /**< instance is running (processes frames) */ 59 AGAIN_STATE_LOCKED = 4, /**< instance is locked (for taking snapshots) */ 60 AGAIN_STATE_MAX /**< max */ 61 } Again_State_t; 62 63 typedef enum Again_OPMode_e { 64 AGAIN_OP_MODE_INVALID = 0, /**< initialization value */ 65 AGAIN_OP_MODE_AUTO = 1, /**< instance is created, but not initialized */ 66 AGAIN_OP_MODE_MANUAL = 2, /**< instance is confiured (ready to start) or stopped */ 67 AGAIN_OP_MODE_MAX /**< max */ 68 } Again_OPMode_t; 69 70 typedef enum Again_ParamMode_e { 71 AGAIN_PARAM_MODE_INVALID = 0, 72 AGAIN_PARAM_MODE_NORMAL = 1, /**< initialization value */ 73 AGAIN_PARAM_MODE_HDR = 2, /**< instance is created, but not initialized */ 74 AGAIN_PARAM_MODE_GRAY = 3, /**< instance is confiured (ready to start) or stopped */ 75 AGAIN_PARAM_MODE_MAX /**< max */ 76 } Again_ParamMode_t; 77 78 typedef struct Again_ExpInfo_s { 79 int hdr_mode; 80 float arTime[3]; 81 float arAGain[3]; 82 float arDGain[3]; 83 int arIso[3]; 84 int arDcgMode[3]; 85 int cur_snr_mode; 86 int snr_mode; 87 88 float preTime[3]; 89 float preAGain[3]; 90 float preDGain[3]; 91 int preIso[3]; 92 int preDcgMode[3]; 93 int pre_snr_mode; 94 95 int mfnr_mode_3to1; 96 } Again_ExpInfo_t; 97 98 typedef struct RK_GAIN_Params_V1_s 99 { 100 101 }RK_GAIN_Params_V1_t; 102 103 typedef struct RK_GAIN_Params_V1_Select_s 104 { 105 unsigned short fix_x_pos_dehaze[GAIN_MAX_INTEPORATATION_LUMAPOINT]; 106 double noise_sigma_dehaze[GAIN_MAX_INTEPORATATION_LUMAPOINT]; 107 108 }RK_GAIN_Params_V1_Select_t; 109 110 111 typedef struct Again_Manual_Attr_V1_s 112 { 113 int gainEn; 114 RK_GAIN_Params_V1_Select_t stSelect; 115 116 } Again_Manual_Attr_V1_t; 117 118 typedef struct Again_Auto_Attr_V1_s 119 { 120 //all ISO params and select param 121 int gainEn; 122 123 RK_GAIN_Params_V1_t stParams; 124 RK_GAIN_Params_V1_Select_t stSelect; 125 126 } Again_Auto_Attr_V1_t; 127 128 typedef struct Again_ProcResult_V1_s { 129 int gainEn; 130 131 //for sw simultaion 132 //RK_GAIN_Params_V1_Select_t stSelect; 133 134 //for hw register 135 RK_GAIN_Fix_V1_t* stFix; 136 137 } Again_ProcResult_V1_t; 138 139 140 typedef struct Again_Config_V1_s { 141 Again_State_t eState; 142 Again_OPMode_t eMode; 143 } Again_Config_V1_t; 144 145 146 typedef struct rk_aiq_gain_attrib_v1_s { 147 Again_OPMode_t eMode; 148 Again_Auto_Attr_V1_t stAuto; 149 Again_Manual_Attr_V1_t stManual; 150 } rk_aiq_gain_attrib_v1_t; 151 152 153 154 //calibdb 155 156 157 //RKAIQ_END_DECLARE 158 159 #endif 160 161