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:
- Only one operation is performed on an interface (that is, a single-function interface), for example, acldvppVpcCropAsync, acldvppVpcResizeAsync and acldvppVpcMakeBorderAsync.
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.
- Multiple operations are performed on an interface (that is, a multi-functional combination interface), for example, the acldvppVpcBatchCropResizePasteAsync and acldvppVpcBatchCropResizeMakeBorderAsync interfaces.
In this mode, to implement multiple functions, such as cropping, resizing, and padding, you only need to call the acldvppVpcBatchCropResizeMakeBorderAsync API.
The following table lists the mapping between single-function APIs and multi-function APIs.
Single-Function API |
Multi-Function API |
|---|---|
|
|
|
acldvppVpcBatchCropResizeMakeBorderAsync (Batch Cropping, Resizing, and Filling) |
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.