[LAD] Mixing audio: Implementing pan and balance

hermann meyer brummer- at web.de
Sun Mar 24 09:49:56 UTC 2013


Am 24.03.2013 09:46, schrieb Raphaël BOLLEN:
> Aargh, although only if the inputs are left un-connected, if you 
> stream silence on input 1 cpu % increase is back. 
I use when ever possible SSE2 to avoid denormals, compile with  -msse2 
-mfpmath=sse
flags and implement as followed:

///////////////////////// DENORMAL PROTECTION WITH SSE /////////////////

#ifdef __SSE__
/* On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
    flags to avoid costly denormals */
#ifdef __SSE3__
#include <pmmintrin.h>
inline void AVOIDDENORMALS()
{
   _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
   _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
}
#else
#include <xmmintrin.h>
inline void AVOIDDENORMALS()
{
   _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
}
#endif //__SSE3__

#else
inline void AVOIDDENORMALS() {}
#endif //__SSE__

//////////////////////////////////////////////////////////////////////////////////////////////////////////


now run once
AVOIDDENORMALS();

somewhere in init()



More information about the Linux-audio-dev mailing list