[LAU] About Algorithms

Fons Adriaensen fons at linuxaudio.org
Mon Jul 18 14:56:04 UTC 2011


On Mon, Jul 18, 2011 at 08:52:55PM +1000, Erik de Castro Lopo wrote:
 
> 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.
  
In the case they would probably be even if the sum was declared
float - it's very likely that the intermediate result will be
stored in a FP register anyway. OTOH there are compiler options
that would force it to single precision even in that case.

Zita-resampler does this a little bit different: it calculates
the sum from the start and end of the filter (where the very small
coefficients are) and working towards the center.

Ciao,

-- 
FA




More information about the Linux-audio-user mailing list