[vorbis-dev] window function

Sebastian Gesemann sgeseman at upb.de
Wed Jul 23 09:51:50 PDT 2003



On Wed, 23 Jul 2003, hkato wrote:

> I have a question. 
> Ogg's window functon is
> 
> f(x)=sin(1/2*pi*sin^2((x+0.5)/n*pi)) for 0 <= x < n
> 
> But I cannot understand why this window function satisfys
> the equation
> 
> f^2(x)+f^2(x+n/2)=2

It satisfies f^2(x)+f^2(x+n/2) = 1 within x=n/h...n-1
as it should do for perfect reconstruction.

Let me try to show you the trick:

Let g(z) be a function for z=0..1 with the following
properties:
 * 0 <= g(z) <= 1
 * g(z) + g(1-z) = 1  (1)

Then, the equation
    sin^2(pi/2*g(z)) + sin^2(pi/2*g(1-z)) = 1  (2)
is true, because...

    sin^2(pi/2*g(z)) + sin^2(pi/2*g(1-z)) = 1  (use (1) here)
<=> sin^2(pi/2*g(z)) + sin^2(pi/2*(1-g(z))) = 1
<=> sin^2(pi/2*g(z)) + sin^2(pi/2-pi/2*g(z)) = 1
<=> sin^2(pi/2*g(z)) + cos^2(-pi/2*g(z)) = 1
<=> sin^2(pi/2*g(z)) + cos^2(pi/2*g(z)) = 1  | set a:=pi/2*g(z)
<=> sin^2(a) + cos^2(a) = 1
which is certainly true.

The Vorbis-Window is given as
    f(x) := sin(1/2*pi*sin^2((x+0.5)*pi/n))

If you substitute z=2(x+0.5)/n, you get
    f(x(z)) = sin(1/2*pi*sin^2(z*pi/2))

With
    g(z):=sin^2(z*pi/2)
you get
    f(x(z)) = sin(1/2*pi*g(z))

So...
    f^2(x) + f^2(n/2+x) = 1
<=> f^2(x) + f^2(n/2-x) = 1  (it's symmetric)
<=> sin^2(pi/2*pi*g(z)) + sin^2(pi/2*pi*g(1-z)) = 1
which is true, if g(z)+g(1-z)=1. (I prooved above)

Finally, we have to check that g(z)+g(1-z)=1 ...
    sin^2(z*pi/2) + sin^2((1-z)*pi/2) = 1
<=> sin^2(z*pi/2) + sin^2(pi/2-z*pi/2) = 1
<=> sin^2(z*pi/2) + cos^2(-z*pi/2) = 1
<=> sin^2(z*pi/2) + cos^2(z*pi/2) = 1
<=> sin^2(a) + cos^2(a) = 1
which is obviously true.

<p>There might be easier ways to proove this. :-)
Anyway...
Every valid MDCT window function can be expressed as
w(x) = sin(1/2 * pi * g(1- |1-2*(x+0.5)/n| ) )  for x=0..n-1
where g(z) satisfies g(z)+g(1-z)=1.

Examples:
g(z) := z		=> Sine-Window (used in MP3)
g(z) := sin^2(z*pi)	=> Vorbis-Window
g(z) := 0.5 - 0.541 * cos(z*pi) + 0.039 * cos(z*3*pi)
      + 0.002 * cos(z*5*pi)  

The last version of g(x) is an KBD-Window-
Approximation. AAC uses windows like this.

<p>HTH,
Sebastian

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