[XviD-devel] Variable Quant + Variable Bitrate (Can it happen?)

pete pross at xvid.org
Tue Nov 29 09:07:12 CET 2005


hi,

[cleaning out my draft mbox...]

On Fri, 28 Jan 2005 22:25:31 -0500 Lee Morgan <leeamorgan at comcast.net>
wrote:
> Would someone please take a bit of time to explain to me why there 
> can't be a variable quant with variable bitrate mode?
> I know, I know - it exists (2 pass right). But that's not what I mean.
> To my understanding 2 pass takes the input bitrate as a avg it intends 
> to meet. It then analyzes the video determining what parts of the video 
> need what bitrate then on the second pass varies the quantizers as need 
> to achieve that overall bitrate (more or less correct?).

> It's been stated that 2 pass has a method of determining what level of 
> quantization a macro block should have (to retain high quality).
> Could this not be determined "on the fly" during a single pass encode 
> to allow instead of a fixed quant but rather a variable quant + 
> variable bitrate mode? Which would use the lowest needed quantization 
> for a macro block while still allowing for higher ones to be used when 
> possible.
> 
> This way it is possible to have a high quality single pass fixed quant 
> 2 without wasting bits.

the 1pass and 2pass rate control algorithms manipulate the quantizer in
effectively the same manner.
=========

mpeg-4 compression is achieved by quantizing the video. the level of
quantization is dictated by the quantizer value. here is a crude ascii
diagram showing a black box view of xvid:

     input video -> [ xvidcore ] -> bitstream output
                         ^
                         | 
                     quantizer

notice how there is no mention of "bitrate" in this diagram... that is
because we cannot directly control bitrate! instead, we employ a rate
control algorithm that instructs xvidcore what quantizer to use for each
frame.

* the 1pass algorithm measures the bits for each frame compressed by the
encoder, and adjusts the next frame's quantizer in order to achieve the
target bitrate.

the problem with 1pass is that it must react to the input video. so if
there is a high-motion scene, followed by a low-motion scene, it will adjust
the quantizer such that each scene is allocated the same number of bits.
this causes the high-motion scene to look ugly.

* the 2pass algorithm overcomes this reactionary problem. the first pass 
measures the bits for each frame compressed by the encoder. the
locations of high- and low-motion scenes are identified, so that the
quantizer can be adjusted in the second pass in order to allocate more
bits to high-motion scenes and less bits to low-motion scenes.

> P.S. Sorry if this double posts (I've been having problems with my mail 
> today - and I didn't see it come through on the list).

yep. several people have been reported problems.

-- pete



More information about the XviD-devel mailing list