hi_comm_sns.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. /******************************************************************************
  2. Copyright (C), 2016, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_sns.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software group
  7. Created : 2011/01/05
  8. Description :
  9. History :
  10. 1.Date : 2011/01/05
  11. Author :
  12. Modification: Created file
  13. ******************************************************************************/
  14. #ifndef __HI_COMM_SNS_H__
  15. #define __HI_COMM_SNS_H__
  16. #include "hi_type.h"
  17. #include "hi_common.h"
  18. #include "hi_comm_isp.h"
  19. #ifdef __cplusplus
  20. #if __cplusplus
  21. extern "C" {
  22. #endif
  23. #endif /* End of #ifdef __cplusplus */
  24. typedef struct hiISP_CMOS_BLACK_LEVEL_S
  25. {
  26. HI_BOOL bUpdate;
  27. HI_U16 au16BlackLevel[ISP_BAYER_CHN_NUM];
  28. } ISP_CMOS_BLACK_LEVEL_S;
  29. typedef struct hiISP_SNS_ATTR_INFO_S
  30. {
  31. SENSOR_ID eSensorId;
  32. } ISP_SNS_ATTR_INFO_S;
  33. #define ISP_SPLIT_POINT_NUM (5)
  34. typedef struct hiISP_CMOS_DEMOSAIC_S
  35. {
  36. HI_BOOL bEnable;
  37. HI_U8 au8NonDirMFDetailEhcStr[ISP_AUTO_ISO_STRENGTH_NUM];
  38. HI_U8 au8NonDirHFDetailEhcStr[ISP_AUTO_ISO_STRENGTH_NUM];
  39. HI_U8 au8NonDirStr[ISP_AUTO_ISO_STRENGTH_NUM];
  40. HI_U8 au8DetailSmoothRange[ISP_AUTO_ISO_STRENGTH_NUM];
  41. HI_U16 au16DetailSmoothStr[ISP_AUTO_ISO_STRENGTH_NUM];
  42. } ISP_CMOS_DEMOSAIC_S;
  43. #define WDR_MAX_FRAME (4)
  44. typedef struct hiISP_CMOS_BAYERNR_S
  45. {
  46. HI_BOOL bEnable;
  47. HI_BOOL bLowPowerEnable;
  48. HI_BOOL bBnrMonoSensorEn;
  49. HI_BOOL bNrLscEnable;
  50. HI_U8 u8NrLscRatio;
  51. HI_U8 au8LutFineStr[ISP_AUTO_ISO_STRENGTH_NUM];
  52. HI_U8 au8ChromaStr[BAYER_PATT_NUM][ISP_AUTO_ISO_STRENGTH_NUM];
  53. HI_U8 au8WDRFrameStr[WDR_MAX_FRAME];
  54. HI_U16 au16CoarseStr[BAYER_PATT_NUM][ISP_AUTO_ISO_STRENGTH_NUM]; //u10.0
  55. HI_U16 au16LutCoringWgt[ISP_AUTO_ISO_STRENGTH_NUM];
  56. HI_U16 au16LutCoringRatio[HI_ISP_BAYERNR_LUT_LENGTH];
  57. } ISP_CMOS_BAYERNR_S;
  58. typedef struct hiISP_CMOS_NOISE_CALIBRATION_S
  59. {
  60. HI_U16 u16CalibrationLutNum;
  61. HI_FLOAT afCalibrationCoef[BAYER_CALIBTAION_MAX_NUM][3];
  62. } ISP_CMOS_NOISE_CALIBRATION_S;
  63. typedef struct hiISP_CMOS_SHARPEN_S
  64. {
  65. HI_U8 u8SkinUmin;
  66. HI_U8 u8SkinVmin;
  67. HI_U8 u8SkinUmax;
  68. HI_U8 u8SkinVmax;
  69. ISP_SHARPEN_MANUAL_ATTR_S stManual;
  70. ISP_SHARPEN_AUTO_ATTR_S stAuto;
  71. } ISP_CMOS_SHARPEN_S;
  72. typedef struct hiISP_CMOS_EDGEMARK_S
  73. {
  74. HI_BOOL bEnable; /*RW; Range:[0, 1]; Format:1.0;Enable/Disable Edge Mark*/
  75. HI_U8 u8Threshold; /* RW; range: [0, 255]; Format:8.0;*/
  76. HI_U32 u32Color; /* RW; range: [0, 0xFFFFFF]; Format:32.0;*/
  77. } ISP_CMOS_EDGEMARK_S;
  78. typedef struct hiISP_CMOS_DRC_S
  79. {
  80. HI_BOOL bEnable;
  81. HI_U16 u16ManualStrength;
  82. HI_U16 u16AutoStrength;
  83. HI_U8 u8SpatialFltCoef;
  84. HI_U8 u8RangeFltCoef;
  85. HI_U8 u8ContrastControl;
  86. HI_S8 s8DetailAdjustFactor;
  87. HI_U8 u8FltScaleFine;
  88. HI_U8 u8FltScaleCoarse;
  89. HI_U8 u8GradRevMax;
  90. HI_U8 u8GradRevThr;
  91. HI_U8 u8PDStrength;
  92. HI_U8 u8LocalMixingBrightMax;
  93. HI_U8 u8LocalMixingBrightMin;
  94. HI_U8 u8LocalMixingDarkMax;
  95. HI_U8 u8LocalMixingDarkMin;
  96. HI_U16 u16ColorCorrectionLut[33];
  97. HI_U8 u8Asymmetry;
  98. HI_U8 u8SecondPole;
  99. HI_U8 u8Stretch;
  100. HI_U8 u8Compress;
  101. HI_U8 u8CurveSel;
  102. HI_U16 au16Xpoint[5];
  103. HI_U16 au16Ypoint[5];
  104. HI_U16 au16Slope[5];
  105. } ISP_CMOS_DRC_S;
  106. typedef struct hiISP_CMOS_WDR_S
  107. {
  108. HI_BOOL bFusionMode;
  109. HI_BOOL bMotionComp;
  110. HI_U16 u16ShortThr;
  111. HI_U16 u16LongThr;
  112. HI_BOOL bShortExpoChk;
  113. HI_BOOL bMDRefFlicker;
  114. HI_U8 au8MdThrLowGain[ISP_AUTO_ISO_STRENGTH_NUM];
  115. HI_U8 au8MdThrHigGain[ISP_AUTO_ISO_STRENGTH_NUM];
  116. ISP_BNR_MODE_E enBnrMode;
  117. HI_U8 u8BnrStr;
  118. HI_U16 au16FusionThr[WDR_MAX_FRAME];
  119. } ISP_CMOS_WDR_S;
  120. typedef struct hiISP_CMOS_PREGAMMA_S
  121. {
  122. HI_BOOL bEnable;
  123. HI_U32 au32PreGamma[PREGAMMA_NODE_NUM];
  124. } ISP_CMOS_PREGAMMA_S;
  125. #define GAMMA_NODE_NUMBER 1025 //Update NODE NUMBER
  126. typedef struct hiISP_CMOS_GAMMA_S
  127. {
  128. HI_U16 au16Gamma[GAMMA_NODE_NUMBER];
  129. } ISP_CMOS_GAMMA_S;
  130. typedef struct hiISP_CMOS_SENSOR_MAX_RESOLUTION_S
  131. {
  132. HI_U32 u32MaxWidth;
  133. HI_U32 u32MaxHeight;
  134. } ISP_CMOS_SENSOR_MAX_RESOLUTION_S;
  135. typedef struct hiISP_CMOS_DPC_S
  136. {
  137. HI_U16 au16Strength[ISP_AUTO_ISO_STRENGTH_NUM];
  138. HI_U16 au16BlendRatio[ISP_AUTO_ISO_STRENGTH_NUM];
  139. } ISP_CMOS_DPC_S;
  140. typedef struct hiISP_LSC_CABLI_TABLE_S
  141. {
  142. HI_U16 au16R_Gain[HI_ISP_LSC_GRID_POINTS];
  143. HI_U16 au16Gr_Gain[HI_ISP_LSC_GRID_POINTS];
  144. HI_U16 au16Gb_Gain[HI_ISP_LSC_GRID_POINTS];
  145. HI_U16 au16B_Gain[HI_ISP_LSC_GRID_POINTS];
  146. } ISP_LSC_CABLI_TABLE_S;
  147. typedef struct hiISP_CMOS_LSC_S
  148. {
  149. HI_U8 u8MeshScale;
  150. ISP_LSC_CABLI_TABLE_S astLscCalibTable[2];
  151. } ISP_CMOS_LSC_S;
  152. typedef struct hiISP_RLSC_CABLI_TABLE_S
  153. {
  154. HI_U16 u16WBRGain;
  155. HI_U16 u16WBBGain;
  156. HI_U16 au16R_Gain[HI_ISP_RLSC_POINTS];
  157. HI_U16 au16Gr_Gain[HI_ISP_RLSC_POINTS];
  158. HI_U16 au16Gb_Gain[HI_ISP_RLSC_POINTS];
  159. HI_U16 au16B_Gain[HI_ISP_RLSC_POINTS];
  160. } ISP_RLSC_CABLI_TABLE_S;
  161. typedef struct hiISP_CMOS_RLSC_S
  162. {
  163. HI_U8 u8Scale;
  164. HI_U16 u16CenterRX;
  165. HI_U16 u16CenterRY;
  166. HI_U16 u16CenterGrX;
  167. HI_U16 u16CenterGrY;
  168. HI_U16 u16CenterGbX;
  169. HI_U16 u16CenterGbY;
  170. HI_U16 u16CenterBX;
  171. HI_U16 u16CenterBY;
  172. HI_U16 u16OffCenterR;
  173. HI_U16 u16OffCenterGr;
  174. HI_U16 u16OffCenterGb;
  175. HI_U16 u16OffCenterB;
  176. ISP_RLSC_CABLI_TABLE_S stLscCalibTable[3];
  177. } ISP_CMOS_RLSC_S;
  178. typedef struct hiISP_CMOS_CA_S
  179. {
  180. HI_BOOL bEnable;
  181. HI_U32 au32YRatioLut[HI_ISP_CA_YRATIO_LUT_LENGTH]; //1.10bit Y Ratio For UV ; Max = 2047 FW Limit
  182. HI_S16 as16ISORatio[ISP_AUTO_ISO_STRENGTH_NUM]; //1.10bit ISO Ratio For UV ,Max = 2047 FW Limi
  183. HI_BOOL bCpEnable;
  184. HI_U32 au32YRatioLUTY[HI_ISP_CA_YRATIO_LUT_LENGTH];
  185. HI_U32 au32YRatioLUTU[HI_ISP_CA_YRATIO_LUT_LENGTH];
  186. HI_U32 au32YRatioLUTV[HI_ISP_CA_YRATIO_LUT_LENGTH];
  187. } ISP_CMOS_CA_S;
  188. typedef struct hiISP_CMOS_CLUT_S
  189. {
  190. HI_BOOL bEnable;
  191. HI_U32 u32GainR;
  192. HI_U32 u32GainG;
  193. HI_U32 u32GainB;
  194. ISP_CLUT_LUT_S stClutLut;
  195. } ISP_CMOS_CLUT_S;
  196. typedef struct hiISP_CMOS_SPLIT_POINT_S
  197. {
  198. HI_U8 u8X; /*RW;Range:[0x0,0x81];Format:8.0;The X point of the knee */
  199. HI_U16 u16Y; /*RW;Range:[0x0,0x8000];Format:16.0;The Y point of the knee */
  200. } ISP_CMOS_SPLIT_POINT_S;
  201. typedef struct hiISP_CMOS_SPLIT_S
  202. {
  203. HI_BOOL bEnable; /*RW;Range:[0x0,0x1];Format:1.0;*/
  204. HI_U8 u8InputWidthSel; /*RW;Range:[0x0,0x3];Format:2.0;Inputwidthselect: 0=12bit; 1=14bit; 2=16bit; */
  205. HI_U8 u8ModeIn; /*RW;Range:[0x0,0x3];Format:2.0;ModeIn: 0=linear; 2=16LOG; 3=sensor-built-in*/
  206. HI_U8 u8ModeOut; /*RW;Range:[0x0,0x3];Format:2.0;ModeOut: 0= 16bit when decompress; 1=2chn ; 2=3chn; */
  207. HI_U32 u32BitDepthOut; /*RW;Range:[0xC,0x14];Format:5.0;The Bit depth of output */
  208. ISP_CMOS_SPLIT_POINT_S astSplitPoint[ISP_SPLIT_POINT_NUM];
  209. } ISP_CMOS_SPLIT_S;
  210. typedef struct hiISP_CMOS_GE_S
  211. {
  212. HI_BOOL bEnable; /*RW,Range: [ 0, 1] */
  213. HI_U8 u8Slope; /*RW,Range: [ 0, 0xE] */
  214. HI_U8 u8SensiSlope; /*RW,Range: [ 0, 0xE] */
  215. HI_U16 u16SensiThr; /*RW,Range: [ 0, 0x3FFF] */
  216. HI_U16 au16Threshold[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW,Range: [ 0, 0x3FFF] */
  217. HI_U16 au16Strength[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW,Range: [ 0, 0x100] */
  218. HI_U16 au16NpOffset[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW,Range: [0x200, 0x3FFF] */
  219. } ISP_CMOS_GE_S;
  220. typedef struct hiISP_CMOS_ANTIFALSECOLOR_S
  221. {
  222. HI_BOOL bEnable; /*RW;Range:[0x0,0x1];Format:1.0; AntiFalseColor Enable*/
  223. HI_U8 au8AntiFalseColorThreshold[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW;Range:[0x0,0x20];Format:6.0;Threshold for antifalsecolor */
  224. HI_U8 au8AntiFalseColorStrength[ISP_AUTO_ISO_STRENGTH_NUM]; /*RW;Range:[0x0,0x1F];Format:5.0;Strength of antifalsecolor */
  225. } ISP_CMOS_ANTIFALSECOLOR_S;
  226. typedef struct hiISP_CMOS_LDCI_S
  227. {
  228. HI_BOOL bEnable;
  229. HI_U8 u8GaussLPFSigma;
  230. HI_U8 au8HePosWgt[ISP_AUTO_ISO_STRENGTH_NUM];
  231. HI_U8 au8HePosSigma[ISP_AUTO_ISO_STRENGTH_NUM];
  232. HI_U8 au8HePosMean[ISP_AUTO_ISO_STRENGTH_NUM];
  233. HI_U8 au8HeNegWgt[ISP_AUTO_ISO_STRENGTH_NUM];
  234. HI_U8 au8HeNegSigma[ISP_AUTO_ISO_STRENGTH_NUM];
  235. HI_U8 au8HeNegMean[ISP_AUTO_ISO_STRENGTH_NUM];
  236. HI_U16 au16BlcCtrl[ISP_AUTO_ISO_STRENGTH_NUM];
  237. } ISP_CMOS_LDCI_S;
  238. typedef struct hiISP_CMOS_PRELOGLUT_S
  239. {
  240. HI_U32 au32PreLogLUT[PRE_LOG_LUT_SIZE];
  241. } ISP_CMOS_PRELOGLUT_S;
  242. typedef struct hiISP_CMOS_LOGLUT_S
  243. {
  244. HI_U32 au32LogLUT[LOG_LUT_SIZE];
  245. } ISP_CMOS_LOGLUT_S;
  246. typedef struct hiISP_CMOS_SENSOR_MODE_S
  247. {
  248. HI_U32 u32SensorID;
  249. HI_U8 u8SensorMode;
  250. HI_BOOL bValidDngRawFormat;
  251. DNG_RAW_FORMAT_S stDngRawFormat;
  252. } ISP_CMOS_SENSOR_MODE_S;
  253. typedef struct hiISP_CMOS_DNG_COLORPARAM_S
  254. {
  255. ISP_DNG_WBGAIN_S stWbGain1;/*the calibration White balance gain of colorcheker in A Light*/
  256. ISP_DNG_WBGAIN_S stWbGain2;/*the calibration White balance gain of colorcheker in D50 Light*/
  257. } ISP_CMOS_DNG_COLORPARAM_S;
  258. typedef union hiISP_CMOS_ALG_KEY_U
  259. {
  260. HI_U64 u64Key;
  261. struct
  262. {
  263. HI_U64 bit1Drc : 1 ; /* [0] */
  264. HI_U64 bit1Demosaic : 1 ; /* [1] */
  265. HI_U64 bit1PreGamma : 1 ; /* [2] */
  266. HI_U64 bit1Gamma : 1 ; /* [3] */
  267. HI_U64 bit1Sharpen : 1 ; /* [4] */
  268. HI_U64 bit1EdgeMark : 1 ; /* [5] */
  269. HI_U64 bit1Ldci : 1 ; /* [6] */
  270. HI_U64 bit1Dpc : 1 ; /* [7] */
  271. HI_U64 bit1Lsc : 1 ; /* [8] */
  272. HI_U64 bit1RLsc : 1 ; /* [9] */
  273. HI_U64 bit1Ge : 1 ; /* [10] */
  274. HI_U64 bit1AntiFalseColor : 1 ; /* [11] */
  275. HI_U64 bit1BayerNr : 1 ; /* [12] */
  276. HI_U64 bit1Split : 1 ; /* [13] */
  277. HI_U64 bit1Ca : 1 ; /* [14] */
  278. HI_U64 bit1Clut : 1 ; /* [15] */
  279. HI_U64 bit1LogLUT : 1 ; /* [16] */
  280. HI_U64 bit1PreLogLUT : 1 ; /* [17] */
  281. HI_U64 bit1Wdr : 1 ; /* [18] */
  282. HI_U64 bit45Rsv : 45; /* [19:63] */
  283. };
  284. } ISP_CMOS_ALG_KEY_U;
  285. typedef struct hiISP_CMOS_DEFAULT_S
  286. {
  287. ISP_CMOS_ALG_KEY_U unKey;
  288. const ISP_CMOS_DRC_S *pstDrc;
  289. const ISP_CMOS_DEMOSAIC_S *pstDemosaic;
  290. const ISP_CMOS_PREGAMMA_S *pstPreGamma;
  291. const ISP_CMOS_GAMMA_S *pstGamma;
  292. const ISP_CMOS_SHARPEN_S *pstSharpen;
  293. const ISP_CMOS_EDGEMARK_S *pstEdgeMark;
  294. const ISP_CMOS_LDCI_S *pstLdci;
  295. const ISP_CMOS_DPC_S *pstDpc;
  296. const ISP_CMOS_LSC_S *pstLsc;
  297. const ISP_CMOS_RLSC_S *pstRLsc;
  298. const ISP_CMOS_GE_S *pstGe;
  299. const ISP_CMOS_ANTIFALSECOLOR_S *pstAntiFalseColor;
  300. const ISP_CMOS_BAYERNR_S *pstBayerNr;
  301. const ISP_CMOS_SPLIT_S *pstSplit;
  302. const ISP_CMOS_CA_S *pstCa;
  303. const ISP_CMOS_CLUT_S *pstClut;
  304. const ISP_CMOS_LOGLUT_S *pstLogLUT;
  305. const ISP_CMOS_PRELOGLUT_S *pstPreLogLUT;
  306. const ISP_CMOS_WDR_S *pstWdr;
  307. ISP_CMOS_NOISE_CALIBRATION_S stNoiseCalibration;
  308. ISP_CMOS_SENSOR_MAX_RESOLUTION_S stSensorMaxResolution;
  309. ISP_CMOS_SENSOR_MODE_S stSensorMode;
  310. ISP_CMOS_DNG_COLORPARAM_S stDngColorParam;
  311. } ISP_CMOS_DEFAULT_S;
  312. typedef struct hiISP_CMOS_SENSOR_IMAGE_MODE_S
  313. {
  314. HI_U16 u16Width;
  315. HI_U16 u16Height;
  316. HI_FLOAT f32Fps;
  317. HI_U8 u8SnsMode;
  318. } ISP_CMOS_SENSOR_IMAGE_MODE_S;
  319. typedef struct hiISP_SENSOR_EXP_FUNC_S
  320. {
  321. HI_VOID(*pfn_cmos_sensor_init)(VI_PIPE ViPipe);
  322. HI_VOID(*pfn_cmos_sensor_exit)(VI_PIPE ViPipe);
  323. HI_VOID(*pfn_cmos_sensor_global_init)(VI_PIPE ViPipe);
  324. HI_S32 (*pfn_cmos_set_image_mode)(VI_PIPE ViPipe, ISP_CMOS_SENSOR_IMAGE_MODE_S *pstSensorImageMode);
  325. HI_S32 (*pfn_cmos_set_wdr_mode)(VI_PIPE ViPipe, HI_U8 u8Mode);
  326. /* the algs get data which is associated with sensor, except 3a */
  327. HI_S32(*pfn_cmos_get_isp_default)(VI_PIPE ViPipe, ISP_CMOS_DEFAULT_S *pstDef);
  328. HI_S32(*pfn_cmos_get_isp_black_level)(VI_PIPE ViPipe, ISP_CMOS_BLACK_LEVEL_S *pstBlackLevel);
  329. HI_S32(*pfn_cmos_get_sns_reg_info)(VI_PIPE ViPipe, ISP_SNS_REGS_INFO_S *pstSnsRegsInfo);
  330. /* the function of sensor set pixel detect */
  331. HI_VOID(*pfn_cmos_set_pixel_detect)(VI_PIPE ViPipe, HI_BOOL bEnable);
  332. } ISP_SENSOR_EXP_FUNC_S;
  333. typedef struct hiISP_SENSOR_REGISTER_S
  334. {
  335. ISP_SENSOR_EXP_FUNC_S stSnsExp;
  336. } ISP_SENSOR_REGISTER_S;
  337. #ifdef __cplusplus
  338. #if __cplusplus
  339. }
  340. #endif
  341. #endif /* End of #ifdef __cplusplus */
  342. #endif /*__HI_COMM_SNS_H__ */