Overview

API Differences Between Versions

In this document, the media data processing APIs in the V1 and V2 versions are both used to implement functions such as image cropping, image resizing, and format conversion. However, these two sets of APIs must not be mixed together.
  • V2 has more functions than V1. For example:
    • JPEGE: The APIs in the V2 version support advanced parameter configuration, such as Huffman table configuration.
    • VENC: The APIs in the V2 version support more refined configuration of bit rate control parameters and effect tuning, such as the QP of I-/P-frames and macroblock bit rate control.
    • VDEC: The APIs in the V2 version support more refined memory control, such as the setting of the input stream buffer.
  • The APIs in the V2 version are recommended, which guarantee continuous evolution of API functions and services in later versions.
  • V1 APIs are retained for backward compatibility considerations, but will be deprecated in later versions.

Function Support

The following table describes the supported functions of media data processing V2

Product

VPC

JPEGD

JPEGE

PNGD

VDEC

VENC

Ascend 950PR / Ascend 950DT

√

√

√

√

x

x

Atlas training products

x

x

x

x

x

x

Atlas inference products

√

√

√

√

√

√

Atlas 200I/500 A2 inference products

√

√

√

√

√

√

Atlas A2 training products / Atlas A2 inference products

√

√

√

√

√

x

Atlas A3 training products / Atlas A3 inference products

√

√

√

√

√

x

Restrictions

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

  • About memory allocation and deallocation
    1. If memory is needed to store the input or output data before implementing the VPC, JPEGD, and JPEGE functions for media data processing, call dvpp_malloc to allocate memory and dvpp_free to free up 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 reuse and reduce memory copy.
    3. Because the address space accessed by media data processing is limited, you are advised to call acl.rt.malloc, acl.rt.malloc_host, or acl.rt.malloc_cached described in section "Memory Management" to allocate memory for other functions (for example, model loading) to ensure sufficient memory during media data processing.
  • About channel requirements

    Before implementing each function of media data processing, you must call APIs to create corresponding channels. See the channel creation and destruction APIs in VPC, VDEC/JPEGD APIs, VENC/JPEGE APIs, and PNGD APIs to learn about the API descriptions and the maximum number of channels.

    Channel creation and destruction involve resource allocation and release. Repeated channel creation and destruction, however, 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.