H.264 encoder: add a simple reactive VBR rate control mode

Graphics / Video Acceleration / VA-API - Mark Thompson [jkqxz.net] - 9 January 2017 19:59 EST

This implements a simple reactive VBR rate control mode for single-layer H.264. The primary aim here is to avoid the problematic behaviour that the CBR rate controller displays on scene changes, where the QP can get pushed up by a large amount in a short period and compromise the quality of following frames to a
very visible degree.

The main idea, then, is to try to keep the HRD buffering above the target level most of the time, so that when a large frame is generated (on a scene change or when the stream complexity increases) we have plenty of slack to be able to encode the more difficult region without compromising quality immediately on the following frames. It is optimistic about the complexity of future frames, so even after generating one or more large frames on a significant change it will try to keep the QP at its current level until the HRD buffer bounds force a change to maintain the intended rate.

Compared to the CBR rate controller, it keeps the quality level much more stable - QP does not always spike up as large frames are generated when the complexity of the stream increases transiently, but equally it does not reduce as quickly when the complexity of the stream decreases.

f804a50 H.264 encoder: add a simple reactive VBR rate control mode
src/gen6_mfc.c | 10 ++--
src/gen6_mfc_common.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++--
src/gen75_mfc.c | 10 ++--
src/gen8_mfc.c | 10 ++--
src/i965_drv_video.c | 5 +-
5 files changed, 141 insertions(+), 20 deletions(-)

Upstream: cgit.freedesktop.org


  • Share