stfctl_isp_ae.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /**
  2. ******************************************************************************
  3. * @file stfctl_isp_ae.h
  4. * @author StarFive Isp Team
  5. * @version V1.0
  6. * @date 05/26/2020
  7. * @brief
  8. ******************************************************************************
  9. * @copy
  10. *
  11. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  12. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  13. * TIME. AS A RESULT, STARFIVE SHALL NOT BE HELD LIABLE FOR ANY
  14. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  15. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  16. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  17. *
  18. * Copyright (C) 2019 - 2022 StarFive Technology Co., Ltd.
  19. */
  20. #ifndef __STFCTL_ISP_AE_H__
  21. #define __STFCTL_ISP_AE_H__
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #include "ISPC/stflib_isp_sensor.h"
  26. /* auto exposure control parameters structure */
  27. //-----------------------------------------------------------------------------
  28. // Define initial values
  29. #define AE_WEIGHT_SUM_Y_OFFSET (0x0084)
  30. #define AE_HIST_R_OFFSET (0x4000)
  31. #define AE_HIST_G_OFFSET (0x4004)
  32. #define AE_HIST_B_OFFSET (0x4200)
  33. #define AE_HIST_Y_OFFSET (0x4204)
  34. #define AE_HIST_BIN_MAX (64)
  35. #define AE_WT_TBL_COL_MAX (16)
  36. #define AE_WT_TBL_ROW_MAX (16)
  37. #define AE_WT_TBL_ITEM_MAX (AE_WT_TBL_ROW_MAX * AE_WT_TBL_COL_MAX)
  38. #define EXPO_LOCK_ITEM_MAX (16)
  39. #define DAMPING_BUFFER_SIZE (10)
  40. #define SAT_WT_TBL_ITEM_MAX (32)
  41. #if 0
  42. #define ISP_DEF_AE_TARGET_B (80)
  43. #elif 1
  44. #define ISP_DEF_AE_TARGET_B (75)
  45. #endif
  46. #if 0
  47. #define ISP_DEF_AT_TARGET_BRACKET (255 * 0.125) // roundup(255 * 0.125)
  48. #elif 1
  49. // 20201229_v01
  50. #define ISP_DEF_AT_TARGET_BRACKET (255 * 0.10) // roundup(255 * 0.10)
  51. #endif
  52. #if 0
  53. #define ISP_DEF_AE_OVER_SAT_COMP_T0 (0x04)
  54. #define ISP_DEF_AE_OVER_SAT_COMP_T1 (0x30)
  55. #define ISP_DEF_AE_OVER_SAT_COMP_MAX (60)
  56. #elif 0
  57. // 20201229_v01
  58. #define ISP_DEF_AE_OVER_SAT_COMP_T0 (255 * 0.0157) // 4
  59. #define ISP_DEF_AE_OVER_SAT_COMP_T1 (255 * 0.09) // 23
  60. #define ISP_DEF_AE_OVER_SAT_COMP_MAX (40)
  61. #elif 1
  62. // 20210103_v01
  63. #define ISP_DEF_AE_OVER_SAT_COMP_T0 (255 * 0.0157) // 4
  64. #define ISP_DEF_AE_OVER_SAT_COMP_T1 (255 * 0.07) // 18
  65. #define ISP_DEF_AE_OVER_SAT_COMP_MAX (40)
  66. #endif
  67. #define ISP_DEF_AE_UNDER_SAT_COMP_T0 (0x08)
  68. #define ISP_DEF_AE_UNDER_SAT_COMP_T1 (0x10)
  69. #define ISP_DEF_AE_UNDER_SAT_COMP_MAX (0)
  70. #if 0
  71. #define ISP_DEF_AE_GAIN_STEP (0x0180)
  72. #elif 0
  73. #define ISP_DEF_AE_GAIN_STEP (0x0130)
  74. #else
  75. #define ISP_DEF_AE_GAIN_STEP (0x0110)
  76. #endif
  77. #define ISP_DEF_AE_RISING_COARSE_THRESHOLD (4.0)
  78. #define ISP_DEF_AE_FALLING_COARSE_THRESHOLD (2.0)
  79. #define ISP_DEF_AE_COARSE_SPEED (0.5)
  80. #define ISP_DEF_AE_COARSE_DEC_BASE (0x100 * 1 / 2)
  81. #define ISP_DEF_AE_INIT_EV (33333)
  82. #if 0
  83. #define ISP_DEF_AE_EXPOSURE_MAX (100000)
  84. #elif 1
  85. #define ISP_DEF_AE_EXPOSURE_MAX (200000)
  86. #endif
  87. #if 0
  88. #define ISP_DEF_AE_GAIN_MAX (128.0)
  89. #elif 0
  90. // 20201229_v01
  91. #define ISP_DEF_AE_GAIN_MAX (64.0)
  92. #elif 1
  93. // 20210104_v01
  94. #define ISP_DEF_AE_GAIN_MAX (16.0)
  95. #endif
  96. #define ISP_DEF_EXPECT_ADC_MAX (2.0)
  97. #define ISP_DEF_EXPO_LOCK_FREQ (0)
  98. #define ISP_DEF_ISO_LEVEL_0 (1.0)
  99. #define ISP_DEF_ISO_LEVEL_1 (2.0)
  100. #define ISP_DEF_ISO_LEVEL_2 (4.0)
  101. #define ISP_DEF_ISO_LEVEL_3 (8.0)
  102. #define ISP_DEF_ISO_LEVEL_4 (16.0)
  103. #define ISP_DEF_ISO_LEVEL_5 (32.0)
  104. #define ISP_DEF_ISO_LEVEL_6 (64.0)
  105. #define ISP_DEF_ISO_LEVEL_7 (128.0)
  106. #define ISP_DEF_ISO_LEVEL_8 (256.0)
  107. #define ISP_DEF_ISO_LEVEL_9 (512.0)
  108. #pragma pack(push, 1)
  109. typedef enum _EN_AE_STABLE_METHOD {
  110. EN_AE_STABLE_METHOD_SMALL_GAIN = 0,
  111. EN_AE_STABLE_METHOD_BRACKET,
  112. EN_AE_STABLE_METHOD_MAX
  113. } EN_AE_STABLE_METHOD, *PEN_AE_STABLE_METHOD;
  114. typedef enum _EN_EXPO_LOCK_FREQ {
  115. EN_EXPO_LOCK_FREQ_50 = 0,
  116. EN_EXPO_LOCK_FREQ_60,
  117. EN_EXPO_LOCK_FREQ_MAX
  118. } EN_EXPO_LOCK_FREQ, *PEN_EXPO_LOCK_FREQ;
  119. typedef enum _EN_TARGET_DIR {
  120. EN_TARGET_DIR_DEC = -1,
  121. EN_TARGET_DIR_STABLE = 0,
  122. EN_TARGET_DIR_INC = 1,
  123. } EN_TARGET_DIR, *PEN_TARGET_DIR;
  124. typedef enum _EN_SAT_WT_TBL_IDX {
  125. EN_SAT_WT_TBL_IDX_OVER = 0,
  126. EN_SAT_WT_TBL_IDX_UNDER,
  127. } EN_SAT_WT_TBL_IDX, *PEN_SAT_WT_TBL_IDX;
  128. #define EN_SAT_WT_TBL_IDX_MAX (EN_SAT_WT_TBL_IDX_UNDER + 1)
  129. typedef struct _ST_SAT_COMP_CRV {
  130. STF_U8 u8T0; /** Threshold 0. */
  131. STF_U8 u8T1; /** Threshold 1. */
  132. STF_U8 u8BrightnessMax; /** Maximum compensation value. */
  133. } ST_SAT_COMP_CRV, *PST_SAT_COMP_CRV;
  134. typedef struct _ST_EXPO_LOCK {
  135. STF_U32 u32ExpoValue; /** Exposure value. */
  136. STF_U32 u32SnrExpoTime; /** Sensor exposure time. */
  137. } ST_EXPO_LOCK, *PST_EXPO_LOCK;
  138. typedef struct _ST_EXPO_LOCK_TBL {
  139. STF_U8 u8ExpoLockCnt; /** Exposure lock table entry count. It depends on how many exposure lock item will be loading and using. */
  140. ST_EXPO_LOCK stExpoLock[EXPO_LOCK_ITEM_MAX]; /** Exposure time lock tables. */
  141. } ST_EXPO_LOCK_TBL, *PST_EXPO_LOCK_TBL;
  142. typedef struct _ST_CTL_AE_SETTING {
  143. //-------------------------------------------------------------------------
  144. // This section parameters value is assign from setting file.
  145. STF_BOOL8 bEnable; /** Enable/Disable auto exposure time and gain control. */
  146. STF_U8 u8TargetBrightness; /** Target brightness values 0-255. */
  147. STF_U8 u8TargetBracket; /** Target bracket value 0-255. Margin around the target brightness which we will consider as a proper exposure (no changes in the exposure settings will be carried out). */
  148. STF_U8 u8AeWeightTbl[AE_WT_TBL_ROW_MAX][AE_WT_TBL_COL_MAX]; /** Brightness measurement weight table. */
  149. STF_U16 u16ExpoGainStep; /** Maximum gain change step, format 0.8.8. The exposure gain change range is +/-u16ExpoGainStep. */
  150. STF_U32 u32AeExposureMax; /** The AE exposure time(us) maximum limit. */
  151. STF_DOUBLE dAeGainMax; /** The AE gain maximum limit. */
  152. STF_DOUBLE dAeAdcMax; /** The AE digital gain maximum value. */
  153. STF_U8 u8ExpoLockFreq; /** Exposure lock frequency. 0: 50Hz, and 1: 60Hz. */
  154. ST_EXPO_LOCK_TBL stExpoLockTbl[EN_EXPO_LOCK_FREQ_MAX]; /** Exposure lock tables,
  155. * first exposure lock table is for 50Hz,
  156. * the second exposure lock table is for 60Hz,
  157. * maximum exposure lock item is 16.
  158. */
  159. STF_DOUBLE dRisingCoarseThreshold; /** EV threshold value for AE into rising coarse mode. Range from 1.1 to 16.0. */
  160. STF_DOUBLE dFallingCoarseThreshold; /** EV threshold value for AE into falling coarse mode. Range from 1.1 to 3.0. */
  161. STF_DOUBLE dCoarseSpeed; /** AE update speed on coarse mode. 0.1 is the slowest and the 1.0 is the fastest. */
  162. ST_SAT_COMP_CRV stOverSatCompCurve; /** Over saturation compensation curve, it's using for brightness value compensation. */
  163. ST_SAT_COMP_CRV stUnderSatCompCurve; /** Under saturation compensation curve, it's using for brightness value compensation. */
  164. STF_U8 u8OverSatWeightTbl[SAT_WT_TBL_ITEM_MAX]; /** Saturation measurement weight table. */
  165. STF_U8 u8UnderSatWeightTbl[SAT_WT_TBL_ITEM_MAX]; /** Saturation measurement weight table. */
  166. } ST_CTL_AE_SETTING, *PST_CTL_AE_SETTING;
  167. typedef struct _ST_CTL_AE_INFO {
  168. STF_U32 u32ExpectSnrExpo; /** The expect sensor exposure time in microseconds. */
  169. STF_DOUBLE dExpectSnrAgc; /** The expect sensor analog gain value. */
  170. STF_DOUBLE dExpectAdc; /** The expect digital gain value, this digital gain will be used on AWB module. */
  171. STF_U8 u8CurrentBrightness; /** The latest brightness value. */
  172. STF_U8 u8YOverPer; /** Measure over saturation percentage on Y channel, range 0-255(100%).*/
  173. STF_U8 u8YUnderPer; /** Measure under saturation percentage on Y channel, range 0-255(100%).*/
  174. STF_U8 u8OverOffset; /** Over saturation compensation value. */
  175. STF_U8 u8UnderOffset; /** Under saturation compensation value. */
  176. STF_U32 u32CurrentEV; /** The latest exposure value in microseconds. */
  177. STF_U32 u32ExpectEV; /** The expect exposure value in microseconds. */
  178. STF_U32 u32ActualSnrExpo; /** The actually program to sensor exposure time. */
  179. STF_DOUBLE dActualSnrAgc; /** The actually program to sensor analog gain. */
  180. } ST_CTL_AE_INFO, *PST_CTL_AE_INFO;
  181. typedef struct _ST_CTL_AE_PARAM {
  182. ST_CTL_AE_SETTING stSetting; /** Control AE setting file parameters. */
  183. //-------------------------------------------------------------------------
  184. ST_CTL_AE_INFO stInfo; /** Control AE output information parameters. */
  185. //-------------------------------------------------------------------------
  186. // This section parameters is internal using.
  187. STF_S8 s8TargetDirection; /** Indicated the direction of current brightness to target brightness. 0: stable, 1:current brightness less than the target brightness, -1:current brightness large than the target brightness. */
  188. STF_U32 u32AeTotalWeight; /** Weight sum. */
  189. STF_U32 u32SubWinPixelCnt; /** AE sub-window pixel count. */
  190. STF_U8 u8MeasureBrightness; /** Measure brightness, it's the 16x16 AE window brightness, values 0-255. */
  191. STF_U8 u8ROverPer; /** Measure over saturation percentage on R channel, range 0-255(100%).*/
  192. STF_U8 u8RUnderPer; /** Measure under saturation percentage on R channel, range 0-255(100%).*/
  193. STF_U8 u8GOverPer; /** Measure over saturation percentage on G channel, range 0-255(100%).*/
  194. STF_U8 u8GUnderPer; /** Measure under saturation percentage on G channel, range 0-255(100%).*/
  195. STF_U8 u8BOverPer; /** Measure over saturation percentage on B channel, range 0-255(100%).*/
  196. STF_U8 u8BUnderPer; /** Measure under saturation percentage on B channel, range 0-255(100%).*/
  197. STF_U16 u16ExpoGain; /** The exposure gain, format 0.8.8. */
  198. STF_U8 u8DampingBuf[DAMPING_BUFFER_SIZE]; /** The brightness damping buffer. */
  199. STF_U8 u8DampCnt; /** Indicate how many brightness value in damping buffer. */
  200. STF_U8 u8DampIdx; /** Indicate the next brightness value insert position. */
  201. STF_U32 u32SnrExposureMin; /** Sensor support minimum exposure time value. It's read from sensor driver. */
  202. STF_U32 u32SnrExposureMax; /** Sensor support maximum exposure time value. It's read from sensor driver. */
  203. STF_DOUBLE dSnrGainMin; /** Sensor support minimum analog gain value. It's read from sensor driver. */
  204. STF_DOUBLE dSnrGainMax; /** Sensor support maximum analog gain value. It's read from sensor driver. */
  205. STF_U32 u32SnrExposureBackup; /** Backup the exposure time value of sensor. */
  206. STF_DOUBLE dSnrGainBackup; /** Backup the gain value of sensor. */
  207. STF_U32 u32NextFrameSnrExposure; /** Next frame program to sensor exposure time value. */
  208. STF_DOUBLE dNextFrameSnrGain; /** BNext frame program to sensor gain value. */
  209. EN_EXPO_GAIN_METHOD enExposureGainMethod; /** Indicate the exposure time and gain program method. */
  210. STF_DOUBLE dIsoStep[ISO_LEVEL_MAX]; /** ISO level AGC gain value. */
  211. STF_U8 u8IsoLevel; /** Indicate the current ISO level value. */
  212. STF_DOUBLE dIsoFactor; /** ISO factor for adaptive control interpolation. */
  213. ST_SENSOR *pstSensor; /** A pointer to a Sensor object which serves as interface to configure the physical sensor. */
  214. } ST_CTL_AE_PARAM, *PST_CTL_AE_PARAM;
  215. #define ST_CTL_AE_SETTING_LEN (sizeof(ST_CTL_AE_SETTING))
  216. #define ST_CTL_AE_INFO_LEN (sizeof(ST_CTL_AE_INFO))
  217. #define ST_CTL_AE_GET_PARAM_LEN (ST_CTL_AE_SETTING_LEN + ST_CTL_AE_INFO_LEN)
  218. #define ST_CTL_AE_SET_PARAM_LEN (ST_CTL_AE_SETTING_LEN)
  219. //#define ST_CTL_AE_PARAM_SIZE (sizeof(ST_CTL_AE_PARAM) - sizeof(ST_SENSOR *))
  220. #define ST_CTL_AE_PARAM_SIZE (sizeof(ST_CTL_AE_PARAM))
  221. #define ST_CTL_AE_PARAM_LEN (ST_CTL_AE_PARAM_SIZE)
  222. typedef struct _ST_ISP_CTL_AE {
  223. #if defined(VIRTUAL_IO_MAPPING)
  224. STF_VOID *pPipeline; /** Pointer to Pipeline. */
  225. #endif //VIRTUAL_IO_MAPPING
  226. STF_VOID *pIspCtx; /** Pointer to ISP context. */
  227. STF_U32 u32Id; /** Control ID. */
  228. STF_CHAR szName[16]; /** Control Name. */
  229. //STF_VOID *pstCtlAeRdma; /** AE's control RDMA structure pointer. */
  230. ST_CTL_AE_PARAM *pstCtlAeParam; /** AE's control parameters structure pointer. */
  231. STF_BOOL8 bRegistered; /** Control register in pipeline. */
  232. STF_S32 (*Init)(STF_VOID *pIspCtx);
  233. STF_S32 (*LoadBinParam)(STF_VOID *pIspCtx, STF_U8 *pu8ParamBuf, STF_U16 u16ParamSize);
  234. STF_S32 (*Enable)(STF_VOID *pIspCtx, STF_BOOL8 bEnable);
  235. STF_BOOL8 (*IsEnable)(STF_VOID *pIspCtx);
  236. STF_S32 (*Registered)(STF_VOID *pIspCtx, STF_BOOL8 bRegistered);
  237. STF_BOOL8 (*IsRegistered)(STF_VOID *pIspCtx);
  238. STF_S32 (*Calculate)(STF_VOID *pIspCtx);
  239. STF_S32 (*FreeResource)(STF_VOID *pIspCtx);
  240. STF_S32 (*GetIqParam)(STF_VOID *pIspCtx, STF_VOID *pParamBuf, STF_U16 *pu16ParamSize);
  241. STF_S32 (*SetIqParam)(STF_VOID *pIspCtx, STF_VOID *pParamBuf, STF_U16 u16ParamSize);
  242. } ST_ISP_CTL_AE, *PST_ISP_CTL_AE;
  243. #pragma pack(pop)
  244. /* auto exposure control parameters interface */
  245. //-----------------------------------------------------------------------------
  246. extern
  247. STF_S32 STFCTL_ISP_AE_CalcTotalWeight(
  248. STF_U32 *pu32W,
  249. STF_U8 *pu8Tbl
  250. );
  251. //-----------------------------------------------------------------------------
  252. extern
  253. STF_S32 STFCTL_ISP_AE_ResetDampingCtrl(
  254. ST_ISP_CTL_AE *pstCtlAe
  255. );
  256. extern
  257. STF_S32 STFCTL_ISP_AE_AddDampingElement(
  258. ST_ISP_CTL_AE *pstCtlAe,
  259. STF_U8 u8Brightness
  260. );
  261. extern
  262. STF_S32 STFCTL_ISP_AE_CalcDampingMedian(
  263. ST_ISP_CTL_AE *pstCtlAe,
  264. STF_U8 *pu8Brightbess
  265. );
  266. //-----------------------------------------------------------------------------
  267. extern
  268. STF_S32 STFCTL_ISP_AE_EvalScAeBrightness(
  269. STF_U8 *pu8Brightness,
  270. STF_U8 *pu8Tbl,
  271. STF_U32 u32TotalWeight,
  272. STF_U32 *pu32ScDumpingBuffer,
  273. STF_U32 u32SubWinPixCnt
  274. );
  275. extern
  276. STF_S32 STFCTL_ISP_AE_CalcHistYSat(
  277. STF_U8 *pu8YOver,
  278. STF_U8 *pu8YUnder,
  279. STF_U32 *pu32ScDumpingBuffer,
  280. STF_U8 u8OverSatWeightTbl[SAT_WT_TBL_ITEM_MAX],
  281. STF_U8 u8UnderSatWeightTbl[SAT_WT_TBL_ITEM_MAX]
  282. );
  283. extern
  284. STF_S32 STFCTL_ISP_AE_LookupSatCurve(
  285. STF_U8 *pu8BOffset,
  286. STF_U8 u8In,
  287. ST_SAT_COMP_CRV *pstSatCompCrv
  288. );
  289. extern
  290. STF_S32 STFCTL_ISP_AE_CalcBrightnessValue(
  291. ST_ISP_CTL_AE *pstCtlAe,
  292. STF_U8 *pu8CurrentBrightness,
  293. STF_U8 u8MeasureBrightness,
  294. STF_U8 u8YOverPer,
  295. STF_U8 u8YUnderPer
  296. );
  297. extern
  298. STF_S8 STFCTL_ISP_AE_CheckTargetDirection(
  299. ST_ISP_CTL_AE *pstCtlAe,
  300. STF_U8 u8CurrentBrightness
  301. );
  302. extern
  303. STF_S32 STFCTL_ISP_AE_CalcExpectEV(
  304. ST_ISP_CTL_AE *pstCtlAe,
  305. STF_U32 *pu32ExpectEV,
  306. STF_U8 u8NewBrightness
  307. );
  308. extern
  309. STF_S32 STFCTL_ISP_AE_CalcIsoFactor(
  310. ST_ISP_CTL_AE *pstCtlAe
  311. );
  312. //-----------------------------------------------------------------------------
  313. extern
  314. STF_S32 STFCTL_ISP_AE_SetExposureTimeAndGain(
  315. STF_VOID *pIspCtx,
  316. STF_U32 *pu32ActualSnrExpo,
  317. STF_DOUBLE *pdActualSnrAgc,
  318. STF_U32 u32ExpectSnrExpo,
  319. STF_DOUBLE dExpectSnrAgc
  320. );
  321. extern
  322. STF_S32 STFCTL_ISP_AE_SetExposureTime(
  323. STF_VOID *pIspCtx,
  324. STF_U32 *pu32ActualSnrExpo,
  325. STF_U32 u32ExpectSnrExpo
  326. );
  327. extern
  328. STF_S32 STFCTL_ISP_AE_SetGain(
  329. STF_VOID *pIspCtx,
  330. STF_DOUBLE *pdActualSnrAgc,
  331. STF_DOUBLE dExpectSnrAgc
  332. );
  333. extern
  334. STF_S32 STFCTL_ISP_AE_SetEV(
  335. ST_ISP_CTL_AE *pstCtlAe,
  336. STF_U32 u32EV,
  337. STF_BOOL8 bUpdateToSensor,
  338. STF_BOOL8 bIsInit
  339. );
  340. extern
  341. STF_S32 STFCTL_ISP_AE_SetEV_Step2(
  342. ST_ISP_CTL_AE *pstCtlAe
  343. );
  344. //-----------------------------------------------------------------------------
  345. extern
  346. STF_S32 STFCTL_ISP_AE_SetEnable(
  347. ST_ISP_CTL_AE *pstCtlAe,
  348. STF_BOOL8 bEnable
  349. );
  350. extern
  351. STF_S32 STFCTL_ISP_AE_SetTargetBrightness(
  352. ST_ISP_CTL_AE *pstCtlAe,
  353. STF_U8 u8TargetBrightness
  354. );
  355. extern
  356. STF_S32 STFCTL_ISP_AE_SetTargetBracket(
  357. ST_ISP_CTL_AE *pstCtlAe,
  358. STF_U8 u8TargetDirection
  359. );
  360. extern
  361. STF_S32 STFCTL_ISP_AE_SetTargetDirection(
  362. ST_ISP_CTL_AE *pstCtlAe,
  363. STF_S8 u8TargetDirection
  364. );
  365. extern
  366. STF_S32 STFCTL_ISP_AE_SetAeWeightingTable(
  367. ST_ISP_CTL_AE *pstCtlAe,
  368. STF_U8 u8AeWeightTbl[AE_WT_TBL_ITEM_MAX]
  369. );
  370. extern
  371. STF_S32 STFCTL_ISP_AE_SetExposureGainStep(
  372. ST_ISP_CTL_AE *pstCtlAe,
  373. STF_U16 u16ExpoGainStep
  374. );
  375. extern
  376. STF_S32 STFCTL_ISP_AE_SetRisingCoarseThreshold(
  377. ST_ISP_CTL_AE *pstCtlAe,
  378. STF_DOUBLE dCoarseThreshold
  379. );
  380. extern
  381. STF_S32 STFCTL_ISP_AE_SetFallingCoarseThreshold(
  382. ST_ISP_CTL_AE *pstCtlAe,
  383. STF_DOUBLE dCoarseThreshold
  384. );
  385. extern
  386. STF_S32 STFCTL_ISP_AE_SetCoarseSpeed(
  387. ST_ISP_CTL_AE *pstCtlAe,
  388. STF_DOUBLE dCoarseSpeed
  389. );
  390. extern
  391. STF_S32 STFCTL_ISP_AE_SetOverSaturationCompensationCurve(
  392. ST_ISP_CTL_AE *pstCtlAe,
  393. ST_SAT_COMP_CRV *pstOverSatCompCurve
  394. );
  395. extern
  396. STF_S32 STFCTL_ISP_AE_SetUnderSaturationCompensationCurve(
  397. ST_ISP_CTL_AE *pstCtlAe,
  398. ST_SAT_COMP_CRV *pstUnderSatCompCurve
  399. );
  400. extern
  401. STF_S32 STFCTL_ISP_AE_SetSatWeightingTable(
  402. ST_ISP_CTL_AE *pstCtlAe,
  403. EN_SAT_WT_TBL_IDX enSatWtTblIdx,
  404. STF_U8 u8SatWeightTbl[SAT_WT_TBL_ITEM_MAX]
  405. );
  406. extern
  407. STF_S32 STFCTL_ISP_AE_SetAeExposureMax(
  408. ST_ISP_CTL_AE *pstCtlAe,
  409. STF_U32 u32AeExposureMax
  410. );
  411. extern
  412. STF_S32 STFCTL_ISP_AE_SetAeGainMax(
  413. ST_ISP_CTL_AE *pstCtlAe,
  414. STF_DOUBLE dAeGainMax
  415. );
  416. extern
  417. STF_S32 STFCTL_ISP_AE_SetAeAdcMax(
  418. ST_ISP_CTL_AE *pstCtlAe,
  419. STF_DOUBLE dAeAdcMax
  420. );
  421. extern
  422. STF_S32 STFCTL_ISP_AE_SetExpoLockFreq(
  423. ST_ISP_CTL_AE *pstCtlAe,
  424. STF_U8 u8ExpoLockFreq
  425. );
  426. extern
  427. STF_S32 STFCTL_ISP_AE_SetExposureLockTable(
  428. ST_ISP_CTL_AE *pstCtlAe,
  429. STF_U8 u8ExpoLockFreq,
  430. ST_EXPO_LOCK stExpoLockTbl[],
  431. STF_U8 u8ExpoLockCnt
  432. );
  433. extern
  434. STF_S32 STFCTL_ISP_AE_SetIsoStep(
  435. ST_ISP_CTL_AE *pstCtlAe,
  436. STF_DOUBLE dIsoStep[]
  437. );
  438. extern
  439. STF_S32 STFCTL_ISP_AE_SetExposureAndGain(
  440. STF_VOID *pIspCtx,
  441. STF_U32 u32ExpectSnrExpo,
  442. STF_DOUBLE dExpectSnrAgc
  443. );
  444. extern
  445. STF_S32 STFCTL_ISP_AE_GetExposureAndGain(
  446. STF_VOID *pIspCtx,
  447. STF_U32 *pu32ActualSnrExpo,
  448. STF_DOUBLE *pdActualSnrAgc
  449. );
  450. extern
  451. STF_S32 STFCTL_ISP_AE_GetIsoInfo(
  452. STF_VOID *pIspCtx,
  453. STF_U8 *pu8IsoLevel,
  454. STF_DOUBLE *pdIsoFactor
  455. );
  456. //-----------------------------------------------------------------------------
  457. extern
  458. STF_S32 STFCTL_ISP_AE_Init(
  459. STF_VOID *pIspCtx
  460. );
  461. extern
  462. STF_S32 STFCTL_ISP_AE_LoadBinParam(
  463. STF_VOID *pIspCtx,
  464. STF_U8 *pu8ParamBuf,
  465. STF_U16 u16ParamSize
  466. );
  467. extern
  468. STF_S32 STFCTL_ISP_AE_Enable(
  469. STF_VOID *pIspCtx,
  470. STF_BOOL8 bEnable
  471. );
  472. extern
  473. STF_BOOL8 STFCTL_ISP_AE_IsEnable(
  474. STF_VOID *pIspCtx
  475. );
  476. extern
  477. STF_S32 STFCTL_ISP_AE_Registered(
  478. STF_VOID *pIspCtx,
  479. STF_BOOL8 bRegistered
  480. );
  481. extern
  482. STF_BOOL8 STFCTL_ISP_AE_IsRegistered(
  483. STF_VOID *pIspCtx
  484. );
  485. extern
  486. STF_S32 STFCTL_ISP_AE_Calculate(
  487. STF_VOID *pIspCtx
  488. );
  489. extern
  490. STF_S32 STFCTL_ISP_AE_FreeResource(
  491. STF_VOID *pIspCtx
  492. );
  493. extern
  494. STF_S32 STFCTL_ISP_AE_GetIqParam(
  495. STF_VOID *pIspCtx,
  496. STF_VOID *pParamBuf,
  497. STF_U16 *pu16ParamSize
  498. );
  499. extern
  500. STF_S32 STFCTL_ISP_AE_SetIqParam(
  501. STF_VOID *pIspCtx,
  502. STF_VOID *pParamBuf,
  503. STF_U16 u16ParamSize
  504. );
  505. //-----------------------------------------------------------------------------
  506. extern
  507. STF_S32 STFCTL_ISP_AE_Create(
  508. STF_VOID *pPipeline
  509. );
  510. extern
  511. STF_S32 STFCTL_ISP_AE_Destroy(
  512. STF_VOID *pPipeline
  513. );
  514. //-----------------------------------------------------------------------------
  515. #ifdef __cplusplus
  516. }
  517. #endif
  518. #endif //__STFCTL_ISP_AE_H__