From: Erik de Castro Lopo <mle+la@...>

To: <linux-audio-user@...>

Subject: Re: [LAU] About Algorithms

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

Re: [LAU] About Algorithms, Erik de Castro Lopo, (Mon Jul 18, 10:53 am)

Linuxaudio.org logo copyright Thorsten Wilms © 2006.

Hosting provided by the Virginia Tech Department of Music and DISIS.