hi_mpi_vdec_get_frame

Applicability

Product

Supported

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Description

Fetches the decoded image and input stream of a decoding channel.

During JPEGD image decoding, if hardware decoding fails when this API is called, software decoding is triggered within this API.

Prototype

hi_s32 hi_mpi_vdec_get_frame (hi_vdec_chn chn, hi_video_frame_info *frame_info, hi_vdec_supplement_info *supplement, hi_vdec_stream *stream, hi_s32 milli_sec)

Parameters

Parameter

Input/Output

Description

chn

Input

Decoding channel ID.

Atlas A3 training products / Atlas A3 inference products : 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 products / Atlas A2 inference products : 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 products : 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 products : 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.

frame_info

Output

Pointer to the information of the decoded image. The decoded output is stored in the device buffer.

supplement

Output

Pointer to the supplementary information of the decoded image. This parameter is reserved. You are advised to set it to NULL.

stream

Output

Pointer to the information of the decoded input stream.

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.

For JPEGD image decoding, the timeout interval configured here refers only to the wait time for obtaining the hardware decoding result, excluding the software decoding time.

Returns

  • 0: success. After obtaining the decoded data, call hi_mpi_vdec_release_frame to release resources used for decoding.

    Although a success message is returned after this API is called, the data that fails to be decoded may be obtained. To check whether the decoding is successful, see the description of frame_flag under v_frame of the hi_video_frame_info structure.

  • Other values: failure. For details, see VDEC/JPEGD Return Codes.

    Notes:

    • If no channel is created during image decoding, the error code HI_ERR_VDEC_UNEXIST is returned.
    • If the channel is destroyed during image fetching, the error code HI_ERR_VDEC_UNEXIST is returned.
    • If the channel is reset during decoded image fetching, the error code HI_ERR_VDEC_UNEXIST is returned.
    • In non-blocking mode, if the buffer has no decoded images, the error code HI_ERR_VDEC_BUF_EMPTY is returned.
    • In timeout mode, if no hardware decoding result is obtained within the specified timeout interval, the error code HI_ERR_VDEC_BUF_EMPTY is returned. In this case, increase the timeout interval or call this API repeatedly to obtain the decoding result.

See Also

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