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_IVE_H_
17#define _HI_IVE_H_
18
19#include "hi_comm_ive.h"
20#include "hi_common.h"
21
22#ifdef __cplusplus
23#if __cplusplus
24extern "C" {
25#endif
26#endif
27
28#define IVE_HIST_NUM          256
29#define IVE_MAP_NUM           256
30#define IVE_MAX_REGION_NUM    254
31#define IVE_ST_MAX_CORNER_NUM 500
32
33/*
34* DMA mode
35*/
36typedef enum hiIVE_DMA_MODE_E {
37    IVE_DMA_MODE_DIRECT_COPY = 0x0,
38    IVE_DMA_MODE_INTERVAL_COPY = 0x1,
39    IVE_DMA_MODE_SET_3BYTE = 0x2,
40    IVE_DMA_MODE_SET_8BYTE = 0x3,
41    IVE_DMA_MODE_BUTT
42} IVE_DMA_MODE_E;
43
44/*
45* DMA control parameter
46*/
47typedef struct hiIVE_DMA_CTRL_S {
48    IVE_DMA_MODE_E enMode;
49    HI_U64 u64Val;      /* Used in memset mode */
50    HI_U8 u8HorSegSize; /* Used in interval-copy mode, every row was segmented by u8HorSegSize bytes,
51                         restricted in values of 2,3,4,8,16 */
52    HI_U8 u8ElemSize;   /* Used in interval-copy mode, the valid bytes copied in front of every segment
53                        in a valid row, which 0<u8ElemSize<u8HorSegSize */
54    HI_U8 u8VerSegRows; /* Used in interval-copy mode, copy one row in every u8VerSegRows */
55} IVE_DMA_CTRL_S;
56
57/*
58* Filter control parameters
59* You need to set these parameters when using the filter operator.
60*/
61typedef struct hiIVE_FILTER_CTRL_S {
62    HI_S8 as8Mask[25]; /* Template parameter filter coefficient.The max mask number is 25. */
63    HI_U8 u8Norm;      /* Normalization parameter, by right shift */
64} IVE_FILTER_CTRL_S;
65
66/*
67* CSC working mode.
68*/
69typedef enum hiIVE_CSC_MODE_E {
70    IVE_CSC_MODE_VIDEO_BT601_YUV2RGB = 0x0, /* CSC: YUV2RGB, video transfer mode, RGB value range [16, 235] */
71    IVE_CSC_MODE_VIDEO_BT709_YUV2RGB = 0x1, /* CSC: YUV2RGB, video transfer mode, RGB value range [16, 235] */
72    IVE_CSC_MODE_PIC_BT601_YUV2RGB = 0x2,   /* CSC: YUV2RGB, picture transfer mode, RGB value range [0, 255] */
73    IVE_CSC_MODE_PIC_BT709_YUV2RGB = 0x3,   /* CSC: YUV2RGB, picture transfer mode, RGB value range [0, 255] */
74
75    IVE_CSC_MODE_PIC_BT601_YUV2HSV = 0x4, /* CSC: YUV2HSV, picture transfer mode, HSV value range [0, 255] */
76    IVE_CSC_MODE_PIC_BT709_YUV2HSV = 0x5, /* CSC: YUV2HSV, picture transfer mode, HSV value range [0, 255] */
77
78    IVE_CSC_MODE_PIC_BT601_YUV2LAB = 0x6, /* CSC: YUV2LAB, picture transfer mode, Lab value range [0, 255] */
79    IVE_CSC_MODE_PIC_BT709_YUV2LAB = 0x7, /* CSC: YUV2LAB, picture transfer mode, Lab value range [0, 255] */
80
81    IVE_CSC_MODE_VIDEO_BT601_RGB2YUV = 0x8, /* CSC: RGB2YUV, video transfer mode, YUV value range [0, 255] */
82    IVE_CSC_MODE_VIDEO_BT709_RGB2YUV = 0x9, /* CSC: RGB2YUV, video transfer mode, YUV value range [0, 255] */
83    IVE_CSC_MODE_PIC_BT601_RGB2YUV = 0xa,   /* CSC: RGB2YUV, picture transfer mode, Y:[16, 235],U\V:[16, 240] */
84    IVE_CSC_MODE_PIC_BT709_RGB2YUV = 0xb,   /* CSC: RGB2YUV, picture transfer mode, Y:[16, 235],U\V:[16, 240] */
85
86    IVE_CSC_MODE_BUTT
87} IVE_CSC_MODE_E;
88
89/*
90* CSC control parameters
91* You need to set these parameters when using the CSC operator.
92* Removed the CSC output format, replaced by setting the output image type.
93*/
94typedef struct hiIVE_CSC_CTRL_S {
95    IVE_CSC_MODE_E enMode; /* Working mode */
96} IVE_CSC_CTRL_S;
97
98/*
99* Filter+CSC control parameters
100* You need to set these parameters when using the filter+CSC operator.
101* The control information about both the filter and CSC needs to be configured.
102*/
103typedef struct hiIVE_FILTER_AND_CSC_CTRL_S {
104    IVE_CSC_MODE_E enMode; /* CSC working mode */
105    HI_S8 as8Mask[25];     /* Template parameter filter coefficient.The max mask number is 25. */
106    HI_U8 u8Norm;          /* Normalization parameter, by right shift */
107} IVE_FILTER_AND_CSC_CTRL_S;
108
109/*
110* SOBEL output ctrl
111*/
112typedef enum hiIVE_SOBEL_OUT_CTRL_E {
113    IVE_SOBEL_OUT_CTRL_BOTH = 0x0, /* Output horizontal and vertical */
114    IVE_SOBEL_OUT_CTRL_HOR = 0x1,  /* Output horizontal */
115    IVE_SOBEL_OUT_CTRL_VER = 0x2,  /* Output vertical */
116    IVE_SOBEL_OUT_CTRL_BUTT
117} IVE_SOBEL_OUT_CTRL_E;
118
119/*
120* SOBEL control parameter
121*/
122typedef struct hiIVE_SOBEL_CTRL_S {
123    IVE_SOBEL_OUT_CTRL_E enOutCtrl; /* Output format */
124    HI_S8 as8Mask[25];              /* Template parameter.The max mask number is 25. */
125} IVE_SOBEL_CTRL_S;
126
127/*
128* Type of the magnitude and angle output results
129*/
130typedef enum hiIVE_MAG_AND_ANG_OUT_CTRL_E {
131    IVE_MAG_AND_ANG_OUT_CTRL_MAG = 0x0,         /* Only the magnitude is output. */
132    IVE_MAG_AND_ANG_OUT_CTRL_MAG_AND_ANG = 0x1, /* The magnitude and angle are output. */
133    IVE_MAG_AND_ANG_OUT_CTRL_BUTT
134} IVE_MAG_AND_ANG_OUT_CTRL_E;
135
136/*
137* Magnitude and angle control parameter
138*/
139typedef struct hiIVE_MAG_AND_ANG_CTRL_S {
140    IVE_MAG_AND_ANG_OUT_CTRL_E enOutCtrl;
141    HI_U16 u16Thr;
142    HI_S8 as8Mask[25]; /* Template parameter.The max mask number is 25. */
143} IVE_MAG_AND_ANG_CTRL_S;
144
145/*
146* Dilate control parameters
147*/
148typedef struct hiIVE_DILATE_CTRL_S {
149    HI_U8 au8Mask[25]; /* The template parameter value must be 0 or 255.The max mask number is 25. */
150} IVE_DILATE_CTRL_S;
151
152/*
153* Erode control parameter
154*/
155typedef struct hiIVE_ERODE_CTRL_S {
156    HI_U8 au8Mask[25]; /* The template parameter value must be 0 or 255.The max mask number is 25. */
157} IVE_ERODE_CTRL_S;
158
159/*
160* Type of the Thresh mode.
161*/
162typedef enum hiIVE_THRESH_MODE_E {
163    /* if srcVal <= lowThr, then dstVal = minVal; else if srcVal > lowThr, then dstVal = maxVal. */
164    IVE_THRESH_MODE_BINARY = 0x0,
165    /* if srcVal <= lowThr, then dstVal = srcVal; else if srcVal > lowThr, then dstVal = maxVal. */
166    IVE_THRESH_MODE_TRUNC = 0x1,
167    /* if srcVal <= lowThr, then dstVal = minVal; else if srcVal > lowThr, then dstVal = srcVal. */
168    IVE_THRESH_MODE_TO_MINVAL = 0x2,
169    /*
170    * if srcVal <= lowThr, then dstVal = minVal;
171    * else if  lowThr < srcVal <= highThr, then dstVal = midVal;
172    * else if  srcVal > highThr, then dstVal = maxVal.
173    */
174    IVE_THRESH_MODE_MIN_MID_MAX = 0x3,
175    /*
176    * if srcVal <= lowThr,then dstVal = srcVal;
177    * else if lowThr < srcVal <= highThr,then dstVal = midVal;
178    * else if srcVal > highThr,then dstVal = maxVal.
179    */
180    IVE_THRESH_MODE_ORI_MID_MAX = 0x4,
181    /*
182    * if srcVal <= lowThr,then dstVal = minVal;
183    * else if lowThr < srcVal <= highThr, then dstVal = midVal;
184    * else if srcVal > highThr, then dstVal = srcVal.
185    */
186    IVE_THRESH_MODE_MIN_MID_ORI = 0x5,
187    /*
188    * if srcVal <= lowThr, then dstVal = minVal;
189    * else if lowThr < srcVal <= highThr,then dstVal = srcVal;
190    * else if srcVal > highThr, then dstVal = maxVal.
191    */
192    IVE_THRESH_MODE_MIN_ORI_MAX = 0x6,
193    /*
194    * if srcVal <= lowThr, then dstVal = srcVal;
195    * else if lowThr < srcVal <= highThr, then dstVal = midVal;
196    * else if srcVal > highThr, then  dstVal = srcVal.
197    */
198    IVE_THRESH_MODE_ORI_MID_ORI = 0x7,
199
200    IVE_THRESH_MODE_BUTT
201} IVE_THRESH_MODE_E;
202
203/*
204* Thresh control parameters.
205*/
206typedef struct hiIVE_THRESH_CTRL_S {
207    IVE_THRESH_MODE_E enMode;
208    HI_U8 u8LowThr;  /* user-defined threshold,  0<=u8LowThr<=255 */
209    HI_U8 u8HighThr; /* user-defined threshold, if enMode<IVE_THRESH_MODE_MIN_MID_MAX, u8HighThr is not used,
210                      else 0<=u8LowThr<=u8HighThr<=255; */
211    HI_U8 u8MinVal;  /* Minimum value when tri-level thresholding */
212    HI_U8 u8MidVal;  /* Middle value when tri-level thresholding, if enMode<2, u32MidVal is not used; */
213    HI_U8 u8MaxVal;  /* Maxmum value when tri-level thresholding */
214} IVE_THRESH_CTRL_S;
215
216/*
217* Type of the Sub output results
218*/
219typedef enum hiIVE_SUB_MODE_E {
220    IVE_SUB_MODE_ABS = 0x0,   /* Absolute value of the difference */
221    IVE_SUB_MODE_SHIFT = 0x1, /* The output result is obtained by shifting the result one digit right
222                                to reserve the signed bit. */
223    IVE_SUB_MODE_BUTT
224} IVE_SUB_MODE_E;
225
226/*
227* Sub control parameters
228*/
229typedef struct hiIVE_SUB_CTRL_S {
230    IVE_SUB_MODE_E enMode;
231} IVE_SUB_CTRL_S;
232
233/*
234* Type of the Integ output results
235*/
236typedef enum hiIVE_INTEG_OUT_CTRL_E {
237    IVE_INTEG_OUT_CTRL_COMBINE = 0x0,
238    IVE_INTEG_OUT_CTRL_SUM = 0x1,
239    IVE_INTEG_OUT_CTRL_SQSUM = 0x2,
240    IVE_INTEG_OUT_CTRL_BUTT
241} IVE_INTEG_OUT_CTRL_E;
242
243/*
244* Integ control parameters
245*/
246typedef struct hiIVE_INTEG_CTRL_S {
247    IVE_INTEG_OUT_CTRL_E enOutCtrl;
248} IVE_INTEG_CTRL_S;
249
250/*
251* Type of the Thresh_S16 mode
252*/
253typedef enum hiIVE_THRESH_S16_MODE_E {
254    IVE_THRESH_S16_MODE_S16_TO_S8_MIN_MID_MAX = 0x0,
255    IVE_THRESH_S16_MODE_S16_TO_S8_MIN_ORI_MAX = 0x1,
256    IVE_THRESH_S16_MODE_S16_TO_U8_MIN_MID_MAX = 0x2,
257    IVE_THRESH_S16_MODE_S16_TO_U8_MIN_ORI_MAX = 0x3,
258
259    IVE_THRESH_S16_MODE_BUTT
260} IVE_THRESH_S16_MODE_E;
261
262/*
263* Thresh_S16 control parameters
264*/
265typedef struct hiIVE_THRESH_S16_CTRL_S {
266    IVE_THRESH_S16_MODE_E enMode;
267    HI_S16 s16LowThr;     /* User-defined threshold */
268    HI_S16 s16HighThr;    /* User-defined threshold */
269    IVE_8BIT_U un8MinVal; /* Minimum value when tri-level thresholding */
270    IVE_8BIT_U un8MidVal; /* Middle value when tri-level thresholding */
271    IVE_8BIT_U un8MaxVal; /* Maxmum value when tri-level thresholding */
272} IVE_THRESH_S16_CTRL_S;
273
274/*
275* Type of the Thresh_U16 mode
276*/
277typedef enum hiIVE_THRESH_U16_MODE_E {
278    IVE_THRESH_U16_MODE_U16_TO_U8_MIN_MID_MAX = 0x0,
279    IVE_THRESH_U16_MODE_U16_TO_U8_MIN_ORI_MAX = 0x1,
280
281    IVE_THRESH_U16_MODE_BUTT
282} IVE_THRESH_U16_MODE_E;
283
284/*
285* Thresh_U16 control parameters
286*/
287typedef struct hiIVE_THRESH_U16_CTRL_S {
288    IVE_THRESH_U16_MODE_E enMode;
289    HI_U16 u16LowThr;
290    HI_U16 u16HighThr;
291    HI_U8 u8MinVal;
292    HI_U8 u8MidVal;
293    HI_U8 u8MaxVal;
294} IVE_THRESH_U16_CTRL_S;
295
296/*
297* Mode of 16BitTo8Bit
298*/
299typedef enum hiIVE_16BIT_TO_8BIT_MODE_E {
300    IVE_16BIT_TO_8BIT_MODE_S16_TO_S8 = 0x0,
301    IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_ABS = 0x1,
302    IVE_16BIT_TO_8BIT_MODE_S16_TO_U8_BIAS = 0x2,
303    IVE_16BIT_TO_8BIT_MODE_U16_TO_U8 = 0x3,
304
305    IVE_16BIT_TO_8BIT_MODE_BUTT
306} IVE_16BIT_TO_8BIT_MODE_E;
307
308/*
309* 16BitTo8Bit control parameters
310*/
311typedef struct hiIVE_16BIT_TO_8BIT_CTRL_S {
312    IVE_16BIT_TO_8BIT_MODE_E enMode;
313    HI_U16 u16Denominator;
314    HI_U8 u8Numerator;
315    HI_S8 s8Bias;
316} IVE_16BIT_TO_8BIT_CTRL_S;
317
318/*
319* Type of the OrdStaFilter
320*/
321typedef enum hiIVE_ORD_STAT_FILTER_MODE_E {
322    IVE_ORD_STAT_FILTER_MODE_MEDIAN = 0x0,
323    IVE_ORD_STAT_FILTER_MODE_MAX = 0x1,
324    IVE_ORD_STAT_FILTER_MODE_MIN = 0x2,
325
326    IVE_ORD_STAT_FILTER_MODE_BUTT
327} IVE_ORD_STAT_FILTER_MODE_E;
328
329/*
330* OrdStaFilter control parameters
331*/
332typedef struct hiIVE_ORD_STAT_FILTER_CTRL_S {
333    IVE_ORD_STAT_FILTER_MODE_E enMode;
334} IVE_ORD_STAT_FILTER_CTRL_S;
335
336/*
337* Type of the Map
338*/
339typedef enum hiIVE_MAP_MODE_E {
340    IVE_MAP_MODE_U8 = 0x0,
341    IVE_MAP_MODE_S16 = 0x1,
342    IVE_MAP_MODE_U16 = 0x2,
343
344    IVE_MAP_MODE_BUTT
345} IVE_MAP_MODE_E;
346/*
347* Map control struct
348*/
349typedef struct hiIVE_MAP_CTRL_S {
350    IVE_MAP_MODE_E enMode;
351} IVE_MAP_CTRL_S;
352/*
353* Map unsigned 8 bit LUT memory struct
354*/
355typedef struct hiIVE_MAP_U8BIT_LUT_MEM_S {
356    HI_U8 au8Map[IVE_MAP_NUM];
357} IVE_MAP_U8BIT_LUT_MEM_S;
358/*
359* Map unsigned 16 bit LUT memory struct
360*/
361typedef struct hiIVE_MAP_U16BIT_LUT_MEM_S {
362    HI_U16 au16Map[IVE_MAP_NUM];
363} IVE_MAP_U16BIT_LUT_MEM_S;
364/*
365* Map signed 16 bit LUT memory struct
366*/
367typedef struct hiIVE_MAP_S16BIT_LUT_MEM_S {
368    HI_S16 as16Map[IVE_MAP_NUM];
369} IVE_MAP_S16BIT_LUT_MEM_S;
370/*
371* Equalizehist control member struct
372*/
373typedef struct hiIVE_EQUALIZE_HIST_CTRL_MEM_S {
374    HI_U32 au32Hist[IVE_HIST_NUM];
375    HI_U8 au8Map[IVE_MAP_NUM];
376} IVE_EQUALIZE_HIST_CTRL_MEM_S;
377
378/*
379* Equalizehist control parameters
380*/
381typedef struct hiIVE_EQUALIZE_HIST_CTRL_S {
382    IVE_MEM_INFO_S stMem;
383} IVE_EQUALIZE_HIST_CTRL_S;
384
385/*
386* Add control parameters
387*/
388typedef struct hiIVE_ADD_CTRL_S {
389    HI_U0Q16 u0q16X; /* x of "xA+yB" */
390    HI_U0Q16 u0q16Y; /* y of "xA+yB" */
391} IVE_ADD_CTRL_S;
392
393/*
394* NCC dst memory struct
395*/
396typedef struct hiIVE_NCC_DST_MEM_S {
397    HI_U64 u64Numerator;
398    HI_U64 u64QuadSum1;
399    HI_U64 u64QuadSum2;
400    HI_U8 u8Reserved[8];
401} IVE_NCC_DST_MEM_S;
402
403/*
404* Region struct
405*/
406typedef struct hiIVE_REGION_S {
407    HI_U32 u32Area;   /* Represented by the pixel number */
408    HI_U16 u16Left;   /* Circumscribed rectangle left border */
409    HI_U16 u16Right;  /* Circumscribed rectangle right border */
410    HI_U16 u16Top;    /* Circumscribed rectangle top border */
411    HI_U16 u16Bottom; /* Circumscribed rectangle bottom border */
412} IVE_REGION_S;
413
414/*
415* CCBLOB struct
416*/
417typedef struct hiIVE_CCBLOB_S {
418    HI_U16 u16CurAreaThr;                       /* Threshold of the result regions' area */
419    HI_S8 s8LabelStatus;                        /* -1: Labeled failed ; 0: Labeled successfully */
420    HI_U8 u8RegionNum;                          /* Number of valid region, non-continuous stored */
421    IVE_REGION_S astRegion[IVE_MAX_REGION_NUM]; /* Valid regions with 'u32Area>0' and 'label = ArrayIndex+1' */
422} IVE_CCBLOB_S;
423
424/*
425* Type of the CCL
426*/
427typedef enum hiIVE_CCL_MODE_E {
428    IVE_CCL_MODE_4C = 0x0, /* 4-connected */
429    IVE_CCL_MODE_8C = 0x1, /* 8-connected */
430
431    IVE_CCL_MODE_BUTT
432} IVE_CCL_MODE_E;
433/*
434* CCL control struct
435*/
436typedef struct hiIVE_CCL_CTRL_S {
437    IVE_CCL_MODE_E enMode; /* Mode */
438    HI_U16 u16InitAreaThr; /* Init threshold of region area */
439    HI_U16 u16Step;        /* Increase area step for once */
440} IVE_CCL_CTRL_S;
441
442/*
443* GMM control struct
444*/
445typedef struct hiIVE_GMM_CTRL_S {
446    HI_U22Q10 u22q10NoiseVar; /* Initial noise Variance */
447    HI_U22Q10 u22q10MaxVar;   /* Max  Variance */
448    HI_U22Q10 u22q10MinVar;   /* Min  Variance */
449    HI_U0Q16 u0q16LearnRate;  /* Learning rate */
450    HI_U0Q16 u0q16BgRatio;    /* Background ratio */
451    HI_U8Q8 u8q8VarThr;       /* Variance Threshold */
452    HI_U0Q16 u0q16InitWeight; /* Initial Weight */
453    HI_U8 u8ModelNum;         /* Model number: 3 or 5 */
454} IVE_GMM_CTRL_S;
455
456/*
457* Type of the GMM2 sensitivity factor mode
458*/
459typedef enum hiIVE_GMM2_SNS_FACTOR_MODE_E {
460    IVE_GMM2_SNS_FACTOR_MODE_GLB = 0x0, /* Global sensitivity factor mode */
461    IVE_GMM2_SNS_FACTOR_MODE_PIX = 0x1, /* Pixel sensitivity factor mode */
462
463    IVE_GMM2_SNS_FACTOR_MODE_BUTT
464} IVE_GMM2_SNS_FACTOR_MODE_E;
465
466/*
467* Type of the GMM2 life update factor mode
468*/
469typedef enum hiIVE_GMM2_LIFE_UPDATE_FACTOR_MODE_E {
470    IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_GLB = 0x0, /* Global life update factor mode */
471    IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_PIX = 0x1, /* Pixel life update factor mode */
472
473    IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_BUTT
474} IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_E;
475
476/*
477* GMM2 control struct
478*/
479typedef struct hiIVE_GMM2_CTRL_S {
480    IVE_GMM2_SNS_FACTOR_MODE_E enSnsFactorMode;                /* Sensitivity factor mode */
481    IVE_GMM2_LIFE_UPDATE_FACTOR_MODE_E enLifeUpdateFactorMode; /* Life update factor mode */
482    HI_U16 u16GlbLifeUpdateFactor;                             /* Global life update factor (default: 4) */
483    HI_U16 u16LifeThr;                                         /* Life threshold (default: 5000) */
484    HI_U16 u16FreqInitVal;                                     /* Initial frequency (default: 20000) */
485    HI_U16 u16FreqReduFactor;                                  /* Frequency reduction factor (default: 0xFF00) */
486    HI_U16 u16FreqAddFactor;                                   /* Frequency adding factor (default: 0xEF) */
487    HI_U16 u16FreqThr;                                         /* Frequency threshold (default: 12000) */
488    HI_U16 u16VarRate;                                         /* Variation update rate (default: 1) */
489    HI_U9Q7 u9q7MaxVar;                                        /* Max variation (default: (16 * 16)<<7) */
490    HI_U9Q7 u9q7MinVar;                                        /* Min variation (default: ( 8 *  8)<<7) */
491    HI_U8 u8GlbSnsFactor;                                      /* Global sensitivity factor (default: 8) */
492    HI_U8 u8ModelNum;                                          /* Model number (range: 1~5, default: 3) */
493} IVE_GMM2_CTRL_S;
494
495/*
496* CannyHysEdge control struct
497*/
498typedef struct hiIVE_CANNY_HYS_EDGE_CTRL_S {
499    IVE_MEM_INFO_S stMem;
500    HI_U16 u16LowThr;
501    HI_U16 u16HighThr;
502    HI_S8 as8Mask[25]; /* Template parameter.The max mask number is 25. */
503} IVE_CANNY_HYS_EDGE_CTRL_S;
504
505/*
506* Canny stack size struct
507*/
508typedef struct hiIVE_CANNY_STACK_SIZE_S {
509    HI_U32 u32StackSize;  /* Stack size for output */
510    HI_U8 u8Reserved[12]; /* For 16 byte align */
511} IVE_CANNY_STACK_SIZE_S;
512
513/*
514* LBP compare mode
515*/
516typedef enum hiIVE_LBP_CMP_MODE_E {
517    IVE_LBP_CMP_MODE_NORMAL = 0x0, /* P(x)-P(center)>= un8BitThr.s8Val, s(x)=1; else s(x)=0; */
518    IVE_LBP_CMP_MODE_ABS = 0x1,    /* Abs(P(x)-P(center))>=un8BitThr.u8Val, s(x)=1; else s(x)=0; */
519
520    IVE_LBP_CMP_MODE_BUTT
521} IVE_LBP_CMP_MODE_E;
522
523/*
524* LBP control struct
525*/
526typedef struct hiIVE_LBP_CTRL_S {
527    IVE_LBP_CMP_MODE_E enMode;
528    IVE_8BIT_U un8BitThr;
529} IVE_LBP_CTRL_S;
530
531/*
532* Type of the GradientFilter output format
533*/
534typedef enum hiIVE_NORM_GRAD_OUT_CTRL_E {
535    IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER = 0x0,
536    IVE_NORM_GRAD_OUT_CTRL_HOR = 0x1,
537    IVE_NORM_GRAD_OUT_CTRL_VER = 0x2,
538    IVE_NORM_GRAD_OUT_CTRL_COMBINE = 0x3,
539
540    IVE_NORM_GRAD_OUT_CTRL_BUTT
541} IVE_NORM_GRAD_OUT_CTRL_E;
542
543/*
544* GradientFilter control parameters
545*/
546typedef struct hiIVE_NORM_GRAD_CTRL_S {
547    IVE_NORM_GRAD_OUT_CTRL_E enOutCtrl;
548    HI_S8 as8Mask[25]; /* Template parameter.The max mask number is 25. */
549    HI_U8 u8Norm;
550} IVE_NORM_GRAD_CTRL_S;
551
552/*
553* LKOpticalFlowPyr output mode
554*/
555typedef enum hiIVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_E {
556    IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_NONE = 0,   /* Output none */
557    IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_STATUS = 1, /* Output status */
558    IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_BOTH = 2,   /* Output status and err */
559
560    IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_BUTT
561} IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_E;
562
563/*
564* LKOpticalFlowPyr control parameters
565*/
566typedef struct hiIVE_LK_OPTICAL_FLOW_PYR_CTRL_S {
567    IVE_LK_OPTICAL_FLOW_PYR_OUT_MODE_E enOutMode;
568    HI_BOOL bUseInitFlow;  /* where to use initial flow */
569    HI_U16 u16PtsNum;      /* Number of the feature points, <=500 */
570    HI_U8 u8MaxLevel;      /* Max level must be [0, 3] */
571    HI_U0Q8 u0q8MinEigThr; /* Minimum eigenvalue threshold */
572    HI_U8 u8IterCnt;       /* Maximum iteration times, <=20 */
573    HI_U0Q8 u0q8Eps;       /* Used for exit criteria: dx^2 + dy^2 < u0q8Eps */
574} IVE_LK_OPTICAL_FLOW_PYR_CTRL_S;
575
576/*
577* Shi-Tomasi maximum eigenvalue
578*/
579typedef struct hiIVE_ST_MAX_EIG_S {
580    HI_U16 u16MaxEig;     /* Shi-Tomasi second step output MaxEig */
581    HI_U8 u8Reserved[14]; /* For 16 byte align */
582} IVE_ST_MAX_EIG_S;
583
584/*
585* ShiTomasi control parameters
586*/
587typedef struct hiIVE_ST_CANDI_CORNER_CTRL_S {
588    IVE_MEM_INFO_S stMem;
589    HI_U0Q8 u0q8QualityLevel;
590} IVE_ST_CANDI_CORNER_CTRL_S;
591
592typedef struct hiIVE_ST_CORNER_INFO_S {
593    HI_U16 u16CornerNum;
594    IVE_POINT_U16_S astCorner[IVE_ST_MAX_CORNER_NUM];
595} IVE_ST_CORNER_INFO_S;
596
597typedef struct hiIVE_ST_CORNER_CTRL_S {
598    HI_U16 u16MaxCornerNum;
599    HI_U16 u16MinDist;
600} IVE_ST_CORNER_CTRL_S;
601
602/*
603* GradFg mode enum
604*/
605typedef enum hiIVE_GRAD_FG_MODE_E {
606    IVE_GRAD_FG_MODE_USE_CUR_GRAD = 0x0,
607    IVE_GRAD_FG_MODE_FIND_MIN_GRAD = 0x1,
608
609    IVE_GRAD_FG_MODE_BUTT
610} IVE_GRAD_FG_MODE_E;
611
612/*
613* GradFg ctrl struct
614*/
615typedef struct hiIVE_GRAD_FG_CTRL_S {
616    IVE_GRAD_FG_MODE_E enMode; /* Calculation mode */
617    HI_U16 u16EdwFactor;       /* Edge width adjustment factor (range: 500 to 2000; default: 1000) */
618    HI_U8 u8CrlCoefThr;        /* Gradient vector correlation coefficient threshold
619                                (ranges: 50 to 100; default: 80) */
620    HI_U8 u8MagCrlThr;         /* Gradient amplitude threshold (range: 0 to 20; default: 4) */
621    HI_U8 u8MinMagDiff;        /* Gradient magnitude difference threshold (range: 2 to 8; default: 2) */
622    HI_U8 u8NoiseVal;          /* Gradient amplitude noise threshold (range: 1 to 8; default: 1) */
623    HI_U8 u8EdwDark;           /* Black pixels enable flag (range: 0 (no), 1 (yes); default: 1) */
624} IVE_GRAD_FG_CTRL_S;
625
626typedef struct hiIVE_CANDI_BG_PIX_S {
627    HI_U8Q4F4 u8q4f4Mean;    /* Candidate background grays value */
628    HI_U16 u16StartTime;     /* Candidate Background start time */
629    HI_U16 u16SumAccessTime; /* Candidate Background cumulative access time */
630    HI_U16 u16ShortKeepTime; /* Candidate background short hold time */
631    HI_U8 u8ChgCond;         /* Time condition for candidate background into the changing state */
632    HI_U8 u8PotenBgLife;     /* Potential background cumulative access time */
633} IVE_CANDI_BG_PIX_S;
634
635typedef struct hiIVE_WORK_BG_PIX_S {
636    HI_U8Q4F4 u8q4f4Mean; /* 0# background grays value */
637    HI_U16 u16AccTime;    /* Background cumulative access time */
638    HI_U8 u8PreGray;      /* Gray value of last pixel */
639    HI_U5Q3 u5q3DiffThr;  /* Differential threshold */
640    HI_U8 u8AccFlag;      /* Background access flag */
641    HI_U8 u8BgGray[3];    /* 1# ~ 3# background grays value */
642} IVE_WORK_BG_PIX_S;
643
644typedef struct hiIVE_BG_LIFE_S {
645    HI_U8 u8WorkBgLife[3]; /* 1# ~ 3# background vitality */
646    HI_U8 u8CandiBgLife;   /* Candidate background vitality */
647} IVE_BG_LIFE_S;
648
649typedef struct hiIVE_BG_MODEL_PIX_S {
650    IVE_WORK_BG_PIX_S stWorkBgPixel; /* Working background */
651    IVE_CANDI_BG_PIX_S stCandiPixel; /* Candidate background */
652    IVE_BG_LIFE_S stBgLife;          /* Background vitality */
653} IVE_BG_MODEL_PIX_S;
654
655typedef struct hiIVE_FG_STAT_DATA_S {
656    HI_U32 u32PixNum;
657    HI_U32 u32SumLum;
658    HI_U8 u8Reserved[8];
659} IVE_FG_STAT_DATA_S;
660
661typedef struct hiIVE_BG_STAT_DATA_S {
662    HI_U32 u32PixNum;
663    HI_U32 u32SumLum;
664    HI_U8 u8Reserved[8];
665} IVE_BG_STAT_DATA_S;
666
667typedef struct hiIVE_MATCH_BG_MODEL_CTRL_S {
668    HI_U32 u32CurFrmNum; /* Current frame timestamp, in frame units */
669    HI_U32 u32PreFrmNum; /* Previous frame timestamp, in frame units */
670    HI_U16 u16TimeThr;   /* Potential background replacement time threshold
671                            (range: 2 to 100 frames; default: 20) */
672
673    HI_U8 u8DiffThrCrlCoef; /* Correlation coefficients between differential threshold and gray value
674                            (range: 0 to 5; default: 0) */
675    HI_U8 u8DiffMaxThr;     /* Maximum of background differential threshold (range: 3 to 15; default: 6) */
676    HI_U8 u8DiffMinThr;     /* Minimum of background differential threshold (range: 3 to 15; default: 4) */
677    HI_U8 u8DiffThrInc;     /* Dynamic Background differential threshold increment
678                            (range: 0 to 6; default: 0) */
679    HI_U8 u8FastLearnRate;  /* Quick background learning rate (range: 0 to 4; default: 2) */
680    HI_U8 u8DetChgRegion;   /* Whether to detect change region (range: 0 (no), 1 (yes); default: 0) */
681} IVE_MATCH_BG_MODEL_CTRL_S;
682
683typedef struct hiIVE_UPDATE_BG_MODEL_CTRL_S {
684    HI_U32 u32CurFrmNum;    /* Current frame timestamp, in frame units */
685    HI_U32 u32PreChkTime;   /* The last time when background status is checked */
686    HI_U32 u32FrmChkPeriod; /* Background status checking period (range: 0 to 2000 frames; default: 50) */
687
688    HI_U32 u32InitMinTime;       /* Background initialization shortest time
689                                (range: 20 to 6000 frames; default: 100) */
690    HI_U32 u32StyBgMinBlendTime; /* Steady background integration shortest time
691                                (range: 20 to 6000 frames; default: 200) */
692    HI_U32 u32StyBgMaxBlendTime; /* Steady background integration longest time
693                                (range: 20 to 40000 frames; default: 1500) */
694    HI_U32 u32DynBgMinBlendTime; /* Dynamic background integration shortest time
695                                (range: 0 to 6000 frames; default: 0) */
696    HI_U32 u32StaticDetMinTime;  /* Still detection shortest time (range: 20 to 6000 frames; default: 80) */
697    HI_U16 u16FgMaxFadeTime;     /* Foreground disappearing longest time
698                                (range: 1 to 255 seconds; default: 15) */
699    HI_U16 u16BgMaxFadeTime;     /* Background disappearing longest time
700                                (range: 1 to 255  seconds ; default: 60) */
701
702    HI_U8 u8StyBgAccTimeRateThr; /* Steady background access time ratio threshold
703                                (range: 10 to 100; default: 80) */
704    HI_U8 u8ChgBgAccTimeRateThr; /* Change background access time ratio threshold
705                                (range: 10 to 100; default: 60) */
706    HI_U8 u8DynBgAccTimeThr;     /* Dynamic background access time ratio threshold
707                                (range: 0 to 50; default: 0) */
708    HI_U8 u8DynBgDepth;          /* Dynamic background depth (range: 0 to 3; default: 3) */
709    HI_U8 u8BgEffStaRateThr;     /* Background state time ratio threshold when initializing
710                                (range: 90 to 100; default: 90) */
711
712    HI_U8 u8AcceBgLearn;  /* Whether to accelerate background learning (range: 0 (no), 1 (yes); default: 0) */
713    HI_U8 u8DetChgRegion; /* Whether to detect change region (range: 0 (no), 1 (yes); default: 0) */
714} IVE_UPDATE_BG_MODEL_CTRL_S;
715
716typedef enum hiIVE_ANN_MLP_ACTIV_FUNC_E {
717    IVE_ANN_MLP_ACTIV_FUNC_IDENTITY = 0x0,
718    IVE_ANN_MLP_ACTIV_FUNC_SIGMOID_SYM = 0x1,
719    IVE_ANN_MLP_ACTIV_FUNC_GAUSSIAN = 0x2,
720
721    IVE_ANN_MLP_ACTIV_FUNC_BUTT
722} IVE_ANN_MLP_ACTIV_FUNC_E;
723typedef enum hiIVE_ANN_MLP_ACCURATE_E {
724    IVE_ANN_MLP_ACCURATE_SRC16_WGT16 = 0x0, /* input decimals' accurate 16 bit, weight 16bit */
725    IVE_ANN_MLP_ACCURATE_SRC14_WGT20 = 0x1, /* input decimals' accurate 14 bit, weight 20bit */
726
727    IVE_ANN_MLP_ACCURATE_BUTT
728} IVE_ANN_MLP_ACCURATE_E;
729
730typedef struct hiIVE_ANN_MLP_MODEL_S {
731    IVE_ANN_MLP_ACTIV_FUNC_E enActivFunc;
732    IVE_ANN_MLP_ACCURATE_E enAccurate;
733    IVE_MEM_INFO_S stWeight;
734    HI_U32 u32TotalWeightSize;
735
736    HI_U16 au16LayerCount[8]; /* 8 layers, including input and output layer */
737    HI_U16 u16MaxCount;       /* Max count <=1024 */
738    HI_U8 u8LayerNum;         /* Layer num must be (2, 8] */
739    HI_U8 u8Reserved;
740} IVE_ANN_MLP_MODEL_S;
741
742typedef enum hiIVE_SVM_TYPE_E {
743    IVE_SVM_TYPE_C_SVC = 0x0,
744    IVE_SVM_TYPE_NU_SVC = 0x1,
745
746    IVE_SVM_TYPE_BUTT
747} IVE_SVM_TYPE_E;
748
749typedef enum hiIVE_SVM_KERNEL_TYPE_E {
750    IVE_SVM_KERNEL_TYPE_LINEAR = 0x0,
751    IVE_SVM_KERNEL_TYPE_POLY = 0x1,
752    IVE_SVM_KERNEL_TYPE_RBF = 0x2,
753    IVE_SVM_KERNEL_TYPE_SIGMOID = 0x3,
754
755    IVE_SVM_KERNEL_TYPE_BUTT
756} IVE_SVM_KERNEL_TYPE_E;
757
758typedef struct hiIVE_SVM_MODEL_S {
759    IVE_SVM_TYPE_E enType;
760    IVE_SVM_KERNEL_TYPE_E enKernelType;
761
762    IVE_MEM_INFO_S stSv;   /* SV memory */
763    IVE_MEM_INFO_S stDf;   /* Decision functions memory */
764    HI_U32 u32TotalDfSize; /* All decision functions coef size in byte */
765
766    HI_U16 u16FeatureDim;
767    HI_U16 u16SvTotal;
768    HI_U8 u8ClassCount;
769} IVE_SVM_MODEL_S;
770
771/*
772* Sad mode
773*/
774typedef enum hiIVE_SAD_MODE_E {
775    IVE_SAD_MODE_MB_4X4 = 0x0,   /* 4x4 */
776    IVE_SAD_MODE_MB_8X8 = 0x1,   /* 8x8 */
777    IVE_SAD_MODE_MB_16X16 = 0x2, /* 16x16 */
778
779    IVE_SAD_MODE_BUTT
780} IVE_SAD_MODE_E;
781/*
782* Sad output ctrl
783*/
784typedef enum hiIVE_SAD_OUT_CTRL_E {
785    IVE_SAD_OUT_CTRL_16BIT_BOTH = 0x0, /* Output 16 bit sad and thresh */
786    IVE_SAD_OUT_CTRL_8BIT_BOTH = 0x1,  /* Output 8 bit sad and thresh */
787    IVE_SAD_OUT_CTRL_16BIT_SAD = 0x2,  /* Output 16 bit sad */
788    IVE_SAD_OUT_CTRL_8BIT_SAD = 0x3,   /* Output 8 bit sad */
789    IVE_SAD_OUT_CTRL_THRESH = 0x4,     /* Output thresh,16 bits sad */
790
791    IVE_SAD_OUT_CTRL_BUTT
792} IVE_SAD_OUT_CTRL_E;
793/*
794* Sad ctrl param
795*/
796typedef struct hiIVE_SAD_CTRL_S {
797    IVE_SAD_MODE_E enMode;
798    IVE_SAD_OUT_CTRL_E enOutCtrl;
799    /*
800    * When srcVal <= u16Thr, then dstVal = minVal; and when srcVal > u16Thr,then dstVal = maxVal.
801    */
802    HI_U16 u16Thr;
803    HI_U8 u8MinVal; /* Min value */
804    HI_U8 u8MaxVal; /* Max value */
805} IVE_SAD_CTRL_S;
806
807/*
808* Resize zoom mode
809*/
810typedef enum hiIVE_RESIZE_MODE_E {
811    IVE_RESIZE_MODE_LINEAR = 0x0, /* Bilinear interpolation */
812
813    IVE_RESIZE_MODE_BUTT
814} IVE_RESIZE_MODE_E;
815
816/*
817* Resize ctrl param
818*/
819typedef struct hiIVE_RESIZE_CTRL_S {
820    IVE_RESIZE_MODE_E enMode;
821    IVE_MEM_INFO_S stMem;
822    HI_U16 u16Num;
823} IVE_RESIZE_CTRL_S;
824
825/*
826* CNN active function mode
827*/
828typedef enum hiIVE_CNN_ACTIV_FUNC_E {
829    IVE_CNN_ACTIV_FUNC_NONE = 0x0,    /* Do not taking a activation, equivalent f(x)=x */
830    IVE_CNN_ACTIV_FUNC_RELU = 0x1,    /* Relu activation function: f(x)=max(0, x) */
831    IVE_CNN_ACTIV_FUNC_SIGMOID = 0x2, /* Relu activation function: f(x)=1/(1+exp(-x)), not support */
832
833    IVE_CNN_ACTIV_FUNC_BUTT
834} IVE_CNN_ACTIV_FUNC_E;
835
836/*
837* CNN pooling mode
838*/
839typedef enum hiIVE_CNN_POOLING_E {
840    IVE_CNN_POOLING_NONE = 0x0, /* Do not taking a pooling action */
841    IVE_CNN_POOLING_MAX = 0x1,  /* Using max value of every pooling area */
842    IVE_CNN_POOLING_AVG = 0x2,  /* Using average value of every pooling area */
843
844    IVE_CNN_POOLING_BUTT
845} IVE_CNN_POOLING_E;
846
847/*
848* CNN Conv-ReLU-Pooling layer control parameters
849*/
850typedef struct hiIVE_CNN_CONV_POOLING_S {
851    IVE_CNN_ACTIV_FUNC_E enActivFunc; /* Type of activation function */
852    IVE_CNN_POOLING_E enPooling;      /* Mode of pooling method */
853
854    HI_U8 u8FeatureMapNum; /* Number of feature maps */
855    HI_U8 u8KernelSize;    /* Kernel size, only support 3 currently */
856    HI_U8 u8ConvStep;      /* Convolution step, only support 1 currently */
857
858    HI_U8 u8PoolSize; /* Pooling size, only support 2 currently */
859    HI_U8 u8PoolStep; /* Pooling step, only support 2 currently */
860    HI_U8 u8Reserved[3];
861} IVE_CNN_CONV_POOLING_S;
862
863/*
864* CNN fully connected layer control parameters
865*/
866typedef struct hiIVE_CNN_FULL_CONNECT_S {
867    HI_U16 au16LayerCnt[8]; /* Neuron number of every fully connected layers. The max layer number is 8. */
868    HI_U16 u16MaxCnt;       /* Max neuron number in all fully connected layers */
869    HI_U8 u8LayerNum;       /* Number of fully connected layer */
870    HI_U8 u8Reserved;
871} IVE_CNN_FULL_CONNECT_S;
872
873/*
874* CNN model info
875*/
876typedef struct hiIVE_CNN_MODEL_S {
877    IVE_CNN_CONV_POOLING_S astConvPool[8]; /* Conv-ReLU-Pooling layers info.The max layer number is 8. */
878    IVE_CNN_FULL_CONNECT_S stFullConnect;  /* Fully connected layers info */
879
880    IVE_MEM_INFO_S stConvKernelBias; /* Conv-ReLU-Pooling layers' kernels and bias */
881    HI_U32 u32ConvKernelBiasSize;    /* Size of Conv-ReLU-Pooling layer' kernels and bias */
882
883    IVE_MEM_INFO_S stFCLWgtBias; /* Fully Connection Layers' weights and bias */
884    HI_U32 u32FCLWgtBiasSize;    /* Size of fully connection layers weights and bias */
885
886    HI_U32 u32TotalMemSize; /* Total memory size of all kernels, weights, bias */
887
888    IVE_IMAGE_TYPE_E enType; /* Image type used for the CNN model */
889    HI_U32 u32Width;         /* Image width used for the model */
890    HI_U32 u32Height;        /* Image height used for the model */
891
892    HI_U16 u16ClassCount;     /* Number of classes */
893    HI_U8 u8ConvPoolLayerNum; /* Number of Conv-ReLU-Pooling layers */
894    HI_U8 u8Reserved;
895} IVE_CNN_MODEL_S;
896
897/*
898* CNN ctrl param
899*/
900typedef struct hiIVE_CNN_CTRL_S {
901    IVE_MEM_INFO_S stMem; /* Assist memory */
902    HI_U32 u32Num;        /* Input image number */
903} IVE_CNN_CTRL_S;
904
905/*
906* CNN result struct
907*/
908typedef struct hiIVE_CNN_RESULT_S {
909    HI_S32 s32ClassIdx;   /* The most possible index of the classification */
910    HI_S32 s32Confidence; /* The confidence of the classification */
911} IVE_CNN_RESULT_S;
912
913/*
914* Perspective transform algorithm mode
915*/
916typedef enum hiIVE_PERSP_TRANS_ALG_MODE_E {
917    IVE_PERSP_TRANS_ALG_MODE_NR_SIM = 0x0, /* Non-reflective similarity transform mode */
918    IVE_PERSP_TRANS_ALG_MODE_SIM = 0x1,    /* Reflective similarity transform mode */
919    IVE_PERSP_TRANS_ALG_MODE_AFFINE = 0x2, /* Affine transform mode */
920
921    IVE_PERSP_TRANS_ALG_MODE_BUTT
922} IVE_PERSP_TRANS_ALG_MODE_E;
923
924/*
925* Point pair
926*/
927typedef struct hiIVE_PERSP_TRANS_POINT_PAIR_S {
928    IVE_POINT_U14Q2_S stSrcPoint; /* Source point */
929    IVE_POINT_U14Q2_S stDstPoint; /* Destination point */
930} IVE_PERSP_TRANS_POINT_PAIR_S;
931
932/*
933* Perspective transform csc mode
934*/
935typedef enum hiIVE_PERSP_TRANS_CSC_MODE_E {
936    IVE_PERSP_TRANS_CSC_MODE_NONE = 0x0,                /* No do csc */
937    IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT601_YUV2RGB = 0x1, /* CSC: YUV2RGB, video transfer mode,
938                                                      RGB value range [16, 235] */
939    IVE_PERSP_TRANS_CSC_MODE_VIDEO_BT709_YUV2RGB = 0x2, /* CSC: YUV2RGB, video transfer mode,
940                                                      RGB value range [16, 235] */
941    IVE_PERSP_TRANS_CSC_MODE_PIC_BT601_YUV2RGB = 0x3,   /* CSC: YUV2RGB, picture transfer mode,
942                                                      RGB value range [0, 255] */
943    IVE_PERSP_TRANS_CSC_MODE_PIC_BT709_YUV2RGB = 0x4,   /* CSC: YUV2RGB, picture transfer mode,
944                                                      RGB value range [0, 255] */
945
946    IVE_PERSP_TRANS_CSC_MODE_BUTT
947} IVE_PERSP_TRANS_CSC_MODE_E;
948
949/*
950* Perspective transform ctrl
951*/
952typedef struct hiIVE_PERSP_TRANS_CTRL_S {
953    IVE_PERSP_TRANS_ALG_MODE_E enAlgMode; /* Alg mode */
954    IVE_PERSP_TRANS_CSC_MODE_E enCscMode; /* CSC mode */
955    HI_U16 u16RoiNum;                     /* Roi number */
956    HI_U16 u16PointPairNum;               /* Point pair number  */
957} IVE_PERSP_TRANS_CTRL_S;
958
959typedef struct hiIVE_ROI_INFO_S {
960    IVE_RECT_S24Q8_S stRoi;
961    HI_U32 u32RoiId;
962} IVE_ROI_INFO_S;
963
964/* Kcf ctrl param */
965typedef struct hiIVE_KCF_PRO_CTRL_S {
966    IVE_CSC_MODE_E enCscMode;  /* Only support:
967                                IVE_CSC_MODE_VIDEO_BT601_YUV2RGB  CSC: YUV2RGB, video transfer mode,
968                                RGB value range [16, 235]
969                                IVE_CSC_MODE_VIDEO_BT709_YUV2RGB  CSC: YUV2RGB, video transfer mode,
970                                RGB value range [16, 235]
971                                IVE_CSC_MODE_PIC_BT601_YUV2RGB  CSC: YUV2RGB, picture transfer mode,
972                                RGB value range [0, 255]
973                                IVE_CSC_MODE_PIC_BT709_YUV2RGB  CSC: YUV2RGB, picture transfer mode,
974                                RGB value range [0, 255]
975                            */
976    IVE_MEM_INFO_S stTmpBuf;
977    HI_U1Q15 u1q15InterFactor; /* Blend coefficient. [0, 32768] */
978    HI_U0Q16 u0q16Lamda;       /* The regularization coefficient. [0, 65535] */
979    HI_U4Q12 u4q12TrancAlfa;   /* The normalization thresh. [0, 4095] */
980    HI_U0Q8 u0q8Sigma;         /* The gaussian kernel bandwidth. [0, 255]  */
981    HI_U8 u8RespThr;
982} IVE_KCF_PRO_CTRL_S;
983
984typedef struct hiIVE_KCF_OBJ_S {
985    IVE_ROI_INFO_S stRoiInfo;
986    IVE_MEM_INFO_S stCosWinX;
987    IVE_MEM_INFO_S stCosWinY;
988    IVE_MEM_INFO_S stGaussPeak;
989    IVE_MEM_INFO_S stHogFeature;
990    IVE_MEM_INFO_S stAlpha;
991    IVE_MEM_INFO_S stDst;
992    HI_U3Q5 u3q5Padding; /* [48, 160]  */
993    HI_U8 au8Reserved[3];
994} IVE_KCF_OBJ_S;
995
996typedef struct hiIVE_LIST_HEAD_S {
997    struct hiIVE_LIST_HEAD_S *pstNext, *pstPrev;
998} IVE_LIST_HEAD_S;
999
1000typedef struct hiIVE_KCF_OBJ_NODE_S {
1001    IVE_LIST_HEAD_S stList;
1002    IVE_KCF_OBJ_S stKcfObj;
1003} IVE_KCF_OBJ_NODE_S;
1004
1005typedef enum hiIVE_KCF_LIST_STATE_E {
1006    IVE_KCF_LIST_STATE_CREATE = 0x1,
1007    IVE_KCF_LIST_STATE_DESTORY = 0x2,
1008    IVE_KCF_LIST_STATE_BUTT
1009} IVE_KCF_LIST_STATE_E;
1010
1011typedef struct hiIVE_KCF_OBJ_LIST_S {
1012    IVE_KCF_OBJ_NODE_S *pstObjNodeBuf; /* The object list node address */
1013    IVE_LIST_HEAD_S stFreeObjList;     /* The free list of object list */
1014    IVE_LIST_HEAD_S stTrainObjList;    /* The training list of object list */
1015    IVE_LIST_HEAD_S stTrackObjList;    /* The tracking list of object list */
1016
1017    HI_U32 u32FreeObjNum;             /* The numbers of free list */
1018    HI_U32 u32TrainObjNum;            /* The numbers of training list */
1019    HI_U32 u32TrackObjNum;            /* The numbers of tracking list */
1020    HI_U32 u32MaxObjNum;              /* The maximum numbers of object list */
1021    IVE_KCF_LIST_STATE_E enListState; /* The object list state */
1022    HI_U8 *pu8TmpBuf;                 /* Assist buffer */
1023    HI_U32 u32Width;                  /* image width */
1024    HI_U32 u32Height;                 /* image height */
1025} IVE_KCF_OBJ_LIST_S;
1026
1027typedef struct hiIVE_KCF_BBOX_S {
1028    IVE_KCF_OBJ_NODE_S *pstNode;
1029    HI_S32 s32Response; /* Bbox Response value. */
1030
1031    IVE_ROI_INFO_S stRoiInfo;
1032    HI_BOOL bTrackOk;
1033    HI_BOOL bRoiRefresh;
1034} IVE_KCF_BBOX_S;
1035
1036typedef struct hiIVE_KCF_BBOX_CTRL_S {
1037    HI_U32 u32MaxBboxNum; /* The member numbers of Bbox Array. */
1038    HI_S32 s32RespThr;    /* Select Bbox when Bbox'Response value is greater than or equal to RespThr. */
1039} IVE_KCF_BBOX_CTRL_S;
1040
1041typedef enum hiIVE_HOG_MODE_E {
1042    IVE_HOG_MODE_VERTICAL_TANGENT_PLANE = 0x1,
1043    IVE_HOG_MODE_HORIZONTAL_TANGENT_PLANE = 0x2,
1044    IVE_HOG_MODE_BUTT
1045} IVE_HOG_MODE_E;
1046
1047typedef struct hiIVE_HOG_CTRL_S {
1048    IVE_CSC_MODE_E enCscMode; /* Only support:
1049                                IVE_CSC_MODE_VIDEO_BT601_YUV2RGB  CSC: YUV2RGB, video transfer mode,
1050                                RGB value range [16, 235]
1051                                IVE_CSC_MODE_VIDEO_BT709_YUV2RGB  CSC: YUV2RGB, video transfer mode,
1052                                RGB value range [16, 235]
1053                                IVE_CSC_MODE_PIC_BT601_YUV2RGB  CSC: YUV2RGB, picture transfer mode,
1054                                RGB value range [0, 255]
1055                                IVE_CSC_MODE_PIC_BT709_YUV2RGB  CSC: YUV2RGB, picture transfer mode,
1056                                RGB value range [0, 255] */
1057    IVE_HOG_MODE_E enHogMode; /* Hog mode */
1058    HI_U32 u32RoiNum;         /* Roi number. [1, 64] */
1059    HI_U4Q12 u4q12TrancAlfa;  /* The normalization thresh. [0, 4095] */
1060    HI_U8 au8Rsv[2];
1061} IVE_HOG_CTRL_S;
1062
1063#ifdef __cplusplus
1064#if __cplusplus
1065}
1066#endif
1067#endif
1068
1069#endif /* _HI_IVE_H_ */
1070