Table 1 describes the functions of media data processing V1.
Function |
Description |
|---|---|
Vision Preprocessing Core (VPC) |
Processes images, including cropping, resizing, pasting, stitching, 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 Functions and Restrictions. |
Video Encoder (VENC) |
Encodes videos. For details, see Functions and Restrictions. |
PNG Decoder (PNGD) |
Decodes PNG images. For details, see Functions and Restrictions. |
Table 2 describes the functions of media data processing V1 supported by Ascend AI Processors.
When using the APIs described in this chapter, pay attention to the following points:
For the asynchronous APIs described in this chapter, a successful API call only indicates the success of the task delivery, regardless of the execution result. For dependent APIs, you are advised to specify the same stream for multiple APIs to ensure tasks execution sequence, because tasks in the same stream are executed in accordance with the API call sequence.
When asynchronous APIs are called to decode, crop, and resize images, if tasks depend on each other, call aclrtSynchronizeStream to ensure that tasks in the stream are executed in order.
To ensure the performance, it is recommended that aclrtSynchronizeStream be called once after multiple asynchronous media data processing tasks are delivered to a stream.
After an asynchronous API is called, do not destroy the allocations immediately. Call the synchronization API (for example, aclrtSynchronizeStream) to confirm that the requested tasks of the device have been completed.
For the Ascend 310P AI Processor, media data processing can access a maximum of 16 GB address space in each process.
Before implementing each function of media data processing, you must call APIs to create corresponding channels. For details, see Channel Creation and Destruction. 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.
On the Ascend 310P AI Processor, the number of channels for each function is limited. VPC supports a maximum of 256 channels. JPEGD and VDEC share a maximum of 256 channels. JPEGE and VENC share a maximum of 256 channels. PNGD supports a maximum number of 128 channels. For details about the API for channel creation, see Channel Creation and Destruction.