[Speex-dev] High CPU usage

Mark Schilling mark_schilling at gmx.de
Wed Jun 13 11:41:07 PDT 2012

Hi Tanmay,

>Does compiling speex API with DISABLE_FLOAT_API and DISABLE_VBR solve the 

I remember that this fixed the problem. But at that time I also needed VBR so this was not an option.
As far as I know, it is related to some calculations that involve float denormals that cause the high CPU usage.

Today I'm still using the following code before speex_encoder_init and erverything works great:

// fix denormals performance issue
// http://software.intel.com/en-us/articles/x87-and-sse-floating-point-assists-in-ia-32-flush-to-zero-ftz-and-denormals-are-zero-daz/
__m128 state[32];
__int32 temp;
__asm fxsave state;
memcpy(&temp, (char*)state + 24, 4);
temp |= (1 << 11); // UNDERFLOW_EXCEPTION_MASK
temp |= (1 << 15); // FTZ_BIT
__asm ldmxcsr temp;

Tested with Visual Studio 2010 on x86.

Please let me know if it works for you too.

NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

More information about the Speex-dev mailing list