1 /* 2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __HI_AWB_COMM_H__ 17 #define __HI_AWB_COMM_H__ 18 19 #include "hi_type.h" 20 #include "hi_comm_isp.h" 21 22 #ifdef __cplusplus 23 #if __cplusplus 24 extern "C" { 25 #endif 26 #endif /* End of #ifdef __cplusplus */ 27 28 #define HI_AWB_LIB_NAME "hisi_awb_lib" 29 30 typedef struct hiAWB_DBG_ATTR_S { 31 HI_U16 u16WhiteLevel; 32 HI_U16 u16BlackLevel; 33 HI_U16 u16CrMax; 34 HI_U16 u16CrMin; 35 HI_U16 u16CbMax; 36 HI_U16 u16CbMin; 37 HI_U16 u16CrHigh; 38 HI_U16 u16CrLow; 39 HI_U16 u16CbHigh; 40 HI_U16 u16CbLow; 41 HI_U16 u16RawWhiteLevel; 42 HI_U16 u16RawBlackLevel; 43 HI_U16 u16RawCrMax; 44 HI_U16 u16RawCrMin; 45 HI_U16 u16RawCbMax; 46 HI_U16 u16RawCbMin; 47 HI_U16 u16RawCrHigh; 48 HI_U16 u16RawCrLow; 49 HI_U16 u16RawCbHigh; 50 HI_U16 u16RawCbLow; 51 52 HI_U16 u16WDRMode; 53 HI_U16 u16Enable; 54 HI_U16 u16ManualEnable; 55 HI_U16 u16Zone; 56 HI_U16 u16HighTemp; 57 HI_U16 u16LowTemp; 58 HI_U16 u16RefTemp; 59 HI_U16 u16RgainBase; 60 HI_U16 u16GgainBase; 61 HI_U16 u16BgainBase; 62 HI_S32 s32p1; 63 HI_S32 s32p2; 64 HI_S32 s32q; 65 HI_S32 s32a; 66 HI_S32 s32c; 67 68 HI_U16 u16ManSatEnable; 69 HI_U16 u16SatTarget; 70 } AWB_DBG_ATTR_S; 71 72 typedef struct hiAWB_ZONE_DBG_S { 73 HI_U16 u16Sum; 74 HI_U16 u16Rg; 75 HI_U16 u16Bg; 76 HI_U16 u16CountAll; 77 HI_U16 u16CountMin; 78 HI_U16 u16CountMax; 79 HI_U16 u16RawRAvg; 80 HI_U16 u16RawGAvg; 81 HI_U16 u16RawBAvg; 82 HI_U16 u16TK; 83 HI_U16 u16Weight; 84 HI_S16 s16Shift; 85 } AWB_ZONE_DBG_S; 86 87 typedef struct hiAWB_DBG_STATUS_S { 88 HI_U32 u32FrmNumBgn; 89 HI_U32 u32GlobalSum; 90 HI_U16 u16GlobalRgSta; 91 HI_U16 u16GlobalBgSta; 92 HI_U16 u16GlobalCountAll; 93 HI_U16 u16GlobalCountMin; 94 HI_U16 u16GlobalCountMax; 95 HI_U16 u16GlobalRAvg; 96 HI_U16 u16GlobalGAvg; 97 HI_U16 u16GlobalBAvg; 98 HI_U16 u16TK; 99 HI_U16 u16Rgain; 100 HI_U16 u16Ggain; 101 HI_U16 u16Bgain; 102 HI_U16 au16CCM[CCM_MATRIX_SIZE]; 103 104 HI_U32 au32HistInfo[256]; /* 256 is size of hist info */ 105 AWB_ZONE_DBG_S astZoneDebug[AWB_ZONE_NUM]; 106 107 HI_U32 u32FrmNumEnd; 108 } AWB_DBG_STATUS_S; 109 110 /* sensor's interface to awb */ 111 typedef struct hiAWB_CCM_TAB_S { 112 HI_U16 u16ColorTemp; /* RW; Range:[2000,10000]; Format:16.0; the current color temperature */ 113 HI_U16 au16CCM[CCM_MATRIX_SIZE]; /* RW; Range: [0x0, 0xFFFF]; Format:8.8; 114 CCM matrixes for different color temperature */ 115 } AWB_CCM_TAB_S; 116 117 typedef struct hiAWB_CCM_S { 118 HI_U16 u16CCMTabNum; /* RW; Range: [0x3, 0x7]; Format:16.0; The number of CCM matrixes */ 119 AWB_CCM_TAB_S astCCMTab[CCM_MATRIX_NUM]; 120 } AWB_CCM_S; 121 122 typedef struct hiAWB_AGC_TABLE_S { 123 HI_BOOL bValid; 124 125 HI_U8 au8Saturation[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;adjust saturation, different iso with different 126 saturation */ 127 } AWB_AGC_TABLE_S; 128 129 typedef struct hiAWB_SENSOR_DEFAULT_S { 130 HI_U16 u16WbRefTemp; /* RW;reference color temperature for WB */ 131 HI_U16 au16GainOffset[ISP_BAYER_CHN_NUM]; /* RW; gain offset for white balance */ 132 HI_S32 as32WbPara[AWB_CURVE_PARA_NUM]; /* RW; parameter for wb curve,p1,p2,q1,a1,b1,c1 */ 133 134 HI_U16 u16GoldenRgain; /* Rgain for the golden sample */ 135 HI_U16 u16GoldenBgain; /* Bgain for the golden sample */ 136 HI_U16 u16SampleRgain; /* Rgain for the current sample */ 137 HI_U16 u16SampleBgain; /* Bgain for the current sample */ 138 AWB_AGC_TABLE_S stAgcTbl; 139 AWB_CCM_S stCcm; 140 HI_U16 u16InitRgain; /* Init WB gain */ 141 HI_U16 u16InitGgain; 142 HI_U16 u16InitBgain; 143 HI_U8 u8AWBRunInterval; /* RW;AWB Run Interval */ 144 HI_U16 au16InitCCM[CCM_MATRIX_SIZE]; 145 } AWB_SENSOR_DEFAULT_S; 146 147 typedef struct hiAWB_SPEC_SENSOR_DEFAULT_S { 148 ISP_SPECAWB_ATTR_S stSpecAwbAttrs; 149 ISP_SPECAWB_CAA_CONTROl_S stCaaControl; 150 } AWB_SPEC_SENSOR_DEFAULT_S; 151 152 typedef struct hiAWB_SENSOR_EXP_FUNC_S { 153 HI_S32 (*pfn_cmos_get_awb_default)(VI_PIPE ViPipe, AWB_SENSOR_DEFAULT_S *pstAwbSnsDft); 154 HI_S32 (*pfn_cmos_get_awb_spec_default)(VI_PIPE ViPipe, AWB_SPEC_SENSOR_DEFAULT_S *pstAwbSpecSnsDft); 155 } AWB_SENSOR_EXP_FUNC_S; 156 157 typedef struct hiAWB_SENSOR_REGISTER_S { 158 AWB_SENSOR_EXP_FUNC_S stSnsExp; 159 } AWB_SENSOR_REGISTER_S; 160 161 #ifdef __cplusplus 162 #if __cplusplus 163 } 164 #endif 165 #endif /* End of #ifdef __cplusplus */ 166 167 #endif 168