Restrictions
For the
Resolution Restrictions
- Input image resolution range
During image processing by VPC, the general input resolution ranges from 10 x 6 to 8192 x 8192. The resolution restrictions of some APIs may be different. For details, see the API descriptions in VPC APIs. When the input image format is YUV440SP or YUV440P, the maximum width of the image is 4096.
- Output resolution range:
Product
Resolution Range
Atlas inference products 10 * 6 ~ 4096 * 4096
Atlas A2 training products /Atlas A2 inference products Atlas 200I/500 A2 inference products Atlas A3 training products /Atlas A3 inference products 10 * 6 ~ 4096 * 8192
Restrictions on Buffer Allocation and Freeing APIs
For details about the requirements on the input and output buffer sizes, see the calculation formulas in Restrictions on Image Formats, Width and Height Alignment, and Buffers.
|
Test Object |
Buffer Allocation/Freeing API |
|---|---|
|
|
During image processing by VPC, acl.himpi.dvpp_malloc and acl.himpi.dvpp_free are called to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user. |
|
|
During image processing by VPC, the following two types of buffer allocation/freeing APIs are supported:
acl.himpi.dvpp_malloc allocates a dedicated buffer for processing media data. However, the address space of the dedicated buffer is limited. If buffer planning is cared or buffer resources are limited, you are advised to allocate buffer by calling acl.rt.malloc. |
Restrictions on Image Formats, Width and Height Alignment, and Buffers
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 minimum and maximum values of the width stride and height stride vary with different versions:
Atlas inference products : 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.Atlas 200I/500 A2 inference products : The minimum width stride is 10 and the minimum height stride is 6.Atlas A2 training products /Atlas A2 inference products : The minimum width stride is 10 and the minimum height stride is 6.Atlas A3 training products /Atlas A3 inference products : The minimum width stride is 10, and the minimum height stride is 6.
- Different APIs may have different requirements on image formats. For details, see the API descriptions in VPC APIs.
|
Product |
Image Format |
Width and Height |
Width Stride x Height Stride Alignment |
Width Stride x Height Stride Alignment |
Buffer Size (in Bytes) |
|---|---|---|---|---|---|
|
General format, supported by all versions |
YUV400 8-bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: No alignment requirement. The value is the same as height. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
YUV420SP NV12 8-bit YUV420SP NV21 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. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 3/2 |
|
|
YUV422SP 8-bit YVU422SP 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: No alignment requirement. The value is the same as height. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 2 |
|
|
YUV444SP 8-bit YVU444SP 8-bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: No alignment requirement. The value is the same as height. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 3 |
|
|
YUV422 Packed YUYV 8-bit YUV422 Packed UYVY 8-bit YUV422 Packed YVYU 8-bit YUV422 Packed VYUY 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: No alignment requirement. The value is the same as height. |
Width stride: Width x 2. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
YUV444 Packed 8-bit RGB888 BGR888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3. Height stride: No alignment requirement. The value is the same as height. |
Width stride: Width x 3. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 4. Height stride: No alignment requirement. The value is the same as height. |
Width stride: Width x 4. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
YUV440SP 8-bit YVU440SP 8-bit |
Width: No alignment requirement, but the width must be ≤ 4096. 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. |
Width stride: No alignment requirement. The value is the same as width. Height stride: Round up the height to the nearest multiple of 2. |
Width stride x Height stride x 2 |
|
|
Only the following versions support this format: |
YVU420 Planar YUV420 Planar |
Width is 2-pixel aligned; height is 2-pixel aligned. |
- |
Width stride: Has no alignment requirements but must be the same as width. Height stride: Has no alignment requirements but must be the same as height. |
Width stride x Height stride x 3/2 |
|
YVU422 Planar YUV422 Planar |
No alignment requirement. |
- |
Width stride: Has no alignment requirements but must be the same as width. Height stride: Has no alignment requirements but must be the same as height. |
Width stride x Height stride x 2 |
|
|
YVU444 Planar YUV444 Planar |
No alignment requirement. |
- |
Width stride: Has no alignment requirements but must be the same as width. Height stride: Has no alignment requirements but must be the same as height. |
Width stride x Height stride x 3 |
|
|
YVU444 Packed 8-bit |
No alignment requirement. |
- |
Width stride: No alignment requirement. Width stride = Width x 3. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
YUV440 Planar YVU440 Planar |
Width: No alignment requirement, but the width must be ≤ 4096. Height: Must be a multiple of 2. |
- |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 2 |
|
|
RGB888 Planar BGR888 Planar |
No alignment requirement. |
- |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 3 |
|
|
Only the following versions support this format: |
YUV400 FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride |
|
RGB888 FP32 BGR888 FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 3 x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride |
|
|
RGB888Planar FP32 BGR888Planar FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride x 3 |
|
Product |
Image Format |
Width and Height |
Width Stride x Height Stride Alignment |
Width Stride x Height Stride Alignment |
Buffer Size (in Bytes) |
|---|---|---|---|---|---|
|
General format, supported by all versions |
YUV400 8-bit |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16. Height stride: No alignment requirement. The value is the same as height. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
YUV420SP NV12 8-bit YUV420SP NV21 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. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 3/2 |
|
|
YUV422SP 8-bit YVU422SP 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: No alignment requirement. The value is the same as height. |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 2 |
|
|
YUV444 Packed 8-bit RGB888 BGR888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3. Height stride: No alignment requirement. The value is the same as height. |
Width stride = Width x 3 Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
No alignment requirement. |
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 4. Height stride: No alignment requirement. The value is the same as height. |
Width stride = Width x 4 Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
|
Only the following versions support this format: |
YUV422 Packed YUYV 8-bit YUV422 Packed UYVY 8-bit YUV422 Packed YVYU 8-bit YUV422 Packed VYUY 8-bit |
Width: No alignment requirement. Height: Must be a multiple of 2. |
- |
Width stride = Width x 2 Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
Only the following versions support this format: |
YVU444 Packed |
No alignment requirement. |
- |
Width stride = Width x 3 Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride |
|
RGB888 Planar BGR888 Planar |
No alignment requirement. |
- |
Width stride: No alignment requirement. The value is the same as width. Height stride: No alignment requirement. The value is the same as height. |
Width stride x Height stride x 3 |
|
|
Only the following versions support this format: |
YUV400 FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride |
|
RGB888 FP32 BGR888 FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 3 x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride |
|
|
RGB888Planar FP32 BGR888Planar FP32 |
No alignment requirement. |
- |
The width stride does not need to be aligned. The width stride is the value of width x 4 (4 indicates that FP32 occupies four bytes). The height stride does not need to be aligned and must be the same as the height. |
Width stride x Height stride x 3 |
Restrictions on Image Cropping and Pasting
- The crop ROI must not be larger than the input image.
- The restrictions on the odd and even numbers of the crop and paste ROIs are as follows:
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.
- The paste ROI must not be larger than the output image. A maximum of 256 paste ROIs are supported.
Due to the 16-pixel alignment requirement, there are the following restrictions for the
Atlas inference products :- The left offset of the paste ROI relative to the output image is 16-pixel aligned. 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. Zero also meets the 16-pixel alignment requirement.
- It is recommended that the pasting width of the output image be a multiple of 16. Otherwise, an extra segment of invalid data is padded. As shown in Figure 4 and Figure 5, the green box indicates invalid data.
- For resizing with the aspect ratio preserved, the left offset for pasting must be a multiple of 16. Therefore, the acl.himpi.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 acl.himpi.vpc_crop_resize_make_border or acl.himpi.vpc_batch_crop_resize_make_border call to implement the cropping, resizing, and padding functions together.
Restrictions on Downsampling of YUV Images
VPC converts the input image format to YUV444 or RGB for internal processing based on the input or output image format. YUV444 or RGB output format has no restriction on the odd and even numbers of the width and height, while the YUV420SP or YUV422SP output format, which performs downsampling processing, has such restrictions due to the data format. Therefore, abnormal data may exist on the output image boarders.
The root cause is that during the calculation, when the output image is at an odd start point, the image is correct for the YUV444 format. However, when the YUV420SP format is downsampled, the odd and even lines share the same UV. In this case, the Y of the start line and the UV of the previous line form a new pixel and abnormal data is generated.
Accuracy Restrictions (
Atlas inference products
)
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 the valid ROI to a multiple of 16 x 2 before pasting or use AIPP to crop the valid ROI and remove invalid data to ensure inference accuracy.