DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::simd Namespace Reference

Functions

void 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 addWithGain (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gain, int count) noexcept
 Double overload.
 
void applyGain (float *DSPARK_RESTRICT data, float gain, int count) noexcept
 Multiplies all samples in a buffer by a gain factor.
 
void applyGain (double *DSPARK_RESTRICT data, double gain, int count) noexcept
 Double overload.
 
float peakLevel (const float *DSPARK_RESTRICT data, int count) noexcept
 Returns the peak absolute sample value in a buffer.
 
double peakLevel (const double *DSPARK_RESTRICT data, int count) noexcept
 Double overload. NaN samples are ignored, as in the float version.
 
float dotProduct (const float *DSPARK_RESTRICT a, const float *DSPARK_RESTRICT b, int count) noexcept
 Computes the dot product of two arrays.
 
double dotProduct (const double *DSPARK_RESTRICT a, const double *DSPARK_RESTRICT b, int count) noexcept
 Double overload.
 
void add (float *DSPARK_RESTRICT dst, const float *DSPARK_RESTRICT src, int count) noexcept
 Adds source samples into a destination buffer (no scaling).
 
void add (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, int count) noexcept
 Double overload.
 
void 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 multiply (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT a, const double *DSPARK_RESTRICT b, int count) noexcept
 Double overload.
 
void 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 copyWithGain (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gain, int count) noexcept
 Double overload.
 
void applyGainRamp (float *DSPARK_RESTRICT data, float gainStart, float gainEnd, int count) noexcept
 In-place linear gain ramp (the canonical click-free fade primitive).
 
void applyGainRamp (double *DSPARK_RESTRICT data, double gainStart, double gainEnd, int count) noexcept
 Double overload.
 
void 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 addWithGainRamp (double *DSPARK_RESTRICT dst, const double *DSPARK_RESTRICT src, double gainStart, double gainEnd, int count) noexcept
 Double overload.
 
float sumOfSquares (const float *DSPARK_RESTRICT data, int count) noexcept
 Returns the sum of squared samples (energy).
 
double sumOfSquares (const double *DSPARK_RESTRICT data, int count) noexcept
 Double overload.
 
void 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 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 addWithGainT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gain, int count) noexcept
 
template<typename T >
void applyGainT (T *DSPARK_RESTRICT data, T gain, int count) noexcept
 
template<typename T >
peakLevelT (const T *DSPARK_RESTRICT data, int count) noexcept
 
template<typename T >
dotProductT (const T *DSPARK_RESTRICT a, const T *DSPARK_RESTRICT b, int count) noexcept
 
template<typename T >
void addT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, int count) noexcept
 
template<typename T >
void multiplyT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT a, const T *DSPARK_RESTRICT b, int count) noexcept
 
template<typename T >
void copyWithGainT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gain, int count) noexcept
 
template<typename T >
sumOfSquaresT (const T *DSPARK_RESTRICT data, int count) noexcept
 
template<typename T >
void applyGainRampT (T *DSPARK_RESTRICT data, T gainStart, T gainEnd, int count) noexcept
 
template<typename T >
void addWithGainRampT (T *DSPARK_RESTRICT dst, const T *DSPARK_RESTRICT src, T gainStart, T gainEnd, int count) noexcept
 

Function Documentation

◆ add() [1/2]

