[linux-audio-dev] Fixing Freeverb and Denormals
Erik de Castro Lopo
erikd-lad at mega-nerd.com
Sat Jan 22 01:36:44 UTC 2005
On Fri, 21 Jan 2005 17:17:43 +0000
Neil Klepeis <nklepeis at sbcglobal.net> wrote:
> Hi all,
>
> The denormal problem with freeverb/ardour on P-4's is killing me.
>
> Since CMT plugin development seems to be a little stagnant, I decided
> to take it into my own hands a bit, but I might need a little help from
> a kind someone out there. Is there anyone who can give me a tip on
> proper syntax for changing the denormals.h file in freeverb (assuming
> this is where the problem lies)?
>
> Details:
>
> On this list and/or posts elsewhere I found that the denormals.h file
> for freeverb doesn't work too well with some newer gcc compilers; one
> recommendation was to exchange the first statement below with the second
> definition:
>
> #define undenormalise(sample) if(((*(unsigned
> int*)&sample)&0x7f800000)==0) sample=0.0f
I think your mail client has wrapped something incorrectly there.
Personally , I would avoid doing this useing integer operations and I
would also avoid macros; inline functions are simply so much better.
> static inline float
> undenormalise(volatile float s)
> {
> s += 9.8607615E-32f;
> return s - 9.8607615E-32f;
> }
That looks OK to me, and the optimiser should not discard it because s
is volatile. Have you looked at the assembler output?
> #define static inline float undenormalise(volatile float s) { s +=
> 9.8607615E-32f; return s - 9.8607615E-32f; }
That is definitle WAAAAAY wrong. what you are doing there is replacing
all instances of the string "static" with "inline float ......".
> You can probably see that I have no idea what I'm doing, but this seems
> like it should be so _simple_.
The static inline function you have above should be OK. Look at the
assembler output (use gcc -S to generate assembler) to make sure that
the addition and subtraction isn't being optimised out.
> Maybe now is the time to go read up on C++.
There's never a good time to read up on C++
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam at mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"To me C++ seems to be a language that has sacrificed orthogonality
and elegance for random expediency." -- Meilir Page-Jones
More information about the Linux-audio-dev
mailing list