VENC Functions and Restrictions

Function Description

The video encoder (VENC) encodes YUV420SP NV12/NV21 8-bit image data into H.264/H.265 video streams.

Resolution Restrictions

Input image resolution::

Model

Resolution Range

Atlas inference product

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

Atlas 200I/500 A2 inference product

114 x 114 to 8192 x 8192

Output stream resolution:

VENC encodes images without changing the image resolution. Therefore, the output image resolution is the same as the input image resolution.

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

To implement the VENC function:

  • Input buffer:

    The acldvppMalloc API needs to be called to allocate the input buffer on the device, and the acldvppFree API needs to be called to free the input buffer. The lifecycle of the input buffer is managed by the user. For details about the buffer size, see the formula in the following table.

    For Atlas inference product , the aclrtMalloc/ aclrtFree interface can be called to apply for or release the input memory. When applying for memory, you are advised to apply for the memory of the ACL_MEM_MALLOC_HUGE_FIRST type. The huge page memory is preferentially applied for, which has better performance. 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 formats:

Input Width and Height Alignment

Input Width Stride, Height Stride, and Buffer Size

Output Format

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

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

  • H264 BP/MP/HP
  • H265 MP (Only slice streams are supported.)

YUV420SP NV21 8bit

For details about the input image format, see acldvppPixelFormat. For details about the width stride and height stride, see Terminology.