I am new to DSP? Where is a good resource for open source DSP algorithms?

MATLAB is great at making protos but once we move to C coding, it takes time and we end up making too many mistakes. I would guess there must be good repositories of C codes for various implementation of filters etc. Any pointers would be good.

  • 1
    $\begingroup$ You definitely need to bring a bit of focus as well as elaboration in your question. Are you really worried about Speed of execution or making and independent software? what is the scope (Application) and target? Are you trying to compare Matlab vs. C vs. xyz ? or have you really made up your mind in C and needs resources there? Any pointers are good - is generally a sign of lack of prior research on your part. $\endgroup$ Feb 27 '12 at 15:18

Part #1: Regarding the comparison:

There is no great general answer to what is a faster alternative to Matlab. It all depends on the platform you use.

@Hilmar asnwer indicating features like SIMD - which ARE possible in C. But it would require assembly lanaguage support along with C.

Here is a broader comparision:

  1. If you are working on a general purpose computing (like x86 or PPC), i guess there is nothing better (and faster) than C.

  2. If you are working on specialized DSP hardware, (or embedded platform such as ARM) than native assembly will be far ahead and C might just be no match against it. (Though C might be a right balance between making flexible software vs. execution speed.

  3. If you are comparing C with C++, unlike general perception - C++ can be made just as optimum in most context with some of the better programming features.

  4. For other handy tools - you can look at some other scripting tools like TCL,or Lua. These are definitely better than lower level but might compromise speed.

Part #2: The references

I would guess there must be good repositories of C codes for various implementation of filters etc.

  1. OpenCV - probably best for computer vision applications.

  2. ImLab 2.3 - is a free open source graphical application for Scientific Image Processing that runs in Windows, Linux and many other UNIX systems. It supports multiple windows, data types including 32 bit integers, 32 bit real numbers and complex numbers. It is implemented in C++ and also in C to provide a very simple way to add new functions. It has many image operations and supports several file formats.

  3. ImageLib: is a C++ class library providing image processing and related facilities. The main set of classes provides a variety of image and vector types, with additional modules supporting scalar and vector quantisation, wavelet transforms, DCT transforms, and simple histogram operations.

  4. CImage - C++ Template Image Processing Library

  5. Camellia Library is an open source Image Processing & Computer Vision library. Written in plain C, it is cross-platform (Unix / Linux, Windows) and robust. It already includes a lot of functions for image processing (filtering, morphological mathematics, labelling, warping, drawing, project/backproject, color conversion, loading/saving images, etc.), most of them being highly speed-optimized. It is also doxygen-documented and examples of use are provided.

  6. VXL : C++ Libraries for Computer Vision Research and Implementation

  7. GNU Scientific Library (GSL) is a numerical library for C and C++ programmers

  8. Intel® Math Kernel Library (Intel® MKL) is a computing math library of highly optimized, extensively threaded math routines for applications that require maximum performance. Core math functions include BLAS, LAPACK, ScaLAPACK1, sparse solvers, fast Fourier transforms, vector math, and more.

  9. You can refer to the book: Numerical Recepies in C - and the example code.

find lot more from here: http://www.cs.cmu.edu/~cil/v-source.html


The rub is that ANSI C is not a terribly good language for real time DSP. Many features that a real DSP chip has can't be addressed in ANSI C. These include address generators, bit-reverse addressing, circular addressing, SIMD, memory segments, multiple buses, fractional data types, fractional multiply, certain fixed point math, zero overhead looping etc. Hence most compilers for DSPs have an extensive set of language extensions (#pragma, inline assembler, new keywords, etc). However these are decidedly non-ANSI and not portable.

Writing a simple fixed point FIR filter in ANSI C can easily be 10 times less efficient than using the proper extensions or assembly code.


You can check put the matlab coder product. This allows you to generate C code directly from your matlab code without having to worry about the introduction of human errors.


However, it only supports a subset of the language and requires a separate licence, but it might be suitable for your needs.

The following link is useful to find the supported subset of Functions



Ceemple is a rapid JIT C++ technical computing environment, that bundles several optimized C/C++ libraries for technical computing, so you can do both rapid prototyping and deployment within Ceemple. Available (free) from http://www.ceemple.com.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.