aclvdecSendFrame

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function Description

Transmit the input buffer and output buffer to the decoder for decoding. This API is asynchronous.

Prototype

1
2
3
4
5
aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc,
acldvppStreamDesc *input,
acldvppPicDesc *output,
aclvdecFrameConfig *config,
void *userData)

Parameters

Parameter

Input/Output

Description

channelDesc

Input

Pointer to the channel description.

The value must be the same as that of channelDesc specified when the aclvdecCreateChannel API is called to create a channel.

Call aclvdecSetChannelDesc series to set attributes of the channel description, including the decoding channel ID, thread, callback function, and video encoding protocol.

Due to software restrictions, the aclvdecSetChannelDescRefFrameNum API cannot be called to set the attributes of the channel description only on Atlas 200/300/500 inference product and Atlas training product . If the aclvdecSetChannelDescRefFrameNum API is called, an error is returned.

input

Input

Pointer to the input stream description. You need to allocate the input buffer in advance.

output

Input/Output

Pointer to the description of the output image. You need to allocate the output buffer in advance.

When output is an input, the user needs to:

  • Call the acldvppCreatePicDesc API to create the image description.
  • Call acldvppSetPicDesc series to set the data buffer, buffer size, width, height, and format of the output image.
    • The output width and height correspond to four parameters: width, height, widthStride, and heightStride. When the width is less than 16, widthStride must be aligned to 32 instead of 16. If none of the four parameters are set, the input width and height are used. If only some of the four parameters are set, the API returns an error.
    • If the output image format is set in this API call, the setting is applied. Otherwise, the setting in the channel description is applied.
    • For details about the output image format requirements, see VDEC Functions and Restrictions.

When the output parameter is used as output, you need to call acldvppGetPicDesc series APIs in the callback function to obtain the decoded output image data. For an interlaced stream, two fields are transmitted every frame. It is normal that one of two transmitted fields has no decoding output and the error code ERR_DECODE_NOPIC = 0x20000 is returned. The decoding output of the interlaced stream is stored in the output buffer corresponding to the odd field.

config

Input

Pointer to the decoding configuration. This field is reserved and can be set to NULL.

userData

Input

Pointer to the user-defined data.

If you want to obtain the sequence number of the decoded frame, define the userData parameter. Then, the sequence number can be passed to the VDEC callback function to determine the frame to be processed.

Returns

0 on success; otherwise, failure. For details, see aclError.

Restrictions

  • The channel passed to this call must have been created. Otherwise, an error code is returned.
  • A stream must be fed in frame mode, which means that a complete frame must be fed in every call to this API.
  • It is not supported to feed empty packets with eos set to 0 (the stream length is 0 or the stream address is empty).
  • When the stream is completely fed to the decoder, feed a frame with eos set to 1 to inform the decoder of the completion of the stream file. After the EOS frame is fed to the decoder, this API call returns the decoding result only after all transmitted frames are decoded and the user-defined callback function handling is complete.
  • Due to stream exceptions or decoding timeout, the aclvdecSendFrame API may fail to send frames or EOS. You are advised to obtain the return code of this API when writing code. If this API fails to be called, handle the exception.
  • aclvdecSendFrame encapsulates the aclrtLaunchCallback API to add a callback function to be executed to the stream task queue. When implementing the VDEC function, <cf id="Bold">aclrtLaunchCallback</cf> does not need to be called separately.

See Also

For details about the API call sequence and example, see VDEC.