The VDEC video decoding output format and resolution are properly selected for better performance.

Background

If you want to use the DVPP to decode videos and obtain RGB images, the current video decoding API hi_mpi_vdec_send_stream supports the YUV420SP or RGB888 output format and image resizing during decoding. Therefore, you can optimize the code logic to improve the performance, call the video decoding API hi_mpi_vdec_send_stream to output the RGB888 format.

Figure 1 VDEC output scenarios

Principles

The video decoding APIs hi_mpi_vdec_send_stream on some AI processors support the YUV420SP or RGB888 format. You can set the API parameters to output different formats. In this way, you do not need to call hi_mpi_vpc_convert_color to convert the format, reducing the number of API calls.

If the resolution of the video stream is different from that of the input image, the decoded image needs to be resized. You can also set the resolution of the output image in hi_mpi_vdec_send_stream of the video decoding API so that the image can be resized during decoding. In this way, you do not need to call the resizing API separately, reducing the number of API calls.

To sum up, the decoding, scaling, and CSC functions can be implemented in hi_mpi_vdec_send_stream of the video decoding API to reduce the number of API calls and improve performance.

Example

You can click vdec_sample to obtain the sample.