Updated on 2022-03-13 GMT+08:00

HIAI_DVPP_DMalloc

Allocates memory for DVPP on the device side. This API is defined in c_graph.h. After this API is called to allocate memory, HIAI_DVPP_DFree must be called to free the memory.

Syntax

void* HIAI_DVPP_DMalloc(const uint32_t dataSize)

Parameter Description

Parameter

Description

Value Range

dataSize

Size of a memory block

0 to (256 MB – 96 bytes), excluding 0. The recommended range is (256 KB – 96 bytes) to (256 MB – 96 bytes).

The model manager on the device side occupies 96 bytes.

Return Value

Address of the memory allocated by using HIAI_DVPP_DMalloc. If the memory fails to be allocated, a null pointer is returned.

Remarks

HIAI_DVPP_DMalloc is a new API for allocating memory to DVPP. The memory allocated by using this API can meet the various memory requirements of DVPP.

If HIAI_DMalloc(1000, buffer, 1000, HIAI_MEMORY_HUGE_PAGE) is called to allocate memory for DVPP in the earlier version, use HIAI_DVPP_DMalloc instead. For details, see HIAI_DMalloc.

Usage Example:

// Allocate memory by using HIAI_DVPP_DMalloc.
uint32_t allocSize = 1000;
char* allocBuffer = (char*)HIAI_DVPP_DMalloc(allocSize);
if (allocBuffer == nullptr) {
   // If the allocation fails, handle the exception.
}