[linux-audio-dev] swh plugins and fixing undenormalize

Erik de Castro Lopo erikd-lad at mega-nerd.com
Thu Jun 24 07:31:30 UTC 2004


On Thu, 24 Jun 2004 02:11:34 -0300
Juan Linietsky <coding at reduz.com.ar> wrote:

> Sorry for not checking, but I guess it could be good for the record (and 
> people googling for it) to ask here.. 
> The macro for dealing denormals that I have is:
> 
> #define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) 
> sample=0.0f
> 
> however gcc 3.3 and 3.4 seem to produce an undesired effect
> when the optimizer is turned on, rendering this macro unusable..
> this breaks freeverb and a few other stuff I have that uses it.
> 
> How was/is this fixed properly?

Personally, I think that macro is rather silly. You bascially end up
forcing data that would otherwise be in the floating point pipeline
into the integer pipeline and then latter, it probably goes back into
the FP pipeline. Secondly, it contains a branch which is usually far
from optimal.

Since the problem is denormalised numbers, has anybody thought of
adding a small DC offset (1e-15) or alternating the addition/subraction
of a small value?

If I had a spare couple of hours I'd benchmark it myself. 

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Open source is an intellectual-property destroyer. I can't
imagine something that could be worse than this for the software
business and the intellectual-property business."
 -- Jim Allchin, Microsoft



More information about the Linux-audio-dev mailing list