[Vorbis-dev] BARK implementation (or specification) error

Chris Moore moore at free.fr
Fri Mar 21 02:57:11 PDT 2014


Hi Tor,

Thank you for your reply.

Le 21/03/2014 09:59, Tor-Einar Jarnbjo a écrit :
>
> Am 20.03.2014 18:56, schrieb Chris Moore:
>
>> In the course of some work which I describe below, I have found a 
>> very significant difference between the BARK function described in 
>> the Vorbis specification and its implementation in libvorbis.
>
> I believe to have implemented one of the first Vorbis decoders based 
> on the specification around 2002 and found several relevant 
> differences between the specification and the reference decoder. Most 
> of the issues I found were corrected in the specification, but I am 
> sure that I didn't find all of the deviations.
>
>> In the specification http://xiph.org/vorbis/doc/Vorbis_I_spec.pdf
>> bark(x) = 13.1arctan(.00074x) + 2.24arctan(.0000000185x**2 + .0001x)
>>
>> In the libvorbis code http://svn.xiph.org/trunk/vorbis/lib/scales.h
>> #define toBARK(n)   
>> (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
>>
>> You will note that the last term is inside the parentheses of the 
>> second arctan function in the specification but outside in the 
>> libvorbis implementation.
>> This results in extremely large differences at high frequencies.
>> Which is correct: the specification or the implementation?
>
> Hard to say, since you may not even find an encoder making use of that 
> feature. The function is only relevant when decoding floor type 0 and 
> even the specification states:
>
> "Floor 0 is not to be considered deprecated, but it is of limited 
> modern use. No known Vorbis encoder past Xiph.Org's own beta 4 makes 
> use of floor 0."
>
> I remember having problems interpreting the floor 0 specification and 
> decided to not implement it at all. I am not sure exactly how much my 
> Java library (J-Ogg) has been used, but I've never heard any 
> complaints that someone has used it and run into problems that floor 0 
> is unsupported.
>

I note that the literature gives the high edge of Bark band 24 as 15500 Hz.
The formula used in the implementation gives this at about 15453 Hz 
which is close.
However the formula from the Vorbis specifications gives this at about 
190796 Hz which is ridiculous.
I therefore conclude that the specifications must be wrong and the 
implementation correct.

In any case it is better this way round as I suppose that the formula in 
the implementation is used de facto.

Cheers,
Chris


More information about the Vorbis-dev mailing list