DSP Programming

DSP Programming for consumer and DSP Software dominated applications are best implemented using a DSP pipeline and modular DSP transformations with buffer management. From years of experience, these pipeline structures which process blocks of data tend to provide the best trade off between overhead, ease of programming and reuse, system cost and time to market.
 
Signal Flow Graph
A signal flow graph is a block diagram which illustrates the basic flow of signals through the system. It is best to start with this graph and define all the basic transformation blocks that are required. If the blocks are uncertain, go and simulate the system with well known data and determine what the blocks and algorithms in each block should be, before implementing the system.
 
DSP Pipelines
The signal flow graph can be replaced by a set of objects which implement the algorithm using modular blocks. This is where DSP Programming really begins.
 
In the diagram, you can see that the links have been replaced with message queues and writes to and receives from these message queues. Each DSP module was transformed into a single thread, and that buffer management pools have been added to allow buffers to flow around the system correctly.
 
DSP Modules and Algorithms
DSP modules or transformation algorithms are an essential part of DSP Programming but are not generally a part of the system that users program very often. It is best to use off the shelf libraries for the algorithm that you need which are hand tuned for your processor. Then, add an initialization message for the thread and some glue software to get messages, manage buffers with the pools and send buffers on to the next stage for further processing.
 
Over time, a pool of modules will be built up. Each one will have buffer, message queue and initialization requirements, but knowing this, any user can string together a set of algorithms to produce the various signal transformations. These modules are small and flexible and can easily be ported onto larger multi-core machines for better performance in the future.
 
Fixed Size Buffer Pools
To properly setup and use such a DSP pipeline, fixed size buffer pools are required. Using fixed size pools, and controlling the number of buffers, the system can be tuned for performance. Buffers can be obtained from any pool by any DSP module and returned by any other thread or DSP module creating great flexibility.
 
Message Queues
Message queues are used between the threads and can have many different properties to ensure rapid and correct processing of signals. Messages can have priorities and fixed numbers to control processing order as well as system throughput.
 
Summary
DSP Programming is easy if approached with DSP pipelines and a clear idea of what the algorithms should do.