For the Ascend 310 AI Processor, this function is reserved and is not supported currently.
For the Ascend 910 AI Processor, this function is reserved and is not supported currently.
The APIs for implementing VPC functions have different resolution requirements. For details, see the API descriptions in VPC.
During image processing by VPC, hi_mpi_dvpp_malloc and hi_mpi_dvpp_free are called to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user.
For details about the image format, width, and height alignment restrictions, see Table 1 and Table 2.
To implement VPC functions with related APIs:
Input Format |
Input Width and Height |
Input Width Stride, Height Stride, and Buffer Size |
|---|---|---|
YUV400 8bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
YUV420SP NV12 8bit |
Width: Must be a multiple of 2. Height: Must be a multiple of 2. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Round up the height to the nearest multiple of 2. Buffer size (in bytes) = Width stride x Height stride x 3/2 |
YUV420SP NV21 8bit |
||
YUV422SP 8bit |
Width: Must be a multiple of 2. Height: No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride x 2 |
YVU422SP 8bit |
||
YUV444SP 8bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride x 3 |
YVU444SP 8bit |
||
YUV422Packed YUYV 8bit |
Width: Must be a multiple of 2. Height: No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 2. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
YUV422Packed UYVY 8bit |
||
YUV422Packed YVYU 8bit |
||
YUV422Packed VYUY 8bit |
||
YUV444Packed 8bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
RGB888 |
||
BGR888 |
||
ARGB8888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 4. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
ABGR8888 |
||
RGBA8888 |
||
BGRA8888 |
||
YUV440SP 8bit |
Width: No alignment requirement. Height: Must be a multiple of 2. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Round up the height to the nearest multiple of 2. Buffer size (in bytes) = Width stride x Height stride x 2 |
YVU440SP 8bit |
Output Format |
Output Width and Height |
Output Width Stride, Height Stride, and Buffer Size |
|---|---|---|
YUV400 8bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
YUV420SP NV12 8bit |
Width: Must be a multiple of 2. Height: Must be a multiple of 2. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Round up the height to the nearest multiple of 2. Buffer size (in bytes) = Width stride x Height stride x 3/2 |
YUV420SP NV21 8bit |
||
YUV422SP 8bit |
Width: Must be a multiple of 2. Height: No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride x 2 |
YVU422SP 8bit |
||
YUV444Packed 8bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
RGB888 |
||
BGR888 |
||
ARGB8888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 4. Height stride: Has no alignment requirements but must be the same as height. Buffer size (in bytes) = Width stride x Height stride |
ABGR8888 |
||
RGBA8888 |
||
BGRA8888 |
The left offset of the paste ROI relative to the output image must be a multiple of 16. The paste ROI can be directly aligned on the leftmost side of the output image, that is, with zero left offset relative to the output image.
If the output image is in YUV420SP format, the left offset and top offset of the paste ROI must be even numbers, and the right offset and bottom offset must be odd numbers.
If the output image is in YUV422SP format, the left offset must be an even number and the right offset must be an odd number.
For other formats, there are no such limits.
For resizing with the aspect ratio preserved, the left offset for pasting must be a multiple of 16. Therefore, the hi_mpi_vpc_crop_resize_paste call may result in paste ROI deviation from the center of the output image. In this case, you can add the hi_mpi_vpc_crop_resize_make_border or hi_mpi_vpc_batch_crop_resize_make_border call to implement the cropping, resizing, and padding functions together.
For the output image formats below, note the following when implementing padding (through the hi_mpi_vpc_copy_make_border call):
VPC converts the input image format to YUV444 or RGB for internal processing based on the input or output image format. The data layout of the YUV420SP or YUV422SP format has restrictions on the odd and even numbers of the width and height, while there are no such restrictions on the YUV444 or RGB format. Therefore, the padding restrictions are used to prevent abnormal data from occurring on the image borders.
For the VPC function, the width of the paste ROI must be a multiple of 16. Otherwise, the paste ROI may contain invalid data for padding. In this case, you can resize width of the valid ROI to a multiple of 16 before pasting or use AIPP to crop the valid ROI and remove invalid data to ensure inference accuracy.