VDEC Functions and Restrictions
Function Description
Video Decoder (VDEC) decodes videos.
Resolution Restrictions
|
Model |
Resolution Range |
|---|---|
|
|
128 x 128 to 4096 x 4096 |
|
|
H.264 input streams: 128 x 128 to 8192 x 8192 H.265 input streams: 128 x 128 to 5400 x 8192 |
|
Model |
Resolution Range |
|---|---|
|
|
10 x 6 to 4096 x 4096 |
|
|
The maximum resolution of the output image is 8192 x 8192. When the width of the input stream is less than or equal to 4096, the minimum resolution of the output image is 10 x 6. Otherwise, the minimum resolution of the output image is 128 x 128. |
Restrictions on Buffer Allocation and Freeing APIs
During VDEC video decoding, call the hi_mpi_dvpp_malloc\hi_mpi_dvpp_free API to allocate or release the input and output memory on the device. The lifecycle of the memory is managed by the user. The size of the input buffer is the size of the input stream. For details about the size of the output buffer, see the formula in Restrictions on Stream/Image Formats, Width and Height Alignment, and Buffers.
For the following product models, the aclrtMalloc\aclrtFree API can be called to allocate or release the input and output memory on the device. The lifecycle of the memory is managed by users.
The memory allocated by calling hi_mpi_dvpp_malloc is the dedicated memory for media data processing. However, the address space of the dedicated memory is limited. If you are concerned about memory planning or memory resources are limited, you are advised to call aclrtMalloc to allocate memory. When the aclrtMalloc interface is called to allocate memory, it is recommended that the memory of the ACL_MEM_MALLOC_HUGE_FIRST type be allocated. The huge page memory is preferentially allocated because the huge page performance is better.
Restrictions on Stream/Image Formats, Width and Height Alignment, and Buffers
- Input stream formats:
- H.264 BP/MP/HP level 5.1 YUV420 streams (Annex-B raw video streams only)
- H.265 8-/10-bit level 5.1 YUV420 streams (Annex-B raw video streams only)
- Output image requirements:
For details about the output image format, see hi_pixel_format. For details about the width stride and height stride, see Terminology.
Table 1 Restrictions on the stream/image format, width and height alignment, and buffer size of Atlas A3 training product /Atlas A3 inference product andAtlas A2 training product /Atlas A2 inference product Output Format
Output Width and Height
Output Width Stride, Height Stride, and Buffer Size
YUV420SP NV12 8bit
Width: Must be a multiple of 2.
Height: Must be a multiple of 2.
Width stride: No alignment requirement. The value is the same as width and ranges from 10 to 24576.
Height stride: No alignment requirements. The value is the same as the height and ranges from 6 to 24576.
Buffer size (in bytes) ≥ Width stride x Height stride x 3/2
YUV420SP NV21 8bit
Width: Must be a multiple of 2.
Height: Must be a multiple of 2.
YUV420SP NV12 10bit
YUV420SP NV21 10bit
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 2 and then multiply it by 2. The minimum value is 256 and the maximum value is 24576.
Height stride: Round up the height to the nearest multiple of 2. The minimum value is 128 and the maximum value is 24576.
Buffer size (in bytes) ≥ Width stride x Height stride x 3/2
RGB888
BGR888
No alignment requirement.
Width stride = Width x 3. The value ranges from 30 to 24576.
Height stride: No alignment requirement. The value is the same as height and ranges from 6 to 24576.
Buffer size (in bytes) ≥ Width stride x Height stride
RGB888 Planar
BGR888 Planar
No alignment requirement.
Width stride: No alignment requirement. The value is the same as width and ranges from 10 to 24576.
Height stride: No alignment requirement. The value is the same as height and ranges from 6 to 24576.
Buffer size (in bytes) ≥ Width stride x Height stride
Table 2 Atlas 200I/500 A2 inference product Restrictions on the stream/image format, width and height alignment, and buffer sizeOutput Format
Output Width and Height
Output Width Stride, Height Stride, and Buffer Size
YUV420SP NV12 8bit
YUV420SP NV21 8bit
Width: Must be a multiple of 2.
Height: Must be a multiple of 2.
Width stride: No alignment requirement. The value is the same as width and ranges from 10 to 24576.
Height stride: No alignment requirements. The value is the same as the height and ranges from 6 to 24576.
Buffer size (in bytes) ≥ Width stride x Height stride x 3/2
RGB888
BGR888
No alignment requirement.
Width stride = Width x 3. The value ranges from 30 to 24576.
Height stride: No alignment requirement. The value is the same as height and ranges from 6 to 24576.
Buffer size (in bytes) ≥ Width stride x Height stride
Table 3 Atlas inference product Restrictions on the stream/image format, width and height alignment, and buffer sizeOutput Format
Output Width and Height
Output Width Stride, Height Stride, and Buffer Size
YUV420SP NV12 8bit
YUV420SP NV21 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. The minimum value is 32 and the maximum value is 16384.
Height stride: Round up the height to the nearest multiple of 2. The minimum value is 6 and the maximum value is 16384.
Buffer size (in bytes) ≥ Width stride x Height stride x 3/2
RGB888
BGR888
No alignment requirement.
Width stride: Round up the width to the nearest multiple of 16 and multiply the result by 3. The minimum value is 48 and the maximum value is 16384.
Height stride: No alignment requirements. The value ranges from 6 to 16384.
Buffer size (in bytes) ≥ Width stride x Height stride
Other Restrictions
- If the output image format is YUV420SP NV12 10-bit or YUV420SP NV21 10-bit, image resizing and CSC are not supported when the VDEC function is used.
This constraint applies to the following product models:
Atlas A3 training product /Atlas A3 inference product Atlas A2 training product /Atlas A2 inference product - VDEC decodes input streams by frame.
- If there are bad frames or frame loss in the stream, VDEC will mark the frames as a decoding failure and report an exception.
- VDEC decodes only H.264 8-bit streams coded in interlaced mode.
- The combined use of stream feeding in frame mode and output in the decoding sequence enables both fast decoding and output. However, this is no applicable to streams containing B-frames.