Hi Jean-Marc, 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 ? 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 >-- Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate f?r nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
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 >> > > >
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. 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/ On Wed, Sep 23, 2009 at 4:06 AM, Jean-Marc Valin < jean-marc.valin at usherbrooke.ca> wrote:> 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 > >> > > > > > > > _______________________________________________ > Speex-dev mailing list > Speex-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20090923/c874e160/attachment-0001.htm