[vorbis-dev] References for the BARK/MEL stuff

Timothy J. Wood tjw at omnigroup.com
Sun Nov 26 17:25:54 PST 2000



  The following is what I came up with for toBARK().  Mathematica kept crashing when I tried to make it do the curve fitting, so I just used my own least squares approximation code.  This evaluates quite a bit faster than the atan version, but as you note, this function really doesn't seem to be performance critical, so this was more of a fun exercise than anything terribly useful (at least there are bigger fish to try right now :)

-tim

/*
  This was obtained by doing a least squares polynomial fit of the previous
  approximation expression:
  
  (13.1*atan(.00074*(f))+2.24*atan((f)*(f)*1.85e-8)+1e-4*(f))
  
  300 points were sampled from 0 to 30000 to provide input to the least squares algorithm.
  
  The polynomial we're using is 7th degree (8 coefficients) of the form:
  
     ax^7+bx^6+...+gx+h
     
  This particular implementation computes the value via this evaluation:
  
    x(x^2(x^2(ax^2+c)+e)+g) + x^2(x^2(bx^2+d)+f)+h
    
  The advantage of doing this is that it allows for twice as good of pipelining by adding one extra operation (the computation of x^2).  This form is especially nice on machines with a fused multiply-add (for example, PowerPC).
  
  On a 500Mhz G4 running MacOS X Public Beta, this version runs in about 53.2% of the time of the atan version.
*/

#if 0

float toBARK(float x)
{
    return (13.1*atan(.00074*x)+2.24*atan(x*x*1.85e-8)+1e-4*x);
}

#else

float toBARK(float x)
{
    float y1, y2, x2;
    const float h = 0.84005793906439973905975193702033720910549163818359375;
    const float g = 0.00882665372976733364485113497721613384783267974853515625;
    const float f = -1.817725926848741204474961541404098852581228129565715789794921875e-06;
    const float e = 2.146459018942472620933211994968142256878795848251684219576418399810791015625e-10;
    const float d = -1.45295852112975684808023645992316556435695711069211455424010637216269969940185546875e-14;
    const float c = 5.570810770808117475022948355275769834319660160043921094674690408510286943055689334869384765625e-19;
    const float b = -1.123223920358406960940846523644387910381077963581645325926274339711774530314869480207562446594238281e-23;
    const float a = 9.24271837728614272911771559202791472363133792494520212846055753734807327410757937791174754238454625e-29;
    
    x2 = x * x;
    
    y2 = x2 * b + d;
    y1 = x2 * a + c;

    y2 = x2 * y2 + f;
    y1 = x2 * y1 + e;

    y2 = x2 * y2 + h;
    y1 = x2 * y1 + g;
    
    y1 = x * y1 + y2;
    
    return y1;
}

#endif

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list