[FFmpeg-devel] [PATCH] avformat/aiffdec: avoid double and ldexp()

Michael Niedermayer michaelni at gmx.at
Thu Jun 11 13:18:31 CEST 2015


On Sun, Jun 07, 2015 at 09:29:20PM -0700, Mark Harris wrote:
> > -    sample_rate = ldexp(val, exp - 16383 - 63);
> > +    if (exp >= 0)
> > +        sample_rate = val << exp;
> > +    else
> > +        sample_rate = (val + (1<<(-exp/2))) >> -exp;
> 
> To round the value it should probably be something like:
>     sample_rate = (val + ((uint64_t)1<<(-exp-1))) >> -exp;
> 
> To avoid possible undefined behavior it would also need to check that
> exp is within range.

changed

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150611/bc42d1af/attachment.asc>


More information about the ffmpeg-devel mailing list