Any good C/C++ DSP library?

Viet picture Viet · Nov 19, 2009 · Viewed 19.8k times · Source

Which DSP library in C/C++ would you recommend? I will need it for real-time embedded systems. It'd be great to have sound signal processing accompany too, but not a mandatory. If you have knowledge of any DSP library, please kindly share.

Answer

Clifford picture Clifford · Nov 23, 2009

We are thinking of AVR, ARM and even some middle range chips

Neither are particularly designed for DSP, but if your performance requirements are modest enough that may not be a problem. What do you need the DSP to do? I suggest that you choose your platform first and use the vendor's library since that will be optimised for the platform. If the vendor does not have a DSP library, then the part may not be a good DSP platform.

For example Microchip's dsPIC devices are microcontrollers with a DSP subsystem that gives good performance per MHz for DSP algorithms such as FIR and FFT, and Microchip provide a DSP library optimised for the part.

ST provide a DSP library for their STM32 parts. These are Cortex M3 devices rather than DSP, but the Harvard architecture and multiply-accumulate instruction make them capable enough in low-end applications such as motor control or speech-band audio processing. Technically since the DSP library is provided as source-code, it would probably port to any Thumb-2 instruction set device, but may not be licensed for such use. While at the same operating frequency these are considerably slower than dsPIC at DSP algorithms (when using optimised assembler libraries), they are faster in general at C code execution, but your mileage may vary, depending on the code and application.

Similarly Atmel provide a DSP library for their AVR32. I have no direct experience of this, but would expect comparable performance to a Cortex m3 device. Significantly perhaps, Atmel's library is far more extensive, and better documented that ST's.

If you want something faster that is not a pure DSP, consider Renesas's SH-2 devices, at an astonishing 2 MIPS per MHz, in many applications not being a dedicated DSP is not an issue, and some parts do have DSP extensions in any case. Again the vendor provides an optimised DSP library.

Other than these 'general-purpose-with-DSP-capability' devices, you might of course opt for a real DSP. TI produce a wide range of such devices from low-end to high. In my experience however, the development costs are high due to TI's high fees for its dev-tools, and many parts are a bit light on on-chip peripherals.

[UPDATE 23 Apri l2012] New STM32F4xx parts are Cortex-M4 based so include DSP and floating-point hardware. They have the same DSP library API as Cortex-M3 base STM32F1xx/F2xx parts but make use of the DSP core for better performance.