1.  Field of the Invention
The present invention relates to systems and methods for encoding video data, and in particular to a system and method for controlling the quantization of the encoded video on a picture-by picture basis to prevent buffer overflow. 
2.  Description of the Related Art
Block-based hybrid video encoding schemes such as HEVC achieve compression not only by removing redundant information from the bitstream, but also by making adjustments in the quality of the output bitstream.  While such quality compromises render HEVC an inherently lossy process, such compromises may be made in a minimally perceptible way.  The quality of the output bistream may be controlled by varying a number of parameters used in the encoding process, including the quantization parameter (QP), which regulates how coarsely the output is quantized.  Such quantization impacts how much spatial detail is retained in the coded bitstream.  When QP is very small, the quantization step size(s) are small, and almost all that detail is retained.  However, as the QP is increased, some of that detail is lost within quantization steps.  The result is that bit rate drops, but at a cost of decreased fidelity (increased distortion). 
Video encoders may be operated open loop (VBR) or closed loop.  When operated open loop, a constant value for QP will result in reasonably constant video quality, but the bit rate may vary dramatically, as the complexity of the video source changes.  Such variance places difficult requirements on the output buffers of the encoders providing the bitstream, and the input buffers of the decoders receiving the bitstream.  Hence, systems and methods for varying QP depending on the complexity of the images of the uncoded source video have been developed.  These systems and method vary the QP based upon an estimation of the picture complexity. 
Decoders includes a buffer to smooth out variations in the arrival time and rate of the incoming coded data.  The encoder providing data to the decoder must produce a bitstream that is usable by the decoder, and in particular, that does not overwhelm the input buffer with data.  Accordingly, encoders use a “virtual buffer” model to estimate the fullness of the buffer in the decoder.  This virtual fullness buffers is another parameter upon which variation of the QP may be based. 
QP rate control may accomplished using a model that defines the quantization parameter as a function of the number of bits in the picture to be coded and two estimation parameters, a and b (also sometimes denoted as A and B, respectively).  However, such models typically utilize a constant value for a and b and hence, do not predict buffer fullness as well as is otherwise possible. 
What is needed is a method and apparatus that encode video using a quantization parameter derived at using estimation parameters that are adaptively adjusted depending on virtual (predicted) buffer fullness.  The method and apparatus described herein satisfies that need.