Awesome
CDSP - Compositional DSP Library for C++
develop @ Travis-CI <br/> (macOS & Linux) | develop @ Appveyor <br/> (Windows) |
---|---|
CDSP is a header only DSP library written with CNL aiming for floating point and fixed-point implementation of typical DSP kernels.
Algorithm designers often start with Matlab, Scipy, R or maybe Julia and get the algorithm designed on very high level with a floating-point datatype. For real-time applications the final target is often fixed-point DSP, FPGA or ASIC. Manual porting of the algorithm to fixed-point is needed which can lead to three separate algorithm source codes: original algorithm in floating-point, fixed-point design of the same and the final implementation on the target. Keeping them in synchronization is a nightmare.
CDSP library shows how with CNL single source code can provide full implementation. Minimally, CDSP can provide both floating-point and fixed-point designs from the same source code. In the case compliant C++ compiler exists for the target the final implementation is done as well.
CDSP fixed-point implementations are measured against their floating point counterparts in terms of numerical accuracy. At this point performance with Cirrus ADSP2 fixed-point datatypes have been tested and separately verified against native Cirrus ADSP2 implementation. Composing new datatype with CNL and specializing the lowest level of core CDSP kernels is quite straight forward to support other architectures such as Qualcomm, TI DSPs and other application specific processors as well as for ASIC implementation.
Requirements
Requirements are the same as with CNL. CDSP pulls CNL from it's conan package.
Linux
Tested on [Travis] (https://travis-ci.org/github/hbe72/cdsp)
Mac
Tested on [Travis] (https://travis-ci.org/github/hbe72/cdsp). For missing packages (compilers) please use Homebrew.
Windows
Tested on AppVeyor
Instructions
Download
The library is hosted on GitHub
git clone https://github.com/hbe72/cdsp.git
Build
Generate the build system and install cdsp
cd cdsp
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/directory/to/install -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install
Test
-
Conan for essential dependencies:
conan remote add --force johnmcfarlane/cnl https://api.bintray.com/conan/johnmcfarlane/cnl conan profile new --detect --force default
For GCC:
conan profile update settings.compiler.libcxx=libstdc++11 default
On OSX for clang or for apple-clang:
conan profile update settings.compiler.libcxx=libc++ default
On Windows:
conan profile update settings.compiler="Visual Studio" default conan profile update settings.os=Windows default
And finally install the dependencies:
conan install --build=missing ..
-
Configure the build with apprpriate toolchain. With GCC:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../test/cmake/toolchain/gcc.cmake -DCNL_SANITIZE=OFF -DCMAKE_PROJECT_cdsp_INCLUDE:FILEPATH="$(pwd)"/conan_paths.cmake ..
or with Clang:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../test/cmake/toolchain/clang.cmake -DCNL_SANITIZE=OFF -DCMAKE_PROJECT_cdsp_INCLUDE:FILEPATH="$(pwd)"/conan_paths.cmake ..
or with MSVC:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../test/cmake/toolchain/msvc.cmake -DCNL_SANITIZE=OFF -DCMAKE_PROJECT_cdsp_INCLUDE:FILEPATH="$(pwd)"/conan_paths.cmake ..
-
Build tests:
cmake --build . --target test-all
-
Run tests:
ctest -R test-unit