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:
- Single-function APIs: One API performs only one action, for example, hi_mpi_vpc_crop, hi_mpi_vpc_resize, and hi_mpi_vpc_copy_make_border.
In this mode, if multiple functions need to be implemented, you need to call multiple APIs. For example, call the preceding three APIs for image cropping, resizing, and padding.
- Multi-function APIs: One API performs multiple actions, for example, hi_mpi_vpc_batch_crop_resize_paste and hi_mpi_vpc_batch_crop_resize_make_border.
In this mode, only the hi_mpi_vpc_batch_crop_resize_make_border API needs to be called to implement multiple functions, such as image cropping, resizing, and padding.
The following table lists the mapping between single-function APIs and multi-function APIs.
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.