hi_mpi_vdec_send_stream

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

Feeds the stream and decoding result buffer to a decoding channel.

During decoding, the input and output memory can be released only after the hi_mpi_vdec_get_frame interface is called to obtain the result.

Prototype

hi_s32 hi_mpi_vdec_send_stream(hi_vdec_chn chn, const hi_vdec_stream *stream, hi_vdec_pic_info *vdec_pic_info, hi_s32 milli_sec)

Parameters

Parameter

Input/Output

Description

chn

Input

Decoding channel ID.

Atlas 350 Accelerator Card: The value range is [0, 256). The maximum number of JPEGD channels is 256.

Atlas A3 training product / Atlas A3 inference product : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256. Among them, a maximum of 256 JPEGD decoding channels and 32 VDEC decoding channels are supported.

Atlas A2 training product / Atlas A2 inference product : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256. Among them, a maximum of 256 JPEGD decoding channels and 32 VDEC decoding channels are supported.

Atlas 200I/500 A2 inference product : The value range of this parameter is [0, 128). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 128.

Atlas inference product : The value range of this parameter is [0, 256). The JPEGD and VDEC functions share the same channels, and the maximum number of channels is 256.

stream

Input

Pointer to the input stream information.

The configured addr must be a buffer address on the device.

vdec_pic_info

Input

Pointer to the information of the output image.

milli_sec

Input

Timeout interval (ms).
  • -1: blocking mode.
  • 0: non-blocking mode.
  • > 0: timeout interval (timeout mode). The timeout interval varies with the operating system. The deviation is generally within a time slice of an operating system. For example, if the time slice of an operating system is 4 ms and the value of milli_sec is set to 1, the actual timeout interval ranges from 1 ms to 5 ms. When the CPU load is high, the timeout interval may fluctuate.

Returns

Restrictions

  • For details about the requirements on the input and output memory, input stream format, and output image format for video decoding, see VDEC Functions and Restrictions.
  • For details about the requirements on the input and output memory, input image format, and output image format, see JPEGD Functions and Restrictions.
  • Before sending data, ensure that the hi_mpi_vdec_start_recv_stream interface has been called to start receiving streams. Otherwise, the error code HI_ERR_VDEC_NOT_PERM is returned, indicating that the operation is not allowed. If stream receiving is stopped in the buffer feeding process, the error code HI_ERR_VDEC_NOT_PERM is returned.
  • The channel passed to this API call must have been created. Otherwise, the error code HI_ERR_VDEC_UNEXIST is returned. If the channel is reset or destroyed in the buffer feeding process, the error code HI_ERR_VDEC_UNEXIST is returned.
  • The buffer feeding mode follows the mode set in the decoding channel creation call. Currently, only the frame mode is supported. In this mode, a complete frame must be fed in every call to this API. Otherwise, a decoding error occurs.
  • Empty packets with end_of_stream set to 0 (the stream length is 0 or the stream address is empty) cannot be fed, and attempts to do so result in errors. Feed an empty packet with end_of_stream set to 1 only when the stream has been fed completely. In this case, the decoder finishes stream decoding and outputs all result images. Set end_of_stream to 0 in other cases.
  • When the stream buffer is empty but cannot accommodate the current stream, the error code HI_ERR_VDEC_ILLEGAL_PARAM is returned.
  • In non-blocking mode, if the stream buffer is full, the error code HI_ERR_VDEC_BUF_FULL is returned.
  • In timeout mode, if the stream fails to be fed within the specified timeout interval, the error code HI_ERR_VDEC_BUF_FULL is returned.
  • For video decoding, if need_display in hi_vdec_stream is set to 0, the stream decoding result is not written to the output buffer configured in hi_vdec_pic_info. In this case, the output buffer address can be set to NULL. The hi_mpi_vdec_get_frame API can still obtain the information about the hi_video_frame_info and hi_vdec_stream structures. However, there is no decoding result data in the output buffer. In this case, you need to free the output buffer. (If the input output buffer address is NULL, the output buffer does not need to be freed.)

See Also

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