The VPC batch processing interface is used to reduce latency and improve performance.
Background
The media data processing section provides the following two types of APIs for operations such as image cropping and resizing:
- Process one image at a time, for example, the hi_mpi_vpc_crop_resize_make_border interface.
In this mode, if there are multiple input images, the for loop mode is used. The hi_mpi_vpc_crop_resize_make_border API is called for each image.
- Process multiple images at a time (that is, the batch processing interface), for example, the hi_mpi_vpc_batch_crop_resize_make_border interface.
In this mode, if there are multiple input images, the hi_mpi_vpc_batch_crop_resize_make_border API needs to be called only once.
The following table lists the mapping between the preceding two types of interfaces.
Processing a Single Image |
Batch Image Processing APIs |
|---|---|
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 Filling) |
Principles
The AI Processor has a built-in image processing unit DVPP (Digital Video Pre-Processing). DVPP has multiple VPC (Vision Preprocessing Core) modules to process tasks such as 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.