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

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] swh plugins and fixing undenormalize
From: Erik de Castro Lopo (erikd-lad_AT_mega-nerd.com)
Date: Thu Jun 24 2004 - 10:31:30 EEST


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


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Jun 24 2004 - 10:25:15 EEST