[Ffmpeg-devel] Use of llrint() in mpegaudiodec.c

Michael Niedermayer michaelni
Wed Nov 29 00:14:08 CET 2006


Hi

On Tue, Nov 28, 2006 at 10:53:24PM +0000, M?ns Rullg?rd wrote:
> Benjamin Larsson <banan at student.ltu.se> writes:
> 
> > M?ns Rullg?rd wrote:
> >
> >>In mpegaudiodec.c there are two calls to llrint().  This function
> >>isn't available on some platforms, so linking fails there.  Looking
> >>closer, I notice that in both cases, the return value is immediately
> >>assigned to a 32-bit variable.  This makes be think that using lrint()
> >>should work equally well, and lrint() is more widely available than
> >>llrint().  Is there some subtle issue I'm missing here, or is the
> >>attached patch safe?
> >>  
> >>
> >
> > This is the commit message that added this code:
> >
> > http://thread.gmane.org/gmane.comp.video.ffmpeg.cvs/4408/focus=4408
> >
> > Some systems didn't like lrint() either, so I suggest to go by the
> > integer rounding route that Michael suggested later in the thread.
> 
> That still doesn't explain why llrint() is used, even though the
> return value is immediately converted to 32 bits.  Michael's second
> suggestion also involves unexplained 64-bit types.

_IIRC_ some values didnt fit in an 32bit int and caused a floating
point exception, adding a check for >MAX should work too but its
more complex ...

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list