[PD] denormalized numbers bugfix in PD

Thomas Grill t.grill at gmx.net
Fri Sep 19 11:56:52 CEST 2003


Hi Derek, hi all,
i've been following a similar discussion on the Max/MSP for Windows list,
where Cycling also modified their externals in an appropriate way.

There are some points to keep in mind:
- PowerPC processors don't suffer from the problem, so there should be an
#ifdef excluding the relevant code for OSX build
- i don't think that there are too many places where a denormalisation can
frequently happen. I'd find it better to introduce an additional external
    object (like bitsafe in max) which can correct the signal for more
occasional denormal situations.
- the undenormalise() code has the problem that it includes an "if" which is
not ideal because of branching. There are some more approaches to the
problem, including "quantification"... have a look at the excellent article
by Laurent de Soras: http://ldesoras.free.fr/doc/articles/denormal.pdf

greetings,
Thomas

----- Original Message ----- 
From: "derek holzer" <derek at x-i.net>
To: <mpuckett at man104-1.ucsd.edu>
Cc: <PD-list at iem.kug.ac.at>
Sent: Friday, September 19, 2003 11:32 AM
Subject: [PD] denormalized numbers bugfix in PD


> 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
>
>
> _______________________________________________
> PD-list mailing list
> PD-list at iem.at
> http://iem.at/cgi-bin/mailman/listinfo/pd-list
>
>





More information about the Pd-list mailing list