Using Multi-function APIs of VPC to Optimize System Scheduling

Background

The media data processing section provides the following APIs for image cropping, resizing, pasting, and padding:

The following table lists the mapping between single-function APIs and multi-function APIs.

Single-Function API

Multi-Function API

hi_mpi_vpc_crop_resize_make_border (cropping, resizing, and padding) or hi_mpi_vpc_batch_crop_resize_make_border (batch cropping, resizing, and padding)

Principles

One API requires several task interactions between the host and device, and each interaction has a delay. If APIs are called for multiple times for implementing multiple functions such as image cropping and resizing, the number of task interactions between the host and device increases, leading to more delay.

By comparison, using a multi-function API to implement multiple functions at once reduces the number of scheduling times between the host and device and the processing times on the device, greatly optimizing the system performance.

Sample

The following uses batch image cropping, resizing, and padding as an example to describe how to call the multi-function API hi_mpi_vpc_batch_crop_resize_make_border. Click here to obtain the complete code.