[Mplayer-cvslog] Re: CVS: main/libmpcodecs ve_xvid.c,1.18,1.19
Rémi Guyomarch
rguyom at pobox.com
Thu Apr 3 10:37:19 CEST 2003
On Thu, Apr 03, 2003 at 09:25:39AM +0200, Dominik Mierzejewski wrote:
> On Thursday, 03 April 2003, Rémi Guyomarch CVS wrote:
> [...]
> > +static double
> > +sse_to_PSNR(double sse, double pixels)
> > +{
> > + return sse == 0 ? INFINITY : 4.34294481903251827652 * (11.08252709031685229249 - log(sse/pixels));
> > + // 4.34294481903251827652 = 10/log(10)
> > + // 11.08252709031685229249 = log(255*255)
> > +}
> > +
>
> You should never compare real type variables with 0. Best thing to do in
> such cases is to check if the absolute value is smaller than a certain
> threshold, for example
>
> return abs(sse) < 0.00000000000000000001 ? ...
log(0) == +INFINITY
log(0.000000000001) < +INFINITY
--
Rémi
More information about the MPlayer-cvslog
mailing list