Ogg Vorbis I format specification: floor type 1 setup and decode
</font></h1>
-<em>Last update to this document: September 19, 2002</em><br>
+<em>Last update to this document: October 15, 2002</em><br>
<h1>Overview</h1>
8) [high_neighbor_offset] = <a href="helper.html#high_neighbor">high_neighbor</a>([floor1_X_list],[i])
9) [predicted] = <a href="helper.html#render_point">render_point</a>( vector [floor1_X_list] element [low_neighbor_offset],
- vector [floor1_X_list] element [high_neighbor_offset],
vector [floor1_final_Y] element [low_neighbor_offset],
+ vector [floor1_X_list] element [high_neighbor_offset],
vector [floor1_final_Y] element [high_neighbor_offset],
vector [floor1_X_list] element [i] )
} else [hiroom] is not greater than [lowroom] {
- 23) vector [floor1_final_Y] element [i] = [predicted] - ([val] - [lowroom]) - 1
+ 23) vector [floor1_final_Y] element [i] = [predicted] - [val] + [hiroom] - 1
}
24) if ([val] is odd) {
25) vector [floor1_final_Y] element [i] =
- [predicted] - (([val] - 1) divided by 2 using integer division)
+ [predicted] - (([val] + 1) divided by 2 using integer division)
} else [val] is even {
6) [hy] = [floor1_final_Y]' element [i] * [floor1_multiplier]
7) [hx] = [floor1_X_list]' element [i]
- 8) <a href="helper.html#render_line">render_line</a>( [lx], [hx], [ly], [hy], [floor] )
+ 8) <a href="helper.html#render_line">render_line</a>( [lx], [ly], [hx], [hy], [floor] )
9) [lx] = [hx]
10) [ly] = [hy]
}
+ }
- 11) if ( [hx] is less than [n] ) {
+ 11) if ( [hx] is less than [n] ) {
- 12) <a href="helper.html#render_line">render_line</a>( [hx], [hy], [n], [hy], [floor] )
+ 12) <a href="helper.html#render_line">render_line</a>( [hx], [hy], [n], [hy], [floor] )
- }
+ }
- 13) if ( [hx] is greater than [n] ) {
+ 13) if ( [hx] is greater than [n] ) {
- 14) truncate vector [floor] to [n] elements
+ 14) truncate vector [floor] to [n] elements
- }
}
15) for each scalar in vector [floor], perform a lookup substitution using
<ol><li>if set, <tt>[vorbis_mapping_submaps]</tt> = read 4 bits as unsigned integer and add one<p>
<li>if unset, <tt>[vorbis_mapping_submaps]</tt> = 1<p>
</ol>
- <li>read 1 bit as a boolean flag; if set, square polar channel mapping is in use:<p>
- <ol><li><tt>[vorbis_mapping_coupling_steps]</tt>= read 8 bits as unsigned integer and add one<p>
- <li>for <tt>[j]</tt> each of <tt>[vorbis_mapping_coupling_steps]</tt> steps:<p>
- <ol>
- <li>vector <tt>[vorbis_mapping_magnitude]</tt> element <tt>[j]</tt>= read <a href="helper.html#ilog">ilog</a>([audio_channels] - 1) bits as unsigned integer<p>
- <li>vector <tt>[vorbis_mapping_angle]</tt> element <tt>[j]</tt>= read <a href="helper.html#ilog">ilog</a>([audio_channels] - 1) bits as unsigned integer<p>
- <li>the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively. If for any coupling step the angle channel number equals the magnitude channel number, the magnitude channel number is greater than <tt>[audio_channels]</tt>-1, or the angle channel is greater than <tt>[audio_channels]</tt>-1, the stream is undecodable.<p>
- </ol>
- </ol>
+ <li>read 1 bit as a boolean flag<p>
+ <ol><li>if set, square polar channel mapping is in use:<p>
+ <ol><li><tt>[vorbis_mapping_coupling_steps]</tt> = read 8 bits as unsigned integer and add one<p>
+ <li>for <tt>[j]</tt> each of <tt>[vorbis_mapping_coupling_steps]</tt> steps:<p>
+ <ol>
+ <li>vector <tt>[vorbis_mapping_magnitude]</tt> element <tt>[j]</tt>= read <a href="helper.html#ilog">ilog</a>([audio_channels] - 1) bits as unsigned integer<p>
+ <li>vector <tt>[vorbis_mapping_angle]</tt> element <tt>[j]</tt>= read <a href="helper.html#ilog">ilog</a>([audio_channels] - 1) bits as unsigned integer<p>
+ <li>the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively. If for any coupling step the angle channel number equals the magnitude channel number, the magnitude channel number is greater than <tt>[audio_channels]</tt>-1, or the angle channel is greater than <tt>[audio_channels]</tt>-1, the stream is undecodable.<p>
+ </ol>
+ </ol>
+ <li>if unset, <tt>[vorbis_mapping_coupling_steps]</tt> = 0
+ </ol>
<li>read 2 bits (reserved field); if the value is nonzero, the stream is undecodable<p>
<li>if <tt>[vorbis_mapping_submaps]</tt> is greater than one, we read channel multiplex settings. For each <tt>[j]</tt> of <tt>[audio_channels]</tt> channels:<p>
<ol><li>vector <tt>[vorbis_mapping_mux]</tt> element <tt>[j]</tt> = read 4 bits as unsigned integer<p>
</ol>
</ol>
-Vorbis windows all use the slope function y=sin(2*PI*sin^2(x/n)),
-but dissimilar lapping requirements can affect overall shape. Window
-generation proceeds as follows:<p>
+Vorbis windows all use the slope function y=sin( .5 * PI * sin^2( (x+.5) /
+n * PI) ) where n is window size and x ranges 0...n-1, but dissimilar
+lapping requirements can affect overall shape. Window generation
+proceeds as follows:<p>
<ol>
<li> <tt>[window_center]</tt> = <tt>[n]</tt> / 2
</ol>
<li> window from range 0 ... <tt>[left_window_start]</tt>-1 inclusive is zero
-<li> for <tt>[i]</tt> in range <tt>[left_window_start]</tt> ... <tt>[left_window_end]</tt>-1, window(<tt>[i]</tt>) = sin(2*PI*sin^2((<tt>[i]</tt>-<tt>[left_window_start]</tt>+.5)/<tt>[left_n]</tt>*PI/2))
+<li> for <tt>[i]</tt> in range <tt>[left_window_start]</tt> ... <tt>[left_window_end]</tt>-1, window(<tt>[i]</tt>) = sin(.5 * PI * sin^2( (<tt>[i]</tt>-<tt>[left_window_start]</tt>+.5) / <tt>[left_n]</tt> * .5 * PI) )
<li> window from range <tt>[left_window_end]</tt> ... <tt>[right_window_start]</tt>-1 inclusive is one
-<li> for <tt>[i]</tt> in range <tt>[right_window_start]</tt> ... <tt>[right_window_end]</tt>-1, window(<tt>[i]</tt>) = sin(2*PI*sin^2((<tt>[i]</tt>-<tt>[right_window_start]</tt>+.5)/<tt>[right_n]</tt>*PI/2.+PI/2.))
+<li> for <tt>[i]</tt> in range <tt>[right_window_start]</tt> ... <tt>[right_window_end]</tt>-1, window(<tt>[i]</tt>) = sin(.5 * PI * sin^2( (<tt>[i]</tt>-<tt>[right_window_start]</tt>+.5) / <tt>[right_n]</tt> * .5 * PI/2. + .5 * PI) )
<li> window from range <tt>[rigth_window_start]</tt> ... <tt>[n]</tt>-1 is zero
function: normalized modified discrete cosine transform
power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.31 2002/06/28 22:19:36 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.32 2002/10/16 02:43:48 xiphmont Exp $
Original algorithm adapted long ago from _The use of multirate filter
banks for coding of high quality digital audio_, by T. Sporer,
This module DOES NOT INCLUDE code to generate/apply the window
function. Everybody has their own weird favorite including me... I
- happen to like the properties of y=sin(2PI*sin^2(x)), but others may
+ happen to like the properties of y=sin(.5PI*sin^2(x)), but others may
vehemently disagree.
********************************************************************/
********************************************************************
function: window functions
- last mod: $Id: window.c,v 1.17 2002/03/23 03:17:34 xiphmont Exp $
+ last mod: $Id: window.c,v 1.18 2002/10/16 02:43:48 xiphmont Exp $
********************************************************************/
switch(type){
case 0:
- /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) */
+ /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*pi*.5) */
{
for(i=0;i<left;i++){