VPI - Vision Programming Interface

0.4.4 Release

NvBuffer Interoperability

Declaration of functions for NvBuffer interoperability. More...

Functions

VPIStatus vpiImageCreateNvBufferWrapper (int dmabuf_fd, uint32_t flags, VPIImage *img)
 Create an image object by wrapping an existing NvBuffer given its dmabuf_fd handle. More...
 
VPIStatus vpiImageSetWrappedNvBuffer (VPIImage img, int dmabuf_fd)
 Redefines the wrapped NvBuffer memory in an existing VPIImage wrapper. More...
 

Detailed Description

Declaration of functions for NvBuffer interoperability.

The provided methods allows wrapping user-created NvBuffer objects (also known as dmabuf_fd) to be used in VPI compute pipelines. NvBuffers are sometimes used to interface with Jetson Linux Multimedia API.

Function Documentation

◆ vpiImageCreateNvBufferWrapper()

VPIStatus vpiImageCreateNvBufferWrapper ( int  dmabuf_fd,
uint32_t  flags,
VPIImage img 
)

#include <vpi/Image.h>

Create an image object by wrapping an existing NvBuffer given its dmabuf_fd handle.

The underlying image object does not own/claim the memory block.

Parameters
[in]dmabuf_fdHandle to the NvBuffer to be wrapped.
[in]flagsImage flags. Here it can be specified in what backends the image can be used by or-ing together VPIBackend flags. Set flags to 0 to enable it in all backends supported by the active VPI context.
[out]imgPointer to memory that will receive the created image handle.
Returns
an error code on failure else VPI_SUCCESS

◆ vpiImageSetWrappedNvBuffer()

VPIStatus vpiImageSetWrappedNvBuffer ( VPIImage  img,
int  dmabuf_fd 
)

#include <vpi/Image.h>

Redefines the wrapped NvBuffer memory in an existing VPIImage wrapper.

The old wrapped NvBuffer and the new one must have same dimensions and format.

The VPIImage must have been created by vpiImageCreateNvBufferWrapper.

This operation is efficient and does not allocate memory. The wrapped NvBuffer will be accessible to the same backends specified during wrapper creation.

The wrapped NvBuffer must not be deallocated while it's still being wrapped.

Parameters
[in]imgHandle to image created by vpiImageCreateCudaMemWrapper.
[in]dmabuf_fdThe new NvBuffer to be wrapped.
Returns
an error code on failure else VPI_SUCCESS