If you are compiling with SSE and/or SSE2 instructions enabled, you could consider enabling the floating point "Flush-to-zero" mode and maybe (if supported on the processor) enable "denormals are zero". The flush-to-zero is probably the more important of the two.<div>
<br></div><div><a href="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/">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/</a><br>
<div><br></div><div><br></div><div><br><div class="gmail_quote">On Wed, Sep 23, 2009 at 4:06 AM, Jean-Marc Valin <span dir="ltr"><<a href="mailto:jean-marc.valin@usherbrooke.ca">jean-marc.valin@usherbrooke.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Mark Schilling a écrit :<br>
<div class="im">> I recompiled with FIXED_POINT and CPU utilization stays below 4%. This is a great improvement.<br>
> So how can I fix this to work with floating point ?<br>
<br>
</div>OK, so it looks a lot like a denorm problem. The issue is basically that<br>
there are filters that decay exponentially, so when the input suddenly<br>
goes to zero, then the filter's output value becomes smaller and smaller<br>
until it reaches ~1e-37. At that point, your CPU takes >10x the normal<br>
time to make calculations (why is beyond me).<br>
<br>
Now, the work-around is to prevent some signals from going to exacly<br>
zero. Have a look at how the VERY_SMALL macro is currently being used.<br>
It's defined as 0 for fixed-point, but 1e-15f for float. By adding that<br>
value to the right signal(s), you can prevent denormalized numbers from<br>
being generated. The key is to find that place or those places. A<br>
profiler may be able to tell you where the problem happens so you can<br>
add VERY_SMALL just before that place. I suspect that just doing that at<br>
the output of the preprocessor may be enough but I'm not sure.<br>
<br>
Cheers,<br>
<font color="#888888"><br>
Jean-Marc<br>
</font><div class="im"><br>
<br>
> Thanks.<br>
><br>
> Mark<br>
><br>
> -----Ursprüngliche Nachricht-----<br>
> Von: Jean-Marc Valin [mailto:<a href="mailto:jean-marc.valin@usherbrooke.ca">jean-marc.valin@usherbrooke.ca</a>]<br>
> Betreff: Re: [Speex-dev] High CPU usage<br>
><br>
><br>
> Hi,<br>
><br>
> 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<br>
> (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.<br>
><br>
> Cheers,<br>
><br>
> Jean-Marc<br>
><br>
><br>
> Mark Schilling a écrit :<br>
>> Hi,<br>
>><br>
>> I have a curious problem with speex. As long as I'm talking, it takes about 2-5% of my CPU. This seems ok.<br>
>> But as soon as I stop talking, CPU utilization rises to about 30-45% and stays there until I start talking again.<br>
>><br>
>> I compiled speex from source and use it with these settings:<br>
>> - Preprocessor: Denoiser = ON, AGC = ON<br>
>> - Encoder: ABR = 15000, DTX = 1, Mode = narrowband, Rate = 8000 Hz.<br>
>><br>
>> My platform: Windows XP SP3, MSVS 2008 SP1, 1.8 GHz Core Duo CPU, 2 GB RAM.<br>
>><br>
>> Thanks for your help :-)<br>
>> Mark<br>
>><br>
><br>
><br>
><br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Speex-dev mailing list<br>
<a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
<a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>
</div></div></blockquote></div><br></div></div>