Using Batch Processing APIs of VPC to Reduce Delay
Background
The media data processing section provides the following APIs for operations such as image cropping and resizing:
- Processing one image at a time: For example, hi_mpi_vpc_crop_resize_make_border.
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.
- Processing multiple images at a time (batch processing): For example, hi_mpi_vpc_batch_crop_resize_make_border.
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.
Principles
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.