Abstract
This paper presents a novel "two-step" rate control strategy for H.264/AVC video encoding designed to resolve the circular dependency between Rate-Distortion Optimization (RDO) and Quantization Parameter (QP) selection. By implementing a fast pre-analysis phase using the Inter 16x16 mode and a subsequent QP refinement step during mode selection, the proposed algorithm achieves superior video quality and precise bit-rate control compared to standard reference software. Crucially, this is achieved without the computational burden of traditional multi-pass encoding, maintaining high efficiency for real-time applications.
Introduction
In video compression, rate control involves deciding how much detail to discard via the Quantization Parameter (QP) to meet a specific bit-rate target while maintaining high visual quality. The H.264/AVC standard introduced a significant challenge: Rate-Distortion Optimization (RDO). To select the optimal encoding mode for a block, the encoder requires a known QP; however, determining the optimal QP requires knowledge of the residue complexity after a mode is selected.
Existing solutions typically either guess the QP, leading to suboptimal quality, or perform multi-pass encoding, which can double the computational load. This research proposes a "middle way" that determines an accurate QP in two steps while performing only a single final encoding pass.
Methodology
The proposed scheme organizes the encoding process into three distinct layers: pre-analysis, frame-layer bit allocation, and macroblock-layer rate control.
The Two-Step Approach
- Pre-analysis Phase: Before formal encoding, the system performs quick motion estimation using only the Inter 16x16 mode. This provides a computationally cheap "sneak peek" at frame complexity to estimate source information and set a "coarse QP."
- Frame-Layer Bit Allocation: Using pre-analysis data, the algorithm allocates a bit budget for the entire frame, balancing buffer status with expected distortion.
- Macroblock-Layer Rate Control:
- Step 1 (Coarse): A coarse QP is calculated for the macroblock based on pre-analysis data.
- Step 2 (Refinement): During the RDO process, a "fine QP" is calculated for each specific mode based on the actual standard deviation of residues found during motion estimation.
By comparing the Rate-Distortion cost of all modes using their refined QPs, the encoder selects the best mode and performs a single encoding pass. This approach breaks the circular dependency by refining the QP within the RDO loop using residue information already generated by motion estimation.
Experimental Results
The algorithm was integrated into the H.264 reference software (JM 9.3) and tested against nine standard video sequences (QCIF, CIF, and D1 resolutions) covering various motion complexities.
Key findings include:
- Quality Improvement: The method achieved an average PSNR improvement of 0.28 dB over standard JM 9.3 rate control, with gains reaching up to 1.36 dB in specific sequences like News.
- Bit-Rate Stability: The algorithm maintained high stability, with bit-rate errors generally kept under 2% across various test cases.
- Computational Efficiency: The overhead was negligible when RDO was active, as pre-analysis results were reused. In "RDO off" mode, complexity increased by approximately 30%, which is considered a reasonable trade-off for the observed quality gains.
Conclusion
The two-step QP determination method effectively addresses the RDO circular dependency in H.264/AVC. While the current pre-analysis relies on the Inter 16x16 mode, future work may explore using more complex modes (e.g., Inter 8x8) for even greater accuracy in high-motion sequences. Additionally, incorporating machine learning to adaptively update model parameters could further refine the rate-distortion modeling.
Summary updated