DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
SimdOps.h File Reference

SIMD-accelerated buffer operations for real-time audio processing. More...

#include <cstdint>
#include <type_traits>
Include dependency graph for SimdOps.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 
namespace  dspark::simd
 

Macros

#define DSPARK_RESTRICT
 

Functions

void dspark::simd::addWithGain (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT src, float gain, int count) noexcept
 Adds source samples scaled by a gain factor into a destination buffer.
 
void dspark::simd::addWithGain (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gain, int count) noexcept
 Double overload.
 
void dspark::simd::applyGain (float *DSPARK_RESTRICT data, float gain, int count) noexcept
 Multiplies all samples in a buffer by a gain factor.
 
void dspark::simd::applyGain (double *DSPARK_RESTRICT data, double gain, int count) noexcept
 Double overload.
 
float dspark::simd::peakLevel (const float *DSPARK_RESTRICT data, int count) noexcept
 Returns the peak absolute sample value in a buffer.
 
double dspark::simd::peakLevel (const double *DSPARK_RESTRICT data, int count) noexcept
 Double overload. NaN samples are ignored, as in the float version.
 
float dspark::simd::dotProduct (const float *DSPARK_RESTRICT a, const float *DSPARK_RESTRICT b, int count) noexcept
 Computes the dot product of two arrays.
 
double dspark::simd::dotProduct (const double *DSPARK_RESTRICT a, const double *DSPARK_RESTRICT b, int count) noexcept
 Double overload.
 
void dspark::simd::add (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT src, int count) noexcept
 Adds source samples into a destination buffer (no scaling).
 
void dspark::simd::add (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, int count) noexcept
 Double overload.
 
void dspark::simd::multiply (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT a, const float *DSPARK_RESTRICT b, int count) noexcept
 Element-wise product of two buffers into a destination.
 
void dspark::simd::multiply (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT a, const double *DSPARK_RESTRICT b, int count) noexcept
 Double overload.
 
void dspark::simd::copyWithGain (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT src, float gain, int count) noexcept
 Copies a buffer applying a gain factor (out-of-place).
 
void dspark::simd::copyWithGain (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gain, int count) noexcept
 Double overload.
 
void dspark::simd::applyGainRamp (float *DSPARK_RESTRICT data, float gainStart, float gainEnd, int count) noexcept
 In-place linear gain ramp (the canonical click-free fade primitive).
 
void dspark::simd::applyGainRamp (double *DSPARK_RESTRICT data, double gainStart, double gainEnd, int count) noexcept
 Double overload.
 
void dspark::simd::addWithGainRamp (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT src, float gainStart, float gainEnd, int count) noexcept
 Adds source samples scaled by a linear gain ramp into a destination.
 
void dspark::simd::addWithGainRamp (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gainStart, double gainEnd, int count) noexcept
 Double overload.
 
float dspark::simd::sumOfSquares (const float *DSPARK_RESTRICT data, int count) noexcept
 Returns the sum of squared samples (energy).
 
double dspark::simd::sumOfSquares (const double *DSPARK_RESTRICT data, int count) noexcept
 Double overload.
 
void dspark::simd::complexMulAccum (float *DSPARK_RESTRICT accum, const float *DSPARK_RESTRICT a, const float *DSPARK_RESTRICT b, int bins) noexcept
 Complex multiply-accumulate over interleaved [re, im, ...] spectra.
 
void dspark::simd::complexMulAccum (double *DSPARK_RESTRICT accum, const double *DSPARK_RESTRICT a, const double *DSPARK_RESTRICT b, int bins) noexcept
 Double overload (scalar on purpose: double spectra are an offline path).
 
template<typename T >
void dspark::simd::addWithGainT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gain, int count) noexcept
 
template<typename T >
void dspark::simd::applyGainT (T *DSPARK_RESTRICT data, T gain, int count) noexcept
 
template<typename T >
dspark::simd::peakLevelT (const T *DSPARK_RESTRICT data, int count) noexcept
 
template<typename T >
dspark::simd::dotProductT (const T *DSPARK_RESTRICT a, const T *DSPARK_RESTRICT b, int count) noexcept
 
template<typename T >
void dspark::simd::addT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, int count) noexcept
 
template<typename T >
void dspark::simd::multiplyT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT a, const T *DSPARK_RESTRICT b, int count) noexcept
 
template<typename T >
void dspark::simd::copyWithGainT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gain, int count) noexcept
 
template<typename T >
dspark::simd::sumOfSquaresT (const T *DSPARK_RESTRICT data, int count) noexcept
 
template<typename T >
void dspark::simd::applyGainRampT (T *DSPARK_RESTRICT data, T gainStart, T gainEnd, int count) noexcept
 
template<typename T >
void dspark::simd::addWithGainRampT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gainStart, T gainEnd, int count) noexcept
 

Detailed Description

SIMD-accelerated buffer operations for real-time audio processing.

Kernels use FMA (fused multiply-add) where the target enables it, and restrict-qualified pointers so compilers can unroll aggressively.

Build flags: binaries compiled for a generic x64 baseline stay on the SSE2 paths. Enable the wider kernels with /arch:AVX2 (MSVC) or -march=x86-64-v3 (GCC/Clang) when you control the deployment target. WebAssembly: compile with -msimd128 -msse2 so Emscripten lowers the SSE2 paths to Wasm SIMD128; otherwise the scalar fallbacks are used.

Definition in file SimdOps.h.

Macro Definition Documentation

◆ DSPARK_RESTRICT

#define DSPARK_RESTRICT

Definition at line 60 of file SimdOps.h.