Restrictions

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.

Resolution Restrictions

Restrictions on Image Formats, Width and Height Alignment, and Buffers

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:

  • For details about the definition of the image format, see hi_pixel_format. For details about the concepts such as width stride and height stride, see Terminology.
  • The width stride ranges from 32 to 16384 (4096 x 4). For a 4096-pixel ARGB image, one pixel occupies four bytes, and a line of pixels occupies 4096 x 4. The height stride ranges from 6 to 16384.
  • Different APIs may have different requirements on image formats. For details, see the API descriptions in VPC.
Table 1 Restrictions on the input image format, width and height alignment, and buffer size

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

Table 2 Restrictions on the output image format, width and height alignment, and buffer size

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

Restrictions on Image Cropping and Pasting

Padding Restrictions

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.

Accuracy Restrictions

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.