• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_COMM_ISP_H__
17 #define __HI_COMM_ISP_H__
18 
19 #include "hi_type.h"
20 #include "hi_errno.h"
21 #include "hi_common.h"
22 #include "hi_comm_video.h"
23 #include "hi_isp_defines.h"
24 
25 #ifdef __cplusplus
26 #if __cplusplus
27 extern "C" {
28 #endif
29 #endif /* End of #ifdef __cplusplus */
30 
31 /* MACRO DEFINITION */
32 #define res_width_max(dev)              (isp_get_max_width(dev))
33 #define RES_WIDTH_MIN                   120
34 #define res_height_max(dev)             (isp_get_max_height(dev))
35 #define RES_HEIGHT_MIN                  120
36 #define ISP_ALIGN_WIDTH                 4
37 #define ISP_ALIGN_HEIGHT                4
38 #define FRAME_RATE_MAX                  65535.0
39 
40 #define ISP_BE_BUF_NUM_MAX              9
41 #define ISP_BE_BUF_NUM_MIN              2
42 
43 #define VREG_MAX_NUM                    16
44 
45 #define AWB_ZONE_ORIG_ROW               32
46 #define AWB_ZONE_ORIG_COLUMN            32
47 #define AWB_ZONE_BIN_MAX                 4
48 #define AE_ZONE_ROW                     15
49 #define AE_ZONE_COLUMN                  17
50 #define AE_PLANE_NUM                     4
51 #define MG_ZONE_ROW                     15
52 #define MG_ZONE_COLUMN                  17
53 #define AWB_ZONE_NUM                    (AWB_ZONE_ORIG_ROW * AWB_ZONE_ORIG_COLUMN * AWB_ZONE_BIN)
54 #define AWB_ZONE_STITCH_MAX             (AWB_ZONE_NUM * ISP_MAX_STITCH_NUM)
55 #define AF_ZONE_ROW                     15
56 #define AF_ZONE_COLUMN                  17
57 #define LIGHTSOURCE_NUM                 4
58 #define MAX_AWB_LIB_NUM                 (AWB_LIB_NUM)
59 #define MAX_AE_LIB_NUM                  (AE_LIB_NUM)
60 
61 #define AE_MIN_WIDTH                    256
62 #define AE_MIN_HEIGHT                   120
63 #define AWB_MIN_WIDTH                   60
64 #define AWB_MIN_HEIGHT                  14
65 #define AF_MIN_WIDTH                    256
66 #define AF_MIN_HEIGHT                   120
67 #define AF_ALIGN_WIDTH                  8
68 #define AF_ALIGN_HEIGHT                 2
69 #define AF_PLGS_NUM                     2
70 
71 #define GAMMA_NODE_NUM                  1025
72 #define PREGAMMA_NODE_NUM               257
73 
74 #define LCAC_STRENGTH_NUM               16
75 
76 #define ISP_AUTO_ISO_STRENGTH_NUM       16
77 #define ISP_SHARPEN_LUMA_NUM            32
78 #define ISP_SHARPEN_GAIN_NUM            32
79 
80 #define ISP_MAX_SNS_REGS                32
81 #define ISP_MAX_SNS_EXP_ADDR_NUM        3
82 
83 #define HI_ISP_RLSC_POINTS                129
84 #define HI_ISP_RLSC_DEFAULT_RADIAL_STR    4096
85 #define HI_ISP_RLSC_DEFAULT_SCALE         3
86 #define HI_ISP_RLSC_DEFAULT_MANUAL_WEIGHT 256
87 #define HI_ISP_RLSC_DEFAULT_WBGAIN        256
88 #define HI_ISP_RLSC_DEFAULT_LIGHT         0
89 #define HI_ISP_RLSC_WEIGHT_Q_BITS         8
90 #define HI_ISP_RLSC_GAIN_LUT_NUM          3
91 #define HI_ISP_RLSC_SCALE_NUM             14
92 #define HI_ISP_MLSC_X_HALF_GRID_NUM       ((HI_ISP_LSC_GRID_COL - 1) / 2)
93 #define HI_ISP_MLSC_Y_HALF_GRID_NUM       ((HI_ISP_LSC_GRID_ROW - 1) / 2)
94 #define HI_ISP_MLSC_GAIN_LUT_NUM          2
95 #define HI_ISP_ACS_LIGHT_NUM              32
96 #define HI_ISP_ACS_CCT_NUM                3
97 #define HI_ISP_ACS_HIST_NUM               10
98 #define HI_ISP_ACS_CHN_NUM                2
99 
100 #define ISP_VREG_SIZE_BIN               0x20000
101 #define ALG_LIB_VREG_SIZE_BIN           0x1000
102 #define WDR_MAX_FRAME_NUM               4
103 
104 #define ISP_HRS_NUM                     6
105 
106 #define ISP_CSC_DC_NUM                  3
107 #define ISP_CSC_COEF_NUM                9
108 
109 #define BAYER_CALIBTAION_MAX_NUM        50
110 #define HI_ISP_BAYERNR_STRENGTH_DIVISOR 100
111 #define HI_ISP_BAYERNR_CORINGLOW_STRENGTH_DIVISOR 10000
112 #define AI_MAX_STEP_FNO_NUM             1024
113 
114 #define ISP_BAS_TAPS_ROW_NUM            17
115 #define ISP_BAS_TAPS_COL_6              6
116 #define ISP_BAS_TAPS_COL_4              4
117 #define HI_ISP_BAYERNR_LUT_LENGTH       33
118 #define HI_ISP_BAYERNR_LMTLUTNUM        129
119 #define PRO_MAX_FRAME_NUM               8
120 #define ISP_RGB_CHN_NUM                 3
121 
122 #define HI_ISP_DEMOSAIC_LUT_LENGTH      17
123 #define ISP_BAYER_CHN_NUM               4
124 #define BAYER_CHN_R                     0
125 #define BAYER_CHN_GR                    1
126 #define BAYER_CHN_GB                    2
127 #define BAYER_CHN_B                     3
128 #define LDCI_LPF_LUT_SIZE               9
129 #define LDCI_HE_LUT_SIZE                33
130 #define LDCI_DE_USM_LUT_SIZE            33
131 #define LDCI_COLOR_GAIN_LUT_SIZE        65
132 #define LDCI_DE_LPF_H_COEF_NUM          3
133 #define LDCI_DE_LPF_V_COEF_NUM          2
134 #define LDCI_POLY_LUT_NUM               65
135 #define LDCI_PF_SFT_NUM                 4
136 #define LDCI_PF_PARA_NUM                2
137 #define LDCI_SM_WIDTH_NUM               3
138 
139 #define NOISESET_ELENUM                 7
140 
141 #define HI_ISP_DRC_CUBIC_POINT_NUM      5
142 #define HI_ISP_DRC_CC_NODE_NUM          33
143 #define HI_ISP_DRC_TM_NODE_NUM          200
144 #define HI_ISP_DRC_TM_SEG_NUM           8
145 #define HI_ISP_DRC_DT_CURVE_NODE_NUM    16
146 #define HI_ISP_DRC_BIN_MIX_NODE_NUM     8
147 #define HI_ISP_DRC_EXP_COMP_SAMPLE_NUM  8
148 #define HI_ISP_DRC_SHP_LOG_CONFIG_NUM   16
149 #define WDR_SIGMA_GAIN_NUM              3
150 
151 #define LOG_LUT_SIZE                    1025
152 #define PRE_LOG_LUT_SIZE                1025
153 #define DEHAZE_LUT_SIZE                 256
154 
155 #define HI_ISP_DE_LUMA_GAIN_LUT_N       17
156 #define ISP_EXP_RATIO_STRENGTH_NUM      16
157 #define ISP_LCAC_DET_NUM                3
158 
159 #define ISP_DO_NOT_NEED_SWITCH_IMAGEMODE (-2)
160 
161 /*  DEFAULT VALUE OF GLOBAL REGISTERS DEFINED HERE */
162 /*  AE  */
163 #define HI_ISP_TOP_RGGB_START_R_GR_GB_B           0
164 #define HI_ISP_TOP_RGGB_START_GR_R_B_GB           1
165 #define HI_ISP_TOP_RGGB_START_GB_B_R_GR           2
166 #define HI_ISP_TOP_RGGB_START_B_GB_GR_R           3
167 
168 #define HI_ISP_TOP_AE_SELECT_AFTER_DG             0
169 #define HI_ISP_TOP_AE_SELECT_AFTER_WB             1
170 #define HI_ISP_TOP_AE_SELECT_AFTER_DRC            2
171 
172 #define HI_ISP_AE_FOUR_PLANE_MODE_DISABLE         0
173 #define HI_ISP_AE_FOUR_PLANE_MODE_ENABLE          1
174 
175 /*  AWB */
176 #define HI_ISP_AWB_OFFSET_COMP_DEF                0
177 #define HI_ISP_CCM_COLORTONE_EN_DEFAULT           1
178 #define HI_ISP_CCM_COLORTONE_RGAIN_DEFAULT        256
179 #define HI_ISP_CCM_COLORTONE_BGAIN_DEFAULT        256
180 #define HI_ISP_CCM_COLORTONE_GGAIN_DEFAULT        256
181 
182 #define HI_ISP_CCM_PROT_EN_DEFAULT                0
183 #define HI_ISP_CCM_CC_THD0_DEFAULT                0
184 #define HI_ISP_CCM_CC_THD1_DEFAULT                0x1E
185 #define HI_ISP_CCM_CC_PROT_RATIO_DEFAULT          10
186 #define HI_ISP_CCM_RR_THD0_DEFAULT                0x1E
187 #define HI_ISP_CCM_RR_THD1_DEFAULT                0x64
188 #define HI_ISP_CCM_GG_THD0_DEFAULT                0x6
189 #define HI_ISP_CCM_GG_THD1_DEFAULT                0x3C
190 #define HI_ISP_CCM_BB_THD0_DEFAULT                0x1E
191 #define HI_ISP_CCM_BB_THD1_DEFAULT                0x64
192 #define HI_ISP_CCM_MAX_RGB_DEFAULT                0xC8
193 #define HI_ISP_CCM_RGB_PROT_RATIO_DEFAULT         10
194 #define HI_ISP_CCM_RECOVER_EN_DEFAULT             1
195 #define HI_ISP_CCM_LUM_RATIO_DEFAULT              256
196 #define HI_ISP_CCM_HUE_RATIO_DEFAULT              256
197 
198 #define ccm_convert_pre(value)  (((value) & 0x8000) | ((value) << 2))
199 #define ccm_convert(value)      (((value) & 0x8000) ? ((~((value) & 0x7FFF)) + 1) : (value))
200 
201 /* GENERAL STRUCTURES */
202 /*
203  * ISP Error Code
204  * 0x40 : ISP_NOT_INIT
205  * 0x41 : ISP_MEM_NOT_INIT
206  * 0x42 : ISP_ATTR_NOT_CFG
207  * 0x43 : ISP_SNS_UNREGISTER
208  * 0x44 : ISP_INVALID_ADDR
209  * 0x45 : ISP_NOMEM
210  * 0x46 : ISP_NO_INT
211  */
212 typedef enum hiISP_ERR_CODE_E {
213     ERR_ISP_NOT_INIT                = 0x40, /* ISP not init */
214     ERR_ISP_MEM_NOT_INIT            = 0x41, /* ISP memory not init */
215     ERR_ISP_ATTR_NOT_CFG            = 0x42, /* ISP attribute not cfg */
216     ERR_ISP_SNS_UNREGISTER          = 0x43, /* ISP sensor unregister */
217     ERR_ISP_INVALID_ADDR            = 0x44, /* ISP invalid address */
218     ERR_ISP_NOMEM                   = 0x45, /* ISP nomem */
219     ERR_ISP_NO_INT                  = 0x46, /* ISP */
220 } ISP_ERR_CODE_E;
221 
222 #define HI_ERR_ISP_NULL_PTR         HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
223 #define HI_ERR_ISP_ILLEGAL_PARAM    HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
224 #define HI_ERR_ISP_NOT_SUPPORT      HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
225 
226 #define HI_ERR_ISP_NOT_INIT         HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_NOT_INIT)
227 #define HI_ERR_ISP_MEM_NOT_INIT     HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_MEM_NOT_INIT)
228 #define HI_ERR_ISP_ATTR_NOT_CFG     HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_ATTR_NOT_CFG)
229 #define HI_ERR_ISP_SNS_UNREGISTER   HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_SNS_UNREGISTER)
230 #define HI_ERR_ISP_INVALID_ADDR     HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_INVALID_ADDR)
231 #define HI_ERR_ISP_NOMEM            HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_NOMEM)
232 #define HI_ERR_ISP_NO_INT           HI_DEF_ERR(HI_ID_ISP, EN_ERR_LEVEL_ERROR, ERR_ISP_NO_INT)
233 
234 /* Defines the structure of ISP module parameters. */
235 typedef struct hiISP_MOD_PARAM_S {
236     HI_U32 u32IntBotHalf;  /* RW;Range:[0, 1]; Format:32.0; Indicate ISP interrupt bottom half,No distinction vipipe */
237     HI_U32 u32QuickStart;  /* RW;Range:[0, 1]; Format:32.0; Indicate ISP Quick Start No distinction vipipe.
238                               Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
239     HI_BOOL  bLongFrmIntEn;    /* when wdr mode enable/disable long frame pipe interrupt.   */
240                                /* Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
241 } ISP_MOD_PARAM_S;
242 
243 /* Defines the structure of ISP control parameters. */
244 typedef struct hiISP_CTRL_PARAM_S {
245     HI_U8   u8BeBufNum;      /* RW;Range:[2, 9]; offline be cfg buffer number(Only used for offline mode).
246                                 Not support changed after isp init */
247     HI_U32  u32ProcParam;    /* RW;Format:32.0; Indicate the update frequency of ISP_PROC information,
248                                 No distinction vipipe */
249     HI_U32  u32StatIntvl;    /* RW;Range:(0, 0xffffffff];Format:32.0;
250                                 Indicate the time interval of ISP statistic information */
251     HI_U32  u32UpdatePos;    /* RW;Range:[0, 1]; Format:32.0; Indicate the location of the configuration register of
252                                 ISP interrupt */
253     HI_U32  u32IntTimeOut;   /* RW;Format:32.0; Indicate the time(unit:ms) of interrupt timeout */
254     HI_U32  u32PwmNumber;    /* R;Format:32.0; Indicate PWM number */
255     HI_U32  u32PortIntDelay; /* RW;Format:32.0; Port intertupt delay value, unit:clk */
256     HI_BOOL bLdciTprFltEn;   /* R;Indicate Enable LDCI temporal filter. Not support changed after isp init */
257 } ISP_CTRL_PARAM_S;
258 
259 /* Defines the working mode of ISP : 0 = automatic mode, 1 = manual mode */
260 typedef enum hiISP_OP_TYPE_E {
261     OP_TYPE_AUTO    = 0,
262     OP_TYPE_MANUAL  = 1,
263     OP_TYPE_BUTT
264 } ISP_OP_TYPE_E;
265 
266 /*
267  * Defines the prior frame of ISP
268  * 0 = long frame
269  * 1 = short frame
270  */
271 typedef enum hiISP_PRIOR_FRAME_E {
272     LONG_FRAME      = 0,
273     SHORT_FRAME       = 1,
274     PRIOR_FRAME_BUTT
275 } ISP_PRIOR_FRAME_E;
276 
277 /*
278  * Defines the ISP correction or detection status
279  * 0 = initial status, no calibration
280  * 1 = The static defect pixel calibration ends normally
281  * 2 = The static defect pixel calibration ends due to timeout.
282  */
283 typedef enum hiISP_STATE_E {
284     ISP_STATE_INIT     = 0,
285     ISP_STATE_SUCCESS  = 1,
286     ISP_STATE_TIMEOUT  = 2,
287     ISP_STATE_BUTT
288 } ISP_STATUS_E;
289 
290 typedef struct hiISP_PIPE_DIFF_ATTR_S {
291     HI_S32 as32Offset[ISP_BAYER_CHN_NUM];   /* RW;Range:[-4095, 4095];Format:12.0; Black level differences between the
292                                                offset value */
293     HI_U32 au32Gain[ISP_BAYER_CHN_NUM];     /* RW;Range:[0x80, 0x400];Format:4.8; The gain difference ratio */
294     HI_U16 au16ColorMatrix[CCM_MATRIX_SIZE]; /* RW;Range:[0x0, 0xFFFF];Format:8.8;
295                                                 Color correction matrix variance ratio */
296 } ISP_PIPE_DIFF_ATTR_S;
297 
298 /* Defines the format of the input Bayer image */
299 typedef enum hiISP_BAYER_FORMAT_E {
300     BAYER_RGGB    = 0,
301     BAYER_GRBG    = 1,
302     BAYER_GBRG    = 2,
303     BAYER_BGGR    = 3,
304     BAYER_BUTT
305 } ISP_BAYER_FORMAT_E;
306 
307 /* Defines the bitwidth of the input Bayer image, used for lsc online calibration */
308 typedef enum hiISP_BAYER_RAWBIT_E {
309     BAYER_RAWBIT_8BIT    = 8,
310     BAYER_RAWBIT_10BIT   = 10,
311     BAYER_RAWBIT_12BIT   = 12,
312     BAYER_RAWBIT_14BIT   = 14,
313     BAYER_RAWBIT_16BIT   = 16,
314     BAYER_RAWBIT_BUTT
315 } ISP_BAYER_RAWBIT_E;
316 
317 /* ISP public attribute, contains the public image attribute */
318 typedef struct hiISP_PUB_ATTR_S {
319     RECT_S          stWndRect;      /* RW; Start position of the cropping window, image width, and image height */
320     SIZE_S          stSnsSize;      /* RW; Width and height of the image output from the sensor */
321     HI_FLOAT        f32FrameRate;   /* RW; Range: [0, 0xFFFF]; For frame rate */
322     ISP_BAYER_FORMAT_E  enBayer;    /* RW; Range:[0,3];Format:2.0;the format of the input Bayer image */
323     WDR_MODE_E      enWDRMode;      /* RW; WDR mode select */
324     HI_U8           u8SnsMode;      /* RW; Range: [0, 0xFF]; Format: 8.0; For special sensor mode switches */
325 } ISP_PUB_ATTR_S;
326 
327 /* Slave mode sensor sync signal generate module */
328 typedef struct hiISP_SLAVE_SNS_SYNC_S {
329     union {
330         struct {
331             HI_U32  bit16Rsv          :  16;
332             HI_U32  bitHInv           :  1;
333             HI_U32  bitVInv           :  1;
334             HI_U32  bit12Rsv          :  12;
335             HI_U32  bitHEnable        :  1;
336             HI_U32  bitVEnable        :  1;
337         } stBits;
338         HI_U32 u32Bytes;
339     } unCfg;
340 
341     HI_U32  u32VsTime;
342     HI_U32  u32HsTime;
343     HI_U32  u32VsCyc;
344     HI_U32  u32HsCyc;
345     HI_U32  u32HsDlyCyc;
346     HI_U32  u32SlaveModeTime;
347 } ISP_SLAVE_SNS_SYNC_S;
348 
349 /* Defines the ISP stitch attribute. */
350 /*
351  * Defines the ISP firmware status
352  * 0 = Running status
353  * 1 = Frozen status
354  */
355 typedef enum hiISP_FMW_STATE_E {
356     ISP_FMW_STATE_RUN = 0,
357     ISP_FMW_STATE_FREEZE,
358     ISP_FMW_STATE_BUTT
359 } ISP_FMW_STATE_E;
360 
361 /* Defines the WDR mode of the ISP */
362 typedef struct hiISP_WDR_MODE_S {
363     WDR_MODE_E  enWDRMode;
364 } ISP_WDR_MODE_S;
365 
366 typedef union hiISP_MODULE_CTRL_U {
367     HI_U64  u64Key;
368     struct {
369         HI_U64  bitBypassISPDGain      : 1; /* RW;[0] */
370         HI_U64  bitBypassAntiFC        : 1; /* RW;[1] */
371         HI_U64  bitBypassCrosstalkR    : 1; /* RW;[2] */
372         HI_U64  bitBypassDPC           : 1; /* RW;[3] */
373         HI_U64  bitBypassNR            : 1; /* RW;[4] */
374         HI_U64  bitBypassDehaze        : 1; /* RW;[5] */
375         HI_U64  bitBypassWBGain        : 1; /* RW;[6] */
376         HI_U64  bitBypassMeshShading   : 1; /* RW;[7] */
377         HI_U64  bitBypassDRC           : 1; /* RW;[8] */
378         HI_U64  bitBypassDemosaic      : 1; /* RW;[9] */
379         HI_U64  bitBypassColorMatrix   : 1; /* RW;[10] */
380         HI_U64  bitBypassGamma         : 1; /* RW;[11] */
381         HI_U64  bitBypassFSWDR         : 1; /* RW;[12] */
382         HI_U64  bitBypassCA            : 1; /* RW;[13] */
383         HI_U64  bitBypassCsConv        : 1; /* RW;[14] */
384         HI_U64  bitBypassRadialCrop    : 1; /* RW;[15]; Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/
385                                                Hi3559V200/Hi3556V200 */
386         HI_U64  bitBypassSharpen       : 1; /* RW;[16] */
387         HI_U64  bitBypassLCAC          : 1; /* RW;[17] */
388         HI_U64  bitBypassGCAC          : 1; /* RW;[18]; Not support for Hi3516EV200/
389                                                Hi3516EV300/Hi3518EV300/Hi3516DV200 */
390         HI_U64  bit2ChnSelect          : 2; /* RW;[19:20] */
391         HI_U64  bitBypassLdci          : 1; /* RW;[21] */
392         HI_U64  bitBypassPreGamma      : 1; /* RW;[22] */
393         HI_U64  bitBypassRadialShading : 1; /* RW;[23]; Only used for Hi3559AV100/Hi3519AV100 */
394         HI_U64  bitBypassAEStatFE      : 1; /* RW;[24] */
395         HI_U64  bitBypassAEStatBE      : 1; /* RW;[25] */
396         HI_U64  bitBypassMGStat        : 1; /* RW;[26] */
397         HI_U64  bitBypassDE            : 1; /* RW;[27]; Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/
398                                                Hi3559V200/Hi3556V200 */
399         HI_U64  bitBypassAFStatFE      : 1; /* RW;[28]; Only used for Hi3559AV100/Hi3519AV100 */
400         HI_U64  bitBypassAFStatBE      : 1; /* RW;[29];  */
401         HI_U64  bitBypassAWBStat       : 1; /* RW;[30]; */
402         HI_U64  bitBypassCLUT          : 1; /* RW;[31]; Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/
403                                                Hi3516DV200 */
404         HI_U64  bitBypassHLC           : 1; /* RW;[32]; Not support for Hi3559AV100/Hi3516EV200/
405                                                Hi3516EV300/Hi3518EV300/Hi3516DV200 */
406         HI_U64  bitBypassEdgeMark      : 1; /* RW;[33]; Not support for Hi3516EV200/Hi3516EV300/
407                                                Hi3518EV300/Hi3516DV200 */
408         HI_U64  bitBypassRGBIR         : 1; /* RW;[34]; Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
409         HI_U64  bitRsv29               : 29;  /* H; [35:63] */
410     };
411 } ISP_MODULE_CTRL_U;
412 
413 /*
414  * Defines the RAW stream Position from the ISP
415  * 0 = the raw data is writing out before the DEMOSAIC  module.
416  * Only used for Hi3559AV100
417  */
418 typedef enum hiISP_RAW_POS_E {
419     RAW_POS_DEMOSAIC    = 0,
420     RAW_POS_BUTT
421 } ISP_RAW_POS_E;
422 
423 /*
424  * Defines the RAW stream Position from the ISP and whether the function of geting raw data is enable.
425  * Only used for Hi3559AV100
426  */
427 typedef struct hiISP_RAW_POS {
428     ISP_RAW_POS_E enRawPos;
429     HI_BOOL bEnable;
430 } ISP_RAW_POS;
431 
432 /*
433  *  Defines the ISP FSWDR attributes in combination mode.
434  *  0 = Short exposure data is used when combining
435  *  1 = Long exposure data is used when combining
436  */
437 typedef enum hiISP_COMBINE_MODE_E {
438     FS_WDR_COMBINE_SHORT_FIRST  = 0,
439     FS_WDR_COMBINE_LONG_FIRST   = 1,
440     FS_WDR_COMBINE_BUTT
441 } ISP_COMBINE_MODE_E;
442 
443 /*
444  * Defines the ISP WDR merge mode.
445  * 0 = WDR mode is used
446  * 1 = Fusion mode is used
447  */
448 typedef enum hiISP_WDR_MERGE_MODE_E {
449     MERGE_WDR_MODE      = 0,
450     MERGE_FUSION_MODE   = 1,
451     MERGE_BUTT
452 } ISP_WDR_MERGE_MODE_E;
453 
454 /*
455  * 0 = The function of bnr is off
456  * 1 = The function of bnr is on
457  */
458 typedef enum hiISP_BNR_MODE_E {
459     BNR_OFF_MODE         = 0,
460     BNR_ON_MODE          = 1,
461     BNR_BUTT
462 } ISP_BNR_MODE_E;
463 
464 typedef enum hiISP_WDR_WBGAIN_POSITION_E {
465     WDR_WBGAIN_IN_DG1         = 0,
466     WDR_WBGAIN_IN_WB          = 1,
467     WDR_WBGAIN_POSITION_BUTT
468 } ISP_WDR_WBGAIN_POSITION_E;
469 
470 typedef struct hiISP_FSWDR_MANUAL_ATTR_S {
471     HI_U8 u8MdThrLowGain;
472     HI_U8 u8MdThrHigGain;
473 } ISP_FSWDR_MANUAL_ATTR_S;
474 
475 typedef struct hiISP_FSWDR_AUTO_ATTR_S {
476     HI_U8 au8MdThrLowGain[ISP_AUTO_ISO_STRENGTH_NUM];
477     HI_U8 au8MdThrHigGain[ISP_AUTO_ISO_STRENGTH_NUM];
478 } ISP_FSWDR_AUTO_ATTR_S;
479 
480 typedef struct hiISP_MDT_ATTR_S {
481     HI_BOOL bShortExpoChk;     /* RW;Range:[0x0,0x1];Format:1.0; */
482     HI_U16  u16ShortCheckThd;   /* RW;Range:[0x0,0xFFF];Format:12.0 */
483     HI_BOOL bMDRefFlicker;
484     HI_U8   u8MdtStillThd;     /* RW;Range:[0x0,0xFE];Format:8.0 */
485     HI_U8   u8MdtFullThd;      /* RW;Range:[0x0,0xFE];Format:8.0,Only used for Hi3559AV100 */
486     HI_U8   u8MdtLongBlend;    /* RW;Range:[0x0,0xFE] */
487     ISP_OP_TYPE_E enOpType;
488     ISP_FSWDR_MANUAL_ATTR_S stManual;
489     ISP_FSWDR_AUTO_ATTR_S   stAuto;
490 } ISP_FSWDR_MDT_ATTR_S;
491 
492 typedef struct hiISP_WDR_COMBINE_ATTR_S {
493     HI_BOOL bMotionComp;        /* RW;Range:[0, 0x1];Format:1.0; enable/disable motion compensation */
494     HI_U16  u16ShortThr;        /* RW;Range:[0, 0xFFF];Format:12.0; Data above this threshold will be taken from
495                                    short exposure only. */
496     HI_U16  u16LongThr;         /* RW;Range:[0, 0xFFF];Format:12.0; limited range :[0, u16ShortThr], Data below this
497                                    threshold will be taken from long exposure only. */
498     HI_BOOL bForceLong;         /* RW;Range:[0, 1];Format:1.0; enable/disable Force Long,
499                                    Not support for Hi3559AV100 */
500     HI_U16  u16ForceLongLowThr; /* RW;Range:[0, 0xFFF];Format:12.0; Data above this threshold will Force to choose
501                                    long frame only, Not support for Hi3559AV100 */
502     HI_U16  u16ForceLongHigThr; /* RW;Range:[0, 0xFFF];Format:12.0; Data below this threshold will Force to choose
503                                    long frame only, Not support for Hi3559AV100 */
504     ISP_FSWDR_MDT_ATTR_S stWDRMdt;
505 } ISP_WDR_COMBINE_ATTR_S;
506 
507 typedef struct hiISP_FUSION_ATTR_S {
508     HI_U16  au16FusionThr[WDR_MAX_FRAME_NUM];      /* RW;Range:[0x0, 0x3FFF];Format:14.0;The threshold of the 4 frame */
509 } ISP_FUSION_ATTR_S;
510 
511 typedef struct hiISP_WDR_BNR_ATTR_S {
512     ISP_BNR_MODE_E enBnrMode;         /* RW;Range:[0, 1];Format:1.0; enable/disable the bnr of wdr */
513     HI_BOOL bShortFrameNR;     /* RW;Range:[0, 1];Format:1.0; enable/disable the bnr of short frame;
514                                    Only used for Hi3519AV100 */
515     HI_U8   u8ShortFrameNRStr; /* RW;Range:[0, 0x3F];Format:8.0;the Level 2 short frame sigma weight of G channel,
516                                   Only used for Hi3519AV100 */
517     HI_U8   u8FusionBnrStr;    /* RW;Range:[0,0x3F];Format:3.3,Only used for Hi3519AV100 */
518     HI_U8   au8NoiseFloor[NOISESET_ELENUM]; /* RW;Range:[0x0, 0xFF];Format:8.0,Only used for Hi3559AV100/Hi3519AV100 */
519     HI_U8   u8FullMdtSigGWgt;  /* RW;Range:[0, 0x1F];Format:8.0,Only used for Hi3519AV100 */
520     HI_U8   u8FullMdtSigRBWgt; /* RW;Range:[0, 0x1F];Format:8.0,Only used for Hi3519AV100 */
521     HI_U8   u8FullMdtSigWgt;  /* RW;Range:[0, 0x1F];Format:8.0,Only used for Hi3559AV100 */
522     HI_U8   au8GsigmaGain[3];  /* RW;Range:[0, 0xFF];Format:8.0,Only used for Hi3559AV100/Hi3519AV100 */
523     HI_U8   au8RBsigmaGain[3]; /* RW;Range:[0, 0xFF];Format:8.0,Only used for Hi3559AV100/Hi3519AV100 */
524 } ISP_WDR_BNR_ATTR_S;
525 
526 typedef struct hiISP_WDR_FS_ATTR_S {
527     ISP_WDR_MERGE_MODE_E enWDRMergeMode;
528     ISP_WDR_COMBINE_ATTR_S stWDRCombine;
529     ISP_WDR_BNR_ATTR_S stBnr; /* Only used for Hi3559AV100/Hi3519AV100 */
530     ISP_FUSION_ATTR_S stFusion;
531     ISP_WDR_WBGAIN_POSITION_E enWDRWbgainPosition; /* RW; Range: [0x0, 0x1]; WDR Gain with or without WB Gain.
532                                                       Only used for Hi3559AV100 */
533 } ISP_WDR_FS_ATTR_S;
534 
535 typedef struct hiISP_DRC_CUBIC_POINT_ATTR_S {
536     HI_U16 u16X;     /* RW; Range:[0, 1000]; Format:10.0; x position of the characteristic point of the cubic curve;
537                         Only used for Hi3559AV100 */
538     HI_U16 u16Y;     /* RW; Range:[0, 1000]; Format:10.0; y position of the characteristic point of the cubic curve;
539                         Only used for Hi3559AV100 */
540     HI_U16 u16Slope; /* RW; Range:[0, 10000]; Format:14.0; slope of the characteristic point of the cubic curve;
541                         Only used for Hi3559AV100 */
542 } ISP_DRC_CUBIC_POINT_ATTR_S;
543 
544 typedef struct hiISP_DRC_ASYMMETRY_CURVE_ATTR_S {
545     HI_U8   u8Asymmetry;  /* RW; Range:[0x1, 0x1E]; Format:5.0; The parameter0 of DRC asymmetry tone mapping curve */
546     HI_U8   u8SecondPole; /* RW; Range:[0x96,0xD2]; Format:8.0; The parameter1 of DRC asymmetry tone mapping curve */
547     HI_U8   u8Stretch;    /* RW; Range:[0x1E,0x3C]; Format:6.0; The parameter2 of DRC asymmetry tone mapping curve */
548     HI_U8   u8Compress;   /* RW; Range:[0x64,0xC8]; Format:8.0; The parameter3 of DRC asymmetry tone mapping curve */
549 } ISP_DRC_ASYMMETRY_CURVE_ATTR_S;
550 
551 typedef struct hiISP_DRC_MANUAL_ATTR_S {
552     HI_U16  u16Strength; /* RW; Range:Hi3559AV100 = [0x0, 0xFF] | Hi3519AV100 = [0x0, 0x3FF] |
553                             Hi3516CV500 = [0x0, 0x3FF] | Hi3516DV300 = [0x0, 0x3FF] | Hi3516AV300 = [0x0, 0x3FF] |
554                             Hi3559V200 = [0x0, 0x3FF] | Hi3556V200 = [0x0, 0x3FF] | Hi3516EV200 = [0x0, 0x3FF] |
555                             Hi3516EV300 = [0x0, 0x3FF] | Hi3518EV300 = [0x0, 0x3FF] | Hi3516DV200 = [0x0, 0x3FF];
556                             Strength of dynamic range compression. Higher values lead to higher differential gain
557                             between shadows and highlights. */
558 } ISP_DRC_MANUAL_ATTR_S;
559 
560 typedef struct hiISP_DRC_AUTO_ATTR_S {
561     HI_U16  u16Strength;   /* RW; Range:Hi3559AV100 = [0x0, 0xFF] | Hi3519AV100 = [0x0, 0x3FF] |
562                               Hi3516CV500 = [0x0, 0x3FF]| Hi3516DV300 = [0x0, 0x3FF] |Hi3516AV300 = [0x0, 0x3FF] |
563                               Hi3559V200 = [0x0, 0x3FF]| Hi3556V200 = [0x0, 0x3FF] | Hi3516EV200 = [0x0, 0x3FF] |
564                               Hi3516EV300 = [0x0, 0x3FF]|Hi3518EV300 = [0x0, 0x3FF]|Hi3516DV200 = [0x0, 0x3FF];
565                               It is the base strength. The strength used in ISP is generated by firmware.
566                               n linear mode, strength = f1(u16Strength, histogram)
567                               In sensor WDR mode: strength = f2(u16Strength, histogram)
568                               In 2to1 WDR mode: strength = f3(ExpRatio) */
569 
570     HI_U16 u16StrengthMax; /* RW; Range: Hi3559AV100 = [0x0, 0xFF] | Hi3519AV100 = [0x0, 0x3FF] |
571                               Hi3516CV500 = [0x0, 0x3FF] | Hi3516DV300 = [0x0, 0x3FF] | Hi3516AV300 = [0x0, 0x3FF] |
572                               Hi3559V200 = [0x0, 0x3FF] | Hi3556V200 = [0x0, 0x3FF] | Hi3516EV200 = [0x0, 0x3FF]|
573                               Hi3516EV300 = [0x0, 0x3FF] | Hi3518EV300 = [0x0, 0x3FF]| Hi3516DV200 = [0x0, 0x3FF];
574                               Maximum DRC strength in Auto mode */
575     HI_U16 u16StrengthMin; /* RW; Range: Hi3559AV100 = [0x0, 0xFF] | Hi3519AV100 = [0x0, 0x3FF] |
576                               Hi3516CV500 = [0x0, 0x3FF] | Hi3516DV300 = [0x0, 0x3FF] | Hi3516AV300 = [0x0, 0x3FF] |
577                               Hi3559V200 = [0x0, 0x3FF] | Hi3556V200 = [0x0, 0x3FF]| Hi3516EV200 = [0x0, 0x3FF] |
578                               Hi3516EV300 = [0x0, 0x3FF]|Hi3518EV300 = [0x0, 0x3FF]|Hi3516DV200 = [0x0, 0x3FF];
579                               Minimum DRC strength in Auto mode */
580 } ISP_DRC_AUTO_ATTR_S;
581 
582 /* DRC curve type: 0 = Asymmetry curve, 1 = Cubic curve, 2 = User-defined curve */
583 typedef enum hiISP_DRC_CURVE_SELECT_E {
584     DRC_CURVE_ASYMMETRY = 0x0,
585     DRC_CURVE_CUBIC,      /* Only used for Hi3559AV100 */
586     DRC_CURVE_USER,
587     DRC_CURVE_BUTT
588 } ISP_DRC_CURVE_SELECT_E;
589 
590 typedef struct hiISP_DRC_ATTR_S {
591     HI_BOOL bEnable;
592     ISP_DRC_CURVE_SELECT_E enCurveSelect;  /* RW; Range:[0x0, 0x2]; Select tone mapping curve type */
593 
594     HI_U8  u8PDStrength;           /* RW; Range:[0x0, 0x80]; Format:8.0; Controls the purple detection strength,
595                                       Only used for Hi3559AV100/Hi3519AV100/Hi3516CV500/Hi3516DV300/Hi3516AV300/
596                                       Hi3559V200/Hi3556V200 */
597     HI_U8  u8LocalMixingBrightMax; /* RW; Range:[0x0, 0x80]; Format:8.0;
598                                       Maximum enhancement strength for positive detail */
599     HI_U8  u8LocalMixingBrightMin; /* RW; Range:[0x0, 0x40]; Format:8.0;
600                                       Minimum enhancement strength for positive detail */
601     HI_U8  u8LocalMixingBrightThr; /* RW; Range:[0x0, 0xFF]; Format:8.0; Luma threshold for enhancement strength
602                                       adaptation of positive detail */
603     HI_S8  s8LocalMixingBrightSlo; /* RW; Range:[-7, 7]; Format:s4.0; Enhancement strength adaptation slope for
604                                       positive detail */
605     HI_U8  u8LocalMixingDarkMax;   /* RW; Range:[0x0, 0x80]; Format:8.0;
606                                       Maximum enhancement strength for negative detail */
607     HI_U8  u8LocalMixingDarkMin;   /* RW; Range:[0x0, 0x40]; Format:8.0;
608                                       Minimum enhancement strength for negative detail */
609     HI_U8  u8LocalMixingDarkThr;   /* RW; Range:[0x0, 0xFF]; Format:8.0; Luma threshold for enhancement strength
610                                       adaptation of negative detail */
611     HI_S8  s8LocalMixingDarkSlo;   /* RW; Range:[-7, 7]; Format:s4.0; Enhancement strength adaptation slope for
612                                       negative detail */
613     HI_U8  u8DetailBrightStr;      /* RW; Range:[0x0, 0x80]; Format:8.0; Controls the gain of the non-linear positive
614                                       detail enhancement; Only used for Hi3559AV100 */
615     HI_U8  u8DetailDarkStr;        /* RW; Range:[0x0, 0x80]; Format:8.0; Controls the gain of the non-linear negative
616                                       detail enhancement; Only used for Hi3559AV100 */
617     HI_U8  u8DetailBrightStep;     /* RW; Range:[0x0, 0x80]; Format:8.0; Controls the step of the non-linear positive
618                                       detail enhancement; Only used for Hi3559AV100 */
619     HI_U8  u8DetailDarkStep;       /* RW; Range:[0x0, 0x80]; Format:8.0; Controls the step of the non-linear negative
620                                       detail enhancement; Only used for Hi3559AV100 */
621 
622     HI_U8  u8BrightGainLmt;        /* RW; Range:[0x0, 0xF];  Format:4.0; Bright area gain high limit */
623     HI_U8  u8BrightGainLmtStep;    /* RW; Range:[0x0, 0xF];  Format:4.0; Bright area gain high limit step */
624     HI_U8  u8DarkGainLmtY;         /* RW; Range:[0x0, 0x85]; Format:7.0; Dark area luma gain limit */
625     HI_U8  u8DarkGainLmtC;         /* RW; Range:[0x0, 0x85]; Format:7.0; Dark area chroma gain limit */
626     HI_U16 au16ColorCorrectionLut[HI_ISP_DRC_CC_NODE_NUM]; /* RW; Range:[0x0, 0x400]; Format:4.12;
627                                                               LUT of color correction coefficients */
628     HI_U16 au16ToneMappingValue[HI_ISP_DRC_TM_NODE_NUM];   /* RW; Range:[0x0, 0xffff]; Format:16.0;
629                                                               LUT of user-defined curve */
630 
631     HI_U8  u8FltScaleCoarse;     /* RW; Range:[0x0, 0xF]; Format:4.0; Spatial filter scale coarse control;
632                                     Only used for Hi3559AV100 and Hi3519AV100 */
633     HI_U8  u8FltScaleFine;       /* RW; Range:[0x0, 0xF]; Format:4.0; Spatial filter scale fine control;
634                                     Only used for Hi3559AV100 and Hi3519AV100  */
635     HI_U8  u8ContrastControl;    /* RW; Range:[0x0, 0xF]; Format:4.0; Contrast control */
636     HI_S8  s8DetailAdjustFactor; /* RW; Range:[-15, 15];  Format:4.0; Detail adjustment factor */
637 
638     HI_U8  u8SpatialFltCoef;     /* RW; Range: Hi3559AV100 = [0x0, 0xA] | Hi3519AV100 = [0x0, 0x5] |
639                                     Hi3516CV500 = [0x0, 0x5] | Hi3516DV300 = [0x0, 0x5] | Hi3516AV300 = [0x0, 0x5] |
640                                     Hi3559V200 = [0x0, 0x5] | Hi3556V200 = [0x0, 0x5] | Hi3516EV200 = [0x0, 0x5] |
641                                     Hi3516EV300 = [0x0, 0x5] |Hi3518EV300 = [0x0, 0x5]|Hi3516DV200 = [0x0, 0x5];
642                                     Spatial filter coefficients */
643     HI_U8  u8RangeFltCoef;       /* RW; Range:[0x0, 0xA]; Format:4.0; Range filter coefficients */
644     HI_U8  u8RangeAdaMax;        /* RW; Range:[0x0, 0x8]; Format:4.0;
645                                     Maximum range filter coefficient adaptation range */
646     HI_U8  u8GradRevMax;         /* RW; Range:[0x0, 0x40]; Format:7.0; Maximum gradient reversal reduction strength */
647     HI_U8  u8GradRevThr;         /* RW; Range:[0x0, 0x80]; Format:8.0; Gradient reversal reduction threshold */
648 
649     HI_U8  u8DpDetectRangeRatio; /* RW; Range:[0x0, 0x1F]; Format:5.0; DRC defect pixel detection control parameter;
650                                     Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
651     HI_U8  u8DpDetectThrSlo;     /* RW; Range:[0x0, 0x1F]; Format:5.0; DRC defect pixel detection control parameter;
652                                     Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
653     HI_U16 u16DpDetectThrMin;    /* RW; Range:[0x0, 0xFFFF]; Format:16.0; DRC defect pixel detection control parameter;
654                                     Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
655 
656     ISP_OP_TYPE_E enOpType;
657     ISP_DRC_MANUAL_ATTR_S stManual;
658     ISP_DRC_AUTO_ATTR_S   stAuto;
659     ISP_DRC_CUBIC_POINT_ATTR_S astCubicPoint[HI_ISP_DRC_CUBIC_POINT_NUM]; /* Only used for Hi3559AV100 */
660     ISP_DRC_ASYMMETRY_CURVE_ATTR_S stAsymmetryCurve;
661 } ISP_DRC_ATTR_S;
662 
663 typedef struct hiISP_LDCI_GAUSS_COEF_ATTR_S {
664     HI_U8   u8Wgt;   /* RW;Range:Hi3559AV100 = [0x0, 0x80] | Hi3519AV100 = [0x0, 0x80]| Hi3516CV500 = [0x0, 0xFF] |
665                         Hi3516DV300 = [0x0, 0xFF]| Hi3516AV300 = [0x0, 0xFF]|Hi3559V200 = [0x0, 0xFF] |
666                         Hi3556V200 = [0x0, 0xFF] | Hi3516EV200 = [0x0, 0xFF] | Hi3516EV300 = [0x0, 0xFF] |
667                         Hi3518EV300 = [0x0, 0xFF]| Hi3516DV200 = [0x0, 0xFF];
668                         Format:1.7;Weight of Gaussian distribution */
669     HI_U8   u8Sigma; /* RW;Range: [0x1, 0xFF];Format:0.8;Sigma of Gaussian distribution */
670     HI_U8   u8Mean;  /* RW;Range: [0x0, 0xFF];Format:0.8;Mean of Gaussian distribution */
671 } ISP_LDCI_GAUSS_COEF_ATTR_S;
672 
673 typedef struct hiISP_LDCI_HE_WGT_ATTR_S {
674     ISP_LDCI_GAUSS_COEF_ATTR_S  stHePosWgt;
675     ISP_LDCI_GAUSS_COEF_ATTR_S  stHeNegWgt;
676 } ISP_LDCI_HE_WGT_ATTR_S;
677 
678 typedef struct hiISP_LDCI_MANUAL_ATTR_S {
679     ISP_LDCI_HE_WGT_ATTR_S  stHeWgt;
680     HI_U16                  u16BlcCtrl; /* RW;Range: [0x0, 0x1FF];Format:9.0;Restrain dark region */
681 } ISP_LDCI_MANUAL_ATTR_S;
682 
683 typedef struct hiISP_LDCI_AUTO_ATTR_S {
684     ISP_LDCI_HE_WGT_ATTR_S  astHeWgt[ISP_AUTO_ISO_STRENGTH_NUM];
685     HI_U16                  au16BlcCtrl[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;Range: [0x0, 0x1FF];Format:9.0;
686                                                                        auto mode, Restrain dark region */
687 } ISP_LDCI_AUTO_ATTR_S;
688 
689 typedef struct hiISP_LDCI_ATTR_S {
690     HI_BOOL                bEnable;         /* RW;Range:[0x0,0x1];Format:1.0; */
691     HI_U8                  u8GaussLPFSigma; /* RW;Range: [0x1, 0xFF];Format:0.8;
692                                                Coefficient of Gaussian low-pass filter */
693     ISP_OP_TYPE_E          enOpType;
694     ISP_LDCI_MANUAL_ATTR_S stManual;
695     ISP_LDCI_AUTO_ATTR_S   stAuto;
696     HI_U16                 u16TprIncrCoef;  /* RW;Range: [0x0, 0x100];Format:0.9;
697                                                Increase Coefficient of temporal filter */
698     HI_U16                 u16TprDecrCoef;  /* RW;Range: [0x0, 0x100];Format:0.9;
699                                                Decrease Coefficient of temporal filter */
700 } ISP_LDCI_ATTR_S;
701 
702 /*
703   defines CA type
704   0 = enable Ca module
705   1 = enable Cp module
706  */
707 typedef enum hiISP_CA_TYPE_E {
708     ISP_CA_ENABLE = 0x0,
709     ISP_CP_ENABLE,
710     ISP_CA_BUTT
711 } ISP_CA_TYPE_E;
712 
713 typedef struct hiISP_CA_LUT_S {
714     HI_U32 au32YRatioLut[HI_ISP_CA_YRATIO_LUT_LENGTH]; /* RW;Range:[0, 2047];Format:1.11 */
715     HI_S32 as32ISORatio[ISP_AUTO_ISO_STRENGTH_NUM];    /* RW;Range:[0, 2047];Format:1.10 */
716 } ISP_CA_LUT_S;
717 
718 /* Only used for Hi3559AV100/Hi3519AV100 */
719 typedef struct hiISP_CP_LUT_S {
720     HI_U8 au8CPLutY[HI_ISP_CA_YRATIO_LUT_LENGTH]; /* RW;Range:[0, 255];Format:8.0; */
721     HI_U8 au8CPLutU[HI_ISP_CA_YRATIO_LUT_LENGTH]; /* RW;Range:[0, 255];Format:8.0; */
722     HI_U8 au8CPLutV[HI_ISP_CA_YRATIO_LUT_LENGTH]; /* RW;Range:[0, 255];Format:8.0; */
723 } ISP_CP_LUT_S;
724 
725 typedef struct hiISP_CA_ATTR_S {
726     HI_BOOL bEnable;            /* RW;Range:[0x0,0x1];Format:1.0 */
727     ISP_CA_TYPE_E eCaCpEn;      /* Only used for Hi3559AV100/Hi3519AV100 */
728     ISP_CA_LUT_S stCA;
729     ISP_CP_LUT_S stCP;          /* Only used for Hi3559AV100/Hi3519AV100 */
730 } ISP_CA_ATTR_S;
731 
732 typedef struct hiCSC_MATRX_S {
733     HI_S16 as16CSCIdc[ISP_CSC_DC_NUM];  /* RW; Range:[-1024, 1023]; Format: 11.0; Input dc component for csc matrix */
734     HI_S16 as16CSCOdc[ISP_CSC_DC_NUM];  /* RW; Range:[-1024, 1023]; Format: 11.0; Output dc component for csc matrix */
735     HI_S16 as16CSCCoef[ISP_CSC_COEF_NUM]; /* RW; Range:[-4096, 4095]; Format: 5.10; 3x3 coefficients for csc matrix */
736 } CSC_MATRX_S;
737 
738 typedef struct hiISP_CSC_ATTR_S {
739     HI_BOOL bEnable;            /* RW; Range:[0, 1];Format:1.0; Enable/Disable CSC Function */
740 
741     COLOR_GAMUT_E enColorGamut; /* RW; Range: [0, 3]; Color gamut type; COLOR_GAMUT_BT2020 only used for Hi3559AV100 */
742     HI_U8   u8Hue;              /* RW; Range:[0, 100];Format:8.0; Csc Hue Value */
743     HI_U8   u8Luma;             /* RW; Range:[0, 100];Format:8.0; Csc Luma Value */
744     HI_U8   u8Contr;            /* RW; Range:[0, 100];Format:8.0; Csc Contrast Value */
745     HI_U8   u8Satu;             /* RW; Range:[0, 100];Format:8.0; Csc Saturation Value */
746     HI_BOOL bLimitedRangeEn;    /* RW; Range: [0x0, 0x1]; Enable/Disable:
747                                    Enable Limited range output mode(default full range output) */
748     HI_BOOL bExtCscEn;          /* RW; Range: [0x0, 0x1]; Enable/Disable: Enable extended luma range */
749     HI_BOOL bCtModeEn;          /* RW; Range: [0x0, 0x1]; Enable/Disable: Enable ct mode */
750     CSC_MATRX_S stCscMagtrx;    /* RW; Color Space Conversion matrix */
751 } ISP_CSC_ATTR_S;
752 
753 typedef struct hiISP_CLUT_ATTR_S {
754     HI_BOOL bEnable;  /* RW; Range:[0, 1];Format:1.0; Enable/Disable CLUT Function,
755                          Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
756     HI_U32  u32GainR; /* RW; Range:[0, 4095];Format:12.0;
757                          Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
758     HI_U32  u32GainG; /* RW; Range:[0, 4095];Format:12.0;
759                          Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
760     HI_U32  u32GainB; /* RW; Range:[0, 4095];Format:12.0;
761                          Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
762 } ISP_CLUT_ATTR_S;
763 
764 typedef struct hiISP_CLUT_LUT_S {
765     HI_U32 au32lut[HI_ISP_CLUT_LUT_LENGTH]; /* RW; Range: Hi3559AV100 = [0, 4294967295] |
766                                                Hi3519AV100 = [0x0, 1073741823]| Hi3516CV500 = [0x0, 1073741823]|
767                                                Hi3516DV300 = [0x0, 1073741823] | Hi3516AV300 = [0x0, 1073741823] |
768                                                Hi3559V200 = [0x0, 1073741823]| Hi3556V200 = [0x0, 1073741823];
769                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
770 } ISP_CLUT_LUT_S;
771 
772 /*
773   Defines the type of static defect pixel calibration
774   0 = bright defect pixel calibration
775   1 = dark defect pixel calibration
776  */
777 typedef enum hiISP_STATIC_DP_TYPE_E {
778     ISP_STATIC_DP_BRIGHT = 0x0,
779     ISP_STATIC_DP_DARK,
780     ISP_STATIC_DP_BUTT
781 } ISP_STATIC_DP_TYPE_E;
782 
783 typedef struct hiISP_DP_STATIC_CALIBRATE_S {
784     HI_BOOL bEnableDetect;               /* RW; Range: [0, 1];Format 1.0;Set 'HI_TRUE'to start static defect-pixel
785                                             calibration, and firmware will set 'HI_FALSE' when finished,
786                                             Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
787     ISP_STATIC_DP_TYPE_E enStaticDPType; /* RW; Range: [0, 1];Format 1.0;Select static bright/dark defect-pixel
788                                             calibration,Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/
789                                             Hi3516DV200 */
790     HI_U8   u8StartThresh; /* RW; Range: [1, 255]; Format 8.0;Start threshold for static defect-pixel calibraiton,
791                               Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
792     HI_U16  u16CountMax;   /* RW; Range:Hi3559AV100 = [0, 8192] | Hi3519AV100 = [0, 8192]| Hi3516CV500 = [0, 6144] |
793                               Hi3516DV300 = [0, 6144] | Hi3516AV300 = [0, 6144] |Hi3559V200 = [0, 6144] |
794                               Hi3556V200 = [0, 6144];Format 14.0; limited Range: [0, STATIC_DP_COUNT_NORMAL*BlkNum],
795                               Limit of max number of static defect-pixel calibraiton.
796                               Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
797     HI_U16  u16CountMin;   /* RW; Range:Hi3559AV100 = [0, 8192] | Hi3519AV100 = [0, 8192]| Hi3516CV500 = [0, 6144] |
798                               Hi3516DV300 = [0, 6144]| Hi3516AV300 = [0, 6144]| Hi3559V200 = [0, 6144] |
799                               Hi3556V200 = [0, 6144];Format 14.0; limited Range: [0, u16CountMax],
800                               Limit of min number of static defect-pixel calibraiton.
801                               Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
802     HI_U16  u16TimeLimit;  /* RW; Range: [0x0, 1600];Format 11.0;Time limit for static defect-pixel calibraiton, in
803                               frame number,Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
804 
805     HI_U32  au32Table[STATIC_DP_COUNT_MAX]; /* R; Range: [0, 0x1FFF1FFF];Format 29.0;
806                                                Static defect-pixel calibraiton table,
807                                                0~12 bits represents the X coordinate of the defect pixel,
808                                                16~28 bits represent the Y coordinate of the defect pixel.
809                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
810     HI_U8   u8FinishThresh; /* R; Range: [0, 255];Format 8.0; Finish threshold for static defect-pixel calibraiton,
811                                   Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
812     HI_U16  u16Count;       /* R; Range:Hi3559AV100 = [0, 8192] | Hi3519AV100 = [0, 8192] Hi3516CV500 = [0, 6144]|
813                                Hi3516DV300 = [0, 6144]| Hi3516AV300 = [0, 6144]| Hi3559V200 = [0, 6144] |
814                                Hi3556V200 = [0, 6144];Format 14.0; Finish number for static defect-pixel calibraiton
815                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
816     ISP_STATUS_E enStatus;  /* R; Range: [0, 2];Format 2.0;Status of static defect-pixel calibraiton,
817                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
818 } ISP_DP_STATIC_CALIBRATE_S;
819 
820 typedef struct hiISP_DP_STATIC_ATTR_S {
821     HI_BOOL bEnable;        /* RW; Range: [0, 1];Format 1.0;Enable/disable the static defect-pixel module,
822                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
823     HI_U16  u16BrightCount; /* RW; Range:Hi3559AV100 = [0, 8192] | Hi3519AV100 = [0, 8192]| Hi3516CV500 = [0, 6144]|
824                                Hi3516DV300 = [0, 6144]| Hi3516AV300 = [0, 6144]| Hi3559V200 = [0, 6144] |
825                                Hi3556V200 = [0, 6144];Format 14.0;limited Range: [0, STATIC_DP_COUNT_NORMAL*BlkNum],
826                                When used as input(W), indicate the number of static bright defect pixels;
827                                As output(R),indicate the number of static bright and dark defect pixels.
828                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
829     HI_U16  u16DarkCount;   /* RW; Range:Hi3559AV100 = [0, 8192] | Hi3519AV100 = [0, 8192]| Hi3516CV500 = [0, 6144]|
830                                Hi3516DV300 = [0, 6144]| Hi3516AV300 = [0, 6144]|Hi3559V200 = [0, 6144] |
831                                Hi3556V200 = [0, 6144];Format 14.0;limited Range: [0, STATIC_DP_COUNT_NORMAL*BlkNum],
832                                When used as input(W), indicate the number of static dark defect pixels;
833                                As output(R), invalid value 0.
834                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
835     HI_U32  au32BrightTable[STATIC_DP_COUNT_MAX]; /* RW; Range: [0x0, 0x1FFF1FFF];Format 29.0;
836                                                      0~12 bits represents the X coordinate of the defect pixel,
837                                                      16~28 bits represent the Y coordinate of the defect pixel
838                                                      Notice: When used as input(W), indicate static bright defect
839                                                      pixels table; As output(R), indicate static bright and dark defect
840                                                      pixels table.
841                                                      Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
842 
843     HI_U32  au32DarkTable[STATIC_DP_COUNT_MAX];  /* RW; Range: [0x0, 0x1FFF1FFF];Format 29.0;
844                                                     0~12 bits represents the X coordinate of the defect pixel,
845                                                     16~28 bits represent the Y coordinate of the defect pixel
846                                                     Notice: When used as input(W), indicate static dark defect pixels
847                                                     table; As output(R), invalid value.
848                                                     Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
849     HI_BOOL bShow; /* RW; Range: [0, 1];Format 1.0;RW;highlight static defect pixel,
850                       Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
851 } ISP_DP_STATIC_ATTR_S;
852 
853 typedef struct hiISP_DP_DYNAMIC_MANUAL_ATTR_S {
854     HI_U16  u16Strength;          /* RW; Range: [0, 255];Format:8.0;Dynamic DPC strength. */
855     HI_U16  u16BlendRatio;        /* RW; Range: [0, 128];Format:9.0;Blending ratio required for DPC */
856 } ISP_DP_DYNAMIC_MANUAL_ATTR_S;
857 
858 typedef struct hiISP_DP_DYNAMIC_AUTO_ATTR_S {
859     HI_U16 au16Strength[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW; Range: [0, 255];Format:8.0;Dynamic DPC strength. */
860     HI_U16 au16BlendRatio[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range: [0, 128];Format:9.0;
861                                                          Blending ratio required for DPC */
862 } ISP_DP_DYNAMIC_AUTO_ATTR_S;
863 
864 typedef struct hiISP_DP_DYNAMIC_ATTR_S {
865     HI_BOOL bEnable;            /* RW; Range: [0, 1];Format 1.0;Enable/disable the dynamic defect-pixel module */
866     HI_BOOL bSupTwinkleEn;      /* RW; Range: [0, 1];Format 1.0;Enable/disable the twinkle suppression  module */
867     HI_S8   s8SoftThr;          /* RW; Range: [0, 127];Format s8.0;twinkle suppression threshold */
868     HI_U8   u8SoftSlope;        /* RW; Range: [0, 255];Format 8.0;Correction controlling parameter of the pixels
869                                    whose deviation is smaller than s8SoftThr. */
870     ISP_OP_TYPE_E enOpType;     /* RW; Range: [0, 1];Format 1.0;Working mode of dynamic DPC */
871     ISP_DP_DYNAMIC_MANUAL_ATTR_S stManual;
872     ISP_DP_DYNAMIC_AUTO_ATTR_S   stAuto;
873 } ISP_DP_DYNAMIC_ATTR_S;
874 
875 typedef struct hiISP_DIS_ATTR_S {
876     HI_BOOL bEnable; /* RW; Range: [0, 1];Format 1.0;Enable/disable dis module,
877                         Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
878 } ISP_DIS_ATTR_S;
879 
880 typedef struct hiISP_SHADING_ATTR_S {
881     HI_BOOL bEnable;       /* RW; Range:[0, 1];Format:1.0; HI_TRUE: enable lsc; HI_FALSE: disable lsc */
882     HI_U16  u16MeshStr;    /* RW; Range:Hi3559AV100=[0, 65535]| Hi3519AV100=[0, 65535]|Hi3516CV500=[0, 65535]|
883                               Hi3516DV300=[0, 65535]|Hi3516AV300=[0, 65535]| Hi3559V200=[0, 65535]|
884                               Hi3556V200=[0, 65535] | Hi3516EV200 = [0x0, 1023] | Hi3516EV300 = [0x0,1023] |
885                               Hi3518EV300 = [0x0,1023] | Hi3516DV200 = [0x0,1023];
886                               The strength of the mesh shading correction */
887     HI_U16  u16BlendRatio; /* RW; Range:[0, 256];Format:9.0; the blendratio of the two mesh gain lookup-table */
888 } ISP_SHADING_ATTR_S;
889 
890 typedef struct hiISP_SHADING_LUT_S {
891     HI_U16  au16RGain[HI_ISP_LSC_GRID_POINTS];  /* RW; Range:[0, 1023];Member used to store the calibration data of the
892                                                    R channel required for LSC. */
893     HI_U16  au16GrGain[HI_ISP_LSC_GRID_POINTS]; /* RW; Range:[0, 1023];Member used to store the calibration data of the
894                                                    Gr channel required for LSC. */
895     HI_U16  au16GbGain[HI_ISP_LSC_GRID_POINTS]; /* RW; Range:[0, 1023];Member used to store the calibration data of the
896                                                    Gb channel required for LSC. */
897     HI_U16  au16BGain[HI_ISP_LSC_GRID_POINTS];  /* RW; Range:[0, 1023];Member used to store the calibration data of the
898                                                    B channel required for LSC. */
899 } ISP_SHADING_GAIN_LUT_S;
900 
901 typedef struct hiISP_BNR_LSC_GAIN_LUT_S {
902     HI_U16  au16RGain[HI_ISP_RLSC_POINTS];  /* RW; Range:[0, 65535];Member used to store the calibration data of the
903                                                R channel required for BNR_LSC.
904                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
905     HI_U16  au16GrGain[HI_ISP_RLSC_POINTS]; /* RW; Range:[0, 65535];Member used to store the calibration data of the
906                                                Gr channel required for BNR_LSC.
907                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
908     HI_U16  au16GbGain[HI_ISP_RLSC_POINTS]; /* RW; Range:[0, 65535];Member used to store the calibration data of the
909                                                Gb channel required for BNR_LSC.
910                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
911     HI_U16  au16BGain[HI_ISP_RLSC_POINTS];  /* RW; Range:[0, 65535];Member used to store the calibration data of the
912                                                B channel required for BNR_LSC.
913                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
914 } ISP_BNR_LSC_GAIN_LUT_S;
915 
916 typedef struct hiISP_SHADING_LUT_ATTR_S {
917     HI_U8  u8MeshScale;        /* RW; Range:[0, 7];Format:3.0;Three bit value that selects the scale and precision for
918                                   the 10 bit gain coefficients stored in mesh tables */
919     HI_U16 au16XGridWidth[HI_ISP_MLSC_X_HALF_GRID_NUM]; /* RW; Range:Hi3559AV100=[4, 1988]| Hi3519AV100=[4, 1988]|
920                                                       Hi3516CV500=[4, 1092]|Hi3516DV300=[4, 1092]|
921                                                       Hi3516AV300=[4, 1092]|Hi3559V200=[4, 1092]|
922                                                       Hi3556V200=[4, 1092] | Hi3516EV200 = [4,255]|
923                                                       Hi3516EV300 = [4,255]|Hi3518EV300 = [4,255]|
924                                                       Hi3516DV200 = [4,255]; limited Range:[4, u32Width/4 - 60],
925                                                       Member used to store the width data of each GRID partition */
926     HI_U16 au16YGridWidth[HI_ISP_MLSC_Y_HALF_GRID_NUM]; /* RW; Range:Hi3559AV100=[4, 1988]| Hi3519AV100=[4, 1988]|
927                                                       Hi3516CV500=[4, 1092]|Hi3516DV300=[4, 1092]|
928                                                       Hi3516AV300=[4, 1092]|Hi3559V200=[4, 1092]|
929                                                       Hi3556V200=[4, 1092]|Hi3516EV200 = [4,255]|
930                                                       Hi3516EV300 =[4,255]| Hi3518EV300 = [4,255 ]|
931                                                       Hi3516DV200 = [4,255 ]; limited Range:[4, u32Height/4 - 60];
932                                                       Member used to store the height data of each GRID partition */
933     ISP_SHADING_GAIN_LUT_S astLscGainLut[HI_ISP_MLSC_GAIN_LUT_NUM];
934     ISP_BNR_LSC_GAIN_LUT_S stBNRLscGainLut; /* Not support for Hi3559AV100/Hi3519AV100/Hi3516EV200/Hi3516EV300 */
935 } ISP_SHADING_LUT_ATTR_S;
936 
937 typedef struct hiISP_MLSC_CALIBRATION_CFG_S {
938     ISP_BAYER_FORMAT_E enBayer;   /* RW; Range: [0, 3];Format ENUM;Shows bayer pattern */
939     ISP_BAYER_RAWBIT_E enRawBit;  /* RW; Range: {8,10,12,14,16};Format ENUM;Shows input raw bitwidth */
940 
941     HI_U16  u16ImgHeight; /* RW; Range: [0, 65535];Format 16.0;Input raw image height */
942     HI_U16  u16ImgWidth;  /* RW; Range: [0, 65535];Format 16.0;Input raw image width */
943 
944     HI_U16  u16DstImgHeight; /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgHeight], Image height that
945                                 crop from input raw image, set to ImgHeight if don't need to crop */
946     HI_U16  u16DstImgWidth;  /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgWidth], Image width that
947                                 crop from input raw image, set to ImgWidth if don't need to crop */
948     HI_U16  u16OffsetX;      /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgWidth - u16DstImgWidth],
949                                 Horizontal offset that crop from input raw image, set to 0 if don't need to crop */
950     HI_U16  u16OffsetY;      /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgHeight - u16DstImgHeight],
951                                 Vertical offset that crop from input raw image, set to 0 if don't need to crop */
952 
953     HI_U32  u32MeshScale; /* RW; Range: [0, 7];Format 3.0; Shows Mesh Scale value */
954 
955     HI_U16  u16BLCOffsetR; /* RW; Range: [0, 4095];Format 12.0;BLC value for R channel */
956     HI_U16  u16BLCOffsetGr; /* RW; Range: [0, 4095];Format 12.0;BLC value for Gr channel */
957     HI_U16  u16BLCOffsetGb; /* RW; Range: [0, 4095];Format 12.0;BLC value for Gb channel */
958     HI_U16  u16BLCOffsetB; /* RW; Range: [0, 4095];Format 12.0;BLC value for B channel */
959 } ISP_MLSC_CALIBRATION_CFG_S;
960 
961 typedef struct hiISP_MESH_SHADING_TABLE_S {
962     HI_U8  u8MeshScale;       /* RW; Range:[0, 7];Format:3.0;Three bit value that selects the scale and precision for
963                                   the 10 bit gain coefficients stored in mesh tables */
964     HI_U16 au16XGridWidth[HI_ISP_MLSC_X_HALF_GRID_NUM]; /* RW; Range:Hi3559AV100=[4, 16323]| Hi3519AV100=[4, 16323]|
965                                                       Hi3516CV500=[4, 16323]|Hi3516DV300=[4, 16323]|
966                                                       Hi3516AV300=[4, 16323] | Hi3559V200=[4, 16323]|
967                                                       Hi3556V200=[4, 16323]|Hi3516EV200 = [4,255]|
968                                                       Hi3516EV300 =[4,255]| Hi3518EV300 = [4,255 ]|
969                                                       Hi3516DV200 = [4,255 ]; limited Range:[4, u16ImgWidth /4 - 60],
970                                                       Member used to store the width data of each GRID partition */
971     HI_U16 au16YGridWidth[HI_ISP_MLSC_Y_HALF_GRID_NUM]; /* RW; Hi3559AV100=[4, 16323]| Hi3519AV100=[4, 16323]|
972                                                       Hi3516CV500=[4, 16323]|Hi3516DV300=[4, 16323]|
973                                                       Hi3516AV300=[4, 16323]| Hi3559V200=[4, 16323] |
974                                                       Hi3556V200=[4, 16323]|Hi3516EV200 = [4,255]|
975                                                       Hi3516EV300 =[4,255]| Hi3518EV300 = [4,255 ]|
976                                                       Hi3516DV200 = [4,255 ]; limited Range:[4, u16ImgHeight /4 - 60],
977                                                       Member used to store the height data of each GRID partition */
978     ISP_SHADING_GAIN_LUT_S stLscGainLut;
979     ISP_BNR_LSC_GAIN_LUT_S stBNRLscGainLut; /* Not support for Hi3559AV100/Hi3519AV100/
980                                                Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
981 } ISP_MESH_SHADING_TABLE_S;
982 
983 /* Only used for Hi3559AV100/Hi3519AV100 */
984 typedef struct hiISP_RADIAL_SHADING_ATTR_S {
985     HI_BOOL bEnable;          /* RW; Range:[0, 1];Format:1.0; enable/disable rlsc */
986     HI_U16  u16RadialStr;     /* RW; Range:[0, 65535];Format:4.12; the strength of the mesh shading correctio */
987 } ISP_RADIAL_SHADING_ATTR_S;
988 
989 /* Only used for Hi3559AV100/Hi3519AV100 */
990 typedef struct hiISP_RADIAL_SHADING_LUT_S {
991     HI_U16  au16RGain[HI_ISP_RLSC_POINTS];  /* RW; Range:[0, 65535];Member used to store the calibration data of the
992                                                R channel required for RLSC.Only used for Hi3559AV100/Hi3519AV100 */
993     HI_U16  au16GrGain[HI_ISP_RLSC_POINTS]; /* RW; Range:[0, 65535];Member used to store the calibration data of the
994                                                Gr channel required for RLSC.Only used for Hi3559AV100/Hi3519AV100 */
995     HI_U16  au16GbGain[HI_ISP_RLSC_POINTS]; /* RW; Range:[0, 65535];Member used to store the calibration data of the
996                                                Gb channel required for RLSC.Only used for Hi3559AV100/Hi3519AV100 */
997     HI_U16  au16BGain[HI_ISP_RLSC_POINTS];  /* RW; Range:[0, 65535];Member used to store the calibration data of the
998                                                B channel required for RLSC.Only used for Hi3559AV100/Hi3519AV100 */
999 } ISP_RADIAL_SHADING_GAIN_LUT_S;
1000 
1001 /* Only used for Hi3559AV100/Hi3519AV100 */
1002 typedef struct hiISP_RADIAL_SHADING_LUT_ATTR_S {
1003     OPERATION_MODE_E enLightMode;  /* RW; Range:[0, 1];Format:1.0; 1: manual mode; 0: auto mode */
1004     HI_U16  u16BlendRatio;         /* RW; Range:[0, 256];Format:8.0; Used in manual mode only, indicates the light
1005                                       blending strength for the first light info */
1006     HI_U8   u8LightType1;          /* RW; Range:[0, 2];Format:2.0; Used in manual mode only, indicates the first light
1007                                      source selected */
1008     HI_U8   u8LightType2;          /* RW; Range:[0, 2];Format:2.0; Used in manual mode only, indicates the second light
1009                                       source selected */
1010     HI_U8   u8RadialScale;         /* RW; Range:[0, 13];Format:4.0;Four bit value that selects the scale and precision
1011                                       for the 10 bit gain coefficients */
1012     HI_U16  u16CenterRX;     /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Width - 1], shows x value of the
1013                                 position of optical center of red channel */
1014     HI_U16  u16CenterRY;     /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Height - 1], shows y value of the
1015                                 position of optical center of red channel */
1016     HI_U16  u16CenterGrX;    /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Width - 1], shows x value of the
1017                                 position of optical center of gr channel */
1018     HI_U16  u16CenterGrY;    /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Height - 1], shows y value of the
1019                                 position of optical center of gr channel */
1020     HI_U16  u16CenterGbX;    /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Width - 1], shows x value of the
1021                                 position of optical center of gb channel */
1022     HI_U16  u16CenterGbY;    /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Height - 1], shows y value of the
1023                                 position of optical center of gb channel */
1024     HI_U16  u16CenterBX;     /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Width - 1], shows x value of the
1025                                 position of optical center of blue channel */
1026     HI_U16  u16CenterBY;     /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Height - 1], shows y value of the
1027                                 position of optical center of blue channel */
1028     HI_U16  u16OffCenterR;   /* RW; Range:[0, 65535];Format:16.0;related to the 1/R^2 value of red channel */
1029     HI_U16  u16OffCenterGr;  /* RW; Range:[0, 65535];Format:16.0;related to the 1/R^2 value of gr channel */
1030     HI_U16  u16OffCenterGb;  /* RW; Range:[0, 65535];Format:16.0;related to the 1/R^2 value of gb channel */
1031     HI_U16  u16OffCenterB;   /* RW; Range:[0, 65535];Format:16.0;related to the 1/R^2 value of blue channel */
1032     ISP_RADIAL_SHADING_GAIN_LUT_S astRLscGainLut[HI_ISP_RLSC_GAIN_LUT_NUM];
1033 } ISP_RADIAL_SHADING_LUT_ATTR_S;
1034 
1035 typedef struct hiISP_RLSC_CALIBRATION_CFG_S {
1036     ISP_BAYER_FORMAT_E enBayer;    /* RW; Range: [0, 3];Format ENUM;Shows bayer pattern */
1037     ISP_BAYER_RAWBIT_E enRawBit;  /* RW; Range: {8,10,12,14,16};Format ENUM;Shows input raw bitwidth */
1038 
1039     HI_U16  u16ImgHeight; /* RW; Range: [0, 65535];Format 16.0;Input raw image height */
1040     HI_U16  u16ImgWidth;  /* RW; Range: [0, 65535];Format 16.0;Input raw image width */
1041 
1042     HI_U16  u16CenterX;       /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgWidth - u16DstImgWidth],
1043                                Horizontal offset that crop from input raw image, set to 0 if don't need to crop */
1044     HI_U16  u16CenterY;       /* RW; Range: [0, 65535];Format 16.0;limited Range:[0, u16ImgHeight - u16DstImgHeight],
1045                                Vertical offset that crop from input raw image, set to 0 if don't need to crop */
1046     HI_U16  u16Radius;        /* RW; Range: [0, 65535];Format 16.0; radius of the area need to calibrate */
1047 
1048     HI_U16  u16RadialScale;  /* RW; Range: [0, 7];Format 3.0; Shows Mesh Scale value */
1049 
1050     HI_U16  u16BlcOffsetR;  /* RW; Range: [0, 4095];Format 12.0;BLC value for R channel */
1051     HI_U16  u16BlcOffsetGr; /* RW; Range: [0, 4095];Format 12.0;BLC value for Gr channel */
1052     HI_U16  u16BlcOffsetGb; /* RW; Range: [0, 4095];Format 12.0;BLC value for Gb channel */
1053     HI_U16  u16BlcOffsetB;  /* RW; Range: [0, 4095];Format 12.0;BLC value for B channel */
1054 } ISP_RLSC_CALIBRATION_CFG_S;
1055 
1056 typedef struct hiISP_RADIAL_SHADING_TABLE_S {
1057     HI_U8   u16RadialScale;       /* RW; Range:[0, 13];Format:4.0;Four bit value that selects the scale and precision
1058                                       for the 10 bit gain coefficients */
1059     HI_U16  u16CenterX; /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Width - 1], shows x value of the position
1060                               of optical center */
1061     HI_U16  u16CenterY; /* RW; Range:[0, 65535];Format:16.0;Limited Range:[0, Height - 1], shows y value of the position
1062                               of optical center */
1063     HI_U16  u16OffCenter;   /* RW; Range:[0, 65535];Format:16.0;related to the 1/R^2 value of all channel */
1064     ISP_RADIAL_SHADING_GAIN_LUT_S stRlscGainLut; /* Only used for Hi3559AV100/Hi3519AV100 */
1065 } ISP_RADIAL_SHADING_TABLE_S;
1066 
1067 typedef struct {
1068     HI_BOOL bEnable;        /* RW; Range:[0, 1];Format:1.0;Acs Enable. */
1069     HI_U16  u16YStrength;   /* RW; Range:[0, 256];Format:8.0;Acs correction strength for y shading. */
1070     HI_U16  u16RunInterval; /* RW; Range:[1, 255];Format:16.0;Acs Run Interval. */
1071     HI_BOOL bLockEnable;    /* RW; Range:[0, 1];Format:1.0;Lock Gain Lut Enable. */
1072 } ISP_ACS_ATTR_S;
1073 
1074 typedef struct hiISP_NR_MANUAL_ATTR_S {
1075     HI_U8  au8ChromaStr[ISP_BAYER_CHN_NUM]; /* RW;Range:[0, 3];Format:2.0;
1076                                                Strength of Chrmoa noise reduction for R/Gr/Gb/B channel,
1077                                                Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1078     HI_U8  u8FineStr;                    /* RW;Range:[0, 0x80];Format:8.0;Strength of Luma noise reduction */
1079     HI_U16 u16CoringWgt;                 /* RW;Range:[0, 0xc80];Format:12.0;Strength of reserving the random noise */
1080     HI_U16 au16CoarseStr[ISP_BAYER_CHN_NUM]; /* RW;Range:[0,0x360];Format:10.0;Coarse Strength of noise reduction */
1081 } ISP_NR_MANUAL_ATTR_S;
1082 
1083 typedef struct hiISP_NR_AUTO_ATTR_S {
1084     HI_U8   au8ChromaStr[ISP_BAYER_CHN_NUM][ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:[0, 3];Format:2.0;
1085                                                                             Strength of chrmoa noise reduction for
1086                                                                             R/Gr/Gb/B channel,
1087                                                                             Not support for Hi3516EV200/Hi3516EV300/
1088                                                                             Hi3518EV300/Hi3516DV200 */
1089     HI_U8   au8FineStr[ISP_AUTO_ISO_STRENGTH_NUM];                       /* RW;Range:[0, 0x80];Format:8.0;
1090                                                                             Strength of luma noise reduction */
1091     HI_U16  au16CoringWgt[ISP_AUTO_ISO_STRENGTH_NUM];                    /* RW;Range:[0, 0xc80];Format:12.0;
1092                                                                             Strength of reserving the random noise */
1093     HI_U16  au16CoarseStr[ISP_BAYER_CHN_NUM][ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;Range:[0, 0x360];Format:10.0;
1094                                                                             Coarse Strength of noise reduction */
1095 } ISP_NR_AUTO_ATTR_S;
1096 
1097 typedef struct hiISP_NR_WDR_ATTR_S {
1098     HI_U8 au8WDRFrameStr[WDR_MAX_FRAME_NUM];    /* RW;Range:[0, 0x50];Format:7.0;Strength of each frame in wdr mode */
1099     HI_U8 au8FusionFrameStr[WDR_MAX_FRAME_NUM]; /* RW;Range:[0, 0x50];Format:7.0;Strength of each frame in wdr mode.
1100                                                    Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/
1101                                                    Hi3556V200/Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1102 } ISP_NR_WDR_ATTR_S;
1103 
1104 typedef struct hiISP_NR_ATTR_S {
1105     HI_BOOL  bEnable;              /* RW;Range:[0, 0x1];Format:1.0; Nr Enable */
1106     HI_BOOL  bLowPowerEnable;      /* RW;Range:[0, 0x1];Format:1.0; Nr Low Power Enable.
1107                                       Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
1108                                       Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1109     HI_BOOL  bNrLscEnable;         /* RW;Range:[0, 1];Format:1.0;
1110                                       HI_TRUE: Noise reduction refers to lens shading;
1111                                       HI_FALSE: Noise reduction not refers to lens shading; */
1112     HI_U8    u8NrLscRatio;         /* RW;Range:[0, 0xff];Format:8.0; Ratio of referring to lens shading.
1113                                       Not support  for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
1114                                       Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1115     HI_U8    u8BnrLscMaxGain;      /* RW;Range:[0, 0xbf];Format:2.6; Max gain for referring to lens shading.
1116                                       Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
1117                                       Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1118     HI_U16   u16BnrLscCmpStrength; /* RW;Range:[0, 0x100];Format:1.8; Compare strength for referring to lens shading.
1119                                       Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
1120                                       Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1121     HI_U16   au16CoringRatio[HI_ISP_BAYERNR_LUT_LENGTH]; /* RW;Range:[0x0, 0x3ff];Format:12.0;
1122                                                             Strength of reserving the random noise according to luma */
1123 
1124     ISP_OP_TYPE_E enOpType;
1125     ISP_NR_AUTO_ATTR_S stAuto;
1126     ISP_NR_MANUAL_ATTR_S stManual;
1127     ISP_NR_WDR_ATTR_S  stWdr;
1128 } ISP_NR_ATTR_S;
1129 
1130 /* Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
1131    Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1132 typedef struct hiISP_DE_MANUAL_ATTR_S {
1133     HI_U16 u16GlobalGain;  /* RW;Range:[0x0,0x100];Format:1.8 */
1134     HI_U16 u16GainLF;     /* RW;Range:[0x0,0x20];Format:2.4 */
1135     HI_U16 u16GainHF;     /* RW;Range:[0x0,0x20];Format:2.4 */
1136 } ISP_DE_MANUAL_ATTR_S;
1137 
1138 /* Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1139 typedef struct hiISP_DE_AUTO_ATTR_S {
1140     HI_U16 au16GlobalGain[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;Range:[0x0,0x100];Format:1.8 */
1141     HI_U16 au16GainLF[ISP_AUTO_ISO_STRENGTH_NUM];     /* RW;Range:[0x0,0x20];Format:2.4 */
1142     HI_U16 au16GainHF[ISP_AUTO_ISO_STRENGTH_NUM];     /* RW;Range:[0x0,0x20];Format:2.4 */
1143 } ISP_DE_AUTO_ATTR_S;
1144 
1145 /* Only used for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1146 typedef struct hiISP_DE_ATTR_S {
1147     HI_BOOL bEnable;                                    /* RW;Range:[0x0,0x1];Format:1.0; De Enable */
1148     HI_U16  au16LumaGainLut[HI_ISP_DE_LUMA_GAIN_LUT_N]; /* RW;Range:[0x0,0x100];Format:1.8 */
1149 
1150     ISP_OP_TYPE_E        enOpType;
1151     ISP_DE_AUTO_ATTR_S   stAuto;
1152     ISP_DE_MANUAL_ATTR_S stManual;
1153 } ISP_DE_ATTR_S;
1154 
1155 #define ISP_CVTMAT_NUM                            12
1156 #define ISP_EXP_CTRL_NUM                          2
1157 
1158 /* Only support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1159 typedef enum hiISP_IRBAYER_FORMAT_E {
1160     IRBAYER_GRGBI = 0,
1161     IRBAYER_RGBGI = 1,
1162     IRBAYER_GBGRI = 2,
1163     IRBAYER_BGRGI = 3,
1164     IRBAYER_IGRGB = 4,
1165     IRBAYER_IRGBG = 5,
1166     IRBAYER_IBGRG = 6,
1167     IRBAYER_IGBGR = 7,
1168     IRBAYER_BUTT
1169 } ISP_IRBAYER_FORMAT_E;
1170 
1171 /* Only support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1172 typedef enum hiISP_IR_CVTMAT_MODE_E {
1173     ISP_IR_CVTMAT_MODE_NORMAL = 0,
1174     ISP_IR_CVTMAT_MODE_MONO,
1175     ISP_IR_CVTMAT_MODE_USER,
1176     ISP_IR_CVTMAT_MODE_BUTT
1177 } ISP_IR_CVTMAT_MODE_E;
1178 
1179 /* Only support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1180 typedef struct hiISP_RGBIR_ATTR_S {
1181     HI_BOOL              bEnable;      /* RW;Range:[0x0, 0x1];Format:1.0; Enable/Disable RGBIR module */
1182     ISP_IRBAYER_FORMAT_E enInPattern;      /* RW;Range:[0x0, 0x7];Format:3.0; IR pattern of the input signal */
1183     ISP_BAYER_FORMAT_E   enOutPattern;     /* RW;Range:[0x0, 0x3];Format:2.0; Bayer pattern of the output signal */
1184 
1185     HI_U16               au16ExpCtrl[ISP_EXP_CTRL_NUM]; /* RW;Range:[0, 2047];Format:11.0;
1186                                                            Over expose control parameter */
1187     HI_U16               au16Gain[ISP_EXP_CTRL_NUM];    /* RW;Range:[0, 511];Format:9.0;
1188                                                            Over expose control  parameter */
1189 
1190     ISP_IR_CVTMAT_MODE_E enIRCvtMatMode;
1191     HI_S16               as16CvtMatrix[ISP_CVTMAT_NUM]; /* RW;Range:[-32768, 32767];Format:s15.0;  RGBIR to Bayer image
1192                                                           Convert matrix coefficients(need calibration) */
1193 } ISP_RGBIR_ATTR_S;
1194 
1195 /*
1196   Defines the type of the ISP gamma curve
1197   0 = Default curve
1198   1 = Default BT.709 curve (Gamma Curve)
1199   2 = Default SMPTE.2084 curve (PQ Curve), Only used for Hi3559AV100
1200   3 = User defined Gamma curve, LUT must be correct
1201 */
1202 typedef enum hiISP_GAMMA_CURVE_TYPE_E {
1203     ISP_GAMMA_CURVE_DEFAULT = 0x0,
1204     ISP_GAMMA_CURVE_SRGB,
1205     ISP_GAMMA_CURVE_HDR,    /* Only used for Hi3559AV100 */
1206     ISP_GAMMA_CURVE_USER_DEFINE,
1207     ISP_GAMMA_CURVE_BUTT
1208 } ISP_GAMMA_CURVE_TYPE_E;
1209 typedef struct hiISP_GAMMA_ATTR_S {
1210     HI_BOOL   bEnable;                     /* RW; Range:[0, 1]; Format:1.0;Enable/Disable Gamma Function */
1211     HI_U16    u16Table[GAMMA_NODE_NUM];    /* RW; Range:[0, 4095]; Format:12.0;Gamma LUT nodes value */
1212 
1213     ISP_GAMMA_CURVE_TYPE_E enCurveType;    /* RW; Range:[0, 3]; Format:2.0;Gamma curve type */
1214 } ISP_GAMMA_ATTR_S;
1215 
1216 typedef struct hiISP_PREGAMMA_ATTR_S {
1217     HI_BOOL   bEnable;                      /* RW; Range:[0, 1]; Format:1.0;Enable/Disable PreGamma Function */
1218     HI_U32    au32Table[PREGAMMA_NODE_NUM]; /* RW; Range:Hi3559AV100 = [0, 0x100000] | Hi3519AV100 = [0, 0x100000] |
1219                                                Hi3516CV500 = [0, 0xFFFFF] |Hi3516DV300 = [0, 0xFFFFF] |
1220                                                Hi3516AV300 = [0, 0xFFFFF] |Hi3559V200 = [0, 0xFFFFF] |
1221                                                Hi3556V200 = [0, 0xFFFFF] | Hi3516EV200 = [0x0, 0xFFFFF]|
1222                                                Hi3516EV300 = [0x0, 0xFFFFF]|Hi3518EV300 = [0x0,0xFFFFF]|
1223                                                Hi3516DV200 = [0x0,0xFFFFF]; Format:21.0;PreGamma LUT nodes value */
1224 } ISP_PREGAMMA_ATTR_S;
1225 
1226 typedef struct hiISP_PRELOGLUT_ATTR_S {
1227     HI_BOOL                 bEnable;  /* RW; Range:[0, 1]; Format:1.0;Enable/Disable PreLogLUT Function.
1228                                          Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1229 } ISP_PRELOGLUT_ATTR_S;
1230 
1231 typedef struct hiISP_LOGLUT_ATTR_S {
1232     HI_BOOL                 bEnable; /* RW; Range:[0, 1]; Format:1.0;Enable/Disable LogLUT Function.
1233                                         Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1234 } ISP_LOGLUT_ATTR_S;
1235 
1236 #define     ISP_SHARPEN_FREQ_CORING_LENGTH      8
1237 #define     SHRP_GAIN_LUT_SIZE                  64
1238 
1239 typedef struct hiISP_SHARPEN_MANUAL_ATTR_S {
1240     HI_U8  au8LumaWgt[ISP_SHARPEN_LUMA_NUM];  /* RW; Range: Hi3559AV100 =[0, 127]|Hi3519AV100=[0, 127]|
1241                                                Hi3516CV500 = [0, 127]|Hi3516DV300 =[0, 127]| Hi3516AV300 =[0, 127]|
1242                                                Hi3559V200 = [0, 127]| Hi3556V200 =[0, 127]| Hi3516EV200 = [0x0, 31]|
1243                                                Hi3516EV300 = [0x0, 31]|Hi3518EV300 = [0x0, 31]|Hi3516DV200 = [0x0, 31];
1244                                                Format:0.7;Adjust the sharpen strength according to luma.
1245                                                Sharpen strength will be weaker when it decrease. */
1246     HI_U16 au16TextureStr[ISP_SHARPEN_GAIN_NUM]; /* RW; Range: [0, 4095]; Format:7.5;
1247                                                   Undirectional sharpen strength for texture and detail enhancement */
1248     HI_U16 au16EdgeStr[ISP_SHARPEN_GAIN_NUM];    /* RW; Range: [0, 4095]; Format:7.5;
1249                                                     Directional sharpen strength for edge enhancement */
1250     HI_U16 u16TextureFreq;         /* RW; Range: [0, 4095];Format:6.6; Texture frequency adjustment.
1251                                       Texture and detail will be finer when it increase */
1252     HI_U16 u16EdgeFreq;            /* RW; Range: [0, 4095];Format:6.6; Edge frequency adjustment.
1253                                       Edge will be narrower and thiner when it increase */
1254     HI_U8  u8OverShoot;            /* RW; Range: [0, 127]; Format:7.0;u8OvershootAmt */
1255     HI_U8  u8UnderShoot;           /* RW; Range: [0, 127]; Format:7.0;u8UndershootAmt */
1256     HI_U8  u8ShootSupStr;          /* RW; Range: [0, 255]; Format:8.0;overshoot and undershoot suppression strength,
1257                                       the amplitude and width of shoot will be decrease when shootSupSt increase */
1258     HI_U8  u8ShootSupAdj;          /* RW; Range: [0, 15]; Format:4.0;overshoot and undershoot suppression adjusting,
1259                                       adjust the edge shoot suppression strength */
1260     HI_U8  u8DetailCtrl;           /* RW; Range: [0, 255]; Format:8.0;Different sharpen strength for detail and edge.
1261                                       When it is bigger than 128, detail sharpen strength will be stronger than edge */
1262     HI_U8  u8DetailCtrlThr;        /* RW; Range: [0, 255]; Format:8.0; The threshold of DetailCtrl, it is used to
1263                                       distinguish detail and edge. */
1264     HI_U8  u8EdgeFiltStr;          /* RW; Range: [0, 63]; Format:6.0;The strength of edge filtering. */
1265     HI_U8  u8EdgeFiltMaxCap;       /* RW; Range: [0, 47]; Format:6.0;The max capacity of edge filtering. */
1266     HI_U8  u8RGain;                /* RW; Range: [0, 31];   Format:5.0;Sharpen Gain for Red Area */
1267     HI_U8  u8GGain;                /* RW; Range: [0, 255]; Format:8.0; Sharpen Gain for Green Area */
1268     HI_U8  u8BGain;                /* RW; Range: [0, 31];   Format:5.0;Sharpen Gain for Blue Area */
1269     HI_U8  u8SkinGain;             /* RW; Range: [0, 31]; Format:5.0;Sharpen Gain for Skin Area */
1270     HI_U16  u16MaxSharpGain;       /* RW; Range: [0, 0x7FF]; Format:8.3; Maximum sharpen gain */
1271     HI_U8  u8WeakDetailGain;       /* RW; Range: [0, 127];
1272                                       Only support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200;
1273                                       sharpen Gain for weakdetail */
1274 } ISP_SHARPEN_MANUAL_ATTR_S;
1275 
1276 typedef struct hiISP_SHARPEN_AUTO_ATTR_S {
1277     HI_U8  au8LumaWgt[ISP_SHARPEN_LUMA_NUM][ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:Hi3559AV100 =[0, 127]|
1278                                                                           Hi3519AV100=[0, 127]|Hi3516CV500 = [0, 127]|
1279                                                                           Hi3516DV300 =[0, 127]| Hi3516AV300 =[0, 127]|
1280                                                                           Hi3559V200 = [0, 127] |Hi3556V200 = [0, 127]|
1281                                                                           Hi3556V200 =[0, 127]| Hi3516EV200 = [0x0, 31]|
1282                                                                           Hi3516EV300 = [0, 31]|Hi3518EV300 = [0x0, 31]|
1283                                                                           Hi3516DV200 = [0x0, 31]
1284                                                                           Format:0.7; Adjust the sharpen strength
1285                                                                           according to luma. Sharpen strength will be
1286                                                                           weaker when it decrease. */
1287     HI_U16 au16TextureStr[ISP_SHARPEN_GAIN_NUM][ISP_AUTO_ISO_STRENGTH_NUM];  /* RW; Range: [0, 4095]; Format:7.5;
1288                                                                                 Undirectional sharpen strength for
1289                                                                                 texture and detail enhancement */
1290     HI_U16 au16EdgeStr[ISP_SHARPEN_GAIN_NUM][ISP_AUTO_ISO_STRENGTH_NUM];     /* RW; Range: [0, 4095]; Format:7.5;
1291                                                                                 Directional sharpen strength for edge
1292                                                                                 enhancement */
1293     HI_U16 au16TextureFreq[ISP_AUTO_ISO_STRENGTH_NUM];   /* RW; Range: [0, 4095]; Format:6.6;Texture frequency
1294                                                             adjustment. Texture and detail will be finer
1295                                                             when it increase */
1296     HI_U16 au16EdgeFreq[ISP_AUTO_ISO_STRENGTH_NUM];      /* RW; Range: [0, 4095]; Format:6.6;Edge frequency adjustment.
1297                                                             Edge will be narrower and thiner when it increase */
1298     HI_U8  au8OverShoot[ISP_AUTO_ISO_STRENGTH_NUM];      /* RW; Range: [0, 127];  Format:7.0;u8OvershootAmt */
1299     HI_U8  au8UnderShoot[ISP_AUTO_ISO_STRENGTH_NUM];     /* RW; Range: [0, 127];  Format:7.0;u8UndershootAmt */
1300     HI_U8  au8ShootSupStr[ISP_AUTO_ISO_STRENGTH_NUM];    /* RW; Range: [0, 255]; Format:8.0;overshoot and undershoot
1301                                                             suppression strength, the amplitude and width of shoot will
1302                                                             be decrease when shootSupSt increase */
1303     HI_U8  au8ShootSupAdj[ISP_AUTO_ISO_STRENGTH_NUM];    /* RW; Range: [0, 15]; Format:4.0;overshoot and undershoot
1304                                                             suppression adjusting, adjust the edge shoot suppression
1305                                                             strength */
1306     HI_U8  au8DetailCtrl[ISP_AUTO_ISO_STRENGTH_NUM];     /* RW; Range: [0, 255]; Format:8.0;Different sharpen strength
1307                                                             for detail and edge. When it is bigger than 128, detail
1308                                                             sharpen strength will be stronger than edge. */
1309     HI_U8  au8DetailCtrlThr[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW; Range: [0, 255]; Format:8.0;
1310                                                             The threshold of DetailCtrl, it is used to distinguish
1311                                                             detail and edge. */
1312     HI_U8  au8EdgeFiltStr[ISP_AUTO_ISO_STRENGTH_NUM];    /* RW; Range: [0, 63]; Format:6.0;
1313                                                             The strength of edge filtering. */
1314     HI_U8  au8EdgeFiltMaxCap[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW; Range: [0, 47]; Format:6.0;
1315                                                              The max capacity of edge filtering. */
1316     HI_U8  au8RGain[ISP_AUTO_ISO_STRENGTH_NUM];           /* RW; Range: [0, 31]; Format:5.0;
1317                                                              Sharpen Gain for Red Area */
1318     HI_U8  au8GGain[ISP_AUTO_ISO_STRENGTH_NUM];           /* RW; Range: [0, 255]; Format:8.0;
1319                                                              Sharpen Gain for Green Area */
1320     HI_U8  au8BGain[ISP_AUTO_ISO_STRENGTH_NUM];           /* RW; Range: [0, 31]; Format:5.0;
1321                                                              Sharpen Gain for Blue Area */
1322     HI_U8  au8SkinGain[ISP_AUTO_ISO_STRENGTH_NUM];       /* RW; Range: [0, 31]; Format:5.0;Sharpen Gain for Skin Area */
1323     HI_U16  au16MaxSharpGain[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range: [0, 0x7FF]; Format:8.3; Maximum sharpen gain */
1324     HI_U8  au8WeakDetailGain[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range: [0, 127]; Format:7.0;
1325                                                         Only used for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200;
1326                                                         sharpen Gain for weakdetail */
1327 } ISP_SHARPEN_AUTO_ATTR_S;
1328 
1329 typedef struct hiISP_SHARPEN_ATTR_S {
1330     HI_BOOL bEnable;    /* RW; Range:[0, 1]; Format:1.0;Enable/Disable sharpen module */
1331     HI_U8 u8SkinUmin;   /* RW; Range: [0, 255];  Format:8.0; U min value of the range of skin area */
1332     HI_U8 u8SkinVmin;   /* RW; Range: [0, 255];  Format:8.0; V min value of the range of skin area */
1333     HI_U8 u8SkinUmax;   /* RW; Range: [0, 255];  Format:8.0; U max value of the range of skin area */
1334     HI_U8 u8SkinVmax;   /* RW; Range: [0, 255];  Format:8.0; V max value of the range of skin area */
1335     ISP_OP_TYPE_E enOpType;
1336     ISP_SHARPEN_MANUAL_ATTR_S stManual;
1337     ISP_SHARPEN_AUTO_ATTR_S   stAuto;
1338 } ISP_SHARPEN_ATTR_S;
1339 
1340 /* Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1341 typedef struct hiISP_EDGEMARK_ATTR_S {
1342     HI_BOOL bEnable;     /* RW; Range:[0, 1]; Format:1.0;Enable/Disable Edge Mark */
1343     HI_U8   u8Threshold; /* RW; Range: [0, 255]; Format:8.0 */
1344     HI_U32  u32Color;    /* RW; Range: [0, 0xFFFFFF]; Format:32.0; */
1345 } ISP_EDGEMARK_ATTR_S;
1346 
1347 /* High Light Constraint */
1348 /* Not support for Hi3559AV100/Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1349 typedef struct hiISP_HLC_ATTR_S {
1350     HI_BOOL bEnable;      /* RW; Range:[0, 1];  Format:1.0;Enable/Disable HLC module */
1351     HI_U8   u8LumaThr;    /* RW; Range:[0, 255];Format:8.0 */
1352     HI_U8   u8LumaTarget; /* RW; Range:[0, 255];Format:8.0 */
1353 } ISP_HLC_ATTR_S;
1354 
1355 /* Crosstalk Removal */
1356 typedef struct hiISP_CR_ATTR_S {
1357     HI_BOOL bEnable;       /* RW; Range: [0, 1];Format 1.0;Enable/disable the crosstalk removal module */
1358     HI_U8   u8Slope;       /* RW; Range: Hi3559AV100 = [0, 14] | Hi3519AV100 = [0, 14]|Hi3516CV500 = [0, 14]|
1359                               Hi3516DV300 =[0, 14] |Hi3516AV300 =[0, 14] | Hi3559V200 =[0, 14] |Hi3556V200 =[0, 14] |
1360                               Hi3516EV200 = [0, 16]|Hi3516EV300 = [0, 16]| Hi3518EV300 = [0, 16]|Hi3516DV200 = [0, 16];
1361                               Crosstalk slope value. */
1362     HI_U8   u8SensiSlope;  /* RW; Range: Hi3559AV100 = [0, 14] | Hi3519AV100 = [0, 14]|Hi3516CV500 = [0, 14]|
1363                               Hi3516DV300 =[0, 14]||Hi3516AV300 =[0, 14] | Hi3559V200 =[0, 14] |Hi3556V200 =[0, 14] |
1364                               Hi3516EV200 = [0, 16]|Hi3516EV300 = [0, 16]|Hi3518EV300 = [0, 16]|Hi3516DV200 = [0, 16];
1365                               Crosstalk sensitivity. */
1366     HI_U16  u16SensiThr;   /* RW; Range: Hi3559AV100 = [0, 16383] | Hi3519AV100 = [0, 16383]|Hi3516CV500 = [0, 16383]|
1367                               Hi3516DV300 =[0, 16383]|Hi3516AV300 =[0, 16383]| Hi3559V200 =[0, 16383]|
1368                               Hi3556V200 =[0, 16383]|Hi3516EV200 = [0,65535]|Hi3516EV300 = [0, 65535]|
1369                               Hi3518EV300 = [0, 65535]|Hi3516DV200 = [0, 65535];
1370                               Crosstalk sensitivity threshold. */
1371     HI_U16  au16Strength[ISP_AUTO_ISO_STRENGTH_NUM];   /* RW; Range: [0,256];Crosstalk strength value. */
1372     HI_U16  au16Threshold[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW; Range: Hi3559AV100 = [0, 16383] |
1373                                                           Hi3519AV100 = [0, 16383]|Hi3516CV500 = [0, 16383]|
1374                                                           Hi3516DV300 =[0, 16383] | Hi3516AV300 =[0, 16383]|
1375                                                           Hi3559V200 =[0, 16383] |Hi3556V200 =[0, 16383] |
1376                                                           Hi3516EV200 = [0, 65535]| Hi3516EV300 = [0, 65535]|
1377                                                           Hi3518EV300 = [0, 65535]|Hi3516DV200 = [0, 65535];
1378                                                           Crosstalk threshold. */
1379     HI_U16  au16NpOffset[ISP_AUTO_ISO_STRENGTH_NUM];   /* RW; Range: Hi3559AV100 = [512, 16383] |
1380                                                           Hi3519AV100 = [512, 16383]|Hi3516CV500 = [512, 16383]|
1381                                                           Hi3516DV300 =[512, 16383] |Hi3516AV300 =[512, 16383] |
1382                                                           Hi3559V200 =[512, 16383] |Hi3556V200 =[512, 16383] |
1383                                                           Hi3516EV200 = [8192, 65535]|Hi3516EV300 = [8192, 65535]|
1384                                                           Hi3518EV300 = [8192, 65535]|Hi3516DV200 = [8192, 65535];
1385                                                           Set Noise profile value. */
1386 } ISP_CR_ATTR_S;
1387 
1388 typedef struct hiISP_ANTIFALSECOLOR_MANUAL_ATTR_S {
1389     HI_U8    u8AntiFalseColorThreshold;     /* RW;Range:[0x0,0x20];Format:6.0;Threshold for antifalsecolor */
1390     HI_U8    u8AntiFalseColorStrength;      /* RW;Range:[0x0,0x1F];Format:5.0;Strength of antifalsecolor */
1391 } ISP_ANTIFALSECOLOR_MANUAL_ATTR_S;
1392 
1393 typedef struct hiISP_ANTIFALSECOLOR_AUTO_ATTR_S {
1394     HI_U8   au8AntiFalseColorThreshold[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;Range:[0x0, 0x20];Format:6.0;
1395                                                                       Threshold for antifalsecolor */
1396     HI_U8   au8AntiFalseColorStrength[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:[0x0, 0x1F];Format:5.0;
1397                                                                       Strength of antifalsecolor */
1398 } ISP_ANTIFALSECOLOR_AUTO_ATTR_S;
1399 
1400 typedef struct hiISP_ANTIFALSECOLOR_ATTR_S {
1401     HI_BOOL  bEnable;                               /* RW;Range:[0x0,0x1];Format:1.0; AntiFalseColor Enable */
1402     ISP_OP_TYPE_E enOpType;
1403     ISP_ANTIFALSECOLOR_AUTO_ATTR_S stAuto;
1404     ISP_ANTIFALSECOLOR_MANUAL_ATTR_S stManual;
1405 } ISP_ANTIFALSECOLOR_ATTR_S;
1406 
1407 typedef struct hiISP_DEMOSAIC_MANUAL_ATTR_S {
1408     HI_U8   u8NonDirStr;            /* RW; Range:[0x0, 0xFF]; Format:4.4; Non-direction strength */
1409     HI_U8   u8NonDirMFDetailEhcStr; /* RW; Range:Hi3559AV100 = [0x0, 0x10] |Hi3519AV100 = [0x0, 0x7f] |
1410                                        Hi3516CV500= [0x0, 0x7f]|Hi3516DV300= [0x0, 0x7f]| Hi3516AV300= [0x0, 0x7f]|
1411                                        Hi3559V200= [0x0, 0x7f]|Hi3556V200= [0x0, 0x7f]| Hi3516EV200 = [0x0, 0x7f]|
1412                                        Hi3516EV300 = [0x0, 0x7f]|Hi3518EV300 = [0x0, 0x7f]|Hi3516DV200 = [0x0, 0x7f];
1413                                        Format:3.4; Non-direction medium frequent detail enhance  strength */
1414     HI_U8   u8NonDirHFDetailEhcStr; /* RW; Range:[0x0, 0x10];  Format:2.2;
1415                                        Non-direction high frequent detail enhance strength */
1416     HI_U8   u8DetailSmoothRange;    /* RW; Range:Hi3559AV100 = [0x1, 0x8] |Hi3519AV100 = [0x1, 0x7] |
1417                                        Hi3516CV500 = [0x1, 0x7]|Hi3516DV300 = [0x1, 0x7]|
1418                                        Hi3516AV300 = [0x1, 0x7]|Hi3559V200 = [0x1, 0x7]|Hi3556V200 = [0x1, 0x7] |
1419                                        Hi3516EV200 = [0x1, 0x7]|Hi3516EV300 = [0x1, 0x7]|Hi3518EV300 = [0x1, 0x7]|
1420                                        Hi3516DV200 = [0x1, 0x7]; Format:4.0; Detail smooth range */
1421     HI_U16  u16DetailSmoothStr;     /* RW; Range:[0x0, 0x100]; Format:9.0; Strength of detail smooth,
1422                                        Only used for Hi3559AV100 */
1423     HI_U8   u8ColorNoiseThdF;       /* RW; Range:[0x0, 0xff]; Format:8.0; Threshold of color noise cancel */
1424     HI_U8   u8ColorNoiseStrF;       /* RW; Range:[0x0, 0x8]; Format:4.0; Strength of color noise cancel,
1425                                        Not available for Hi3559AV100 */
1426     HI_U8   u8ColorNoiseThdY;       /* RW; Range:Hi3559AV100 = [0x0, 0xFF] |Hi3519AV100 = [0x0, 0xFF] |
1427                                        Hi3516CV500 = [0x0, 0xFF] |Hi3516DV300 = [0x0, 0xFF] |
1428                                        Hi3516AV300 = [0x0, 0xFF] |Hi3559V200 = [0x0, 0xFF] |
1429                                        Hi3556V200 = [0x0, 0xFF] |Hi3516EV200 = [0x0, 0xF] |
1430                                        Hi3516EV300 = [0x0, 0xF] |Hi3518EV300 = [0x0, 0xF];
1431                                        Format:8.0; Range of color denoise luma, related to luminance and saturation */
1432     HI_U8   u8ColorNoiseStrY;       /* RW; Range:Hi3559AV100 = [0x0, 0xFF] |Hi3519AV100 = [0x0, 0xFF] |
1433                                        Hi3516CV500 = [0x0, 0xFF] |Hi3516DV300 = [0x0, 0xFF] |
1434                                        Hi3516AV300 = [0x0, 0xFF] |Hi3559V200 = [0x0, 0xFF] |
1435                                        Hi3556V200 = [0x0, 0xFF] |Hi3516EV200 = [0x0, 0x3F] |
1436                                        Hi3516EV300 = [0x0, 0x3F] |Hi3518EV300 = [0x0, 0x3F];
1437                                        Format:8.0;Format:8.0; Strength of color denoise luma */
1438 } ISP_DEMOSAIC_MANUAL_ATTR_S;
1439 
1440 typedef struct hiISP_DEMOSAIC_AUTO_ATTR_S {
1441     HI_U8  au8NonDirStr[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0xFF]; Format:4.4; Non-direction strength */
1442     HI_U8  au8NonDirMFDetailEhcStr[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:Hi3559AV100 = [0x0, 0x10] |
1443                                                                  Hi3519AV100 = [0x0, 0x7f] |Hi3516CV500= [0x0, 0x7f]|
1444                                                                  Hi3516DV300= [0x0, 0x7f]|Hi3516AV300= [0x0, 0x7f]|
1445                                                                  Hi3559V200 = [0x0, 0x7f] |Hi3556V200= [0x0, 0x7f] |
1446                                                                  Hi3516EV200= [0x0, 0x7f]|Hi3516EV300 = [0x0, 0x7f] |
1447                                                                  Hi3518EV300= [0x0, 0x7f]|Hi3516DV200 = [0x0, 0x7f];
1448                                                                  Format:3.4; Non-direction medium frequent detail
1449                                                                  enhance strength */
1450     HI_U8  au8NonDirHFDetailEhcStr[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0x10];  Format:2.2; Non-direction
1451                                                                   high frequent detail enhance strength */
1452     HI_U8  au8DetailSmoothRange[ISP_AUTO_ISO_STRENGTH_NUM];    /* RW; Range:Hi3559AV100 = [0x1, 0x8] |
1453                                                                  Hi3519AV100 = [0x1, 0x7] |Hi3516CV500 = [0x1, 0x7]|
1454                                                                  Hi3516DV300 = [0x1, 0x7]|Hi3516AV300 = [0x1, 0x7]|
1455                                                                  Hi3559V200 = [0x1, 0x7] |Hi3556V200 = [0x1, 0x7]|
1456                                                                  Hi3516EV200= [0x1, 0x7]|Hi3516EV300 = [0x, 0x7] |
1457                                                                  Hi3518EV300= [0x1, 0x7]|Hi3516DV200= [0x1, 0x7];
1458                                                                  Format:4.0; Detail smooth range */
1459     HI_U16 au16DetailSmoothStr[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW;Range:[0x0, 0x100]; Format:9.0;
1460                                                               Strength of detail smooth, Only used for Hi3559AV100 */
1461     HI_U8  au8ColorNoiseThdF[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:[0x0, 0xff]; Format:8.0;
1462                                                              Threshold of color noise cancel */
1463     HI_U8  au8ColorNoiseStrF[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:[0x0, 0x8]; Format:4.0; Strength of color noise
1464                                                              cancel, Not available for Hi3559AV100 */
1465     HI_U8  au8ColorNoiseThdY[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:Hi3559AV100 = [0x0, 0xFF] |
1466                                                              Hi3519AV100 = [0x0, 0xFF] | Hi3516CV500 = [0x0, 0xFF] |
1467                                                              Hi3516DV300 = [0x0, 0xFF] | Hi3516AV300 = [0x0, 0xFF] |
1468                                                              Hi3559V200 = [0x0, 0xFF] | Hi3556V200 = [0x0, 0xFF] |
1469                                                              Hi3516EV200 = [0x0, 0xF] | Hi3516EV300 = [0x0, 0xF] |
1470                                                              Hi3518EV300 = [0x0, 0xF];
1471                                                              Format:8.0; Range of color denoise luma, related to
1472                                                              luminance and saturation */
1473     HI_U8  au8ColorNoiseStrY[ISP_AUTO_ISO_STRENGTH_NUM];  /* RW;Range:Hi3559AV100 = [0x0, 0xFF] |
1474                                                              Hi3519AV100 = [0x0, 0xFF] | Hi3516CV500 = [0x0, 0xFF] |
1475                                                              Hi3516DV300 = [0x0, 0xFF] | Hi3516AV300 = [0x0, 0xFF] |
1476                                                              Hi3559V200 = [0x0, 0xFF] | Hi3556V200 = [0x0, 0xFF] |
1477                                                              Hi3516EV200 = [0x0, 0x3F] | Hi3516EV300 = [0x0, 0x3F] |
1478                                                              Hi3518EV300 = [0x0, 0x3F];
1479                                                              Format:8.0;Format:8.0; Strength of color denoise luma */
1480 } ISP_DEMOSAIC_AUTO_ATTR_S;
1481 
1482 typedef struct hiISP_DEMOSAIC_ATTR_S {
1483     HI_BOOL bEnable;        /* RW; Range:[0, 1]; Format:1.0;Enable/Disable demosaic module */
1484     ISP_OP_TYPE_E enOpType;
1485     ISP_DEMOSAIC_MANUAL_ATTR_S stManual;
1486     ISP_DEMOSAIC_AUTO_ATTR_S stAuto;
1487 } ISP_DEMOSAIC_ATTR_S;
1488 
1489 /* Defines the attributes of the ISP black level */
1490 typedef struct hiISP_BLACK_LEVEL_S {
1491     ISP_OP_TYPE_E enOpType;
1492     HI_U16 au16BlackLevel[ISP_BAYER_CHN_NUM]; /* RW; Range: [0x0, 0xFFF];Format:12.0;
1493                                                  Black level values that correspond to the black levels of the
1494                                                  R,Gr, Gb, and B components respectively. */
1495 } ISP_BLACK_LEVEL_S;
1496 
1497 /*
1498   Defines the FPN removal type
1499   0 = Frame mode correction
1500   1 = Line mode correction
1501  */
1502 typedef enum hiISP_FPN_TYPE_E {
1503     ISP_FPN_TYPE_FRAME = 0,
1504     ISP_FPN_TYPE_LINE = 1,
1505     ISP_FPN_TYPE_BUTT
1506 } ISP_FPN_TYPE_E;
1507 
1508 /* Defines the information about calibrated black frames */
1509 typedef struct hiISP_FPN_FRAME_INFO_S {
1510     HI_U32              u32Iso;             /* RW;Range:[0x64,0xFFFFFFFF];Format:32.0;FPN CALIBRATE ISO */
1511     HI_U32              u32Offset[VI_MAX_SPLIT_NODE_NUM]; /* RW;Range:[0, 0xFFF];Format:12.0;
1512                                                              FPN frame u32Offset (agv pixel value) */
1513     HI_U32              u32FrmSize;         /* RW;FPN frame size (exactly frm size or compress len) */
1514     VIDEO_FRAME_INFO_S  stFpnFrame;         /* FPN frame info, 8bpp,10bpp,12bpp,16bpp. Compression or not */
1515 } ISP_FPN_FRAME_INFO_S;
1516 
1517 /* Defines the calibration attribute of the FPN removal module */
1518 typedef struct hiISP_FPN_CALIBRATE_ATTR_S {
1519     HI_U32               u32Threshold; /* RW;Range:[1,0xFFF];Format:12.0;pix value > threshold means defective pixel */
1520     HI_U32               u32FrameNum;  /* RW;Range:[1, 16];Format:5.0;Number of frames to be calibrated.
1521                                       The value range is {1, 2, 4, 8, 16},that is, the integer exponentiation of 2 */
1522     ISP_FPN_TYPE_E       enFpnType;    /* frame mode or line mode */
1523     ISP_FPN_FRAME_INFO_S stFpnCaliFrame;
1524 } ISP_FPN_CALIBRATE_ATTR_S;
1525 /* Defines the manual correction attribute of the FPN removal module. */
1526 typedef struct hiISP_FPN_MANUAL_ATTR_S {
1527     HI_U32               u32Strength;         /* RW;Range:[0,1023];Format:10.0;Manual correction strength */
1528 } ISP_FPN_MANUAL_ATTR_S;
1529 
1530 /* Defines the automatic correction attribute of the FPN removal module */
1531 typedef struct hiISP_FPN_AUTO_ATTR_S {
1532     HI_U32               u32Strength;          /* RW;Range:[0,1023];Format:10.0;Auto correction strength */
1533 } ISP_FPN_AUTO_ATTR_S;
1534 
1535 /* Defines the correction attribute of the FPN removal module */
1536 typedef struct hiISP_FPN_ATTR_S {
1537     HI_BOOL               bEnable;            /* RW;Range:[0,1];Format:1.0; */
1538     ISP_OP_TYPE_E         enOpType;           /* manual or auto mode */
1539     ISP_FPN_TYPE_E        enFpnType;          /* frame mode or line mode */
1540     ISP_FPN_FRAME_INFO_S  stFpnFrmInfo;       /* input in correction mode. */
1541     ISP_FPN_MANUAL_ATTR_S stManual;
1542     ISP_FPN_AUTO_ATTR_S   stAuto;
1543 } ISP_FPN_ATTR_S;
1544 
1545 /* Defines the manual dehze attribute */
1546 typedef struct hiISP_DEHAZE_MANUAL_ATTR_S {
1547     HI_U8              u8strength;  /* RW;Range:[0,0xFF];Format:8.0;Manual dehze strength */
1548 } ISP_DEHAZE_MANUAL_ATTR_S;
1549 
1550 /* Defines the automatic dehze attribute */
1551 typedef struct hiISP_DEHAZE_AUTO_ATTR_S {
1552     HI_U8 u8strength; /* RW;Range:[0,0xFF];Format:8.0;Weighted coefficient for automatic dehaze strength. */
1553 } ISP_DEHAZE_AUTO_ATTR_S;
1554 
1555 /* Defines the ISP dehaze attribute */
1556 typedef struct hiISP_DEHAZE_ATTR_S {
1557     HI_BOOL  bEnable;           /* RW;Range:[0,1];Format:1.0; */
1558     HI_BOOL  bUserLutEnable;    /* RW;Range:[0,1];0:Auto Lut 1:User Lut */
1559     HI_U8    au8DehazeLut[DEHAZE_LUT_SIZE];
1560     ISP_OP_TYPE_E      enOpType;
1561     ISP_DEHAZE_MANUAL_ATTR_S stManual;
1562     ISP_DEHAZE_AUTO_ATTR_S   stAuto;
1563     HI_U16       u16TmprfltIncrCoef; /* RW, Range: [0x0, 0x80].filter increase coeffcient. */
1564     HI_U16       u16TmprfltDecrCoef; /* RW, Range: [0x0, 0x80].filter decrease coeffcient. */
1565 } ISP_DEHAZE_ATTR_S;
1566 
1567 /* Defines purple fringing correction manual attribute */
1568 typedef struct hiISP_DEPURPLESTR_MANUAL_ATTR_S {
1569     HI_U8 u8DePurpleCrStr;               /* RW;Range: [0,8];Format:4.0;Correction strength of the R channel */
1570     HI_U8 u8DePurpleCbStr;               /* RW;Range: [0,8];Format:4.0;Correction strength of the B channel */
1571 } ISP_DEPURPLESTR_MANUAL_ATTR_S;
1572 
1573 /* Defines purple fringing correction automatic attribute */
1574 typedef struct hiISP_DEPURPLESTR_AUTO_ATTR_S {
1575     HI_U8 au8DePurpleCrStr[ISP_EXP_RATIO_STRENGTH_NUM]; /* RW;Range: [0, 8];Format:4.0;
1576                                                            Correction strength of the R channel */
1577     HI_U8 au8DePurpleCbStr[ISP_EXP_RATIO_STRENGTH_NUM]; /* RW;Range: [0, 8];Format:4.0;
1578                                                            Correction strength of the B channel */
1579 } ISP_DEPURPLESTR_AUTO_ATTR_S;
1580 
1581 /* Purple fringing detection and correction attribute */
1582 typedef struct hiISP_LOCAL_CAC_ATTR_S {
1583     HI_BOOL bEnable;             /* RW;Range: [0,1];Format:1.0; enable/disable local cac */
1584     HI_U16  u16PurpleDetRange;   /* RW;Range: [0,410];Format:9.0;Purple fringing detection scope */
1585     HI_U16  u16VarThr;           /* RW;Range: [0,4095];Format:12.0;Edge detection threshold */
1586     HI_U16  u16RDetThr[ISP_LCAC_DET_NUM];    /* RW;Range: [0,4095];Format:12.0;Component R detection threshold */
1587     HI_U16  u16GDetThr[ISP_LCAC_DET_NUM];    /* RW;Range: [0,4095];Format:12.0;Component G detection threshold */
1588     HI_U16  u16BDetThr[ISP_LCAC_DET_NUM];    /* RW;Range: [0,4095];Format:12.0;Component B detection threshold */
1589     HI_U16  u16LumaDetThr[ISP_LCAC_DET_NUM]; /* RW;Range: [0,4095];Format:12.0;Component Luma detection threshold */
1590     HI_S16  s16CbCrRatio[ISP_LCAC_DET_NUM];  /* RW;Range: [-2048, 2047];Format:S12.0; Cb/Cr ratio threshold,
1591                                                 Not supported in hi3559av100 and hi3519av100 */
1592     ISP_OP_TYPE_E      enOpType; /* RW;Range: [0,1];Format:1.0;Purple fringing correction working mode */
1593     ISP_DEPURPLESTR_MANUAL_ATTR_S stManual;
1594     ISP_DEPURPLESTR_AUTO_ATTR_S   stAuto;
1595 } ISP_LOCAL_CAC_ATTR_S;
1596 
1597 /* Defines the lateral chromatic aberration correction attribute,
1598    Not support for Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1599 typedef struct hiISP_GLOBAL_CAC_ATTR_S {
1600     HI_BOOL bEnable;            /* RW; Range: [0, 1];Format: 1.0;  enable/disable global cac */
1601     HI_U16  u16VerCoordinate;   /* RW; Range: [0, 8191];Format: 13.0; limited Range: [0, ImageHeight - 1],
1602                                    Vertical coordinate of the optical center */
1603     HI_U16  u16HorCoordinate;   /* RW; Range: [0, 8191];Format: 13.0; limited range : [0, ImageWidth - 1],
1604                                    Horizontal coordinate of the optical center */
1605     HI_S16  s16ParamRedA;       /* RW; Range: [-256, 255];Format: 9.0;
1606                                    Coefficient a of the radius polynomial corresponding to channel R */
1607     HI_S16  s16ParamRedB;       /* RW; Range: [-256, 255];Format: 9.0;
1608                                    Coefficient b of the radius polynomial corresponding to channel R */
1609     HI_S16  s16ParamRedC;       /* RW; Range: [-256, 255];Format: 9.0;
1610                                    Coefficient c of the radius polynomial corresponding to channel R */
1611     HI_S16  s16ParamBlueA;      /* RW; Range: [-256, 255];Format: 9.0;
1612                                    Coefficient a of the radius polynomial corresponding to channel B */
1613     HI_S16  s16ParamBlueB;      /* RW; Range: [-256, 255];Format: 9.0;
1614                                    Coefficient b of the radius polynomial corresponding to channel B */
1615     HI_S16  s16ParamBlueC;      /* RW; Range: [-256, 255];Format: 9.0;
1616                                    Coefficient c of the radius polynomial corresponding to channel B */
1617     HI_U8   u8VerNormShift;     /* RW; Range: [0, 7];Format: 3.0;
1618                                    Normalized shift parameter in the vertical direction */
1619     HI_U8   u8VerNormFactor;    /* RW; Range: [0, 31];Format: 5.0; Normalized coefficient in the vertical direction */
1620     HI_U8   u8HorNormShift;     /* RW; Range: [0, 7];Format: 3.0;
1621                                    Normalized shift parameter in the horizontal direction */
1622     HI_U8   u8HorNormFactor;    /* RW; Range: [0, 31];Format: 5.0;
1623                                    Normalized coefficient in the horizontal direction */
1624     HI_U16  u16CorVarThr;       /* RW; Range: [0, 4095];Format: 12.0;
1625                                    Variance threshold of lateral chromatic aberration correction */
1626 } ISP_GLOBAL_CAC_ATTR_S;
1627 
1628 /* Defines the Radial Crop attribute */
1629 typedef struct hiISP_RC_ATTR_S {
1630     HI_BOOL bEnable;       /* RW;Range:[0, 1];Format:1.0; enable/disableridial crop;
1631                               Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1632     POINT_S stCenterCoor;  /* RW;the coordinate of central pixel.
1633                               Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1634     HI_U32  u32Radius;     /* RW;Range:[0, 11586];Format:14.0; when the distance to central pixel is greater than
1635                               u32Radius, the pixel value becomes 0.
1636                               Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200 */
1637 } ISP_RC_ATTR_S;
1638 
1639 typedef struct hiISP_INNER_STATE_INFO_S {
1640     HI_U16 au16TextureStr[ISP_SHARPEN_GAIN_NUM]; /* RW; range: [0, 4095]; Format:7.5;Undirectional sharpen strength
1641                                                     for texture and detail enhancement */
1642     HI_U16 au16EdgeStr[ISP_SHARPEN_GAIN_NUM];    /* RW; range: [0, 4095]; Format:7.5;Directional sharpen strength
1643                                                     for edge enhancement */
1644     HI_U16 u16TextureFreq;         /* RW; range: [0, 4095];Format:6.6; Texture frequency adjustment. Texture and detail
1645                                       will be finer when it increase */
1646     HI_U16 u16EdgeFreq;            /* RW; range: [0, 4095];Format:6.6; Edge frequency adjustment. Edge will be narrower
1647                                       and thiner when it increase */
1648     HI_U8  u8OverShoot;            /* RW; range: [0, 127]; Format:7.0;u8OvershootAmt */
1649     HI_U8  u8UnderShoot;           /* RW; range: [0, 127]; Format:7.0;u8UndershootAmt */
1650     HI_U8  u8ShootSupStr;          /* RW; range: [0, 255]; Format:8.0;overshoot and undershoot suppression strength,
1651                                       the amplitude and width of shoot will be decrease when shootSupSt increase */
1652 
1653     HI_U8   u8NrLscRatio;                       /* RW;Range:[0x0, 0xff];Format:8.0; Strength of reserving the random
1654                                                    noise according to luma,
1655                                                    Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 not support */
1656     HI_U16  au16CoarseStr[ISP_BAYER_CHN_NUM];   /* RW;Range:[0x0, 0x3ff];Format:10.0;
1657                                                    Coarse Strength of noise reduction */
1658     HI_U8   au8WDRFrameStr[WDR_MAX_FRAME_NUM];  /* RW;Range:[0x0, 0x50];Format:7.0;
1659                                                    Coarse strength of each frame in wdr mode */
1660     HI_U8   au8ChromaStr[ISP_BAYER_CHN_NUM];    /* RW;Range:[0x0, 0x3];Format:2.0;Strength of Chrmoa noise reduction
1661                                                    for R/Gr/Gb/B channel, Only used for Hi3559AV100/Hi3519AV100 */
1662     HI_U8   u8FineStr;              /* RW;Range:[0x0,0x80];Format:8.0;Strength of Luma noise reduction */
1663     HI_U16  u16CoringWgt;           /* RW;Range:[0x0,0xC80];Format:12.0;Strength of reserving the random noise */
1664 
1665     HI_U16 u16DeHazeStrengthActual; /* RW;Range:[0,0xFF];Format:8.0;actual dehze strength */
1666     HI_U16 u16DrcStrengthActual;    /* RW;Range: Hi3559AV100 = [0x0, 0xFF] | Hi3519AV100 = [0x0, 0x3FF] |
1667                                        Hi3516CV500 = [0x0, 0x3FF]| Hi3516DV300 = [0x0, 0x3FF]|
1668                                        Hi3516AV300 = [0x0, 0x3FF]|Hi3559V200 = [0x0, 0x3FF]| Hi3556V200 = [0x0, 0x3FF]|
1669                                        Hi3516EV200 = [0x0, 0x3FF]|Hi3516EV300 = [0x0, 0x3FF]|Hi3518EV300 = [0x0, 0x3FF]|
1670                                        Hi3516DV200 = [0x0, 0x3FF];Strength of dynamic range compression.
1671                                        Higher values lead to higher differential gain between shadows and highlights */
1672     HI_U32 u32WDRExpRatioActual[WDR_MAX_FRAME_NUM - 1]; /* RW; Range:[0x40, 0x4000]; Format:26.6; 0x40 means 1 times.
1673                                                            When enExpRatioType is OP_TYPE_AUTO, u32ExpRatio is invalid.
1674                                                            When enExpRatioType is OP_TYPE_MANUAL, u32ExpRatio is
1675                                                            quotient of long exposure time / short exposure time. */
1676     HI_BOOL bWDRSwitchFinish;       /* RW; Range:[0, 1];Format:1.0;HI_TRUE: WDR switch is finished */
1677     HI_BOOL bResSwitchFinish;       /* RW; Range:[0, 1];Format:1.0;HI_TRUE: Resolution switch is finished */
1678     HI_U16 au16BLActual[ISP_BAYER_CHN_NUM]; /* RW; Range: [0x0, 0xFFF];Format:12.0;
1679                                                Actual Black level values that correspond to the black levels of the
1680                                                R,Gr, Gb, and B components respectively. */
1681 } ISP_INNER_STATE_INFO_S;
1682 
1683 /*
1684   The position of AE histogram in ISP BE pipeline
1685   0 = After DG;
1686   1 = After static WB;
1687   2 = After DRC;
1688  */
1689 typedef enum hiISP_AE_SWITCH_E {
1690     ISP_AE_AFTER_DG = 0,
1691     ISP_AE_AFTER_WB,
1692     ISP_AE_AFTER_DRC,
1693     ISP_AE_SWITCH_BUTT
1694 } ISP_AE_SWITCH_E;
1695 
1696 /*
1697   FourPlaneMode enable
1698   0 : Disabled;
1699   1 : Enabled
1700 */
1701 typedef enum hiISP_AE_FOUR_PLANE_MODE_E {
1702     ISP_AE_FOUR_PLANE_MODE_DISABLE = 0,
1703     ISP_AE_FOUR_PLANE_MODE_ENABLE,
1704     ISP_AE_FOUR_PLANE_MODE_BUTT
1705 } ISP_AE_FOUR_PLANE_MODE_E;
1706 
1707 typedef enum hiISP_AE_HIST_SKIP_E {
1708     ISP_AE_HIST_SKIP_EVERY_PIXEL = 0,
1709     ISP_AE_HIST_SKIP_EVERY_2ND_PIXEL,
1710     ISP_AE_HIST_SKIP_EVERY_3RD_PIXEL,
1711     ISP_AE_HIST_SKIP_EVERY_4TH_PIXEL,
1712     ISP_AE_HIST_SKIP_EVERY_5TH_PIXEL,
1713     ISP_AE_HIST_SKIP_EVERY_8TH_PIXEL,
1714     ISP_AE_HIST_SKIP_EVERY_9TH_PIXEL,
1715     ISP_AE_HIST_SKIP_BUTT
1716 } ISP_AE_HIST_SKIP_E;
1717 
1718 typedef enum hiISP_AE_HIST_OFFSET_X_E {
1719     ISP_AE_HIST_START_FORM_FIRST_COLUMN = 0,
1720     ISP_AE_HIST_START_FORM_SECOND_COLUMN,
1721     ISP_AE_HIST_OFFSET_X_BUTT
1722 } ISP_AE_HIST_OFFSET_X_E;
1723 
1724 typedef enum hiISP_AE_HIST_OFFSET_Y_E {
1725     ISP_AE_HIST_START_FORM_FIRST_ROW = 0,
1726     ISP_AE_HIST_START_FORM_SECOND_ROW,
1727     ISP_AE_HIST_OFFSET_Y_BUTT
1728 } ISP_AE_HIST_OFFSET_Y_E;
1729 
1730 /* Defines the mode configuration for the sampling points during global histogram statistics. */
1731 typedef struct hiISP_AE_HIST_CONFIG_S {
1732     ISP_AE_HIST_SKIP_E enHistSkipX;    /* RW; Range:[0, 6]; Format:4.0;
1733                                           Histogram decimation in horizontal direction: 0=every pixel;
1734                                           1=every 2nd pixel; 2=every 3rd pixel; 3=every 4th pixel; 4=every 5th pixel;
1735                                           5=every 8th pixel; 6+=every 9th pixel */
1736     ISP_AE_HIST_SKIP_E enHistSkipY;    /* RW; Range:[0, 6]; Format:4.0;
1737                                           Histogram decimation in vertical direction: 0=every pixel; 1=every 2nd pixel;
1738                                           2=every 3rd pixel; 3=every 4th pixel; 4=every 5th pixel; 5=every 8th pixel;
1739                                           6+=every 9th pixel */
1740     ISP_AE_HIST_OFFSET_X_E enHistOffsetX;  /* RW; Range:[0, 1]; Format:1.0;
1741                                               0= start from the first column; 1=start from second column */
1742     ISP_AE_HIST_OFFSET_Y_E enHistOffsetY;  /* RW; Range:[0, 1]; Format:1.0;
1743                                               0= start from the first row; 1= start from second row */
1744 } ISP_AE_HIST_CONFIG_S;
1745 
1746 typedef enum hiISP_AE_STAT_MODE__E {
1747     ISP_AE_NORMAL = 0,
1748     ISP_AE_ROOT,
1749     ISP_AE_MODE_BUTT
1750 } ISP_AE_STAT_MODE_E;
1751 
1752 /* Crops the input image of the AE module */
1753 typedef struct hiISP_AE_CROP_S {
1754     HI_BOOL bEnable; /* RW; Range: [0,1];  Format:1.0;AE crop enable. */
1755     HI_U16  u16X;    /* RW; Range: Hi3559AV100 = [0, 8192 - 256]|Hi3519AV100 = [0, 8192 - 256]|
1756                         Hi3516CV500 = [0, 4608 - 256]|Hi3516DV300 = [0, 4608 - 256]| Hi3516AV300 = [0, 4608 - 256]|
1757                         Hi3559V200   = [0, 4608 - 256]|Hi3556V200  = [0, 4608 - 256]| Hi3516EV200 = [0,3072 - 256]|
1758                         Hi3516EV300 = [0,3072 - 256]|Hi3518EV300 = [0,3072 - 256]|Hi3516DV200 = [0,3072 - 256];
1759                         Format:13.0;AE image crop start x, limited range:[0, ImageWidth - 256] */
1760     HI_U16  u16Y;   /* RW; Range: Hi3559AV100 = [0, 8192 - 120]|Hi3519AV100 = [0, 8192 - 120]|
1761                        Hi3516CV500 = [0, 4608 - 120]|Hi3516DV300 = [0, 4608 - 120]| Hi3516AV300 = [0, 4608 - 120]|
1762                        Hi3559V200   = [0, 4608 - 120]|Hi3556V200   = [0, 4608 - 120]| Hi3516EV200 = [0,3072 - 120]|
1763                        Hi3516EV300 = [0,3072 - 120]|Hi3518EV300 = [0,3072 - 120]| Hi3516DV200 = [0,3072 - 120];
1764                        Format:13.0;AEimage crop start y, limited range:[0, ImageHeight - 120]  */
1765     HI_U16  u16W;   /* RW; Range: Hi3559AV100 = [256, 8192]|Hi3519AV100 = [256, 8192]|Hi3516CV500 = [256, 4608]|
1766                        Hi3516DV300 = [256, 4608] | Hi3516AV300 = [256, 4608] |Hi3559V200   = [256, 4608]|
1767                        Hi3556V200  = [256, 4608]| Hi3516EV200 = [256, 3072]|Hi3516EV300 = [256, 3072]|
1768                        Hi3518EV300 = [256, 3072]|Hi3516DV200 = [256, 3072];
1769                        Format:14.0;AE image crop width,  limited range:[256, ImageWidth] */
1770     HI_U16  u16H;   /* RW; Range: Hi3559AV100 = [120, 8192]|Hi3519AV100 = [120, 8192]|Hi3516CV500 = [120, 4608]|
1771                        Hi3516DV300 = [120, 4608] | Hi3516AV300 = [120, 4608] |Hi3559V200   = [120, 4608]|
1772                        Hi3556V200  = [120, 4608]| Hi3516EV200 = [120, 3072]|Hi3516EV300 = [120, 3072]|
1773                        Hi3518EV300 = [120, 3072]|Hi3516DV200 = [120, 3072];
1774                        Format:14.0;AE image crop height  limited range:[120, ImageHeight] */
1775 } ISP_AE_CROP_S;
1776 
1777 /* config of statistics structs */
1778 #define HIST_THRESH_NUM                           4
1779 typedef struct hiISP_AE_STATISTICS_CFG_S {
1780     ISP_AE_SWITCH_E          enAESwitch;      /* RW; Range:[0, 2]; Format:2.0;
1781                                                  The position of AE histogram in ISP BE pipeline */
1782     ISP_AE_HIST_CONFIG_S     stHistConfig;
1783     ISP_AE_FOUR_PLANE_MODE_E enFourPlaneMode; /* RW; Range:[0, 1]; Format:2.0;Four Plane Mode Enable */
1784     ISP_AE_STAT_MODE_E       enHistMode;      /* RW; Range:[0, 1]; Format:2.0;AE Hist Rooting Mode */
1785     ISP_AE_STAT_MODE_E       enAverMode;      /* RW; Range:[0, 1]; Format:2.0;AE Aver Rooting Mode */
1786     ISP_AE_STAT_MODE_E       enMaxGainMode;   /* RW; Range:[0, 1]; Format:2.0;Max Gain Rooting Mode */
1787     ISP_AE_CROP_S            stCrop;
1788     HI_U8 au8Weight[AE_ZONE_ROW][AE_ZONE_COLUMN]; /* RW; Range:[0x0, 0xF]; Format:4.0; AE weighting table */
1789 } ISP_AE_STATISTICS_CFG_S;
1790 
1791 /* Smart Info */
1792 #define PEOPLE_CLASS_MAX   2
1793 typedef struct hiISP_SMART_ROI_S {
1794     HI_BOOL  bEnable;
1795     HI_BOOL  bAvailable;
1796     HI_U8    u8Luma;
1797 } ISP_PEOPLE_ROI_S;
1798 
1799 #define TUNNEL_CLASS_MAX   2
1800 typedef struct hiISP_TUNNEL_ROI_S {
1801     HI_BOOL  bEnable;
1802     HI_BOOL  bAvailable;
1803     HI_U32   u32TunnelAreaRatio;
1804     HI_U32   u32TunnelExpPerf;
1805 } ISP_TUNNEL_ROI_S;
1806 
1807 typedef struct hiISP_SMART_INFO_S {
1808     ISP_PEOPLE_ROI_S  stPeopleROI[PEOPLE_CLASS_MAX];
1809     ISP_TUNNEL_ROI_S  stTunnelROI[TUNNEL_CLASS_MAX];
1810 } ISP_SMART_INFO_S;
1811 
1812 typedef enum hiISP_AE_PEOPLE_TYPE_E {
1813     ISP_FACE_INDEX = 0,
1814     ISP_PEOPLE_INDEX = 1,
1815     ISP_PEOPLE_BUTT
1816 } ISP_PEOPLE_TYPE_E;
1817 
1818 typedef enum hiISP_AE_TUNNEL_TYPE_E {
1819     ISP_TUNNEL_IN_INDEX = 0,
1820     ISP_TUNNEL_OUT_INDEX = 1,
1821     ISP_TUNNEL_BUTT
1822 } ISP_TUNNEL_TYPE_E;
1823 
1824 /* fines whether the peak value of the zoned IIR statistics is calculated.  */
1825 typedef enum hiISP_AF_PEAK_MODE_E {
1826     ISP_AF_STA_NORM         = 0,    /* use every value of the block statistic */
1827     ISP_AF_STA_PEAK,                /* use the maximum value in one line of the block statistic */
1828     ISP_AF_STA_BUTT
1829 } ISP_AF_PEAK_MODE_E;
1830 
1831 /* Defines whether the zoned statistics are squared in square mode.  */
1832 typedef enum hiISP_AF_SQU_MODE_E {
1833     ISP_AF_STA_SUM_NORM     = 0,    /* statistic value accumlate */
1834     ISP_AF_STA_SUM_SQU,             /* statistic value square then accumlate */
1835     ISP_AF_STA_SUM_BUTT
1836 } ISP_AF_SQU_MODE_E;
1837 /* Crops the input image of the AF module.  */
1838 typedef struct hiISP_AF_CROP_S {
1839     HI_BOOL bEnable; /* RW; Range: [0,1];  Format:1.0; AF crop enable */
1840     HI_U16  u16X;    /* RW; Range: Hi3559AV100 = [0, 7936]|Hi3519AV100 = [0, 7936]|Hi3516CV500 = [0, 4352]|
1841                         Hi3516DV300 = [0, 4352]| Hi3516AV300 = [0, 4352]| Hi3559V200 = [0, 4352]|
1842                         Hi3556V200  = [0, 4352]| Hi3516EV200 = [0, 2816]| Hi3516EV300 = [0, 2816]|
1843                         Hi3518EV300 = [0, 2816]|Hi3516DV200 = [0, 2816];
1844                         Format:13.0;AF image crop start x, limited range:[0, ImageWidth-256] */
1845     HI_U16  u16Y;    /* RW; Range: Hi3559AV100 = [0, 8072]|Hi3519AV100 = [0, 8072]|Hi3516CV500 = [0, 4488]|
1846                         Hi3516DV300 = [0, 4488]| Hi3516AV300 = [0, 4488]| Hi3559V200 = [0, 4488]|
1847                         Hi3556V200  = [0, 4488]| Hi3516EV200 = [0, 2952]|Hi3516EV300 = [0,2952]|
1848                         Hi3518EV300 = [0,2952]|Hi3516DV200 = [0,2952];
1849                         Format:13.0;AF image crop start y, limited range:[0, ImageHeight-120] */
1850     HI_U16  u16W;    /* RW; Range: Hi3559AV100 = [256, 8192]|Hi3519AV100 = [256, 8192]|Hi3516CV500 = [256, 4608]|
1851                         Hi3516DV300 = [256, 4608]| Hi3516AV300 = [256, 4608]| Hi3559V200  = [256, 4608]|
1852                         Hi3556V200  = [256, 4608]| Hi3516EV200 = [256, 3072]| Hi3516EV300 = [256, 3072]|
1853                         Hi3518EV300 = [256, 3072]|Hi3516DV200 = [256, 3072];
1854                         Format:14.0;AF image crop width, limited range:[256, ImageWidth] */
1855     HI_U16  u16H;    /* RW; Range: Hi3559AV100 = [120, 8192]|Hi3519AV100 = [120, 8192]|Hi3516CV500 = [120, 4608]|
1856                         Hi3516DV300 = [120, 4608]| Hi3516AV300 = [120, 4608]| Hi3559V200 = [120, 4608]|
1857                         Hi3556V200  = [120, 4608]| Hi3516EV200 = [120,3072]| Hi3516EV300 = [120,3072]|
1858                         Hi3518EV300 = [120, 3072]|Hi3516DV200 = [120, 3072];
1859                         Format:14.0;AF image crop height, limited range:[120, ImageHeight] */
1860 } ISP_AF_CROP_S;
1861 
1862 /* Defines the position of AF module statistics.  */
1863 typedef enum hiISP_AF_STATISTICS_POS_E {
1864     ISP_AF_STATISTICS_AFTER_DGAIN    = 0, /* The AF module is placed in the raw field for statistics,AF after DGain */
1865     ISP_AF_STATISTICS_AFTER_DRC,         /* The AF module is placed in the raw field for statistics,AF after DRC */
1866     ISP_AF_STATISTICS_AFTER_CSC,         /* The AF module is placed in the YUV field for statistics,AF after CSC */
1867     ISP_AF_STATISTICS_BUTT
1868 } ISP_AF_STATISTICS_POS_E;
1869 
1870 /* Configures the Bayer field of the AF module.  */
1871 typedef struct hiISP_AF_RAW_CFG_S {
1872     HI_U8               GammaGainLimit; /* RW; Range: [0x0, 0x5]; Format:3.0,
1873                                            Not support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
1874     HI_U8               GammaValue;     /* RW; Range: Hi3559AV100 = [0x0, 0x6] | Hi3519AV100 = [0x0, 0x6] |
1875                                            Hi3516CV500 = [0x0, 0x6] | Hi3516DV300 = [0x0, 0x6]|
1876                                            Hi3516AV300 = [0x0, 0x6] | Hi3559V200 = [0x0, 0x6]|
1877                                            Hi3556V200  = [0x0, 0x6]| Hi3516EV200 = [0x0, 0x1]|
1878                                            Hi3516EV300 = [0x0, 0x1]| Hi3518EV300 = [0x0, 0x1]|
1879                                            Hi3516DV200 = [0x0, 0x1]; */
1880     ISP_BAYER_FORMAT_E  enPattern;      /* RW; Range: [0x0, 0x3]; Format:2.0;raw domain pattern */
1881 } ISP_AF_RAW_CFG_S;
1882 /* Configures the pre-filter of the AF module.  */
1883 typedef struct hiISP_AF_PRE_FILTER_CFG_S {
1884     HI_BOOL             bEn;         /* RW; Range: [0,1]; Format:1.0; pre filter enable  .          */
1885     HI_U16              u16strength; /* RW; Range: [0x0, 0xFFFF]; Format:16.0;pre filter strength    */
1886 } ISP_AF_PRE_FILTER_CFG_S;
1887 
1888 /* Defines AF statistics configuration parameters.  */
1889 typedef struct hiISP_AF_CFG_S {
1890     HI_BOOL                 bEnable;        /* RW; Range: [0,1];   AF enable. */
1891     HI_U16                  u16Hwnd;        /* RW; Range: [1, 17]; AF statistic window horizontal block.  */
1892     HI_U16                  u16Vwnd;        /* RW; Range: [1, 15]; AF statistic window veritical block.  */
1893     HI_U16                  u16Hsize;       /* RW; Range: Hi3559AV100 = [256, 8192]|Hi3519AV100 = [256, 8192]|
1894                                                Hi3516CV500 = [256, 4608]|Hi3516DV300 = [256, 4608]|
1895                                                Hi3516AV300 = [256, 4608]|Hi3559V200 = [256, 4608]|
1896                                                Hi3556V200  = [256, 4608]|Hi3516EV200 = [256,3072]|
1897                                                Hi3516EV300 = [256,3072]|Hi3518EV300 = [256,3072]|
1898                                                Hi3516DV200 = [256,3072];
1899                                                limited Range: [256, ImageWidth],AF image width. */
1900     HI_U16                  u16Vsize;       /* RW; Range: Hi3559AV100 = [120, 8192]|Hi3519AV100 = [120, 8192]|
1901                                                Hi3516CV500 = [120, 4608]|Hi3516DV300 = [120, 4608]|
1902                                                Hi3516AV300 = [120, 4608]|Hi3559V200 = [120, 4608]|
1903                                                Hi3556V200  = [120, 4608]|Hi3516EV200 = [120,3072]|
1904                                                Hi3516EV300 = [120,3072]|Hi3518EV300 = [120,3072]|
1905                                                Hi3516DV200 = [120,3072];
1906                                                limited Range: [120, ImageHeight],AF image height. */
1907     ISP_AF_PEAK_MODE_E      enPeakMode;     /* RW; Range: [0,1]; AF peak value statistic mode. */
1908     ISP_AF_SQU_MODE_E       enSquMode;      /* RW; Range: [0,1]; AF statistic square accumulate. */
1909     ISP_AF_CROP_S           stCrop;         /* RW; AF input image crop */
1910     ISP_AF_STATISTICS_POS_E enStatisticsPos; /* RW; Range: [0,2]; AF statistic position, it can be set to yuv or raw */
1911     ISP_AF_RAW_CFG_S        stRawCfg;       /* RW; When AF locate at RAW domain, these para should be cfg. */
1912     ISP_AF_PRE_FILTER_CFG_S stPreFltCfg;    /* RW; pre filter cfg */
1913     HI_U16                  u16HighLumaTh;  /* RW; Range: [0,0xFF]; high luma threshold. */
1914 } ISP_AF_CFG_S;
1915 /* Configures the AF level depend gain module.  */
1916 typedef struct hiISP_AF_LD_S {
1917     HI_BOOL     bLdEn;                      /* RW; Range: [0, 1]; FILTER level depend gain enable. */
1918     HI_U16      u16ThLow;                   /* RW; range: [0x0, 0xFF]; FILTER level depend th low */
1919     HI_U16      u16GainLow;                 /* RW; range: [0x0, 0xFF]; FILTER level depend gain low */
1920     HI_U16      u16SlpLow;                  /* RW; range: [0x0, 0xF];  FILTER level depend slope low */
1921     HI_U16      u16ThHigh;                  /* RW; range: [0x0, 0xFF]; FILTER level depend th high */
1922     HI_U16      u16GainHigh;                /* RW; range: [0x0, 0xFF]; FILTER level depend gain high */
1923     HI_U16      u16SlpHigh;                 /* RW; range: [0x0, 0xF];  FILTER level depend slope high */
1924 } ISP_AF_LD_S;
1925 /* Configures the AF coring module.  */
1926 typedef struct hiISP_AF_CORING_S {
1927     HI_U16      u16Th;                      /* RW; Range: [0x0, 0x7FF];FILTER coring threshold. */
1928     HI_U16      u16Slp;                     /* RW; Range: [0x0, 0xF];  FILTER Coring Slope */
1929     HI_U16      u16Lmt;                     /* RW; Range: [0x0, 0x7FF];FILTER coring limit */
1930 } ISP_AF_CORING_S;
1931 
1932 #define IIR_EN_NUM                                3
1933 #define IIR_GAIN_NUM                              7
1934 #define IIR_SHIFT_NUM                             4
1935 /* Defines the IIR parameter configuration of horizontal filters for AF statistics.  */
1936 typedef struct hiISP_AF_H_PARAM_S {
1937     HI_BOOL         bNarrowBand;                /* RW; Range: [0, 1]; IIR narrow band enable. */
1938     HI_BOOL         abIIREn[IIR_EN_NUM];        /* RW; Range: [0, 1]; IIR enable. */
1939     HI_U8           u8IIRShift;                 /* RW; Range: [0, 63]; IIR Shift.
1940                                                    Only used for Hi3559AV100/Hi3519AV100 */
1941     HI_S16          as16IIRGain[IIR_GAIN_NUM];  /* RW; Range: [-511, 511]. IIR gain,gain0 range:[0,255]. */
1942     HI_U16          au16IIRShift[IIR_SHIFT_NUM]; /* RW; Range: [0x0, 0x7];  IIR shift. */
1943     ISP_AF_LD_S     stLd;                       /* RW; filter level depend. */
1944     ISP_AF_CORING_S stCoring;                   /* RW; filter coring. */
1945 } ISP_AF_H_PARAM_S;
1946 
1947 #define FIR_GAIN_NUM                              5
1948 
1949 typedef struct hiISP_AF_V_PARAM_S {
1950     HI_S16          as16FIRH[FIR_GAIN_NUM]; /* RW; Range: [-31, 31];   FIR gain. */
1951     ISP_AF_LD_S     stLd;                   /* RW; filter level depend. */
1952     ISP_AF_CORING_S stCoring;               /* RW; filter coring.  */
1953 } ISP_AF_V_PARAM_S;
1954 
1955 #define ACC_SHIFT_H_NUM                           2
1956 #define ACC_SHIFT_V_NUM                           2
1957 
1958 typedef struct hiISP_AF_FV_PARAM_S {
1959     HI_U16 u16AccShiftY;                    /* RW; Range: [0x0, 0xF]; luminance Y statistic shift. */
1960     HI_U16 au16AccShiftH[ACC_SHIFT_H_NUM];  /* RW; Range: [0x0, 0xF]; IIR statistic shift. */
1961     HI_U16 au16AccShiftV[ACC_SHIFT_V_NUM];  /* RW; Range: [0x0, 0xF]; FIR statistic shift. */
1962     HI_U16 u16HlCntShift;                   /* RW; Range: [0x0, 0xF]; High luminance counter shift */
1963 } ISP_AF_FV_PARAM_S;
1964 
1965 typedef struct hiISP_FOCUS_STATISTICS_CFG_S {
1966     ISP_AF_CFG_S        stConfig;
1967     ISP_AF_H_PARAM_S    stHParam_IIR0;
1968     ISP_AF_H_PARAM_S    stHParam_IIR1;
1969     ISP_AF_V_PARAM_S    stVParam_FIR0;
1970     ISP_AF_V_PARAM_S    stVParam_FIR1;
1971     ISP_AF_FV_PARAM_S   stFVParam;
1972 } ISP_FOCUS_STATISTICS_CFG_S;
1973 
1974 /*
1975    the main purpose of stat key was to access individual statistic info separately...
1976    ...for achieving performance optimization of CPU, because of we acquire stat...
1977    ... in ISP_DRV ISR for our firmware reference and USER can also use alternative MPI...
1978    ... to do this job, so bit1AeStat1~bit1AfStat for MPI behavior control, and bit16IsrAccess...
1979    ... for ISR access control, they were independent. but they have the same bit order, for example...
1980    ... bit1AeStat1 for MPI AeStat1 access key, and bit16 of u32Key for ISR AeStat1 access key
1981 */
1982 typedef union hiISP_STATISTICS_CTRL_U {
1983     HI_U64  u64Key;
1984     struct {
1985         HI_U64  bit1FEAeGloStat     : 1;   /* [0] */
1986         HI_U64  bit1FEAeLocStat     : 1;   /* [1] */
1987         HI_U64  bit1FEAeStiGloStat  : 1;   /* [2] .Only used for Hi3559AV100/Hi3519AV100 */
1988         HI_U64  bit1FEAeStiLocStat  : 1;   /* [3] .Only used for Hi3559AV100/Hi3519AV100 */
1989         HI_U64  bit1BEAeGloStat     : 1;   /* [4] */
1990         HI_U64  bit1BEAeLocStat     : 1;   /* [5] */
1991         HI_U64  bit1BEAeStiGloStat  : 1;   /* [6] .Only used for Hi3559AV100/Hi3519AV100 */
1992         HI_U64  bit1BEAeStiLocStat  : 1;   /* [7] .Only used for Hi3559AV100/Hi3519AV100 */
1993         HI_U64  bit1AwbStat1        : 1;   /* [8] */
1994         HI_U64  bit1AwbStat2        : 1;   /* [9] */
1995         HI_U64  bit2Rsv0            : 2;   /* [10:11] */
1996         HI_U64  bit1FEAfStat        : 1;   /* [12] .Only used for Hi3559AV100/Hi3519AV100 */
1997         HI_U64  bit1BEAfStat        : 1;   /* [13]  */
1998         HI_U64  bit2Rsv1            : 2;   /* [14:15] */
1999         HI_U64  bit1Dehaze          : 1;   /* [16] */
2000         HI_U64  bit1MgStat          : 1;   /* [17] */
2001         HI_U64  bit14Rsv            : 14;   /* [18:31] */
2002         HI_U64  bit32IsrAccess      : 32;   /* [32:63] */
2003     };
2004 } ISP_STATISTICS_CTRL_U;
2005 
2006 /* statistics structs */
2007 #define HIST_NUM                                  1024
2008 #define BAYER_PATTERN_NUM                         4
2009 #define WDR_CHN_MAX                               4
2010 #define ISP_CHN_MAX_NUM                           4
2011 
2012 typedef struct hiISP_AE_GRID_INFO_S {
2013     HI_U16 au16GridYPos[AE_ZONE_ROW + 1];   /* R */
2014     HI_U16 au16GridXPos[AE_ZONE_COLUMN + 1]; /* R */
2015     HI_U8  u8Status;                        /* R;0:not update, 1: update,others:reserved */
2016 } ISP_AE_GRID_INFO_S;
2017 
2018 typedef struct hiISP_MG_GRID_INFO_S {
2019     HI_U16 au16GridYPos[MG_ZONE_ROW + 1];    /* R */
2020     HI_U16 au16GridXPos[MG_ZONE_COLUMN + 1]; /* R */
2021     HI_U8  u8Status;                         /* R;0:not update, 1: update,others:reserved */
2022 } ISP_MG_GRID_INFO_S;
2023 
2024 typedef struct hiISP_AWB_GRID_INFO_S {
2025     HI_U16 au16GridYPos[AWB_ZONE_ORIG_ROW  + 1];   /* R */
2026     HI_U16 au16GridXPos[AWB_ZONE_ORIG_COLUMN + 1]; /* R */
2027     HI_U8  u8Status;                               /* R;0:not update, 1: update,others:reserved */
2028 } ISP_AWB_GRID_INFO_S;
2029 
2030 typedef struct hiISP_FOCUS_GRID_INFO_S {
2031     HI_U16 au16GridYPos[AF_ZONE_ROW + 1];    /* R */
2032     HI_U16 au16GridXPos[AF_ZONE_COLUMN + 1]; /* R */
2033     HI_U8  u8Status;                         /* R;0:not update, 1: update,others:reserved */
2034 } ISP_FOCUS_GRID_INFO_S;
2035 
2036 typedef struct hiISP_AE_STATISTICS_S {
2037     HI_U32 au32FEHist1024Value[ISP_CHN_MAX_NUM][HIST_NUM];      /* R; Range: [0x0, 0xFFFFFFFF]; Format:32.0;
2038                                                                    Global 1024 bins histogram of FE */
2039     HI_U16 au16FEGlobalAvg[ISP_CHN_MAX_NUM][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF]; Format:16.0;
2040                                                                    Global average value of FE,
2041                                                          Not support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
2042     HI_U16 au16FEZoneAvg[ISP_CHN_MAX_NUM][AE_ZONE_ROW][AE_ZONE_COLUMN][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF];
2043                                                                                               Format:16.0;
2044                                                                                               Zone average value of FE,
2045                                 Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200's Fe1 and Fe3,
2046                                 Not support Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
2047     HI_U32 au32BEHist1024Value[HIST_NUM];       /* R; Range: [0x0, 0xFFFFFFFF]; Format:32.0;
2048                                                    Global 1024 bins histogram of BE */
2049     HI_U16 au16BEGlobalAvg[BAYER_PATTERN_NUM];  /* R; Range: [0x0, 0xFFFF]; Format:16.0; Global average value of BE */
2050     HI_U16 au16BEZoneAvg[AE_ZONE_ROW][AE_ZONE_COLUMN][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF]; Format:16.0;
2051                                                                              Zone average value of BE */
2052     ISP_AE_GRID_INFO_S stFEGridInfo;
2053     ISP_AE_GRID_INFO_S stBEGridInfo;
2054 } ISP_AE_STATISTICS_S;
2055 
2056 /* Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
2057    Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
2058 typedef struct hiISP_AE_STITCH_STATISTICS_S {
2059     HI_U32 au32FEHist1024Value[ISP_CHN_MAX_NUM][HIST_NUM];      /* R; Range: [0x0, 0xFFFFFFFF]; Format:32.0;
2060                                                                    Global 1024 bins histogram of FE */
2061     HI_U16 au16FEGlobalAvg[ISP_CHN_MAX_NUM][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF]; Format:16.0;
2062                                                                    Global average value of FE */
2063     HI_U16 au16FEZoneAvg[VI_MAX_PIPE_NUM][ISP_CHN_MAX_NUM][AE_ZONE_ROW][AE_ZONE_COLUMN][BAYER_PATTERN_NUM]; /* R;
2064                                                                                       Range: [0x0, 0xFFFF]; Format:16.0;
2065                                                                                       Zone average value of FE */
2066     HI_U32 au32BEHist1024Value[HIST_NUM];      /* R; Range: [0x0, 0xFFFFFFFF]; Format:32.0;
2067                                                   Global 1024 bins histogram of BE */
2068     HI_U16 au16BEGlobalAvg[BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF]; Format:16.0; Global average value of BE */
2069     HI_U16 au16BEZoneAvg[VI_MAX_PIPE_NUM][AE_ZONE_ROW][AE_ZONE_COLUMN][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFFFF];
2070                                                                                               Format:16.0;
2071                                                                                             Zone average value of BE */
2072 } ISP_AE_STITCH_STATISTICS_S;
2073 
2074 typedef struct hiISP_MG_STATISTICS_S {
2075     HI_U16 au16ZoneAvg[MG_ZONE_ROW][MG_ZONE_COLUMN][BAYER_PATTERN_NUM]; /* R; Range: [0x0, 0xFF]; Format:8.0;
2076                                                                            Zone average value */
2077     ISP_MG_GRID_INFO_S stGridInfo;
2078 } ISP_MG_STATISTICS_S;
2079 
2080 typedef enum hiISP_AWB_SWITCH_E {
2081     ISP_AWB_AFTER_DG                   = 0,
2082     ISP_AWB_AFTER_Expander,
2083     ISP_AWB_AFTER_DRC,
2084     ISP_AWB_SWITCH_BUTT
2085 } ISP_AWB_SWITCH_E;
2086 
2087 typedef enum hiISP_AWB_GAIN_SWITCH_E {
2088     ISP_AWB_GAIN_IN_ISP = 0,
2089     ISP_AWB_GAIN_IN_SENSOR,
2090     ISP_AWB_GAIN_IN_BUTT
2091 } ISP_AWB_GAIN_SWITCH_E;
2092 
2093 /* Crops the input image of the AWB module */
2094 typedef struct hiISP_AWB_CROP_S {
2095     HI_BOOL bEnable;  /* RW; Range: [0,1];  Format:1.0;AWB crop enable */
2096     HI_U16  u16X;  /* RW; Range: Hi3559AV100 = [0, 8192 - 60]|Hi3519AV100 = [0, 8192 - 60]|Hi3516CV500 = [0, 4608 - 60]|
2097                       Hi3516DV300 = [0, 4608 - 60]| Hi3516AV300 = [0, 4608 - 60]|Hi3559V200 = [0, 4608 - 60]|
2098                       Hi3556V200 = [0, 4608 - 60]| Hi3516EV200 = [0,3072- 60]|Hi3516EV300 = [0,3072- 60]|
2099                       Hi3518EV300 = [0,3072- 60]| Hi3516DV200 = [0,3072- 60]; Format:13.0;
2100                       AWB image crop start x, limited range:[0, ImageWidth - u16ZoneCol * 60] */
2101     HI_U16  u16Y;  /* RW; Range: Hi3559AV100 = [0, 8192 - 14]|Hi3519AV100 = [0, 8192 - 14]|Hi3516CV500 = [0, 4608 - 14]|
2102                       Hi3516DV300 = [0, 4608 - 14]| Hi3516AV300 = [0, 4608 - 14]|Hi3559V200 = [0, 4608 - 14]|
2103                       Hi3556V200 = [0, 4608 - 14]| Hi3516EV200 = [0,3072-14]|Hi3516EV300 = [0,3072-14]|
2104                       Hi3518EV300 = [0,3072-14]| Hi3516DV200 = [0,3072-14]; Format:13.0;
2105                       AWB image crop start y,limited range:[0, ImageHeight - u16ZoneRow * 14] */
2106     HI_U16  u16W;  /* RW; Range: Hi3559AV100 = [60, 8192]|Hi3519AV100 = [60, 8192]|Hi3516CV500 = [60, 4608]|
2107                       Hi3516DV300 = [60, 4608] | Hi3516AV300 = [60, 4608] |Hi3559V200   = [60, 4608]|
2108                       Hi3556V200  = [60, 4608]| Hi3516EV200 = [60,3072]|Hi3516EV300 = [60,3072]|Hi3518EV300 = [60,3072]|
2109                       Hi3516DV200 = [60,3072]; Format:14.0;AWB image crop width,
2110                       limited range:[u16ZoneCol * 60, ImageWidth] */
2111     HI_U16  u16H;  /* RW; Range: Hi3559AV100 = [14, 8192]|Hi3519AV100 = [14, 8192]|Hi3516CV500 = [14, 4608]|
2112                       Hi3516DV300 = [14, 4608] | Hi3516AV300 = [14, 4608] |Hi3559V200 = [14, 4608]|
2113                       Hi3556V200 = [14, 4608] | Hi3516EV200 = [14,3072]|Hi3516EV300 = [14,3072]|Hi3518EV300 = [14,3072]|
2114                       Hi3516DV200 = [14,3072]; Format:14.0;AWB image crop height,
2115                       limited range:[u16ZoneRow * 14, ImageHeight] */
2116 } ISP_AWB_CROP_S;
2117 
2118 /* Defines the AWB statistics configuration */
2119 typedef struct hiISP_WB_STATISTICS_CFG_S {
2120     ISP_AWB_SWITCH_E enAWBSwitch; /* RW; Range: [0x0, 0x2]; Position of AWB statistics in pipeline */
2121     HI_U16 u16ZoneRow;            /* RW; Range: [0x1, 0x20]; Vertical Blocks,
2122                                      limited range:[1, min(32, ImageHeight /AWB_MIN_HEIGHT)] */
2123     HI_U16 u16ZoneCol;            /* RW; Range: [0x1, 0x20]; Horizontal Blocks,
2124                                      limited range:[BlkNum, min(32, Width /AWB_MIN_WIDTH)] */
2125     HI_U16 u16ZoneBin;            /* RW; Range:Hi3559AV100 = [1, 4] | Hi3519AV100 = [1, 4] | Hi3516CV500 = [1, 1]|
2126                                      Hi3516DV300 = [1, 1]| Hi3516AV300 = [1, 1]|Hi3559V200 = [1, 1]|
2127                                      Hi3556V200 = [1, 1]| Hi3516EV200 = [1,1]|Hi3516EV300 = [1,1]|Hi3518EV300 = [1,1]|
2128                                      Hi3516DV200 = [1,1]; Brightness Bins */
2129     HI_U16 au16HistBinThresh[AWB_ZONE_BIN_MAX]; /* RW; Range: [0x0, 0xFFFF]; Bin Threshold */
2130     HI_U16 u16WhiteLevel;        /* RW; Range: [0x0, 0xFFFF];Upper limit of valid data for white region,
2131                                     for Bayer statistics, [0x0, 0x3FF] for RGB statistics */
2132     HI_U16 u16BlackLevel;        /* RW; Range: [0x0, 0xFFFF];limited range: [0x0, u16WhiteLevel],
2133                                     Lower limit of valid data for white region .
2134                                     for Bayer statistics, bitwidth is 12, for RGB statistics, bitwidth is 10 */
2135     HI_U16 u16CbMax;             /* RW; Range: [0x0, 0xFFF];Maximum value of B/G for white region */
2136     HI_U16 u16CbMin;             /* RW; Range: [0x0, 0xFFF];limited range: [0x0, u16CbMax]
2137                                     Minimum value of B/G for white region */
2138     HI_U16 u16CrMax;             /* RW; Range: [0x0, 0xFFF];Maximum value of R/G for white region */
2139     HI_U16 u16CrMin;             /* RW; Range: [0x0, 0xFFF];limited range: [0x0, u16CrMax],
2140                                     Minimum value of R/G for white region */
2141     ISP_AWB_CROP_S stCrop;
2142 } ISP_WB_STATISTICS_CFG_S;
2143 
2144 /* Not support for Hi3516CV500/Hi3516DV300/Hi3516AV300/Hi3559V200/Hi3556V200/
2145    Hi3516EV200/Hi3516EV300/Hi3518EV300/Hi3516DV200 */
2146 typedef struct hiISP_WB_STITCH_STATISTICS_S {
2147     HI_U16  u16ZoneRow;                         /* R; Range: [0x1, 0x20];
2148                                                    effective horizontal block number for AWB statistic stitch window */
2149     HI_U16  u16ZoneCol;                         /* R; Range: [0x1, 0x100];
2150                                                    effective vetical block number for AWB statistic stitch window */
2151     HI_U16  au16ZoneAvgR[AWB_ZONE_STITCH_MAX];  /* R; Range: [0x0, 0xFFFF];Zone Average R  for Stitich mode */
2152     HI_U16  au16ZoneAvgG[AWB_ZONE_STITCH_MAX];  /* R; Range: [0x0, 0xFFFF];Zone Average G  for Stitich mode */
2153     HI_U16  au16ZoneAvgB[AWB_ZONE_STITCH_MAX];  /* R; Range: [0x0, 0xFFFF];Zone Average B  for Stitich mode */
2154     HI_U16  au16ZoneCountAll[AWB_ZONE_STITCH_MAX]; /* R; Range: [0x0, 0xFFFF];
2155                                                       normalized number of Gray points for Stitich mode */
2156 } ISP_WB_STITCH_STATISTICS_S;
2157 
2158 typedef struct hiISP_WB_STATISTICS_S {
2159     HI_U16 u16GlobalR;          /* R; Range: [0x0, 0xFFFF];Global WB output Average R */
2160     HI_U16 u16GlobalG;          /* R; Range: [0x0, 0xFFFF];Global WB output Average G */
2161     HI_U16 u16GlobalB;          /* R; Range: [0x0, 0xFFFF];Global WB output Average B */
2162     HI_U16 u16CountAll;         /* R; Range: [0x0, 0xFFFF];normalized number of Gray points */
2163 
2164     HI_U16 au16ZoneAvgR[AWB_ZONE_NUM];            /* R; Range: [0x0, 0xFFFF];Zone Average R */
2165     HI_U16 au16ZoneAvgG[AWB_ZONE_NUM];            /* R; Range: [0x0, 0xFFFF];Zone Average G */
2166     HI_U16 au16ZoneAvgB[AWB_ZONE_NUM];            /* R; Range: [0x0, 0xFFFF];Zone Average B */
2167     HI_U16 au16ZoneCountAll[AWB_ZONE_NUM];        /* R; Range: [0x0, 0xFFFF];normalized number of Gray points */
2168     ISP_AWB_GRID_INFO_S stGridInfo;
2169 } ISP_WB_STATISTICS_S;
2170 
2171 typedef struct hiISP_FOCUS_ZONE_S {
2172     HI_U16  u16v1;             /* R; Range: [0x0, 0xFFFF];vertical fir block1 Statistics */
2173     HI_U16  u16h1;             /* R; Range: [0x0, 0xFFFF];horizontal iir block1 Statistics */
2174     HI_U16  u16v2;             /* R; Range: [0x0, 0xFFFF];vertical fir block2 Statistics */
2175     HI_U16  u16h2;             /* R; Range: [0x0, 0xFFFF];horizontal iir block2 Statistics */
2176     HI_U16  u16y;              /* R; Range: [0x0, 0xFFFF];Y Statistics */
2177     HI_U16  u16HlCnt;          /* R; Range: [0x0, 0xFFFF];HlCnt Statistics */
2178 } ISP_FOCUS_ZONE_S;
2179 
2180 typedef struct hiISP_FE_FOCUS_STATISTICS_S {
2181     ISP_FOCUS_ZONE_S stZoneMetrics[WDR_CHN_MAX][AF_ZONE_ROW][AF_ZONE_COLUMN]; /* R; The zoned measure of contrast */
2182 } ISP_FE_FOCUS_STATISTICS_S;
2183 
2184 typedef struct hiISP_BE_FOCUS_STATISTICS_S {
2185     ISP_FOCUS_ZONE_S stZoneMetrics[AF_ZONE_ROW][AF_ZONE_COLUMN]; /* R; The zoned measure of contrast */
2186 } ISP_BE_FOCUS_STATISTICS_S;
2187 
2188 typedef struct hiISP_AF_STATISTICS_S {
2189     ISP_FE_FOCUS_STATISTICS_S stFEAFStat; /* only used for Hi3559AV100/Hi3519AV100 */
2190     ISP_BE_FOCUS_STATISTICS_S stBEAFStat;
2191     ISP_FOCUS_GRID_INFO_S     stFEAFGridInfo; /* only used for Hi3559AV100/Hi3519AV100 */
2192     ISP_FOCUS_GRID_INFO_S     stBEAFGridInfo;
2193 } ISP_AF_STATISTICS_S;
2194 
2195 typedef struct hiISP_STATISTICS_CFG_S {
2196     ISP_STATISTICS_CTRL_U       unKey;
2197     ISP_AE_STATISTICS_CFG_S     stAECfg;
2198     ISP_WB_STATISTICS_CFG_S     stWBCfg;
2199     ISP_FOCUS_STATISTICS_CFG_S  stFocusCfg;
2200 } ISP_STATISTICS_CFG_S;
2201 
2202 typedef struct hiISP_DBG_ATTR_S {
2203     HI_U32  u32Rsv;         /* H;need to add member */
2204 } ISP_DBG_ATTR_S;
2205 
2206 typedef struct hiISP_DBG_STATUS_S {
2207     HI_U32  u32FrmNumBgn;
2208     HI_U32  u32Rsv;         /* H;need to add member */
2209     HI_U32  u32FrmNumEnd;
2210 } ISP_DBG_STATUS_S;
2211 
2212 /*
2213 0 = Communication between the sensor and the ISP over the I2C interface
2214 1 = Communication between the sensor and the ISP over the SSP interface
2215 */
2216 typedef enum hiISP_SNS_TYPE_E {
2217     ISP_SNS_I2C_TYPE = 0,
2218     ISP_SNS_SSP_TYPE,
2219 
2220     ISP_SNS_TYPE_BUTT,
2221 } ISP_SNS_TYPE_E;
2222 
2223 /* sensor communication bus */
2224 typedef union hiISP_SNS_COMMBUS_U {
2225     HI_S8   s8I2cDev;
2226     struct {
2227         HI_S8  bit4SspDev       : 4;
2228         HI_S8  bit4SspCs        : 4;
2229     } s8SspDev;
2230 } ISP_SNS_COMMBUS_U;
2231 
2232 typedef struct hiISP_I2C_DATA_S {
2233     HI_BOOL bUpdate;            /* RW; Range: [0x0, 0x1]; Format:1.0;
2234                                    HI_TRUE: The sensor registers are written,
2235                                    HI_FALSE: The sensor registers are not written */
2236     HI_U8   u8DelayFrmNum;      /* RW; Number of delayed frames for the sensor register */
2237     HI_U8   u8IntPos;           /* RW;Position where the configuration of the sensor register takes effect */
2238                                 /* 0x0,very short frame start interrupt, 0x1:very short frame end interrupt,
2239                                    0x10,short frame start interrupt, 0x11:short frame end interrupt,
2240                                    0x20,middle frame start interrupt, 0x21:middle frame end interrupt,
2241                                    0x30,long frame start interrupt, 0x31:long frame end interrupt            */
2242     HI_U8   u8DevAddr;          /* RW;Sensor device address */
2243     HI_U32  u32RegAddr;         /* RW;Sensor register address */
2244     HI_U32  u32AddrByteNum;     /* RW;Bit width of the sensor register address */
2245     HI_U32  u32Data;            /* RW;Sensor register data */
2246     HI_U32  u32DataByteNum;     /* RW;Bit width of sensor register data */
2247 } ISP_I2C_DATA_S;
2248 
2249 typedef struct hiISP_SSP_DATA_S {
2250     HI_BOOL bUpdate;            /* RW; Range: [0x0, 0x1]; Format:1.0;
2251                                    HI_TRUE: The sensor registers are written,
2252                                    HI_FALSE: The sensor registers are not written */
2253     HI_U8   u8DelayFrmNum;      /* RW; Number of delayed frames for the sensor register */
2254     HI_U8   u8IntPos;           /* RW;Position where the configuration of the sensor register takes effect
2255                                  0x0,very short frame start interrupt, 0x1:very short frame end interrupt
2256                                  0x10,short frame start interrupt, 0x11:short frame end interrupt
2257                                  0x20,middle frame start interrupt, 0x21:middle frame end interrupt
2258                                  0x30,long frame start interrupt, 0x31:long frame end interrupt            */
2259 
2260     HI_U32  u32DevAddr;         /* RW;Sensor device address */
2261     HI_U32  u32DevAddrByteNum;  /* RW;Bit width of the sensor device address */
2262     HI_U32  u32RegAddr;         /* RW;Sensor register address */
2263     HI_U32  u32RegAddrByteNum;  /* RW;Bit width of the sensor register address */
2264     HI_U32  u32Data;            /* RW;Sensor register data */
2265     HI_U32  u32DataByteNum;     /* RW;Bit width of sensor register data */
2266 } ISP_SSP_DATA_S;
2267 
2268 typedef enum hiISP_SNS_MODE_E {
2269     SNS_EXP_MODE = 0,
2270     SNS_SHR_MODE = 1,
2271     SNS_MODE_BUTT
2272 } ISP_SNS_MODE_E;
2273 
2274 typedef struct hiISP_MCF_DATA_S {
2275     HI_U32  u32SnsVmaxAddr[ISP_MAX_SNS_EXP_ADDR_NUM]; /* 3 addr high  mid  low */
2276     HI_U32  u32SnsExpAddr[ISP_MAX_SNS_EXP_ADDR_NUM];  /* 3 addr high  mid  low */
2277     HI_U32  u32SnsReadoutTime;
2278     ISP_SNS_MODE_E enSnsExpMode;     /* 1: shr   0:exp */
2279 } ISP_MCF_DATA_S;
2280 
2281 typedef struct hiISP_SNS_REGS_INFO_S {
2282     ISP_SNS_TYPE_E enSnsType;
2283     HI_U32  u32RegNum;              /* RW;Number of registers required when exposure results are written to the sensor.
2284                                        The member value cannot be dynamically changed */
2285     HI_U8   u8Cfg2ValidDelayMax;    /* RW;Maximum number of delayed frames from the time when all sensor registers are
2286                                        configured to the time when configurations take effect, which is used to ensure
2287                                        the synchronization between sensor registers and ISP registers */
2288     ISP_SNS_COMMBUS_U  unComBus;
2289     union {
2290         ISP_I2C_DATA_S astI2cData[ISP_MAX_SNS_REGS];
2291         ISP_SSP_DATA_S astSspData[ISP_MAX_SNS_REGS];
2292     };
2293 
2294     struct {
2295         HI_BOOL bUpdate;
2296         HI_U8   u8DelayFrmNum;
2297         HI_U32  u32SlaveVsTime;      /* RW;time of vsync. Unit: inck clock cycle */
2298         HI_U32  u32SlaveBindDev;
2299     } stSlvSync;
2300 
2301     ISP_MCF_DATA_S stMcfData;
2302 
2303     HI_BOOL bConfig;
2304 } ISP_SNS_REGS_INFO_S;
2305 
2306 typedef enum hiISP_VD_TYPE_E {
2307     ISP_VD_FE_START   = 0,
2308     ISP_VD_FE_END,
2309     ISP_VD_BE_END,
2310 
2311     ISP_VD_BUTT
2312 } ISP_VD_TYPE_E;
2313 
2314 /* Defines the attributes of the virtual addresses for the registers of ISP submodules */
2315 typedef struct hiISP_REG_ATTR_S {
2316     HI_VOID *pIspExtRegAddr;        /* R;Start virtual address for the ISP external virtual registers */
2317     HI_U32 u32IspExtRegSize;        /* R;Size of the ISP external virtual registers */
2318     HI_VOID *pAeExtRegAddr;         /* R;Start virtual address for the AE library module */
2319     HI_U32 u32AeExtRegSize;         /* R;Size of the AE library module */
2320     HI_VOID *pAwbExtRegAddr;        /* R;Start virtual address for the AWB library module */
2321     HI_U32 u32AwbExtRegSize;        /* R;Size of the AWB library module */
2322 } ISP_REG_ATTR_S;
2323 
2324 /* AI structs */
2325 /*
2326   Defines the ISP iris type
2327   0 = DC iris
2328   1 = P iris
2329  */
2330 typedef enum hiISP_IRIS_TYPE_E {
2331     ISP_IRIS_DC_TYPE = 0,
2332     ISP_IRIS_P_TYPE,
2333 
2334     ISP_IRIS_TYPE_BUTT,
2335 } ISP_IRIS_TYPE_E;
2336 
2337 /* Defines the F value of the ISP iris */
2338 typedef enum hiISP_IRIS_F_NO_E {
2339     ISP_IRIS_F_NO_32_0 = 0,
2340     ISP_IRIS_F_NO_22_0,
2341     ISP_IRIS_F_NO_16_0,
2342     ISP_IRIS_F_NO_11_0,
2343     ISP_IRIS_F_NO_8_0,
2344     ISP_IRIS_F_NO_5_6,
2345     ISP_IRIS_F_NO_4_0,
2346     ISP_IRIS_F_NO_2_8,
2347     ISP_IRIS_F_NO_2_0,
2348     ISP_IRIS_F_NO_1_4,
2349     ISP_IRIS_F_NO_1_0,
2350 
2351     ISP_IRIS_F_NO_BUTT,
2352 } ISP_IRIS_F_NO_E;
2353 
2354 typedef struct hiISP_DCIRIS_ATTR_S {
2355     HI_S32 s32Kp;           /* RW; Range:[0, 100000]; Format:32.0; the proportional gain of PID algorithm,
2356                                default value is 7000 */
2357     HI_S32 s32Ki;           /* RW; Range:[0, 1000]; Format:32.0; the integral gain of PID algorithm,
2358                                default value is 100 */
2359     HI_S32 s32Kd;           /* RW; Range:[0, 100000]; Format:32.0; the derivative gain of PID algorithm,
2360                                default value is 3000 */
2361     HI_U32 u32MinPwmDuty;   /* RW; Range:[0, 1000]; Format:32.0; which is the min pwm duty for dciris control */
2362     HI_U32 u32MaxPwmDuty;   /* RW; Range:[0, 1000]; Format:32.0; which is the max pwm duty for dciris control */
2363     HI_U32 u32OpenPwmDuty;  /* RW; Range:[0, 1000]; Format:32.0; which is the open pwm duty for dciris control */
2364 } ISP_DCIRIS_ATTR_S;
2365 
2366 typedef struct hiISP_PIRIS_ATTR_S {
2367     HI_BOOL bStepFNOTableChange;    /* W; Range:[0, 1]; Format:1.0; Step-F number mapping table change or not */
2368     HI_BOOL bZeroIsMax;             /* RW; Range:[0, 1]; Format:1.0; Step 0 corresponds to max aperture or not,
2369                                        it's related to the specific iris */
2370     HI_U16 u16TotalStep;            /* RW; Range:[1, 1024]; Format:16.0; Total steps of  Piris's aperture,
2371                                        it's related to the specific iris */
2372     HI_U16 u16StepCount;            /* RW; Range:[1, 1024]; Format:16.0; Used steps of Piris's aperture.
2373                                        when Piris's aperture is too small, the F number precision is not enough,
2374                                        so not all the steps can be used. It's related to the specific iris */
2375     HI_U16 au16StepFNOTable[AI_MAX_STEP_FNO_NUM];   /* RW; Range:[1, 1024]; Format:16.0; Step-F number mapping table.
2376                                                        F1.0 is expressed as 1024, F32 is expressed as 1,
2377                                                        it's related to the specific iris */
2378     ISP_IRIS_F_NO_E  enMaxIrisFNOTarget;  /* RW; Range:[0, 10]; Format:4.0;
2379                                              Max F number of Piris's aperture, it's related to the specific iris */
2380     ISP_IRIS_F_NO_E  enMinIrisFNOTarget;  /* RW; Range:[0, 10]; Format:4.0;
2381                                              Min F number of Piris's aperture, it's related to the specific iris */
2382 
2383     HI_BOOL bFNOExValid;            /* RW; Range:[0, 1]; Format:1.0; use equivalent gain to present FNO or not */
2384     HI_U32 u32MaxIrisFNOTarget;    /* RW; Range:[1, 1024]; Format:16.0;
2385                                       Max equivalent gain of F number of Piris's aperture,
2386                                       only used when bFNOExValid is true, it's related to the specific iris */
2387     HI_U32 u32MinIrisFNOTarget;    /* RW; Range:[1, 1024]; Format:16.0;
2388                                       Min equivalent gain of F number of Piris's aperture,
2389                                       only used when bFNOExValid is true, it's related to the specific iris */
2390 } ISP_PIRIS_ATTR_S;
2391 
2392 /* Defines the MI attribute */
2393 typedef struct hiISP_MI_ATTR_S {
2394     HI_U32  u32HoldValue;            /* RW; Range:[0, 1000]; Format:32.0; iris hold value for DC-iris */
2395     ISP_IRIS_F_NO_E  enIrisFNO;      /* RW; Range:[0, 10]; Format:4.0; the F number of P-iris */
2396 } ISP_MI_ATTR_S;
2397 
2398 /*
2399   Defines the ISP iris status
2400   0 = In this mode can set the MI holdvalue
2401   1 = Open Iris to the max
2402   2 = Close Iris to the min
2403  */
2404 typedef enum hiISP_IRIS_STATUS_E {
2405     ISP_IRIS_KEEP  = 0,
2406     ISP_IRIS_OPEN  = 1,
2407     ISP_IRIS_CLOSE = 2,
2408     ISP_IRIS_BUTT
2409 } ISP_IRIS_STATUS_E;
2410 
2411 /* Defines the iris attribute */
2412 typedef struct hiISP_IRIS_ATTR_S {
2413     HI_BOOL bEnable;                 /* RW;iris enable/disable */
2414     ISP_OP_TYPE_E   enOpType;        /* auto iris or manual iris */
2415     ISP_IRIS_TYPE_E enIrisType;      /* DC-iris or P-iris */
2416     ISP_IRIS_STATUS_E enIrisStatus;  /* RW; status of Iris */
2417     ISP_MI_ATTR_S   stMIAttr;
2418 } ISP_IRIS_ATTR_S;
2419 
2420 
2421 /* AE structs */
2422 /*
2423   Defines the AE mode
2424   0 = Automatic frame rate reduction mode (slow shutter mode)
2425   1 = Constant frame rate mode
2426  */
2427 typedef enum hiISP_AE_MODE_E {
2428     AE_MODE_SLOW_SHUTTER = 0,
2429     AE_MODE_FIX_FRAME_RATE  = 1,
2430     AE_MODE_BUTT
2431 } ISP_AE_MODE_E;
2432 /*
2433   Defines the AE exposure policy mode
2434   0 = Highlight first exposure mode
2435   1 = Lowlight first exposure mode
2436  */
2437 typedef enum hiISP_AE_STRATEGY_E {
2438     AE_EXP_HIGHLIGHT_PRIOR = 0,
2439     AE_EXP_LOWLIGHT_PRIOR  = 1,
2440     AE_STRATEGY_MODE_BUTT
2441 } ISP_AE_STRATEGY_E;
2442 /* Defines the maximum exposure time or gain and minimum exposure time or gain */
2443 typedef struct hiISP_AE_RANGE_S {
2444     HI_U32 u32Max;  /* RW;Range:[0,0xFFFFFFFF];Format:32.0;Maximum value */
2445     HI_U32 u32Min;  /* RW;Range:[0,0xFFFFFFFF];Format:32.0;limited Range:[0,u32Max],Minimum value */
2446 } ISP_AE_RANGE_S;
2447 
2448 /* Defines the ISP exposure delay attribute */
2449 typedef struct hiISP_AE_DELAY_S {
2450     HI_U16 u16BlackDelayFrame;    /* RW; Range:[0, 65535]; Format:16.0; AE black delay frame count */
2451     HI_U16 u16WhiteDelayFrame;    /* RW; Range:[0, 65535]; Format:16.0; AE white delay frame count */
2452 } ISP_AE_DELAY_S;
2453 
2454 /*
2455   Defines the anti-flicker mode.
2456   0 = The epxosure time is fixed to be the multiplies of 1/(2*frequency) sec,
2457     it may lead to over exposure in the high-luminance environments.
2458   1 = The anti flicker may be closed to avoid over exposure in the high-luminance environments.
2459  */
2460 typedef enum hiISP_ANTIFLICKER_MODE_E {
2461     ISP_ANTIFLICKER_NORMAL_MODE = 0x0,
2462     ISP_ANTIFLICKER_AUTO_MODE   = 0x1,
2463     ISP_ANTIFLICKER_MODE_BUTT
2464 } ISP_ANTIFLICKER_MODE_E;
2465 
2466 /* Defines the anti-flicker attribute */
2467 typedef struct hiISP_ANTIFLICKER_S {
2468     HI_BOOL bEnable;     /* RW; Range:[0, 1]; Format:1.0; */
2469     HI_U8   u8Frequency; /* RW; Range:[0, 255]; Format:8.0;
2470                             usually this value is 50 or 60 which is the frequency of the AC power supply */
2471     ISP_ANTIFLICKER_MODE_E  enMode;
2472 } ISP_ANTIFLICKER_S;
2473 
2474 typedef struct hiISP_SUBFLICKER_S {
2475     HI_BOOL bEnable; /* RW; Range:[0, 1]; Format:1.0; */
2476 
2477     HI_U8   u8LumaDiff; /* RW; Range:[0, 100]; Format:8.0; if subflicker mode enable, current luma is less than AE
2478                            compensation plus LumaDiff, AE will keep min antiflicker shutter time
2479                            (for example: 1/100s or 1/120s) to avoid flicker. while current luma is larger than AE
2480                            compensation plus the LumaDiff, AE will reduce shutter time to avoid over-exposure and
2481                            introduce flicker in the pircture */
2482 } ISP_SUBFLICKER_S;
2483 
2484 /*
2485  * Defines the ISP FSWDR operating mode
2486  * 0 = Normal FSWDR mode
2487  * 1 = Long frame mode, only effective in LINE_WDR,
2488  * when running in this mode FSWDR module only output the long frame data
2489  */
2490 typedef enum hiISP_FSWDR_MODE_E {
2491     ISP_FSWDR_NORMAL_MODE          = 0x0,
2492     ISP_FSWDR_LONG_FRAME_MODE      = 0x1,
2493     ISP_FSWDR_AUTO_LONG_FRAME_MODE = 0x2, /* Auto long frame mode, only effective in LINE_WDR,  When running in this
2494                                              mode, normal WDR and long frame mode would auto switch */
2495     ISP_FSWDR_MODE_BUTT
2496 } ISP_FSWDR_MODE_E;
2497 
2498 typedef struct hiISP_AE_ATTR_S {
2499     /* base parameter */
2500     ISP_AE_RANGE_S stExpTimeRange;   /* RW; Range:[0x0, 0xFFFFFFFF]; Format:32.0; sensor exposure time (unit: us),
2501                                         it's related to the specific sensor */
2502     ISP_AE_RANGE_S stAGainRange;     /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2503                                         sensor analog gain (unit: times, 10bit precision), it's related to the
2504                                         specific sensor */
2505     ISP_AE_RANGE_S stDGainRange;     /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2506                                         sensor digital gain (unit: times, 10bit precision), it's related to the
2507                                         specific sensor */
2508     ISP_AE_RANGE_S stISPDGainRange;  /* RW; Range:[0x400, 0x40000]; Format:22.10;
2509                                         ISP digital gain (unit: times, 10bit precision), it's related to the
2510                                         ISP digital gain range */
2511     ISP_AE_RANGE_S stSysGainRange;   /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2512                                         system gain (unit: times, 10bit precision), it's related to the specific
2513                                         sensor and ISP Dgain range */
2514     HI_U32 u32GainThreshold;         /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2515                                         Gain threshold for slow shutter mode (unit: times, 10bit precision) */
2516 
2517     HI_U8  u8Speed;                  /* RW; Range:[0x0, 0xFF]; Format:8.0;
2518                                         AE adjust step for dark scene to bright scene switch */
2519     HI_U16  u16BlackSpeedBias;       /* RW; Range:[0x0, 0xFFFF]; Format:16.0;
2520                                         AE adjust step bias for bright scene to dark scene switch */
2521     HI_U8  u8Tolerance;              /* RW; Range:[0x0, 0xFF]; Format:8.0; AE adjust tolerance */
2522     HI_U8  u8Compensation;           /* RW; Range:[0x0, 0xFF]; Format:8.0; AE compensation */
2523     HI_U16  u16EVBias;               /* RW; Range:[0x0, 0xFFFF]; Format:16.0; AE EV bias */
2524     ISP_AE_STRATEGY_E enAEStrategyMode;  /* RW; Range:[0, 1]; Format:1.0; Support Highlight prior or Lowlight prior */
2525     HI_U16  u16HistRatioSlope;       /* RW; Range:[0x0, 0xFFFF]; Format:16.0; AE hist ratio slope */
2526     HI_U8   u8MaxHistOffset;         /* RW; Range:[0x0, 0xFF]; Format:8.0; Max hist offset */
2527 
2528     ISP_AE_MODE_E  enAEMode;         /* RW; Range:[0, 1]; Format:1.0; AE mode(slow shutter/fix framerate)(onvif) */
2529     ISP_ANTIFLICKER_S stAntiflicker;
2530     ISP_SUBFLICKER_S stSubflicker;
2531     ISP_AE_DELAY_S stAEDelayAttr;
2532 
2533     HI_BOOL bManualExpValue;         /* RW; Range:[0, 1]; Format:1.0; manual exposure value or not */
2534     HI_U32 u32ExpValue;              /* RW; Range:(0x0, 0xFFFFFFFF]; Format:32.0; manual exposure value */
2535 
2536     ISP_FSWDR_MODE_E enFSWDRMode;    /* RW; Range:[0, 2]; Format:2.0; FSWDR running mode */
2537     HI_BOOL bWDRQuick;               /* RW; Range:[0, 1]; Format:1.0; WDR use delay strategy or not;
2538                                         If is true, WDR AE adjust will be faster */
2539 
2540     HI_U16  u16ISOCalCoef;     /* RW; Range:[0x0, 0xFFFF]; Format:8.8;
2541                                   The coefficient between Standard ISO and origin ISO (unit: times, 8bit precision) */
2542 } ISP_AE_ATTR_S;
2543 
2544 typedef struct hiISP_ME_ATTR_S {
2545     ISP_OP_TYPE_E enExpTimeOpType;
2546     ISP_OP_TYPE_E enAGainOpType;
2547     ISP_OP_TYPE_E enDGainOpType;
2548     ISP_OP_TYPE_E enISPDGainOpType;
2549 
2550     HI_U32 u32ExpTime;  /* RW; Range:[0x0, 0xFFFFFFFF]; Format:32.0;
2551                            sensor exposure time (unit: us), it's related to the specific sensor */
2552     HI_U32 u32AGain;    /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2553                            sensor analog gain (unit: times, 10bit precision), it's related to the specific sensor */
2554     HI_U32 u32DGain;    /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2555                            sensor digital gain (unit: times, 10bit precision), it's related to the specific sensor */
2556     HI_U32 u32ISPDGain; /* RW; Range:[0x400, 0x40000]; Format:22.10; ISP digital gain (unit: times, 10bit precision),
2557                            it's related to the ISP digital gain range */
2558 } ISP_ME_ATTR_S;
2559 
2560 typedef struct hiISP_EXPOSURE_ATTR_S {
2561     HI_BOOL         bByPass;    /* RW; Range:[0, 1]; Format:1.0; */
2562     ISP_OP_TYPE_E   enOpType;
2563     HI_U8     u8AERunInterval;  /* RW; Range:[0x1, 0xFF]; Format:8.0; set the AE run interval */
2564     HI_BOOL   bHistStatAdjust;  /* RW; Range:[0, 1]; Format:1.0;
2565                                    HI_TRUE: 256 bin histogram statistic config will adjust
2566                                    when large red or blue area detected.
2567                                    HI_FALSE: 256 bin histogram statistic config will not change */
2568     HI_BOOL   bAERouteExValid;  /* RW; Range:[0, 1]; Format:1.0; use extend AE route or not */
2569     ISP_ME_ATTR_S   stManual;
2570     ISP_AE_ATTR_S   stAuto;
2571     ISP_PRIOR_FRAME_E enPriorFrame;  /* RW; Range:[0, 3]; Format:1.0; AE prior frame */
2572     HI_BOOL   bAEGainSepCfg;  /* RW; Range:[0, 1]; Format:1.0; long and short frame gain separately configure or not */
2573     HI_BOOL   bAdvanceAE;     /* RW; Range:[0, 1]; Format:1.0; open advance AE or not */
2574 } ISP_EXPOSURE_ATTR_S;
2575 
2576 #define ISP_AE_ROUTE_MAX_NODES                    16
2577 typedef struct hiISP_AE_ROUTE_NODE_S {
2578     HI_U32  u32IntTime;          /* RW; Range:(0x0, 0xFFFFFFFF]; Format:32.0;
2579                                     sensor exposure time (unit: us), it's related to the specific sensor */
2580     HI_U32  u32SysGain;          /* RW; Range:[0x400, 0xFFFFFFFF]; Format:22.10;
2581                                     system gain (unit: times, 10bit precision), it's related to the specific sensor and
2582                                     ISP Dgain range */
2583     ISP_IRIS_F_NO_E  enIrisFNO;  /* RW; Range:[0, 10]; Format:4.0;
2584                                     the F number of the iris's aperture, only support for Piris */
2585     HI_U32  u32IrisFNOLin;       /* RW; Range:[0x1, 0x400]; Format:32.0;
2586                                     the equivalent gain of F number of the iris's aperture, only support for Piris */
2587 } ISP_AE_ROUTE_NODE_S;
2588 
2589 typedef struct hiISP_AE_ROUTE_S {
2590     HI_U32 u32TotalNum;     /* RW; Range:[0, 0x10]; Format:8.0; total node number of AE route */
2591     ISP_AE_ROUTE_NODE_S astRouteNode[ISP_AE_ROUTE_MAX_NODES];
2592 } ISP_AE_ROUTE_S;
2593 
2594 #define ISP_AE_ROUTE_EX_MAX_NODES                 16
2595 typedef struct hiISP_AE_ROUTE_EX_NODE_S {
2596     HI_U32  u32IntTime;   /* RW; Range:(0x0, 0xFFFFFFFF]; Format:32.0;
2597                              sensor exposure time (unit: us), it's related to the specific sensor */
2598     HI_U32  u32Again;     /* RW; Range:[0x400, 0x3FFFFF]; Format:22.10;
2599                              sensor analog gain (unit: times, 10bit precision), it's related to the specific sensor */
2600     HI_U32  u32Dgain;     /* RW; Range:[0x400, 0x3FFFFF]; Format:22.10;
2601                              sensor digital gain (unit: times, 10bit precision), it's related to the specific sensor */
2602     HI_U32  u32IspDgain;    /* RW; Range:[0x400, 0x40000]; Format:22.10;
2603                                ISP digital gain (unit: times, 10bit precision) */
2604     ISP_IRIS_F_NO_E  enIrisFNO;  /* RW; Range:[0, 10]; Format:4.0;
2605                                     the F number of the iris's aperture, only support for Piris */
2606     HI_U32  u32IrisFNOLin;  /* RW; Range:[0x1, 0x400]; Format:32.0;
2607                                the equivalent gain of F number of the iris's aperture, only support for Piris */
2608 } ISP_AE_ROUTE_EX_NODE_S;
2609 
2610 typedef struct hiISP_AE_ROUTE_EX_S {
2611     HI_U32 u32TotalNum;       /* RW; Range:[0, 0x10]; Format:8.0; total node number of extend AE route */
2612     ISP_AE_ROUTE_EX_NODE_S astRouteExNode[ISP_AE_ROUTE_EX_MAX_NODES];
2613 } ISP_AE_ROUTE_EX_S;
2614 
2615 typedef struct hiISP_EXP_INFO_S {
2616     HI_U32 u32ExpTime;                 /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2617     HI_U32 u32ShortExpTime;            /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2618     HI_U32 u32MedianExpTime;           /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2619     HI_U32 u32LongExpTime;             /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2620     HI_U32 u32AGain;                   /* R; Range:[0x400, 0xFFFFFFFF]; Format:22.10; */
2621     HI_U32 u32DGain;                   /* R; Range:[0x400, 0xFFFFFFFF]; Format:22.10; */
2622     HI_U32 u32AGainSF;                 /* R; Range:[0x400, 0xFFFFFFFF]; Format:22.10; */
2623     HI_U32 u32DGainSF;                 /* R; Range:[0x400, 0xFFFFFFFF]; Format:22.10; */
2624     HI_U32 u32ISPDGain;                /* R; Range:[0x400, 0xFFFFFFFF]; Format:22.10; */
2625     HI_U32 u32Exposure;                /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2626     HI_BOOL bExposureIsMAX;            /* R; Range:[0, 1]; Format:1.0; */
2627     HI_S16 s16HistError;               /* R; Range:[-32768, 32767]; Format:16.0; */
2628     HI_U32 au32AE_Hist1024Value[HIST_NUM]; /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0;
2629                                               1024 bins histogram for channel 1 */
2630 
2631     HI_U8  u8AveLum;                /* R; Range:[0x0, 0xFF]; Format:8.0; */
2632     HI_U32 u32LinesPer500ms;        /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; exposure lines per 500ms */
2633     HI_U32 u32PirisFNO;             /* R; Range:[0x0, 0x400]; Format:32.0; */
2634     HI_U32 u32Fps;                  /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; actual fps */
2635     HI_U32 u32ISO;                  /* R; Range:[0x64, 0xFFFFFFFF]; Format:32.0; */
2636     HI_U32 u32ISOSF;                /* R; Range:[0x64, 0xFFFFFFFF]; Format:32.0; */
2637     HI_U32 u32ISOCalibrate;         /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; */
2638     HI_U32 u32RefExpRatio;          /* R; Range:[0x40, 0x4000]; Format:26.6; */
2639     HI_U16 u16WdrExpCoef;           /* R; Range:[0x0, 0x400]; Format:6.10; 0x400 means 1 times */
2640     HI_U32 u32FirstStableTime;      /* R; Range:[0x0, 0xFFFFFFFF]; Format:32.0; AE first stable time for quick start */
2641     HI_U32 u32QuickStarISO;         /* R; Range:[0x64, 0xFFFFFFFF]; Format:32.0; */
2642     ISP_AE_ROUTE_S stAERoute;       /* R; Actual AE route */
2643     ISP_AE_ROUTE_EX_S stAERouteEx;  /* R; Actual AE route_ex */
2644     ISP_AE_ROUTE_S stAERouteSF;     /* R; Actual AE route_sf */
2645     ISP_AE_ROUTE_EX_S stAERouteSFEx; /* R; Actual AE route_sf_ex */
2646 } ISP_EXP_INFO_S;
2647 
2648 typedef struct {
2649     HI_U32 u32RegAddr;
2650     HI_U32 u32RegValue;
2651 } ISP_EXP_PARAM_REG;
2652 
2653 typedef struct {
2654     HI_U32 u32TarFps;
2655     HI_U32 u32TarIspDgain; /* 10bit */
2656     ISP_EXP_PARAM_REG stTimeReg[10]; /* 10 */
2657     ISP_EXP_PARAM_REG stAgainReg[10]; /* 10 */
2658     ISP_EXP_PARAM_REG stDgainReg[10]; /* 10 */
2659 } ISP_EXP_CONVERT_PARAM;
2660 
2661 #define EXP_RATIO_NUM                             3
2662 typedef struct hiISP_WDR_EXPOSURE_ATTR_S {
2663     ISP_OP_TYPE_E enExpRatioType;   /* RW; Range:[0, 1]; Format:1.0;
2664                                        OP_TYPE_AUTO: The ExpRatio used in ISP is generated by firmware;
2665                                        OP_TYPE_MANUAL: The ExpRatio used in ISP is set by u32ExpRatio */
2666     HI_U32 au32ExpRatio[EXP_RATIO_NUM]; /* RW; Range:[0x40, 0xFFF]; Format:26.6; 0x40 means 1 times.
2667                                            When enExpRatioType is OP_TYPE_AUTO, u32ExpRatio is invalid.
2668                                            When enExpRatioType is OP_TYPE_MANUAL, u32ExpRatio is quotient of
2669                                            long exposure time / short exposure time. */
2670     HI_U32 u32ExpRatioMax;  /* RW; Range:[0x40, 0x4000]; Format:26.6; 0x40 means 1 times.
2671                                When enExpRatioType is OP_TYPE_AUTO, u32ExpRatioMax is max(upper limit) of ExpRatio
2672                                generated by firmware.
2673                                When enExpRatioType is OP_TYPE_MANUAL, u32ExpRatioMax is invalid. */
2674     HI_U32 u32ExpRatioMin;  /* RW; Range:[0x40, 0x4000]; Format:26.6; limited Range:[0x40, u32ExpRatioMax],
2675                                0x40 means 1 times.
2676                                When enExpRatioType is OP_TYPE_AUTO, u32ExpRatioMin is min(lower limit) of ExpRatio
2677                                generated by firmware.
2678                                When enExpRatioType is OP_TYPE_MANUAL, u32ExpRatioMin is invalid. */
2679     HI_U16 u16Tolerance;    /* RW; Range:[0x0, 0xFF]; Format:8.0;et the dynamic range tolerance.
2680                                Format: unsigned 6.2-bit fixed-point. 0x4 means 1dB. */
2681     HI_U16 u16Speed;        /* RW; Range:[0x0, 0xFF]; Format:8.0; exposure ratio adjust speed */
2682     HI_U16 u16RatioBias;    /* RW; Range:[0x0, 0xFFFF]; Format:16.0; exposure ratio bias */
2683     HI_U16 u16HighLightTarget;  /* RW; Range:[0x0, 0x400]; Format:10.0; the high light target. */
2684     HI_U16 u16ExpCoefMin;     /* RW; Range:[0x0, 0x400]; Format:16.0; min exposure cofficient */
2685 } ISP_WDR_EXPOSURE_ATTR_S;
2686 
2687 typedef struct hiISP_HDR_EXPOSURE_ATTR_S {
2688     ISP_OP_TYPE_E enExpHDRLvType; /* RW; Range:[0, 1]; Format:1.0;
2689                                      OP_TYPE_AUTO: The ExpHDRLv used in ISP is generated by firmware;
2690                                      OP_TYPE_MANUAL: The ExpHDRLv used in ISP is set by u32ExpHDRLv */
2691     HI_U32 u32ExpHDRLv;           /* RW; Range:[0x40, 0x400]; Format:26.6; 0x40 means 1 times.
2692                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpHDRLv is invalid.
2693                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpHDRLv is the quotient of
2694                                      exposure / linear exposure. */
2695     HI_U32 u32ExpHDRLvMax;        /* RW; Range:[0x40, 0x400]; Format:26.6; 0x40 means 1 times.
2696                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpHDRLvMax is max(upper limit) of
2697                                      ExpHDRLv generated by firmware.
2698                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpHDRLvMax is invalid. */
2699     HI_U32 u32ExpHDRLvMin;        /* RW; Range:[0x40, 0x400]; Format:26.6; limited range:[0x40, u32ExpHDRLvMax],
2700                                      0x40 means 1 times.
2701                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpHDRLvMin is min(lower limit) of
2702                                      ExpHDRLv generated by firmware.
2703                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpHDRLvMin is invalid. */
2704     HI_U32 u32ExpHDRLvWeight;     /* RW; Range:[0x0, 0x400]; Format:16.0; exposure HDR level weight. */
2705 } ISP_HDR_EXPOSURE_ATTR_S;
2706 
2707 typedef struct hiISP_SMART_EXPOSURE_ATTR_S {
2708     HI_BOOL bEnable;              /* RW; Range:[0, 1]; Format:1.0; smart ae enable or not */
2709     HI_BOOL bIRMode;              /* RW; Range:[0, 1]; Format:1.0; smart ae IR mode or not */
2710     ISP_OP_TYPE_E enSmartExpType; /* RW; Range:[0, 1]; Format:1.0;
2711                                      OP_TYPE_AUTO: The ExpCoef used in ISP is generated by firmware;
2712                                      OP_TYPE_MANUAL: The ExpCoef used in ISP is set by u32ExpCoef */
2713     HI_U16  u16ExpCoef;           /* RW; Range:[0x0, 0xFFFF]; Format:6.10; 0x400 means 1 times.
2714                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpCoef is invalid.
2715                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpCoef is the quotient of exposure. */
2716     HI_U8   u8LumaTarget;         /* RW; Range:[0x0, 0xFF]; Format:8.0; luma target of smart ae. */
2717     HI_U16  u16ExpCoefMax;        /* RW; Range:[0x0, 0xFFFF]; Format:6.10; 0x400 means 1 times.
2718                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpCoefvMax is max(upper limit) of ExpCoef
2719                                      generated by firmware.
2720                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpCoefMax is invalid. */
2721     HI_U16  u16ExpCoefMin;        /* RW; Range:[0x0, 0xFFFF]; Format:6.10; 0x400 means 1 times.
2722                                      When enExpHDRLvType is OP_TYPE_AUTO, u32ExpCoefMax is min(lower limit) of ExpCoef
2723                                      generated by firmware.
2724                                      When enExpHDRLvType is OP_TYPE_MANUAL, u32ExpCoefMin is invalid. */
2725     HI_U8   u8SmartInterval;      /* RW; Range:[0x1, 0xFF]; Format:8.0; smart ae run interval */
2726     HI_U8   u8SmartSpeed;         /* RW; Range:[0x0, 0xFF]; Format:8.0; smart ae adjust step */
2727     HI_U16  u16SmartDelayNum;     /* RW; Range:[0x0, 0x400]; Format:16.0; smart ae adjust delay frame num */
2728 } ISP_SMART_EXPOSURE_ATTR_S;
2729 
2730 /* AWB structs */
2731 /*
2732   Defines the AWB online calibration type
2733   u16AvgRgain: the avg value of Rgain after online calibration
2734   u16AvgBgain: the avg value of Bgain after online calibration
2735  */
2736 typedef struct hiISP_AWB_Calibration_Gain_S {
2737     HI_U16 u16AvgRgain;
2738     HI_U16 u16AvgBgain;
2739 } ISP_AWB_Calibration_Gain_S;
2740 /*
2741   Defines the AWB algorithm type
2742   0 = Improved gray world algorithm.
2743   1 = AWB algorithm that classifies the statistics and re-filters the white blocks
2744  */
2745 typedef enum hiISP_AWB_ALG_TYPE_E {
2746     AWB_ALG_LOWCOST = 0,
2747     AWB_ALG_ADVANCE = 1,
2748     AWB_ALG_BUTT
2749 } ISP_AWB_ALG_TYPE_E;
2750 
2751 /*
2752   Defines the AWB policy in the multi-illuminant scenario
2753   0 = Automatic saturation adjustment in the multi-illuminant scenario
2754   1 = Automatic ccm adjustment in the multi-illuminant scenario
2755  */
2756 typedef enum hiISP_AWB_MULTI_LS_TYPE_E {
2757     AWB_MULTI_LS_SAT = 0,
2758     AWB_MULTI_LS_CCM = 1,
2759     AWB_MULTI_LS_BUTT
2760 } ISP_AWB_MULTI_LS_TYPE_E;
2761 
2762 typedef enum hiISP_AWB_INDOOR_OUTDOOR_STATUS_E {
2763     AWB_INDOOR_MODE = 0,
2764     AWB_OUTDOOR_MODE = 1,
2765     AWB_INDOOR_OUTDOOR_BUTT
2766 } ISP_AWB_INDOOR_OUTDOOR_STATUS_E;
2767 
2768 /* Defines the AWB gain range */
2769 typedef struct hiISP_AWB_CT_LIMIT_ATTR_S {
2770     HI_BOOL bEnable;
2771     ISP_OP_TYPE_E   enOpType;
2772 
2773     HI_U16 u16HighRgLimit; /* RW; Range:[0x0, 0xFFF]; Format:4.8;
2774                               in Manual Mode, user define the Max Rgain of High Color Temperature */
2775     HI_U16 u16HighBgLimit; /* RW; Range:[0x0, 0xFFF]; Format:4.8;
2776                               in Manual Mode, user define the Min Bgain of High Color Temperature */
2777     HI_U16 u16LowRgLimit;  /* RW; Range:[0x0, 0xFFF]; Format:4.8; limited range:[0x0, u16HighRgLimit),
2778                               in Manual Mode, user define the Min Rgain of Low Color Temperature */
2779     HI_U16 u16LowBgLimit;  /* RW; Range:[0, 0xFFF]; Format:4.8; limited Range:(u16HighBgLimit, 0xFFF],
2780                               in Manual Mode, user define the Max Bgain of Low Color Temperature */
2781 } ISP_AWB_CT_LIMIT_ATTR_S;
2782 
2783 typedef struct hiISP_AWB_IN_OUT_ATTR_S {
2784     HI_BOOL bEnable;                                 /* RW; Range:[0, 1]; Format:1.0;
2785                                                         Outdoor/Indoor scenario determination enable */
2786     ISP_OP_TYPE_E   enOpType;
2787     ISP_AWB_INDOOR_OUTDOOR_STATUS_E enOutdoorStatus; /* RW;User should config indoor or outdoor status in Manual Mode */
2788     HI_U32 u32OutThresh;     /* RW;Format:32.0;shutter time(in us) to judge indoor or outdoor */
2789     HI_U16 u16LowStart;      /* RW;Format:16.0;5000K is recommend */
2790     HI_U16 u16LowStop;       /* RW;Format:16.0;limited range:(0, u16LowStart),
2791                                 4500K is recommend, should be smaller than u8LowStart */
2792     HI_U16 u16HighStart;     /* RW;Format:16.0;limited range:(u16LowStart, 0xFFFF],
2793                                 6500K is recommend, shoule be larger than u8LowStart */
2794     HI_U16 u16HighStop;      /* RW;Format:16.0;limited range:(u16HighStart, 0xFFFF],
2795                                 8000K is recommend, should be larger than u8HighStart */
2796     HI_BOOL bGreenEnhanceEn; /* RW; Range:[0, 1]; Format:1.0;
2797                                 If this is enabled, Green channel will be enhanced based on the ratio of green plant */
2798     HI_U8   u8OutShiftLimit; /* RW; Range:[0, 0xFF]; Format:8.0;Max white point zone distance to Planckian Curve */
2799 } ISP_AWB_IN_OUT_ATTR_S;
2800 
2801 typedef struct hiISP_AWB_CBCR_TRACK_ATTR_S {
2802     HI_BOOL bEnable;                            /* RW; Range:[0, 1]; Format:1.0;
2803                                                 If enabled, statistic parameter cr, cb will change according to iso */
2804 
2805     HI_U16  au16CrMax[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0xFFF]; au16CrMax[i] >= au16CrMin[i] */
2806     HI_U16  au16CrMin[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0xFFF] */
2807     HI_U16  au16CbMax[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0xFFF]; au16CbMax[i] >= au16CbMin[i] */
2808     HI_U16  au16CbMin[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range:[0x0, 0xFFF] */
2809 } ISP_AWB_CBCR_TRACK_ATTR_S;
2810 
2811 #define AWB_LUM_HIST_NUM                          6
2812 /* Defines the parameters of the luminance histogram statistics for white balance */
2813 typedef struct hiISP_AWB_LUM_HISTGRAM_ATTR_S {
2814     HI_BOOL bEnable;      /* RW; Range:[0, 1]; Format:1.0; If enabled, zone weight to awb is combined with zone luma */
2815     ISP_OP_TYPE_E   enOpType;                 /* In auto mode, the weight distribution follows Gaussian distribution */
2816     HI_U8   au8HistThresh[AWB_LUM_HIST_NUM];  /* RW; Range:[0x0, 0xFF]; Format:8.0;
2817                                                  In manual mode, user define luma thresh, thresh[0] is 0,
2818                                                  thresh[5] is 0xFF,  thresh[i] greater or equal to  thresh[i-1] */
2819     HI_U16  au16HistWt[AWB_LUM_HIST_NUM];     /* RW; Range:[0x0, 0xFFFF]; Format:16.0;
2820                                                  user can define luma weight in both manual and auto mode. */
2821 } ISP_AWB_LUM_HISTGRAM_ATTR_S;
2822 
2823 /* Defines the information about a separate illuminant */
2824 typedef struct hiISP_AWB_LIGHTSOURCE_INFO_S {
2825     HI_U16 u16WhiteRgain; /* RW;Range:[0x0, 0xFFF]; Format:4.8; G/R of White points at this light source */
2826     HI_U16 u16WhiteBgain; /* RW;Range:[0x0, 0xFFF]; Format:4.8; G/B of White points at this light source */
2827     HI_U16 u16ExpQuant;   /* RW;shutter time * again * dgain >> 4, Not support Now */
2828     HI_U8  u8LightStatus; /* RW;Range:[0,2]; Format:2.0; idle  1:add light source  2:delete sensitive color */
2829     HI_U8  u8Radius;      /* RW;Range:[0x0, 0xFF];  Format:8.0; Radius of light source, */
2830 } ISP_AWB_EXTRA_LIGHTSOURCE_INFO_S;
2831 
2832 #define AWB_LS_NUM                                4
2833 #define AWB_MULTI_CT_NUM                          8
2834 /* extended AWB attributes */
2835 typedef struct hiISP_AWB_ATTR_EX_S {
2836     HI_U8  u8Tolerance;      /* RW; Range:[0x0, 0xFF]; Format:8.0; AWB adjust tolerance */
2837     HI_U8  u8ZoneRadius;     /* RW; Range:[0x0, 0xFF]; Format:8.0; radius of AWB blocks */
2838     HI_U16 u16CurveLLimit;   /* RW; Range:[0x0, 0x100]; Format:9.0; Left limit of AWB Curve,
2839                                 recomend for indoor 0xE0, outdoor 0xE0 */
2840     HI_U16 u16CurveRLimit;   /* RW; Range:[0x100, 0xFFF]; Format:12.0; Right Limit of AWB Curve,
2841                                 recomend for indoor 0x130, outdoor 0x120 */
2842 
2843     HI_BOOL  bExtraLightEn;  /* RW; Range:[0, 1]; Format:1.0; Enable special light source function */
2844     ISP_AWB_EXTRA_LIGHTSOURCE_INFO_S    stLightInfo[AWB_LS_NUM];
2845     ISP_AWB_IN_OUT_ATTR_S               stInOrOut;
2846 
2847     HI_BOOL bMultiLightSourceEn;              /* RW; Range:[0, 1]; Format:1.0; If enabled, awb will do special process
2848                                                  in multi light source enviroment */
2849     ISP_AWB_MULTI_LS_TYPE_E enMultiLSType;    /* Saturation or CCM Tunning */
2850     HI_U16  u16MultiLSScaler;                 /* RW; Range:[0x0, 0x100]; Format:12.0;
2851                                                  In saturation type, it means the max saturation it can achieve,
2852                                                  in ccm type, it means the strenght of multi process. */
2853     HI_U16  au16MultiCTBin[AWB_MULTI_CT_NUM]; /* RW; Range:[0, 0XFFFF]; Format:16.0;
2854                                                  AWB Support divide the color temperature range by 8 bins */
2855     HI_U16  au16MultiCTWt[AWB_MULTI_CT_NUM];  /* RW; Range:[0x0, 0x400];Weight for different color temperature,
2856                                                  same value of 8 means CT weight does't work, */
2857 
2858     HI_BOOL bFineTunEn;         /* RW; Range:[0x0, 0x1]; Format:1.0;If enabled, skin color scene will be optimized */
2859     HI_U8   u8FineTunStrength;  /* RW; Range:[0x0, 0xFF]; Format:8.0;
2860                                    larger value means better performance of skin color scene,
2861                                    but will increase error probability in low color temperature scene */
2862 } ISP_AWB_ATTR_EX_S;
2863 
2864 #define AWB_CURVE_PARA_NUM                        6
2865 typedef struct hiISP_AWB_ATTR_S {
2866     HI_BOOL bEnable;               /* RW; Range:[0x0, 0x1]; Format:1.0;If AWB is disabled, static wb gain will be used,
2867                                       otherwise auto wb gain will be used */
2868 
2869     HI_U16 u16RefColorTemp;        /* RW; Range:[0x0, 0xFFFF]; Format:16.0; Calibration Information */
2870     HI_U16 au16StaticWB[ISP_BAYER_CHN_NUM];   /* RW; Range:[0x0, 0xFFF]; Format:12.0;Calibration Information */
2871     HI_S32 as32CurvePara[AWB_CURVE_PARA_NUM]; /* RW; Format:32.0;Calibration Information,
2872                                                  limited Range:as32CurvePara[3] != 0, as32CurvePara[4]==128 */
2873 
2874     ISP_AWB_ALG_TYPE_E       enAlgType;
2875 
2876     HI_U8  u8RGStrength;     /* RW; Range: [0x0, 0xFF]; Format:8.0; AWB Strength of R Channel */
2877     HI_U8  u8BGStrength;     /* RW; Range: [0x0, 0xFF]; Format:8.0; AWB Strength of B Channel */
2878     HI_U16 u16Speed;         /* RW; Range: [0x0, 0xFFF]; Format:12.0; Convergence speed of AWB  */
2879     HI_U16 u16ZoneSel;       /* RW; Range: [0, 255]; Format:8.0; A value of 0 or 0xFF means global AWB,
2880                                 A value between 0 and 0xFF means zoned AWB */
2881     HI_U16 u16HighColorTemp; /* RW; Range: [0, 65535]; Format:16.0; AWB max temperature, Recommended: [8500, 10000] */
2882     HI_U16 u16LowColorTemp;  /* RW; Range: [0, 65535]; Format:16.0; Limited Range:[0, u16HighColorTemp),
2883                                 AWB min temperature, Recommended: [2000, 2500] */
2884     ISP_AWB_CT_LIMIT_ATTR_S stCTLimit;
2885     HI_BOOL bShiftLimitEn;  /* RW; Range: [0, 1]; Format:1.0; If enabled, when the statistic information is out of
2886                                range, it should be project back */
2887     HI_U8  u8ShiftLimit;    /* RW; Range: [0x0, 0xFF];  Format:8.0; planckian curve range, Recommended: [0x30, 0x50] */
2888     HI_BOOL bGainNormEn;    /* RW; Range: [0, 1]; Format:1.0; if enabled, the min of RGB gain is fixed. */
2889     HI_BOOL bNaturalCastEn; /* RW, Range: [0, 1]; Format:1.0; if enabled, the color performance will be natural in
2890                                lowlight and low color temperature */
2891 
2892     ISP_AWB_CBCR_TRACK_ATTR_S stCbCrTrack;
2893     ISP_AWB_LUM_HISTGRAM_ATTR_S stLumaHist;
2894     HI_BOOL bAWBZoneWtEn;          /* RW, Range: [0, 1]; Format:1.0; if enabled, user can set weight for each zones */
2895     HI_U8   au8ZoneWt[(AWB_ZONE_ORIG_ROW) * (AWB_ZONE_ORIG_COLUMN)]; /* RW; Range: [0, 255]; Format:8.0;Zone Wt Table */
2896 } ISP_AWB_ATTR_S;
2897 
2898 /* Attr for SPC AWB */
2899 #define SPECAWB_FACTTBL_ELMNUM                    7          /* Table number. */
2900 #define SPECAWB_FACTTBL_SIZE                      64         /* Table size for weight for light source detection. */
2901 #define SPECAWB_BBL_SIZE                          40         /* Table size for BlackBodyTable. */
2902 
2903 typedef struct hiISP_SPECAWB_BBL_TBL_S {
2904     HI_S16 s16Kelvin;   /* RW;Range:[-32768, 32767];Kelvin */
2905     HI_S16 s16Wbr;      /* RW;Range:[-32768, 32767];WBR value */
2906     HI_S16 s16Wbb;      /* RW;Range:[-32768, 32767];WBB value */
2907 } ISP_SPECAWB_BBL_TBL_S;
2908 
2909 typedef struct hiISP_SPECAWB_KELVIN_DBB_MAP_S {
2910     HI_S16 s16Kelvin; /* RW;Range:[-32768, 32767];kevin */
2911     HI_S16 s16DBB;   /* RW;Range:[-32768, 32767];DeltaBlackBody */
2912 } ISP_SPECAWB_KELVIN_DBB_MAP_S;
2913 
2914 typedef struct  hiISP_SPECKCWB_S {
2915     HI_S32    s32RGain; /* RW;Range:[-2147483648, 2147483647]; RgainValue */
2916     HI_S32    s32BGain; /* RW;Range:[-2147483648, 2147483647]; BgainValue */
2917 } ISP_SPECKCWB_S;
2918 
2919 typedef struct  hiISP_SPECKCWBS16_S {
2920     HI_S16    s16RGain; /* RW;Range:[-32768, 32767]; RgainValue(16bit) */
2921     HI_S16    s16BGain; /* RW;Range:[-32768, 32767]; BgainValue(16bit) */
2922 } ISP_SPECKCWBS16_S;
2923 
2924 typedef struct  hiISP_SPECAWB_FACTTBL_ELEMENT_S {
2925     HI_S16    s16Bv; /* RW;Range:[-32768, 32767]; The center value of the Bv value targeted by this table. */
2926     HI_U8     u8FactTbl[SPECAWB_FACTTBL_SIZE][SPECAWB_FACTTBL_SIZE]; /* RW;Range:[0, 0xFF];
2927                                                                         Weight for light source detection. */
2928 } ISP_SPECAWB_FACTTBL_ELEMENT_S;
2929 
2930 typedef struct  hiISP_SPECAWB_ATTR_S {
2931     ISP_SPECKCWB_S    stWBCenter;        /* RW;WB gain value at the center of the table: The table index is
2932                                             calculated as a relative value from this gain. */
2933     ISP_SPECKCWB_S    stWBMin;           /* RW;Minimum value of WB gain that the table covers. */
2934     ISP_SPECKCWB_S    stWBMax;           /* RW;Maximum value of WB gain that the table covers. */
2935     ISP_SPECKCWB_S    stLogFact;         /* RW;Range covered by the table: 1/exp(stLogFact) to exp(stLogFact).
2936                                             For example, if it is 1.0, WBDelta will be 1/e to e.
2937                                             However, e = 2.71828 ... (base of natural logarithm) */
2938     HI_S32            s32LimitFactMin;   /* RW;Range:[0, s32LimitFactMax];AWB statics threshold value:
2939                                             minimum threshold value of ratio to pixel maximum value. */
2940     HI_S32            s32LimitFactMax;   /* RW;Range:[s32LimitFactMin, 0xFFFF];AWB statics threshold value:
2941                                             maximum threshold value of ratio to pixel maximum value. */
2942     HI_S32            s32LimitFactLimit; /* RW;Range:[0x600, 0x4000]; AWB statics limit value:
2943                                             ratio to (pixel maximum value * s32LimitFactMax) */
2944     HI_S32            s32FactOffset;     /* RW;Range:[0, 0x800];
2945                                             The offset value of the weight when calculating the AWB statics */
2946     HI_S32            s32BFact;          /* RW;Range:[0x399, 0x500];
2947                                             The value of specular weight when calculating the AWB statics */
2948     HI_S32            s32ACntMin;        /* RW;Range:[0, 0x20];Threshold for block adoption.
2949                                             If the integrated value of the AWB statics is less than m_ACntMin,
2950                                             the block is ignored. */
2951     ISP_SPECKCWB_S    stWBNeutral;       /* RW;WB gain returned when AWB calculation can not be performed */
2952     HI_U8             bLastIsFlash;      /* RW;Range:[1]: The last table is used for flash.
2953                                             0: Used for unknown Bv value. */
2954     HI_S16            s16BvFlashELimit;  /* RW;Range:[-32768, 32767];Threshold of Bv value before strobe lighting when
2955                                             using table for strobe. If bLastIsFlash == TRUE and the Bv value before
2956                                             strobe flash is less than this value, use the table for strobe. */
2957     HI_S32            s32APercent;       /* RW;Range:[0, 100];A value percent of the WB statics */
2958     ISP_SPECKCWBS16_S stWBCnvTbl[SPECAWB_FACTTBL_SIZE][SPECAWB_FACTTBL_SIZE]; /* RW; WB gain conversion table
2959                                                                             (incomplete chromatic adaptation table) */
2960     HI_U8             u8ElementNum; /* RW; Range:[7];Number of connected ISP_SPECAWB_FACTTBL_ELEMENT. */
2961     ISP_SPECAWB_FACTTBL_ELEMENT_S stFactElement[SPECAWB_FACTTBL_ELMNUM];                      /* RW; Weight Table */
2962     ISP_SPECAWB_KELVIN_DBB_MAP_S  stKelvinDBBTbl[SPECAWB_FACTTBL_SIZE][SPECAWB_FACTTBL_SIZE]; /* RW;KelvinDbb table. */
2963     ISP_SPECAWB_BBL_TBL_S         stBlackBodyTbl[SPECAWB_BBL_SIZE];                           /* RW;BlackBody table. */
2964     HI_U16                        u16Fno; /* RW; Range:[10, 100];F number of the len,F1.4=14,F2.8=28,F36 =360... */
2965 } ISP_SPECAWB_ATTR_S;
2966 
2967 typedef struct hiISP_SPECAWB_CONTROL_ATTR_S {
2968     HI_S16 s16BlendHighBvThresh;        /* RW; Range: [-32768, 32767]; High Bv threshold for inner blending function */
2969     HI_U16 u16BlendHighBvWt;            /* RW; Range: [0, 2048]; High Bv  weight for inner blending function */
2970     HI_S16 s16BlendLowBvThresh;         /* RW; Range: [-32768, s16BlendHighBvThresh);
2971                                            Low Bv threshold for inner blending function */
2972     HI_U16 u16BlendLowBvWt;             /* RW; Range: [0, 2048]; Low Bv  weight for inner blending function */
2973 } ISP_SPECAWB_CONTROL_ATTR_S;
2974 
2975 #define SPECAWB_MAX_CAA_NUM                       3
2976 #define SPECAWB_KEVIN_CONVER_MAX_NUM              8
2977 
2978 typedef struct  hiISP_SPECAWB_CAA_CONVERSION_S {
2979     HI_S32 s32SrcKelvin;    /* RW;Range:[-2147483648, 2147483647]; Source kelvin */
2980     HI_S32 s32DstKelvin;    /* RW;Range:[-2147483648, 2147483647]; Destination kelvin */
2981 } ISP_SPECAWB_CAA_CONVERSION_S;
2982 typedef struct  hiISP_SPECAWB_CAA_TBL_S {
2983     HI_U8   u8Enable;       /* RW;Range:[0,1]; lut enable */
2984     HI_S16  s16Bv;          /* RW;Range:[-32768, 32767]; Bv value */
2985     ISP_SPECAWB_CAA_CONVERSION_S stKelvinCon[SPECAWB_KEVIN_CONVER_MAX_NUM];
2986     ISP_SPECKCWBS16_S stWBCnvTbl[SPECAWB_FACTTBL_SIZE][SPECAWB_FACTTBL_SIZE];
2987 } ISP_SPECAWB_CAA_TBL_S;
2988 
2989 typedef struct  hiISP_SPECAWB_CAA_CONTROl_S {
2990     ISP_SPECAWB_CAA_TBL_S stControl[SPECAWB_MAX_CAA_NUM];
2991 } ISP_SPECAWB_CAA_CONTROl_S;
2992 typedef struct hiISP_MWB_ATTR_S {
2993     HI_U16 u16Rgain;            /* RW; Range: [0x0, 0xFFF]; Format:4.8; Multiplier for R  color channel  */
2994     HI_U16 u16Grgain;           /* RW; Range: [0x0, 0xFFF]; Format:4.8; Multiplier for Gr color channel */
2995     HI_U16 u16Gbgain;           /* RW; Range: [0x0, 0xFFF]; Format:4.8; Multiplier for Gb color channel */
2996     HI_U16 u16Bgain;            /* RW; Range: [0x0, 0xFFF]; Format:4.8; Multiplier for B  color channel */
2997 } ISP_MWB_ATTR_S;
2998 
2999 typedef enum hiISP_AWB_ALG_E {
3000     ALG_AWB         = 0,
3001     ALG_AWB_SPEC    = 1,
3002     ALG_BUTT
3003 } ISP_AWB_ALG_E;
3004 typedef struct hiISP_WB_ATTR_S {
3005     HI_BOOL bByPass;              /* RW; Range: [0, 1];  Format:1.0; If enabled, awb will be bypassed */
3006     HI_U8   u8AWBRunInterval;     /* RW; Range: [0x1, 0xFF];  Format:8.0; set the AWB run interval */
3007     ISP_OP_TYPE_E   enOpType;
3008     ISP_MWB_ATTR_S  stManual;
3009     ISP_AWB_ATTR_S  stAuto;
3010     ISP_AWB_ALG_E enAlgType;
3011 } ISP_WB_ATTR_S;
3012 
3013 typedef struct hiISP_COLORMATRIX_MANUAL_S {
3014     HI_BOOL bSatEn;                  /* RW; Range: [0, 1]; Format:1.0;
3015                                         If bSatEn=1, the active CCM = SatMatrix * ManualMatrix,
3016                                         else the active CCM =  ManualMatrix */
3017     HI_U16 au16CCM[CCM_MATRIX_SIZE]; /* RW; Range: [0x0, 0xFFFF]; Format:8.8; Manul CCM matrix, */
3018 } ISP_COLORMATRIX_MANUAL_S;
3019 
3020 typedef struct hiISP_COLORMATRIX_PARAM_S {
3021     HI_U16 u16ColorTemp;             /* RW; Range: [500, 30000]; Format:16.0; the current color temperature */
3022     HI_U16 au16CCM[CCM_MATRIX_SIZE]; /* RW; Range: [0x0, 0xFFFF]; Format:8.8; CCM matrixes for different
3023                                         color temperature */
3024 } ISP_COLORMATRIX_PARAM_S;
3025 
3026 typedef struct hiISP_COLORMATRIX_AUTO_S {
3027     HI_BOOL bISOActEn;    /* RW; Range: [0, 1]; Format:1.0; if enabled, CCM will bypass in low light */
3028     HI_BOOL bTempActEn;   /* RW; Range: [0, 1]; Format:1.0; if enabled, CCM will bypass when color temperature is
3029                              larger than 8000K or less than 2500K */
3030     HI_U16  u16CCMTabNum; /* RW; Range: [0x3, 0x7]; Format:16.0; The number of CCM matrixes */
3031     ISP_COLORMATRIX_PARAM_S astCCMTab[CCM_MATRIX_NUM];
3032 } ISP_COLORMATRIX_AUTO_S;
3033 
3034 typedef struct hiISP_COLORMATRIX_ATTR_S {
3035     ISP_OP_TYPE_E enOpType;
3036     ISP_COLORMATRIX_MANUAL_S stManual;
3037     ISP_COLORMATRIX_AUTO_S stAuto;
3038 } ISP_COLORMATRIX_ATTR_S;
3039 
3040 typedef struct hiISP_SATURATION_MANUAL_S {
3041     HI_U8   u8Saturation;        /* RW; Range: [0, 0xFF]; Format:8.0; set the manual saturation of CCM */
3042 } ISP_SATURATION_MANUAL_S;
3043 
3044 typedef struct hiISP_SATURATION_AUTO_S {
3045     HI_U8   au8Sat[ISP_AUTO_ISO_STRENGTH_NUM]; /* RW; Range: [0, 0xFF]; should be decreased with increasing ISO */
3046 } ISP_SATURATION_AUTO_S;
3047 
3048 typedef struct hiISP_SATURATION_ATTR_S {
3049     ISP_OP_TYPE_E enOpType;
3050     ISP_SATURATION_MANUAL_S stManual;
3051     ISP_SATURATION_AUTO_S stAuto;
3052 } ISP_SATURATION_ATTR_S;
3053 
3054 typedef struct hiISP_COLOR_TONE_ATTR_S {
3055     HI_U16 u16RedCastGain;        /* RW; Range: [0x100, 0x180]; Format:4.8; R channel gain after CCM */
3056     HI_U16 u16GreenCastGain;      /* RW; Range: [0x100, 0x180]; Format:4.8; G channel gain after CCM */
3057     HI_U16 u16BlueCastGain;       /* RW; Range: [0x100, 0x180]; Format:4.8; B channel gain after CCM */
3058 } ISP_COLOR_TONE_ATTR_S;
3059 
3060 typedef struct hiISP_WB_INFO_S {
3061     HI_U16 u16Rgain;                /* R; Range: [0x0, 0xFFF]; Format:8.8;AWB result of R color channel */
3062     HI_U16 u16Grgain;               /* R; Range: [0x0, 0xFFF]; Format:8.8; AWB result of Gr color channel */
3063     HI_U16 u16Gbgain;               /* R; Range: [0x0, 0xFFF]; Format:8.8; AWB result of Gb color channel */
3064     HI_U16 u16Bgain;                /* R; Range: [0x0, 0xFFF]; Format:8.8; AWB result of B color channel */
3065     HI_U16 u16Saturation;           /* R; Range: [0x0, 0xFF];Format:8.0;Current saturation */
3066     HI_U16 u16ColorTemp;            /* R; Range: [0x0, 0xFFFF];Format:16.0;Detect color temperature, maybe out of color
3067                                        cemeprature range */
3068     HI_U16 au16CCM[CCM_MATRIX_SIZE]; /* R; Range: [0x0, 0xFFFF];Format:16.0;Current color correction matrix */
3069 
3070     HI_U16 u16LS0CT;            /* R; Range: [0x0, 0xFFFF];Format:16.0;color tempearture of primary light source */
3071     HI_U16 u16LS1CT;            /* R; Range: [0x0, 0xFFFF];Format:16.0;color tempearture of secondary light source */
3072     HI_U16 u16LS0Area;          /* R; Range: [0x0, 0xFF];Format:8.0;area of primary light source */
3073     HI_U16 u16LS1Area;          /* R; Range: [0x0, 0xFF];Format:8.0;area of secondary light source */
3074     HI_U8  u8MultiDegree;       /* R; Range: [0x0, 0xFF];0 means uniform light source, larger value means multi
3075                                    light source */
3076     HI_U16 u16ActiveShift;      /* R; Range;[0x0,0xFF] */
3077     HI_U32 u32FirstStableTime;  /* R, Range: [0x0, 0xFFFFFFFF];Format:32.0;AWB first stable frame number */
3078     ISP_AWB_INDOOR_OUTDOOR_STATUS_E enInOutStatus;   /* R; indoor or outdoor status */
3079     HI_S16  s16Bv;                                   /* R; Range;[-32768, 32767]; Bv value */
3080 } ISP_WB_INFO_S;
3081 
3082 typedef struct hiISP_QUICK_START_PARAM_S {
3083     HI_BOOL bQuickStartEn;
3084     HI_U8 u8BlackFrameNum;
3085     HI_BOOL bIrModeEn;
3086     HI_U32 u32InitExposureIr;
3087     HI_U32 u32ISOThrIr;
3088     HI_U16 u16IrCutDelayTime;
3089 } ISP_QUICK_START_PARAM_S;
3090 
3091 typedef struct hiISP_INIT_ATTR_S {
3092     HI_BOOL bIsIrMode;
3093     HI_U32 u32ExpTime;
3094     HI_U32 u32AGain;
3095     HI_U32 u32DGain;
3096     HI_U32 u32ISPDGain;
3097     HI_U32 u32Exposure;
3098     HI_U32 u32InitIso;
3099     HI_U32 u32LinesPer500ms;
3100     HI_U32 u32PirisFNO;
3101     HI_U16 u16WBRgain;
3102     HI_U16 u16WBGgain;
3103     HI_U16 u16WBBgain;
3104     HI_U16 u16SampleRgain;
3105     HI_U16 u16SampleBgain;
3106     HI_U16 au16CCM[CCM_MATRIX_SIZE];
3107     HI_BOOL bAERouteExValid;
3108     ISP_QUICK_START_PARAM_S stQuickStart;
3109     ISP_AE_ROUTE_S stAERoute;
3110     ISP_AE_ROUTE_EX_S stAERouteEx;
3111     ISP_AE_ROUTE_S stAERouteSF;
3112     ISP_AE_ROUTE_EX_S stAERouteSFEx;
3113 } ISP_INIT_ATTR_S;
3114 
3115 typedef struct hiISP_AF_ATTR_S {
3116     HI_S32 s32DistanceMax; /* RW;the focuse range */
3117     HI_S32 s32DistanceMin;
3118     HI_U8 u8Weight[AF_ZONE_ROW][AF_ZONE_COLUMN]; /* RW;weighting table */
3119 } ISP_AF_ATTR_S;
3120 typedef struct hiISP_MF_ATTR_S {
3121     HI_S32 s32DefaultSpeed;     /* RW;1,default speed(unit:m/s).(onvif) */
3122 } ISP_MF_ATTR_S;
3123 typedef struct hiISP_FOCUS_ATTR_S {
3124     ISP_OP_TYPE_E  enOpType;
3125     ISP_MF_ATTR_S  stManual;
3126     ISP_AF_ATTR_S  stAuto;
3127 } ISP_FOCUS_ATTR_S;
3128 
3129 /*
3130   DNG cfalayout type
3131   1 = Rectangular (or square) layout
3132   2 = Staggered layout A: even columns are offset down by 1/2 row
3133   3 = Staggered layout B: even columns are offset up by 1/2 row
3134   4 = Staggered layout C: even rows are offset right by 1/2 column
3135   5 = Staggered layout D: even rows are offset left by 1/2 column
3136   6 = Staggered layout E: even rows are offset up by 1/2 row, even columns are offset left by 1/2 column
3137   7 = Staggered layout F: even rows are offset up by 1/2 row, even columns are offset right by 1/2 column
3138   8 = Staggered layout G: even rows are offset down by 1/2 row, even columns are offset left by 1/2 column
3139   9 = Staggered layout H: even rows are offset down by 1/2 row, even columns are offset right by 1/2 column
3140  */
3141 typedef enum hiDNG_CFALAYOUT_TYPE_E {
3142     CFALAYOUT_TYPE_RECTANGULAR = 1,
3143     CFALAYOUT_TYPE_A,        /* a,b,c... not support */
3144     CFALAYOUT_TYPE_B,
3145     CFALAYOUT_TYPE_C,
3146     CFALAYOUT_TYPE_D,
3147     CFALAYOUT_TYPE_E,
3148     CFALAYOUT_TYPE_F,
3149     CFALAYOUT_TYPE_G,
3150     CFALAYOUT_TYPE_H,
3151     CFALAYOUT_TYPE_BUTT
3152 } DNG_CFALAYOUT_TYPE_E;
3153 
3154 typedef struct hiDNG_SRATIONAL_S {
3155     HI_S32 s32Numerator;   /* represents the numerator of a fraction, */
3156     HI_S32 s32Denominator; /* the denominator. */
3157 } DNG_SRATIONAL_S;
3158 
3159 typedef struct hiDNG_BLCREPEATDIM_S {
3160     HI_U16 u16BlcRepeatRows;
3161     HI_U16 u16BlcRepeatCols;
3162 } DNG_BLCREPEATDIM_S;
3163 
3164 typedef struct hiDNG_DEFAULTSCALE_S {
3165     DNG_RATIONAL_S stDefaultScaleH;
3166     DNG_RATIONAL_S stDefaultScaleV;
3167 } DNG_DEFAULTSCALE_S;
3168 
3169 typedef struct hiDNG_REPEATPATTERNDIM_S {
3170     HI_U16 u16RepeatPatternDimRows;
3171     HI_U16 u16RepeatPatternDimCols;
3172 } DNG_REPEATPATTERNDIM_S;
3173 
3174 /* Defines the structure of dng raw format. */
3175 typedef struct hiDNG_RAW_FORMAT_S {
3176     HI_U8 u8BitsPerSample;                        /* RO;Format:8.0; Indicate the bit numbers of raw data */
3177     HI_U8 au8CfaPlaneColor[CFACOLORPLANE];        /* RO;Format:8.0; Indicate the planer numbers of raw data;
3178                                                      0:red 1:green 2: blue */
3179     DNG_CFALAYOUT_TYPE_E enCfaLayout;             /* RO;Range:[1,9]; Describes the spatial layout of the CFA */
3180     DNG_BLCREPEATDIM_S stBlcRepeatDim;            /* Specifies repeat pattern size for the BlackLevel */
3181     HI_U32 u32WhiteLevel;                         /* RO;Format:32.0; Indicate the WhiteLevel of the raw data */
3182     DNG_DEFAULTSCALE_S stDefaultScale;            /* Specifies the default scale factors for each direction to convert
3183                                                      the image to square pixels */
3184     DNG_REPEATPATTERNDIM_S stCfaRepeatPatternDim; /* Specifies the pixel number of repeat color planer in each
3185                                                      direction */
3186     HI_U8 au8CfaPattern[ISP_BAYER_CHN];           /* RO;Format:8.0; Indicate the bayer start order;
3187                                                      0:red 1:green 2: blue */
3188 } DNG_RAW_FORMAT_S;
3189 
3190 /* Defines the structure of dng image static infomation. read only */
3191 typedef struct hiDNG_IMAGE_STATIC_INFO_S {
3192     DNG_RAW_FORMAT_S stDngRawFormat;
3193     DNG_SRATIONAL_S astColorMatrix1[CCM_MATRIX_SIZE];       /* defines a transformation matrix that converts XYZ values
3194                                                                to reference camera native color space values,
3195                                                                under the first calibration illuminant. */
3196     DNG_SRATIONAL_S astColorMatrix2[CCM_MATRIX_SIZE];       /* defines a transformation matrix that converts XYZ values
3197                                                                to reference camera native color space values,
3198                                                                under the second calibration illuminant. */
3199     DNG_SRATIONAL_S astCameraCalibration1[CCM_MATRIX_SIZE]; /* defines a calibration matrix that transforms reference
3200                                                                camera native space values to individual camera native
3201                                                                space values under the first calibration illuminant */
3202     DNG_SRATIONAL_S astCameraCalibration2[CCM_MATRIX_SIZE]; /* defines a calibration matrix that transforms reference
3203                                                                camera native space values to individual camera native
3204                                                                space values under the second calibration illuminant */
3205     DNG_SRATIONAL_S astForwadMatrix1[CCM_MATRIX_SIZE];      /* defines a matrix that maps white balanced camera colors
3206                                                                to XYZ D50 colors */
3207     DNG_SRATIONAL_S astForwadMatrix2[CCM_MATRIX_SIZE];      /* defines a matrix that maps white balanced camera colors
3208                                                                to XYZ D50 colors */
3209 
3210     HI_U8  u8CalibrationIlluminant1; /* RO;Format:8.0;Light source, actually this means white balance setting.
3211                                         '0' means unknown, '1' daylight, '2' fluorescent, '3' tungsten, '10' flash,
3212                                         '17' standard light A, '18' standard light B, '19' standard light C,
3213                                         '20' D55, '21' D65, '22' D75, '255' other */
3214     HI_U8  u8CalibrationIlluminant2; /* RO;Format:8.0;Light source, actually this means white balance setting.
3215                                         '0' means unknown, '1' daylight, '2' fluorescent, '3' tungsten, '10' flash,
3216                                         '17' standard light A, '18' standard light B, '19' standard light C,
3217                                         '20' D55, '21' D65, '22' D75, '255' other */
3218 } DNG_IMAGE_STATIC_INFO_S;
3219 
3220 /* Defines the structure of DNG WB gain used for calculate DNG colormatrix. */
3221 typedef struct hiISP_DNG_WBGAIN_S {
3222     HI_U16 u16Rgain;            /* RW;Range: [0x0, 0xFFF]; Multiplier for R  color channel */
3223     HI_U16 u16Ggain;            /* RW;Range: [0x0, 0xFFF]; Multiplier for G  color channel */
3224     HI_U16 u16Bgain;            /* RW;Range: [0x0, 0xFFF]; Multiplier for B  color channel */
3225 } ISP_DNG_WBGAIN_S;
3226 
3227 /* Defines the structure of DNG color parameters. */
3228 typedef struct hiISP_DNG_COLORPARAM_S {
3229     ISP_DNG_WBGAIN_S stWbGain1; /* the calibration White balance gain of colorcheker in low colortemper light source */
3230     ISP_DNG_WBGAIN_S stWbGain2; /* the calibration White balance gain of colorcheker in high colortemper light source */
3231 } ISP_DNG_COLORPARAM_S;
3232 
3233 typedef enum hiISP_IR_STATUS_E {
3234     ISP_IR_STATUS_NORMAL = 0,
3235     ISP_IR_STATUS_IR     = 1,
3236     ISP_IR_BUTT
3237 } ISP_IR_STATUS_E;
3238 
3239 typedef enum hiISP_IR_SWITCH_STATUS_E {
3240     ISP_IR_SWITCH_NONE      = 0,
3241     ISP_IR_SWITCH_TO_NORMAL = 1,
3242     ISP_IR_SWITCH_TO_IR     = 2,
3243     ISP_IR_SWITCH_BUTT
3244 } ISP_IR_SWITCH_STATUS_E;
3245 
3246 typedef struct hiISP_IR_AUTO_ATTR_S {
3247     HI_BOOL bEnable;            /* RW, HI_TRUE: enable IR_auto function;  HI_TRUE: disable IR_auto function. */
3248     HI_U32  u32Normal2IrIsoThr; /* RW, Range: [0, 0xFFFFFFFF]. ISO threshold of switching from normal to IR mode */
3249     HI_U32  u32Ir2NormalIsoThr; /* RW, Range: [0, 0xFFFFFFFF]. ISO threshold of switching from IR to normal mode */
3250     HI_U32  u32RGMax;           /* RW, Range: [0x0, 0xFFF].    Maximum value of R/G in IR scene, 4.8-bit fix-point */
3251     HI_U32  u32RGMin;           /* RW, Range: [0x0, u32RGMax]. Minimum value of R/G in IR scene, 4.8-bit fix-point */
3252     HI_U32  u32BGMax;           /* RW, Range: [0x0, 0xFFF].    Maximum value of B/G in IR scene, 4.8-bit fix-point */
3253     HI_U32  u32BGMin;           /* RW, Range: [0x0, u32BGMax]. Minimum value of B/G in IR scene, 4.8-bit fix-point */
3254 
3255     ISP_IR_STATUS_E enIrStatus; /* RW. Current IR status. */
3256 
3257     ISP_IR_SWITCH_STATUS_E enIrSwitch; /* RO, IR switch status. */
3258 } ISP_IR_AUTO_ATTR_S;
3259 
3260 /* Only used for Hi3516CV500/Hi3516DV300 */
3261 typedef enum hiISP_CALCFLICKER_TYPE_E {
3262     FLICKER_TYPE_NONE = 0,
3263     FLICKER_TYPE_UNKNOW,
3264     FLICKER_TYPE_50HZ,
3265     FLICKER_TYPE_60HZ,
3266     FLICKER_TYPE_BUTT,
3267 } ISP_CALCFLICKER_TYPE_E;
3268 
3269 /* Only used for Hi3516CV500/Hi3516DV300 */
3270 typedef struct hiISP_CALCFLICKER_INPUT_S {
3271     HI_U32 u32LinesPerSecond;      /* The total line number of 1 second */
3272 } ISP_CALCFLICKER_INPUT_S;
3273 
3274 /* Only used for Hi3516CV500/Hi3516DV300 */
3275 typedef struct hiISP_CALCFLICKER_OUTPUT_S {
3276     ISP_CALCFLICKER_TYPE_E enFlickerType;  /* The calculate result of flicker type */
3277 } ISP_CALCFLICKER_OUTPUT_S;
3278 
3279 #ifdef __cplusplus
3280 #if __cplusplus
3281 }
3282 #endif
3283 #endif /* End of #ifdef __cplusplus */
3284 
3285 #endif /* __HI_COMM_ISP_H__ */
3286