[FFmpeg-devel] [PATCH] AAC: type puns for 16 bit floating point rounding

Reimar Döffinger Reimar.Doeffinger
Mon Mar 16 17:40:43 CET 2009

On Wed, Feb 25, 2009 at 10:02:54PM +0000, Robert Swain wrote:
> 2009/2/23 Michael Niedermayer <michaelni at gmx.at>:
> > anyway i must admit i was tired and had not considered this ...
> > though i would suspect that a pure integer implementation would beat
> > frexpf/ldexpf
> This only matters if an arch is found with 32-bit float format
> non-IEEE754 compliant.

Hm, I think I should point out that at least flt16_trunc should be
implementable (and much faster than frexpf) as pure float operations
(at least +-1), too assuming you get the compiler to behave stupid:
> static av_always_inline float flt16_trunc(float pf) {
>     float tmp = pf * ((1 << 17) + 1);
>     return tmp - (tmp - pf);
> }
While I think it has too many issues to recommend it, it _might_ even
be faster than the current code.

More information about the ffmpeg-devel mailing list