Data Structures | |
struct | VPIPyramidData |
Stores the pyramid contents. More... | |
Macros | |
#define | VPI_MAX_PYRAMID_LEVEL_COUNT (10) |
Maximum number of pyramid levels. | |
Typedefs | |
typedef struct VPIPyramidImpl * | VPIPyramid |
Functions | |
VPIStatus | vpiPyramidCreate (uint32_t width, uint32_t height, VPIImageType fmt, uint32_t numLevels, float scale, uint32_t flags, VPIPyramid *pyr) |
Create an empty image pyramid instance with the specified flags. More... | |
void | vpiPyramidDestroy (VPIPyramid pyr) |
Destroy an image pyramid instance as well as all resources it owns. More... | |
VPIStatus | vpiPyramidGetFlags (VPIPyramid pyr, uint32_t *flags) |
Returns the flags associated with the pyramid. More... | |
VPIStatus | vpiPyramidGetType (VPIPyramid pyr, VPIImageType *type) |
Returns the image type of the pyramid levels. More... | |
VPIStatus | vpiPyramidGetNumLevels (VPIPyramid pyr, uint32_t *numLevels) |
Get the image pyramid level count. More... | |
VPIStatus | vpiPyramidGetWidth (VPIPyramid pyr, uint32_t outSize, uint32_t *out) |
Get the image width in pixels (for all levels at once). More... | |
VPIStatus | vpiPyramidGetHeight (VPIPyramid pyr, uint32_t outSize, uint32_t *out) |
Get the height of all image levels. More... | |
VPIStatus | vpiPyramidLock (VPIPyramid pyr, VPILockMode lock, VPIPyramidData *out) |
Acquires the lock on a pyramid object and returns pointers to each level of the pyramid. More... | |
VPIStatus | vpiImageWrapPyramidLevel (VPIPyramid pyr, uint32_t level, VPIImage *img) |
Creates an image that wraps one pyramid level. More... | |
VPIStatus | vpiPyramidUnlock (VPIPyramid pyr) |
Releases the lock on a image pyramid object. More... | |
Pyramid flags | |
#define | VPI_PYRAMID_NO_PVA 0x01 |
Pyramid can't be used by PVA backend. | |
#define | VPI_PYRAMID_NO_CPU 0x02 |
Pyramid can't be used by CPU backend. | |
#define | VPI_PYRAMID_NO_CUDA 0x04 |
Pyramid can't be used by CUDA backend. | |
Pyramid helper flags | |
#define | VPI_PYRAMID_ONLY_CUDA (VPI_PYRAMID_NO_PVA | VPI_PYRAMID_NO_CPU) |
Pyramid can only be used by CUDA backend. | |
#define | VPI_PYRAMID_ONLY_CPU (VPI_PYRAMID_NO_PVA | VPI_PYRAMID_NO_CUDA) |
Pyramid can only be used by CPU backend. | |
#define | VPI_PYRAMID_ONLY_PVA (VPI_PYRAMID_NO_CUDA | VPI_PYRAMID_NO_CPU) |
Pyramid can only be used by PVA backend. | |
An abstract representation of a 2D image pyramid.
Pixel formats match the ones supported by image container. The pyramid is not necessarily dyadic. The scale between levels is defined in the constructor.
2D image pyramid containers are created by calling vpiPyramidCreate to allocate and initialize an empty (zeroed) VPIPyramid object. The memory for the pyramid image data is allocated and managed by the backend implementation.
Parameters such as levels, scale, width, height and pixel format are immutable and specified at the construction time. The internal memory layout is also backend-specific. More importantly, efficient exchange of image pyramid data between different hardware blocks might force the implementation to allocate the memory in multiple memory pools (e.g. dGPU and system DRAM). In some scenarios (to optimize performance and memory use), it might be beneficial to constrain the internal allocation policy to support only a particular set of backends. This is implemented with VPI_PYRAMID_NO_PVA, VPI_PYRAMID_NO_CPU, VPI_PYRAMID_NO_CUDA set of flags which are passed during image pyramid construction. For example, an image pyramid allocated with VPI_PYRAMID_NO_CUDA flag set, will not be readable or writeable by any CUDA VPIStream instance.
The set of vpiPyramidLock / vpiPyramidUnlock calls allows the user to read from/write to the image data from the host. These functions are non-blocking and oblivious to the device command queue, so it's up to the user to make sure that all pending operations using this image pyramid as input or output are finished. Also, depending on the VPIStream type, lock/unlock operation might be time-consuming and, for example, involve copying data over PCIe bus for dGPUs.
struct VPIPyramidData |
Stores the pyramid contents.
Every level is represented by an entire VPIImageData. There are numLevels
levels, and they can be accessed from levels[0]
to levels[numLevels-1]
.
Data Fields | ||
---|---|---|
VPIImageData | levels[VPI_MAX_PYRAMID_LEVEL_COUNT] |
Contents of every pyramid level. Only the first numLevels levels has valid data. |
int32_t | numLevels |
Number of levels (i.e. height) of the pyramid. |
typedef struct VPIPyramidImpl* VPIPyramid |
VPIStatus vpiImageWrapPyramidLevel | ( | VPIPyramid | pyr, |
uint32_t | level, | ||
VPIImage * | img | ||
) |
#include <vpi/Pyramid.h>
Creates an image that wraps one pyramid level.
The created image doesn't own its contents. Destroying the pyramid while there are images wrapping its levels leads to undefined behavior. If image wraps the base pyramid level, locking the pyramid will also lock the image. Once the image isn't needed anymore, call vpiImageDestroy to free resources.
pyr | [in] The pyramid whose level will be wrapped. |
level | [in] Pyramid level to wrap. |
img | [out] Pointer to an image handle that will hold the created image. |
VPIStatus vpiPyramidCreate | ( | uint32_t | width, |
uint32_t | height, | ||
VPIImageType | fmt, | ||
uint32_t | numLevels, | ||
float | scale, | ||
uint32_t | flags, | ||
VPIPyramid * | pyr | ||
) |
#include <vpi/Pyramid.h>
Create an empty image pyramid instance with the specified flags.
Image data is zeroed.
width | [in] width |
height | [in] height |
numLevels | [in] numLevels |
scale | [in] scale |
fmt | [in] image pixel format |
flags | [in] flags |
pyr | [out] pointer to image pyramid handle |
void vpiPyramidDestroy | ( | VPIPyramid | pyr | ) |
#include <vpi/Pyramid.h>
Destroy an image pyramid instance as well as all resources it owns.
pyr | [in] pyramid handle |
VPIStatus vpiPyramidGetFlags | ( | VPIPyramid | pyr, |
uint32_t * | flags | ||
) |
#include <vpi/Pyramid.h>
Returns the flags associated with the pyramid.
pyr | [in] pyramid handle |
flags | [out] pointer to where the flags will be written. |
VPIStatus vpiPyramidGetHeight | ( | VPIPyramid | pyr, |
uint32_t | outSize, | ||
uint32_t * | out | ||
) |
#include <vpi/Pyramid.h>
Get the height of all image levels.
pyr | [in] an image pyramid handle |
outSize | [in] size of the output array in elements |
out | [out] a pointer to an array which will be filled heights of the image pyramid levels |
VPIStatus vpiPyramidGetNumLevels | ( | VPIPyramid | pyr, |
uint32_t * | numLevels | ||
) |
#include <vpi/Pyramid.h>
Get the image pyramid level count.
pyr | [in] an image pyramid handle |
numLevels | [out] a pointer to a variable which will be set to the number of levels of the image pyramid |
VPIStatus vpiPyramidGetType | ( | VPIPyramid | pyr, |
VPIImageType * | type | ||
) |
#include <vpi/Pyramid.h>
Returns the image type of the pyramid levels.
pyr | [in] pyramid handle |
type | [out] pointer to where the image type will be written. |
VPIStatus vpiPyramidGetWidth | ( | VPIPyramid | pyr, |
uint32_t | outSize, | ||
uint32_t * | out | ||
) |
#include <vpi/Pyramid.h>
Get the image width in pixels (for all levels at once).
pyr | [in] an image pyramid handle |
outSize | [in] size of the output array in elements |
out | [out] a pointer to an array which will be filled widths of the image pyramid levels |
VPIStatus vpiPyramidLock | ( | VPIPyramid | pyr, |
VPILockMode | lock, | ||
VPIPyramidData * | out | ||
) |
#include <vpi/Pyramid.h>
Acquires the lock on a pyramid object and returns pointers to each level of the pyramid.
Depending on the internal image representation, as well as the actual location in memory, this function might have a significant performance overhead (format conversion, layout conversion, device-to-host memory copy).
pyr | [in] an image pyramid handle |
lock | [in] lock mode |
out | [out] a pointer to a structure that will receive the pyramid data to be accessed by host |
VPIStatus vpiPyramidUnlock | ( | VPIPyramid | pyr | ) |
#include <vpi/Pyramid.h>
Releases the lock on a image pyramid object.
This function might have a significant performance overhead (format conversion, layout conversion, host-to-device memory copy).
pyr | [in] an image pyramid handle |