VDEC Functions and Restrictions

The Atlas training products do not support the VDEC function described in this section.

Description

VDEC decodes videos.

Resolution Restrictions

  • Input stream resolution:

    Model

    Resolution Range

    Atlas A3 training products/Atlas A3 inference products

    Atlas A2 training products/Atlas A2 inference products

    Atlas inference products

    128 x 128 to 4096 x 4096

    Atlas 200I/500 A2 inference products

    H.264 input streams: 128 x 128 to 8192 x 8192

    H.265 input streams: 128 x 128 to 5400 x 8192

  • Output image resolution:

    Model

    Resolution Range

    Atlas A3 training products/Atlas A3 inference products

    Atlas A2 training products/Atlas A2 inference products

    Atlas inference products

    10 x 6 to 4096 x 4096

    Atlas 200I/500 A2 inference products

    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.

APIs for Buffer Allocation and Freeing

The size of the input buffer refers to the actual size occupied by the input stream. For details about the size of the output buffer, see the formula in Table 1.

Model

APIs for Buffer Allocation and Freeing

Atlas inference products

When using VDEC, call hi_mpi_dvpp_malloc to allocate the input and output buffers on the device, and hi_mpi_dvpp_free to free the input and output buffers. The buffer lifetime is managed by the user.

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

When using VDEC, the following two types of APIs for buffer allocation/freeing are supported:

  • Call aclrtMalloc to allocate the input and output buffers on the device, and aclrtFree to free the input and output buffers. The buffer lifetime is managed by the user. During buffer allocation, you are advised to allocate buffer of the ACL_MEM_MALLOC_HUGE_FIRST type. Huge page buffer has better performance and is preferred.
  • Call hi_mpi_dvpp_malloc to allocate the input and output buffers on the device, and hi_mpi_dvpp_free to free the input and output buffers. The buffer lifetime is managed by the user.

Note: hi_mpi_dvpp_malloc allocates a dedicated buffer for processing media data. However, the address space of the dedicated buffer is limited. If buffer resources are limited, aclrtMalloc is recommended for allocating buffer.

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 definition of the output image format, see hi_pixel_format. For details about the concepts such as width stride and height stride, see Terminology.
    Table 1 Restrictions on stream/image formats, width and height alignment, and buffers

    Output Image Format

    Output Width and Height

    Output Width Stride, Height Stride, and Buffer Size

    Atlas inference products

    Output Width Stride, Height Stride, and Buffer Size

    Atlas A3 training products/Atlas A3 inference products

    Atlas A2 training products/Atlas A2 inference products

    Atlas 200I/500 A2 inference products

    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. The value ranges from 32 to 16384.

    Height stride: Round up the height to the nearest multiple of 2. The value ranges from 6 to 16384.

    Buffer size (in bytes) ≥ Width stride x Height stride x 3/2

    Width stride: No alignment requirements. The value is the same as the 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 8-bit

    Width: Must be a multiple of 2.

    Height: Must be a multiple of 2.

    RGB888

    No alignment requirements.

    Width stride: Round up the width to the nearest multiple of 16 and then multiply the result by 3. The value ranges from 48 to 16384.

    Height stride: No alignment requirements. The value ranges from 6 to 16384.

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

    Width stride = Width x 3. The value ranges from 30 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

    BGR888

    No alignment requirements.

    RGB888 Planar

    Atlas A2 training products/Atlas A2 inference products: This format is supported.

    Atlas A3 training products/Atlas A3 inference products: This format is supported.

    No alignment requirements.

    -

    Width stride: No alignment requirements. The value is the same as the 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

    BGR888 Planar

    Atlas A2 training products/Atlas A2 inference products: This format is supported.

    Atlas A3 training products/Atlas A3 inference products: This format is supported.

    No alignment requirements.

    -

Other Restrictions

  • For Atlas A2 training products/Atlas A2 inference products, if the output image format is YUV420SP NV12 10-bit or YUV420SP NV21 10-bit, image resizing and color space conversion (CSC) are not supported when VDEC is used.
  • For Atlas A3 training products/Atlas A3 inference products, if the output image format is YUV420SP NV12 10-bit or YUV420SP NV21 10-bit, image resizing and CSC are not supported when VDEC is used.
  • 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 not applicable to streams containing B-frames.