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_ERROR
Memory allocation error
VVAS_RET_INVALID_ARGS
Invalid arguments to APIs
VVAS_RET_ERROR
Generic error
VVAS_RET_SUCCESS
Success
VVAS_RET_EOS
End of stream
VVAS_RET_SEND_AGAIN
Call the API without changing arguments
VVAS_RET_NEED_MOREDATA
Core APIs need more data to complete a specific operation
VVAS_RET_CAPS_CHANGED
Capabilities 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_NONE
No DMA Synchronization required
VVAS_DATA_SYNC_FROM_DEVICE
Synchronize data from device to host
VVAS_DATA_SYNC_TO_DEVICE
Synchronize 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_NONE
Default flag
VVAS_DATA_MAP_READ
Map memory in read mode
VVAS_DATA_MAP_WRITE
Map 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_UNKNOWN
Unknown allocation type
VVAS_ALLOC_TYPE_CMA
Physically contiguous Memory will be allocated by backend drivers (i.e XRT)
VVAS_ALLOC_TYPE_NON_CMA
Memory will be allocated using malloc API
-
enum VvasAllocationFlags¶
Enum representing VVAS allocation flags. Can be extended in future.
Constants
VVAS_ALLOC_FLAG_UNKNOWN
Unknown allocation type
VVAS_ALLOC_FLAG_NONE
To 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_idx
Index of the Memory bank from which memory is allocated
alloc_type
Memory allocation type
enum VvasAllocationType
alloc_flags
Flags used to allocate memory
enum VvasAllocationFlags
map_flags
Flags to indicate current mapping type
enum VvasDataMapFlags
sync_flags
Flags 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
pts
Presentation timestamp
dts
Decoding timestamp
duration
Duration of the frame
-
enum VvasFontType¶
Fonts supported by VVAS core
Constants
VVAS_FONT_HERSHEY_SIMPLEX
Normal size sans-serif font
VVAS_FONT_HERSHEY_PLAIN
Small size sans-serif font
VVAS_FONT_HERSHEY_DUPLEX
Normal size sans-serif font (more complex than VVAS_FONT_HERSHEY_SIMPLEX)
VVAS_FONT_HERSHEY_COMPLEX
Normal size serif font
VVAS_FONT_HERSHEY_TRIPLEX
Normal size serif font (more complex than VVAS_FONT_HERSHEY_COMPLEX)
VVAS_FONT_HERSHEY_COMPLEX_SMALL
Smaller 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_idx
Device index to which current context belongs
xclbin_loc
xclbin location which is used to configure a device
dev_handle
Device Handle to which current context belongs to and having device index
VvasContext->dev_idx
uuid
UUID of xclbin
log_level
Loging 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_idx
Index of the FPGA device. This can be -1 if no FPGA is present
char * xclbin_loc
Location 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_level
Logging level
VvasReturnType *vret
Address 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_ctx
Context 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_ERROR
Prints ERROR logs
LOG_LEVEL_WARNING
Prints WARNING and ERROR logs
LOG_LEVEL_INFO
Prints INFO, WARNING & ERROR logs
LOG_LEVEL_DEBUG
Prints 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_level
Log level
uint32_t set_log_level
Log level to filter logs
const char *filename
Source code filename from which this logging is triggered
const char *func
Source code function name
uint32_t line
Source code line number
const char *fmt
Format 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 *data
Address of the data pointer
void *user_data
User 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
data
Pointer to memory which is mapped to user space using VvasDataMapFlags
size
Size 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_ctx
Address of VvasContext handle created using vvas_context_create()
VvasAllocationType mem_type
Type of the memory need to be allocated
VvasAllocationFlags mem_flags
Flags of type
enum VvasAllocationFlags
uint8_t mbank_idx
Index of the memory bank on which memory need to be allocated
size_t size
Size of the memory to be allocated.
VvasReturnType *ret
Address 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_ctx
Address of VvasContext handle created using vvas_context_create()
uint8_t *data
Pointer to data which needs to encapsulated in
struct VvasMemory
size_t size
Size of the memory to which data pointer is pointing
VvasMemoryDataFreeCB free_cb
Callback function to be called during vvas_memory_free() API.
void *user_data
User defined data
VvasReturnType *ret
Address 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_mem
Address of
struct VvasMemory
object
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_mem
Address of
struct VvasMemory
objectVvasDataMapFlags flags
Flags used to map vvas_mem
VvasMemoryMapInfo *info
Structure 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_mem
Address of
struct VvasMemory
objectVvasMemoryMapInfo *info
Memory map information populated during vvas_memory_map() API
Return
-
void vvas_memory_set_metadata(VvasMemory *vvas_mem, VvasMetadata *meta_data)¶
Sets
VvasMetadata
metadata onstruct VvasMemory
object
Parameters
VvasMemory* vvas_mem
Address of
struct VvasMemory
objectVvasMetadata *meta_data
Address of
struct VvasMetadata
to be set on vvas_mem
Return
None
-
void vvas_memory_get_metadata(VvasMemory *vvas_mem, VvasMetadata *meta_data)¶
Gets
VvasMetadata
metadata fromstruct VvasMemory
object
Parameters
VvasMemory* vvas_mem
Address of
struct VvasMemory
objectVvasMetadata *meta_data
Address of
struct VvasMetadata
to 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_UNKNOWN
Unknown codec type
VVAS_CODEC_H264
H264/AVC codec type
VVAS_CODEC_H265
H265/HEVC codec type
-
enum VvasVideoFormat¶
Represents video color formats supported by VVAS core APIs
Constants
VVAS_VIDEO_FORMAT_UNKNOWN
Unknown color format
VVAS_VIDEO_FORMAT_Y_UV8_420
planar 4:2:0 YUV with interleaved UV plane
VVAS_VIDEO_FORMAT_RGBx
Packed RGB, 4 bytes per pixel
VVAS_VIDEO_FORMAT_r210
Packed 4:4:4 RGB, 10 bits per channel
VVAS_VIDEO_FORMAT_Y410
Packed 4:4:4 YUV, 10 bits per channel
VVAS_VIDEO_FORMAT_BGRx
Packed BGR, 4 bytes per pixel
VVAS_VIDEO_FORMAT_BGRA
Reverse rgb with alpha channel last
VVAS_VIDEO_FORMAT_RGBA
RGB with alpha channel last
VVAS_VIDEO_FORMAT_YUY2
Packed 4:2:2 YUV (Y0-U0-Y1-V0, Y2-U2-Y3-V2 Y4…)
VVAS_VIDEO_FORMAT_NV16
Planar 4:2:2 YUV with interleaved UV plane
VVAS_VIDEO_FORMAT_RGB
RGB packed into 24 bits without padding
VVAS_VIDEO_FORMAT_v308
Packed 4:4:4 YUV
VVAS_VIDEO_FORMAT_BGR
BGR packed into 24 bits without padding
VVAS_VIDEO_FORMAT_I422_10LE
Planar 4:2:2 YUV, 10 bits per channel
VVAS_VIDEO_FORMAT_NV12_10LE32
10-bit variant of GST_VIDEO_FORMAT_NV12, packed into 32bit words (MSB 2 bits padding)
VVAS_VIDEO_FORMAT_GRAY8
8-bit grayscale
VVAS_VIDEO_FORMAT_GRAY10_LE32
10-bit grayscale, packed into 32bit words (2 bits padding)
VVAS_VIDEO_FORMAT_I420
Planar 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_right
Padding to the right
padding_left
Padding to the left
padding_top
Padding to the top
padding_bottom
Padding to the bottom
stride_align
Extra 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
width
Width of a video frame
height
Height of a video frame
fmt
Video frame color format
n_planes
Number of planes in video frame color format
stride
Array of stride values
elevation
Array of elevation values
alignment
Video 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
data
Pointer to a video frame plane data
size
Size of a video plane
offset
Offset of the first valid data from the data pointer
stride
Stride of a video plane
elevation
Elevation (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
nplanes
Number of planes in a video frame
size
Video frame size
width
Width of the mapped video frame
height
Height of the mapped video frame
fmt
Video frame color format
alignment
Video frame’s Alignment information
planes
Array 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_data
User 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_ctx
Address of VvasContext handle created using vvas_context_create()
VvasAllocationType alloc_type
Type of the memory need to be allocated
VvasAllocationFlags alloc_flags
Allocation flags used to allocate video frame
uint8_t mbank_idx
Index of the memory bank on which memory need to be allocated
VvasVideoInfo *vinfo
Address of VvasVideoInfo which contains video frame specific information
VvasReturnType *ret
Address 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_ctx
Address of VvasContext handle created using vvas_context_create()
VvasVideoInfo *vinfo
Video information related a frame
void *data[VVAS_VIDEO_MAX_PLANES]
Array of data pointers to each plane
VvasVideoFrameDataFreeCB free_cb
Pointer to callback function to be called when
struct VvasVideoFrame
is freedvoid *user_data
User data to be passed to callback function free_cb
VvasReturnType *ret
Address to store return value. Upon case of error, ret is useful in understanding the root cause
Return
On success, returns
struct VvasVideoFrame
handle 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_vframe
Address of
struct VvasVideoFrame
VvasDataMapFlags map_flags
Flags used to map vvas_vframe
VvasVideoFrameMapInfo *info
Structure 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_vframe
Address of
struct VvasVideoFrame
VvasVideoFrameMapInfo *info
Pointer 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_vframe
Address of
struct VvasVideoFrame
Return
None
-
void vvas_video_frame_set_metadata(VvasVideoFrame *vvas_mem, VvasMetadata *meta_data)¶
Sets metadata on VvasVideoFrame
Parameters
VvasVideoFrame* vvas_mem
Address of
struct VvasVideoFrame
VvasMetadata *meta_data
Address of
struct VvasMetadata
to 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_mem
Address of
struct VvasVideoFrame
VvasMetadata *meta_data
Address of
struct VvasMetadata
to 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_mem
Address of
struct VvasVideoFrame
VvasVideoInfo *vinfo
Video 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_YOLOV3
YOLOV3
VVAS_XCLASS_FACEDETECT
FACEDETECT
VVAS_XCLASS_CLASSIFICATION
CLASSIFICATION
VVAS_XCLASS_VEHICLECLASSIFICATION
VEHICLECLASSIFICATION
VVAS_XCLASS_SSD
SSD
VVAS_XCLASS_REID
REID
VVAS_XCLASS_REFINEDET
REFINEDET
VVAS_XCLASS_TFSSD
TFSSD
VVAS_XCLASS_YOLOV2
YOLOV2
VVAS_XCLASS_SEGMENTATION
SEGMENTATION
VVAS_XCLASS_PLATEDETECT
PLATEDETECT
VVAS_XCLASS_PLATENUM
PLATENUM
VVAS_XCLASS_POSEDETECT
POSEDETECT
VVAS_XCLASS_BCC
BCC
VVAS_XCLASS_EFFICIENTDETD2
EFFICIENTDETD2
VVAS_XCLASS_FACEFEATURE
FACEFEATURE
VVAS_XCLASS_FACELANDMARK
FACELANDMARK
VVAS_XCLASS_ROADLINE
ROADLINE
VVAS_XCLASS_ULTRAFAST
ULTRAFAST
VVAS_XCLASS_RAWTENSOR
RAWTENSOR
VVAS_XCLASS_NOTFOUND
UNKNOWN
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
red
R color component
green
G color component
blue
B color component
alpha
Transparency
-
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_id
A unique id associated to this classification
class_id
The numerical id associated to the assigned class
class_prob
The resulting probability of the assigned class. Typically ranges between 0 and 1
class_label
The label associated to this class or NULL if not available
num_classes
The total number of classes of the entire prediction
probabilities
The entire array of probabilities of the prediction
labels
The entire array of labels of the prediction. NULL if not available
label_color
The color of labels
-
VvasInferClassification *vvas_inferclassification_new(void)¶
This function allocates new memory for VvasInferClassification
Parameters
void
no 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 *self
Address 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 *self
Address 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 * self
Address of VvasInferenceClassification
int level
Level 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
x
horizontal coordinate of the upper position in pixels
y
vertical coordinate of the upper position in pixels
width
width of bounding box in pixels
height
height of bounding box in pixels
box_color
bounding box color
-
struct Pointf¶
coordinate of point
Definition
struct Pointf {
float x;
float y;
};
Members
x
horizontal coordinate of the upper position in pixels
y
vertical 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_shoulder
R_shoulder coordinate
right_elbow
R_elbow coordinate
right_wrist
R_wrist coordinate
left_shoulder
L_shoulder coordinate
left_elbow
L_elbow coordinate
left_wrist
L_wrist coordinate
right_hip
R_hip coordinate
right_knee
R_knee coordinate
right_ankle
R_ankle coordinate
left_hip
L_hip coordinate
left_knee
L_knee coordinate
left_ankle
L_ankle coordinate
head
Head coordinate
neck
Neck coordinate
-
enum feature_type¶
Enum for holding type of feature
Constants
UNKNOWN_FEATURE
Unknown feature
FLOAT_FEATURE
Float features
FIXED_FEATURE
Fixed point features
LANDMARK
Landmark
ROADLINE
Roadlines
ULTRAFAST
Points from Ultrafast model
-
enum road_line_type¶
Enum for holding type of road line
Constants
BACKGROUND
Background
WHITE_DOTTED_LINE
White dotted line
WHITE_SOLID_LINE
White solid line
YELLOW_LINE
Yellow 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_feature
float features
fixed_feature
fixed features
road_line
points for drawing road lanes
landmark
five key points on a human face
line_size
Number of points in road_line
type
enum to hold type of feature
line_type
enum 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
width
Width of output image
height
Height of output image
size
Size of output
type
Type of Reid
data
Reid output data
free
function pointer to free data
copy
function pointer to copy data
-
enum seg_type¶
Enum for holding type of segmentation
Constants
SEMANTIC
Semantic
MEDICAL
Medical
SEG3D
3D 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
type
enum to hold type of segmentation
width
Width of output image
height
Height of output image
fmt
Segmentation output format
data
Segmentation output data
free
function pointer to free data
copy
function 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
size
Size of output Tensors
ptr
Pointers to output Tensors
priv
Private structure
free
function pointer to free data
copy
function pointer to copy data
height
Height of output image
width
Width of output image
fmt
Format of output image
ref_count
Reference 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_id
A unique id for this specific prediction
enabled
This flag indicates whether or not this prediction should be used for further inference
bbox
Bouding box for this specific prediction
classifications
linked list to classifications
node
Address to tree data structure node
bbox_scaled
bbox co-ordinates scaled to root node resolution or not
obj_track_label
Track Label for the object
model_class
Model class defined in vvas-core
model_name
Model name
count
A number element, used by model which give output a number
pose14pt
Struct of the result returned by the posedetect/openpose network
feature
Features of a face/road
reid
Getting feature from an image
segmentation
Segmentation data
tb
Rawtensor data
-
VvasInferPrediction *vvas_inferprediction_new(void)¶
Allocate new memory for VvasInferPrediction
Parameters
void
no 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 *self
Instance of the parent node to which child node will be appended.
VvasInferPrediction *child
Instance 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 *smeta
Address 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 *infer
VvasInferPrediction object will be passed while traversing to child nodes.
void *data
user 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 *self
Address 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 * self
Address 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
void
no 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
bitdepth
Number of bits each pixel is coded for say 8 bit or 10 bit.
codec_type
AVC(H264)/HEVC(H265) codec type.
profile
AVC(H264)/HEVC(H265) profile.
level
AVC(H264)/HEVC(H265) level.
height
Frame height in pixel.
width
Frame width in pixel.
chroma_mode
Chroma sampling mode 444, 420 etc.
scan_type
Scan type interlaced or progressive.
frame_rate
Frame rate numerator.
clk_ratio
Frame 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_ctx
Device context handle pointer.
VvasCodecType codec_type
Codec type for which stream required to be parsed.
VvasLogLevel log_level
Log 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 *handle
VvasParser handle pointer.
VvasMemory *inbuf
Input data blob pointer (pointer to elementary stream buffer) to be parsed.
int32_t valid_insize
Valid 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 **outbuf
output VvasMemory pointer containing one encoded access-unit(au)/frame on success, else returns NULL.
int32_t *offset
This 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_cfg
pointer 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_eos
whether 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 *handle
Parser 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
width
width of frame in pixel
height
Height of frame in pixel
frame_rate
Frame rate
clk_ratio
Clock Ratio
codec_type
Codec Type, AVC - 0 or HEVC - 1
profile
Encoding profile
level
Encoding level
bitdepth
Bit depth of each pixel 8 or 10 bit
chroma_mode
Chroma Mode
scan_type
Scan Type, Interlaced(0) or Progressive(1)
splitbuff_mode
Split Buffer Mode
low_latency
Low Latency, Disabled(0) or Enabled(1)
entropy_buffers_count
Number of Entropy Buffers
i_frame_only
I 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
vinfo
VvasVideoInfo represents decoder output frame properties
mem_bank_id
Memory bank on which video frame should be allocated
min_out_buf
Minimum 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_ctx
Address of VvasContext handle created using vvas_context_create
uint8_t *dec_name
Name of the decoder to be used for decoding
VvasCodecType dec_type
Type of the decoder to be used (i.e. H264/H265)
uint8_t hw_instance_id
Decoder 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_level
Logging 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_handle
Decoder handle pointer
VvasDecoderInCfg *icfg
Decoder input configuration
VvasDecoderOutCfg *ocfg
Decoder 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_handle
Decoder handle pointer
VvasMemory *au
Complete access unit/frame. send NULL pointer on End of stream
VvasList *loutframes
List 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_handle
Decoder handle pointer
VvasVideoFrame **output
Video 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_handle
Decoder 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_FIXED
Fixed filter coefficients type
VVAS_SCALER_COEF_AUTO_GENERATE
Auto generate filter coefficients type
-
enum VvasScalerMode¶
Enum for holding scaling modes.
Constants
VVAS_SCALER_MODE_BILINEAR
Bilinear scaling mode
VVAS_SCALER_MODE_BICUBIC
BiCubic scaling mode
VVAS_SCALER_MODE_POLYPHASE
PolyPhase scaling mode
-
enum VvasScalerType¶
Enum for holding scaling types.
Constants
VVAS_SCALER_DEFAULT
Default Scale Type
VVAS_SCALER_LETTERBOX
LetterBox Scale which maintain aspect ratio
VVAS_SCALER_ENVELOPE_CROPPED
Envelope scale and center cropped
-
enum VvasScalerHorizontalAlign¶
Enum for holding horizontal alignment options.
Constants
VVAS_SCALER_HORZ_ALIGN_CENTER
Center Alignment into output frame
VVAS_SCALER_HORZ_ALIGN_LEFT
Left Alignment into output frame
VVAS_SCALER_HORZ_ALIGN_RIGHT
Right Alignment into output frame
-
enum VvasScalerVerticalAlign¶
Enum for holding vertical alignment options.
Constants
VVAS_SCALER_VERT_ALIGN_CENTER
Center Alignment into output frame
VVAS_SCALER_VERT_ALIGN_TOP
Top Alignment into output frame
VVAS_SCALER_VERT_ALIGN_BOTTOM
Bottom 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
type
Scale Type
horz_align
Horizontal Alignment
vert_align
Vertical Alignment
smallest_side_num
Smallest side numerator to calculate scale ratio for envelope scale
-
enum VvasScalerFilterTaps¶
Enum for holding number of filter taps.
Constants
VVAS_SCALER_FILTER_TAPS_6
6 filter taps
VVAS_SCALER_FILTER_TAPS_8
8 filter taps
VVAS_SCALER_FILTER_TAPS_10
10 filter taps
VVAS_SCALER_FILTER_TAPS_12
12 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_type
Coefficient loading type
smode
Scaling mode
ftaps
Filter taps
ppc
Pixel per clock
mem_bank
Memory bank on which the internal buffers should be allocated
n_fmts
Number of color formats supported by scaler
supported_fmts
Array 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_SR13
Scaling ration 1.3
VVAS_SCALER_FILTER_COEF_SR15
Scaling ration 1.5
VVAS_SCALER_FILTER_COEF_SR2
Scaling ration 2, 8 tap
VVAS_SCALER_FILTER_COEF_SR25
Scaling ration 2.5
VVAS_SCALER_FILTER_COEF_TAPS_10
10 tap
VVAS_SCALER_FILTER_COEF_TAPS_12
12 tap
VVAS_SCALER_FILTER_COEF_TAPS_6
6 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
frame
VvasVideoFrame
x
X coordinate
y
Y coordinate
width
Width of Rect
height
Height 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_r
PreProcessing parameter alpha/mean red channel value
mean_g
PreProcessing parameter alpha/mean green channel value
mean_b
PreProcessing parameter alpha/mean blue channel value
scale_r
PreProcessing parameter beta/scale red channel value
scale_g
PreProcessing parameter beta/scale green channel value
scale_b
PreProcessing 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 * ctx
VvasContext handle created using vvas_context_create
const char * kernel_name
Scaler kernel name
VvasLogLevel log_level
Logging 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 * hndl
VvasContext handle created using vvas_context_create
VvasScalerRect * src_rect
Source Rect VvasScalerRect
VvasScalerRect * dst_rect
Destination Rect VvasScalerRect
VvasScalerPpe * ppe
Preprocessing parameters VvasScalerPpe, NULL if no PPE is needed
VvasScalerParam * param
Scaler 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 * hndl
VvasScaler 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 * hndl
VvasScaler 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 * hndl
VvasScaler handle pointer created using vvas_scaler_create
VvasScalerFilterCoefType coef_type
Filter 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 * hndl
VvasScaler 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 * prop
Scaler properties VvasScalerProp
Return
VvasReturnType
-
VvasReturnType vvas_scaler_prop_set(VvasScaler *hndl, VvasScalerProp *prop)¶
This API is used to set properties of VvasScaler
Parameters
VvasScaler * hndl
VvasScaler handle pointer created using vvas_scaler_create
VvasScalerProp * prop
Scaler 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_path
Model path
model_name
Model name
model_format
Color format of the input image, like BGR, RGB etc., expected by the model
modelclass
Model class
batch_size
Batch size
need_preprocess
If this is set to true, then software pre-processing will be performed using Vitis-AI library
performance_test
Performance test
objs_detection_max
Sort the detected objects based on area of the bounding box, from highest to lowest area.
filter_labels
Array of labels to process
num_filter_labels
Number of labels to process
float_feature
Float feature
segoutfmt
Segmentation output format
segoutfactor
Multiplication 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_width
Model required width
model_height
Model required height
batch_size
Model supported batch size
mean_r
Mean value of R channel
mean_g
Mean value of G channel
mean_b
Mean value of B channel
scale_r
Scale value of R channel
scale_g
Scale value of G channel
scale_b
Scale 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_conf
VvasDpuInferConf structure.
VvasLogLevel log_level
VvasLogLevel 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_handle
VvasDpuInfer 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_size
Batch 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_handle
VvasDpuInfer 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_handle
VvasDpuInfer handle created using vvas_dpuinfer_create.
VvasModelConf *model_conf
VvasModelConf 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_path
Model path
model_name
Model name
-
VvasPostProcessor *vvas_postprocess_create(VvasPostProcessConf *postproc_conf, VvasLogLevel log_level)¶
Upon success initializes post-processor instance with config parameters.
Parameters
VvasPostProcessConf * postproc_conf
VvasPostProcessConf structure.
VvasLogLevel log_level
VvasLogLevel 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_handle
post-processing handle created using vvas_postprocess_create.
VvasInferPrediction *src
Pointer 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_handle
post-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_IOU
Intersection-Over-Union algorithm
TRACKER_ALGO_MOSSE
Minimum Output Sum of Squared Error algorithm
TRACKER_ALGO_KCF
Kernelized Correlation Filter algorithm
TRACKER_ALGO_NONE
No 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_RGB
Use RGB color space for object matching
TRACKER_USE_HSV
Use HSV (Hue-Saturation-Value) color space for object matching.
-
enum VvasTrackerSearchScale¶
Enum representing search scales to be used for tracking
Constants
SEARCH_SCALE_ALL
Search for object both in up, same and down scale
SEARCH_SCALE_UP
Search for object in up and same scale only
SEARCH_SCALE_DOWN
Search for object in down and same scale only
SEARCH_SCALE_NONE
Search 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_type
Tracker algorithm to be used 0:IOU 1:KCF Tracker 2:MOSSE Tracker
iou_use_color
To use color information for matching or not duirng IOU tracking
obj_match_color
Color space to be used for object matching
search_scales
Search scales of object during tracking
fet_length
Feature length to be used during KCF based tracking
min_width
Minimum width for considering as noise
min_height
Minimum height for considering as noise
max_width
Maximum width for considering as noise
max_height
Maximum height for considering as noise
num_inactive_frames
Number of frames wait for object reappearing before consider as inactive
num_frames_confidence
Number of frames of continuous detection before considering for tracking and assiging an ID
padding
Extra area surrounding the target to search in tracking
obj_match_search_region
Search for nearest object to match
dist_correlation_threshold
Objects correlation threshold
dist_overlap_threshold
Objects overlap threshold
dist_scale_change_threshold
Ojbects scale change threshold
dist_correlation_weight
Weightage for correlation in distance function
dist_overlap_weight
Weightage for overlap in distance function
dist_scale_change_weight
Weightage for scale change in distance function
occlusion_threshold
Occlusion threshold to ignore objects for tracking
confidence_score
Tracker confidence threshold for tracking
skip_inactive_objs
Flag 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_ctx
Pointer VvasContext handle.
VvasTrackerconfig *config
Pointer 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_hndl
ref VvasTracker with newly detected objects in VvasTracker:new_objs. Upon tracking updates ref VvasTracker:trk_objs with tracked objects info.
VvasVideoFrame *pFrame
ref VvasVideoFrame structure of input frame.
VvasInferPrediction **infer_meta
ref 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_hndl
Pointer 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
red
Red component value
green
Green component value
blue
Blue 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
name
Name of object to be considered for processing by metaconvert
color
Color components to be applied on the object
do_mask
If 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_type
Font type
enum VvasFontType
font_size
Font size
line_thickness
Line thickness while drawing rectangles or lines
radius
Circle/point radius
level
Prepare VvasOverlayShapeInfo from nodes present in specific level only. With level = 0, displays all nodes information
mask_level
Apply masking at specific level
y_offset
Y-axis offset while displaying text
draw_above_bbox_flag
Flag to draw text above or inside bounding box. In case x and y position are zero draws inside frame left top corner
text_color
Color values to be used to display text
allowed_labels
List of labels from VvasInferPrediction to be considered while creating text. If allowed_labels is NULL, then all possible VvasInferPrediction labels are allowed
allowed_labels_count
Count of the filter_labels array
allowed_classes
Consider only specific classes and respective color while preparing
struct VvasOverlayShapeInfo
allowed_classes_count
Count 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_ctx
Handle to VVAS context
VvasMetaConvertConfig *cfg
Handle to
struct VvasMetaConvertConfig
VvasLogLevel log_level
Log level to be used to dump metaconvert logs
VvasReturnType *ret
Address 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_convert
Handle to VVAS Meta convert
VvasTreeNode *parent
Handle to parent node of Inference prediction tree
VvasOverlayShapeInfo *shape_info
Handle to overlay information which will be used overlay module to draw bounding box
Return
-
void vvas_metaconvert_destroy(VvasMetaConvert *meta_convert)¶
Destorys
struct VvasMetaConvert
handle
Parameters
VvasMetaConvert *meta_convert
Handle 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_START
START
ARROW_DIRECTION_END
END
ARROW_DIRECTION_BOTH_ENDS
BOTH_ENDS
-
struct VvasOverlayCoordinates¶
Structure representing Coordinate information
Definition
struct VvasOverlayCoordinates {
int32_t x;
int32_t y;
};
Members
x
x offset
y
y offset
-
struct VvasOverlayColorData¶
Structure representing Color information
Definition
struct VvasOverlayColorData {
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
};
Members
red
red value
green
green value
blue
blue value
alpha
alpha value
-
struct VvasOverlayFontData¶
Structure representing Font information
Definition
struct VvasOverlayFontData {
uint32_t font_num;
float font_size;
VvasOverlayColorData font_color;
};
Members
font_num
font style number from openCV
font_size
font size
font_color
font 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
points
frame coordinate info
width
width of the rectangle
height
height of the rectangle
thickness
thickness of rectangle
apply_bg_color
flag to apply bg color
rect_color
color information of rectangle
bg_color
color 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
points
text coordinate info
disp_text
display text
bottom_left_origin
display text position
apply_bg_color
display text background color
text_font
display text font
bg_color
background 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_pt
line start coordinate info
end_pt
line end coordinate info
thickness
Thickness in units of Pixels
line_color
color 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_pt
arrow start coordinate info
end_pt
arrow end coordinate info
arrow_direction
arrow direction
thickness
thickness in units of Pixels
tipLength
tip length
line_color
color information
-
struct VvasOverlayCircleParams¶
Structure representing Circle Information
Definition
struct VvasOverlayCircleParams {
VvasOverlayCoordinates center_pt;
uint32_t thickness;
uint32_t radius;
VvasOverlayColorData circle_color;
};
Members
center_pt
circle coordinate info
thickness
circle thickness
radius
circle radius
circle_color
color 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_pts
polygon coordinate info
thickness
polygon thickness
num_pts
number of points
poly_color
polygon 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_rects
number of rectangles to be displayed
num_text
number of texts to be displayed
num_lines
number of lines to be displayed
num_arrows
number of arrows to be displayed
num_circles
number of circles to be displayed
num_polys
number of polygons to be displayed
rect_params
rectangle information
text_params
text meta information
line_params
line meta information
arrow_params
arrow meta information
circle_params
circle meta information
polygn_params
polygon meta information
-
void vvas_overlay_shape_info_init(VvasOverlayShapeInfo *shape_info)¶
Initializes shape_info parameters
Parameters
VvasOverlayShapeInfo *shape_info
Pointer 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_info
Destination shape info structure
VvasOverlayShapeInfo *src_shape_info
Source shape info structure
Return
none
-
void vvas_overlay_shape_info_free(VvasOverlayShapeInfo *shape_info)¶
Deinitializes shape_info parameters
Parameters
VvasOverlayShapeInfo *shape_info
Pointer 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
stride
stride information
height
height of the frame
width
width of the frame
fmt
Specify input frame color format
buf_addr
Address 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_clock
display clock true or false
clock_font_name
font style name
clock_font_scale
font scale
clock_font_color
font color
clock_x_offset
clock x offset
clock_y_offset
clock 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_info
frame information
clk_info
clock overlay information
shape_info
Overlay information
-
VvasReturnType vvas_overlay_process_frame(VvasOverlayFrameInfo *pFrameInfo)¶
Parameters
VvasOverlayFrameInfo *pFrameInfo
Address 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_PASS
Indicates operation is success.
VVAS_METAAFFIXER_NO_FRAME_OVERLAP
Indicates no frame overlap occured.
VVAS_METAAFFIXER_NULL_VALUE
Indicates 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_dur
Duration of the infer frame.
uint32_t infer_queue_size
Represents Max queue size of the infer frame
VvasLogLevel loglevel
Indicates 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 *handle
MetaAffixer 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 *handle
Address of context handle ref VvasMetaAffixer
bool sync_pts
if FALSE then last received infer meta data is used for scaling. Else reference infer metadata is chosen based on PTS of input frame.
VvasVideoInfo *vinfo
Input Frame Information
VvasMetadata *metadata
Metadata of input frame
VvasMetaAffixerRespCode *respcode
Metaaffixer response code.
VvasInferPrediction **ScaledMetaData
Scaled 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 *handle
Context handle ref VvasMetaAffixer
VvasVideoInfo *vinfo
Address of frame info
VvasMetadata *metadata
Metadata of frame
VvasInferPrediction *infer
Infer 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
p
Pointer for Mutex Handle.
i
Mutex count.
Parameters
VvasMutex *mutex
Handle of mutex.
Return
None.
Parameters
VvasMutex *mutex
Handle 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 *mutex
Address 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 *mutex
Address of mutex object.
Context
This function unlocks mutex.
Return
None.
Parameters
VvasMutex *mutex
Address 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
data
Holds the address of data.
next
Holds the address of next element in list.
prev
Holds the address of previous element in list.
Parameters
VvasList* list
Pointer to VvasList.
Return
None
Parameters
VvasList* list
Pointer to VvasList in which element has to be added.
void *data
Element to be added into the list.
Return
On success Returns the updated list.
On Failure returns NULL.
Parameters
VvasList* list
Pointer to VvasList.
Return
Number of element in the VvasList.
Parameters
VvasList * list
Pointer to VvasList.
void * data
Data 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* list
Pointer to VvasList.
uint32_t n
Position of the element.
Return
On Success returns the pointer to Element data.
On Failure return NULL.
Parameters
VvasList* list
Pointer to VvasList.
const void* data
Pointer to the data to be removed. Data is owned by the caller
Return
Updated VvasList
Parameters
VvasList* list
Pointer 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 *data
List element data handle.
void *udata
User 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* list
A pointer to VvasList.
VvasFunc func
A callback function to be called for each element of the list.
void *data
User 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 *data
Data 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* list
Pointer to VvasList.
vvas_list_free_notify func
Pointer 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_list
Source data handle.
void* data
User 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* list
Pointer to VvasList.
vvas_list_copy_func func
Pointer to vvas_list_copy_func.
void* data
Pointer 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 length
Queue 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_queue
VvasQueue 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 *data
data 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_queue
VvasQueue allocated using vvas_queue_new.
VvasQueueDestroyNotify free_func
Callback 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_queue
VvasQueue 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_queue
VvasQueue allocated using vvas_queue_new.
VvasQueueDestroyNotify free_func
Callback 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_queue
VvasQueue 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_queue
VvasQueue 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 *data
Queue handle.
void *udata
user 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_queue
VvasQueue allocated using vvas_queue_new.
VvasQueueFunc func
A callback function to be called for each element of the queue.
void *user_data
user 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_queue
VvasQueue allocated using vvas_queue_new.
void *data
The 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_queue
VvasQueue allocated using vvas_queue_new.
void *data
The 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_queue
VvasQueue 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_queue
VvasQueue 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_queue
VvasQueue allocated using vvas_queue_new.
uint64_t timeout
Time 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
data
Handle for storing data.
next
Handle for storing next node.
prev
Handle for storing Previous node.
parent
Handle for storing Parent node.
children
Handle for storing children.
-
enum VvasTreeNodeTraverseType¶
This enum is defines node traverse type.
Constants
IN_ORDER
Visits a node’s left child first, then the node itself, then its right child.
PRE_ORDER
Visits a node, then its children.
POST_ORDER
Visits a node’s children, then the node itself.
-
enum VvasTreeNodeTraverseFlags¶
This enum defines which nodes to be visited.
Constants
TRAVERSE_LEAFS
Only leaf nodes should be visited.
TRAVERSE_NON_LEAFS
Only non-leaf nodes should be visited.
TRAVERSE_ALL
All nodes should be visited.
-
VvasTreeNode *vvas_treenode_new(void *data)¶
Creates new tree node.
Parameters
void* data
Address 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* node
Address 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* src
Data to be copied.
void* data
Additional 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* node
Address of source node to copy data from.
vvas_treenode_copy_func func
Address of function which is called to copy data in each node.
void *data
Additional 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 *Node
Address of node.
void *data
User 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 *node
Node of the tree to start traversing.
VvasTreeNodeTraverseType traverse_order
Order in which nodes are to be traversed in a tree.
VvasTreeNodeTraverseFlags traverse_flags
Order in which children of nodes to be visited.
int32_t max_depth
Maximum depth of traversal, if max_depth is -1 then all nodes in tree are visited.
vvas_treenode_traverse_func func
Function to be called for each node visit.
void *data
User 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_node
Parent node.
VvasTreeNode *child_node
child 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 *Node
Address of node.
void *data
User 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 *node
Parent node address.
VvasTreeNodeTraverseFlags traverse_flags
Order in which children of nodes to be visited.
vvas_treenode_traverse_child_func func
Function to be called for each child node visit.
void *data
User 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 *node
Address 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 *node
Address 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_node
Address 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 *parent
Address of the parent node.
VvasTreeNode* sibling
Address of the sibling node.
VvasTreeNode* node
Address 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
dummy1
Pointer handle, this is internal member users need not pass value.
dummy2
Pointer handle, this is internal member users need not pass value.
dummy3
Pointer handle, this is internal member users need not pass value.
dummy4
int value, this is internal member users need not pass value.
dummy5
bool value, this is internal member users need not pass value.
dummy6
Pointer 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 * key
Key value.
Return
Hash value.
-
VvasEqualFunc¶
Typedef: Function pointer to compare key values.
Syntax
bool VvasEqualFunc (const void * a, const void * b)
Parameters
const void * a
Key value to be compared.
const void * b
Key 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 * data
Data 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 * key
Key value.
void * value
Hash value.
void * user_data
User data to be passed.
Return
False to end loop.
-
uint32_t vvas_direct_hash(const void *key)¶
Converts gpointer to hash.
Parameters
const void * key
Key Value.
Return
A Hash value.
-
uint32_t vvas_int_hash(const void *key)¶
Converts gpointer to int value.
Parameters
const void * key
Key Value.
Return
A Hash value.
-
uint32_t vvas_str_hash(const void *key)¶
Converts a string to hash value.
Parameters
const void * key
Key Value.
Return
A Hash value.
-
bool vvas_direct_equal(const void *a, const void *b)¶
Compares pointers.
Parameters
const void * a
Pointer to be compared.
const void * b
Pointer to be compared.
Return
True if equal.
-
bool vvas_int_equal(const void *a, const void *b)¶
Compares two int values.
Parameters
const void * a
Pointer to be compared.
const void * b
Pointer to be compared.
Return
True if equal.
-
bool vvas_int64_equal(const void *a, const void *b)¶
Compares two int64 values.
Parameters
const void * a
Pointer to be compared.
const void * b
Pointer to be compared.
Return
True if equal.
-
bool vvas_double_equal(const void *a, const void *b)¶
Compares two double values.
Parameters
const void * a
Pointer to be compared.
const void * b
Pointer to be compared.
Return
True if equal.
-
bool vvas_str_equal(const void *a, const void *b)¶
Compares two strings.
Parameters
const void * a
Pointer to be compared.
const void * b
Pointer 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_func
A function to create a hash value from a key.
VvasEqualFunc key_eq_func
A 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_func
A function to create a hash value from a key.
VvasEqualFunc key_eq_func
A function to create a hash value from a key.
VvasDestroyNotify key_destroy_fn
function 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_fn
A 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_table
Handle for VvasHashTable.
void * key
A key to insert.
void * value
The 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_table
Handle for VvasHashTable.
const void * key
The 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_table
Handle for VvasHashTable.
void * key
A 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_table
Handle 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_table
Handle for VvasHashTable.
void * key
The 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_table
Handle for VvasHashTable.
VvasHRFunc func
The function to call for each key/value pair.
void * user_data
user 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_table
Handle for VvasHashTable.
Return
None.
-
void vvas_hash_table_unref(VvasHashTable *hash_table)¶
Decrement the reference count by one.
Parameters
VvasHashTable* hash_table
Handle 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_table
Handle 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_table
Handle for VvasHashTable.
VvasHashTableIter *iter
Handle 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 *iter
Handle for VvasHashTableIter.
void **key
Pointer to update.
void **value
Pointer to update.
Context
Allows to iterate through the table and updates information in Key and values params passed.
Return
None.