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 __RKAIQ_TYPES_ALGO_AGIC_INT_H__ 17 #define __RKAIQ_TYPES_ALGO_AGIC_INT_H__ 18 19 #include <stdint.h> 20 21 #include "RkAiqCalibDbTypes.h" 22 #include "rk_aiq_comm.h" 23 #include "agic_uapi_head.h" 24 25 typedef struct rkaiq_gic_v1_hw_param_s { 26 uint8_t edge_open; 27 28 uint16_t regmingradthrdark2; 29 uint16_t regmingradthrdark1; 30 uint16_t regminbusythre; 31 32 uint16_t regdarkthre; 33 uint16_t regmaxcorvboth; 34 uint16_t regdarktthrehi; 35 36 uint8_t regkgrad2dark; 37 uint8_t regkgrad1dark; 38 uint8_t regstrengthglobal_fix; 39 uint8_t regdarkthrestep; 40 uint8_t regkgrad2; 41 uint8_t regkgrad1; 42 uint8_t reggbthre; 43 44 uint16_t regmaxcorv; 45 uint16_t regmingradthr2; 46 uint16_t regmingradthr1; 47 48 uint8_t gr_ratio; 49 uint16_t dnloscale; 50 uint16_t dnhiscale; 51 uint8_t reglumapointsstep; 52 53 uint16_t gvaluelimitlo; 54 uint16_t gvaluelimithi; 55 uint8_t fusionratiohilimt1; 56 57 uint8_t regstrength_fix; 58 59 uint16_t sigma_y[15]; 60 61 uint8_t noise_cut_en; 62 uint16_t noise_coe_a; 63 64 uint16_t noise_coe_b; 65 uint16_t diff_clip; 66 } __attribute__((packed)) rkaiq_gic_v1_hw_param_t; 67 68 typedef struct rkaiq_gic_v2_hw_param_s { 69 uint16_t regmingradthrdark2; 70 uint16_t regmingradthrdark1; 71 uint16_t regminbusythre; 72 73 uint16_t regdarkthre; 74 uint16_t regmaxcorvboth; 75 uint16_t regdarktthrehi; 76 77 uint8_t regkgrad2dark; 78 uint8_t regkgrad1dark; 79 uint8_t regstrengthglobal_fix; 80 uint8_t regdarkthrestep; 81 uint8_t regkgrad2; 82 uint8_t regkgrad1; 83 uint8_t reggbthre; 84 85 uint16_t regmaxcorv; 86 uint16_t regmingradthr2; 87 uint16_t regmingradthr1; 88 89 uint8_t gr_ratio; 90 uint8_t noise_scale; 91 uint16_t noise_base; 92 uint16_t diff_clip; 93 94 uint16_t sigma_y[15]; 95 } __attribute__((packed)) rkaiq_gic_v2_hw_param_t; 96 97 typedef struct AgicProcResult_s { 98 union { 99 rkaiq_gic_v1_hw_param_t ProcResV20; 100 rkaiq_gic_v2_hw_param_t ProcResV21; 101 }; 102 bool gic_en; 103 } AgicProcResult_t; 104 105 typedef struct AgicConfigV20_s { 106 unsigned char gic_en; 107 unsigned char edge_open; 108 unsigned short regmingradthrdark2; 109 unsigned short regmingradthrdark1; 110 unsigned short regminbusythre; 111 unsigned short regdarkthre; 112 unsigned short regmaxcorvboth; 113 unsigned short regdarktthrehi; 114 unsigned char regkgrad2dark; 115 unsigned char regkgrad1dark; 116 float globalStrength; 117 unsigned char regkgrad2; 118 unsigned char regkgrad1; 119 unsigned char reggbthre; 120 unsigned short regmaxcorv; 121 unsigned short regmingradthr2; 122 unsigned short regmingradthr1; 123 unsigned char gr_ratio; 124 float dnloscale; 125 float dnhiscale; 126 unsigned char reglumapointsstep; 127 float gvaluelimitlo; 128 float gvaluelimithi; 129 float fusionratiohilimt1; 130 float textureStrength; 131 float noiseCurve_0; 132 float noiseCurve_1; 133 float sigma_y[15]; 134 unsigned char noise_cut_en; 135 unsigned short noise_coe_a; 136 unsigned short noise_coe_b; 137 unsigned short diff_clip; 138 } AgicConfigV20_t; 139 140 typedef struct AgicConfigV21_s { 141 unsigned char gic_en; 142 unsigned short regmingradthrdark2; 143 unsigned short regmingradthrdark1; 144 unsigned short regminbusythre; 145 unsigned short regdarkthre; 146 unsigned short regmaxcorvboth; 147 unsigned short regdarktthrehi; 148 unsigned char regkgrad2dark; 149 unsigned char regkgrad1dark; 150 unsigned char regkgrad2; 151 unsigned char regkgrad1; 152 unsigned char reggbthre; 153 unsigned short regmaxcorv; 154 unsigned short regmingradthr2; 155 unsigned short regmingradthr1; 156 unsigned char gr_ratio; 157 uint8_t noise_scale; 158 uint16_t noise_base; 159 float noiseCurve_0; 160 float noiseCurve_1; 161 float sigma_y[15]; 162 float globalStrength; 163 unsigned short diff_clip; 164 } AgicConfigV21_t; 165 166 typedef struct AgicConfig_s { 167 union { 168 AgicConfigV20_t ConfigV20; 169 AgicConfigV21_t ConfigV21; 170 }; 171 } AgicConfig_t; 172 173 #endif //__RKAIQ_TYPES_ALGO_AGIC_INT_H__ 174