13
0

Prevent denormals in Lua DSP state (LPF, Biquad)

This commit is contained in:
Robin Gareus 2021-03-08 22:19:01 +01:00
parent cb6ad45e9d
commit 54ece22efb
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -20,6 +20,8 @@
#include <algorithm> #include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include <cmath> #include <cmath>
#include <boost/math/special_functions/fpclassify.hpp>
#include "ardour/dB.h" #include "ardour/dB.h"
#include "ardour/buffer.h" #include "ardour/buffer.h"
#include "ardour/dsp_filter.h" #include "ardour/dsp_filter.h"
@ -125,6 +127,7 @@ LowPass::proc (float *data, const uint32_t n_samples)
} }
_z = z; _z = z;
if (!isfinite_local (_z)) { _z = 0; } if (!isfinite_local (_z)) { _z = 0; }
else if (!boost::math::isnormal (_z)) { _z = 0; }
} }
void void
@ -178,7 +181,9 @@ Biquad::run (float *data, const uint32_t n_samples)
} }
if (!isfinite_local (_z1)) { _z1 = 0; } if (!isfinite_local (_z1)) { _z1 = 0; }
else if (!boost::math::isnormal (_z1)) { _z1 = 0; }
if (!isfinite_local (_z2)) { _z2 = 0; } if (!isfinite_local (_z2)) { _z2 = 0; }
else if (!boost::math::isnormal (_z2)) { _z2 = 0; }
} }
void void