Functions and Restrictions

The Atlas training products does not support this function.

The Atlas A2 training products/Atlas A2 inference products does not support this function.

The Atlas A3 training products/Atlas A3 inference products does not support this function.

Function Description

VENC encodes YUV420SP NV12/NV21 8-bit images into H.264/H.265 video streams.

Resolution Restrictions

  • Input resolution range:

    Model

    Resolution Range

    Atlas inference products

    The width and height range from 128 to 4096. For H.264 streams, the maximum resolution must not exceed 4096 × 2304.

    Atlas 200I/500 A2 inference products

    114 × 114 to 8192 × 8192

  • Output stream resolution:

    VENC only encodes images and does not change the image resolution. Therefore, the resolution of the output image is the same as that of the input image.

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

To implement the VENC function:

  • Input buffer

    Call acldvppMalloc or acldvppFree to allocate or free the input buffer on the device. The buffer lifetime is managed by the user. For details about the buffer size, see the formula in the following table.

    For the Atlas inference products, aclrtMalloc and aclrtFree can be called to allocate and free input buffer, respectively. During buffer allocation, you are advised to allocate buffer of the ACL_MEM_MALLOC_HUGE_FIRST type. Huge page buffer has better performance and therefore is preferred. The lifetime of the buffer is also managed by the user. For details about the buffer size, see the calculation formula in the following table.

  • Output buffer

    The output buffer is managed by the system.

Table 1 Restrictions on the image format, width and height alignment, and buffer size

Input Format

Input Width and Height

Input Width Stride, Height Stride, and Buffer Size

Output Format

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 height stride does not need to be configured.

Buffer size (in bytes) = Width stride × Height × 3/2

  • H264 BP/MP/HP
  • H.265 MP (slice streams only)

YUV420SP NV21 8-bit

For details about the definition of the input image format, see acldvppPixelFormat. For details about the concepts such as width stride and height stride, see Terminology.