Restrictions

Resolution Restrictions

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

During image processing by VPC, acldvppMalloc and acldvppFree are called to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user.

For the Ascend 310 AI Processor and Ascend 910 AI Processor, the restrictions on the image format and width and height alignment are listed below. For details, see Table 1 and Table 2. In the 8K scenario, the input image format must be YUV420SP NV12 8-bit or YUV420SP NV21 8-bit.

The restrictions on the image format and width and height alignment for the Ascend 310P AI Processor are listed below. For details, see Table 3 and Table 4. In the 8K scenario, the following input image formats are supported:
  • YUV400 8-bit
  • YUV420SP NV12 8-bit, YUV420SP NV21 8-bit
  • YUV422SP 8-bit, YVU422SP 8-bit
  • YUV444SP 8-bit, YVU444SP 8-bit
  • YUV422P YUYV 8-bit, YUV422P UYVY 8-bit, YUV422P YVYU 8-bit, YUV422P VYUY 8-bit

To implement VPC functions with related APIs:

  • For details about the definition of the image format, see acldvppPixelFormat. For details about the concepts such as width stride, height stride, and 8K 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.
Table 1 Restrictions on the input image format, width and height alignment, and buffer size (Ascend 310 AI Processor and Ascend 910 AI Processor)

Input Format

Input Width and Height

Input Width Stride, Height Stride, and Buffer Size

YUV400 8-bit

No alignment requirement.

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 NV12 8-bit

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 8-bit

YUV422SP 8-bit

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: Round up the height to the nearest multiple of 2.

Buffer size (in bytes) = Width stride x Height stride x 2

YVU422SP 8-bit

YUV444SP 8-bit

No alignment requirement.

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

YVU444SP 8-bit

YUV422 Packed YUYV 8-bit

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: Round up the height to the nearest multiple of 2.

Buffer size (in bytes) = Width stride x Height stride

YUV422 Packed UYVY 8-bit

YUV422 Packed YVYU 8-bit

YUV422 Packed VYUY 8-bit

YUV444 Packed 8-bit

No alignment requirement.

Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3.

Height stride: Round up the height to the nearest multiple of 2.

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: Round up the height to the nearest multiple of 2.

Buffer size (in bytes) = Width stride x Height stride

ABGR8888

RGBA8888

BGRA8888

Table 2 Restrictions on the output image format, width and height alignment, and buffer size (Ascend 310 AI Processor and Ascend 910 AI Processor)

Output Format

Output Width and Height

Output Width Stride, Height Stride, and Buffer Size

YUV420SP NV12 8-bit

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 8-bit

Table 3 Restrictions on the input image format, width and height alignment, and buffer size (Ascend 310P AI Processor)

Input Format

Input Width and Height

Input Width Stride, Height Stride, and Buffer Size

YUV400 8-bit

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 8-bit

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 8-bit

YUV422SP 8-bit

Width: Must be a multiple of 2.

Height: No alignment requirement.

The width stride is 16-pixel aligned. The height stride can be the same as the height stride.

Buffer size (in bytes) = Width stride x Height stride x 2

YVU422SP 8-bit

YUV444SP 8-bit

No alignment requirement.

The width stride is 16-pixel aligned. The height stride can be the same as the height stride.

Buffer size (in bytes) = Width stride x Height stride x 3

YVU444SP 8-bit

YUV422 Packed YUYV 8-bit

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

YUV422 Packed UYVY 8-bit

YUV422 Packed YVYU 8-bit

YUV422 Packed VYUY 8-bit

YUV444 Packed 8-bit

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 8-bit

Table 4 Restrictions on the output image format, width and height alignment, and buffer size (Ascend 310P AI Processor)

Output Format

Output Width and Height

Output Width Stride, Height Stride, and Buffer Size

YUV400 8-bit

No alignment requirement.

The width stride is 16-pixel aligned. The height stride can be the same as the height stride.

Buffer size (in bytes) = Width stride x Height stride

YUV420SP NV12 8-bit

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 8-bit

YUV422SP 8-bit

Width: Must be a multiple of 2.

Height: No alignment requirement.

The width stride is 16-pixel aligned. The height stride can be the same as the height stride.

Buffer size (in bytes) = Width stride x Height stride x 2

YVU422SP 8-bit

YUV444 Packed 8-bit

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

Accuracy Restrictions

Restrictions on the VPC output as the input for model inference

Ascend 310 AI Processor and Ascend 910 AI Processor: For the VPC function, width x height of the paste ROI must be a multiple of 16 x 2. Otherwise, the paste ROI may contain invalid data for padding. In this case, you need to use AIPP to crop the valid ROI and remove invalid data to ensure inference accuracy.

Ascend 310P AI Processor: 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 need to use AIPP to crop the valid ROI and remove invalid data to ensure inference accuracy.