Deluge Firmware 1.3.0
Build date: 2026.11.28
Loading...
Searching...
No Matches
ImpulseResponseProcessor Class Reference

Public Member Functions

void process (std::span< StereoSample > buffer)

Private Types

using CoefficientVectors = std::array<Argon<int32_t>, NUM_COEFFICIENT_VECTORS>

Static Private Member Functions

static void copy (const StereoSample *from, size_t n, StereoSample *to)
static void convolve (const StereoSample *x, std::span< StereoSample > output)
 x points at the first new input, with HISTORY_SIZE older inputs before it
template<size_t j>
static void tap (const int32_t *newest, CoefficientVectors &coefficients, Argon< int32_t > &later, Argon< int32_t > &earlier)
static size_t convolveNeon (const StereoSample *x, std::span< StereoSample > output)
 Four outputs (two vectors, each two stereo frames) at a time; returns how many outputs it did.
static void convolveScalar (const StereoSample *x, std::span< StereoSample > output, size_t n=0)
 One output at a time, from output n on: the leftovers after convolveNeon, or everything off ARM.

Private Attributes

std::array< StereoSample, HISTORY_SIZE > history_ {}

Static Private Attributes

static constexpr size_t IR_SIZE = 26
static constexpr size_t HISTORY_SIZE = (IR_SIZE - 1)
static constexpr std::array< int32_t, IR_SIZE > ir
static constexpr size_t CHUNK_SIZE = 64
static constexpr size_t NUM_COEFFICIENT_VECTORS = (IR_SIZE + 3) / 4
static constexpr std::array< int32_t, NUM_COEFFICIENT_VECTORS *4 > irHalf

Member Function Documentation

◆ copy()

void ImpulseResponseProcessor::copy ( const StereoSample * from,
size_t n,
StereoSample * to )
inlinestaticprivate

Copy forwards, so moving samples down within the same array is fine too. These copies are short, so doing them two samples at a time inline is much cheaper than calling memcpy() / memmove() as std::copy does

◆ process()

void ImpulseResponseProcessor::process ( std::span< StereoSample > buffer)
inline

Convolve the buffer with the IR, in place. Direct form, so each output is a single chain of rounded multiply-accumulates over the last IR_SIZE inputs; this gives exactly the same result as accumulating rounded products one at a time.

Member Data Documentation

◆ ir

std::array<int32_t, IR_SIZE> ImpulseResponseProcessor::ir
staticconstexprprivate
Initial value:
= {
-3203916, 8857848, 24813136, 41537808, 35217472, 15195632, -27538592, -61984128, 1944654848,
1813580928, 438462784, 101125088, 6042048, -22429488, -46218864, -56638560, -64785312, -52108528,
-37256992, -11863856, 1390352, 14663296, 12784464, 14254800, 5690912, 4490736,
}

◆ irHalf

std::array<int32_t, NUM_COEFFICIENT_VECTORS * 4> ImpulseResponseProcessor::irHalf
staticconstexprprivate
Initial value:
= [] {
std::array<int32_t, NUM_COEFFICIENT_VECTORS * 4> half{};
for (size_t k = 0; k < IR_SIZE; k++) {
half[k] = ir[k] / 2;
}
return half;
}()

The documentation for this class was generated from the following file: