The Art of Image Processing - Kindle eBook Company logo

Introduction to DSP - Programming DSPs: index

The simple FIR filter equation:

FIR filter equation

can be implemented quite directly in C language:

y[n] = 0.0;
for (k = 0; k < N; k++)
y[n] = y[n] + c[k] * x[n-k];

But this naive code is inefficient:

inefficient code

The code is inefficient because:

  • it uses array indices [i] rather than pointers *ptr
  • it needs a lot of address arithmetic
  • it repeatedly accesses the output array

backward/forward go back to start of module go back to previous page go to next page go to next module