[PD] denormalized numbers bugfix in PD

derek holzer derek at x-i.net
Fri Sep 19 11:32:35 CEST 2003


Miller,

I'd like to ask for a source code change to deal with denormalized 
numbers in PD. Inquiries on the PD list have shown that I am not the 
only one who has found his or her CPU spiking up over 100% whenever any 
sound in the patch becomes very small, both under Linux and Windows. The 
problem gets extremely bad when dealing with decaying sounds, such as 
reverb tails and feedback delays. I have noticed that denormalized 
numbers are a much more serious problem under Linux, particularly when 
using a P4 processor, although the problem is not limited to this 
specific processor.

Research on the web has informed me that hardware manufacturers have no 
inclination to fix this problem, so the solution must be handled on the 
software level. Olaf Matthes proposed the following changes to the 
source code, which should be implemented in both the PD code itself, as 
well as any in external which might produce denormals:

> A fix in terms of
> changing the source code is to add the following:
>
> #define undenormalise(sample) if(((*(unsigned 
> int*)&sample)&0x7f800000)==0)
> sample=0.0
>
> and add
>
> undenormalise(myfloatvalue);
>
> wherever a calculation might have produced very small values (replace
> 'myfloatvalue' with the variable that stores the float). There are 
> many many places
> in the Pd sources (and in every external) where this happens. 


Could you please consider implementing this, or a similar bugfix, in a 
future release of PD?

Thanks for your hard work so far,
Derek





More information about the Pd-list mailing list