Custom Rate Control - Custom Rate Control - 3.0 English - PG447

H.264/H.265/JPEG Video Codec Unit 2 (VCU2) Solutions LogiCORE IP Product Guide (PG447)

Document ID
PG447
Release Date
2026-03-06
Version
3.0 English

A custom rate control algorithm is supported that is run by the firmware on the RISC-V processor. For this purpose vcu2-ctrl-sw/app_riscv is available:

vcu2-ctrl-sw/app_riscv/
├── base.mk
├── constants.lds
├── constants.mk
├── MakefilePlugin
├── plugin
│   ├── plugin.mk
│   └── plugin_src.mk
├── plugin_c906_gcc.lds
├── plugin_common.lds
├── README_PLUGIN
└── riscv_config.mk

The custom rate control code is linked against the existing firmware binary (as sources are not made available). The following steps generates an encoder firmware binary with custom rate control:

  1. Clone repository: Xilinx/vcu2-ctrl-sw
  2. Create Firmware/ folder at the same level
  3. Copy encoder_firmware.bin from Xilinx/vcu2-firmware to Firmware/ folder
  4. cd vcu2-ctrl-sw/app_riscv
  5. Add RISC-V gcc compiler to $PATH. For example: export PATH=/<install>/gnu/riscv/lin/riscv64-unknown-elf/bin:$PATH
  6. make -f MakefilePlugin, or V=1 make -f MakefilePlugin for verbose (make -f MakefilePlugin clean to clean)
  7. bin/riscv/plugged_encoder_firmware.bin is generated that can replace /lib/firmware/ale2xx.fw on the platform

These steps compile vcu2-ctrl-sw/lib_rate_ctrl/ExampleRCPlugin.c which has logs that output to the kernel message buffer:

pCtx->pMcu->trace("setrcparam", 20);

Use the dmesg command on the platform to inspect the kernel message buffer.

In the encoder cfg file change the rate control mode:

[RATE_CONTROL] RateCtrlMode = PLUGIN:

File vcu2-ctrl-sw/include/lib_rate_ctrl/PluginInterface.h describes the interface to implement.