denorm


    Apr 07 2006 | 11:06 am
    Hi,
    I got some feedback from a user of one of my externals (tl.crossover4~) that he is experiencing occasional bursts in CPU usage. It might be that this is due to some denorm issues in the code of the externals. I don't have any experience with this, so I am wondering if there are some suggestions about what to do with it, or sample codes, possibly from other open-sourced 3rd party externals, that I could look into.
    Thanks, Trond

    • Apr 07 2006 | 12:34 pm
      Hi Trond,
      Here is an example of code calling a function that fixes denormals from ttblue: http://svn.sourceforge.net/viewcvs.cgi/ttblue/trunk/ttblue/d splib/tt_dcblock.h?r1=31&r2=39
      And the definition of that function is at line 125 in this file: http://svn.sourceforge.net/viewcvs.cgi/ttblue/trunk/ttblue/d splib/tt_audio_base.h?annotate=49
      Because the function is in the class definition itself it will automatically be inlined by the compiler so you don't incur a cpu hit for calling the function. Basically it is adding and subtracting a small number such that the round-off error makes the number that is returned no longer denormalled.
      I hope this is useful... -Tim
    • Apr 07 2006 | 12:38 pm
      Absolutely!
      Thanks, Trond
    • Apr 07 2006 | 2:55 pm
      I forgot to include this piece of information (which is defined in the base cpp file):
      const double tt_audio_base::anti_denormal_value = 1e-18;
      best, Tim