DSP library for signal processing
DSP library for digital signal processing (and more)
This library provides set of functions that perform SIMD-optimized computing on several hardware architectures.
Currently supported set of SIMD extensions:
All functions currently operate on IEEE-754 single-precision floating-point numbers.
Current set of functions provided:
The build and correct unit test execution has been confirmed for following platforms:
The support of following list of hardware architectures has been implemented:
For all other architectures the generic implementation of algorithms is used, without any architecture-specific optimizations.
The following packages need to be installed for building:
To build the library, perform the following commands:
make config # Configure the build
make fetch # Fetch dependencies from Git repository
make
sudo make install
To get more build options, run:
make help
To uninstall library, simply issue:
make uninstall
To clean all binary files, run:
make clean
To clean the whole project tree including configuration files, run:
make prune
To fetch all possible dependencies and make the source code tree portable between different architectures and platforms, run:
make tree
To build source code archive with all possible dependencies, run:
make distsrc
Here's the code snippet of how the library can be initialized and used in C++:
#include <lsp-plug.in/dsp/dsp.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char **argv)
{
// Initialize DSP
lsp::dsp::init();
// Optionally: output information about the system
lsp::dsp::info_t *info = lsp::dsp::info();
if (info != NULL)
{
printf("Architecture: %s\n", info->arch);
printf("Processor: %s\n", info->cpu);
printf("Model: %s\n", info->model);
printf("Features: %s\n", info->features);
::free(info);
}
// For faster computing we can tune CPU by updating thread context.
// This will enable Flush-to-Zero and Denormals-are-Zero flags on
// CPUs that support them. This is thread-local change and should
// be called in each individual processing thread
lsp::dsp::context_t ctx;
lsp::dsp::start(&ctx);
// Here we call some dsp functions, for example dsp::fill_zero
float v[0x1000];
lsp::dsp::fill_zero(v, sizeof(v)/sizeof(float));
// At the end, we need to restore the context and reset CPU settings to defaults
lsp::dsp::finish(&ctx);
return 0;
}
Also all functions can be accessed from pure C with lsp_dsp_
prefix in the funcion and type names:
#include <lsp-plug.in/dsp/dsp.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char **argv)
{
// Initialize DSP
lsp_dsp_init();
// Optionally: output information about the system
lsp_dsp_info_t *info = lsp_dsp_info();
if (info != NULL)
{
printf("Architecture: %s\n", info->arch);
printf("Processor: %s\n", info->cpu);
printf("Model: %s\n", info->model);
printf("Features: %s\n", info->features);
free(info);
}
// For faster computing we can tune CPU by updating thread context.
// This will enable Flush-to-Zero and Denormals-are-Zero flags on
// CPUs that support them. This is thread-local change and should
// be called in each individual processing thread
lsp_dsp_context_t ctx;
lsp_dsp_start(&ctx);
// Here we call some dsp functions, for example lsp_dsp_fill_zero
float v[0x1000];
lsp_dsp_fill_zero(v, sizeof(v)/sizeof(float));
// At the end, we need to restore the context and reset CPU settings to defaults
lsp_dsp_finish(&ctx);
return 0;
}