Sample Overview

Sample Obtaining

Click video encoding to obtain the sample code.

Function Usage

In this sample, a YUV420SP NV12 image is encoded for n consecutive times to generate an H.265 video stream. (n is defaulted to 16. It is configurable and controlled by the venc_cnt parameter during app running.)

Main APIs

The following table lists the main APIs.

Initialization

  • Call acl.init to initialize the configuration.
  • Call acl.finalize to deinitialize the configuration.

Device management

  • Call acl.rt.set_device to specify the compute device.
  • Call acl.rt.get_run_mode to obtain the running mode of the software stack. The internal processing process varies according to the running mode.
  • Call acl.rt.reset_device to reset the current device and reclaim the associated resources.

Memory management

  • Call acl.dvpp.malloc to allocate memory on the device.
  • Call acl.dvpp.free to free the memory on the device.

Data transfer

Call acl.rt.memcpy:

  • Transfers encode source data from the host to the device.
  • Transfers the encode result from the device to the host.

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

Media data processing

acl.venc.send_frame: sends the images to be encoded to the encoder.

Directory Structure

The following is an example of the directory structure after the model file is converted:
venc_image
├──scripts
│ ├── host_version.conf // Version number configuration file.
│ └── testcase_300.sh // Run script.
├──src
│ └── acl_venc.py // Video encoding implementation file.
├── README_CN.md 
└── data // Test data, which needs to be deployed by users.
  └── dvpp_venc_128x128_nv12.yuv // Image file to be processed.