[FFmpeg-devel] [PATCH] avformat/aiffdec: avoid double and ldexp()
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.
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
Size: 181 bytes
Desc: Digital signature
More information about the ffmpeg-devel