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

Måns Rullgård mru
Wed Nov 29 00:38:44 CET 2006


Michael Niedermayer <michaelni at gmx.at> writes:

> 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 ...

Hmm, so some values are too large for signed 32-bit but fit in
unsigned 32-bit?  That would explain things.  So how should we
properly fix this?  We *could* of course ignore it and let it break on
cygwin...

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list