25class [[gnu::hot]] ImpulseResponseProcessor {
26 constexpr static size_t IR_SIZE = 26;
27 constexpr static size_t IR_BUFFER_SIZE = (IR_SIZE - 1);
29 constexpr static std::array<int32_t, IR_SIZE> ir = {
30 -3203916, 8857848, 24813136, 41537808, 35217472, 15195632, -27538592, -61984128, 1944654848,
31 1813580928, 438462784, 101125088, 6042048, -22429488, -46218864, -56638560, -64785312, -52108528,
32 -37256992, -11863856, 1390352, 14663296, 12784464, 14254800, 5690912, 4490736,
36 ImpulseResponseProcessor() =
default;
38 inline void process(
const StereoSample<q31_t> input, StereoSample<q31_t>& output) {
39 output.l = buffer_[0].l + multiply_32x32_rshift32_rounded(input.l, ir[0]);
40 output.r = buffer_[0].r + multiply_32x32_rshift32_rounded(input.r, ir[0]);
42 for (int32_t i = 1; i < IR_BUFFER_SIZE; i++) {
43 buffer_[i - 1].l = buffer_[i].l + multiply_32x32_rshift32_rounded(input.l, ir[i]);
44 buffer_[i - 1].r = buffer_[i].r + multiply_32x32_rshift32_rounded(input.r, ir[i]);
47 buffer_[IR_BUFFER_SIZE - 1].l = multiply_32x32_rshift32_rounded(input.l, ir[IR_BUFFER_SIZE]);
48 buffer_[IR_BUFFER_SIZE - 1].r = multiply_32x32_rshift32_rounded(input.r, ir[IR_BUFFER_SIZE]);
52 std::array<StereoSample<q31_t>, IR_BUFFER_SIZE> buffer_;