Functions and Restrictions

Function Description

Table 1 describes the functions of media data processing V1 (Digital Vision Pre-Processing, DVPP).

Table 1 Function Description

Function

Function

Vision Preprocessing Core (VPC)

Supports image cropping, resizing, and format conversion. For details, see Restrictions.

JPEG Decoder (JPEGD)

Decodes .jpg, .jpeg, .JPG, and .JPEG images into YUV images. For details, see Functions and Restrictions.

JPEG Encoder (JPEGE)

Encodes YUV images into .jpg images. For details, see Functions and Restrictions.

Video Decoder (VDEC)

Decodes videos. For details, see VDEC Functions and Restrictions.

Video Encoder (VENC)

Encodes videos. For details, see VENC Functions and Restrictions.

PNG Decoder (PNGD)

Decodes PNG images. For details, see PNGD Functions and Restrictions.

Functions supported by each product model

Table 2 describes the functions of media data processing V1 supported by each product model.

The meanings of the identifiers are as follows:
  • √: supported.
  • x: not supported
Table 2 Function support

Model

VPC

JPEGD

JPEGE

PNGD

VDEC

VENC

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas A3 training product / Atlas A3 inference product

Atlas 350 Accelerator Card

Restrictions

When using the APIs described in this chapter, pay attention to the following points:

  • About asynchronous APIs

    For the asynchronous APIs described in this section, successful API calling only indicates that the task is successfully delivered, not the task execution. For asynchronous APIs that depend on each other, you are advised to specify the same stream in multiple asynchronous APIs to ensure that tasks can be executed in sequence. This is because tasks in the same stream are executed in the API call sequence. After the asynchronous API is called, resources cannot be released immediately. You need to call the synchronous waiting API (for example, aclrtSynchronizeStream) to ensure that the resources can be released only after the task on the device is complete. To ensure performance, you are advised to call aclrtSynchronizeStream once after multiple asynchronous API tasks are delivered to a stream.

  • About memory allocation and deallocation:
    1. Before implementing the VPC, JPEGD, and JPEGE functions for media data processing, if you need to allocate memory on the device to store the input or output data, call the acldvppMalloc API to allocate memory and call the acldvppFree API to free the memory. If multiple functions are used in cascade and the same memory segment needs to be reused, allocate the maximum allowed memory.
    2. The memory allocated in 1 can be used for media data processing and other tasks. For example, the output of media data processing can be used as the input of model inference to implement memory overcommitment and reduce memory copy.
    3. However, the address space accessed by media data processing is limited. To ensure that the memory is sufficient during media data processing, you are advised to call other memory allocation APIs (such as the aclrtMalloc API) for other functions (such as model loading) except media data processing.
  • About channel requirements

    Before implementing the media data processing function, you must call the corresponding API to create a channel. For details about the API for creating a channel, see Channel creation and destruction. Channel creation and destruction involve resource allocation and release. Repeated channel creation and destruction affect service performance. Therefore, you are advised to manage channels based on your actual scenario. For example, to process VPC images continuously, create VPC channels, wait until all VPC functions are called, and then destroy the VPC channels.

    Too many channels would affect the CPU usage and memory usage of the device. For details about the number of channels, see the performance specifications in the corresponding function sections.

    The maximum number of channels for each media data processing function is as follows:

    Model

    Maximum Number of Channels for Each Function

    Atlas inference product

    • The maximum number of channels for VPC is 256.
    • JPEGD and VDEC share channels and support a maximum of 256 channels.
    • JPEGE and VENC share channels and support a maximum of 256 channels.
    • The maximum number of channels for PNGD is 128.

    In the Ascend virtual instance scenario, the number of channels must meet the following requirements. If the total number of channels is not an integer, round it down.

    • Total number of VPC channels = (Number of allocated VPC hardware units/Total number of VPC hardware units) × 256
    • Total number of VDEC and JPEGD channels = (Total number of allocated VDEC and JPEGD hardware units/Total number of VDEC and JPEGD hardware units) x 256
    • Total number of VENC channels and JPEGE channels = (Total number of allocated VENC and JPEGE hardware units/Total number of VENC and JPEGE hardware units) x 256
    • Total number of PNGD channels = Allocation specification × 128

      For the PNGD function, if the following Ascend virtual instance template is used, the restrictions on the number of channels are different:

      • When the vir04_4c_dvpp template is used, the total number of channels is fixed at 128.
      • When the vir04_3c_ndvpp template is used, the DVPP function is not used. Therefore, the total number of channels is 0.
    • You can run the npu-smi info -t template-info command on the server where the driver is installed to view the computing resource specifications.

    Atlas A2 training product / Atlas A2 inference product

    • The maximum number of channels for VPC is 256.
    • JPEGD and VDEC share channels and support a maximum of 256 channels. The maximum number of JPEGD decoding channels is 256, and the maximum number of VDEC decoding channels is 32.
    • The maximum number of channels for JPEGE is 256.
    • The maximum number of channels for PNGD is 128.

    In the Ascend virtual instance scenario, the number of channels must meet the following requirements. If the total number of channels is not an integer, round it down.

    • The maximum number of channels for VPC is 256.
    • Total number of VDEC channels = (Number of allocated VDEC hardware units/Number of VDEC hardware units) × 32. If the total number of channels is not an integer, round down the value. The number of JPEGD channels is independent from the computing power, but the maximum number of JPEGD and VDEC channels is 256.
    • The maximum number of channels for JPEGE is 256.
    • Total number of PNGD channels = Allocation specification x 128
      For the PNGD function, if the following Ascend virtual instance template is used, the restrictions on the number of channels are different:
      • When the vir12_4c_32g_m, vir10_4c_16g_m, or vir10_4c_32g_m template is used, the total number of channels is fixed to 128.
      • When the vir12_3c_32g_nm, vir10_3c_16g_nm or vir10_3c_32g_nm template is used, the DVPP function is not used. Therefore, the total number of channels is 0.
    • You can run the npu-smi info -t template-info command on the server where the driver is installed to view the computing resource specifications.

    Atlas 200I/500 A2 inference product

    • The maximum number of channels for VPC is 128.
    • The maximum number of channels for JPEGD is 128.
    • The maximum number of channels for VDEC is 128.
    • The maximum number of channels for JPEGE is 128. The maximum number of channels for VENC is 128.
    • The maximum number of channels for PNGD is 128.

    In the Ascend virtual instance scenario, the number of channels must meet the following requirements. If the total number of channels is not an integer, round it down.

    • The maximum number of channels for VPC is 128.
    • Total number of VDEC channels = (Number of allocated VDEC hardware units/Number of VDEC hardware units) × 128. If the total number of channels is not an integer, round down the value. The number of JPEGD channels is not affected by the computing power, but the total number of JPEGD and VDEC channels cannot exceed 128.
    • Total number of VENC channels = (Number of allocated VENC hardware units/Number of VENC hardware units) × 128. If the total number of channels is not an integer, round down the value. The number of JPEGE channels is not affected by the computing power, but the total number of JPEGE and VENC channels cannot exceed 128.
    • You can run the npu-smi info -t template-info command on the server where the driver is installed to view the computing resource specifications.

    Atlas A3 training product / Atlas A3 inference product

    • The maximum number of channels for VPC is 256.
    • JPEGD and VDEC share channels and support a maximum of 256 channels. The maximum number of JPEGD decoding channels is 256, and the maximum number of VDEC decoding channels is 32.
    • The maximum number of channels for JPEGE is 256.
    • The maximum number of channels for PNGD is 128.