void dspark::simd::add ( double *DSPARK_RESTRICT  dst,
const double *DSPARK_RESTRICT  src,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 646 of file SimdOps.h.

◆ add() [2/2]

void dspark::simd::add ( float *DSPARK_RESTRICT  dst,
const float *DSPARK_RESTRICT  src,
int  count 
)
inlinenoexcept

Adds source samples into a destination buffer (no scaling).

Definition at line 608 of file SimdOps.h.

◆ addT()

template<typename T >
void dspark::simd::addT ( T *DSPARK_RESTRICT  dst,
const T *DSPARK_RESTRICT  src,
int  count 
)
noexcept

Definition at line 1189 of file SimdOps.h.

◆ addWithGain() [1/2]

void dspark::simd::addWithGain ( double *DSPARK_RESTRICT  dst,
const double *DSPARK_RESTRICT  src,
double  gain,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 130 of file SimdOps.h.

◆ addWithGain() [2/2]

void dspark::simd::addWithGain ( float *DSPARK_RESTRICT  dst,
const float *DSPARK_RESTRICT  src,
float  gain,
int  count 
)
inlinenoexcept

Adds source samples scaled by a gain factor into a destination buffer.

Definition at line 77 of file SimdOps.h.

◆ addWithGainRamp() [1/2]

void dspark::simd::addWithGainRamp ( double *DSPARK_RESTRICT  dst,
const double *DSPARK_RESTRICT  src,
double  gainStart,
double  gainEnd,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 956 of file SimdOps.h.

◆ addWithGainRamp() [2/2]

void dspark::simd::addWithGainRamp ( float *DSPARK_RESTRICT  dst,
const float *DSPARK_RESTRICT  src,
float  gainStart,
float  gainEnd,
int  count 
)
inlinenoexcept

Adds source samples scaled by a linear gain ramp into a destination.

Same ramp convention as applyGainRamp: sample i uses gainStart + i * (gainEnd - gainStart) / count, spanning [gainStart, gainEnd) across the block. count <= 0 is a no-op.

Definition at line 896 of file SimdOps.h.

◆ addWithGainRampT()

template<typename T >
void dspark::simd::addWithGainRampT ( T *DSPARK_RESTRICT  dst,
const T *DSPARK_RESTRICT  src,
gainStart,
gainEnd,
int  count 
)
noexcept

Definition at line 1224 of file SimdOps.h.

◆ addWithGainT()

template<typename T >
void dspark::simd::addWithGainT ( T *DSPARK_RESTRICT  dst,
const T *DSPARK_RESTRICT  src,
gain,
int  count 
)
noexcept

Definition at line 1161 of file SimdOps.h.

◆ applyGain() [1/2]

void dspark::simd::applyGain ( double *DSPARK_RESTRICT  data,
double  gain,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 224 of file SimdOps.h.

◆ applyGain() [2/2]

void dspark::simd::applyGain ( float *DSPARK_RESTRICT  data,
float  gain,
int  count 
)
inlinenoexcept

Multiplies all samples in a buffer by a gain factor.

Definition at line 186 of file SimdOps.h.

◆ applyGainRamp() [1/2]

void dspark::simd::applyGainRamp ( double *DSPARK_RESTRICT  data,
double  gainStart,
double  gainEnd,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 841 of file SimdOps.h.

◆ applyGainRamp() [2/2]

void dspark::simd::applyGainRamp ( float *DSPARK_RESTRICT  data,
float  gainStart,
float  gainEnd,
int  count 
)
inlinenoexcept

In-place linear gain ramp (the canonical click-free fade primitive).

Sample i is scaled by gainStart + i * (gainEnd - gainStart) / count, so the ramp covers [gainStart, gainEnd) across the block: the last sample sits one step below gainEnd. For a continuous fade across consecutive blocks, start the next block at gainEnd. count <= 0 is a no-op.

Definition at line 794 of file SimdOps.h.

◆ applyGainRampT()

template<typename T >
void dspark::simd::applyGainRampT ( T *DSPARK_RESTRICT  data,
gainStart,
gainEnd,
int  count 
)
noexcept

Definition at line 1217 of file SimdOps.h.

◆ applyGainT()

template<typename T >
void dspark::simd::applyGainT ( T *DSPARK_RESTRICT  data,
gain,
int  count 
)
noexcept

Definition at line 1168 of file SimdOps.h.

◆ complexMulAccum() [1/2]

void dspark::simd::complexMulAccum ( double *DSPARK_RESTRICT  accum,
const double *DSPARK_RESTRICT  a,
const double *DSPARK_RESTRICT  b,
int  bins 
)
inlinenoexcept

Double overload (scalar on purpose: double spectra are an offline path).

Definition at line 1144 of file SimdOps.h.

◆ complexMulAccum() [2/2]

void dspark::simd::complexMulAccum ( float *DSPARK_RESTRICT  accum,
const float *DSPARK_RESTRICT  a,
const float *DSPARK_RESTRICT  b,
int  bins 
)
inlinenoexcept

Complex multiply-accumulate over interleaved [re, im, ...] spectra.

The workhorse of frequency-domain (partitioned) convolution: accum += a * b evaluated as complex numbers, for bins complex bins.

Definition at line 1039 of file SimdOps.h.

◆ copyWithGain() [1/2]

void dspark::simd::copyWithGain ( double *DSPARK_RESTRICT  dst,
const double *DSPARK_RESTRICT  src,
double  gain,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 756 of file SimdOps.h.

◆ copyWithGain() [2/2]

void dspark::simd::copyWithGain ( float *DSPARK_RESTRICT  dst,
const float *DSPARK_RESTRICT  src,
float  gain,
int  count 
)
inlinenoexcept

Copies a buffer applying a gain factor (out-of-place).

Definition at line 730 of file SimdOps.h.

◆ copyWithGainT()

template<typename T >
void dspark::simd::copyWithGainT ( T *DSPARK_RESTRICT  dst,
const T *DSPARK_RESTRICT  src,
gain,
int  count 
)
noexcept

Definition at line 1203 of file SimdOps.h.

◆ dotProduct() [1/2]

double dspark::simd::dotProduct ( const double *DSPARK_RESTRICT  a,
const double *DSPARK_RESTRICT  b,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 517 of file SimdOps.h.

◆ dotProduct() [2/2]

float dspark::simd::dotProduct ( const float *DSPARK_RESTRICT  a,
const float *DSPARK_RESTRICT  b,
int  count 
)
inlinenoexcept

Computes the dot product of two arrays.

Definition at line 419 of file SimdOps.h.

◆ dotProductT()

template<typename T >
T dspark::simd::dotProductT ( const T *DSPARK_RESTRICT  a,
const T *DSPARK_RESTRICT  b,
int  count 
)
noexcept

Definition at line 1182 of file SimdOps.h.

◆ multiply() [1/2]

void dspark::simd::multiply ( double *DSPARK_RESTRICT  dst,
const double *DSPARK_RESTRICT  a,
const double *DSPARK_RESTRICT  b,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 702 of file SimdOps.h.

◆ multiply() [2/2]

void dspark::simd::multiply ( float *DSPARK_RESTRICT  dst,
const float *DSPARK_RESTRICT  a,
const float *DSPARK_RESTRICT  b,
int  count 
)
inlinenoexcept

Element-wise product of two buffers into a destination.

Definition at line 679 of file SimdOps.h.

◆ multiplyT()

template<typename T >
void dspark::simd::multiplyT ( T *DSPARK_RESTRICT  dst,
const T *DSPARK_RESTRICT  a,
const T *DSPARK_RESTRICT  b,
int  count 
)
noexcept

Definition at line 1196 of file SimdOps.h.

◆ peakLevel() [1/2]

double dspark::simd::peakLevel ( const double *DSPARK_RESTRICT  data,
int  count 
)
inlinenoexcept

Double overload. NaN samples are ignored, as in the float version.

Definition at line 345 of file SimdOps.h.

◆ peakLevel() [2/2]

float dspark::simd::peakLevel ( const float *DSPARK_RESTRICT  data,
int  count 
)
inlinenoexcept

Returns the peak absolute sample value in a buffer.

NaN samples are ignored on every code path (SIMD and scalar): the result is the peak of the finite samples, 0 if there are none.

Definition at line 264 of file SimdOps.h.

◆ peakLevelT()

template<typename T >
T dspark::simd::peakLevelT ( const T *DSPARK_RESTRICT  data,
int  count 
)
noexcept

Definition at line 1175 of file SimdOps.h.

◆ sumOfSquares() [1/2]

double dspark::simd::sumOfSquares ( const double *DSPARK_RESTRICT  data,
int  count 
)
inlinenoexcept

Double overload.

Definition at line 1024 of file SimdOps.h.

◆ sumOfSquares() [2/2]

float dspark::simd::sumOfSquares ( const float *DSPARK_RESTRICT  data,
int  count 
)
inlinenoexcept

Returns the sum of squared samples (energy).

Definition at line 1018 of file SimdOps.h.

◆ sumOfSquaresT()

template<typename T >
T dspark::simd::sumOfSquaresT ( const T *DSPARK_RESTRICT  data,
int  count 
)
noexcept

Definition at line 1210 of file SimdOps.h.