Choosing a Proper VDEC Output Format and Resolution to Optimize Performance

Background

On some Ascend AI Processors, the hi_mpi_vdec_send_stream API supports YUV420SP or RGB888 output and allows image resizing during decoding. If you want to use DVPP to decode videos and obtain RGB images, the hi_mpi_vdec_send_stream API can be called directly to output RGB888 data, thus improving performance.

Figure 1 VDEC output scenarios

Principles

On some Ascend AI Processors, the hi_mpi_vdec_send_stream API supports YUV420SP or RGB888 output (for details, see VDEC Functions and Restrictions). You can set the API parameters to select different output formats. In this way, you do not need to call hi_mpi_vpc_convert_color to convert the format, reducing the API calling time.

If the resolution of a video stream is different from that of an image input to the model, the decoded image needs to be resized. You can also set the resolution of the output image by calling hi_mpi_vdec_send_stream. In this way, the image can be resized during decoding, with no need for you to call the resizing API additionally.

In brief, the hi_mpi_vdec_send_stream call can implement the functions of decoding, resizing, and CSC, reducing the number of APIs to be called and improving performance.

Sample

Click here to obtain the sample code of video decoding.