11bd4fe43Sopenharmony_ci/* 21bd4fe43Sopenharmony_ci * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED. 31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License. 51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at 61bd4fe43Sopenharmony_ci * 71bd4fe43Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 81bd4fe43Sopenharmony_ci * 91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and 131bd4fe43Sopenharmony_ci * limitations under the License. 141bd4fe43Sopenharmony_ci */ 151bd4fe43Sopenharmony_ci 161bd4fe43Sopenharmony_ci#ifndef __HI_AWB_COMM_H__ 171bd4fe43Sopenharmony_ci#define __HI_AWB_COMM_H__ 181bd4fe43Sopenharmony_ci 191bd4fe43Sopenharmony_ci#include "hi_type.h" 201bd4fe43Sopenharmony_ci#include "hi_comm_isp.h" 211bd4fe43Sopenharmony_ci 221bd4fe43Sopenharmony_ci#ifdef __cplusplus 231bd4fe43Sopenharmony_ci#if __cplusplus 241bd4fe43Sopenharmony_ciextern "C" { 251bd4fe43Sopenharmony_ci#endif 261bd4fe43Sopenharmony_ci#endif /* End of #ifdef __cplusplus */ 271bd4fe43Sopenharmony_ci 281bd4fe43Sopenharmony_ci#define HI_AWB_LIB_NAME "hisi_awb_lib" 291bd4fe43Sopenharmony_ci 301bd4fe43Sopenharmony_citypedef struct hiAWB_DBG_ATTR_S { 311bd4fe43Sopenharmony_ci HI_U16 u16WhiteLevel; 321bd4fe43Sopenharmony_ci HI_U16 u16BlackLevel; 331bd4fe43Sopenharmony_ci HI_U16 u16CrMax; 341bd4fe43Sopenharmony_ci HI_U16 u16CrMin; 351bd4fe43Sopenharmony_ci HI_U16 u16CbMax; 361bd4fe43Sopenharmony_ci HI_U16 u16CbMin; 371bd4fe43Sopenharmony_ci HI_U16 u16CrHigh; 381bd4fe43Sopenharmony_ci HI_U16 u16CrLow; 391bd4fe43Sopenharmony_ci HI_U16 u16CbHigh; 401bd4fe43Sopenharmony_ci HI_U16 u16CbLow; 411bd4fe43Sopenharmony_ci HI_U16 u16RawWhiteLevel; 421bd4fe43Sopenharmony_ci HI_U16 u16RawBlackLevel; 431bd4fe43Sopenharmony_ci HI_U16 u16RawCrMax; 441bd4fe43Sopenharmony_ci HI_U16 u16RawCrMin; 451bd4fe43Sopenharmony_ci HI_U16 u16RawCbMax; 461bd4fe43Sopenharmony_ci HI_U16 u16RawCbMin; 471bd4fe43Sopenharmony_ci HI_U16 u16RawCrHigh; 481bd4fe43Sopenharmony_ci HI_U16 u16RawCrLow; 491bd4fe43Sopenharmony_ci HI_U16 u16RawCbHigh; 501bd4fe43Sopenharmony_ci HI_U16 u16RawCbLow; 511bd4fe43Sopenharmony_ci 521bd4fe43Sopenharmony_ci HI_U16 u16WDRMode; 531bd4fe43Sopenharmony_ci HI_U16 u16Enable; 541bd4fe43Sopenharmony_ci HI_U16 u16ManualEnable; 551bd4fe43Sopenharmony_ci HI_U16 u16Zone; 561bd4fe43Sopenharmony_ci HI_U16 u16HighTemp; 571bd4fe43Sopenharmony_ci HI_U16 u16LowTemp; 581bd4fe43Sopenharmony_ci HI_U16 u16RefTemp; 591bd4fe43Sopenharmony_ci HI_U16 u16RgainBase; 601bd4fe43Sopenharmony_ci HI_U16 u16GgainBase; 611bd4fe43Sopenharmony_ci HI_U16 u16BgainBase; 621bd4fe43Sopenharmony_ci HI_S32 s32p1; 631bd4fe43Sopenharmony_ci HI_S32 s32p2; 641bd4fe43Sopenharmony_ci HI_S32 s32q; 651bd4fe43Sopenharmony_ci HI_S32 s32a; 661bd4fe43Sopenharmony_ci HI_S32 s32c; 671bd4fe43Sopenharmony_ci 681bd4fe43Sopenharmony_ci HI_U16 u16ManSatEnable; 691bd4fe43Sopenharmony_ci HI_U16 u16SatTarget; 701bd4fe43Sopenharmony_ci} AWB_DBG_ATTR_S; 711bd4fe43Sopenharmony_ci 721bd4fe43Sopenharmony_citypedef struct hiAWB_ZONE_DBG_S { 731bd4fe43Sopenharmony_ci HI_U16 u16Sum; 741bd4fe43Sopenharmony_ci HI_U16 u16Rg; 751bd4fe43Sopenharmony_ci HI_U16 u16Bg; 761bd4fe43Sopenharmony_ci HI_U16 u16CountAll; 771bd4fe43Sopenharmony_ci HI_U16 u16CountMin; 781bd4fe43Sopenharmony_ci HI_U16 u16CountMax; 791bd4fe43Sopenharmony_ci HI_U16 u16RawRAvg; 801bd4fe43Sopenharmony_ci HI_U16 u16RawGAvg; 811bd4fe43Sopenharmony_ci HI_U16 u16RawBAvg; 821bd4fe43Sopenharmony_ci HI_U16 u16TK; 831bd4fe43Sopenharmony_ci HI_U16 u16Weight; 841bd4fe43Sopenharmony_ci HI_S16 s16Shift; 851bd4fe43Sopenharmony_ci} AWB_ZONE_DBG_S; 861bd4fe43Sopenharmony_ci 871bd4fe43Sopenharmony_citypedef struct hiAWB_DBG_STATUS_S { 881bd4fe43Sopenharmony_ci HI_U32 u32FrmNumBgn; 891bd4fe43Sopenharmony_ci HI_U32 u32GlobalSum; 901bd4fe43Sopenharmony_ci HI_U16 u16GlobalRgSta; 911bd4fe43Sopenharmony_ci HI_U16 u16GlobalBgSta; 921bd4fe43Sopenharmony_ci HI_U16 u16GlobalCountAll; 931bd4fe43Sopenharmony_ci HI_U16 u16GlobalCountMin; 941bd4fe43Sopenharmony_ci HI_U16 u16GlobalCountMax; 951bd4fe43Sopenharmony_ci HI_U16 u16GlobalRAvg; 961bd4fe43Sopenharmony_ci HI_U16 u16GlobalGAvg; 971bd4fe43Sopenharmony_ci HI_U16 u16GlobalBAvg; 981bd4fe43Sopenharmony_ci HI_U16 u16TK; 991bd4fe43Sopenharmony_ci HI_U16 u16Rgain; 1001bd4fe43Sopenharmony_ci HI_U16 u16Ggain; 1011bd4fe43Sopenharmony_ci HI_U16 u16Bgain; 1021bd4fe43Sopenharmony_ci HI_U16 au16CCM[CCM_MATRIX_SIZE]; 1031bd4fe43Sopenharmony_ci 1041bd4fe43Sopenharmony_ci HI_U32 au32HistInfo[256]; /* 256 is size of hist info */ 1051bd4fe43Sopenharmony_ci AWB_ZONE_DBG_S astZoneDebug[AWB_ZONE_NUM]; 1061bd4fe43Sopenharmony_ci 1071bd4fe43Sopenharmony_ci HI_U32 u32FrmNumEnd; 1081bd4fe43Sopenharmony_ci} AWB_DBG_STATUS_S; 1091bd4fe43Sopenharmony_ci 1101bd4fe43Sopenharmony_ci/* sensor's interface to awb */ 1111bd4fe43Sopenharmony_citypedef struct hiAWB_CCM_TAB_S { 1121bd4fe43Sopenharmony_ci HI_U16 u16ColorTemp; /* RW; Range:[2000,10000]; Format:16.0; the current color temperature */ 1131bd4fe43Sopenharmony_ci HI_U16 au16CCM[CCM_MATRIX_SIZE]; /* RW; Range: [0x0, 0xFFFF]; Format:8.8; 1141bd4fe43Sopenharmony_ci CCM matrixes for different color temperature */ 1151bd4fe43Sopenharmony_ci} AWB_CCM_TAB_S; 1161bd4fe43Sopenharmony_ci 1171bd4fe43Sopenharmony_citypedef struct hiAWB_CCM_S { 1181bd4fe43Sopenharmony_ci HI_U16 u16CCMTabNum; /* RW; Range: [0x3, 0x7]; Format:16.0; The number of CCM matrixes */ 1191bd4fe43Sopenharmony_ci AWB_CCM_TAB_S astCCMTab[CCM_MATRIX_NUM]; 1201bd4fe43Sopenharmony_ci} AWB_CCM_S; 1211bd4fe43Sopenharmony_ci 1221bd4fe43Sopenharmony_citypedef struct hiAWB_AGC_TABLE_S { 1231bd4fe43Sopenharmony_ci HI_BOOL bValid; 1241bd4fe43Sopenharmony_ci 1251bd4fe43Sopenharmony_ci HI_U8 au8Saturation[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;adjust saturation, different iso with different 1261bd4fe43Sopenharmony_ci saturation */ 1271bd4fe43Sopenharmony_ci} AWB_AGC_TABLE_S; 1281bd4fe43Sopenharmony_ci 1291bd4fe43Sopenharmony_citypedef struct hiAWB_SENSOR_DEFAULT_S { 1301bd4fe43Sopenharmony_ci HI_U16 u16WbRefTemp; /* RW;reference color temperature for WB */ 1311bd4fe43Sopenharmony_ci HI_U16 au16GainOffset[ISP_BAYER_CHN_NUM]; /* RW; gain offset for white balance */ 1321bd4fe43Sopenharmony_ci HI_S32 as32WbPara[AWB_CURVE_PARA_NUM]; /* RW; parameter for wb curve,p1,p2,q1,a1,b1,c1 */ 1331bd4fe43Sopenharmony_ci 1341bd4fe43Sopenharmony_ci HI_U16 u16GoldenRgain; /* Rgain for the golden sample */ 1351bd4fe43Sopenharmony_ci HI_U16 u16GoldenBgain; /* Bgain for the golden sample */ 1361bd4fe43Sopenharmony_ci HI_U16 u16SampleRgain; /* Rgain for the current sample */ 1371bd4fe43Sopenharmony_ci HI_U16 u16SampleBgain; /* Bgain for the current sample */ 1381bd4fe43Sopenharmony_ci AWB_AGC_TABLE_S stAgcTbl; 1391bd4fe43Sopenharmony_ci AWB_CCM_S stCcm; 1401bd4fe43Sopenharmony_ci HI_U16 u16InitRgain; /* Init WB gain */ 1411bd4fe43Sopenharmony_ci HI_U16 u16InitGgain; 1421bd4fe43Sopenharmony_ci HI_U16 u16InitBgain; 1431bd4fe43Sopenharmony_ci HI_U8 u8AWBRunInterval; /* RW;AWB Run Interval */ 1441bd4fe43Sopenharmony_ci HI_U16 au16InitCCM[CCM_MATRIX_SIZE]; 1451bd4fe43Sopenharmony_ci} AWB_SENSOR_DEFAULT_S; 1461bd4fe43Sopenharmony_ci 1471bd4fe43Sopenharmony_citypedef struct hiAWB_SPEC_SENSOR_DEFAULT_S { 1481bd4fe43Sopenharmony_ci ISP_SPECAWB_ATTR_S stSpecAwbAttrs; 1491bd4fe43Sopenharmony_ci ISP_SPECAWB_CAA_CONTROl_S stCaaControl; 1501bd4fe43Sopenharmony_ci} AWB_SPEC_SENSOR_DEFAULT_S; 1511bd4fe43Sopenharmony_ci 1521bd4fe43Sopenharmony_citypedef struct hiAWB_SENSOR_EXP_FUNC_S { 1531bd4fe43Sopenharmony_ci HI_S32 (*pfn_cmos_get_awb_default)(VI_PIPE ViPipe, AWB_SENSOR_DEFAULT_S *pstAwbSnsDft); 1541bd4fe43Sopenharmony_ci HI_S32 (*pfn_cmos_get_awb_spec_default)(VI_PIPE ViPipe, AWB_SPEC_SENSOR_DEFAULT_S *pstAwbSpecSnsDft); 1551bd4fe43Sopenharmony_ci} AWB_SENSOR_EXP_FUNC_S; 1561bd4fe43Sopenharmony_ci 1571bd4fe43Sopenharmony_citypedef struct hiAWB_SENSOR_REGISTER_S { 1581bd4fe43Sopenharmony_ci AWB_SENSOR_EXP_FUNC_S stSnsExp; 1591bd4fe43Sopenharmony_ci} AWB_SENSOR_REGISTER_S; 1601bd4fe43Sopenharmony_ci 1611bd4fe43Sopenharmony_ci#ifdef __cplusplus 1621bd4fe43Sopenharmony_ci#if __cplusplus 1631bd4fe43Sopenharmony_ci} 1641bd4fe43Sopenharmony_ci#endif 1651bd4fe43Sopenharmony_ci#endif /* End of #ifdef __cplusplus */ 1661bd4fe43Sopenharmony_ci 1671bd4fe43Sopenharmony_ci#endif 168