1 /* GPL-2.0 WITH Linux-syscall-note OR Apache 2.0 */ 2 /* Copyright (c) 2022 Fuzhou Rockchip Electronics Co., Ltd */ 3 4 #ifndef INCLUDE_RT_MPI_RK_COMM_IVS_H_ 5 6 #define INCLUDE_RT_MPI_RK_COMM_IVS_H_ 7 #include "rk_type.h" 8 #include "rk_common.h" 9 #include "rk_errno.h" 10 #include "rk_comm_video.h" 11 #include "rk_comm_mb.h" 12 13 #ifdef __cplusplus 14 #if __cplusplus 15 extern "C" { 16 #endif 17 #endif /* End of #ifdef __cplusplus */ 18 19 #define IVS_MAX_AREA_NUM 16 20 #define IVS_MAX_AREA_POINT_NUM 6 21 22 typedef enum rkIVS_MODE_E { 23 IVS_MODE_MD = 1 << 0, 24 IVS_MODE_OD = 1 << 1, 25 IVS_MODE_MD_OD = IVS_MODE_MD | IVS_MODE_OD, 26 IVS_MODE_BUTT 27 } IVS_MODE_E; 28 29 typedef struct rkIVS_AREA_S { 30 RK_U32 u32PointNum; /* 点个数 */ 31 POINT_S points[IVS_MAX_AREA_POINT_NUM]; /* 围成区域的所有点坐标 */ 32 } IVS_AREA_S; 33 34 typedef struct rkIVS_AREAS_S { 35 RK_U32 u32AreaNum; 36 IVS_AREA_S areas[IVS_MAX_AREA_NUM]; 37 } IVS_AREAS_S; 38 39 typedef struct rkIVS_DET_ATTR_S { 40 IVS_AREAS_S stDetArea; 41 } IVS_DET_ATTR_S; 42 43 typedef struct rkIVS_CHN_ATTR_S { 44 IVS_MODE_E enMode; 45 RK_U32 u32PicWidth; 46 RK_U32 u32PicHeight; 47 PIXEL_FORMAT_E enPixelFormat; 48 ROTATION_E enRotation; 49 MIRROR_E enMirror; 50 RK_BOOL bTraceClose; 51 RK_S32 s32Gop; 52 RK_BOOL bSmearEnable; 53 RK_BOOL bWeightpEnable; 54 RK_BOOL bMDEnable; 55 RK_S32 s32MDInterval; 56 RK_BOOL bMDNightMode; 57 RK_U32 u32MDSensibility; // 1: low, 2: mid, 3: high 58 RK_BOOL bODEnable; 59 RK_S32 s32ODInterval; 60 RK_S32 s32ODPercent; // [5, 8] 61 62 union { 63 IVS_DET_ATTR_S stDetAttr; 64 }; 65 } IVS_CHN_ATTR_S; 66 67 typedef struct rkIVS_MD_INFO_S { 68 RK_U32 frameId; /* 所在帧序号 */ 69 RK_U32 u32RectNum; 70 RECT_S stRect[4096]; 71 RK_CHAR *pData; 72 RK_U32 u32Size; 73 RK_S32 s32Fd; 74 } IVS_MD_INFO_S; 75 76 typedef struct rkIVS_OD_INFO_S { 77 RK_U32 frameId; /* 所在帧序号 */ 78 RK_U32 u32Flag; 79 RK_U32 u32PixSum; 80 } IVS_OD_INFO_S; 81 82 typedef struct rkIVS_RESULT_S { 83 IVS_MD_INFO_S stMdInfo; 84 IVS_OD_INFO_S stOdInfo; 85 } IVS_RESULT_S; 86 87 typedef struct rkIVS_RESULT_INFO_S { 88 RK_S32 s32ResultNum; 89 IVS_RESULT_S *pstResults; 90 } IVS_RESULT_INFO_S; 91 92 /*********************************************************************************************/ 93 /* invlalid channel ID */ 94 #define RK_ERR_IVS_INVALID_CHNID RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_INVALID_CHNID) 95 /* at lease one parameter is illagal ,eg, an illegal enumeration value */ 96 #define RK_ERR_IVS_ILLEGAL_PARAM RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_ILLEGAL_PARAM) 97 /* channel exists */ 98 #define RK_ERR_IVS_EXIST RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_EXIST) 99 /* using a NULL point */ 100 #define RK_ERR_IVS_NULL_PTR RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NULL_PTR) 101 /* try to enable or initialize system,device or channel, before configing attribute */ 102 #define RK_ERR_IVS_NOT_CONFIG RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_CONFIG) 103 /* operation is not supported by NOW */ 104 #define RK_ERR_IVS_NOT_SUPPORT RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_SUPPORT) 105 /* operation is not permitted ,eg, try to change stati attribute */ 106 #define RK_ERR_IVS_NOT_PERM RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOT_PERM) 107 /* the channle is not existed */ 108 #define RK_ERR_IVS_UNEXIST RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_UNEXIST) 109 /* failure caused by malloc memory */ 110 #define RK_ERR_IVS_NOMEM RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOMEM) 111 /* failure caused by malloc buffer */ 112 #define RK_ERR_IVS_NOBUF RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOBUF) 113 /* no data in buffer */ 114 #define RK_ERR_IVS_BUF_EMPTY RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_EMPTY) 115 /* no buffer for new data */ 116 #define RK_ERR_IVS_BUF_FULL RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_BUF_FULL) 117 /* system is not ready,had not initialed or loaded */ 118 #define RK_ERR_IVS_SYS_NOTREADY RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_NOTREADY) 119 /* system busy */ 120 #define RK_ERR_IVS_BUSY RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_BUSY) 121 /* bad address, eg. used for copy_from_user & copy_to_user */ 122 #define RK_ERR_IVS_BADADDR RK_DEF_ERR(RK_ID_IVS, RK_ERR_LEVEL_ERROR, RK_ERR_BADADDR) 123 124 #ifdef __cplusplus 125 #if __cplusplus 126 } 127 #endif 128 #endif /* End of #ifdef __cplusplus */ 129 130 #endif /* End of #ifndef INCLUDE_RT_MPI_RK_COMM_IVS_H_ */ 131 132 133