AscendCL media data processing provides the following types of APIs for image cropping, resizing, pasting, and padding:
In this mode, the preceding APIs need to be called to implement multiple functions, such as image cropping, resizing, and padding.
In this mode, only the acldvppVpcBatchCropResizeMakeBorderAsync 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.
Single-function API |
Multi-function API |
|---|---|
|
|
|
acldvppVpcBatchCropResizeMakeBorderAsync (batch cropping, resizing, and padding) |
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.
The following uses batch image cropping and resizing as an example to describe how to call the multi-function API acldvppVpcBatchCropResizeAsync. Click here to obtain the complete code.