Skip to content

DSP Library (libdsp x15)

Henrik Langer edited this page Mar 4, 2017 · 10 revisions

Development

The development of libdsp-x15 took place in this repo. The architecture provides a consistent interface for creating, managing and executing DSP tasks. libdsp-x15 uses OpenCL for offloading operations to DSPs and TI DSPLIB (which implements signal operations on C66x DSPs). All implementations of DSP tasks must inherit from the abstract class DspTask and implement its methods. The TaskProcessor class is responsible for execution of DSP tasks. DSP tasks can only be created via DspTaskFactory. For detailed explanation of the build process check out Build Instructions page.

Components

  • DspTask - Abstract class which defines required interfaces for DSP tasks. Newly created DSP tasks must inherit from this class.
  • DspTaskFactory - Creates DSP tasks. Is responsible for correct construction and destruction.
  • TaskProcessor - Manages execution of DSP tasks.
  • FFT_SP - Implements single precision fast Fourier transform.
  • IFFT_SP - Implements single precision inverse fast Fourier transform.
  • FilterBiquadSP - Implements single precision biquad filter. Offers static helpers for coefficient calculation.
  • OpenCL Kernel Code - Provides interface for TI DSP Library

Usage

For a maximum performance the buffers are allocated in a contiguous memory area, which can be accessed from both host CPU and DSPs, thus avoiding an additional copy of data.

FFT / IFFT

FFT / IFFT uses complex samples for input and output data, represented by two floating point types. Therefore the buffer size is the double of the value of N. When using the raw low level buffers (e.g. getInputBuffer()), the FFT / IFFT operation expects the following format of input data:

-------------------------------------------
|       complex input/output sample       |
|            (double aligned)           |
|-----------------------------------------|
|      real part     |   imaginary part   |
| (single precision) | (single precision) |
-------------------------------------------

The output data of FFT/IFFT operation has the same format as input data. Additionally both tasks offer helper methods to access the buffers via C++ std::complex from STL.

Biquad Filter

The biquad filter operation only uses real numbers, thus the input and output buffer size corresponds to the number of input and output samples.

For detailed description of libdsp-x15 checkout the API Reference or the demo applications in this repo.

Testing

Fast Fourier Transform (FFT) / Inverse Fast Fourier Transform (IFFT)

In theory a Fourier Transform transforms a signal in time domain to frequency domain. Every signal represented in frequency domain can be reconstructed to time domain using an Inverse Fourier Transforma. To test both operations in a single test, a sine signal has been generated, transformed to frequency domain using FFT and reconstructed using IFFT. For evaluation of the test, all signals has been plotted (see here) using the GNU Octave. The test program is located in code/test-fft-ifft and the GNU Octave evaluation script in test/FFT_Plot.m.

Biquad Filter

The biquad filter operation has been tested in a similar way. A sine signal is generated and copied to the input buffer of biquad filter task. The biquad filter is configured as Notch with a cutoff frequency of 10 kHz. The plots of the transfer function and input / output signals can be found here. For more information check out the Realtime Filter Demo page.

References

Important Sources