Restrictions
For the
For the
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.
- Different APIs may have different requirements on image formats. For details, see the API descriptions in VPC.
|
Model |
Image Format |
Width x Height Alignment |
Buffer Size (in Bytes) |
|---|---|---|---|
|
General format, supported by all models |
YUV400 8bit |
No alignment requirement. |
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 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 x Height stride x 2 |
|
|
YUV444SP 8bit YVU444SP 8bit |
No alignment requirement. |
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 x Height stride |
|
|
YUV444 Packed 8-bit RGB888 BGR888 |
No alignment requirement. |
Width stride x Height stride |
|
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
No alignment requirement. |
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 x Height stride x 2 |
|
Model |
Image Format |
Width x Height Alignment |
Buffer Size (in Bytes) |
|---|---|---|---|
|
General format, supported by all models |
YUV400 8bit |
No alignment requirement. |
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 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 x Height stride x 2 |
|
|
YUV444 Packed 8-bit RGB888 BGR888 |
No alignment requirement. |
Width stride x Height stride |
|
|
ARGB8888 ABGR8888 RGBA8888 BGRA8888 |
No alignment requirement. |
Width stride x Height stride |
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.
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.