AscendCL media data processing provides the following types of APIs for image cropping and resizing:
In this mode, if there are multiple input images, the for loop mode is typically used, that is, the hi_mpi_vpc_crop_resize_make_border API is called once for each image.
In this mode, if there are multiple input images, only the hi_mpi_vpc_batch_crop_resize_make_border API needs to be called once.
The following table lists the mapping between these two types of APIs.
Single-Image Processing API |
Batch Processing API |
|---|---|
hi_mpi_vpc_crop_resize_paste (cropping, resizing, and pasting) |
hi_mpi_vpc_batch_crop_resize_paste (batch cropping, resizing, and pasting) |
hi_mpi_vpc_crop_resize_make_border (cropping, resizing, and padding) |
hi_mpi_vpc_batch_crop_resize_make_border (batch cropping, resizing, and padding) |
The Ascend AI Processor has a built-in DVPP unit, which contains multiple VPC modules for functions like image cropping, resizing, and format conversion.
When a batch processing API is called, batch tasks are evenly distributed to multiple VPC modules for parallel processing, reducing the processing delay and improving performance.
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.