[xiph-commits] r14647 - in branches/vorbis-aotuv: . doc doc/vorbisfile doc/xml examples include/vorbis lib lib/books/coupled lib/books/floor lib/books/uncoupled lib/modes macosx macosx/Vorbis.xcodeproj vq win32 win32/VS2005 win32/VS2005/libvorbis win32/VS2005/libvorbisfile win32/VS2005/vorbisdec win32/VS2005/vorbisenc

j at svn.xiph.org j at svn.xiph.org
Tue Apr 1 03:48:05 PDT 2008


Author: j
Date: 2008-04-01 03:47:58 -0700 (Tue, 01 Apr 2008)
New Revision: 14647

Added:
   branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.txt
   branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.xml
   branches/vorbis-aotuv/doc/vorbisfile/ov_fopen.html
   branches/vorbis-aotuv/lib/psy_table.h
   branches/vorbis-aotuv/win32/VS2005/
   branches/vorbis-aotuv/win32/VS2005/libvorbis/
   branches/vorbis-aotuv/win32/VS2005/libvorbis/libvorbis.vcproj
   branches/vorbis-aotuv/win32/VS2005/libvorbisfile/
   branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.def
   branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.vcproj
   branches/vorbis-aotuv/win32/VS2005/vorbisdec/
   branches/vorbis-aotuv/win32/VS2005/vorbisdec/vorbisdec.vcproj
   branches/vorbis-aotuv/win32/VS2005/vorbisenc/
   branches/vorbis-aotuv/win32/VS2005/vorbisenc/vorbisenc.vcproj
Modified:
   branches/vorbis-aotuv/CHANGES
   branches/vorbis-aotuv/COPYING
   branches/vorbis-aotuv/Makefile.am
   branches/vorbis-aotuv/README
   branches/vorbis-aotuv/aoTuV_README-1st.txt
   branches/vorbis-aotuv/aoTuV_technical.txt
   branches/vorbis-aotuv/autogen.sh
   branches/vorbis-aotuv/configure.in
   branches/vorbis-aotuv/doc/Makefile.am
   branches/vorbis-aotuv/doc/Vorbis_I_spec.html
   branches/vorbis-aotuv/doc/Vorbis_I_spec.pdf
   branches/vorbis-aotuv/doc/floor1_inverse_dB_table.html
   branches/vorbis-aotuv/doc/framing.html
   branches/vorbis-aotuv/doc/helper.html
   branches/vorbis-aotuv/doc/index.html
   branches/vorbis-aotuv/doc/oggstream.html
   branches/vorbis-aotuv/doc/programming.html
   branches/vorbis-aotuv/doc/stereo.html
   branches/vorbis-aotuv/doc/v-comment.html
   branches/vorbis-aotuv/doc/vorbis-fidelity.html
   branches/vorbis-aotuv/doc/vorbis.html
   branches/vorbis-aotuv/doc/vorbisfile/OggVorbis_File.html
   branches/vorbis-aotuv/doc/vorbisfile/callbacks.html
   branches/vorbis-aotuv/doc/vorbisfile/chaining_example_c.html
   branches/vorbis-aotuv/doc/vorbisfile/chainingexample.html
   branches/vorbis-aotuv/doc/vorbisfile/crosslap.html
   branches/vorbis-aotuv/doc/vorbisfile/datastructures.html
   branches/vorbis-aotuv/doc/vorbisfile/decoding.html
   branches/vorbis-aotuv/doc/vorbisfile/example.html
   branches/vorbis-aotuv/doc/vorbisfile/exampleindex.html
   branches/vorbis-aotuv/doc/vorbisfile/fileinfo.html
   branches/vorbis-aotuv/doc/vorbisfile/index.html
   branches/vorbis-aotuv/doc/vorbisfile/initialization.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate_instant.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_callbacks.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_clear.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_comment.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_crosslap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_info.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_open.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_open_callbacks.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_lap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page_lap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_tell.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_total.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek_lap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_raw_tell.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_raw_total.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_read.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_read_float.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_seekable.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_serialnumber.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_streams.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_test.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_test_callbacks.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_test_open.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_lap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page_lap.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_tell.html
   branches/vorbis-aotuv/doc/vorbisfile/ov_time_total.html
   branches/vorbis-aotuv/doc/vorbisfile/overview.html
   branches/vorbis-aotuv/doc/vorbisfile/reference.html
   branches/vorbis-aotuv/doc/vorbisfile/return.html
   branches/vorbis-aotuv/doc/vorbisfile/seekexample.html
   branches/vorbis-aotuv/doc/vorbisfile/seeking.html
   branches/vorbis-aotuv/doc/vorbisfile/seeking_example_c.html
   branches/vorbis-aotuv/doc/vorbisfile/seeking_test_c.html
   branches/vorbis-aotuv/doc/vorbisfile/seekingexample.html
   branches/vorbis-aotuv/doc/vorbisfile/threads.html
   branches/vorbis-aotuv/doc/vorbisfile/vorbis_comment.html
   branches/vorbis-aotuv/doc/vorbisfile/vorbis_info.html
   branches/vorbis-aotuv/doc/vorbisfile/vorbisfile_example_c.html
   branches/vorbis-aotuv/doc/xml/05-comment.xml
   branches/vorbis-aotuv/doc/xml/08-residue.xml
   branches/vorbis-aotuv/doc/xml/footer.xml
   branches/vorbis-aotuv/examples/chaining_example.c
   branches/vorbis-aotuv/examples/decoder_example.c
   branches/vorbis-aotuv/examples/encoder_example.c
   branches/vorbis-aotuv/examples/seeking_example.c
   branches/vorbis-aotuv/examples/vorbisfile_example.c
   branches/vorbis-aotuv/include/vorbis/Makefile.am
   branches/vorbis-aotuv/include/vorbis/codec.h
   branches/vorbis-aotuv/include/vorbis/vorbisenc.h
   branches/vorbis-aotuv/include/vorbis/vorbisfile.h
   branches/vorbis-aotuv/lib/Makefile.am
   branches/vorbis-aotuv/lib/analysis.c
   branches/vorbis-aotuv/lib/backends.h
   branches/vorbis-aotuv/lib/barkmel.c
   branches/vorbis-aotuv/lib/bitrate.c
   branches/vorbis-aotuv/lib/bitrate.h
   branches/vorbis-aotuv/lib/block.c
   branches/vorbis-aotuv/lib/books/coupled/res_books_stereo.h
   branches/vorbis-aotuv/lib/books/floor/floor_books.h
   branches/vorbis-aotuv/lib/books/uncoupled/res_books_uncoupled.h
   branches/vorbis-aotuv/lib/codebook.c
   branches/vorbis-aotuv/lib/codebook.h
   branches/vorbis-aotuv/lib/codec_internal.h
   branches/vorbis-aotuv/lib/envelope.c
   branches/vorbis-aotuv/lib/envelope.h
   branches/vorbis-aotuv/lib/floor0.c
   branches/vorbis-aotuv/lib/floor1.c
   branches/vorbis-aotuv/lib/highlevel.h
   branches/vorbis-aotuv/lib/info.c
   branches/vorbis-aotuv/lib/lookup.c
   branches/vorbis-aotuv/lib/lookup.h
   branches/vorbis-aotuv/lib/lookup_data.h
   branches/vorbis-aotuv/lib/lookups.pl
   branches/vorbis-aotuv/lib/lpc.c
   branches/vorbis-aotuv/lib/lpc.h
   branches/vorbis-aotuv/lib/lsp.c
   branches/vorbis-aotuv/lib/lsp.h
   branches/vorbis-aotuv/lib/mapping0.c
   branches/vorbis-aotuv/lib/masking.h
   branches/vorbis-aotuv/lib/mdct.c
   branches/vorbis-aotuv/lib/mdct.h
   branches/vorbis-aotuv/lib/misc.h
   branches/vorbis-aotuv/lib/modes/floor_all.h
   branches/vorbis-aotuv/lib/modes/psych_11.h
   branches/vorbis-aotuv/lib/modes/psych_16.h
   branches/vorbis-aotuv/lib/modes/psych_44.h
   branches/vorbis-aotuv/lib/modes/psych_8.h
   branches/vorbis-aotuv/lib/modes/residue_16.h
   branches/vorbis-aotuv/lib/modes/residue_44.h
   branches/vorbis-aotuv/lib/modes/residue_44u.h
   branches/vorbis-aotuv/lib/modes/residue_8.h
   branches/vorbis-aotuv/lib/modes/setup_11.h
   branches/vorbis-aotuv/lib/modes/setup_16.h
   branches/vorbis-aotuv/lib/modes/setup_22.h
   branches/vorbis-aotuv/lib/modes/setup_32.h
   branches/vorbis-aotuv/lib/modes/setup_44.h
   branches/vorbis-aotuv/lib/modes/setup_44u.h
   branches/vorbis-aotuv/lib/modes/setup_8.h
   branches/vorbis-aotuv/lib/modes/setup_X.h
   branches/vorbis-aotuv/lib/os.h
   branches/vorbis-aotuv/lib/psy.c
   branches/vorbis-aotuv/lib/psy.h
   branches/vorbis-aotuv/lib/psytune.c
   branches/vorbis-aotuv/lib/registry.c
   branches/vorbis-aotuv/lib/registry.h
   branches/vorbis-aotuv/lib/res0.c
   branches/vorbis-aotuv/lib/scales.h
   branches/vorbis-aotuv/lib/sharedbook.c
   branches/vorbis-aotuv/lib/smallft.c
   branches/vorbis-aotuv/lib/smallft.h
   branches/vorbis-aotuv/lib/synthesis.c
   branches/vorbis-aotuv/lib/vorbisenc.c
   branches/vorbis-aotuv/lib/vorbisfile.c
   branches/vorbis-aotuv/lib/window.c
   branches/vorbis-aotuv/lib/window.h
   branches/vorbis-aotuv/macosx/Info.plist
   branches/vorbis-aotuv/macosx/Vorbis.xcodeproj/project.pbxproj
   branches/vorbis-aotuv/vq/Makefile.am
   branches/vorbis-aotuv/vq/bookutil.c
   branches/vorbis-aotuv/vq/bookutil.h
   branches/vorbis-aotuv/vq/build.c
   branches/vorbis-aotuv/vq/cascade.c
   branches/vorbis-aotuv/vq/distribution.c
   branches/vorbis-aotuv/vq/genericdata.c
   branches/vorbis-aotuv/vq/huffbuild.c
   branches/vorbis-aotuv/vq/latticebuild.c
   branches/vorbis-aotuv/vq/latticehint.c
   branches/vorbis-aotuv/vq/latticepare.c
   branches/vorbis-aotuv/vq/latticetune.c
   branches/vorbis-aotuv/vq/localcodebook.h
   branches/vorbis-aotuv/vq/lspdata.c
   branches/vorbis-aotuv/vq/metrics.c
   branches/vorbis-aotuv/vq/residuedata.c
   branches/vorbis-aotuv/vq/residuesplit.c
   branches/vorbis-aotuv/vq/run.c
   branches/vorbis-aotuv/vq/train.c
   branches/vorbis-aotuv/vq/vqext.h
   branches/vorbis-aotuv/vq/vqgen.c
   branches/vorbis-aotuv/vq/vqgen.h
   branches/vorbis-aotuv/vq/vqsplit.c
   branches/vorbis-aotuv/vq/vqsplit.h
   branches/vorbis-aotuv/win32/vorbis.def
Log:
import "aoTuV" beta5.5
 * based on libvorbis 1.2.0
 * The noise control of the Impulse block was expanded. 
   This is effective with the outstanding sample of the pre-echo.
 * The pre-echo reduction code came to work at a lower bit rate.
 * Noise Normalization was reviewed. As a result, the bug is revised.
 * The detailed tuning was done again.



Modified: branches/vorbis-aotuv/CHANGES
===================================================================
--- branches/vorbis-aotuv/CHANGES	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/CHANGES	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,3 +1,14 @@
+libvorbis 1.2.0 (2007-07-25) -- "Xiph.Org libVorbis I 20070622"
+
+ * new ov_fopen() convenience call that avoids the common
+   stdio conflicts with ov_open() and MSVC runtimes.
+ * libvorbisfile now handles multiplexed streams
+ * improve robustness to corrupt input streams
+ * fix a minor encoder bug
+ * updated RTP draft
+ * build system updates
+ * minor corrections to the specification
+
 libvorbis 1.1.2 (2005-11-27) -- "Xiph.Org libVorbis I 20050304"
 
  * fix a serious encoder bug with gcc 4 optimized builds

Modified: branches/vorbis-aotuv/COPYING
===================================================================
--- branches/vorbis-aotuv/COPYING	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/COPYING	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,5 +1,5 @@
-aoTuV - Copyright (c) 2003-2006 Aoyumi
-libvorbis - Copyright (c) 2002-2005 Xiph.org Foundation
+aoTuV - Copyright (c) 2003-2008 Aoyumi
+libvorbis - Copyright (c) 2002-2007 Xiph.org Foundation
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: branches/vorbis-aotuv/Makefile.am
===================================================================
--- branches/vorbis-aotuv/Makefile.am	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/Makefile.am	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-AUTOMAKE_OPTIONS = foreign dist-zip
+AUTOMAKE_OPTIONS = 1.6 foreign dist-zip dist-bzip2
 
 SUBDIRS = lib include doc examples vq
 
@@ -10,11 +10,8 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = vorbis.pc vorbisenc.pc vorbisfile.pc
 
-# we include the whole debian/ dir in EXTRA_DIST because there's a problem
-# with autotools and HFS+ MacOSX file systems that caused debian/Makefile.am
-# to pick up on the lowercase changelog file and add ChangeLog to DIST_COMMON
-# because of it, breaking make dist.  This works just as well.
 EXTRA_DIST = \
+	CHANGES COPYING \
 	todo.txt autogen.sh \
 	libvorbis.spec libvorbis.spec.in \
 	vorbis.m4 \
@@ -22,17 +19,20 @@
 	vorbis-uninstalled.pc.in \
 	vorbisenc-uninstalled.pc.in \
 	vorbisfile-uninstalled.pc.in \
-	debian macos macosx win32
+	doc examples symbian vq \
+	macos macosx win32
 
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-docs
 
 dist-hook:
-	rm -rf `find $(distdir)/debian -name .svn`
-	rm -rf `find $(distdir)/debian -name "Makefile*"`
-	rm -rf `find $(distdir)/macos -name .svn`
-	rm -rf `find $(distdir)/macosx -name .svn`
-	rm -rf `find $(distdir)/win32 -name .svn`
+	for item in $(EXTRA_DIST); do \
+	  if test -d $$item; then \
+	    echo -n "cleaning $$item dir for distribution..."; \
+	    rm -rf `find $(distdir)/$$item -name .svn`; \
+	    echo "OK"; \
+	  fi; \
+	done
 
 debug:
 	$(MAKE) all CFLAGS="@DEBUG@"

Modified: branches/vorbis-aotuv/README
===================================================================
--- branches/vorbis-aotuv/README	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/README	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,7 +5,7 @@
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
-* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2004             *
+* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
 * by the Xiph.org Foundation, http://www.xiph.org/                 *
 *                                                                  *
 ********************************************************************

Modified: branches/vorbis-aotuv/aoTuV_README-1st.txt
===================================================================
--- branches/vorbis-aotuv/aoTuV_README-1st.txt	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/aoTuV_README-1st.txt	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,4 +1,4 @@
-aoTuV Beta 5
+aoTuV Beta 5.5
 
 "aoTuV" tunes up Xiph.Org's libvorbis uniquely. 
 A license is taken as "BSD-style license" as well as original libvorbis. 
@@ -14,8 +14,8 @@
 
 aoTuV based on <Xiph.Org libvorbis>
 
-Copyright (c) 2002-2005 Xiph.Org Foundation
-Copyright (c) 2003-2006 Aoyumi
+Copyright (c) 2002-2007 Xiph.Org Foundation
+Copyright (c) 2003-2008 Aoyumi
 
 
 AUTHOR : aoyumi <aoyumi at gmail.com>

Modified: branches/vorbis-aotuv/aoTuV_technical.txt
===================================================================
--- branches/vorbis-aotuv/aoTuV_technical.txt	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/aoTuV_technical.txt	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,3 +1,30 @@
+aoTuV beta5.5 technical information
+
+
+The differences from the aoTuV beta 5...
+
+  1.  The frequency domain width of M6 was revised.
+
+  2.  For q-1/-2, a pre-echo reduction code was applied (M3).  In addition,
+  the M3 code was improved.
+
+  3.  The floor setup parameters in the low bit-rate was changed.
+
+  4.  The part including bug of noise normalization was rewritten.
+
+  5.  libvorbis 1.2.0 were merged. Furthermore, a revision of Bug #300 and
+  #1229 was applied.
+
+  6.  The ATH curve of the high frequency area (more than 32kHz) was revised. 
+
+...and I tune up many parameters. 
+
+
+2008/03/30
+Aoyumi
+
+----------------------------------------------------------------------------
+
 aoTuV beta5 technical information
 
 
@@ -17,7 +44,8 @@
   5.   In order to decrease artifact by collapse of audio energy, noise 
   normalization processing of point stereo was extended. [32/44.1/48kHz only] 
 
-  6.   The threshold of channel coupling (lossless <=> point) is changed dynamically. This is a method based on a certain idea. [M6] 
+  6.   The threshold of channel coupling (lossless <=> point) is changed 
+  dynamically. This is a method based on a certain idea. [M6] 
 
 ...and I tune up many parameters. 
 

Modified: branches/vorbis-aotuv/autogen.sh
===================================================================
--- branches/vorbis-aotuv/autogen.sh	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/autogen.sh	2008-04-01 10:47:58 UTC (rev 14647)
@@ -20,19 +20,71 @@
         DIE=1
 }
 
-echo "checking for automake... "
-(automake --version) < /dev/null > /dev/null 2>&1 || {
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/"
+VERSIONMKMAJ="sed -e s/\([0-9][0-9]*\)[^0-9].*/\\1/"
+VERSIONMKMIN="sed -e s/.*[0-9][0-9]*\.//"
+
+# do we need automake?
+if test -r Makefile.am; then
+  AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
+  AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
+  if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
+    AM_NEEDED=""
+  fi
+  if test -z $AM_NEEDED; then
+    echo -n "checking for automake... "
+    AUTOMAKE=automake
+    ACLOCAL=aclocal
+    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
+      echo "yes"
+    else
+      echo "no"
+      AUTOMAKE=
+    fi
+  else
+    echo -n "checking for automake $AM_NEEDED or later... "
+    majneeded=`echo $AM_NEEDED | $VERSIONMKMAJ`
+    minneeded=`echo $AM_NEEDED | $VERSIONMKMIN`
+    for am in automake-$AM_NEEDED automake$AM_NEEDED \
+	automake automake-1.7 automake-1.8 automake-1.9 automake-1.10; do
+      ($am --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP`
+      maj=`echo $ver | $VERSIONMKMAJ`
+      min=`echo $ver | $VERSIONMKMIN`
+      if test $maj -eq $majneeded -a $min -ge $minneeded; then
+        AUTOMAKE=$am
+        echo $AUTOMAKE
+        break
+      fi
+    done
+    test -z $AUTOMAKE &&  echo "no"
+    echo -n "checking for aclocal $AM_NEEDED or later... "
+    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED \
+	aclocal aclocal-1.7 aclocal-1.8 aclocal-1.9 aclocal-1.10; do
+      ($ac --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP`
+      maj=`echo $ver | $VERSIONMKMAJ`
+      min=`echo $ver | $VERSIONMKMIN`
+      if test $maj -eq $majneeded -a $min -ge $minneeded; then
+        ACLOCAL=$ac
+        echo $ACLOCAL
+        break
+      fi
+    done
+    test -z $ACLOCAL && echo "no"
+  fi
+  test -z $AUTOMAKE || test -z $ACLOCAL && {
         echo
         echo "You must have automake installed to compile $package."
-	echo "Download the appropriate package for your system,"
-	echo "or get the source from one of the GNU ftp sites"
-	echo "listed in http://www.gnu.org/order/ftp.html"
-        DIE=1
-}
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+  }
+fi
 
 echo -n "checking for libtool... "
 for LIBTOOLIZE in libtoolize glibtoolize nope; do
-  (type $LIBTOOLIZE) > /dev/null 2>&1 && break
+  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
 done
 if test x$LIBTOOLIZE = xnope; then
   echo "nope."
@@ -60,14 +112,14 @@
 
 echo "Generating configuration files for $package, please wait...."
 
-echo "  aclocal $ACLOCAL_FLAGS"
-aclocal $ACLOCAL_FLAGS || exit 1
+echo "  $ACLOCAL $ACLOCAL_FLAGS"
+$ACLOCAL $ACLOCAL_FLAGS || exit 1
+echo "  $LIBTOOLIZE --automake"
+$LIBTOOLIZE --automake || exit 1
 echo "  autoheader"
 autoheader || exit 1
-echo "  $LIBTOOLIZE --automake"
-$LIBTOOLIZE --automake || exit 1
-echo "  automake --add-missing $AUTOMAKE_FLAGS"
-automake --add-missing $AUTOMAKE_FLAGS || exit 1
+echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
+$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
 echo "  autoconf"
 autoconf || exit 1
 

Modified: branches/vorbis-aotuv/configure.in
===================================================================
--- branches/vorbis-aotuv/configure.in	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/configure.in	2008-04-01 10:47:58 UTC (rev 14647)
@@ -11,19 +11,19 @@
 
 AM_CONFIG_HEADER([config.h])
 
-AM_INIT_AUTOMAKE(libvorbis,1.1.2)
+AM_INIT_AUTOMAKE(libvorbis,1.2.0)
 AM_MAINTAINER_MODE
 
 dnl Library versioning
 
-V_LIB_CURRENT=3
-V_LIB_REVISION=1
-V_LIB_AGE=3
-VF_LIB_CURRENT=4
-VF_LIB_REVISION=1
-VF_LIB_AGE=1
+V_LIB_CURRENT=4
+V_LIB_REVISION=0
+V_LIB_AGE=4
+VF_LIB_CURRENT=5
+VF_LIB_REVISION=0
+VF_LIB_AGE=2
 VE_LIB_CURRENT=2
-VE_LIB_REVISION=2
+VE_LIB_REVISION=3
 VE_LIB_AGE=0
 AC_SUBST(V_LIB_CURRENT)
 AC_SUBST(V_LIB_REVISION)

Modified: branches/vorbis-aotuv/doc/Makefile.am
===================================================================
--- branches/vorbis-aotuv/doc/Makefile.am	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/Makefile.am	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,7 +6,8 @@
 
 ### all of the static docs, commited to SVN and included as is
 static_docs = \
-	draft-kerr-avt-vorbis-rtp-03.txt \
+	draft-ietf-avt-rtp-vorbis-06.xml \
+	draft-ietf-avt-rtp-vorbis-06.txt \
 	eightphase.png \
 	evenlsp.png \
 	floor1_inverse_dB_table.html \
@@ -100,7 +101,7 @@
 	@mkdir -p $(BUILDDIR)
 	@for file in $(doc_sources); do cp $(srcdir)/$$file $(BUILDDIR); done
 # translate the draft rtp.txt to .xml in the BUILDDIR
-$(BUILDDIR)/draft-rtp.xml: draft-kerr-avt-vorbis-rtp-03.txt
+$(BUILDDIR)/draft-rtp.xml: draft-ietf-avt-rtp-vorbis-05.txt
 	cat $< | sed 's///g' > $@
 # cat $< | sed 's///g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g' > $@
 
@@ -112,15 +113,13 @@
 Vorbis_I_spec.fo: $(BUILDDIR)/Vorbis_I_spec.xml
 	cd build; xsltproc --xinclude --output $@ spec-fo.xsl Vorbis_I_spec.xml && mv $@ ..
 
-# we add the two newlines to pdfxmltex because on a number of Fedora systems
-# tex prompts for input complaining about something;
-# and surprisingly there's no way to tell tex to ignore that
-# also, --interaction doesn't seem to actually do anything different
-# if you change it
+# we add the two newlines to pdfxmltex because this entire XML
+# toolchain is built from wishful thinking and bonghits and the
+# default supplied passivetex config files are buggy.
 Vorbis_I_spec.pdf: Vorbis_I_spec.fo $(SPEC_PNG_BUILD) $(SPEC_PDF_BUILD)
 	cp $< build/spec.fo # work around a passivetex bug
-	cd build; echo -e -n "\n\n" | pdfxmltex --interaction nonstopmode spec.fo
-	cd build; echo -e -n "\n\n" | pdfxmltex --interaction nonstopmode spec.fo
+	-cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
+	-cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
 	rm build/spec.fo
 	mv build/spec.pdf $@
 else

Modified: branches/vorbis-aotuv/doc/Vorbis_I_spec.html
===================================================================
--- branches/vorbis-aotuv/doc/Vorbis_I_spec.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/Vorbis_I_spec.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,12 +1,12 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Vorbis I specification</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2405333"></a>Vorbis I specification</h1></div><div><h3 class="corpauthor">Xiph.org Foundation</h3></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#vorbis-spec-intro">1. Introduction and Description</a></span></dt><dd><dl><dt><span class="section"><a href="#id2519516">1.1. Overview</a></span></dt><dt><span class="section"><a href="#id2518126">1.2. Decoder Configuration</a></span></dt><dt><span class="section"><a href="#id2449172">1.3. High-level Decode Process</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-bitpacking">2. Bitpacki
 ng Convention</a></span></dt><dd><dl><dt><span class="section"><a href="#id2524173">2.1. Overview</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codebook">3. Probability Model and Codebooks</a></span></dt><dd><dl><dt><span class="section"><a href="#id2523292">3.1. Overview</a></span></dt><dt><span class="section"><a href="#id2509016">3.2. Packed codebook format</a></span></dt><dt><span class="section"><a href="#id2450655">3.3. Use of the codebook abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codec">4. Codec Setup and Packet Decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id2512199">4.1. Overview</a></span></dt><dt><span class="section"><a href="#id2531940">4.2. Header decode and decode setup</a></span></dt><dt><span class="section"><a href="#id2545699">4.3. Audio packet decode and synthesis</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-comment">5. comment field and h
 eader specification</a></span></dt><dd><dl><dt><span class="section"><a href="#id2541891">5.1. Overview</a></span></dt><dt><span class="section"><a href="#id2541925">5.2. Comment encoding</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor0">6. Floor type 0 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id2512128">6.1. Overview</a></span></dt><dt><span class="section"><a href="#id2505686">6.2. Floor 0 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor1">7. Floor type 1 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id2541060">7.1. Overview</a></span></dt><dt><span class="section"><a href="#id2540135">7.2. Floor 1 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-residue">8. Residue setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id2524422">8.1. Overview</a></span></dt><dt><span class="section"><a hre
 f="#id2517330">8.2. Residue format</a></span></dt><dt><span class="section"><a href="#id2506346">8.3. residue 0</a></span></dt><dt><span class="section"><a href="#id2517602">8.4. residue 1</a></span></dt><dt><span class="section"><a href="#id2517633">8.5. residue 2</a></span></dt><dt><span class="section"><a href="#id2538870">8.6. Residue decode</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-helper">9. Helper equations</a></span></dt><dd><dl><dt><span class="section"><a href="#id2507758">9.1. Overview</a></span></dt><dt><span class="section"><a href="#id2512257">9.2. Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-tables">10. Tables</a></span></dt><dd><dl><dt><span class="section"><a href="#vorbis-spec-floor1_inverse_dB_table">10.1. floor1_inverse_dB_table</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-ogg">A. Embedding Vorbis into an Ogg stream</a></span></dt><dd><dl><dt><span class="sec
 tion"><a href="#id2520211">A.1. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#id2530380">A.1.1. Restrictions</a></span></dt><dt><span class="section"><a href="#id2512176">A.1.2. MIME type</a></span></dt></dl></dd><dt><span class="section"><a href="#id2520628">A.2. Encapsulation</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-rtp">B. Vorbis encapsulation in RTP</a></span></dt><dt><span class="appendix"><a href="#footer">C. Colophon</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-intro"></a>1. Introduction and Description</h2></div><div><p class="releaseinfo">
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Vorbis I specification</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id291327"></a>Vorbis I specification</h1></div><div><h3 class="corpauthor">Xiph.org Foundation</h3></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#vorbis-spec-intro">1. Introduction and Description</a></span></dt><dd><dl><dt><span class="section"><a href="#id311592">1.1. Overview</a></span></dt><dt><span class="section"><a href="#id258770">1.2. Decoder Configuration</a></span></dt><dt><span class="section"><a href="#id258461">1.3. High-level Decode Process</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-bitpacking">2. Bitpacking C
 onvention</a></span></dt><dd><dl><dt><span class="section"><a href="#id304831">2.1. Overview</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codebook">3. Probability Model and Codebooks</a></span></dt><dd><dl><dt><span class="section"><a href="#id310158">3.1. Overview</a></span></dt><dt><span class="section"><a href="#id310216">3.2. Packed codebook format</a></span></dt><dt><span class="section"><a href="#id316518">3.3. Use of the codebook abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codec">4. Codec Setup and Packet Decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id336024">4.1. Overview</a></span></dt><dt><span class="section"><a href="#id326710">4.2. Header decode and decode setup</a></span></dt><dt><span class="section"><a href="#id342709">4.3. Audio packet decode and synthesis</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-comment">5. comment field and header speci
 fication</a></span></dt><dd><dl><dt><span class="section"><a href="#id314030">5.1. Overview</a></span></dt><dt><span class="section"><a href="#id314058">5.2. Comment encoding</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor0">6. Floor type 0 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id336814">6.1. Overview</a></span></dt><dt><span class="section"><a href="#id321046">6.2. Floor 0 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor1">7. Floor type 1 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id336243">7.1. Overview</a></span></dt><dt><span class="section"><a href="#id334800">7.2. Floor 1 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-residue">8. Residue setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id320982">8.1. Overview</a></span></dt><dt><span class="section"><a href="#id307154">8.2.
  Residue format</a></span></dt><dt><span class="section"><a href="#id326310">8.3. residue 0</a></span></dt><dt><span class="section"><a href="#id326344">8.4. residue 1</a></span></dt><dt><span class="section"><a href="#id334893">8.5. residue 2</a></span></dt><dt><span class="section"><a href="#id334939">8.6. Residue decode</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-helper">9. Helper equations</a></span></dt><dd><dl><dt><span class="section"><a href="#id316603">9.1. Overview</a></span></dt><dt><span class="section"><a href="#id317505">9.2. Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-tables">10. Tables</a></span></dt><dd><dl><dt><span class="section"><a href="#vorbis-spec-floor1_inverse_dB_table">10.1. floor1_inverse_dB_table</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-ogg">1. Embedding Vorbis into an Ogg stream</a></span></dt><dd><dl><dt><span class="section"><a href="#id319760"
 >1.1. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#id336562">1.1.1. Restrictions</a></span></dt><dt><span class="section"><a href="#id330723">1.1.2. MIME type</a></span></dt></dl></dd><dt><span class="section"><a href="#id328095">1.2. Encapsulation</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-rtp">2. Vorbis encapsulation in RTP</a></span></dt><dt><span class="appendix"><a href="#footer">3. Colophon</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-intro"></a>1. Introduction and Description</h2></div><div><p class="releaseinfo">
  $Id: 01-introduction.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2519516"></a>1.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id311592"></a>1.1. Overview</h3></div></div></div><p>
 This document provides a high level description of the Vorbis codec's
 construction.  A bit-by-bit specification appears beginning in 
 <a href="#vorbis-spec-codec" title="4. Codec Setup and Packet Decode">Section 4, &#8220;Codec Setup and Packet Decode&#8221;</a>.
 The later sections assume a high-level
 understanding of the Vorbis decode process, which is 
-provided here.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2528250"></a>1.1.1. Application</h4></div></div></div><p>
+provided here.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317198"></a>1.1.1. Application</h4></div></div></div><p>
 Vorbis is a general purpose perceptual audio CODEC intended to allow
 maximum encoder flexibility, thus allowing it to scale competitively
 over an exceptionally wide range of bitrates.  At the high
@@ -18,13 +18,13 @@
 masters) and a range of channel representations (monaural,
 polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255
 discrete channels).
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2525977"></a>1.1.2. Classification</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id315630"></a>1.1.2. Classification</h4></div></div></div><p>
 Vorbis I is a forward-adaptive monolithic transform CODEC based on the
 Modified Discrete Cosine Transform.  The codec is structured to allow
 addition of a hybrid wavelet filterbank in Vorbis II to offer better
 transient response and reproduction using a transform better suited to
 localized time events.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2517154"></a>1.1.3. Assumptions</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323943"></a>1.1.3. Assumptions</h4></div></div></div><p>
 The Vorbis CODEC design assumes a complex, psychoacoustically-aware
 encoder and simple, low-complexity decoder. Vorbis decode is
 computationally simpler than mp3, although it does require more
@@ -56,8 +56,8 @@
 embedded in an Ogg stream specifically, although this is by no means a
 requirement or fundamental assumption in the Vorbis design.</p><p>
 The specification for embedding Vorbis into
-an Ogg transport stream is in <a href="#vorbis-over-ogg" title="A. Embedding Vorbis into an Ogg stream">Appendix A, <i>Embedding Vorbis into an Ogg stream</i></a>.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518614"></a>1.1.4. Codec Setup and Probability Model</h4></div></div></div><p>
+an Ogg transport stream is in <a href="#vorbis-over-ogg" title="1. Embedding Vorbis into an Ogg stream">Appendix 1, <i>Embedding Vorbis into an Ogg stream</i></a>.
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id324282"></a>1.1.4. Codec Setup and Probability Model</h4></div></div></div><p>
 Vorbis' heritage is as a research CODEC and its current design
 reflects a desire to allow multiple decades of continuous encoder
 improvement before running out of room within the codec specification.
@@ -85,29 +85,29 @@
 current design trends (and also points out limitations in some
 existing software/interface designs, such as Windows' ACM codec
 framework).  However, we find that it does not fundamentally limit
-Vorbis' suitable application space.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518094"></a>1.1.5. Format Specification</h4></div></div></div><p>
+Vorbis' suitable application space.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258744"></a>1.1.5. Format Specification</h4></div></div></div><p>
 The Vorbis format is well-defined by its decode specification; any
 encoder that produces packets that are correctly decoded by the
 reference Vorbis decoder described below may be considered a proper
 Vorbis encoder.  A decoder must faithfully and completely implement
 the specification defined below (except where noted) to be considered
-a proper Vorbis decoder.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518110"></a>1.1.6. Hardware Profile</h4></div></div></div><p>
+a proper Vorbis decoder.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258756"></a>1.1.6. Hardware Profile</h4></div></div></div><p>
 Although Vorbis decode is computationally simple, it may still run
 into specific limitations of an embedded design.  For this reason,
 embedded designs are allowed to deviate in limited ways from the
 'full' decode specification yet still be certified compliant.  These
-optional omissions are labelled in the spec where relevant.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2518126"></a>1.2. Decoder Configuration</h3></div></div></div><p>
+optional omissions are labelled in the spec where relevant.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id258770"></a>1.2. Decoder Configuration</h3></div></div></div><p>
 Decoder setup consists of configuration of multiple, self-contained
 component abstractions that perform specific functions in the decode
 pipeline.  Each different component instance of a specific type is
 semantically interchangeable; decoder configuration consists both of
 internal component configuration, as well as arrangement of specific
 instances into a decode pipeline.  Componentry arrangement is roughly
-as follows:</p><div class="mediaobject"><img src="components.png" alt="decoder pipeline configuration"></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518164"></a>1.2.1. Global Config</h4></div></div></div><p>
+as follows:</p><div class="mediaobject"><img src="components.png" alt="decoder pipeline configuration"></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258803"></a>1.2.1. Global Config</h4></div></div></div><p>
 Global codec configuration consists of a few audio related fields
 (sample rate, channels), Vorbis version (always '0' in Vorbis I),
 bitrate hints, and the lists of component instances.  All other
-configuration is in the context of specific components.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518178"></a>1.2.2. Mode</h4></div></div></div><p>
+configuration is in the context of specific components.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258815"></a>1.2.2. Mode</h4></div></div></div><p>
 Each Vorbis frame is coded according to a master 'mode'.  A bitstream
 may use one or many modes.</p><p>
 The mode mechanism is used to encode a frame according to one of
@@ -120,7 +120,7 @@
 (always 0, the Vorbis window, in Vorbis I), transform type (always
 type 0, the MDCT, in Vorbis I) and a mapping number.  The mapping
 number specifies which mapping configuration instance to use for
-low-level packet decode and synthesis.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518208"></a>1.2.3. Mapping</h4></div></div></div><p>
+low-level packet decode and synthesis.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258359"></a>1.2.3. Mapping</h4></div></div></div><p>
 A mapping contains a channel coupling description and a list of
 'submaps' that bundle sets of channel vectors together for grouped
 encoding and decoding. These submaps are not references to external
@@ -141,7 +141,7 @@
 and a bass-only representation to the bass channel, thus saving space.
 In this example, channels 0-4 belong to submap 0 (which indicates use
 of a full-range floor) and channel 5 belongs to submap 1, which uses a
-bass-only representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2462918"></a>1.2.4. Floor</h4></div></div></div><p>
+bass-only representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258391"></a>1.2.4. Floor</h4></div></div></div><p>
 Vorbis encodes a spectral 'floor' vector for each PCM channel.  This
 vector is a low-resolution representation of the audio spectrum for
 the given channel in the current frame, generally used akin to a
@@ -165,7 +165,7 @@
 configuration generally refers to multiple codebooks in the codebook
 component list.  Entropy coding is thus provided as an abstraction,
 and each floor instance may choose from any and all available
-codebooks when coding/decoding.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518290"></a>1.2.5. Residue</h4></div></div></div><p>
+codebooks when coding/decoding.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258423"></a>1.2.5. Residue</h4></div></div></div><p>
 The spectral residue is the fine structure of the audio spectrum
 once the floor curve has been subtracted out.  In simplest terms, it
 is coded in the bitstream using cascaded (multi-pass) vector
@@ -174,7 +174,7 @@
 configured by residue instance.  As with the floor components, the
 final VQ/entropy encoding is provided by external codebook instances
 and each residue instance may choose from any and all available
-codebooks.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2518309"></a>1.2.6. Codebooks</h4></div></div></div><p>
+codebooks.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258437"></a>1.2.6. Codebooks</h4></div></div></div><p>
 Codebooks are a self-contained abstraction that perform entropy
 decoding and, optionally, use the entropy-decoded integer value as an
 offset into an index of output value vectors, returning the indicated
@@ -186,7 +186,7 @@
 The codebook vector index is similarly packed according to index
 characteristic.  Most commonly, the vector index is encoded as a
 single list of values of possible values that are then permuted into
-a list of n-dimensional rows (lattice VQ).</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2449172"></a>1.3. High-level Decode Process</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2449178"></a>1.3.1. Decode Setup</h4></div></div></div><p>
+a list of n-dimensional rows (lattice VQ).</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id258461"></a>1.3. High-level Decode Process</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258467"></a>1.3.1. Decode Setup</h4></div></div></div><p>
 Before decoding can begin, a decoder must initialize using the
 bitstream headers matching the stream to be decoded.  Vorbis uses
 three header packets; all are required, in-order, by this
@@ -194,16 +194,16 @@
 belonging to the Vorbis stream. In Vorbis I, all packets after the
 three initial headers are audio packets. </p><p>
 The header packets are, in order, the identification
-header, the comments header, and the setup header.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2449199"></a>1.3.1.1. Identification Header</h5></div></div></div><p>
+header, the comments header, and the setup header.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id314074"></a>1.3.1.1. Identification Header</h5></div></div></div><p>
 The identification header identifies the bitstream as Vorbis, Vorbis
 version, and the simple audio characteristics of the stream such as
-sample rate and number of channels.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2449212"></a>1.3.1.2. Comment Header</h5></div></div></div><p>
+sample rate and number of channels.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id314086"></a>1.3.1.2. Comment Header</h5></div></div></div><p>
 The comment header includes user text comments ("tags") and a vendor
 string for the application/library that produced the bitstream.  The
 encoding and proper use of the comment header is described in 
-<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2449230"></a>1.3.1.3. Setup Header</h5></div></div></div><p>
+<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id314101"></a>1.3.1.3. Setup Header</h5></div></div></div><p>
 The setup header includes extensive CODEC setup information as well as
-the complete VQ and Huffman codebooks needed for decode.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2449243"></a>1.3.2. Decode Procedure</h4></div></div></div><div class="highlights"><p>
+the complete VQ and Huffman codebooks needed for decode.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id314113"></a>1.3.2. Decode Procedure</h4></div></div></div><div class="highlights"><p>
 The decoding and synthesis procedure for all audio packets is
 fundamentally the same.
 </p><div class="orderedlist"><ol type="1"><li>decode packet type flag</li><li>decode mode number</li><li>decode window shape (long windows only)</li><li>decode floor</li><li>decode residue into residue vectors</li><li>inverse channel coupling of residue vectors</li><li>generate floor curve from decoded floor data</li><li>compute dot product of floor and residue, producing audio spectrum vector</li><li>inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis I</li><li>overlap/add left-hand output of transform with right-hand output of previous frame</li><li>store right hand-data from transform of current frame for future lapping</li><li>if not first frame, return results of overlap/add as audio result of current frame</li></ol></div><p>
@@ -215,7 +215,7 @@
 later before overlap/add with the next frame.  This optimization
 produces entirely equivalent output and is naturally perfectly legal.
 The decoder must be <span class="emphasis"><em>entirely mathematically equivalent</em></span> to the
-specification, it need not be a literal semantic implementation.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2449344"></a>1.3.2.1. Packet type decode</h5></div></div></div><p>
+specification, it need not be a literal semantic implementation.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id314203"></a>1.3.2.1. Packet type decode</h5></div></div></div><p>
 Vorbis I uses four packet types. The first three packet types mark each
 of the three Vorbis headers described above. The fourth packet type
 marks an audio packet. All other packet types are reserved; packets
@@ -225,7 +225,7 @@
 verify the packet type; <span class="emphasis"><em>a non-audio packet when audio is expected
 indicates stream corruption or a non-compliant stream. The decoder
 must ignore the packet and not attempt decoding it to
-audio</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2449370"></a>1.3.2.2. Mode decode</h5></div></div></div><p>
+audio</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id314225"></a>1.3.2.2. Mode decode</h5></div></div></div><p>
 Vorbis allows an encoder to set up multiple, numbered packet 'modes',
 as described earlier, all of which may be used in a given Vorbis
 stream. The mode is encoded as an integer used as a direct offset into
@@ -261,11 +261,11 @@
 The use of multirate filter banks for coding of high quality digital
 audio</a></span>&#8221;, by T. Sporer, K. Brandenburg and B. Edler.  Vorbis windows
 all use the slope function 
-  <span class="inlinemediaobject"></span>.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450128"></a>1.3.2.4. floor decode</h5></div></div></div><p>
+  <span class="inlinemediaobject"><span>$y = \sin(.5*\pi \, \sin^2((x+.5)/n*\pi))$</span></span>.
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339168"></a>1.3.2.4. floor decode</h5></div></div></div><p>
 Each floor is encoded/decoded in channel order, however each floor
 belongs to a 'submap' that specifies which floor configuration to
-use.  All floors are decoded before residue decode begins.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450140"></a>1.3.2.5. residue decode</h5></div></div></div><p>
+use.  All floors are decoded before residue decode begins.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339179"></a>1.3.2.5. residue decode</h5></div></div></div><p>
 Although the number of residue vectors equals the number of channels,
 channel coupling may mean that the raw residue vectors extracted
 during decode do not map directly to specific channels.  When channel
@@ -275,7 +275,7 @@
 Vorbis codes residue vectors in groups by submap; the coding is done
 in submap order from submap 0 through n-1.  This differs from floors
 which are coded using a configuration provided by submap number, but
-are coded individually in channel order.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450165"></a>1.3.2.6. inverse channel coupling</h5></div></div></div><p>
+are coded individually in channel order.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339196"></a>1.3.2.6. inverse channel coupling</h5></div></div></div><p>
 A detailed discussion of stereo in the Vorbis codec can be found in
 the document <a href="stereo.html" target="_top"><em class="citetitle">Stereo Channel Coupling in the
 Vorbis CODEC</em></a>.  Vorbis is not limited to only stereo coupling, but
@@ -289,7 +289,7 @@
 angle) back to Cartesian representation.</p><p>
 After decoupling, in order, each pair of vectors on the coupling list, 
 the resulting residue vectors represent the fine spectral detail
-of each output channel.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450201"></a>1.3.2.7. generate floor curve</h5></div></div></div><p>
+of each output channel.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339224"></a>1.3.2.7. generate floor curve</h5></div></div></div><p>
 The decoder may choose to generate the floor curve at any appropriate
 time.  It is reasonable to generate the output curve when the floor
 data is decoded from the raw packet, or it can be generated after
@@ -298,7 +298,7 @@
 some working space.</p><p>
 Both floor 0 and floor 1 generate a linear-range, linear-domain output
 vector to be multiplied (dot product) by the linear-range,
-linear-domain spectral residue.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450222"></a>1.3.2.8. compute floor/residue dot product</h5></div></div></div><p>
+linear-domain spectral residue.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339240"></a>1.3.2.8. compute floor/residue dot product</h5></div></div></div><p>
 This step is straightforward; for each output channel, the decoder
 multiplies the floor curve and residue vectors element by element,
 producing the finished audio spectrum of each channel.</p><p>
@@ -321,7 +321,7 @@
 product must be able to handle an effective 48 bit times 24 bit
 multiplication.  This range may be achieved using large (64 bit or
 larger) integers, or implementing a movable binary point
-representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450264"></a>1.3.2.9. inverse monolithic transform (MDCT)</h5></div></div></div><p>
+representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339268"></a>1.3.2.9. inverse monolithic transform (MDCT)</h5></div></div></div><p>
 The audio spectrum is converted back into time domain PCM audio via an
 inverse Modified Discrete Cosine Transform (MDCT).  A detailed
 description of the MDCT is available in the paper <a href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" target="_top">&#8220;<span class="citetitle">The use of multirate filter banks for coding of high quality digital
@@ -329,16 +329,16 @@
 Note that the PCM produced directly from the MDCT is not yet finished
 audio; it must be lapped with surrounding frames using an appropriate
 window (such as the Vorbis window) before the MDCT can be considered
-orthogonal.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450296"></a>1.3.2.10. overlap/add data</h5></div></div></div><p>
+orthogonal.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339292"></a>1.3.2.10. overlap/add data</h5></div></div></div><p>
 Windowed MDCT output is overlapped and added with the right hand data
 of the previous window such that the 3/4 point of the previous window
 is aligned with the 1/4 point of the current window (as illustrated in
 the window overlap diagram). At this point, the audio data between the
 center of the previous frame and the center of the current frame is
-now finished and ready to be returned. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450312"></a>1.3.2.11. cache right hand data</h5></div></div></div><p>
+now finished and ready to be returned. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339304"></a>1.3.2.11. cache right hand data</h5></div></div></div><p>
 The decoder must cache the right hand portion of the current frame to
 be lapped with the left hand portion of the next frame.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2542059"></a>1.3.2.12. return finished audio data</h5></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id339314"></a>1.3.2.12. return finished audio data</h5></div></div></div><p>
 The overlapped portion produced from overlapping the previous and
 current frame data is finished data to be returned by the decoder.
 This data spans from the center of the previous window to the center
@@ -360,7 +360,7 @@
 calculating PCM offsets; after the first frame, the proper PCM output
 offset is '0' (as no data has been returned yet).</p></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-bitpacking"></a>2. Bitpacking Convention</h2></div><div><p class="releaseinfo">
  $Id: 02-bitpacking.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2524173"></a>2.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id304831"></a>2.1. Overview</h3></div></div></div><p>
 The Vorbis codec uses relatively unstructured raw packets containing
 arbitrary-width binary integer fields.  Logically, these packets are a
 bitstream in which bits are coded one-by-one by the encoder and then
@@ -370,7 +370,7 @@
 or, less commonly other fixed word sizes.  The Vorbis bitpacking
 convention specifies the correct mapping of the logical packet
 bitstream into an actual representation in fixed-width words.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2498786"></a>2.1.1. octets, bytes and words</h4></div></div></div><p>
+</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id304890"></a>2.1.1. octets, bytes and words</h4></div></div></div><p>
 In most contemporary architectures, a 'byte' is synonymous with an
 'octet', that is, eight bits.  This has not always been the case;
 seven, ten, eleven and sixteen bit 'bytes' have been used.  For
@@ -386,13 +386,13 @@
 bytes (16, 32 or 64 bits).  Note however that the Vorbis bitpacking
 convention is still well defined for any native byte size; Vorbis uses
 the native bit-width of a given storage system. This document assumes
-that a byte is one octet for purposes of example.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2516522"></a>2.1.2. bit order</h4></div></div></div><p>
+that a byte is one octet for purposes of example.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id304832"></a>2.1.2. bit order</h4></div></div></div><p>
 A byte has a well-defined 'least significant' bit (LSb), which is the
 only bit set when the byte is storing the two's complement integer
 value +1.  A byte's 'most significant' bit (MSb) is at the opposite
 end of the byte. Bits in a byte are numbered from zero at the LSb to
 <span class="emphasis"><em>n</em></span> (<span class="emphasis"><em>n</em></span>=7 in an octet) for the
-MSb.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2483456"></a>2.1.3. byte order</h4></div></div></div><p>
+MSb.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id327953"></a>2.1.3. byte order</h4></div></div></div><p>
 Words are native groupings of multiple bytes.  Several byte orderings
 are possible in a word; the common ones are 3-2-1-0 ('big endian' or
 'most significant byte first' in which the highest-valued byte comes
@@ -404,7 +404,7 @@
 of a concern only during optimization when writing high performance
 code that operates on a word of storage at a time rather than by byte.
 Logically, bytes are always coded and decoded in order from byte zero
-through byte <span class="emphasis"><em>n</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2513509"></a>2.1.4. coding bits into byte sequences</h4></div></div></div><p>
+through byte <span class="emphasis"><em>n</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id336382"></a>2.1.4. coding bits into byte sequences</h4></div></div></div><p>
 The Vorbis codec has need to code arbitrary bit-width integers, from
 zero to 32 bits wide, into packets.  These integer fields are not
 aligned to the boundaries of the byte representation; the next field
@@ -420,13 +420,13 @@
 have been filled, encoding continues by zeroing all bits of the next
 byte and writing the next bit into the bit position 0 of that byte.
 Decoding follows the same process as encoding, but by reading bits
-from the byte stream and reassembling them into integers.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2537805"></a>2.1.5. signedness</h4></div></div></div><p>
+from the byte stream and reassembling them into integers.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id310906"></a>2.1.5. signedness</h4></div></div></div><p>
 The signedness of a specific number resulting from decode is to be
 interpreted by the decoder given decode context.  That is, the three
 bit binary pattern 'b111' can be taken to represent either 'seven' as
 an unsigned integer, or '-1' as a signed, two's complement integer.
 The encoder and decoder are responsible for knowing if fields are to
-be treated as signed or unsigned.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2513546"></a>2.1.6. coding example</h4></div></div></div><p>
+be treated as signed or unsigned.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258112"></a>2.1.6. coding example</h4></div></div></div><p>
 Code the 4 bit integer value '12' [b1100] into an empty bytestream.
 Bytestream result:
 
@@ -490,7 +490,7 @@
 byte n [               ]  bytestream length == 4 bytes
 
 </pre><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2513617"></a>2.1.7. decoding example</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id258160"></a>2.1.7. decoding example</h4></div></div></div><p>
 Reading from the beginning of the bytestream encoded in the above example:
 
 </p><pre class="screen">
@@ -515,7 +515,7 @@
 two-bit-wide integer 'b11'.  This value may be interpreted either as
 the unsigned value '3', or the signed value '-1'.  Signedness is
 dependent on decode context.</p></li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2513669"></a>2.1.8. end-of-packet alignment</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id259912"></a>2.1.8. end-of-packet alignment</h4></div></div></div><p>
 The typical use of bitpacking is to produce many independent
 byte-aligned packets which are embedded into a larger byte-aligned
 container structure, such as an Ogg transport bitstream.  Externally,
@@ -533,7 +533,7 @@
 packets as a normal mode of operation, and as such, decoders must
 handle reading past the end of a packet as a typical mode of
 operation. Any further read operations after an 'end-of-packet'
-condition shall also return 'end-of-packet'.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2520883"></a>2.1.9.  reading zero bits</h4></div></div></div><p>
+condition shall also return 'end-of-packet'.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id259938"></a>2.1.9.  reading zero bits</h4></div></div></div><p>
 Reading a zero-bit-wide integer returns the value '0' and does not
 increment the stream cursor.  Reading to the end of the packet (but
 not past, such that an 'end-of-packet' condition has not triggered)
@@ -542,7 +542,7 @@
 integer after a previous read sets 'end-of-packet' shall also fail
 with 'end-of-packet'.</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-codebook"></a>3. Probability Model and Codebooks</h2></div><div><p class="releaseinfo">
  $Id: 03-codebook.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2523292"></a>3.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id310158"></a>3.1. Overview</h3></div></div></div><p>
 Unlike practically every other mainstream audio codec, Vorbis has no
 statically configured probability model, instead packing all entropy
 decoding configuration, VQ and Huffman, into the bitstream itself in
@@ -551,15 +551,15 @@
 Huffman-equivalent representation for decoding compressed codewords as
 well as an optional lookup table of output vector values to which a
 decoded Huffman value is applied as an offset, generating the final
-decoded output corresponding to a given compressed codeword.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2497985"></a>3.1.1. Bitwise operation</h4></div></div></div><p>
+decoded output corresponding to a given compressed codeword.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id335318"></a>3.1.1. Bitwise operation</h4></div></div></div><p>
 The codebook mechanism is built on top of the vorbis bitpacker. Both
 the codebooks themselves and the codewords they decode are unrolled 
 from a packet as a series of arbitrary-width values read from the 
-stream according to <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a>.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2509016"></a>3.2. Packed codebook format</h3></div></div></div><p>
+stream according to <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a>.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id310216"></a>3.2. Packed codebook format</h3></div></div></div><p>
 For purposes of the examples below, we assume that the storage
 system's native byte width is eight bits.  This is not universally
 true; see <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a> for discussion 
-relating to non-eight-bit bytes.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2450934"></a>3.2.1. codebook decode</h4></div></div></div><p>
+relating to non-eight-bit bytes.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id324957"></a>3.2.1. codebook decode</h4></div></div></div><p>
 A codebook begins with a 24 bit sync pattern, 0x564342:
 
 </p><pre class="screen">
@@ -689,7 +689,7 @@
 document.</p></li></ul></div><p>
 </p><p>
 An 'end of packet' during any read operation in the above steps is
-considered an error condition rendering the stream undecodable.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2519623"></a>3.2.1.1. Huffman decision tree representation</h5></div></div></div><p>
+considered an error condition rendering the stream undecodable.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id258959"></a>3.2.1.1. Huffman decision tree representation</h5></div></div></div><p>
 The <code class="varname">[codebook_codeword_lengths]</code> array and
 <code class="varname">[codebook_entries]</code> value uniquely define the Huffman decision
 tree used for entropy decoding.</p><p>
@@ -747,7 +747,7 @@
 Codebook entries marked 'unused' are simply skipped in the assigning
 process.  They have no codeword and do not appear in the decision
 tree, thus it's impossible for any bit pattern read from the stream to
-decode to that entry number.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2450540"></a>3.2.1.2. VQ lookup table vector representation</h5></div></div></div><p>
+decode to that entry number.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id316419"></a>3.2.1.2. VQ lookup table vector representation</h5></div></div></div><p>
 Unpacking the VQ lookup table vectors relies on the following values:
 </p><pre class="programlisting">
 the [codebook_multiplicands] array
@@ -763,7 +763,7 @@
 Decoding (unpacking) a specific vector in the vector lookup table
 proceeds according to <code class="varname">[codebook_lookup_type]</code>.  The unpacked
 vector values are what a codebook would return during audio packet
-decode in a VQ context.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id2450569"></a>3.2.1.2.1. Vector value decode: Lookup type 1</h6></div></div></div><p>
+decode in a VQ context.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id316444"></a>3.2.1.2.1. Vector value decode: Lookup type 1</h6></div></div></div><p>
 Lookup type one specifies a lattice VQ lookup table built
 algorithmically from a list of scalar values.  Calculate (unpack) the
 final values of a codebook entry vector from the entries in
@@ -790,7 +790,7 @@
      }
  
   8) vector calculation completed.
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id2450608"></a>3.2.1.2.2. Vector value decode: Lookup type 2</h6></div></div></div><p>
+</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id316478"></a>3.2.1.2.2. Vector value decode: Lookup type 2</h6></div></div></div><p>
 Lookup type two specifies a VQ lookup table in which each scalar in
 each vector is explicitly set by the <code class="varname">[codebook_multiplicands]</code>
 array in a one-to-one mapping.  Calculate [unpack] the
@@ -815,7 +815,7 @@
      }
  
   7) vector calculation completed.
-</pre></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2450655"></a>3.3. Use of the codebook abstraction</h3></div></div></div><p>
+</pre></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id316518"></a>3.3. Use of the codebook abstraction</h3></div></div></div><p>
 The decoder uses the codebook abstraction much as it does the
 bit-unpacking convention; a specific codebook reads a
 codeword from the bitstream, decoding it into an entry number, and then
@@ -848,18 +848,18 @@
 offset into the VQ lookup table.  The value returned to the decoder is
 the vector of scalars corresponding to this offset.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-codec"></a>4. Codec Setup and Packet Decode</h2></div><div><p class="releaseinfo">
  $Id: 04-codec.xml 10466 2005-11-28 00:34:44Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2512199"></a>4.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id336024"></a>4.1. Overview</h3></div></div></div><p>
 This document serves as the top-level reference document for the
 bit-by-bit decode specification of Vorbis I.  This document assumes a
 high-level understanding of the Vorbis decode process, which is
 provided in <a href="#vorbis-spec-intro" title="1. Introduction and Description">Section 1, &#8220;Introduction and Description&#8221;</a>.  <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a> covers reading and writing bit fields from
-and to bitstream packets.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2531940"></a>4.2. Header decode and decode setup</h3></div></div></div><p>
+and to bitstream packets.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326710"></a>4.2. Header decode and decode setup</h3></div></div></div><p>
 A Vorbis bitstream begins with three header packets. The header
 packets are, in order, the identification header, the comments header,
 and the setup header. All are required for decode compliance.  An
 end-of-packet condition during decoding the first or third header
 packet renders the stream undecodable.  End-of-packet decoding the
-comment header is a non-fatal error condition.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2531581"></a>4.2.1. Common header decode</h4></div></div></div><p>
+comment header is a non-fatal error condition.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id337747"></a>4.2.1. Common header decode</h4></div></div></div><p>
 Each header packet begins with the same header fields.
 </p><pre class="screen">
   1) [packet_type] : 8 bit value
@@ -869,7 +869,7 @@
 is type 1, the comment header type 3 and the setup header type 5
 (these types are all odd as a packet with a leading single bit of '0'
 is an audio packet).  The packets must occur in the order of
-identification, comment, setup.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2522768"></a>4.2.2. Identification header</h4></div></div></div><p>
+identification, comment, setup.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317806"></a>4.2.2. Identification header</h4></div></div></div><p>
 The identification header is a short header of only a few fields used
 to declare the stream definitively as Vorbis, and provide a few externally
 relevant pieces of information about the audio stream. The
@@ -895,9 +895,9 @@
 field especially may be considerably off in purely VBR streams.  The
 fields are meaningful only when greater than zero.</p><p>
 </p><div class="itemizedlist"><ul type="disc"><li>All three fields set to the same value implies a fixed rate, or tightly bounded, nearly fixed-rate bitstream</li><li>Only nominal set implies a VBR or ABR stream that averages the nominal bitrate</li><li>Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits</li><li>None set indicates the encoder does not care to speculate.</li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2505902"></a>4.2.3. Comment header</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id320370"></a>4.2.3. Comment header</h4></div></div></div><p>
 Comment header decode and data specification is covered in
-<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2505916"></a>4.2.4. Setup header</h4></div></div></div><p>
+<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id320384"></a>4.2.4. Setup header</h4></div></div></div><p>
 Vorbis codec setup is configurable to an extreme degree:
 
 </p><div class="mediaobject"><img src="components.png" alt="[decoder pipeline configuration]"></div><p>
@@ -908,13 +908,13 @@
 (placeholders in Vorbis I), floor configurations, residue
 configurations, channel mapping configurations and mode
 configurations. It finishes with a framing bit of '1'.  Header decode
-proceeds in the following order:</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2524640"></a>4.2.4.1. Codebooks</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_codebook_count]</code> = read eight bits as unsigned integer and add one</li><li>Decode <code class="varname">[vorbis_codebook_count]</code> codebooks in order as defined
+proceeds in the following order:</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id305504"></a>4.2.4.1. Codebooks</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_codebook_count]</code> = read eight bits as unsigned integer and add one</li><li>Decode <code class="varname">[vorbis_codebook_count]</code> codebooks in order as defined
 in <a href="#vorbis-spec-codebook" title="3. Probability Model and Codebooks">Section 3, &#8220;Probability Model and Codebooks&#8221;</a>.  Save each configuration, in
 order, in an array of
-codebook configurations <code class="varname">[vorbis_codebook_configurations]</code>.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2524679"></a>4.2.4.2. Time domain transforms</h5></div></div></div><p>
+codebook configurations <code class="varname">[vorbis_codebook_configurations]</code>.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id305539"></a>4.2.4.2. Time domain transforms</h5></div></div></div><p>
 These hooks are placeholders in Vorbis I.  Nevertheless, the
 configuration placeholder values must be read to maintain bitstream
-sync.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_time_count]</code> = read 6 bits as unsigned integer and add one</li><li>read <code class="varname">[vorbis_time_count]</code> 16 bit values; each value should be zero.  If any value is nonzero, this is an error condition and the stream is undecodable.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2524718"></a>4.2.4.3. Floors</h5></div></div></div><p>
+sync.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_time_count]</code> = read 6 bits as unsigned integer and add one</li><li>read <code class="varname">[vorbis_time_count]</code> 16 bit values; each value should be zero.  If any value is nonzero, this is an error condition and the stream is undecodable.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id328542"></a>4.2.4.3. Floors</h5></div></div></div><p>
 Vorbis uses two floor types; header decode is handed to the decode
 abstraction of the appropriate type.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_floor_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each <code class="varname">[i]</code> of <code class="varname">[vorbis_floor_count]</code> floor numbers:
   </p><div class="orderedlist"><ol type="a"><li>read the floor type: vector <code class="varname">[vorbis_floor_types]</code> element <code class="varname">[i]</code> =
@@ -923,13 +923,13 @@
 this
 configuration in slot <code class="varname">[i]</code> of the floor configuration array <code class="varname">[vorbis_floor_configurations]</code>.</li><li>If the floor type is one,
 decode the floor configuration as defined in <a href="#vorbis-spec-floor1" title="7. Floor type 1 setup and decode">Section 7, &#8220;Floor type 1 setup and decode&#8221;</a>; save this configuration in slot <code class="varname">[i]</code> of the floor configuration array <code class="varname">[vorbis_floor_configurations]</code>.</li><li>If the the floor type is greater than one, this stream is undecodable; ERROR CONDITION</li></ol></div><p>
- </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2510370"></a>4.2.4.4. Residues</h5></div></div></div><p>
+ </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id328635"></a>4.2.4.4. Residues</h5></div></div></div><p>
 Vorbis uses three residue types; header decode of each type is identical.
 </p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_residue_count]</code> = read 6 bits as unsigned integer and add one
 </li><li><p>For each of <code class="varname">[vorbis_residue_count]</code> residue numbers:
  </p><div class="orderedlist"><ol type="a"><li>read the residue type; vector <code class="varname">[vorbis_residue_types]</code> element <code class="varname">[i]</code> = read 16 bits as unsigned integer</li><li>If the residue type is zero,
 one or two, decode the residue configuration as defined in <a href="#vorbis-spec-residue" title="8. Residue setup and decode">Section 8, &#8220;Residue setup and decode&#8221;</a>; save this configuration in slot <code class="varname">[i]</code> of the residue configuration array <code class="varname">[vorbis_residue_configurations]</code>.</li><li>If the the residue type is greater than two, this stream is undecodable; ERROR CONDITION</li></ol></div><p>
-</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2510452"></a>4.2.4.5. Mappings</h5></div></div></div><p>
+</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id275059"></a>4.2.4.5. Mappings</h5></div></div></div><p>
 Mappings are used to set up specific pipelines for encoding
 multichannel audio with varying channel mapping applications. Vorbis I
 uses a single mapping type (0), with implicit PCM channel mappings.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_mapping_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each <code class="varname">[i]</code> of <code class="varname">[vorbis_mapping_count]</code> mapping numbers:
@@ -943,19 +943,19 @@
                </p></li></ol></div><p>
            </p></li><li>if unset, <code class="varname">[vorbis_mapping_coupling_steps]</code> = 0</li></ol></div><p>
        </p></li><li>read 2 bits (reserved field); if the value is nonzero, the stream is undecodable</li><li><p>if <code class="varname">[vorbis_mapping_submaps]</code> is greater than one, we read channel multiplex settings. For each <code class="varname">[j]</code> of <code class="varname">[audio_channels]</code> channels:</p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> = read 4 bits as unsigned integer</li><li>if the value is greater than the highest numbered submap (<code class="varname">[vorbis_mapping_submaps]</code> - 1), this in an error condition rendering the stream undecodable</li></ol></div></li><li><p>for each submap <code class="varname">[j]</code> of <code class="varname">[vorbis_mapping_submaps]</code> submaps, read the floor and residue numbers for use in decoding that submap:</p><div class="orderedlist"><ol type="A"><li>read and discard 8 bits (the unused time con
 figuration placeholder)</li><li>read 8 bits as unsigned integer for the floor number; save in vector <code class="varname">[vorbis_mapping_submap_floor]</code> element <code class="varname">[j]</code></li><li>verify the floor number is not greater than the highest number floor configured for the bitstream. If it is, the bitstream is undecodable</li><li>read 8 bits as unsigned integer for the residue number; save in vector <code class="varname">[vorbis_mapping_submap_residue]</code> element <code class="varname">[j]</code></li><li>verify the residue number is not greater than the highest number residue configured for the bitstream.  If it is, the bitstream is undecodable</li></ol></div></li><li>save this mapping configuration in slot <code class="varname">[i]</code> of the mapping configuration array <code class="varname">[vorbis_mapping_configurations]</code>.</li></ol></div></li></ol></div><p>
- </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2528009"></a>4.2.4.6. Modes</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_mode_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each of <code class="varname">[vorbis_mode_count]</code> mode numbers:</p><div class="orderedlist"><ol type="a"><li><code class="varname">[vorbis_mode_blockflag]</code> = read 1 bit</li><li><code class="varname">[vorbis_mode_windowtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_transformtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_mapping]</code> = read 8 bits as unsigned integer</li><li>verify ranges; zero is the only legal value in Vorbis I for
+ </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id342611"></a>4.2.4.6. Modes</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_mode_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each of <code class="varname">[vorbis_mode_count]</code> mode numbers:</p><div class="orderedlist"><ol type="a"><li><code class="varname">[vorbis_mode_blockflag]</code> = read 1 bit</li><li><code class="varname">[vorbis_mode_windowtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_transformtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_mapping]</code> = read 8 bits as unsigned integer</li><li>verify ranges; zero is the only legal value in Vorbis I for
 <code class="varname">[vorbis_mode_windowtype]</code>
 and <code class="varname">[vorbis_mode_transformtype]</code>.  <code class="varname">[vorbis_mode_mapping]</code> must not be greater than the highest number mapping in use.  Any illegal values render the stream undecodable.</li><li>save this mode configuration in slot <code class="varname">[i]</code> of the mode configuration array
 <code class="varname">[vorbis_mode_configurations]</code>.</li></ol></div></li><li>read 1 bit as a framing flag.  If unset, a framing error occurred and the stream is not
 decodable.</li></ol></div><p>
 After reading mode descriptions, setup header decode is complete.
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2545699"></a>4.3. Audio packet decode and synthesis</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id342709"></a>4.3. Audio packet decode and synthesis</h3></div></div></div><p>
 Following the three header packets, all packets in a Vorbis I stream
 are audio.  The first step of audio packet decode is to read and
 verify the packet type. <span class="emphasis"><em>A non-audio packet when audio is expected
 indicates stream corruption or a non-compliant stream. The decoder
 must ignore the packet and not attempt decoding it to audio</em></span>.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2545717"></a>4.3.1. packet type, mode and window decode</h4></div></div></div><div class="orderedlist"><ol type="1"><li>read 1 bit <code class="varname">[packet_type]</code>; check that packet type is 0 (audio)</li><li>read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([vorbis_mode_count]-1) bits
+</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342724"></a>4.3.1. packet type, mode and window decode</h4></div></div></div><div class="orderedlist"><ol type="1"><li>read 1 bit <code class="varname">[packet_type]</code>; check that packet type is 0 (audio)</li><li>read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([vorbis_mode_count]-1) bits
 <code class="varname">[mode_number]</code></li><li>decode blocksize <code class="varname">[n]</code> is equal to <code class="varname">[blocksize_0]</code> if 
 <code class="varname">[vorbis_mode_blockflag]</code> is 0, else <code class="varname">[n]</code> is equal to <code class="varname">[blocksize_1]</code>.</li><li><p>perform window selection and setup; this window is used later by the inverse MDCT:</p><div class="orderedlist"><ol type="a"><li><p>if this is a long window (the <code class="varname">[vorbis_mode_blockflag]</code> flag of this mode is
 set):</p><div class="orderedlist"><ol type="i"><li>read 1 bit for <code class="varname">[previous_window_flag]</code></li><li>read 1 bit for <code class="varname">[next_window_flag]</code></li><li>if <code class="varname">[previous_window_flag]</code> is not set, the left half
@@ -991,7 +991,7 @@
 An end-of-packet condition up to this point should be considered an
 error that discards this packet from the stream.  An end of packet
 condition past this point is to be considered a possible nominal
-occurrence.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546181"></a>4.3.2. floor curve decode</h4></div></div></div><p>
+occurrence.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343132"></a>4.3.2. floor curve decode</h4></div></div></div><p>
 From this point on, we assume out decode context is using mode number
 <code class="varname">[mode_number]</code> from configuration array
 <code class="varname">[vorbis_mode_configurations]</code> and the map number
@@ -1013,7 +1013,7 @@
 </p><p>
 An end-of-packet condition during floor decode shall result in packet
 decode zeroing all channel output vectors and skipping to the
-add/overlap output stage.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546321"></a>4.3.3. nonzero vector propagate</h4></div></div></div><p>
+add/overlap output stage.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343249"></a>4.3.3. nonzero vector propagate</h4></div></div></div><p>
 A possible result of floor decode is that a specific vector is marked
 'unused' which indicates that that final output vector is all-zero
 values (and the floor is zero).  The residue for that vector is not
@@ -1029,13 +1029,13 @@
 are set to false, then both must be set to false.  Note that an 'unused' 
 floor has no decoded floor information; it is important that this is 
 remembered at floor curve synthesis time.</li></ol></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546383"></a>4.3.4. residue decode</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343299"></a>4.3.4. residue decode</h4></div></div></div><p>
 Unlike floors, which are decoded in channel order, the residue vectors
 are decoded in submap order.</p><p>
 for each submap <code class="varname">[i]</code> in order from 0 ... <code class="varname">[vorbis_mapping_submaps]</code>-1</p><div class="orderedlist"><ol type="1"><li><code class="varname">[ch]</code> = 0</li><li><p>for each channel <code class="varname">[j]</code> in order from 0 ... <code class="varname">[audio_channels]</code> - 1</p><div class="orderedlist"><ol type="a"><li><p>if channel <code class="varname">[j]</code> in submap <code class="varname">[i]</code> (vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> is equal to <code class="varname">[i]</code>)</p><div class="orderedlist"><ol type="i"><li><p>if vector <code class="varname">[no_residue]</code> element <code class="varname">[j]</code> is true
       </p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[do_not_decode_flag]</code> element <code class="varname">[ch]</code> is set</li></ol></div><p>
      else
-      </p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[do_not_decode_flag]</code> element <code class="varname">[ch]</code> is unset</li></ol></div></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li><li><code class="varname">[residue_number]</code> = vector <code class="varname">[vorbis_mapping_submap_residue]</code> element <code class="varname">[i]</code></li><li><code class="varname">[residue_type]</code> = vector <code class="varname">[vorbis_residue_types]</code> element <code class="varname">[residue_number]</code></li><li>decode <code class="varname">[ch]</code> vectors using residue <code class="varname">[residue_number]</code>, according to type <code class="varname">[residue_type]</code>, also passing vector <code class="varname">[do_not_decode_flag]</code> to indicate which vectors in the bundle should not be decoded. Correct per-vector decode length is <code class="varname">[n]</code>/2.</li><li><co
 de class="varname">[ch]</code> = 0</li><li><p>for each channel <code class="varname">[j]</code> in order from 0 ... <code class="varname">[audio_channels]</code></p><div class="orderedlist"><ol type="a"><li><p>if channel <code class="varname">[j]</code> is in submap <code class="varname">[i]</code> (vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> is equal to <code class="varname">[i]</code>)</p><div class="orderedlist"><ol type="i"><li>residue vector for channel <code class="varname">[j]</code> is set to decoded residue vector <code class="varname">[ch]</code></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546633"></a>4.3.5. inverse coupling</h4></div></div></div><p>
+      </p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[do_not_decode_flag]</code> element <code class="varname">[ch]</code> is unset</li></ol></div></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li><li><code class="varname">[residue_number]</code> = vector <code class="varname">[vorbis_mapping_submap_residue]</code> element <code class="varname">[i]</code></li><li><code class="varname">[residue_type]</code> = vector <code class="varname">[vorbis_residue_types]</code> element <code class="varname">[residue_number]</code></li><li>decode <code class="varname">[ch]</code> vectors using residue <code class="varname">[residue_number]</code>, according to type <code class="varname">[residue_type]</code>, also passing vector <code class="varname">[do_not_decode_flag]</code> to indicate which vectors in the bundle should not be decoded. Correct per-vector decode length is <code class="varname">[n]</code>/2.</li><li><co
 de class="varname">[ch]</code> = 0</li><li><p>for each channel <code class="varname">[j]</code> in order from 0 ... <code class="varname">[audio_channels]</code></p><div class="orderedlist"><ol type="a"><li><p>if channel <code class="varname">[j]</code> is in submap <code class="varname">[i]</code> (vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> is equal to <code class="varname">[i]</code>)</p><div class="orderedlist"><ol type="i"><li>residue vector for channel <code class="varname">[j]</code> is set to decoded residue vector <code class="varname">[ch]</code></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343545"></a>4.3.5. inverse coupling</h4></div></div></div><p>
 for each <code class="varname">[i]</code> from <code class="varname">[vorbis_mapping_coupling_steps]</code>-1 descending to 0
 
 </p><div class="orderedlist"><ol type="1"><li><code class="varname">[magnitude_vector]</code> = the residue vector for channel
@@ -1053,7 +1053,7 @@
       </p><div class="orderedlist"><ol type="A"><li><code class="varname">[new_A]</code> = <code class="varname">[M]</code></li><li><code class="varname">[new_M]</code> = <code class="varname">[M]</code>-<code class="varname">[A]</code></li></ol></div><p>
      </p></li></ol></div><p>
    </p></li><li>set scalar value <code class="varname">[M]</code> in vector <code class="varname">[magnitude_vector]</code> to <code class="varname">[new_M]</code></li><li>set scalar value <code class="varname">[A]</code> in vector <code class="varname">[angle_vector]</code> to <code class="varname">[new_A]</code></li></ol></div></li></ol></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546883"></a>4.3.6. dot product</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343790"></a>4.3.6. dot product</h4></div></div></div><p>
 For each channel, synthesize the floor curve from the decoded floor
 information, according to packet type. Note that the vector synthesis
 length for floor computation is <code class="varname">[n]</code>/2.</p><p>
@@ -1081,14 +1081,14 @@
 product must be able to handle an effective 48 bit times 24 bit
 multiplication.  This range may be achieved using large (64 bit or
 larger) integers, or implementing a movable binary point
-representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546936"></a>4.3.7. inverse MDCT</h4></div></div></div><p>
+representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343829"></a>4.3.7. inverse MDCT</h4></div></div></div><p>
 Convert the audio spectrum vector of each channel back into time
 domain PCM audio via an inverse Modified Discrete Cosine Transform
 (MDCT).  A detailed description of the MDCT is available in the paper
 <a href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" target="_top">&#8220;<span class="citetitle">The
 use of multirate filter banks for coding of high quality digital
 audio</span>&#8221;</a>, by T. Sporer, K. Brandenburg and B. Edler.  The window
-function used for the MDCT is the function described earlier.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2546961"></a>4.3.8. overlap_add</h4></div></div></div><p>
+function used for the MDCT is the function described earlier.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343850"></a>4.3.8. overlap_add</h4></div></div></div><p>
 Windowed MDCT output is overlapped and added with the right hand data
 of the previous window such that the 3/4 point of the previous window
 is aligned with the 1/4 point of the current window (as illustrated in
@@ -1112,7 +1112,7 @@
 Data is not returned from the first frame; it must be used to 'prime'
 the decode engine.  The encoder accounts for this priming when
 calculating PCM offsets; after the first frame, the proper PCM output
-offset is '0' (as no data has been returned yet).</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2547004"></a>4.3.9. output channel order</h4></div></div></div><p>
+offset is '0' (as no data has been returned yet).</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343883"></a>4.3.9. output channel order</h4></div></div></div><p>
 Vorbis I specifies only a channel mapping type 0.  In mapping type 0,
 channel mapping is implicitly defined as follows for standard audio
 applications:</p><div class="variablelist"><dl><dt><span class="term">one channel</span></dt><dd>the stream is monophonic</dd><dt><span class="term">two channels</span></dt><dd>the stream is stereo.  channel order: left, right</dd><dt><span class="term">three channels</span></dt><dd>the stream is a 1d-surround encoding.  channel order: left,
@@ -1124,8 +1124,8 @@
 mapping as seen fit.  Future channel mappings (such as three and four
 channel <a href="http://www.ambisonic.net/" target="_top">Ambisonics</a>) will
 make use of channel mappings other than mapping 0.</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-comment"></a>5. comment field and header specification</h2></div><div><p class="releaseinfo">
- $Id: 05-comment.xml 10465 2005-11-28 00:33:05Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541891"></a>5.1. Overview</h3></div></div></div><p>The Vorbis text comment header is the second (of three) header
+ $Id: 05-comment.xml 11703 2006-07-17 16:33:17Z giles $
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id314030"></a>5.1. Overview</h3></div></div></div><p>The Vorbis text comment header is the second (of three) header
 packets that begin a Vorbis bitstream. It is meant for short text
 comments, not arbitrary metadata; arbitrary metadata belongs in a
 separate logical bitstream (usually an XML stream type) that provides
@@ -1138,7 +1138,7 @@
 
 </p><div class="blockquote"><blockquote class="blockquote"><p>Honest Bob and the Factory-to-Dealer-Incentives, <em class="citetitle">I'm Still
 Around</em>, opening for Moxy Früvous, 1997.</p></blockquote></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541925"></a>5.2. Comment encoding</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2541929"></a>5.2.1. Structure</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id314058"></a>5.2. Comment encoding</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id322574"></a>5.2.1. Structure</h4></div></div></div><p>
 The comment header is logically a list of eight-bit-clean vectors; the
 number of vectors is bounded to 2^32-1 and the length of each vector
 is limited to 2^32-1 bytes. The vector length is encoded; the vector
@@ -1159,7 +1159,7 @@
   8) if ( [framing_bit] unset or end-of-packet ) then ERROR
   9) done.
 </pre><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2498376"></a>5.2.2. Content vector format</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326883"></a>5.2.2. Content vector format</h4></div></div></div><p>
 The comment vectors are structured similarly to a UNIX environment variable.
 That is, comment fields consist of a field name and a corresponding value and
 look like:</p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">
@@ -1176,7 +1176,7 @@
 </p><p>
 0x3D is followed by 8 bit clean UTF-8 encoded value of the
 field contents to the end of the field.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2529464"></a>5.2.2.1. Field names</h5></div></div></div><p>Below is a proposed, minimal list of standard field names with a
+</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id322620"></a>5.2.2.1. Field names</h5></div></div></div><p>Below is a proposed, minimal list of standard field names with a
 description of intended use.  No single or group of field names is
 mandatory; a comment header may contain one, all or none of the names
 in this list.</p><div class="variablelist"><dl><dt><span class="term">TITLE</span></dt><dd>Track/Work name</dd><dt><span class="term">VERSION</span></dt><dd>The version field may be used to
@@ -1202,13 +1202,13 @@
 </dd><dt><span class="term">LOCATION</span></dt><dd>Location where track was recorded
 </dd><dt><span class="term">CONTACT</span></dt><dd>Contact information for the creators or distributors of the track. This could be a URL, an email address, the physical address of the producing label.
 </dd><dt><span class="term">ISRC</span></dt><dd>International Standard Recording Code for the
-track; see <a href="http://www.ifpi.org/site-content/online/isrc_intro.html" target="_top">the ISRC
+track; see <a href="http://www.ifpi.org/isrc/" target="_top">the ISRC
 intro page</a> for more information on ISRC numbers.
-</dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id2527296"></a>5.2.2.2. Implications</h5></div></div></div><p>Field names should not be 'internationalized'; this is a
+</dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id306349"></a>5.2.2.2. Implications</h5></div></div></div><p>Field names should not be 'internationalized'; this is a
 concession to simplicity not an attempt to exclude the majority of
-the world that doesn't speak English. Field <span class="emphasis"><em>contents</em></span>
-however, use the UTF-8 character encoding to allow easy representation of any
-language.</p><p>We have the length of the entirety of the field and restrictions on
+the world that doesn't speak English. Field <span class="emphasis"><em>contents</em></span>,
+however, use the UTF-8 character encoding to allow easy representation 
+of any language.</p><p>We have the length of the entirety of the field and restrictions on
 the field name so that the field name is bounded in a known way. Thus
 we also have the length of the field contents.</p><p>Individual 'vendors' may use non-standard field names within
 reason. The proper use of comment fields should be clear through
@@ -1225,7 +1225,7 @@
 ARTIST=Sonny Stitt 
 </pre></blockquote></div><p>
 
-</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2525558"></a>5.2.3. Encoding</h4></div></div></div><p>
+</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id306394"></a>5.2.3. Encoding</h4></div></div></div><p>
 The comment header comprises the entirety of the second bitstream
 header packet.  Unlike the first bitstream header packet, it is not
 generally the only packet on the second page and may not be restricted
@@ -1255,17 +1255,17 @@
 This is actually somewhat easier to describe in code; implementation of the above can be found in <code class="filename">vorbis/lib/info.c</code>, <code class="function">_vorbis_pack_comment()</code> and <code class="function">_vorbis_unpack_comment()</code>.
 </p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-floor0"></a>6. Floor type 0 setup and decode</h2></div><div><p class="releaseinfo">
   $Id: 06-floor0.xml 10424 2005-11-23 08:44:18Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2512128"></a>6.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id336814"></a>6.1. Overview</h3></div></div></div><p>
 Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately
 known as Line Spectral Frequency or LSF) representation to encode a
 smooth spectral envelope curve as the frequency response of the LSP
 filter.  This representation is equivalent to a traditional all-pole
 infinite impulse response filter as would be used in linear predictive
 coding; LSP representation may be converted to LPC representation and
-vice-versa.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2505686"></a>6.2. Floor 0 format</h3></div></div></div><p>
+vice-versa.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id321046"></a>6.2. Floor 0 format</h3></div></div></div><p>
 Floor zero configuration consists of six integer fields and a list of
 VQ codebooks for use in coding/decoding the LSP filter coefficient
-values used by each frame. </p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2515774"></a>6.2.1. header decode</h4></div></div></div><p>
+values used by each frame. </p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id313179"></a>6.2.1. header decode</h4></div></div></div><p>
 Configuration information for instances of floor zero decodes from the
 codec setup header (third packet).  configuration decode proceeds as
 follows:</p><pre class="screen">
@@ -1351,12 +1351,12 @@
      </p><div class="informalequation"><div class="mediaobject"><img src="floorval.png" alt="[expression for floorval]"></div></div><p>
  </p></li><li><code class="varname">[iteration_condition]</code> = map element <code class="varname">[i]</code></li><li><code class="varname">[output]</code> element <code class="varname">[i]</code> = <code class="varname">[linear_floor_value]</code></li><li>increment <code class="varname">[i]</code></li><li>if ( map element <code class="varname">[i]</code> is equal to <code class="varname">[iteration_condition]</code> ) continue at step 5</li><li>if ( <code class="varname">[i]</code> is less than <code class="varname">[n]</code> ) continue at step 2</li><li>done</li></ol></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-floor1"></a>7. Floor type 1 setup and decode</h2></div><div><p class="releaseinfo">
  $Id: 07-floor1.xml 10466 2005-11-28 00:34:44Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541060"></a>7.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id336243"></a>7.1. Overview</h3></div></div></div><p>
 Vorbis floor type one uses a piecewise straight-line representation to
 encode a spectral envelope curve. The representation plots this curve
 mechanically on a linear frequency axis and a logarithmic (dB)
 amplitude axis. The integer plotting algorithm used is similar to
-Bresenham's algorithm.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2540135"></a>7.2. Floor 1 format</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2451267"></a>7.2.1. model</h4></div></div></div><p>
+Bresenham's algorithm.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id334800"></a>7.2. Floor 1 format</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id316161"></a>7.2.1. model</h4></div></div></div><p>
 Floor type one represents a spectral curve as a series of
 line segments.  Synthesis constructs a floor curve using iterative
 prediction in a process roughly equivalent to the following simplified
@@ -1392,7 +1392,7 @@
 behavior is used for actual decode, as described later.  The actual
 algorithm splits Y value computation and line plotting into two steps
 with modifications to the above algorithm to eliminate noise
-accumulation through integer roundoff/truncation. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2516615"></a>7.2.2. header decode</h4></div></div></div><p>
+accumulation through integer roundoff/truncation. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317351"></a>7.2.2. header decode</h4></div></div></div><p>
 A list of floor X values is stored in the packet header in interleaved
 format (used in list order during packet decode and synthesis).  This
 list is split into partitions, and each partition is assigned to a
@@ -1524,7 +1524,7 @@
 Although some aspects of the below algorithm look like inconsequential
 optimizations, implementors are warned to follow the details closely.
 Deviation from implementing a strictly equivalent algorithm can result
-in serious decoding errors.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id2521765"></a>7.2.2.2.1. step 1: amplitude value synthesis</h6></div></div></div><p>
+in serious decoding errors.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id326536"></a>7.2.2.2.1. step 1: amplitude value synthesis</h6></div></div></div><p>
 Unwrap the always-positive-or-zero values read from the packet into
 +/- difference values, then apply to line prediction.</p><pre class="screen">
   1) [range] = vector { 256, 128, 86, 64 } element ([floor1_multiplier]-1)
@@ -1600,7 +1600,7 @@
 
  29) done
 
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id2521846"></a>7.2.2.2.2. step 2: curve synthesis</h6></div></div></div><p>
+</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id326571"></a>7.2.2.2.2. step 2: curve synthesis</h6></div></div></div><p>
 Curve synthesis generates a return vector <code class="varname">[floor]</code> of length
 <code class="varname">[n]</code> (where <code class="varname">[n]</code> is provided by the decode process
 calling to floor decode).  Floor 1 curve synthesis makes use of the
@@ -1650,8 +1650,8 @@
  16) done
 
 </pre></div></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-residue"></a>8. Residue setup and decode</h2></div><div><p class="releaseinfo">
-  $Id: 08-residue.xml 10466 2005-11-28 00:34:44Z giles $
- </p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2524422"></a>8.1. Overview</h3></div></div></div><p>
+  $Id: 08-residue.xml 13159 2007-06-21 05:22:35Z xiphmont $
+ </p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id320982"></a>8.1. Overview</h3></div></div></div><p>
 A residue vector represents the fine detail of the audio spectrum of
 one channel in an audio frame after the encoder subtracts the floor
 curve and performs any channel coupling.  A residue vector may
@@ -1662,7 +1662,7 @@
 residue vectors into the bitstream packet, and then reconstructs the
 vectors during decode.  Vorbis makes use of three different encoding
 variants (numbered 0, 1 and 2) of the same basic vector encoding
-abstraction.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2517330"></a>8.2. Residue format</h3></div></div></div><p>
+abstraction.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id307154"></a>8.2. Residue format</h3></div></div></div><p>
 Residue format partitions each vector in the vector bundle into chunks,
 classifies each chunk, encodes the chunk classifications and finally
 encodes the chunks themselves using the the specific VQ arrangement
@@ -1697,7 +1697,7 @@
 from multiple decode passes.  The classification value associated with
 a partition is the same in each pass, thus the classification codeword
 is coded only in the first pass.</p></li></ul></div><p>
-</p><div class="mediaobject"><img src="residue-pack.png" alt="[illustration of residue vector format]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2506346"></a>8.3. residue 0</h3></div></div></div><p>
+</p><div class="mediaobject"><img src="residue-pack.png" alt="[illustration of residue vector format]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326310"></a>8.3. residue 0</h3></div></div></div><p>
 Residue 0 and 1 differ only in the way the values within a residue
 partition are interleaved during partition encoding (visually treated
 as a black box--or cyan box or brown box--in the above figure).</p><p>
@@ -1721,7 +1721,7 @@
 
 </pre><p>
 It is worth mentioning at this point that no configurable value in the
-residue coding setup is restricted to a power of two.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2517602"></a>8.4. residue 1</h3></div></div></div><p>
+residue coding setup is restricted to a power of two.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326344"></a>8.4. residue 1</h3></div></div></div><p>
 Residue 1 does not interleave VQ encoding.  It represents partition
 vector scalars in order.  As with residue 0, however, partition length
 must be an integer multiple of the codebook dimension, although
@@ -1739,14 +1739,14 @@
 
 codebook dimensions = 1  encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ]
 
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2517633"></a>8.5. residue 2</h3></div></div></div><p>
+</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id334893"></a>8.5. residue 2</h3></div></div></div><p>
 Residue type two can be thought of as a variant of residue type 1.
 Rather than encoding multiple passed-in vectors as in residue type 1,
 the <span class="emphasis"><em>ch</em></span> passed in vectors of length <span class="emphasis"><em>n</em></span> are first
 interleaved and flattened into a single vector of length
 <span class="emphasis"><em>ch</em></span>*<span class="emphasis"><em>n</em></span>.  Encoding then proceeds as in type 1. Decoding is
 as in type 1 with decode interleave reversed. If operating on a single
-vector to begin with, residue type 1 and type 2 are equivalent.</p><div class="mediaobject"><img src="residue2.png" alt="[illustration of residue type 2]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2538870"></a>8.6. Residue decode</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2538876"></a>8.6.1. header decode</h4></div></div></div><p>
+vector to begin with, residue type 1 and type 2 are equivalent.</p><div class="mediaobject"><img src="residue2.png" alt="[illustration of residue type 2]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id334939"></a>8.6. Residue decode</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id334945"></a>8.6.1. header decode</h4></div></div></div><p>
 Header decode for all three residue types is identical.</p><pre class="programlisting">
   1) [residue_begin] = read 24 bits as unsigned integer
   2) [residue_end] = read 24 bits as unsigned integer
@@ -1807,7 +1807,7 @@
 An end-of-packet condition at any point in header decode renders the
 stream undecodable.  In addition, any codebook number greater than the
 maximum numbered codebook set up in this stream also renders the
-stream undecodable.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2538992"></a>8.6.2. packet decode</h4></div></div></div><p>
+stream undecodable.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id325037"></a>8.6.2. packet decode</h4></div></div></div><p>
 Format 0 and 1 packet decode is identical except for specific
 partition interleave.  Format 2 packet decode can be built out of the
 format 1 decode process.  Thus we describe first the decode
@@ -1818,32 +1818,52 @@
 passed in number of vectors is 3 and vector number 1 is marked 'do not
 decode', decode skips vector 1 during the decode loop.  However, even
 'do not decode' vectors are allocated and zeroed.</p><p>
+Depending on the values of <code class="varname">[residue_begin]</code> and
+<code class="varname">[residue_end]</code>, it is obvious that the encoded
+portion of a residue vector may be the entire possible residue vector
+or some other strict subset of the actual residue vector size with
+zero padding at either uncoded end.  However, it is also possible to
+set <code class="varname">[residue_begin]</code> and
+<code class="varname">[residue_end]</code> to specify a range partially or
+wholly beyond the maximum vector size.  Before beginning residue
+decode, limit <code class="varname">[residue_begin]</code> and
+<code class="varname">[residue_end]</code> to the maximum possible vector size
+as follows.  We assume that the number of vectors being encoded,
+<code class="varname">[ch]</code> is provided by the higher level decoding
+process.</p><pre class="programlisting">
+  1) [actual_size] = current blocksize/2;
+  2) if residue encoding is format 2
+       3) [actual_size] = [actual_size] * [ch];
+  4) [limit_residue_begin] = maximum of ([residue_begin],[actual_size]);
+  5) [limit_residue_end] = maximum of ([residue_end],[actual_size]);
+</pre><p>
 The following convenience values are conceptually useful to clarifying
 the decode process:</p><pre class="programlisting">
   1) [classwords_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook]
-  2) [n_to_read] = [residue_end] - [residue_begin]
+  2) [n_to_read] = [limit_residue_end] - [limit_residue_begin]
   3) [partitions_to_read] = [n_to_read] / [residue_partition_size]
 </pre><p>
-Packet decode proceeds as follows, matching the description offered earlier in the document.  We assume that the number of vectors being encoded, <code class="varname">[ch]</code> is provided by the higher level decoding process.</p><pre class="programlisting">
+Packet decode proceeds as follows, matching the description offered earlier in the document. </p><pre class="programlisting">
   1) allocate and zero all vectors that will be returned.
-  2) iterate [pass] over the range 0 ... 7 {
+  2) if ([n_to_read] is zero), stop; there is no residue to decode.
+  3) iterate [pass] over the range 0 ... 7 {
 
-       3) [partition_count] = 0
+       4) [partition_count] = 0
 
-       4) while [partition_count] is less than [partitions_to_read]
+       5) while [partition_count] is less than [partitions_to_read]
 
-            5) if ([pass] is zero) {
+            6) if ([pass] is zero) {
      
-                 6) iterate [j] over the range 0 .. [ch]-1 {
+                 7) iterate [j] over the range 0 .. [ch]-1 {
 
-                      7) if vector [j] is not marked 'do not decode' {
+                      8) if vector [j] is not marked 'do not decode' {
 
-                           8) [temp] = read from packet using codebook [residue_classbook] in scalar context
-                           9) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
+                           9) [temp] = read from packet using codebook [residue_classbook] in scalar context
+                          10) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
 
-                               10) array [classifications] element [j],([i]+[partition_count]) =
+                               11) array [classifications] element [j],([i]+[partition_count]) =
                                    [temp] integer modulo [residue_classifications]
-                               11) [temp] = [temp] / [residue_classifications] using integer division
+                               12) [temp] = [temp] / [residue_classifications] using integer division
 
                               }
       
@@ -1853,35 +1873,35 @@
           
                }
 
-           12) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] 
+           13) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] 
                is also less than [partitions_to_read] {
 
-                 13) iterate [j] over the range 0 .. [ch]-1 {
+                 14) iterate [j] over the range 0 .. [ch]-1 {
    
-                      14) if vector [j] is not marked 'do not decode' {
+                      15) if vector [j] is not marked 'do not decode' {
    
-                           15) [vqclass] = array [classifications] element [j],[partition_count]
-                           16) [vqbook] = array [residue_books] element [vqclass],[pass]
-                           17) if ([vqbook] is not 'unused') {
+                           16) [vqclass] = array [classifications] element [j],[partition_count]
+                           17) [vqbook] = array [residue_books] element [vqclass],[pass]
+                           18) if ([vqbook] is not 'unused') {
    
-                                18) decode partition into output vector number [j], starting at scalar 
-                                    offset [residue_begin]+[partition_count]*[residue_partition_size] using 
+                                19) decode partition into output vector number [j], starting at scalar 
+                                    offset [limit_residue_begin]+[partition_count]*[residue_partition_size] using 
                                     codebook number [vqbook] in VQ context
                           }
                      }
    
-                 19) increment [partition_count] by one
+                 20) increment [partition_count] by one
 
                }
           }
      }
  
- 20) done
+ 21) done
 
 </pre><p>
 An end-of-packet condition during packet decode is to be considered a
 nominal occurrence.  Decode returns the result of vector decode up to
-that point.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2498601"></a>8.6.3. format 0 specifics</h4></div></div></div><p>
+that point.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341700"></a>8.6.3. format 0 specifics</h4></div></div></div><p>
 Format zero decodes partitions exactly as described earlier in the
 'Residue Format: residue 0' section.  The following pseudocode
 presents the same algorithm. Assume:</p><p>
@@ -1903,7 +1923,7 @@
 
   6) done
 
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2498659"></a>8.6.4. format 1 specifics</h4></div></div></div><p>
+</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341754"></a>8.6.4. format 1 specifics</h4></div></div></div><p>
 Format 1 decodes partitions exactly as described earlier in the
 'Residue Format: residue 1' section.  The following pseudocode
 presents the same algorithm. Assume:</p><p>
@@ -1923,7 +1943,7 @@
  
   6) if ( [i] is less than [n] ) continue at step 2
   7) done
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2498716"></a>8.6.5. format 2 specifics</h4></div></div></div><p>
+</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341807"></a>8.6.5. format 2 specifics</h4></div></div></div><p>
 Format 2 is reducible to format 1.  It may be implemented as an additional step prior to and an additional post-decode step after a normal format 1 decode.
 </p><p>
 Format 2 handles 'do not decode' vectors differently than residue 0 or
@@ -1946,11 +1966,11 @@
   </pre><p>
  </p></li></ol></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-helper"></a>9. Helper equations</h2></div><div><p class="releaseinfo">
  $Id: 09-helper.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2507758"></a>9.1. Overview</h3></div></div></div><p>
+</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id316603"></a>9.1. Overview</h3></div></div></div><p>
 The equations below are used in multiple places by the Vorbis codec
 specification.  Rather than cluttering up the main specification
 documents, they are defined here and referenced where appropriate.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2512257"></a>9.2. Functions</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-ilog"></a>9.2.1. ilog</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id317505"></a>9.2. Functions</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-ilog"></a>9.2.1. ilog</h4></div></div></div><p>
 The "ilog(x)" function returns the position number (1 through n) of the highest set bit in the two's complement integer value
 <code class="varname">[x]</code>.  Values of <code class="varname">[x]</code> less than zero are defined to return zero.</p><pre class="programlisting">
   1) [return_value] = 0;
@@ -2131,7 +2151,7 @@
   0.50028648,    0.53279791,    0.56742212,    0.60429640, 
   0.64356699,    0.68538959,    0.72993007,    0.77736504, 
   0.82788260,    0.88168307,    0.9389798,     1.
-</pre></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-ogg"></a>A. Embedding Vorbis into an Ogg stream</h2><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2520211"></a>A.1. Overview</h3></div></div></div><p>
+</pre></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-ogg"></a>1. Embedding Vorbis into an Ogg stream</h2><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id319760"></a>1.1. Overview</h3></div></div></div><p>
 This document describes using Ogg logical and physical transport
 streams to encapsulate Vorbis compressed audio packet data into file
 form.</p><p>
@@ -2142,7 +2162,7 @@
 bitstream and framing spec</a> provide detailed descriptions of Ogg
 transport streams. This specification document assumes a working
 knowledge of the concepts covered in these named backround
-documents.  Please read them first.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2530380"></a>A.1.1. Restrictions</h4></div></div></div><p>
+documents.  Please read them first.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id336562"></a>1.1.1. Restrictions</h4></div></div></div><p>
 The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis
 streams use Ogg transport streams in degenerate, unmultiplexed
 form only. That is:
@@ -2165,11 +2185,11 @@
 specific support of Vorbis within a degenrate ogg stream (naturally,
 application authors are encouraged to support full multiplexed Ogg
 handling).
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2512176"></a>A.1.2. MIME type</h4></div></div></div><p>
+</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id330723"></a>1.1.2. MIME type</h4></div></div></div><p>
 The correct MIME type of any Ogg file is <code class="literal">application/ogg</code>.
 However, if a file is a Vorbis I audio file (which implies a
 degenerate Ogg stream including only unmultiplexed Vorbis audio), the
-mime type <code class="literal">audio/x-vorbis</code> is also allowed.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2520628"></a>A.2. Encapsulation</h3></div></div></div><p>
+mime type <code class="literal">audio/x-vorbis</code> is also allowed.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id328095"></a>1.2. Encapsulation</h3></div></div></div><p>
 Ogg encapsulation of a Vorbis packet stream is straightforward.</p><div class="itemizedlist"><ul type="disc"><li>
   The first Vorbis packet (the identification header), which
   uniquely identifies a stream as Vorbis audio, is placed alone in the
@@ -2241,14 +2261,14 @@
   between the actual available data returned and the declared amount
   indicates how many trailing samples to discard from the decoding
   process.
- </li></ul></div></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-rtp"></a>B. Vorbis encapsulation in RTP</h2><pre class="literallayout">
+ </li></ul></div></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-rtp"></a>2. Vorbis encapsulation in RTP</h2><pre class="literallayout">
 
 
 
     <p>Please consult the internet draft <em class="citetitle">RTP Payload Format for Vorbis Encoded
     Audio</em> for description of how to embed Vorbis audio in an RTP stream.</p>
   
-</pre></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="footer"></a>C. Colophon</h2><div class="mediaobject"><img src="white-xifish.png" alt="[Xiph.org logo]"></div><p>
+</pre></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="footer"></a>3. Colophon</h2><div class="mediaobject"><img src="white-xifish.png" alt="[Xiph.org logo]"></div><p>
 Ogg is a <a href="http://www.xiph.org/" target="_top">Xiph.org Foundation</a> effort
 to protect essential tenets of Internet multimedia from corporate
 hostage-taking; Open Source is the net's greatest tool to keep
@@ -2266,7 +2286,7 @@
 other licenses.</p><p>
 Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm)
 of the <a href="http://www.xiph.org/" target="_top">Xiph.org Foundation</a>.  These
-pages are copyright (C) 1994-2004 Xiph.org Foundation. All rights
+pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
 reserved.</p><p>
 This document is set in DocBook XML.
 </p></div></div></body></html>

Modified: branches/vorbis-aotuv/doc/Vorbis_I_spec.pdf
===================================================================
(Binary files differ)

Added: branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.txt
===================================================================
--- branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.txt	                        (rev 0)
+++ branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.txt	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,1401 @@
+
+
+
+AVT Working Group                                             L. Barbato
+Internet-Draft                                                  Xiph.Org
+Expires: December 27, 2007                                  Jun 25, 2007
+
+
+                      draft-ietf-avt-rtp-vorbis-06
+              RTP Payload Format for Vorbis Encoded Audio
+
+Status of this Memo
+
+   By submitting this Internet-Draft, each author represents that any
+   applicable patent or other IPR claims of which he or she is aware
+   have been or will be disclosed, and any of which he or she becomes
+   aware will be disclosed, in accordance with Section 6 of BCP 79.
+
+   Internet-Drafts are working documents of the Internet Engineering
+   Task Force (IETF), its areas, and its working groups.  Note that
+   other groups may also distribute working documents as Internet-
+   Drafts.
+
+   Internet-Drafts are draft documents valid for a maximum of six months
+   and may be updated, replaced, or obsoleted by other documents at any
+   time.  It is inappropriate to use Internet-Drafts as reference
+   material or to cite them other than as "work in progress."
+
+   The list of current Internet-Drafts can be accessed at
+   http://www.ietf.org/ietf/1id-abstracts.txt.
+
+   The list of Internet-Draft Shadow Directories can be accessed at
+   http://www.ietf.org/shadow.html.
+
+   This Internet-Draft will expire on December 27, 2007.
+
+Copyright Notice
+
+   Copyright (C) The IETF Trust (2007).
+
+Abstract
+
+   This document describes an RTP payload format for transporting Vorbis
+   encoded audio.  It details the RTP encapsulation mechanism for raw
+   Vorbis data and details the delivery mechanisms for the decoder
+   probability model, referred to as a codebook and other setup
+   information.
+
+   Also included within this memo are media type registrations, and the
+   details necessary for the use of Vorbis with the Session Description
+   Protocol (SDP).
+
+
+
+Barbato                 Expires December 27, 2007               [Page 1]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+Editors Note
+
+   All references to RFC XXXX are to be replaced by references to the
+   RFC number of this memo, when published.
+
+
+Table of Contents
+
+   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
+     1.1.  Terminology  . . . . . . . . . . . . . . . . . . . . . . .  3
+   2.  Payload Format . . . . . . . . . . . . . . . . . . . . . . . .  3
+     2.1.  RTP Header . . . . . . . . . . . . . . . . . . . . . . . .  3
+     2.2.  Payload Header . . . . . . . . . . . . . . . . . . . . . .  5
+     2.3.  Payload Data . . . . . . . . . . . . . . . . . . . . . . .  6
+     2.4.  Example RTP Packet . . . . . . . . . . . . . . . . . . . .  7
+   3.  Configuration Headers  . . . . . . . . . . . . . . . . . . . .  8
+     3.1.  In-band Header Transmission  . . . . . . . . . . . . . . .  9
+       3.1.1.  Packed Configuration . . . . . . . . . . . . . . . . .  9
+     3.2.  Out of Band Transmission . . . . . . . . . . . . . . . . . 11
+       3.2.1.  Packed Headers . . . . . . . . . . . . . . . . . . . . 11
+     3.3.  Loss of Configuration Headers  . . . . . . . . . . . . . . 12
+   4.  Comment Headers  . . . . . . . . . . . . . . . . . . . . . . . 12
+   5.  Frame Packetization  . . . . . . . . . . . . . . . . . . . . . 13
+     5.1.  Example Fragmented Vorbis Packet . . . . . . . . . . . . . 14
+     5.2.  Packet Loss  . . . . . . . . . . . . . . . . . . . . . . . 16
+   6.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 17
+     6.1.  Packed Headers IANA Considerations . . . . . . . . . . . . 19
+   7.  SDP related considerations . . . . . . . . . . . . . . . . . . 20
+     7.1.  Mapping Media Type Parameters into SDP . . . . . . . . . . 20
+       7.1.1.  SDP Example  . . . . . . . . . . . . . . . . . . . . . 21
+     7.2.  Usage with the SDP Offer/Answer Model  . . . . . . . . . . 21
+   8.  Congestion Control . . . . . . . . . . . . . . . . . . . . . . 22
+   9.  Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
+     9.1.  Stream Radio . . . . . . . . . . . . . . . . . . . . . . . 22
+   10. Security Considerations  . . . . . . . . . . . . . . . . . . . 23
+   11. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 23
+   12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 23
+     12.1. Normative References . . . . . . . . . . . . . . . . . . . 23
+     12.2. Informative References . . . . . . . . . . . . . . . . . . 24
+   Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 24
+   Intellectual Property and Copyright Statements . . . . . . . . . . 25
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 2]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+1.  Introduction
+
+   Vorbis is a general purpose perceptual audio codec intended to allow
+   maximum encoder flexibility, thus allowing it to scale competitively
+   over an exceptionally wide range of bitrates.  At the high quality/
+   bitrate end of the scale (CD or DAT rate stereo, 16/24 bits), it is
+   in the same league as AAC.  Vorbis is also intended for lower and
+   higher sample rates (from 8kHz telephony to 192kHz digital masters)
+   and a range of channel representations (monaural, polyphonic, stereo,
+   quadraphonic, 5.1, ambisonic, or up to 255 discrete channels).
+
+   Vorbis encoded audio is generally encapsulated within an Ogg format
+   bitstream [11], which provides framing and synchronization.  For the
+   purposes of RTP transport, this layer is unnecessary, and so raw
+   Vorbis packets are used in the payload.
+
+1.1.  Terminology
+
+   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
+   document are to be interpreted as described in RFC 2119 [1].
+
+
+2.  Payload Format
+
+   For RTP based transport of Vorbis encoded audio the standard RTP
+   header is followed by a 4 octets payload header, then the payload
+   data.  The payload headers are used to associate the Vorbis data with
+   its associated decoding codebooks as well as indicating if the
+   following packet contains fragmented Vorbis data and/or the number of
+   whole Vorbis data frames.  The payload data contains the raw Vorbis
+   bitstream information.  There are 3 types of Vorbis payload data, an
+   RTP packet MUST contain just one of them at a time.
+
+2.1.  RTP Header
+
+   The format of the RTP header is specified in [2] and shown in Figure
+   Figure 1.  This payload format uses the fields of the header in a
+   manner consistent with that specification.
+
+
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 3]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |       sequence number         |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                           timestamp                           |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                           Figure 1: RTP Header
+
+   The RTP header begins with an octet of fields (V, P, X, and CC) to
+   support specialized RTP uses (see [2] and [3] for details).  For
+   Vorbis RTP, the following values are used.
+
+   Version (V): 2 bits
+
+   This field identifies the version of RTP.  The version used by this
+   specification is two (2).
+
+   Padding (P): 1 bit
+
+   Padding MAY be used with this payload format according to section 5.1
+   of [2].
+
+   Extension (X): 1 bit
+
+   The Extension bit is used in accordance with [2].
+
+   CSRC count (CC): 4 bits
+
+   The CSRC count is used in accordance with [2].
+
+   Marker (M): 1 bit
+
+   Set to zero.  Audio silence suppression not used.  This conforms to
+   section 4.1 of [13].
+
+   Payload Type (PT): 7 bits
+
+   An RTP profile for a class of applications is expected to assign a
+   payload type for this format, or a dynamically allocated payload type
+   SHOULD be chosen which designates the payload as Vorbis.
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 4]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   Sequence number: 16 bits
+
+   The sequence number increments by one for each RTP data packet sent,
+   and may be used by the receiver to detect packet loss and to restore
+   packet sequence.  This field is detailed further in [2].
+
+   Timestamp: 32 bits
+
+   A timestamp representing the sampling time of the first sample of the
+   first Vorbis packet in the RTP packet.  The clock frequency MUST be
+   set to the sample rate of the encoded audio data and is conveyed out-
+   of-band (e.g. as a SDP parameter).
+
+   SSRC/CSRC identifiers:
+
+   These two fields, 32 bits each with one SSRC field and a maximum of
+   16 CSRC fields, are as defined in [2].
+
+2.2.  Payload Header
+
+   The 4 octets following the RTP Header section are the Payload Header.
+   This header is split into a number of bitfields detailing the format
+   of the following payload data packets.
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                     Ident                     | F |VDT|# pkts.|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                         Figure 2: Payload Header
+
+   Ident: 24 bits
+
+   This 24 bit field is used to associate the Vorbis data to a decoding
+   Configuration.  It is stored as network byte order integer.
+
+   Fragment type (F): 2 bits
+
+   This field is set according to the following list
+
+      0 = Not Fragmented
+      1 = Start Fragment
+      2 = Continuation Fragment
+      3 = End Fragment
+
+   Vorbis Data Type (VDT): 2 bits
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 5]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   This field specifies the kind of Vorbis data stored in this RTP
+   packet.  There are currently three different types of Vorbis
+   payloads.  Each packet MUST contain only a single type of Vorbis
+   payload (e.g. you MUST not aggregate configuration and comment
+   payload in the same packet)
+
+      0 = Raw Vorbis payload
+      1 = Vorbis Packed Configuration payload
+      2 = Legacy Vorbis Comment payload
+      3 = Reserved
+
+   The packets with a VDT of value 3 MUST be ignored
+
+   The last 4 bits represent the number of complete packets in this
+   payload.  This provides for a maximum number of 15 Vorbis packets in
+   the payload.  If the packet contains fragmented data the number of
+   packets MUST be set to 0.
+
+2.3.  Payload Data
+
+   Raw Vorbis packets are currently unbounded in length, application
+   profiles will likely define a practical limit.  Typical Vorbis packet
+   sizes range from very small (2-3 bytes) to quite large (8-12
+   kilobytes).  The reference implementation [12] typically produces
+   packets less than ~800 bytes, except for the setup header packets
+   which are ~4-12 kilobytes.  Within an RTP context, to avoid
+   fragmentation, the Vorbis data packet size SHOULD be kept
+   sufficiently small so that after adding the RTP and payload headers,
+   the complete RTP packet is smaller than the path MTU.
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |            length             |       vorbis packet data     ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                       Figure 3: Payload Data Header
+
+   Each Vorbis payload packet starts with a two octet length header,
+   which is used to represent the size in bytes of the following data
+   payload, followed by the raw Vorbis data padded to the nearest byte
+   boundary, as explained by the vorbis specification [13].  The length
+   value is stored as network byte order integer.
+
+   For payloads which consist of multiple Vorbis packets the payload
+   data consists of the packet length followed by the packet data for
+   each of the Vorbis packets in the payload.
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 6]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   The Vorbis packet length header is the length of the Vorbis data
+   block only and does not count the length field.
+
+   The payload packing of the Vorbis data packets MUST follow the
+   guidelines set-out in [3] where the oldest packet occurs immediately
+   after the RTP packet header.  Subsequent packets, if any, MUST follow
+   in temporal order.
+
+   Channel mapping of the audio is in accordance with the Vorbis I
+   Specification [13].
+
+2.4.  Example RTP Packet
+
+   Here is an example RTP packet containing two Vorbis packets.
+
+   RTP Packet Header:
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      | 2 |0|0|  0    |0|      PT     |       sequence number         |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |               timestamp (in sample rate units)                |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronisation source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                     Ident                     | 0 | 0 | 2 pks |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |            length             |          vorbis data         ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        vorbis data                           |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |            length             |   next vorbis packet data    ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        vorbis data                          ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..               vorbis data                    |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                    Figure 4: Example Raw Vorbis Packet
+
+   The payload data section of the RTP packet begins with the 24 bit
+   Ident field followed by the one octet bitfield header, which has the
+   number of Vorbis frames set to 2.  Each of the Vorbis data frames is
+
+
+
+Barbato                 Expires December 27, 2007               [Page 7]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   prefixed by the two octets length field.  The Packet Type and
+   Fragment Type are set to 0.  The Configuration that will be used to
+   decode the packets is the one indexed by the ident value.
+
+
+3.  Configuration Headers
+
+   Unlike other mainstream audio codecs Vorbis has no statically
+   configured probability model.  Instead, it packs all entropy decoding
+   configuration, Vector Quantization and Huffman models into a data
+   block that must be transmitted to the decoder along with the
+   compressed data.  A decoder also requires information detailing the
+   number of audio channels, bitrates and similar information to
+   configure itself for a particular compressed data stream.  These two
+   blocks of information are often referred to collectively as the
+   "codebooks" for a Vorbis stream, and are nominally included as
+   special "header" packets at the start of the compressed data.  In
+   addition, the Vorbis I specification [13] requires the presence of a
+   comment header packet which gives simple metadata about the stream,
+   but this information is not required for decoding the frame sequence.
+
+   Thus these two codebook header packets must be received by the
+   decoder before any audio data can be interpreted.  These requirements
+   pose problems in RTP, which is often used over unreliable transports.
+
+   Since this information must be transmitted reliably and, as the RTP
+   stream may change certain configuration data mid-session, there are
+   different methods for delivering this configuration data to a client,
+   both in-band and out-of-band which is detailed below.  SDP delivery
+   is typically used to set up an initial state for the client
+   application.  The changes may be due to different codebooks as well
+   as different bitrates of the stream.
+
+   The delivery vectors in use can be specified by an SDP attribute to
+   indicate the method and the optional URI where the Vorbis Packed
+   Configuration (Section 3.1.1) Packets could be fetched.  Different
+   delivery methods MAY be advertised for the same session.  The in-band
+   Configuration delivery SHOULD be considered as baseline, out-of-band
+   delivery methods that don't use RTP will not be described in this
+   document.  For non chained streams, the Configuration recommended
+   delivery method is inline the Packed Configuration (Section 3.1.1) in
+   the SDP as explained in the IANA considerations (Section 7.1).
+
+   The 24 bit Ident field is used to map which Configuration will be
+   used to decode a packet.  When the Ident field changes, it indicates
+   that a change in the stream has taken place.  The client application
+   MUST have in advance the correct configuration and if the client
+   detects a change in the Ident value and does not have this
+
+
+
+Barbato                 Expires December 27, 2007               [Page 8]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   information it MUST NOT decode the raw Vorbis data associated until
+   it fetches the correct Configuration.
+
+3.1.  In-band Header Transmission
+
+   The Packed Configuration (Section 3.1.1) Payload is sent in-band with
+   the packet type bits set to match the Vorbis Data Type.  Clients MUST
+   be capable of dealing with fragmentation and periodic re-transmission
+   of the configuration headers.
+
+3.1.1.  Packed Configuration
+
+   A Vorbis Packed Configuration is indicated with the Vorbis Data Type
+   field set to 1.  Of the three headers defined in the Vorbis I
+   specification [13], the identification and the setup MUST be packed
+   as they are, while the comment header MAY be replaced with a dummy
+   one.  The packed configuration follows a generic way to store xiph
+   codec configurations: The first field stores the number of the
+   following packets minus one (count field), the next ones represent
+   the size of the headers (length fields), the headers immediately
+   follow the list of length fields.  The size of the last header is
+   implicit.  The count and the length fields are encoded using the
+   following logic: the data is in network order, every byte has the
+   most significant bit used as flag and the following 7 used to store
+   the value.  The first N bit are to be taken, where N is number of
+   bits representing the value modulo 7, and stored in the first byte.
+   If there are more bits, the flag bit is set to 1 and the subsequent
+   7bit are stored in the following byte, if there are remaining bits
+   set the flag to 1 and the same procedure is repeated.  The ending
+   byte has the flag bit set to 0.  In order to decode it is enough to
+   iterate over the bytes until the flag bit set to 0, for every byte
+   the data is added to the accumulated value multiplied by 128.  The
+   headers are packed in the same order they are present in ogg:
+   identification, comment, setup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007               [Page 9]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |             xxxx              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                             xxxxx                             |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                      Ident                    | 1 | 0 |      0|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           length              | n. of headers |    length1    |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |    length2    |                  Identification              ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        Identification                       ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        Identification                       ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        Identification                       ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..               Identification                 |    Comment   ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                            Comment                          ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                            Comment                          ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                            Comment                          ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..           Comment            |             Setup            ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                            Setup                            ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                            Setup                            ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                   Figure 5: Packed Configuration Figure
+
+   The Ident field is set with the value that will be used by the Raw
+   Payload Packets to address this Configuration.  The Fragment type is
+   set to 0 since the packet bears the full Packed configuration, the
+   number of packet is set to 1.
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 10]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+3.2.  Out of Band Transmission
+
+   This section, as stated above, does not cover all the possible out-
+   of-band delivery methods since they rely on different protocols and
+   are linked to specific applications.  The following packet definition
+   SHOULD be used in out-of-band delivery and MUST be used when
+   Configuration is inlined in the SDP.
+
+3.2.1.  Packed Headers
+
+   As mentioned above the RECOMMENDED delivery vector for Vorbis
+   configuration data is via a retrieval method that can be performed
+   using a reliable transport protocol.  As the RTP headers are not
+   required for this method of delivery the structure of the
+   configuration data is slightly different.  The packed header starts
+   with a 32 bit (network ordered) count field which details the number
+   of packed headers that are contained in the bundle.  Next is the
+   Packed header payload for each chained Vorbis stream.
+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                     Number of packed headers                  |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                          Packed header                        |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                          Packed header                        |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                     Figure 6: Packed Headers Overview
+
+   Since the Configuration Ident and the Identification Header are fixed
+   length there is only a 2 byte length tag to define the length of the
+   packed headers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 11]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                   Ident                       |    length    ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..              | n. of headers |    length1    |    length2   ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..              |             Identification Header            ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      .................................................................
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..              |         Comment Header                       ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      .................................................................
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        Comment Header                        |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                          Setup Header                        ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      .................................................................
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                         Setup Header                         |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                      Figure 7: Packed Headers Detail
+
+   The key difference between the in-band format and this one, is that
+   there is no need for the payload header octet.  In this figure the
+   comment has a size bigger than 127 bytes.
+
+3.3.  Loss of Configuration Headers
+
+   Unlike the loss of raw Vorbis payload data, loss of a configuration
+   header can lead to a situation where it will not be possible to
+   successfully decode the stream.
+
+   Loss of Configuration Packet results in the halting of stream
+   decoding.
+
+
+4.  Comment Headers
+
+   With the Vorbis Data Type flag set to 2, this indicates that the
+   packet contain the comment metadata, such as artist name, track title
+   and so on.  These metadata messages are not intended to be fully
+   descriptive but to offer basic track/song information.  Clients MAY
+   ignore it completely.  The details on the format of the comments can
+   be found in the Vorbis documentation [13].
+
+
+
+Barbato                 Expires December 27, 2007              [Page 12]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |             xxxx              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                             xxxxx                             |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                      Ident                    | 0 | 2 |      1|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |            length             |            Comment           ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                           Comment                           ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                           Comment                            |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                         Figure 8: Comment Packet
+
+   The 2 bytes length field is necessary since this packet could be
+   fragmented.
+
+
+5.  Frame Packetization
+
+   Each RTP packet contains either one Vorbis packet fragment, or an
+   integer number of complete Vorbis packets (up to a maximum of 15
+   packets, since the number of packets is defined by a 4 bit value).
+
+   Any Vorbis data packet that is less than path MTU SHOULD be bundled
+   in the RTP packet with as many Vorbis packets as will fit, up to a
+   maximum of 15, except when such bundling would exceed an
+   application's desired transmission latency.  Path MTU is detailed in
+   [6] and [7].
+
+   A fragmented packet has a zero in the last four bits of the payload
+   header.  The first fragment will set the Fragment type to 1.  Each
+   fragment after the first will set the Fragment type to 2 in the
+   payload header.  The RTP packet containing the last fragment of the
+   Vorbis packet will have the Fragment type set to 3.  To maintain the
+   correct sequence for fragmented packet reception the timestamp field
+   of fragmented packets MUST be the same as the first packet sent, with
+   the sequence number incremented as normal for the subsequent RTP
+
+
+
+Barbato                 Expires December 27, 2007              [Page 13]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   packets.  The length field shows the fragment length.
+
+5.1.  Example Fragmented Vorbis Packet
+
+   Here is an example fragmented Vorbis packet split over three RTP
+   packets.  Each packet contains the standard RTP headers as well as
+   the 4 octets Vorbis headers.
+
+      Packet 1:
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |           1000                |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                            12345                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                       Ident                   | 1 | 0 |      0|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |             length            |            vorbis data       ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        vorbis data                           |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+              Figure 9: Example Fragmented Packet (Packet 1)
+
+   In this packet the initial sequence number is 1000 and the timestamp
+   is 12345.  The Fragment type is set to 1, the number of packets field
+   is set to 0, and as the payload is raw Vorbis data the VDT field is
+   set to 0.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 14]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+      Packet 2:
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |           1001                |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                             12345                             |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                       Ident                   | 2 | 0 |      0|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |             length            |          vorbis data         ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        vorbis data                           |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+              Figure 10: Example Fragmented Packet (Packet 2)
+
+   The Fragment type field is set to 2 and the number of packets field
+   is set to 0.  For large Vorbis fragments there can be several of
+   these type of payload packets.  The maximum packet size SHOULD be no
+   greater than the path MTU, including all RTP and payload headers.
+   The sequence number has been incremented by one but the timestamp
+   field remains the same as the initial packet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 15]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+      Packet 3:
+
+       0                   1                   2                   3
+       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |V=2|P|X|  CC   |M|     PT      |           1002                |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                             12345                             |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |           synchronization source (SSRC) identifier            |
+      +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+      |            contributing source (CSRC) identifiers             |
+      |                              ...                              |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |                      Ident                    | 3 | 0 |      0|
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      |             length            |          vorbis data         ..
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+      ..                        vorbis data                           |
+      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+              Figure 11: Example Fragmented Packet (Packet 3)
+
+   This is the last Vorbis fragment packet.  The Fragment type is set to
+   3 and the packet count remains set to 0.  As in the previous packets
+   the timestamp remains set to the first packet in the sequence and the
+   sequence number has been incremented.
+
+5.2.  Packet Loss
+
+   As there is no error correction within the Vorbis stream, packet loss
+   will result in a loss of signal.  Packet loss is more of an issue for
+   fragmented Vorbis packets as the client will have to cope with the
+   handling of the Fragment Type.  In case of loss of fragments the
+   client MUST discard all the remaining fragments and decode the
+   incomplete packet.  If we use the fragmented Vorbis packet example
+   above and the first packet is lost the client MUST detect that the
+   next packet has the packet count field set to 0 and the Fragment type
+   2 and MUST drop it.  The next packet, which is the final fragmented
+   packet, MUST be dropped in the same manner.  If the missing packet is
+   the last, the received two fragments will be kept and the incomplete
+   vorbis packet decoded.
+
+   Loss of any of the Configuration fragment will result in the loss of
+   the full Configuration packet with the result detailed in the Loss of
+   Configuration Headers (Section 3.3) section.
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 16]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+6.  IANA Considerations
+
+   Type name:  audio
+
+   Subtype name:  vorbis
+
+   Required parameters:
+
+      rate:  indicates the RTP timestamp clock rate as described in RTP
+         Profile for Audio and Video Conferences with Minimal Control.
+         [3]
+
+      channels:  indicates the number of audio channels as described in
+         RTP Profile for Audio and Video Conferences with Minimal
+         Control. [3]
+
+      delivery-method:  indicates the delivery methods in use, the
+         possible values are: inline, in_band, out_band, MAY be included
+         multiple times
+
+      configuration:  the base64 [9] representation of the Packed
+         Headers (Section 3.2.1).  It MUST follow the associated
+         delivery-method parameter ("inline").
+
+   Optional parameters:
+
+      configuration-uri:  the URI [4] of the configuration headers in
+         case of out of band transmission.  In the form of
+         "protocol://path/to/resource/", depending on the specific
+         method, a single configuration packet could be retrived by its
+         Ident number, or multiple packets could be aggregated in a
+         single stream.  Such aggregates MAY be compressed using either
+         bzip2 [16] or gzip [14].  A sha1 [10] checksum MAY be provided
+         for aggregates.  In this latter case the URI will end with the
+         aggregate name, followed by its compressed extension if
+         applies, a "!" and the base64 [9] representation of the
+         sha1hash of the above mentioned compressed aggregated as in:
+         "protocol://path/to/resource/aggregated.bz2!sha1hash".  The
+         trailing '/' discriminates which of two methods are in use.
+         The configuration-uri MUST follow the associated delivery
+         method parameter ("out_band").  Non hierarchical protocols and
+         protocols using for special purposes the '!' separator MAY
+         point just to a resource aggregate using their specific syntax.
+
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 17]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   Encoding considerations:
+
+      This media type is framed and contains binary data.
+
+   Security considerations:
+
+      See Section 10 of RFC XXXX.
+
+   Interoperability considerations:
+
+      None
+
+   Published specification:
+
+      RFC XXXX [RFC Editor: please replace by the RFC number of this
+      memo, when published]
+
+      Ogg Vorbis I specification: Codec setup and packet decode.
+      Available from the Xiph website, http://www.xiph.org
+
+   Applications which use this media type:
+
+      Audio streaming and conferencing tools
+
+   Additional information:
+
+      None
+
+   Person & email address to contact for further information:
+
+      Luca Barbato: <lu_zero at gentoo.org> IETF Audio/Video Transport
+      Working Group
+
+   Intended usage:
+
+      COMMON
+
+   Restriction on usage:
+
+      This media type depends on RTP framing, and hence is only defined
+      for transfer via RTP [2]
+
+   Author:
+
+      Luca Barbato
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 18]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   Change controller:
+
+      IETF AVT Working Group delegated from the IESG
+
+
+6.1.  Packed Headers IANA Considerations
+
+   The following IANA considerations MUST only be applied to the packed
+   headers.
+
+   Type name:  audio
+
+   Subtype name:  vorbis-config
+
+   Required parameters:
+
+      None
+
+   Optional parameters:
+
+      None
+
+   Encoding considerations:
+
+      This media type contains binary data.
+
+   Security considerations:
+
+      See Section 10 of RFC XXXX.
+
+   Interoperability considerations:
+
+      None
+
+   Published specification:
+
+      RFC XXXX [RFC Editor: please replace by the RFC number of this
+      memo, when published]
+
+   Applications which use this media type:
+
+      Vorbis encoded audio, configuration data.
+
+   Additional information:
+
+      None
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 19]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   Person & email address to contact for further information:
+
+      Luca Barbato: <lu_zero at gentoo.org>
+      IETF Audio/Video Transport Working Group
+
+   Intended usage:  COMMON
+
+   Restriction on usage:
+
+      This media type doesn't depend on the transport.
+
+   Author:
+
+      Luca Barbato
+
+   Change controller:
+
+      IETF AVT Working Group delegated from the IESG
+
+
+7.  SDP related considerations
+
+   The following paragraphs defines the mapping of the parameters
+   described in the IANA considerations section and their usage in the
+   Offer/Answer Model [8].
+
+7.1.  Mapping Media Type Parameters into SDP
+
+   The information carried in the Media Type media type specification
+   has a specific mapping to fields in the Session Description Protocol
+   (SDP) [5], which is commonly used to describe RTP sessions.  When SDP
+   is used to specify sessions the mapping are as follows:
+
+   o  The type name ("audio") goes in SDP "m=" as the media name.
+
+   o  The subtype name ("vorbis") goes in SDP "a=rtpmap" as the encoding
+      name.
+
+   o  The parameter "rate" also goes in "a=rtpmap" as clock rate.
+
+   o  The parameter "channels" also goes in "a=rtpmap" as channel count.
+
+   o  The mandated parameters "delivery-method" and "configuration" MUST
+      be included in the SDP "a=fmtp" attribute.
+
+   o  The optional parameter "configuration-uri", when present, MUST be
+      included in the SDP "a=fmtp" attribute and MUST follow the
+      delivery-method that applies.
+
+
+
+Barbato                 Expires December 27, 2007              [Page 20]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+   If the stream comprises chained Vorbis files and all of them are
+   known in advance, the Configuration Packet for each file SHOULD be
+   passed to the client using the configuration attribute.
+
+   The URI specified in the configuration-uri attribute MUST point to a
+   location where all of the Configuration Packets needed for the life
+   of the session reside.
+
+   The port value is specified by the server application bound to the
+   address specified in the c= line.  The bitrate value and channels
+   specified in the rtpmap attribute MUST match the Vorbis sample rate
+   value.  An example is found below.
+
+7.1.1.  SDP Example
+
+   The following example shows a basic SDP single stream.  The first
+   configuration packet is inlined in the sdp, other configurations
+   could be fetched at any time from the first provided uri using or all
+   the known configuration could be downloaded using the second uri.
+   The inline base64 [9] configuration string is omitted because of the
+   length.
+      c=IN IP4 192.0.2.1
+      m=audio RTP/AVP 98
+      a=rtpmap:98 vorbis/44100/2
+      a=fmtp:98 delivery-method=inline; configuration=base64string;
+      delivery-method=out_band;
+      configuration-uri=rtsp://path/to/the/resource; delivery-
+      method=out_band; configuration-uri=http://another/path/to/
+      resource/aggregate.bz2!8b6237eb5154a0ea12811a94e8e2697b3312bc6c;
+
+   Note that the payload format (encoding) names are commonly shown in
+   upper case.  Media Type subtypes are commonly shown in lower case.
+   These names are case-insensitive in both places.  Similarly,
+   parameter names are case-insensitive both in Media Type types and in
+   the default mapping to the SDP a=fmtp attribute.  The exception
+   regarding case sensitivity is the configuration-uri URI which MUST be
+   regarded as being case sensitive.  The a=fmtp line is a single line
+   even if it is presented broken because of clarity.
+
+7.2.  Usage with the SDP Offer/Answer Model
+
+   The only paramenter negotiable is the delivery method.  All the
+   others are declarative: the offer, as described in An Offer/Answer
+   Model Session Description Protocol [8], may contain a large number of
+   delivery methods per single fmtp attribute, the answerer MUST remove
+   every delivery-method and configuration-uri not supported.  All the
+   parameters MUST not be altered on answer otherwise.
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 21]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+8.  Congestion Control
+
+   Vorbis clients SHOULD send regular receiver reports detailing
+   congestion.  A mechanism for dynamically downgrading the stream,
+   known as bitrate peeling, will allow for a graceful backing off of
+   the stream bitrate.  This feature is not available at present so an
+   alternative would be to redirect the client to a lower bitrate stream
+   if one is available.
+
+
+9.  Examples
+
+   The following examples are common usage patterns that MAY be applied
+   in such situations, the main scope of this section is to explain
+   better usage of the transmission vectors.
+
+9.1.  Stream Radio
+
+   This is one of the most common situation: one single server streaming
+   content in multicast, the clients may start a session at random time.
+   The content itself could be a mix of live stream, as the wj's voice,
+   and stored streams as the music she plays.
+
+   In this situation we don't know in advance how many codebooks we will
+   use.  The clients can join anytime and users expect to start
+   listening to the content in a short time.
+
+   On join the client will receive the current Configuration necessary
+   to decode the current stream inlined in the SDP so that the decoding
+   will start immediately after.
+
+   When the streamed content changes the new Configuration is sent in-
+   band before the actual stream, and the Configuration that has to be
+   sent inline in the SDP updated.  Since the in-band method is
+   unreliable, an out of band fallback is provided.
+
+   The client could choose to fetch the Configuration from the alternate
+   source as soon as it discovers a Configuration packet got lost in-
+   band or use selective retransmission [15], if the server supports the
+   feature.
+
+   A serverside optimization would be to keep an hash list of the
+   Configurations per session to avoid packing all of them and send the
+   same Configuration with different Ident tags
+
+   A clientside optimization would be to keep a tag list of the
+   Configurations per session and don't process configuration packets
+   already known.
+
+
+
+Barbato                 Expires December 27, 2007              [Page 22]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+10.  Security Considerations
+
+   RTP packets using this payload format are subject to the security
+   considerations discussed in the RTP specification [2].  This implies
+   that the confidentiality of the media stream is achieved by using
+   encryption.  Because the data compression used with this payload
+   format is applied end-to-end, encryption may be performed on the
+   compressed data.  Additional care MAY be needed for delivery methods
+   that point to external resources, using secure protocols to fetch the
+   configuration payloads.  Where the size of a data block is set, care
+   MUST be taken to prevent buffer overflows in the client applications.
+
+
+11.  Acknowledgments
+
+   This document is a continuation of draft-moffitt-vorbis-rtp-00.txt
+   and draft-kerr-avt-vorbis-rtp-04.txt.  The Media Type type section is
+   a continuation of draft-short-avt-rtp-vorbis-mime-00.txt.
+
+   Thanks to the AVT, Ogg Vorbis Communities / Xiph.org including Steve
+   Casner, Aaron Colwell, Ross Finlayson, Fluendo, Ramon Garcia, Pascal
+   Hennequin, Ralph Giles, Tor-Einar Jarnbjo, Colin Law, John Lazzaro,
+   Jack Moffitt, Christopher Montgomery, Colin Perkins, Barry Short,
+   Mike Smith, Phil Kerr, Michael Sparks, Magnus Westerlund, David
+   Barrett, Silvia Pfeiffer, Stefan Ehmann, Alessandro Salvatori.
+   Politecnico di Torino (LS)^3/IMG Group in particular Federico
+   Ridolfo, Francesco Varano, Giampaolo Mancini, Dario Gallucci, Juan
+   Carlos De Martin.
+
+
+12.  References
+
+12.1.  Normative References
+
+   [1]   Bradner, S., "Key words for use in RFCs to Indicate Requirement
+         Levels", RFC 2119.
+
+   [2]   Schulzrinne, H., Casner, S., Frederick, R., and V. Jacobson,
+         "RTP: A Transport Protocol for real-time applications",
+         RFC 3550.
+
+   [3]   Schulzrinne, H. and S. Casner, "RTP Profile for Audio and Video
+         Conferences with Minimal Control.", RFC 3551.
+
+   [4]   Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
+         Resource Identifier (URI): Generic Syntax", RFC 3986.
+
+   [5]   Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
+
+
+
+Barbato                 Expires December 27, 2007              [Page 23]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+         Description Protocol", RFC 4566, July 2006.
+
+   [6]   Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191,
+         November 1990.
+
+   [7]   McCann et al., J., "Path MTU Discovery for IP version 6",
+         RFC 1981.
+
+   [8]   Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with
+         Session Description Protocol (SDP)", RFC 3264.
+
+   [9]   Josefsson, S., "The Base16, Base32, and Base64 Data Encodings",
+         RFC 3548.
+
+   [10]  National Institute of Standards and Technology, "Secure Hash
+         Standard", May 1993.
+
+12.2.  Informative References
+
+   [11]  Pfeiffer, S., "The Ogg Encapsulation Format Version 0",
+         RFC 3533.
+
+   [12]  "libvorbis: Available from the Xiph website,
+         http://www.xiph.org".
+
+   [13]  "Ogg Vorbis I specification:  Codec setup and packet decode.
+         Available from the Xiph website, http://www.xiph.org".
+
+   [14]  Deutsch, P., "GZIP file format specification version 4.3",
+         RFC 1952.
+
+   [15]  Friedman, T., Caceres, R., and A. Clark, "RTP Control Protocol
+         Extended Reports (RTCP XR)", RFC 3611, November 2003.
+
+   [16]  Seward, J., "libbz2 and bzip2".
+
+
+Author's Address
+
+   Luca Barbato
+   Xiph.Org
+
+   Email: lu_zero at gentoo.org
+   URI:   http://www.xiph.org/
+
+
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 24]
+
+Internet-Draft        draft-ietf-avt-rtp-vorbis-06              Jun 2007
+
+
+Full Copyright Statement
+
+   Copyright (C) The IETF Trust (2007).
+
+   This document is subject to the rights, licenses and restrictions
+   contained in BCP 78, and except as set forth therein, the authors
+   retain all their rights.
+
+   This document and the information contained herein are provided on an
+   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
+   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
+   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
+   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
+   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+Intellectual Property
+
+   The IETF takes no position regarding the validity or scope of any
+   Intellectual Property Rights or other rights that might be claimed to
+   pertain to the implementation or use of the technology described in
+   this document or the extent to which any license under such rights
+   might or might not be available; nor does it represent that it has
+   made any independent effort to identify any such rights.  Information
+   on the procedures with respect to rights in RFC documents can be
+   found in BCP 78 and BCP 79.
+
+   Copies of IPR disclosures made to the IETF Secretariat and any
+   assurances of licenses to be made available, or the result of an
+   attempt made to obtain a general license or permission for the use of
+   such proprietary rights by implementers or users of this
+   specification can be obtained from the IETF on-line IPR repository at
+   http://www.ietf.org/ipr.
+
+   The IETF invites any interested party to bring to its attention any
+   copyrights, patents or patent applications, or other proprietary
+   rights that may cover technology that may be required to implement
+   this standard.  Please address the information to the IETF at
+   ietf-ipr at ietf.org.
+
+
+Acknowledgment
+
+   Funding for the RFC Editor function is provided by the IETF
+   Administrative Support Activity (IASA).
+
+
+
+
+
+Barbato                 Expires December 27, 2007              [Page 25]
+
+

Added: branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.xml
===================================================================
--- branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.xml	                        (rev 0)
+++ branches/vorbis-aotuv/doc/draft-ietf-avt-rtp-vorbis-06.xml	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,1388 @@
+<?xml version='1.0'?>
+<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
+<?rfc toc="yes" ?>
+<?rfc compact='yes'?>
+
+<rfc ipr="full3978" docName="RTP Payload Format for Vorbis Encoded Audio">
+
+<front>
+<title>draft-ietf-avt-rtp-vorbis-06</title>
+
+<author initials="L" surname="Barbato" fullname="Luca Barbato">
+<organization>Xiph.Org</organization>
+<address>
+<email>lu_zero at gentoo.org</email>
+<uri>http://www.xiph.org/</uri>
+</address>
+</author>
+
+<date day="25" month="Jun" year="2007" />
+
+<area>General</area>
+<workgroup>AVT Working Group</workgroup>
+<keyword>I-D</keyword>
+
+<keyword>Internet-Draft</keyword>
+<keyword>Vorbis</keyword>
+<keyword>RTP</keyword>
+
+<abstract>
+
+<t>
+This document describes an RTP payload format for transporting Vorbis encoded
+audio. It details the RTP encapsulation mechanism for raw Vorbis data and 
+details the delivery mechanisms for the decoder probability model, referred to
+as a codebook and other setup information.
+</t>
+
+<t>
+Also included within this memo are media type registrations, and the details
+necessary for the use of Vorbis with the Session Description Protocol (SDP).
+</t>
+
+</abstract>
+
+<note title="Editors Note">
+<t>
+All references to RFC XXXX are to be replaced by references to the RFC number
+of this memo, when published.
+</t>
+</note>
+
+</front>
+
+<middle>
+
+<section anchor="Introduction" title="Introduction">
+
+<t>
+Vorbis is a general purpose perceptual audio codec intended to allow 
+maximum encoder flexibility, thus allowing it to scale competitively 
+over an exceptionally wide range of bitrates. At the high 
+quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits), it 
+is in the same league as AAC.
+Vorbis is also intended for lower and higher sample rates (from 
+8kHz telephony to 192kHz digital masters) and a range of channel 
+representations (monaural, polyphonic, stereo, quadraphonic, 5.1, 
+ambisonic, or up to 255 discrete channels).
+</t>
+
+<t>
+Vorbis encoded audio is generally encapsulated within an Ogg format bitstream
+<xref target="rfc3533"></xref>, which provides framing and synchronization.
+For the purposes of RTP transport, this layer is unnecessary, and so raw Vorbis
+packets are used in the payload.
+</t>
+
+<section anchor="Terminology" title="Terminology">
+
+<t>
+The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" 
+in this document are to be interpreted as described in RFC 2119 <xref target="rfc2119"></xref>.
+</t>
+
+</section>
+</section>
+
+<section anchor="Payload Format" title="Payload Format">
+
+<t>
+For RTP based transport of Vorbis encoded audio the standard RTP header is
+followed by a 4 octets payload header, then the payload data. The payload
+headers are used to associate the Vorbis data with its associated decoding
+codebooks as well as indicating if the following packet contains fragmented
+Vorbis data and/or the number of whole Vorbis data frames. The payload data
+contains the raw Vorbis bitstream information. There are 3 types of Vorbis
+payload data, an RTP packet MUST contain just one of them at a time.
+</t>
+
+<section anchor="RTP Header" title="RTP Header">
+
+<t>
+The format of the RTP header is specified in <xref target="rfc3550"></xref>
+and shown in Figure <xref target="RTP Header Figure"/>.  This payload format
+uses the fields of the header in a manner consistent with that specification.
+</t>
+
+<t>
+<figure anchor="RTP Header Figure" title="RTP Header">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |       sequence number         |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                           timestamp                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+</t>
+
+<t>
+The RTP header begins with an octet of fields (V, P, X, and CC) to support
+specialized RTP uses (see <xref target="rfc3550"></xref> and 
+<xref target="rfc3551"></xref> for details). For Vorbis RTP, the following
+values are used.
+</t>
+
+<t>
+Version (V): 2 bits</t>
+<t>
+This field identifies the version of RTP. The version used by this
+specification is two (2).
+</t>
+
+<t>
+Padding (P): 1 bit</t>
+<t>
+Padding MAY be used with this payload format according to section 5.1 of
+<xref target="rfc3550"></xref>.
+</t>
+
+<t>
+Extension (X): 1 bit</t>
+<t>
+The Extension bit is used in accordance with <xref target="rfc3550"></xref>.
+</t>
+
+<t>
+CSRC count (CC): 4 bits</t>
+<t>
+The CSRC count is used in accordance with <xref target="rfc3550"></xref>.
+</t>
+
+<t>
+Marker (M): 1 bit</t>
+<t>
+Set to zero.  Audio silence suppression not used.  This conforms to section 4.1
+of <xref target="vorbis-spec-ref"></xref>.
+</t>
+
+<t>
+Payload Type (PT): 7 bits</t>
+<t>
+An RTP profile for a class of applications is expected to assign a payload type
+for this format, or a dynamically allocated payload type SHOULD be chosen which
+designates the payload as Vorbis.
+</t>
+
+<t>
+Sequence number: 16 bits</t>
+<t>
+The sequence number increments by one for each RTP data packet sent, and may be
+used by the receiver to detect packet loss and to restore packet sequence. This
+field is detailed further in <xref target="rfc3550"></xref>.
+</t>
+
+<t>
+Timestamp: 32 bits</t>
+<t>
+A timestamp representing the sampling time of the first sample of the first
+Vorbis packet in the RTP packet. The clock frequency MUST be set to the sample
+rate of the encoded audio data and is conveyed out-of-band (e.g. as a SDP parameter).
+</t>
+
+<t>
+SSRC/CSRC identifiers: </t>
+<t>
+These two fields, 32 bits each with one SSRC field and a maximum of 16 CSRC
+fields, are as defined in <xref target="rfc3550">
+</xref>.  
+</t>
+
+</section>
+
+<section anchor="Payload Header" title="Payload Header">
+
+<t>
+The 4 octets following the RTP Header section are the Payload Header. This
+header is split into a number of bitfields detailing the format of the
+following payload data packets.
+</t>
+
+<figure anchor="Payload Header Figure" title="Payload Header">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                     Ident                     | F |VDT|# pkts.|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+Ident: 24 bits</t>
+<t>
+This 24 bit field is used to associate the Vorbis data to a decoding
+Configuration. It is stored as network byte order integer.
+</t>
+
+<t>
+Fragment type (F): 2 bits</t>
+<t>
+This field is set according to the following list
+</t>
+<vspace blankLines="1" />
+<list style="empty">
+<t>      0 = Not Fragmented</t>
+<t>      1 = Start Fragment</t>
+<t>      2 = Continuation Fragment</t>
+<t>      3 = End Fragment</t>
+</list>
+
+<t>
+Vorbis Data Type (VDT): 2 bits</t>
+<t>
+This field specifies the kind of Vorbis data stored in this RTP packet. There
+are currently three different types of Vorbis payloads. Each packet MUST contain only a single type of Vorbis payload (e.g. you MUST not aggregate configuration and comment payload in the same packet)
+</t>
+
+<vspace blankLines="1" />
+<list style="empty">
+<t>      0 = Raw Vorbis payload</t>
+<t>      1 = Vorbis Packed Configuration payload</t>
+<t>      2 = Legacy Vorbis Comment payload</t>
+<t>      3 = Reserved</t>
+</list>
+
+<t> The packets with a VDT of value 3 MUST be ignored </t>
+
+<t>
+The last 4 bits represent the number of complete packets in this payload. This
+provides for a maximum number of 15 Vorbis packets in the payload. If the
+packet contains fragmented data the number of packets MUST be set to 0.
+</t>
+
+</section>
+
+<section anchor="Payload Data" title="Payload Data">
+
+<t>
+Raw Vorbis packets are currently unbounded in length, application profiles will
+likely define a practical limit. Typical Vorbis packet sizes range from very
+small (2-3 bytes) to quite large (8-12 kilobytes). The reference implementation
+<xref target="libvorbis"></xref> typically produces packets less than ~800
+bytes, except for the setup header packets which are ~4-12 kilobytes. Within an
+RTP context, to avoid fragmentation, the Vorbis data packet size SHOULD be kept
+sufficiently small so that after adding the RTP and payload headers, the
+complete RTP packet is smaller than the path MTU.
+</t>
+
+<figure anchor="Payload Data Figure" title="Payload Data Header">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |            length             |       vorbis packet data     ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+Each Vorbis payload packet starts with a two octet length header, which is used
+to represent the size in bytes of the following data payload, followed by the
+raw Vorbis data padded to the nearest byte boundary, as explained by the <xref target="vorbis-spec-ref">vorbis specification</xref>. The length value is stored
+as network byte order integer.
+</t>
+
+<t>
+For payloads which consist of multiple Vorbis packets the payload data consists
+of the packet length followed by the packet data for each of the Vorbis packets
+in the payload.
+</t>
+
+<t>
+The Vorbis packet length header is the length of the Vorbis data block only and
+does not count the length field.
+</t>
+
+<t>
+The payload packing of the Vorbis data packets MUST follow the guidelines
+set-out in <xref target="rfc3551"></xref> where the oldest packet occurs
+immediately after the RTP packet header. Subsequent packets, if any, MUST
+follow in temporal order.
+</t>
+
+<t>
+Channel mapping of the audio is in accordance with the
+<xref target="vorbis-spec-ref">Vorbis I Specification</xref>.
+</t>
+
+</section>
+
+<section anchor="Example RTP Packet" title="Example RTP Packet">
+
+<t>
+Here is an example RTP packet containing two Vorbis packets.
+</t>
+
+<t>
+RTP Packet Header:
+</t>
+
+<figure anchor="Example Raw Vorbis Packet" title="Example Raw Vorbis Packet">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   | 2 |0|0|  0    |0|      PT     |       sequence number         |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |               timestamp (in sample rate units)                |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronisation source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                     Ident                     | 0 | 0 | 2 pks |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |            length             |          vorbis data         ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        vorbis data                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |            length             |   next vorbis packet data    ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        vorbis data                          ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..               vorbis data                    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+The payload data section of the RTP packet begins with the 24 bit Ident field
+followed by the one octet bitfield header, which has the number of Vorbis
+frames set to 2.  Each of the Vorbis data frames is prefixed by the two octets
+length field. The Packet Type and Fragment Type are set to 0. The Configuration
+that will be used to decode the packets is the one indexed by the ident value.
+</t>
+
+</section>
+</section>
+
+
+
+<section anchor="Configuration Headers" title="Configuration Headers">
+
+<t>
+Unlike other mainstream audio codecs Vorbis has no statically 
+configured probability model. Instead, it packs all entropy decoding 
+configuration, Vector Quantization and Huffman models into a data block
+that must be transmitted to the decoder along with the compressed data.
+A decoder also requires information detailing the number of audio 
+channels, bitrates and similar information to configure itself for a 
+particular compressed data stream. These two blocks of information are 
+often referred to collectively as the "codebooks" for a Vorbis stream,
+and are nominally included as special "header" packets at the start 
+of the compressed data. In addition,
+the <xref target="vorbis-spec-ref">Vorbis I specification</xref>
+requires the presence of a comment header packet which gives simple
+metadata about the stream, but this information is not required for 
+decoding the frame sequence.
+</t>
+
+<t>
+Thus these two codebook header packets must be received by the decoder before
+any audio data can be interpreted. These requirements pose problems in RTP,
+which is often used over unreliable transports.
+</t>
+
+<t>
+Since this information must be transmitted reliably and, as the RTP 
+stream may change certain configuration data mid-session, there are 
+different methods for delivering this configuration data to a 
+client, both in-band and out-of-band which is detailed below. SDP 
+delivery is typically used to set up an initial state for the client 
+application. The changes may be due to different codebooks as well as 
+different bitrates of the stream.
+</t>
+
+<t>
+The delivery vectors in use can be specified by an SDP attribute to indicate the
+method and the optional URI where the Vorbis
+<xref target="Packed Configuration">Packed Configuration</xref> Packets could
+be fetched. Different delivery methods MAY be advertised for the same session.
+The in-band Configuration delivery SHOULD be considered as baseline,
+out-of-band delivery methods that don't use RTP will not be described in this
+document. For non chained streams, the Configuration recommended delivery
+method is inline the <xref target="Packed Configuration">Packed Configuration</xref> in the SDP as explained in the <xref target="Mapping Media Type Parameters into SDP"> IANA considerations</xref>.
+</t>
+
+<t>
+The 24 bit Ident field is used to map which Configuration will be used to
+decode a packet. When the Ident field changes, it indicates that a change in
+the stream has taken place. The client application MUST have in advance the
+correct configuration and if the client detects a change in the Ident value and
+does not have this information it MUST NOT decode the raw Vorbis data
+associated until it fetches the correct Configuration.
+</t>
+
+<section anchor="In-band Header Transmission" title="In-band Header Transmission">
+
+<t>
+The <xref target="Packed Configuration">Packed Configuration</xref> Payload is
+sent in-band with the packet type bits set to match the Vorbis Data Type.
+Clients MUST be capable of dealing with fragmentation and periodic
+re-transmission of the configuration headers.
+</t>
+
+<section anchor="Packed Configuration" title="Packed Configuration">
+
+<t>
+A Vorbis Packed Configuration is indicated with the Vorbis Data Type field set
+to 1. Of the three headers defined in the
+<xref target="vorbis-spec-ref">Vorbis I specification</xref>, the
+identification and the setup MUST be packed as they are, while the comment header MAY be replaced with a dummy one. The packed configuration follows a generic way to store xiph codec configurations: The first field stores the number of the following packets minus one (count field), the next ones represent the size of the headers (length fields), the headers immediately follow the list of length fields. The size of the last header is implicit.
+The count and the length fields are encoded using the following logic: the data is in network order, every byte has the most significant bit used as flag and the following 7 used to store the value. The first N bit are to be taken, where N is number of bits representing the value modulo 7, and stored in the first byte.
+If there are more bits, the flag bit is set to 1 and the subsequent 7bit are stored in the following byte, if there are remaining bits set the flag to 1 and the same procedure is repeated. The ending byte has the flag bit set to 0. In order to decode it is enough to iterate over the bytes until the flag bit set to 0, for every byte the data is added to the accumulated value multiplied by 128.
+The headers are packed in the same order they are present in ogg: identification, comment, setup.</t>
+
+<figure anchor="Packed Configuration Figure" title="Packed Configuration Figure">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |             xxxx              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                             xxxxx                             |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                      Ident                    | 1 | 0 |      0|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           length              | n. of headers |    length1    |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |    length2    |                  Identification              ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        Identification                       ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        Identification                       ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        Identification                       ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..               Identification                 |    Comment   ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                            Comment                          ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                            Comment                          ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                            Comment                          ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..           Comment            |             Setup            ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                            Setup                            ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                            Setup                            ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>The Ident field is set with the value that will be used by the Raw Payload
+Packets to address this Configuration. The Fragment type is set to 0 since the
+packet bears the full Packed configuration, the number of packet is set to 1.</t>
+</section>
+</section>
+
+<section anchor="Out of Band Transmission" title="Out of Band Transmission">
+
+<t>
+This section, as stated above, does not cover all the possible out-of-band
+delivery methods since they rely on different protocols and are linked to
+specific applications. The following packet definition SHOULD be used in
+out-of-band delivery and MUST be used when Configuration is inlined in the SDP.
+</t>
+
+<section anchor="Packed Headers" title="Packed Headers"> 
+
+<t>
+As mentioned above the RECOMMENDED delivery vector for Vorbis configuration
+data is via a retrieval method that can be performed using a reliable transport
+protocol. As the RTP headers are not required for this method of delivery the
+structure of the configuration data is slightly different. The packed header
+starts with a 32 bit (network ordered) count field which details the number of
+packed headers that are contained in the bundle. Next is the Packed header
+payload for each chained Vorbis stream.
+</t>
+
+<figure anchor="Packed Headers Overview Figure" title="Packed Headers Overview">
+<artwork><![CDATA[
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                     Number of packed headers                  |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                          Packed header                        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                          Packed header                        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+Since the Configuration Ident and the Identification Header are fixed length
+there is only a 2 byte length tag to define the length of the packed headers.
+</t>
+
+<figure anchor="Packed Headers Detail Figure" title="Packed Headers Detail">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                   Ident                       |    length    ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..              | n. of headers |    length1    |    length2   ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..              |             Identification Header            ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   .................................................................
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..              |         Comment Header                       ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   .................................................................
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        Comment Header                        |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                          Setup Header                        ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   .................................................................
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                         Setup Header                         |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+<t>
+The key difference between the in-band format and this one, is that there is no
+need for the payload header octet. In this figure the comment has a size bigger
+than 127 bytes.
+</t>
+</section>
+
+</section>
+
+<section anchor="Loss of Configuration Headers" title="Loss of Configuration Headers"> 
+
+<t>
+Unlike the loss of raw Vorbis payload data, loss of a configuration header can
+lead to a situation where it will not be possible to successfully decode the
+stream.
+</t>
+
+<t>
+Loss of Configuration Packet results in the halting of stream decoding.
+</t>
+
+</section>
+
+</section>
+
+<section anchor="Comment Headers" title="Comment Headers">
+
+<t>
+With the Vorbis Data Type flag set to 2, this indicates that the packet contain
+the comment metadata, such as artist name, track title and so on. These
+metadata messages are not intended to be fully descriptive but to offer basic
+track/song information. Clients MAY ignore it completely. The details on the
+format of the comments can be found in the <xref target="vorbis-spec-ref">Vorbis documentation</xref>.
+</t>
+<figure anchor="Comment Packet Figure" title="Comment Packet">
+<artwork><![CDATA[
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |             xxxx              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                             xxxxx                             |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                      Ident                    | 0 | 2 |      1|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |            length             |            Comment           ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                           Comment                           ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                           Comment                            |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+The 2 bytes length field is necessary since this packet could be fragmented.
+</t>
+
+</section>
+<section anchor="Frame Packetization" title="Frame Packetization">
+
+<t>
+Each RTP packet contains either one Vorbis packet fragment, or an integer
+number of complete Vorbis packets (up to a maximum of 15 packets, since the
+number of packets is defined by a 4 bit value).
+</t>
+
+<t>
+Any Vorbis data packet that is less than path MTU SHOULD be bundled in the RTP
+packet with as many Vorbis packets as will fit, up to a maximum of 15, except
+when such bundling would exceed an application's desired transmission latency.
+Path MTU is detailed in <xref target="rfc1191"></xref> and <xref target="rfc1981"></xref>.
+</t>
+
+<t>
+A fragmented packet has a zero in the last four bits of the payload header.
+The first fragment will set the Fragment type to 1. Each fragment after the
+first will set the Fragment type to 2 in the payload header.  The RTP packet
+containing the last fragment of the Vorbis packet will have the Fragment type
+set to 3.  To maintain the correct sequence for fragmented packet reception
+the timestamp field of fragmented packets MUST be the same as the first packet
+sent, with the sequence number incremented as normal for the subsequent RTP
+packets. The length field shows the fragment length.
+</t>
+
+<section anchor="Example Fragmented Vorbis Packet" title="Example Fragmented Vorbis Packet">
+
+<t>
+Here is an example fragmented Vorbis packet split over three RTP packets.
+Each packet contains the standard RTP headers as well as the 4 octets Vorbis
+headers.
+</t>
+
+<figure anchor="Example Fragmented Packet (Packet 1)" title="Example Fragmented Packet (Packet 1)">
+<artwork><![CDATA[
+   Packet 1:
+
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |           1000                |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                            12345                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                       Ident                   | 1 | 0 |      0|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |             length            |            vorbis data       ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        vorbis data                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+In this packet the initial sequence number is 1000 and the timestamp is 12345.  The Fragment type is set to 1, the number of packets field is set to 0, and as
+the payload is raw Vorbis data the VDT field is set to 0.
+</t>
+
+<figure anchor="Example Fragmented Packet (Packet 2)" title="Example Fragmented Packet (Packet 2)">
+<artwork><![CDATA[
+   Packet 2:
+
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |           1001                |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                             12345                             |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                       Ident                   | 2 | 0 |      0|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |             length            |          vorbis data         ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        vorbis data                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+The Fragment type field is set to 2 and the number of packets field is set to 0.
+For large Vorbis fragments there can be several of these type of payload 
+packets. The maximum packet size SHOULD be no greater than the path MTU,
+including all RTP and payload headers. The sequence number has been incremented
+by one but the timestamp field remains the same as the initial packet.
+</t>
+
+<figure anchor="Example Fragmented Packet (Packet 3)" title="Example Fragmented Packet (Packet 3)">
+<artwork><![CDATA[
+   Packet 3:
+
+    0                   1                   2                   3
+    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |V=2|P|X|  CC   |M|     PT      |           1002                |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                             12345                             |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |           synchronization source (SSRC) identifier            |
+   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
+   |            contributing source (CSRC) identifiers             |
+   |                              ...                              |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |                      Ident                    | 3 | 0 |      0|
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   |             length            |          vorbis data         ..
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+   ..                        vorbis data                           |
+   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+]]></artwork>
+</figure>
+
+<t>
+This is the last Vorbis fragment packet.  The Fragment type is set to 3 and the
+packet count remains set to 0. As in the previous packets the timestamp remains
+set to the first packet in the sequence and the sequence number has been
+incremented.
+</t>
+</section>
+
+<section anchor="Packet Loss" title="Packet Loss">
+
+<t>
+As there is no error correction within the Vorbis stream, packet loss will
+result in a loss of signal. Packet loss is more of an issue for fragmented
+Vorbis packets as the client will have to cope with the handling of the
+Fragment Type. In case of loss of fragments the client MUST discard all the
+remaining fragments and decode the incomplete packet. If we use the fragmented
+Vorbis packet example above and the first packet is lost the client MUST detect
+that the next packet has the packet count field set to 0 and the Fragment type
+2 and MUST drop it. The next packet, which is the final fragmented packet, MUST
+be dropped in the same manner. If the missing packet is the last, the received
+two fragments will be kept and the incomplete vorbis packet decoded.
+</t>
+
+<t>
+Loss of any of the Configuration fragment will result in the loss of the full
+Configuration packet with the result detailed in the <xref target="Loss of Configuration Headers">Loss of Configuration Headers</xref> section.
+</t>
+
+</section>
+</section>
+<section anchor="IANA Considerations" title="IANA Considerations"> 
+
+<vspace blankLines="1" />
+<list style="hanging">
+<t hangText="Type name:"> audio </t>
+<vspace blankLines="1" />
+
+<t hangText="Subtype name:"> vorbis </t>
+<vspace blankLines="1" />
+
+<t hangText="Required parameters:">
+
+<vspace blankLines="1" />
+
+<list style="hanging">
+<t hangText="rate:"> indicates the RTP timestamp clock rate as described in <xref target="rfc3551">RTP Profile for Audio and Video Conferences with Minimal Control.</xref>
+</t>
+<vspace blankLines="1" />
+
+<t hangText="channels:"> indicates the number of audio channels as described in <xref target="rfc3551">RTP Profile for Audio and Video Conferences with Minimal Control.</xref>
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="delivery-method:"> indicates the delivery methods in use, the possible values are: inline, in_band, out_band, MAY be included multiple times
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="configuration:"> the <xref target="rfc3548">base64</xref> representation of the <xref target="Packed Headers">Packed Headers</xref>. It MUST follow the associated delivery-method parameter ("inline").
+</t>
+</list>
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Optional parameters:">
+
+<vspace blankLines="1" />
+
+<list style="hanging">
+<t hangText="configuration-uri:"> the <xref target="rfc3986">URI</xref> of
+the configuration headers in case of out of band transmission.
+In the form of "protocol://path/to/resource/", depending on the specific
+method, a single configuration packet could be retrived by its Ident number, or
+multiple packets could be aggregated in a single stream. 
+Such aggregates MAY be compressed using either
+<xref target="BZ2">bzip2</xref> or <xref target="rfc1952">gzip</xref>.
+A <xref target="FIPS180">sha1</xref> checksum MAY be provided for aggregates.
+In this latter case the URI will end with the aggregate name, followed by its
+compressed extension if applies, a "!" and the <xref target="rfc3548">base64</xref> representation of the sha1hash of the above mentioned compressed aggregated
+as in: "protocol://path/to/resource/aggregated.bz2!sha1hash".
+The trailing '/' discriminates which of two methods are in use.
+The configuration-uri MUST follow the associated delivery method parameter ("out_band").
+Non hierarchical protocols and protocols using for special purposes the '!' separator MAY point just to a resource aggregate using their specific syntax.
+</t>
+</list>
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Encoding considerations:">
+<vspace blankLines="1" />
+This media type is framed and contains binary data.
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Security considerations:">
+<vspace blankLines="1" />
+See Section 10 of RFC XXXX.</t>
+
+<vspace blankLines="1" />
+<t hangText="Interoperability considerations:">
+<vspace blankLines="1" />
+None</t>
+
+<vspace blankLines="1" />
+<t hangText="Published specification:">
+
+<vspace blankLines="1" />
+RFC XXXX [RFC Editor: please replace by the RFC number of  this memo, when published]
+<vspace blankLines="1" />
+Ogg Vorbis I specification:  Codec setup and packet decode. Available from the Xiph website, http://www.xiph.org
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Applications which use this media type:">
+<vspace blankLines="1"/>
+Audio streaming and conferencing tools </t>
+
+<vspace blankLines="1" />
+
+<t hangText="Additional information:">
+<vspace blankLines="1" />
+None </t>
+
+<vspace blankLines="1" />
+
+<t hangText="Person &amp; email address to contact for further information:">
+
+<vspace blankLines="1" />
+
+Luca Barbato: &lt;lu_zero at gentoo.org&gt;<br/>
+IETF Audio/Video Transport Working Group
+
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Intended usage:">
+<vspace blankLines="1" />
+COMMON</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Restriction on usage:">
+<vspace blankLines="1" />
+This media type depends on RTP framing, and hence is only defined for transfer via <xref target="rfc3550">RTP</xref></t>
+
+<vspace blankLines="1" />
+
+<t hangText="Author:">
+<vspace blankLines="1"/>Luca Barbato</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Change controller:">
+<vspace blankLines="1"/>IETF AVT Working Group delegated from the IESG</t>
+
+<vspace blankLines="1" />
+</list>
+
+<section anchor="Packed Headers IANA Considerations" title="Packed Headers IANA Considerations"> 
+
+<t>
+The following IANA considerations MUST only be applied to the packed headers.
+</t>
+
+<vspace blankLines="1" />
+
+<list style="hanging">
+<t hangText="Type name:"> audio </t>
+
+<vspace blankLines="1" />
+
+<t hangText="Subtype name:"> vorbis-config </t>
+
+<vspace blankLines="1" />
+
+<t hangText="Required parameters:">
+<vspace blankLines="1" />
+None
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Optional parameters:">
+<vspace blankLines="1" />
+None
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Encoding considerations:">
+<vspace blankLines="1" />
+This media type contains binary data.
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Security considerations:">
+<vspace blankLines="1" />
+See Section 10 of RFC XXXX.
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Interoperability considerations:">
+<vspace blankLines="1" />
+None
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Published specification:">
+<vspace blankLines="1" />
+RFC XXXX [RFC Editor: please replace by the RFC number of  this memo,
+       when published]
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Applications which use this media type:">
+<vspace blankLines="1" />
+Vorbis encoded audio, configuration data.
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Additional information:"> 
+<vspace blankLines="1" />
+None
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Person &amp; email address to contact for further information:">
+<vspace blankLines="1" />
+Luca Barbato: &lt;lu_zero at gentoo.org&gt;
+<vspace blankLines="0" />
+IETF Audio/Video Transport Working Group
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Intended usage:">
+COMMON
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Restriction on usage:">
+<vspace blankLines="1" />
+This media type doesn't depend on the transport.
+</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Author:">
+<vspace blankLines="1" />
+Luca Barbato</t>
+
+<vspace blankLines="1" />
+
+<t hangText="Change controller:">
+<vspace blankLines="1" />
+IETF AVT Working Group delegated from the IESG</t>
+</list>
+
+</section>
+
+</section>
+
+<section anchor="SDP related considerations" title="SDP related considerations">
+<t>
+The following paragraphs defines the mapping of the parameters described in the IANA considerations section and their usage in the <xref target="rfc3264">Offer/Answer Model</xref>.
+</t>
+
+<section anchor="Mapping Media Type Parameters into SDP" title="Mapping Media Type Parameters into SDP"> 
+
+<t>
+The information carried in the Media Type media type specification has a
+specific mapping to fields in the <xref target="rfc4566">Session Description
+Protocol (SDP)</xref>, which is commonly used to describe RTP sessions.
+When SDP is used to specify sessions the mapping are as follows:
+</t>
+
+<vspace blankLines="1" />
+<list style="symbols">
+
+<t>The type name ("audio") goes in SDP "m=" as the media name.</t>
+<vspace blankLines="1" />
+
+<t>The subtype name ("vorbis") goes in SDP "a=rtpmap" as the encoding name.</t>
+<vspace blankLines="1" />
+
+<t>The parameter "rate" also goes in "a=rtpmap" as clock rate.</t>
+<vspace blankLines="1" />
+
+<t>The parameter "channels" also goes in "a=rtpmap" as channel count.</t>
+<vspace blankLines="1" />
+
+<t>The mandated parameters "delivery-method" and "configuration" MUST be
+included in the SDP "a=fmtp" attribute.</t>
+<vspace blankLines="1" />
+
+<t>The optional parameter "configuration-uri", when present, MUST be included
+in the SDP "a=fmtp" attribute and MUST follow the delivery-method that applies.</t>
+
+</list>
+
+<t>
+If the stream comprises chained Vorbis files and all of them are known in
+advance, the Configuration Packet for each file SHOULD be passed to the client
+using the configuration attribute.
+</t>
+
+<t>
+The URI specified in the configuration-uri attribute MUST point to a location
+where all of the Configuration Packets needed for the life of the session
+reside.
+</t>
+
+<t>
+The port value is specified by the server application bound to the address
+specified in the c= line. The bitrate value and channels specified in the
+rtpmap attribute MUST match the Vorbis sample rate value.  An example is found
+below.
+</t>
+
+<section anchor="SDP Example" title="SDP Example">
+<t>The following example shows a basic SDP single stream. The first
+configuration packet is inlined in the sdp, other configurations could be
+fetched at any time from the first provided uri using or all the known
+configuration could be downloaded using the second uri. The inline
+<xref target="rfc3548">base64</xref> configuration string is omitted because of
+the length.</t>
+
+<list style="empty">
+<t>c=IN IP4 192.0.2.1</t>
+<t>m=audio  RTP/AVP 98</t>
+<t>a=rtpmap:98 vorbis/44100/2</t>
+<t>a=fmtp:98 delivery-method=inline; configuration=base64string; delivery-method=out_band; configuration-uri=rtsp://path/to/the/resource; delivery-method=out_band; configuration-uri=http://another/path/to/resource/aggregate.bz2!8b6237eb5154a0ea12811a94e8e2697b3312bc6c;</t>
+</list>
+</section>
+
+
+<t>
+Note that the payload format (encoding) names are commonly shown in upper case.
+Media Type subtypes are commonly shown in lower case. These names are
+case-insensitive in both places.  Similarly, parameter names are
+case-insensitive both in Media Type types and in the default mapping to the SDP
+a=fmtp attribute. The exception regarding case sensitivity is the
+configuration-uri URI which MUST be regarded as being case sensitive. The
+a=fmtp line is a single line even if it is presented broken because of clarity.
+</t>
+
+</section>
+
+<section anchor="Usage with the SDP Offer/Answer Mode" title="Usage with the SDP Offer/Answer Model">
+
+<t>
+The only paramenter negotiable is the delivery method. All the others are
+declarative: the offer, as described in <xref target="rfc3264">An Offer/Answer
+Model Session Description Protocol</xref>, may contain a large number of
+delivery methods per single fmtp attribute, the answerer MUST remove every
+delivery-method and configuration-uri not supported. All the parameters MUST
+not be altered on answer otherwise.
+</t>
+
+</section>
+
+</section>
+
+<section anchor="Congestion Control" title="Congestion Control"> 
+
+<t>
+Vorbis clients SHOULD send regular receiver reports detailing congestion. A
+mechanism for dynamically downgrading the stream, known as bitrate peeling,
+will allow for a graceful backing off of the stream bitrate. This feature is
+not available at present so an alternative would be to redirect the client to
+a lower bitrate stream if one is available.
+</t>
+
+</section> 
+
+<section anchor="Examples" title="Examples">
+
+<t>
+The following examples are common usage patterns that MAY be applied in such
+situations, the main scope of this section is to explain better usage of the
+transmission vectors.
+</t>
+
+<section anchor="Stream Radio" title="Stream Radio">
+
+<t>This is one of the most common situation: one single server streaming
+content in multicast, the clients may start a session at random time. The
+content itself could be a mix of live stream, as the wj's voice, and stored
+streams as the music she plays.</t>
+
+<t>In this situation we don't know in advance how many codebooks we will use.
+The clients can join anytime and users expect to start listening to the content
+in a short time.</t>
+
+<t>On join the client will receive the current Configuration necessary to
+decode the current stream inlined in the SDP so that the decoding will start
+immediately after.</t>
+
+<t>When the streamed content changes the new Configuration is sent in-band
+before the actual stream, and the Configuration that has to be sent inline in
+the SDP updated. Since the in-band method is unreliable, an out of band
+fallback is provided.</t>
+
+<t>The client could choose to fetch the Configuration from the alternate source
+as soon as it discovers a Configuration packet got lost in-band or use
+<xref target="RFC3611">selective retransmission</xref>, if the server supports
+the feature.</t>
+
+<t>A serverside optimization would be to keep an hash list of the
+Configurations per session to avoid packing all of them and send the same
+Configuration with different Ident tags</t>
+
+<t>A clientside optimization would be to keep a tag list of the Configurations
+per session and don't process configuration packets already known.</t>
+
+</section>
+</section>
+
+<section anchor="Security Considerations" title="Security Considerations"> 
+<t>
+RTP packets using this payload format are subject to the security
+considerations discussed in the RTP specification 
+<xref target="rfc3550"></xref>.  This implies that the confidentiality of the
+media stream is achieved by using encryption. Because the data compression used
+with this payload format is applied end-to-end, encryption may be performed on
+the compressed data. Additional care MAY be needed for delivery methods that
+point to external resources, using secure protocols to fetch the configuration
+payloads. Where the size of a data block is set, care MUST be taken to prevent
+buffer overflows in the client applications.
+</t>
+
+</section> 
+
+<section anchor="Acknowledgments" title="Acknowledgments"> 
+
+<t>
+This document is a continuation of draft-moffitt-vorbis-rtp-00.txt and
+draft-kerr-avt-vorbis-rtp-04.txt.  The Media Type type section is a
+continuation of draft-short-avt-rtp-vorbis-mime-00.txt.
+</t>
+
+<t>
+Thanks to the AVT, Ogg Vorbis Communities / Xiph.org including Steve Casner,
+Aaron Colwell, Ross Finlayson, Fluendo, Ramon Garcia, Pascal Hennequin, Ralph
+Giles, Tor-Einar Jarnbjo, Colin Law, John Lazzaro, Jack Moffitt, Christopher
+Montgomery,  Colin Perkins, Barry Short, Mike Smith, Phil Kerr, Michael Sparks,
+Magnus Westerlund, David Barrett, Silvia Pfeiffer, Stefan Ehmann, Alessandro
+Salvatori. Politecnico di Torino (LS)³/IMG Group in particular Federico
+Ridolfo, Francesco Varano, Giampaolo Mancini, Dario Gallucci, Juan Carlos De Martin.
+</t>
+
+</section> 
+
+</middle>
+
+<back>
+
+<references title="Normative References">
+
+<reference anchor="rfc2119">
+<front>
+<title>Key words for use in RFCs to Indicate Requirement Levels </title>
+<author initials="S." surname="Bradner" fullname="Scott Bradner"></author>
+</front>
+<seriesInfo name="RFC" value="2119" />
+</reference>   
+
+<reference anchor="rfc3550">
+<front>
+<title>RTP: A Transport Protocol for real-time applications</title>
+<author initials="H." surname="Schulzrinne" fullname=""></author>
+<author initials="S." surname="Casner" fullname=""></author>
+<author initials="R." surname="Frederick" fullname=""></author>
+<author initials="V." surname="Jacobson" fullname=""></author>
+</front>
+<seriesInfo name="RFC" value="3550" />
+</reference> 
+
+<reference anchor="rfc3551">
+<front>
+<title>RTP Profile for Audio and Video Conferences with Minimal Control.</title>
+<author initials="H." surname="Schulzrinne" fullname=""></author>
+<author initials="S." surname="Casner" fullname=""></author>
+</front>
+<date month="July" year="2003" />
+<seriesInfo name="RFC" value="3551" />
+</reference> 
+
+<reference anchor='rfc3986'>
+<front>
+<title abbrev='URI Generic Syntax'>Uniform Resource Identifier (URI): Generic Syntax</title>
+<author initials='T.' surname='Berners-Lee' fullname='Tim Berners-Lee'>
+</author>
+<author initials='R.' surname='Fielding' fullname='Roy T. Fielding'>
+</author>
+<author initials='L.' surname='Masinter' fullname='Larry Masinter'>
+</author>
+</front>
+<date year='2005' month='January' />
+<seriesInfo name='RFC' value='3986' />
+</reference>
+
+<reference anchor='rfc4566'>
+
+<front>
+<title>SDP: Session Description Protocol</title>
+<author initials='M.' surname='Handley' fullname='M. Handley'>
+<organization /></author>
+<author initials='V.' surname='Jacobson' fullname='V. Jacobson'>
+<organization /></author>
+<author initials='C.' surname='Perkins' fullname='C. Perkins'>
+<organization /></author>
+<date year='2006' month='July' />
+</front>
+
+<seriesInfo name='RFC' value='4566' />
+<format type='TXT' octets='108820' target='ftp://ftp.isi.edu/in-notes/rfc4566.txt' />
+</reference>
+
+<reference anchor='rfc1191'>
+
+<front>
+<title>Path MTU discovery</title>
+<author initials='J.' surname='Mogul' fullname='Jeffrey Mogul'>
+<organization>Digital Equipment Corporation (DEC) , Western Research Laboratory</organization>
+<address>
+<email>mogul at decwrl.dec.com</email></address></author>
+<author initials='S.' surname='Deering' fullname='Steve Deering'>
+<organization>Xerox Palo Alto Research Center</organization>
+<address>
+<email>deering at xerox.com</email></address></author>
+<date year='1990' day='1' month='November' />
+</front>
+
+<seriesInfo name='RFC' value='1191' />
+<format type='TXT' octets='47936' target='ftp://ftp.isi.edu/in-notes/rfc1191.txt' />
+</reference>
+
+<reference anchor="rfc1981">
+<front>
+<title>Path MTU Discovery for IP version 6</title>
+<author initials="J." surname="McCann et al." fullname="J. McCann et al."></author>
+</front>
+<seriesInfo name="RFC" value="1981" />
+</reference>   
+
+<reference anchor="rfc3264">
+<front>
+<title>An Offer/Answer Model with Session Description Protocol (SDP)</title>
+<author initials="J." surname="Rosenberg" fullname="Jonathan Rosenberg"></author>
+<author initials="H." surname="Schulzrinne" fullname="Henning Schulzrinne"></author>
+</front>
+<seriesInfo name="RFC" value="3264" />
+</reference>   
+
+<reference anchor="rfc3548">
+<front>
+<title>The Base16, Base32, and Base64 Data Encodings</title>
+<author initials="S." surname="Josefsson" fullname="Simon Josefsson"></author>
+</front>
+<seriesInfo name="RFC" value="3548" />
+</reference>
+<reference anchor="FIPS180">
+<front>
+<title>Secure Hash Standard</title>
+<author>
+<organization>National Institute of Standards and Technology</organization>
+</author>
+<date month="May" year="1993"/>
+</front>
+</reference>
+</references>
+
+<references title="Informative References">
+
+<reference anchor="rfc3533">
+<front>
+<title>The Ogg Encapsulation Format Version 0</title>
+<author initials="S." surname="Pfeiffer" fullname="Silvia Pfeiffer"></author>
+</front>
+<seriesInfo name="RFC" value="3533" />
+</reference>
+
+<reference anchor="libvorbis">
+<front>
+<title>libvorbis: Available from the Xiph website, http://www.xiph.org</title>
+</front>
+</reference>   
+
+<reference anchor="vorbis-spec-ref">
+<front>
+<title>Ogg Vorbis I specification:  Codec setup and packet decode.  Available from the Xiph website, http://www.xiph.org</title>
+</front>
+</reference>   
+
+<reference anchor="rfc1952">
+<front>
+<title>GZIP file format specification version 4.3</title>
+<author initials="P" surname="Deutsch" fullname="L. Peter Deutsch"></author>
+</front>
+<seriesInfo name="RFC" value="1952" />
+</reference>
+
+<reference anchor="RFC3611">
+<front>
+<title>RTP Control Protocol Extended Reports (RTCP XR)</title>
+<author initials="T." surname="Friedman" fullname="T. Friedman" />
+<author initials="R." surname="Caceres" fullname="R. Caceres" />
+<author initials="A." surname="Clark" fullname="A. Clark" />
+<date year="2003" month="November"/>
+</front>
+<seriesInfo name="RFC" value="3611"/>
+</reference>
+<reference anchor="BZ2">
+<front>
+
+<title>libbz2 and bzip2</title>
+<author initials="J" surname="Seward" fullname="Julian Seward" />
+</front>
+</reference>
+</references>
+</back>
+</rfc>

Modified: branches/vorbis-aotuv/doc/floor1_inverse_dB_table.html
===================================================================
--- branches/vorbis-aotuv/doc/floor1_inverse_dB_table.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/floor1_inverse_dB_table.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,154 +1,154 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis I format specification: floor1_inverse_dB_table</h1>
-
-<p>The vector <tt>[floor1_inverse_dB_table]</tt> is a 256 element static
-lookup table consiting of the following values (read left to right
-then top to bottom):</p>
-
-<pre>
-  1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, 
-  1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, 
-  1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.1287530e-07, 
-  2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, 
-  2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, 
-  3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, 
-  4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, 
-  6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, 
-  7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, 
-  1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, 
-  1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, 
-  1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, 
-  2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, 
-  2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, 
-  3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, 
-  4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, 
-  5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, 
-  7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, 
-  9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, 
-  1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, 
-  1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, 
-  2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, 
-  2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, 
-  3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, 
-  4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, 
-  5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, 
-  7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, 
-  9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, 
-  0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, 
-  0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, 
-  0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, 
-  0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, 
-  0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, 
-  0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, 
-  0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, 
-  0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, 
-  0.00092223983, 0.00098217216, 0.0010459992,  0.0011139742, 
-  0.0011863665,  0.0012634633,  0.0013455702,  0.0014330129, 
-  0.0015261382,  0.0016253153,  0.0017309374,  0.0018434235, 
-  0.0019632195,  0.0020908006,  0.0022266726,  0.0023713743, 
-  0.0025254795,  0.0026895994,  0.0028643847,  0.0030505286, 
-  0.0032487691,  0.0034598925,  0.0036847358,  0.0039241906, 
-  0.0041792066,  0.0044507950,  0.0047400328,  0.0050480668, 
-  0.0053761186,  0.0057254891,  0.0060975636,  0.0064938176, 
-  0.0069158225,  0.0073652516,  0.0078438871,  0.0083536271, 
-  0.0088964928,  0.009474637,   0.010090352,   0.010746080, 
-  0.011444421,   0.012188144,   0.012980198,   0.013823725, 
-  0.014722068,   0.015678791,   0.016697687,   0.017782797, 
-  0.018938423,   0.020169149,   0.021479854,   0.022875735, 
-  0.024362330,   0.025945531,   0.027631618,   0.029427276, 
-  0.031339626,   0.033376252,   0.035545228,   0.037855157, 
-  0.040315199,   0.042935108,   0.045725273,   0.048696758, 
-  0.051861348,   0.055231591,   0.058820850,   0.062643361, 
-  0.066714279,   0.071049749,   0.075666962,   0.080584227, 
-  0.085821044,   0.091398179,   0.097337747,   0.10366330, 
-  0.11039993,    0.11757434,    0.12521498,    0.13335215, 
-  0.14201813,    0.15124727,    0.16107617,    0.17154380, 
-  0.18269168,    0.19456402,    0.20720788,    0.22067342, 
-  0.23501402,    0.25028656,    0.26655159,    0.28387361, 
-  0.30232132,    0.32196786,    0.34289114,    0.36517414, 
-  0.38890521,    0.41417847,    0.44109412,    0.46975890, 
-  0.50028648,    0.53279791,    0.56742212,    0.60429640, 
-  0.64356699,    0.68538959,    0.72993007,    0.77736504, 
-  0.82788260,    0.88168307,    0.9389798,     1.
-</pre>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis I format specification: floor1_inverse_dB_table</h1>
+
+<p>The vector <tt>[floor1_inverse_dB_table]</tt> is a 256 element static
+lookup table consiting of the following values (read left to right
+then top to bottom):</p>
+
+<pre>
+  1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, 
+  1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, 
+  1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.1287530e-07, 
+  2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, 
+  2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, 
+  3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, 
+  4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, 
+  6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, 
+  7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, 
+  1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, 
+  1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, 
+  1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, 
+  2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, 
+  2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, 
+  3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, 
+  4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, 
+  5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, 
+  7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, 
+  9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, 
+  1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, 
+  1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, 
+  2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, 
+  2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, 
+  3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, 
+  4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, 
+  5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, 
+  7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, 
+  9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, 
+  0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, 
+  0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, 
+  0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, 
+  0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, 
+  0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, 
+  0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, 
+  0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, 
+  0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, 
+  0.00092223983, 0.00098217216, 0.0010459992,  0.0011139742, 
+  0.0011863665,  0.0012634633,  0.0013455702,  0.0014330129, 
+  0.0015261382,  0.0016253153,  0.0017309374,  0.0018434235, 
+  0.0019632195,  0.0020908006,  0.0022266726,  0.0023713743, 
+  0.0025254795,  0.0026895994,  0.0028643847,  0.0030505286, 
+  0.0032487691,  0.0034598925,  0.0036847358,  0.0039241906, 
+  0.0041792066,  0.0044507950,  0.0047400328,  0.0050480668, 
+  0.0053761186,  0.0057254891,  0.0060975636,  0.0064938176, 
+  0.0069158225,  0.0073652516,  0.0078438871,  0.0083536271, 
+  0.0088964928,  0.009474637,   0.010090352,   0.010746080, 
+  0.011444421,   0.012188144,   0.012980198,   0.013823725, 
+  0.014722068,   0.015678791,   0.016697687,   0.017782797, 
+  0.018938423,   0.020169149,   0.021479854,   0.022875735, 
+  0.024362330,   0.025945531,   0.027631618,   0.029427276, 
+  0.031339626,   0.033376252,   0.035545228,   0.037855157, 
+  0.040315199,   0.042935108,   0.045725273,   0.048696758, 
+  0.051861348,   0.055231591,   0.058820850,   0.062643361, 
+  0.066714279,   0.071049749,   0.075666962,   0.080584227, 
+  0.085821044,   0.091398179,   0.097337747,   0.10366330, 
+  0.11039993,    0.11757434,    0.12521498,    0.13335215, 
+  0.14201813,    0.15124727,    0.16107617,    0.17154380, 
+  0.18269168,    0.19456402,    0.20720788,    0.22067342, 
+  0.23501402,    0.25028656,    0.26655159,    0.28387361, 
+  0.30232132,    0.32196786,    0.34289114,    0.36517414, 
+  0.38890521,    0.41417847,    0.44109412,    0.46975890, 
+  0.50028648,    0.53279791,    0.56742212,    0.60429640, 
+  0.64356699,    0.68538959,    0.72993007,    0.77736504, 
+  0.82788260,    0.88168307,    0.9389798,     1.
+</pre>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/framing.html
===================================================================
--- branches/vorbis-aotuv/doc/framing.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/framing.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,433 +1,431 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg logical bitstream framing</h1>
-
-<h2>Ogg bitstreams</h2>
-
-<p>The Ogg transport bitstream is designed to provide framing, error
-protection and seeking structure for higher-level codec streams that
-consist of raw, unencapsulated data packets, such as the Vorbis audio
-codec or Tarkin video codec.</p>
-
-<h2>Application example: Vorbis</h2>
-
-<p>Vorbis encodes short-time blocks of PCM data into raw packets of
-bit-packed data. These raw packets may be used directly by transport
-mechanisms that provide their own framing and packet-separation
-mechanisms (such as UDP datagrams). For stream based storage (such as
-files) and transport (such as TCP streams or pipes), Vorbis uses the
-Ogg bitstream format to provide framing/sync, sync recapture
-after error, landmarks during seeking, and enough information to
-properly separate data back into packets at the original packet
-boundaries without relying on decoding to find packet boundaries.</p>
-
-<h2>Design constraints for Ogg bitstreams</h2>
-
-<ol>
-<li>True streaming; we must not need to seek to build a 100%
-  complete bitstream.</li>
-<li>Use no more than approximately 1-2% of bitstream bandwidth for
-  packet boundary marking, high-level framing, sync and seeking.</li>
-<li>Specification of absolute position within the original sample
-  stream.</li>
-<li>Simple mechanism to ease limited editing, such as a simplified
-  concatenation mechanism.</li>
-<li>Detection of corruption, recapture after error and direct, random
-  access to data at arbitrary positions in the bitstream.</li>
-</ol>
-
-<h2>Logical and Physical Bitstreams</h2>
-
-<p>A <em>logical</em> Ogg bitstream is a contiguous stream of
-sequential pages belonging only to the logical bitstream. A
-<em>physical</em> Ogg bitstream is constructed from one or more
-than one logical Ogg bitstream (the simplest physical bitstream
-is simply a single logical bitstream). We describe below the exact
-formatting of an Ogg logical bitstream. Combining logical
-bitstreams into more complex physical bitstreams is described in the
-<a href="oggstream.html">Ogg bitstream overview</a>. The exact
-mapping of raw Vorbis packets into a valid Ogg Vorbis physical
-bitstream is described in <a href="vorbis-stream.html">Vorbis
-bitstream mapping</a>.</p>
-
-<h2>Bitstream structure</h2>
-
-<p>An Ogg stream is structured by dividing incoming packets into
-segments of up to 255 bytes and then wrapping a group of contiguous
-packet segments into a variable length page preceded by a page
-header. Both the header size and page size are variable; the page
-header contains sizing information and checksum data to determine
-header/page size and data integrity.</p>
-
-<p>The bitstream is captured (or recaptured) by looking for the beginning
-of a page, specifically the capture pattern. Once the capture pattern
-is found, the decoder verifies page sync and integrity by computing
-and comparing the checksum. At that point, the decoder can extract the
-packets themselves.</p>
-
-<h3>Packet segmentation</h3>
-
-<p>Packets are logically divided into multiple segments before encoding
-into a page. Note that the segmentation and fragmentation process is a
-logical one; it's used to compute page header values and the original
-page data need not be disturbed, even when a packet spans page
-boundaries.</p>
-
-<p>The raw packet is logically divided into [n] 255 byte segments and a
-last fractional segment of &lt; 255 bytes. A packet size may well
-consist only of the trailing fractional segment, and a fractional
-segment may be zero length. These values, called "lacing values" are
-then saved and placed into the header segment table.</p>
-
-<p>An example should make the basic concept clear:</p>
-
-<pre>
-<tt>
-raw packet:
-  ___________________________________________
- |______________packet data__________________| 753 bytes
-
-lacing values for page header segment table: 255,255,243
-</tt>
-</pre>
-
-<p>We simply add the lacing values for the total size; the last lacing
-value for a packet is always the value that is less than 255. Note
-that this encoding both avoids imposing a maximum packet size as well
-as imposing minimum overhead on small packets (as opposed to, eg,
-simply using two bytes at the head of every packet and having a max
-packet size of 32k. Small packets (&lt;255, the typical case) are
-penalized with twice the segmentation overhead). Using the lacing
-values as suggested, small packets see the minimum possible
-byte-aligned overheade (1 byte) and large packets, over 512 bytes or
-so, see a fairly constant ~.5% overhead on encoding space.</p>
-
-<p>Note that a lacing value of 255 implies that a second lacing value
-follows in the packet, and a value of &lt; 255 marks the end of the
-packet after that many additional bytes. A packet of 255 bytes (or a
-multiple of 255 bytes) is terminated by a lacing value of 0:</p>
-
-<pre><tt>
-raw packet:
-  _______________________________
- |________packet data____________|          255 bytes
-
-lacing values: 255, 0
-</tt></pre>
-
-<p>Note also that a 'nil' (zero length) packet is not an error; it
-consists of nothing more than a lacing value of zero in the header.</p>
-
-<h3>Packets spanning pages</h3>
-
-<p>Packets are not restricted to beginning and ending within a page,
-although individual segments are, by definition, required to do so.
-Packets are not restricted to a maximum size, although excessively
-large packets in the data stream are discouraged; the Ogg
-bitstream specification strongly recommends nominal page size of
-approximately 4-8kB (large packets are foreseen as being useful for
-initialization data at the beginning of a logical bitstream).</p>
-
-<p>After segmenting a packet, the encoder may decide not to place all the
-resulting segments into the current page; to do so, the encoder places
-the lacing values of the segments it wishes to belong to the current
-page into the current segment table, then finishes the page. The next
-page is begun with the first value in the segment table belonging to
-the next packet segment, thus continuing the packet (data in the
-packet body must also correspond properly to the lacing values in the
-spanned pages. The segment data in the first packet corresponding to
-the lacing values of the first page belong in that page; packet
-segments listed in the segment table of the following page must begin
-the page body of the subsequent page).</p>
-
-<p>The last mechanic to spanning a page boundary is to set the header
-flag in the new page to indicate that the first lacing value in the
-segment table continues rather than begins a packet; a header flag of
-0x01 is set to indicate a continued packet. Although mandatory, it
-is not actually algorithmically necessary; one could inspect the
-preceding segment table to determine if the packet is new or
-continued. Adding the information to the packet_header flag allows a
-simpler design (with no overhead) that needs only inspect the current
-page header after frame capture. This also allows faster error
-recovery in the event that the packet originates in a corrupt
-preceding page, implying that the previous page's segment table
-cannot be trusted.</p>
-
-<p>Note that a packet can span an arbitrary number of pages; the above
-spanning process is repeated for each spanned page boundary. Also a
-'zero termination' on a packet size that is an even multiple of 255
-must appear even if the lacing value appears in the next page as a
-zero-length continuation of the current packet. The header flag
-should be set to 0x01 to indicate that the packet spanned, even though
-the span is a nil case as far as data is concerned.</p>
-
-<p>The encoding looks odd, but is properly optimized for speed and the
-expected case of the majority of packets being between 50 and 200
-bytes (note that it is designed such that packets of wildly different
-sizes can be handled within the model; placing packet size
-restrictions on the encoder would have only slightly simplified design
-in page generation and increased overall encoder complexity).</p>
-
-<p>The main point behind tracking individual packets (and packet
-segments) is to allow more flexible encoding tricks that requiring
-explicit knowledge of packet size. An example is simple bandwidth
-limiting, implemented by simply truncating packets in the nominal case
-if the packet is arranged so that the least sensitive portion of the
-data comes last.</p>
-
-<h3>Page header</h3>
-
-<p>The headering mechanism is designed to avoid copying and re-assembly
-of the packet data (ie, making the packet segmentation process a
-logical one); the header can be generated directly from incoming
-packet data. The encoder buffers packet data until it finishes a
-complete page at which point it writes the header followed by the
-buffered packet segments.</p>
-
-<h4>capture_pattern</h4>
-
-<p>A header begins with a capture pattern that simplifies identifying
-pages; once the decoder has found the capture pattern it can do a more
-intensive job of verifying that it has in fact found a page boundary
-(as opposed to an inadvertent coincidence in the byte stream).</p>
-
-<pre><tt>
- byte value
-
-  0  0x4f 'O'
-  1  0x67 'g'
-  2  0x67 'g'
-  3  0x53 'S'  
-</tt></pre>
-
-<h4>stream_structure_version</h4>
-
-<p>The capture pattern is followed by the stream structure revision:</p>
-
-<pre><tt>
- byte value
-
-  4  0x00
-</tt></pre>
- 
-<h4>header_type_flag</h4>
-  
-<p>The header type flag identifies this page's context in the bitstream:</p>
-
-<pre><tt>
- byte value
-
-  5  bitflags: 0x01: unset = fresh packet
-	               set = continued packet
-	       0x02: unset = not first page of logical bitstream
-                       set = first page of logical bitstream (bos)
-	       0x04: unset = not last page of logical bitstream
-                       set = last page of logical bitstream (eos)
-</tt></pre>
-
-<h4>absolute granule position</h4>
-
-<p>(This is packed in the same way the rest of Ogg data is packed; LSb
-of LSB first. Note that the 'position' data specifies a 'sample'
-number (eg, in a CD quality sample is four octets, 16 bits for left
-and 16 bits for right; in video it would likely be the frame number.
-It is up to the specific codec in use to define the semantic meaning
-of the granule position value). The position specified is the total
-samples encoded after including all packets finished on this page
-(packets begun on this page but continuing on to the next page do not
-count). The rationale here is that the position specified in the
-frame header of the last page tells how long the data coded by the
-bitstream is. A truncated stream will still return the proper number
-of samples that can be decoded fully.</p>
-
-<p>A special value of '-1' (in two's complement) indicates that no packets
-finish on this page.</p>
-
-<pre><tt>
- byte value
-
-  6  0xXX LSB
-  7  0xXX
-  8  0xXX
-  9  0xXX
- 10  0xXX
- 11  0xXX
- 12  0xXX
- 13  0xXX MSB
-</tt></pre>
-
-<h4>stream serial number</h4>
- 
-<p>Ogg allows for separate logical bitstreams to be mixed at page
-granularity in a physical bitstream. The most common case would be
-sequential arrangement, but it is possible to interleave pages for
-two separate bitstreams to be decoded concurrently. The serial
-number is the means by which pages physical pages are associated with
-a particular logical stream. Each logical stream must have a unique
-serial number within a physical stream:</p>
-
-<pre><tt>
- byte value
-
- 14  0xXX LSB
- 15  0xXX
- 16  0xXX
- 17  0xXX MSB
-</tt></pre>
-
-<h4>page sequence no</h4>
-
-<p>Page counter; lets us know if a page is lost (useful where packets
-span page boundaries).</p>
-
-<pre><tt>
- byte value
-
- 18  0xXX LSB
- 19  0xXX
- 20  0xXX
- 21  0xXX MSB
-</tt></pre>
-
-<h4>page checksum</h4>
-     
-<p>32 bit CRC value (direct algorithm, initial val and final XOR = 0,
-generator polynomial=0x04c11db7). The value is computed over the
-entire header (with the CRC field in the header set to zero) and then
-continued over the page. The CRC field is then filled with the
-computed value.</p>
-
-<p>(A thorough discussion of CRC algorithms can be found in <a
-href="ftp://ftp.rocksoft.com/papers/crc_v3.txt">"A
-Painless Guide to CRC Error Detection Algorithms"</a> by Ross
-Williams <a
-href="mailto:ross at guest.adelaide.edu.au">ross at guest.adelaide.edu.au</a>.)</p>
-
-<pre><tt>
- byte value
-
- 22  0xXX LSB
- 23  0xXX
- 24  0xXX
- 25  0xXX MSB
-</tt></pre>
-
-<h4>page_segments</h4>
-
-<p>The number of segment entries to appear in the segment table. The
-maximum number of 255 segments (255 bytes each) sets the maximum
-possible physical page size at 65307 bytes or just under 64kB (thus
-we know that a header corrupted so as destroy sizing/alignment
-information will not cause a runaway bitstream. We'll read in the
-page according to the corrupted size information that's guaranteed to
-be a reasonable size regardless, notice the checksum mismatch, drop
-sync and then look for recapture).</p>
-
-<pre><tt>
- byte value
-
- 26 0x00-0xff (0-255)
-</tt></pre>
-
-<h4>segment_table (containing packet lacing values)</h4>
-
-<p>The lacing values for each packet segment physically appearing in
-this page are listed in contiguous order.</p>
-
-<pre><tt>
- byte value
-
- 27 0x00-0xff (0-255)
- [...]
- n  0x00-0xff (0-255, n=page_segments+26)
-</tt></pre>
-
-<p>Total page size is calculated directly from the known header size and
-lacing values in the segment table. Packet data segments follow
-immediately after the header.</p>
-
-<p>Page headers typically impose a flat .25-.5% space overhead assuming
-nominal ~8k page sizes. The segmentation table needed for exact
-packet recovery in the streaming layer adds approximately .5-1%
-nominal assuming expected encoder behavior in the 44.1kHz, 128kbps
-stereo encodings.</p>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg logical bitstream framing</h1>
+
+<h2>Ogg bitstreams</h2>
+
+<p>The Ogg transport bitstream is designed to provide framing, error
+protection and seeking structure for higher-level codec streams that
+consist of raw, unencapsulated data packets, such as the Vorbis audio
+codec or Theora video codec.</p>
+
+<h2>Application example: Vorbis</h2>
+
+<p>Vorbis encodes short-time blocks of PCM data into raw packets of
+bit-packed data. These raw packets may be used directly by transport
+mechanisms that provide their own framing and packet-separation
+mechanisms (such as UDP datagrams). For stream based storage (such as
+files) and transport (such as TCP streams or pipes), Vorbis uses the
+Ogg bitstream format to provide framing/sync, sync recapture
+after error, landmarks during seeking, and enough information to
+properly separate data back into packets at the original packet
+boundaries without relying on decoding to find packet boundaries.</p>
+
+<h2>Design constraints for Ogg bitstreams</h2>
+
+<ol>
+<li>True streaming; we must not need to seek to build a 100%
+  complete bitstream.</li>
+<li>Use no more than approximately 1-2% of bitstream bandwidth for
+  packet boundary marking, high-level framing, sync and seeking.</li>
+<li>Specification of absolute position within the original sample
+  stream.</li>
+<li>Simple mechanism to ease limited editing, such as a simplified
+  concatenation mechanism.</li>
+<li>Detection of corruption, recapture after error and direct, random
+  access to data at arbitrary positions in the bitstream.</li>
+</ol>
+
+<h2>Logical and Physical Bitstreams</h2>
+
+<p>A <em>logical</em> Ogg bitstream is a contiguous stream of
+sequential pages belonging only to the logical bitstream. A
+<em>physical</em> Ogg bitstream is constructed from one or more
+than one logical Ogg bitstream (the simplest physical bitstream
+is simply a single logical bitstream). We describe below the exact
+formatting of an Ogg logical bitstream. Combining logical
+bitstreams into more complex physical bitstreams is described in the
+<a href="oggstream.html">Ogg bitstream overview</a>. The exact
+mapping of raw Vorbis packets into a valid Ogg Vorbis physical
+bitstream is described in the Vorbis I Specification.</p>
+
+<h2>Bitstream structure</h2>
+
+<p>An Ogg stream is structured by dividing incoming packets into
+segments of up to 255 bytes and then wrapping a group of contiguous
+packet segments into a variable length page preceded by a page
+header. Both the header size and page size are variable; the page
+header contains sizing information and checksum data to determine
+header/page size and data integrity.</p>
+
+<p>The bitstream is captured (or recaptured) by looking for the beginning
+of a page, specifically the capture pattern. Once the capture pattern
+is found, the decoder verifies page sync and integrity by computing
+and comparing the checksum. At that point, the decoder can extract the
+packets themselves.</p>
+
+<h3>Packet segmentation</h3>
+
+<p>Packets are logically divided into multiple segments before encoding
+into a page. Note that the segmentation and fragmentation process is a
+logical one; it's used to compute page header values and the original
+page data need not be disturbed, even when a packet spans page
+boundaries.</p>
+
+<p>The raw packet is logically divided into [n] 255 byte segments and a
+last fractional segment of &lt; 255 bytes. A packet size may well
+consist only of the trailing fractional segment, and a fractional
+segment may be zero length. These values, called "lacing values" are
+then saved and placed into the header segment table.</p>
+
+<p>An example should make the basic concept clear:</p>
+
+<pre>
+<tt>
+raw packet:
+  ___________________________________________
+ |______________packet data__________________| 753 bytes
+
+lacing values for page header segment table: 255,255,243
+</tt>
+</pre>
+
+<p>We simply add the lacing values for the total size; the last lacing
+value for a packet is always the value that is less than 255. Note
+that this encoding both avoids imposing a maximum packet size as well
+as imposing minimum overhead on small packets (as opposed to, eg,
+simply using two bytes at the head of every packet and having a max
+packet size of 32k. Small packets (&lt;255, the typical case) are
+penalized with twice the segmentation overhead). Using the lacing
+values as suggested, small packets see the minimum possible
+byte-aligned overheade (1 byte) and large packets, over 512 bytes or
+so, see a fairly constant ~.5% overhead on encoding space.</p>
+
+<p>Note that a lacing value of 255 implies that a second lacing value
+follows in the packet, and a value of &lt; 255 marks the end of the
+packet after that many additional bytes. A packet of 255 bytes (or a
+multiple of 255 bytes) is terminated by a lacing value of 0:</p>
+
+<pre><tt>
+raw packet:
+  _______________________________
+ |________packet data____________|          255 bytes
+
+lacing values: 255, 0
+</tt></pre>
+
+<p>Note also that a 'nil' (zero length) packet is not an error; it
+consists of nothing more than a lacing value of zero in the header.</p>
+
+<h3>Packets spanning pages</h3>
+
+<p>Packets are not restricted to beginning and ending within a page,
+although individual segments are, by definition, required to do so.
+Packets are not restricted to a maximum size, although excessively
+large packets in the data stream are discouraged; the Ogg
+bitstream specification strongly recommends nominal page size of
+approximately 4-8kB (large packets are foreseen as being useful for
+initialization data at the beginning of a logical bitstream).</p>
+
+<p>After segmenting a packet, the encoder may decide not to place all the
+resulting segments into the current page; to do so, the encoder places
+the lacing values of the segments it wishes to belong to the current
+page into the current segment table, then finishes the page. The next
+page is begun with the first value in the segment table belonging to
+the next packet segment, thus continuing the packet (data in the
+packet body must also correspond properly to the lacing values in the
+spanned pages. The segment data in the first packet corresponding to
+the lacing values of the first page belong in that page; packet
+segments listed in the segment table of the following page must begin
+the page body of the subsequent page).</p>
+
+<p>The last mechanic to spanning a page boundary is to set the header
+flag in the new page to indicate that the first lacing value in the
+segment table continues rather than begins a packet; a header flag of
+0x01 is set to indicate a continued packet. Although mandatory, it
+is not actually algorithmically necessary; one could inspect the
+preceding segment table to determine if the packet is new or
+continued. Adding the information to the packet_header flag allows a
+simpler design (with no overhead) that needs only inspect the current
+page header after frame capture. This also allows faster error
+recovery in the event that the packet originates in a corrupt
+preceding page, implying that the previous page's segment table
+cannot be trusted.</p>
+
+<p>Note that a packet can span an arbitrary number of pages; the above
+spanning process is repeated for each spanned page boundary. Also a
+'zero termination' on a packet size that is an even multiple of 255
+must appear even if the lacing value appears in the next page as a
+zero-length continuation of the current packet. The header flag
+should be set to 0x01 to indicate that the packet spanned, even though
+the span is a nil case as far as data is concerned.</p>
+
+<p>The encoding looks odd, but is properly optimized for speed and the
+expected case of the majority of packets being between 50 and 200
+bytes (note that it is designed such that packets of wildly different
+sizes can be handled within the model; placing packet size
+restrictions on the encoder would have only slightly simplified design
+in page generation and increased overall encoder complexity).</p>
+
+<p>The main point behind tracking individual packets (and packet
+segments) is to allow more flexible encoding tricks that requiring
+explicit knowledge of packet size. An example is simple bandwidth
+limiting, implemented by simply truncating packets in the nominal case
+if the packet is arranged so that the least sensitive portion of the
+data comes last.</p>
+
+<h3>Page header</h3>
+
+<p>The headering mechanism is designed to avoid copying and re-assembly
+of the packet data (ie, making the packet segmentation process a
+logical one); the header can be generated directly from incoming
+packet data. The encoder buffers packet data until it finishes a
+complete page at which point it writes the header followed by the
+buffered packet segments.</p>
+
+<h4>capture_pattern</h4>
+
+<p>A header begins with a capture pattern that simplifies identifying
+pages; once the decoder has found the capture pattern it can do a more
+intensive job of verifying that it has in fact found a page boundary
+(as opposed to an inadvertent coincidence in the byte stream).</p>
+
+<pre><tt>
+ byte value
+
+  0  0x4f 'O'
+  1  0x67 'g'
+  2  0x67 'g'
+  3  0x53 'S'  
+</tt></pre>
+
+<h4>stream_structure_version</h4>
+
+<p>The capture pattern is followed by the stream structure revision:</p>
+
+<pre><tt>
+ byte value
+
+  4  0x00
+</tt></pre>
+ 
+<h4>header_type_flag</h4>
+  
+<p>The header type flag identifies this page's context in the bitstream:</p>
+
+<pre><tt>
+ byte value
+
+  5  bitflags: 0x01: unset = fresh packet
+	               set = continued packet
+	       0x02: unset = not first page of logical bitstream
+                       set = first page of logical bitstream (bos)
+	       0x04: unset = not last page of logical bitstream
+                       set = last page of logical bitstream (eos)
+</tt></pre>
+
+<h4>absolute granule position</h4>
+
+<p>(This is packed in the same way the rest of Ogg data is packed; LSb
+of LSB first. Note that the 'position' data specifies a 'sample'
+number (eg, in a CD quality sample is four octets, 16 bits for left
+and 16 bits for right; in video it would likely be the frame number.
+It is up to the specific codec in use to define the semantic meaning
+of the granule position value). The position specified is the total
+samples encoded after including all packets finished on this page
+(packets begun on this page but continuing on to the next page do not
+count). The rationale here is that the position specified in the
+frame header of the last page tells how long the data coded by the
+bitstream is. A truncated stream will still return the proper number
+of samples that can be decoded fully.</p>
+
+<p>A special value of '-1' (in two's complement) indicates that no packets
+finish on this page.</p>
+
+<pre><tt>
+ byte value
+
+  6  0xXX LSB
+  7  0xXX
+  8  0xXX
+  9  0xXX
+ 10  0xXX
+ 11  0xXX
+ 12  0xXX
+ 13  0xXX MSB
+</tt></pre>
+
+<h4>stream serial number</h4>
+ 
+<p>Ogg allows for separate logical bitstreams to be mixed at page
+granularity in a physical bitstream. The most common case would be
+sequential arrangement, but it is possible to interleave pages for
+two separate bitstreams to be decoded concurrently. The serial
+number is the means by which pages physical pages are associated with
+a particular logical stream. Each logical stream must have a unique
+serial number within a physical stream:</p>
+
+<pre><tt>
+ byte value
+
+ 14  0xXX LSB
+ 15  0xXX
+ 16  0xXX
+ 17  0xXX MSB
+</tt></pre>
+
+<h4>page sequence no</h4>
+
+<p>Page counter; lets us know if a page is lost (useful where packets
+span page boundaries).</p>
+
+<pre><tt>
+ byte value
+
+ 18  0xXX LSB
+ 19  0xXX
+ 20  0xXX
+ 21  0xXX MSB
+</tt></pre>
+
+<h4>page checksum</h4>
+     
+<p>32 bit CRC value (direct algorithm, initial val and final XOR = 0,
+generator polynomial=0x04c11db7). The value is computed over the
+entire header (with the CRC field in the header set to zero) and then
+continued over the page. The CRC field is then filled with the
+computed value.</p>
+
+<p>(A thorough discussion of CRC algorithms can be found in <a
+href="http://www.ross.net/crc/download/crc_v3.txt">"A
+Painless Guide to CRC Error Detection Algorithms"</a> by Ross
+Williams <a href="mailto:ross at ross.net">ross at ross.net</a>.)</p>
+
+<pre><tt>
+ byte value
+
+ 22  0xXX LSB
+ 23  0xXX
+ 24  0xXX
+ 25  0xXX MSB
+</tt></pre>
+
+<h4>page_segments</h4>
+
+<p>The number of segment entries to appear in the segment table. The
+maximum number of 255 segments (255 bytes each) sets the maximum
+possible physical page size at 65307 bytes or just under 64kB (thus
+we know that a header corrupted so as destroy sizing/alignment
+information will not cause a runaway bitstream. We'll read in the
+page according to the corrupted size information that's guaranteed to
+be a reasonable size regardless, notice the checksum mismatch, drop
+sync and then look for recapture).</p>
+
+<pre><tt>
+ byte value
+
+ 26 0x00-0xff (0-255)
+</tt></pre>
+
+<h4>segment_table (containing packet lacing values)</h4>
+
+<p>The lacing values for each packet segment physically appearing in
+this page are listed in contiguous order.</p>
+
+<pre><tt>
+ byte value
+
+ 27 0x00-0xff (0-255)
+ [...]
+ n  0x00-0xff (0-255, n=page_segments+26)
+</tt></pre>
+
+<p>Total page size is calculated directly from the known header size and
+lacing values in the segment table. Packet data segments follow
+immediately after the header.</p>
+
+<p>Page headers typically impose a flat .25-.5% space overhead assuming
+nominal ~8k page sizes. The segmentation table needed for exact
+packet recovery in the streaming layer adds approximately .5-1%
+nominal assuming expected encoder behavior in the 44.1kHz, 128kbps
+stereo encodings.</p>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/helper.html
===================================================================
--- branches/vorbis-aotuv/doc/helper.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/helper.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,239 +1,239 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis I format specification: helper equations</h1>
-
-<h1>Overview</h1>
-
-<p>The equations below are used in multiple places by the Vorbis codec
-specification. Rather than cluttering up the main specification
-documents, they are defined here and linked in the main documents
-where appropriate.</p>
-
-<h2><a name="log">ilog</a></h2>
-
-<p>The "ilog(x)" function returns the position number (1 through n) of the
-highest set bit in the two's complement integer value
-<tt>[x]</tt>. Values of <tt>[x]</tt> less than zero are defined to return zero.</p>
-
-<pre>
-  1) [return_value] = 0;
-  2) if ( [x] is greater than zero ){
-      
-       3) increment [return_value];
-       4) logical shift [x] one bit to the right, padding the MSb with zero
-       5) repeat at step 2)
-
-     }
-
-   6) done
-</pre>
-
-<p>Examples:</p>
-
-<ul>
-<li>ilog(0) = 0;</li>
-<li>ilog(1) = 1;</li>
-<li>ilog(2) = 2;</li>
-<li>ilog(3) = 2;</li>
-<li>ilog(4) = 3;</li>
-<li>ilog(7) = 3;</li>
-<li>ilog(negative number) = 0;</li>
-</ul>
-
-<h2><a name="float32_unpack">float32_unpack</a></h2>
-
-<p>"float32_unpack(x)" is intended to translate the packed binary
-representation of a Vorbis codebook float value into the
-representation used by the decoder for floating point numbers. For
-purposes of this example, we will unpack a Vorbis float32 into a
-host-native floating point number.</p>
-
-<pre>
-  1) [mantissa] = [x] bitwise AND 0x1fffff (unsigned result)
-  2) [sign] = [x] bitwise AND 0x80000000 (unsigned result)
-  3) [exponent] = ( [x] bitwise AND 0x7fe00000) shifted right 21 bits (unsigned result)
-  4) if ( [sign] is nonzero ) then negate [mantissa]
-  5) return [mantissa] * ( 2 ^ ( [exponent] - 788 ) )
-</pre>
-
-<h2><a name="lookup1_values">lookup1_values</a></h2>
-
-<p>"lookup1_values(codebook_entries,codebook_dimensions)" is used to
-compute the correct length of the value index for a codebook VQ lookup
-table of lookup type 1. The values on this list are permuted to
-construct the VQ vector lookup table of size
-<tt>[codebook_entries]</tt>.</p>
-
-<p>The return value for this function is defined to be 'the greatest
-integer value for which <tt>[return_value] to the power of
-[codebook_dimensions] is less than or equal to
-[codebook_entries]</tt>'.</p>
-
-<h2><a name="low_neighbor">low_neighbor</a></h2>
-
-<p>"low_neighbor(v,x)" finds the position <i>n</i> in vector [v] of
-the greatest value scalar element for which <i>n</i> is less than
-<tt>[x]</tt> and <tt>vector [v] element <i>n</i> is less
-than vector [v] element [x]</tt>.</p>
-
-<h2><a name="high_neighbor">high_neighbor</a></h2>
-
-<p>"high_neighbor(v,x)" finds the position <i>n</i> in vector [v] of
-the lowest value scalar element for which <i>n</i> is less than
-<tt>[x]</tt> and <tt>vector [v] element <i>n</i> is greater
-than vector [v] element [x]</tt>.</p>
-
-<h2><a name="render_point">render_point</a></h2>
-
-<p>"render_point(x0,y0,x1,y1,X)" is used to find the Y value at point X
-along the line specified by x0, x1, y0 and y1. This function uses an
-integer algorithm to solve for the point directly without calculating
-intervening values along the line.</p>
-
-<pre>
-  1)  [dy] = [y1] - [y0]
-  2) [adx] = [x1] - [x0]
-  3) [ady] = absolute value of [dy]
-  4) [err] = [ady] * ([X] - [x0])
-  5) [off] = [err] / [adx] using integer division
-  6) if ( [dy] is less than zero ) {
-
-       7) [Y] = [y0] - [off]
-
-     } else {
-
-       8) [Y] = [y0] + [off]
-  
-     }
-
-  9) done
-</pre>
-
-<h2><a name="render_line">render_line</a></h2>
-
-<p>Floor decode type one uses the integer line drawing algorithm of
-"render_line(x0, y0, x1, y1, v)" to construct an integer floor
-curve for contiguous piecewise line segments. Note that it has not
-been relevant elsewhere, but here we must define integer division as
-rounding division of both positive and negative numbers toward zero.</p>
-
-<pre>
-  1)   [dy] = [y1] - [y0]
-  2)  [adx] = [x1] - [x0]
-  3)  [ady] = absolute value of [dy]
-  4) [base] = [dy] / [adx] using integer division
-  5)    [x] = [x0]
-  6)    [y] = [y0]
-  7)  [err] = 0
-
-  8) if ( [dy] is less than 0 ) {
-
-        9) [sy] = [base] - 1
-
-     } else {
-
-       10) [sy] = [base] + 1
-
-     }
-
- 11) [ady] = [ady] - (absolute value of [base]) * [adx]
- 12) vector [v] element [x] = [y]
-
- 13) iterate [x] over the range [x0]+1 ... [x1]-1 {
-
-       14) [err] = [err] + [ady];
-       15) if ( [err] >= [adx] ) {
-
-             15) [err] = [err] - [adx]
-             16)   [y] = [y] + [sy]
-
-           } else {
-
-             17) [y] = [y] + [base]
-   
-           }
-
-       18) vector [v] element [x] = [y]
-
-     }
-</pre>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis I format specification: helper equations</h1>
+
+<h1>Overview</h1>
+
+<p>The equations below are used in multiple places by the Vorbis codec
+specification. Rather than cluttering up the main specification
+documents, they are defined here and linked in the main documents
+where appropriate.</p>
+
+<h2><a name="log">ilog</a></h2>
+
+<p>The "ilog(x)" function returns the position number (1 through n) of the
+highest set bit in the two's complement integer value
+<tt>[x]</tt>. Values of <tt>[x]</tt> less than zero are defined to return zero.</p>
+
+<pre>
+  1) [return_value] = 0;
+  2) if ( [x] is greater than zero ){
+      
+       3) increment [return_value];
+       4) logical shift [x] one bit to the right, padding the MSb with zero
+       5) repeat at step 2)
+
+     }
+
+   6) done
+</pre>
+
+<p>Examples:</p>
+
+<ul>
+<li>ilog(0) = 0;</li>
+<li>ilog(1) = 1;</li>
+<li>ilog(2) = 2;</li>
+<li>ilog(3) = 2;</li>
+<li>ilog(4) = 3;</li>
+<li>ilog(7) = 3;</li>
+<li>ilog(negative number) = 0;</li>
+</ul>
+
+<h2><a name="float32_unpack">float32_unpack</a></h2>
+
+<p>"float32_unpack(x)" is intended to translate the packed binary
+representation of a Vorbis codebook float value into the
+representation used by the decoder for floating point numbers. For
+purposes of this example, we will unpack a Vorbis float32 into a
+host-native floating point number.</p>
+
+<pre>
+  1) [mantissa] = [x] bitwise AND 0x1fffff (unsigned result)
+  2) [sign] = [x] bitwise AND 0x80000000 (unsigned result)
+  3) [exponent] = ( [x] bitwise AND 0x7fe00000) shifted right 21 bits (unsigned result)
+  4) if ( [sign] is nonzero ) then negate [mantissa]
+  5) return [mantissa] * ( 2 ^ ( [exponent] - 788 ) )
+</pre>
+
+<h2><a name="lookup1_values">lookup1_values</a></h2>
+
+<p>"lookup1_values(codebook_entries,codebook_dimensions)" is used to
+compute the correct length of the value index for a codebook VQ lookup
+table of lookup type 1. The values on this list are permuted to
+construct the VQ vector lookup table of size
+<tt>[codebook_entries]</tt>.</p>
+
+<p>The return value for this function is defined to be 'the greatest
+integer value for which <tt>[return_value] to the power of
+[codebook_dimensions] is less than or equal to
+[codebook_entries]</tt>'.</p>
+
+<h2><a name="low_neighbor">low_neighbor</a></h2>
+
+<p>"low_neighbor(v,x)" finds the position <i>n</i> in vector [v] of
+the greatest value scalar element for which <i>n</i> is less than
+<tt>[x]</tt> and <tt>vector [v] element <i>n</i> is less
+than vector [v] element [x]</tt>.</p>
+
+<h2><a name="high_neighbor">high_neighbor</a></h2>
+
+<p>"high_neighbor(v,x)" finds the position <i>n</i> in vector [v] of
+the lowest value scalar element for which <i>n</i> is less than
+<tt>[x]</tt> and <tt>vector [v] element <i>n</i> is greater
+than vector [v] element [x]</tt>.</p>
+
+<h2><a name="render_point">render_point</a></h2>
+
+<p>"render_point(x0,y0,x1,y1,X)" is used to find the Y value at point X
+along the line specified by x0, x1, y0 and y1. This function uses an
+integer algorithm to solve for the point directly without calculating
+intervening values along the line.</p>
+
+<pre>
+  1)  [dy] = [y1] - [y0]
+  2) [adx] = [x1] - [x0]
+  3) [ady] = absolute value of [dy]
+  4) [err] = [ady] * ([X] - [x0])
+  5) [off] = [err] / [adx] using integer division
+  6) if ( [dy] is less than zero ) {
+
+       7) [Y] = [y0] - [off]
+
+     } else {
+
+       8) [Y] = [y0] + [off]
+  
+     }
+
+  9) done
+</pre>
+
+<h2><a name="render_line">render_line</a></h2>
+
+<p>Floor decode type one uses the integer line drawing algorithm of
+"render_line(x0, y0, x1, y1, v)" to construct an integer floor
+curve for contiguous piecewise line segments. Note that it has not
+been relevant elsewhere, but here we must define integer division as
+rounding division of both positive and negative numbers toward zero.</p>
+
+<pre>
+  1)   [dy] = [y1] - [y0]
+  2)  [adx] = [x1] - [x0]
+  3)  [ady] = absolute value of [dy]
+  4) [base] = [dy] / [adx] using integer division
+  5)    [x] = [x0]
+  6)    [y] = [y0]
+  7)  [err] = 0
+
+  8) if ( [dy] is less than 0 ) {
+
+        9) [sy] = [base] - 1
+
+     } else {
+
+       10) [sy] = [base] + 1
+
+     }
+
+ 11) [ady] = [ady] - (absolute value of [base]) * [adx]
+ 12) vector [v] element [x] = [y]
+
+ 13) iterate [x] over the range [x0]+1 ... [x1]-1 {
+
+       14) [err] = [err] + [ady];
+       15) if ( [err] >= [adx] ) {
+
+             15) [err] = [err] - [adx]
+             16)   [y] = [y] + [sy]
+
+           } else {
+
+             17) [y] = [y] + [base]
+   
+           }
+
+       18) vector [v] element [x] = [y]
+
+     }
+</pre>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/index.html
===================================================================
--- branches/vorbis-aotuv/doc/index.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/index.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,114 +1,114 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis Documentation</h1>
-
-<h2>Vorbis technical discussion documents</h2>
-<ul>
-<li><a href="vorbis-fidelity.html">Fidelity measurement terminology</a></li>
-<li><a href="stereo.html">Vorbis channel coupling and stereo-specific application</a></li>
-</ul>
-
-<h2>Ogg Vorbis I specification</h2>
-
-<ul>
-<li>Vorbis I specification [<a href="Vorbis_I_spec.html">html</a>]
-  [<a href="Vorbis_I_spec.pdf">pdf</a>]</li>
-<li><a href="v-comment.html">Vorbis comment header specification</a></li>
-<li><a href="draft-kerr-avt-vorbis-rtp-03.txt">Embedding Vorbis encoded 
-audio in an RTP payload format</a></li>
-</ul>
-
-<h2>Ogg Vorbis programming documents</h2>
-
-<ul>
-<li>Programming with libvorbis</li>
-<li><a href="vorbisfile/index.html">Programming with vorbisfile</a></li>
-<li><a href="vorbisenc/index.html">Programming with vorbisenc</a></li>
-</ul>
-
-<h2>Ogg bitstream documentation</h2>
-
-<ul>
-<li><a href="oggstream.html">Ogg bitstream overview</a></li>
-<li><a href="framing.html">Ogg logical bitstream and framing spec</a></li>
-</ul>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis Documentation</h1>
+
+<h2>Vorbis technical discussion documents</h2>
+<ul>
+<li><a href="vorbis-fidelity.html">Fidelity measurement terminology</a></li>
+<li><a href="stereo.html">Vorbis channel coupling and stereo-specific application</a></li>
+</ul>
+
+<h2>Ogg Vorbis I specification</h2>
+
+<ul>
+<li>Vorbis I specification [<a href="Vorbis_I_spec.html">html</a>]
+  [<a href="Vorbis_I_spec.pdf">pdf</a>]</li>
+<li><a href="v-comment.html">Vorbis comment header specification</a></li>
+<li><a href="draft-ietf-avt-rtp-vorbis-06.txt">Embedding Vorbis encoded 
+audio in an RTP payload format</a></li>
+</ul>
+
+<h2>Ogg Vorbis programming documents</h2>
+
+<ul>
+<li>Programming with libvorbis</li>
+<li><a href="vorbisfile/index.html">Programming with vorbisfile</a></li>
+<li><a href="vorbisenc/index.html">Programming with vorbisenc</a></li>
+</ul>
+
+<h2>Ogg bitstream documentation</h2>
+
+<ul>
+<li><a href="oggstream.html">Ogg bitstream overview</a></li>
+<li><a href="framing.html">Ogg logical bitstream and framing spec</a></li>
+</ul>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2006 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/oggstream.html
===================================================================
--- branches/vorbis-aotuv/doc/oggstream.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/oggstream.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,234 +1,234 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg logical and physical bitstream overview</h1>
-
-<h2>Ogg bitstreams</h2>
-
-<p>Ogg codecs use octet vectors of raw, compressed data
-(<em>packets</em>). These compressed packets do not have any
-high-level structure or boundary information; strung together, they
-appear to be streams of random bytes with no landmarks.</p>
-
-<p>Raw packets may be used directly by transport mechanisms that provide
-their own framing and packet-separation mechanisms (such as UDP
-datagrams). For stream based storage (such as files) and transport
-(such as TCP streams or pipes), Vorbis and other future Ogg codecs use
-the Ogg bitstream format to provide framing/sync, sync recapture
-after error, landmarks during seeking, and enough information to
-properly separate data back into packets at the original packet
-boundaries without relying on decoding to find packet boundaries.</p>
-
-<h2>Logical and physical bitstreams</h2>
-
-<p>Raw packets are grouped and encoded into contiguous pages of
-structured bitstream data called <em>logical bitstreams</em>. A
-logical bitstream consists of pages, in order, belonging to a single
-codec instance. Each page is a self contained entity (although it is
-possible that a packet may be split and encoded across one or more
-pages); that is, the page decode mechanism is designed to recognize,
-verify and handle single pages at a time from the overall bitstream.</p>
-
-<p>Multiple logical bitstreams can be combined (with restrictions) into a
-single <em>physical bitstream</em>. A physical bitstream consists of
-multiple logical bitstreams multiplexed at the page level and may
-include a 'meta-header' at the beginning of the multiplexed logical
-stream that serves as identification magic. Whole pages are taken in
-order from multiple logical bitstreams and combined into a single
-physical stream of pages. The decoder reconstructs the original
-logical bitstreams from the physical bitstream by taking the pages in
-order from the physical bitstream and redirecting them into the
-appropriate logical decoding entity. The simplest physical bitstream
-is a single, unmultiplexed logical bitstream with no meta-header; this
-is referred to as a 'degenerate stream'.</p>
-
-<p><a href="framing.html">Ogg Logical Bitstream Framing</a> discusses
-the page format of an Ogg bitstream, the packet coding process
-and logical bitstreams in detail. The remainder of this document
-specifies requirements for constructing finished, physical Ogg
-bitstreams.</p>
-
-<h2>Mapping Restrictions</h2>
-
-<p>Logical bitstreams may not be mapped/multiplexed into physical
-bitstreams without restriction. Here we discuss design restrictions
-on Ogg physical bitstreams in general, mostly to introduce
-design rationale. Each 'media' format defines its own (generally more
-restrictive) mapping. An 'Ogg Vorbis Audio Bitstream', for example, has a
-specific physical bitstream structure.
-An 'Ogg A/V' bitstream (not currently specified) will also mandate a
-specific, restricted physical bitstream format.</p>
-
-<h3>additional end-to-end structure</h3>
-
-<p>The <a href="framing.html">framing specification</a> defines
-'beginning of stream' and 'end of stream' page markers via a header
-flag (it is possible for a stream to consist of a single page). A
-stream always consists of an integer number of pages, an easy
-requirement given the variable size nature of pages.</p>
-
-<p>In addition to the header flag marking the first and last pages of a
-logical bitstream, the first page of an Ogg bitstream obeys
-additional restrictions. Each individual media mapping specifies its
-own implementation details regarding these restrictions.</p>
-
-<p>The first page of a logical Ogg bitstream consists of a single,
-small 'initial header' packet that includes sufficient information to
-identify the exact CODEC type and media requirements of the logical
-bitstream. The intent of this restriction is to simplify identifying
-the bitstream type and content; for a given media type (or across all
-Ogg media types) we can know that we only need a small, fixed
-amount of data to uniquely identify the bitstream type.</p>
-
-<p>As an example, Ogg Vorbis places the name and revision of the Vorbis
-CODEC, the audio rate and the audio quality into this initial header,
-thus simplifying vastly the certain identification of an Ogg Vorbis
-audio bitstream.</p>
-
-<h3>sequential multiplexing (chaining)</h3>
-
-<p>The simplest form of logical bitstream multiplexing is concatenation
-(<em>chaining</em>). Complete logical bitstreams are strung
-one-after-another in order. The bitstreams do not overlap; the final
-page of a given logical bitstream is immediately followed by the
-initial page of the next. Chaining is the only logical->physical
-mapping allowed by Ogg Vorbis.</p>
-
-<p>Each chained logical bitstream must have a unique serial number within
-the scope of the physical bitstream.</p>
-
-<h3>concurrent multiplexing (grouping)</h3>
-
-<p>Logical bitstreams may also be multiplexed 'in parallel'
-(<em>grouped</em>). An example of grouping would be to allow
-streaming of separate audio and video streams, using different codecs
-and different logical bitstreams, in the same physical bitstream.
-Whole pages from multiple logical bitstreams are mixed together.</p>
-
-<p>The initial pages of each logical bitstream must appear first; the
-media mapping specifies the order of the initial pages. For example,
-Ogg A/V will eventually specify an Ogg video bitstream with
-audio. The mapping may specify that the physical bitstream must begin
-with the initial page of a logical video bitstream, followed by the
-initial page of an audio stream. Unlike initial pages, terminal pages
-for the logical bitstreams need not all occur contiguously (although a
-specific media mapping may require this; it is not mandated by the
-generic Ogg stream spec). Terminal pages may be 'nil' pages,
-that is, pages containing no content but simply a page header with
-position information and the 'last page of bitstream' flag set in the
-page header.</p>
-
-<p>Each grouped bitstream must have a unique serial number within the
-scope of the physical bitstream.</p>
-
-<h3>sequential and concurrent multiplexing</h3>
-
-<p>Groups of concurrently multiplexed bitstreams may be chained
-consecutively. Such a physical bitstream obeys all the rules of both
-grouped and chained multiplexed streams; the groups, when unchained ,
-must stand on their own as a valid concurrently multiplexed
-bitstream.</p>
-
-<h3>multiplexing example</h3>
-
-<p>Below, we present an example of a grouped and chained bitstream:</p>
-
-<p><img src="stream.png" alt="stream"/></p>
-
-<p>In this example, we see pages from five total logical bitstreams
-multiplexed into a physical bitstream. Note the following
-characteristics:</p>
-
-<ol>
-<li>Grouped bitstreams begin together; all of the initial pages
-must appear before any data pages. When concurrently multiplexed
-groups are chained, the new group does not begin until all the
-bitstreams in the previous group have terminated.</li>
-
-<li>The pages of concurrently multiplexed bitstreams need not conform
-to a regular order; the only requirement is that page <tt>n</tt> of a
-logical bitstream follow page <tt>n-1</tt> in the physical bitstream.
-There are no restrictions on intervening pages belonging to other
-logical bitstreams. (Tying page appearance to bitrate demands is one
-logical strategy, ie, the page appears at the chronological point
-where decode requires more information).</li>
-</ol>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg logical and physical bitstream overview</h1>
+
+<h2>Ogg bitstreams</h2>
+
+<p>Ogg codecs use octet vectors of raw, compressed data
+(<em>packets</em>). These compressed packets do not have any
+high-level structure or boundary information; strung together, they
+appear to be streams of random bytes with no landmarks.</p>
+
+<p>Raw packets may be used directly by transport mechanisms that provide
+their own framing and packet-separation mechanisms (such as UDP
+datagrams). For stream based storage (such as files) and transport
+(such as TCP streams or pipes), Vorbis and other future Ogg codecs use
+the Ogg bitstream format to provide framing/sync, sync recapture
+after error, landmarks during seeking, and enough information to
+properly separate data back into packets at the original packet
+boundaries without relying on decoding to find packet boundaries.</p>
+
+<h2>Logical and physical bitstreams</h2>
+
+<p>Raw packets are grouped and encoded into contiguous pages of
+structured bitstream data called <em>logical bitstreams</em>. A
+logical bitstream consists of pages, in order, belonging to a single
+codec instance. Each page is a self contained entity (although it is
+possible that a packet may be split and encoded across one or more
+pages); that is, the page decode mechanism is designed to recognize,
+verify and handle single pages at a time from the overall bitstream.</p>
+
+<p>Multiple logical bitstreams can be combined (with restrictions) into a
+single <em>physical bitstream</em>. A physical bitstream consists of
+multiple logical bitstreams multiplexed at the page level and may
+include a 'meta-header' at the beginning of the multiplexed logical
+stream that serves as identification magic. Whole pages are taken in
+order from multiple logical bitstreams and combined into a single
+physical stream of pages. The decoder reconstructs the original
+logical bitstreams from the physical bitstream by taking the pages in
+order from the physical bitstream and redirecting them into the
+appropriate logical decoding entity. The simplest physical bitstream
+is a single, unmultiplexed logical bitstream with no meta-header; this
+is referred to as a 'degenerate stream'.</p>
+
+<p><a href="framing.html">Ogg Logical Bitstream Framing</a> discusses
+the page format of an Ogg bitstream, the packet coding process
+and logical bitstreams in detail. The remainder of this document
+specifies requirements for constructing finished, physical Ogg
+bitstreams.</p>
+
+<h2>Mapping Restrictions</h2>
+
+<p>Logical bitstreams may not be mapped/multiplexed into physical
+bitstreams without restriction. Here we discuss design restrictions
+on Ogg physical bitstreams in general, mostly to introduce
+design rationale. Each 'media' format defines its own (generally more
+restrictive) mapping. An 'Ogg Vorbis Audio Bitstream', for example, has a
+specific physical bitstream structure.
+An 'Ogg A/V' bitstream (not currently specified) will also mandate a
+specific, restricted physical bitstream format.</p>
+
+<h3>additional end-to-end structure</h3>
+
+<p>The <a href="framing.html">framing specification</a> defines
+'beginning of stream' and 'end of stream' page markers via a header
+flag (it is possible for a stream to consist of a single page). A
+stream always consists of an integer number of pages, an easy
+requirement given the variable size nature of pages.</p>
+
+<p>In addition to the header flag marking the first and last pages of a
+logical bitstream, the first page of an Ogg bitstream obeys
+additional restrictions. Each individual media mapping specifies its
+own implementation details regarding these restrictions.</p>
+
+<p>The first page of a logical Ogg bitstream consists of a single,
+small 'initial header' packet that includes sufficient information to
+identify the exact CODEC type and media requirements of the logical
+bitstream. The intent of this restriction is to simplify identifying
+the bitstream type and content; for a given media type (or across all
+Ogg media types) we can know that we only need a small, fixed
+amount of data to uniquely identify the bitstream type.</p>
+
+<p>As an example, Ogg Vorbis places the name and revision of the Vorbis
+CODEC, the audio rate and the audio quality into this initial header,
+thus simplifying vastly the certain identification of an Ogg Vorbis
+audio bitstream.</p>
+
+<h3>sequential multiplexing (chaining)</h3>
+
+<p>The simplest form of logical bitstream multiplexing is concatenation
+(<em>chaining</em>). Complete logical bitstreams are strung
+one-after-another in order. The bitstreams do not overlap; the final
+page of a given logical bitstream is immediately followed by the
+initial page of the next. Chaining is the only logical->physical
+mapping allowed by Ogg Vorbis.</p>
+
+<p>Each chained logical bitstream must have a unique serial number within
+the scope of the physical bitstream.</p>
+
+<h3>concurrent multiplexing (grouping)</h3>
+
+<p>Logical bitstreams may also be multiplexed 'in parallel'
+(<em>grouped</em>). An example of grouping would be to allow
+streaming of separate audio and video streams, using different codecs
+and different logical bitstreams, in the same physical bitstream.
+Whole pages from multiple logical bitstreams are mixed together.</p>
+
+<p>The initial pages of each logical bitstream must appear first; the
+media mapping specifies the order of the initial pages. For example,
+Ogg A/V will eventually specify an Ogg video bitstream with
+audio. The mapping may specify that the physical bitstream must begin
+with the initial page of a logical video bitstream, followed by the
+initial page of an audio stream. Unlike initial pages, terminal pages
+for the logical bitstreams need not all occur contiguously (although a
+specific media mapping may require this; it is not mandated by the
+generic Ogg stream spec). Terminal pages may be 'nil' pages,
+that is, pages containing no content but simply a page header with
+position information and the 'last page of bitstream' flag set in the
+page header.</p>
+
+<p>Each grouped bitstream must have a unique serial number within the
+scope of the physical bitstream.</p>
+
+<h3>sequential and concurrent multiplexing</h3>
+
+<p>Groups of concurrently multiplexed bitstreams may be chained
+consecutively. Such a physical bitstream obeys all the rules of both
+grouped and chained multiplexed streams; the groups, when unchained ,
+must stand on their own as a valid concurrently multiplexed
+bitstream.</p>
+
+<h3>multiplexing example</h3>
+
+<p>Below, we present an example of a grouped and chained bitstream:</p>
+
+<p><img src="stream.png" alt="stream"/></p>
+
+<p>In this example, we see pages from five total logical bitstreams
+multiplexed into a physical bitstream. Note the following
+characteristics:</p>
+
+<ol>
+<li>Grouped bitstreams begin together; all of the initial pages
+must appear before any data pages. When concurrently multiplexed
+groups are chained, the new group does not begin until all the
+bitstreams in the previous group have terminated.</li>
+
+<li>The pages of concurrently multiplexed bitstreams need not conform
+to a regular order; the only requirement is that page <tt>n</tt> of a
+logical bitstream follow page <tt>n-1</tt> in the physical bitstream.
+There are no restrictions on intervening pages belonging to other
+logical bitstreams. (Tying page appearance to bitrate demands is one
+logical strategy, ie, the page appears at the chronological point
+where decode requires more information).</li>
+</ol>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/programming.html
===================================================================
--- branches/vorbis-aotuv/doc/programming.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/programming.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,554 +1,554 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Programming with Xiph.org <tt>libvorbis</tt></h1>
-
-<h2>Description</h2> 
-
-<p>Libvorbis is the Xiph.org Foundation's portable Ogg Vorbis CODEC
-implemented as a programmatic library. Libvorbis provides primitives
-to handle framing and manipulation of Ogg bitstreams (used by the
-Vorbis for streaming), a full analysis (encoding) interface as well as
-packet decoding and synthesis for playback.</p>
-
-<p>The libvorbis library does not provide any system interface; a
-full-featured demonstration player included with the library
-distribtion provides example code for a variety of system interfaces
-as well as a working example of using libvorbis in production code.</p>
-
-<h2>Encoding Overview</h2>
-
-<h2>Decoding Overview</h2>
-
-<p>Decoding a bitstream with libvorbis follows roughly the following
-steps:</p>
-
-<ol>
-<li>Frame the incoming bitstream into pages</li>
-<li>Sort the pages by logical bitstream and buffer then into logical streams</li>
-<li>Decompose the logical streams into raw packets</li>
-<li>Reconstruct segments of the original data from each packet</li>
-<li>Glue the reconstructed segments back into a decoded stream</li>
-</ol>
-
-<h3>Framing</h3>
-
-<p>An Ogg bitstream is logically arranged into pages, but to decode
-the pages, we have to find them first. The raw bitstream is first fed
-into an <tt>ogg_sync_state</tt> buffer using <tt>ogg_sync_buffer()</tt>
-and <tt>ogg_sync_wrote()</tt>. After each block we submit to the sync
-buffer, we should check to see if we can frame and extract a complete
-page or pages using <tt>ogg_sync_pageout()</tt>. Extra pages are
-buffered; allowing them to build up in the <tt>ogg_sync_state</tt>
-buffer will eventually exhaust memory.</p>
-
-<p>The Ogg pages returned from <tt>ogg_sync_pageout</tt> need not be
-decoded further to be used as landmarks in seeking; seeking can be
-either a rough process of simply jumping to approximately intuited
-portions of the bitstream, or it can be a precise bisection process
-that captures pages and inspects data position. When seeking,
-however, sequential multiplexing (chaining) must be accounted for;
-beginning play in a new logical bitstream requires initializing a
-synthesis engine with the headers from that bitstream. Vorbis
-bitstreams do not make use of concurent multiplexing (grouping).</p>
-
-<h3>Sorting</h3>
-
-<p>The pages produced by <tt>ogg_sync_pageout</tt> are then sorted by
-serial number to seperate logical bitstreams. Initialize logical
-bitstream buffers (<tt>og_stream_state</tt>) using
-<tt>ogg_stream_init()</tt>. Pages are submitted to the matching
-logical bitstream buffer using <tt>ogg_stream_pagein</tt>; the serial
-number of the page and the stream buffer must match, or the page will
-be rejected. A page submitted out of sequence will simply be noted,
-and in the course of outputting packets, the hole will be flagged
-(<tt>ogg_sync_pageout</tt> and <tt>ogg_stream_packetout</tt> will
-return a negative value at positions where they had to recapture the
-stream).</p>
-
-<h3>Extracting packets</h3>
-
-<p>After submitting page[s] to a logical stream, read available packets
-using <tt>ogg_stream_packetout</tt>.</p>
-
-<h3>Decoding packets</h3>
-
-<h3>Reassembling data segments</h3>
-
-<h2>Ogg Bitstream Manipulation Structures</h2>
-
-<p>Two of the Ogg bitstream data structures are intended to be
-transparent to the developer; the fields should be used directly.</p>
-
-<h3>ogg_packet</h3>
-
-<pre>
-typedef struct {
-  unsigned char *packet;
-  long  bytes;
-  long  b_o_s;
-  long  e_o_s;
-
-  size64 granulepos;
-
-} ogg_packet;
-</pre>
-
-<dl>
-<dt>packet:</dt>
-<dd>a pointer to the byte data of the raw packet</dd>
-<dt>bytes:</dt>
-<dd>the size of the packet' raw data</dd>
-<dt>b_o_s:</dt>
-<dd>beginning of stream; nonzero if this is the first packet of 
-  the logical bitstream</dd>
-<dt>e_o_s:</dt>
-<dd>end of stream; nonzero if this is the last packet of the 
-  logical bitstream</dd>
-<dt>granulepos:</dt>
-<dd>the absolute position of this packet in the original 
-  uncompressed data stream.</dd>
-</dl>
-
-<h4>encoding notes</h4>
-
-<p>The encoder is responsible for setting all of
-the fields of the packet to appropriate values before submission to
-<tt>ogg_stream_packetin()</tt>; however, it is noted that the value in
-<tt>b_o_s</tt> is ignored; the first page produced from a given
-<tt>ogg_stream_state</tt> structure will be stamped as the initial
-page. <tt>e_o_s</tt>, however, must be set; this is the means by
-which the stream encoding primitives handle end of stream and cleanup.</p>
-
-<h4>decoding notes</h4>
-
-<p><tt>ogg_stream_packetout()</tt> sets the fields
-to appropriate values. Note that granulepos will be >= 0 only in the
-case that the given packet actually represents that position (ie, only
-the last packet completed on any page will have a meaningful
-<tt>granulepos</tt>). Intervening frames will see <tt>granulepos</tt> set
-to -1.</p>
-
-<h3>ogg_page</h3>
-
-<pre>
-typedef struct {
-  unsigned char *header;
-  long header_len;
-  unsigned char *body;
-  long body_len;
-} ogg_page;
-</pre>
-
-<dl>
-<dt>header:</dt>
-<dd>pointer to the page header data</dd>
-<dt>header_len:</dt>
-<dd>length of the page header in bytes</dd>
-<dt>body:</dt>
-<dd>pointer to the page body</dd>
-<dt>body_len:</dt>
-<dd>length of the page body</dd>
-</dl>
-
-<p>Note that although the <tt>header</tt> and <tt>body</tt> pointers do
-not necessarily point into a single contiguous page vector, the page
-body must immediately follow the header in the bitstream.</p>
-
-<h2>Ogg Bitstream Manipulation Functions</h2>
-
-<h3>
-int    ogg_page_bos(ogg_page *og);
-</h3>
-
-<p>Returns the 'beginning of stream' flag for the given Ogg page. The
-beginning of stream flag is set on the initial page of a logical
-bitstream.</p>
-
-<p>Zero indicates the flag is cleared (this is not the initial page of a
-logical bitstream). Nonzero indicates the flag is set (this is the
-initial page of a logical bitstream).</p>
-
-<h3>
-int    ogg_page_continued(ogg_page *og);
-</h3>
-
-<p>Returns the 'packet continued' flag for the given Ogg page. The packet
-continued flag indicates whether or not the body data of this page
-begins with packet continued from a preceeding page.</p>
-
-<p>Zero (unset) indicates that the body data begins with a new packet.
-Nonzero (set) indicates that the first packet data on the page is a
-continuation from the preceeding page.</p>
-
-<h3>
-int    ogg_page_eos(ogg_page *og);
-</h3>
-
-<p>Returns the 'end of stream' flag for a give Ogg page. The end of page
-flag is set on the last (terminal) page of a logical bitstream.</p>
-
-<p>Zero (unset) indicates that this is not the last page of a logical
-bitstream. Nonzero (set) indicates that this is the last page of a
-logical bitstream and that no addiitonal pages belonging to this
-bitstream may follow.</p>
-
-<h3>
-size64 ogg_page_granulepos(ogg_page *og);
-</h3>
-
-<p>Returns the position of this page as an absolute position within the
-original uncompressed data. The position, as returned, is 'frames
-encoded to date up to and including the last whole packet on this
-page'. Partial packets begun on this page but continued to the
-following page are not included. If no packet ends on this page, the
-frame position value will be equal to the frame position value of the
-preceeding page. If none of the original uncompressed data is yet
-represented in the logical bitstream (for example, the first page of a
-bitstream consists only of a header packet; this packet encodes only
-metadata), the value shall be zero.</p>
-
-<p>The units of the framenumber are determined by media mapping. A
-vorbis audio bitstream, for example, defines one frame to be the
-channel values from a single sampling period (eg, a 16 bit stereo
-bitstream consists of two samples of two bytes for a total of four
-bytes, thus a frame would be four bytes). A video stream defines one
-frame to be a single frame of video.</p>
-
-<h3>
-int    ogg_page_pageno(ogg_page *og);
-</h3>
-
-<p>Returns the sequential page number of the given Ogg page. The first
-page in a logical bitstream is numbered zero; following pages are
-numbered in increasing monotonic order.</p>
-
-<h3>
-int    ogg_page_serialno(ogg_page *og);
-</h3>
-
-<p>Returns the serial number of the given Ogg page. The serial number is
-used as a handle to distinguish various logical bitstreams in a
-physical Ogg bitstresm. Every logical bitstream within a
-physical bitstream must use a unique (within the scope of the physical
-bitstream) serial number, which is stamped on all bitstream pages.</p>
-
-<h3>
-int    ogg_page_version(ogg_page *og);
-</h3>
-
-<p>Returns the revision of the Ogg bitstream structure of the given page.
-Currently, the only permitted number is zero. Later revisions of the
-bitstream spec will increment this version should any changes be
-incompatable.</p>
-
-<h3>
-int    ogg_stream_clear(ogg_stream_state *os);
-</h3>
-
-<p>Clears and deallocates the internal storage of the given Ogg stream.
-After clearing, the stream structure is not initialized for use;
-<tt>ogg_stream_init</tt> must be called to reinitialize for use.
-Use <tt>ogg_stream_reset</tt> to reset the stream state
-to a fresh, intiialized state.</p>
-
-<p><tt>ogg_stream_clear</tt> does not call <tt>free()</tt> on the pointer
-<tt>os</tt>, allowing use of this call on stream structures in static
-or automatic storage. <tt>ogg_stream_destroy</tt>is a complimentary
-function that frees the pointer as well.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-int    ogg_stream_destroy(ogg_stream_state *os);
-</h3>
-
-<p>Clears and deallocates the internal storage of the given Ogg stream,
-then frees the storage associated with the pointer <tt>os</tt>.</p>
-
-<p><tt>ogg_stream_clear</tt> does not call <tt>free()</tt> on the pointer
-<tt>os</tt>, allowing use of that call on stream structures in static
-or automatic storage.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-int    ogg_stream_init(ogg_stream_state *os,int serialno);
-</h3>
-
-<p>Initialize the storage associated with <tt>os</tt> for use as an Ogg
-stream. This call is used to initialize a stream for both encode and
-decode. The given serial number is the serial number that will be
-stamped on pages of the produced bitstream (during encode), or used as
-a check that pages match (during decode).</p>
-
-<p>Returns zero on success, nonzero on failure.</p>
-
-<h3>
-int    ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
-</h3>
-
-<p>Used during encoding to add the given raw packet to the given Ogg
-bitstream. The contents of <tt>op</tt> are copied;
-<tt>ogg_stream_packetin</tt> does not retain any pointers into
-<tt>op</tt>'s storage. The encoding proccess buffers incoming packets
-until enough packets have been assembled to form an entire page;
-<tt>ogg_stream_pageout</tt> is used to read complete pages.</p>
-
-<p>Returns zero on success, nonzero on failure.</p>
-
-<h3>
-int    ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
-</h3>
-
-<p>Used during decoding to read raw packets from the given logical
-bitstream. <tt>ogg_stream_packetout</tt> will only return complete
-packets for which checksumming indicates no corruption. The size and
-contents of the packet exactly match those given in the encoding
-process. </p>
-
-<p>Returns zero if the next packet is not ready to be read (not buffered
-or incomplete), positive if it returned a complete packet in
-<tt>op</tt> and negative if there is a gap, extra bytes or corruption
-at this position in the bitstream (essentially that the bitstream had
-to be recaptured). A negative value is not necessarily an error. It
-would be a common occurence when seeking, for example, which requires
-recapture of the bitstream at the position decoding continued.</p>
-
-<p>If the return value is positive, <tt>ogg_stream_packetout</tt> placed
-a packet in <tt>op</tt>. The data in <tt>op</tt> points to static
-storage that is valid until the next call to
-<tt>ogg_stream_pagein</tt>, <tt>ogg_stream_clear</tt>,
-<tt>ogg_stream_reset</tt>, or <tt>ogg_stream_destroy</tt>. The
-pointers are not invalidated by more calls to
-<tt>ogg_stream_packetout</tt>.</p>
-
-<h3>
-int    ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
-</h3>
-
-<p>Used during decoding to buffer the given complete, pre-verified page
-for decoding into raw Ogg packets. The given page must be framed,
-normally produced by <tt>ogg_sync_pageout</tt>, and from the logical
-bitstream associated with <tt>os</tt> (the serial numbers must match).
-The contents of the given page are copied; <tt>ogg_stream_pagein</tt>
-retains no pointers into <tt>og</tt> storage.</p>
-
-<p>Returns zero on success and non-zero on failure.</p>
-
-<h3>
-int    ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
-</h3>
-
-<p>Used during encode to read complete pages from the stream buffer. The
-returned page is ready for sending out to the real world.</p>
-
-<p>Returns zero if there is no complete page ready for reading. Returns
-nonzero when it has placed data for a complete page into
-<tt>og</tt>. Note that the storage returned in og points into internal
-storage; the pointers in <tt>og</tt> are valid until the next call to
-<tt>ogg_stream_pageout</tt>, <tt>ogg_stream_packetin</tt>,
-<tt>ogg_stream_reset</tt>, <tt>ogg_stream_clear</tt> or
-<tt>ogg_stream_destroy</tt>.</p>
-
-<h3>
-int    ogg_stream_reset(ogg_stream_state *os);
-</h3>
-
-<p>Resets the given stream's state to that of a blank, unused stream;
-this may be used during encode or decode.</p>
-
-<p>Note that if used during encode, it does not alter the stream's serial
-number. In addition, the next page produced during encoding will be
-marked as the 'initial' page of the logical bitstream.</p>
-
-<p>When used during decode, this simply clears the data buffer of any
-pending pages. Beginning and end of stream cues are read from the
-bitstream and are unaffected by reset.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-char  *ogg_sync_buffer(ogg_sync_state *oy, long size);
-</h3>
-
-<p>This call is used to buffer a raw bitstream for framing and
-verification. <tt>ogg_sync_buffer</tt> handles stream capture and
-recapture, checksumming, and division into Ogg pages (as required by
-<tt>ogg_stream_pagein</tt>).</p>
-
-<p><tt>ogg_sync_buffer</tt> exposes a buffer area into which the decoder
-copies the next (up to) <tt>size</tt> bytes. We expose the buffer
-(rather than taking a buffer) in order to avoid an extra copy many
-uses; this way, for example, <tt>read()</tt> can transfer data
-directly into the stream buffer without first needing to place it in
-temporary storage.</p>
-
-<p>Returns a pointer into <tt>oy</tt>'s internal bitstream sync buffer;
-the remaining space in the sync buffer is at least <tt>size</tt>
-bytes. The decoder need not write all of <tt>size</tt> bytes;
-<tt>ogg_sync_wrote</tt> is used to inform the engine how many bytes
-were actually written. Use of <tt>ogg_sync_wrote</tt> after writing
-into the exposed buffer is mandantory.</p>
-
-<h3>
-int    ogg_sync_clear(ogg_sync_state *oy);
-</h3>
-
-<p><tt>ogg_sync_clear</tt>
-clears and deallocates the internal storage of the given Ogg sync
-buffer. After clearing, the sync structure is not initialized for
-use; <tt>ogg_sync_init</tt> must be called to reinitialize for use.
-Use <tt>ogg_sync_reset</tt> to reset the sync state and buffer to a
-fresh, intiialized state.</p>
-
-<p><tt>ogg_sync_clear</tt> does not call <tt>free()</tt> on the pointer
-<tt>oy</tt>, allowing use of this call on sync structures in static
-or automatic storage. <tt>ogg_sync_destroy</tt>is a complimentary
-function that frees the pointer as well.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-int    ogg_sync_destroy(ogg_sync_state *oy);
-</h3>
-
-<p>Clears and deallocates the internal storage of the given Ogg sync
-buffer, then frees the storage associated with the pointer
-<tt>oy</tt>.</p>
-
-<p><tt>ogg_sync_clear</tt> does not call <tt>free()</tt> on the pointer
-<tt>oy</tt>, allowing use of that call on stream structures in static
-or automatic storage.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-int    ogg_sync_init(ogg_sync_state *oy);
-</h3>
-
-<p>Initializes the sync buffer <tt>oy</tt> for use.</p>
-
-<p>Returns zero on success and non-zero on failure. This function always
-succeeds.</p>
-
-<h3>
-int    ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
-</h3>
-
-<p>Reads complete, framed, verified Ogg pages from the sync buffer,
-placing the page data in <tt>og</tt>.</p>
-
-<p>Returns zero when there's no complete pages buffered for
-retrieval. Returns negative when a loss of sync or recapture occurred
-(this is not necessarily an error; recapture would be required after
-seeking, for example). Returns positive when a page is returned in
-<tt>og</tt>. Note that the data in <tt>og</tt> points into the sync
-buffer storage; the pointers are valid until the next call to
-<tt>ogg_sync_buffer</tt>, <tt>ogg_sync_clear</tt>,
-<tt>ogg_sync_destroy</tt> or <tt>ogg_sync_reset</tt>.</p>
-
-<h3>
-int    ogg_sync_reset(ogg_sync_state *oy);
-</h3>
-
-<p><tt>ogg_sync_reset</tt> resets the sync state in <tt>oy</tt> to a
-clean, empty state. This is useful, for example, when seeking to a
-new location in a bitstream.</p>
-
-<p>Returns zero on success, nonzero on failure.</p>
-
-<h3>
-int    ogg_sync_wrote(ogg_sync_state *oy, long bytes);
-</h3>
-
-<p>Used to inform the sync state as to how many bytes were actually
-written into the exposed sync buffer. It must be equal to or less
-than the size of the buffer requested.</p>
-
-<p>Returns zero on success and non-zero on failure; failure occurs only
-when the number of bytes written were larger than the buffer.</p>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Programming with Xiph.org <tt>libvorbis</tt></h1>
+
+<h2>Description</h2> 
+
+<p>Libvorbis is the Xiph.org Foundation's portable Ogg Vorbis CODEC
+implemented as a programmatic library. Libvorbis provides primitives
+to handle framing and manipulation of Ogg bitstreams (used by the
+Vorbis for streaming), a full analysis (encoding) interface as well as
+packet decoding and synthesis for playback.</p>
+
+<p>The libvorbis library does not provide any system interface; a
+full-featured demonstration player included with the library
+distribtion provides example code for a variety of system interfaces
+as well as a working example of using libvorbis in production code.</p>
+
+<h2>Encoding Overview</h2>
+
+<h2>Decoding Overview</h2>
+
+<p>Decoding a bitstream with libvorbis follows roughly the following
+steps:</p>
+
+<ol>
+<li>Frame the incoming bitstream into pages</li>
+<li>Sort the pages by logical bitstream and buffer then into logical streams</li>
+<li>Decompose the logical streams into raw packets</li>
+<li>Reconstruct segments of the original data from each packet</li>
+<li>Glue the reconstructed segments back into a decoded stream</li>
+</ol>
+
+<h3>Framing</h3>
+
+<p>An Ogg bitstream is logically arranged into pages, but to decode
+the pages, we have to find them first. The raw bitstream is first fed
+into an <tt>ogg_sync_state</tt> buffer using <tt>ogg_sync_buffer()</tt>
+and <tt>ogg_sync_wrote()</tt>. After each block we submit to the sync
+buffer, we should check to see if we can frame and extract a complete
+page or pages using <tt>ogg_sync_pageout()</tt>. Extra pages are
+buffered; allowing them to build up in the <tt>ogg_sync_state</tt>
+buffer will eventually exhaust memory.</p>
+
+<p>The Ogg pages returned from <tt>ogg_sync_pageout</tt> need not be
+decoded further to be used as landmarks in seeking; seeking can be
+either a rough process of simply jumping to approximately intuited
+portions of the bitstream, or it can be a precise bisection process
+that captures pages and inspects data position. When seeking,
+however, sequential multiplexing (chaining) must be accounted for;
+beginning play in a new logical bitstream requires initializing a
+synthesis engine with the headers from that bitstream. Vorbis
+bitstreams do not make use of concurent multiplexing (grouping).</p>
+
+<h3>Sorting</h3>
+
+<p>The pages produced by <tt>ogg_sync_pageout</tt> are then sorted by
+serial number to seperate logical bitstreams. Initialize logical
+bitstream buffers (<tt>og_stream_state</tt>) using
+<tt>ogg_stream_init()</tt>. Pages are submitted to the matching
+logical bitstream buffer using <tt>ogg_stream_pagein</tt>; the serial
+number of the page and the stream buffer must match, or the page will
+be rejected. A page submitted out of sequence will simply be noted,
+and in the course of outputting packets, the hole will be flagged
+(<tt>ogg_sync_pageout</tt> and <tt>ogg_stream_packetout</tt> will
+return a negative value at positions where they had to recapture the
+stream).</p>
+
+<h3>Extracting packets</h3>
+
+<p>After submitting page[s] to a logical stream, read available packets
+using <tt>ogg_stream_packetout</tt>.</p>
+
+<h3>Decoding packets</h3>
+
+<h3>Reassembling data segments</h3>
+
+<h2>Ogg Bitstream Manipulation Structures</h2>
+
+<p>Two of the Ogg bitstream data structures are intended to be
+transparent to the developer; the fields should be used directly.</p>
+
+<h3>ogg_packet</h3>
+
+<pre>
+typedef struct {
+  unsigned char *packet;
+  long  bytes;
+  long  b_o_s;
+  long  e_o_s;
+
+  size64 granulepos;
+
+} ogg_packet;
+</pre>
+
+<dl>
+<dt>packet:</dt>
+<dd>a pointer to the byte data of the raw packet</dd>
+<dt>bytes:</dt>
+<dd>the size of the packet' raw data</dd>
+<dt>b_o_s:</dt>
+<dd>beginning of stream; nonzero if this is the first packet of 
+  the logical bitstream</dd>
+<dt>e_o_s:</dt>
+<dd>end of stream; nonzero if this is the last packet of the 
+  logical bitstream</dd>
+<dt>granulepos:</dt>
+<dd>the absolute position of this packet in the original 
+  uncompressed data stream.</dd>
+</dl>
+
+<h4>encoding notes</h4>
+
+<p>The encoder is responsible for setting all of
+the fields of the packet to appropriate values before submission to
+<tt>ogg_stream_packetin()</tt>; however, it is noted that the value in
+<tt>b_o_s</tt> is ignored; the first page produced from a given
+<tt>ogg_stream_state</tt> structure will be stamped as the initial
+page. <tt>e_o_s</tt>, however, must be set; this is the means by
+which the stream encoding primitives handle end of stream and cleanup.</p>
+
+<h4>decoding notes</h4>
+
+<p><tt>ogg_stream_packetout()</tt> sets the fields
+to appropriate values. Note that granulepos will be >= 0 only in the
+case that the given packet actually represents that position (ie, only
+the last packet completed on any page will have a meaningful
+<tt>granulepos</tt>). Intervening frames will see <tt>granulepos</tt> set
+to -1.</p>
+
+<h3>ogg_page</h3>
+
+<pre>
+typedef struct {
+  unsigned char *header;
+  long header_len;
+  unsigned char *body;
+  long body_len;
+} ogg_page;
+</pre>
+
+<dl>
+<dt>header:</dt>
+<dd>pointer to the page header data</dd>
+<dt>header_len:</dt>
+<dd>length of the page header in bytes</dd>
+<dt>body:</dt>
+<dd>pointer to the page body</dd>
+<dt>body_len:</dt>
+<dd>length of the page body</dd>
+</dl>
+
+<p>Note that although the <tt>header</tt> and <tt>body</tt> pointers do
+not necessarily point into a single contiguous page vector, the page
+body must immediately follow the header in the bitstream.</p>
+
+<h2>Ogg Bitstream Manipulation Functions</h2>
+
+<h3>
+int    ogg_page_bos(ogg_page *og);
+</h3>
+
+<p>Returns the 'beginning of stream' flag for the given Ogg page. The
+beginning of stream flag is set on the initial page of a logical
+bitstream.</p>
+
+<p>Zero indicates the flag is cleared (this is not the initial page of a
+logical bitstream). Nonzero indicates the flag is set (this is the
+initial page of a logical bitstream).</p>
+
+<h3>
+int    ogg_page_continued(ogg_page *og);
+</h3>
+
+<p>Returns the 'packet continued' flag for the given Ogg page. The packet
+continued flag indicates whether or not the body data of this page
+begins with packet continued from a preceeding page.</p>
+
+<p>Zero (unset) indicates that the body data begins with a new packet.
+Nonzero (set) indicates that the first packet data on the page is a
+continuation from the preceeding page.</p>
+
+<h3>
+int    ogg_page_eos(ogg_page *og);
+</h3>
+
+<p>Returns the 'end of stream' flag for a give Ogg page. The end of page
+flag is set on the last (terminal) page of a logical bitstream.</p>
+
+<p>Zero (unset) indicates that this is not the last page of a logical
+bitstream. Nonzero (set) indicates that this is the last page of a
+logical bitstream and that no addiitonal pages belonging to this
+bitstream may follow.</p>
+
+<h3>
+size64 ogg_page_granulepos(ogg_page *og);
+</h3>
+
+<p>Returns the position of this page as an absolute position within the
+original uncompressed data. The position, as returned, is 'frames
+encoded to date up to and including the last whole packet on this
+page'. Partial packets begun on this page but continued to the
+following page are not included. If no packet ends on this page, the
+frame position value will be equal to the frame position value of the
+preceeding page. If none of the original uncompressed data is yet
+represented in the logical bitstream (for example, the first page of a
+bitstream consists only of a header packet; this packet encodes only
+metadata), the value shall be zero.</p>
+
+<p>The units of the framenumber are determined by media mapping. A
+vorbis audio bitstream, for example, defines one frame to be the
+channel values from a single sampling period (eg, a 16 bit stereo
+bitstream consists of two samples of two bytes for a total of four
+bytes, thus a frame would be four bytes). A video stream defines one
+frame to be a single frame of video.</p>
+
+<h3>
+int    ogg_page_pageno(ogg_page *og);
+</h3>
+
+<p>Returns the sequential page number of the given Ogg page. The first
+page in a logical bitstream is numbered zero; following pages are
+numbered in increasing monotonic order.</p>
+
+<h3>
+int    ogg_page_serialno(ogg_page *og);
+</h3>
+
+<p>Returns the serial number of the given Ogg page. The serial number is
+used as a handle to distinguish various logical bitstreams in a
+physical Ogg bitstresm. Every logical bitstream within a
+physical bitstream must use a unique (within the scope of the physical
+bitstream) serial number, which is stamped on all bitstream pages.</p>
+
+<h3>
+int    ogg_page_version(ogg_page *og);
+</h3>
+
+<p>Returns the revision of the Ogg bitstream structure of the given page.
+Currently, the only permitted number is zero. Later revisions of the
+bitstream spec will increment this version should any changes be
+incompatable.</p>
+
+<h3>
+int    ogg_stream_clear(ogg_stream_state *os);
+</h3>
+
+<p>Clears and deallocates the internal storage of the given Ogg stream.
+After clearing, the stream structure is not initialized for use;
+<tt>ogg_stream_init</tt> must be called to reinitialize for use.
+Use <tt>ogg_stream_reset</tt> to reset the stream state
+to a fresh, intiialized state.</p>
+
+<p><tt>ogg_stream_clear</tt> does not call <tt>free()</tt> on the pointer
+<tt>os</tt>, allowing use of this call on stream structures in static
+or automatic storage. <tt>ogg_stream_destroy</tt>is a complimentary
+function that frees the pointer as well.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+int    ogg_stream_destroy(ogg_stream_state *os);
+</h3>
+
+<p>Clears and deallocates the internal storage of the given Ogg stream,
+then frees the storage associated with the pointer <tt>os</tt>.</p>
+
+<p><tt>ogg_stream_clear</tt> does not call <tt>free()</tt> on the pointer
+<tt>os</tt>, allowing use of that call on stream structures in static
+or automatic storage.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+int    ogg_stream_init(ogg_stream_state *os,int serialno);
+</h3>
+
+<p>Initialize the storage associated with <tt>os</tt> for use as an Ogg
+stream. This call is used to initialize a stream for both encode and
+decode. The given serial number is the serial number that will be
+stamped on pages of the produced bitstream (during encode), or used as
+a check that pages match (during decode).</p>
+
+<p>Returns zero on success, nonzero on failure.</p>
+
+<h3>
+int    ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
+</h3>
+
+<p>Used during encoding to add the given raw packet to the given Ogg
+bitstream. The contents of <tt>op</tt> are copied;
+<tt>ogg_stream_packetin</tt> does not retain any pointers into
+<tt>op</tt>'s storage. The encoding proccess buffers incoming packets
+until enough packets have been assembled to form an entire page;
+<tt>ogg_stream_pageout</tt> is used to read complete pages.</p>
+
+<p>Returns zero on success, nonzero on failure.</p>
+
+<h3>
+int    ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
+</h3>
+
+<p>Used during decoding to read raw packets from the given logical
+bitstream. <tt>ogg_stream_packetout</tt> will only return complete
+packets for which checksumming indicates no corruption. The size and
+contents of the packet exactly match those given in the encoding
+process. </p>
+
+<p>Returns zero if the next packet is not ready to be read (not buffered
+or incomplete), positive if it returned a complete packet in
+<tt>op</tt> and negative if there is a gap, extra bytes or corruption
+at this position in the bitstream (essentially that the bitstream had
+to be recaptured). A negative value is not necessarily an error. It
+would be a common occurence when seeking, for example, which requires
+recapture of the bitstream at the position decoding continued.</p>
+
+<p>If the return value is positive, <tt>ogg_stream_packetout</tt> placed
+a packet in <tt>op</tt>. The data in <tt>op</tt> points to static
+storage that is valid until the next call to
+<tt>ogg_stream_pagein</tt>, <tt>ogg_stream_clear</tt>,
+<tt>ogg_stream_reset</tt>, or <tt>ogg_stream_destroy</tt>. The
+pointers are not invalidated by more calls to
+<tt>ogg_stream_packetout</tt>.</p>
+
+<h3>
+int    ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
+</h3>
+
+<p>Used during decoding to buffer the given complete, pre-verified page
+for decoding into raw Ogg packets. The given page must be framed,
+normally produced by <tt>ogg_sync_pageout</tt>, and from the logical
+bitstream associated with <tt>os</tt> (the serial numbers must match).
+The contents of the given page are copied; <tt>ogg_stream_pagein</tt>
+retains no pointers into <tt>og</tt> storage.</p>
+
+<p>Returns zero on success and non-zero on failure.</p>
+
+<h3>
+int    ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
+</h3>
+
+<p>Used during encode to read complete pages from the stream buffer. The
+returned page is ready for sending out to the real world.</p>
+
+<p>Returns zero if there is no complete page ready for reading. Returns
+nonzero when it has placed data for a complete page into
+<tt>og</tt>. Note that the storage returned in og points into internal
+storage; the pointers in <tt>og</tt> are valid until the next call to
+<tt>ogg_stream_pageout</tt>, <tt>ogg_stream_packetin</tt>,
+<tt>ogg_stream_reset</tt>, <tt>ogg_stream_clear</tt> or
+<tt>ogg_stream_destroy</tt>.</p>
+
+<h3>
+int    ogg_stream_reset(ogg_stream_state *os);
+</h3>
+
+<p>Resets the given stream's state to that of a blank, unused stream;
+this may be used during encode or decode.</p>
+
+<p>Note that if used during encode, it does not alter the stream's serial
+number. In addition, the next page produced during encoding will be
+marked as the 'initial' page of the logical bitstream.</p>
+
+<p>When used during decode, this simply clears the data buffer of any
+pending pages. Beginning and end of stream cues are read from the
+bitstream and are unaffected by reset.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+char  *ogg_sync_buffer(ogg_sync_state *oy, long size);
+</h3>
+
+<p>This call is used to buffer a raw bitstream for framing and
+verification. <tt>ogg_sync_buffer</tt> handles stream capture and
+recapture, checksumming, and division into Ogg pages (as required by
+<tt>ogg_stream_pagein</tt>).</p>
+
+<p><tt>ogg_sync_buffer</tt> exposes a buffer area into which the decoder
+copies the next (up to) <tt>size</tt> bytes. We expose the buffer
+(rather than taking a buffer) in order to avoid an extra copy many
+uses; this way, for example, <tt>read()</tt> can transfer data
+directly into the stream buffer without first needing to place it in
+temporary storage.</p>
+
+<p>Returns a pointer into <tt>oy</tt>'s internal bitstream sync buffer;
+the remaining space in the sync buffer is at least <tt>size</tt>
+bytes. The decoder need not write all of <tt>size</tt> bytes;
+<tt>ogg_sync_wrote</tt> is used to inform the engine how many bytes
+were actually written. Use of <tt>ogg_sync_wrote</tt> after writing
+into the exposed buffer is mandantory.</p>
+
+<h3>
+int    ogg_sync_clear(ogg_sync_state *oy);
+</h3>
+
+<p><tt>ogg_sync_clear</tt>
+clears and deallocates the internal storage of the given Ogg sync
+buffer. After clearing, the sync structure is not initialized for
+use; <tt>ogg_sync_init</tt> must be called to reinitialize for use.
+Use <tt>ogg_sync_reset</tt> to reset the sync state and buffer to a
+fresh, intiialized state.</p>
+
+<p><tt>ogg_sync_clear</tt> does not call <tt>free()</tt> on the pointer
+<tt>oy</tt>, allowing use of this call on sync structures in static
+or automatic storage. <tt>ogg_sync_destroy</tt>is a complimentary
+function that frees the pointer as well.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+int    ogg_sync_destroy(ogg_sync_state *oy);
+</h3>
+
+<p>Clears and deallocates the internal storage of the given Ogg sync
+buffer, then frees the storage associated with the pointer
+<tt>oy</tt>.</p>
+
+<p><tt>ogg_sync_clear</tt> does not call <tt>free()</tt> on the pointer
+<tt>oy</tt>, allowing use of that call on stream structures in static
+or automatic storage.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+int    ogg_sync_init(ogg_sync_state *oy);
+</h3>
+
+<p>Initializes the sync buffer <tt>oy</tt> for use.</p>
+
+<p>Returns zero on success and non-zero on failure. This function always
+succeeds.</p>
+
+<h3>
+int    ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
+</h3>
+
+<p>Reads complete, framed, verified Ogg pages from the sync buffer,
+placing the page data in <tt>og</tt>.</p>
+
+<p>Returns zero when there's no complete pages buffered for
+retrieval. Returns negative when a loss of sync or recapture occurred
+(this is not necessarily an error; recapture would be required after
+seeking, for example). Returns positive when a page is returned in
+<tt>og</tt>. Note that the data in <tt>og</tt> points into the sync
+buffer storage; the pointers are valid until the next call to
+<tt>ogg_sync_buffer</tt>, <tt>ogg_sync_clear</tt>,
+<tt>ogg_sync_destroy</tt> or <tt>ogg_sync_reset</tt>.</p>
+
+<h3>
+int    ogg_sync_reset(ogg_sync_state *oy);
+</h3>
+
+<p><tt>ogg_sync_reset</tt> resets the sync state in <tt>oy</tt> to a
+clean, empty state. This is useful, for example, when seeking to a
+new location in a bitstream.</p>
+
+<p>Returns zero on success, nonzero on failure.</p>
+
+<h3>
+int    ogg_sync_wrote(ogg_sync_state *oy, long bytes);
+</h3>
+
+<p>Used to inform the sync state as to how many bytes were actually
+written into the exposed sync buffer. It must be equal to or less
+than the size of the buffer requested.</p>
+
+<p>Returns zero on success and non-zero on failure; failure occurs only
+when the number of bytes written were larger than the buffer.</p>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/stereo.html
===================================================================
--- branches/vorbis-aotuv/doc/stereo.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/stereo.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,418 +1,418 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a, h4, h4 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis stereo-specific channel coupling discussion</h1>
-
-<h2>Abstract</h2>
-
-<p>The Vorbis audio CODEC provides a channel coupling
-mechanisms designed to reduce effective bitrate by both eliminating
-interchannel redundancy and eliminating stereo image information
-labeled inaudible or undesirable according to spatial psychoacoustic
-models. This document describes both the mechanical coupling
-mechanisms available within the Vorbis specification, as well as the
-specific stereo coupling models used by the reference
-<tt>libvorbis</tt> codec provided by xiph.org.</p>
-
-<h2>Mechanisms</h2>
-
-<p>In encoder release beta 4 and earlier, Vorbis supported multiple
-channel encoding, but the channels were encoded entirely separately
-with no cross-analysis or redundancy elimination between channels.
-This multichannel strategy is very similar to the mp3's <em>dual
-stereo</em> mode and Vorbis uses the same name for its analogous
-uncoupled multichannel modes.</p>
-
-<p>However, the Vorbis spec provides for, and Vorbis release 1.0 rc1 and
-later implement a coupled channel strategy. Vorbis has two specific
-mechanisms that may be used alone or in conjunction to implement
-channel coupling. The first is <em>channel interleaving</em> via
-residue backend type 2, and the second is <em>square polar
-mapping</em>. These two general mechanisms are particularly well
-suited to coupling due to the structure of Vorbis encoding, as we'll
-explore below, and using both we can implement both totally
-<em>lossless stereo image coupling</em> [bit-for-bit decode-identical
-to uncoupled modes], as well as various lossy models that seek to
-eliminate inaudible or unimportant aspects of the stereo image in
-order to enhance bitrate. The exact coupling implementation is
-generalized to allow the encoder a great deal of flexibility in
-implementation of a stereo or surround model without requiring any
-significant complexity increase over the combinatorially simpler
-mid/side joint stereo of mp3 and other current audio codecs.</p>
-
-<p>A particular Vorbis bitstream may apply channel coupling directly to
-more than a pair of channels; polar mapping is hierarchical such that
-polar coupling may be extrapolated to an arbitrary number of channels
-and is not restricted to only stereo, quadraphonics, ambisonics or 5.1
-surround. However, the scope of this document restricts itself to the
-stereo coupling case.</p>
-
-<h3>Square Polar Mapping</h3>
-
-<h4>maximal correlation</h4>
- 
-<p>Recall that the basic structure of a a Vorbis I stream first generates
-from input audio a spectral 'floor' function that serves as an
-MDCT-domain whitening filter. This floor is meant to represent the
-rough envelope of the frequency spectrum, using whatever metric the
-encoder cares to define. This floor is subtracted from the log
-frequency spectrum, effectively normalizing the spectrum by frequency.
-Each input channel is associated with a unique floor function.</p>
-
-<p>The basic idea behind any stereo coupling is that the left and right
-channels usually correlate. This correlation is even stronger if one
-first accounts for energy differences in any given frequency band
-across left and right; think for example of individual instruments
-mixed into different portions of the stereo image, or a stereo
-recording with a dominant feature not perfectly in the center. The
-floor functions, each specific to a channel, provide the perfect means
-of normalizing left and right energies across the spectrum to maximize
-correlation before coupling. This feature of the Vorbis format is not
-a convenient accident.</p>
-
-<p>Because we strive to maximally correlate the left and right channels
-and generally succeed in doing so, left and right residue is typically
-nearly identical. We could use channel interleaving (discussed below)
-alone to efficiently remove the redundancy between the left and right
-channels as a side effect of entropy encoding, but a polar
-representation gives benefits when left/right correlation is
-strong.</p>
-
-<h4>point and diffuse imaging</h4>
-
-<p>The first advantage of a polar representation is that it effectively
-separates the spatial audio information into a 'point image'
-(magnitude) at a given frequency and located somewhere in the sound
-field, and a 'diffuse image' (angle) that fills a large amount of
-space simultaneously. Even if we preserve only the magnitude (point)
-data, a detailed and carefully chosen floor function in each channel
-provides us with a free, fine-grained, frequency relative intensity
-stereo*. Angle information represents diffuse sound fields, such as
-reverberation that fills the entire space simultaneously.</p>
-
-<p>*<em>Because the Vorbis model supports a number of different possible
-stereo models and these models may be mixed, we do not use the term
-'intensity stereo' talking about Vorbis; instead we use the terms
-'point stereo', 'phase stereo' and subcategories of each.</em></p>
-
-<p>The majority of a stereo image is representable by polar magnitude
-alone, as strong sounds tend to be produced at near-point sources;
-even non-diffuse, fast, sharp echoes track very accurately using
-magnitude representation almost alone (for those experimenting with
-Vorbis tuning, this strategy works much better with the precise,
-piecewise control of floor 1; the continuous approximation of floor 0
-results in unstable imaging). Reverberation and diffuse sounds tend
-to contain less energy and be psychoacoustically dominated by the
-point sources embedded in them. Thus, we again tend to concentrate
-more represented energy into a predictably smaller number of numbers.
-Separating representation of point and diffuse imaging also allows us
-to model and manipulate point and diffuse qualities separately.</p>
-
-<h4>controlling bit leakage and symbol crosstalk</h4>
-
-<p>Because polar
-representation concentrates represented energy into fewer large
-values, we reduce bit 'leakage' during cascading (multistage VQ
-encoding) as a secondary benefit. A single large, monolithic VQ
-codebook is more efficient than a cascaded book due to entropy
-'crosstalk' among symbols between different stages of a multistage cascade.
-Polar representation is a way of further concentrating entropy into
-predictable locations so that codebook design can take steps to
-improve multistage codebook efficiency. It also allows us to cascade
-various elements of the stereo image independently.</p>
-
-<h4>eliminating trigonometry and rounding</h4>
-
-<p>Rounding and computational complexity are potential problems with a
-polar representation. As our encoding process involves quantization,
-mixing a polar representation and quantization makes it potentially
-impossible, depending on implementation, to construct a coupled stereo
-mechanism that results in bit-identical decompressed output compared
-to an uncoupled encoding should the encoder desire it.</p>
-
-<p>Vorbis uses a mapping that preserves the most useful qualities of
-polar representation, relies only on addition/subtraction (during
-decode; high quality encoding still requires some trig), and makes it
-trivial before or after quantization to represent an angle/magnitude
-through a one-to-one mapping from possible left/right value
-permutations. We do this by basing our polar representation on the
-unit square rather than the unit-circle.</p>
-
-<p>Given a magnitude and angle, we recover left and right using the
-following function (note that A/B may be left/right or right/left
-depending on the coupling definition used by the encoder):</p>
-
-<pre>
-      if(magnitude>0)
-        if(angle>0){
-          A=magnitude;
-          B=magnitude-angle;
-        }else{
-          B=magnitude;
-          A=magnitude+angle;
-        }
-      else
-        if(angle>0){
-          A=magnitude;
-          B=magnitude+angle;
-        }else{
-          B=magnitude;
-          A=magnitude-angle;
-        }
-    }
-</pre>
-
-<p>The function is antisymmetric for positive and negative magnitudes in
-order to eliminate a redundant value when quantizing. For example, if
-we're quantizing to integer values, we can visualize a magnitude of 5
-and an angle of -2 as follows:</p>
-
-<p><img src="squarepolar.png" alt="square polar"/></p>
-
-<p>This representation loses or replicates no values; if the range of A
-and B are integral -5 through 5, the number of possible Cartesian
-permutations is 121. Represented in square polar notation, the
-possible values are:</p>
-
-<pre>
- 0, 0
-
--1,-2  -1,-1  -1, 0  -1, 1
-
- 1,-2   1,-1   1, 0   1, 1
-
--2,-4  -2,-3  -2,-2  -2,-1  -2, 0  -2, 1  -2, 2  -2, 3  
-
- 2,-4   2,-3   ... following the pattern ...
-
- ...   5, 1   5, 2   5, 3   5, 4   5, 5   5, 6   5, 7   5, 8   5, 9
-
-</pre>
-
-<p>...for a grand total of 121 possible values, the same number as in
-Cartesian representation (note that, for example, <tt>5,-10</tt> is
-the same as <tt>-5,10</tt>, so there's no reason to represent
-both. 2,10 cannot happen, and there's no reason to account for it.)
-It's also obvious that this mapping is exactly reversible.</p>
-
-<h3>Channel interleaving</h3>
-
-<p>We can remap and A/B vector using polar mapping into a magnitude/angle
-vector, and it's clear that, in general, this concentrates energy in
-the magnitude vector and reduces the amount of information to encode
-in the angle vector. Encoding these vectors independently with
-residue backend #0 or residue backend #1 will result in bitrate
-savings. However, there are still implicit correlations between the
-magnitude and angle vectors. The most obvious is that the amplitude
-of the angle is bounded by its corresponding magnitude value.</p>
-
-<p>Entropy coding the results, then, further benefits from the entropy
-model being able to compress magnitude and angle simultaneously. For
-this reason, Vorbis implements residue backend #2 which pre-interleaves
-a number of input vectors (in the stereo case, two, A and B) into a
-single output vector (with the elements in the order of
-A_0, B_0, A_1, B_1, A_2 ... A_n-1, B_n-1) before entropy encoding. Thus
-each vector to be coded by the vector quantization backend consists of
-matching magnitude and angle values.</p>
-
-<p>The astute reader, at this point, will notice that in the theoretical
-case in which we can use monolithic codebooks of arbitrarily large
-size, we can directly interleave and encode left and right without
-polar mapping; in fact, the polar mapping does not appear to lend any
-benefit whatsoever to the efficiency of the entropy coding. In fact,
-it is perfectly possible and reasonable to build a Vorbis encoder that
-dispenses with polar mapping entirely and merely interleaves the
-channel. Libvorbis based encoders may configure such an encoding and
-it will work as intended.</p>
-
-<p>However, when we leave the ideal/theoretical domain, we notice that
-polar mapping does give additional practical benefits, as discussed in
-the above section on polar mapping and summarized again here:</p>
-
-<ul>
-<li>Polar mapping aids in controlling entropy 'leakage' between stages
-of a cascaded codebook.</li>
-<li>Polar mapping separates the stereo image
-into point and diffuse components which may be analyzed and handled
-differently.</li>
-</ul>
-
-<h2>Stereo Models</h2>
-
-<h3>Dual Stereo</h3>
-
-<p>Dual stereo refers to stereo encoding where the channels are entirely
-separate; they are analyzed and encoded as entirely distinct entities.
-This terminology is familiar from mp3.</p>
-
-<h3>Lossless Stereo</h3>
-
-<p>Using polar mapping and/or channel interleaving, it's possible to
-couple Vorbis channels losslessly, that is, construct a stereo
-coupling encoding that both saves space but also decodes
-bit-identically to dual stereo. OggEnc 1.0 and later uses this
-mode in all high-bitrate encoding.</p>
-
-<p>Overall, this stereo mode is overkill; however, it offers a safe
-alternative to users concerned about the slightest possible
-degradation to the stereo image or archival quality audio.</p>
-
-<h3>Phase Stereo</h3>
-
-<p>Phase stereo is the least aggressive means of gracefully dropping
-resolution from the stereo image; it affects only diffuse imaging.</p>
-
-<p>It's often quoted that the human ear is deaf to signal phase above
-about 4kHz; this is nearly true and a passable rule of thumb, but it
-can be demonstrated that even an average user can tell the difference
-between high frequency in-phase and out-of-phase noise. Obviously
-then, the statement is not entirely true. However, it's also the case
-that one must resort to nearly such an extreme demonstration before
-finding the counterexample.</p>
-
-<p>'Phase stereo' is simply a more aggressive quantization of the polar
-angle vector; above 4kHz it's generally quite safe to quantize noise
-and noisy elements to only a handful of allowed phases, or to thin the
-phase with respect to the magnitude. The phases of high amplitude
-pure tones may or may not be preserved more carefully (they are
-relatively rare and L/R tend to be in phase, so there is generally
-little reason not to spend a few more bits on them)</p>
-
-<h4>example: eight phase stereo</h4>
-
-<p>Vorbis may implement phase stereo coupling by preserving the entirety
-of the magnitude vector (essential to fine amplitude and energy
-resolution overall) and quantizing the angle vector to one of only
-four possible values. Given that the magnitude vector may be positive
-or negative, this results in left and right phase having eight
-possible permutation, thus 'eight phase stereo':</p>
-
-<p><img src="eightphase.png" alt="eight phase"/></p>
-
-<p>Left and right may be in phase (positive or negative), the most common
-case by far, or out of phase by 90 or 180 degrees.</p>
-
-<h4>example: four phase stereo</h4>
-
-<p>Similarly, four phase stereo takes the quantization one step further;
-it allows only in-phase and 180 degree out-out-phase signals:</p>
-
-<p><img src="fourphase.png" alt="four phase"/></p>
-
-<h3>example: point stereo</h3>
-
-<p>Point stereo eliminates the possibility of out-of-phase signal
-entirely. Any diffuse quality to a sound source tends to collapse
-inward to a point somewhere within the stereo image. A practical
-example would be balanced reverberations within a large, live space;
-normally the sound is diffuse and soft, giving a sonic impression of
-volume. In point-stereo, the reverberations would still exist, but
-sound fairly firmly centered within the image (assuming the
-reverberation was centered overall; if the reverberation is stronger
-to the left, then the point of localization in point stereo would be
-to the left). This effect is most noticeable at low and mid
-frequencies and using headphones (which grant perfect stereo
-separation). Point stereo is is a graceful but generally easy to
-detect degradation to the sound quality and is thus used in frequency
-ranges where it is least noticeable.</p>
-
-<h3>Mixed Stereo</h3>
-
-<p>Mixed stereo is the simultaneous use of more than one of the above
-stereo encoding models, generally using more aggressive modes in
-higher frequencies, lower amplitudes or 'nearly' in-phase sound.</p>
-
-<p>It is also the case that near-DC frequencies should be encoded using
-lossless coupling to avoid frame blocking artifacts.</p>
-
-<h3>Vorbis Stereo Modes</h3>
-
-<p>Vorbis, as of 1.0, uses lossless stereo and a number of mixed modes
-constructed out of lossless and point stereo. Phase stereo was used
-in the rc2 encoder, but is not currently used for simplicity's sake. It
-will likely be re-added to the stereo model in the future.</p>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
-
-
-
-
-
-
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a, h4, h4 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis stereo-specific channel coupling discussion</h1>
+
+<h2>Abstract</h2>
+
+<p>The Vorbis audio CODEC provides a channel coupling
+mechanisms designed to reduce effective bitrate by both eliminating
+interchannel redundancy and eliminating stereo image information
+labeled inaudible or undesirable according to spatial psychoacoustic
+models. This document describes both the mechanical coupling
+mechanisms available within the Vorbis specification, as well as the
+specific stereo coupling models used by the reference
+<tt>libvorbis</tt> codec provided by xiph.org.</p>
+
+<h2>Mechanisms</h2>
+
+<p>In encoder release beta 4 and earlier, Vorbis supported multiple
+channel encoding, but the channels were encoded entirely separately
+with no cross-analysis or redundancy elimination between channels.
+This multichannel strategy is very similar to the mp3's <em>dual
+stereo</em> mode and Vorbis uses the same name for its analogous
+uncoupled multichannel modes.</p>
+
+<p>However, the Vorbis spec provides for, and Vorbis release 1.0 rc1 and
+later implement a coupled channel strategy. Vorbis has two specific
+mechanisms that may be used alone or in conjunction to implement
+channel coupling. The first is <em>channel interleaving</em> via
+residue backend type 2, and the second is <em>square polar
+mapping</em>. These two general mechanisms are particularly well
+suited to coupling due to the structure of Vorbis encoding, as we'll
+explore below, and using both we can implement both totally
+<em>lossless stereo image coupling</em> [bit-for-bit decode-identical
+to uncoupled modes], as well as various lossy models that seek to
+eliminate inaudible or unimportant aspects of the stereo image in
+order to enhance bitrate. The exact coupling implementation is
+generalized to allow the encoder a great deal of flexibility in
+implementation of a stereo or surround model without requiring any
+significant complexity increase over the combinatorially simpler
+mid/side joint stereo of mp3 and other current audio codecs.</p>
+
+<p>A particular Vorbis bitstream may apply channel coupling directly to
+more than a pair of channels; polar mapping is hierarchical such that
+polar coupling may be extrapolated to an arbitrary number of channels
+and is not restricted to only stereo, quadraphonics, ambisonics or 5.1
+surround. However, the scope of this document restricts itself to the
+stereo coupling case.</p>
+
+<h3>Square Polar Mapping</h3>
+
+<h4>maximal correlation</h4>
+ 
+<p>Recall that the basic structure of a a Vorbis I stream first generates
+from input audio a spectral 'floor' function that serves as an
+MDCT-domain whitening filter. This floor is meant to represent the
+rough envelope of the frequency spectrum, using whatever metric the
+encoder cares to define. This floor is subtracted from the log
+frequency spectrum, effectively normalizing the spectrum by frequency.
+Each input channel is associated with a unique floor function.</p>
+
+<p>The basic idea behind any stereo coupling is that the left and right
+channels usually correlate. This correlation is even stronger if one
+first accounts for energy differences in any given frequency band
+across left and right; think for example of individual instruments
+mixed into different portions of the stereo image, or a stereo
+recording with a dominant feature not perfectly in the center. The
+floor functions, each specific to a channel, provide the perfect means
+of normalizing left and right energies across the spectrum to maximize
+correlation before coupling. This feature of the Vorbis format is not
+a convenient accident.</p>
+
+<p>Because we strive to maximally correlate the left and right channels
+and generally succeed in doing so, left and right residue is typically
+nearly identical. We could use channel interleaving (discussed below)
+alone to efficiently remove the redundancy between the left and right
+channels as a side effect of entropy encoding, but a polar
+representation gives benefits when left/right correlation is
+strong.</p>
+
+<h4>point and diffuse imaging</h4>
+
+<p>The first advantage of a polar representation is that it effectively
+separates the spatial audio information into a 'point image'
+(magnitude) at a given frequency and located somewhere in the sound
+field, and a 'diffuse image' (angle) that fills a large amount of
+space simultaneously. Even if we preserve only the magnitude (point)
+data, a detailed and carefully chosen floor function in each channel
+provides us with a free, fine-grained, frequency relative intensity
+stereo*. Angle information represents diffuse sound fields, such as
+reverberation that fills the entire space simultaneously.</p>
+
+<p>*<em>Because the Vorbis model supports a number of different possible
+stereo models and these models may be mixed, we do not use the term
+'intensity stereo' talking about Vorbis; instead we use the terms
+'point stereo', 'phase stereo' and subcategories of each.</em></p>
+
+<p>The majority of a stereo image is representable by polar magnitude
+alone, as strong sounds tend to be produced at near-point sources;
+even non-diffuse, fast, sharp echoes track very accurately using
+magnitude representation almost alone (for those experimenting with
+Vorbis tuning, this strategy works much better with the precise,
+piecewise control of floor 1; the continuous approximation of floor 0
+results in unstable imaging). Reverberation and diffuse sounds tend
+to contain less energy and be psychoacoustically dominated by the
+point sources embedded in them. Thus, we again tend to concentrate
+more represented energy into a predictably smaller number of numbers.
+Separating representation of point and diffuse imaging also allows us
+to model and manipulate point and diffuse qualities separately.</p>
+
+<h4>controlling bit leakage and symbol crosstalk</h4>
+
+<p>Because polar
+representation concentrates represented energy into fewer large
+values, we reduce bit 'leakage' during cascading (multistage VQ
+encoding) as a secondary benefit. A single large, monolithic VQ
+codebook is more efficient than a cascaded book due to entropy
+'crosstalk' among symbols between different stages of a multistage cascade.
+Polar representation is a way of further concentrating entropy into
+predictable locations so that codebook design can take steps to
+improve multistage codebook efficiency. It also allows us to cascade
+various elements of the stereo image independently.</p>
+
+<h4>eliminating trigonometry and rounding</h4>
+
+<p>Rounding and computational complexity are potential problems with a
+polar representation. As our encoding process involves quantization,
+mixing a polar representation and quantization makes it potentially
+impossible, depending on implementation, to construct a coupled stereo
+mechanism that results in bit-identical decompressed output compared
+to an uncoupled encoding should the encoder desire it.</p>
+
+<p>Vorbis uses a mapping that preserves the most useful qualities of
+polar representation, relies only on addition/subtraction (during
+decode; high quality encoding still requires some trig), and makes it
+trivial before or after quantization to represent an angle/magnitude
+through a one-to-one mapping from possible left/right value
+permutations. We do this by basing our polar representation on the
+unit square rather than the unit-circle.</p>
+
+<p>Given a magnitude and angle, we recover left and right using the
+following function (note that A/B may be left/right or right/left
+depending on the coupling definition used by the encoder):</p>
+
+<pre>
+      if(magnitude>0)
+        if(angle>0){
+          A=magnitude;
+          B=magnitude-angle;
+        }else{
+          B=magnitude;
+          A=magnitude+angle;
+        }
+      else
+        if(angle>0){
+          A=magnitude;
+          B=magnitude+angle;
+        }else{
+          B=magnitude;
+          A=magnitude-angle;
+        }
+    }
+</pre>
+
+<p>The function is antisymmetric for positive and negative magnitudes in
+order to eliminate a redundant value when quantizing. For example, if
+we're quantizing to integer values, we can visualize a magnitude of 5
+and an angle of -2 as follows:</p>
+
+<p><img src="squarepolar.png" alt="square polar"/></p>
+
+<p>This representation loses or replicates no values; if the range of A
+and B are integral -5 through 5, the number of possible Cartesian
+permutations is 121. Represented in square polar notation, the
+possible values are:</p>
+
+<pre>
+ 0, 0
+
+-1,-2  -1,-1  -1, 0  -1, 1
+
+ 1,-2   1,-1   1, 0   1, 1
+
+-2,-4  -2,-3  -2,-2  -2,-1  -2, 0  -2, 1  -2, 2  -2, 3  
+
+ 2,-4   2,-3   ... following the pattern ...
+
+ ...   5, 1   5, 2   5, 3   5, 4   5, 5   5, 6   5, 7   5, 8   5, 9
+
+</pre>
+
+<p>...for a grand total of 121 possible values, the same number as in
+Cartesian representation (note that, for example, <tt>5,-10</tt> is
+the same as <tt>-5,10</tt>, so there's no reason to represent
+both. 2,10 cannot happen, and there's no reason to account for it.)
+It's also obvious that this mapping is exactly reversible.</p>
+
+<h3>Channel interleaving</h3>
+
+<p>We can remap and A/B vector using polar mapping into a magnitude/angle
+vector, and it's clear that, in general, this concentrates energy in
+the magnitude vector and reduces the amount of information to encode
+in the angle vector. Encoding these vectors independently with
+residue backend #0 or residue backend #1 will result in bitrate
+savings. However, there are still implicit correlations between the
+magnitude and angle vectors. The most obvious is that the amplitude
+of the angle is bounded by its corresponding magnitude value.</p>
+
+<p>Entropy coding the results, then, further benefits from the entropy
+model being able to compress magnitude and angle simultaneously. For
+this reason, Vorbis implements residue backend #2 which pre-interleaves
+a number of input vectors (in the stereo case, two, A and B) into a
+single output vector (with the elements in the order of
+A_0, B_0, A_1, B_1, A_2 ... A_n-1, B_n-1) before entropy encoding. Thus
+each vector to be coded by the vector quantization backend consists of
+matching magnitude and angle values.</p>
+
+<p>The astute reader, at this point, will notice that in the theoretical
+case in which we can use monolithic codebooks of arbitrarily large
+size, we can directly interleave and encode left and right without
+polar mapping; in fact, the polar mapping does not appear to lend any
+benefit whatsoever to the efficiency of the entropy coding. In fact,
+it is perfectly possible and reasonable to build a Vorbis encoder that
+dispenses with polar mapping entirely and merely interleaves the
+channel. Libvorbis based encoders may configure such an encoding and
+it will work as intended.</p>
+
+<p>However, when we leave the ideal/theoretical domain, we notice that
+polar mapping does give additional practical benefits, as discussed in
+the above section on polar mapping and summarized again here:</p>
+
+<ul>
+<li>Polar mapping aids in controlling entropy 'leakage' between stages
+of a cascaded codebook.</li>
+<li>Polar mapping separates the stereo image
+into point and diffuse components which may be analyzed and handled
+differently.</li>
+</ul>
+
+<h2>Stereo Models</h2>
+
+<h3>Dual Stereo</h3>
+
+<p>Dual stereo refers to stereo encoding where the channels are entirely
+separate; they are analyzed and encoded as entirely distinct entities.
+This terminology is familiar from mp3.</p>
+
+<h3>Lossless Stereo</h3>
+
+<p>Using polar mapping and/or channel interleaving, it's possible to
+couple Vorbis channels losslessly, that is, construct a stereo
+coupling encoding that both saves space but also decodes
+bit-identically to dual stereo. OggEnc 1.0 and later uses this
+mode in all high-bitrate encoding.</p>
+
+<p>Overall, this stereo mode is overkill; however, it offers a safe
+alternative to users concerned about the slightest possible
+degradation to the stereo image or archival quality audio.</p>
+
+<h3>Phase Stereo</h3>
+
+<p>Phase stereo is the least aggressive means of gracefully dropping
+resolution from the stereo image; it affects only diffuse imaging.</p>
+
+<p>It's often quoted that the human ear is deaf to signal phase above
+about 4kHz; this is nearly true and a passable rule of thumb, but it
+can be demonstrated that even an average user can tell the difference
+between high frequency in-phase and out-of-phase noise. Obviously
+then, the statement is not entirely true. However, it's also the case
+that one must resort to nearly such an extreme demonstration before
+finding the counterexample.</p>
+
+<p>'Phase stereo' is simply a more aggressive quantization of the polar
+angle vector; above 4kHz it's generally quite safe to quantize noise
+and noisy elements to only a handful of allowed phases, or to thin the
+phase with respect to the magnitude. The phases of high amplitude
+pure tones may or may not be preserved more carefully (they are
+relatively rare and L/R tend to be in phase, so there is generally
+little reason not to spend a few more bits on them)</p>
+
+<h4>example: eight phase stereo</h4>
+
+<p>Vorbis may implement phase stereo coupling by preserving the entirety
+of the magnitude vector (essential to fine amplitude and energy
+resolution overall) and quantizing the angle vector to one of only
+four possible values. Given that the magnitude vector may be positive
+or negative, this results in left and right phase having eight
+possible permutation, thus 'eight phase stereo':</p>
+
+<p><img src="eightphase.png" alt="eight phase"/></p>
+
+<p>Left and right may be in phase (positive or negative), the most common
+case by far, or out of phase by 90 or 180 degrees.</p>
+
+<h4>example: four phase stereo</h4>
+
+<p>Similarly, four phase stereo takes the quantization one step further;
+it allows only in-phase and 180 degree out-out-phase signals:</p>
+
+<p><img src="fourphase.png" alt="four phase"/></p>
+
+<h3>example: point stereo</h3>
+
+<p>Point stereo eliminates the possibility of out-of-phase signal
+entirely. Any diffuse quality to a sound source tends to collapse
+inward to a point somewhere within the stereo image. A practical
+example would be balanced reverberations within a large, live space;
+normally the sound is diffuse and soft, giving a sonic impression of
+volume. In point-stereo, the reverberations would still exist, but
+sound fairly firmly centered within the image (assuming the
+reverberation was centered overall; if the reverberation is stronger
+to the left, then the point of localization in point stereo would be
+to the left). This effect is most noticeable at low and mid
+frequencies and using headphones (which grant perfect stereo
+separation). Point stereo is is a graceful but generally easy to
+detect degradation to the sound quality and is thus used in frequency
+ranges where it is least noticeable.</p>
+
+<h3>Mixed Stereo</h3>
+
+<p>Mixed stereo is the simultaneous use of more than one of the above
+stereo encoding models, generally using more aggressive modes in
+higher frequencies, lower amplitudes or 'nearly' in-phase sound.</p>
+
+<p>It is also the case that near-DC frequencies should be encoded using
+lossless coupling to avoid frame blocking artifacts.</p>
+
+<h3>Vorbis Stereo Modes</h3>
+
+<p>Vorbis, as of 1.0, uses lossless stereo and a number of mixed modes
+constructed out of lossless and point stereo. Phase stereo was used
+in the rc2 encoder, but is not currently used for simplicity's sake. It
+will likely be re-added to the stereo model in the future.</p>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>
+
+
+
+
+
+

Modified: branches/vorbis-aotuv/doc/v-comment.html
===================================================================
--- branches/vorbis-aotuv/doc/v-comment.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/v-comment.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,285 +1,285 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis I format specification: comment field and header specification</h1>
-
-<h1>Overview</h1>
-
-<p>The Vorbis text comment header is the second (of three) header
-packets that begin a Vorbis bitstream. It is meant for short, text
-comments, not arbitrary metadata; arbitrary metadata belongs in a
-separate logical bitstream (usually an XML stream type) that provides
-greater structure and machine parseability.</p>
-
-<p>The comment field is meant to be used much like someone jotting a
-quick note on the bottom of a CDR. It should be a little information to
-remember the disc by and explain it to others; a short, to-the-point
-text note that need not only be a couple words, but isn't going to be
-more than a short paragraph. The essentials, in other words, whatever
-they turn out to be, eg:</p>
-
-<blockquote><p>
-"Honest Bob and the Factory-to-Dealer-Incentives, _I'm Still Around_,
-opening for Moxy Fr&uuml;vous, 1997"
-</p></blockquote>
-
-<h1>Comment encoding</h1>
-
-<h2>Structure</h2>
-
-<p>The comment header logically is a list of eight-bit-clean vectors; the
-number of vectors is bounded to 2^32-1 and the length of each vector
-is limited to 2^32-1 bytes. The vector length is encoded; the vector
-contents themselves are not null terminated. In addition to the vector
-list, there is a single vector for vendor name (also 8 bit clean,
-length encoded in 32 bits). For example, the 1.0 release of libvorbis 
-set the vendor string to "Xiph.Org libVorbis I 20020717".</p>
-
-<p>The comment header is decoded as follows:</p>
-
-<pre>
-  1) [vendor_length] = read an unsigned integer of 32 bits
-  2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
-  3) [user_comment_list_length] = read an unsigned integer of 32 bits
-  4) iterate [user_comment_list_length] times {
-
-       5) [length] = read an unsigned integer of 32 bits
-       6) this iteration's user comment = read a UTF-8 vector as [length] octets
-
-     }
-
-  7) [framing_bit] = read a single bit as boolean
-  8) if ( [framing_bit] unset or end of packet ) then ERROR
-  9) done.
-</pre>
-
-<h2>Content vector format</h2>
-
-<p>The comment vectors are structured similarly to a UNIX environment variable.
-That is, comment fields consist of a field name and a corresponding value and
-look like:</p>
-
-<pre>
-comment[0]="ARTIST=me"; 
-comment[1]="TITLE=the sound of Vorbis"; 
-</pre>
-
-<ul>
-<li>A case-insensitive field name that may consist of ASCII 0x20 through
-0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive (A-Z) is
-to be considered equivalent to ASCII 0x61 through 0x7A inclusive
-(a-z).</li>
-<li>The field name is immediately followed by ASCII 0x3D ('='); 
-this equals sign is used to terminate the field name.</li>
-<li>0x3D is followed by the 8 bit clean UTF-8 encoded value of the 
-field contents to the end of the field.</li>
-</ul>
-
-<h3>Field names</h3>
-
-<p>Below is a proposed, minimal list of standard field names with a
-description of intended use. No single or group of field names is
-mandatory; a comment header may contain one, all or none of the names
-in this list.</p>
-
-<dl>
-
-<dt>TITLE</dt>
-<dd>Track/Work name</dd>
-
-<dt>VERSION</dt>
-<dd>The version field may be used to differentiate multiple
-versions of the same track title in a single collection.
-(e.g. remix info)</dd>
-
-<dt>ALBUM</dt>
-<dd>The collection name to which this track belongs</dd>
-
-<dt>TRACKNUMBER</dt>
-<dd>The track number of this piece if part of a specific larger collection or album</dd>
-
-<dt>ARTIST</dt>
-<dd>The artist generally considered responsible for the work. In popular music
-this is usually the performing band or singer. For classical music it would be
-the composer. For an audio book it would be the author of the original text.</dd>
-
-<dt>PERFORMER</dt>
-<dd>The artist(s) who performed the work. In classical music this would be the
-conductor, orchestra, soloists. In an audio book it would be the actor who did
-the reading. In popular music this is typically the same as the ARTIST and
-is omitted.</dd>
-
-<dt>COPYRIGHT</dt>
-<dd>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'</dd>
-
-<dt>LICENSE</dt>
-<dd>License information, eg, 'All Rights Reserved', 'Any
-Use Permitted', a URL to a license such as a Creative Commons license
-("www.creativecommons.org/blahblah/license.html") or the EFF Open
-Audio License ('distributed under the terms of the Open Audio
-License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
-details'), etc.</dd>
-
-<dt>ORGANIZATION</dt>
-<dd>Name of the organization producing the track (i.e.
-the 'record label')</dd>
-
-<dt>DESCRIPTION</dt>
-<dd>A short text description of the contents</dd>
-
-<dt>GENRE</dt>
-<dd>A short text indication of music genre</dd>
-
-<dt>DATE</dt>
-<dd>Date the track was recorded</dd>
-
-<dt>LOCATION</dt>
-<dd>Location where track was recorded</dd>
-
-<dt>CONTACT</dt>
-<dd>Contact information for the creators or distributors of the track.
-This could be a URL, an email address, the physical address of
-the producing label.</dd>
-
-<dt>ISRC</dt>
-<dd>ISRC number for the track; see <a href="http://www.ifpi.org/site-content/online/isrc_intro.html">the
-ISRC intro page</a> for more information on ISRC numbers.</dd>
-
-</dl>
-
-<h3>Implications</h3>
-
-<ul>
-<li>Field names should not be 'internationalized'; this is a
-concession to simplicity not an attempt to exclude the majority of
-the world that doesn't speak English. Field <emph>contents</emph>, 
-however, use the UTF-8 character encoding to allow easy representation 
-of any language.</li>
-<li>We have the length of the entirety of the field and restrictions on
-the field name so that the field name is bounded in a known way. Thus
-we also have the length of the field contents.</li>
-<li>Individual 'vendors' may use non-standard field names within
-reason. The proper use of comment fields should be clear through
-context at this point. Abuse will be discouraged.</li>
-<li>There is no vendor-specific prefix to 'nonstandard' field names.
-Vendors should make some effort to avoid arbitrarily polluting the
-common namespace. We will generally collect the more useful tags
-here to help with standardization.</li>
-<li>Field names are not required to be unique (occur once) within a
-comment header. As an example, assume a track was recorded by three
-well know artists; the following is permissible, and encouraged:
-<pre>
-              ARTIST=Dizzy Gillespie 
-              ARTIST=Sonny Rollins 
-              ARTIST=Sonny Stitt 
-</pre></li>
-</ul>
-
-<h2>Encoding</h2> 
-
-<p>The comment header comprises the entirety of the second bitstream
-header packet. Unlike the first bitstream header packet, it is not
-generally the only packet on the second page and may not be restricted
-to within the second bitstream page. The length of the comment header
-packet is (practically) unbounded. The comment header packet is not
-optional; it must be present in the bitstream even if it is
-effectively empty.</p>
-
-<p>The comment header is encoded as follows (as per Ogg's standard
-bitstream mapping which renders least-significant-bit of the word to be
-coded into the least significant available bit of the current
-bitstream octet first):</p>
-
-<ol>
-<li>Vendor string length (32 bit unsigned quantity specifying number of octets)</li>
-<li>Vendor string ([vendor string length] octets coded from beginning of string
-to end of string, not null terminated)</li>
-<li>Number of comment fields (32 bit unsigned quantity specifying number of fields)</li>
-<li>Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned
-quantity specifying number of octets)</li>
-<li>Comment field 0 ([Comment field 0 length] octets coded from beginning of
-string to end of string, not null terminated)</li>
-<li>Comment field 1 length (if [Number of comment fields]>1...)...</li>
-</ol>
-
-<p>This is actually somewhat easier to describe in code; implementation of the above
-can be found in vorbis/lib/info.c:_vorbis_pack_comment(),_vorbis_unpack_comment()</p>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis I format specification: comment field and header specification</h1>
+
+<h1>Overview</h1>
+
+<p>The Vorbis text comment header is the second (of three) header
+packets that begin a Vorbis bitstream. It is meant for short, text
+comments, not arbitrary metadata; arbitrary metadata belongs in a
+separate logical bitstream (usually an XML stream type) that provides
+greater structure and machine parseability.</p>
+
+<p>The comment field is meant to be used much like someone jotting a
+quick note on the bottom of a CDR. It should be a little information to
+remember the disc by and explain it to others; a short, to-the-point
+text note that need not only be a couple words, but isn't going to be
+more than a short paragraph. The essentials, in other words, whatever
+they turn out to be, eg:</p>
+
+<blockquote><p>
+"Honest Bob and the Factory-to-Dealer-Incentives, _I'm Still Around_,
+opening for Moxy Fr&uuml;vous, 1997"
+</p></blockquote>
+
+<h1>Comment encoding</h1>
+
+<h2>Structure</h2>
+
+<p>The comment header logically is a list of eight-bit-clean vectors; the
+number of vectors is bounded to 2^32-1 and the length of each vector
+is limited to 2^32-1 bytes. The vector length is encoded; the vector
+contents themselves are not null terminated. In addition to the vector
+list, there is a single vector for vendor name (also 8 bit clean,
+length encoded in 32 bits). For example, the 1.0 release of libvorbis 
+set the vendor string to "Xiph.Org libVorbis I 20020717".</p>
+
+<p>The comment header is decoded as follows:</p>
+
+<pre>
+  1) [vendor_length] = read an unsigned integer of 32 bits
+  2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
+  3) [user_comment_list_length] = read an unsigned integer of 32 bits
+  4) iterate [user_comment_list_length] times {
+
+       5) [length] = read an unsigned integer of 32 bits
+       6) this iteration's user comment = read a UTF-8 vector as [length] octets
+
+     }
+
+  7) [framing_bit] = read a single bit as boolean
+  8) if ( [framing_bit] unset or end of packet ) then ERROR
+  9) done.
+</pre>
+
+<h2>Content vector format</h2>
+
+<p>The comment vectors are structured similarly to a UNIX environment variable.
+That is, comment fields consist of a field name and a corresponding value and
+look like:</p>
+
+<pre>
+comment[0]="ARTIST=me"; 
+comment[1]="TITLE=the sound of Vorbis"; 
+</pre>
+
+<ul>
+<li>A case-insensitive field name that may consist of ASCII 0x20 through
+0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive (A-Z) is
+to be considered equivalent to ASCII 0x61 through 0x7A inclusive
+(a-z).</li>
+<li>The field name is immediately followed by ASCII 0x3D ('='); 
+this equals sign is used to terminate the field name.</li>
+<li>0x3D is followed by the 8 bit clean UTF-8 encoded value of the 
+field contents to the end of the field.</li>
+</ul>
+
+<h3>Field names</h3>
+
+<p>Below is a proposed, minimal list of standard field names with a
+description of intended use. No single or group of field names is
+mandatory; a comment header may contain one, all or none of the names
+in this list.</p>
+
+<dl>
+
+<dt>TITLE</dt>
+<dd>Track/Work name</dd>
+
+<dt>VERSION</dt>
+<dd>The version field may be used to differentiate multiple
+versions of the same track title in a single collection.
+(e.g. remix info)</dd>
+
+<dt>ALBUM</dt>
+<dd>The collection name to which this track belongs</dd>
+
+<dt>TRACKNUMBER</dt>
+<dd>The track number of this piece if part of a specific larger collection or album</dd>
+
+<dt>ARTIST</dt>
+<dd>The artist generally considered responsible for the work. In popular music
+this is usually the performing band or singer. For classical music it would be
+the composer. For an audio book it would be the author of the original text.</dd>
+
+<dt>PERFORMER</dt>
+<dd>The artist(s) who performed the work. In classical music this would be the
+conductor, orchestra, soloists. In an audio book it would be the actor who did
+the reading. In popular music this is typically the same as the ARTIST and
+is omitted.</dd>
+
+<dt>COPYRIGHT</dt>
+<dd>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'</dd>
+
+<dt>LICENSE</dt>
+<dd>License information, eg, 'All Rights Reserved', 'Any
+Use Permitted', a URL to a license such as a Creative Commons license
+("www.creativecommons.org/blahblah/license.html") or the EFF Open
+Audio License ('distributed under the terms of the Open Audio
+License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
+details'), etc.</dd>
+
+<dt>ORGANIZATION</dt>
+<dd>Name of the organization producing the track (i.e.
+the 'record label')</dd>
+
+<dt>DESCRIPTION</dt>
+<dd>A short text description of the contents</dd>
+
+<dt>GENRE</dt>
+<dd>A short text indication of music genre</dd>
+
+<dt>DATE</dt>
+<dd>Date the track was recorded</dd>
+
+<dt>LOCATION</dt>
+<dd>Location where track was recorded</dd>
+
+<dt>CONTACT</dt>
+<dd>Contact information for the creators or distributors of the track.
+This could be a URL, an email address, the physical address of
+the producing label.</dd>
+
+<dt>ISRC</dt>
+<dd>ISRC number for the track; see <a href="http://www.ifpi.org/isrc/">the
+ISRC intro page</a> for more information on ISRC numbers.</dd>
+
+</dl>
+
+<h3>Implications</h3>
+
+<ul>
+<li>Field names should not be 'internationalized'; this is a
+concession to simplicity not an attempt to exclude the majority of
+the world that doesn't speak English. Field <emph>contents</emph>, 
+however, use the UTF-8 character encoding to allow easy representation 
+of any language.</li>
+<li>We have the length of the entirety of the field and restrictions on
+the field name so that the field name is bounded in a known way. Thus
+we also have the length of the field contents.</li>
+<li>Individual 'vendors' may use non-standard field names within
+reason. The proper use of comment fields should be clear through
+context at this point. Abuse will be discouraged.</li>
+<li>There is no vendor-specific prefix to 'nonstandard' field names.
+Vendors should make some effort to avoid arbitrarily polluting the
+common namespace. We will generally collect the more useful tags
+here to help with standardization.</li>
+<li>Field names are not required to be unique (occur once) within a
+comment header. As an example, assume a track was recorded by three
+well know artists; the following is permissible, and encouraged:
+<pre>
+              ARTIST=Dizzy Gillespie 
+              ARTIST=Sonny Rollins 
+              ARTIST=Sonny Stitt 
+</pre></li>
+</ul>
+
+<h2>Encoding</h2> 
+
+<p>The comment header comprises the entirety of the second bitstream
+header packet. Unlike the first bitstream header packet, it is not
+generally the only packet on the second page and may not be restricted
+to within the second bitstream page. The length of the comment header
+packet is (practically) unbounded. The comment header packet is not
+optional; it must be present in the bitstream even if it is
+effectively empty.</p>
+
+<p>The comment header is encoded as follows (as per Ogg's standard
+bitstream mapping which renders least-significant-bit of the word to be
+coded into the least significant available bit of the current
+bitstream octet first):</p>
+
+<ol>
+<li>Vendor string length (32 bit unsigned quantity specifying number of octets)</li>
+<li>Vendor string ([vendor string length] octets coded from beginning of string
+to end of string, not null terminated)</li>
+<li>Number of comment fields (32 bit unsigned quantity specifying number of fields)</li>
+<li>Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned
+quantity specifying number of octets)</li>
+<li>Comment field 0 ([Comment field 0 length] octets coded from beginning of
+string to end of string, not null terminated)</li>
+<li>Comment field 1 length (if [Number of comment fields]>1...)...</li>
+</ol>
+
+<p>This is actually somewhat easier to describe in code; implementation of the above
+can be found in vorbis/lib/info.c:_vorbis_pack_comment(),_vorbis_unpack_comment()</p>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/vorbis-fidelity.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbis-fidelity.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbis-fidelity.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,180 +1,180 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis: Fidelity measurement and terminology discussion</h1>
-
-<p>Terminology discussed in this document is based on common terminology
-associated with contemporary codecs such as MPEG I audio layer 3
-(mp3). However, some differences in terminology are useful in the
-context of Vorbis as Vorbis functions somewhat differently than most
-current formats. For clarity, then, we describe a common terminology
-for discussion of Vorbis's and other formats' audio quality.</p>
-
-<h2>Subjective and Objective</h2>
-
-<p><em>Objective</em> fidelity is a measure, based on a computable,
-mechanical metric, of how carefully an output matches an input. For
-example, a stereo amplifier may claim to introduce less that .01%
-total harmonic distortion when amplifying an input signal; this claim
-is easy to verify given proper equipment, and any number of testers are
-likely to arrive at the same, exact results. One need not listen to
-the equipment to make this measurement.</p>
-
-<p>However, given two amplifiers with identical, verifiable objective
-specifications, listeners may strongly prefer the sound quality of one
-over the other. This is actually the case in the decades old debate
-[some would say jihad] among audiophiles involving vacuum tube versus
-solid state amplifiers. There are people who can tell the difference,
-and strongly prefer one over the other despite seemingly identical,
-measurable quality. This preference is <em>subjective</em> and
-difficult to measure but nonetheless real.</p>
-
-<p>Individual elements of subjective differences often can be qualified,
-but overall subjective quality generally is not measurable. Different
-observers are likely to disagree on the exact results of a subjective
-test as each observer's perspective differs. When measuring
-subjective qualities, the best one can hope for is average, empirical
-results that show statistical significance across a group.</p>
-
-<p>Perceptual codecs are most concerned with subjective, not objective,
-quality. This is why evaluating a perceptual codec via distortion
-measures and sonograms alone is useless; these objective measures may
-provide insight into the quality or functioning of a codec, but cannot
-answer the much squishier subjective question, "Does it sound
-good?". The tube amplifier example is perhaps not the best as very few
-people can hear, or care to hear, the minute differences between tubes
-and transistors, whereas the subjective differences in perceptual
-codecs tend to be quite large even when objective differences are
-not.</p>
-
-<h2>Fidelity, Artifacts and Differences</h2>
-
-<p>Audio <em>artifacts</em> and loss of fidelity or more simply
-put, audio <em>differences</em> are not the same thing.</p>
-
-<p>A loss of fidelity implies differences between the perceived input and
-output signal; it does not necessarily imply that the differences in
-output are displeasing or that the output sounds poor (although this
-is often the case). Tube amplifiers are <em>not</em> higher fidelity
-than modern solid state and digital systems. They simply produce a
-form of distortion and coloring that is either unnoticeable or actually
-pleasing to many ears.</p>
-
-<p>As compared to an original signal using hard metrics, all perceptual
-codecs [ASPEC, ATRAC, MP3, WMA, AAC, TwinVQ, AC3 and Vorbis included]
-lose objective fidelity in order to reduce bitrate. This is fact. The
-idea is to lose fidelity in ways that cannot be perceived. However,
-most current streaming applications demand bitrates lower than what
-can be achieved by sacrificing only objective fidelity; this is also
-fact, despite whatever various company press releases might claim.
-Subjective fidelity eventually must suffer in one way or another.</p>
-
-<p>The goal is to choose the best possible tradeoff such that the
-fidelity loss is graceful and not obviously noticeable. Most listeners
-of FM radio do not realize how much lower fidelity that medium is as
-compared to compact discs or DAT. However, when compared directly to
-source material, the difference is obvious. A cassette tape is lower
-fidelity still, and yet the degradation, relatively speaking, is
-graceful and generally easy not to notice. Compare this graceful loss
-of quality to an average 44.1kHz stereo mp3 encoded at 80 or 96kbps.
-The mp3 might actually be higher objective fidelity but subjectively
-sounds much worse.</p>
-
-<p>Thus, when a CODEC <em>must</em> sacrifice subjective quality in order
-to satisfy a user's requirements, the result should be a
-<em>difference</em> that is generally either difficult to notice
-without comparison, or easy to ignore. An <em>artifact</em>, on the
-other hand, is an element introduced into the output that is
-immediately noticeable, obviously foreign, and undesired. The famous
-'underwater' or 'twinkling' effect synonymous with low bitrate (or
-poorly encoded) mp3 is an example of an <em>artifact</em>. This
-working definition differs slightly from common usage, but the coined
-distinction between differences and artifacts is useful for our
-discussion.</p>
-
-<p>The goal, when it is absolutely necessary to sacrifice subjective
-fidelity, is obviously to strive for differences and not artifacts.
-The vast majority of codecs today fail at this task miserably,
-predictably, and regularly in one way or another. Avoiding such
-failures when it is necessary to sacrifice subjective quality is a
-fundamental design objective of Vorbis and that objective is reflected
-in Vorbis's design and tuning.</p>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis: Fidelity measurement and terminology discussion</h1>
+
+<p>Terminology discussed in this document is based on common terminology
+associated with contemporary codecs such as MPEG I audio layer 3
+(mp3). However, some differences in terminology are useful in the
+context of Vorbis as Vorbis functions somewhat differently than most
+current formats. For clarity, then, we describe a common terminology
+for discussion of Vorbis's and other formats' audio quality.</p>
+
+<h2>Subjective and Objective</h2>
+
+<p><em>Objective</em> fidelity is a measure, based on a computable,
+mechanical metric, of how carefully an output matches an input. For
+example, a stereo amplifier may claim to introduce less that .01%
+total harmonic distortion when amplifying an input signal; this claim
+is easy to verify given proper equipment, and any number of testers are
+likely to arrive at the same, exact results. One need not listen to
+the equipment to make this measurement.</p>
+
+<p>However, given two amplifiers with identical, verifiable objective
+specifications, listeners may strongly prefer the sound quality of one
+over the other. This is actually the case in the decades old debate
+[some would say jihad] among audiophiles involving vacuum tube versus
+solid state amplifiers. There are people who can tell the difference,
+and strongly prefer one over the other despite seemingly identical,
+measurable quality. This preference is <em>subjective</em> and
+difficult to measure but nonetheless real.</p>
+
+<p>Individual elements of subjective differences often can be qualified,
+but overall subjective quality generally is not measurable. Different
+observers are likely to disagree on the exact results of a subjective
+test as each observer's perspective differs. When measuring
+subjective qualities, the best one can hope for is average, empirical
+results that show statistical significance across a group.</p>
+
+<p>Perceptual codecs are most concerned with subjective, not objective,
+quality. This is why evaluating a perceptual codec via distortion
+measures and sonograms alone is useless; these objective measures may
+provide insight into the quality or functioning of a codec, but cannot
+answer the much squishier subjective question, "Does it sound
+good?". The tube amplifier example is perhaps not the best as very few
+people can hear, or care to hear, the minute differences between tubes
+and transistors, whereas the subjective differences in perceptual
+codecs tend to be quite large even when objective differences are
+not.</p>
+
+<h2>Fidelity, Artifacts and Differences</h2>
+
+<p>Audio <em>artifacts</em> and loss of fidelity or more simply
+put, audio <em>differences</em> are not the same thing.</p>
+
+<p>A loss of fidelity implies differences between the perceived input and
+output signal; it does not necessarily imply that the differences in
+output are displeasing or that the output sounds poor (although this
+is often the case). Tube amplifiers are <em>not</em> higher fidelity
+than modern solid state and digital systems. They simply produce a
+form of distortion and coloring that is either unnoticeable or actually
+pleasing to many ears.</p>
+
+<p>As compared to an original signal using hard metrics, all perceptual
+codecs [ASPEC, ATRAC, MP3, WMA, AAC, TwinVQ, AC3 and Vorbis included]
+lose objective fidelity in order to reduce bitrate. This is fact. The
+idea is to lose fidelity in ways that cannot be perceived. However,
+most current streaming applications demand bitrates lower than what
+can be achieved by sacrificing only objective fidelity; this is also
+fact, despite whatever various company press releases might claim.
+Subjective fidelity eventually must suffer in one way or another.</p>
+
+<p>The goal is to choose the best possible tradeoff such that the
+fidelity loss is graceful and not obviously noticeable. Most listeners
+of FM radio do not realize how much lower fidelity that medium is as
+compared to compact discs or DAT. However, when compared directly to
+source material, the difference is obvious. A cassette tape is lower
+fidelity still, and yet the degradation, relatively speaking, is
+graceful and generally easy not to notice. Compare this graceful loss
+of quality to an average 44.1kHz stereo mp3 encoded at 80 or 96kbps.
+The mp3 might actually be higher objective fidelity but subjectively
+sounds much worse.</p>
+
+<p>Thus, when a CODEC <em>must</em> sacrifice subjective quality in order
+to satisfy a user's requirements, the result should be a
+<em>difference</em> that is generally either difficult to notice
+without comparison, or easy to ignore. An <em>artifact</em>, on the
+other hand, is an element introduced into the output that is
+immediately noticeable, obviously foreign, and undesired. The famous
+'underwater' or 'twinkling' effect synonymous with low bitrate (or
+poorly encoded) mp3 is an example of an <em>artifact</em>. This
+working definition differs slightly from common usage, but the coined
+distinction between differences and artifacts is useful for our
+discussion.</p>
+
+<p>The goal, when it is absolutely necessary to sacrifice subjective
+fidelity, is obviously to strive for differences and not artifacts.
+The vast majority of codecs today fail at this task miserably,
+predictably, and regularly in one way or another. Avoiding such
+failures when it is necessary to sacrifice subjective quality is a
+fundamental design objective of Vorbis and that objective is reflected
+in Vorbis's design and tuning.</p>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/vorbis.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbis.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbis.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,234 +1,234 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
-<title>Ogg Vorbis Documentation</title>
-
-<style type="text/css">
-body {
-  margin: 0 18px 0 18px;
-  padding-bottom: 30px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-  color: #333333;
-  font-size: .8em;
-}
-
-a {
-  color: #3366cc;
-}
-
-img {
-  border: 0;
-}
-
-#xiphlogo {
-  margin: 30px 0 16px 0;
-}
-
-#content p {
-  line-height: 1.4;
-}
-
-h1, h1 a, h2, h2 a, h3, h3 a {
-  font-weight: bold;
-  color: #ff9900;
-  margin: 1.3em 0 8px 0;
-}
-
-h1 {
-  font-size: 1.3em;
-}
-
-h2 {
-  font-size: 1.2em;
-}
-
-h3 {
-  font-size: 1.1em;
-}
-
-li {
-  line-height: 1.4;
-}
-
-#copyright {
-  margin-top: 30px;
-  line-height: 1.5em;
-  text-align: center;
-  font-size: .8em;
-  color: #888888;
-  clear: both;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="xiphlogo">
-  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
-</div>
-
-<h1>Ogg Vorbis encoding format documentation</h1>
-
-<p><img src="wait.png" alt="wait"/>As of writing, not all the below document
-links are live. They will be populated as we complete the documents.</p>
-
-<h2>Documents</h2>
-
-<ul>
-<li><a href="packet.html">Vorbis packet structure</a></li>
-<li><a href="envelope.html">Temporal envelope shaping and blocksize</a></li>
-<li><a href="mdct.html">Time domain segmentation and MDCT transform</a></li>
-<li><a href="resolution.html">The resolution floor</a></li>
-<li><a href="residuals.html">MDCT-domain fine structure</a></li>
-</ul>
-
-<ul>
-<li><a href="probmodel.html">The Vorbis probability model</a></li>
-<li><a href="bitpack.html">The Vorbis bitpacker</a></li>
-</ul>
-
-<ul>
-<li><a href="oggstream.html">Ogg bitstream overview</a></li>
-<li><a href="framing.html">Ogg logical bitstream and framing spec</a></li>
-<li><a href="vorbis-stream.html">Vorbis packet->Ogg bitstream mapping</a></li>
-</ul>
-
-<ul>
-<li><a href="programming.html">Programming with libvorbis</a></li>
-</ul>
-
-<h2>Description</h2>
-
-<p>Ogg Vorbis is a general purpose compressed audio format
-for high quality (44.1-48.0kHz, 16+ bit, polyphonic) audio and music
-at moderate fixed and variable bitrates (40-80 kb/s/channel). This
-places Vorbis in the same class as audio representations including
-MPEG-1 audio layer 3, MPEG-4 audio (AAC and TwinVQ), and PAC.</p>
-
-<p>Vorbis is the first of a planned family of Ogg multimedia coding
-formats being developed as part of the Xiph.org Foundation's Ogg multimedia
-project. See <a href="http://www.xiph.org/">http://www.xiph.org/</a>
-for more information.</p>
-
-<h2>Vorbis technical documents</h2>
-
-<p>A Vorbis encoder takes in overlapping (but contiguous) short-time
-segments of audio data. The encoder analyzes the content of the audio
-to determine an optimal compact representation; this phase of encoding
-is known as <em>analysis</em>. For each short-time block of sound,
-the encoder then packs an efficient representation of the signal, as
-determined by analysis, into a raw packet much smaller than the size
-required by the original signal; this phase is <em>coding</em>.
-Lastly, in a streaming environment, the raw packets are then
-structured into a continuous stream of octets; this last phase is
-<em>streaming</em>. Note that the stream of octets is referred to both
-as a 'byte-' and 'bit-'stream; the latter usage is acceptible as the
-stream of octets is a physical representation of a true logical
-bit-by-bit stream.</p>
-
-<p>A Vorbis decoder performs a mirror image process of extracting the
-original sequence of raw packets from an Ogg stream (<em>stream
-decomposition</em>), reconstructing the signal representation from the
-raw data in the packet (<em>decoding</em>) and them reconstituting an
-audio signal from the decoded representation (<em>synthesis</em>).</p>
-
-<p>The <a href="programming.html">Programming with libvorbis</a>
-documents discuss use of the reference Vorbis codec library
-(libvorbis) produced by the Xiph.org Foundation.</p>
-
-<p>The data representations and algorithms necessary at each step to
-encode and decode Ogg Vorbis bitstreams are described by the below
-documents in sufficient detail to construct a complete Vorbis codec.
-Note that at the time of writing, Vorbis is still in a 'Request For
-Comments' stage of development; despite being in advanced stages of
-development, input from the multimedia community is welcome.</p>
-
-<h3>Vorbis analysis and synthesis</h3>
-
-<p>Analysis begins by seperating an input audio stream into individual,
-overlapping short-time segments of audio data. These segments are
-then transformed into an alternate representation, seeking to
-represent the original signal in a more efficient form that codes into
-a smaller number of bytes. The analysis and transformation stage is
-the most complex element of producing a Vorbis bitstream.</p>
-
-<p>The corresponding synthesis step in the decoder is simpler; there is
-no analysis to perform, merely a mechanical, deterministic
-reconstruction of the original audio data from the transform-domain
-representation.</p>
-
-<ul>
-<li><a href="packet.html">Vorbis packet structure</a>:
-Describes the basic analysis components necessary to produce Vorbis
-packets and the structure of the packet itself.</li>
-<li><a href="envelope.html">Temporal envelope shaping and blocksize</a>:
-Use of temporal envelope shaping and variable blocksize to minimize
-time-domain energy leakage during wide dynamic range and spectral energy
-swings. Also discusses time-related principles of psychoacoustics.</li>
-<li><a href="mdct.html">Time domain segmentation and MDCT transform</a>:
-Division of time domain data into individual overlapped, windowed
-short-time vectors and transformation using the MDCT</li>
-<li><a href="resolution.html">The resolution floor</a>: Use of frequency
-doamin psychoacoustics, and the MDCT-domain noise, masking and resolution
-floors</li>
-<li><a href="residuals.html">MDCT-domain fine structure</a>: Production,
-quantization and massaging of MDCT-spectrum fine structure</li>
-</ul>
-
-<h3>Vorbis coding and decoding</h3>
-
-<p>Coding and decoding converts the transform-domain representation of
-the original audio produced by analysis to and from a bitwise packed
-raw data packet. Coding and decoding consist of two logically
-orthogonal concepts, <em>back-end coding</em> and <em>bitpacking</em>.</p>
-
-<p><em>Back-end coding</em> uses a probability model to represent the raw numbers
-of the audio representation in as few physical bits as possible;
-familiar examples of back-end coding include Huffman coding and Vector
-Quantization.</p>
-
-<p><em>Bitpacking</em> arranges the variable sized words of the back-end
-coding into a vector of octets without wasting space. The octets
-produced by coding a single short-time audio segment is one raw Vorbis
-packet.</p>
-
-<ul>
-<li><a href="probmodel.html">The Vorbis probability model</a></li>
-<li><a href="bitpack.html">The Vorbis bitpacker</a>: Arrangement of 
-variable bit-length words into an octet-aligned packet.</li>
-</ul>
-
-<h3>Vorbis streaming and stream decomposition</h3>
-
-<p>Vorbis packets contain the raw, bitwise-compressed representation of a
-snippet of audio. These packets contain no structure and cannot be
-strung together directly into a stream; for streamed transmission and
-storage, Vorbis packets are encoded into an Ogg bitstream.</p>
-
-<ul>
-<li><a href="oggstream.html">Ogg bitstream overview</a>: High-level
-description of Ogg logical bitstreams, how logical bitstreams
-(of mixed media types) can be combined into physical bitstreams, and
-restrictions on logical-to-physical mapping. Note that this document is
-not specific only to Ogg Vorbis.</li>
-<li><a href="framing.html">Ogg logical bitstream and framing
-spec</a>: Low level, complete specification of Ogg logical
-bitstream pages. Note that this document is not specific only to Ogg
-Vorbis.</li>
-<li><a href="vorbis-stream.html">Vorbis bitstream mapping</a>:
-Specifically describes mapping Vorbis data into an
-Ogg physical bitstream.</li>
-</ul>
-
-<div id="copyright">
-  The Xiph Fish Logo is a
-  trademark (&trade;) of Xiph.Org.<br/>
-
-  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
-</div>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
+<title>Ogg Vorbis Documentation</title>
+
+<style type="text/css">
+body {
+  margin: 0 18px 0 18px;
+  padding-bottom: 30px;
+  font-family: Verdana, Arial, Helvetica, sans-serif;
+  color: #333333;
+  font-size: .8em;
+}
+
+a {
+  color: #3366cc;
+}
+
+img {
+  border: 0;
+}
+
+#xiphlogo {
+  margin: 30px 0 16px 0;
+}
+
+#content p {
+  line-height: 1.4;
+}
+
+h1, h1 a, h2, h2 a, h3, h3 a {
+  font-weight: bold;
+  color: #ff9900;
+  margin: 1.3em 0 8px 0;
+}
+
+h1 {
+  font-size: 1.3em;
+}
+
+h2 {
+  font-size: 1.2em;
+}
+
+h3 {
+  font-size: 1.1em;
+}
+
+li {
+  line-height: 1.4;
+}
+
+#copyright {
+  margin-top: 30px;
+  line-height: 1.5em;
+  text-align: center;
+  font-size: .8em;
+  color: #888888;
+  clear: both;
+}
+</style>
+
+</head>
+
+<body>
+
+<div id="xiphlogo">
+  <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
+</div>
+
+<h1>Ogg Vorbis encoding format documentation</h1>
+
+<p><img src="wait.png" alt="wait"/>As of writing, not all the below document
+links are live. They will be populated as we complete the documents.</p>
+
+<h2>Documents</h2>
+
+<ul>
+<li><a href="packet.html">Vorbis packet structure</a></li>
+<li><a href="envelope.html">Temporal envelope shaping and blocksize</a></li>
+<li><a href="mdct.html">Time domain segmentation and MDCT transform</a></li>
+<li><a href="resolution.html">The resolution floor</a></li>
+<li><a href="residuals.html">MDCT-domain fine structure</a></li>
+</ul>
+
+<ul>
+<li><a href="probmodel.html">The Vorbis probability model</a></li>
+<li><a href="bitpack.html">The Vorbis bitpacker</a></li>
+</ul>
+
+<ul>
+<li><a href="oggstream.html">Ogg bitstream overview</a></li>
+<li><a href="framing.html">Ogg logical bitstream and framing spec</a></li>
+<li><a href="vorbis-stream.html">Vorbis packet->Ogg bitstream mapping</a></li>
+</ul>
+
+<ul>
+<li><a href="programming.html">Programming with libvorbis</a></li>
+</ul>
+
+<h2>Description</h2>
+
+<p>Ogg Vorbis is a general purpose compressed audio format
+for high quality (44.1-48.0kHz, 16+ bit, polyphonic) audio and music
+at moderate fixed and variable bitrates (40-80 kb/s/channel). This
+places Vorbis in the same class as audio representations including
+MPEG-1 audio layer 3, MPEG-4 audio (AAC and TwinVQ), and PAC.</p>
+
+<p>Vorbis is the first of a planned family of Ogg multimedia coding
+formats being developed as part of the Xiph.org Foundation's Ogg multimedia
+project. See <a href="http://www.xiph.org/">http://www.xiph.org/</a>
+for more information.</p>
+
+<h2>Vorbis technical documents</h2>
+
+<p>A Vorbis encoder takes in overlapping (but contiguous) short-time
+segments of audio data. The encoder analyzes the content of the audio
+to determine an optimal compact representation; this phase of encoding
+is known as <em>analysis</em>. For each short-time block of sound,
+the encoder then packs an efficient representation of the signal, as
+determined by analysis, into a raw packet much smaller than the size
+required by the original signal; this phase is <em>coding</em>.
+Lastly, in a streaming environment, the raw packets are then
+structured into a continuous stream of octets; this last phase is
+<em>streaming</em>. Note that the stream of octets is referred to both
+as a 'byte-' and 'bit-'stream; the latter usage is acceptible as the
+stream of octets is a physical representation of a true logical
+bit-by-bit stream.</p>
+
+<p>A Vorbis decoder performs a mirror image process of extracting the
+original sequence of raw packets from an Ogg stream (<em>stream
+decomposition</em>), reconstructing the signal representation from the
+raw data in the packet (<em>decoding</em>) and them reconstituting an
+audio signal from the decoded representation (<em>synthesis</em>).</p>
+
+<p>The <a href="programming.html">Programming with libvorbis</a>
+documents discuss use of the reference Vorbis codec library
+(libvorbis) produced by the Xiph.org Foundation.</p>
+
+<p>The data representations and algorithms necessary at each step to
+encode and decode Ogg Vorbis bitstreams are described by the below
+documents in sufficient detail to construct a complete Vorbis codec.
+Note that at the time of writing, Vorbis is still in a 'Request For
+Comments' stage of development; despite being in advanced stages of
+development, input from the multimedia community is welcome.</p>
+
+<h3>Vorbis analysis and synthesis</h3>
+
+<p>Analysis begins by seperating an input audio stream into individual,
+overlapping short-time segments of audio data. These segments are
+then transformed into an alternate representation, seeking to
+represent the original signal in a more efficient form that codes into
+a smaller number of bytes. The analysis and transformation stage is
+the most complex element of producing a Vorbis bitstream.</p>
+
+<p>The corresponding synthesis step in the decoder is simpler; there is
+no analysis to perform, merely a mechanical, deterministic
+reconstruction of the original audio data from the transform-domain
+representation.</p>
+
+<ul>
+<li><a href="packet.html">Vorbis packet structure</a>:
+Describes the basic analysis components necessary to produce Vorbis
+packets and the structure of the packet itself.</li>
+<li><a href="envelope.html">Temporal envelope shaping and blocksize</a>:
+Use of temporal envelope shaping and variable blocksize to minimize
+time-domain energy leakage during wide dynamic range and spectral energy
+swings. Also discusses time-related principles of psychoacoustics.</li>
+<li><a href="mdct.html">Time domain segmentation and MDCT transform</a>:
+Division of time domain data into individual overlapped, windowed
+short-time vectors and transformation using the MDCT</li>
+<li><a href="resolution.html">The resolution floor</a>: Use of frequency
+doamin psychoacoustics, and the MDCT-domain noise, masking and resolution
+floors</li>
+<li><a href="residuals.html">MDCT-domain fine structure</a>: Production,
+quantization and massaging of MDCT-spectrum fine structure</li>
+</ul>
+
+<h3>Vorbis coding and decoding</h3>
+
+<p>Coding and decoding converts the transform-domain representation of
+the original audio produced by analysis to and from a bitwise packed
+raw data packet. Coding and decoding consist of two logically
+orthogonal concepts, <em>back-end coding</em> and <em>bitpacking</em>.</p>
+
+<p><em>Back-end coding</em> uses a probability model to represent the raw numbers
+of the audio representation in as few physical bits as possible;
+familiar examples of back-end coding include Huffman coding and Vector
+Quantization.</p>
+
+<p><em>Bitpacking</em> arranges the variable sized words of the back-end
+coding into a vector of octets without wasting space. The octets
+produced by coding a single short-time audio segment is one raw Vorbis
+packet.</p>
+
+<ul>
+<li><a href="probmodel.html">The Vorbis probability model</a></li>
+<li><a href="bitpack.html">The Vorbis bitpacker</a>: Arrangement of 
+variable bit-length words into an octet-aligned packet.</li>
+</ul>
+
+<h3>Vorbis streaming and stream decomposition</h3>
+
+<p>Vorbis packets contain the raw, bitwise-compressed representation of a
+snippet of audio. These packets contain no structure and cannot be
+strung together directly into a stream; for streamed transmission and
+storage, Vorbis packets are encoded into an Ogg bitstream.</p>
+
+<ul>
+<li><a href="oggstream.html">Ogg bitstream overview</a>: High-level
+description of Ogg logical bitstreams, how logical bitstreams
+(of mixed media types) can be combined into physical bitstreams, and
+restrictions on logical-to-physical mapping. Note that this document is
+not specific only to Ogg Vorbis.</li>
+<li><a href="framing.html">Ogg logical bitstream and framing
+spec</a>: Low level, complete specification of Ogg logical
+bitstream pages. Note that this document is not specific only to Ogg
+Vorbis.</li>
+<li><a href="vorbis-stream.html">Vorbis bitstream mapping</a>:
+Specifically describes mapping Vorbis data into an
+Ogg physical bitstream.</li>
+</ul>
+
+<div id="copyright">
+  The Xiph Fish Logo is a
+  trademark (&trade;) of Xiph.Org.<br/>
+
+  These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
+</div>
+
+</body>
+</html>

Modified: branches/vorbis-aotuv/doc/vorbisfile/OggVorbis_File.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/OggVorbis_File.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/OggVorbis_File.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -21,28 +21,44 @@
 The OggVorbis_File structure defines an Ogg Vorbis file.
 <p>
 
-This structure is used in all libvorbisfile routines.  Before it can be used,
-it must be initialized by <a href="ov_open.html">ov_open()</a> or <a
-href="ov_open_callbacks.html">ov_open_callbacks()</a>.
+This structure is used in all libvorbisfile routines.  Before it can
+be used, it must be initialized by <a
+href="ov_open.html">ov_open()</a>, <a
+href="ov_fopen.html">ov_fopen()</a>, or <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a>. <em>Important
+Note:</em> The use of <a href="ov_open.html">ov_open()</a> is
+discouraged under Windows due to a peculiarity of Windows linking
+convention; use <a href="ov_fopen.html">ov_fopen()</a> or <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a> instead.  This
+caution only applies to Windows; use of <a
+href="ov_open.html">ov_open()</a> is appropriate for all other
+platforms.  See the <a href="ov_open.html">ov_open()</a> page for more
+information.
 
 <p>
 After use, the OggVorbis_File structure must be deallocated with a
 call to <a href="ov_clear.html">ov_clear()</a>.
 
 <p>
-Once a file or data source is opened successfully by libvorbisfile
-(using <a href="ov_open.html">ov_open()</a> or <a
-href="ov_open_callbacks.html">ov_open_callbacks()</a>), it is owned by
-libvorbisfile.  The file should not be used by any other applications or
-functions outside of the libvorbisfile API.  The file must not be closed
-directly by the application at any time after a successful open;
-libvorbisfile expects to close the file within <a
-href="ov_clear.html">ov_clear()</a>.
-<p>
-If the call to <a href="ov_open.html">ov_open()</a> or <a
+Note that once a file handle is passed to a successful <a
+href="ov_open.html">ov_open()</a> call, the handle is owned by
+libvorbisfile and will be closed by libvorbisfile later during the
+call to <a href="ov_clear.html">ov_clear()</a>.  The handle should not
+be used or closed outside of the libvorbisfile API.  Similarly, files
+opened by <a href="ov_fopen.html">ov_fopen()</a> will also be closed
+internally by vorbisfile in <a href="ov_clear.html">ov_clear()</a>.<p>
+
+<a href="ov_open_callbacks.html">ov_open_callbacks()</a> allows the
+application to choose whether libvorbisfile will or will not close the
+handle in <a href="ov_clear.html">ov_clear()</a>; see the <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a> page for more information.<p>
+
+If a call to <a href="ov_open.html">ov_open()</a> or <a
 href="ov_open_callbacks.html">ov_open_callbacks()</a> <b>fails</b>,
-libvorbisfile does <b>not</b> assume ownership of the file and the
-application is expected to close it if necessary.
+libvorbisfile does <b>not</b> assume ownership of the handle and the
+application is expected to close it if necessary.  A failed <a
+href="ov_fopen.html">ov_fopen()</a> call will internally close the
+file handle if the open process fails.<p>
 
 <br><br>
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
@@ -108,11 +124,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/callbacks.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/callbacks.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/callbacks.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -50,9 +50,13 @@
 
 The seek-like function provided in the <tt>seek_func</tt> field is
 used to request non-sequential data access by libvorbisfile, moving
-the access cursor to the requested position.<p>
+the access cursor to the requested position. The seek function is
+optional; if callbacks are only to handle non-seeking (streaming) data
+or the application wishes to force streaming behavior,
+<tt>seek_func</tt> and <tt>tell_func</tt> should be set to NULL. If
+the seek function is non-NULL, libvorbisfile mandates the following
+behavior:
 
-libvorbisfile expects the following behavior:
 <ul>
 <li>The seek function must always return -1 (failure) if the given
 data abstraction is not seekable.  It may choose to always return -1
@@ -73,15 +77,17 @@
 
 The close function should deallocate any access state used by the
 passed in instance of the data access abstraction and invalidate the
-instance handle.  The close function is assumed to succeed.<p>
+instance handle.  The close function is assumed to succeed; its return
+code is not checked.<p>
 
-One common use of callbacks and the close function is to change the
-behavior of libvorbisfile with respect to file closure for applications
-that <em>must</em> <tt>fclose</tt> data files themselves. By passing
-the normal stdio calls as callback functions, but passing a
-<tt>close_func</tt> that does nothing, an application may call <a
-href="ov_clear.html">ov_clear()</a> and then <tt>fclose()</tt> the
-file originally passed to libvorbisfile.
+The <tt>close_func</tt> may be set to NULL to indicate that libvorbis
+should not attempt to close the file/data handle in <a
+href="ov_clear.html">ov_clear</a> but allow the application to handle
+file/data access cleanup itself. For example, by passing the normal
+stdio calls as callback functions, but passing a <tt>close_func</tt>
+that is NULL or does nothing (as in the case of OV_CALLBACKS_NOCLOSE), an
+application may call <a href="ov_clear.html">ov_clear()</a> and then
+later <tt>fclose()</tt> the file originally passed to libvorbisfile.
 
 <h2>Tell function</h2> 
 
@@ -94,17 +100,19 @@
 not an error.<p>
 
 The tell function need not be provided if the data IO abstraction is
-not seekable.<p>
+not seekable, or the application wishes to force streaming
+behavior. In this case, the <tt>tell_func</tt> and <tt>seek_func</tt>
+fields should be set to NULL.<p>
 
 <br><br>
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/chaining_example_c.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/chaining_example_c.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/chaining_example_c.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -31,8 +31,12 @@
   OggVorbis_File ov;
   int i;
 
+<font color="#A020F0">#ifdef _WIN32</font> <font color="#B22222">/* We need to set stdin to binary mode on windows. */</font>
+  _setmode( _fileno( stdin ), _O_BINARY );
+<font color="#A020F0">#endif</font>
+
   <font color="#B22222">/* open the file/pipe on stdin */</font>
-  <font color="#4169E1">if</font>(ov_open(stdin,&amp;ov,NULL,-1)&lt;0){
+  <font color="#4169E1">if</font>(ov_open_callbacks(stdin,&amp;ov,NULL,-1,OV_CALLBACKS_NOCLOSE)&lt;0){
     printf(<font color="#666666">"Could not open input as an OggVorbis file.\n\n"</font>);
     exit(1);
   }
@@ -73,11 +77,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2004 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/chainingexample.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/chainingexample.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/chainingexample.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -50,16 +50,33 @@
 </tr>
 </table>
 
-<p><a href="ov_open.html">ov_open()</a> must be
-called to initialize the <a href="OggVorbis_File.html">OggVorbis_File</a> structure with default values.  
-<a href="ov_open.html">ov_open()</a> also checks to ensure that we're reading Vorbis format and not something else.
+<p>This example takes its input on stdin which is in 'text' mode by default under Windows; this will corrupt the input data unless set to binary mode.  This applies only to Windows.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+#ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
+  _setmode( _fileno( stdin ), _O_BINARY );
+#endif
+</b></pre>
+        </td>
+</tr>
+</table>
 
+<p>We call <a href="ov_open_callbacks.html">ov_open_callbacks()</a> to
+initialize the <a href="OggVorbis_File.html">OggVorbis_File</a>
+structure.  <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
+also checks to ensure that we're reading Vorbis format and not
+something else. The OV_CALLBACKS_NOCLOSE callbacks instruct
+libvorbisfile not to close stdin later during cleanup.<p>
+
 <br><br>
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
         <td>
 <pre><b>
-  if(ov_open(stdin,&amp;ov,NULL,-1)&gt;0){
+  if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
@@ -145,11 +162,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2004 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/crosslap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/crosslap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/crosslap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -54,7 +54,7 @@
 reasons described above.
 
 <p>Frame lapping, like Vorbis performs internally during continuous
-playback, is necessary to eliminate that last epislon of trouble.
+playback, is necessary to eliminate that last epsilon of trouble.
 
 <h1>Easiest Crosslap</h1>
 
@@ -108,11 +108,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/datastructures.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/datastructures.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/datastructures.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -48,11 +48,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/decoding.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/decoding.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/decoding.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -61,7 +61,8 @@
 	<td><a href="ov_read.html">ov_read</a></td>
 	<td>This function makes up the main chunk of a decode loop. It takes an
 OggVorbis_File structure, which must have been initialized by a previous
-call to <a href="ov_open.html"><tt>ov_open()</tt></a>.</td>
+call to <a href="ov_open.html"><tt>ov_open()</tt></a>, <a href="ov_fopen.html"><tt>ov_fopen()</tt></a>, 
+or <a href="ov_open_callbacks.html"><tt>ov_open_callbacks()</tt></a>.</td>
 </tr>
 <tr valign=top>
         <td><a href="ov_read_float.html">ov_read_float</a></td>
@@ -73,11 +74,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/example.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/example.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/example.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -87,16 +87,19 @@
 </tr>
 </table>
 
-<p><a href="ov_open.html">ov_open()</a> must be
-called to initialize the <b>OggVorbis_File</b> structure with default values.  
-<a href="ov_open.html">ov_open()</a> also checks to ensure that we're reading Vorbis format and not something else.
+<p>We call <a href="ov_open_callbacks.html">ov_open_callbacks()</a> to
+initialize the <b>OggVorbis_File</b> structure with default values.
+<a href="ov_open_callbacks.html">ov_open_callbacks()</a> also checks
+to ensure that we're reading Vorbis format and not something else. The
+OV_CALLBACKS_NOCLOSE callbacks instruct libvorbisfile not to close
+stdin later during cleanup.
 
 <br><br>
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
         <td>
 <pre><b>
-  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+  if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
       fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
       exit(1);
   }
@@ -192,11 +195,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/exampleindex.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/exampleindex.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/exampleindex.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -26,11 +26,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/fileinfo.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/fileinfo.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/fileinfo.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -82,11 +82,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/index.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/index.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/index.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -36,11 +36,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/initialization.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/initialization.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/initialization.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,24 +9,35 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
 <H1>Setup/Teardown</h1> <p>In order to decode audio using
 libvorbisfile, a bitstream containing Vorbis audio must be properly
 initialized before decoding and cleared when decoding is finished.
-The simplest possible case is to use <tt>fopen()</tt> to open a Vorbis
-file and then pass the <tt>FILE *</tt> to an <a
-href="ov_open.html">ov_open()</a> call.  A successful <a
+The simplest possible case is to use <a
+href="ov_fopen.html">ov_fopen()</a> to open the file for access, check
+it for Vorbis content, and prepare it for playback.  A successful <a
 href="return.html">return code</a> from <a
-href="ov_open.html">ov_open()</a> indicates the file is ready for use.
+href="ov_fopen.html">ov_fopen()</a> indicates the file is ready for use.
 Once the file is no longer needed, <a
 href="ov_clear.html">ov_clear()</a> is used to close the file and
-deallocate decoding resources.  </b>Do not</b> call <tt>fclose()</tt> on the
-file; libvorbisfile does this in the <a
-href="ov_clear.html">ov_clear()</a> call.
+deallocate decoding resources.<p>
 
+On systems other than Windows<a href="ov_open.html#winfoot">[a]</a>, an
+application may also open a file itself using <tt>fopen()</tt>, then pass the
+<tt>FILE *</tt> to libvorbisfile using <a
+href="ov_open.html">ov_open()</a>. </b>Do not</b> call
+<tt>fclose()</tt> on a file handle successfully submitted to <a
+href="ov_open.html">ov_open()</a>; libvorbisfile does this in the <a
+href="ov_clear.html">ov_clear()</a> call.<p>
+
+An application that requires more setup flexibility may open a data
+stream using <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
+to change default libvorbis behavior or specify non-stdio data access
+mechanisms.<p>
+
 <p>
 All libvorbisfile initialization and deallocation routines are declared in "vorbis/vorbisfile.h".
 <p>
@@ -37,13 +48,18 @@
 	<td><b>purpose</b></td>
 </tr>
 <tr valign=top>
-	<td><a href="ov_open.html">ov_open</a></td>
-	<td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream and default values.  This must be called before other functions in the library may be
+	<td><a href="ov_fopen.html">ov_fopen</a></td>
+	<td>Opens a file and initializes the Ogg Vorbis bitstream with default values.  This must be called before other functions in the library may be
 	used.</td>
 </tr>
 <tr valign=top>
+	<td><a href="ov_open.html">ov_open</a></td>
+	<td>Initializes the Ogg Vorbis bitstream with default values from a passed in file handle.  This must be called before other functions in the library may be
+	used.  <a href="#winfoot"><em>Do not use this call under Windows [a];</em></a> Use <a href="ov_fopen.html">ov_fopen()</a> or <a href="ov_open_callbacks.html">ov_open_callbacks()</a> instead.</td>
+</tr>
+<tr valign=top>
 	<td><a href="ov_open_callbacks.html">ov_open_callbacks</a></td>
-	<td>Initializes the Ogg Vorbis bitstream with a pointer to a bitstream, default values, and custom file/bitstream manipulation routines.  Used instead of <a href="ov_open.html">ov_open()</a> when working with other than stdio based I/O.</td>
+	<td>Initializes the Ogg Vorbis bitstream from a file handle and custom file/bitstream manipulation routines.  Used instead of <a href="ov_open.html">ov_open()</a> or <a href="ov_fopen.html">ov_fopen()</a> when altering or replacing libvorbis's default stdio I/O behavior, or when a bitstream must be initialized from a <tt>FILE *</tt> under Windows.</td>
 </tr>
 
 <tr valign=top>
@@ -86,13 +102,14 @@
 
 <br><br>
 <hr noshade>
+
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -59,11 +59,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate_instant.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate_instant.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_bitrate_instant.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -52,11 +52,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_callbacks.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_callbacks.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_callbacks.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -23,11 +23,13 @@
 <p>
 The ov_callbacks structure does not need to be user-defined if you are
 working with stdio-based file manipulation; the <a
-href="ov_open.html">ov_open()</a> call provides default callbacks for
+href="ov_fopen.html">ov_fopen()</a> and <a
+href="ov_open.html">ov_open()</a> calls internally provide default callbacks for
 stdio.  ov_callbacks are defined and passed to <a
 href="ov_open_callbacks.html">ov_open_callbacks()</a> when
 implementing non-stdio based stream manipulation (such as playback
-from a memory buffer).
+from a memory buffer) or when <a
+href="ov_open.html#winfoot">ov_open()-style initialization from a <tt>FILE *</tt> is required under Windows [a]</a>.
 <p>
 
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
@@ -48,15 +50,52 @@
 <dt><i>read_func</i></dt>
 <dd>Pointer to custom data reading function.</dd>
 <dt><i>seek_func</i></dt>
-<dd>Pointer to custom data seeking function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided seek callback should always return -1 (failure).</dd>
+<dd>Pointer to custom data seeking function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided seek callback should always return -1 (failure) or the <tt>seek_func</tt> and <tt>tell_func</tt> fields should be set to NULL.</dd>
 <dt><i>close_func</i></dt>
-<dd>Pointer to custom data source closure function.</dd>
+<dd>Pointer to custom data source closure function.  Set to NULL if libvorbisfile should not attempt to automatically close the file/data handle.</dd>
 <dt><i>tell_func</i></dt>
-<dd>Pointer to custom data location function.</dd>
+<dd>Pointer to custom data location function. If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided tell callback should always return -1 (failure) or the <tt>seek_func</tt> and <tt>tell_func</tt> fields should be set to NULL.</dd>
 </dl>
 
 <p>
 
+<h3>Predefined callbacks</h3>
+The header vorbis/vorbisfile.h provides several predefined static ov_callbacks structures that may be passed to <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a>:
+<dl>
+<dt><tt>OV_CALLBACKS_DEFAULT</tt><dd>
+
+These callbacks provide the same behavior as used internally by <a
+href="ov_fopen.html">ov_fopen()</a> and <a
+href="ov_open.html">ov_open()</a>.
+
+<dt><tt>OV_CALLBACKS_NOCLOSE</tt><dd>
+
+The same as <tt>OV_CALLBACKS_DEFAULT</tt>, but with the
+<tt>close_func</tt> field set to NULL.  The most typical use would be
+to use <a href="ov_open_callbacks.html">ov_open_callbacks()</a> to
+provide the same behavior as <a href="ov_open.html">ov_open()</a>, but
+not close the file/data handle in <a
+href="ov_clear.html">ov_clear()</a>.
+
+<dt><tt>OV_CALLBACKS_STREAMONLY</tt><dd>
+
+A set of callbacks that set <tt>seek_func</tt> and <tt>tell_func</tt>
+to NULL, thus forcing strict streaming-only behavior regardless of
+whether or not the input is actually seekable.
+
+<dt><tt>OV_CALLBACKS_STREAMONLY_NOCLOSE</tt><dd>
+
+The same as <tt>OV_CALLBACKS_STREAMONLY</tt>, but with
+<tt>close_func</tt> also set to null, preventing libvorbisfile from
+attempting to close the file/data handle in <a
+href="ov_clear.html">ov_clear()</a>.
+
+</dl>
+<p>
+
+<h3>Examples and usage</h3>
+
 See <a href="callbacks.html">the callbacks and non-stdio I/O document</a> for more
 detailed information on required behavior of the various callback
 functions.<p>
@@ -65,11 +104,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_clear.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_clear.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_clear.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -17,8 +17,8 @@
 
 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
 
-<p> After a bitstream has been opened using <a href="ov_open.html">ov_open()</a>/<a href="ov_open_callbacks.html">ov_open_callbacks()</a> and decoding is complete, the application must call <tt>ov_clear()</tt> to clear
-the decoder's buffers.  <tt>ov_clear()</tt> will also close the file.<p>
+<p> After a bitstream has been opened using <a href="ov_fopen.html">ov_fopen()</a>/<a href="ov_open.html">ov_open()</a>/<a href="ov_open_callbacks.html">ov_open_callbacks()</a> and decoding is complete, the application must call <tt>ov_clear()</tt> to clear
+the decoder's buffers.  <tt>ov_clear()</tt> will also close the file unless it was opened using <a href="ov_open_callbacks.html">ov_open_callbacks()</a> with the <tt>close_func</tt> callback set to NULL.<p>
 
 <tt>ov_clear()</tt> must also be called after a successful call to <a href="ov_test.html">ov_test()</a> or <a href="ov_test_callbacks.html">ov_test_callbacks()</a>.<p>
 
@@ -37,7 +37,7 @@
 <dl>
 <dt><i>vf</i></dt>
 <dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
-functions.  After <tt>ov_clear</tt> has been called, the structure is deallocated and can no longer be used.</dd>
+functions.  After <tt>ov_clear</tt> has been called, the contents of this structure are deallocated, and it can no longer be used without being reinitialized by a call to <a href="ov_fopen.html">ov_fopen()</a>, <a href="ov_open.html">ov_open()</a> or <a href="ov_open_callbacks.html">ov_open_callbacks()</a>.</dd>
 </dl>
 
 
@@ -51,11 +51,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_comment.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_comment.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_comment.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -10,7 +10,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -53,11 +53,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_crosslap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_crosslap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_crosslap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -87,11 +87,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Added: branches/vorbis-aotuv/doc/vorbisfile/ov_fopen.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_fopen.html	                        (rev 0)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_fopen.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,124 @@
+<html>
+
+<head>
+<title>Vorbisfile - function - ov_fopen</title>
+<link rel=stylesheet href="style.css" type="text/css">
+</head>
+
+<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
+<table border=0 width=100%>
+<tr>
+<td><p class=tiny>Vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
+</tr>
+</table>
+
+<h1>ov_fopen</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>This is the simplest function used to open and initialize an OggVorbis_File
+structure. It sets up all the related decoding structure.
+<p>The first argument is a file path suitable
+for passing to fopen(). <tt>vf</tt> should be a pointer to an empty
+OggVorbis_File structure -- this is used for ALL the externally visible
+libvorbisfile functions. Once this has been called, the same <a
+href="OggVorbis_File.html">OggVorbis_File</a> struct should be passed
+to all the libvorbisfile functions.
+<p>The <tt>vf</tt> structure initialized using ov_fopen() must
+eventually be cleaned using <a href="ov_clear.html">ov_clear()</a>.
+
+<p>
+It is often useful to call <tt>ov_fopen()</tt> simply to determine
+whether a given file is a Vorbis bitstream. If the <tt>ov_fopen()</tt>
+call fails, then the file is either inaccessable (errno is set) or not
+recognizable as Vorbis (errno unchanged).  If the call succeeds but
+the initialized <tt>vf</tt> structure will not be used, the
+application is responsible for calling <a
+href="ov_clear.html">ov_clear()</a> to clear the decoder's buffers and
+close the file.<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+	<td>
+<pre><b>
+int ov_fopen(char *path,<a href="OggVorbis_File.html">OggVorbis_File</a> *vf);
+</b></pre>
+	</td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>path</i></dt>
+<dd>Null terminated string containing a file path suitable for passing to <tt>fopen()</tt>.
+</dd>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the libvorbisfile functions.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>0 indicates success</li>
+
+<li>less than zero for failure:</li>
+<ul>
+<li>OV_EREAD - A read from media returned an error.</li>
+<li>OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.</li>
+<li>OV_EVERSION - Vorbis version mismatch.</li>
+<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
+</ul>
+</blockquote>
+<p>
+
+<h3>Notes</h3>
+<dl>
+
+<dt><b>[a] Threaded decode</b><p>
+<dd>If your decoder is threaded, it is recommended that you NOT call
+<tt>ov_open_callbacks()</tt>
+in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback
+thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
+call, given that the full structure of the file is determined at this point,
+which may require reading large parts of the file under certain circumstances
+(determining all the logical bitstreams in one physical bitstream, for
+example).  See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
+<p>
+
+<dt><b>[b] Mixed media streams</b><p>
+<dd>
+As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
+Vorbis content in mixed-media Ogg streams, not just Vorbis-only
+streams.  For example, Vorbisfile may be used to open and access the
+audio from an Ogg stream consisting of Theora video and Vorbis audio.
+Vorbisfile 1.2.0 decodes the first logical audio stream of each
+physical stream section.<p>
+
+<dt><b>[c] Faster testing for Vorbis files</b><p>
+<dd><a href="ov_test.html">ov_test()</a> and <a
+href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less
+computationally expensive ways to test a file for Vorbisness, but
+require more setup code.<p>
+
+</dl>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
+</tr><tr>
+<td><p class=tiny>Vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_info.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_info.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_info.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -51,11 +51,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_open.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_open.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_open.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -17,29 +17,46 @@
 
 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
 
-<p>This is the main function used to open and initialize an OggVorbis_File
-structure. It sets up all the related decoding structure.
+<p>ov_open is one of three initialization functions used to initialize
+an OggVorbis_File structure and prepare a bitstream for playback.
+
+<p><em><b> WARNING for Windows developers: </b> Do not use ov_open() in
+Windows applications; Windows linking places restrictions on
+passing <tt>FILE *</tt> handles successfully, and ov_open() runs
+afoul of these restrictions <a href="#winfoot">[a]</a>.  See the <a
+href="ov_open_callbacks.html">ov_open_callbacks() page </a> for
+details on using <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a> instead. </em>
+
 <p>The first argument must be a file pointer to an already opened file
 or pipe (it need not be seekable--though this obviously restricts what
 can be done with the bitstream). <tt>vf</tt> should be a pointer to the
-OggVorbis_File structure--this is used for ALL the externally visible libvorbisfile
+OggVorbis_File structure -- this is used for ALL the externally visible libvorbisfile
 functions. Once this has been called, the same <a href="OggVorbis_File.html">OggVorbis_File</a>
-struct should be passed to all the libvorbisfile functions.
-<p>Also, you should be aware that ov_open(), once successful, takes complete possession of the file resource.  After you have opened a file using ov_open(), you MUST close it using <a href="ov_clear.html">ov_clear()</a>, not fclose() or any other function.
-<p>
-It is often useful to call <tt>ov_open()</tt>
-simply to determine whether a given file is a vorbis bitstream. If the
-<tt>ov_open()</tt>
-call fails, then the file is not recognizable as such. 
-When you use <tt>ov_open()
-</tt>for
-this, you should <tt>fclose()</tt> the file pointer if, and only if, the
-<tt>ov_open()</tt>
-call fails. If it succeeds, you must call <a href="ov_clear.html">ov_clear()</a> to clear
-the decoder's buffers and close the file for you.<p>
+struct should be passed to all the libvorbisfile functions.<p>
 
-(Note that <a href="ov_test.html">ov_test()</a> provides a less expensive way to test a file for Vorbisness.)<p>
+The <tt>vf</tt> structure initialized using ov_fopen() must eventually
+be cleaned using <a href="ov_clear.html">ov_clear()</a>.  Once a
+<tt>FILE *</tt> handle is passed to ov_open() successfully, the
+application MUST NOT <tt>fclose()</tt> or in any other way manipulate
+that file handle.  Vorbisfile will close the file in <a
+href="ov_clear.html">ov_clear()</a>.  If the application must be able
+to close the <tt>FILE *</tt> handle itself, see <a
+href="ov_open_callbacks.html">ov_open_callbacks()</a> with the use of
+<tt>OV_CALLBACKS_NOCLOSE</tt>.
 
+<p>It is often useful to call <tt>ov_open()</tt> simply to determine
+whether a given file is a Vorbis bitstream. If the <tt>ov_open()</tt>
+call fails, then the file is not recognizable as Vorbis.  If the call
+succeeds but the initialized <tt>vf</tt> structure will not be used,
+the application is responsible for calling <a
+href="ov_clear.html">ov_clear()</a> to clear the decoder's buffers and
+close the file.<p>
+
+If [and only if] an <tt>ov_open()</tt> call fails, the application
+must explicitly <tt>fclose()</tt> the <tt>FILE *</tt> pointer itself.
+
+
 <br><br>
 <table border=0 color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
@@ -87,26 +104,77 @@
 </blockquote>
 <p>
 
+<a name="notes"></a>
 <h3>Notes</h3>
-<p>If your decoder is threaded, it is recommended that you NOT call
+<dl>
+
+<a name="winfoot"></a>
+<dt><b>[a] Windows and ov_open()</b><p>
+
+<dd>Under Windows, stdio file access is implemented in each of many
+variants of crt.o, several of which are typically installed on any one
+Windows machine.  If libvorbisfile and the application using
+libvorbisfile are not linked against the exact same
+version/variant/build of crt.o (and they usually won't be, especially
+using a prebuilt libvorbis DLL), <tt>FILE *</tt> handles cannot be
+opened in the application and then passed to vorbisfile to be used
+by stdio calls from vorbisfile's different version of CRT.  For this
+reason, using <a href="ov_open.html">ov_open()</a> under Windows
+without careful, expert linking will typically cause a protection
+fault.  Windows programmers should use <a
+href="ov_fopen.html">ov_fopen()</a> (which will only use libvorbis's
+crt.o) or <a href="ov_open_callbacks.html">ov_open_callbacks()</a>
+(which will only use the application's crt.o) instead.<p>
+
+This warning only applies to Windows and only applies to <a
+href="ov_open.html">ov_open()</a>.  It is perfectly safe to use <a
+href="ov_open.html">ov_open()</a> on all other platforms.<p>
+
+For more information, see the following microsoft pages on <a
+href="http://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx">C
+runtime library linking</a> and a specific description of <a
+href="http://msdn2.microsoft.com/en-us/library/ms235460(VS.80).aspx">restrictions
+on passing CRT objects across DLL boundaries</a>.
+
+<p>
+
+<dt><b>[b] Threaded decode</b><p>
+<dd>If your decoder is threaded, it is recommended that you NOT call
 <tt>ov_open()</tt>
-in the main control thread--instead, call <tt>ov_open()</tt> IN your decode/playback
+in the main control thread--instead, call <tt>ov_open()</tt> in your decode/playback
 thread. This is important because <tt>ov_open()</tt> may be a fairly time-consuming
 call, given that the full structure of the file is determined at this point,
 which may require reading large parts of the file under certain circumstances
 (determining all the logical bitstreams in one physical bitstream, for
 example).  See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
+<p>
 
+<dt><b>[c] Mixed media streams</b><p>
+<dd>
+As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
+Vorbis content in mixed-media Ogg streams, not just Vorbis-only
+streams.  For example, Vorbisfile may be used to open and access the
+audio from an Ogg stream consisting of Theora video and Vorbis audio.
+Vorbisfile 1.2.0 decodes the first logical audio stream of each
+physical stream section.<p>
 
+<dt><b>[d] Faster testing for Vorbis files</b><p>
+<dd><a href="ov_test.html">ov_test()</a> and <a
+href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less
+computationally expensive ways to test a file for Vorbisness, but
+require more setup code.<p>
+
+</dl>
+
 <br><br>
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_open_callbacks.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_open_callbacks.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_open_callbacks.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -17,23 +17,29 @@
 
 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
 
-<p>This is an alternative function used to open and initialize an OggVorbis_File
-structure when using a data source other than a file.   It allows you to specify custom file manipulation routines and sets up all the related decoding structure.
-<p>Once this has been called, the same <tt>OggVorbis_File</tt>
-struct should be passed to all the libvorbisfile functions.
-<p>
-It is often useful to call <tt>ov_open_callbacks()</tt>
-simply to determine whether a given stream is a vorbis bitstream. If the
-<tt>ov_open_callbacks()</tt>
-call fails, then the data is not recognizable as such. When you use <tt>ov_open_callbacks()
-</tt>for
-this, you should close or otherwise deallocate your <tt>datasource</tt> if, and only if, the
-<tt>ov_open_callbacks()</tt>
-call fails. If it succeeds, you must call <a href=ov_clear.html>ov_clear()</a> to clear
-the decoder's buffers and call your close callback.<p>
+<p>This is an alternative function used to open and initialize an
+OggVorbis_File structure when using a data source other than a file,
+when its necessary to modify default file access behavior, or to
+initialize a Vorbis decode from a <tt>FILE *</tt> pointer under
+Windows where <a href="ov_open.html">ov_open()</a> cannot be used.  It
+allows the application to specify custom file manipulation routines
+and sets up all the related decoding structures.
 
-See also <a href="callbacks.html">Callbacks and Non-stdio I/O</a> for information on designing and specifying the required callback functions.<p>
+<p>Once ov_open_callbacks() has been called, the same
+<tt>OggVorbis_File</tt> struct should be passed to all the
+libvorbisfile functions.  Unlike <a
+href="ov_fopen.html">ov_fopen()</a> and <a
+href="ov_open.html">ov_open()</a>, ov_open_callbacks() may be used to
+instruct vorbisfile to either automatically close or not to close the
+file/data access handle in <a href="ov_clear.html">ov_clear()</a>.
+Automatic closure is disabled by passing NULL as the close callback,
+or using one of the predefined callback sets that specify a NULL close
+callback.  The application is responsible for closing a file when a
+call to ov_open_callbacks() is unsuccessful.<p>
 
+See also <a href="callbacks.html">Callbacks and Non-stdio I/O</a> for
+information on designing and specifying custom callback functions.<p>
+
 <br><br>
 <table border=0 color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
@@ -62,7 +68,7 @@
 read from the stream and the stream is not seekable. In this case, <tt>ibytes</tt>
 should contain the length (in bytes) of the buffer.  Used together with <tt>initial</tt>.</dd>
 <dt><i>callbacks</i></dt>
-<dd>A completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.</dd>
+<dd>A completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.  vorbisfile.h defines several preprovided callback sets; see <a href="ov_callbacks.html">ov_callbacks</a> for details.</dd>
 </dl>
 
 
@@ -72,7 +78,7 @@
 <li>less than zero for failure:</li>
 <ul>
 <li>OV_EREAD - A read from media returned an error.</li>
-<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
+<li>OV_ENOTVORBIS - Bitstream does not contain any Vorbis data.</li>
 <li>OV_EVERSION - Vorbis version mismatch.</li>
 <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
 <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
@@ -81,25 +87,58 @@
 <p>
 
 <h3>Notes</h3>
-<p>If your decoder is threaded, it is recommended that you NOT call
+<dl>
+
+<dt><b>[a] Windows and use as an ov_open() substitute</b><p> Windows
+applications should not use <a href="ov_open.html">ov_open()</a> due
+to the likelihood of <a href="ov_open.html#winfoot">CRT linking
+mismatches and runtime protection faults
+[ov_open:a]</a>. ov_open_callbacks() is a safe substitute; specifically:
+
+<pre><tt>ov_open_callbacks(f, vf, initial, ibytes, OV_CALLBACKS_DEFAULT);</tt>
+</pre>
+
+... provides exactly the same functionality as <a
+href="ov_open.html">ov_open()</a> but will always work correctly under
+Windows, regardless of linking setup details.<p>
+
+<dt><b>[b] Threaded decode</b><p>
+<dd>If your decoder is threaded, it is recommended that you NOT call
 <tt>ov_open_callbacks()</tt>
-in the main control thread--instead, call <tt>ov_open_callbacks()</tt> IN your decode/playback
+in the main control thread--instead, call <tt>ov_open_callbacks()</tt> in your decode/playback
 thread. This is important because <tt>ov_open_callbacks()</tt> may be a fairly time-consuming
 call, given that the full structure of the file is determined at this point,
 which may require reading large parts of the file under certain circumstances
 (determining all the logical bitstreams in one physical bitstream, for
-example).
-See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
+example).  See <a href="threads.html">Thread Safety</a> for other information on using libvorbisfile with threads.
+<p>
 
+<dt><b>[c] Mixed media streams</b><p>
+<dd>
+As of Vorbisfile release 1.2.0, Vorbisfile is able to access the
+Vorbis content in mixed-media Ogg streams, not just Vorbis-only
+streams.  For example, Vorbisfile may be used to open and access the
+audio from an Ogg stream consisting of Theora video and Vorbis audio.
+Vorbisfile 1.2.0 decodes the first logical audio stream of each
+physical stream section.<p>
+
+<dt><b>[d] Faster testing for Vorbis files</b><p>
+<dd><a href="ov_test.html">ov_test()</a> and <a
+href="ov_test_callbacks.html">ov_test_callbacks()</a> provide less
+computationally expensive ways to test a file for Vorbisness, but
+require more setup code.<p>
+
+</dl>
+
 <br><br>
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -70,11 +70,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_lap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_lap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_lap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -90,11 +90,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -71,11 +71,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page_lap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page_lap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_seek_page_lap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -99,11 +99,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_tell.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_tell.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_tell.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -50,11 +50,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_total.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_total.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_pcm_total.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -54,11 +54,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -70,11 +70,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek_lap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek_lap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_raw_seek_lap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -97,11 +97,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_raw_tell.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_raw_tell.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_raw_tell.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -52,11 +52,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_raw_total.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_raw_total.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_raw_total.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -55,11 +55,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_read.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_read.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_read.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -110,11 +110,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_read_float.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_read_float.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_read_float.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -88,7 +88,7 @@
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_seekable.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_seekable.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_seekable.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -50,11 +50,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_serialnumber.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_serialnumber.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_serialnumber.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -54,11 +54,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_streams.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_streams.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_streams.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -51,11 +51,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_test.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_test.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_test.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -19,11 +19,21 @@
 
 <p>
 This partially opens a vorbis file to test for Vorbis-ness.  It loads
-the headers for the first chain, and tests for seekability (but does not seek).
+the headers for the first chain and tests for seekability (but does not seek).
 Use <a href="ov_test_open.html">ov_test_open()</a> to finish opening the file
 or <a href="ov_clear.html">ov_clear</a> to close/free it.
 <p>
 
+<p><em><b> WARNING for Windows developers: </b> Do not use ov_test()
+in Windows applications; Windows linking places restrictions on
+passing <tt>FILE *</tt> handles successfully, and ov_test() runs afoul
+of these restrictions <a href="#winfoot">[a]</a> in exactly the same
+way as <a href="ov_open.html">ov_open()</a>.  See the <a
+href="ov_test_callbacks.html">ov_test_callbacks() page </a> for
+details on using <a
+href="ov_test_callbacks.html">ov_test_callbacks()</a> instead. </em>
+<p>
+
 <table border=0 color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
 	<td>
@@ -62,7 +72,7 @@
 <li>less than zero for failure:</li>
 <ul>
 <li>OV_EREAD - A read from media returned an error.</li>
-<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
+<li>OV_ENOTVORBIS - Bitstream contains no Vorbis data.</li>
 <li>OV_EVERSION - Vorbis version mismatch.</li>
 <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
 <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
@@ -70,17 +80,19 @@
 </blockquote>
 <p>
 
+<h3>Notes</h3>
 
+All the <a href="ov_open.html#notes">notes from ov_open()</a> apply to ov_test().
 
 <br><br>
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_test_callbacks.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_test_callbacks.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_test_callbacks.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -18,7 +18,13 @@
 <p><i>declared in "vorbis/vorbisfile.h";</i></p>
 
 <p>This is an alternative function used to open and test an OggVorbis_File
-structure when using a data source other than a file.   It allows you to specify custom file manipulation routines and sets up all the related decoding structures.
+structure when using a data source other than a file,
+when its necessary to modify default file access behavior, or to
+test for Vorbis content from a <tt>FILE *</tt> pointer under
+Windows where <a href="ov_open.html">ov_test()</a> cannot be used.  It
+allows the application to specify custom file manipulation routines
+and sets up all the related decoding structures.
+
 <p>Once this has been called, the same <tt>OggVorbis_File</tt>
 struct should be passed to all the libvorbisfile functions.
 <p>
@@ -52,7 +58,7 @@
 read from the file and the stream is not seekable. In this case, <tt>ibytes</tt>
 should contain the length (in bytes) of the buffer.  Used together with <tt>initial</tt>.</dd>
 <dt><i>callbacks</i></dt>
-<dd>A completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.</dd>
+<dd>A completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.  vorbisfile.h defines several preprovided callback sets; see <a href="ov_callbacks.html">ov_callbacks</a> for details.</dd>
 </dl>
 
 
@@ -62,7 +68,7 @@
 <li>less than zero for failure:</li>
 <ul>
 <li>OV_EREAD - A read from media returned an error.</li>
-<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>
+<li>OV_ENOTVORBIS - Bitstream contains no Vorbis data.</li>
 <li>OV_EVERSION - Vorbis version mismatch.</li>
 <li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>
 <li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>
@@ -70,18 +76,33 @@
 </blockquote>
 <p>
 
+<h3>Notes</h3>
+<dl>
 
+<dt><b>[a] Windows and use as an ov_test() substitute</b><p> Windows
+applications should not use <a href="ov_test.html">ov_test()</a> due
+to the likelihood of <a href="ov_open.html#winfoot">CRT linking
+mismatches and runtime protection faults
+[ov_open:a]</a>. ov_test_callbacks() is a safe substitute; specifically:
 
+<pre><tt>ov_test_callbacks(f, vf, initial, ibytes, OV_CALLBACKS_DEFAULT);</tt>
+</pre>
 
+... provides exactly the same functionality as <a
+href="ov_test.html">ov_test()</a> but will always work correctly under
+Windows, regardless of linking setup details.<p>
+
+</dl>
+
 <br><br>
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_test_open.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_test_open.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_test_open.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -62,11 +62,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -69,11 +69,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_lap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_lap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_lap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -92,11 +92,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -70,11 +70,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page_lap.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page_lap.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_seek_page_lap.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -99,11 +99,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_tell.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_tell.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_tell.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -50,11 +50,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/ov_time_total.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/ov_time_total.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/ov_time_total.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -54,11 +54,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/overview.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/overview.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/overview.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -47,11 +47,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/reference.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/reference.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/reference.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -23,6 +23,7 @@
 <a href="ov_callbacks.html">ov_callbacks</a><br>
 <br>
 <b>Setup/Teardown</b><br>
+<a href="ov_fopen.html">ov_fopen()</a><br>
 <a href="ov_open.html">ov_open()</a><br>
 <a href="ov_open_callbacks.html">ov_open_callbacks()</a><br>
 <a href="ov_clear.html">ov_clear()</a><br>
@@ -69,11 +70,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/return.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/return.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/return.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -64,11 +64,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/seekexample.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/seekexample.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/seekexample.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -32,7 +32,6 @@
 #include &lt;stdio.h>
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"
-#include "../lib/misc.h"
 </b></pre>
 	</td>
 </tr>
@@ -52,16 +51,30 @@
 </tr>
 </table>
 
-<p><a href="ov_open.html">ov_open()</a> must be
+<p>This example takes its input on stdin which is in 'text' mode by default under Windows; this will corrupt the input data unless set to binary mode.  This applies only to Windows.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+#ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
+  _setmode( _fileno( stdin ), _O_BINARY );
+#endif
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p><a href="ov_open_callbacks.html">ov_open()</a> must be
 called to initialize the <a href="OggVorbis_File.html">OggVorbis_File</a> structure with default values.  
-<a href="ov_open.html">ov_open()</a> also checks to ensure that we're reading Vorbis format and not something else.
+<a href="ov_open_callbacks.html">ov_open_callbacks()</a> also checks to ensure that we're reading Vorbis format and not something else.
 
 <br><br>
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
         <td>
 <pre><b>
-  if(ov_open(stdin,&ov,NULL,-1)<0){
+  if(ov_open_callbacks(stdin,&ov,NULL,-1, OV_CALLBACKS_NOCLOSE)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
@@ -126,11 +139,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/seeking.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/seeking.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/seeking.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -94,11 +94,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/seeking_example_c.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/seeking_example_c.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/seeking_example_c.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -28,14 +28,17 @@
 #include <stdio.h>
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"
-#include "../lib/misc.h"
 
 int main(){
   OggVorbis_File ov;
   int i;
 
+#ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
+  _setmode( _fileno( stdin ), _O_BINARY );
+#endif
+
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)==-1){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
@@ -70,11 +73,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/seeking_test_c.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/seeking_test_c.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/seeking_test_c.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -28,14 +28,17 @@
 #include <stdio.h>
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"
-#include "../lib/misc.h"
 
 int main(){
   OggVorbis_File ov;
   int i;
 
+#ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
+  _setmode( _fileno( stdin ), _O_BINARY );
+#endif
+
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)==-1){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
@@ -70,11 +73,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/seekingexample.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/seekingexample.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/seekingexample.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -80,23 +80,22 @@
 
 #ifdef _WIN32
   _setmode( _fileno( stdin ), _O_BINARY );
-  _setmode( _fileno( stdout ), _O_BINARY );
 #endif
 </b></pre>
         </td>
 </tr>
 </table>
 
-<p><a href="ov_open.html">ov_open()</a> must be
+<p><a href="ov_open_callbacks.html">ov_open_callbacks()</a> must be
 called to initialize the <b>OggVorbis_File</b> structure with default values.  
-<a href="ov_open.html">ov_open()</a> also checks to ensure that we're reading Vorbis format and not something else.
+<a href="ov_open_callbacks.html">ov_open_callbacks()</a> also checks to ensure that we're reading Vorbis format and not something else.
 
 <br><br>
 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
 <tr bgcolor=#cccccc>
         <td>
 <pre><b>
-  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+  if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
       fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
       exit(1);
   }

Modified: branches/vorbis-aotuv/doc/vorbisfile/threads.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/threads.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/threads.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -37,11 +37,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/vorbis_comment.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/vorbis_comment.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/vorbis_comment.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -57,11 +57,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/vorbis_info.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/vorbis_info.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/vorbis_info.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -67,11 +67,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/vorbisfile/vorbisfile_example_c.html
===================================================================
--- branches/vorbis-aotuv/doc/vorbisfile/vorbisfile_example_c.html	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/vorbisfile/vorbisfile_example_c.html	2008-04-01 10:47:58 UTC (rev 14647)
@@ -9,7 +9,7 @@
 <table border=0 width=100%>
 <tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 
@@ -46,7 +46,7 @@
   _setmode( _fileno( stdout ), _O_BINARY );
 #endif
 
-  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+  if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
       fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
       exit(1);
   }
@@ -93,11 +93,11 @@
 <hr noshade>
 <table border=0 width=100%>
 <tr valign=top>
-<td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
+<td><p class=tiny>copyright &copy; 2007 Xiph.org</p></td>
 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team at vorbis.org">team at vorbis.org</a></p></td>
 </tr><tr>
 <td><p class=tiny>Vorbisfile documentation</p></td>
-<td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.2.0 - 20070723</p></td>
 </tr>
 </table>
 

Modified: branches/vorbis-aotuv/doc/xml/05-comment.xml
===================================================================
--- branches/vorbis-aotuv/doc/xml/05-comment.xml	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/xml/05-comment.xml	2008-04-01 10:47:58 UTC (rev 14647)
@@ -189,7 +189,7 @@
 <varlistentry><term>ISRC</term>
 <listitem><simpara>International Standard Recording Code for the
 track; see <ulink
-url="http://www.ifpi.org/site-content/online/isrc_intro.html">the ISRC
+url="http://www.ifpi.org/isrc/">the ISRC
 intro page</ulink> for more information on ISRC numbers.
 </simpara></listitem>
 </varlistentry>

Modified: branches/vorbis-aotuv/doc/xml/08-residue.xml
===================================================================
--- branches/vorbis-aotuv/doc/xml/08-residue.xml	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/xml/08-residue.xml	2008-04-01 10:47:58 UTC (rev 14647)
@@ -283,37 +283,61 @@
 'do not decode' vectors are allocated and zeroed.</para>
 
 <para>
+Depending on the values of <varname>[residue_begin]</varname> and
+<varname>[residue_end]</varname>, it is obvious that the encoded
+portion of a residue vector may be the entire possible residue vector
+or some other strict subset of the actual residue vector size with
+zero padding at either uncoded end.  However, it is also possible to
+set <varname>[residue_begin]</varname> and
+<varname>[residue_end]</varname> to specify a range partially or
+wholly beyond the maximum vector size.  Before beginning residue
+decode, limit <varname>[residue_begin]</varname> and
+<varname>[residue_end]</varname> to the maximum possible vector size
+as follows.  We assume that the number of vectors being encoded,
+<varname>[ch]</varname> is provided by the higher level decoding
+process.</para>
+
+<programlisting>
+  1) [actual_size] = current blocksize/2;
+  2) if residue encoding is format 2
+       3) [actual_size] = [actual_size] * [ch];
+  4) [limit_residue_begin] = maximum of ([residue_begin],[actual_size]);
+  5) [limit_residue_end] = maximum of ([residue_end],[actual_size]);
+</programlisting>
+
+<para>
 The following convenience values are conceptually useful to clarifying
 the decode process:</para>
 
 <programlisting>
   1) [classwords_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook]
-  2) [n_to_read] = [residue_end] - [residue_begin]
+  2) [n_to_read] = [limit_residue_end] - [limit_residue_begin]
   3) [partitions_to_read] = [n_to_read] / [residue_partition_size]
 </programlisting>
 
 <para>
-Packet decode proceeds as follows, matching the description offered earlier in the document.  We assume that the number of vectors being encoded, <varname>[ch]</varname> is provided by the higher level decoding process.</para>
+Packet decode proceeds as follows, matching the description offered earlier in the document. </para>
 <programlisting>
   1) allocate and zero all vectors that will be returned.
-  2) iterate [pass] over the range 0 ... 7 {
+  2) if ([n_to_read] is zero), stop; there is no residue to decode.
+  3) iterate [pass] over the range 0 ... 7 {
 
-       3) [partition_count] = 0
+       4) [partition_count] = 0
 
-       4) while [partition_count] is less than [partitions_to_read]
+       5) while [partition_count] is less than [partitions_to_read]
 
-            5) if ([pass] is zero) {
+            6) if ([pass] is zero) {
      
-                 6) iterate [j] over the range 0 .. [ch]-1 {
+                 7) iterate [j] over the range 0 .. [ch]-1 {
 
-                      7) if vector [j] is not marked 'do not decode' {
+                      8) if vector [j] is not marked 'do not decode' {
 
-                           8) [temp] = read from packet using codebook [residue_classbook] in scalar context
-                           9) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
+                           9) [temp] = read from packet using codebook [residue_classbook] in scalar context
+                          10) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
 
-                               10) array [classifications] element [j],([i]+[partition_count]) =
+                               11) array [classifications] element [j],([i]+[partition_count]) =
                                    [temp] integer modulo [residue_classifications]
-                               11) [temp] = [temp] / [residue_classifications] using integer division
+                               12) [temp] = [temp] / [residue_classifications] using integer division
 
                               }
       
@@ -323,30 +347,30 @@
           
                }
 
-           12) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] 
+           13) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] 
                is also less than [partitions_to_read] {
 
-                 13) iterate [j] over the range 0 .. [ch]-1 {
+                 14) iterate [j] over the range 0 .. [ch]-1 {
    
-                      14) if vector [j] is not marked 'do not decode' {
+                      15) if vector [j] is not marked 'do not decode' {
    
-                           15) [vqclass] = array [classifications] element [j],[partition_count]
-                           16) [vqbook] = array [residue_books] element [vqclass],[pass]
-                           17) if ([vqbook] is not 'unused') {
+                           16) [vqclass] = array [classifications] element [j],[partition_count]
+                           17) [vqbook] = array [residue_books] element [vqclass],[pass]
+                           18) if ([vqbook] is not 'unused') {
    
-                                18) decode partition into output vector number [j], starting at scalar 
-                                    offset [residue_begin]+[partition_count]*[residue_partition_size] using 
+                                19) decode partition into output vector number [j], starting at scalar 
+                                    offset [limit_residue_begin]+[partition_count]*[residue_partition_size] using 
                                     codebook number [vqbook] in VQ context
                           }
                      }
    
-                 19) increment [partition_count] by one
+                 20) increment [partition_count] by one
 
                }
           }
      }
  
- 20) done
+ 21) done
 
 </programlisting>
 

Modified: branches/vorbis-aotuv/doc/xml/footer.xml
===================================================================
--- branches/vorbis-aotuv/doc/xml/footer.xml	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/doc/xml/footer.xml	2008-04-01 10:47:58 UTC (rev 14647)
@@ -49,7 +49,7 @@
 <para>
 Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm)
 of the <ulink url="http://www.xiph.org/">Xiph.org Foundation</ulink>.  These
-pages are copyright (C) 1994-2004 Xiph.org Foundation. All rights
+pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
 reserved.</para>
 
 <para>

Modified: branches/vorbis-aotuv/examples/chaining_example.c
===================================================================
--- branches/vorbis-aotuv/examples/chaining_example.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/examples/chaining_example.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.18 2002/10/11 11:14:41 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -28,15 +28,14 @@
   OggVorbis_File ov;
   int i;
 
-#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
+#ifdef _WIN32 /* We need to set stdin to binary mode. Damn windows. */
   /* Beware the evil ifdef. We avoid these where we can, but this one we 
      cannot. Don't add any more, you'll probably go to hell if you do. */
   _setmode( _fileno( stdin ), _O_BINARY );
-  _setmode( _fileno( stdout ), _O_BINARY );
 #endif
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)<0){
+  if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }

Modified: branches/vorbis-aotuv/examples/decoder_example.c
===================================================================
--- branches/vorbis-aotuv/examples/decoder_example.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/examples/decoder_example.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: simple example decoder
- last mod: $Id: decoder_example.c,v 1.27 2002/07/12 15:07:52 giles Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/examples/encoder_example.c
===================================================================
--- branches/vorbis-aotuv/examples/encoder_example.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/examples/encoder_example.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/examples/seeking_example.c
===================================================================
--- branches/vorbis-aotuv/examples/seeking_example.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/examples/seeking_example.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: illustrate seeking, and test it too
- last mod: $Id: seeking_example.c,v 1.15 2002/07/11 06:40:47 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -25,35 +25,41 @@
 # include <fcntl.h>
 #endif
 
-void _verify(OggVorbis_File *ov,ogg_int64_t pos,
-	     ogg_int64_t val,ogg_int64_t pcmval,
+void _verify(OggVorbis_File *ov,
+	     ogg_int64_t val,ogg_int64_t pcmval,double timeval,
 	     ogg_int64_t pcmlength,
 	     char *bigassbuffer){
   int j;
   long bread;
   char buffer[4096];
   int dummy;
+  ogg_int64_t pos;
 
   /* verify the raw position, the pcm position and position decode */
   if(val!=-1 && ov_raw_tell(ov)<val){
-    printf("raw position out of tolerance: requested %ld, got %ld\n",
+    fprintf(stderr,"raw position out of tolerance: requested %ld, got %ld\n",
 	   (long)val,(long)ov_raw_tell(ov));
     exit(1);
   }
   if(pcmval!=-1 && ov_pcm_tell(ov)>pcmval){
-    printf("pcm position out of tolerance: requested %ld, got %ld\n",
+    fprintf(stderr,"pcm position out of tolerance: requested %ld, got %ld\n",
 	   (long)pcmval,(long)ov_pcm_tell(ov));
     exit(1);
   }
+  if(timeval!=-1 && ov_time_tell(ov)>timeval){
+    fprintf(stderr,"time position out of tolerance: requested %f, got %f\n",
+	   timeval,ov_time_tell(ov));
+    exit(1);
+  }
   pos=ov_pcm_tell(ov);
   if(pos<0 || pos>pcmlength){
-    printf("pcm position out of bounds: got %ld\n",(long)pos);
+    fprintf(stderr,"pcm position out of bounds: got %ld\n",(long)pos);
     exit(1);
   }
   bread=ov_read(ov,buffer,4096,1,1,1,&dummy);
   for(j=0;j<bread;j++){
     if(buffer[j]!=bigassbuffer[j+pos*2]){
-      printf("data position after seek doesn't match pcm position\n");
+      fprintf(stderr,"data position after seek doesn't match pcm position\n");
 
       {
 	FILE *f=fopen("a.m","w");
@@ -73,18 +79,18 @@
   OggVorbis_File ov;
   int i,ret;
   ogg_int64_t pcmlength;
+  double timelength;
   char *bigassbuffer;
   int dummy;
 
 #ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
   _setmode( _fileno( stdin ), _O_BINARY );
-  _setmode( _fileno( stdout ), _O_BINARY );
 #endif
 
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)<0){
-    printf("Could not open input as an OggVorbis file.\n\n");
+  if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
+    fprintf(stderr,"Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
 
@@ -96,7 +102,7 @@
     for(i=0;i<ov.links;i++){
       vorbis_info *vi=ov_info(&ov,i);
       if(vi->channels!=2){
-	printf("Sorry; right now seeking_test can only use Vorbis files\n"
+	fprintf(stderr,"Sorry; right now seeking_test can only use Vorbis files\n"
 	       "that are entirely stereo.\n\n");
 	exit(1);
       }
@@ -104,8 +110,8 @@
     
     /* because we want to do sample-level verification that the seek
        does what it claimed, decode the entire file into memory */
-    fflush(stdout);
     pcmlength=ov_pcm_total(&ov,-1);
+    timelength=ov_time_total(&ov,-1);
     bigassbuffer=malloc(pcmlength*2); /* w00t */
     i=0;
     while(i<pcmlength*2){
@@ -120,83 +126,116 @@
 	      (long)(pcmlength*2-i));
     }
     
-    /* Exercise all the real seeking cases; ov_raw_seek,
-       ov_pcm_seek_page and ov_pcm_seek.  time seek is just a wrapper
-       on pcm_seek */
     {
       ogg_int64_t length=ov.end;
-      printf("\rtesting raw seeking to random places in %ld bytes....\n",
+      fprintf(stderr,"\rtesting raw seeking to random places in %ld bytes....\n",
 	     (long)length);
     
       for(i=0;i<1000;i++){
 	ogg_int64_t val=(double)rand()/RAND_MAX*length;
-	ogg_int64_t pos;
-	printf("\r\t%d [raw position %ld]...     ",i,(long)val);
-	fflush(stdout);
+	fprintf(stderr,"\r\t%d [raw position %ld]...     ",i,(long)val);
 	ret=ov_raw_seek(&ov,val);
 	if(ret<0){
-	  printf("seek failed: %d\n",ret);
+	  fprintf(stderr,"seek failed: %d\n",ret);
 	  exit(1);
 	}
 
-	_verify(&ov,pos,val,-1,pcmlength,bigassbuffer);
+	_verify(&ov,val,-1,-1.,pcmlength,bigassbuffer);
 
       }
     }
 
-    printf("\r");
+    fprintf(stderr,"\r");
     {
-      printf("testing pcm page seeking to random places in %ld samples....\n",
+      fprintf(stderr,"testing pcm page seeking to random places in %ld samples....\n",
 	     (long)pcmlength);
     
       for(i=0;i<1000;i++){
 	ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
-	ogg_int64_t pos;
-	printf("\r\t%d [pcm position %ld]...     ",i,(long)val);
-	fflush(stdout);
+	fprintf(stderr,"\r\t%d [pcm position %ld]...     ",i,(long)val);
 	ret=ov_pcm_seek_page(&ov,val);
 	if(ret<0){
-	  printf("seek failed: %d\n",ret);
+	  fprintf(stderr,"seek failed: %d\n",ret);
 	  exit(1);
 	}
 
-	_verify(&ov,pos,-1,val,pcmlength,bigassbuffer);
+	_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
 
       }
     }
     
-    printf("\r");
+    fprintf(stderr,"\r");
     {
-      ogg_int64_t length=ov.end;
-      printf("testing pcm exact seeking to random places in %ld samples....\n",
+      fprintf(stderr,"testing pcm exact seeking to random places in %ld samples....\n",
 	     (long)pcmlength);
     
       for(i=0;i<1000;i++){
 	ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
-	ogg_int64_t pos;
-	printf("\r\t%d [pcm position %ld]...     ",i,(long)val);
-	fflush(stdout);
+	fprintf(stderr,"\r\t%d [pcm position %ld]...     ",i,(long)val);
 	ret=ov_pcm_seek(&ov,val);
 	if(ret<0){
-	  printf("seek failed: %d\n",ret);
+	  fprintf(stderr,"seek failed: %d\n",ret);
 	  exit(1);
 	}
 	if(ov_pcm_tell(&ov)!=val){
-	  printf("Declared position didn't perfectly match request: %ld != %ld\n",
+	  fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
 		 (long)val,(long)ov_pcm_tell(&ov));
 	  exit(1);
 	}
 
-	_verify(&ov,pos,-1,val,pcmlength,bigassbuffer);
+	_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
 
       }
     }
+
+    fprintf(stderr,"\r");
+    {
+      fprintf(stderr,"testing time page seeking to random places in %f seconds....\n",
+	     timelength);
     
-    printf("\r                                           \nOK.\n\n");
+      for(i=0;i<1000;i++){
+	double val=(double)rand()/RAND_MAX*timelength;
+	fprintf(stderr,"\r\t%d [time position %f]...     ",i,val);
+	ret=ov_time_seek_page(&ov,val);
+	if(ret<0){
+	  fprintf(stderr,"seek failed: %d\n",ret);
+	  exit(1);
+	}
 
+	_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
 
+      }
+    }
+
+    fprintf(stderr,"\r");
+    {
+      fprintf(stderr,"testing time exact seeking to random places in %f seconds....\n",
+	     timelength);
+    
+      for(i=0;i<1000;i++){
+	double val=(double)rand()/RAND_MAX*timelength;
+	fprintf(stderr,"\r\t%d [time position %f]...     ",i,val);
+	ret=ov_time_seek(&ov,val);
+	if(ret<0){
+	  fprintf(stderr,"seek failed: %d\n",ret);
+	  exit(1);
+	}
+	if(ov_time_tell(&ov)<val-1 || ov_time_tell(&ov)>val+1){
+	  fprintf(stderr,"Declared position didn't perfectly match request: %f != %f\n",
+		 val,ov_time_tell(&ov));
+	  exit(1);
+	}
+
+	_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
+
+      }
+    }
+    
+    fprintf(stderr,"\r                                           \nOK.\n\n");
+
+
   }else{
-    printf("Standard input was not seekable.\n");
+    fprintf(stderr,"Standard input was not seekable.\n");
   }
 
   ov_clear(&ov);

Modified: branches/vorbis-aotuv/examples/vorbisfile_example.c
===================================================================
--- branches/vorbis-aotuv/examples/vorbisfile_example.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/examples/vorbisfile_example.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: simple example decoder using vorbisfile
- last mod: $Id: vorbisfile_example.c,v 1.10 2002/07/11 06:40:47 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -44,7 +44,7 @@
   _setmode( _fileno( stdout ), _O_BINARY );
 #endif
 
-  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+  if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
       fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
       exit(1);
   }

Modified: branches/vorbis-aotuv/include/vorbis/Makefile.am
===================================================================
--- branches/vorbis-aotuv/include/vorbis/Makefile.am	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/include/vorbis/Makefile.am	2008-04-01 10:47:58 UTC (rev 14647)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
-includedir = $(prefix)/include/vorbis
+vorbisincludedir = $(includedir)/vorbis
 
-include_HEADERS = codec.h vorbisfile.h vorbisenc.h
+vorbisinclude_HEADERS = codec.h vorbisfile.h vorbisenc.h
 
 

Modified: branches/vorbis-aotuv/include/vorbis/codec.h
===================================================================
--- branches/vorbis-aotuv/include/vorbis/codec.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/include/vorbis/codec.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,7 +6,7 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
 
  ********************************************************************
 
@@ -198,6 +198,7 @@
 					   ogg_packet *op);
 
 /* Vorbis PRIMITIVES: synthesis layer *******************************/
+extern int      vorbis_synthesis_idheader(ogg_packet *op);
 extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
 					  ogg_packet *op);
 

Modified: branches/vorbis-aotuv/include/vorbis/vorbisenc.h
===================================================================
--- branches/vorbis-aotuv/include/vorbis/vorbisenc.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/include/vorbis/vorbisenc.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,7 +6,7 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/include/vorbis/vorbisfile.h
===================================================================
--- branches/vorbis-aotuv/include/vorbis/vorbisfile.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/include/vorbis/vorbisfile.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -43,6 +43,44 @@
   long   (*tell_func)  (void *datasource);
 } ov_callbacks;
 
+/* a few sets of convenient callbacks, especially for use under
+ * Windows where ov_open_callbacks() should always be used instead of
+ * ov_open() to avoid problems with incompatable crt.o version linking
+ * issues. */
+
+static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
+  if(f==NULL)return(-1);
+  return fseek(f,off,whence);
+}
+
+static ov_callbacks OV_CALLBACKS_DEFAULT = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
+  (int (*)(void *))                             fclose,
+  (long (*)(void *))                            ftell
+};
+
+static ov_callbacks OV_CALLBACKS_NOCLOSE = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
+  (int (*)(void *))                             NULL,
+  (long (*)(void *))                            ftell
+};
+
+static ov_callbacks OV_CALLBACKS_STREAMONLY = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           NULL,
+  (int (*)(void *))                             fclose,
+  (long (*)(void *))                            NULL
+};
+
+static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           NULL,
+  (int (*)(void *))                             NULL,
+  (long (*)(void *))                            NULL
+};
+
 #define  NOTOPEN   0
 #define  PARTOPEN  1
 #define  OPENED    2
@@ -86,7 +124,9 @@
 
 } OggVorbis_File;
 
+
 extern int ov_clear(OggVorbis_File *vf);
+extern int ov_fopen(char *path,OggVorbis_File *vf);
 extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
 		char *initial, long ibytes, ov_callbacks callbacks);

Modified: branches/vorbis-aotuv/lib/Makefile.am
===================================================================
--- branches/vorbis-aotuv/lib/Makefile.am	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/Makefile.am	2008-04-01 10:47:58 UTC (rev 14647)
@@ -14,7 +14,8 @@
 			envelope.h lpc.h lsp.h codebook.h misc.h psy.h\
 			masking.h os.h mdct.h smallft.h highlevel.h\
 			registry.h scales.h window.h lookup.h lookup_data.h\
-			codec_internal.h backends.h bitrate.h 
+			codec_internal.h backends.h bitrate.h\
+			psy_table.h 
 libvorbis_la_LDFLAGS = -no-undefined -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
 libvorbis_la_LIBADD = @OGG_LIBS@ @VORBIS_LIBS@
 

Modified: branches/vorbis-aotuv/lib/analysis.c
===================================================================
--- branches/vorbis-aotuv/lib/analysis.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/analysis.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/backends.h
===================================================================
--- branches/vorbis-aotuv/lib/backends.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/backends.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/barkmel.c
===================================================================
--- branches/vorbis-aotuv/lib/barkmel.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/barkmel.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: bark scale utility
- last mod: $Id: barkmel.c,v 1.12 2002/07/11 06:40:48 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/bitrate.c
===================================================================
--- branches/vorbis-aotuv/lib/bitrate.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/bitrate.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/bitrate.h
===================================================================
--- branches/vorbis-aotuv/lib/bitrate.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/bitrate.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/block.c
===================================================================
--- branches/vorbis-aotuv/lib/block.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/block.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2003             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -287,10 +287,11 @@
   b=v->backend_state;
   b->psy_g_look=_vp_global_look(vi);
 
-  /* added by aoyumi */
-  b->nblock = _ogg_calloc((128*vi->channels), sizeof(*b->nblock));
-  b->tblock = _ogg_calloc((128*vi->channels), sizeof(*b->tblock));
+  /* Init (added by aoyumi) */
+  b->nblock = _ogg_calloc((256*vi->channels), sizeof(*b->nblock));
+  b->tblock = _ogg_calloc((256*vi->channels), sizeof(*b->tblock));
   b->lownoise_compand_level = _ogg_calloc(vi->channels, sizeof(*b->lownoise_compand_level));
+  b->padnum = 0;
   
   /* Initialize the envelope state storage */
   b->ve=_ogg_calloc(1,sizeof(*b->ve));
@@ -331,20 +332,23 @@
       }
 
       if(b->flr){
-	for(i=0;i<ci->floors;i++)
-	  _floor_P[ci->floor_type[i]]->
-	    free_look(b->flr[i]);
+	if(ci)
+	  for(i=0;i<ci->floors;i++)
+	    _floor_P[ci->floor_type[i]]->
+	      free_look(b->flr[i]);
 	_ogg_free(b->flr);
       }
       if(b->residue){
-	for(i=0;i<ci->residues;i++)
-	  _residue_P[ci->residue_type[i]]->
-	    free_look(b->residue[i]);
+	if(ci)
+	  for(i=0;i<ci->residues;i++)
+	    _residue_P[ci->residue_type[i]]->
+	      free_look(b->residue[i]);
 	_ogg_free(b->residue);
       }
       if(b->psy){
-	for(i=0;i<ci->psys;i++)
-	  _vp_psy_clear(b->psy+i);
+	if(ci)
+	  for(i=0;i<ci->psys;i++)
+	    _vp_psy_clear(b->psy+i);
 	_ogg_free(b->psy);
       }
 
@@ -362,8 +366,9 @@
     }
     
     if(v->pcm){
-      for(i=0;i<vi->channels;i++)
-	if(v->pcm[i])_ogg_free(v->pcm[i]);
+      if(vi)
+	for(i=0;i<vi->channels;i++)
+	  if(v->pcm[i])_ogg_free(v->pcm[i]);
       _ogg_free(v->pcm);
       if(v->pcmret)_ogg_free(v->pcmret);
     }
@@ -409,7 +414,7 @@
 
 static void _preextrapolate_helper(vorbis_dsp_state *v){
   int i;
-  int order=32;
+  int order=16;
   float *lpc=alloca(order*sizeof(*lpc));
   float *work=alloca(v->pcm_current*sizeof(*work));
   long j;
@@ -424,6 +429,17 @@
       /* prime as above */
       vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
       
+#if 0
+      if(v->vi->channels==2){
+	if(i==0)
+	  _analysis_output("predataL",0,work,v->pcm_current-v->centerW,0,0,0);
+	else
+	  _analysis_output("predataR",0,work,v->pcm_current-v->centerW,0,0,0);
+      }else{
+	_analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0);
+      }
+#endif 
+
       /* run the predictor filter */
       vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
 			 order,

Modified: branches/vorbis-aotuv/lib/books/coupled/res_books_stereo.h
===================================================================
--- branches/vorbis-aotuv/lib/books/coupled/res_books_stereo.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/books/coupled/res_books_stereo.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -462,83 +462,6 @@
 	0
 };
 
-static long _vq_quantlist__16c0_s_p2_0[] = {
-	2,
-	1,
-	3,
-	0,
-	4,
-};
-
-static long _vq_lengthlist__16c0_s_p2_0[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0,
-};
-
-static float _vq_quantthresh__16c0_s_p2_0[] = {
-	-1.5, -0.5, 0.5, 1.5, 
-};
-
-static long _vq_quantmap__16c0_s_p2_0[] = {
-	    3,    1,    0,    2,    4,
-};
-
-static encode_aux_threshmatch _vq_auxt__16c0_s_p2_0 = {
-	_vq_quantthresh__16c0_s_p2_0,
-	_vq_quantmap__16c0_s_p2_0,
-	5,
-	5
-};
-
-static static_codebook _16c0_s_p2_0 = {
-	4, 625,
-	_vq_lengthlist__16c0_s_p2_0,
-	1, -533725184, 1611661312, 3, 0,
-	_vq_quantlist__16c0_s_p2_0,
-	NULL,
-	&_vq_auxt__16c0_s_p2_0,
-	NULL,
-	0
-};
-
 static long _vq_quantlist__16c0_s_p3_0[] = {
 	2,
 	1,
@@ -1652,83 +1575,6 @@
 	0
 };
 
-static long _vq_quantlist__16c1_s_p2_0[] = {
-	2,
-	1,
-	3,
-	0,
-	4,
-};
-
-static long _vq_lengthlist__16c1_s_p2_0[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0,
-};
-
-static float _vq_quantthresh__16c1_s_p2_0[] = {
-	-1.5, -0.5, 0.5, 1.5, 
-};
-
-static long _vq_quantmap__16c1_s_p2_0[] = {
-	    3,    1,    0,    2,    4,
-};
-
-static encode_aux_threshmatch _vq_auxt__16c1_s_p2_0 = {
-	_vq_quantthresh__16c1_s_p2_0,
-	_vq_quantmap__16c1_s_p2_0,
-	5,
-	5
-};
-
-static static_codebook _16c1_s_p2_0 = {
-	4, 625,
-	_vq_lengthlist__16c1_s_p2_0,
-	1, -533725184, 1611661312, 3, 0,
-	_vq_quantlist__16c1_s_p2_0,
-	NULL,
-	&_vq_auxt__16c1_s_p2_0,
-	NULL,
-	0
-};
-
 static long _vq_quantlist__16c1_s_p3_0[] = {
 	2,
 	1,
@@ -3764,83 +3610,6 @@
 	0
 };
 
-static long _vq_quantlist__8c0_s_p2_0[] = {
-	2,
-	1,
-	3,
-	0,
-	4,
-};
-
-static long _vq_lengthlist__8c0_s_p2_0[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0,
-};
-
-static float _vq_quantthresh__8c0_s_p2_0[] = {
-	-1.5, -0.5, 0.5, 1.5, 
-};
-
-static long _vq_quantmap__8c0_s_p2_0[] = {
-	    3,    1,    0,    2,    4,
-};
-
-static encode_aux_threshmatch _vq_auxt__8c0_s_p2_0 = {
-	_vq_quantthresh__8c0_s_p2_0,
-	_vq_quantmap__8c0_s_p2_0,
-	5,
-	5
-};
-
-static static_codebook _8c0_s_p2_0 = {
-	4, 625,
-	_vq_lengthlist__8c0_s_p2_0,
-	1, -533725184, 1611661312, 3, 0,
-	_vq_quantlist__8c0_s_p2_0,
-	NULL,
-	&_vq_auxt__8c0_s_p2_0,
-	NULL,
-	0
-};
-
 static long _vq_quantlist__8c0_s_p3_0[] = {
 	2,
 	1,
@@ -4933,83 +4702,6 @@
 	0
 };
 
-static long _vq_quantlist__8c1_s_p2_0[] = {
-	2,
-	1,
-	3,
-	0,
-	4,
-};
-
-static long _vq_lengthlist__8c1_s_p2_0[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0,
-};
-
-static float _vq_quantthresh__8c1_s_p2_0[] = {
-	-1.5, -0.5, 0.5, 1.5, 
-};
-
-static long _vq_quantmap__8c1_s_p2_0[] = {
-	    3,    1,    0,    2,    4,
-};
-
-static encode_aux_threshmatch _vq_auxt__8c1_s_p2_0 = {
-	_vq_quantthresh__8c1_s_p2_0,
-	_vq_quantmap__8c1_s_p2_0,
-	5,
-	5
-};
-
-static static_codebook _8c1_s_p2_0 = {
-	4, 625,
-	_vq_lengthlist__8c1_s_p2_0,
-	1, -533725184, 1611661312, 3, 0,
-	_vq_quantlist__8c1_s_p2_0,
-	NULL,
-	&_vq_auxt__8c1_s_p2_0,
-	NULL,
-	0
-};
-
 static long _vq_quantlist__8c1_s_p3_0[] = {
 	2,
 	1,

Modified: branches/vorbis-aotuv/lib/books/floor/floor_books.h
===================================================================
--- branches/vorbis-aotuv/lib/books/floor/floor_books.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/books/floor/floor_books.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************

Modified: branches/vorbis-aotuv/lib/books/uncoupled/res_books_uncoupled.h
===================================================================
--- branches/vorbis-aotuv/lib/books/uncoupled/res_books_uncoupled.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/books/uncoupled/res_books_uncoupled.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************

Modified: branches/vorbis-aotuv/lib/codebook.c
===================================================================
--- branches/vorbis-aotuv/lib/codebook.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/codebook.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.39 2002/06/28 22:19:35 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -255,6 +255,7 @@
 
 /* returns the number of bits ************************************************/
 int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){
+  if(a<0 || a>=book->c->entries)return(0);
   oggpack_write(b,book->codelist[a],book->c->lengthlist[a]);
   return(book->c->lengthlist[a]);
 }
@@ -310,7 +311,7 @@
   int  read=book->dec_maxlength;
   long lo,hi;
   long lok = oggpack_look(b,book->dec_firsttablen);
- 
+  
   if (lok >= 0) {
     long entry = book->dec_firsttable[lok];
     if(entry&0x80000000UL){
@@ -324,24 +325,24 @@
     lo=0;
     hi=book->used_entries;
   }
-
+  
   lok = oggpack_look(b, read);
-
+  
   while(lok<0 && read>1)
     lok = oggpack_look(b, --read);
   if(lok<0)return -1;
-
+  
   /* bisect search for the codeword in the ordered list */
   {
     ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
-
+    
     while(hi-lo>1){
       long p=(hi-lo)>>1;
       long test=book->codelist[lo+p]>testword;    
       lo+=p&(test-1);
       hi-=p&(-test);
-    }
-
+      }
+    
     if(book->dec_codelengths[lo]<=read){
       oggpack_adv(b, book->dec_codelengths[lo]);
       return(lo);
@@ -349,6 +350,7 @@
   }
   
   oggpack_adv(b, read);
+
   return(-1);
 }
 
@@ -368,104 +370,121 @@
 
 /* returns the [original, not compacted] entry number or -1 on eof *********/
 long vorbis_book_decode(codebook *book, oggpack_buffer *b){
-  long packed_entry=decode_packed_entry_number(book,b);
-  if(packed_entry>=0)
-    return(book->dec_index[packed_entry]);
-  
+  if(book->used_entries>0){
+    long packed_entry=decode_packed_entry_number(book,b);
+    if(packed_entry>=0)
+      return(book->dec_index[packed_entry]);
+  }
+
   /* if there's no dec_index, the codebook unpacking isn't collapsed */
-  return(packed_entry);
+  return(-1);
 }
 
 /* returns 0 on OK or -1 on eof *************************************/
 long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
-  int step=n/book->dim;
-  long *entry = alloca(sizeof(*entry)*step);
-  float **t = alloca(sizeof(*t)*step);
-  int i,j,o;
-
-  for (i = 0; i < step; i++) {
-    entry[i]=decode_packed_entry_number(book,b);
-    if(entry[i]==-1)return(-1);
-    t[i] = book->valuelist+entry[i]*book->dim;
+  if(book->used_entries>0){
+    int step=n/book->dim;
+    long *entry = alloca(sizeof(*entry)*step);
+    float **t = alloca(sizeof(*t)*step);
+    int i,j,o;
+    
+    for (i = 0; i < step; i++) {
+      entry[i]=decode_packed_entry_number(book,b);
+      if(entry[i]==-1)return(-1);
+      t[i] = book->valuelist+entry[i]*book->dim;
+    }
+    for(i=0,o=0;i<book->dim;i++,o+=step)
+      for (j=0;j<step;j++)
+	a[o+j]+=t[j][i];
   }
-  for(i=0,o=0;i<book->dim;i++,o+=step)
-    for (j=0;j<step;j++)
-      a[o+j]+=t[j][i];
   return(0);
 }
 
 long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
-  int i,j,entry;
-  float *t;
+  if(book->used_entries>0){
+    int i,j,entry;
+    float *t;
+    
+    if(book->dim>8){
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;)
+	  a[i++]+=t[j++];
+      }
+    }else{
+      for(i=0;i<n;){
+	entry = decode_packed_entry_number(book,b);
+	if(entry==-1)return(-1);
+	t     = book->valuelist+entry*book->dim;
+	j=0;
+	switch((int)book->dim){
+	case 8:
+	  a[i++]+=t[j++];
+	case 7:
+	  a[i++]+=t[j++];
+	case 6:
+	  a[i++]+=t[j++];
+	case 5:
+	  a[i++]+=t[j++];
+	case 4:
+	  a[i++]+=t[j++];
+	case 3:
+	  a[i++]+=t[j++];
+	case 2:
+	  a[i++]+=t[j++];
+	case 1:
+	  a[i++]+=t[j++];
+	case 0:
+	  break;
+	}
+      }
+    }    
+  }
+  return(0);
+}
 
-  if(book->dim>8){
+long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
+  if(book->used_entries>0){
+    int i,j,entry;
+    float *t;
+    
     for(i=0;i<n;){
       entry = decode_packed_entry_number(book,b);
       if(entry==-1)return(-1);
       t     = book->valuelist+entry*book->dim;
       for (j=0;j<book->dim;)
-	a[i++]+=t[j++];
+	a[i++]=t[j++];
     }
   }else{
+    int i,j;
+    
     for(i=0;i<n;){
-      entry = decode_packed_entry_number(book,b);
-      if(entry==-1)return(-1);
-      t     = book->valuelist+entry*book->dim;
-      j=0;
-      switch((int)book->dim){
-      case 8:
-	a[i++]+=t[j++];
-      case 7:
-	a[i++]+=t[j++];
-      case 6:
-	a[i++]+=t[j++];
-      case 5:
-	a[i++]+=t[j++];
-      case 4:
-	a[i++]+=t[j++];
-      case 3:
-	a[i++]+=t[j++];
-      case 2:
-	a[i++]+=t[j++];
-      case 1:
-	a[i++]+=t[j++];
-      case 0:
-	break;
-      }
+      for (j=0;j<book->dim;)
+	a[i++]=0.f;
     }
-  }    
-  return(0);
-}
-
-long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
-  int i,j,entry;
-  float *t;
-
-  for(i=0;i<n;){
-    entry = decode_packed_entry_number(book,b);
-    if(entry==-1)return(-1);
-    t     = book->valuelist+entry*book->dim;
-    for (j=0;j<book->dim;)
-      a[i++]=t[j++];
   }
   return(0);
 }
 
 long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
 			      oggpack_buffer *b,int n){
+
   long i,j,entry;
   int chptr=0;
-
-  for(i=offset/ch;i<(offset+n)/ch;){
-    entry = decode_packed_entry_number(book,b);
-    if(entry==-1)return(-1);
-    {
-      const float *t = book->valuelist+entry*book->dim;
-      for (j=0;j<book->dim;j++){
-	a[chptr++][i]+=t[j];
-	if(chptr==ch){
-	  chptr=0;
-	  i++;
+  if(book->used_entries>0){
+    for(i=offset/ch;i<(offset+n)/ch;){
+      entry = decode_packed_entry_number(book,b);
+      if(entry==-1)return(-1);
+      {
+	const float *t = book->valuelist+entry*book->dim;
+	for (j=0;j<book->dim;j++){
+	  a[chptr++][i]+=t[j];
+	  if(chptr==ch){
+	    chptr=0;
+	    i++;
+	  }
 	}
       }
     }

Modified: branches/vorbis-aotuv/lib/codebook.h
===================================================================
--- branches/vorbis-aotuv/lib/codebook.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/codebook.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: codebook.h,v 1.13 2002/06/28 22:19:35 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/codec_internal.h
===================================================================
--- branches/vorbis-aotuv/lib/codec_internal.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/codec_internal.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -91,6 +91,7 @@
   int lW_blocktype; /* last window block type */
   int lW_modenumber; /* last window mode number (0=short, 1=long) */
   int lW_no; /* the number of continuous window blocks (last window) */
+  int padnum; /* padding block number (impulse-padding-impulse case) for M3 */
 } private_state;
 
 /* codec_setup_info contains all the setup information specific to the

Modified: branches/vorbis-aotuv/lib/envelope.c
===================================================================
--- branches/vorbis-aotuv/lib/envelope.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/envelope.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/envelope.h
===================================================================
--- branches/vorbis-aotuv/lib/envelope.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/envelope.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.h,v 1.25 2002/07/11 06:40:48 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/floor0.c
===================================================================
--- branches/vorbis-aotuv/lib/floor0.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/floor0.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.55 2003/09/05 23:17:49 giles Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/floor1.c
===================================================================
--- branches/vorbis-aotuv/lib/floor1.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/floor1.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -358,7 +358,7 @@
   0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
 };
 
-static void render_line(int x0,int x1,int y0,int y1,float *d){
+static void render_line(int n, int x0,int x1,int y0,int y1,float *d){
   int dy=y1-y0;
   int adx=x1-x0;
   int ady=abs(dy);
@@ -370,8 +370,12 @@
 
   ady-=abs(base*adx);
 
-  d[x]*=FLOOR1_fromdB_LOOKUP[y];
-  while(++x<x1){
+  if(n>x1)n=x1;
+
+  if(x<n)
+    d[x]*=FLOOR1_fromdB_LOOKUP[y];
+
+  while(++x<n){
     err=err+ady;
     if(err>=adx){
       err-=adx;
@@ -1068,7 +1072,7 @@
 	hy*=info->mult;
 	hx=info->postlist[current];
 	
-	render_line(lx,hx,ly,hy,out);
+	render_line(n,lx,hx,ly,hy,out);
 	
 	lx=hx;
 	ly=hy;

Modified: branches/vorbis-aotuv/lib/highlevel.h
===================================================================
--- branches/vorbis-aotuv/lib/highlevel.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/highlevel.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/info.c
===================================================================
--- branches/vorbis-aotuv/lib/info.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/info.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2003             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -135,11 +135,11 @@
     if(vc->user_comments)_ogg_free(vc->user_comments);
 	if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
     if(vc->vendor)_ogg_free(vc->vendor);
+    memset(vc,0,sizeof(*vc));
   }
-  memset(vc,0,sizeof(*vc));
 }
 
-/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
+/* blocksize 0 is guaranteed to be short, 1 is guaranteed to be long.
    They may be equal, but short will never ge greater than long */
 int vorbis_info_blocksize(vorbis_info *vi,int zo){
   codec_setup_info *ci = vi->codec_setup;
@@ -162,14 +162,23 @@
       if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
 
     for(i=0;i<ci->maps;i++) /* unpack does the range checking */
-      _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
+      if(ci->map_param[i]) /* this may be cleaning up an aborted
+			      unpack, in which case the below type
+			      cannot be trusted */
+	_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
 
     for(i=0;i<ci->floors;i++) /* unpack does the range checking */
-      _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
+      if(ci->floor_param[i]) /* this may be cleaning up an aborted
+				unpack, in which case the below type
+				cannot be trusted */
+	_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
     
     for(i=0;i<ci->residues;i++) /* unpack does the range checking */
-      _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
-
+      if(ci->residue_param[i]) /* this may be cleaning up an aborted
+				  unpack, in which case the below type
+				  cannot be trusted */
+	_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
+    
     for(i=0;i<ci->books;i++){
       if(ci->book_param[i]){
 	/* knows if the book was not alloced */
@@ -211,9 +220,10 @@
   
   if(vi->rate<1)goto err_out;
   if(vi->channels<1)goto err_out;
-  if(ci->blocksizes[0]<8)goto err_out; 
+  if(ci->blocksizes[0]<64)goto err_out; 
   if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
-  
+  if(ci->blocksizes[1]>8192)goto err_out;
+
   if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
 
   return(0);
@@ -328,6 +338,31 @@
   return(OV_EBADHEADER);
 }
 
+/* Is this packet a vorbis ID header? */
+int vorbis_synthesis_idheader(ogg_packet *op){
+  oggpack_buffer opb;
+  char buffer[6];
+
+  if(op){
+    oggpack_readinit(&opb,op->packet,op->bytes);
+
+    if(!op->b_o_s)
+      return(0); /* Not the initial packet */
+
+    if(oggpack_read(&opb,8) != 1)
+      return 0; /* not an ID header */
+
+    memset(buffer,0,6);
+    _v_readstring(&opb,buffer,6);
+    if(memcmp(buffer,"vorbis",6))
+      return 0; /* not vorbis */
+
+    return 1;
+  }
+
+  return 0;
+}
+
 /* The Vorbis header is in three packets; the initial small packet in
    the first page that identifies basic parameters, a second packet
    with bitstream comments and a third packet that holds the
@@ -416,7 +451,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="AO; aoTuV b5 [20061024] (based on Xiph.Org's libVorbis)";
+  char temp[]="AO; aoTuV b5a [20080330] (based on Xiph.Org's libVorbis)";
   int bytes = strlen(temp);
 
   /* preamble */  
@@ -591,12 +626,14 @@
   memset(op_comm,0,sizeof(*op_comm));
   memset(op_code,0,sizeof(*op_code));
 
-  if(b->header)_ogg_free(b->header);
-  if(b->header1)_ogg_free(b->header1);
-  if(b->header2)_ogg_free(b->header2);
-  b->header=NULL;
-  b->header1=NULL;
-  b->header2=NULL;
+  if(b){
+    if(b->header)_ogg_free(b->header);
+    if(b->header1)_ogg_free(b->header1);
+    if(b->header2)_ogg_free(b->header2);
+    b->header=NULL;
+    b->header1=NULL;
+    b->header2=NULL;
+  }
   return(ret);
 }
 

Modified: branches/vorbis-aotuv/lib/lookup.c
===================================================================
--- branches/vorbis-aotuv/lib/lookup.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lookup.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.c,v 1.9 2002/01/22 08:06:07 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/lookup.h
===================================================================
--- branches/vorbis-aotuv/lib/lookup.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lookup.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.h,v 1.7 2002/07/11 06:40:49 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/lookup_data.h
===================================================================
--- branches/vorbis-aotuv/lib/lookup_data.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lookup_data.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup data; generated by lookups.pl; edit there
-  last mod: $Id: lookup_data.h,v 1.10 2003/01/18 08:09:28 msmith Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/lookups.pl
===================================================================
--- branches/vorbis-aotuv/lib/lookups.pl	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lookups.pl	2008-04-01 10:47:58 UTC (rev 14647)
@@ -7,13 +7,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup data; generated by lookups.pl; edit there
-  last mod: $Id: lookups.pl,v 1.7 2002/07/11 06:40:49 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/lpc.c
===================================================================
--- branches/vorbis-aotuv/lib/lpc.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lpc.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.c,v 1.37 2003/03/08 07:15:32 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 
@@ -62,6 +62,7 @@
   double *aut=alloca(sizeof(*aut)*(m+1));
   double *lpc=alloca(sizeof(*lpc)*(m));
   double error;
+  double epsilon;
   int i,j;
 
   /* autocorrelation, p+1 lag coefficients */
@@ -74,14 +75,16 @@
   
   /* Generate lpc coefficients from autocorr values */
 
-  error=aut[0];
-  
+  /* set our noise floor to about -100dB */
+  error=aut[0] * (1. + 1e-10);
+  epsilon=1e-9*aut[0]+1e-10;
+
   for(i=0;i<m;i++){
     double r= -aut[i+1];
 
-    if(error==0){
-      memset(lpci,0,m*sizeof(*lpci));
-      return 0;
+    if(error<epsilon){
+      memset(lpc+i,0,(m-i)*sizeof(*lpc));
+      goto done;
     }
 
     /* Sum up this iteration's reflection coefficient; note that in
@@ -101,11 +104,24 @@
       lpc[j]+=r*lpc[i-1-j];
       lpc[i-1-j]+=r*tmp;
     }
-    if(i%2)lpc[j]+=lpc[j]*r;
+    if(i&1)lpc[j]+=lpc[j]*r;
 
-    error*=1.f-r*r;
+    error*=1.-r*r;
+
   }
 
+ done:
+   
+  /* slightly damp the filter */ 
+  {
+    double g = .99;
+    double damp = g;
+    for(j=0;j<m;j++){
+      lpc[j]*=damp;
+      damp*=g;
+    }
+  }
+
   for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
 
   /* we need the error value to know how big an impulse to hit the

Modified: branches/vorbis-aotuv/lib/lpc.h
===================================================================
--- branches/vorbis-aotuv/lib/lpc.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lpc.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.h,v 1.20 2003/03/07 09:13:30 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/lsp.c
===================================================================
--- branches/vorbis-aotuv/lib/lsp.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lsp.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.c,v 1.24 2002/10/16 07:44:21 xiphmont Exp $
+  last mod: $Id$
 
   The LSP generation code is taken (with minimal modification and a
   few bugfixes) from "On the Computation of the LSP Frequencies" by

Modified: branches/vorbis-aotuv/lib/lsp.h
===================================================================
--- branches/vorbis-aotuv/lib/lsp.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/lsp.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.h,v 1.11 2002/07/11 06:40:49 xiphmont Exp $
+  last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/mapping0.c
===================================================================
--- branches/vorbis-aotuv/lib/mapping0.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/mapping0.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -295,22 +295,28 @@
                                      next major model upgrade. */
 
 #if 0
-    if(vi->channels==2)
+    if(vi->channels==2){
       if(i==0)
 	_analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
       else
 	_analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
+    }else{
+      _analysis_output("pcm",seq,pcm,n,0,0,total-n/2);
+    }
 #endif
   
     /* window the PCM data */
     _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
 
 #if 0
-    if(vi->channels==2)
+    if(vi->channels==2){
       if(i==0)
 	_analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
       else
 	_analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
+    }else{
+      _analysis_output("windowed",seq,pcm,n,0,0,total-n/2);
+    }
 #endif
 
     /* transform the PCM data */
@@ -365,6 +371,8 @@
       }else{
 	_analysis_output("fftR",seq,logfft,n/2,1,0,0);
       }
+    }else{
+      _analysis_output("fft",seq,logfft,n/2,1,0,0);
     }
 #endif
 
@@ -387,8 +395,8 @@
       float *logmdct =logfft+n/2;
       float *logmask =logfft;
       
-      float *lastmdct = b->nblock+i*128;
-      float *tempmdct = b->tblock+i*128;
+      float *lastmdct = b->nblock+i*256;
+      float *tempmdct = b->tblock+i*256;
       
       float *lowcomp = b->lownoise_compand_level+i;
 
@@ -448,6 +456,8 @@
 	  _analysis_output("noiseL",seq,noise,n/2,1,0,0);
 	else
 	  _analysis_output("noiseR",seq,noise,n/2,1,0,0);
+      }else{
+	_analysis_output("noise",seq,noise,n/2,1,0,0);
       }
 #endif
 
@@ -467,6 +477,8 @@
 	  _analysis_output("toneL",seq,tone,n/2,1,0,0);
 	else
 	  _analysis_output("toneR",seq,tone,n/2,1,0,0);
+      }else{
+	_analysis_output("tone",seq,tone,n/2,1,0,0);
       }
 #endif
 
@@ -484,6 +496,7 @@
 			   noise,
 			   tone,
 			   1,
+			   vorbis_bitrate_managed(vb),
 			   logmask,
 			   mdct,
 			   logmdct,
@@ -492,7 +505,7 @@
 			   vif->n,
 			   blocktype, modenumber,
 			   vb->nW,
-			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no, b->padnum);
 	
 #if 0
 	if(vi->channels==2){
@@ -500,6 +513,8 @@
 	    _analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
 	  else
 	    _analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
+	}else{
+	  _analysis_output("aotuvM1",seq,aotuv,psy_look->n,1,1,0);
 	}
       }
 #endif
@@ -511,6 +526,8 @@
 	  _analysis_output("mask1L",seq,logmask,n/2,1,0,0);
 	else
 	  _analysis_output("mask1R",seq,logmask,n/2,1,0,0);
+      }else{
+	_analysis_output("mask1",seq,logmask,n/2,1,0,0);
       }
 #endif
 
@@ -524,6 +541,7 @@
 		   logmdct,
 		   logmask);
       
+      
       /* are we managing bitrate?  If so, perform two more fits for
          later rate tweaking (fits represent hi/lo) */
       if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
@@ -533,6 +551,7 @@
 			   noise,
 			   tone,
 			   2,
+			   vorbis_bitrate_managed(vb),
 			   logmask,
 			   mdct,
 			   logmdct,
@@ -541,7 +560,7 @@
 			   vif->n,
 			   blocktype, modenumber,
 			   vb->nW,
-			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no, b->padnum);
 
 #if 0
 	if(vi->channels==2){
@@ -549,6 +568,8 @@
 	    _analysis_output("mask2L",seq,logmask,n/2,1,0,0);
 	  else
 	    _analysis_output("mask2R",seq,logmask,n/2,1,0,0);
+	}else{
+	  _analysis_output("mask2",seq,logmask,n/2,1,0,0);
 	}
 #endif
 	
@@ -562,6 +583,7 @@
 			   noise,
 			   tone,
 			   0,
+			   vorbis_bitrate_managed(vb),
 			   logmask,
 			   mdct,
 			   logmdct,
@@ -570,14 +592,17 @@
 			   vif->n,
 			   blocktype, modenumber,
 			   vb->nW,
-			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no, b->padnum);
 
 #if 0
-	if(vi->channels==2)
+	if(vi->channels==2){
 	  if(i==0)
 	    _analysis_output("mask0L",seq,logmask,n/2,1,0,0);
 	  else
 	    _analysis_output("mask0R",seq,logmask,n/2,1,0,0);
+	}else{
+	  _analysis_output("mask0",seq,logmask,n/2,1,0,0);
+	}
 #endif
 
 	floor_posts[i][0]=
@@ -701,7 +726,8 @@
 			 ci->psy_g_param.sliding_lowpass[vb->W][k]);
 		 
 
-	_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
+	_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i],
+				blocktype, modenumber);
 
 	
 #if 0
@@ -734,6 +760,7 @@
 		   ilogmaskch,
 		   nonzero,
 		   ci->psy_g_param.sliding_lowpass[vb->W][k],
+		   blocktype, modenumber,
 		   gmdct, res_org);
       }
       
@@ -761,11 +788,22 @@
       }
       
       /* set last-window type & number */
+      // if (last window == impulse) && (present window == padding) padnum=1
+      if(!b->lW_modenumber && !b->lW_blocktype && !modenumber && blocktype) b->padnum=1;
+      else if(b->padnum) b->padnum++;
+      if(modenumber) b->padnum=0; // if (present window == (long or trans.) ) padnum=0 [reset]
+      // if (current block type == last block type) lW_no++
       if((blocktype == b->lW_blocktype) && (modenumber == b->lW_modenumber)) b->lW_no++;
       else b->lW_no = 1;
       b->lW_blocktype = blocktype;
       b->lW_modenumber = modenumber;
       /* ok, done encoding.  Next protopacket. */
+      
+      // block type
+      /*if(modenumber && blocktype)printf("[L]\n");
+      else if(modenumber && !blocktype)printf("[T]\n");
+      else if(!modenumber && blocktype)printf("[P]\n");
+      else if(!modenumber && !blocktype)printf("[I]\n");*/
     }
     
   }

Modified: branches/vorbis-aotuv/lib/masking.h
===================================================================
--- branches/vorbis-aotuv/lib/masking.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/masking.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/mdct.c
===================================================================
--- branches/vorbis-aotuv/lib/mdct.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/mdct.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,14 +5,14 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.32 2002/10/16 02:43:48 xiphmont Exp $
+ last mod: $Id$
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,

Modified: branches/vorbis-aotuv/lib/mdct.h
===================================================================
--- branches/vorbis-aotuv/lib/mdct.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/mdct.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: modified discrete cosine transform prototypes
- last mod: $Id: mdct.h,v 1.20 2002/01/22 11:59:00 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/misc.h
===================================================================
--- branches/vorbis-aotuv/lib/misc.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/misc.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: miscellaneous prototypes
- last mod: $Id: misc.h,v 1.12 2002/06/28 22:19:37 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/modes/floor_all.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/floor_all.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/floor_all.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -145,7 +145,7 @@
   &_huff_book_line_512x17_3sub3, 
 };
 
-static static_codebook **_floor_books[10]={
+static static_codebook **_floor_books[13]={
   _floor_128x4_books,
   _floor_256x4_books,
   _floor_128x7_books,
@@ -156,9 +156,12 @@
   _floor_1024x27_books,
   _floor_2048x27_books,
   _floor_512x17_books,
+  _floor_1024x27_books,
+  _floor_2048x27_books,
+  _floor_256x4low_books,
 };
 
-static vorbis_info_floor1 _floor[10]={
+static vorbis_info_floor1 _floor[13]={
   /* 128 x 4 */
   {
     1,{0},{4},{2},{0},
@@ -243,6 +246,31 @@
     
     60,30,500,    1,18.,  -1 /* lowpass! */
   },
+  /* 1024 x 27 (44.1/48kHz low bitrate) */
+  {
+    8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
+    {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
+    2,{0,1024,   93,23,358, 6,46,186,750,  14,33,65, 130,260,485,
+       3,10,18,28,  39,55,79,111,  158,220,306,  418,650,560},
+    
+    60,30,500,    3,18.,  -1 /* lowpass */
+  },
+  /* 2048 x 27 (44.1/48kHz) */
+  {
+    8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
+    {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
+    2,{0,2048,   186,46,716, 12,92,372,1500,  28,66,130, 260,520,970,
+       6,20,36,56,  78,110,158,222,  316,440,612,  836,1300,1120},
+    
+    60,30,500,    3,18.,  -1 /* lowpass */
+  },
+  /* 512 x 4 (256 x 4) */
+  {
+    1,{0},{4},{2},{0},
+    {{1,2,3,4}},
+    4,{0,512, 132,32,64,280},
 
+    60,30,500,   1.,18.,  -1
+  },
 };
 

Modified: branches/vorbis-aotuv/lib/modes/psych_11.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_11.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/psych_11.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -15,15 +15,7 @@
 
  ********************************************************************/
 
-static double _psy_lowpass_11[4]={4.1,4.5,5.5,30.,};
-
-static att3 _psy_tone_masteratt_11[4]={
-  {{ 31,  28,  13},  0,   0},  /* -2 */
-  {{ 30,  28,  12},  0,   0},  /* -1 */
-  {{ 30,  26,  12},  0,   0},  /*  0 */
-  {{ 20,   0, -14},  0,   0},  /* 10 */
-};
-
+/* tonal masking curve level adjustments *************************/
 static vp_adjblock _vp_tonemask_adj_11[4]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
@@ -33,7 +25,7 @@
   {{-20,-20,-20,-20,-20,-16,-10,-8,-4,-2, 0, 0, 0, 0,99,99,99}}, /* 10 */
 };
 
-
+/* noise bias */
 static noise3 _psy_noisebias_11[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -4,  2,  4, 10, 10, 12, 12, 12, 99, 99, 99},
@@ -53,5 +45,16 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
 };
 
-static double _noise_thresh_11[4]={ .3,.3,.5,.5 };
+/* tone master attenuation by base quality mode and bitrate tweak */
+static att3 _psy_tone_masteratt_11[4]={
+  {{ 31,  28,  13},  0,   0},  /* -2 */
+  {{ 30,  28,  12},  0,   0},  /* -1 */
+  {{ 30,  26,  12},  0,   0},  /*  0 */
+  {{ 20,   0, -14},  0,   0},  /* 10 */
+};
 
+/* lowpass by mode **************/
+static double _psy_lowpass_11[4]={4.1,4.5,5.5,30.,};
+
+/* noise normalization **********/
+static double _noise_thresh_11[3]={ .3,.3,.5 };

Modified: branches/vorbis-aotuv/lib/modes/psych_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_16.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/psych_16.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -15,41 +15,7 @@
 
  ********************************************************************/
 
-/* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_16[5]={
-  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
-  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
-   {  6,  5,  5,  5,  5,  5,  5,  5,  4,  4,  4,  4,  4,  4,  4},
-   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  4,  4},
-   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
-   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
-   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  4,  4},
-   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
-   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
-   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  4,  4,  4,  4,  4},
-   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-  {{  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
-   {  5,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
-   {  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
-   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-   {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-   {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8},
-   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-};
-
-static double _psy_lowpass_16[5]={6.,6.5,8,30.,99.};
-
-static att3 _psy_tone_masteratt_16[5]={
-  {{ 30,  28,  12},  0,   0},  /* -2 */
-  {{ 30,  28,  12},  0,   0},  /* -1 */
-  {{ 25,  23,  12},  0,   0},  /* 0.5 */
-  {{ 20,  12,   0},  0,   0},  /*  5 */
-  {{ 15,   0, -14},  0,   0},  /* 10 */
-};
-
+/* tonal masking curve level adjustments *************************/
 static vp_adjblock _vp_tonemask_adj_16[5]={
   /* adjust for mode zero */
   /* 63     125     250     500       1     2     4     8    16 */
@@ -60,7 +26,7 @@
   {{-30,-30,-30,-30,-30,-26,-20,-10, -8,-6,-2,-2, 0, 0, 0, 0, 0}}, /* 10 */
 };
 
-
+/* noise bias */
 static noise3 _psy_noisebias_16_short[5]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-15,-15,-15,-15,-15,-10,-10, -5,  4, 10, 10, 10, 10, 12, 12, 14, 20},
@@ -130,18 +96,62 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static double _noise_thresh_16[5]={ .3,.3,.5,.5,.5 };
+static noiseguard _psy_noiseguards_16[4]={
+  {10,10,-1},
+  {10,10,-1},
+  {20,20,-1},
+  {20,20,-1},
+};
 
-static int _noise_start_16[4]={ 256,256,256,9999 };
-static int _noise_part_16[5]={ 8,8,8,8,8 };
-
+/* ath ****************/
 static int _psy_ath_floater_16[5]={
   -100,-100,-100,-100,-105,
 };
-
 static int _psy_ath_abs_16[5]={
   -130,-130,-130,-130,-140,
 };
 
+/* stereo mode by base quality level */
+static adj_stereo _psy_stereo_modes_16[5]={
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
+  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  6,  5,  5,  5,  5,  5,  5,  5,  4,  4,  4,  4,  4,  4,  4},
+   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  4,  4,  4,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  5,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+};
 
+/* tone master attenuation by base quality mode and bitrate tweak */
+static att3 _psy_tone_masteratt_16[5]={
+  {{ 30,  28,  12},  0,   0},  /* -2 */
+  {{ 30,  28,  12},  0,   0},  /* -1 */
+  {{ 25,  23,  12},  0,   0},  /* 0.5 */
+  {{ 20,  12,   0},  0,   0},  /*  5 */
+  {{ 15,   0, -14},  0,   0},  /* 10 */
+};
 
+/* lowpass by mode **************/
+static double _psy_lowpass_16[5]={6.,6.5,8,30.,99.};
+
+/* noise normalization **********/
+static int _noise_start_16[4]={ 256,256,256,9999 };
+
+static int _noise_part_16[4]={ 8,8,8,8 };
+
+static double _noise_thresh_16[4]={ .3,.3,.5,.5 };
+

Modified: branches/vorbis-aotuv/lib/modes/psych_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_44.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/psych_44.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -81,8 +81,8 @@
 //    24,25,26,27,28,29,30, 31,     /* 31dB */
 //    32,33,34,35,36,37,38, 39,     /* 39dB */
     0, 1, 2, 3, 4, 5, 6,  6,     /* 7dB */
-    7, 7, 7, 8, 9,10, 11, 11,     /* 15dB */
-    12,12,13,13,14,14,15, 15,     /* 23dB */
+    7, 7, 7, 8, 9, 9,10, 10,     /* 15dB */
+    11,12,13,14,15,15,15, 15,     /* 23dB */
     16,16,17,17,17,18,18, 19,     /* 31dB */
     19,19,20,21,22,23,24, 25,     /* 39dB */
   }},
@@ -144,89 +144,39 @@
 };
 
 /* tonal masking curve level adjustments *************************/
-
 static vp_adjblock _vp_tonemask_adj_longblock[13]={
    /* 63     125     250     500       1       2       4       8      16 */
-// {{ -3, -9,-12,-12,-10,-10,-10,-10,-10,-10,-10, -1,  0,  0,  1,  1,  1}}, /* -2(addition) */
-   {{-16,-16,-16,-15,-15,-15,-14,-14,-13,-13,-12,-12,-11, -5,  0,  0,  5}},
-
-// {{ -3, -9,-12,-12,-11,-11,-11,-11,-11,-11,-10, -1, -1,  0,  0,  0,  0}}, /* -1 */
-   {{-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-13,-12, -7, -2, -2,  3}},
+   {{-16,-16,-16,-15,-15,-15,-15,-15,-14,-13,-12,-11,-11, -4,  0,  0,  5}}, /* -2(addition) */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-14,-13, -7, -2, -2,  3}}, /* -1  */
    
-/* {{-15,-15,-15,-15,-10, -8, -4, -2,  0,  0,  0, 10,  0,  0,  0,  0,  0}},    0 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13, -8, -3, -3,  1}}, /* 0 */
-
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  5,  0,  0,  0,  0,  0}},    1 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10, -4, -4,  0}}, /* 1 */
-
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    2 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -5, -5,  0}}, /* 2 */
-   
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    3 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -8, -7,  0}}, /* 3 */
-   
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    4 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}},  /* 4 */
-   
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    5 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 5 */
-   
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    6 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 6 */
-   
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    7 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 7 */
-
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    8 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 8 */
-
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    9 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11,-10,-10,  0}}, /* 9 */
-
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    10 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11,-10,-10,  0}}, /* 10 */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-14,-13, -8, -3, -3,  1}}, /*  0  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-10, -3, -3,  0}}, /*  1  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-11, -5, -5,  0}}, /*  2  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-12, -7, -6,  0}}, /*  3  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -8, -9,  0}}, /*  4  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -8, -9,  0}}, /*  5  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  6  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  7  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  8  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  9  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12,-10,-10,  0}}, /* 10  */
 };
 static vp_adjblock _vp_tonemask_adj_otherblock[13]={
    /* 63     125     250     500       1       2       4       8      16 */
-
-// {{ -3, -9,-12,-12,-10,-10,-10,-10,-10,-10,-10, -1,  0,  0,  1,  1,  1}}, /* -2(addition) */
-   {{-16,-16,-16,-15,-15,-15,-14,-14,-13,-13,-12,-12,-11, -5,  0,  0,  5}},
-
-// {{ -3, -9,-12,-12,-11,-11,-11,-11,-11,-11,-10, -1, -1,  0,  0,  0,  0}}, /* -1 */
-   {{-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-13,-12, -7, -2, -2,  3}},
+   {{-16,-16,-16,-15,-15,-15,-15,-15,-14,-13,-12,-11,-11, -4,  0,  0,  5}}, /* -2(addition) */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-14,-13, -7, -2, -2,  3}}, /* -1  */
    
-/* {{-20,-20,-20,-20,-14,-12,-10, -8, -4,  0,  0, 10,  0,  0,  0,  0,  0}},    0 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14, -8, -3, -3,  0}}, /* 0 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  5,  0,  0,  0,  0,  0}},    1 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-10, -4, -4,  0}}, /* 1 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    2 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -6, -5,  0}}, /* 2 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    3 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -7,  0}}, /* 3 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    4 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 4 */
-   
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    5 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 5 */
-   
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    6 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 6 */
-   
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    7 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 7 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    8 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11, -9, -9,  0}}, /* 8 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    9 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11,-10,-10,  0}}, /* 9 */
-
-/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    10 */
-   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-11,-10,-10,  0}}, /* 10 */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-14,-13, -8, -3, -3,  1}}, /*  0  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-10, -3, -3,  0}}, /*  1  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-11, -5, -5,  0}}, /*  2  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-15,-15,-14,-12, -7, -6,  0}}, /*  3  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -8, -9,  0}}, /*  4  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -8, -9,  0}}, /*  5  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  6  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  7  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  8  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12, -9,-10,  0}}, /*  9  */
+   {{-16,-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-14,-12,-10,-10,  0}}, /* 10  */
 };
 
 /* noise bias (transition block) */
@@ -234,21 +184,21 @@
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-28,-28,-26,-26,-22,-18,-16, -8, -2,  2,  2,  2,  2,  5,  6,  7, 15},
+    {-28,-28,-26,-26,-22,-18,-16,-10, -2,  2,  2,  2,  3,  5,  6,  7, 14},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* -1 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-28,-28,-24,-20,-18,-10, -4,  0,  0,  0,  0,  2,  3,  4, 14},
+    {-30,-30,-28,-28,-24,-20,-18,-12, -4,  0,  0,  0,  1,  3,  4,  5, 12},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 0 */
 /*{{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  4,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},*/
   {{{-15,-15,-15,-15,-15,-12, -6, -4,  0,  2,  4,  4,  5,  5,  5,  8, 10},
-    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  0,  1,  2,  3,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  1,  1,  2,  3,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 1 */
 /*{{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8, 10},
@@ -324,21 +274,21 @@
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  2,  6,  6,  6,  6, 10, 10, 12, 20},
-    {-20,-20,-20,-20,-20,-18,-12, -6,  0,  2,  2,  2,  2,  5,  6,  7, 15},
+    {-20,-20,-20,-20,-20,-18,-12, -6,  0,  2,  2,  2,  3,  5,  6,  7, 14},
     {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* -1 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  0,  6,  6,  6,  6, 10, 10, 12, 20},
     {-20,-20,-20,-20,-20,-20,-10, -2,  0,  0,  0,  0,  0,  2,  4,  6, 15},
     {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  0,  6,  6,  6,  6, 10, 10, 12, 20},
-    {-20,-20,-20,-20,-20,-18,-12, -8, -2,  0,  0,  0,  0,  2,  3,  4, 14},
+    {-20,-20,-20,-20,-20,-18,-12, -8, -2,  0,  0,  0,  1,  3,  4,  5, 12},
     {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 0 */
 /*{{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8,  10},
     {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  0,  2,  4,  10},
     {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8, 10},
-    {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  1,  2,  3,  7},
+    {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  1,  1,  2,  3,  8},
     {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 1 */
 /*{{{-10,-10,-10,-10,-10,-10, -8, -4,  0,  2,  4,  4,  5,  5,  5,  8, 10},
@@ -408,49 +358,49 @@
   /*  63     125     250     500      1k      2k      4k      8k     16k*/
   /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-28,-28,-26,-26,-22,-18,-16, -8, -2,  2,  2,  2,  3,  6,  7,  8, 15},
+    {-28,-28,-26,-26,-22,-18,-16,-10, -2,  2,  2,  2,  3,  5,  6,  7, 14},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* -1 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-28,-28,-24,-20,-18,-10, -4,  0,  0,  0,  1,  4,  5,  6, 14},
+    {-30,-30,-28,-28,-24,-20,-18,-12, -4,  0,  0,  0,  1,  2,  4,  5, 12},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 0 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  4,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  4, 10},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  4,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  0,  1,  2,  3,  7},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  1,  1,  2,  3,  8},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 1 */
 /*{{{-12,-12,-12,-12,-12, -8, -6, -4,  0,  4,  4,  4,  4, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4, -4, -2, -2, -2, -2,  2},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8,-10,-10, -8, -8, -8, -6, -4}}},*/
   {{{-12,-12,-12,-12,-12, -8, -6, -4,  0,  4,  4,  4,  4, 10, 12, 14, 20},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -1,  3},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4, -4, -2, -2, -1,  1,  4},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8,-10,-10, -8, -8, -8, -6, -4}}},
   /* 2 */
 //  {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  8, 10, 10, 16},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  8, 10, 10, 16},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3, -2,  1},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3,  0,  1},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   /* 3 */
 //  {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  6,  8,  8, 14},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  6,  8,  8, 14},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3, -2,  1},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3,  0,  1},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   /* 4 */
 //  {{{-16,-16,-16,-16,-16,-12,-10, -6, -2,  0,  0,  0,  0,  4,  6,  6, 12},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
 //    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   {{{-16,-16,-16,-16,-16,-12,-10, -6, -2,  0,  0,  0,  0,  4,  6,  6, 12},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3, -2,  1},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -3,  0,  1},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   /* 5 */
 /*{{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
@@ -495,25 +445,28 @@
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-28,-28,-26,-26,-22,-18,-16, -8, -2,  2,  2,  2,  3,  6,  7,  8, 15},
+    {-28,-28,-26,-26,-22,-18,-16,-10, -2,  2,  2,  2,  4,  6,  7,  8, 14},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* -1 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-28,-28,-24,-20,-18,-10, -4,  0,  0,  0,  1,  4,  5,  6, 14},
+    {-30,-30,-28,-28,-24,-20,-18,-12, -4,  0,  0,  1,  2,  4,  5,  6, 12},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -4, -4, -4, -4, -4, -2,  0,  2}}},
   /* 0 */
 /*{{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  2,  3,  6,  6,  8, 10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -4, -4, -2,  0,  2}}},*/
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  0,  3,  3,  5,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -6,  0,  0,  0,  1,  2,  3,  4,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -4, -4, -2,  0,  2}}},
   /* 1 */
+//  {{{-12,-12,-12,-12,-12, -8, -6, -4,  0,  4,  4,  4,  4, 10, 12, 14, 20},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -6, -4, -2,  0}}},
   {{{-12,-12,-12,-12,-12, -8, -6, -4,  0,  4,  4,  4,  4, 10, 12, 14, 20},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  1,  1,  2,  4,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -6, -4, -2,  0}}},
   /* 2 */
 //  {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  8, 10, 10, 16},
@@ -527,8 +480,11 @@
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1,  0,  0,  2,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
   /* 4 */
+//  {{{-16,-16,-16,-16,-16,-12,-10, -6, -2,  0,  0,  0,  0,  4,  6,  6, 12},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1,  0,  2,  6},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
   {{{-16,-16,-16,-16,-16,-12,-10, -6, -2,  0,  0,  0,  0,  4,  6,  6, 12},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1,  0,  0,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
   /* 5 */
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  6,  6, 12},
@@ -743,7 +699,7 @@
 static double _psy_lowpass_44[13]={
   /*  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */
 //  13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
-  13.1,14.8,15.1,15.8,16.5,17.2,18.3,20.1,48.,999.,999.,999.,999.
+  13.0,14.3,15.1,15.8,16.5,17.2,18.3,20.1,48.,999.,999.,999.,999.
 };
 
 /* noise normalization **********/
@@ -771,11 +727,12 @@
 static double _noise_thresh_44[12]={
   /*  .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */
 //   .2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
-   .16,.19,.19,.2,.35,.8,9999.,9999.,9999.,9999.,9999.,9999.,
+   .17,.2,.2,.2,.35,.6,9999.,9999.,9999.,9999.,9999.,9999.,
 };
 
-static double _noise_thresh_5only[2]={
- .5,.5,
+/* 0~8kHz */
+static double _noise_thresh_5only[3]={
+ .5,.5,.5
 };
 
 /* 32kHz only */

Modified: branches/vorbis-aotuv/lib/modes/psych_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_8.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/psych_8.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -15,13 +15,32 @@
 
  ********************************************************************/
 
-static att3 _psy_tone_masteratt_8[4]={
-  {{ 33,  28,  13},  0,   0},  /* -2 */
-  {{ 32,  28,  12},  0,   0},  /* -1 */
-  {{ 30,  26,  12},  0,   0},  /*  0 */
-  {{ 20,   0, -14},  0,   0},  /* 10 */
+/* noise compander lookups */
+static compandblock _psy_compand_8[3]={
+  {{
+     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+     8, 8, 9, 9,10,10,11, 11,     /* 15dB */
+    12,12,13,13,14,14,15, 16,     /* 23dB */
+    17,18,19,20,21,22,23, 24,     /* 31dB */
+    25,26,27,28,29,30,31, 32,     /* 39dB */
+  }},
+  {{
+     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+     8, 8, 9, 9,10,10,11, 11,     /* 15dB */
+    12,12,13,13,14,14,15, 15,     /* 23dB */
+    16,16,17,17,17,18,18, 19,     /* 31dB */
+    19,19,20,21,22,23,24, 25,     /* 39dB */
+  }},
+  {{
+     0, 1, 2, 3, 4, 5, 6,  6,     /* 7dB */
+     7, 7, 6, 6, 5, 5, 4,  4,     /* 15dB */
+     3, 3, 3, 4, 5, 6, 7,  8,     /* 23dB */
+     9,10,11,12,13,14,15, 16,     /* 31dB */
+    17,18,19,20,21,22,23, 24,     /* 39dB */
+  }},
 };
 
+/* tonal masking curve level adjustments *************************/
 static vp_adjblock _vp_tonemask_adj_8[4]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
@@ -31,7 +50,7 @@
   {{-15,-15,-15,-15,-10,-10, -6,-2, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 10 */
 };
 
-
+/* noise bias */
 static noise3 _psy_noisebias_8[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  3,  4,  8,  8,  8, 10, 10, 99, 99, 99},
@@ -51,6 +70,21 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
 };
 
+static noiseguard _psy_noiseguards_8[3]={
+  {10,10,-1},
+  {10,10,-1},
+  {10,10,-1},
+};
+
+
+/* ath ****************/
+static int _psy_ath_floater_8[4]={
+  -100,-100,-100,-105,
+};
+static int _psy_ath_abs_8[4]={
+  -130,-130,-130,-140,
+};
+
 /* stereo mode by base quality level */
 static adj_stereo _psy_stereo_modes_8[4]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
@@ -72,49 +106,21 @@
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
 };
 
-static noiseguard _psy_noiseguards_8[3]={
-  {10,10,-1},
-  {10,10,-1},
-  {10,10,-1},
+/* tone master attenuation by base quality mode and bitrate tweak */
+static att3 _psy_tone_masteratt_8[4]={
+  {{ 33,  28,  13},  0,   0},  /* -2 */
+  {{ 32,  28,  12},  0,   0},  /* -1 */
+  {{ 30,  26,  12},  0,   0},  /*  0 */
+  {{ 20,   0, -14},  0,   0},  /* 10 */
 };
 
-static compandblock _psy_compand_8[3]={
-  {{
-     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
-     8, 8, 9, 9,10,10,11, 11,     /* 15dB */
-    12,12,13,13,14,14,15, 16,     /* 23dB */
-    17,18,19,20,21,22,23, 24,     /* 31dB */
-    25,26,27,28,29,30,31, 32,     /* 39dB */
-  }},
-  {{
-     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
-     8, 8, 9, 9,10,10,11, 11,     /* 15dB */
-    12,12,13,13,14,14,15, 15,     /* 23dB */
-    16,16,17,17,17,18,18, 19,     /* 31dB */
-    19,19,20,21,22,23,24, 25,     /* 39dB */
-  }},
-  {{
-     0, 1, 2, 3, 4, 5, 6,  6,     /* 7dB */
-     7, 7, 6, 6, 5, 5, 4,  4,     /* 15dB */
-     3, 3, 3, 4, 5, 6, 7,  8,     /* 23dB */
-     9,10,11,12,13,14,15, 16,     /* 31dB */
-    17,18,19,20,21,22,23, 24,     /* 39dB */
-  }},
-};
+/* lowpass by mode **************/
+static double _psy_lowpass_8[4]={2.6,3.,4.,4.};
 
-static double _psy_lowpass_8[4]={2.6,3.,4.,4.};
+/* noise normalization **********/
 static int _noise_start_8[3]={
   64,64,64,
 };
 static int _noise_part_8[3]={
   8,8,8,
 };
-
-static int _psy_ath_floater_8[4]={
-  -100,-100,-100,-105,
-};
-
-static int _psy_ath_abs_8[4]={
-  -130,-130,-130,-140,
-};
-

Modified: branches/vorbis-aotuv/lib/modes/residue_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_16.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/residue_16.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -21,7 +21,7 @@
   {
     {0},
     {0,0,&_16c0_s_p1_0},
-    {0,0,&_16c0_s_p2_0},
+    {0},
     {0,0,&_16c0_s_p3_0},
     {0,0,&_16c0_s_p4_0},
     {0,0,&_16c0_s_p5_0},
@@ -35,7 +35,7 @@
   {
     {0},
     {0,0,&_16c1_s_p1_0},
-    {0,0,&_16c1_s_p2_0},
+    {0},
     {0,0,&_16c1_s_p3_0},
     {0,0,&_16c1_s_p4_0},
     {0,0,&_16c1_s_p5_0},

Modified: branches/vorbis-aotuv/lib/modes/residue_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/residue_44.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/modes/residue_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44u.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/residue_44u.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/modes/residue_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_8.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/residue_8.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -22,17 +22,29 @@
 
 static static_bookblock _resbook_8s_0={
   {
-    {0},{0,0,&_8c0_s_p1_0},{0,0,&_8c0_s_p2_0},{0,0,&_8c0_s_p3_0},
-    {0,0,&_8c0_s_p4_0},{0,0,&_8c0_s_p5_0},{0,0,&_8c0_s_p6_0},
-    {&_8c0_s_p7_0,&_8c0_s_p7_1},{&_8c0_s_p8_0,&_8c0_s_p8_1},
+    {0},
+    {0,0,&_8c0_s_p1_0},
+    {0},
+    {0,0,&_8c0_s_p3_0},
+    {0,0,&_8c0_s_p4_0},
+    {0,0,&_8c0_s_p5_0},
+    {0,0,&_8c0_s_p6_0},
+    {&_8c0_s_p7_0,&_8c0_s_p7_1},
+    {&_8c0_s_p8_0,&_8c0_s_p8_1},
     {&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2}
    }
 };
 static static_bookblock _resbook_8s_1={
   {
-    {0},{0,0,&_8c1_s_p1_0},{0,0,&_8c1_s_p2_0},{0,0,&_8c1_s_p3_0},
-    {0,0,&_8c1_s_p4_0},{0,0,&_8c1_s_p5_0},{0,0,&_8c1_s_p6_0},
-    {&_8c1_s_p7_0,&_8c1_s_p7_1},{&_8c1_s_p8_0,&_8c1_s_p8_1},
+    {0},
+    {0,0,&_8c1_s_p1_0},
+    {0},
+    {0,0,&_8c1_s_p3_0},
+    {0,0,&_8c1_s_p4_0},
+    {0,0,&_8c1_s_p5_0},
+    {0,0,&_8c1_s_p6_0},
+    {&_8c1_s_p7_0,&_8c1_s_p7_1},
+    {&_8c1_s_p8_0,&_8c1_s_p8_1},
     {&_8c1_s_p9_0,&_8c1_s_p9_1,&_8c1_s_p9_2}
    }
 };

Modified: branches/vorbis-aotuv/lib/modes/setup_11.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_11.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_11.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/modes/setup_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_16.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_16.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -69,7 +69,7 @@
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,
@@ -121,7 +121,7 @@
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,

Modified: branches/vorbis-aotuv/lib/modes/setup_22.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_22.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_22.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -47,7 +47,7 @@
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,
@@ -99,7 +99,7 @@
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,

Modified: branches/vorbis-aotuv/lib/modes/setup_32.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_32.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_32.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -32,6 +32,13 @@
   12.1,12.6,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
 };
 
+static int _floor_short_mapping_32[12]={
+  1,1,0,0,2,2,4,5,5,5,5,5
+};
+static int _floor_long_mapping_32[12]={
+  8,8,7,7,7,7,7,7,7,7,7,7
+};
+
 ve_setup_data_template ve_setup_32_stereo={
 //  11,
   12,
@@ -78,8 +85,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  _floor_short_mapping_32,
+  _floor_long_mapping_32,
 
   _mapres_template_44_stereo
 };
@@ -130,8 +137,8 @@
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  _floor_short_mapping_32,
+  _floor_long_mapping_32,
 
   _mapres_template_44_uncoupled
 };

Modified: branches/vorbis-aotuv/lib/modes/setup_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_44.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -37,7 +37,7 @@
 };
 
 static double _psy_compand_short_mapping[13]={
-  1., 1., 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
+  0., 0., 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
 };
 static double _psy_compand_long_mapping[13]={
   4., 4., 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
@@ -54,7 +54,7 @@
   1,1,0,0,2,2,4,5,5,5,5,5
 };
 static int _floor_long_mapping_44[12]={
-  8,8,7,7,7,7,7,7,7,7,7,7
+  11,11,10,10,10,7,7,7,7,7,7,7
 };
 
 ve_setup_data_template ve_setup_44_stereo={
@@ -73,7 +73,7 @@
   _psy_tone_0dB,
   _psy_tone_suppress,
 
-  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock, // impulse
   _vp_tonemask_adj_longblock,
   _vp_tonemask_adj_otherblock,
 

Modified: branches/vorbis-aotuv/lib/modes/setup_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44u.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_44u.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/modes/setup_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_8.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_8.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/modes/setup_X.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_X.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/modes/setup_X.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/os.h
===================================================================
--- branches/vorbis-aotuv/lib/os.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/os.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -7,8 +7,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/psy.c
===================================================================
--- branches/vorbis-aotuv/lib/psy.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/psy.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -23,6 +23,7 @@
 
 #include "masking.h"
 #include "psy.h"
+#include "psy_table.h"
 #include "os.h"
 #include "lpc.h"
 #include "smallft.h"
@@ -44,21 +45,45 @@
 static int m3n32[] = {21,13,10,4};
 static int m3n44[] = {15,9,7,3};
 static int m3n48[] = {14,8,6,3};
+static int m3n32x2[] = {42,26,20,8};
+static int m3n44x2[] = {30,18,14,6};
+static int m3n48x2[] = {28,16,12,6};
 
-static int temp_bfn[128] = {
+static int freq_bfn128[128] = {
  0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
  4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
  8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,
 12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,
+
 16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,
 20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,
 24,24,24,24,25,25,25,24,23,22,21,20,19,18,17,16,
 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
 };
+static int freq_bfn256[256] = {
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,
+12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,
+16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,
+20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,
+24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,
+28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,
 
-static float nnmid_th=0.2;
+32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,
+36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,
+40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,
+44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,
+48,48,48,48,49,49,49,49,50,50,50,50,51,50,49,48,
+47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,
+31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,
+15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
+};
 
+static float nnmid_th=0.3;
 
+
+
 vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy_global *gi=&ci->psy_g_param;
@@ -314,6 +339,9 @@
   p->n25p=n/4;
   p->n33p=n/3;
   p->n75p=n*3/4;
+  p->nn25pt=vi->normal_partition/4;
+  p->nn50pt=p->nn25pt*2;
+  p->nn75pt=p->nn25pt*3;
   if(rate < 26000){
   	/* below 26kHz */
   	p->m_val = 0;
@@ -321,48 +349,64 @@
   	p->tonecomp_endp=0; // dummy
   	p->tonecomp_thres=.25;
   	p->st_freqlimit=n;
-  	p->min_nn_lp=0;
+  	p->min_nn_lp=0; p->nn_mec_s= 0; p->nn_mec_m= 0;
   }else if(rate < 38000){
   	/* 32kHz */
   	p->m_val = .93;
-  	for(i=0; i<4; i++) p->m3n[i] = m3n32[i];
-  	if(n==128)      { p->tonecomp_endp= 124; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit=n; p->min_nn_lp=   0;}
+  	if(n==128)      { p->tonecomp_endp= 124; p->tonecomp_thres=.7;
+  	                 p->st_freqlimit=n;      p->min_nn_lp=120;
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n32[i];}
   	else if(n==256) { p->tonecomp_endp= 248; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit=n; p->min_nn_lp=   0;}
-  	else if(n==1024){ p->tonecomp_endp= 992; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit=n; p->min_nn_lp= 832;}
+  	                 p->st_freqlimit=n;      p->min_nn_lp=240;
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n32x2[i];}
+  	else if(n==1024){ p->tonecomp_endp= 992; p->tonecomp_thres=.7;
+  	                 p->st_freqlimit=n;      p->min_nn_lp=960;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   	else if(n==2048){ p->tonecomp_endp=1984; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit=n; p->min_nn_lp=1664;}
+  	                 p->st_freqlimit=n;      p->min_nn_lp=1920;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   }else if(rate > 46000){
   	/* 48kHz */
   	p->m_val = 1.205;
-  	for(i=0; i<4; i++) p->m3n[i] = m3n48[i];
-  	if(n==128)      { p->tonecomp_endp=  83; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit=  89; p->min_nn_lp=   0;}
+  	if(n==128)      { p->tonecomp_endp=  83; p->tonecomp_thres=.7;
+  	                 p->st_freqlimit=  88;   p->min_nn_lp=  80;
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n48[i];}
   	else if(n==256) { p->tonecomp_endp= 166; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit= 178; p->min_nn_lp=   0;}
-  	else if(n==1024){ p->tonecomp_endp= 664; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit= 712; p->min_nn_lp= 576;}
+  	                 p->st_freqlimit= 176;   p->min_nn_lp= 160;
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n48x2[i];}
+  	else if(n==1024){ p->tonecomp_endp= 664; p->tonecomp_thres=.7;
+  	                 p->st_freqlimit= 704;   p->min_nn_lp= 640;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   	else if(n==2048){ p->tonecomp_endp=1328; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit=1424; p->min_nn_lp=1152;}
+  	                 p->st_freqlimit=1408;   p->min_nn_lp=1280;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   }else{
   	/* 44.1kHz */
   	p->m_val = 1.;
-  	for(i=0; i<4; i++) p->m3n[i] = m3n44[i];
-  	if(n==128)      { p->tonecomp_endp=  90; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit=  96; p->min_nn_lp=   0;}
+  	if(n==128)      { p->tonecomp_endp=  90; p->tonecomp_thres=.7; //15503.90625
+  	                 p->st_freqlimit=  96;   p->min_nn_lp=  87;    //16537.5 , 14987.109375
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n44[i];}
   	else if(n==256) { p->tonecomp_endp= 180; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit= 192; p->min_nn_lp=   0;}
-  	else if(n==1024){ p->tonecomp_endp= 720; p->tonecomp_thres=.5;
-  	                 p->st_freqlimit= 768; p->min_nn_lp= 608;}
+  	                 p->st_freqlimit= 192;   p->min_nn_lp= 174;
+  	                 p->nn_mec_s = .48;       p->nn_mec_m =.24;
+  	                 for(i=0; i<4; i++) p->m3n[i] = m3n44x2[i];}
+  	else if(n==1024){ p->tonecomp_endp= 720; p->tonecomp_thres=.7;
+  	                 p->st_freqlimit= 768;   p->min_nn_lp= 696;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   	else if(n==2048){ p->tonecomp_endp=1440; p->tonecomp_thres=.7;
-  	                 p->st_freqlimit=1536; p->min_nn_lp=1216;}
+  	                 p->st_freqlimit=1536;   p->min_nn_lp=1392;
+  	                 p->nn_mec_s =.24;       p->nn_mec_m =.12;}
   }
 
   /* set up the lookups for a given blocksize and sample rate */
 
-  for(i=0,j=0;i<MAX_ATH-1;i++){
+  j=0;
+  for(i=0;i<MAX_ATH-1;i++){
     int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate);
     float base=ATH[i];
     if(j<endpos){
@@ -373,6 +417,9 @@
       }
     }
   }
+  for(i=j; i<n; i++){
+      p->ath[i]=p->ath[j-1];
+  }
 
   for(i=0;i<n;i++){
     float bark=toBARK(rate/(2*n)*i); 
@@ -623,7 +670,10 @@
   int i;
 
   int lo, hi;
-  float R, A, B, D;
+  float R=0.f;
+  float A=0.f;
+  float B=0.f;
+  float D=1.f;
   float w, x, y;
 
   tN = tX = tXX = tY = tXY = 0.f;
@@ -935,6 +985,7 @@
 			float *noise,
 			float *tone,
 			int offset_select,
+			int bit_managed,
 			float *logmask,
 			float *mdct,
 			float *logmdct,
@@ -943,15 +994,14 @@
 			int end_block,
 			int blocktype, int modenumber,
 			int nW_modenumber,
-			int lW_blocktype, int lW_modenumber, int lW_no){
+			int lW_blocktype, int lW_modenumber, int lW_no, int padnum){
 
   int i,j,n=p->n;
-  int m2_sw=0,  padth; /* aoTuV for M2 */
-  int it_sw, *m3n, m3_count; /* aoTuV for M3 */
-  int m4_end, lp_pos, m4_start; /* aoTuV for M4 */
+  int m2_sw=0; /* aoTuV for M2 */
+  int m3_sw, *m3n, m3_count, mdctbuf_flag; /* aoTuV for M3 */
+  int m4_end, m4_lp_pos, m4_start; /* aoTuV for M4 */
   float de, coeffi, cx; /* aoTuV for M1 */
-  float toneth; /* aoTuV for M2 */
-  float noise_rate, noise_rate_low, noise_center, rate_mod; /* aoTuV for M3 */
+  float noise_rate, noise_rate_low, noise_center, rate_mod, tone_rate; /* aoTuV for M3 */
   float m4_thres; /* aoTuV for M4 */
   float toneatt=p->vi->tone_masteratt[offset_select];
 
@@ -960,7 +1010,7 @@
   m4_start=p->vi->normal_start;
   m4_end = p->tonecomp_endp;
   m4_thres = p->tonecomp_thres;
-  lp_pos=9999;
+  m4_lp_pos=9999;
   
   end_block+=p->vi->normal_partition;
   if(end_block>n)end_block=n;
@@ -972,54 +1022,110 @@
   /** @ M2 PRE **/
   if(p->vi->normal_thresh<.48){
   	if((cx > 0.5) && !modenumber && blocktype && (n==128)){
-    	if(p->vi->normal_thresh>.35) padth = 10+(int)(p->vi->flacint*100);
-    	else padth = 10;
-    	m2_sw=1;
+    	if(p->vi->normal_thresh>.35) m2_sw = 10+(int)(p->vi->flacint*100);
+    	else m2_sw = 10;
     }
   }
+  
+  /* flag for lastmdct & tempmdct (bitrate managed mode) */
+  if( (bit_managed && (offset_select==2)) || (!bit_managed && (offset_select==1)) ) mdctbuf_flag=1;
+  else mdctbuf_flag=0; 
 
-  /** @ M3 PRE **/
-  m3_count = 3;
-  if(toneatt < 3) m3_count = 2; // q6~
-  if((n == 128) && !modenumber && !blocktype){
-  	if(!lW_blocktype && !lW_modenumber){ /* last window "short" - type "impulse" */
-  		if(lW_no < 8){
-  			/* impulse - @impulse case1 */
-  			noise_rate = 0.7-(float)(lW_no-1)/17;
-  			noise_center = (float)(lW_no*m3_count);
-  		}else{
-  			/* impulse - @impulse case2 */
-  			noise_rate = 0.3;
-  			noise_center = 25;
-  			if((lW_no*m3_count) < 24) noise_center = lW_no*m3_count;
+  /** @ M3&M4 PRE **/
+  if(cx < 0.5){
+  	m3_sw = 0; /* for M3 */
+  	m4_end=end_block; /* for M4 */
+  }else{
+  	/** M3 PRE **/
+  	if((n == 128) && !modenumber && !blocktype){
+  		if(toneatt < 3) m3_count = 2; // q6~
+  		else m3_count = 3;
+  		
+  		if(!lW_blocktype && !lW_modenumber){ /* last window "short" - type "impulse" */
+  			if(lW_no < 8){
+  				/* impulse - @impulse case1 */
+  				noise_rate = 0.7-(float)(lW_no-1)/17;
+  				noise_center = (float)(lW_no*m3_count);
+  				tone_rate = 8-lW_no;
+  			}else{
+  				/* impulse - @impulse case2 */
+  				noise_rate = 0.3;
+  				noise_center = 25;
+  				tone_rate = 0;
+  				if((lW_no*m3_count) < 24) noise_center = lW_no*m3_count;
+  			}
+  			if(mdctbuf_flag == 1){
+  				for(i=0; i<128; i++) tempmdct[i] -= 5;
+  			}
+  		}else{ /* non_impulse - @Short(impulse) case */
+  			noise_rate = 0.7;
+  			noise_center = 0;
+  			tone_rate = 8.;
+  			if(mdctbuf_flag == 1){
+  				for(i=0; i<128; i++) tempmdct[i] = lastmdct[i] - 5;
+  			}
   		}
-  		if(offset_select == 1){
-  			for(i=0; i<128; i++) tempmdct[i] -= 5;
+  		noise_rate_low = 0;
+  		m3_sw = 1;
+  		if(padnum)noise_rate*=.8;
+  		for(i=0;i<n;i++){
+  			float freqbuf;
+  			float cell=75/(float)freq_bfn128[i];
+  		    for(j=1; j<=freq_bfn128[i]; j++){
+    			freqbuf = logmdct[i]-(cell*j);
+				if((tempmdct[i+j] < freqbuf) && (mdctbuf_flag == 1))
+				 tempmdct[i+j] += (5./(float)freq_bfn128[i+j]);
+			}
+		}
+  	}else if((n == 256) && !modenumber && !blocktype){
+  		// for q-1/-2 44.1kHz/48kHz
+  		if(!lW_blocktype && !lW_modenumber){ /* last window "short" - type "impulse" */
+  			m3_count = 6;
+  			if(lW_no < 4){
+  				/* impulse - @impulse case1 */
+  				noise_rate = 0.4-(float)(lW_no-1)/11;
+  				noise_center = (float)(lW_no*m3_count+12);
+  				tone_rate = 8-lW_no*2;
+  			}else{
+  				/* impulse - @impulse case2 */
+  				noise_rate = 0.2;
+  				noise_center = 30;
+  				tone_rate = 0;
+  			}
+  			if(mdctbuf_flag == 1){
+  				for(i=0; i<256; i++) tempmdct[i] -= 10;
+  			}
+  		}else{ /* non_impulse - @Short(impulse) case */
+  			noise_rate = 0.6;
+  			noise_center = 12;
+  			tone_rate = 8.;
+  			if(mdctbuf_flag == 1){
+  				for(i=0; i<256; i++) tempmdct[i] = lastmdct[i] - 10;
+  			}
   		}
-  	}else{ /* non_impulse - @Short(impulse) case */
-  		noise_rate = 0.7;
-  		noise_center = 0;
-  		if(offset_select == 1){
-  			for(i=0; i<128; i++) tempmdct[i] = lastmdct[i] - 5;
-  		}
+  		noise_rate_low = 0;
+  		m3_sw = 1;
+  		if(padnum)noise_rate*=.5;
+  		for(i=0;i<n;i++){
+  			float freqbuf;
+  			float cell=75/(float)freq_bfn256[i];
+  			for(j=1; j<=freq_bfn256[i]; j++){
+    			freqbuf = logmdct[i]-(cell*j);
+				if((tempmdct[i+j] < freqbuf) &&(mdctbuf_flag == 1))
+				 tempmdct[i+j] += (10./(float)freq_bfn256[i+j]);
+			}
+		}
+  	}else m3_sw = 0;
+  	
+  	/** M4 PRE **/
+  	if(p->vi->normal_thresh>1.){
+  		m4_start = 9999;
+  	}else{
+  		if(m4_end>end_block)m4_lp_pos=m4_end;
+  		else m4_lp_pos=end_block;
   	}
-  	noise_rate_low = 0;
-  	it_sw = 1;
-  }else{
-  	it_sw = 0;
   }
   
-  /** @ M3&M4 PRE **/
-  if(cx < 0.5){
-  	it_sw = 0; /* for M3 */
-  	m4_end=end_block; /* for M4 */
-  }else if(p->vi->normal_thresh>1.){
-  	m4_start = 9999;
-  }else{
-  	if(m4_end>end_block)lp_pos=m4_end;
-  	else lp_pos=end_block;
-  }
-
   for(i=0;i<n;i++){
     float val= noise[i]+p->noiseoffset[offset_select][i];
     float tval= tone[i]+toneatt;
@@ -1034,33 +1140,42 @@
     if(m2_sw){
     	// the conspicuous low level pre-echo of the padding block origin is reduced. 
     	if((logmdct[i]-lastmdct[i]) > 20){
-    		if(i > m3n[3]) val -= (logmdct[i]-lastmdct[i]-20)/padth;
-    		else val -= (logmdct[i]-lastmdct[i]-20)/(padth+padth);
+    		if(i > m3n[3]) val -= (logmdct[i]-lastmdct[i]-20)/m2_sw;
+    		else val -= (logmdct[i]-lastmdct[i]-20)/(m2_sw+m2_sw);
     	}
     }
     
     /* AoTuV */
     /** @ M3 MAIN **
-    Dynamic impulse block noise control. (#4)
+    Dynamic impulse block noise control. (#6)
     48/44.1/32kHz only.
-    by Aoyumi @ 2006/02/02
+    by Aoyumi @ 2007/07/27
     */
-    if(it_sw){
-    	for(j=1; j<=temp_bfn[i]; j++){
-    		float tempbuf = logmdct[i]-(75/temp_bfn[i]*j)-5;
-			if( (tempmdct[i+j] < tempbuf) && (tempmdct[i+j] < (logmdct[i+j]-5)) )
-			 tempmdct[i+j] = logmdct[i+j] - 5;
-		}
-    	if(val > tval){
+    if(m3_sw){
+    	if(val>tval){
     		if( (val>lastmdct[i]) && (logmdct[i]>(tempmdct[i]+noise_center)) ){
+    			int toneac=0;
     			float valmask=0;
-    			tempmdct[i] = logmdct[i];
     			
+    			if(mdctbuf_flag == 1)tempmdct[i] = logmdct[i]; // reset
     			if(logmdct[i]>lastmdct[i]){
     				rate_mod = noise_rate;
     			}else{
     				rate_mod = noise_rate_low;
 				}
+				
+				if( !padnum && (i<m4_end) && ((val-lastmdct[i])>20) ){
+					float dBsub=(logmdct[i]-lastmdct[i]);
+					if(dBsub>25){
+						toneac=1;
+						if(tval>-100){
+							float tr_cur=tone_rate;
+							if(dBsub<(25+tr_cur)) tr_cur=dBsub-25;
+							else tval-=tr_cur;
+							if(tval<-100)tval=-100;
+						}
+					}
+				}
 				if(i > m3n[1]){
 						if((val-tval)>30) valmask=((val-tval-30)/10+30)*rate_mod;
 						else valmask=(val-tval)*rate_mod;
@@ -1076,14 +1191,15 @@
 				}
 				if((val-valmask)>lastmdct[i])val-=valmask;
 				else val=lastmdct[i];
+				
+				if( toneac && ((val-lastmdct[i])>20) ){
+					val-=(val-lastmdct[i]-20)*.2;
+				}
 			}
    		}
    	}
    	
-   	/* This affects calculation of a floor curve. */
-   	if(i>=lp_pos)logmdct[i]=-160;
-   	
-     /* AoTuV */
+    /* AoTuV */
 	/** @ M4 MAIN **
 	The purpose of this portion is working Noise Normalization more correctly. 
 	(There is this in order to prevent extreme boost of floor)
@@ -1095,7 +1211,7 @@
     //logmask[i]=max(val,tval);
     if(val>tval){
 		logmask[i]=val;
-	}else if((i>m4_start) && (i<m4_end) && (logmdct[i]>-140)){
+	}else if((i>m4_start) && (i<m4_end) && (logmdct[i]>-140)){ // -140dB(test OK)
 		if(logmdct[i]>val){
 			if(logmdct[i]<tval)tval-=(tval-val)*m4_thres;
 		}else{
@@ -1143,10 +1259,16 @@
   }
 
   /** @ M3 SET lastmdct **/
-  if(offset_select == 1){
-	if(n == 1024){
+  if((mdctbuf_flag==1) && (cx >= 0.5)){
+  	if((n == 128) || (n == 256)){
+		for(i=0; i<n; i++) lastmdct[i] = logmdct[i];
+	}else{
 		if(!nW_modenumber){
-			for(i=0; i<128; i++){
+			int nsh;
+			if(n == 1024) nsh=128;
+			else nsh=256;
+			
+			for(i=0; i<nsh; i++){
 				lastmdct[i] = logmdct[i*8];
 				for(j=1; j<8; j++){
 					if(lastmdct[i] > logmdct[i*8+j]){
@@ -1155,10 +1277,11 @@
 				}
 			}
 		}
-	}else if(n == 128){
-		for(i=0; i<128; i++) lastmdct[i] = logmdct[i];
 	}
   }
+  /* This affects calculation of a floor curve. */
+  for(i=m4_lp_pos; i<n; i++)logmdct[i]=-160;
+  
 }
 
 float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
@@ -1479,8 +1602,9 @@
 }
 
 void _vp_noise_normalize(vorbis_look_psy *p,
-			 float *in,float *out,int *sortedindex){
-  int i,j=0,n=p->n,min_energy;
+			 float *in,float *out,int *sortedindex,
+			 int blocktype, int modenumber){
+  int i,j=0,n=p->n;
   vorbis_info_psy *vi=p->vi;
   int partition=vi->normal_partition;
   int start=vi->normal_start;
@@ -1495,9 +1619,11 @@
       float acc=0.;
       int k;
       int energy_loss=0;
-      int nn_num=0;
-      int freqband_mid=j+16;
-      int freqband_flag=0;
+      int nn_count=0;
+      int div_low=j+p->nn25pt;
+	  int div_high=j+p->nn75pt;
+	  int low_flag=0;
+	  int high_flag=0;
       
       for(i=j;i<j+partition;i++){
         if(rint(in[i])==0.f){
@@ -1505,19 +1631,24 @@
         	energy_loss++;
         }
       }
-      /* When an energy loss is large, NN processing is carried out in the middle of partition. */
-      /*if(energy_loss==32 && fabs(in[freqband_mid])>nnmid_th){
-      	if(in[freqband_mid]*in[freqband_mid]<.25f){
-      		i=0;
-      		if(acc>=vi->normal_thresh){
-      			out[freqband_mid]=unitnorm(in[freqband_mid]);
+      
+      /* partition is 8 or 32 */
+      if(partition==8){ div_low--; div_high--; }
+      
+      /* Expansion of Noise Normalization.  by Aoyumi */
+	  /* When the energy loss of a partition is large, 
+	     NN is performed in the middle of partition. (without impulse block) */
+      if((energy_loss==partition) && !(!modenumber && !blocktype)){
+	  	for(k=div_low; k<=div_high ;k+=p->nn50pt){
+      		if(acc>=vi->normal_thresh && fabs(in[k])>nnmid_th){
+      			out[k]=unitnorm(in[k]);
       			acc-=1.;
-      			freqband_flag=1;
-      			nn_num++;
+      			nn_count++;
+	  			if(k==div_low)low_flag=k;
+	  			else high_flag=k;
       		}
       	}
-      }*/
-      
+      }
       /* NN main */
       for(i=0;i<partition;i++){
       	k=sortedindex[i+j-start];
@@ -1526,31 +1657,26 @@
       		//acc-=in[k]*in[k];
       	}else{
       		if(acc<vi->normal_thresh)break;
-      		if(freqband_flag && freqband_mid==k)continue;
+      		if(low_flag==k || high_flag==k)continue;
       		out[k]=unitnorm(in[k]);
       		acc-=1.;
-      		nn_num++;
+      		nn_count++;
       	}
       }
       
       /* The minimum energy complement */
-      /*min_energy=32-energy_loss+nn_num;
-      if(min_energy<2 || (j<=p->min_nn_lp && min_energy==2)){
-      	k=sortedindex[i+j-start];
-      	if(freqband_flag && freqband_mid==k){
-      		i++;
-      		k=sortedindex[i+j-start];
-	    }
-	    if(!(fabs(in[k])<0.3)){
+	  if(modenumber && (energy_loss==partition) && (j<=p->min_nn_lp) && (nn_count)){
+	    k=sortedindex[i+j-start];
+	    if(fabs(in[k])>=p->nn_mec_m){
 	    	out[k]=unitnorm(in[k]);
 	    	i++;
 	    }
-	  }*/
+	  }
 	  
 	  // The last process
       for(;i<partition;i++){
       	k=sortedindex[i+j-start];
-      	if(freqband_flag && freqband_mid==k)continue;
+      	if(low_flag==k || high_flag==k)continue;
       	else out[k]=0.;
       }
     }
@@ -1571,10 +1697,11 @@
 		int   **ifloor,
 		int   *nonzero,
 		int  sliding_lowpass,
+		int blocktype, int modenumber,
 		float **mdct, float **res_org){
 
   int i,j,k,n=p->n;
-
+  
   /* perform any requested channel coupling */
   /* point stereo can only be used in a first stage (in this encoder)
      because of the dependency on floor lookups */
@@ -1610,8 +1737,7 @@
       float postpoint_backup;
       float st_thresh;
       int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
-      int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
-      int pointlimit=limit;
+      int pointlimit=g->coupling_pointlimit[p->vi->blockflag][blobno];
       int freqlimit=p->st_freqlimit;
       unsigned char Mc_treshp[2048];
       unsigned char Ac_treshp[2048];
@@ -1644,8 +1770,8 @@
       	st_thresh=.1;
       	if(p->m_val<.5){
       		// low frequency limit
-      		if(stcont_start<limit)stcont_start=limit;
-      	}else if(p->vi->normal_thresh>1.)st_thresh=.5;
+      		if(stcont_start<pointlimit)stcont_start=pointlimit;
+      	}else if(p->vi->normal_thresh>1.)st_thresh=.25;
       	for(j=0;j<=freqlimit;j++){ // or j<n
       		if(fabs(rM[j])<st_thresh)Mc_treshp[j]=1;
       		else Mc_treshp[j]=0;
@@ -1658,7 +1784,6 @@
 	float acc=0.f;
 	float rpacc;
 	int energy_loss=0;
-	int nn_num=0;
 
 	for(k=0;k<partition;k++){
 	  int l=k+j;
@@ -1674,7 +1799,7 @@
 	  float shighA=0.f;
 	  float rMs=fabs(rMo[l]);
       float rAs=fabs(rAo[l]);
-
+      
 	  postpoint=postpoint_backup;
 	  
 	  /* AoTuV */
@@ -1687,9 +1812,13 @@
 	  	int lof_num;
 	  	int hif_num;
 	  	
-	  	// (It may be better to calculate this in advance) 
-	  	lof_st=l-(l/2)*.167;
-	  	hif_st=l+l*.167;
+	  	lof_st=LOF_TABLE[l];
+	  	hif_st=HIF_TABLE[l];
+	  	/*** original calc.
+	  	float magicnum=.175; // 0.16`0.19
+	  	lof_st=l-(l/2)*(magicnum*.5);
+	  	hif_st=l+l*magicnum;
+	  	****/
 	  
 	  	hif_stcopy=hif_st;
 	  	
@@ -1703,34 +1832,43 @@
 	  			
 	  			// low freq.(lower)
 	  			lof_num=lof_st-old_lof_st;
-	  			if(lof_num==0){
-	  				Afreq_num+=Ac_treshp[l-1];
-	  				Mfreq_num+=Mc_treshp[l-1];
-	  			}else if(lof_num==1){
-	  				Afreq_num+=Ac_treshp[l-1];
-	  				Mfreq_num+=Mc_treshp[l-1];
-	  				Afreq_num-=Ac_treshp[old_lof_st];
-	  				Mfreq_num-=Mc_treshp[old_lof_st];
-	  			}//else puts("err. low");
+	  			switch(lof_num){
+	  				case 0:
+	  					Afreq_num+=Ac_treshp[l-1];
+	  					Mfreq_num+=Mc_treshp[l-1];
+	  					break;
+	  				case 1:
+	  					Afreq_num+=Ac_treshp[l-1];
+	  					Mfreq_num+=Mc_treshp[l-1];
+	  					Afreq_num-=Ac_treshp[old_lof_st];
+	  					Mfreq_num-=Mc_treshp[old_lof_st];
+	  					break;
+	  				default:/* puts("err. low") */;break;
+	  			}
 	  			
 	  			// high freq.(higher)
 	  			hif_num=hif_st-old_hif_st;
-	  			if(hif_num==0){
-	  				Afreq_num-=Ac_treshp[l];
-	  				Mfreq_num-=Mc_treshp[l];
-	  			}else if(hif_num==1){
-	  				Afreq_num-=Ac_treshp[l];
-	  				Mfreq_num-=Mc_treshp[l];
-	  				Afreq_num+=Ac_treshp[hif_st];
-	  				Mfreq_num+=Mc_treshp[hif_st];
-	  			}else if(hif_num==2){
-	  				Afreq_num-=Ac_treshp[l];
-	  				Mfreq_num-=Mc_treshp[l];
-	  				Afreq_num+=Ac_treshp[hif_st];
-	  				Mfreq_num+=Mc_treshp[hif_st];
-	  				Afreq_num+=Ac_treshp[hif_st-1];
-	  				Mfreq_num+=Mc_treshp[hif_st-1];
-	  			}//else puts("err. high");
+	  			switch(hif_num){
+	  				case 0:
+	  					Afreq_num-=Ac_treshp[l];
+	  					Mfreq_num-=Mc_treshp[l];
+	  					break;
+	  				case 1:
+	  					Afreq_num-=Ac_treshp[l];
+	  					Mfreq_num-=Mc_treshp[l];
+	  					Afreq_num+=Ac_treshp[hif_st];
+	  					Mfreq_num+=Mc_treshp[hif_st];
+	  					break;
+	  				case 2:
+	  					Afreq_num-=Ac_treshp[l];
+	  					Mfreq_num-=Mc_treshp[l];
+	  					Afreq_num+=Ac_treshp[hif_st];
+	  					Mfreq_num+=Mc_treshp[hif_st];
+	  					Afreq_num+=Ac_treshp[hif_st-1];
+	  					Mfreq_num+=Mc_treshp[hif_st-1];
+	  					break;
+	  				default:/* puts("err. high") */;break;
+	  			}
 	  		}
 	  	}else{
 	  		for(m=lof_st; m<=hif_st; m++){
@@ -1739,7 +1877,7 @@
 	  			if(Mc_treshp[m]) Mfreq_num++;
 			}
 	  	}
-	  	if(l>=limit){
+	  	if(l>=pointlimit){
 	  		shigh=sth_high/(hif_stcopy-lof_st);
 	  		shighA=shigh*Afreq_num;
 	  		shighM=shigh*Mfreq_num;
@@ -1758,7 +1896,7 @@
 	  	old_hif_st=hif_st;
 	  }
 
-	  if(l>=limit){
+	  if(l>=pointlimit){
 	    postpoint-=shigh;
 	    /* The following prevents an extreme reduction of residue. (2ch stereo only) */
 	  	if( ((a>0.) && (b<0.)) || ((b>0.) && (a<0.)) ){
@@ -1772,7 +1910,7 @@
 	  }
 	  
 	  if(l<sliding_lowpass){
-	    if((l>=limit && rMs<postpoint && rAs<postpoint) ||
+	    if((l>=pointlimit && rMs<postpoint && rAs<postpoint) ||
 	       (rMs<(prepoint-slowM) && rAs<(prepoint-slowA))){
 
 
@@ -1783,7 +1921,7 @@
 	      //if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
 	      if(rint(qM[l])==0.f){
 	      	energy_loss++;
-	      	if(l>=limit)acc+=qM[l]*qM[l];
+	      	if(l>=pointlimit)acc+=qM[l]*qM[l];
 	      }
 	    }else{
 	      couple_lossless(rM[l],rA[l],qM+l,qA+l);
@@ -1794,59 +1932,57 @@
 	  }
 	}
 
-	if(p->vi->normal_point_p){
-	  int freqband_mid=j+16;
-	  int freqband_flag=0;
-	  int min_energy;
+	/* Expansion of Noise Normalization(for point stereo).  by Aoyumi */
+	if(p->vi->normal_point_p && p->vi->normal_start!=9999){
+	  int div_low=j+p->nn25pt;
+	  int div_high=j+p->nn75pt;
+	  int low_flag=0;
+	  int high_flag=0;
+	  int nn_count=0;
+	  int l; // k=parttion counter. l=mdct counter. j=partition block counter
 	  
+	  /* partition is 8 or 32 */
+	  if(partition==8){ div_low--; div_high--; }
 	  rpacc=acc;
-	  /* When the energy loss of a partition is large, NN is performed in the middle of partition.
-	      for 48/44.1/32kHz */
-	  if(energy_loss==32 && fabs(qM[freqband_mid])>nnmid_th && acc>=p->vi->normal_thresh
-	   && freqband_mid<sliding_lowpass && freqband_mid>=pointlimit && rint(qM[freqband_mid])==0.f){
-	  	if( ((mdctM[freqband_mid]>0.) && (mdctA[freqband_mid]<0.)) ||
-	  	 ((mdctA[freqband_mid]>0.) && (mdctM[freqband_mid]<0.)) ){
-	  	 acc-=1.f;
-	  	 rpacc-=1.32;
-	  	}else{
-	  	 acc-=1.f;
-	  	 rpacc-=1.f;
+	  
+	  /* When the energy loss of a partition is large, 
+	     NN is performed in the middle of partition. (without impulse block) */
+	  if((energy_loss==partition) && !(!modenumber && !blocktype)){
+	  	for(l=div_low; l<=div_high ;l+=p->nn50pt){
+	  		if(l>=pointlimit && acc>=p->vi->normal_thresh && 
+	  		 fabs(qM[l])>nnmid_th && l<sliding_lowpass){
+	  			if( ((mdctM[l]>0.) && (mdctA[l]<0.)) || ((mdctA[l]>0.) && (mdctM[l]<0.)) ){
+	  				acc-=1.f;  rpacc-=1.25;
+	  			}else{
+	  		 		acc-=1.f;  rpacc-=1.f;
+	  			}
+	  			qM[l]=unitnorm(qM[l]);
+	  			nn_count++;
+	  			if(l==div_low)low_flag=l;
+	  			else high_flag=l;
+	  		}
 	  	}
-	  	qM[freqband_mid]=unitnorm(qM[freqband_mid]);
-	  	freqband_flag=1;
-	  	nn_num++;
 	  }
 	  /* NN main (point stereo) */
 	  for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
-	    int l;
 	    l=mag_sort[i][j+k];
-	    if(freqband_mid==l && freqband_flag)continue;
 	    if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
+	      if(low_flag==l || high_flag==l)continue;
 	      if( ((mdctM[l]>0.) && (mdctA[l]<0.)) || ((mdctA[l]>0.) && (mdctM[l]<0.)) ){
 	        if(rpacc<p->vi->normal_thresh)continue;
-	        acc-=1.f;
-	        rpacc-=1.32;
+	        acc-=1.f;  rpacc-=1.25;
 	      }else{
-	        acc-=1.f;
-	        rpacc-=1.f;
+	        acc-=1.f;  rpacc-=1.f;
 	      }
 	      qM[l]=unitnorm(qM[l]);
-	      nn_num++;
+	      nn_count++;
 	    }
 	  }
-	  /* The minimum energy complement.
-	      for 48/44.1/32kHz */
-	  min_energy=32-energy_loss+nn_num;
-	  if(min_energy<2 || (j<=p->min_nn_lp && min_energy==2)){
-	  	int l;
-	  	float ab;
+	  /* The minimum energy complement. (long & trans. block) */
+	  if(modenumber && (energy_loss==partition) && (j<=p->min_nn_lp) && (nn_count)){
 	    for(;k<partition;k++){
 	    	l=mag_sort[i][j+k];
-	    	ab=fabs(qM[l]);
-	    	if(ab<0.04)break;
-	    	if( ((mdctM[l]>0.) && (mdctA[l]<0.)) || ((mdctA[l]>0.) && (mdctM[l]<0.))
-	    	 && ab<0.11)break; // 0.11
-	    	if(rint(qM[l])==0.f && l>=pointlimit){
+	    	if((l>=pointlimit) && (rint(qM[l])==0.f) && (fabs(rM[l]+rA[l])>=p->nn_mec_s)){
 	    		qM[l]=unitnorm(qM[l]);
 	    		break;
 	    	}

Modified: branches/vorbis-aotuv/lib/psy.h
===================================================================
--- branches/vorbis-aotuv/lib/psy.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/psy.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -119,12 +119,17 @@
   int tonecomp_endp; /* for M4 */
   int min_nn_lp; /* for M6 */
   float tonecomp_thres; /* for M4 */
+  float nn_mec_s; /* minimum energy complement for noise normalization [stereo] */
+  float nn_mec_m; /* minimum energy complement for noise normalization [mono] */
   float m_val; /* masking compensation value */
   
   int st_freqlimit; /* for M6 */
-  int n25p;
-  int n33p;
-  int n75p;
+  int n25p; /* mdct n(25%) */
+  int n33p; /* mdct n(33%) */
+  int n75p; /* mdct n(75%) */
+  int nn75pt; /* 75 % partition for noise  normalization */
+  int nn50pt; /* half partition for noise normalization */
+  int nn25pt; /* quarter partition for noise normalization */
 
 } vorbis_look_psy;
 
@@ -157,6 +162,7 @@
 			       float *noise,
 			       float *tone,
 			       int offset_select,
+			       int bit_managed,
 			       float *logmask,
 			       float *mdct,
 			       float *logmdct,
@@ -165,7 +171,7 @@
 			       int end_block,
 			       int blocktype, int modenumber,
 			       int nW_modenumber,
-			       int lW_blocktype, int lW_modenumber, int lW_no);
+			       int lW_blocktype, int lW_modenumber, int lW_no, int padnum);
 
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
@@ -185,10 +191,12 @@
 		       int   **ifloor,
 		       int   *nonzero,
 		       int   sliding_lowpass,
+		       int blocktype, int modenumber,
 		       float **mdct, float **res_org);
 
 extern void _vp_noise_normalize(vorbis_look_psy *p,
-				float *in,float *out,int *sortedindex);
+				float *in,float *out,int *sortedindex,
+				int blocktype, int modenumber);
 
 extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
 				     float *magnitudes,int *sortedindex);

Added: branches/vorbis-aotuv/lib/psy_table.h
===================================================================
--- branches/vorbis-aotuv/lib/psy_table.h	                        (rev 0)
+++ branches/vorbis-aotuv/lib/psy_table.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,521 @@
+/* aoTuV */
+
+/* M6 table */
+static short LOF_TABLE[4096]={
+   0,   1,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
+  15,  16,  17,  18,  19,  20,  21,  22,  22,  23,  24,  25,  26,  27,  28,  29,
+  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  43,  44,
+  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,
+  61,  62,  63,  64,  65,  66,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,
+  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  87,  88,  89,  90,
+  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 131, 132, 133, 134, 135, 136,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
+ 153, 154, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 175, 175, 176, 177, 178, 179, 180, 181, 182,
+ 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 196, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
+ 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
+ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 240, 241, 242, 243,
+ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
+ 260, 261, 262, 263, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 284, 285, 286, 287, 288, 289,
+ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
+ 306, 307, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,
+ 321, 322, 323, 324, 325, 326, 327, 328, 328, 329, 330, 331, 332, 333, 334, 335,
+ 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 349, 350,
+ 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
+ 367, 368, 369, 370, 371, 372, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381,
+ 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 393, 394, 395, 396,
+ 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412,
+ 413, 414, 415, 416, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427,
+ 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 437, 438, 439, 440, 441, 442,
+ 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458,
+ 459, 460, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473,
+ 474, 475, 476, 477, 478, 479, 480, 481, 481, 482, 483, 484, 485, 486, 487, 488,
+ 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 502, 503,
+ 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519,
+ 520, 521, 522, 523, 524, 525, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534,
+ 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 546, 547, 548, 549,
+ 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565,
+ 566, 567, 568, 569, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580,
+ 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 590, 591, 592, 593, 594, 595,
+ 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611,
+ 612, 613, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626,
+ 627, 628, 629, 630, 631, 632, 633, 634, 634, 635, 636, 637, 638, 639, 640, 641,
+ 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 655, 656,
+ 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672,
+ 673, 674, 675, 676, 677, 678, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687,
+ 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 699, 700, 701, 702,
+ 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718,
+ 719, 720, 721, 722, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733,
+ 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 743, 744, 745, 746, 747, 748,
+ 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764,
+ 765, 766, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779,
+ 780, 781, 782, 783, 784, 785, 786, 787, 787, 788, 789, 790, 791, 792, 793, 794,
+ 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 808, 809,
+ 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
+ 826, 827, 828, 829, 830, 831, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840,
+ 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 852, 853, 854, 855,
+ 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871,
+ 872, 873, 874, 875, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886,
+ 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 896, 897, 898, 899, 900, 901,
+ 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917,
+ 918, 919, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932,
+ 933, 934, 935, 936, 937, 938, 939, 940, 940, 941, 942, 943, 944, 945, 946, 947,
+ 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 961, 962,
+ 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978,
+ 979, 980, 981, 982, 983, 984, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993,
+ 994, 995, 996, 997, 998, 999,1000,1001,1002,1003,1004,1005,1005,1006,1007,1008,
+1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,
+1025,1026,1027,1028,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,
+1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1049,1050,1051,1052,1053,1054,
+1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
+1071,1072,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
+1086,1087,1088,1089,1090,1091,1092,1093,1093,1094,1095,1096,1097,1098,1099,1100,
+1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1114,1115,
+1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,
+1132,1133,1134,1135,1136,1137,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,
+1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1158,1159,1160,1161,
+1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,
+1178,1179,1180,1181,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,
+1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1202,1203,1204,1205,1206,1207,
+1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,
+1224,1225,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,
+1239,1240,1241,1242,1243,1244,1245,1246,1246,1247,1248,1249,1250,1251,1252,1253,
+1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1267,1268,
+1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,
+1285,1286,1287,1288,1289,1290,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,
+1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1311,1312,1313,1314,
+1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,
+1331,1332,1333,1334,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,
+1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1355,1356,1357,1358,1359,1360,
+1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,
+1377,1378,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,
+1392,1393,1394,1395,1396,1397,1398,1399,1399,1400,1401,1402,1403,1404,1405,1406,
+1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1420,1421,
+1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,
+1438,1439,1440,1441,1442,1443,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,
+1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1464,1465,1466,1467,
+1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,
+1484,1485,1486,1487,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,
+1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1508,1509,1510,1511,1512,1513,
+1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,
+1530,1531,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,
+1545,1546,1547,1548,1549,1550,1551,1552,1552,1553,1554,1555,1556,1557,1558,1559,
+1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1573,1574,
+1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,
+1591,1592,1593,1594,1595,1596,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,
+1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1617,1618,1619,1620,
+1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,
+1637,1638,1639,1640,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,
+1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1661,1662,1663,1664,1665,1666,
+1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,
+1683,1684,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,
+1698,1699,1700,1701,1702,1703,1704,1705,1705,1706,1707,1708,1709,1710,1711,1712,
+1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1726,1727,
+1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,
+1744,1745,1746,1747,1748,1749,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,
+1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1770,1771,1772,1773,
+1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,
+1790,1791,1792,1793,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,
+1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1814,1815,1816,1817,1818,1819,
+1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,
+1836,1837,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,
+1851,1852,1853,1854,1855,1856,1857,1858,1858,1859,1860,1861,1862,1863,1864,1865,
+1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1879,1880,
+1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,
+1897,1898,1899,1900,1901,1902,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,
+1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1923,1924,1925,1926,
+1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,
+1943,1944,1945,1946,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,
+1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1967,1968,1969,1970,1971,1972,
+1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,
+1989,1990,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,
+2004,2005,2006,2007,2008,2009,2010,2011,2011,2012,2013,2014,2015,2016,2017,2018,
+2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2032,2033,
+2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,
+2050,2051,2052,2053,2054,2055,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,
+2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2076,2077,2078,2079,
+2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,
+2096,2097,2098,2099,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,
+2111,2112,2113,2114,2115,2116,2117,2118,2119,2120,2120,2121,2122,2123,2124,2125,
+2126,2127,2128,2129,2130,2131,2132,2133,2134,2135,2136,2137,2138,2139,2140,2141,
+2142,2143,2143,2144,2145,2146,2147,2148,2149,2150,2151,2152,2153,2154,2155,2156,
+2157,2158,2159,2160,2161,2162,2163,2164,2164,2165,2166,2167,2168,2169,2170,2171,
+2172,2173,2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,2184,2185,2185,2186,
+2187,2188,2189,2190,2191,2192,2193,2194,2195,2196,2197,2198,2199,2200,2201,2202,
+2203,2204,2205,2206,2207,2208,2208,2209,2210,2211,2212,2213,2214,2215,2216,2217,
+2218,2219,2220,2221,2222,2223,2224,2225,2226,2227,2228,2229,2229,2230,2231,2232,
+2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,
+2249,2250,2251,2252,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,
+2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2273,2274,2275,2276,2277,2278,
+2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2290,2291,2292,2293,2294,
+2295,2296,2296,2297,2298,2299,2300,2301,2302,2303,2304,2305,2306,2307,2308,2309,
+2310,2311,2312,2313,2314,2315,2316,2317,2317,2318,2319,2320,2321,2322,2323,2324,
+2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2337,2338,2338,2339,
+2340,2341,2342,2343,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,
+2356,2357,2358,2359,2360,2361,2361,2362,2363,2364,2365,2366,2367,2368,2369,2370,
+2371,2372,2373,2374,2375,2376,2377,2378,2379,2380,2381,2382,2382,2383,2384,2385,
+2386,2387,2388,2389,2390,2391,2392,2393,2394,2395,2396,2397,2398,2399,2400,2401,
+2402,2403,2404,2405,2405,2406,2407,2408,2409,2410,2411,2412,2413,2414,2415,2416,
+2417,2418,2419,2420,2421,2422,2423,2424,2425,2426,2426,2427,2428,2429,2430,2431,
+2432,2433,2434,2435,2436,2437,2438,2439,2440,2441,2442,2443,2444,2445,2446,2447,
+2448,2449,2449,2450,2451,2452,2453,2454,2455,2456,2457,2458,2459,2460,2461,2462,
+2463,2464,2465,2466,2467,2468,2469,2470,2470,2471,2472,2473,2474,2475,2476,2477,
+2478,2479,2480,2481,2482,2483,2484,2485,2486,2487,2488,2489,2490,2491,2491,2492,
+2493,2494,2495,2496,2497,2498,2499,2500,2501,2502,2503,2504,2505,2506,2507,2508,
+2509,2510,2511,2512,2513,2514,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,
+2524,2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2535,2536,2537,2538,
+2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,
+2555,2556,2557,2558,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,
+2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2579,2580,2581,2582,2583,2584,
+2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,
+2601,2602,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,
+2616,2617,2618,2619,2620,2621,2622,2623,2623,2624,2625,2626,2627,2628,2629,2630,
+2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2644,2645,
+2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,
+2662,2663,2664,2665,2666,2667,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,
+2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2688,2689,2690,2691,
+2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,
+2708,2709,2710,2711,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,
+2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2732,2733,2734,2735,2736,2737,
+2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,
+2754,2755,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,
+2769,2770,2771,2772,2773,2774,2775,2776,2776,2777,2778,2779,2780,2781,2782,2783,
+2784,2785,2786,2787,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2797,2798,
+2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,
+2815,2816,2817,2818,2819,2820,2820,2821,2822,2823,2824,2825,2826,2827,2828,2829,
+2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2841,2842,2843,2844,
+2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,
+2861,2862,2863,2864,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,
+2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2885,2886,2887,2888,2889,2890,
+2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,
+2907,2908,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,
+2922,2923,2924,2925,2926,2927,2928,2929,2929,2930,2931,2932,2933,2934,2935,2936,
+2937,2938,2939,2940,2941,2942,2943,2944,2945,2946,2947,2948,2949,2950,2950,2951,
+2952,2953,2954,2955,2956,2957,2958,2959,2960,2961,2962,2963,2964,2965,2966,2967,
+2968,2969,2970,2971,2972,2973,2973,2974,2975,2976,2977,2978,2979,2980,2981,2982,
+2983,2984,2985,2986,2987,2988,2989,2990,2991,2992,2993,2994,2994,2995,2996,2997,
+2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,
+3014,3015,3016,3017,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,
+3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3038,3039,3040,3041,3042,3043,
+3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3056,3057,3058,3059,
+3060,3061,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071,3072,3073,3074,
+3075,3076,3077,3078,3079,3080,3081,3082,3082,3083,3084,3085,3086,3087,3088,3089,
+3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3103,3104,
+3105,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119,3120,
+3121,3122,3123,3124,3125,3126,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,
+3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3147,3148,3149,3150,
+3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,
+3167,3168,3169,3170,3170,3171,3172,3173,3174,3175,3176,3177,3178,3179,3180,3181,
+3182,3183,3184,3185,3186,3187,3188,3189,3190,3191,3191,3192,3193,3194,3195,3196,
+3197,3198,3199,3200,3201,3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,
+3213,3214,3214,3215,3216,3217,3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,
+3228,3229,3230,3231,3232,3233,3234,3235,3235,3236,3237,3238,3239,3240,3241,3242,
+3243,3244,3245,3246,3247,3248,3249,3250,3251,3252,3253,3254,3255,3256,3256,3257,
+3258,3259,3260,3261,3262,3263,3264,3265,3266,3267,3268,3269,3270,3271,3272,3273,
+3274,3275,3276,3277,3278,3279,3279,3280,3281,3282,3283,3284,3285,3286,3287,3288,
+3289,3290,3291,3292,3293,3294,3295,3296,3297,3298,3299,3300,3300,3301,3302,3303,
+3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,
+3320,3321,3322,3323,3323,3324,3325,3326,3327,3328,3329,3330,3331,3332,3333,3334,
+3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3344,3345,3346,3347,3348,3349,
+3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,3361,3362,3363,3364,3365,
+3366,3367,3367,3368,3369,3370,3371,3372,3373,3374,3375,3376,3377,3378,3379,3380,
+3381,3382,3383,3384,3385,3386,3387,3388,3388,3389,3390,3391,3392,3393,3394,3395,
+3396,3397,3398,3399,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3409,3410,
+3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,
+3427,3428,3429,3430,3431,3432,3432,3433,3434,3435,3436,3437,3438,3439,3440,3441,
+3442,3443,3444,3445,3446,3447,3448,3449,3450,3451,3452,3453,3453,3454,3455,3456,
+3457,3458,3459,3460,3461,3462,3463,3464,3465,3466,3467,3468,3469,3470,3471,3472,
+3473,3474,3475,3476,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486,3487,
+3488,3489,3490,3491,3492,3493,3494,3495,3496,3497,3497,3498,3499,3500,3501,3502,
+3503,3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516,3517,3518,
+3519,3520,3520,3521,3522,3523,3524,3525,3526,3527,3528,3529,3530,3531,3532,3533,
+3534,3535,3536,3537,3538,3539,3540,3541,3541,3542,3543,3544,3545,3546,3547,3548,
+3549,3550,3551,3552,3553,3554,3555,3556,3557,3558,3559,3560,3561,3562,3562,3563,
+3564,3565,3566,3567,3568,3569,3570,3571,3572,3573,3574,3575,3576,3577,3578,3579,
+3580,3581,3582,3583,3584,3585,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,
+3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3606,3607,3608,3609,
+3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,
+3626,3627,3628,3629,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,
+3641,3642,3643,3644,3645,3646,3647,3648,3649,3650,3650,3651,3652,3653,3654,3655,
+3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,
+3672,3673,3673,3674,3675,3676,3677,3678,3679,3680,3681,3682,3683,3684,3685,3686,
+3687,3688,3689,3690,3691,3692,3693,3694,3694,3695,3696,3697,3698,3699,3700,3701,
+3702,3703,3704,3705,3706,3707,3708,3709,3710,3711,3712,3713,3714,3715,3715,3716,
+3717,3718,3719,3720,3721,3722,3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,
+3733,3734,3735,3736,3737,3738,3738,3739,3740,3741,3742,3743,3744,3745,3746,3747,
+3748,3749,3750,3751,3752,3753,3754,3755,3756,3757,3758,3759,3759,3760,3761,3762,
+3763,3764,3765,3766,3767,3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,
+3779,3780,3781,3782,3782,3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,
+3794,3795,3796,3797,3798,3799,3800,3801,3802,3803,3803,3804,3805,3806,3807,3808,
+3809,3810,3811,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,3822,3823,3824,
+3825,3826,3826,3827,3828,3829,3830,3831,3832,3833,3834,3835,3836,3837,3838,3839,
+3840,3841,3842,3843,3844,3845,3846,3847,3847,3848,3849,3850,3851,3852,3853,3854,
+3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3868,3869,
+3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,
+3886,3887,3888,3889,3890,3891,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,
+3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3912,3913,3914,3915
+};
+
+
+static short HIF_TABLE[4096]={
+   0,   1,   2,   3,   4,   5,   7,   8,   9,  10,  11,  12,  14,  15,  16,  17,
+  18,  19,  21,  22,  23,  24,  25,  27,  28,  29,  30,  31,  32,  34,  35,  36,
+  37,  38,  39,  41,  42,  43,  44,  45,  46,  48,  49,  50,  51,  52,  54,  55,
+  56,  57,  58,  59,  61,  62,  63,  64,  65,  66,  68,  69,  70,  71,  72,  74,
+  75,  76,  77,  78,  79,  81,  82,  83,  84,  85,  86,  88,  89,  90,  91,  92,
+  93,  95,  96,  97,  98,  99, 101, 102, 103, 104, 105, 106, 108, 109, 110, 111,
+ 112, 113, 115, 116, 117, 118, 119, 121, 122, 123, 124, 125, 126, 128, 129, 130,
+ 131, 132, 133, 135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 146, 148, 149,
+ 150, 151, 152, 153, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 168,
+ 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 182, 183, 184, 185, 186,
+ 187, 189, 190, 191, 192, 193, 195, 196, 197, 198, 199, 200, 202, 203, 204, 205,
+ 206, 207, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 222, 223, 224,
+ 225, 226, 227, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 242, 243,
+ 244, 245, 246, 247, 249, 250, 251, 252, 253, 254, 256, 257, 258, 259, 260, 262,
+ 263, 264, 265, 266, 267, 269, 270, 271, 272, 273, 274, 276, 277, 278, 279, 280,
+ 281, 283, 284, 285, 286, 287, 289, 290, 291, 292, 293, 294, 296, 297, 298, 299,
+ 300, 301, 303, 304, 305, 306, 307, 309, 310, 311, 312, 313, 314, 316, 317, 318,
+ 319, 320, 321, 323, 324, 325, 326, 327, 328, 330, 331, 332, 333, 334, 336, 337,
+ 338, 339, 340, 341, 343, 344, 345, 346, 347, 348, 350, 351, 352, 353, 354, 356,
+ 357, 358, 359, 360, 361, 363, 364, 365, 366, 367, 368, 370, 371, 372, 373, 374,
+ 375, 377, 378, 379, 380, 381, 383, 384, 385, 386, 387, 388, 390, 391, 392, 393,
+ 394, 395, 397, 398, 399, 400, 401, 403, 404, 405, 406, 407, 408, 410, 411, 412,
+ 413, 414, 415, 417, 418, 419, 420, 421, 422, 424, 425, 426, 427, 428, 430, 431,
+ 432, 433, 434, 435, 437, 438, 439, 440, 441, 442, 444, 445, 446, 447, 448, 450,
+ 451, 452, 453, 454, 455, 457, 458, 459, 460, 461, 462, 464, 465, 466, 467, 468,
+ 469, 471, 472, 473, 474, 475, 477, 478, 479, 480, 481, 482, 484, 485, 486, 487,
+ 488, 489, 491, 492, 493, 494, 495, 497, 498, 499, 500, 501, 502, 504, 505, 506,
+ 507, 508, 509, 511, 512, 513, 514, 515, 516, 518, 519, 520, 521, 522, 524, 525,
+ 526, 527, 528, 529, 531, 532, 533, 534, 535, 536, 538, 539, 540, 541, 542, 544,
+ 545, 546, 547, 548, 549, 551, 552, 553, 554, 555, 556, 558, 559, 560, 561, 562,
+ 563, 565, 566, 567, 568, 569, 571, 572, 573, 574, 575, 576, 578, 579, 580, 581,
+ 582, 583, 585, 586, 587, 588, 589, 591, 592, 593, 594, 595, 596, 598, 599, 600,
+ 601, 602, 603, 605, 606, 607, 608, 609, 610, 612, 613, 614, 615, 616, 618, 619,
+ 620, 621, 622, 623, 625, 626, 627, 628, 629, 630, 632, 633, 634, 635, 636, 638,
+ 639, 640, 641, 642, 643, 645, 646, 647, 648, 649, 650, 652, 653, 654, 655, 656,
+ 657, 659, 660, 661, 662, 663, 665, 666, 667, 668, 669, 670, 672, 673, 674, 675,
+ 676, 677, 679, 680, 681, 682, 683, 685, 686, 687, 688, 689, 690, 692, 693, 694,
+ 695, 696, 697, 699, 700, 701, 702, 703, 704, 706, 707, 708, 709, 710, 712, 713,
+ 714, 715, 716, 717, 719, 720, 721, 722, 723, 724, 726, 727, 728, 729, 730, 732,
+ 733, 734, 735, 736, 737, 739, 740, 741, 742, 743, 744, 746, 747, 748, 749, 750,
+ 751, 753, 754, 755, 756, 757, 759, 760, 761, 762, 763, 764, 766, 767, 768, 769,
+ 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 782, 783, 784, 786, 787, 788,
+ 789, 790, 791, 793, 794, 795, 796, 797, 798, 800, 801, 802, 803, 804, 806, 807,
+ 808, 809, 810, 811, 813, 814, 815, 816, 817, 818, 820, 821, 822, 823, 824, 826,
+ 827, 828, 829, 830, 831, 833, 834, 835, 836, 837, 838, 840, 841, 842, 843, 844,
+ 845, 847, 848, 849, 850, 851, 853, 854, 855, 856, 857, 858, 860, 861, 862, 863,
+ 864, 865, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 880, 881, 882,
+ 883, 884, 885, 887, 888, 889, 890, 891, 892, 894, 895, 896, 897, 898, 900, 901,
+ 902, 903, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 920,
+ 921, 922, 923, 924, 925, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938,
+ 939, 941, 942, 943, 944, 945, 947, 948, 949, 950, 951, 952, 954, 955, 956, 957,
+ 958, 959, 961, 962, 963, 964, 965, 967, 968, 969, 970, 971, 972, 974, 975, 976,
+ 977, 978, 979, 981, 982, 983, 984, 985, 986, 988, 989, 990, 991, 992, 994, 995,
+ 996, 997, 998, 999,1001,1002,1003,1004,1005,1006,1008,1009,1010,1011,1012,1014,
+1015,1016,1017,1018,1019,1021,1022,1023,1024,1025,1026,1028,1029,1030,1031,1032,
+1033,1035,1036,1037,1038,1039,1041,1042,1043,1044,1045,1046,1048,1049,1050,1051,
+1052,1053,1055,1056,1057,1058,1059,1061,1062,1063,1064,1065,1066,1068,1069,1070,
+1071,1072,1073,1075,1076,1077,1078,1079,1080,1082,1083,1084,1085,1086,1088,1089,
+1090,1091,1092,1093,1095,1096,1097,1098,1099,1100,1102,1103,1104,1105,1106,1108,
+1109,1110,1111,1112,1113,1115,1116,1117,1118,1119,1120,1122,1123,1124,1125,1126,
+1127,1129,1130,1131,1132,1133,1135,1136,1137,1138,1139,1140,1142,1143,1144,1145,
+1146,1147,1149,1150,1151,1152,1153,1155,1156,1157,1158,1159,1160,1162,1163,1164,
+1165,1166,1167,1169,1170,1171,1172,1173,1174,1176,1177,1178,1179,1180,1182,1183,
+1184,1185,1186,1187,1189,1190,1191,1192,1193,1194,1196,1197,1198,1199,1200,1202,
+1203,1204,1205,1206,1207,1209,1210,1211,1212,1213,1214,1216,1217,1218,1219,1220,
+1221,1223,1224,1225,1226,1227,1229,1230,1231,1232,1233,1234,1236,1237,1238,1239,
+1240,1241,1243,1244,1245,1246,1247,1249,1250,1251,1252,1253,1254,1256,1257,1258,
+1259,1260,1261,1263,1264,1265,1266,1267,1268,1270,1271,1272,1273,1274,1276,1277,
+1278,1279,1280,1281,1283,1284,1285,1286,1287,1288,1290,1291,1292,1293,1294,1296,
+1297,1298,1299,1300,1301,1303,1304,1305,1306,1307,1308,1310,1311,1312,1313,1314,
+1315,1317,1318,1319,1320,1321,1323,1324,1325,1326,1327,1328,1330,1331,1332,1333,
+1334,1335,1337,1338,1339,1340,1341,1343,1344,1345,1346,1347,1348,1350,1351,1352,
+1353,1354,1355,1357,1358,1359,1360,1361,1362,1364,1365,1366,1367,1368,1370,1371,
+1372,1373,1374,1375,1377,1378,1379,1380,1381,1382,1384,1385,1386,1387,1388,1390,
+1391,1392,1393,1394,1395,1397,1398,1399,1400,1401,1402,1404,1405,1406,1407,1408,
+1409,1411,1412,1413,1414,1415,1417,1418,1419,1420,1421,1422,1424,1425,1426,1427,
+1428,1429,1431,1432,1433,1434,1435,1437,1438,1439,1440,1441,1442,1444,1445,1446,
+1447,1448,1449,1451,1452,1453,1454,1455,1456,1458,1459,1460,1461,1462,1464,1465,
+1466,1467,1468,1469,1471,1472,1473,1474,1475,1476,1478,1479,1480,1481,1482,1484,
+1485,1486,1487,1488,1489,1491,1492,1493,1494,1495,1496,1498,1499,1500,1501,1502,
+1503,1505,1506,1507,1508,1509,1511,1512,1513,1514,1515,1516,1518,1519,1520,1521,
+1522,1523,1525,1526,1527,1528,1529,1531,1532,1533,1534,1535,1536,1538,1539,1540,
+1541,1542,1543,1545,1546,1547,1548,1549,1550,1552,1553,1554,1555,1556,1558,1559,
+1560,1561,1562,1563,1565,1566,1567,1568,1569,1570,1572,1573,1574,1575,1576,1578,
+1579,1580,1581,1582,1583,1585,1586,1587,1588,1589,1590,1592,1593,1594,1595,1596,
+1597,1599,1600,1601,1602,1603,1605,1606,1607,1608,1609,1610,1612,1613,1614,1615,
+1616,1617,1619,1620,1621,1622,1623,1625,1626,1627,1628,1629,1630,1632,1633,1634,
+1635,1636,1637,1639,1640,1641,1642,1643,1644,1646,1647,1648,1649,1650,1652,1653,
+1654,1655,1656,1657,1659,1660,1661,1662,1663,1664,1666,1667,1668,1669,1670,1672,
+1673,1674,1675,1676,1677,1679,1680,1681,1682,1683,1684,1686,1687,1688,1689,1690,
+1691,1693,1694,1695,1696,1697,1699,1700,1701,1702,1703,1704,1706,1707,1708,1709,
+1710,1711,1713,1714,1715,1716,1717,1719,1720,1721,1722,1723,1724,1726,1727,1728,
+1729,1730,1731,1733,1734,1735,1736,1737,1738,1740,1741,1742,1743,1744,1746,1747,
+1748,1749,1750,1751,1753,1754,1755,1756,1757,1758,1760,1761,1762,1763,1764,1766,
+1767,1768,1769,1770,1771,1773,1774,1775,1776,1777,1778,1780,1781,1782,1783,1784,
+1785,1787,1788,1789,1790,1791,1793,1794,1795,1796,1797,1798,1800,1801,1802,1803,
+1804,1805,1807,1808,1809,1810,1811,1813,1814,1815,1816,1817,1818,1820,1821,1822,
+1823,1824,1825,1827,1828,1829,1830,1831,1832,1834,1835,1836,1837,1838,1840,1841,
+1842,1843,1844,1845,1847,1848,1849,1850,1851,1852,1854,1855,1856,1857,1858,1860,
+1861,1862,1863,1864,1865,1867,1868,1869,1870,1871,1872,1874,1875,1876,1877,1878,
+1879,1881,1882,1883,1884,1885,1887,1888,1889,1890,1891,1892,1894,1895,1896,1897,
+1898,1899,1901,1902,1903,1904,1905,1907,1908,1909,1910,1911,1912,1914,1915,1916,
+1917,1918,1919,1921,1922,1923,1924,1925,1926,1928,1929,1930,1931,1932,1934,1935,
+1936,1937,1938,1939,1941,1942,1943,1944,1945,1946,1948,1949,1950,1951,1952,1954,
+1955,1956,1957,1958,1959,1961,1962,1963,1964,1965,1966,1968,1969,1970,1971,1972,
+1973,1975,1976,1977,1978,1979,1981,1982,1983,1984,1985,1986,1988,1989,1990,1991,
+1992,1993,1995,1996,1997,1998,1999,2001,2002,2003,2004,2005,2006,2008,2009,2010,
+2011,2012,2013,2015,2016,2017,2018,2019,2020,2022,2023,2024,2025,2026,2028,2029,
+2030,2031,2032,2033,2035,2036,2037,2038,2039,2040,2042,2043,2044,2045,2046,2048,
+2049,2050,2051,2052,2053,2055,2056,2057,2058,2059,2060,2062,2063,2064,2065,2066,
+2067,2069,2070,2071,2072,2073,2075,2076,2077,2078,2079,2080,2082,2083,2084,2085,
+2086,2087,2089,2090,2091,2092,2093,2095,2096,2097,2098,2099,2100,2102,2103,2104,
+2105,2106,2107,2109,2110,2111,2112,2113,2114,2116,2117,2118,2119,2120,2122,2123,
+2124,2125,2126,2127,2129,2130,2131,2132,2133,2134,2136,2137,2138,2139,2140,2142,
+2143,2144,2145,2146,2147,2149,2150,2151,2152,2153,2154,2156,2157,2158,2159,2160,
+2161,2163,2164,2165,2166,2167,2169,2170,2171,2172,2173,2174,2176,2177,2178,2179,
+2180,2181,2183,2184,2185,2186,2187,2189,2190,2191,2192,2193,2194,2196,2197,2198,
+2199,2200,2201,2203,2204,2205,2206,2207,2208,2210,2211,2212,2213,2214,2216,2217,
+2218,2219,2220,2221,2223,2224,2225,2226,2227,2228,2230,2231,2232,2233,2234,2236,
+2237,2238,2239,2240,2241,2243,2244,2245,2246,2247,2248,2250,2251,2252,2253,2254,
+2255,2257,2258,2259,2260,2261,2263,2264,2265,2266,2267,2268,2270,2271,2272,2273,
+2274,2275,2277,2278,2279,2280,2281,2283,2284,2285,2286,2287,2288,2290,2291,2292,
+2293,2294,2295,2297,2298,2299,2300,2301,2302,2304,2305,2306,2307,2308,2310,2311,
+2312,2313,2314,2315,2317,2318,2319,2320,2321,2322,2324,2325,2326,2327,2328,2330,
+2331,2332,2333,2334,2335,2337,2338,2339,2340,2341,2342,2344,2345,2346,2347,2348,
+2349,2351,2352,2353,2354,2355,2357,2358,2359,2360,2361,2362,2364,2365,2366,2367,
+2368,2369,2371,2372,2373,2374,2375,2377,2378,2379,2380,2381,2382,2384,2385,2386,
+2387,2388,2389,2391,2392,2393,2394,2395,2396,2398,2399,2400,2401,2402,2404,2405,
+2406,2407,2408,2409,2411,2412,2413,2414,2415,2416,2418,2419,2420,2421,2422,2424,
+2425,2426,2427,2428,2429,2431,2432,2433,2434,2435,2436,2438,2439,2440,2441,2442,
+2443,2445,2446,2447,2448,2449,2451,2452,2453,2454,2455,2456,2458,2459,2460,2461,
+2462,2463,2465,2466,2467,2468,2469,2471,2472,2473,2474,2475,2476,2478,2479,2480,
+2481,2482,2483,2485,2486,2487,2488,2489,2490,2492,2493,2494,2495,2496,2498,2499,
+2500,2501,2502,2503,2505,2506,2507,2508,2509,2510,2512,2513,2514,2515,2516,2518,
+2519,2520,2521,2522,2523,2525,2526,2527,2528,2529,2530,2532,2533,2534,2535,2536,
+2537,2539,2540,2541,2542,2543,2545,2546,2547,2548,2549,2550,2552,2553,2554,2555,
+2556,2557,2559,2560,2561,2562,2563,2565,2566,2567,2568,2569,2570,2572,2573,2574,
+2575,2576,2577,2579,2580,2581,2582,2583,2584,2586,2587,2588,2589,2590,2592,2593,
+2594,2595,2596,2597,2599,2600,2601,2602,2603,2604,2606,2607,2608,2609,2610,2612,
+2613,2614,2615,2616,2617,2619,2620,2621,2622,2623,2624,2626,2627,2628,2629,2630,
+2631,2633,2634,2635,2636,2637,2639,2640,2641,2642,2643,2644,2646,2647,2648,2649,
+2650,2651,2653,2654,2655,2656,2657,2659,2660,2661,2662,2663,2664,2666,2667,2668,
+2669,2670,2671,2673,2674,2675,2676,2677,2678,2680,2681,2682,2683,2684,2686,2687,
+2688,2689,2690,2691,2693,2694,2695,2696,2697,2698,2700,2701,2702,2703,2704,2706,
+2707,2708,2709,2710,2711,2713,2714,2715,2716,2717,2718,2720,2721,2722,2723,2724,
+2725,2727,2728,2729,2730,2731,2733,2734,2735,2736,2737,2738,2740,2741,2742,2743,
+2744,2745,2747,2748,2749,2750,2751,2753,2754,2755,2756,2757,2758,2760,2761,2762,
+2763,2764,2765,2767,2768,2769,2770,2771,2772,2774,2775,2776,2777,2778,2780,2781,
+2782,2783,2784,2785,2787,2788,2789,2790,2791,2792,2794,2795,2796,2797,2798,2800,
+2801,2802,2803,2804,2805,2807,2808,2809,2810,2811,2812,2814,2815,2816,2817,2818,
+2819,2821,2822,2823,2824,2825,2827,2828,2829,2830,2831,2832,2834,2835,2836,2837,
+2838,2839,2841,2842,2843,2844,2845,2847,2848,2849,2850,2851,2852,2854,2855,2856,
+2857,2858,2859,2861,2862,2863,2864,2865,2866,2868,2869,2870,2871,2872,2874,2875,
+2876,2877,2878,2879,2881,2882,2883,2884,2885,2886,2888,2889,2890,2891,2892,2894,
+2895,2896,2897,2898,2899,2901,2902,2903,2904,2905,2906,2908,2909,2910,2911,2912,
+2913,2915,2916,2917,2918,2919,2921,2922,2923,2924,2925,2926,2928,2929,2930,2931,
+2932,2933,2935,2936,2937,2938,2939,2941,2942,2943,2944,2945,2946,2948,2949,2950,
+2951,2952,2953,2955,2956,2957,2958,2959,2960,2962,2963,2964,2965,2966,2968,2969,
+2970,2971,2972,2973,2975,2976,2977,2978,2979,2980,2982,2983,2984,2985,2986,2988,
+2989,2990,2991,2992,2993,2995,2996,2997,2998,2999,3000,3002,3003,3004,3005,3006,
+3007,3009,3010,3011,3012,3013,3015,3016,3017,3018,3019,3020,3022,3023,3024,3025,
+3026,3027,3029,3030,3031,3032,3033,3035,3036,3037,3038,3039,3040,3042,3043,3044,
+3045,3046,3047,3049,3050,3051,3052,3053,3054,3056,3057,3058,3059,3060,3062,3063,
+3064,3065,3066,3067,3069,3070,3071,3072,3073,3074,3076,3077,3078,3079,3080,3082,
+3083,3084,3085,3086,3087,3089,3090,3091,3092,3093,3094,3096,3097,3098,3099,3100,
+3101,3103,3104,3105,3106,3107,3109,3110,3111,3112,3113,3114,3116,3117,3118,3119,
+3120,3121,3123,3124,3125,3126,3127,3129,3130,3131,3132,3133,3134,3136,3137,3138,
+3139,3140,3141,3143,3144,3145,3146,3147,3148,3150,3151,3152,3153,3154,3156,3157,
+3158,3159,3160,3161,3163,3164,3165,3166,3167,3168,3170,3171,3172,3173,3174,3176,
+3177,3178,3179,3180,3181,3183,3184,3185,3186,3187,3188,3190,3191,3192,3193,3194,
+3195,3197,3198,3199,3200,3201,3203,3204,3205,3206,3207,3208,3210,3211,3212,3213,
+3214,3215,3217,3218,3219,3220,3221,3223,3224,3225,3226,3227,3228,3230,3231,3232,
+3233,3234,3235,3237,3238,3239,3240,3241,3242,3244,3245,3246,3247,3248,3250,3251,
+3252,3253,3254,3255,3257,3258,3259,3260,3261,3262,3264,3265,3266,3267,3268,3270,
+3271,3272,3273,3274,3275,3277,3278,3279,3280,3281,3282,3284,3285,3286,3287,3288,
+3289,3291,3292,3293,3294,3295,3297,3298,3299,3300,3301,3302,3304,3305,3306,3307,
+3308,3309,3311,3312,3313,3314,3315,3317,3318,3319,3320,3321,3322,3324,3325,3326,
+3327,3328,3329,3331,3332,3333,3334,3335,3336,3338,3339,3340,3341,3342,3344,3345,
+3346,3347,3348,3349,3351,3352,3353,3354,3355,3356,3358,3359,3360,3361,3362,3364,
+3365,3366,3367,3368,3369,3371,3372,3373,3374,3375,3376,3378,3379,3380,3381,3382,
+3383,3385,3386,3387,3388,3389,3391,3392,3393,3394,3395,3396,3398,3399,3400,3401,
+3402,3403,3405,3406,3407,3408,3409,3411,3412,3413,3414,3415,3416,3418,3419,3420,
+3421,3422,3423,3425,3426,3427,3428,3429,3430,3432,3433,3434,3435,3436,3438,3439,
+3440,3441,3442,3443,3445,3446,3447,3448,3449,3450,3452,3453,3454,3455,3456,3458,
+3459,3460,3461,3462,3463,3465,3466,3467,3468,3469,3470,3472,3473,3474,3475,3476,
+3477,3479,3480,3481,3482,3483,3485,3486,3487,3488,3489,3490,3492,3493,3494,3495,
+3496,3497,3499,3500,3501,3502,3503,3505,3506,3507,3508,3509,3510,3512,3513,3514,
+3515,3516,3517,3519,3520,3521,3522,3523,3524,3526,3527,3528,3529,3530,3532,3533,
+3534,3535,3536,3537,3539,3540,3541,3542,3543,3544,3546,3547,3548,3549,3550,3552,
+3553,3554,3555,3556,3557,3559,3560,3561,3562,3563,3564,3566,3567,3568,3569,3570,
+3571,3573,3574,3575,3576,3577,3579,3580,3581,3582,3583,3584,3586,3587,3588,3589,
+3590,3591,3593,3594,3595,3596,3597,3599,3600,3601,3602,3603,3604,3606,3607,3608,
+3609,3610,3611,3613,3614,3615,3616,3617,3618,3620,3621,3622,3623,3624,3626,3627,
+3628,3629,3630,3631,3633,3634,3635,3636,3637,3638,3640,3641,3642,3643,3644,3646,
+3647,3648,3649,3650,3651,3653,3654,3655,3656,3657,3658,3660,3661,3662,3663,3664,
+3665,3667,3668,3669,3670,3671,3673,3674,3675,3676,3677,3678,3680,3681,3682,3683,
+3684,3685,3687,3688,3689,3690,3691,3693,3694,3695,3696,3697,3698,3700,3701,3702,
+3703,3704,3705,3707,3708,3709,3710,3711,3712,3714,3715,3716,3717,3718,3720,3721,
+3722,3723,3724,3725,3727,3728,3729,3730,3731,3732,3734,3735,3736,3737,3738,3740,
+3741,3742,3743,3744,3745,3747,3748,3749,3750,3751,3752,3754,3755,3756,3757,3758,
+3759,3761,3762,3763,3764,3765,3767,3768,3769,3770,3771,3772,3774,3775,3776,3777,
+3778,3779,3781,3782,3783,3784,3785,3787,3788,3789,3790,3791,3792,3794,3795,3796,
+3797,3798,3799,3801,3802,3803,3804,3805,3806,3808,3809,3810,3811,3812,3814,3815,
+3816,3817,3818,3819,3821,3822,3823,3824,3825,3826,3828,3829,3830,3831,3832,3834,
+3835,3836,3837,3838,3839,3841,3842,3843,3844,3845,3846,3848,3849,3850,3851,3852,
+3853,3855,3856,3857,3858,3859,3861,3862,3863,3864,3865,3866,3868,3869,3870,3871,
+3872,3873,3875,3876,3877,3878,3879,3881,3882,3883,3884,3885,3886,3888,3889,3890,
+3891,3892,3893,3895,3896,3897,3898,3899,3900,3902,3903,3904,3905,3906,3908,3909,
+3910,3911,3912,3913,3915,3916,3917,3918,3919,3920,3922,3923,3924,3925,3926,3928,
+3929,3930,3931,3932,3933,3935,3936,3937,3938,3939,3940,3942,3943,3944,3945,3946,
+3947,3949,3950,3951,3952,3953,3955,3956,3957,3958,3959,3960,3962,3963,3964,3965,
+3966,3967,3969,3970,3971,3972,3973,3975,3976,3977,3978,3979,3980,3982,3983,3984,
+3985,3986,3987,3989,3990,3991,3992,3993,3994,3996,3997,3998,3999,4000,4002,4003,
+4004,4005,4006,4007,4009,4010,4011,4012,4013,4014,4016,4017,4018,4019,4020,4022,
+4023,4024,4025,4026,4027,4029,4030,4031,4032,4033,4034,4036,4037,4038,4039,4040,
+4041,4043,4044,4045,4046,4047,4049,4050,4051,4052,4053,4054,4056,4057,4058,4059,
+4060,4061,4063,4064,4065,4066,4067,4069,4070,4071,4072,4073,4074,4076,4077,4078,
+4079,4080,4081,4083,4084,4085,4086,4087,4088,4090,4091,4092,4093,4094,4096,4097,
+4098,4099,4100,4101,4103,4104,4105,4106,4107,4108,4110,4111,4112,4113,4114,4116,
+4117,4118,4119,4120,4121,4123,4124,4125,4126,4127,4128,4130,4131,4132,4133,4134,
+4135,4137,4138,4139,4140,4141,4143,4144,4145,4146,4147,4148,4150,4151,4152,4153,
+4154,4155,4157,4158,4159,4160,4161,4163,4164,4165,4166,4167,4168,4170,4171,4172,
+4173,4174,4175,4177,4178,4179,4180,4181,4182,4184,4185,4186,4187,4188,4190,4191,
+4192,4193,4194,4195,4197,4198,4199,4200,4201,4202,4204,4205,4206,4207,4208,4210,
+4211,4212,4213,4214,4215,4217,4218,4219,4220,4221,4222,4224,4225,4226,4227,4228,
+4229,4231,4232,4233,4234,4235,4237,4238,4239,4240,4241,4242,4244,4245,4246,4247,
+4248,4249,4251,4252,4253,4254,4255,4257,4258,4259,4260,4261,4262,4264,4265,4266,
+4267,4268,4269,4271,4272,4273,4274,4275,4276,4278,4279,4280,4281,4282,4284,4285,
+4286,4287,4288,4289,4291,4292,4293,4294,4295,4296,4298,4299,4300,4301,4302,4304,
+4305,4306,4307,4308,4309,4311,4312,4313,4314,4315,4316,4318,4319,4320,4321,4322,
+4323,4325,4326,4327,4328,4329,4331,4332,4333,4334,4335,4336,4338,4339,4340,4341,
+4342,4343,4345,4346,4347,4348,4349,4351,4352,4353,4354,4355,4356,4358,4359,4360,
+4361,4362,4363,4365,4366,4367,4368,4369,4370,4372,4373,4374,4375,4376,4378,4379,
+4380,4381,4382,4383,4385,4386,4387,4388,4389,4390,4392,4393,4394,4395,4396,4398,
+4399,4400,4401,4402,4403,4405,4406,4407,4408,4409,4410,4412,4413,4414,4415,4416,
+4417,4419,4420,4421,4422,4423,4425,4426,4427,4428,4429,4430,4432,4433,4434,4435,
+4436,4437,4439,4440,4441,4442,4443,4445,4446,4447,4448,4449,4450,4452,4453,4454,
+4455,4456,4457,4459,4460,4461,4462,4463,4464,4466,4467,4468,4469,4470,4472,4473,
+4474,4475,4476,4477,4479,4480,4481,4482,4483,4484,4486,4487,4488,4489,4490,4492,
+4493,4494,4495,4496,4497,4499,4500,4501,4502,4503,4504,4506,4507,4508,4509,4510,
+4511,4513,4514,4515,4516,4517,4519,4520,4521,4522,4523,4524,4526,4527,4528,4529,
+4530,4531,4533,4534,4535,4536,4537,4539,4540,4541,4542,4543,4544,4546,4547,4548,
+4549,4550,4551,4553,4554,4555,4556,4557,4558,4560,4561,4562,4563,4564,4566,4567,
+4568,4569,4570,4571,4573,4574,4575,4576,4577,4578,4580,4581,4582,4583,4584,4586,
+4587,4588,4589,4590,4591,4593,4594,4595,4596,4597,4598,4600,4601,4602,4603,4604,
+4605,4607,4608,4609,4610,4611,4613,4614,4615,4616,4617,4618,4620,4621,4622,4623,
+4624,4625,4627,4628,4629,4630,4631,4633,4634,4635,4636,4637,4638,4640,4641,4642,
+4643,4644,4645,4647,4648,4649,4650,4651,4652,4654,4655,4656,4657,4658,4660,4661,
+4662,4663,4664,4665,4667,4668,4669,4670,4671,4672,4674,4675,4676,4677,4678,4680,
+4681,4682,4683,4684,4685,4687,4688,4689,4690,4691,4692,4694,4695,4696,4697,4698,
+4699,4701,4702,4703,4704,4705,4707,4708,4709,4710,4711,4712,4714,4715,4716,4717,
+4718,4719,4721,4722,4723,4724,4725,4727,4728,4729,4730,4731,4732,4734,4735,4736,
+4737,4738,4739,4741,4742,4743,4744,4745,4746,4748,4749,4750,4751,4752,4754,4755,
+4756,4757,4758,4759,4761,4762,4763,4764,4765,4766,4768,4769,4770,4771,4772,4774,
+4775,4776,4777,4778,4779,4781,4782,4783,4784,4785,4786,4788,4789,4790,4791,4792,
+4793,4795,4796,4797,4798,4799,4801,4802,4803,4804,4805,4806,4808,4809,4810,4811
+};

Modified: branches/vorbis-aotuv/lib/psytune.c
===================================================================
--- branches/vorbis-aotuv/lib/psytune.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/psytune.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,17 +5,20 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: simple utility that runs audio through the psychoacoustics
            without encoding
- last mod: $Id: psytune.c,v 1.20 2003/03/04 21:22:11 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
+/* NB: this is dead code, retained purely for doc and reference value
+       don't try to compile it */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Modified: branches/vorbis-aotuv/lib/registry.c
===================================================================
--- branches/vorbis-aotuv/lib/registry.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/registry.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.15 2002/07/11 06:40:50 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/registry.h
===================================================================
--- branches/vorbis-aotuv/lib/registry.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/registry.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.13 2002/07/11 06:40:50 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/res0.c
===================================================================
--- branches/vorbis-aotuv/lib/res0.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/res0.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -336,7 +336,7 @@
     }
   }
 
-  {
+  if(best>-1){
     float *ptr=book->valuelist+best*dim;
     for(i=0;i<dim;i++)
       *a++ -= *ptr++;
@@ -355,10 +355,12 @@
     int entry=local_book_besterror(book,vec+i*dim);
 
 #ifdef TRAIN_RES
-    acc[entry]++;
+    if(entry>0)
+      acc[entry]++;
 #endif
-
+      
     bits+=vorbis_book_encode(book,entry,opb);
+  
   }
 
   return(bits);
@@ -380,11 +382,11 @@
   int partvals=n/samples_per_partition;
   long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword));
   float scale=100./samples_per_partition;
-
+  
   /* we find the partition type for each partition of each
      channel.  We'll go back and do the interleaved encoding in a
      bit.  For now, clarity */
- 
+  
   for(i=0;i<ch;i++){
     partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i]));
     memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i]));
@@ -409,12 +411,12 @@
       partword[j][i]=k;  
     }
   }
-
+  
 #ifdef TRAIN_RESAUX
   {
     FILE *of;
     char buffer[80];
-  
+    
     for(i=0;i<ch;i++){
       sprintf(buffer,"resaux_%d.vqd",look->train_seq);
       of=fopen(buffer,"a");
@@ -426,7 +428,7 @@
   }
 #endif
   look->frames++;
-
+  
   return(partword);
 }
 
@@ -446,7 +448,7 @@
 
   int partvals=n/samples_per_partition;
   long **partword=_vorbis_block_alloc(vb,sizeof(*partword));
-
+  
 #if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
   FILE *of;
   char buffer[80];
@@ -454,7 +456,7 @@
   
   partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
   memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
-
+  
   for(i=0,l=info->begin/ch;i<partvals;i++){
     float magmax=0.f;
     float angmax=0.f;
@@ -462,16 +464,16 @@
       if(fabs(in[0][l])>magmax)magmax=fabs(in[0][l]);
       for(k=1;k<ch;k++)
 	if(fabs(in[k][l])>angmax)angmax=fabs(in[k][l]);
-      l++;
+	l++;
     }
-
+    
     for(j=0;j<possible_partitions-1;j++)
       if(magmax<=info->classmetric1[j] &&
 	 angmax<=info->classmetric2[j])
 	break;
-
+    
     partword[0][i]=j;
-
+    
   }  
   
 #ifdef TRAIN_RESAUX
@@ -482,9 +484,9 @@
   fprintf(of,"\n");
   fclose(of);
 #endif
-
+  
   look->frames++;
-
+  
   return(partword);
 }
 
@@ -509,15 +511,15 @@
   int partvals=n/samples_per_partition;
   long resbits[128];
   long resvals[128];
-
+  
 #ifdef TRAIN_RES
   for(i=0;i<ch;i++)
-    for(j=info->begin;j<info->end;j++){
+    for(j=info->begin;j<end;j++){
       if(in[i][j]>look->tmax)look->tmax=in[i][j];
       if(in[i][j]<look->tmin)look->tmin=in[i][j];
     }
 #endif
-
+  
   memset(resbits,0,sizeof(resbits));
   memset(resvals,0,sizeof(resvals));
   
@@ -525,11 +527,11 @@
      words for a partition per channel until we've written all the
      residual words for that partition word.  Then write the next
      partition channel words... */
-
+  
   for(s=0;s<look->stages;s++){
-
+    
     for(i=0;i<partvals;){
-
+      
       /* first we encode a partition codeword for each channel */
       if(s==0){
 	for(j=0;j<ch;j++){
@@ -539,7 +541,7 @@
 	    if(i+k<partvals)
 	      val+=partword[j][i+k];
 	  }	
-
+	  
 	  /* training hack */
 	  if(val<look->phrasebook->entries)
 	    look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb);
@@ -547,14 +549,14 @@
 	  else
 	    fprintf(stderr,"!");
 #endif
-	
+	  
 	}
       }
       
       /* now we encode interleaved residual values for the partitions */
       for(k=0;k<partitions_per_word && i<partvals;k++,i++){
 	long offset=i*samples_per_partition+info->begin;
-	
+	  
 	for(j=0;j<ch;j++){
 	  if(s==0)resvals[partword[j][i]]+=samples_per_partition;
 	  if(info->secondstages[partword[j][i]]&(1<<s)){
@@ -562,7 +564,7 @@
 	    if(statebook){
 	      int ret;
 	      long *accumulator=NULL;
-
+	      
 #ifdef TRAIN_RES
 	      accumulator=look->training_data[s][partword[j][i]];
 	      {
@@ -579,7 +581,7 @@
 	      
 	      ret=encode(opb,in[j]+offset,samples_per_partition,
 			 statebook,accumulator);
-
+	      
 	      look->postbits+=ret;
 	      resbits[partword[j][i]]+=ret;
 	    }
@@ -588,19 +590,20 @@
       }
     }
   }
-
+  
   /*{
     long total=0;
     long totalbits=0;
     fprintf(stderr,"%d :: ",vb->mode);
     for(k=0;k<possible_partitions;k++){
-      fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]);
-      total+=resvals[k];
-      totalbits+=resbits[k];
-      }
+    fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]);
+    total+=resvals[k];
+    totalbits+=resbits[k];
+    }
     
     fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
     }*/
+
   return(0);
 }
 
@@ -617,45 +620,49 @@
   /* move all this setup out later */
   int samples_per_partition=info->grouping;
   int partitions_per_word=look->phrasebook->dim;
-  int n=info->end-info->begin;
+  int max=vb->pcmend>>1;
+  int end=(info->end<max?info->end:max);
+  int n=end-info->begin;
   
-  int partvals=n/samples_per_partition;
-  int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-  int ***partword=alloca(ch*sizeof(*partword));
-
-  for(j=0;j<ch;j++)
-    partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
-
-  for(s=0;s<look->stages;s++){
-
-    /* each loop decodes on partition codeword containing 
-       partitions_pre_word partitions */
-    for(i=0,l=0;i<partvals;l++){
-      if(s==0){
-	/* fetch the partition word for each channel */
-	for(j=0;j<ch;j++){
-	  int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
-	  if(temp==-1)goto eopbreak;
-	  partword[j][l]=look->decodemap[temp];
-	  if(partword[j][l]==NULL)goto errout;
+  if(n>0){
+    int partvals=n/samples_per_partition;
+    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+    int ***partword=alloca(ch*sizeof(*partword));
+    
+    for(j=0;j<ch;j++)
+      partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
+    
+    for(s=0;s<look->stages;s++){
+      
+      /* each loop decodes on partition codeword containing 
+	 partitions_per_word partitions */
+      for(i=0,l=0;i<partvals;l++){
+	if(s==0){
+	  /* fetch the partition word for each channel */
+	  for(j=0;j<ch;j++){
+	    int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+	    
+	    if(temp==-1)goto eopbreak;
+	    partword[j][l]=look->decodemap[temp];
+	    if(partword[j][l]==NULL)goto errout;
+	  }
 	}
-      }
-      
-      /* now we decode residual values for the partitions */
-      for(k=0;k<partitions_per_word && i<partvals;k++,i++)
-	for(j=0;j<ch;j++){
-	  long offset=info->begin+i*samples_per_partition;
-	  if(info->secondstages[partword[j][l][k]]&(1<<s)){
-	    codebook *stagebook=look->partbooks[partword[j][l][k]][s];
-	    if(stagebook){
-	      if(decodepart(stagebook,in[j]+offset,&vb->opb,
-			    samples_per_partition)==-1)goto eopbreak;
+	
+	/* now we decode residual values for the partitions */
+	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+	  for(j=0;j<ch;j++){
+	    long offset=info->begin+i*samples_per_partition;
+	    if(info->secondstages[partword[j][l][k]]&(1<<s)){
+	      codebook *stagebook=look->partbooks[partword[j][l][k]][s];
+	      if(stagebook){
+		if(decodepart(stagebook,in[j]+offset,&vb->opb,
+			      samples_per_partition)==-1)goto eopbreak;
+	      }
 	    }
 	  }
-	}
-    } 
+      } 
+    }
   }
-  
  errout:
  eopbreak:
   return(0);
@@ -833,41 +840,44 @@
   /* move all this setup out later */
   int samples_per_partition=info->grouping;
   int partitions_per_word=look->phrasebook->dim;
-  int n=info->end-info->begin;
+  int max=(vb->pcmend*ch)>>1;
+  int end=(info->end<max?info->end:max);
+  int n=end-info->begin;
 
-  int partvals=n/samples_per_partition;
-  int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-  int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword));
-
-  for(i=0;i<ch;i++)if(nonzero[i])break;
-  if(i==ch)return(0); /* no nonzero vectors */
-
-  for(s=0;s<look->stages;s++){
-    for(i=0,l=0;i<partvals;l++){
-
-      if(s==0){
-	/* fetch the partition word */
-	int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
-	if(temp==-1)goto eopbreak;
-	partword[l]=look->decodemap[temp];
-	if(partword[l]==NULL)goto errout;
-      }
-
-      /* now we decode residual values for the partitions */
-      for(k=0;k<partitions_per_word && i<partvals;k++,i++)
-	if(info->secondstages[partword[l][k]]&(1<<s)){
-	  codebook *stagebook=look->partbooks[partword[l][k]][s];
-	  
-	  if(stagebook){
-	    if(vorbis_book_decodevv_add(stagebook,in,
-					i*samples_per_partition+info->begin,ch,
-					&vb->opb,samples_per_partition)==-1)
-	      goto eopbreak;
+  if(n>0){
+    int partvals=n/samples_per_partition;
+    int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+    int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword));
+    
+    for(i=0;i<ch;i++)if(nonzero[i])break;
+    if(i==ch)return(0); /* no nonzero vectors */
+    
+    for(s=0;s<look->stages;s++){
+      for(i=0,l=0;i<partvals;l++){
+	
+	if(s==0){
+	  /* fetch the partition word */
+	  int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+	  if(temp==-1)goto eopbreak;
+	  partword[l]=look->decodemap[temp];
+	  if(partword[l]==NULL)goto errout;
+	}
+	
+	/* now we decode residual values for the partitions */
+	for(k=0;k<partitions_per_word && i<partvals;k++,i++)
+	  if(info->secondstages[partword[l][k]]&(1<<s)){
+	    codebook *stagebook=look->partbooks[partword[l][k]][s];
+	    
+	    if(stagebook){
+	      if(vorbis_book_decodevv_add(stagebook,in,
+					  i*samples_per_partition+info->begin,ch,
+					  &vb->opb,samples_per_partition)==-1)
+		goto eopbreak;
+	    }
 	  }
-	}
-    } 
+      } 
+    }
   }
-  
  errout:
  eopbreak:
   return(0);

Modified: branches/vorbis-aotuv/lib/scales.h
===================================================================
--- branches/vorbis-aotuv/lib/scales.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/scales.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/sharedbook.c
===================================================================
--- branches/vorbis-aotuv/lib/sharedbook.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/sharedbook.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.29 2002/10/11 07:44:28 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -329,30 +329,31 @@
   c->used_entries=n;
   c->dim=s->dim;
 
-  /* two different remappings go on here.  
+  if(n>0){
+    
+    /* two different remappings go on here.  
+       
+    First, we collapse the likely sparse codebook down only to
+    actually represented values/words.  This collapsing needs to be
+    indexed as map-valueless books are used to encode original entry
+    positions as integers.
+    
+    Second, we reorder all vectors, including the entry index above,
+    by sorted bitreversed codeword to allow treeless decode. */
 
-     First, we collapse the likely sparse codebook down only to
-     actually represented values/words.  This collapsing needs to be
-     indexed as map-valueless books are used to encode original entry
-     positions as integers.
-
-     Second, we reorder all vectors, including the entry index above,
-     by sorted bitreversed codeword to allow treeless decode. */
-
-  {
     /* perform sort */
     ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
     ogg_uint32_t **codep=alloca(sizeof(*codep)*n);
     
     if(codes==NULL)goto err_out;
-
+    
     for(i=0;i<n;i++){
       codes[i]=bitreverse(codes[i]);
       codep[i]=codes+i;
     }
-
+    
     qsort(codep,n,sizeof(*codep),sort32a);
-
+    
     sortindex=alloca(n*sizeof(*sortindex));
     c->codelist=_ogg_malloc(n*sizeof(*c->codelist));
     /* the index is a reverse index */
@@ -364,66 +365,66 @@
     for(i=0;i<n;i++)
       c->codelist[sortindex[i]]=codes[i];
     _ogg_free(codes);
-  }
-
-  c->valuelist=_book_unquantize(s,n,sortindex);
-  c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index));
-
-  for(n=0,i=0;i<s->entries;i++)
-    if(s->lengthlist[i]>0)
-      c->dec_index[sortindex[n++]]=i;
   
-  c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
-  for(n=0,i=0;i<s->entries;i++)
-    if(s->lengthlist[i]>0)
-      c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
 
-  c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
-  if(c->dec_firsttablen<5)c->dec_firsttablen=5;
-  if(c->dec_firsttablen>8)c->dec_firsttablen=8;
-
-  tabn=1<<c->dec_firsttablen;
-  c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
-  c->dec_maxlength=0;
-
-  for(i=0;i<n;i++){
-    if(c->dec_maxlength<c->dec_codelengths[i])
-      c->dec_maxlength=c->dec_codelengths[i];
-    if(c->dec_codelengths[i]<=c->dec_firsttablen){
-      ogg_uint32_t orig=bitreverse(c->codelist[i]);
-      for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
-	c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
+    c->valuelist=_book_unquantize(s,n,sortindex);
+    c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index));
+    
+    for(n=0,i=0;i<s->entries;i++)
+      if(s->lengthlist[i]>0)
+	c->dec_index[sortindex[n++]]=i;
+    
+    c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
+    for(n=0,i=0;i<s->entries;i++)
+      if(s->lengthlist[i]>0)
+	c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
+    
+    c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
+    if(c->dec_firsttablen<5)c->dec_firsttablen=5;
+    if(c->dec_firsttablen>8)c->dec_firsttablen=8;
+    
+    tabn=1<<c->dec_firsttablen;
+    c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
+    c->dec_maxlength=0;
+    
+    for(i=0;i<n;i++){
+      if(c->dec_maxlength<c->dec_codelengths[i])
+	c->dec_maxlength=c->dec_codelengths[i];
+      if(c->dec_codelengths[i]<=c->dec_firsttablen){
+	ogg_uint32_t orig=bitreverse(c->codelist[i]);
+	for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
+	  c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
+      }
     }
-  }
-
-  /* now fill in 'unused' entries in the firsttable with hi/lo search
-     hints for the non-direct-hits */
-  {
-    ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
-    long lo=0,hi=0;
-
-    for(i=0;i<tabn;i++){
-      ogg_uint32_t word=i<<(32-c->dec_firsttablen);
-      if(c->dec_firsttable[bitreverse(word)]==0){
-	while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
-	while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
-	
-	/* we only actually have 15 bits per hint to play with here.
-           In order to overflow gracefully (nothing breaks, efficiency
-           just drops), encode as the difference from the extremes. */
-	{
-	  unsigned long loval=lo;
-	  unsigned long hival=n-hi;
-
-	  if(loval>0x7fff)loval=0x7fff;
-	  if(hival>0x7fff)hival=0x7fff;
-	  c->dec_firsttable[bitreverse(word)]=
-	    0x80000000UL | (loval<<15) | hival;
+    
+    /* now fill in 'unused' entries in the firsttable with hi/lo search
+       hints for the non-direct-hits */
+    {
+      ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
+      long lo=0,hi=0;
+      
+      for(i=0;i<tabn;i++){
+	ogg_uint32_t word=i<<(32-c->dec_firsttablen);
+	if(c->dec_firsttable[bitreverse(word)]==0){
+	  while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
+	  while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
+	  
+	  /* we only actually have 15 bits per hint to play with here.
+	     In order to overflow gracefully (nothing breaks, efficiency
+	     just drops), encode as the difference from the extremes. */
+	  {
+	    unsigned long loval=lo;
+	    unsigned long hival=n-hi;
+	    
+	    if(loval>0x7fff)loval=0x7fff;
+	    if(hival>0x7fff)hival=0x7fff;
+	    c->dec_firsttable[bitreverse(word)]=
+	      0x80000000UL | (loval<<15) | hival;
+	  }
 	}
       }
     }
   }
-  
 
   return(0);
  err_out:

Modified: branches/vorbis-aotuv/lib/smallft.c
===================================================================
--- branches/vorbis-aotuv/lib/smallft.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/smallft.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/smallft.h
===================================================================
--- branches/vorbis-aotuv/lib/smallft.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/smallft.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: fft transform
- last mod: $Id: smallft.h,v 1.12 2002/07/11 06:40:50 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/synthesis.c
===================================================================
--- branches/vorbis-aotuv/lib/synthesis.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/synthesis.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.30 2003/08/18 05:34:01 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/vorbisenc.c
===================================================================
--- branches/vorbis-aotuv/lib/vorbisenc.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/vorbisenc.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/lib/vorbisfile.c
===================================================================
--- branches/vorbis-aotuv/lib/vorbisfile.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/vorbisfile.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,8 +5,8 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
@@ -58,10 +58,11 @@
 
 /* read a little more data from the file/pipe into the ogg_sync framer
 */
-#define CHUNKSIZE 8500 /* a shade over 8k; anyone using pages well
-                          over 8k gets what they deserve */
+#define CHUNKSIZE 65536
+
 static long _get_data(OggVorbis_File *vf){
   errno=0;
+  if(!(vf->callbacks.read_func))return(-1);
   if(vf->datasource){
     char *buffer=ogg_sync_buffer(&vf->oy,CHUNKSIZE);
     long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
@@ -73,15 +74,18 @@
 }
 
 /* save a tiny smidge of verbosity to make the code more readable */
-static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
+static int _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
   if(vf->datasource){ 
-    (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
+    if(!(vf->callbacks.seek_func)||
+       (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET) == -1)
+      return OV_EREAD;
     vf->offset=offset;
     ogg_sync_reset(&vf->oy);
   }else{
     /* shouldn't happen unless someone writes a broken callback */
-    return;
+    return OV_EFAULT;
   }
+  return 0;
 }
 
 /* The read/seek functions track absolute position within the stream */
@@ -145,7 +149,10 @@
     begin-=CHUNKSIZE;
     if(begin<0)
       begin=0;
-    _seek_helper(vf,begin);
+
+    ret=_seek_helper(vf,begin);
+    if(ret)return(ret);
+
     while(vf->offset<end){
       ret=_get_next_page(vf,og,end-vf->offset);
       if(ret==OV_EREAD)return(OV_EREAD);
@@ -158,7 +165,9 @@
   }
 
   /* we have the offset.  Actually snork and hold the page now */
-  _seek_helper(vf,offset);
+  ret=_seek_helper(vf,offset);
+  if(ret)return(ret);
+
   ret=_get_next_page(vf,og,CHUNKSIZE);
   if(ret<0)
     /* this shouldn't be possible */
@@ -167,6 +176,58 @@
   return(offset);
 }
 
+static void _add_serialno(ogg_page *og,long **serialno_list, int *n){
+  long s = ogg_page_serialno(og);
+  (*n)++;
+
+  if(serialno_list){
+    *serialno_list = _ogg_realloc(*serialno_list, sizeof(*serialno_list)*(*n));
+  }else{
+    *serialno_list = _ogg_malloc(sizeof(**serialno_list));
+  }
+  
+  (*serialno_list)[(*n)-1] = s;
+}
+
+/* returns nonzero if found */
+static int _lookup_serialno(ogg_page *og, long *serialno_list, int n){
+  long s = ogg_page_serialno(og);
+
+  if(serialno_list){
+    while(n--){
+      if(*serialno_list == s) return 1;
+      serialno_list++;
+    }
+  }
+  return 0;
+}
+
+/* start parsing pages at current offset, remembering all serial
+   numbers.  Stop logging at first non-bos page */
+static int _get_serialnos(OggVorbis_File *vf, long **s, int *n){
+  ogg_page og;
+
+  *s=NULL;
+  *n=0;
+
+  while(1){
+    ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
+    if(llret==OV_EOF)return(0);
+    if(llret<0)return(llret);
+    if(!ogg_page_bos(&og)) return 0;
+
+    /* look for duplicate serialnos; add this one if unique */
+    if(_lookup_serialno(&og,*s,*n)){
+      if(*s)_ogg_free(*s);
+      *s=0;
+      *n=0;
+      return(OV_EBADHEADER);
+    }
+
+    _add_serialno(&og,s,n);
+  }
+}
+
 /* finds each bitstream link one at a time using a bisection search
    (has to begin by knowing the offset of the lb's initial page).
    Recurses for each link so it can alloc the link storage after
@@ -175,7 +236,8 @@
 				    ogg_int64_t begin,
 				    ogg_int64_t searched,
 				    ogg_int64_t end,
-				    long currentno,
+				    long *currentno_list,
+				    int  currentnos,
 				    long m){
   ogg_int64_t endsearched=end;
   ogg_int64_t next=end;
@@ -193,10 +255,12 @@
       bisect=(searched+endsearched)/2;
     }
     
-    _seek_helper(vf,bisect);
+    ret=_seek_helper(vf,bisect);
+    if(ret)return(ret);
+
     ret=_get_next_page(vf,&og,-1);
     if(ret==OV_EREAD)return(OV_EREAD);
-    if(ret<0 || ogg_page_serialno(&og)!=currentno){
+    if(ret<0 || !_lookup_serialno(&og,currentno_list,currentnos)){
       endsearched=bisect;
       if(ret>=0)next=ret;
     }else{
@@ -204,23 +268,28 @@
     }
   }
 
-  _seek_helper(vf,next);
-  ret=_get_next_page(vf,&og,-1);
-  if(ret==OV_EREAD)return(OV_EREAD);
-  
-  if(searched>=end || ret<0){
-    vf->links=m+1;
-    vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
-    vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
-    vf->offsets[m+1]=searched;
-  }else{
-    ret=_bisect_forward_serialno(vf,next,vf->offset,
-				 end,ogg_page_serialno(&og),m+1);
-    if(ret==OV_EREAD)return(OV_EREAD);
+  {
+    long *next_serialno_list=NULL;
+    int next_serialnos=0;
+
+    ret=_seek_helper(vf,next);
+    if(ret)return(ret);
+    ret=_get_serialnos(vf,&next_serialno_list,&next_serialnos);
+    if(ret)return(ret);
+    
+    if(searched>=end || next_serialnos==0){
+      vf->links=m+1;
+      vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
+      vf->offsets[m+1]=searched;
+    }else{
+      ret=_bisect_forward_serialno(vf,next,vf->offset,
+				   end,next_serialno_list,next_serialnos,m+1);
+      if(ret)return(ret);
+    }
+    
+    if(next_serialno_list)_ogg_free(next_serialno_list);
   }
-  
   vf->offsets[m]=begin;
-  vf->serialnos[m]=currentno;
   return(0);
 }
 
@@ -231,46 +300,98 @@
   ogg_page og;
   ogg_packet op;
   int i,ret;
-  
+  int allbos=0;
+
   if(!og_ptr){
     ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
     if(llret==OV_EREAD)return(OV_EREAD);
-    if(llret<0)return OV_ENOTVORBIS;
+    if(llret<0)return(OV_ENOTVORBIS);
     og_ptr=&og;
   }
 
-  ogg_stream_reset_serialno(&vf->os,ogg_page_serialno(og_ptr));
-  if(serialno)*serialno=vf->os.serialno;
-  vf->ready_state=STREAMSET;
-  
-  /* extract the initial header from the first page and verify that the
-     Ogg bitstream is in fact Vorbis data */
-  
   vorbis_info_init(vi);
   vorbis_comment_init(vc);
+
+  /* extract the first set of vorbis headers we see in the headerset */
+
+  while(1){
   
-  i=0;
-  while(i<3){
+    /* if we're past the ID headers, we won't be finding a Vorbis
+       stream in this link */
+    if(!ogg_page_bos(og_ptr)){
+      ret = OV_ENOTVORBIS;
+      goto bail_header;
+    }
+
+    /* prospective stream setup; we need a stream to get packets */
+    ogg_stream_reset_serialno(&vf->os,ogg_page_serialno(og_ptr));
     ogg_stream_pagein(&vf->os,og_ptr);
-    while(i<3){
-      int result=ogg_stream_packetout(&vf->os,&op);
-      if(result==0)break;
-      if(result==-1){
-	ret=OV_EBADHEADER;
+
+    if(ogg_stream_packetout(&vf->os,&op) > 0 &&
+       vorbis_synthesis_idheader(&op)){
+
+      /* continue Vorbis header load; past this point, any error will
+	 render this link useless (we won't continue looking for more
+	 Vorbis streams */
+      if(serialno)*serialno=vf->os.serialno;
+      vf->ready_state=STREAMSET;
+      if((ret=vorbis_synthesis_headerin(vi,vc,&op)))
 	goto bail_header;
+
+      i=0;
+      while(i<2){ /* get a page loop */
+	
+	while(i<2){ /* get a packet loop */
+
+	  int result=ogg_stream_packetout(&vf->os,&op);
+	  if(result==0)break;
+	  if(result==-1){
+	    ret=OV_EBADHEADER;
+	    goto bail_header;
+	  }
+	
+	  if((ret=vorbis_synthesis_headerin(vi,vc,&op)))
+	    goto bail_header;
+
+	  i++;
+	}
+
+	while(i<2){
+	  if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
+	    ret=OV_EBADHEADER;
+	    goto bail_header;
+	  }
+
+	  /* if this page belongs to the correct stream, go parse it */
+	  if(vf->os.serialno == ogg_page_serialno(og_ptr)){
+	    ogg_stream_pagein(&vf->os,og_ptr);
+	    break;
+	  }
+
+	  /* if we never see the final vorbis headers before the link
+	     ends, abort */
+	  if(ogg_page_bos(og_ptr)){
+	    if(allbos){
+	      ret = OV_EBADHEADER;
+	      goto bail_header;
+	    }else
+	      allbos=1;
+	  }
+
+	  /* otherwise, keep looking */
+	}
       }
-      if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
-	goto bail_header;
-      }
-      i++;
+
+      return 0; 
     }
-    if(i<3)
-      if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
-	ret=OV_EBADHEADER;
-	goto bail_header;
-      }
+
+    /* this wasn't vorbis, get next page, try again */
+    {
+      ogg_int64_t llret=_get_next_page(vf,og_ptr,CHUNKSIZE);
+      if(llret==OV_EREAD)return(OV_EREAD);
+      if(llret<0)return(OV_ENOTVORBIS);
+    } 
   }
-  return 0; 
 
  bail_header:
   vorbis_info_clear(vi);
@@ -293,27 +414,35 @@
   ogg_page og;
   int i;
   ogg_int64_t ret;
-  
+
   vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
   vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
+  vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
   vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
   vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
   
   for(i=0;i<vf->links;i++){
     if(i==0){
       /* we already grabbed the initial header earlier.  Just set the offset */
+      vf->serialnos[i]=vf->current_serialno;
       vf->dataoffsets[i]=dataoffset;
-      _seek_helper(vf,dataoffset);
+      ret=_seek_helper(vf,dataoffset);
+      if(ret)
+	vf->dataoffsets[i]=-1;
 
     }else{
 
       /* seek to the location of the initial header */
 
-      _seek_helper(vf,vf->offsets[i]);
-      if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
-    	vf->dataoffsets[i]=-1;
+      ret=_seek_helper(vf,vf->offsets[i]);
+      if(ret){
+	vf->dataoffsets[i]=-1;
       }else{
-	vf->dataoffsets[i]=vf->offset;
+	if(_fetch_headers(vf,vf->vi+i,vf->vc+i,vf->serialnos+i,NULL)<0){
+	  vf->dataoffsets[i]=-1;
+	}else{
+	  vf->dataoffsets[i]=vf->offset;
+	}
       }
     }
 
@@ -335,8 +464,10 @@
              truncated/mangled */
 	  break;
        
+	if(ogg_page_bos(&og)) break;
+
 	if(ogg_page_serialno(&og)!=vf->serialnos[i])
-	  break;
+	  continue;
 	
 	/* count blocksizes of all frames in the page */
 	ogg_stream_pagein(&vf->os,&og);
@@ -367,21 +498,29 @@
        get the last page of the stream */
     {
       ogg_int64_t end=vf->offsets[i+1];
-      _seek_helper(vf,end);
-
-      while(1){
-	ret=_get_prev_page(vf,&og);
-	if(ret<0){
-	  /* this should not be possible */
-	  vorbis_info_clear(vf->vi+i);
-	  vorbis_comment_clear(vf->vc+i);
-	  break;
+      ret=_seek_helper(vf,end);
+      if(ret){
+	/* this should not be possible */
+	vorbis_info_clear(vf->vi+i);
+	vorbis_comment_clear(vf->vc+i);
+      }else{
+	
+	while(1){
+	  ret=_get_prev_page(vf,&og);
+	  if(ret<0){
+	    /* this should not be possible */
+	    vorbis_info_clear(vf->vi+i);
+	    vorbis_comment_clear(vf->vc+i);
+	    break;
+	  }
+	  if(ogg_page_serialno(&og)==vf->serialnos[i]){
+	    if(ogg_page_granulepos(&og)!=-1){
+	      vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
+	      break;
+	    }
+	  }
+	  vf->offset=ret;
 	}
-	if(ogg_page_granulepos(&og)!=-1){
-	  vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
-	  break;
-	}
-	vf->offset=ret;
       }
     }
   }
@@ -405,35 +544,40 @@
 }
 
 static int _open_seekable2(OggVorbis_File *vf){
-  long serialno=vf->current_serialno;
-  ogg_int64_t dataoffset=vf->offset, end;
+  ogg_int64_t dataoffset=vf->offset,end;
+  long *serialno_list=NULL;
+  int serialnos=0;
+  int ret;
   ogg_page og;
 
   /* we're partially open and have a first link header state in
      storage in vf */
   /* we can seek, so set out learning all about this file */
-  (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
-  vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
-  
+  if(vf->callbacks.seek_func && vf->callbacks.tell_func){
+    (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
+    vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
+  }else{
+    vf->offset=vf->end=-1;
+  }
+
+  /* If seek_func is implemented, tell_func must also be implemented */
+  if(vf->end==-1) return(OV_EINVAL);
+
   /* We get the offset for the last page of the physical bitstream.
      Most OggVorbis files will contain a single logical bitstream */
   end=_get_prev_page(vf,&og);
   if(end<0)return(end);
 
-  /* more than one logical bitstream? */
-  if(ogg_page_serialno(&og)!=serialno){
+  /* back to beginning, learn all serialnos of first link */
+  ret=_seek_helper(vf,0);
+  if(ret)return(ret);
+  ret=_get_serialnos(vf,&serialno_list,&serialnos);
+  if(ret)return(ret);
 
-    /* Chained bitstream. Bisect-search each logical bitstream
-       section.  Do so based on serial number only */
-    if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD);
+  /* now determine bitstream structure recursively */
+  if(_bisect_forward_serialno(vf,0,0,end+1,serialno_list,serialnos,0)<0)return(OV_EREAD);  
+  if(serialno_list)_ogg_free(serialno_list);
 
-  }else{
-
-    /* Only one logical bitstream */
-    if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD);
-
-  }
-
   /* the initial header memory is referenced by vf after; don't free it */
   _prefetch_all_headers(vf,dataoffset);
   return(ov_raw_seek(vf,0));
@@ -543,29 +687,49 @@
 
     if(vf->ready_state>=OPENED){
       ogg_int64_t ret;
-      if(!readp)return(0);
-      if((ret=_get_next_page(vf,&og,-1))<0){
-	return(OV_EOF); /* eof. 
-			   leave unitialized */
-      }
+      
+      while(1){ 
+	/* the loop is not strictly necessary, but there's no sense in
+	   doing the extra checks of the larger loop for the common
+	   case in a multiplexed bistream where the page is simply
+	   part of a different logical bitstream; keep reading until
+	   we get one with the correct serialno */
+	
+	if(!readp)return(0);
+	if((ret=_get_next_page(vf,&og,-1))<0){
+	  return(OV_EOF); /* eof. leave unitialized */
+	}
 
 	/* bitrate tracking; add the header's bytes here, the body bytes
 	   are done by packet above */
-      vf->bittrack+=og.header_len*8;
-      
-      /* has our decoding just traversed a bitstream boundary? */
-      if(vf->ready_state==INITSET){
-	if(vf->current_serialno!=ogg_page_serialno(&og)){
-	  if(!spanp)
-	    return(OV_EOF);
+	vf->bittrack+=og.header_len*8;
+	
+	if(vf->ready_state==INITSET){
+	  if(vf->current_serialno!=ogg_page_serialno(&og)){
+	    
+	    /* two possibilities: 
+	       1) our decoding just traversed a bitstream boundary
+	       2) another stream is multiplexed into this logical section? */
+	    
+	    if(ogg_page_bos(&og)){
+	      /* boundary case */
+	      if(!spanp)
+		return(OV_EOF);
+	      
+	      _decode_clear(vf);
+	      
+	      if(!vf->seekable){
+		vorbis_info_clear(vf->vi);
+		vorbis_comment_clear(vf->vc);
+	      }
+	      break;
 
-	  _decode_clear(vf);
-	  
-	  if(!vf->seekable){
-	    vorbis_info_clear(vf->vi);
-	    vorbis_comment_clear(vf->vc);
+	    }else
+	      continue; /* possibility #2 */
 	  }
 	}
+
+	break;
       }
     }
 
@@ -586,18 +750,20 @@
 
       if(vf->ready_state<STREAMSET){
 	if(vf->seekable){
-	  vf->current_serialno=ogg_page_serialno(&og);
-	  
+	  long serialno = ogg_page_serialno(&og);
+
 	  /* match the serialno to bitstream section.  We use this rather than
 	     offset positions to avoid problems near logical bitstream
 	     boundaries */
+
 	  for(link=0;link<vf->links;link++)
-	    if(vf->serialnos[link]==vf->current_serialno)break;
-	  if(link==vf->links)return(OV_EBADLINK); /* sign of a bogus
-						     stream.  error out,
-						     leave machine
-						     uninitialized */
-	  
+	    if(vf->serialnos[link]==serialno)break;
+
+	  if(link==vf->links) continue; /* not the desired Vorbis
+					   bitstream section; keep
+					   trying */
+
+	  vf->current_serialno=serialno;
 	  vf->current_link=link;
 	  
 	  ogg_stream_reset_serialno(&vf->os,vf->current_serialno);
@@ -619,7 +785,11 @@
 	if(ret<0)return ret;
       }
     }
+
+    /* the buffered page is the data we want, and we're ready for it;
+       add it to the stream state */
     ogg_stream_pagein(&vf->os,&og);
+
   }
 }
 
@@ -632,9 +802,9 @@
 
 static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
 		     long ibytes, ov_callbacks callbacks){
-  int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
+  int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,SEEK_CUR):-1);
   int ret;
-
+  
   memset(vf,0,sizeof(*vf));
   vf->datasource=f;
   vf->callbacks = callbacks;
@@ -709,7 +879,8 @@
     if(vf->serialnos)_ogg_free(vf->serialnos);
     if(vf->offsets)_ogg_free(vf->offsets);
     ogg_sync_clear(&vf->oy);
-    if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
+    if(vf->datasource && vf->callbacks.close_func)
+      (vf->callbacks.close_func)(vf->datasource);
     memset(vf,0,sizeof(*vf));
   }
 #ifdef DEBUG_LEAKS
@@ -743,6 +914,17 @@
 
   return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
 }
+
+int ov_fopen(char *path,OggVorbis_File *vf){
+  int ret;
+  FILE *f = fopen(path,"rb");
+  if(!f) return -1;
+
+  ret = ov_open(f,vf,NULL,0);
+  if(ret) fclose(f);
+  return ret;
+}
+
  
 /* cheap hack for game usage where downsampling is desirable; there's
    no need for SRC as we can just do it cheaply in libvorbis. */
@@ -948,6 +1130,7 @@
 
 int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
   ogg_stream_state work_os;
+  int ret;
 
   if(vf->ready_state<OPENED)return(OV_EINVAL);
   if(!vf->seekable)
@@ -964,7 +1147,8 @@
 			    vf->current_serialno); /* must set serialno */
   vorbis_synthesis_restart(&vf->vd);
     
-  _seek_helper(vf,pos);
+  ret=_seek_helper(vf,pos);
+  if(ret)goto seek_error;
 
   /* we need to make sure the pcm_offset is set, but we don't want to
      advance the raw cursor past good packets just to get to the first
@@ -986,8 +1170,8 @@
     ogg_packet op;
     int lastblock=0;
     int accblock=0;
-    int thisblock;
-    int eosflag;
+    int thisblock=0;
+    int eosflag=0; 
 
     ogg_stream_init(&work_os,vf->current_serialno); /* get the memory ready */
     ogg_stream_reset(&work_os); /* eliminate the spurious OV_HOLE
@@ -1009,7 +1193,7 @@
 	    }else{
 	      
 	      if(eosflag)
-	      ogg_stream_packetout(&vf->os,NULL);
+		ogg_stream_packetout(&vf->os,NULL);
 	      else
 		if(lastblock)accblock+=(lastblock+thisblock)>>2;
 	    }	    
@@ -1043,25 +1227,35 @@
       }
       
       /* has our decoding just traversed a bitstream boundary? */
-      if(vf->ready_state>=STREAMSET)
+      if(vf->ready_state>=STREAMSET){
 	if(vf->current_serialno!=ogg_page_serialno(&og)){
-	  _decode_clear(vf); /* clear out stream state */
-	  ogg_stream_clear(&work_os);
+	  
+	  /* two possibilities: 
+	     1) our decoding just traversed a bitstream boundary
+	     2) another stream is multiplexed into this logical section? */
+            
+	  if(ogg_page_bos(&og)){
+	    /* we traversed */
+	    _decode_clear(vf); /* clear out stream state */
+	    ogg_stream_clear(&work_os);
+	  } /* else, do nothing; next loop will scoop another page */
 	}
+      }
 
       if(vf->ready_state<STREAMSET){
 	int link;
-	
-	vf->current_serialno=ogg_page_serialno(&og);
+	long serialno = ogg_page_serialno(&og);
+
 	for(link=0;link<vf->links;link++)
-	  if(vf->serialnos[link]==vf->current_serialno)break;
-	if(link==vf->links)goto seek_error; /* sign of a bogus stream.
-					       error out, leave
-					       machine uninitialized */
+	  if(vf->serialnos[link]==serialno)break;
+
+	if(link==vf->links) continue; /* not the desired Vorbis
+					 bitstream section; keep
+					 trying */
 	vf->current_link=link;
-	
-	ogg_stream_reset_serialno(&vf->os,vf->current_serialno);
-	ogg_stream_reset_serialno(&work_os,vf->current_serialno); 
+	vf->current_serialno=serialno;
+	ogg_stream_reset_serialno(&vf->os,serialno);
+	ogg_stream_reset_serialno(&work_os,serialno); 
 	vf->ready_state=STREAMSET;
 	
       }
@@ -1095,7 +1289,7 @@
   int link=-1;
   ogg_int64_t result=0;
   ogg_int64_t total=ov_pcm_total(vf,-1);
-
+  
   if(vf->ready_state<OPENED)return(OV_EINVAL);
   if(!vf->seekable)return(OV_ENOSEEK);
 
@@ -1136,8 +1330,9 @@
 	  bisect=begin+1;
       }
       
-      _seek_helper(vf,bisect);
-    
+      result=_seek_helper(vf,bisect);
+      if(result) goto seek_error;
+      
       while(begin<end){
 	result=_get_next_page(vf,&og,end-vf->offset);
 	if(result==OV_EREAD) goto seek_error;
@@ -1148,11 +1343,18 @@
 	    if(bisect==0) goto seek_error;
 	    bisect-=CHUNKSIZE;
 	    if(bisect<=begin)bisect=begin+1;
-	    _seek_helper(vf,bisect);
+	    result=_seek_helper(vf,bisect);
+	    if(result) goto seek_error;
 	  }
 	}else{
-	  ogg_int64_t granulepos=ogg_page_granulepos(&og);
+	  ogg_int64_t granulepos;
+
+	  if(ogg_page_serialno(&og)!=vf->serialnos[link])
+	    continue;
+
+	  granulepos=ogg_page_granulepos(&og);
 	  if(granulepos==-1)continue;
+	  
 	  if(granulepos<target){
 	    best=result;  /* raw offset of packet with granulepos */ 
 	    begin=vf->offset; /* raw offset of next page */
@@ -1168,9 +1370,10 @@
 		end=result;
 		bisect-=CHUNKSIZE; /* an endless loop otherwise. */
 		if(bisect<=begin)bisect=begin+1;
-		_seek_helper(vf,bisect);
+		result=_seek_helper(vf,bisect);
+		if(result) goto seek_error;
 	      }else{
-		end=result;
+		end=bisect;
 		endtime=granulepos;
 		break;
 	      }
@@ -1187,17 +1390,18 @@
       ogg_packet op;
       
       /* seek */
-      _seek_helper(vf,best);
+      result=_seek_helper(vf,best);
       vf->pcm_offset=-1;
+      if(result) goto seek_error;
+      result=_get_next_page(vf,&og,-1);
+      if(result<0) goto seek_error;
       
-      if(_get_next_page(vf,&og,-1)<0)return(OV_EOF); /* shouldn't happen */
-      
       if(link!=vf->current_link){
 	/* Different link; dump entire decode machine */
 	_decode_clear(vf);  
 	
 	vf->current_link=link;
-	vf->current_serialno=ogg_page_serialno(&og);
+	vf->current_serialno=vf->serialnos[link];
 	vf->ready_state=STREAMSET;
 	
       }else{
@@ -1216,13 +1420,15 @@
              get one with a granulepos or without the 'continued' flag
              set.  Then just use raw_seek for simplicity. */
 	  
-	  _seek_helper(vf,best);
+	  result=_seek_helper(vf,best);
+	  if(result<0) goto seek_error;
 	  
 	  while(1){
 	    result=_get_prev_page(vf,&og);
 	    if(result<0) goto seek_error;
-	    if(ogg_page_granulepos(&og)>-1 ||
-	       !ogg_page_continued(&og)){
+	    if(ogg_page_serialno(&og)==vf->current_serialno &&
+	       (ogg_page_granulepos(&og)>-1 ||
+		!ogg_page_continued(&og))){
 	      return ov_raw_seek(vf,result);
 	    }
 	    vf->offset=result;
@@ -1313,19 +1519,20 @@
       
       /* suck in a new page */
       if(_get_next_page(vf,&og,-1)<0)break;
-      if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
+      if(ogg_page_bos(&og))_decode_clear(vf);
       
       if(vf->ready_state<STREAMSET){
+	long serialno=ogg_page_serialno(&og);
 	int link;
 	
-	vf->current_serialno=ogg_page_serialno(&og);
 	for(link=0;link<vf->links;link++)
-	  if(vf->serialnos[link]==vf->current_serialno)break;
-	if(link==vf->links)return(OV_EBADLINK);
+	  if(vf->serialnos[link]==serialno)break;
+	if(link==vf->links) continue; 
 	vf->current_link=link;
 	
-	ogg_stream_reset_serialno(&vf->os,vf->current_serialno); 
 	vf->ready_state=STREAMSET;      
+	vf->current_serialno=ogg_page_serialno(&og);
+	ogg_stream_reset_serialno(&vf->os,serialno); 
 	ret=_make_decode_ready(vf);
 	if(ret)return ret;
 	lastblock=0;
@@ -1360,20 +1567,23 @@
   /* translate time to PCM position and call ov_pcm_seek */
 
   int link=-1;
-  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
-  double time_total=ov_time_total(vf,-1);
+  ogg_int64_t pcm_total=0;
+  double time_total=0.;
 
   if(vf->ready_state<OPENED)return(OV_EINVAL);
   if(!vf->seekable)return(OV_ENOSEEK);
-  if(seconds<0 || seconds>time_total)return(OV_EINVAL);
+  if(seconds<0)return(OV_EINVAL);
   
   /* which bitstream section does this time offset occur in? */
-  for(link=vf->links-1;link>=0;link--){
-    pcm_total-=vf->pcmlengths[link*2+1];
-    time_total-=ov_time_total(vf,link);
-    if(seconds>=time_total)break;
+  for(link=0;link<vf->links;link++){
+    double addsec = ov_time_total(vf,link);
+    if(seconds<time_total+addsec)break;
+    time_total+=addsec;
+    pcm_total+=vf->pcmlengths[link*2+1];
   }
 
+  if(link==vf->links)return(OV_EINVAL);
+
   /* enough information to convert time offset to pcm offset */
   {
     ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;
@@ -1387,20 +1597,23 @@
   /* translate time to PCM position and call ov_pcm_seek */
 
   int link=-1;
-  ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
-  double time_total=ov_time_total(vf,-1);
+  ogg_int64_t pcm_total=0;
+  double time_total=0.;
 
   if(vf->ready_state<OPENED)return(OV_EINVAL);
   if(!vf->seekable)return(OV_ENOSEEK);
-  if(seconds<0 || seconds>time_total)return(OV_EINVAL);
+  if(seconds<0)return(OV_EINVAL);
   
   /* which bitstream section does this time offset occur in? */
-  for(link=vf->links-1;link>=0;link--){
-    pcm_total-=vf->pcmlengths[link*2+1];
-    time_total-=ov_time_total(vf,link);
-    if(seconds>=time_total)break;
+  for(link=0;link<vf->links;link++){
+    double addsec = ov_time_total(vf,link);
+    if(seconds<time_total+addsec)break;
+    time_total+=addsec;
+    pcm_total+=vf->pcmlengths[link*2+1];
   }
 
+  if(link==vf->links)return(OV_EINVAL);
+
   /* enough information to convert time offset to pcm offset */
   {
     ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;

Modified: branches/vorbis-aotuv/lib/window.c
===================================================================
--- branches/vorbis-aotuv/lib/window.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/window.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: window functions
- last mod: $Id: window.c,v 1.23 2003/09/01 22:59:54 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/lib/window.h
===================================================================
--- branches/vorbis-aotuv/lib/window.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/lib/window.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: window functions
- last mod: $Id: window.h,v 1.14 2003/09/05 22:17:41 giles Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/macosx/Info.plist
===================================================================
--- branches/vorbis-aotuv/macosx/Info.plist	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/macosx/Info.plist	2008-04-01 10:47:58 UTC (rev 14647)
@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<string>Vorbis</string>
 	<key>CFBundleGetInfoString</key>
-	<string>Vorbis framework 1.1.1, Copyright © 1994-2005 Xiph.Org Foundation</string>
+	<string>Vorbis framework 1.2.0, Copyright © 1994-2007 Xiph.Org Foundation</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
@@ -17,13 +17,13 @@
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.1.1</string>
+	<string>1.2.0</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>1.1.1d1</string>
+	<string>1.2.0</string>
 	<key>NSHumanReadableCopyright</key>
-	<string>Vorbis framework 1.1.1, Copyright © 1994-2005 Xiph.Org Foundation</string>
+	<string>Vorbis framework 1.2.0, Copyright © 1994-2007 Xiph.Org Foundation</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: branches/vorbis-aotuv/macosx/Vorbis.xcodeproj/project.pbxproj
===================================================================
--- branches/vorbis-aotuv/macosx/Vorbis.xcodeproj/project.pbxproj	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/macosx/Vorbis.xcodeproj/project.pbxproj	2008-04-01 10:47:58 UTC (rev 14647)
@@ -73,38 +73,38 @@
 		730F23E7091827B100AB638C /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65F03389C830112CE8F /* vorbisfile.c */; };
 		730F23E8091827B100AB638C /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F66003389C830112CE8F /* window.c */; };
 		730F23FB0918281100AB638C /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 730F23FA0918281100AB638C /* Ogg.framework */; };
+		738835F40B18FF50005C7A69 /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F63803389C830112CE8F /* mdct.c */; };
+		738835F70B18FF58005C7A69 /* smallft.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65A03389C830112CE8F /* smallft.c */; };
+		738835F80B18FF61005C7A69 /* block.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F60F03389C830112CE8F /* block.c */; };
+		738835F90B18FF67005C7A69 /* envelope.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62603389C830112CE8F /* envelope.c */; };
+		738835FA0B18FF71005C7A69 /* window.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F66003389C830112CE8F /* window.c */; };
+		738835FB0B18FF7A005C7A69 /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F63203389C830112CE8F /* lsp.c */; };
+		738835FC0B18FF82005C7A69 /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F63003389C830112CE8F /* lpc.c */; };
+		738835FD0B18FF93005C7A69 /* analysis.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F60A03389C830112CE8F /* analysis.c */; };
+		738835FE0B18FF9C005C7A69 /* synthesis.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65C03389C830112CE8F /* synthesis.c */; };
+		738835FF0B18FF9E005C7A69 /* psy.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65203389C830112CE8F /* psy.c */; };
+		738836000B18FFCB005C7A69 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62B03389C830112CE8F /* info.c */; };
+		738836010B18FFE5005C7A69 /* floor1.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62903389C830112CE8F /* floor1.c */; };
+		738836020B18FFE5005C7A69 /* floor0.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62803389C830112CE8F /* floor0.c */; };
+		738836030B18FFED005C7A69 /* res0.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65703389C830112CE8F /* res0.c */; };
+		738836040B18FFF0005C7A69 /* mapping0.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F63603389C830112CE8F /* mapping0.c */; };
+		738836050B18FFF8005C7A69 /* registry.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65503389C830112CE8F /* registry.c */; };
+		738836060B18FFFD005C7A69 /* codebook.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62303389C830112CE8F /* codebook.c */; };
+		738836070B190001005C7A69 /* sharedbook.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65903389C830112CE8F /* sharedbook.c */; };
+		738836080B190008005C7A69 /* lookup.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F62C03389C830112CE8F /* lookup.c */; };
+		738836090B19000B005C7A69 /* bitrate.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F60D03389C830112CE8F /* bitrate.c */; };
+		738836140B1904A5005C7A69 /* vorbisenc.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65E03389C830112CE8F /* vorbisenc.c */; };
+		738836230B190601005C7A69 /* vorbisfile.c in Sources */ = {isa = PBXBuildFile; fileRef = F5D8F65F03389C830112CE8F /* vorbisfile.c */; };
 /* End PBXBuildFile section */
 
-/* Begin PBXBuildStyle section */
-		014CEA440018CDF011CA2923 /* Development */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-				GCC_DYNAMIC_NO_PIC = NO;
-				GCC_ENABLE_FIX_AND_CONTINUE = YES;
-				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
-				OPTIMIZATION_CFLAGS = "-O0";
-				ZERO_LINK = YES;
-			};
-			name = Development;
-		};
-		014CEA450018CDF011CA2923 /* Deployment */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-				GCC_ENABLE_FIX_AND_CONTINUE = NO;
-				ZERO_LINK = NO;
-			};
-			name = Deployment;
-		};
-/* End PBXBuildStyle section */
-
 /* Begin PBXFileReference section */
 		089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		730F23F0091827B100AB638C /* Info.plist */ = {isa = PBXFileReference; explicitFileType = text.plist; fileEncoding = 4; path = Info.plist; sourceTree = "<group>"; };
 		730F23F1091827B100AB638C /* Vorbis.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Vorbis.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		730F23FA0918281100AB638C /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
+		738835E40B18F870005C7A69 /* libvorbis.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvorbis.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		738836130B190488005C7A69 /* libvorbisenc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvorbisenc.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		738836220B1905E5005C7A69 /* libvorbisfile.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libvorbisfile.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		F58520B90191D12B01A802FE /* codec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = codec.h; sourceTree = "<group>"; };
 		F58520BA0191D12B01A802FE /* vorbisenc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vorbisenc.h; sourceTree = "<group>"; };
 		F58520BB0191D12B01A802FE /* vorbisfile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vorbisfile.h; sourceTree = "<group>"; };
@@ -184,6 +184,27 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		738835E20B18F870005C7A69 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		738836110B190488005C7A69 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		738836200B1905E5005C7A69 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
@@ -191,6 +212,9 @@
 			isa = PBXGroup;
 			children = (
 				730F23F1091827B100AB638C /* Vorbis.framework */,
+				738835E40B18F870005C7A69 /* libvorbis.a */,
+				738836130B190488005C7A69 /* libvorbisenc.a */,
+				738836220B1905E5005C7A69 /* libvorbisfile.a */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -400,6 +424,27 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		738835E00B18F870005C7A69 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		7388360F0B190488005C7A69 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		7388361E0B1905E5005C7A69 /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXHeadersBuildPhase section */
 
 /* Begin PBXNativeTarget section */
@@ -415,28 +460,6 @@
 			);
 			buildRules = (
 			);
-			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_SEARCH_PATHS = (
-					/Library/Frameworks,
-					../../ogg/macosx/build,
-				);
-				FRAMEWORK_VERSION = A;
-				HEADER_SEARCH_PATHS = "";
-				INSTALL_PATH = /Library/Frameworks;
-				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "-D__MACOSX__";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = Vorbis;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
-			};
 			dependencies = (
 			);
 			name = Vorbis;
@@ -445,24 +468,72 @@
 			productReference = 730F23F1091827B100AB638C /* Vorbis.framework */;
 			productType = "com.apple.product-type.framework";
 		};
+		738835E30B18F870005C7A69 /* libvorbis (static) */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 738835E50B18F88E005C7A69 /* Build configuration list for PBXNativeTarget "libvorbis (static)" */;
+			buildPhases = (
+				738835E00B18F870005C7A69 /* Headers */,
+				738835E10B18F870005C7A69 /* Sources */,
+				738835E20B18F870005C7A69 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "libvorbis (static)";
+			productName = vorbis;
+			productReference = 738835E40B18F870005C7A69 /* libvorbis.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		738836120B190488005C7A69 /* libvorbisenc (static) */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 7388361A0B1904D6005C7A69 /* Build configuration list for PBXNativeTarget "libvorbisenc (static)" */;
+			buildPhases = (
+				7388360F0B190488005C7A69 /* Headers */,
+				738836100B190488005C7A69 /* Sources */,
+				738836110B190488005C7A69 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "libvorbisenc (static)";
+			productName = vorbisenc;
+			productReference = 738836130B190488005C7A69 /* libvorbisenc.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		738836210B1905E5005C7A69 /* libvorbisfile (static) */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 738836250B19065D005C7A69 /* Build configuration list for PBXNativeTarget "libvorbisfile (static)" */;
+			buildPhases = (
+				7388361E0B1905E5005C7A69 /* Headers */,
+				7388361F0B1905E5005C7A69 /* Sources */,
+				738836200B1905E5005C7A69 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "libvorbisfile (static)";
+			productName = vorbisfile;
+			productReference = 738836220B1905E5005C7A69 /* libvorbisfile.a */;
+			productType = "com.apple.product-type.library.static";
+		};
 /* End PBXNativeTarget section */
 
 /* Begin PBXProject section */
 		0867D690FE84028FC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 730F23F3091827B200AB638C /* Build configuration list for PBXProject "Vorbis" */;
-			buildSettings = {
-			};
-			buildStyles = (
-				014CEA440018CDF011CA2923 /* Development */,
-				014CEA450018CDF011CA2923 /* Deployment */,
-			);
 			hasScannedForEncodings = 0;
 			mainGroup = 0867D691FE84028FC02AAC07 /* vorbis */;
 			productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
 			projectDirPath = "";
 			targets = (
 				730F23A1091827B100AB638C /* Vorbis */,
+				738835E30B18F870005C7A69 /* libvorbis (static) */,
+				738836120B190488005C7A69 /* libvorbisenc (static) */,
+				738836210B1905E5005C7A69 /* libvorbisfile (static) */,
 			);
 		};
 /* End PBXProject section */
@@ -518,6 +589,49 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		738835E10B18F870005C7A69 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				738835F40B18FF50005C7A69 /* mdct.c in Sources */,
+				738835F70B18FF58005C7A69 /* smallft.c in Sources */,
+				738835F80B18FF61005C7A69 /* block.c in Sources */,
+				738835F90B18FF67005C7A69 /* envelope.c in Sources */,
+				738835FA0B18FF71005C7A69 /* window.c in Sources */,
+				738835FB0B18FF7A005C7A69 /* lsp.c in Sources */,
+				738835FC0B18FF82005C7A69 /* lpc.c in Sources */,
+				738835FD0B18FF93005C7A69 /* analysis.c in Sources */,
+				738835FE0B18FF9C005C7A69 /* synthesis.c in Sources */,
+				738835FF0B18FF9E005C7A69 /* psy.c in Sources */,
+				738836000B18FFCB005C7A69 /* info.c in Sources */,
+				738836010B18FFE5005C7A69 /* floor1.c in Sources */,
+				738836020B18FFE5005C7A69 /* floor0.c in Sources */,
+				738836030B18FFED005C7A69 /* res0.c in Sources */,
+				738836040B18FFF0005C7A69 /* mapping0.c in Sources */,
+				738836050B18FFF8005C7A69 /* registry.c in Sources */,
+				738836060B18FFFD005C7A69 /* codebook.c in Sources */,
+				738836070B190001005C7A69 /* sharedbook.c in Sources */,
+				738836080B190008005C7A69 /* lookup.c in Sources */,
+				738836090B19000B005C7A69 /* bitrate.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		738836100B190488005C7A69 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				738836140B1904A5005C7A69 /* vorbisenc.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		7388361F0B1905E5005C7A69 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				738836230B190601005C7A69 /* vorbisfile.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXVariantGroup section */
@@ -532,7 +646,7 @@
 /* End PBXVariantGroup section */
 
 /* Begin XCBuildConfiguration section */
-		730F23ED091827B100AB638C /* Development */ = {
+		730F23ED091827B100AB638C /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
@@ -543,12 +657,10 @@
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_FIX_AND_CONTINUE = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-				GCC_OPTIMIZATION_LEVEL = 0;
 				HEADER_SEARCH_PATHS = ../lib;
 				INFOPLIST_FILE = Info.plist;
 				INSTALL_PATH = /Library/Frameworks;
 				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				PRODUCT_NAME = Vorbis;
 				SECTORDER_FLAGS = "";
@@ -560,9 +672,9 @@
 				WRAPPER_EXTENSION = framework;
 				ZERO_LINK = YES;
 			};
-			name = Development;
+			name = Debug;
 		};
-		730F23EE091827B100AB638C /* Deployment */ = {
+		730F23EE091827B100AB638C /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = YES;
@@ -575,7 +687,6 @@
 				INFOPLIST_FILE = Info.plist;
 				INSTALL_PATH = /Library/Frameworks;
 				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
 				PRODUCT_NAME = Vorbis;
 				SECTORDER_FLAGS = "";
@@ -587,76 +698,193 @@
 				WRAPPER_EXTENSION = framework;
 				ZERO_LINK = NO;
 			};
-			name = Deployment;
+			name = Release;
 		};
-		730F23EF091827B100AB638C /* Default */ = {
+		730F23F4091827B200AB638C /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				DYLIB_COMPATIBILITY_VERSION = 1;
-				DYLIB_CURRENT_VERSION = 1;
-				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
-				FRAMEWORK_VERSION = A;
-				HEADER_SEARCH_PATHS = ../lib;
-				INFOPLIST_FILE = Info.plist;
-				INSTALL_PATH = /Library/Frameworks;
-				LIBRARY_SEARCH_PATHS = "";
-				OTHER_CFLAGS = "";
-				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = Vorbis;
-				SECTORDER_FLAGS = "";
-				WARNING_CFLAGS = (
-					"-Wmost",
-					"-Wno-four-char-constants",
-					"-Wno-unknown-pragmas",
-				);
-				WRAPPER_EXTENSION = framework;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
 			};
-			name = Default;
+			name = Debug;
 		};
-		730F23F4091827B200AB638C /* Development */ = {
+		730F23F5091827B200AB638C /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				GCC_OPTIMIZATION_LEVEL = 3;
 				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				OTHER_CFLAGS = (
+					"$(OTHER_CFLAGS)",
+					"-ffast-math",
+					"-falign-loops=16",
+				);
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
 			};
-			name = Development;
+			name = Release;
 		};
-		730F23F5091827B200AB638C /* Deployment */ = {
+		738835E60B18F88E005C7A69 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbis;
+				ZERO_LINK = YES;
 			};
-			name = Deployment;
+			name = Debug;
 		};
-		730F23F6091827B200AB638C /* Default */ = {
+		738835E70B18F88E005C7A69 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbis;
+				ZERO_LINK = NO;
 			};
-			name = Default;
+			name = Release;
 		};
+		7388361B0B1904D6005C7A69 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../lib,
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbisenc;
+				ZERO_LINK = YES;
+			};
+			name = Debug;
+		};
+		7388361C0B1904D6005C7A69 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../lib,
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbisenc;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
+		738836260B19065D005C7A69 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbisfile;
+				ZERO_LINK = YES;
+			};
+			name = Debug;
+		};
+		738836270B19065D005C7A69 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					../../ogg/include,
+				);
+				INSTALL_PATH = /usr/local/lib;
+				PREBINDING = NO;
+				PRODUCT_NAME = vorbisfile;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
 		730F23EC091827B100AB638C /* Build configuration list for PBXNativeTarget "Vorbis" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				730F23ED091827B100AB638C /* Development */,
-				730F23EE091827B100AB638C /* Deployment */,
-				730F23EF091827B100AB638C /* Default */,
+				730F23ED091827B100AB638C /* Debug */,
+				730F23EE091827B100AB638C /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
+			defaultConfigurationName = Release;
 		};
 		730F23F3091827B200AB638C /* Build configuration list for PBXProject "Vorbis" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
-				730F23F4091827B200AB638C /* Development */,
-				730F23F5091827B200AB638C /* Deployment */,
-				730F23F6091827B200AB638C /* Default */,
+				730F23F4091827B200AB638C /* Debug */,
+				730F23F5091827B200AB638C /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Default;
+			defaultConfigurationName = Release;
 		};
+		738835E50B18F88E005C7A69 /* Build configuration list for PBXNativeTarget "libvorbis (static)" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				738835E60B18F88E005C7A69 /* Debug */,
+				738835E70B18F88E005C7A69 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		7388361A0B1904D6005C7A69 /* Build configuration list for PBXNativeTarget "libvorbisenc (static)" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7388361B0B1904D6005C7A69 /* Debug */,
+				7388361C0B1904D6005C7A69 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		738836250B19065D005C7A69 /* Build configuration list for PBXNativeTarget "libvorbisfile (static)" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				738836260B19065D005C7A69 /* Debug */,
+				738836270B19065D005C7A69 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = 0867D690FE84028FC02AAC07 /* Project object */;

Modified: branches/vorbis-aotuv/vq/Makefile.am
===================================================================
--- branches/vorbis-aotuv/vq/Makefile.am	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/Makefile.am	2008-04-01 10:47:58 UTC (rev 14647)
@@ -10,17 +10,17 @@
 LDADD = ../lib/libvorbis.la
 
 latticebuild_SOURCES = latticebuild.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
+	vqgen.h bookutil.h localcodebook.h
 latticepare_SOURCES = latticepare.c vqgen.c bookutil.c vqsplit.c\
-	vqgen.h bookutil.h
+	vqgen.h vqsplit.h bookutil.h localcodebook.h
 latticehint_SOURCES = latticehint.c bookutil.c\
-	bookutil.h
+	vqsplit.h bookutil.h localcodebook.h
 latticetune_SOURCES = latticetune.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
+	vqgen.h bookutil.h localcodebook.h
 huffbuild_SOURCES = huffbuild.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
+	vqgen.h bookutil.h localcodebook.h
 distribution_SOURCES = distribution.c bookutil.c\
-	bookutil.h
+	bookutil.h localcodebook.h
 
 EXTRA_DIST = residue_entropy auxpartition.pl
 

Modified: branches/vorbis-aotuv/vq/bookutil.c
===================================================================
--- branches/vorbis-aotuv/vq/bookutil.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/bookutil.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,7 +6,7 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/vq/bookutil.h
===================================================================
--- branches/vorbis-aotuv/vq/bookutil.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/bookutil.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,7 +6,7 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 

Modified: branches/vorbis-aotuv/vq/build.c
===================================================================
--- branches/vorbis-aotuv/vq/build.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/build.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building codebooks from training sets
- last mod: $Id: build.c,v 1.21 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/cascade.c
===================================================================
--- branches/vorbis-aotuv/vq/cascade.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/cascade.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: function call to do simple data cascading
- last mod: $Id: cascade.c,v 1.13 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/distribution.c
===================================================================
--- branches/vorbis-aotuv/vq/distribution.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/distribution.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility for finding the distribution in a data set
- last mod: $Id: distribution.c,v 1.9 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/genericdata.c
===================================================================
--- branches/vorbis-aotuv/vq/genericdata.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/genericdata.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: generic euclidian distance metric for VQ codebooks
- last mod: $Id: genericdata.c,v 1.11 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/huffbuild.c
===================================================================
--- branches/vorbis-aotuv/vq/huffbuild.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/huffbuild.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: hufftree builder
- last mod: $Id: huffbuild.c,v 1.13 2002/06/28 22:19:56 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/latticebuild.c
===================================================================
--- branches/vorbis-aotuv/vq/latticebuild.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/latticebuild.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building codebooks from lattice descriptions
- last mod: $Id: latticebuild.c,v 1.12 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/latticehint.c
===================================================================
--- branches/vorbis-aotuv/vq/latticehint.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/latticehint.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building thresh/pigeonhole encode hints
- last mod: $Id: latticehint.c,v 1.12 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/latticepare.c
===================================================================
--- branches/vorbis-aotuv/vq/latticepare.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/latticepare.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility for paring low hit count cells from lattice codebook
- last mod: $Id: latticepare.c,v 1.11 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/latticetune.c
===================================================================
--- branches/vorbis-aotuv/vq/latticetune.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/latticetune.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,13 +6,13 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for setting entropy encoding parameters
            for lattice codebooks
- last mod: $Id: latticetune.c,v 1.11 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/localcodebook.h
===================================================================
--- branches/vorbis-aotuv/vq/localcodebook.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/localcodebook.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: codebook.h,v 1.13 2002/06/28 22:19:35 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/lspdata.c
===================================================================
--- branches/vorbis-aotuv/vq/lspdata.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/lspdata.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: metrics and quantization code for LSP VQ codebooks
- last mod: $Id: lspdata.c,v 1.19 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/metrics.c
===================================================================
--- branches/vorbis-aotuv/vq/metrics.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/metrics.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: function calls to collect codebook metrics
- last mod: $Id: metrics.c,v 1.15 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/residuedata.c
===================================================================
--- branches/vorbis-aotuv/vq/residuedata.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/residuedata.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: metrics and quantization code for residue VQ codebooks
- last mod: $Id: residuedata.c,v 1.10 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/residuesplit.c
===================================================================
--- branches/vorbis-aotuv/vq/residuesplit.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/residuesplit.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: residue backend 0 partitioner/classifier
- last mod: $Id: residuesplit.c,v 1.13 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/run.c
===================================================================
--- branches/vorbis-aotuv/vq/run.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/run.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for loading and operating on codebooks
- last mod: $Id: run.c,v 1.15 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/train.c
===================================================================
--- branches/vorbis-aotuv/vq/train.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/train.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: utility main for training codebooks
- last mod: $Id: train.c,v 1.24 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/vqext.h
===================================================================
--- branches/vorbis-aotuv/vq/vqext.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/vqext.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: prototypes for extermal metrics specific to data type
- last mod: $Id: vqext.h,v 1.14 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/vqgen.c
===================================================================
--- branches/vorbis-aotuv/vq/vqgen.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/vqgen.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: train a VQ codebook 
- last mod: $Id: vqgen.c,v 1.41 2002/10/11 07:44:28 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/vqgen.h
===================================================================
--- branches/vorbis-aotuv/vq/vqgen.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/vqgen.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook 
- last mod: $Id: vqgen.h,v 1.19 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/vqsplit.c
===================================================================
--- branches/vorbis-aotuv/vq/vqsplit.c	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/vqsplit.c	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook and the encoding decision 'tree'
- last mod: $Id: vqsplit.c,v 1.26 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Modified: branches/vorbis-aotuv/vq/vqsplit.h
===================================================================
--- branches/vorbis-aotuv/vq/vqsplit.h	2008-03-31 15:23:02 UTC (rev 14646)
+++ branches/vorbis-aotuv/vq/vqsplit.h	2008-04-01 10:47:58 UTC (rev 14647)
@@ -6,12 +6,12 @@
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
- * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook decision tree 
- last mod: $Id: vqsplit.h,v 1.8 2001/12/20 01:00:40 segher Exp $
+ last mod: $Id$
 
  ********************************************************************/
 

Added: branches/vorbis-aotuv/win32/VS2005/libvorbis/libvorbis.vcproj
===================================================================
--- branches/vorbis-aotuv/win32/VS2005/libvorbis/libvorbis.vcproj	                        (rev 0)
+++ branches/vorbis-aotuv/win32/VS2005/libvorbis/libvorbis.vcproj	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,653 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libvorbis"
+	ProjectGUID="{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}"
+	RootNamespace="libvorbis"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbis.dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile="..\..\vorbis.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/libvorbis.pdb"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/libvorbis.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4100;4267;4189;4305;4127;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbis.dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile="..\..\vorbis.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="$(OutDir)/libvorbis.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4100;4267;4189;4305;4127;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbis.dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile="..\..\vorbis.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="$(OutDir)/libvorbis.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBVORBIS_EXPORTS"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+				DisableSpecificWarnings="4244;4100;4267;4189;4305;4127;4706"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbis.dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile="..\..\vorbis.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				ImportLibrary="$(OutDir)/libvorbis.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\lib\analysis.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\bitrate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\block.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\codebook.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\envelope.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\floor0.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\floor1.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\info.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lookup.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lpc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lsp.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\mapping0.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\mdct.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\psy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\registry.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\res0.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\sharedbook.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\smallft.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\synthesis.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\vorbis.def"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\vorbisenc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\window.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\lib\backends.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\bitrate.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\codebook.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\vorbis\codec.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\codec_internal.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\envelope.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\floor_all.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\books\floor\floor_books.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\highlevel.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lookup.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lookup_data.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lpc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\lsp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\masking.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\mdct.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\misc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\os.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\psy.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\psych_11.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\psych_16.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\psych_44.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\psych_8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\registry.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\books\coupled\res_books_stereo.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\books\uncoupled\res_books_uncoupled.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\residue_16.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\residue_44.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\residue_44u.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\residue_8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\scales.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_11.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_16.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_22.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_32.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_44.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_44u.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_8.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\modes\setup_X.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\smallft.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\vorbis\vorbisenc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\include\vorbis\vorbisfile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\window.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.def
===================================================================
--- branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.def	                        (rev 0)
+++ branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.def	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,47 @@
+LIBRARY	libvorbisfile
+EXPORTS
+ov_clear
+ov_open
+ov_open_callbacks
+;
+ov_test
+ov_test_callbacks
+ov_test_open
+;
+ov_bitrate
+ov_bitrate_instant
+;
+ov_streams
+ov_seekable
+ov_serialnumber
+;
+ov_raw_total
+ov_pcm_total
+ov_time_total
+;
+ov_raw_seek
+ov_pcm_seek
+ov_pcm_seek_page
+ov_time_seek
+ov_time_seek_page
+;
+ov_raw_seek_lap
+ov_pcm_seek_lap
+ov_pcm_seek_page_lap
+ov_time_seek_lap
+ov_time_seek_page_lap
+;
+ov_raw_tell
+ov_pcm_tell
+ov_time_tell
+;
+ov_info
+ov_comment
+;
+ov_read_float
+ov_read
+ov_crosslap
+;
+ov_halfrate
+ov_halfrate_p
+;
\ No newline at end of file

Added: branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.vcproj
===================================================================
--- branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.vcproj	                        (rev 0)
+++ branches/vorbis-aotuv/win32/VS2005/libvorbisfile/libvorbisfile.vcproj	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="libvorbisfile"
+	ProjectGUID="{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}"
+	RootNamespace="libvorbisfile"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBVORBISFILE_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbisfile.dll"
+				LinkIncremental="2"
+				ModuleDefinitionFile="libvorbisfile.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/libvorbisfile.pdb"
+				SubSystem="2"
+				ImportLibrary="$(OutDir)/libvorbisfile.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBVORBISFILE_EXPORTS"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/libvorbisfile.dll"
+				LinkIncremental="1"
+				ModuleDefinitionFile="libvorbisfile.def"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/libvorbisfile.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\libvorbisfile.def"
+				>
+			</File>
+			<File
+				RelativePath="..\..\..\lib\vorbisfile.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\include\vorbis\vorbisfile.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: branches/vorbis-aotuv/win32/VS2005/vorbisdec/vorbisdec.vcproj
===================================================================
--- branches/vorbis-aotuv/win32/VS2005/vorbisdec/vorbisdec.vcproj	                        (rev 0)
+++ branches/vorbis-aotuv/win32/VS2005/vorbisdec/vorbisdec.vcproj	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,389 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="vorbisdec"
+	ProjectGUID="{5833EEA1-1068-431F-A6E5-316E7DC5D90A}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisdec.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/vorbisdec.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE2|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisdec.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\examples\decoder_example.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: branches/vorbis-aotuv/win32/VS2005/vorbisenc/vorbisenc.vcproj
===================================================================
--- branches/vorbis-aotuv/win32/VS2005/vorbisenc/vorbisenc.vcproj	                        (rev 0)
+++ branches/vorbis-aotuv/win32/VS2005/vorbisenc/vorbisenc.vcproj	2008-04-01 10:47:58 UTC (rev 14647)
@@ -0,0 +1,390 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="vorbisenc"
+	ProjectGUID="{E48B6A8B-F7FE-4DA8-8248-E64DBAC4F56C}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				ExceptionHandling="0"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisenc.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/vorbisenc.pdb"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				StringPooling="true"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/vorbisenc.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_SSE|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"