[Speex-dev] High CPU usage

Tanmay Ambre ambre.tanmay at gmail.com
Fri Aug 3 06:02:56 PDT 2012


> Hi Tanmay,
> 
> >Does compiling speex API with DISABLE_FLOAT_API and DISABLE_VBR solve the 
> >problem?
> 
> 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.
> 
> Mark

Hi Mark,

Your solution worked very well. 

I tested it at 8Khz 1 channel input.

Tanmay







More information about the Speex-dev mailing list