[vorbis-dev] Specification change requests

Lourens Veen lourens at rainbowdesert.net
Tue Oct 15 14:56:17 PDT 2002



On Tuesday 15 October 2002 22:18, Nicolas Pitre wrote:
> On Tue, 15 Oct 2002, Tor-Einar Jarnbjo wrote:
> > ###############
> > #2002-10-15-003
> >
> > The function used to describe the window slope in "Ogg Vorbis I
> > format specification: introduction and description" is:
> >
> > y=sin(2PI*sin^2(x/n))
> > (here, I even don't understand the notation you use)
> >
> > The function described in the source code comment (window.c,
> > line 29) is:
> >
> > y=sin(sin(x)*sin(x)*2pi)
> >
> > And at last, the function actually implemented in libvorbis,
> > (window.c, lines 33-38) is:
> >
> > y=sin(sin(x/n*PI/2)^2*PI/2)
>
> Even this isn't exact.  It rather looks like:
>
> 	y=sin(sin((x+0.5)/n*PI/2)^2*PI/2)

Okay, here's my take on this (I'm not a Vorbis developer, nor 
affiliated with Xiph.org!).

Firstly, sin^2(x) is just a different way of writing (sin(x))^2. I 
don't think it's that obscure, as I've seen it before quite often. 
Not a problem IMHO.

The comment in window.c:29 is just sloppy, it comments on the 
general shape of the window in a sense of the kind of function 
displaying it. For the actual implementation some scaling is 
necessary, and is being done, which complicates things. I'm not 
sure whether and how this should be fixed.

Lastly, I believe there's a bug in the documentation, namely in 
http://www.xiph.org/ogg/vorbis/doc/vorbis-spec-ref.html, "packet 
type, mode and window decode", window generation steps 6 and 8. In 
the docs, the squared sine is multiplied by 2*PI, in the code by 
PI/2. The latter is correct ofcourse, since sin^2(x) is in [0..1], 
and we want to stretch that value to cover the first quarter of the 
sine wave, not the whole sine wave, since that would give a weird 
wave at the front of the window not to mention the fact that it 
wouldn't be continuous.

Solution:

Replace

6. for [i] in range [left_window_start] ... [left_window_end]-1, 
window([i]) = 
sin(2*PI*sin^2(([i]-[left_window_start]+.5)/[left_n]*PI/2))

and

8. for [i] in range [right_window_start] ... [right_window_end]-1, 
window([i]) = 
sin(2*PI*sin^2(([i]-[right_window_start]+.5)/[right_n]*PI/2.+PI/2.))

with

6. for [i] in range [left_window_start] ... [left_window_end]-1, 
window([i]) = 
sin(PI/2*sin^2(([i]-[left_window_start]+.5)/[left_n]*PI/2))

8. for [i] in range [right_window_start] ... [right_window_end]-1, 
window([i]) = 
sin(PI/2*sin^2(([i]-[right_window_start]+.5)/[right_n]*PI/2.+PI/2.))

Also note that the link to the paper describing the MDCT in 
http://www.xiph.org/ogg/vorbis/doc/vorbis-spec-intro.html is dead. 
The paper is still in the Citeseer (http://citeseer.nj.nec.com) 
cache.

One down, 7 to go.

Lourens

-- 
GPG public key: http://home.student.utwente.nl/l.e.veen/lourens.key

--- >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