Re: Optimizing a tapped delay (FIR) filter implementation




Kumar Appaiah wrote:
... I have a an initial delay line
(circular) buffer of 3520 samples, where I have 18 taps

at various positions with various gains. Right now, I am doing the
following in a loop:
....
Obviously, this makes the code spend a *lot* of time on the division
(modulo) operator. What is the correct and efficient way

bump the size of the circular array up to a power of 2 (in this case
4096) and then use the bit-wise & operator to mask (er_index+TAP_2)
with (ER_LENGTH-1). if your compiler is dumb and subtracts the 1 each
time rather than uses a constant value of (ER_LENGTH-1), then #define a
new symbol. the & operator is much faster than the % operator.

#define ER_LENGTH 4096 % must be power of 2
#define CIRC_INDEX(x) ( (x) & (ER_LENGTH-1) )

r b-j

.



Relevant Pages

  • Re: circular addressing implementation
    ... had a special instruction to manage addressing circular buffers. ... > buffer every time a new input sample is available. ... > buffer size to a power of two and use a logical AND on the input index instead ...
    (comp.dsp)
  • Re: Circular addressing mode in TI C64x+
    ... local buffer and then carry out the processing? ... efficiently generate circular addresses. ... The DSP detects the ...
    (comp.dsp)
  • Re: circular addressing implementation
    ... When programming a delay line a good technique is the use of circular ... buffer every time a new input sample is available. ... addressing is that you need a conditional, more especifically, an iffor ... Note that the mod operation is a divide operation, and usually takes about as long as an integer division with the same size operands -- even on DSP chips this can take longer than a conditional. ...
    (comp.dsp)
  • Re: Buffering TCPIP data
    ... It would be very helpful if you could outline the benefits of a circular ... You'd implement the circular buffer with an underlying byte array - it ... with no extra copying involved - i.e. you don't copy the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: mmap and physical memory
    ... > on my machine that mmaps a lot of memory and then uses it as circular ... So with time it walks from the beginning of the buffer to the ... > much RSS memory as there is mmaped. ... > mmaped areas are also much bigger. ...
    (comp.os.linux.development.apps)