Decode

Function Usage

Video decoding API of the VideoDecoder class.

When an instantiated decoder invokes the Decode API for the first time, the system checks whether the scenario is a pre-allocation scenario. In this case, call the Decode API to pre-allocate output memory to prevent API calling failure.

Prototype

APP_ERROR Decode(const std::shared_ptr<uint8_t> data, const uint32_t dataSize,
                 const uint32_t frameId, void* userData);
APP_ERROR Decode(const std::shared_ptr<uint8_t> data, const uint32_t dataSize, const uint32_t frameId,
                 Image& preMallocData, void* userData);

Parameter Description

Parameter

Input/Output

Description

data

Input

Memory address of the data before decoding

dataSize

Input

Memory size of the data before decoding

frameId

Input

Video frame ID before decoding

userData

Input/Output

User-defined data, which is transferred to the user-defined callback function and is used to obtain the decoding result.

preMallocData

Input

To use the pre-allocated memory, users need to construct the Image class based on the allocated memory address, memory size, image width and height, device ID, and image format.

Return Parameter Description

Data Structure

Description

APP_ERROR

Error code returned during program execution. For details, see the MxBase/ErrorCode/ErrorCode.h file.