Re: [LAU] About Algorithms

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-user@...>
Date: Monday, July 18, 2011 - 10:53 am

David Adler wrote:

> AFAIK everything Jack (including Ardour) uses single precision 32 bit

The actual data values are 32 bit but they are converted to 64 bit
before they the arithmetic is done.

For instance in Secret Rabbit Code (my code), all data entering
and leaving the converter plus the actual filter coefficients are
stored as 32 bit floats. However, the inner loop which does the
multiply accumulate (similar to what is done when mixing) does:

double result = 0.0 ;

for ( ..... )
sum += coeff [k] * data [k] ;

Specifically all the inputs are 32 bit floats, but all intermediate
results are 64 bit.

> 32 bit floating point gives a dynamic range of ~192dB, well above the

Floating point calculations have problems. Specifically, if you take
a long list of numbers with both very large values and very small
values, you will get different results depending on whether you
add them the smallest to largest vs largest to smallest. For the
most accurate results, add from the smallest to largest.

This is probably the best known paper on the issues surrounding
floating point:

http://download.oracle.com/docs/cd/E19422-01/819-3693/ncg_goldberg.html

However, the problems of floating point are almost non-existant
in comparison to the problems of fixed point.

> I would not speak of inferiority or superiority when comparing this

I would be almost certain that Jack works on single presicion float
data, but does all the intermediate calculations in double precision.

If we assume that the 48 bit arithmetic only represents values in
the range (-1.0, 1.0) (this is usually the case when doing audio
processing on DSP processors).

Consider two values that are to be stored in a 48 bit fixed point
register:

va = 1.0 / pi
vb = 1.0 / (pi * 0x10000000000)

In the case of the value va, nearly all of the 48 register bits
will be used and we will get close to 48 bits of precision.

For the case of vb, a number very much smaller than 1.0, about
40 of the most significant bits will be zeros, leaving only about
8 bits of precision.

Now compare the above fixed point prepresentation with the floating
point representation where the mantissa would have the same number
of bits for both numbers and only the exponents would differ.

> Giving this[1] paper a quick look, they use the term "double

No, this is much more likely the double precision mode of the Motorola
56000 family of 24 bit fixed point DSP chips.

> All that

Exactly. Floating point, especially double floating point makes
it easier to code, because there's much less of this faffing about
required.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] About Algorithms, Moshe Werner, (Sat Jul 16, 11:03 pm)
Re: [LAU] About Algorithms, lorenzo cecchi, (Mon Jul 18, 10:40 am)
Re: [LAU] About Algorithms, Fons Adriaensen, (Mon Jul 18, 2:46 pm)
Re: [LAU] About Algorithms, Fons Adriaensen, (Sun Jul 17, 8:45 am)
Re: [LAU] About Algorithms, Ken Restivo, (Wed Jul 20, 3:39 am)
Re: [LAU] About Algorithms, Dale Powell, (Sun Jul 17, 11:25 am)
Re: [LAU] About Algorithms, Paul Coccoli, (Mon Jul 18, 9:55 pm)
Re: [LAU] About Algorithms, Folderol, (Mon Jul 18, 10:03 pm)
Re: [LAU] About Algorithms, Charles Henry, (Tue Jul 19, 3:52 am)
Re: [LAU] About Algorithms, Moshe Werner, (Tue Jul 19, 3:24 pm)
Re: [LAU] About Algorithms, Paul Davis, (Tue Jul 19, 2:54 am)
Re: [LAU] About Algorithms, Paul Coccoli, (Tue Jul 19, 9:47 pm)
Re: [LAU] About Algorithms, Dale Powell, (Wed Jul 20, 4:53 pm)
Re: [LAU] About Algorithms, Paul Davis, (Tue Jul 19, 9:57 pm)
Re: [LAU] About Algorithms, Moshe Werner, (Mon Jul 18, 6:40 am)
Re: [LAU] About Algorithms, Moshe Werner, (Mon Jul 18, 7:19 am)
Re: [LAU] About Algorithms, Erik de Castro Lopo, (Mon Jul 18, 7:38 am)
Re: [LAU] About Algorithms, David Adler, (Mon Jul 18, 9:53 am)
Re: [LAU] About Algorithms, Erik de Castro Lopo, (Mon Jul 18, 10:53 am)
Re: [LAU] About Algorithms, Fons Adriaensen, (Mon Jul 18, 2:56 pm)
Re: [LAU] About Algorithms, David Adler, (Mon Jul 18, 11:56 am)
Re: [LAU] About Algorithms, Erik de Castro Lopo, (Mon Jul 18, 12:11 pm)
Re: [LAU] About Algorithms, Fons Adriaensen, (Mon Jul 18, 3:01 pm)
Re: [LAU] About Algorithms, Paul Davis, (Mon Jul 18, 3:02 pm)
Re: [LAU] About Algorithms, Fons Adriaensen, (Mon Jul 18, 3:12 pm)
Re: [LAU] About Algorithms, David Adler, (Mon Jul 18, 12:14 pm)
Re: [LAU] About Algorithms, Renato, (Mon Jul 18, 10:13 am)
Re: [LAU] About Algorithms, David Adler, (Mon Jul 18, 10:43 am)
Re: [LAU] About Algorithms, Erik de Castro Lopo, (Mon Jul 18, 10:57 am)
Re: [LAU] About Algorithms, David Adler, (Mon Jul 18, 12:01 pm)
Re: [LAU] About Algorithms, Stephen Stubbs, (Sun Jul 17, 2:17 pm)
Re: [LAU] About Algorithms, Dale Powell, (Sun Jul 17, 3:25 pm)
Re: [LAU] About Algorithms, Erik de Castro Lopo, (Sun Jul 17, 8:31 am)