[Vorbis-dev] Qyery on bark equation in floor0 code

Ralph Giles giles at xiph.org
Fri Dec 17 11:29:22 PST 2004


On Fri, Dec 17, 2004 at 09:55:39AM +0530, nagaraja.sreerama at wipro.com wrote:

> I need some clarifications regarding the mismatch I found in the code
> and the specification.
> 
> (a) In the specification, the bark(x) equation is given as:
> 
> bark(x) = 13.1 atan(.00074x) + 2.24 atan(.0000000158(x^2)) + .0001x
> 
> whereas in the code it is given as:
> 
> #define toBARK(n)
> (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
> 
> Which one of these is the proper one ?

Can you be more specific about what the mismatch is. Are these not 
identical to within floating point precision?

> (b) Also, we are planning to implement a fixed point code for the Vorbis
> decoder. And as usual the obvious criteria is the compliance and how
> accurately this fixed point code should generate the output that matches
> mathematically the floating code implementation. Specifically I feel
> that the tremor code implements the linear approximation depending on
> some specific baud scales (0, 100, 200, 301, 405, 516 etc...). I have a
> feeling that this leads to some inaccuracy in the results compared to
> the floating point code. Is this acceptable ? What is the basis for
> acceptance say the algorithm should mathematically match the
> specification ?

Monty is the best one to comment on this. I believe Tremor is considered 
a compliant encoder, but it's possible it's only accurate for 16 bit 
output.

What monty has remarked on in the past is that a major issue with fixed 
point implementations is maintaining enough headroom in applying the 
residue to the floor curve, at this requires more than 24 bits of 
dynamic range.

 -r


More information about the Vorbis-dev mailing list