[Speex-dev] High CPU usage

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Wed Sep 23 04:06:22 PDT 2009


Mark Schilling a écrit :
> I recompiled with FIXED_POINT and CPU utilization stays below 4%. This is a great improvement.
> So how can I fix this to work with floating point ?

OK, so it looks a lot like a denorm problem. The issue is basically that
there are filters that decay exponentially, so when the input suddenly
goes to zero, then the filter's output value becomes smaller and smaller
until it reaches ~1e-37. At that point, your CPU takes >10x the normal
time to make calculations (why is beyond me).

Now, the work-around is to prevent some signals from going to exacly
zero. Have a look at how the VERY_SMALL macro is currently being used.
It's defined as 0 for fixed-point, but 1e-15f for float. By adding that
value to the right signal(s), you can prevent denormalized numbers from
being generated. The key is to find that place or those places. A
profiler may be able to tell you where the problem happens so you can
add VERY_SMALL just before that place. I suspect that just doing that at
the output of the preprocessor may be enough but I'm not sure.

Cheers,

	Jean-Marc


> Thanks.
> 
> Mark
> 
> -----Ursprüngliche Nachricht-----
> Von: Jean-Marc Valin [mailto:jean-marc.valin at usherbrooke.ca] 
> Betreff: Re: [Speex-dev] High CPU usage
> 
> 
> Hi,
> 
> Sound like it could be the good old denormalised float problem on the Intel chips. Just to make sure, can you try compiling in fixed-point
> (FIXED_POINT) and see if the problem goes away (it's not a fix, just a test)? If that's the case, there's probably a few VERY_SMALL's to add to some signals.
> 
> Cheers,
> 
> 	Jean-Marc
> 
> 
> Mark Schilling a écrit :
>> Hi,
>>
>> I have a curious problem with speex. As long as I'm talking, it takes about 2-5% of my CPU. This seems ok.
>> But as soon as I stop talking, CPU utilization rises to about 30-45% and stays there until I start talking again. 
>>
>> I compiled speex from source and use it with these settings:
>> - Preprocessor: Denoiser = ON, AGC = ON
>> - Encoder: ABR = 15000, DTX = 1, Mode = narrowband, Rate = 8000 Hz.
>>
>> My platform: Windows XP SP3, MSVS 2008 SP1, 1.8 GHz Core Duo CPU, 2 GB RAM.
>>
>> Thanks for your help :-)
>> Mark
>>
> 
> 
> 


More information about the Speex-dev mailing list