From baf7c74ad752b4606219d796e5c1c3d08b0824ed Mon Sep 17 00:00:00 2001 From: Vesa Date: Fri, 14 Nov 2014 20:43:49 +0200 Subject: [PATCH] Strip denormals --- include/MixerWorkerThread.h | 6 ++++++ src/core/MixerWorkerThread.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/MixerWorkerThread.h b/include/MixerWorkerThread.h index 2b680e8d5..d1ebc73eb 100644 --- a/include/MixerWorkerThread.h +++ b/include/MixerWorkerThread.h @@ -31,6 +31,12 @@ #include "ThreadableJob.h" #include "Mixer.h" +#ifdef __SSE__ +#include +#endif +#ifdef __SSE3__ +#include +#endif class MixerWorkerThread : public QThread { diff --git a/src/core/MixerWorkerThread.cpp b/src/core/MixerWorkerThread.cpp index 834db4afe..817d19c71 100644 --- a/src/core/MixerWorkerThread.cpp +++ b/src/core/MixerWorkerThread.cpp @@ -101,6 +101,16 @@ MixerWorkerThread::MixerWorkerThread( Mixer* mixer ) : m_workingBuf( new sampleFrame[mixer->framesPerPeriod()] ), m_quit( false ) { + // set denormal protection for this thread + #ifdef __SSE3__ + /* DAZ flag */ + _MM_SET_DENORMALS_ZERO_MODE( _MM_DENORMALS_ZERO_ON ); + #endif + #ifdef __SSE__ + /* FTZ flag */ + _MM_SET_FLUSH_ZERO_MODE( _MM_FLUSH_ZERO_ON ); + #endif + // initialize global static data if( queueReadyWaitCond == NULL ) {