/****************************************************************************** Copyright (C), 2001-2014, Hisilicon Tech. Co., Ltd. ****************************************************************************** File Name : hi_comm_ive.h Version : Initial Draft Author : Hisilicon multimedia software (IVE) group Created : 2014/08/05 Description : History : 1.Date : 2013/07/01~2014/08/05 Author : t00228657\c00211359\c00206215 Modification: Created file ******************************************************************************/ #ifndef _HI_IVE_H_ #define _HI_IVE_H_ #ifdef __cplusplus #if __cplusplus extern "C"{ #endif #endif #include "hi_comm_ive.h" //if sdk environment,include hi_common.h,else typedef HI_S32 IVE_HANDLE #include "hi_common.h" #define IVE_HIST_NUM 256 #define IVE_MAP_NUM 256 #define IVE_MAX_REGION_NUM 254 #define IVE_ST_MAX_CORNER_NUM 200 /* *DMA mode ,created by Chen Quanfu 2013-07-19 */ typedef enum hiIVE_DMA_MODE_E { IVE_DMA_MODE_DIRECT_COPY = 0x0, IVE_DMA_MODE_INTERVAL_COPY = 0x1, IVE_DMA_MODE_SET_3BYTE = 0x2, IVE_DMA_MODE_SET_8BYTE = 0x3, IVE_DMA_MODE_BUTT }IVE_DMA_MODE_E; /* *DMA control parameter ,created by Chen Quanfu 2013-07-19 */ typedef struct hiIVE_DMA_CTRL_S { IVE_DMA_MODE_E enMode; HI_U64 u64Val; /*Used in memset mode*/ HI_U8 u8HorSegSize; /*Used in interval-copy mode, every row was segmented by u8HorSegSize bytes, restricted in values of 2,3,4,8,16*/ HI_U8 u8ElemSize; /*Used in interval-copy mode, the valid bytes copied in front of every segment in a valid row, which 0 lowThr, dstVal = maxVal.*/ IVE_THRESH_MODE_TRUNC = 0x1, /*srcVal <= lowThr, dstVal = srcVal; srcVal > lowThr, dstVal = maxVal.*/ IVE_THRESH_MODE_TO_MINVAL = 0x2, /*srcVal <= lowThr, dstVal = minVal; srcVal > lowThr, dstVal = srcVal.*/ IVE_THRESH_MODE_MIN_MID_MAX = 0x3, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.*/ IVE_THRESH_MODE_ORI_MID_MAX = 0x4, /*srcVal <= lowThr, dstVal = srcVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = maxVal.*/ IVE_THRESH_MODE_MIN_MID_ORI = 0x5, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = srcVal.*/ IVE_THRESH_MODE_MIN_ORI_MAX = 0x6, /*srcVal <= lowThr, dstVal = minVal; lowThr < srcVal <= highThr, dstVal = srcVal; srcVal > highThr, dstVal = maxVal.*/ IVE_THRESH_MODE_ORI_MID_ORI = 0x7, /*srcVal <= lowThr, dstVal = srcVal; lowThr < srcVal <= highThr, dstVal = midVal; srcVal > highThr, dstVal = srcVal.*/ IVE_THRESH_MODE_BUTT }IVE_THRESH_MODE_E; /* * Thresh control parameters. * Modified by Tan Bing, 2013-7-22 */ typedef struct hiIVE_THRESH_CTRL_S { IVE_THRESH_MODE_E enMode; HI_U8 u8LowThr; /*user-defined threshold, 0<=u8LowThr<=255 */ HI_U8 u8HighThr; /*user-defined threshold, if enMode0' and 'label = ArrayIndex+1'*/ }IVE_CCBLOB_S; /* *CCL control struct */ typedef struct hiIVE_CCL_CTRL_S { HI_U16 u16InitAreaThr; /*Init threshold of region area*/ HI_U16 u16Step; /*Increase area step for once*/ }IVE_CCL_CTRL_S; /* *GMM control struct */ typedef struct hiIVE_GMM_CTRL_S { HI_U22Q10 u22q10NoiseVar; /*Initial noise Variance*/ HI_U22Q10 u22q10MaxVar; /*Max Variance*/ HI_U22Q10 u22q10MinVar; /*Min Variance*/ HI_U0Q16 u0q16LearnRate; /*Learning rate*/ HI_U0Q16 u0q16BgRatio; /*Background ratio*/ HI_U8Q8 u8q8VarThr; /*Variance Threshold*/ HI_U0Q16 u0q16InitWeight; /*Initial Weight*/ HI_U8 u8ModelNum; /*Model number: 3 or 5*/ }IVE_GMM_CTRL_S; /* *CannyHysEdge control struct */ typedef struct hiIVE_CANNY_HYS_EDGE_CTRL_S { IVE_MEM_INFO_S stMem; HI_U16 u16LowThr; HI_U16 u16HighThr; HI_S8 as8Mask[25]; } IVE_CANNY_HYS_EDGE_CTRL_S; /* *Canny stack size struct */ typedef struct hiIVE_CANNY_STACK_SIZE_S { HI_U32 u32StackSize; /*Stack size for output*/ HI_U8 u8Reserved[12]; /*For 16 byte align*/ }IVE_CANNY_STACK_SIZE_S; /* *LBP compare mode */ typedef enum hiIVE_LBP_CMP_MODE_E { IVE_LBP_CMP_MODE_NORMAL = 0x0, /* P(x)-P(center)>= un8BitThr.s8Val, s(x)=1; else s(x)=0; */ IVE_LBP_CMP_MODE_ABS = 0x1, /* Abs(P(x)-P(center))>=un8BitThr.u8Val, s(x)=1; else s(x)=0; */ IVE_LBP_CMP_MODE_BUTT }IVE_LBP_CMP_MODE_E; /* *LBP control struct */ typedef struct hiIVE_LBP_CTRL_S { IVE_LBP_CMP_MODE_E enMode; IVE_8BIT_U un8BitThr; }IVE_LBP_CTRL_S; /* *Type of the GradientFilter output format */ typedef enum hiIVE_NORM_GRAD_OUT_CTRL_E { IVE_NORM_GRAD_OUT_CTRL_HOR_AND_VER = 0x0, IVE_NORM_GRAD_OUT_CTRL_HOR = 0x1, IVE_NORM_GRAD_OUT_CTRL_VER = 0x2, IVE_NORM_GRAD_OUT_CTRL_COMBINE = 0x3, IVE_NORM_GRAD_OUT_CTRL_BUTT }IVE_NORM_GRAD_OUT_CTRL_E; /* *GradientFilter control parameters */ typedef struct hiIVE_NORM_GRAD_CTRL_S { IVE_NORM_GRAD_OUT_CTRL_E enOutCtrl; HI_S8 as8Mask[25]; HI_U8 u8Norm; }IVE_NORM_GRAD_CTRL_S; /* * LKOpticalFlow movement */ typedef struct hiIVE_MV_S9Q7_S { HI_S32 s32Status; /*Result of tracking: 0-success; -1-failure*/ HI_S9Q7 s9q7Dx; /*X-direction component of the movement*/ HI_S9Q7 s9q7Dy; /*Y-direction component of the movement*/ }IVE_MV_S9Q7_S; typedef struct hiIVE_LK_OPTICAL_FLOW_CTRL_S { HI_U16 u16CornerNum; /*Number of the feature points,<200*/ HI_U0Q8 u0q8MinEigThr; /*Minimum eigenvalue threshold*/ HI_U8 u8IterCount; /*Maximum iteration times*/ HI_U0Q8 u0q8Epsilon; /*Threshold of iteration for dx^2 + dy^2 < u0q8Epsilon */ }IVE_LK_OPTICAL_FLOW_CTRL_S; typedef struct hiIVE_ST_MAX_EIG_S { HI_U16 u16MaxEig; /*Shi-Tomasi second step output MaxEig*/ HI_U8 u8Reserved[14]; /*For 16 byte align*/ }IVE_ST_MAX_EIG_S; /* *ShiTomasi control parameters */ typedef struct hiIVE_ST_CANDI_CORNER_CTRL_S { IVE_MEM_INFO_S stMem; HI_U0Q8 u0q8QualityLevel; }IVE_ST_CANDI_CORNER_CTRL_S; typedef struct hiIVE_ST_CORNER_INFO_S { HI_U16 u16CornerNum; IVE_POINT_U16_S astCorner[IVE_ST_MAX_CORNER_NUM]; }IVE_ST_CORNER_INFO_S; typedef struct hiIVE_ST_CORNER_CTRL_S { HI_U16 u16MaxCornerNum; HI_U16 u16MinDist; }IVE_ST_CORNER_CTRL_S; /* * GradFg mode enum */ typedef enum hiIVE_GRAD_FG_MODE_E { IVE_GRAD_FG_MODE_USE_CUR_GRAD = 0x0, IVE_GRAD_FG_MODE_FIND_MIN_GRAD = 0x1, IVE_GRAD_FG_MODE_BUTT }IVE_GRAD_FG_MODE_E; /* * GradFg ctrl struct */ typedef struct hiIVE_GRAD_FG_CTRL_S { IVE_GRAD_FG_MODE_E enMode; /*Calculation mode*/ HI_U16 u16EdwFactor; /*Edge width adjustment factor (range: 500 to 2000; default: 1000)*/ HI_U8 u8CrlCoefThr; /*Gradient vector correlation coefficient threshold (ranges: 50 to 100; default: 80)*/ HI_U8 u8MagCrlThr; /*Gradient amplitude threshold (range: 0 to 20; default: 4)*/ HI_U8 u8MinMagDiff; /*Gradient magnitude difference threshold (range: 2 to 8; default: 2)*/ HI_U8 u8NoiseVal; /*Gradient amplitude noise threshold (range: 1 to 8; default: 1)*/ HI_U8 u8EdwDark; /*Black pixels enable flag (range: 0 (no), 1 (yes); default: 1)*/ }IVE_GRAD_FG_CTRL_S; typedef struct hiIVE_CANDI_BG_PIX_S { HI_U8Q4F4 u8q4f4Mean; /*Candidate background grays value */ HI_U16 u16StartTime; /*Candidate Background start time */ HI_U16 u16SumAccessTime; /*Candidate Background cumulative access time */ HI_U16 u16ShortKeepTime; /*Candidate background short hold time*/ HI_U8 u8ChgCond; /*Time condition for candidate background into the changing state*/ HI_U8 u8PotenBgLife; /*Potential background cumulative access time */ }IVE_CANDI_BG_PIX_S; typedef struct hiIVE_WORK_BG_PIX_S { HI_U8Q4F4 u8q4f4Mean; /*0# background grays value */ HI_U16 u16AccTime; /*Background cumulative access time */ HI_U8 u8PreGray; /*Gray value of last pixel */ HI_U5Q3 u5q3DiffThr; /*Differential threshold */ HI_U8 u8AccFlag; /*Background access flag */ HI_U8 u8BgGray[3]; /*1# ~ 3# background grays value */ }IVE_WORK_BG_PIX_S; typedef struct hiIVE_BG_LIFE_S { HI_U8 u8WorkBgLife[3]; /*1# ~ 3# background vitality */ HI_U8 u8CandiBgLife; /*Candidate background vitality */ }IVE_BG_LIFE_S; typedef struct hiIVE_BG_MODEL_PIX_S { IVE_WORK_BG_PIX_S stWorkBgPixel; /*Working background */ IVE_CANDI_BG_PIX_S stCandiPixel; /*Candidate background */ IVE_BG_LIFE_S stBgLife; /*Background vitality */ }IVE_BG_MODEL_PIX_S; typedef struct hiIVE_FG_STAT_DATA_S { HI_U32 u32PixNum; HI_U32 u32SumLum; HI_U8 u8Reserved[8]; }IVE_FG_STAT_DATA_S; typedef struct hiIVE_BG_STAT_DATA_S { HI_U32 u32PixNum; HI_U32 u32SumLum; HI_U8 u8Reserved[8]; }IVE_BG_STAT_DATA_S; typedef struct hiIVE_MATCH_BG_MODEL_CTRL_S { HI_U32 u32CurFrmNum; /*Current frame timestamp, in frame units */ HI_U32 u32PreFrmNum; /*Previous frame timestamp, in frame units */ HI_U16 u16TimeThr; /*Potential background replacement time threshold (range: 2 to 100 frames; default: 20) */ HI_U8 u8DiffThrCrlCoef; /*Correlation coefficients between differential threshold and gray value (range: 0 to 5; default: 0) */ HI_U8 u8DiffMaxThr; /*Maximum of background differential threshold (range: 3 to 15; default: 6) */ HI_U8 u8DiffMinThr; /*Minimum of background differential threshold (range: 3 to 15; default: 4) */ HI_U8 u8DiffThrInc; /*Dynamic Background differential threshold increment (range: 0 to 6; default: 0) */ HI_U8 u8FastLearnRate; /*Quick background learning rate (range: 0 to 4; default: 2) */ HI_U8 u8DetChgRegion; /*Whether to detect change region (range: 0 (no), 1 (yes); default: 0) */ }IVE_MATCH_BG_MODEL_CTRL_S; typedef struct hiIVE_UPDATE_BG_MODEL_CTRL_S { HI_U32 u32CurFrmNum; /*Current frame timestamp, in frame units */ HI_U32 u32PreChkTime; /*The last time when background status is checked */ HI_U32 u32FrmChkPeriod; /*Background status checking period (range: 0 to 2000 frames; default: 50) */ HI_U32 u32InitMinTime; /*Background initialization shortest time (range: 20 to 6000 frames; default: 100)*/ HI_U32 u32StyBgMinBlendTime; /*Steady background integration shortest time (range: 20 to 6000 frames; default: 200)*/ HI_U32 u32StyBgMaxBlendTime; /*Steady background integration longest time (range: 20 to 40000 frames; default: 1500)*/ HI_U32 u32DynBgMinBlendTime; /*Dynamic background integration shortest time (range: 0 to 6000 frames; default: 0)*/ HI_U32 u32StaticDetMinTime; /*Still detection shortest time (range: 20 to 6000 frames; default: 80)*/ HI_U16 u16FgMaxFadeTime; /*Foreground disappearing longest time (range: 1 to 255 seconds; default: 15)*/ HI_U16 u16BgMaxFadeTime; /*Background disappearing longest time (range: 1 to 255 seconds ; default: 60)*/ HI_U8 u8StyBgAccTimeRateThr; /*Steady background access time ratio threshold (range: 10 to 100; default: 80)*/ HI_U8 u8ChgBgAccTimeRateThr; /*Change background access time ratio threshold (range: 10 to 100; default: 60)*/ HI_U8 u8DynBgAccTimeThr; /*Dynamic background access time ratio threshold (range: 0 to 50; default: 0)*/ HI_U8 u8DynBgDepth; /*Dynamic background depth (range: 0 to 3; default: 3)*/ HI_U8 u8BgEffStaRateThr; /*Background state time ratio threshold when initializing (range: 90 to 100; default: 90)*/ HI_U8 u8AcceBgLearn; /*Whether to accelerate background learning (range: 0 (no), 1 (yes); default: 0)*/ HI_U8 u8DetChgRegion; /*Whether to detect change region (range: 0 (no), 1 (yes); default: 0)*/ } IVE_UPDATE_BG_MODEL_CTRL_S; typedef enum hiIVE_ANN_MLP_ACTIV_FUNC_E { IVE_ANN_MLP_ACTIV_FUNC_IDENTITY = 0x0, IVE_ANN_MLP_ACTIV_FUNC_SIGMOID_SYM = 0x1, IVE_ANN_MLP_ACTIV_FUNC_GAUSSIAN = 0x2, IVE_ANN_MLP_ACTIV_FUNC_BUTT }IVE_ANN_MLP_ACTIV_FUNC_E; typedef struct hiIVE_ANN_MLP_MODEL_S { IVE_ANN_MLP_ACTIV_FUNC_E enActivFunc; IVE_MEM_INFO_S stWeight; HI_U32 u32TotalWeightSize; HI_U16 au16LayerCount[8]; /*8 layers, including input and output layer, every layerCount<=256*/ HI_U16 u16MaxCount; /*MaxCount<=256*/ HI_U8 u8LayerNum; /*2 u16Thr, dstVal = maxVal.*/ HI_U8 u8MinVal; /*Min value*/ HI_U8 u8MaxVal; /*Max value*/ }IVE_SAD_CTRL_S; #ifdef __cplusplus #if __cplusplus } #endif #endif #endif/*_HI_IVE_H_*/