Media Data Processing V2 (JPEGE)

Sample Obtaining

Refer to jpege_sample to obtain the sample.

Description

This sample implements the encoding of YUV images into .jpg images.

Principles

The following table lists the key functions involved in this sample.

Initialization

  • aclInit: performs initialization.
  • aclFinalize: performs deinitialization.

Device Management

  • aclrtSetDevice: sets the compute device.
  • aclrtGetRunMode: obtains the run mode of the software stack. The internal processing varies depending on the run mode.
  • aclrtResetDevice: resets the compute device and cleans up all resources associated with the device.

Memory Management

  • aclrtMallocHost/aclrtFreeHost: allocates and frees host memory, respectively.
  • hi_mpi_dvpp_malloc/hi_mpi_dvpp_free: allocates and frees device memory respectively for storing input and output data during media data processing.

Data Transfer

aclrtMemcpy:

  • Transfers decode source data from the host to the device.
  • Transfers the inference result from the device to the host.

Data transfer is not required if your app runs in the board environment.

Media Data Processing V2

See the APIs provided in Video Encoding (VENC) and JPEG Encoder (JPEGE).

Directory Structure

The sample directory is organized as follows:

├── common                       //Directory of the sample code files
│   ├── sample_comm.h           //Header file that declares functions related to encoding
│   ├── sample_comm_venc.cpp    //Implementation file of functions related to encoding

├── smoke_vpc                    //Directory of the sample code files
│   ├── sample_jpege.cpp        //Implementation file of the main function
                                         
├── CMakeLists.txt               //Build script

App Build and Run

Refer to jpege_sample to obtain the sample. View the README file in the sample.