[XviD-devel] GME and Block ME

Michael Niedermayer michaelni at gmx.at
Sat Apr 19 15:48:22 CEST 2003


Hi

On Saturday 19 April 2003 13:15, Christoph Lampert wrote:
> On Sat, 19 Apr 2003, Michael Niedermayer wrote:
> > Hi
> >
> > On Saturday 19 April 2003 08:56, Marco Al wrote:
> > > From: "Michael Niedermayer" <michaelni at gmx.at>
> > >
> > > > yes sounds better, ill change ffmpeg/mencoder docs to that :)
> > >
> > > Hey, since you are reading this a question :) Does your code do an
> > > optimal search or an M-best search?
> >
> > optimal, except that only 0, level, level-1 are checked, IIRC additionaly
> > checking level-2 had only a few byte lower filesize at constant quant,
> > the level-2 code is there and outcommented if u want to try
> >
> > for h263 quantizers a larger level difference should not be needed
> > the dequantized level stepsize is 2*qp and so for level-3 (!= 0) we need
> > to gain at least ((2.5*2*qp)^2 - (0.5*2*qp)^2)/lambda bits where lambda
> > is 0.85*qp^2 as recommanded by some doc
>
> Hi, thanks for explainations, and btw. the lambda values would have
> been my next question anyway: ffmpeg's mpegvideo.c reads
>
>    lambda= (qscale*qscale*64*105 + 64)>>7; //FIXME finetune
>
> and
>
>    int score= distoration + length[UNI_AC_ENC_INDEX(run,level)]*lambda;
>
> which I read as  lambda = 64*105/128 * qscale^2
>
> Where does the extra factor of 64 come from (or 16 perhaps, considering
> stepsize = 2*qscale) ?
very simple, the unquantized stuff is scaled by 8, so the distoration is 
scaled by 64, so we need to scale the bits by 64 too 

[...]

-- 
Michael
screen[y][x] ^= cursor[cy][cx];			(violates patent #4,197,590)
median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]);	(violates patent #5,905,535)
buf[i]= qp - buf[i-1];				(violates patent #?)
for more examples, see http://mplayerhq.hu/~michael/patent.html
stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en


More information about the XviD-devel mailing list