[FFmpeg-devel] Input requested on floating point decomposition for AAC Main
Wed Nov 12 00:17:47 CET 2008
On Tue, 2008-11-11 at 14:59 -0500, Alex Converse wrote:
> On Tue, Nov 11, 2008 at 5:21 AM, Jason Garrett-Glaser
> <darkshikari at gmail.com> wrote:
> > On Mon, Nov 10, 2008 at 10:39 PM, Alex Converse <alex.converse at gmail.com> wrote:
> >> To do 16-bit floating point rounding for AAC-Main, I need a function
> >> that will decompose a float into a normalized scheme and it's
> >> exponent. Conveniently there exists the x87 instruction FXTRACT for
> >> this very purpose.
> > Are you sure this is a good idea? FXTRACT takes 170 clock cycles on
> > Core 2, according to Agner, making it the single slowest floating
> > point operation in x86 history, perhaps competing with FBSTP.
> Hmm, FXTRACT may be slow but it appears to not be as slow as frexpf.
If you're implementing rounding code for x86 or AMD64 specifically (so
you could rely on a particular instruction) then you can most likely
implement the rounding more efficiently than by decomposing the float
into mantissa and exponent. You can rely on the memory representation of
a float and manipulate the bytes directly, or perhaps in some cases rely
on known machine precision and force rounding based on that with
algebraic operations (depending on exactly what kind of rounding you
want to do).
More information about the ffmpeg-devel