[MPlayer-cvslog] CVS: main/libaf af_format.c,1.26,1.27

D Richard Felker III dalias at aerifal.cx
Tue Feb 22 20:53:38 CET 2005


On Tue, Feb 22, 2005 at 05:29:59PM +0100, Reimar Döffinger wrote:
> Hi,
> On Tue, Feb 22, 2005 at 03:13:00AM +0100, Richard Felker CVS wrote:
> > -      ((int8_t*)out)[i]=(int8_t)lrintf(SCHAR_MAX*((float*)in)[i]);
> > +      ((int8_t*)out)[i] = (int)(127.0 * (1.0+((float*)in)[i])) - 127;
> 
> I don't quite get why it's necessary to first add 127 and then subtract
> it again?? Also when this is broken, won't all other places where lrintf

This forces rounding in a common direction like lrintf would do,
rather than rounding towards 0 which introduces a bias that
audiophiles might complain about. :)

> How about just improving the configure check
> (-Werror-implicit-function-declaration maybe?).

Perhaps, but imo it's bad to use lrintf anyway -- it's probably slow
unless the libc makes it inline.

Rich




More information about the MPlayer-cvslog mailing list