Skip to content

Rate Control Methods

Huts, Roman edited this page Oct 28, 2022 · 1 revision

Advanced Micro Devices

Rate Control Methods in AMF Video Encoder

Usage Guide


Disclaimer

The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions, and typographical errors. The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product and roadmap changes, component and motherboard version changes, new model and/or product releases, product differences between differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. Any computer system has risks of security vulnerabilities that cannot be completely prevented or mitigated. AMD assumes no obligation to update or otherwise correct or revise this information. However, AMD reserves the right to revise this information and to make changes from time to time to the content hereof without obligation of AMD to notify any person of such revisions or changes. THIS INFORMATION IS PROVIDED ‘AS IS.” AMD MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND ASSUMES NO RESPONSIBILITY FOR ANY INACCURACIES, ERRORS, OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION. AMD SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL AMD BE LIABLE TO ANY PERSON FOR ANY RELIANCE, DIRECT, INDIRECT, SPECIAL, OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.

© 2022 Advanced Micro Devices, Inc. All rights reserved.


AMF Video Encoder provides several rate control (RC) methods that are designed to better fit to different use cases.

Constant QP

In this mode, all the blocks/CTBs/SBs are coded at the same QP/QPIndex throughout the stream. In AVC/HEVC, QP ranges from 0 to 51, while in AV1, QPIndex ranges from 0 to 255. As is expected, the coded stream is variable in size, depending mainly on the complexity of the video contents.

Constant bitrate (CBR)

In video coding, CBR means that the bitrate generated by the encoder could be outputted at constant rate. This can be guaranteed that the coded picture buffer (CPB) should never underflow, or filler data need to be inserted.

Note that CBR is useful for streaming multimedia contents, but not optimal for recording as it may not be able to allocate enough bits for complex scenes, and filler data wastes precious bit budget.

CBR RC modes typically works together with ENFORCE_HRD and FILLER_DATA_ENABLE to guarantee HRD compliance.

Peak Constraint Variable bitrate (PCVBR)

Variable bitrate (VBR) means that the bitrate generated by the encoder could be outputted at non-constant rate. In other words, the CPB buffer is allowed to underflow.

Typically, VBR allows simple scene to be coded at lower bitrate, with saved bits being used to code complexed scene at higher bitrate. The resulting video will have less quality fluctuation compared to CBR.

PCVBR works in a similar way as VBR, but its peak bitrate is constrained by PEAK_BITRATE. This means that, if the encoder must encode the high complexity scene segment at higher than target bitrate, the maximum bitrate it can go is PEAK_BITRATE. Obviously other parts of the stream must be encoded at a lower bit rate to bring the average bitrate down to the target level.

To take full advantage of VBR in reducing quality fluctuation, a large VBV buffer (1 to 3 seconds) is needed. Consequently, large VBV buffer brings in large delay.

Latency Constraint Variable bitrate (LCVBR)

LCVBR is another variant of VBR – it works at variable bitrate, but target for low latency usage. In LCVBR, the VBV buffer can be set to be 1.1 to 3 frames, with maximum bitrate to be the same as target bitrate. It can barely allow CPB buffer overshot and unused bits from simple scene could not be used for future complex scene.

LCVBR achieves its strict latency constraint at the compromise of encoded video quality.

As a compromise, it is suggested for customers to try PCVBR with small buffer size to find good balance between quality and latency impact on the end-to-end solution.

Quality Based Variable Bitrate (QVBR)

This mode sets the RC mode to QUALITY_VBR and sets QVBR_QUALITY_LEVEL to 1 to 51, with 1 to be the worst quality, and 51 to be the best quality. 23 is set to be the default quality, at which level the coding artifacts is barely noticeable. User does not need to provide any target bitrate information as no rate control is employed. The output bitstreams size (bitrate) varies and is dependent on the complexity of the video.

QVBR mode is based on AMD patented technology on constant quality video coding. In QVBR, higher bitrate is used for complex scene, and lower bitrate is used for simple scene. The variable allocation of bit budgets guarantees that the same perceptual quality is achieved across the frame and entire stream.

Note that QVBR might hurt objective quality matrices such as PSNR or VMAF.

High Quality Variable Bitrate (HQ-VBR)

This mode sets the RC mode to HIGH_QUALITY_VBR. It is based on AMD patented technology on constant quality video coding. In this mode, target frame size is determined jointly by scene saliency and buffer status. It can absorb input video complexity variation and achieve constant visual quality. Besides target bitrate, its peak bitrate is constrained by PEAK_BITRATE. HQ-VBR works better with a large CPB buffer, and buffer underflow is allowed.

HQ-VBR aims at improving perceptual quality by producing the constant perceptual quality close to target bitrate. To guarantee the minimum perceptual quality, and to avoid wasting bit budget, the bitrate accuracy at extremely low/high target bitrate will be reduced.

Note that HQ-VBR might hurt objective quality matrices such as PSNR or VMAF.

High Quality Constant Bitrate (HQ-CBR)

This mode sets the RC mode to HIGH_QUALITY_CBR. It is based on AMD patented technology on constant quality video coding. In this mode, target frame size is determined jointly by scene saliency and buffer status. It can absorb input video complexity variation and achieve constant visual quality. HQ-CBR works better with a large CPB buffer. It typically works together with ENFORCE_HRD and FILLER_DATA_ENABLE to avoid CPB buffer underflow and guarantee HRD compliance.

HQ-CBR aims at improving perceptual quality by producing the constant perceptual quality close to the target bitrate. To guarantee the minimum perceptual quality loss, and to avoid wasting the bit budget, the bitrate accuracy at extremely low/high target bitrates will be reduced.

Note that HQ-CBR might hurt objective quality matrices such as PSNR or VMAF.

Annex A: Glossary of Acronyms

Acronym Definition
AMF Advanced Media Framework
AV1 AOMedia Video 1
AVC Advanced Video Coding
CBR constant bitrate
CPB coded picture buffer
CTB coding tree block
CQP constant QP
HEVC High Efficiency Video Coding
HQ-CBR high quality constant bitrate
HQ-VBR high quality variable bitrate
HVS human visual system
HRD hypothetical reference decoder
JND just noticeable difference
LCVBR latency constraint variable bitrate
PA pre-analysis
PCVBR peak constraint variable bitrate
PP pre-processing
PSNR peak signal-to-noise ratio
QP quantization parameters
QVBR quality based variable bitrate
RC rate control
SSIM structural similarity index measure
SB super block
VBV video buffer verifier
VMAF video multimethod assessment fusion

Reference:

  1. https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/master/amf/doc/AMF_Video_PreProcessing_API.pdf
  2. https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/master/amf/doc/AMF_Video_PreAnalysis_API.pdf