hbVPVideoDecode

typedef struct { uint8_t pixelFormat; uint32_t inBufSize; uint32_t outBufCount; hbVPVideoType videoType; } hbVPVideoDecParam;

Parameter for Video decoding.

  • Member

    Member NameDescription
    pixelFormatThe pixel format of the input image. The HB_VP_IMAGE_FORMAT_NV12 and HB_VP_IMAGE_FORMAT_YUV420 formats are currently supported.
    inBufSizeSpecifies the size of the internal input buffer of VPU, its size needs to satisfy 1024 alignment. Value range [1024, 2^31-1], default value 10 * 1024 * 1024.
    outBufCountSpecifies the count of output buffers the VPU. Value range [1, 31], default value 5.
    videoTypeThe type of encoding protocol.
int32_t hbVPGetDefaultVideoDecParam(hbVPVideoDecParam *param);

Get the decoder's default decoding parameter.

  • Parameter
    • [in] param Decode the parameter pointer.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
int32_t hbVPCreateVideoDecContext(hbVPVideoContext *context, hbVPVideoDecParam const *param);

The API for calling to create decoder context and initialize context to nullptr in advance before creation.

  • Parameter
    • [out] context Decoder context pointer.
    • [in] param Decode the parameter pointer.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • The VPU highest supports the creation of 32 encoding or decoding contexts.
    • The first frame of the decoder must be an IDR frame containing the header information of VPS+SPS+PPS, otherwise it cannot be decoded properly.
    • The decoder does not support decoding of B-frame streams containing backward reference frames.
int32_t hbVPReleaseVideoDecContext(hbVPVideoContext context);

The API for calling to release the decoder context.

  • Parameter
    • [in] context Decoder context pointer.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
int32_t hbVPVideoDecode(hbUCPTaskHandle_t *taskHandle, hbVPArray const *srcBuf, hbVPVideoContext context);

The API for calling the VPU decoding

  • Parameter
    • [out] taskHandle Task handles are responsible for the interaction of the operator with the UCP architecture.
    • [in] srcBuf Pointer the memory address where the H.264 or H.265 data is stored.
    • [in] context Decoder context pointer.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • Create the task using asynchronous methods is only supported.
int32_t hbVPGetVideoDecOutputBuffer(hbUCPTaskHandle_t taskHandle, hbVPArray *outBuf);

The API calling for to get the decoded data buffer.

  • Parameter
    • [in] taskHandle Task handles are responsible for the interaction of the operator with the UCP architecture.
    • [out] outBuf Pointer the memory address that holds the decoded data.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • The output buffer outBuf is requested internally by the VPU.
    • The buffer contains valid data upon the task is successfully completed, and is released during the task release phase.