[FFmpeg-devel] [PATCH] RoQ video encoder

Eric Lasota riot
Sat Jun 2 00:07:26 CEST 2007


Michael Niedermayer wrote:
 > the encoder is scary ...
First video encoder I ever wrote.  Over 2 years ago.  :P

 > ignoring the codebook generation the optimal solution is to iterate
 > over all possible encodings and choose the one with the lowest
 > rate distortion, that is distortion + lambda*bits (lambda is a constant
 > for the whole frame or movie which can be used to tune quality vs. 
bitrate,
 > distortion is the sum of squared differences or something like that)
The result would be the same.  Lambda represents the amount of error 
that the
encoder is willing to exchange for one bit, so you could say the reducer
defines lambda as the lowest number that will cause a reduction, a 
number that
will increase every iteration until the target is met, starting at zero.

The update I posted is actually just an additional measure to ensure that
lambda is, in fact, always increasing.

If you want to stop at lambda to do VBR, stick this at the start of the
reducer loop right after the validity check, and define lNum and lDenom 
as the
numerator and denominator of lambda:

if(lNum*sortOptionsSorted[0]->bitCostDecrease > 
lDenom*sortOptionsSorted[0]->mseIncrease)
    break;

 > do you also have a video which shows artifacts due to the YV12 instead of
 > RGB ?
I still need to reinstall Cygwin and test it with FFMPEG, but this should
break it.  Red box scrolling one pixel to the left for half a second.  Works
fine with Q3, should smear with subsampled chroma.
http://icculus.org/~riot/redbox.bz2




More information about the ffmpeg-devel mailing list