filter-chain: avoid denormals in biquad

See #1681 #2160
This commit is contained in:
Wim Taymans 2022-02-21 17:34:36 +01:00
parent 820e282a14
commit 62ae9b7d30

View file

@ -24,6 +24,7 @@
#include "config.h" #include "config.h"
#include <float.h>
#include <math.h> #include <math.h>
#ifdef HAVE_SNDFILE #ifdef HAVE_SNDFILE
#include <sndfile.h> #include <sndfile.h>
@ -303,10 +304,12 @@ static void bq_run(struct builtin *impl, unsigned long samples, int type)
y2 = y1; y2 = y1;
y1 = y; y1 = y;
} }
bq->x1 = x1; #define F(x) (-FLT_MIN < (x) && (x) < FLT_MIN ? 0.0f : (x))
bq->x2 = x2; bq->x1 = F(x1);
bq->y1 = y1; bq->x2 = F(x2);
bq->y2 = y2; bq->y1 = F(y1);
bq->y2 = F(y2);
#undef F
} }
/** bq_lowpass */ /** bq_lowpass */