Overview
API Differences Between Versions
- 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.
Typical Functions
CANN provides AIPP- and DVPP-based image/video data processing modes. This section focuses on DVPP-based image/video data processing.
Function Support
The following table describes the supported functions of media data processing V2
|
Product |
VPC |
JPEGD |
JPEGE |
PNGD |
VDEC |
VENC |
|---|---|---|---|---|---|---|
|
Atlas 200/300/500 Inference Product |
x |
x |
x |
x |
x |
x |
|
Atlas Training Series Product |
x |
x |
x |
x |
x |
x |
Restrictions
When using the APIs described in this chapter, pay attention to the following points:
- About memory allocation and deallocation
- If memory is needed to store the input or output data before implementing the VPC, JPEGD, and JPEGE functions for media data processing, call acl.himpi.dvpp_malloc to allocate memory and acl.himpi.dvpp_free to free up memory.
- 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.
- 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.
A too large number of 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.