VVAS C API Reference¶
Common APIs¶
VVAS Common APIs¶
VVAS Common APIs
This file contains common structures, enumerations and method declarations for VVAS core libraries.
-
enum VvasReturnType¶
Enum representing VVAS core APIs’ return type
Constants
VVAS_RET_ALLOC_ERRORMemory allocation error
VVAS_RET_INVALID_ARGSInvalid arguments to APIs
VVAS_RET_ERRORGeneric error
VVAS_RET_SUCCESSSuccess
VVAS_RET_EOSEnd of stream
VVAS_RET_SEND_AGAINCall the API without changing arguments
VVAS_RET_NEED_MOREDATACore APIs need more data to complete a specific operation
VVAS_RET_CAPS_CHANGEDCapabilities changed
Note
Negative number represents error and positive number is not an error
-
enum VvasDataSyncFlags¶
Flags to synchronize data between host and FPGA device
Constants
VVAS_DATA_SYNC_NONENo DMA Synchronization required
VVAS_DATA_SYNC_FROM_DEVICESynchronize data from device to host
VVAS_DATA_SYNC_TO_DEVICESynchronize data from host to device
Description
Data will be synchronized from device to host or host to device via DMA operation. Here host is an x86 machine and device is an FPGA device
-
enum VvasDataMapFlags¶
Flags used while mapping memory
Constants
VVAS_DATA_MAP_NONEDefault flag
VVAS_DATA_MAP_READMap memory in read mode
VVAS_DATA_MAP_WRITEMap memory in write mode
Description
Memory flags used while mapping underlying memory to user space
-
enum VvasAllocationType¶
Enum representing VVAS allocation type
Constants
VVAS_ALLOC_TYPE_UNKNOWNUnknown allocation type
VVAS_ALLOC_TYPE_CMAPhysically contiguous Memory will be allocated by backend drivers (i.e XRT)
VVAS_ALLOC_TYPE_NON_CMAMemory will be allocated using malloc API
-
enum VvasAllocationFlags¶
Enum representing VVAS allocation flags. Can be extended in future.
Constants
VVAS_ALLOC_FLAG_UNKNOWNUnknown allocation type
VVAS_ALLOC_FLAG_NONETo create memory both on FPGA device and host. This is the default option
-
struct VvasAllocationInfo¶
Structure to store information related memory allocation
Definition
struct VvasAllocationInfo {
uint8_t mbank_idx;
VvasAllocationType alloc_type;
VvasAllocationFlags alloc_flags;
VvasDataMapFlags map_flags;
VvasDataSyncFlags sync_flags;
};
Members
mbank_idxIndex of the Memory bank from which memory is allocated
alloc_typeMemory allocation type
enum VvasAllocationTypealloc_flagsFlags used to allocate memory
enum VvasAllocationFlagsmap_flagsFlags to indicate current mapping type
enum VvasDataMapFlagssync_flagsFlags which represents data synchronization requirement enum VvasDataSyncFlags
-
struct VvasMetadata¶
Structure to store frame metadata
Definition
struct VvasMetadata {
uint64_t pts;
uint64_t dts;
uint64_t duration;
};
Members
ptsPresentation timestamp
dtsDecoding timestamp
durationDuration of the frame
-
enum VvasFontType¶
Fonts supported by VVAS core
Constants
VVAS_FONT_HERSHEY_SIMPLEXNormal size sans-serif font
VVAS_FONT_HERSHEY_PLAINSmall size sans-serif font
VVAS_FONT_HERSHEY_DUPLEXNormal size sans-serif font (more complex than VVAS_FONT_HERSHEY_SIMPLEX)
VVAS_FONT_HERSHEY_COMPLEXNormal size serif font
VVAS_FONT_HERSHEY_TRIPLEXNormal size serif font (more complex than VVAS_FONT_HERSHEY_COMPLEX)
VVAS_FONT_HERSHEY_COMPLEX_SMALLSmaller version of VVAS_FONT_HERSHEY_COMPLEX
Device Context APIs¶
VVAS Context APIs
This file contains context related structures and method declarations for VVAS core libraries.
-
struct VvasContext¶
Holds a context related to a device
Definition
struct VvasContext {
int32_t dev_idx;
char *xclbin_loc;
vvasDeviceHandle dev_handle;
uuid_t uuid;
VvasLogLevel log_level;
};
Members
dev_idxDevice index to which current context belongs
xclbin_locxclbin location which is used to configure a device
dev_handleDevice Handle to which current context belongs to and having device index
VvasContext->dev_idxuuidUUID of xclbin
log_levelLoging level to be used by context
-
VvasContext *vvas_context_create(int32_t dev_idx, char *xclbin_loc, VvasLogLevel log_level, VvasReturnType *vret)¶
Opens device specified by dev_idx and download xclbin image on the same
Parameters
int32_t dev_idxIndex of the FPGA device. This can be -1 if no FPGA is present
char * xclbin_locLocation of xclbin to be downloaded on device index dev_idx. This can be NULL as well in case user does not want to access FPGA device
VvasLogLevel log_levelLogging level
VvasReturnType *vretAddress to store return value. In case of error, vret is useful in understanding the root cause
Description
User can create multiple contexts to a device with same xclbin. If user wish to create a context with different xclbin than the xclbin already configured on a FPGA device, he/she need to first destroy the old context with vvas_context_destroy() before creating new context. User shall provide valid dev_idx and xclbin_loc if there is a need to access FPGA device while calling this API. In case a vvas-core API doesn’t need to access any FPGA device, then device id must be -1 and xclbin_loc can be NULL
Return
Address of VvasContext on success
NULL on failure
-
VvasReturnType vvas_context_destroy(VvasContext *vvas_ctx)¶
Destroys device context
Parameters
VvasContext* vvas_ctxContext to device
Description
Before destroying the context, application should destroy modules which are using current context.
Return
Logging APIs¶
VVAS Logging APIs
This file contains logging function declaration and helper macros for core libraries to print log
-
enum VvasLogLevel¶
Log levels supported VVAS Core APIs
Constants
LOG_LEVEL_ERRORPrints ERROR logs
LOG_LEVEL_WARNINGPrints WARNING and ERROR logs
LOG_LEVEL_INFOPrints INFO, WARNING & ERROR logs
LOG_LEVEL_DEBUGPrints DEBUG, INFO, WARNING & ERROR logs
-
void vvas_log(uint32_t log_level, uint32_t set_log_level, const char *filename, const char *func, uint32_t line, const char *fmt, ...)¶
This function send logs to a destination based on environment variable value VVAS_CORE_LOG_FILE_PATH
Parameters
uint32_t log_levelLog level
uint32_t set_log_levelLog level to filter logs
const char *filenameSource code filename from which this logging is triggered
const char *funcSource code function name
uint32_t lineSource code line number
const char *fmtFormat string passed for logging.
...variable arguments
Description
- This API dumps logs based on VVAS_CORE_LOG_FILE_PATH environment variable like below:
if Valid path is set then logs will be stored in specified path.
if “CONSOLE” is set then logs will be routed to console.
if no value is set then logs will be routed to syslog
Note
It is recommended use macros LOG_ERROR/LOG_WARNING/LOG_INFO/LOG_DEBUG instead of calling this function to avoid sending multiple arguments
Return
None
Memory APIs¶
VVAS Memory APIs
This file contains structures and methods related VVAS memory.
-
VvasMemoryDataFreeCB¶
Typedef: Callback function to be called to free memory pointed by data, when VvasMemory handle is getting freed using vvas_memory_free() API.
Syntax
void VvasMemoryDataFreeCB (void *data, void *user_data)
Parameters
void *dataAddress of the data pointer
void *user_dataUser data pointer sent via vvas_memory_alloc_from_data() API
Return
None
-
struct VvasMemoryMapInfo¶
Stores information related to VvasMemory after mapping
Definition
struct VvasMemoryMapInfo {
uint8_t *data;
size_t size;
};
Members
dataPointer to memory which is mapped to user space using VvasDataMapFlags
sizeSize of the mapped memory
-
VvasMemory *vvas_memory_alloc(VvasContext *vvas_ctx, VvasAllocationType mem_type, VvasAllocationFlags mem_flags, uint8_t mbank_idx, size_t size, VvasReturnType *ret)¶
Allocates memory specified by size and other arguments passed to this API
Parameters
VvasContext *vvas_ctxAddress of VvasContext handle created using vvas_context_create()
VvasAllocationType mem_typeType of the memory need to be allocated
VvasAllocationFlags mem_flagsFlags of type
enum VvasAllocationFlagsuint8_t mbank_idxIndex of the memory bank on which memory need to be allocated
size_t sizeSize of the memory to be allocated.
VvasReturnType *retAddress to store return value. In case of error, ret is useful in understanding the root cause
Return
On Success, returns VvasMemory handle,
On Failure, returns NULL
-
VvasMemory *vvas_memory_alloc_from_data(VvasContext *vvas_ctx, uint8_t *data, size_t size, VvasMemoryDataFreeCB free_cb, void *user_data, VvasReturnType *ret)¶
Allocates VvasMemory handle from data pointer and size
Parameters
VvasContext *vvas_ctxAddress of VvasContext handle created using vvas_context_create()
uint8_t *dataPointer to data which needs to encapsulated in
struct VvasMemorysize_t sizeSize of the memory to which data pointer is pointing
VvasMemoryDataFreeCB free_cbCallback function to be called during vvas_memory_free() API.
void *user_dataUser defined data
VvasReturnType *retAddress to store return value. Upon case of error, ret is useful in understanding the root cause
Description
When application allocates memory and needs to send it to VVAS core APIs, this API is useful to wrap this memory pointer into VvasMemory handle.
Return
On Success, returns VvasMemory handle,
On Failure, returns NULL
-
void vvas_memory_free(VvasMemory *vvas_mem)¶
Frees the memory allocated by vvas_memory_alloc() API
Parameters
VvasMemory* vvas_memAddress of
struct VvasMemoryobject
Return
None
-
VvasReturnType vvas_memory_map(VvasMemory *vvas_mem, VvasDataMapFlags flags, VvasMemoryMapInfo *info)¶
Maps vvas_mem to user space using flags. Based on
VvasMemory->sync_flags, data will be synchronized between host and device.
Parameters
VvasMemory* vvas_memAddress of
struct VvasMemoryobjectVvasDataMapFlags flagsFlags used to map vvas_mem
VvasMemoryMapInfo *infoStructure which gets populated after mapping is successful
Return
-
VvasReturnType vvas_memory_unmap(VvasMemory *vvas_mem, VvasMemoryMapInfo *info)¶
Unmaps vvas_mem from user space
Parameters
VvasMemory* vvas_memAddress of
struct VvasMemoryobjectVvasMemoryMapInfo *infoMemory map information populated during vvas_memory_map() API
Return
-
void vvas_memory_set_metadata(VvasMemory *vvas_mem, VvasMetadata *meta_data)¶
Sets
VvasMetadatametadata onstruct VvasMemoryobject
Parameters
VvasMemory* vvas_memAddress of
struct VvasMemoryobjectVvasMetadata *meta_dataAddress of
struct VvasMetadatato be set on vvas_mem
Return
None
-
void vvas_memory_get_metadata(VvasMemory *vvas_mem, VvasMetadata *meta_data)¶
Gets
VvasMetadatametadata fromstruct VvasMemoryobject
Parameters
VvasMemory* vvas_memAddress of
struct VvasMemoryobjectVvasMetadata *meta_dataAddress of
struct VvasMetadatato be populated by this API .
Return
None
Video Common APIs¶
VVAS Video Common APIs
This file contains structures and methods related to VVAS Video Frame.
-
enum VvasCodecType¶
Codec types supported by VVAS Core APIs
Constants
VVAS_CODEC_UNKNOWNUnknown codec type
VVAS_CODEC_H264H264/AVC codec type
VVAS_CODEC_H265H265/HEVC codec type
-
enum VvasVideoFormat¶
Represents video color formats supported by VVAS core APIs
Constants
VVAS_VIDEO_FORMAT_UNKNOWNUnknown color format
VVAS_VIDEO_FORMAT_Y_UV8_420planar 4:2:0 YUV with interleaved UV plane
VVAS_VIDEO_FORMAT_RGBxPacked RGB, 4 bytes per pixel
VVAS_VIDEO_FORMAT_r210Packed 4:4:4 RGB, 10 bits per channel
VVAS_VIDEO_FORMAT_Y410Packed 4:4:4 YUV, 10 bits per channel
VVAS_VIDEO_FORMAT_BGRxPacked BGR, 4 bytes per pixel
VVAS_VIDEO_FORMAT_BGRAReverse rgb with alpha channel last
VVAS_VIDEO_FORMAT_RGBARGB with alpha channel last
VVAS_VIDEO_FORMAT_YUY2Packed 4:2:2 YUV (Y0-U0-Y1-V0, Y2-U2-Y3-V2 Y4…)
VVAS_VIDEO_FORMAT_NV16Planar 4:2:2 YUV with interleaved UV plane
VVAS_VIDEO_FORMAT_RGBRGB packed into 24 bits without padding
VVAS_VIDEO_FORMAT_v308Packed 4:4:4 YUV
VVAS_VIDEO_FORMAT_BGRBGR packed into 24 bits without padding
VVAS_VIDEO_FORMAT_I422_10LEPlanar 4:2:2 YUV, 10 bits per channel
VVAS_VIDEO_FORMAT_NV12_10LE3210-bit variant of GST_VIDEO_FORMAT_NV12, packed into 32bit words (MSB 2 bits padding)
VVAS_VIDEO_FORMAT_GRAY88-bit grayscale
VVAS_VIDEO_FORMAT_GRAY10_LE3210-bit grayscale, packed into 32bit words (2 bits padding)
VVAS_VIDEO_FORMAT_I420Planar 4:2:0 YUV
-
struct VvasVideoAlignment¶
Contains video alignment information
Definition
struct VvasVideoAlignment {
uint32_t padding_right;
uint32_t padding_left;
uint32_t padding_top;
uint32_t padding_bottom;
uint32_t stride_align[VVAS_VIDEO_MAX_PLANES];
};
Members
padding_rightPadding to the right
padding_leftPadding to the left
padding_topPadding to the top
padding_bottomPadding to the bottom
stride_alignExtra alignment requirement for strides (which is in bytes)
-
struct VvasVideoInfo¶
Contains infomation related to a video frame
Definition
struct VvasVideoInfo {
int32_t width;
int32_t height;
VvasVideoFormat fmt;
uint32_t n_planes;
size_t stride[VVAS_VIDEO_MAX_PLANES];
size_t elevation[VVAS_VIDEO_MAX_PLANES];
VvasVideoAlignment alignment;
};
Members
widthWidth of a video frame
heightHeight of a video frame
fmtVideo frame color format
n_planesNumber of planes in video frame color format
strideArray of stride values
elevationArray of elevation values
alignmentVideo frame’s alignment information
-
struct VvasVideoPlaneInfo¶
Structure contains information specific to a video frame plane
Definition
struct VvasVideoPlaneInfo {
uint8_t *data;
size_t size;
size_t offset;
int32_t stride;
int32_t elevation;
};
Members
dataPointer to a video frame plane data
sizeSize of a video plane
offsetOffset of the first valid data from the data pointer
strideStride of a video plane
elevationElevation (in height direction) of a video plane
-
struct VvasVideoFrameMapInfo¶
Structure contains information specific to a video frame after mapping operation
Definition
struct VvasVideoFrameMapInfo {
uint8_t nplanes;
size_t size;
int32_t width;
int32_t height;
VvasVideoFormat fmt;
VvasVideoAlignment alignment;
VvasVideoPlaneInfo planes[VVAS_VIDEO_MAX_PLANES];
};
Members
nplanesNumber of planes in a video frame
sizeVideo frame size
widthWidth of the mapped video frame
heightHeight of the mapped video frame
fmtVideo frame color format
alignmentVideo frame’s Alignment information
planesArray containing video plane specific information
-
VvasVideoFrameDataFreeCB¶
Typedef: Callback function to be called to free memory pointed by data, when VvasMemory handle is getting freed using vvas_video_frame_free() API.
Syntax
void VvasVideoFrameDataFreeCB (void *data[VVAS_VIDEO_MAX_PLANES], void *user_data)
Parameters
void *data[VVAS_VIDEO_MAX_PLANES]Array of data pointers to video planes
void *user_dataUser data pointer sent via vvas_video_frame_alloc_from_data() API
Return
None
-
VvasVideoFrame *vvas_video_frame_alloc(VvasContext *vvas_ctx, VvasAllocationType alloc_type, VvasAllocationFlags alloc_flags, uint8_t mbank_idx, VvasVideoInfo *vinfo, VvasReturnType *ret)¶
Allocates memory based on VvasVideoInfo structure
Parameters
VvasContext *vvas_ctxAddress of VvasContext handle created using vvas_context_create()
VvasAllocationType alloc_typeType of the memory need to be allocated
VvasAllocationFlags alloc_flagsAllocation flags used to allocate video frame
uint8_t mbank_idxIndex of the memory bank on which memory need to be allocated
VvasVideoInfo *vinfoAddress of VvasVideoInfo which contains video frame specific information
VvasReturnType *retAddress to store return value. In case of error, ret is useful in understanding the root cause
Return
On success, returns VvasVideoFrame handle and
On failure, returns NULL
-
VvasVideoFrame *vvas_video_frame_alloc_from_data(VvasContext *vvas_ctx, VvasVideoInfo *vinfo, void *data[VVAS_VIDEO_MAX_PLANES], VvasVideoFrameDataFreeCB free_cb, void *user_data, VvasReturnType *ret)¶
Allocates memory based on data pointers provided by user
Parameters
VvasContext *vvas_ctxAddress of VvasContext handle created using vvas_context_create()
VvasVideoInfo *vinfoVideo information related a frame
void *data[VVAS_VIDEO_MAX_PLANES]Array of data pointers to each plane
VvasVideoFrameDataFreeCB free_cbPointer to callback function to be called when
struct VvasVideoFrameis freedvoid *user_dataUser data to be passed to callback function free_cb
VvasReturnType *retAddress to store return value. Upon case of error, ret is useful in understanding the root cause
Return
On success, returns
struct VvasVideoFramehandle andOn failure, returns NULL
-
VvasReturnType vvas_video_frame_map(VvasVideoFrame *vvas_vframe, VvasDataMapFlags map_flags, VvasVideoFrameMapInfo *info)¶
Maps vvas_vframe to user space using map_flags. Based on
struct VvasMemory->sync_flags, data will be synchronized between host and the device.
Parameters
VvasVideoFrame* vvas_vframeAddress of
struct VvasVideoFrameVvasDataMapFlags map_flagsFlags used to map vvas_vframe
VvasVideoFrameMapInfo *infoStructure which gets populated after mapping is successful
Return
-
VvasReturnType vvas_video_frame_unmap(VvasVideoFrame *vvas_vframe, VvasVideoFrameMapInfo *info)¶
Unmaps vvas_vframe which was mapped earlier
Parameters
VvasVideoFrame* vvas_vframeAddress of
struct VvasVideoFrameVvasVideoFrameMapInfo *infoPointer to information which was populated during vvas_video_frame_map() API
Return
-
void vvas_video_frame_free(VvasVideoFrame *vvas_vframe)¶
Frees the video frame allocated during vvas_video_frame_alloc() API
Parameters
VvasVideoFrame* vvas_vframeAddress of
struct VvasVideoFrame
Return
None
-
void vvas_video_frame_set_metadata(VvasVideoFrame *vvas_mem, VvasMetadata *meta_data)¶
Sets metadata on VvasVideoFrame
Parameters
VvasVideoFrame* vvas_memAddress of
struct VvasVideoFrameVvasMetadata *meta_dataAddress of
struct VvasMetadatato be set on vvas_mem
Return
None
-
void vvas_video_frame_get_metadata(VvasVideoFrame *vvas_mem, VvasMetadata *meta_data)¶
Gets metadata on VvasVideoFrame
Parameters
VvasVideoFrame* vvas_memAddress of
struct VvasVideoFrameVvasMetadata *meta_dataAddress of
struct VvasMetadatato store metadata from vvas_mem
Return
None
-
void vvas_video_frame_get_videoinfo(VvasVideoFrame *vvas_mem, VvasVideoInfo *vinfo)¶
Gets video frame information from VvasVideoFrame
Parameters
VvasVideoFrame* vvas_memAddress of
struct VvasVideoFrameVvasVideoInfo *vinfoVideo frame information of
struct VvasVideoInfo
Return
None
DPU Common APIs¶
VVAS Dpu Infer Common APIs
This file contains common structures for inference classes.
-
enum VvasClass¶
enum to define all supported model classes
Constants
VVAS_XCLASS_YOLOV3YOLOV3
VVAS_XCLASS_FACEDETECTFACEDETECT
VVAS_XCLASS_CLASSIFICATIONCLASSIFICATION
VVAS_XCLASS_VEHICLECLASSIFICATIONVEHICLECLASSIFICATION
VVAS_XCLASS_SSDSSD
VVAS_XCLASS_REIDREID
VVAS_XCLASS_REFINEDETREFINEDET
VVAS_XCLASS_TFSSDTFSSD
VVAS_XCLASS_YOLOV2YOLOV2
VVAS_XCLASS_SEGMENTATIONSEGMENTATION
VVAS_XCLASS_PLATEDETECTPLATEDETECT
VVAS_XCLASS_PLATENUMPLATENUM
VVAS_XCLASS_POSEDETECTPOSEDETECT
VVAS_XCLASS_BCCBCC
VVAS_XCLASS_EFFICIENTDETD2EFFICIENTDETD2
VVAS_XCLASS_FACEFEATUREFACEFEATURE
VVAS_XCLASS_FACELANDMARKFACELANDMARK
VVAS_XCLASS_ROADLINEROADLINE
VVAS_XCLASS_ULTRAFASTULTRAFAST
VVAS_XCLASS_RAWTENSORRAWTENSOR
VVAS_XCLASS_NOTFOUNDUNKNOWN
Infer Classification APIs¶
VVAS Infer Classification APIs
This file contains data type and API declarations for Infer classification operations.
-
struct VvasColorInfo¶
Contains information for color of the detected object
Definition
struct VvasColorInfo {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
};
Members
redR color component
greenG color component
blueB color component
alphaTransparency
-
struct VvasInferClassification¶
Contains information on classification for each object
Definition
struct VvasInferClassification {
uint64_t classification_id;
int32_t class_id;
double class_prob;
char* class_label;
int32_t num_classes;
double* probabilities;
char** labels;
VvasColorInfo label_color;
};
Members
classification_idA unique id associated to this classification
class_idThe numerical id associated to the assigned class
class_probThe resulting probability of the assigned class. Typically ranges between 0 and 1
class_labelThe label associated to this class or NULL if not available
num_classesThe total number of classes of the entire prediction
probabilitiesThe entire array of probabilities of the prediction
labelsThe entire array of labels of the prediction. NULL if not available
label_colorThe color of labels
-
VvasInferClassification *vvas_inferclassification_new(void)¶
This function allocates new memory for VvasInferClassification
Parameters
voidno arguments
Return
On Success returns address of the new object of VvasInferClassification.
On Failure returns NULL
-
void vvas_inferclassification_free(VvasInferClassification *self)¶
This function deallocates memory associated with VvasInferClassification object
Parameters
VvasInferClassification *selfAddress of the object handle to be freed
Return
none.
-
VvasInferClassification *vvas_inferclassification_copy(const VvasInferClassification *self)¶
This function creates a new copy of VvasInferClassification object
Parameters
const VvasInferClassification *selfAddress of context handle
Return
On Success returns address of the new object of VvasInferClassification.
On Failure returns NULL
-
char *vvas_inferclassification_to_string(VvasInferClassification *self, int level)¶
This function creates a string of classifications
Parameters
VvasInferClassification * selfAddress of VvasInferenceClassification
int levelLevel of inference prediction
User has to free this memory
Return
Returns a string with all classifications serialized.
Infer Prediction APIs¶
VVAS Infer Prediction APIs
This file contains data type and API declarations for Inference operations.
-
struct VvasBoundingBox¶
Contains information for box data for detected object
Definition
struct VvasBoundingBox {
int32_t x;
int32_t y;
uint32_t width;
uint32_t height;
VvasColorInfo box_color;
};
Members
xhorizontal coordinate of the upper position in pixels
yvertical coordinate of the upper position in pixels
widthwidth of bounding box in pixels
heightheight of bounding box in pixels
box_colorbounding box color
-
struct Pointf¶
coordinate of point
Definition
struct Pointf {
float x;
float y;
};
Members
xhorizontal coordinate of the upper position in pixels
yvertical coordinate of the upper position in pixels
-
struct Pose14Pt¶
14 coordinate points to represented pose
Definition
struct Pose14Pt {
Pointf right_shoulder;
Pointf right_elbow;
Pointf right_wrist;
Pointf left_shoulder;
Pointf left_elbow;
Pointf left_wrist;
Pointf right_hip;
Pointf right_knee;
Pointf right_ankle;
Pointf left_hip;
Pointf left_knee;
Pointf left_ankle;
Pointf head;
Pointf neck;
};
Members
right_shoulderR_shoulder coordinate
right_elbowR_elbow coordinate
right_wristR_wrist coordinate
left_shoulderL_shoulder coordinate
left_elbowL_elbow coordinate
left_wristL_wrist coordinate
right_hipR_hip coordinate
right_kneeR_knee coordinate
right_ankleR_ankle coordinate
left_hipL_hip coordinate
left_kneeL_knee coordinate
left_ankleL_ankle coordinate
headHead coordinate
neckNeck coordinate
-
enum feature_type¶
Enum for holding type of feature
Constants
UNKNOWN_FEATUREUnknown feature
FLOAT_FEATUREFloat features
FIXED_FEATUREFixed point features
LANDMARKLandmark
ROADLINERoadlines
ULTRAFASTPoints from Ultrafast model
-
enum road_line_type¶
Enum for holding type of road line
Constants
BACKGROUNDBackground
WHITE_DOTTED_LINEWhite dotted line
WHITE_SOLID_LINEWhite solid line
YELLOW_LINEYellow line
-
struct Feature¶
The features of a road/person
Definition
struct Feature {
union {
float float_feature[VVAS_MAX_FEATURES];
int8_t fixed_feature[VVAS_MAX_FEATURES];
Pointf road_line[VVAS_MAX_FEATURES];
Pointf landmark[NUM_LANDMARK_POINT];
};
uint32_t line_size;
enum feature_type type;
enum road_line_type line_type;
};
Members
{unnamed_union}anonymous
float_featurefloat features
fixed_featurefixed features
road_linepoints for drawing road lanes
landmarkfive key points on a human face
line_sizeNumber of points in road_line
typeenum to hold type of feature
line_typeenum to hold type of road lane
-
struct Reid¶
Structure to gold reid model results
Definition
struct Reid {
uint32_t width;
uint32_t height;
uint64_t size;
uint64_t type;
void *data;
bool (*free) (void *);
bool (*copy) (const void *, void *);
};
Members
widthWidth of output image
heightHeight of output image
sizeSize of output
typeType of Reid
dataReid output data
freefunction pointer to free data
copyfunction pointer to copy data
-
enum seg_type¶
Enum for holding type of segmentation
Constants
SEMANTICSemantic
MEDICALMedical
SEG3D3D Segmentation
-
struct Segmentation¶
Structure for storing segmentation related information
Definition
struct Segmentation {
enum seg_type type;
uint32_t width;
uint32_t height;
char fmt[MAX_SEGOUTFMT_LEN];
void *data;
bool (*free) (void *);
bool (*copy) (const void *, void *);
};
Members
typeenum to hold type of segmentation
widthWidth of output image
heightHeight of output image
fmtSegmentation output format
dataSegmentation output data
freefunction pointer to free data
copyfunction pointer to copy data
-
struct TensorBuf¶
Structure for storing Tensor related information
Definition
struct TensorBuf {
int size;
void *ptr[20];
void *priv;
void (*free) (void **);
void (*copy) (void **, void **);
unsigned long int height;
unsigned long int width;
unsigned long int fmt;
atomic_int ref_count;
};
Members
sizeSize of output Tensors
ptrPointers to output Tensors
privPrivate structure
freefunction pointer to free data
copyfunction pointer to copy data
heightHeight of output image
widthWidth of output image
fmtFormat of output image
ref_countReference count
-
struct VvasInferPrediction¶
Contains Inference meta data information of a frame
Definition
struct VvasInferPrediction {
uint64_t prediction_id;
bool enabled;
VvasBoundingBox bbox;
VvasList* classifications;
VvasTreeNode *node;
bool bbox_scaled;
char *obj_track_label;
VvasClass model_class;
char *model_name;
int count;
Pose14Pt pose14pt;
Feature feature;
Reid reid;
Segmentation segmentation;
TensorBuf *tb;
};
Members
prediction_idA unique id for this specific prediction
enabledThis flag indicates whether or not this prediction should be used for further inference
bboxBouding box for this specific prediction
classificationslinked list to classifications
nodeAddress to tree data structure node
bbox_scaledbbox co-ordinates scaled to root node resolution or not
obj_track_labelTrack Label for the object
model_classModel class defined in vvas-core
model_nameModel name
countA number element, used by model which give output a number
pose14ptStruct of the result returned by the posedetect/openpose network
featureFeatures of a face/road
reidGetting feature from an image
segmentationSegmentation data
tbRawtensor data
-
VvasInferPrediction *vvas_inferprediction_new(void)¶
Allocate new memory for VvasInferPrediction
Parameters
voidno arguments
Return
On Success returns address of the new object instance of VvasInferPrediction.
On Failure returns NULL
-
void vvas_inferprediction_append(VvasInferPrediction *self, VvasInferPrediction *child)¶
Appends child node to parent node
Parameters
VvasInferPrediction *selfInstance of the parent node to which child node will be appended.
VvasInferPrediction *childInstance of the child node to be appended.
Return
none
-
VvasInferPrediction *vvas_inferprediction_copy(VvasInferPrediction *smeta)¶
This function will perform a deep copy of the given node
Parameters
VvasInferPrediction *smetaAddress of VvasInferPrediction instance to be copied
Return
On Success returns address of the new copied node.
On Failure returns NULL
-
void *vvas_inferprediction_node_copy(const void *infer, void *data)¶
This function is used to copy single node and also passed as param to node deep copy
Parameters
const void *inferVvasInferPrediction object will be passed while traversing to child nodes.
void *datauser data to be passed.
Return
On Success returns address of the new node.
On Failure returns NULL
-
void vvas_inferprediction_free(VvasInferPrediction *self)¶
This function deallocates memory for VvasInferPrediction
Parameters
VvasInferPrediction *selfAddress of the object handle to be freed
Return
none
-
char *vvas_inferprediction_to_string(VvasInferPrediction *self)¶
This function creates a string of predictions
Parameters
VvasInferPrediction * selfAddress of VvasInferPrediction
User has to free this memory.
Return
Returns a string with all predictions serialized.
-
uint64_t vvas_inferprediction_get_prediction_id(void)¶
This function generates unique prediction id
Parameters
voidno arguments
Return
Returns unique prediction id.
Parser APIs¶
Core APIs
Creating Parser Instance:
vvas_parser_create()Getting Stream Parameters (Decode input configuration) and Acces Unit Frame:
vvas_parser_get_au()Destroying Parser Instance:
vvas_parser_destroy()
Details of API and its parameter description
VVAS Parser APIs
This file contains prototypes for parsining and extracting access-unit(au) from avc/h264 or hevc/h265 elementary stream.
-
type VvasParser¶
Opaque handle to reference Parser instance.
-
struct VvasParserFrameInfo¶
Holds the parsed frame information.
Definition
struct VvasParserFrameInfo {
uint32_t bitdepth;
uint32_t codec_type;
uint32_t profile;
uint32_t level;
uint32_t height;
uint32_t width;
uint32_t chroma_mode;
uint32_t scan_type;
uint32_t frame_rate;
uint32_t clk_ratio;
};
Members
bitdepthNumber of bits each pixel is coded for say 8 bit or 10 bit.
codec_typeAVC(H264)/HEVC(H265) codec type.
profileAVC(H264)/HEVC(H265) profile.
levelAVC(H264)/HEVC(H265) level.
heightFrame height in pixel.
widthFrame width in pixel.
chroma_modeChroma sampling mode 444, 420 etc.
scan_typeScan type interlaced or progressive.
frame_rateFrame rate numerator.
clk_ratioFrame rate denominator.
-
VvasParser *vvas_parser_create(VvasContext *vvas_ctx, VvasCodecType codec_type, VvasLogLevel log_level)¶
Creates parser instance for processing the stream parsing.
Parameters
VvasContext* vvas_ctxDevice context handle pointer.
VvasCodecType codec_typeCodec type for which stream required to be parsed.
VvasLogLevel log_levelLog level to control the traces.
Context
This function will allocate internal resources and return the handle.
Return
VvasParser handle pointer on success.
NULL on failure.
-
VvasReturnType vvas_parser_get_au(VvasParser *handle, VvasMemory *inbuf, int32_t valid_insize, VvasMemory **outbuf, int32_t *offset, VvasDecoderInCfg **dec_cfg, bool is_eos)¶
This API is called to extract one complete encoded Access Unit/Frame from the input elementary stream buffer. It may be possible that there is partial AU in current input buffer. In this case this function will return VVAS_RET_NEED_MOREDATA indicating that parser need more data to extract the complete AU. In this case user needs to call this API several times with new elementary stream data to get complete AU. It is also possible that there is more than one AUs (access-units) in current input buffer. In this case this function will return the first complete AU in this buffer and the “offset” parameter will represent the amount of data consumed from the beginning of the current input buffer. To get remaining AUs in this buffer, this APIs must be called with same input buffer and “offset” received in previous call to this function, until this function returns either a new AU, VVAS_RET_NEED_MOREDATA or VVAS_RET_ERROR.
Parameters
VvasParser *handleVvasParser handle pointer.
VvasMemory *inbufInput data blob pointer (pointer to elementary stream buffer) to be parsed.
int32_t valid_insizeValid input data buffer size. The “inbuf” is allocated initially once based on the application requirements, like stream resolution, bitrate etc. Later on, this same buffer is re-sent with new data. For example, let’s assume “inbuf” size is 4K bytes at the beginning. As long as this buffer is completely carrying new data of 4K size, then “valid_insize” will be 4K. But towards the end of stream when the available new data is less than 4K bytes, say, it is 3K only, then “valid_insize” will be 3K even though the buffer size is 4K.
VvasMemory **outbufoutput VvasMemory pointer containing one encoded access-unit(au)/frame on success, else returns NULL.
int32_t *offsetThis is input as well as output parameter to this function. As an input to this function, this parameter indicates from which offset, from the beginning of the input buffer, the parser needs to start parsing. This is required when there are multiple AUs/Frames in the current input buffer. As an output, this parameter represents how much data, from the beginning of the current input buffer, has been consumed.
VvasDecoderInCfg **dec_cfgpointer to pointer of decoder configuration. Valid if there is change in stream properties with respect to previous properties else its value will be NULL.
bool is_eoswhether end of stream is reached. All of the input data blob should be consumed by the parser before setting this argument to TRUE. It should be sent as TRUE if earlier invocation of this API returned VVAS_RET_NEED_MOREDATA and there is no new data has been passed in this call.
Context
This function returns one encoded access-unit/frame in “outbuf”, if found. The “outbuf” is allocated by this function and it is the responsibility of application to free this memory once it has been consumed. This function also returns decoder configuration information in “dec_cfg” parameter along with first AU. In case the stream properties remain same, then “dec_cfg” will be NULL for the sub-sequent AUs. In case there is change in the stream properties which requires decoder re-configuration then decoder configuration information, “dec_cfg”, parameter will have new decoder configuration.
Return
VVAS_RET_SUCCESS on Success.
VVAS_RET_NEED_MOREDATA, If more data is needed to extract a complete Access Unit/frame.
VVAS_RET_ERROR on any other Failure.
-
VvasReturnType vvas_parser_destroy(VvasParser *handle)¶
Destroys parser instance
Parameters
VvasParser *handleParser handle pointer.
Context
This function will free internal resources and destroy handle.
Return
VVAS_RET_SUCCESS on Success.
VVAS_RET_ERROR on Failure.
Decoder APIs¶
Core APIs
Creating Decoder Instance:
vvas_decoder_create()Configuring Decoder and getting decoder’s output configuration:
vvas_decoder_config()Submit Parsed Frame and List of output video frames to the decoder:
vvas_decoder_submit_frames()Get Decoded frame from the Decoder:
vvas_decoder_get_decoded_frame()Destroy Decoder instance:
vvas_decoder_destroy()
Details of API and its parameter description
VVAS Decoder APIs
This file contains the public methods related to VVAS decoder. These functions can be used to implement decode of avc/h264 and hevc/h265 encoded stream(s). User need to pass one access-unit(au) at a time for decoding.
-
type VvasDecoder¶
Holds the reference to decoder instance.
-
struct VvasDecoderInCfg¶
Holds decoder input configuration
Definition
struct VvasDecoderInCfg {
uint32_t width;
uint32_t height;
uint32_t frame_rate;
uint32_t clk_ratio;
uint32_t codec_type;
uint32_t profile;
uint32_t level;
uint32_t bitdepth;
uint32_t chroma_mode;
uint32_t scan_type;
uint32_t splitbuff_mode;
uint32_t low_latency;
uint32_t entropy_buffers_count;
uint32_t i_frame_only;
};
Members
widthwidth of frame in pixel
heightHeight of frame in pixel
frame_rateFrame rate
clk_ratioClock Ratio
codec_typeCodec Type, AVC - 0 or HEVC - 1
profileEncoding profile
levelEncoding level
bitdepthBit depth of each pixel 8 or 10 bit
chroma_modeChroma Mode
scan_typeScan Type, Interlaced(0) or Progressive(1)
splitbuff_modeSplit Buffer Mode
low_latencyLow Latency, Disabled(0) or Enabled(1)
entropy_buffers_countNumber of Entropy Buffers
i_frame_onlyI frame only decode, Disabled(0) or Enabled(1)
-
struct VvasDecoderOutCfg¶
Holds the configuration information for decoder output
Definition
struct VvasDecoderOutCfg {
VvasVideoInfo vinfo;
uint32_t mem_bank_id;
uint32_t min_out_buf;
};
Members
vinfoVvasVideoInfo represents decoder output frame properties
mem_bank_idMemory bank on which video frame should be allocated
min_out_bufMinimum number of output buffers required for decoder
-
VvasDecoder *vvas_decoder_create(VvasContext *vvas_ctx, uint8_t *dec_name, VvasCodecType dec_type, uint8_t hw_instance_id, VvasLogLevel log_level)¶
Creates decoder’s instance handle
Parameters
VvasContext *vvas_ctxAddress of VvasContext handle created using vvas_context_create
uint8_t *dec_nameName of the decoder to be used for decoding
VvasCodecType dec_typeType of the decoder to be used (i.e. H264/H265)
uint8_t hw_instance_idDecoder instance index in a multi-instance decoder. Incase of V70, this represents HW instance index and can have any value from 0 to 3.
VvasLogLevel log_levelLogging level
Context
This function will allocate internal decoder resources and return the handle.
Return
VvasDecoder handle pointer on success.
NULL on failure.
-
VvasReturnType vvas_decoder_config(VvasDecoder *dec_handle, VvasDecoderInCfg *icfg, VvasDecoderOutCfg *ocfg)¶
Configures decoder with VvasDecoderInCfg and produces VvasDecoderOutCfg. Applications or parser can populate VvasDecoderInCfg
Parameters
VvasDecoder* dec_handleDecoder handle pointer
VvasDecoderInCfg *icfgDecoder input configuration
VvasDecoderOutCfg *ocfgDecoder output configuration
Context
This fucntion configures the decoder hardware for stream to be decoded. User need to allocate alteast suggested min_out_buf each with properties as in vinfo of ocfg. List if these allocated buffers are required to be passed to decoder in the fist invocation of function vvas_decoder_submit_frames along with the first access-unit.
Return
-
VvasReturnType vvas_decoder_submit_frames(VvasDecoder *dec_handle, VvasMemory *au, VvasList *loutframes)¶
Submits one Access Unit/Frame and free output buffers to decoder for decoding
Parameters
VvasDecoder* dec_handleDecoder handle pointer
VvasMemory *auComplete access unit/frame. send NULL pointer on End of stream
VvasList *loutframesList of free output frames for decoding process
Context
This function submits the encoded access-unit(au) and a list of
free output buffers. These output buffers are used by decoder to output decoded frames.
Once user has consumed the output buffer, then this free output buffer is sent back to
decoder in successive invocation. In first invocation of
this function user need to pass the list of atleast as many free outout buffers as
suggested in ocfg output parameter of vvas_decoder_config API. At the end of
stream, user need to pass au=NULL and drain/flush the decoder by calling
vvas_decoder_get_decoded_frame several times till we get VVAS_RET_EOS. User need to send free output buffers
to decoder even during the draining/flushing of remaining decoded frame.
Return
VVAS_RET_SUCCESS if success.
VVAS_RET_INVALID_ARGS if parameter is not valid or not in expeceted range.
VVAS_RET_SEND_AGAIN if nalu is not consumed completely. In this case, send same NALU again.
VVAS_RET_ERROR if any other errors.
-
VvasReturnType vvas_decoder_get_decoded_frame(VvasDecoder *dec_handle, VvasVideoFrame **output)¶
This API gets decoded frame from decoder
Parameters
VvasDecoder* dec_handleDecoder handle pointer
VvasVideoFrame **outputVideo frame which contains decoded data
Context
This function gives decoded frame if available, one at a time in each invocation. User need to keep calling this function until VVAS_RET_EOS is returned.
Return
VVAS_RET_SUCCESS on success.
VVAS_RET_EOS on End of stream.
VVAS_RET_NEED_MOREDATA if decoder need more data to produce any decoded frame.
VVAS_RET_INVALID_ARGS if parameter is not valid or not in expeceted range.
VVAS_RET_ERROR any other error.
-
VvasReturnType vvas_decoder_destroy(VvasDecoder *dec_handle)¶
Destroys decoded handle
Parameters
VvasDecoder* dec_handleDecoder handle pointer
Context
This function will free internal resources and destroy handle.
Return
VVAS_RET_SUCCESS on success.
VVAS_RET_ERROR on failure.
Scaler APIs/Pre-processing APIs¶
Core APIs
Create Scaler instance:
vvas_scaler_create()Adding processing channel into the Scaler:
vvas_scaler_channel_add()Processing all the added channels:
vvas_scaer_process_frame()Configuring Scaler:
vvas_scaler_prop_set()Destroy Scaler instance:
vvas_scaler_destroy()
Details of API and its parameter description
VVAS Scaler APIs
This file contains public methods and data structures related to VVAS scaler.
-
enum VvasScalerCoefLoadType¶
Enum for holding type of filter coefficients loading type
Constants
VVAS_SCALER_COEF_FIXEDFixed filter coefficients type
VVAS_SCALER_COEF_AUTO_GENERATEAuto generate filter coefficients type
-
enum VvasScalerMode¶
Enum for holding scaling modes.
Constants
VVAS_SCALER_MODE_BILINEARBilinear scaling mode
VVAS_SCALER_MODE_BICUBICBiCubic scaling mode
VVAS_SCALER_MODE_POLYPHASEPolyPhase scaling mode
-
enum VvasScalerType¶
Enum for holding scaling types.
Constants
VVAS_SCALER_DEFAULTDefault Scale Type
VVAS_SCALER_LETTERBOXLetterBox Scale which maintain aspect ratio
VVAS_SCALER_ENVELOPE_CROPPEDEnvelope scale and center cropped
-
enum VvasScalerHorizontalAlign¶
Enum for holding horizontal alignment options.
Constants
VVAS_SCALER_HORZ_ALIGN_CENTERCenter Alignment into output frame
VVAS_SCALER_HORZ_ALIGN_LEFTLeft Alignment into output frame
VVAS_SCALER_HORZ_ALIGN_RIGHTRight Alignment into output frame
-
enum VvasScalerVerticalAlign¶
Enum for holding vertical alignment options.
Constants
VVAS_SCALER_VERT_ALIGN_CENTERCenter Alignment into output frame
VVAS_SCALER_VERT_ALIGN_TOPTop Alignment into output frame
VVAS_SCALER_VERT_ALIGN_BOTTOMBottom Alignment into output frame
-
struct VvasScalerParam¶
Contains Information related to Scaler Parameters
Definition
struct VvasScalerParam {
VvasScalerType type;
VvasScalerHorizontalAlign horz_align;
VvasScalerVerticalAlign vert_align;
uint16_t smallest_side_num;
};
Members
typeScale Type
horz_alignHorizontal Alignment
vert_alignVertical Alignment
smallest_side_numSmallest side numerator to calculate scale ratio for envelope scale
-
enum VvasScalerFilterTaps¶
Enum for holding number of filter taps.
Constants
VVAS_SCALER_FILTER_TAPS_66 filter taps
VVAS_SCALER_FILTER_TAPS_88 filter taps
VVAS_SCALER_FILTER_TAPS_1010 filter taps
VVAS_SCALER_FILTER_TAPS_1212 filter taps
-
struct VvasScalerProp¶
Contains Scaler Properties.
Definition
struct VvasScalerProp {
VvasScalerCoefLoadType coef_load_type;
VvasScalerMode smode;
VvasScalerFilterTaps ftaps;
uint32_t ppc;
uint32_t mem_bank;
uint8_t n_fmts;
VvasVideoFormat supported_fmts[VVAS_SCALER_MAX_SUPPORT_FMT];
};
Members
coef_load_typeCoefficient loading type
smodeScaling mode
ftapsFilter taps
ppcPixel per clock
mem_bankMemory bank on which the internal buffers should be allocated
n_fmtsNumber of color formats supported by scaler
supported_fmtsArray of video formats supported by scaler (valid from 0 n_fmts-1)
-
enum VvasScalerFilterCoefType¶
Enum for holding filter coefficients type.
Constants
VVAS_SCALER_FILTER_COEF_SR13Scaling ration 1.3
VVAS_SCALER_FILTER_COEF_SR15Scaling ration 1.5
VVAS_SCALER_FILTER_COEF_SR2Scaling ration 2, 8 tap
VVAS_SCALER_FILTER_COEF_SR25Scaling ration 2.5
VVAS_SCALER_FILTER_COEF_TAPS_1010 tap
VVAS_SCALER_FILTER_COEF_TAPS_1212 tap
VVAS_SCALER_FILTER_COEF_TAPS_66 tap, Always used for up scale
-
struct VvasScalerRect¶
Contains Information related to frame region of interest.
Definition
struct VvasScalerRect {
VvasVideoFrame *frame;
uint16_t x;
uint16_t y;
uint16_t width;
uint16_t height;
};
Members
frameVvasVideoFrame
xX coordinate
yY coordinate
widthWidth of Rect
heightHeight of Rect
-
struct VvasScalerPpe¶
Contains Information related to Pre-processing parameters
Definition
struct VvasScalerPpe {
float mean_r;
float mean_g;
float mean_b;
float scale_r;
float scale_g;
float scale_b;
};
Members
mean_rPreProcessing parameter alpha/mean red channel value
mean_gPreProcessing parameter alpha/mean green channel value
mean_bPreProcessing parameter alpha/mean blue channel value
scale_rPreProcessing parameter beta/scale red channel value
scale_gPreProcessing parameter beta/scale green channel value
scale_bPreProcessing parameter beta/scale blue channel value
-
type VvasScaler¶
Opaque handle for the VvasScaler instance
-
VvasScaler *vvas_scaler_create(VvasContext *ctx, const char *kernel_name, VvasLogLevel log_level)¶
Creates Scaler’s instance.
Parameters
VvasContext * ctxVvasContext handle created using vvas_context_create
const char * kernel_nameScaler kernel name
VvasLogLevel log_levelLogging level
Return
On Success returns VvasScaler handle pointer, on Failure returns NULL
-
VvasReturnType vvas_scaler_channel_add(VvasScaler *hndl, VvasScalerRect *src_rect, VvasScalerRect *dst_rect, VvasScalerPpe *ppe, VvasScalerParam *param)¶
This API adds one processing channel configuration. One channel represents a set of operations, like resize, color space conversion, PPE etc. to be performed on the input buffer. Hardware Scaler may have alignment requirement. In such case this API will adjust x, y, width and height of src_rect and dst_rect. Adjusted values will be updated in the src_rect and dst_rect.
Parameters
VvasScaler * hndlVvasContext handle created using vvas_context_create
VvasScalerRect * src_rectSource Rect VvasScalerRect
VvasScalerRect * dst_rectDestination Rect VvasScalerRect
VvasScalerPpe * ppePreprocessing parameters VvasScalerPpe, NULL if no PPE is needed
VvasScalerParam * paramScaler type and Alignment parameters VvasScalerParam
Return
VvasReturnType
-
VvasReturnType vvas_scaler_process_frame(VvasScaler *hndl)¶
This API does processing of channels added using vvas_scaler_channel_add There can be multiple channels added to perform different operations on the input frame. All these operations are performed in context of this API call.
Parameters
VvasScaler * hndlVvasScaler handle pointer created using vvas_scaler_create
Return
VvasReturnType
-
VvasReturnType vvas_scaler_destroy(VvasScaler *hndl)¶
This API destroys the scaler instance created using vvas_scaler_create
Parameters
VvasScaler * hndlVvasScaler handle pointer created using vvas_scaler_create
Return
VvasReturnType
-
VvasReturnType vvas_scaler_set_filter_coef(VvasScaler *hndl, VvasScalerFilterCoefType coef_type, const int16_t tbl[VVAS_SCALER_MAX_PHASES][VVAS_SCALER_FILTER_TAPS_12])¶
This API can be used to overwrite default filter coefficients.
Parameters
VvasScaler * hndlVvasScaler handle pointer created using vvas_scaler_create
VvasScalerFilterCoefType coef_typeFilter coefficients type VvasScalerFilterCoefType
const int16_t tbl[VVAS_SCALER_MAX_PHASES][VVAS_SCALER_FILTER_TAPS_12]Filter coefficients, Reference of VVAS_SCALER_MAX_PHASESxVVAS_SCALER_FILTER_TAPS_12 array of short
Return
VvasReturnType
-
VvasReturnType vvas_scaler_prop_get(VvasScaler *hndl, VvasScalerProp *prop)¶
This API will fill current scaler properties. This API returns the default properties if called before setting these properties.
Parameters
VvasScaler * hndlVvasScaler handle pointer created using vvas_scaler_create. If hndl is null, then static configurations will be returned in prop by parsing scaler config file “/opt/xilinx/vvas/share/image_processing.cfg”
VvasScalerProp * propScaler properties VvasScalerProp
Return
VvasReturnType
-
VvasReturnType vvas_scaler_prop_set(VvasScaler *hndl, VvasScalerProp *prop)¶
This API is used to set properties of VvasScaler
Parameters
VvasScaler * hndlVvasScaler handle pointer created using vvas_scaler_create
VvasScalerProp * propScaler properties VvasScalerProp
Return
VvasReturnType
Inference APIs¶
Core APIs
Create DPU instance:
vvas_dpuinfer_create()Get DPU configuration:
vvas_dpuinfer_get_config()Do inferencing:
vvas_dpuinfer_process_frames()Destroy DPU instance:
vvas_dpuinfer_destroy()
Details of API and its parameter description
VVAS DPU Infer APIs
This file contains structures and methods related to VVAS Inference.
-
struct VvasDpuInferConf¶
Contains information related to model and configurable parameters
Definition
struct VvasDpuInferConf {
char * model_path;
char * model_name;
VvasVideoFormat model_format;
char * modelclass;
unsigned int batch_size;
bool need_preprocess;
bool performance_test;
unsigned int objs_detection_max;
char **filter_labels;
int num_filter_labels;
bool float_feature;
VvasVideoFormat segoutfmt;
int segoutfactor;
};
Members
model_pathModel path
model_nameModel name
model_formatColor format of the input image, like BGR, RGB etc., expected by the model
modelclassModel class
batch_sizeBatch size
need_preprocessIf this is set to true, then software pre-processing will be performed using Vitis-AI library
performance_testPerformance test
objs_detection_maxSort the detected objects based on area of the bounding box, from highest to lowest area.
filter_labelsArray of labels to process
num_filter_labelsNumber of labels to process
float_featureFloat feature
segoutfmtSegmentation output format
segoutfactorMultiplication factor for Y8 output to look bright
-
struct VvasModelConf¶
Contains information related to model requirements
Definition
struct VvasModelConf {
int model_width;
int model_height;
unsigned int batch_size;
float mean_r;
float mean_g;
float mean_b;
float scale_r;
float scale_g;
float scale_b;
};
Members
model_widthModel required width
model_heightModel required height
batch_sizeModel supported batch size
mean_rMean value of R channel
mean_gMean value of G channel
mean_bMean value of B channel
scale_rScale value of R channel
scale_gScale value of G channel
scale_bScale value of B channel
-
type VvasDpuInfer¶
Holds the reference to dpu instance.
-
VvasDpuInfer *vvas_dpuinfer_create(VvasDpuInferConf *dpu_conf, VvasLogLevel log_level)¶
Initializes DPU with config parameters and allocates DpuInfer instance
Parameters
VvasDpuInferConf * dpu_confVvasDpuInferConf structure.
VvasLogLevel log_levelVvasLogLevel enum.
This instance must be freed using vvas_dpuinfer_destroy.
Return
On Success returns VvasDpuInfer handle.
On Failure returns NULL.
-
VvasReturnType vvas_dpuinfer_process_frames(VvasDpuInfer *dpu_handle, VvasVideoFrame *inputs[MAX_NUM_OBJECT], VvasInferPrediction *predictions[MAX_NUM_OBJECT], int batch_size)¶
This API processes frames in a batch.
Parameters
VvasDpuInfer * dpu_handleVvasDpuInfer handle created using vvas_dpuinfer_create.
VvasVideoFrame *inputs[MAX_NUM_OBJECT]Array of VvasVideoFrame
VvasInferPrediction *predictions[MAX_NUM_OBJECT]Array of VvasInferPrediction. MAX_NUM_OBJECT is defined as 512.
int batch_sizeBatch size.
This API returns VvasInferPrediction to each frame. It is user’s responsibility to free the VvasInferPrediction of each frame.
Return
VvasReturnType
-
VvasReturnType vvas_dpuinfer_destroy(VvasDpuInfer *dpu_handle)¶
De-initialises the model and free all other resources allocated
Parameters
VvasDpuInfer * dpu_handleVvasDpuInfer handle created using vvas_dpuinfer_create.
Return
VvasReturnType
-
VvasReturnType vvas_dpuinfer_get_config(VvasDpuInfer *dpu_handle, VvasModelConf *model_conf)¶
Returns the VvasModelConf structure with all fields populated
Parameters
VvasDpuInfer * dpu_handleVvasDpuInfer handle created using vvas_dpuinfer_create.
VvasModelConf *model_confVvasModelConf structure
Return
VvasReturnType
Inference Post-processing APIs¶
VVAS Post-processing APIs
This file contains structures and methods related to VVAS inference.
-
type VvasPostProcessor¶
Holds the reference to post-processing instance.
-
struct VvasPostProcessConf¶
Contains information related to post-processing library configurable parameters
Definition
struct VvasPostProcessConf {
char * model_path;
char * model_name;
};
Members
model_pathModel path
model_nameModel name
-
VvasPostProcessor *vvas_postprocess_create(VvasPostProcessConf *postproc_conf, VvasLogLevel log_level)¶
Upon success initializes post-processor instance with config parameters.
Parameters
VvasPostProcessConf * postproc_confVvasPostProcessConf structure.
VvasLogLevel log_levelVvasLogLevel enum.
This instance must be freed using vvas_postprocess_destroy.
Return
On Success returns VvasPostProcessor handle.
On Failure returns NULL.
-
VvasInferPrediction *vvas_postprocess_tensor(VvasPostProcessor *postproc_handle, VvasInferPrediction *src)¶
Parameters
VvasPostProcessor * postproc_handlepost-processing handle created using vvas_postprocess_create.
VvasInferPrediction *srcPointer to VvasInferPrediction containing rawtensors.
Return
VvasInferPrediction tree with post-processed results
-
VvasReturnType vvas_postprocess_destroy(VvasPostProcessor *postproc_handle)¶
Free all resources allocated
Parameters
VvasPostProcessor * postproc_handlepost-processing handle created using vvas_postprocess_create.
Return
VvasReturnType
Tracker APIs¶
VVAS Tracker APIs
This file contains public methods and data structures related to VVAS Tracker.
-
enum VvasTrackerAlgoType¶
Enum representing tracker algorithm type
Constants
TRACKER_ALGO_IOUIntersection-Over-Union algorithm
TRACKER_ALGO_MOSSEMinimum Output Sum of Squared Error algorithm
TRACKER_ALGO_KCFKernelized Correlation Filter algorithm
TRACKER_ALGO_NONENo Algorithm is specified. TRACKER_ALGO_KCF will be set as default algorithm.
-
enum VvasTrackerMatchColorSpace¶
Enum representing color space used for object matching
Constants
TRACKER_USE_RGBUse RGB color space for object matching
TRACKER_USE_HSVUse HSV (Hue-Saturation-Value) color space for object matching.
-
enum VvasTrackerSearchScale¶
Enum representing search scales to be used for tracking
Constants
SEARCH_SCALE_ALLSearch for object both in up, same and down scale
SEARCH_SCALE_UPSearch for object in up and same scale only
SEARCH_SCALE_DOWNSearch for object in down and same scale only
SEARCH_SCALE_NONESearch for in same scale
-
struct VvasTrackerconfig¶
Structure to hold tracker configuration
Definition
struct VvasTrackerconfig {
VvasTrackerAlgoType tracker_type;
bool iou_use_color;
VvasTrackerMatchColorSpace obj_match_color;
VvasTrackerSearchScale search_scales;
unsigned int fet_length;
unsigned int min_width;
unsigned int min_height;
unsigned int max_width;
unsigned int max_height;
int num_inactive_frames;
int num_frames_confidence;
float padding;
float obj_match_search_region;
float dist_correlation_threshold;
float dist_overlap_threshold;
float dist_scale_change_threshold;
float dist_correlation_weight;
float dist_overlap_weight;
float dist_scale_change_weight;
float occlusion_threshold;
float confidence_score;
bool skip_inactive_objs;
};
Members
tracker_typeTracker algorithm to be used 0:IOU 1:KCF Tracker 2:MOSSE Tracker
iou_use_colorTo use color information for matching or not duirng IOU tracking
obj_match_colorColor space to be used for object matching
search_scalesSearch scales of object during tracking
fet_lengthFeature length to be used during KCF based tracking
min_widthMinimum width for considering as noise
min_heightMinimum height for considering as noise
max_widthMaximum width for considering as noise
max_heightMaximum height for considering as noise
num_inactive_framesNumber of frames wait for object reappearing before consider as inactive
num_frames_confidenceNumber of frames of continuous detection before considering for tracking and assiging an ID
paddingExtra area surrounding the target to search in tracking
obj_match_search_regionSearch for nearest object to match
dist_correlation_thresholdObjects correlation threshold
dist_overlap_thresholdObjects overlap threshold
dist_scale_change_thresholdOjbects scale change threshold
dist_correlation_weightWeightage for correlation in distance function
dist_overlap_weightWeightage for overlap in distance function
dist_scale_change_weightWeightage for scale change in distance function
occlusion_thresholdOcclusion threshold to ignore objects for tracking
confidence_scoreTracker confidence threshold for tracking
skip_inactive_objsFlag to enable skipping of inactive object
-
VvasTracker *vvas_tracker_create(VvasContext *vvas_ctx, VvasTrackerconfig *config)¶
initializes tracker with config parameters and allocates required memory
Parameters
VvasContext *vvas_ctxPointer VvasContext handle.
VvasTrackerconfig *configPointer to VvasTrackerConfig structure.
Return
On Success returns ref VvasTracker handle. On Failure returns NULL.
-
VvasReturnType vvas_tracker_process(VvasTracker *vvas_tracker_hndl, VvasVideoFrame *pFrame, VvasInferPrediction **infer_meta)¶
Called for every frames with or without detection information for tracking objects in a frame.
Parameters
VvasTracker *vvas_tracker_hndlref VvasTracker with newly detected objects in VvasTracker:new_objs. Upon tracking updates ref VvasTracker:trk_objs with tracked objects info.
VvasVideoFrame *pFrameref VvasVideoFrame structure of input frame.
VvasInferPrediction **infer_metaref VvasInferPrediction contains detection tree if detection info available else NULL.
Return
ref VvasReturnType.
-
bool vvas_tracker_destroy(VvasTracker *vvas_tracker_hndl)¶
free memory allocated during creating the tracker and resets parameters to default values
Parameters
VvasTracker *vvas_tracker_hndlPointer to ref VvasTracker
Return
True on success. False on failure.
Meta Convert APIs¶
Core APIs
Create MetaConvert instance:
vvas_metaconvert_create()Convert DPU detected data to Overlay data format:
vvas_metaconvert_prepare_overlay_metadata()Destroy MetaConvert instance:
vvas_metaconvert_destroy()
Details of API and its parameter description
VVAS Metaconvert APIs
This file contains functions to covert different type of infer metadata to overlay metadata.
-
struct VvasRGBColor¶
Holds RGB color values
Definition
struct VvasRGBColor {
uint8_t red;
uint8_t green;
uint8_t blue;
};
Members
redRed component value
greenGreen component value
blueBlue component value
-
struct VvasFilterObjectInfo¶
Information about objects to be filtered from a list
Definition
struct VvasFilterObjectInfo {
char name[META_CONVERT_MAX_STR_LENGTH];
VvasRGBColor color;
uint8_t do_mask;
};
Members
nameName of object to be considered for processing by metaconvert
colorColor components to be applied on the object
do_maskIf set, masking will be done on this object
-
struct VvasMetaConvertConfig¶
Configuration to be supplied by the user
Definition
struct VvasMetaConvertConfig {
VvasFontType font_type;
float font_size;
int32_t line_thickness;
int32_t radius;
uint8_t level;
uint8_t mask_level;
uint32_t y_offset;
bool draw_above_bbox_flag;
VvasRGBColor text_color;
char **allowed_labels;
uint32_t allowed_labels_count;
VvasFilterObjectInfo **allowed_classes;
uint32_t allowed_classes_count;
};
Members
font_typeFont type
enum VvasFontTypefont_sizeFont size
line_thicknessLine thickness while drawing rectangles or lines
radiusCircle/point radius
levelPrepare VvasOverlayShapeInfo from nodes present in specific level only. With level = 0, displays all nodes information
mask_levelApply masking at specific level
y_offsetY-axis offset while displaying text
draw_above_bbox_flagFlag to draw text above or inside bounding box. In case x and y position are zero draws inside frame left top corner
text_colorColor values to be used to display text
allowed_labelsList of labels from VvasInferPrediction to be considered while creating text. If allowed_labels is NULL, then all possible VvasInferPrediction labels are allowed
allowed_labels_countCount of the filter_labels array
allowed_classesConsider only specific classes and respective color while preparing
struct VvasOverlayShapeInfoallowed_classes_countCount of the allowed_classes array
-
VvasMetaConvert *vvas_metaconvert_create(VvasContext *vvas_ctx, VvasMetaConvertConfig *cfg, VvasLogLevel log_level, VvasReturnType *ret)¶
Creates VvasMetaConvert handle based on cfg
Parameters
VvasContext *vvas_ctxHandle to VVAS context
VvasMetaConvertConfig *cfgHandle to
struct VvasMetaConvertConfigVvasLogLevel log_levelLog level to be used to dump metaconvert logs
VvasReturnType *retAddress to store return value. In case of error, ret is useful in understanding the root cause
Return
Handle to VvasMetaConvert
-
VvasReturnType vvas_metaconvert_prepare_overlay_metadata(VvasMetaConvert *meta_convert, VvasTreeNode *parent, VvasOverlayShapeInfo *shape_info)¶
Converts Inference prediction tree to structure which can be understood by overlay module
Parameters
VvasMetaConvert *meta_convertHandle to VVAS Meta convert
VvasTreeNode *parentHandle to parent node of Inference prediction tree
VvasOverlayShapeInfo *shape_infoHandle to overlay information which will be used overlay module to draw bounding box
Return
-
void vvas_metaconvert_destroy(VvasMetaConvert *meta_convert)¶
Destorys
struct VvasMetaConverthandle
Parameters
VvasMetaConvert *meta_convertHandle to VVAS Meta convert
Return
None
Overlay APIs¶
Core APIs
Draw Infer data onto the Video:
vvas_overlay_process_frame()
Details of API and its parameter description
VVAS Overlay Shape Info APIs
This file contains public methods and data structures related to VVAS Overlay Shape Info.
-
enum VvasOverlayArrowDirection¶
Structure representing Arrow Direction information
Constants
ARROW_DIRECTION_STARTSTART
ARROW_DIRECTION_ENDEND
ARROW_DIRECTION_BOTH_ENDSBOTH_ENDS
-
struct VvasOverlayCoordinates¶
Structure representing Coordinate information
Definition
struct VvasOverlayCoordinates {
int32_t x;
int32_t y;
};
Members
xx offset
yy offset
-
struct VvasOverlayColorData¶
Structure representing Color information
Definition
struct VvasOverlayColorData {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
};
Members
redred value
greengreen value
blueblue value
alphaalpha value
-
struct VvasOverlayFontData¶
Structure representing Font information
Definition
struct VvasOverlayFontData {
uint32_t font_num;
float font_size;
VvasOverlayColorData font_color;
};
Members
font_numfont style number from openCV
font_sizefont size
font_colorfont color
-
struct VvasOverlayRectParams¶
Structure representing information to draw rectangle on frame.
Definition
struct VvasOverlayRectParams {
VvasOverlayCoordinates points;
uint32_t width;
uint32_t height;
uint32_t thickness;
uint32_t apply_bg_color;
VvasOverlayColorData rect_color;
VvasOverlayColorData bg_color;
};
Members
pointsframe coordinate info
widthwidth of the rectangle
heightheight of the rectangle
thicknessthickness of rectangle
apply_bg_colorflag to apply bg color
rect_colorcolor information of rectangle
bg_colorcolor information of background
-
struct VvasOverlayTextParams¶
Structure representing Text information
Definition
struct VvasOverlayTextParams {
VvasOverlayCoordinates points;
char *disp_text;
uint32_t bottom_left_origin;
uint32_t apply_bg_color;
VvasOverlayFontData text_font;
VvasOverlayColorData bg_color;
};
Members
pointstext coordinate info
disp_textdisplay text
bottom_left_origindisplay text position
apply_bg_colordisplay text background color
text_fontdisplay text font
bg_colorbackground color information
-
struct VvasOverlayLineParams¶
Structure representing Line information
Definition
struct VvasOverlayLineParams {
VvasOverlayCoordinates start_pt;
VvasOverlayCoordinates end_pt;
uint32_t thickness;
VvasOverlayColorData line_color;
};
Members
start_ptline start coordinate info
end_ptline end coordinate info
thicknessThickness in units of Pixels
line_colorcolor information
-
struct VvasOverlayArrowParams¶
Structure representing Arrow information
Definition
struct VvasOverlayArrowParams {
VvasOverlayCoordinates start_pt;
VvasOverlayCoordinates end_pt;
VvasOverlayArrowDirection arrow_direction;
uint32_t thickness;
float tipLength;
VvasOverlayColorData line_color;
};
Members
start_ptarrow start coordinate info
end_ptarrow end coordinate info
arrow_directionarrow direction
thicknessthickness in units of Pixels
tipLengthtip length
line_colorcolor information
-
struct VvasOverlayCircleParams¶
Structure representing Circle Information
Definition
struct VvasOverlayCircleParams {
VvasOverlayCoordinates center_pt;
uint32_t thickness;
uint32_t radius;
VvasOverlayColorData circle_color;
};
Members
center_ptcircle coordinate info
thicknesscircle thickness
radiuscircle radius
circle_colorcolor information
-
struct VvasOverlayPolygonParams¶
Structure representing Polygon information
Definition
struct VvasOverlayPolygonParams {
VvasList *poly_pts;
uint32_t thickness;
int32_t num_pts;
VvasOverlayColorData poly_color;
};
Members
poly_ptspolygon coordinate info
thicknesspolygon thickness
num_ptsnumber of points
poly_colorpolygon color information
-
struct VvasOverlayShapeInfo¶
Structure representing Overlay Shape information
Definition
struct VvasOverlayShapeInfo {
uint32_t num_rects;
uint32_t num_text;
uint32_t num_lines;
uint32_t num_arrows;
uint32_t num_circles;
uint32_t num_polys;
VvasList *rect_params;
VvasList *text_params;
VvasList *line_params;
VvasList *arrow_params;
VvasList *circle_params;
VvasList *polygn_params;
};
Members
num_rectsnumber of rectangles to be displayed
num_textnumber of texts to be displayed
num_linesnumber of lines to be displayed
num_arrowsnumber of arrows to be displayed
num_circlesnumber of circles to be displayed
num_polysnumber of polygons to be displayed
rect_paramsrectangle information
text_paramstext meta information
line_paramsline meta information
arrow_paramsarrow meta information
circle_paramscircle meta information
polygn_paramspolygon meta information
-
void vvas_overlay_shape_info_init(VvasOverlayShapeInfo *shape_info)¶
Initializes shape_info parameters
Parameters
VvasOverlayShapeInfo *shape_infoPointer to shape info structure
Return
none
-
void vvas_overlay_shape_info_copy(VvasOverlayShapeInfo *dest_shape_info, VvasOverlayShapeInfo *src_shape_info)¶
Copies shape information from src to dst
Parameters
VvasOverlayShapeInfo *dest_shape_infoDestination shape info structure
VvasOverlayShapeInfo *src_shape_infoSource shape info structure
Return
none
-
void vvas_overlay_shape_info_free(VvasOverlayShapeInfo *shape_info)¶
Deinitializes shape_info parameters
Parameters
VvasOverlayShapeInfo *shape_infoPointer to shape info structure
Return
none
VVAS Overlay APIs
This file contains public methods and data structures related to VVAS Overlay.
-
struct VvasFrameInfo¶
Structure represents input frame information on which overlay has to be performed.
Definition
struct VvasFrameInfo {
uint32_t stride;
uint32_t height;
uint32_t width;
VvasVideoFormat fmt;
uint8_t *buf_addr;
};
Members
stridestride information
heightheight of the frame
widthwidth of the frame
fmtSpecify input frame color format
buf_addrAddress of frame on which overlay operation to be performed
-
struct VvasOverlayClockInfo¶
Structure represents Clock information to be display on frame.
Definition
struct VvasOverlayClockInfo {
bool display_clock;
uint32_t clock_font_name;
float clock_font_scale;
uint32_t clock_font_color;
uint32_t clock_x_offset;
uint32_t clock_y_offset;
};
Members
display_clockdisplay clock true or false
clock_font_namefont style name
clock_font_scalefont scale
clock_font_colorfont color
clock_x_offsetclock x offset
clock_y_offsetclock y offset
-
struct VvasOverlayFrameInfo¶
This is the main structure to be passed for processing overlay onto a frame.
Definition
struct VvasOverlayFrameInfo {
VvasVideoFrame *frame_info;
VvasOverlayClockInfo clk_info;
VvasOverlayShapeInfo shape_info;
};
Members
frame_infoframe information
clk_infoclock overlay information
shape_infoOverlay information
-
VvasReturnType vvas_overlay_process_frame(VvasOverlayFrameInfo *pFrameInfo)¶
Parameters
VvasOverlayFrameInfo *pFrameInfoAddress of VvasOverlayFrameInfo
Context
Drawing is performed on the given frame.
Return
On Success, returns VVAS_SUCCESS.
On Failure, returns VVAS_ERROR_*
Metaaffixer APIs¶
VVAS Metaaffixer APIs
This file describes APIs for metaaffixer that can be used to scale the inference metadata as per the different resolution than the original resolution. The infer meta data to be scaled and attached is decided based on matching the PTS of the source and the destination frames.
-
enum VvasMetaAffixerRespCode¶
This enum represents Metaaffixer response code.
Constants
VVAS_METAAFFIXER_PASSIndicates operation is success.
VVAS_METAAFFIXER_NO_FRAME_OVERLAPIndicates no frame overlap occured.
VVAS_METAAFFIXER_NULL_VALUEIndicates NULL value received.
-
VvasMetaAffixer *vvas_metaaffixer_create(uint64_t inferframe_dur, uint32_t infer_queue_size, VvasLogLevel loglevel)¶
Creates metaaffixer handle
Parameters
uint64_t inferframe_durDuration of the infer frame.
uint32_t infer_queue_sizeRepresents Max queue size of the infer frame
VvasLogLevel loglevelIndicates log level
Context
This function will allocate internal resources and return the handle.
Return
On Sucess returns handle of Metaaffixer handle
On Failure returns NULL
-
void vvas_metaaffixer_destroy(VvasMetaAffixer *handle)¶
Destroys metaaffixer handle
Parameters
VvasMetaAffixer *handleMetaAffixer handle to be destroyed
Context
This function will destroy all memory allocated for handle instanced passed
Return
None
-
VvasReturnType vvas_metaaffixer_get_frame_meta(VvasMetaAffixer *handle, bool sync_pts, VvasVideoInfo *vinfo, VvasMetadata *metadata, VvasMetaAffixerRespCode *respcode, VvasInferPrediction **ScaledMetaData)¶
Provides scaled metadata.
Parameters
VvasMetaAffixer *handleAddress of context handle ref VvasMetaAffixer
bool sync_ptsif FALSE then last received infer meta data is used for scaling. Else reference infer metadata is chosen based on PTS of input frame.
VvasVideoInfo *vinfoInput Frame Information
VvasMetadata *metadataMetadata of input frame
VvasMetaAffixerRespCode *respcodeMetaaffixer response code.
VvasInferPrediction **ScaledMetaDataScaled meta data is updated here.
Context
This function returns scaled metadata based on input frame info
Return
On Success returns VVAS_SUCCESS
On Failure returns VVAS_RET_ERROR
-
VvasReturnType vvas_metaaffixer_submit_infer_meta(VvasMetaAffixer *handle, VvasVideoInfo *vinfo, VvasMetadata *metadata, VvasInferPrediction *infer)¶
Submit infer metadata.
Parameters
VvasMetaAffixer *handleContext handle ref VvasMetaAffixer
VvasVideoInfo *vinfoAddress of frame info
VvasMetadata *metadataMetadata of frame
VvasInferPrediction *inferInfer metadata associated with infer frame
Context
This function will submit meta data information.
Return
On Success returns VVAS_RET_SUCCESS
On Failure returns VVAS_RET_ERROR
Utility APIs¶
Mutex APIs¶
VVAS Mutex APIs
This file contains APIs for handling synchronization.
-
type VvasMutex¶
Holds the reference to Mutex handle.
-
union _VvasMutex¶
This union is for creating Mutex instance.
Definition
union _VvasMutex {
void* p;
int32_t i[2];
};
Members
pPointer for Mutex Handle.
iMutex count.
Parameters
VvasMutex *mutexHandle of mutex.
Return
None.
Parameters
VvasMutex *mutexHandle of mutex.
Context
This function Locks mutex. If mutex is already locked by another thread the current thread will block until mutex is unlocked by the other thread.
Return
None.
Parameters
VvasMutex *mutexAddress of mutex object.
Context
This function will try to lock mutex. If mutex is already locked by another thread, it immediately returns FALSE.
Return
TRUE - If mutex lock is acquired.
FALSE - If failes to acquire lock.
Parameters
VvasMutex *mutexAddress of mutex object.
Context
This function unlocks mutex.
Return
None.
Parameters
VvasMutex *mutexAddress of mutex object.
Context
This function frees resources allocated to the mutex.
Return
None.
List APIs¶
VVAS List APIs
This file contains APIs for handling List related operations.
-
struct VvasList¶
Data structure for the list element.
Definition
struct VvasList {
void* data;
struct VvasList* next;
struct VvasList* prev;
};
Members
dataHolds the address of data.
nextHolds the address of next element in list.
prevHolds the address of previous element in list.
Parameters
VvasList* listPointer to VvasList.
Return
None
Parameters
VvasList* listPointer to VvasList in which element has to be added.
void *dataElement to be added into the list.
Return
On success Returns the updated list.
On Failure returns NULL.
Parameters
VvasList* listPointer to VvasList.
Return
Number of element in the VvasList.
Parameters
VvasList * listPointer to VvasList.
void * dataData to look for.
Return
On Success returns the pointer to Element data found.
On Failure return NULL.
-
void *vvas_list_nth_data(VvasList *list, uint32_t n)¶
Gets the data of the element at the given position.
Parameters
VvasList* listPointer to VvasList.
uint32_t nPosition of the element.
Return
On Success returns the pointer to Element data.
On Failure return NULL.
Parameters
VvasList* listPointer to VvasList.
const void* dataPointer to the data to be removed. Data is owned by the caller
Return
Updated VvasList
Parameters
VvasList* listPointer to VvasList.
Return
Pointer to the first element of the VvasList, i.e head.
-
VvasFunc¶
Typedef: Call back function for vvas_list_foreach.
Syntax
void VvasFunc (void *data, void *udata)
Parameters
void *dataList element data handle.
void *udataUser data.
Return
None
-
void vvas_list_foreach(VvasList *list, VvasFunc func, void *data)¶
Call’s the function for each element of the VvasList.
Parameters
VvasList* listA pointer to VvasList.
VvasFunc funcA callback function to be called for each element of the list.
void *dataUser data to pass to the function.
-
vvas_list_free_notify¶
Typedef: This is the function prototype to be passed for vvas_list_free_full.
Syntax
void vvas_list_free_notify (void *data)
Parameters
void *dataData handle to be freed
Return
None
-
void vvas_list_free_full(VvasList *list, vvas_list_free_notify func)¶
Frees all the memory allocated and used by VvasList.
Parameters
VvasList* listPointer to VvasList.
vvas_list_free_notify funcPointer to vvas_list_free_full, pointer to destroy function.
Return
None
-
vvas_list_copy_func¶
Typedef: This function will be called for list copy.
Syntax
VOID_POINTER vvas_list_copy_func (const void* src_list, void* data)
Parameters
const void* src_listSource data handle.
void* dataUser data.
Return
New copied list.
-
VvasList *vvas_list_copy_deep(VvasList *list, vvas_list_copy_func func, void *data)¶
Performs deep copy of the list node passed.
Parameters
VvasList* listPointer to VvasList.
vvas_list_copy_func funcPointer to vvas_list_copy_func.
void* dataPointer to user data.
Return
Pointer to the first element of the VvasList, i.e head.
Queue APIs¶
VVAS Queue APIs
This file contains APIs for handling Queue related operations.
-
type VvasQueue¶
Handle for VvasQueue instance.
Parameters
int32_t lengthQueue length, -1 for no limit on length.
Context
This API allocates a new VvasQueue. This instance must be freed using vvas_queue_free.
Return
Handle for VvasQueue.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API frees the memory allocated for the VvasQueue. If queue elements contain dynamically-allocated memory, then they should be freed first.
Return
none.
-
VvasQueueDestroyNotify¶
Typedef: Destroy Notification callback.
Syntax
void VvasQueueDestroyNotify (void *data)
Parameters
void *datadata to be freeed.
Return
void.
-
void vvas_queue_free_full(VvasQueue *vvas_queue, VvasQueueDestroyNotify free_func)¶
Free’s all the memory used by a VvasQueue.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
VvasQueueDestroyNotify free_funcCallback function which is called when a data element is destroyed. It is passed the pointer to the data element and should free any memory and resources allocated for it.
Context
This API frees all the memory used by a VvasQueue, and calls the specified destroy function on every element’s data. free_func should not modify the queue (eg, by removing the freed element from it).
Return
None.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API removes all the elements in queue. If queue elements contain dynamically-allocated memory, they should be freed first.
Return
None.
-
void vvas_queue_clear_full(VvasQueue *vvas_queue, VvasQueueDestroyNotify free_func)¶
Free’s all the memory used by a VvasQueue.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
VvasQueueDestroyNotify free_funcCallback function which is called when a data element is freed. It is passed the pointer to the data element and should free any memory and resources allocated for it.
Context
This API frees all the memory used by a VvasQueue, and calls the provided free_func on each item in the VvasQueue.free_func should not modify the queue (eg, by removing the freed element from it).
Return
None.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API is to check if vvas_queue is empty or not.
Return
Returns TRUE if vvas_queue is empty.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API is to get the vvas_queue’s length.
Return
Returns the number of items in the queue.
-
VvasQueueFunc¶
Typedef: Queue iteration callback.
Syntax
void VvasQueueFunc (void *data, void *udata)
Parameters
void *dataQueue handle.
void *udatauser data.
Context
Call back function.
Return
void.
-
void vvas_queue_for_each(VvasQueue *vvas_queue, VvasQueueFunc func, void *user_data)¶
Callback function called for each element.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
VvasQueueFunc funcA callback function to be called for each element of the queue.
void *user_datauser data to be passed.
Context
This API Calls func for each element in the queue passing user_data to the function. func should not modify the queue.
Return
None.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
void *dataThe data for the new element.
Context
This API Adds a new element at the tail of the queue, this API will block if the queue is full. For non blocking enqueue use vvas_queue_enqueue_noblock.
Return
None.
-
bool vvas_queue_enqueue_noblock(VvasQueue *vvas_queue, void *data)¶
API Adds a new element at the tail.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
void *dataThe data for the new element.
Context
This API Adds a new element at the tail of the queue, this API will not block when queue is full.
Return
Returns TRUE is data is enquired, FALSE otherwise.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API removes the first element of the queue and returns its data. This API will block if the queue is empty. For non blocking dequeue use vvas_queue_dequeue_noblock.
Return
The data of the first element in the queue, or NULL if the queue is empty.
-
void *vvas_queue_dequeue_noblock(VvasQueue *vvas_queue)¶
Removes the first element & returns its data.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
Context
This API removes the first element of the queue and returns its data.
Return
The data of the first element in the queue, or NULL if the queue is empty.
-
void *vvas_queue_dequeue_timeout(VvasQueue *vvas_queue, uint64_t timeout)¶
Removes the first element of the queue.
Parameters
VvasQueue * vvas_queueVvasQueue allocated using vvas_queue_new.
uint64_t timeoutTime in microseconds to wait for data in the queue.
Context
This API removes the first element of the queue and returns its data. If the queue is empty, it will block for timeout microseconds, or until data becomes available.
Return
The data of the first element in the queue.
If no data is received before timeout, NULL is returned.
Tree Node APIs¶
VVAS Node APIs
This file contains APIs for handling Node related operations.
-
struct _VvasTreeNode¶
This structure is for creating Node instance.
Definition
struct _VvasTreeNode {
void* data;
VvasTreeNode *next;
VvasTreeNode *prev;
VvasTreeNode *parent;
VvasTreeNode *children;
};
Members
dataHandle for storing data.
nextHandle for storing next node.
prevHandle for storing Previous node.
parentHandle for storing Parent node.
childrenHandle for storing children.
-
enum VvasTreeNodeTraverseType¶
This enum is defines node traverse type.
Constants
IN_ORDERVisits a node’s left child first, then the node itself, then its right child.
PRE_ORDERVisits a node, then its children.
POST_ORDERVisits a node’s children, then the node itself.
-
enum VvasTreeNodeTraverseFlags¶
This enum defines which nodes to be visited.
Constants
TRAVERSE_LEAFSOnly leaf nodes should be visited.
TRAVERSE_NON_LEAFSOnly non-leaf nodes should be visited.
TRAVERSE_ALLAll nodes should be visited.
-
VvasTreeNode *vvas_treenode_new(void *data)¶
Creates new tree node.
Parameters
void* dataAddress of data.
Context
This function creates new tree node.
Return
On Success returns node address.
On Failure returns NULL.
-
void vvas_treenode_destroy(VvasTreeNode *node)¶
Deallocates tree node.
Parameters
VvasTreeNode* nodeAddress of node.
Context
This function deallocates node.
Return
None.
-
vvas_treenode_copy_func¶
Typedef: Copy node data.
Syntax
VOID_POINTER vvas_treenode_copy_func (const void* src, void* data)
Parameters
const void* srcData to be copied.
void* dataAdditional data.
Context
This function is used to copy node data while performing deep-copy of a tree node.
Return
On Success returns address of the new node.
On Failure returns NULL.
-
VvasTreeNode *vvas_treenode_copy_deep(VvasTreeNode *node, vvas_treenode_copy_func func, void *data)¶
Deep copies node.
Parameters
VvasTreeNode* nodeAddress of source node to copy data from.
vvas_treenode_copy_func funcAddress of function which is called to copy data in each node.
void *dataAdditional data to be passed to func.
Context
This function recursively deep copies node data.
Return
On Success returns address of the new node which contain copies of data.
On Failure returns NULL.
-
vvas_treenode_traverse_func¶
Typedef: To traverse tree node.
Syntax
bool vvas_treenode_traverse_func (const VvasTreeNode *Node, void *data)
Parameters
const VvasTreeNode *NodeAddress of node.
void *dataUser data to be passed to the node.
Context
This function is passed for vvas_treenode_traverse and is called for each node visited, traverse can be halted by returning TRUE.
Return
TRUE to stop the traverse.
FALSE to continue traverse.
-
void vvas_treenode_traverse(VvasTreeNode *node, VvasTreeNodeTraverseType traverse_order, VvasTreeNodeTraverseFlags traverse_flags, int32_t max_depth, vvas_treenode_traverse_func func, void *data)¶
Traverse a tree node.
Parameters
VvasTreeNode *nodeNode of the tree to start traversing.
VvasTreeNodeTraverseType traverse_orderOrder in which nodes are to be traversed in a tree.
VvasTreeNodeTraverseFlags traverse_flagsOrder in which children of nodes to be visited.
int32_t max_depthMaximum depth of traversal, if max_depth is -1 then all nodes in tree are visited.
vvas_treenode_traverse_func funcFunction to be called for each node visit.
void *dataUser data to be passed to the function.
Context
This function used to traverse a tree starting at the given node.
Return
None.
-
void vvas_treenode_append(VvasTreeNode *parent_node, VvasTreeNode *child_node)¶
Inserts node from bottom.
Parameters
VvasTreeNode *parent_nodeParent node.
VvasTreeNode *child_nodechild node.
Context
This function used to insert the node as the last child of the given parent node.
Return
None.
-
vvas_treenode_traverse_child_func¶
Typedef: To Traverse child node func callback.
Syntax
void vvas_treenode_traverse_child_func (VvasTreeNode *Node, void *data)
Parameters
VvasTreeNode *NodeAddress of node.
void *dataUser data to be passed to the node.
Context
This function is passed for vvas_treenode_traverse_child, It is called with each child node together with the user data passed.
Return
None.
-
void vvas_treenode_traverse_child(VvasTreeNode *node, VvasTreeNodeTraverseFlags traverse_flags, vvas_treenode_traverse_child_func func, void *data)¶
Traverses child nodes.
Parameters
VvasTreeNode *nodeParent node address.
VvasTreeNodeTraverseFlags traverse_flagsOrder in which children of nodes to be visited.
vvas_treenode_traverse_child_func funcFunction to be called for each child node visit.
void *dataUser data to be passed to the function.
Context
Calls given function for each child node of the Parent node. It does not descend beneath the child nodes.
Return
None.
-
uint32_t vvas_treenode_get_depth(VvasTreeNode *node)¶
Gets the depth of the node.
Parameters
VvasTreeNode *nodeAddress of the node for which depth to be found out.
Context
This function used to get the depth of the node.
Return
On Success returns depth of the given node.
On Failure returns 0, if node is null. The root node has depth of 1, for children of the root node the depth is 2 and so on.
-
uint32_t vvas_treenode_get_max_height(VvasTreeNode *node)¶
Gets the max height of the node.
Parameters
VvasTreeNode *nodeAddress of the node.
Context
This function used to get the maximum distance of the given node from all leaf nodes.
Return
On Success returns max distance of the given node from all leaf node.
On Failure returns 0, if node is null.If node has no children, 1 is returned. If node has children, 2 is returned.
-
uint32_t vvas_treenode_get_n_childnodes(VvasTreeNode *root_node)¶
Gets number of child nodes.
Parameters
VvasTreeNode *root_nodeAddress of the parent node.
Context
This function used to get the number of child nodes of the given node.
Return
On Success returns number of child nodes of the parent node.
On Failure returns 0, if node is null.
-
VvasTreeNode *vvas_treenode_insert_before(VvasTreeNode *parent, VvasTreeNode *sibling, VvasTreeNode *node)¶
inserts before given node.
Parameters
VvasTreeNode *parentAddress of the parent node.
VvasTreeNode* siblingAddress of the sibling node.
VvasTreeNode* nodeAddress of the node to be inserted.
Context
This function will insert before the tree node.
Return
On Success returns number of child nodes of the parent node.
On Failure returns 0, if node is null.
Hash APIs¶
VVAS Hash APIs
This file contains APIs for handling HashMap related operations.
-
struct _VvasHashTable¶
Holds hash table handle.
Definition
struct _VvasHashTable {
};
Members
-
struct VvasHashTableIter¶
Holds hash table iteration information.
Definition
struct VvasHashTableIter {
void *dummy1;
void *dummy2;
void *dummy3;
int dummy4;
bool dummy5;
void *dummy6;
};
Members
dummy1Pointer handle, this is internal member users need not pass value.
dummy2Pointer handle, this is internal member users need not pass value.
dummy3Pointer handle, this is internal member users need not pass value.
dummy4int value, this is internal member users need not pass value.
dummy5bool value, this is internal member users need not pass value.
dummy6Pointer handle, this is internal member users need not pass value.
-
VvasHashFunc¶
Typedef: Function pointer to create hash value.
Syntax
uint32_t VvasHashFunc (const void * key)
Parameters
const void * keyKey value.
Return
Hash value.
-
VvasEqualFunc¶
Typedef: Function pointer to compare key values.
Syntax
bool VvasEqualFunc (const void * a, const void * b)
Parameters
const void * aKey value to be compared.
const void * bKey value to be compared.
Return
True if both are equal.
-
VvasDestroyNotify¶
Typedef: Function pointer to be called when Destoryed.
Syntax
void VvasDestroyNotify (void * data)
Parameters
void * dataData to be destroyed.
Return
None.
-
VvasHRFunc¶
Typedef: Function pointer to called for each key value pair.
Syntax
bool VvasHRFunc (void * key, void * value, void * user_data)
Parameters
void * keyKey value.
void * valueHash value.
void * user_dataUser data to be passed.
Return
False to end loop.
-
uint32_t vvas_direct_hash(const void *key)¶
Converts gpointer to hash.
Parameters
const void * keyKey Value.
Return
A Hash value.
-
uint32_t vvas_int_hash(const void *key)¶
Converts gpointer to int value.
Parameters
const void * keyKey Value.
Return
A Hash value.
-
uint32_t vvas_str_hash(const void *key)¶
Converts a string to hash value.
Parameters
const void * keyKey Value.
Return
A Hash value.
-
bool vvas_direct_equal(const void *a, const void *b)¶
Compares pointers.
Parameters
const void * aPointer to be compared.
const void * bPointer to be compared.
Return
True if equal.
-
bool vvas_int_equal(const void *a, const void *b)¶
Compares two int values.
Parameters
const void * aPointer to be compared.
const void * bPointer to be compared.
Return
True if equal.
-
bool vvas_int64_equal(const void *a, const void *b)¶
Compares two int64 values.
Parameters
const void * aPointer to be compared.
const void * bPointer to be compared.
Return
True if equal.
-
bool vvas_double_equal(const void *a, const void *b)¶
Compares two double values.
Parameters
const void * aPointer to be compared.
const void * bPointer to be compared.
Return
True if equal.
-
bool vvas_str_equal(const void *a, const void *b)¶
Compares two strings.
Parameters
const void * aPointer to be compared.
const void * bPointer to be compared.
Return
True if equal.
-
VvasHashTable *vvas_hash_table_new(VvasHashFunc hash_func, VvasEqualFunc key_eq_func)¶
Creates a new VvasHashTable with a reference count of 1.
Parameters
VvasHashFunc hash_funcA function to create a hash value from a key.
VvasEqualFunc key_eq_funcA function to create a hash value from a key.
Return
A new VvasHashTable.
-
VvasHashTable *vvas_hash_table_new_full(VvasHashFunc hash_func, VvasEqualFunc key_eq_func, VvasDestroyNotify key_destroy_fn, VvasDestroyNotify value_destroy_fn)¶
Creates a new VvasHashTable.
Parameters
VvasHashFunc hash_funcA function to create a hash value from a key.
VvasEqualFunc key_eq_funcA function to create a hash value from a key.
VvasDestroyNotify key_destroy_fnfunction to free the memory allocated for the key used when removing the entry from the VvasHashTable, or NULL if you don’t want to supply such a function.
VvasDestroyNotify value_destroy_fnA function to free the memory allocated for the value used when removing the entry from the GHashTable, or NULL if you don’t want to supply such a function.
Context
Creates a new VvasHashTable like vvas_hash_table_new() with a reference count of 1 and allows to specify functions to free the memory allocated for the key and value that get called when removing the entry from the VvasHashTable.
Return
A new VvasHashTable.
-
bool vvas_hash_table_insert(VvasHashTable *hash_table, void *key, void *value)¶
Inserts a new key and value into a VvasHashTable.
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
void * keyA key to insert.
void * valueThe value to associate with the key.
Return
TRUE if the key did not exist yet.
-
void *vvas_hash_table_lookup(VvasHashTable *hash_table, const void *key)¶
Looks up key in Hash Table
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
const void * keyThe key to look up.
Return
Associates value or NULL if key is not found.
-
bool vvas_hash_table_contains(VvasHashTable *hash_table, void *key)¶
Checks if key exit in the hash table
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
void * keyA key to check.
Return
TRUE if key found, FALSE if key not found.
-
uint32_t vvas_hash_table_size(VvasHashTable *hash_table)¶
Returns number of elements in the hash table
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
Return
Number of element in the hash table.
-
bool vvas_hash_table_remove(VvasHashTable *hash_table, void *key)¶
Removes a key and its associated value from a hash table.
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
void * keyThe Key to remove.
Return
TRUE if key was found and removed from hash table.
-
uint32_t vvas_hash_table_foreach_remove(VvasHashTable *hash_table, VvasHRFunc func, void *user_data)¶
Calls the function for each remove
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
VvasHRFunc funcThe function to call for each key/value pair.
void * user_datauser data to be passed to the function.
Context
Calls the given function for each key/value pair in the hash table. if function returns TRUE, then key/value pair is removed from the hash table.
Return
The number of key/value pair removed.
-
void vvas_hash_table_remove_all(VvasHashTable *hash_table)¶
Removes all key/value from the hash table
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
Return
None.
-
void vvas_hash_table_unref(VvasHashTable *hash_table)¶
Decrement the reference count by one.
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
Context
Decrement the reference count by one. Once the reference count drops to zero all the key/value will be destroyed.
Return
None.
-
void vvas_hash_table_destroy(VvasHashTable *hash_table)¶
Destroys all keys and values in hash table
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
Context
Destroys all keys and values in the VvasHashTable and decrements its reference count by 1. If keys and/or values are dynamically allocated, you should either free them first or create the VvasHashTable with destroy notifiers using vvas_hash_table_new_full(). In the latter case the destroy functions you supplied will be called on all keys and values during the destruction phase.
Return
None.
-
void vvas_hash_table_iter_init(VvasHashTable *hash_table, VvasHashTableIter *iter)¶
Returns the iterator for hash table.
Parameters
VvasHashTable* hash_tableHandle for VvasHashTable.
VvasHashTableIter *iterHandle for table iterator.
Return
None.
-
bool vvas_hash_table_iter_next(VvasHashTableIter *iter, void **key, void **value)¶
Allows to iterate through the table.
Parameters
VvasHashTableIter *iterHandle for VvasHashTableIter.
void **keyPointer to update.
void **valuePointer to update.
Context
Allows to iterate through the table and updates information in Key and values params passed.
Return
None.