[linux-audio-dev] interesting post from vst-plugins on float/int

Juan Linietsky coding at reduz.com.ar
Wed Sep 18 01:35:40 UTC 2002


On Mon, 16 Sep 2002 09:01:56 -0400
Paul Davis <pbd at op.net> wrote:

> i thought this was pretty insightful. vst-plugins has had a little
> debate over whether or not VST should provide an integer sample
> format. actually, not much of a debate. one person suggested it,
> everybody else jumped on him. this post, however, is the most
> detailed on why you should forget about thinking of float arithmetic
> as slower than integer ...
> 
> --;p

I still use ints and fixed point because shifting and masking are
faster than fdiv and fmod.
As far as I know you cant do those instructions in one cycle using
floats, and I use them everywhere.
For my FM synth emulators I have fixed point iterators where the
integer part is shifted
and used as index to a sinetable and then the fractional part masked
for interpolation.
This amazingly beats using FSIN o my duron 850mhz, which not only
starts slowing down
when the float index is greater than PI/4, but also doesnt give good
results because
of the limited 23 bits mantisa. And yes, i tried using the fpu control
register to change
presicion to 32 bits.
Thats why my integer code is still many times faster than my floating
point code.
I allways start with floating point mixers to try out approaches and
then convert to fixed point
to gain a very considerable speed boost. Consider also that when
working with sample
data you usually have it in 16 bits signed format (uses less space
than a 32 bits floats)
Disk space and memory usage are vital when you are writing a sampler,
i'd hate it if my sample libs would take up twice as much.
Also saturated adds in MMX are awesome when layering/mixing many code
blocks.
For now, I dont see any reason to switch to floating point for my
stuff since facts show me what is
faster.

Juan Linietsky



More information about the Linux-audio-dev mailing list