disable denormals in eq plugins

This commit is contained in:
Connor Olding 2014-02-05 23:53:23 -08:00
parent 6d6c64c1b0
commit bbabae237b
5 changed files with 25 additions and 16 deletions

View file

@ -32,6 +32,7 @@ process(personal *data,
float *out_L, float *out_R, float *out_L, float *out_R,
unsigned long count) unsigned long count)
{ {
disable_denormals();
for (unsigned long pos = 0; pos < count; pos++) { for (unsigned long pos = 0; pos < count; pos++) {
out_L[pos] = process_one(data->filters[0], in_L[pos]); out_L[pos] = process_one(data->filters[0], in_L[pos]);
out_R[pos] = process_one(data->filters[1], in_R[pos]); out_R[pos] = process_one(data->filters[1], in_R[pos]);
@ -44,6 +45,7 @@ process_double(personal *data,
double *out_L, double *out_R, double *out_L, double *out_R,
unsigned long count) unsigned long count)
{ {
disable_denormals();
for (unsigned long pos = 0; pos < count; pos++) { for (unsigned long pos = 0; pos < count; pos++) {
out_L[pos] = process_one(data->filters[0], in_L[pos]); out_L[pos] = process_one(data->filters[0], in_L[pos]);
out_R[pos] = process_one(data->filters[1], in_R[pos]); out_R[pos] = process_one(data->filters[1], in_R[pos]);

View file

@ -28,6 +28,7 @@ process(personal *data,
float *out_L, float *out_R, float *out_L, float *out_R,
unsigned long count) unsigned long count)
{ {
disable_denormals();
for (unsigned long pos = 0; pos < count; pos++) { for (unsigned long pos = 0; pos < count; pos++) {
out_L[pos] = process_one(data->filters[0], in_L[pos]); out_L[pos] = process_one(data->filters[0], in_L[pos]);
out_R[pos] = process_one(data->filters[1], in_R[pos]); out_R[pos] = process_one(data->filters[1], in_R[pos]);
@ -40,6 +41,7 @@ process_double(personal *data,
double *out_L, double *out_R, double *out_L, double *out_R,
unsigned long count) unsigned long count)
{ {
disable_denormals();
for (unsigned long pos = 0; pos < count; pos++) { for (unsigned long pos = 0; pos < count; pos++) {
out_L[pos] = process_one(data->filters[0], in_L[pos]); out_L[pos] = process_one(data->filters[0], in_L[pos]);
out_R[pos] = process_one(data->filters[1], in_R[pos]); out_R[pos] = process_one(data->filters[1], in_R[pos]);

View file

@ -1,13 +1,6 @@
#include <string.h> #include <string.h>
#ifdef __SSE2__ #include "crap_util.h"
#include <xmmintrin.h>
#ifndef __SSE2_MATH__
#warning SSE2 enabled but not forced, beware denormals
#endif
#else
#warning built without SSE2, denormals will be painful
#endif
#define ID 0x50F7BA11 #define ID 0x50F7BA11
#define LABEL "crap_tube" #define LABEL "crap_tube"
@ -24,14 +17,6 @@ typedef struct {
double history_R[HIST_SIZE]; double history_R[HIST_SIZE];
} personal; } personal;
static void
disable_denormals()
{
#if __SSE2__
_mm_setcsr(_mm_getcsr() | 0x8040);
#endif
}
static double static double
distort(double x) distort(double x)
{ {

View file

@ -1,5 +1,17 @@
#include "math.h" #include "math.h"
#ifdef __SSE2__
#include <xmmintrin.h>
#ifndef __SSE2_MATH__
#warning SSE2 enabled but not forced, beware denormals
#endif
#else
#warning built without SSE2, denormals will be painful
#endif
static void
disable_denormals();
#define LIMIT(v,l,u) ((v)<(l)?(l):((v)>(u)?(u):(v))) #define LIMIT(v,l,u) ((v)<(l)?(l):((v)>(u)?(u):(v)))
#define DB2LIN(x) ((x) > -90 ? pow(10, (x) * 0.05) : 0) #define DB2LIN(x) ((x) > -90 ? pow(10, (x) * 0.05) : 0)

View file

@ -2,6 +2,14 @@
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
static void
disable_denormals()
{
#if __SSE2__
_mm_setcsr(_mm_getcsr() | 0x8040);
#endif
}
/* via http://www.rgba.org/articles/sfrand/sfrand.htm */ /* via http://www.rgba.org/articles/sfrand/sfrand.htm */
static unsigned int mirand = 1; static unsigned int mirand = 1;