Merge branch_beta3 onto the mainline.
authorMonty <xiphmont@xiph.org>
Mon, 6 Nov 2000 00:07:26 +0000 (00:07 +0000)
committerMonty <xiphmont@xiph.org>
Mon, 6 Nov 2000 00:07:26 +0000 (00:07 +0000)
Monty

svn path=/trunk/vorbis/; revision=990

221 files changed:
.cvsignore
Makefile.am
acinclude.m4 [new file with mode: 0644]
configure.in
doc/Makefile.am
doc/framing.html [deleted file]
doc/oggstream.html [deleted file]
doc/stream.png [deleted file]
doc/vorbis-clip.txt [new file with mode: 0644]
doc/vorbis-errors.txt [new file with mode: 0644]
doc/vorbisfile/.cvsignore [moved from include/vorbis/book/.cvsignore with 100% similarity]
doc/vorbisfile/Makefile.am [new file with mode: 0644]
doc/vorbisfile/OggVorbis_File.html [new file with mode: 0644]
doc/vorbisfile/chaining_example_c.html [new file with mode: 0644]
doc/vorbisfile/chainingexample.html [new file with mode: 0644]
doc/vorbisfile/datastructures.html [new file with mode: 0644]
doc/vorbisfile/decoding.html [new file with mode: 0644]
doc/vorbisfile/example.html [new file with mode: 0644]
doc/vorbisfile/exampleindex.html [new file with mode: 0644]
doc/vorbisfile/fileinfo.html [new file with mode: 0644]
doc/vorbisfile/index.html [new file with mode: 0644]
doc/vorbisfile/initialization.html [new file with mode: 0644]
doc/vorbisfile/ov_bitrate.html [new file with mode: 0644]
doc/vorbisfile/ov_bitrate_instant.html [new file with mode: 0644]
doc/vorbisfile/ov_callbacks.html [new file with mode: 0644]
doc/vorbisfile/ov_clear.html [new file with mode: 0644]
doc/vorbisfile/ov_comment.html [new file with mode: 0644]
doc/vorbisfile/ov_info.html [new file with mode: 0644]
doc/vorbisfile/ov_open.html [new file with mode: 0644]
doc/vorbisfile/ov_open_callbacks.html [new file with mode: 0644]
doc/vorbisfile/ov_pcm_seek.html [new file with mode: 0644]
doc/vorbisfile/ov_pcm_seek_page.html [new file with mode: 0644]
doc/vorbisfile/ov_pcm_tell.html [new file with mode: 0644]
doc/vorbisfile/ov_pcm_total.html [new file with mode: 0644]
doc/vorbisfile/ov_raw_seek.html [new file with mode: 0644]
doc/vorbisfile/ov_raw_tell.html [new file with mode: 0644]
doc/vorbisfile/ov_raw_total.html [new file with mode: 0644]
doc/vorbisfile/ov_read.html [new file with mode: 0644]
doc/vorbisfile/ov_seekable.html [new file with mode: 0644]
doc/vorbisfile/ov_serialnumber.html [new file with mode: 0644]
doc/vorbisfile/ov_streams.html [new file with mode: 0644]
doc/vorbisfile/ov_time_seek.html [new file with mode: 0644]
doc/vorbisfile/ov_time_seek_page.html [new file with mode: 0644]
doc/vorbisfile/ov_time_tell.html [new file with mode: 0644]
doc/vorbisfile/ov_time_total.html [new file with mode: 0644]
doc/vorbisfile/overview.html [new file with mode: 0644]
doc/vorbisfile/reference.html [new file with mode: 0644]
doc/vorbisfile/seekexample.html [new file with mode: 0644]
doc/vorbisfile/seeking.html [new file with mode: 0644]
doc/vorbisfile/seeking_example_c.html [new file with mode: 0644]
doc/vorbisfile/seeking_test_c.html [new file with mode: 0644]
doc/vorbisfile/seekingexample.html [new file with mode: 0644]
doc/vorbisfile/style.css [new file with mode: 0644]
doc/vorbisfile/vorbis_comment.html [new file with mode: 0644]
doc/vorbisfile/vorbis_info.html [new file with mode: 0644]
doc/vorbisfile/vorbisfile_example_c.html [new file with mode: 0644]
examples/.cvsignore
examples/Makefile.am
examples/chaining_example.c
examples/decoder_example.c
examples/encoder_example.c
examples/seeking_example.c
examples/vorbisfile_example.c
include/vorbis/Makefile.am
include/vorbis/book/Makefile.am [deleted file]
include/vorbis/codec.h
include/vorbis/vorbisenc.h [new file with mode: 0644]
include/vorbis/vorbisfile.h
lib/Makefile.am
lib/analysis.c
lib/backends.h [moved from include/vorbis/backends.h with 87% similarity]
lib/barkmel.c
lib/block.c
lib/bookinternal.h [deleted file]
lib/books/.cvsignore [new file with mode: 0644]
lib/books/Makefile.am [new file with mode: 0644]
lib/books/lsp12_0.vqh [moved from include/vorbis/book/lsp12_0.vqh with 99% similarity]
lib/books/lsp30_0.vqh [moved from include/vorbis/book/lsp30_0.vqh with 99% similarity]
lib/books/res0_1024a_128_1.vqh [moved from include/vorbis/book/res0_1024a_128_1.vqh with 81% similarity]
lib/books/res0_1024a_128_2.vqh [moved from include/vorbis/book/res0_1024a_128_2.vqh with 81% similarity]
lib/books/res0_1024a_128_3.vqh [moved from include/vorbis/book/res0_1024a_128_3.vqh with 90% similarity]
lib/books/res0_1024a_128_4.vqh [moved from include/vorbis/book/res0_1024a_128_4.vqh with 90% similarity]
lib/books/res0_1024a_128_5.vqh [moved from include/vorbis/book/res0_1024a_128_5.vqh with 96% similarity]
lib/books/res0_1024a_128_6.vqh [moved from include/vorbis/book/res0_1024a_128_6.vqh with 96% similarity]
lib/books/res0_1024a_128_7.vqh [moved from include/vorbis/book/res0_1024a_128_7.vqh with 83% similarity]
lib/books/res0_1024a_128_8.vqh [moved from include/vorbis/book/res0_1024a_128_8.vqh with 86% similarity]
lib/books/res0_1024a_128_9.vqh [moved from include/vorbis/book/res0_1024a_128_9.vqh with 90% similarity]
lib/books/res0_1024a_160_1.vqh [moved from include/vorbis/book/res0_1024a_160_1.vqh with 81% similarity]
lib/books/res0_1024a_160_2.vqh [moved from include/vorbis/book/res0_1024a_160_2.vqh with 81% similarity]
lib/books/res0_1024a_160_3.vqh [moved from include/vorbis/book/res0_1024a_160_3.vqh with 90% similarity]
lib/books/res0_1024a_160_4.vqh [moved from include/vorbis/book/res0_1024a_160_4.vqh with 90% similarity]
lib/books/res0_1024a_160_5.vqh [moved from include/vorbis/book/res0_1024a_160_5.vqh with 96% similarity]
lib/books/res0_1024a_160_6.vqh [moved from include/vorbis/book/res0_1024a_160_6.vqh with 96% similarity]
lib/books/res0_1024a_160_7.vqh [moved from include/vorbis/book/res0_1024a_160_7.vqh with 83% similarity]
lib/books/res0_1024a_160_8.vqh [moved from include/vorbis/book/res0_1024a_160_8.vqh with 86% similarity]
lib/books/res0_1024a_160_9.vqh [moved from include/vorbis/book/res0_1024a_160_9.vqh with 90% similarity]
lib/books/res0_1024a_192_1.vqh [moved from include/vorbis/book/res0_1024a_192_1.vqh with 81% similarity]
lib/books/res0_1024a_192_2.vqh [moved from include/vorbis/book/res0_1024a_192_2.vqh with 90% similarity]
lib/books/res0_1024a_192_3.vqh [moved from include/vorbis/book/res0_1024a_192_3.vqh with 96% similarity]
lib/books/res0_1024a_192_4.vqh [moved from include/vorbis/book/res0_1024a_192_4.vqh with 82% similarity]
lib/books/res0_1024a_192_5.vqh [moved from include/vorbis/book/res0_1024a_192_5.vqh with 90% similarity]
lib/books/res0_1024a_256_1.vqh [moved from include/vorbis/book/res0_1024a_256_1.vqh with 90% similarity]
lib/books/res0_1024a_256_2.vqh [moved from include/vorbis/book/res0_1024a_256_2.vqh with 83% similarity]
lib/books/res0_1024a_256_3.vqh [moved from include/vorbis/book/res0_1024a_256_3.vqh with 86% similarity]
lib/books/res0_1024a_256_4.vqh [moved from include/vorbis/book/res0_1024a_256_4.vqh with 88% similarity]
lib/books/res0_1024a_256_5.vqh [moved from include/vorbis/book/res0_1024a_256_5.vqh with 91% similarity]
lib/books/res0_1024a_350_1.vqh [moved from include/vorbis/book/res0_1024a_350_1.vqh with 90% similarity]
lib/books/res0_1024a_350_2.vqh [moved from include/vorbis/book/res0_1024a_350_2.vqh with 83% similarity]
lib/books/res0_1024a_350_3.vqh [moved from include/vorbis/book/res0_1024a_350_3.vqh with 86% similarity]
lib/books/res0_1024a_350_4.vqh [moved from include/vorbis/book/res0_1024a_350_4.vqh with 88% similarity]
lib/books/res0_1024a_350_5.vqh [moved from include/vorbis/book/res0_1024a_350_5.vqh with 91% similarity]
lib/books/res0_128a_128_1.vqh [moved from include/vorbis/book/res0_128a_128_1.vqh with 81% similarity]
lib/books/res0_128a_128_2.vqh [moved from include/vorbis/book/res0_128a_128_2.vqh with 90% similarity]
lib/books/res0_128a_128_3.vqh [moved from include/vorbis/book/res0_128a_128_3.vqh with 96% similarity]
lib/books/res0_128a_128_4.vqh [moved from include/vorbis/book/res0_128a_128_4.vqh with 82% similarity]
lib/books/res0_128a_128_5.vqh [moved from include/vorbis/book/res0_128a_128_5.vqh with 90% similarity]
lib/books/res0_128a_160_1.vqh [moved from include/vorbis/book/res0_128a_160_1.vqh with 81% similarity]
lib/books/res0_128a_160_2.vqh [moved from include/vorbis/book/res0_128a_160_2.vqh with 90% similarity]
lib/books/res0_128a_160_3.vqh [moved from include/vorbis/book/res0_128a_160_3.vqh with 96% similarity]
lib/books/res0_128a_160_4.vqh [moved from include/vorbis/book/res0_128a_160_4.vqh with 82% similarity]
lib/books/res0_128a_160_5.vqh [moved from include/vorbis/book/res0_128a_160_5.vqh with 90% similarity]
lib/books/res0_128a_192_1.vqh [moved from include/vorbis/book/res0_128a_192_1.vqh with 81% similarity]
lib/books/res0_128a_192_2.vqh [moved from include/vorbis/book/res0_128a_192_2.vqh with 90% similarity]
lib/books/res0_128a_192_3.vqh [moved from include/vorbis/book/res0_128a_192_3.vqh with 96% similarity]
lib/books/res0_128a_192_4.vqh [moved from include/vorbis/book/res0_128a_192_4.vqh with 82% similarity]
lib/books/res0_128a_192_5.vqh [moved from include/vorbis/book/res0_128a_192_5.vqh with 90% similarity]
lib/books/res0_128a_256_1.vqh [moved from include/vorbis/book/res0_128a_256_1.vqh with 90% similarity]
lib/books/res0_128a_256_2.vqh [moved from include/vorbis/book/res0_128a_256_2.vqh with 83% similarity]
lib/books/res0_128a_256_3.vqh [moved from include/vorbis/book/res0_128a_256_3.vqh with 86% similarity]
lib/books/res0_128a_256_4.vqh [moved from include/vorbis/book/res0_128a_256_4.vqh with 88% similarity]
lib/books/res0_128a_256_5.vqh [moved from include/vorbis/book/res0_128a_256_5.vqh with 91% similarity]
lib/books/res0_128a_350_1.vqh [moved from include/vorbis/book/res0_128a_350_1.vqh with 90% similarity]
lib/books/res0_128a_350_2.vqh [moved from include/vorbis/book/res0_128a_350_2.vqh with 83% similarity]
lib/books/res0_128a_350_3.vqh [moved from include/vorbis/book/res0_128a_350_3.vqh with 86% similarity]
lib/books/res0_128a_350_4.vqh [moved from include/vorbis/book/res0_128a_350_4.vqh with 88% similarity]
lib/books/res0_128a_350_5.vqh [moved from include/vorbis/book/res0_128a_350_5.vqh with 91% similarity]
lib/books/resaux0_1024a_128.vqh [moved from include/vorbis/book/resaux0_1024a_128.vqh with 77% similarity]
lib/books/resaux0_1024a_160.vqh [moved from include/vorbis/book/resaux0_1024a_160.vqh with 77% similarity]
lib/books/resaux0_1024a_192.vqh [moved from include/vorbis/book/resaux0_1024a_192.vqh with 74% similarity]
lib/books/resaux0_1024a_256.vqh [moved from include/vorbis/book/resaux0_1024a_256.vqh with 93% similarity]
lib/books/resaux0_1024a_350.vqh [moved from include/vorbis/book/resaux0_1024a_350.vqh with 93% similarity]
lib/books/resaux0_128a_128.vqh [moved from include/vorbis/book/resaux0_128a_128.vqh with 93% similarity]
lib/books/resaux0_128a_160.vqh [moved from include/vorbis/book/resaux0_128a_160.vqh with 93% similarity]
lib/books/resaux0_128a_192.vqh [moved from include/vorbis/book/resaux0_128a_192.vqh with 93% similarity]
lib/books/resaux0_128a_256.vqh [moved from include/vorbis/book/resaux0_128a_256.vqh with 93% similarity]
lib/books/resaux0_128a_350.vqh [moved from include/vorbis/book/resaux0_128a_350.vqh with 93% similarity]
lib/codebook.c
lib/codebook.h [moved from include/vorbis/codebook.h with 63% similarity]
lib/codec_internal.h [new file with mode: 0644]
lib/envelope.c
lib/envelope.h
lib/floor0.c
lib/iir.c
lib/iir.h
lib/info.c
lib/lookup.c
lib/lookup.h
lib/lookup_data.h
lib/lookups.pl
lib/lpc.c
lib/lpc.h
lib/lsp.c
lib/lsp.h
lib/mapping0.c
lib/masking.h
lib/mdct.c
lib/mdct.h
lib/misc.c
lib/misc.h
lib/modes/.cvsignore [new file with mode: 0644]
lib/modes/Makefile.am [new file with mode: 0644]
lib/modes/mode_A.h [moved from include/vorbis/mode_A.h with 84% similarity]
lib/modes/mode_B.h [moved from include/vorbis/mode_B.h with 84% similarity]
lib/modes/mode_C.h [moved from include/vorbis/mode_C.h with 86% similarity]
lib/modes/mode_D.h [moved from include/vorbis/mode_D.h with 83% similarity]
lib/modes/mode_E.h [moved from include/vorbis/mode_E.h with 80% similarity]
lib/modes/modes.h [moved from include/vorbis/modes.h with 56% similarity]
lib/os.h
lib/psy.c
lib/psy.h
lib/psytune.c
lib/registry.c
lib/registry.h
lib/res0.c
lib/scales.h
lib/sharedbook.c
lib/sharedbook.h [deleted file]
lib/smallft.c
lib/smallft.h
lib/synthesis.c
lib/time0.c
lib/vorbis-errors.txt [new file with mode: 0644]
lib/vorbisenc.c [new file with mode: 0644]
lib/vorbisfile.c
lib/window.c
lib/window.h
libvorbis.spec
mac/compat/strdup.c
vorbis.m4 [new file with mode: 0644]
vq/Makefile [moved from vq/Makefile.in with 69% similarity]
vq/bookutil.c
vq/bookutil.h
vq/build.c
vq/cascade.c
vq/genericdata.c
vq/huffbuild.c
vq/latticebuild.c
vq/latticehint.c
vq/latticepare.c
vq/latticetune.c
vq/lspdata.c
vq/metrics.c
vq/residuedata.c
vq/residuesplit.c
vq/run.c
vq/train.c
vq/vqext.h
vq/vqgen.c
vq/vqgen.h
vq/vqsplit.c
vq/vqsplit.h

index 9a6264c..87f78c5 100644 (file)
@@ -11,3 +11,4 @@ configure
 .libs
 .deps
 *.ogg
+vorbis-config
index e0eca51..c8773a1 100644 (file)
@@ -4,7 +4,10 @@ AUTOMAKE_OPTIONS = foreign dist-zip
 
 SUBDIRS = lib include doc examples
 
-EXTRA_DIST = README COPYING todo.txt libvorbis.spec
+m4datadir = $(datadir)/aclocal
+m4data_DATA = vorbis.m4
+
+EXTRA_DIST = README COPYING todo.txt libvorbis.spec vorbis.m4
 
 debug:
        $(MAKE) all CFLAGS="@DEBUG@"
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..c6f1a2f
--- /dev/null
@@ -0,0 +1,95 @@
+# acinclude.m4
+# all .m4 files needed that might not be installed go here
+
+# ogg.m4
+# Configure paths for libogg
+# Jack Moffitt <jack@icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+
+dnl AM_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
+dnl
+AC_DEFUN(AM_PATH_OGG,
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(ogg-prefix,[  --with-ogg-prefix=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
+AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
+
+  if test x$ogg_prefix != x ; then
+    ogg_args="$ogg_args --prefix=$ogg_prefix"
+    OGG_CFLAGS="-I$ogg_prefix/include"
+    OGG_LIBS="-L$ogg_prefix/lib"
+  fi
+
+  OGG_LIBS="$OGG_LIBS -logg"
+
+  AC_MSG_CHECKING(for Ogg)
+  no_ogg=""
+
+
+  if test "x$enable_oggtest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $OGG_CFLAGS"
+    LIBS="$LIBS $OGG_LIBS"
+dnl
+dnl Now check if the installed Ogg is sufficiently new.
+dnl
+      rm -f conf.oggtest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ogg/ogg.h>
+
+int main ()
+{
+  system("touch conf.oggtest");
+  return 0;
+}
+
+],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_ogg" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.oggtest ; then
+       :
+     else
+       echo "*** Could not run Ogg test program, checking why..."
+       CFLAGS="$CFLAGS $OGG_CFLAGS"
+       LIBS="$LIBS $OGG_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <ogg/ogg.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding Ogg or finding the wrong"
+       echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
+       echo "*** or that you have moved Ogg since it was installed. In the latter case, you"
+       echo "*** may want to edit the ogg-config script: $OGG_CONFIG" ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     OGG_CFLAGS=""
+     OGG_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(OGG_CFLAGS)
+  AC_SUBST(OGG_LIBS)
+  rm -f conf.oggtest
+])
index 926d3e3..7d0ac70 100644 (file)
@@ -15,12 +15,18 @@ V_LIB_AGE=0
 VF_LIB_CURRENT=0
 VF_LIB_REVISION=0
 VF_LIB_AGE=0
+VE_LIB_CURRENT=0
+VE_LIB_REVISION=0
+VE_LIB_AGE=0
 AC_SUBST(V_LIB_CURRENT)
 AC_SUBST(V_LIB_REVISION)
 AC_SUBST(V_LIB_AGE)
 AC_SUBST(VF_LIB_CURRENT)
 AC_SUBST(VF_LIB_REVISION)
 AC_SUBST(VF_LIB_AGE)
+AC_SUBST(VE_LIB_CURRENT)
+AC_SUBST(VE_LIB_REVISION)
+AC_SUBST(VE_LIB_AGE)
 
 dnl --------------------------------------------------  
 dnl Check for programs
@@ -34,12 +40,6 @@ CFLAGS="$cflags_save"
 
 AM_PROG_LIBTOOL
 
-dnl --------------------------------------------------  
-dnl Additional arguments
-dnl --------------------------------------------------  
-
-AC_ARG_WITH(ogg, [  --with-ogg=DIR          Set where the Ogg library is located]) 
-
 dnl --------------------------------------------------
 dnl Set build flags based on environment
 dnl --------------------------------------------------
@@ -73,8 +73,8 @@ else
        *86-*-linux*)
                DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
                CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
-#                      PROFILE="-Wall -W -pg -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
-               PROFILE="-Wall -W -pg -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
+#                      PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
+               PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
 
                # glibc < 2.1.3 has a serious FP bug in the math inline header
                # that will cripple Vorbis.  Look to see if the magic FP stack
@@ -130,116 +130,6 @@ else
         esac
 fi
 
-AC_HEADER_STDC
-
-AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread")
-
-dnl This seems to be the only way to make autoconf only *sometimes* configure
-dnl a subdirectory with AC_CONFIG_SUBDIRS.  "__noconf" is assumed to not 
-dnl exist as a directory, so configure won't try to recursively enter it, unless
-dnl the shell variable $dummy is reset to an existing directory inside the
-dnl if clause.
-
-dummy="__noconf"
-
-# check macro modified from Jon Shiring's to compensate for autoconf's lagging
-# behind the times on type madness
-
-AC_MSG_CHECKING(for int16_t)
-AC_CACHE_VAL(has_int16_t,
-[AC_TRY_RUN([
-#ifdef __BEOS__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int16_t foo;
-int main() {return 0;}
-],
-has_int16_t=yes,
-has_int16_t=no,
-has_int16_t=no
-)])
-AC_MSG_RESULT($has_int16_t)
-
-AC_MSG_CHECKING(for int32_t)
-AC_CACHE_VAL(has_int32_t,
-[AC_TRY_RUN([
-#ifdef __BEOS__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int32_t foo;
-int main() {return 0;}
-],
-has_int32_t=yes,
-has_int32_t=no,
-has_int32_t=no
-)])
-AC_MSG_RESULT($has_int32_t)
-
-AC_MSG_CHECKING(for uint32_t)
-AC_CACHE_VAL(has_uint32_t,
-[AC_TRY_RUN([
-#ifdef __BEOS__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-uint32_t foo;
-int main() {return 0;}
-],
-has_uint32_t=yes,
-has_uint32_t=no,
-has_uint32_t=no
-)])
-AC_MSG_RESULT($has_uint32_t)
-
-AC_MSG_CHECKING(for u_int32_t)
-AC_CACHE_VAL(has_u_int32_t,
-[AC_TRY_RUN([
-#ifdef __BEOS__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-u_int32_t foo;
-int main() {return 0;}
-],
-has_u_int32_t=yes,
-has_u_int32_t=no,
-has_u_int32_t=no
-)])
-AC_MSG_RESULT($has_u_int32_t)
-
-AC_MSG_CHECKING(for int64_t)
-AC_CACHE_VAL(has_int64_t,
-[AC_TRY_RUN([
-#ifdef __BEOS__
-#include <inttypes.h>
-#endif
-#include <sys/types.h>
-int64_t foo;
-int main() {return 0;}
-],
-has_int64_t=yes,
-has_int64_t=no,
-has_int64_t=no
-)])
-AC_MSG_RESULT($has_int64_t)
-
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-
-
-if test x$has_int16_t = "xyes" ; then
-       SIZE16="int16_t"
-else
-       case 2 in
-               $ac_cv_sizeof_short) SIZE16="short";;
-               $ac_cv_sizeof_int) SIZE16="int";;
-       esac
-fi
-
 dnl --------------------------------------------------
 dnl Check for headers
 dnl --------------------------------------------------
@@ -259,11 +149,7 @@ dnl --------------------------------------------------
 AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
 
-dnl Check for libogg
-if test -n $with_ogg; then
-       CFLAGS="$CFLAGS -I$with_ogg/include -L$with_ogg/lib"
-fi 
-AC_CHECK_LIB(ogg, oggpack_read, LIBS="$LIBS -logg", AC_MSG_ERROR([You must have libogg to compile vorbis!!!]))
+AM_PATH_OGG(have_ogg=yes, have_ogg=no)
 
 dnl --------------------------------------------------
 dnl Check for library functions
@@ -280,4 +166,4 @@ AC_SUBST(DEBUG)
 AC_SUBST(PROFILE)
 AC_SUBST(pthread_lib)
 
-AC_OUTPUT(Makefile lib/Makefile doc/Makefile include/Makefile include/vorbis/Makefile include/vorbis/book/Makefile examples/Makefile)
+AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile doc/Makefile doc/vorbisfile/Makefile include/Makefile include/vorbis/Makefile examples/Makefile)
index 7c3cbc8..3edc3e5 100644 (file)
@@ -2,7 +2,9 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-docdir = $(datadir)/$(PACKAGE)-$(VERSION)
+SUBDIRS = vorbisfile
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
 
 doc_DATA = v-comment.html vorbisword2.png white-ogg.png programming.html\
         vorbis.html wait.png white-xifish.png
diff --git a/doc/framing.html b/doc/framing.html
deleted file mode 100644 (file)
index 51054c7..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-<HTML><HEAD><TITLE>xiph.org: Ogg Vorbis documentation</TITLE>
-<BODY bgcolor="#ffffff" text="#202020" link="#006666" vlink="#000000">
-<nobr><a href="vorbis.html"><img src="white-ogg.png" border=0><img 
-src="vorbisword2.png" border=0></a></nobr><p>
-
-<h1><font color=#000070>
-Ogg logical bitstream framing
-</font></h1>
-
-<em>Last update to this document: July 15, 1999</em><br> 
-
-<h2>Ogg bitstreams</h2>
-
-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-seperation
-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 seperate 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> Use no more than approximately 1-2% of bitstream bandwidth for
-   packet boundary marking, high-level framing, sync and seeking.
-
-<li> Specification of absolute position within the original sample
-   stream.
-
-<li> Simple mechanism to ease limited editing, such as a simplified
-   concatenation mechanism.
-
-<li> Detection of corruption, recapture after error and direct, random
-   access to data at arbitrary positions in the bitstream.
-</ol>
-
-<h2>Logical and Physical Bitstreams</h2>
-
-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>.
-
-<h2>Bitstream structure</h2>
-
-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 preceeded 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>
-
-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>
-
-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>
-
-The raw packet is logically divided into [n] 255 byte segments and a
-last fractional segment of < 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>
-
-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>
-
-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 (<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>
-
-Note that a lacing value of 255 implies that a second lacing value
-follows in the packet, and a value of < 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>
-
-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>
-
-Packets are not resticted 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 forseen as being useful for
-initialization data at the beginning of a logical bitstream).<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>
-
-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
-preceeding 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
-preceeding page, implying that the previous page's segment table
-cannot be trusted.<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>
-
-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>
-
-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>
-
-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>
-
- 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 inadvertant 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>
-
- The capture pattern is followed by the stream structure revision:
-
-<pre><tt>
- byte value
-
-  4  0x00
-</tt></pre>
-<h4>header_type_flag</h4>
-  
- The header type flag identifies this page's context in the bitstream:
-
-<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>PCM absolute position</h4>
-
- (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 be the frame number).  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 thenext page do not count).  The rationale here is
- that the position specified in the frame header of the last page
- tells how long the PCM data coded by the bitstream is.  A truncated
- stream will still return the proper number of samples that can be
- decoded fully.
-
-<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>
- Ogg allows for seperate 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 seperate 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:
-
-<pre><tt>
- byte value
-
- 14  0xXX LSB
- 15  0xXX
- 16  0xXX
- 17  0xXX MSB
-</tt></pre>
-
-<h4>page sequence no</h4>
-
- Page counter; lets us know if a page is lost (useful where packets
- span page boundaries).
-
-<pre><tt>
- byte value
-
- 18  0xXX LSB
- 19  0xXX
- 20  0xXX
- 21  0xXX MSB
-</tt></pre>
-
-<h4>page checksum</h4>
-     
- 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>
-
- (A thorough discussion of CRC algorithms can be found in <a
- href="ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt">"A
- Painless Guide to CRC Error Detection Algorithms"</a> by Ross
- Williams <a
- href="mailto:ross@guest.adelaide.edu.au">ross@guest.adelaide.edu.au</a>.)
-
-<pre><tt>
- byte value
-
- 22  0xXX LSB
- 23  0xXX
- 24  0xXX
- 25  0xXX MSB
-</tt></pre>
-
-<h4>page_segments</h4>
-
- 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>
-
- The lacing values for each packet segment physically appearing in
- this page are listed in contiguous order.
-
-<pre><tt>
- byte value
-
- 27 0x00-0xff (0-255)
- [...]
- n  0x00-0xff (0-255, n=page_segments+26)
-</tt></pre>
-
-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>
-
-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>
-
-<hr>
-<a href="http://www.xiph.org/">
-<img src="white-xifish.png" align=left border=0>
-</a>
-<font size=-2 color=#505050>
-
-Ogg is a <a href="http://www.xiph.org">Xiphophorus</a> effort to
-protect essential tenets of Internet multimedia from corporate
-hostage-taking; Open Source is the net's greatest tool to keep
-everyone honest. See <a href="http://www.xiph.org/about.html">About
-Xiphophorus</a> for details.
-<p>
-
-Ogg Vorbis is the first Ogg audio CODEC.  Anyone may
-freely use and distribute the Ogg and Vorbis specification,
-whether in a private, public or corporate capacity.  However,
-Xiphophorus and the Ogg project (xiph.org) reserve the right to set
-the Ogg/Vorbis specification and certify specification compliance.<p>
-
-Xiphophorus's Vorbis software CODEC implementation is distributed
-under the Lessr/Library GNU Public License.  This does not restrict
-third parties from distributing independent implementations of Vorbis
-software under other licenses.<p>
-
-OggSquish, Vorbis, Xiphophorus and their logos are trademarks (tm) of
-<a href="http://www.xiph.org/">Xiphophorus</a>.  These pages are
-copyright (C) 1994-2000 Xiphophorus. All rights reserved.<p>
-
-</body>
-
-
diff --git a/doc/oggstream.html b/doc/oggstream.html
deleted file mode 100644 (file)
index 46a221c..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-<HTML><HEAD><TITLE>xiph.org: Ogg Vorbis documentation</TITLE>
-<BODY bgcolor="#ffffff" text="#202020" link="#006666" vlink="#000000">
-<nobr><a href="vorbis.html"><img src="white-ogg.png" border=0><img 
-src="vorbisword2.png" border=0></a></nobr><p>
-
-
-<h1><font color=#000070>
-Ogg logical and physical bitstream overview
-</font></h1>
-
-<em>Last update to this document: July 18, 1999</em><br> 
-
-<h2>Ogg bitstreams</h2>
-
-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>
-
-Raw packets may be used directly by transport mechanisms that provide
-their own framing and packet-seperation 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 seperate data back into packets at the original packet
-boundaries without relying on decoding to find packet boundaries.<p>
-
-<h2>Logical and physical bitstreams</h2>
-
-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>
-
-Multiple logical bitstreams can be combined (with restricctions) into
-a single <em>physical bitstream</em>.  A physical bitstream consists
-of multiple logical bitstreams multiplexed at the page level. 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 fromt he physical bitstream and redirecting them into
-the appropriate logical decoding entitiy. The simplest physical
-bitstream is a single, unmultiplexed logical bitstream.  <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>
-
-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 '<a href="vorbis-stream.html">Ogg Vorbis
-Audio Bitstream</a>', for example, has a <a
-href="vorbis-stream.html">specific physical bitstream structure</a>.
-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>
-
-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>
-
-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>
-
-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>
-
-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>
-
-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>
-
-Each chained logical bitstream must have a unique serial number within
-the scope of the physical bitstream.<p>
-
-<h3>concurrent multiplexing (grouping)</h3>
-
-Logical bitstreams may also be multiplexed 'in parallel'
-(<em>grouped</em>).  An example of grouping would be to allow
-streaming of seperate audio and video streams, using differnt codecs
-and different logical bitstreams, in the same physical bitstream.
-Whole pages from multiple logical bitstreams are mixed together.<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>
-
-Each grouped bitstream must have a unique serial number within the
-scope of the physical bitstream.<p>
-
-<h3>sequential and concurrent multiplexing</h3>
-
-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>
-
-Below, we present an example of a grouped and chained bitstream:<p>
-
-<img src=stream.png><p>
-
-In this example, we see pages from five total logical bitstreams
-multiplexed into a physical bitstream.  Note the following
-characteristics:
-
-<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.<p>
-
-<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 appearence to bitrate demands is one
-logical strategy, ie, the page appears at the chronological point
-where decode requires more information).
-
-</ol>
-
-<hr>
-<a href="http://www.xiph.org/">
-<img src="white-xifish.png" align=left border=0>
-</a>
-<font size=-2 color=#505050>
-
-Ogg is a <a href="http://www.xiph.org">Xiphophorus</a> effort to
-protect essential tenets of Internet multimedia from corporate
-hostage-taking; Open Source is the net's greatest tool to keep
-everyone honest. See <a href="http://www.xiph.org/about.html">About
-Xiphophorus</a> for details.
-<p>
-
-Ogg Vorbis is the first Ogg audio CODEC.  Anyone may
-freely use and distribute the Ogg and Vorbis specification,
-whether in a private, public or corporate capacity.  However,
-Xiphophorus and the Ogg project (xiph.org) reserve the right to set
-the Ogg/Vorbis specification and certify specification compliance.<p>
-
-Xiphophorus's Vorbis software CODEC implementation is distributed
-under the Lesser/Library GNU Public License.  This does not restrict
-third parties from distributing independent implementations of Vorbis
-software under other licenses.<p>
-
-OggSquish, Vorbis, Xiphophorus and their logos are trademarks (tm) of
-<a href="http://www.xiph.org/">Xiphophorus</a>.  These pages are
-copyright (C) 1994-2000 Xiphophorus. All rights reserved.<p>
-
-</body>
-
-
diff --git a/doc/stream.png b/doc/stream.png
deleted file mode 100644 (file)
index 6e9dca8..0000000
Binary files a/doc/stream.png and /dev/null differ
diff --git a/doc/vorbis-clip.txt b/doc/vorbis-clip.txt
new file mode 100644 (file)
index 0000000..2e67034
--- /dev/null
@@ -0,0 +1,139 @@
+Topic:
+
+Sample granularity editing of a Vorbis file; inferred arbitrary sample
+length starting offsets / PCM stream lengths
+
+Overview:
+
+Vorbis, like mp3, is a frame-based* audio compression where audio is
+broken up into discrete short time segments.  These segments are
+'atomic' that is, one must recover the entire short time segment from
+the frame packet; there's no way to recover only a part of the PCM time
+segment from part of the coded packet without expanding the entire
+packet and then discarding a portion of the resulting PCM audio.
+
+* In mp3, the data segment representing a given time period is called
+  a 'frame'; the roughly equivalent Vorbis construct is a 'packet'.
+
+Thus, when we edit a Vorbis stream, the finest physical editing
+granularity is on these packet boundaries (the mp3 case is
+actually somewhat more complex and mp3 editing is more complicated
+than just snipping on a frame boundary because time data can be spread
+backward or forward over frames.  In Vorbis, packets are all
+stand-alone).  Thus, at the physical packet level, Vorbis is still
+limited to streams that contain an integral number of packets.
+
+However, Vorbis streams may still exactly represent and be edited to a
+PCM stream of arbitrary length and starting offset without padding the
+beginning or end of the decoded stream or requiring that the desired
+edit points be packet aligned.  Vorbis makes use of Ogg stream
+framing, and this framing provides time-stamping data, called a
+'granule position'; our starting offset and finished stream length may
+be inferred from correct usage of the granule position data.
+
+Time stamping mechanism:
+
+Vorbis packets are bundled into into Ogg pages (note that pages do not
+necessarily contain integral numbers of packets, but that isn't
+inportant in this discussion.  More about Ogg framing can be found in
+ogg/doc/framing.html).  Each page that contains a packet boundary is
+stamped with the absolute sample-granularity offset of the data, that
+is, 'complete samples-to-date' up to the last completed packet of that
+page. (The same mechanism is used for eg, video, where the number
+represents complete 2-D frames, and so on).
+
+(It's possible but rare for a packet to span more than two pages such
+that page[s] in the middle have no packet boundary; these packets have
+a granule position of '-1'.)
+
+This granule position mechaism in Ogg is used by Vorbis to indicate when the
+PCM data intended to be represented in a Vorbis segment begins a
+number of samples into the data represented by the first packet[s]
+and/or ends before the physical PCM data represented in the last
+packet[s].
+
+File length a non-integral number of frames:
+
+A file to be encoded in Vorbis will probably not encode into an
+integral number of packets; such a file is encoded with the last
+packet containing 'extra'* samples. These samples are not padding; they
+will be discarded in decode. 
+
+*(For best results, the encoder should use extra samples that preserve
+the character of the last frame.  Simply setting them to zero will
+introduce a 'cliff' that's hard to encode, resulting in spread-frame
+noise.  Libvorbis extrapolates the last frame past the end of data to
+produce the extra samples.  Even simply duplicating the last value is
+better than clamping the signal to zero).
+
+The encoder indicates to the decoder that the file is actually shorter
+than all of the samples ('original' + 'extra') by setting the granule
+position in the last page to a short value, that is, the last
+timestamp is the original length of the file discarding extra samples.
+The decoder will see that the number of samples it has decoded in the
+last page is too many; it is 'original' + 'extra', where the
+granulepos says that through the last packet we only have 'original'
+number of samples.  The decoder then ignores the 'extra' samples.
+This behavior is to occur only when the end-of-stream bit is set in
+the page (indicating last page of the logical stream).
+Note that it not legal for the granule position of the last page to
+indicate that there are more samples in the file than actually exist,
+however, implementations should handle such an illegal file gracefully
+in the interests of robust programming.
+
+Beginning point not on integral packet boundary:
+
+It is possible that we will the PCM data represented by a Vorbis
+stream to begin at a position later than where the decoded PCM data
+really begins after an integral packet boundary, a situation analagous
+to the above description where the PCM data does not end at an
+integral packet boundary.  The easiest example is taking a clip out of
+a larger Vorbis stream, and choosing a beginning point of the clip
+that is not on a packet boundary; we need to ignore a few samples to
+get the desired beginning point.
+
+The process of marking the desired beginning point is similar to
+marking an arbitrary ending point. If the encoder wishes sample zero
+to be some location past the actual beginning of data, it associates a
+'short' granule position value with the completion of the second*
+audio packet.  The granule position is associated with the second
+packet simply by making sure the second packet completes its page.
+
+*(We associate the short value with the second packet for two reasons.
+ a) The first packet only primes the overlap/add buffer.  No data is
+ returned before decoding the second packet; this places the decision
+ information at the point of decision.  b) Placing the short value on
+ the first packet would make the value negative (as the first packet
+ normally represents position zero); a negative value would break the
+ requirement that granule positions increase; the headers have
+ position values of zero)
+
+The decoder sees that on the first page that will return
+data from the overlap/add queue, we have more samples than the granule
+position accounts for, and discards the 'surplus' from the beginning
+of the queue.
+
+Note that short granule values (indicating less than the actually
+returned about of data) are not legal in the Vorbis spec outside of
+indicating beginning and ending sample positions.  However, decoders
+should, at minimum, tolerate inadvertant short values elsewhere in the
+stream (just as they should tolerate out-of-order/non-increasing
+granulepos values, although this too is illegal).
+
+Beginning point at arbitrary positive timestamp (no 'zero' sample):
+
+It's also possible that the granule position of the first page of an
+audio stream is a 'long value', that is, a value larger than the
+amount of PCM audio decoded.  This implies only that we are starting
+playback at some point into the logical stream, a potentially common
+occurence in streaming applications where the decoder may be
+connecting into a live stream.  The decoder should not treat the long
+value specially.
+
+A long value elsewhere in the stream would normally occur only when a
+page is lost or out of sequence, as indicated by the page's sequence
+number.  A long value under any other situation is not legal, however
+a decoder should tolerate both possibilities.
+
+
diff --git a/doc/vorbis-errors.txt b/doc/vorbis-errors.txt
new file mode 100644 (file)
index 0000000..e873d8a
--- /dev/null
@@ -0,0 +1,103 @@
+Error return codes possible from libvorbis and libvorbisfile:
+
+All 'failure' style returns are <0; this either indicates a generic
+'false' value (eg, ready?  T or F) or an error condition.  Code can
+safely just test for < 0, or look at the specific return code for more
+detail.
+
+*** Return codes:
+
+OV_FALSE        The call returned a 'false' status (eg, ov_bitrate_instant 
+               can return OV_FALSE if playback is not in progress, and thus 
+               there is no instantaneous bitrate information to report.
+
+OV_HOLE                libvorbis/libvorbisfile is alerting the application that 
+               there was an interruption in the data (one of: garbage 
+               between pages, loss of sync followed by recapture, or a 
+               corrupt page)
+
+OV_EREAD        A read from media returned an error.
+
+OV_EFAULT       Internal logic fault; indicates a bug or heap/stack 
+               corruption.
+
+OV_EIMPL        The bitstream makes use of a feature not implemented in this 
+               library version.
+
+OV_EINVAL       Invalid argument value.
+
+OV_ENOTVORBIS  Bitstream/page/packet is not Vorbis data.
+
+OV_EBADHEADER   Invalid Vorbis bitstream header.
+
+OV_EVERSION    Vorbis version mismatch.
+
+OV_ENOTAUDIO   Packet data submitted to vorbis_synthesis is not audio data.
+
+OV_EBADPACKET  Invalid packet submitted to vorbis_synthesis.
+
+OV_EBADLINK    Invalid stream section supplied to libvorbis/libvorbisfile, 
+               or the requested link is corrupt. 
+
+OV_ENOSEEK     Bitstream is not seekable.
+
+
+****************************************************************
+*** Libvorbis functions that can return failure/error codes:
+
+int vorbis_analysis_headerout()
+    OV_EIMPL
+
+int vorbis_analysis_wrote()
+    OV_EINVAL
+
+int vorbis_synthesis_headerin()
+    OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER
+
+int vorbis_synthesis()
+    OV_ENOTAUDIO, OV_EBADPACKET
+
+int vorbis_synthesis_read()
+    OV_EINVAL
+
+****************************************************************
+*** Libvorbisfile functions that can return failure/error codes:
+
+int ov_open_callbacks()   
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER, OV_FAULT
+
+int ov_open()
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER, OV_FAULT
+
+long ov_bitrate()
+    OV_EINVAL, OV_FALSE
+
+long ov_bitrate_instant()
+    OV_FALSE
+
+ogg_int64_t ov_raw_total()
+    OV_EINVAL
+
+ogg_int64_t ov_pcm_total()
+    OV_EINVAL
+
+double ov_time_total()
+    OV_EINVAL
+
+int ov_raw_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_BADLINK
+
+int ov_pcm_seek_page()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_pcm_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_time_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_time_seek_page()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+long ov_read()
+    OV_HOLE, OV_EBADLINK
diff --git a/doc/vorbisfile/Makefile.am b/doc/vorbisfile/Makefile.am
new file mode 100644 (file)
index 0000000..63d282d
--- /dev/null
@@ -0,0 +1,19 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
+
+doc_DATA = OggVorbis_File.html chaining_example_c.html chainingexample.html\
+       datastructures.html decoding.html example.html exampleindex.html\
+       fileinfo.html index.html initialization.html ov_bitrate.html\
+       ov_bitrate_instant.html ov_callbacks.html ov_clear.html\
+       ov_comment.html ov_info.html ov_open.html ov_open_callbacks.html\
+       ov_pcm_seek.html ov_pcm_tell.html ov_pcm_total.html ov_raw_seek.html\
+       ov_raw_tell.html ov_raw_total.html ov_read.html ov_seekable.html\
+       ov_serialnumber.html ov_streams.html ov_time_seek.html\
+       ov_time_tell.html ov_time_total.html overview.html reference.html\
+       seekexample.html seeking.html seeking_test_c.html seekingexample.html\
+       style.css vorbis_comment.html vorbis_info.html vorbisfile_example_c.html
+
+EXTRA_DIST = $(doc_DATA)
diff --git a/doc/vorbisfile/OggVorbis_File.html b/doc/vorbisfile/OggVorbis_File.html
new file mode 100644 (file)
index 0000000..6748dee
--- /dev/null
@@ -0,0 +1,105 @@
+<html>
+
+<head>
+<title>vorbisfile - datatype - OggVorbis_File</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>OggVorbis_File</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h"</i></p>
+
+<p>
+The OggVorbis_File structure defines an Ogg Vorbis file.
+<p>
+This structure is used in all vorbisfile 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>.
+<p>
+After use, the OggVorbis_File structure must be deallocated with a call to <a href="ov_clear.html">ov_clear()</a>.\r
+<p>Once a file or data source is passed to libvorbisfile, it is owned by vorbisfile.  The file should not be used by any other applications or functions outside the Vorbisfile API.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>typedef struct {
+  void             *datasource; /* Pointer to a FILE *, etc. */
+  int              seekable;
+  int64_t          offset;
+  int64_t          end;
+  ogg_sync_state   oy; 
+
+  /* If the FILE handle isn't seekable (eg, a pipe), only the current
+     stream appears */
+  int              links;
+  int64_t          *offsets;
+  int64_t          *dataoffsets;
+  long             *serialnos;
+  int64_t          *pcmlengths;
+  vorbis_info      *vi;
+  vorbis_comment   *vc;
+
+  /* Decoding working state local storage */
+  int64_t          pcm_offset;
+  int              decode_ready;
+  long             current_serialno;
+  int              current_link;
+
+  double           bittrack;
+  double           samptrack;
+
+  ogg_stream_state os; /* take physical pages, weld into a logical
+                          stream of packets */
+  vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
+  vorbis_block     vb; /* local working space for packet->PCM decode */
+
+  <a href="ov_callbacks.html">ov_callbacks</a> callbacks;
+
+} OggVorbis_File;</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Relevant Struct Members</h3>
+<dl>
+<dt><i>datasource</i></dt>
+<dd>Pointer to file or other ogg source.</dd>
+<dt><i>seekable</i></dt>
+<dd>Read-only int indicating whether file is seekable, i.e., physical file is seekable, a pipe isn't.</dd>
+<dt><i>links</i></dt>
+<dd>Read-only int indicating the number of logical bitstreams within the physical bitstream.</dd>\r
+<dt><i>ov_callbacks</i></dt>\r
+<dd>Collection of file manipulation routines to be used on this data source.</dd>
+</dl>
+
+<h3>Notes</h3>
+
+<p>If your system's <tt>&lt;sys/types.h></tt> does not
+define <tt>int64_t,</tt> you will need to define this as a 64-bit type
+inside your system's project file/Makefile, etc. On win32, for example,
+this should be defined as <tt>__int64</tt>. On the Unix platform, these
+are usually defined properly in the system header files.
+<p>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/chaining_example_c.html b/doc/vorbisfile/chaining_example_c.html
new file mode 100644 (file)
index 0000000..6131693
--- /dev/null
@@ -0,0 +1,86 @@
+<html>
+
+<head>
+<title>vorbisfile - chaining_example.c</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>chaining_example.c</h1>
+
+<p>
+The example program source:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+
+#include <vorbis/codec.h>\r
+#include <vorbis/vorbisfile.h>\r
+\r
+int main(){\r
+  OggVorbis_File ov;\r
+  int i;\r
+\r
+  /* open the file/pipe on stdin */\r
+  if(ov_open(stdin,&ov,NULL,-1)<0){\r
+    printf("Could not open input as an OggVorbis file.\n\n");\r
+    exit(1);\r
+  }\r
+  \r
+  /* print details about each logical bitstream in the input */\r
+  if(ov_seekable(&ov)){\r
+    printf("Input bitstream contained %ld logical bitstream section(s).\n",\r
+          ov_streams(&ov));\r
+    printf("Total bitstream playing time: %ld seconds\n\n",\r
+          (long)ov_time_total(&ov,-1));\r
+\r
+  }else{\r
+    printf("Standard input was not seekable.\n"\r
+          "First logical bitstream information:\n\n");\r
+  }\r
+\r
+  for(i=0;i<ov_streams(&ov);i++){\r
+    vorbis_info *vi=ov_info(&ov,i);\r
+    printf("\tlogical bitstream section %d information:\n",i+1);\r
+    printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",\r
+          vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,\r
+          ov_serialnumber(&ov,i));\r
+    printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));\r
+    printf(" play time: %lds\n",(long)ov_time_total(&ov,i));\r
+  }\r
+\r
+  ov_clear(&ov);\r
+  return 0;\r
+}\r
+
+</b></pre>
+       </td>
+</tr>
+</table>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/chainingexample.html b/doc/vorbisfile/chainingexample.html
new file mode 100644 (file)
index 0000000..f7c251b
--- /dev/null
@@ -0,0 +1,158 @@
+<html>
+
+<head>
+<title>vorbisfile - Example Code</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Chaining Example Code</h1>
+
+<p>
+The following is a run-through of the chaining example program supplied
+with vorbisfile - <a href="chaining_example_c.html">chaining_example.c</a>.  
+This program demonstrates how to work with a chained bitstream.
+
+<p>
+First, relevant headers, including vorbis-specific "codec.h" and "vorbisfile.h" have to be included.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+#include "../lib/misc.h"
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<p>Inside main(), we declare our primary OggVorbis_File structure.  We also declare a other helpful variables to track our progress within the file.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+int main(){
+  OggVorbis_File ov;
+  int i;
+</b></pre>
+        </td>
+</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.
+
+<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){\r
+    printf("Could not open input as an OggVorbis file.\n\n");
+    exit(1);
+  }
+
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+First we check to make sure the stream is seekable using <a href="ov_seekable.html">ov_seekable</a>.
+
+<p>Then we're going to find the number of logical bitstreams in the physical bitstream using <a href="ov_streams.html">ov_streams</a>.
+
+<p>We use <a href="ov_time_total.html">ov_time_total</a> to determine the total length of the physical bitstream.  We specify that we want the entire bitstream by using the argument <tt>-1</tt>.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  if(ov_seekable(&ov)){
+    printf("Input bitstream contained %ld logical bitstream section(s).\n",
+          ov_streams(&ov));
+    printf("Total bitstream playing time: %ld seconds\n\n",
+          (long)ov_time_total(&ov,-1));
+
+  }else{
+    printf("Standard input was not seekable.\n"
+          "First logical bitstream information:\n\n");
+  }
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>Now we're going to iterate through each logical bitstream and print information about that bitstream.
+
+<p>We use <a href="ov_info.html">ov_info</a> to pull out the <a href="vorbis_info.html">vorbis_info</a> struct for each logical bitstream.  This struct contains bitstream-specific info.
+
+<p><a href="ov_serialnumber.html">ov_serialnumber</a> retrieves the unique serial number for the logical bistream.  <a href="ov_raw_total.html">ov_raw_total</a> gives the total compressed bytes for the logical bitstream, and <a href="ov_time_total.html">ov_time_total</a> gives the total time in the logical bitstream.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  for(i=0;i<ov_streams(&ov);i++){
+    vorbis_info *vi=ov_info(&ov,i);
+    printf("\tlogical bitstream section %d information:\n",i+1);
+    printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
+          vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
+          ov_serialnumber(&ov,i));
+    printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));
+    printf(" play time: %lds\n",(long)ov_time_total(&ov,i));
+  } 
+</b></pre>
+        </td>
+</tr>
+</table>
+<p>
+When we're done with the entire physical bitstream, we need to call <a href="ov_clear.html">ov_clear()</a> to release the bitstream.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  ov_clear(&ov);
+  return 0;
+}
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The full source for chaining_example.c can be found with the vorbis
+distribution in <a href="chaining_example_c.html">chaining_example.c</a>.
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/datastructures.html b/doc/vorbisfile/datastructures.html
new file mode 100644 (file)
index 0000000..955b9c7
--- /dev/null
@@ -0,0 +1,63 @@
+<html>
+
+<head>
+<title>vorbisfile - Base Data Structures</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Base Data Structures</h1>
+<p>There are several data structures used to hold file and bitstream information during vorbisfile decoding.
+<p>
+All the <b>vorbisfile</b> specific data structures are declared in "vorbis/vorbisfile.h" or "vorbis/codec.h".
+<p>\r
+<p>When using vorbisfile, we usually won't need to know about most of the contents of these data structures, but it may be helpful to understand what they contain.\r
+<br><br>
+
+<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td><b>datatype</b></td>
+       <td><b>purpose</b></td>
+</tr>
+<tr valign=top>
+       <td><a href="OggVorbis_File.html">OggVorbis_File</a></td>
+       <td>This structure represents the basic file information. It contains 
+       a pointer to the physical file or bitstream and various information about that bitstream.</td>
+</tr>
+<tr valign=top>
+<td><a href="vorbis_comment.html">vorbis_comment</a></td>
+       <td>This structure contains the file comments. It contains 
+       a pointer to unlimited user comments, information about the number of comments, and a vendor description.</td>
+</tr>
+<tr valign=top>
+<td><a href="vorbis_info.html">vorbis_info</a></td>
+       <td>This structure contains encoder-related information about the bitstream.  It includes encoder info, channel info, and bitrate limits.</td>
+</tr>
+<tr valign=top>
+<td><a href="ov_callbacks.html">ov_callbacks</a></td>
+       <td>This structure contains pointers to file manipulation routines.  Can be user-specified for use with <a href="ov_open_callbacks.html">ov_open_callbacks()</a>.</td>
+</tr>
+</table>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/decoding.html b/doc/vorbisfile/decoding.html
new file mode 100644 (file)
index 0000000..bc35fd7
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+
+<head>
+<title>vorbisfile - Decoding</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Decoding</h1>
+
+<p>
+All the <b>vorbisfile</b> decoding routines are declared in "vorbis/vorbisfile.h".
+<p>
+
+<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td><b>function</b></td>
+       <td><b>purpose</b></td>
+</tr>
+<tr valign=top>
+       <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>
+</tr>
+</table>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 Xiphophorus</p></td>
+<td align=right><p class=tiny><a href="http://www.vorbis.org/">www.vorbis.org</a><br><a href="mailto:team@icecast.org">team@icecast.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/example.html b/doc/vorbisfile/example.html
new file mode 100644 (file)
index 0000000..d057484
--- /dev/null
@@ -0,0 +1,205 @@
+<html>
+
+<head>
+<title>vorbisfile - Example Code</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Example Code</h1>
+
+<p>
+The following is a run-through of the decoding example program supplied
+with vorbisfile - <a href="vorbisfile_example_c.html">vorbisfile_example.c</a>.  
+This program takes a vorbis bitstream from stdin and writes raw pcm to stdout.
+
+<p>
+First, relevant headers, including vorbis-specific "codec.h" and "vorbisfile.h" have to be included.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;math.h&gt;
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+</b></pre>
+       </td>
+</tr>
+</table>
+<p>
+We also have to make a concession to Windows users here.  If we are using windows for decoding, we must declare these libraries so that we can set stdin/stdout to binary.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#ifdef _WIN32
+#include &lt;io.h&gt;
+#include &lt;fcntl.h&gt;
+#endif
+</b></pre>
+       </td>
+</tr>
+</table>
+<p>
+Next, a buffer for the pcm audio output is declared.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+char pcmout[4096];
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>Inside main(), we declare our primary OggVorbis_File structure.  We also declare a few other helpful variables to track out progress within the file.
+Also, we make our final concession to Windows users by setting the stdin and stdout to binary mode.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+int main(int argc, char **argv){
+  OggVorbis_File vf;
+  int eof=0;
+  int current_section;
+
+#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
+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.
+
+<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) {
+      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
+      exit(1);
+  }
+
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+We're going to pull the channel and bitrate info from the file using <a href="ov_info.html">ov_info()</a> and show them to the user.
+We also want to pull out and show the user a comment attached to the file using <a href="ov_comment.html">ov_comment()</a>.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  {
+    char **ptr=ov_comment(&vf,-1)->user_comments;
+    vorbis_info *vi=ov_info(&vf,-1);
+    while(*ptr){
+      fprintf(stderr,"%s\n",*ptr);
+      ++ptr;
+    }
+    fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
+    fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
+  }
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+Here's the read loop:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+
+  while(!eof){\r
+    long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);\r
+    if (ret == 0) {\r
+      /* EOF */\r
+      eof=1;\r
+    } else if (ret < 0) {\r
+      /* error in the stream.  Not a problem, just reporting it in\r
+        case we (the app) cares.  In this case, we don't. */\r
+    } else {\r
+      /* we don't bother dealing with sample rate changes, etc, but\r
+        you'll have to*/\r
+      fwrite(pcmout,1,ret,stdout);\r
+    }\r
+  }\r
+
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The code is reading blocks of data using <a href="ov_read.html">ov_read()</a>.
+Based on the value returned, we know if we're at the end of the file or have invalid data.  If we have valid data, we write it to the pcm output.
+
+<p>
+Now that we've finished playing, we can pack up and go home.  It's important to call <a href="ov_clear.html">ov_clear()</a> when we're finished.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+
+  ov_clear(&vf);
+    
+  fprintf(stderr,"Done.\n");
+  return(0);
+}
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The full source for vorbisfile_example.c can be found with the vorbis
+distribution in <a href="vorbisfile_example_c.html">vorbisfile_example.c</a>.
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/exampleindex.html b/doc/vorbisfile/exampleindex.html
new file mode 100644 (file)
index 0000000..1575e27
--- /dev/null
@@ -0,0 +1,39 @@
+<html>
+
+<head>
+<title>vorbisfile - Documentation</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>VorbisFile Example Code</h1>
+
+<p>
+Three sample programs are included with the vorbisfile distribution.
+<p>
+<a href="example.html">vorbisfile decoding</a><br>
+<a href="seekexample.html">vorbisfile seeking</a><br>
+<a href="chainingexample.html">vorbisfile bitstream chaining</a><br>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/fileinfo.html b/doc/vorbisfile/fileinfo.html
new file mode 100644 (file)
index 0000000..27f6370
--- /dev/null
@@ -0,0 +1,96 @@
+<html>\r
+\r
+<head>\r
+<title>vorbisfile - File Information</title>\r
+<link rel=stylesheet href="style.css" type="text/css">\r
+</head>\r
+\r
+<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">\r
+<table border=0 width=100%>\r
+<tr>\r
+<td><p class=tiny>vorbisfile documentation</p></td>\r
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>\r
+</tr>\r
+</table>\r
+\r
+<h1>File Information</h1>\r
+<p>Vorbisfile contains many functions to get information about bitstream attributes and decoding status.\r
+<p>\r
+All the <b>vorbisfile</b> file information routines are declared in "vorbis/vorbisfile.h".\r
+<p>\r
+\r
+<table border=1 color=black width=50% cellspacing=0 cellpadding=7>\r
+<tr bgcolor=#cccccc>\r
+       <td><b>function</b></td>\r
+       <td><b>purpose</b></td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_bitrate.html">ov_bitrate</a></td>\r
+       <td>Returns the average bitrate of the current logical bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_bitrate_instant.html">ov_bitrate_instant</a></td>\r
+       <td>Returns the exact bitrate since the last call of this function, or -1 if beginning of the bitream or no new info is available.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_streams.html">ov_streams</a></td>\r
+       <td>Gives the number of logical bitstreams within the current physical bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_seekable.html">ov_seekable</a></td>\r
+       <td>Indicates whether the bitstream is seekable.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_serialnumber.html">ov_serialnumber</a></td>\r
+       <td>Returns the unique serial number of the specified logical bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_raw_total.html">ov_raw_total</a></td>\r
+       <td>Returns the total (compressed) bytes in a physical or logical seekable bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_pcm_total.html">ov_pcm_total</a></td>\r
+       <td>Returns the total number of samples in a physical or logical seekable bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_time_total.html">ov_time_total</a></td>\r
+       <td>Returns the total time length in seconds of a physical or logical seekable bitstream.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_raw_tell.html">ov_raw_tell</a></td>\r
+       <td>Returns the byte location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_pcm_tell.html">ov_pcm_tell</a></td>\r
+       <td>Returns the sample location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_time_tell.html">ov_time_tell</a></td>\r
+       <td>Returns the time location of the next sample to be read, giving the approximate location in the stream that the decoding engine has reached.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_info.html">ov_info</a></td>\r
+       <td>Returns the <a href="vorbis_info.html">vorbis_info</a> struct for a specific bitstream section.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_comment.html">ov_comment</a></td>\r
+       <td>Returns attached <a href="vorbis_comment.html">comments</a> for the current bitstream.</td>\r
+</tr>\r
+</table>\r
+\r
+<br><br>\r
+<hr noshade>\r
+<table border=0 width=100%>\r
+<tr valign=top>\r
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>\r
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>\r
+</tr><tr>\r
+<td><p class=tiny>vorbisfile documentation</p></td>\r
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>\r
+</tr>\r
+</table>\r
+\r
+\r
+</body>\r
+\r
+</html>\r
diff --git a/doc/vorbisfile/index.html b/doc/vorbisfile/index.html
new file mode 100644 (file)
index 0000000..102636a
--- /dev/null
@@ -0,0 +1,42 @@
+<html>
+
+<head>
+<title>vorbisfile - Documentation</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>VorbisFile Documentation</h1>
+
+<p>
+VorbisFile is a stdio-based convenience library for decoding vorbis bitstreams.
+It is the simplest and quickest way to go from file to raw PCM audio samples--if
+your decoder doesn't need to read from anything other than a file, use
+this. This document explains how to use the vorbisfile API in detail.
+<p>
+<a href="overview.html">vorbisfile api overview</a><br>
+<a href="exampleindex.html">vorbisfile example code</a><br>
+<a href="reference.html">vorbisfile api reference</a><br>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/initialization.html b/doc/vorbisfile/initialization.html
new file mode 100644 (file)
index 0000000..be09f65
--- /dev/null
@@ -0,0 +1,56 @@
+<html>
+
+<head>
+<title>libvorbisfile - Setup/Teardown</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>libvorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</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 and cleared when decoding is finished.
+<p>
+All the <b>vorbisfile</b> initialization and deallocation routines are declared in "vorbis/vorbisfile.h".
+<p>
+
+<table border=1 color=black width=50% cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td><b>function</b></td>
+       <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
+       used.</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 a data source other than a file.</td>
+</tr>
+<tr valign=top>
+       <td><a href="ov_clear.html">ov_clear</a></td>
+       <td>Closes the bitstream and cleans up loose ends.  Must be called when we're done with the bitstream.</td>
+</tr>
+</table>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_bitrate.html b/doc/vorbisfile/ov_bitrate.html
new file mode 100644 (file)
index 0000000..ad40261
--- /dev/null
@@ -0,0 +1,73 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_bitrate</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_bitrate</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>This function returns the average bitrate for the specified logical bitstream.  This may be different from the <a href=ov_info.html>ov_info->nominal_bitrate</a> value, as it is based on the actual average for this bitstream if the file is seekable.\r
+<p>Nonseekable files will return the nominal bitrate setting or the average of the upper and lower bounds, if any of these values are set.
+<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_bitrate(OggVorbis_File *vf,int i);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>i</i></dt>
+<dd>Link to the desired logical bitstream.  For nonseekable files, this argument is ignored.  To retrieve the bitrate for the entire bitstream, this parameter should be set to -1.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>OV_EINVAL indicates that an invalid argument value was submitted.</li>\r
+<li>OV_FALSE means the call returned a 'false' status, which in this case most likely indicates that the file is nonseekable and the upper, lower, and nominal bitrates were unset.
+<li><i>n</i> indicates the bitrate for the given logical bitstream or the entire
+   physical bitstream.  If the file is open for random (seekable) access, it will
+   find the *actual* average bitrate.  If the file is streaming (nonseekable), it
+   returns the nominal bitrate (if set) or else the average of the
+   upper/lower bounds (if set).</li>
+</blockquote>
+<p>
+
+<br>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_bitrate_instant.html b/doc/vorbisfile/ov_bitrate_instant.html
new file mode 100644 (file)
index 0000000..7f53b70
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_bitrate</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_bitrate_instant</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Used to find the most recent bitrate played back within the file.  Will return 0 if the bitrate has not changed or it is the beginning of the file.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_bitrate_instant(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 indicates the beginning of the file or unchanged bitrate info.</li>
+<li><i>n</i> indicates the actual bitrate since the last call.</li>\r
+<li>OV_FALSE indicates that the call returned a 'false' status.  In this case, this error code is returned if playback is not in progress, and thus there is no instantaneous bitrate information to report.</li>
+</blockquote>
+<p>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_callbacks.html b/doc/vorbisfile/ov_callbacks.html
new file mode 100644 (file)
index 0000000..9d73c68
--- /dev/null
@@ -0,0 +1,66 @@
+<html>
+
+<head>
+<title>vorbisfile - datatype - ov_callbacks</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_callbacks</h1>
+
+<p><i>declared in "vorbis/codec.h"</i></p>
+
+<p>
+The ov_callbacks structure contains file manipulation function prototypes necessary for opening, closing, seeking, and location.
+<p>
+The ov_callbacks structure does not need to be user-defined if you are working with a standard file.  The typical <a href="ov_open.html">ov_open()</a> call will fill ov_callbacks for you.  However, ov_callbacks should be defined if you are using other data sources.  In this situation, use <a href="ov_open_callbacks.html">ov_open_callbacks()</a> instead of <a href="ov_open.html">ov_open()</a>.
+<p>
+
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>typedef struct {
+  size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
+  int    (*seek_func)  (void *datasource, int64_t offset, int whence);
+  int    (*close_func) (void *datasource);
+  long   (*tell_func)  (void *datasource);
+} ov_callbacks;</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Relevant Struct Members</h3>
+<dl>
+<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.</dd>
+<dt><i>close_func</i></dt>
+<dd>Pointer to custom data source closure function.</dd>
+<dt><i>tell_func</i></dt>
+<dd>Pointer to custom data location function.</dd>
+</dl>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_clear.html b/doc/vorbisfile/ov_clear.html
new file mode 100644 (file)
index 0000000..81eb0ea
--- /dev/null
@@ -0,0 +1,63 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_clear</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_clear</h1>
+
+<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> and decoding is complete, you must call <tt>ov_clear()</tt> to clear
+the decoder's buffers and close the file for you.
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_clear(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.  After <tt>ov_clear</tt> has been called, the structure is deallocated and can no longer be used.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+</blockquote>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_comment.html b/doc/vorbisfile/ov_comment.html
new file mode 100644 (file)
index 0000000..654fa98
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_bitrate</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_comment</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns a pointer to the <a href="vorbis_comment.html">vorbis_comment</a> struct for the specified bitstream.  For nonseekable streams, returns the struct for the current bitstream.
+<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>i</i></dt>
+<dd>Link to the desired logical bitstream.  For nonseekable files, this argument is ignored.  To retrieve the <a href="vorbis_comment.html">vorbis_comment</a> struct for the current bitstream, this parameter should be set to -1.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>Returns the vorbis_comment struct for the specified bitstream.</li>
+<li>NULL if the specified bitstream does not exist or the file has been initialized improperly.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_info.html b/doc/vorbisfile/ov_info.html
new file mode 100644 (file)
index 0000000..e410274
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_info</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_info</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the <a href="vorbis_info.html">vorbis_info</a> struct for the specified bitstream.  For nonseekable files, always returns the current vorbis_info struct.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+vorbis_info *ov_info(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf,int link);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. <b></strong>Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</b></dd>
+<dt><i>i</i></dt>
+<dd>Link to the desired logical bitstream.  For nonseekable files, this argument is ignored.  To retrieve the <a href="vorbis_info.html">vorbis_info</a> struct for the current bitstream, this parameter should be set to -1.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>Returns the vorbis_info struct for the specified bitstream.  Returns vorbis_info for current bitstream if the file is nonseekable or i=-1.</li>
+<li>NULL if the specified bitstream does not exist or the file has been initialized improperly.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_open.html b/doc/vorbisfile/ov_open.html
new file mode 100644 (file)
index 0000000..1a55527
--- /dev/null
@@ -0,0 +1,112 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_open</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_open</h1>
+
+<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>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 vorbisfile
+functions. Once this has been called, the same <a href="OggVorbis_File.html">OggVorbis_File</a>
+struct should be passed to all the vorbisfile 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.
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_open(FILE *f,<a href="OggVorbis_File.html">OggVorbis_File</a> *vf,char *initial,long ibytes);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>f</i></dt>
+<dd>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).</dd>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</dd>
+<dt><i>initial</i></dt>
+<dd>Typically set to NULL.  This parameter is useful if some data has already been
+read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>.  In this case, <tt>initial</tt>
+should be a pointer to a buffer containing the data read.</dd>
+<dt><i>ibytes</i></dt>
+<dd>Typically set to 0.  This parameter is useful if some data has already been
+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>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+
+<li>less than zero for failure:</li>\r
+<ul>
+<li>OV_EREAD - A read from media returned an error.</li>\r
+<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>\r
+<li>OV_EVERSION - Vorbis version mismatch.</li>\r
+<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>\r
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>\r
+</ul>
+</blockquote>
+<p>
+
+<h3>Notes</h3>
+<p>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
+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).
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_open_callbacks.html b/doc/vorbisfile/ov_open_callbacks.html
new file mode 100644 (file)
index 0000000..9ac61bd
--- /dev/null
@@ -0,0 +1,108 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_open_callbacks</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_open_callbacks</h1>
+
+<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 vorbisfile functions.
+<p>
+It is often useful to call <tt>ov_open_callbacks()</tt>
+simply to determine whether a given file is a vorbis bitstream. If the
+<tt>ov_open_callbacks()</tt>
+call fails, then the file is not recognizable as such. When you use <tt>ov_open_callbacks()
+</tt>for
+this, you should <tt>fclose()</tt> the file pointer 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 close the file for you.
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_open_callbacks(void *datasource, <a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *initial, long ibytes, <a href="ov_callbacks.html">ov_callbacks</a> callbacks);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>f</i></dt>
+<dd>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).</dd>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</dd>
+<dt><i>initial</i></dt>
+<dd>Typically set to NULL.  This parameter is useful if some data has already been
+read from the file and the stream is not seekable. It is used in conjunction with <tt>ibytes</tt>.  In this case, <tt>initial</tt>
+should be a pointer to a buffer containing the data read.</dd>
+<dt><i>ibytes</i></dt>
+<dd>Typically set to 0.  This parameter is useful if some data has already been
+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>Pointer to a completed <a href="ov_callbacks.html">ov_callbacks</a> struct which indicates desired custom file manipulation routines.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+<li>less than zero for failure:</li>\r
+<ul>
+<li>OV_EREAD - A read from media returned an error.</li>\r
+<li>OV_ENOTVORBIS - Bitstream is not Vorbis data.</li>\r
+<li>OV_EVERSION - Vorbis version mismatch.</li>\r
+<li>OV_EBADHEADER - Invalid Vorbis bitstream header.</li>\r
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack corruption.</li>\r
+</ul>
+</blockquote>
+<p>
+
+<h3>Notes</h3>
+<p>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).
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_pcm_seek.html b/doc/vorbisfile/ov_pcm_seek.html
new file mode 100644 (file)
index 0000000..43e5015
--- /dev/null
@@ -0,0 +1,82 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_bitrate</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_pcm_seek</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Seeks to the offset specified (in pcm samples) within the physical bitstream.  This function only works for seekable streams.
+<p>This also updates everything needed within the
+decoder, so you can immediately call <a href="ov_read.html">ov_read()</a> and get data from
+the newly seeked to position.
+<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_pcm_seek(OggVorbis_File *vf,int64_t pos);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>pos</i></dt>
+<dd>Position in pcm samples to seek to in the bitstream.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+
+<li>
+nonzero indicates failure, described by several error codes:</li>\r
+<ul>\r
+<li>OV_ENOSEEK - Bitstream is not seekable.\r
+</li>\r
+<li>OV_EINVAL - Invalid argument value.\r
+</li>\r
+<li>OV_EREAD - A read from media returned an error.\r
+</li>\r
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack \r
+               corruption.\r
+</li>\r
+<li>OV_EBADLINK - Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt. \r
+</li>\r
+</ul></blockquote>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_pcm_seek_page.html b/doc/vorbisfile/ov_pcm_seek_page.html
new file mode 100644 (file)
index 0000000..1f97db8
--- /dev/null
@@ -0,0 +1,83 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_pcm_seek_page</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_pcm_seek_page</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Seeks to the closest page preceding the specified location (in pcm samples) within the physical bitstream.  This function only works for seekable streams.\r
+<p>This function is faster than <a href="ov_pcm_seek.html">ov_pcm_seek</a> because the function can begin decoding at a page boundary rather than seeking through any remaining samples before the specified location.  However, it is less accurate.
+<p>This also updates everything needed within the
+decoder, so you can immediately call <a href="ov_read.html">ov_read()</a> and get data from
+the newly seeked to position.
+<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_pcm_seek(OggVorbis_File *vf,int64_t pos);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>pos</i></dt>
+<dd>Position in pcm samples to seek to in the bitstream.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+
+<li>
+nonzero indicates failure, described by several error codes:</li>\r
+<ul>\r
+<li>OV_ENOSEEK - Bitstream is not seekable.\r
+</li>\r
+<li>OV_EINVAL - Invalid argument value.\r
+</li>\r
+<li>OV_EREAD - A read from media returned an error.\r
+</li>\r
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack \r
+               corruption.\r
+</li>\r
+<li>OV_EBADLINK - Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt. \r
+</li>\r
+</ul></</blockquote>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_pcm_tell.html b/doc/vorbisfile/ov_pcm_tell.html
new file mode 100644 (file)
index 0000000..f277a41
--- /dev/null
@@ -0,0 +1,61 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_pcm_tell</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_pcm_tell</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the current offset in samples.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int64_t ov_pcm_tell(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li><i>n</i> indicates the current offset in samples.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_pcm_total.html b/doc/vorbisfile/ov_pcm_total.html
new file mode 100644 (file)
index 0000000..bb205c2
--- /dev/null
@@ -0,0 +1,66 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_pcm_total</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_pcm_total</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the total pcm samples of the physical bitstream or a specified logical bitstream.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int64_t ov_pcm_total(OggVorbis_File *vf,int i);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>i</i></dt>
+<dd>Link to the desired logical bitstream.  To retrieve the total pcm samples for the entire physical bitstream, this parameter should be set to -1.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>\r
+<li>OV_EINVAL means that the argument was invalid.  In this case, the requested bitstream did not exist or the bitstream is unseekable.</li>
+<li>
+total length in pcm samples of content if i=-1.</li>
+<li>length in pcm samples of logical bitstream if i=1 to n.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_raw_seek.html b/doc/vorbisfile/ov_raw_seek.html
new file mode 100644 (file)
index 0000000..dba16b4
--- /dev/null
@@ -0,0 +1,77 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_raw_seek</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_raw_seek</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Seeks to the offset specified (in compressed raw bytes) within the physical bitstream.  This function only works for seekable streams.
+<p>This also updates everything needed within the
+decoder, so you can immediately call <a href="ov_read.html">ov_read()</a> and get data from
+the newly seeked to position.
+<p>When seek speed is a priority, this is the best vorbisfile seek funtion to use.
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_raw_seek(OggVorbis_File *vf,long pos);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</dd>
+<dt><i>pos</i></dt>
+<dd>Position in compressed bytes to seek to in the bitstream.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 indicates success</li>
+<li>nonzero indicates failure, described by several error codes:</li>\r
+<ul>\r
+<li>OV_ENOSEEK - Bitstream is not seekable.\r
+</li>\r
+<li>OV_EINVAL - Invalid argument value.\r
+</li>\r
+<li>OV_EBADLINK - Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt. \r
+</li>\r
+</ul>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_raw_tell.html b/doc/vorbisfile/ov_raw_tell.html
new file mode 100644 (file)
index 0000000..d2b649d
--- /dev/null
@@ -0,0 +1,61 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_raw_tell</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_raw_tell</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the current offset in raw compressed bytes.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int64_t ov_raw_tell(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li><i>n</i> indicates the current offset in bytes.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_raw_total.html b/doc/vorbisfile/ov_raw_total.html
new file mode 100644 (file)
index 0000000..9732a0d
--- /dev/null
@@ -0,0 +1,66 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_raw_total</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_raw_total</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the total (compressed) bytes of the physical bitstream or a specified logical bitstream.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int64_t ov_raw_total(OggVorbis_File *vf,int i);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>i</i></dt>
+<dd><b>Link to the desired logical bitstream.  To retrieve the total bytes for the entire physical bitstream, this parameter should be set to -1.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>OV_EINVAL means that the argument was invalid.  In this case, the requested bitstream did not exist or the bitstream is nonseekable</li>
+<li>
+total length in compressed bytes of content if i=-1.</li>
+<li>length in compressed bytes of logical bitstream if i=1 to n.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_read.html b/doc/vorbisfile/ov_read.html
new file mode 100644 (file)
index 0000000..ad53aaa
--- /dev/null
@@ -0,0 +1,99 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_read</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_read</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>This is the main function used to decode a Vorbis file within a loop.
+<p>This function deals with more complicated bitstream chaining issues.  Up to this point, everything could more or less hide the multiple
+   logical bitstream nature of chaining from the toplevel application
+   if the toplevel application didn't particularly care.  However, when we actually read audio back, we must be aware that multiple bitstream sections do not necessarily
+   have to have the same number of channels or sampling rate.
+<p>
+   ov_read returns the sequential logical bitstream number currently
+   being decoded along with the PCM data in order that the toplevel
+   application can take action on channel/sample rate changes.  This
+   number will be incremented even for streamed (non-seekable) streams
+   For seekable streams, it represents the actual logical bitstream
+   index within the physical bitstream.
+<p>
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_read(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions.</dd>
+<dt><i>buffer</i></dt>
+<dd>A pointer to an output buffer.  The decoded output is inserted into this buffer.</dd>
+<dt><i>length</i></dt>
+<dd>Number of bytes to be read into the buffer. Should be the same size as the buffer.  A typical value is 4096.</dd>
+<dt><i>bigendianp</i></dt>
+<dd>Specifies big or little endian byte packing.  0 for little endian, 1 for big endian.  Typical value is 0.</dd>
+<dt><i>word</i></dt>
+<dd>Specifies word size.  Possible arguments are 1 for 8-bit samples, or 2 or 16-bit samples.  Typical value is 2.</dd>
+<dt><i>sgned</i></dt>
+<dd>Signed or unsigned data.  0 for unsigned, 1 for signed.  Typically 1.</dd>
+<dt><i>bitstream</i></dt>
+<dd></dd>A pointer to the number of the current logical bitstream.
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+OV_HOLE indicates there was an interruption in the data. (one of: garbage between pages, loss of sync followed by recapture, or a corrupt page)</li>\r
+<li>
+OV_EBADLINK    indicates that an invalid stream section was supplied to libvorbisfile, \r
+               or the requested link is corrupt. \r
+</li>
+
+<li>
+0 indicates EOF</li>
+<li><i>n</i> indicates actual number of bytes read.  Within a logical bitstream, the number should equal <tt>length</tt>.  At the end of a logical bitstream, the number of bytes read will equal the remaining number of bytes in the bitstream.</li>
+</blockquote>
+<p>
+<h3>Notes</h3>
+<p><b>Typical usage:</b> <tt>bytes_read = ov_read(&amp;vf, buffer, 4096,0,2,1,&amp;current_section)</tt>
+<br>This reads up to 4096 bytes into a buffer, with signed 16-bit little-endian
+samples.
+<br>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_seekable.html b/doc/vorbisfile/ov_seekable.html
new file mode 100644 (file)
index 0000000..e369ee9
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_seekable</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_seekable</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>This indicates whether or not the bitstream is seekable.
+
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_seekable(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. <b>Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 indicates that the file is not seekable.</li>
+<li>1 indicates that the file is seekable.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_serialnumber.html b/doc/vorbisfile/ov_serialnumber.html
new file mode 100644 (file)
index 0000000..0c2a733
--- /dev/null
@@ -0,0 +1,67 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_serialnumber</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_serialnumber</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the serialnumber of the specified logical bitstream.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_serialnumber(OggVorbis_File *vf,int i);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</dd>
+<dt><i>i</i></dt>
+<dd><b>Link to the desired logical bitstream.  For nonseekable files, this argument is ignored.  To retrieve the <a href="vorbis_info.html">vorbis_info</a> struct for the current bitstream, this parameter should be set to -1.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+-1 if the specified logical bitstream <i>i</i> does not exist.</li>
+
+<li>Returns the serial number of the logical bitstream <i>i</i> or the serial number of the current bitstream if the file is nonseekable.</li>
+</blockquote>
+<p>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_streams.html b/doc/vorbisfile/ov_streams.html
new file mode 100644 (file)
index 0000000..ba4b31e
--- /dev/null
@@ -0,0 +1,65 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_streams</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_streams</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the number of logical bitstreams within our physical bitstream.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+long ov_streams(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. <b>Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+1 indicates a single logical bitstream or an unseekable file.</li>
+<li><i>n</i> indicates the number of logical bitstreams.</li>
+</blockquote>
+<p>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_time_seek.html b/doc/vorbisfile/ov_time_seek.html
new file mode 100644 (file)
index 0000000..8e88e9c
--- /dev/null
@@ -0,0 +1,71 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_time_seek</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_time_seek</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>For seekable
+streams, this seeks to the given time. For implementing seeking in a player,
+this is the only function generally needed. This also updates everything needed within the
+decoder, so you can immediately call <a href="ov_read.html">ov_read()</a> and get data from
+the newly seeked to position.  For obvious reasons, this doesn't work for unseekable streams.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_time_seek(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, double seconds);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>Pointer to our already opened and initialized OggVorbis_File structure.</dd>
+<dt><i>seconds</i></dt>
+<dd>Location to seek to within the file, specified in seconds.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+
+<li>
+Nonzero for failure</li>
+</blockquote>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_time_seek_page.html b/doc/vorbisfile/ov_time_seek_page.html
new file mode 100644 (file)
index 0000000..b3b9616
--- /dev/null
@@ -0,0 +1,84 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_time_seek_page</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_time_seek_page</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>For seekable
+streams, this seeks to closest full page preceding the given time.  This function is faster than <a href="ov_time_seek.html">ov_time_seek</a> because it doesn't seek through the last few samples to reach an exact time, but it is also less accurate.  This should be used when speed is important.\r
+<p>This function also updates everything needed within the
+decoder, so you can immediately call <a href="ov_read.html">ov_read()</a> and get data from
+the newly seeked to position.  \r
+<p>For obvious reasons, this doesn't work for unseekable streams.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+int ov_time_seek_page(<a href="OggVorbis_File.html">OggVorbis_File</a> *vf, double seconds);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>Pointer to our already opened and initialized OggVorbis_File structure.</dd>
+<dt><i>seconds</i></dt>
+<dd>Location to seek to within the file, specified in seconds.</dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>
+0 for success</li>
+
+<li>
+nonzero indicates failure, described by several error codes:</li>\r
+<ul>\r
+<li>OV_ENOSEEK - Bitstream is not seekable.\r
+</li>\r
+<li>OV_EINVAL - Invalid argument value.\r
+</li>\r
+<li>OV_EREAD - A read from media returned an error.\r
+</li>\r
+<li>OV_EFAULT - Internal logic fault; indicates a bug or heap/stack \r
+               corruption.\r
+</li>\r
+<li>OV_EBADLINK - Invalid stream section supplied to libvorbis/libvorbisfile, or the requested link is corrupt. \r
+</li>\r
+</ul></blockquote>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_time_tell.html b/doc/vorbisfile/ov_time_tell.html
new file mode 100644 (file)
index 0000000..1377926
--- /dev/null
@@ -0,0 +1,63 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_bitrate</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_time_tell</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+<p>Returns the current offset in seconds.
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+double ov_time_tell(OggVorbis_File *vf);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. <b>Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li><i>n</i> indicates the current offset in bytes.</li>
+</blockquote>
+<p>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/ov_time_total.html b/doc/vorbisfile/ov_time_total.html
new file mode 100644 (file)
index 0000000..1fa81a5
--- /dev/null
@@ -0,0 +1,74 @@
+<html>
+
+<head>
+<title>vorbisfile - function - ov_time_total</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>ov_time_total</h1>
+
+<p><i>declared in "vorbis/vorbisfile.h";</i></p>
+
+
+<p>Returns the total time in seconds of the physical bitstream or a specified logical bitstream.
+
+
+<br><br>
+<table border=0 color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+double ov_time_total(OggVorbis_File *vf,int i);
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>vf</i></dt>
+<dd>A pointer to the OggVorbis_File structure--this is used for ALL the externally visible vorbisfile
+functions. Once this has been called, the same <tt>OggVorbis_File</tt>
+struct should be passed to all the vorbisfile functions.</dd>
+<dt><i>i</i></dt>
+<dd><b>Link to the desired logical bitstream.  To retrieve the <a href="vorbis_info.html">vorbis_info</a> struct for the current bitstream, this parameter should be set to -1.</b></dd>
+</dl>
+
+
+<h3>Return Values</h3>
+<blockquote>
+<li>OV_EINVAL means that the argument was invalid.  In this case, the requested bitstream did not exist or the bitstream is nonseekable.</li>
+<li>
+total length in seconds of content if i=-1.</li>
+<li>length in seconds of logical bitstream if i=1 to n.</li>
+</blockquote>
+<p>
+<h3>Notes</h3>
+<p><b>Typical usage:</b> <tt>bytes_read = ov_read(&amp;vf, buffer, 4096,0,2,1,&amp;current_section)</tt>
+<br>This reads up to 4096 bytes into a buffer, with signed 16-bit little-endian
+samples.
+<br>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/overview.html b/doc/vorbisfile/overview.html
new file mode 100644 (file)
index 0000000..99b384d
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+
+<head>
+<title>libvorbisfile - API Overview</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>VorbisFile API Overview</h1>
+\r
+<p>The makeup of the vorbisfile API is relatively simple.  It revolves around a single file resource.  This resource is passed to the Vorbisfile API, where it is opened, manipulated, and closed, in the form of an <a href="OggVorbis_File.html">OggVorbis_File</a> struct.
+<p>
+The vorbisfile API consists of the following functional categories:
+<p>
+<ul>
+<li><p><a href="datastructures.html">Base data structures</a>
+<li><p><a href="initialization.html">Setup/Teardown</a>
+<li><p><a href="decoding.html">Decoding</a>
+<li><p><a href="seeking.html">Seeking</a>
+<li><p><a href="fileinfo.html">File Information</a>
+</ul>
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/reference.html b/doc/vorbisfile/reference.html
new file mode 100644 (file)
index 0000000..0649e22
--- /dev/null
@@ -0,0 +1,66 @@
+<html>
+
+<head>
+<title>Vorbisfile API Reference</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Vorbisfile API Reference</h1>
+
+<p>
+<b>Data Structures</b><br>
+<a href="OggVorbis_File.html">OggVorbis_File</a><br>
+<a href="vorbis_comment.html">vorbis_comment</a><br>
+<a href="vorbis_info.html">vorbis_info</a><br>
+<a href="ov_callbacks.html">ov_callbacks</a><br>
+<br>
+<b>Setup/Teardown</b><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>
+<br>
+<b>Decoding</b><br>
+<a href="ov_read.html">ov_read()</a><br>
+<br>
+<b>Seeking</b><br>
+<a href="ov_raw_seek.html">ov_raw_seek()</a><br>
+<a href="ov_pcm_seek.html">ov_pcm_seek()</a><br>
+<a href="ov_time_seek.html">ov_time_seek()</a><br>
+<br>
+<b>File Information</b><br>
+<a href="ov_bitrate.html">ov_bitrate()</a><br>
+<a href="ov_bitrate_instant.html">ov_bitrate_instant()</a><br>
+<a href="ov_streams.html">ov_streams()</a><br>
+<a href="ov_seekable.html">ov_seekable()</a><br>
+<a href="ov_serialnumber.html">ov_serialnumber()</a><br>
+<a href="ov_raw_total.html">ov_raw_total()</a><br>
+<a href="ov_pcm_total.html">ov_pcm_total()</a><br>
+<a href="ov_time_total.html">ov_time_total()</a><br>
+<a href="ov_raw_tell.html">ov_raw_tell()</a><br>
+<a href="ov_pcm_tell.html">ov_pcm_tell()</a><br>
+<a href="ov_time_tell.html">ov_time_tell()</a><br>
+<a href="ov_info.html">ov_info()</a><br>
+<a href="ov_comment.html">ov_comment()</a><br>
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/seekexample.html b/doc/vorbisfile/seekexample.html
new file mode 100644 (file)
index 0000000..1c5e36b
--- /dev/null
@@ -0,0 +1,139 @@
+<html>
+
+<head>
+<title>vorbisfile - Example Code</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Example Code</h1>
+
+<p>
+The following is a run-through of the seeking example program supplied
+with vorbisfile - <a href="seeking_test_c.html">seeking_test.c</a>.  
+This program tests the vorbisfile <a href="ov_time_seek.html">ov_time_seek</a> function by seeking to random points within the file.
+
+<p>
+First, relevant headers, including vorbis-specific "codec.h" and "vorbisfile.h" have to be included.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#include &lt;stdlib.h>
+#include &lt;stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+#include "../lib/misc.h"
+</b></pre>
+       </td>
+</tr>
+</table>
+
+<p>Inside main(), we declare our primary OggVorbis_File structure.  We also declare a other helpful variables to track our progress within the file.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+int main(){
+  OggVorbis_File ov;
+  int i;
+</b></pre>
+        </td>
+</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.
+
+<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){
+    printf("Could not open input as an OggVorbis file.\n\n");
+    exit(1);
+  }
+
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+First we check to make sure the stream is seekable using <a href="ov_seekable.html">ov_seekable</a>.
+
+<p>Then we seek to 100 random spots in the bitstream using <a href="ov_time_seek.html">ov_time_seek</a> with randomly generated values.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  
+  /* print details about each logical bitstream in the input */
+  if(ov_seekable(&ov)){
+    double length=ov_time_total(&ov,-1);
+    printf("testing seeking to random places in %g seconds....\n",length);
+    for(i=0;i<100;i++){
+      double val=(double)rand()/RAND_MAX*length;
+      ov_time_seek(&ov,val);
+      printf("\r\t%d [%gs]...     ",i,val);
+      fflush(stdout);
+    }
+    
+    printf("\r                                   \nOK.\n\n");
+  }else{
+    printf("Standard input was not seekable.\n");
+  }
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+<p>
+When we're done seeking, we need to call <a href="ov_clear.html">ov_clear()</a> to release the bitstream.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  ov_clear(&ov);
+  return 0;
+}
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The full source for seeking_test.c can be found with the vorbis
+distribution in <a href="seeking_test_c.html">seeking_test.c</a>.
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/seeking.html b/doc/vorbisfile/seeking.html
new file mode 100644 (file)
index 0000000..6b5ac18
--- /dev/null
@@ -0,0 +1,67 @@
+<html>\r
+\r
+<head>\r
+<title>vorbisfile - Seeking</title>\r
+<link rel=stylesheet href="style.css" type="text/css">\r
+</head>\r
+\r
+<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">\r
+<table border=0 width=100%>\r
+<tr>\r
+<td><p class=tiny>vorbisfile documentation</p></td>\r
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>\r
+</tr>\r
+</table>\r
+\r
+<h1>Seeking</h1>\r
+<p>Seeking functions allow you to specify a specific point in the stream to begin or continue decoding.\r
+<p>\r
+All the <b>vorbisfile</b> seeking routines are declared in "vorbis/vorbisfile.h".\r
+<p>\r
+<p>Certain seeking functions are best suited to different situations.  When speed is important, page-level seeking should be used.\r
+\r
+</ul>\r
+\r
+<table border=1 color=black width=50% cellspacing=0 cellpadding=7>\r
+<tr bgcolor=#cccccc>\r
+       <td><b>function</b></td>\r
+       <td><b>purpose</b></td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_raw_seek.html">ov_raw_seek</a></td>\r
+       <td>This function seeks to a specific byte in the bitstream, specified in bytes.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_pcm_seek.html">ov_pcm_seek</a></td>\r
+       <td>This function seeks to a specific point in the bitstream, specified in pcm samples.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_pcm_seek.html">ov_pcm_seek_page</a></td>\r
+       <td>This function seeks to the closest page preceding a point in the bitstream, specified in pcm samples.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_time_seek.html">ov_time_seek</a></td>\r
+       <td>This function seeks to a time in the bitstream, specified in seconds.  The easiest and simplest seeking method.</td>\r
+</tr>\r
+<tr valign=top>\r
+       <td><a href="ov_time_seek_page.html">ov_time_seek_page</a></td>\r
+       <td>This function seeks to the closest page preceding a time in the bitstream, specified in seconds.</td>\r
+</tr>\r
+</table>\r
+\r
+<br><br>\r
+<hr noshade>\r
+<table border=0 width=100%>\r
+<tr valign=top>\r
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>\r
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>\r
+</tr><tr>\r
+<td><p class=tiny>vorbisfile documentation</p></td>\r
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>\r
+</tr>\r
+</table>\r
+\r
+\r
+</body>\r
+\r
+</html>\r
diff --git a/doc/vorbisfile/seeking_example_c.html b/doc/vorbisfile/seeking_example_c.html
new file mode 100644 (file)
index 0000000..0ffcf82
--- /dev/null
@@ -0,0 +1,83 @@
+<html>
+
+<head>
+<title>vorbisfile - seeking_test.c</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>seeking_test.c</h1>
+
+<p>
+The example program source:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+#include "../lib/misc.h"
+
+int main(){
+  OggVorbis_File ov;
+  int i;
+
+  /* open the file/pipe on stdin */
+  if(ov_open(stdin,&ov,NULL,-1)==-1){
+    printf("Could not open input as an OggVorbis file.\n\n");
+    exit(1);
+  }
+  
+  /* print details about each logical bitstream in the input */
+  if(ov_seekable(&ov)){
+    double length=ov_time_total(&ov,-1);
+    printf("testing seeking to random places in %g seconds....\n",length);
+    for(i=0;i<100;i++){
+      double val=(double)rand()/RAND_MAX*length;
+      ov_time_seek(&ov,val);
+      printf("\r\t%d [%gs]...     ",i,val);
+      fflush(stdout);
+    }
+    
+    printf("\r                                   \nOK.\n\n");
+  }else{
+    printf("Standard input was not seekable.\n");
+  }
+
+  ov_clear(&ov);
+  return 0;
+}
+
+</b></pre>
+       </td>
+</tr>
+</table>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/seeking_test_c.html b/doc/vorbisfile/seeking_test_c.html
new file mode 100644 (file)
index 0000000..0ffcf82
--- /dev/null
@@ -0,0 +1,83 @@
+<html>
+
+<head>
+<title>vorbisfile - seeking_test.c</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>seeking_test.c</h1>
+
+<p>
+The example program source:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+#include "../lib/misc.h"
+
+int main(){
+  OggVorbis_File ov;
+  int i;
+
+  /* open the file/pipe on stdin */
+  if(ov_open(stdin,&ov,NULL,-1)==-1){
+    printf("Could not open input as an OggVorbis file.\n\n");
+    exit(1);
+  }
+  
+  /* print details about each logical bitstream in the input */
+  if(ov_seekable(&ov)){
+    double length=ov_time_total(&ov,-1);
+    printf("testing seeking to random places in %g seconds....\n",length);
+    for(i=0;i<100;i++){
+      double val=(double)rand()/RAND_MAX*length;
+      ov_time_seek(&ov,val);
+      printf("\r\t%d [%gs]...     ",i,val);
+      fflush(stdout);
+    }
+    
+    printf("\r                                   \nOK.\n\n");
+  }else{
+    printf("Standard input was not seekable.\n");
+  }
+
+  ov_clear(&ov);
+  return 0;
+}
+
+</b></pre>
+       </td>
+</tr>
+</table>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/seekingexample.html b/doc/vorbisfile/seekingexample.html
new file mode 100644 (file)
index 0000000..a137786
--- /dev/null
@@ -0,0 +1,204 @@
+<html>
+
+<head>
+<title>vorbisfile - Example Code</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>Example Code</h1>
+
+<p>
+The following is a run-through of the decoding example program supplied
+with vorbisfile - <a href="vorbisfile_example_c.html">vorbisfile_example.c</a>.  
+This program takes a vorbis bitstream from stdin and writes raw pcm to stdout.
+
+<p>
+First, relevant headers, including vorbis-specific "codec.h" and "vorbisfile.h" have to be included.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;math.h&gt;
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+</b></pre>
+       </td>
+</tr>
+</table>
+<p>
+We also have to make a concession to Windows users here.  If we are using windows for decoding, we must declare these libraries so that we can set stdin/stdout to binary.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#ifdef _WIN32
+#include &lt;io.h&gt;
+#include &lt;fcntl.h&gt;
+#endif
+</b></pre>
+       </td>
+</tr>
+</table>
+<p>
+Next, a buffer for the pcm audio output is declared.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+char pcmout[4096];
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>Inside main(), we declare our primary OggVorbis_File structure.  We also declare a few other helpful variables to track out progress within the file.
+Also, we make our final concession to Windows users by setting the stdin and stdout to binary mode.
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+int main(int argc, char **argv){
+  OggVorbis_File vf;
+  int eof=0;
+  int current_section;
+
+#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
+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.
+
+<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) {
+      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
+      exit(1);
+  }
+
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+We're going to pull the channel and bitrate info from the file using <a href="ov_info.html">ov_info()</a> and show them to the user.
+We also want to pull out and show the user a comment attached to the file using <a href="ov_comment.html">ov_comment()</a>.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+  {
+    char **ptr=ov_comment(&vf,-1)->user_comments;
+    vorbis_info *vi=ov_info(&vf,-1);
+    while(*ptr){
+      fprintf(stderr,"%s\n",*ptr);
+      ++ptr;
+    }
+    fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
+    fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
+  }
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+Here's the read loop:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+
+  while(!eof){
+    long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
+    switch(ret){
+    case 0:
+      /* EOF */
+      eof=1;
+      break;
+    case -1:
+      break;
+    default:
+      fwrite(pcmout,1,ret,stdout);
+      break;
+    }
+  }
+  
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The code is reading blocks of data using <a href="ov_read.html">ov_read()</a>.
+Based on the value returned, we know if we're at the end of the file or have invalid data.  If we have valid data, we write it to the pcm output.
+
+<p>
+Now that we've finished playing, we can pack up and go home.  It's important to call <a href="ov_clear.html">ov_clear()</a> when we're finished.
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+        <td>
+<pre><b>
+
+  ov_clear(&vf);
+    
+  fprintf(stderr,"Done.\n");
+  return(0);
+}
+</b></pre>
+        </td>
+</tr>
+</table>
+
+<p>
+The full source for vorbisfile_example.c can be found with the vorbis
+distribution in <a href="vorbisfile_example_c.html">vorbisfile_example.c</a>.
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
+<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/style.css b/doc/vorbisfile/style.css
new file mode 100644 (file)
index 0000000..332f809
--- /dev/null
@@ -0,0 +1,7 @@
+BODY { font-family: helvetica, sans-serif }
+TD { font-family: helvetica, sans-serif }
+P { font-family: helvetica, sans-serif }
+H1 { font-family: helvetica, sans-serif }
+H2 { font-family: helvetica, sans-serif }
+H4 { font-family: helvetica, sans-serif }
+P.tiny { font-size: 8pt }
diff --git a/doc/vorbisfile/vorbis_comment.html b/doc/vorbisfile/vorbis_comment.html
new file mode 100644 (file)
index 0000000..53f5b74
--- /dev/null
@@ -0,0 +1,67 @@
+<html>
+
+<head>
+<title>vorbisfile - datatype - vorbis_comment</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>vorbis_comment</h1>
+
+<p><i>declared in "vorbis/codec.h"</i></p>
+
+<p>
+The vorbis_comment structure defines an Ogg Vorbis comment.
+<p>
+Only the fields the program needs must be defined.  If a field isn't
+defined by the application, it will either be blank (if it's a string value)
+or set to some reasonable default (usually 0).
+<p>
+
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>typedef struct vorbis_comment{
+  /* unlimited user comment fields. */
+  char **user_comments;
+  int    comments;
+  char  *vendor;
+
+} vorbis_comment;</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Parameters</h3>
+<dl>
+<dt><i>user_comments</i></dt>
+<dd>Unlimited user comment array.  Comments stored in normal C 0-terminated strings.</dd>
+<dt><i>comments</i></dt>
+<dd>Int signifying number of user comments in user_comments field.</dd>
+<dt><i>vendor</i></dt>
+<dd>Information about the creator of the file.  Stored in a standard C 0-terminated string.</dd>
+</dl>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/vorbis_info.html b/doc/vorbisfile/vorbis_info.html
new file mode 100644 (file)
index 0000000..b9ae7de
--- /dev/null
@@ -0,0 +1,102 @@
+<html>
+
+<head>
+<title>vorbisfile - datatype - vorbis_info</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>vorbis_info</h1>
+
+<p><i>declared in "vorbis/codec.h"</i></p>
+
+<p>
+The vorbis_info structure contains information about a vorbis bitstream.  Most of the information in this struct is more complex and in-depth than we need for vorbisfile decoding.  However, the info's there if we need or want it.
+
+<p>
+
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>typedef struct vorbis_info{
+  int version;
+  int channels;
+  long rate;
+  
+  long bitrate_upper;
+  long bitrate_nominal;
+  long bitrate_lower;
+
+  long blocksizes[2];
+
+  int        modes;
+  int        maps;
+  int        times;
+  int        floors;
+  int        residues;
+  int        books;
+  int        psys;     /* encode only */
+
+  vorbis_info_mode    *mode_param[64];
+  int                  map_type[64];
+  vorbis_info_mapping *map_param[64];
+  int                  time_type[64];
+  vorbis_info_time    *time_param[64];
+  int                  floor_type[64];
+  vorbis_info_floor   *floor_param[64];
+  int                  residue_type[64];
+  vorbis_info_residue *residue_param[64];
+  static_codebook     *book_param[256];
+  vorbis_info_psy     *psy_param[64]; /* encode only */
+  
+  /* for block long/sort tuning; encode only */
+  int        envelopesa;
+  double     preecho_thresh;
+  double     preecho_clamp;
+
+} vorbis_info;</b></pre>
+       </td>
+</tr>
+</table>
+
+<h3>Relevant Struct Members</h3>
+<dl>
+<dt><i>version</i></dt>
+<dd>Vorbis encoder version used to create this bitstream.</dd>
+<dt><i>channels</i></dt>
+<dd>Int signifying number of channels in bitstream.</dd>
+<dt><i>rate</i></dt>
+<dd>Sampling rate of the bitstream.</dd>
+<dt><i>bitrate_upper</i></dt>
+<dd>Specifies the upper limit in a VBR bitstream.  If the value matches the bitrate_nominal and bitrate_lower parameters, the stream is fixed bitrate.  May be unset if no limit exists.</dd>
+<dt><i>bitrate_nominal</i></dt>
+<dd>Specifies the average bitrate for a VBR bitstream.  May be unset.  If the bitrate_upper and bitrate_lower parameters match, the stream is fixed bitrate.</dd>
+<dt><i>bitrate_lower</i></dt>
+<dd>Specifies the lower limit in a VBR bitstream.  If the value matches the bitrate_nominal and bitrate_upper parameters, the stream is fixed bitrate.  May be unset if no limit exists.</dd>
+<dt><i>blocksizes[2]</i></dt>
+<dd>Contains the sizes of the long and short blocks for this particular bitstream.  These are variable and can be set by the encoder.  Vorbis only supports two sizes, long and short.</dd>
+</dl>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
diff --git a/doc/vorbisfile/vorbisfile_example_c.html b/doc/vorbisfile/vorbisfile_example_c.html
new file mode 100644 (file)
index 0000000..38068db
--- /dev/null
@@ -0,0 +1,106 @@
+<html>
+
+<head>
+<title>vorbisfile - vorbisfile_example.c</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.25 - 20000615</p></td>
+</tr>
+</table>
+
+<h1>vorbisfile_example.c</h1>
+
+<p>
+The example program source:
+
+<br><br>
+<table border=0 width=100% color=black cellspacing=0 cellpadding=7>
+<tr bgcolor=#cccccc>
+       <td>
+<pre><b>
+#include &lt;stdio.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;math.h&gt;
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+
+#ifdef _WIN32
+#include &lt;io.h&gt;
+#include &lt;fcntl.h&gt;
+#endif
+
+char pcmout[4096];
+
+int main(int argc, char **argv){
+  OggVorbis_File vf;
+  int eof=0;
+  int current_section;
+
+#ifdef _WIN32
+  _setmode( _fileno( stdin ), _O_BINARY );
+  _setmode( _fileno( stdout ), _O_BINARY );
+#endif
+
+  if(ov_open(stdin, &vf, NULL, 0) < 0) {
+      fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
+      exit(1);
+  }
+
+  {
+    char **ptr=ov_comment(&vf,-1)->user_comments;
+    vorbis_info *vi=ov_info(&vf,-1);
+    while(*ptr){
+      fprintf(stderr,"%s\n",*ptr);
+      ++ptr;
+    }
+    fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
+    fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
+  }
+  
+  while(!eof){\r
+    long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);\r
+    if (ret == 0) {\r
+      /* EOF */\r
+      eof=1;\r
+    } else if (ret < 0) {\r
+      /* error in the stream.  Not a problem, just reporting it in\r
+        case we (the app) cares.  In this case, we don't. */\r
+    } else {\r
+      /* we don't bother dealing with sample rate changes, etc, but\r
+        you'll have to*/\r
+      fwrite(pcmout,1,ret,stdout);\r
+    }\r
+  }\r
+\r
+  ov_clear(&vf);
+    
+  fprintf(stderr,"Done.\n");
+  return(0);
+}
+
+</b></pre>
+       </td>
+</tr>
+</table>
+
+
+<br><br>
+<hr noshade>
+<table border=0 width=100%>
+<tr valign=top>
+<td><p class=tiny>copyright &copy; 2000 vorbis team</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@vorbis.org">team@vorbis.org</a></p></td>
+</tr><tr>
+<td><p class=tiny>vorbisfile documentation</p></td>
+<td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
+</tr>
+</table>
+
+</body>
+
+</html>
index f775f1d..1eb3972 100644 (file)
@@ -6,3 +6,4 @@ encoder_example
 decoder_example
 chaining_example
 vorbisfile_example
+seeking_example
index 7dfb6a2..86aea17 100644 (file)
@@ -7,16 +7,17 @@ INCLUDES = -I$(top_srcdir)/include
 noinst_PROGRAMS = decoder_example encoder_example chaining_example\
                vorbisfile_example seeking_example
 
-LDADD = $(top_srcdir)/lib/.libs/libvorbis.a
+LDADD = ../lib/libvorbis.la $(OGG_LIBS)
 
 decoder_example_SOURCES = decoder_example.c
 encoder_example_SOURCES = encoder_example.c
+encoder_example_LDADD = ../lib/libvorbisenc.la ../lib/libvorbis.la $(OGG_LIBS)
 chaining_example_SOURCES = chaining_example.c
-chaining_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a
+chaining_example_LDADD = ../lib/libvorbisfile.la ../lib/libvorbis.la $(OGG_LIBS)
 vorbisfile_example_SOURCES = vorbisfile_example.c
-vorbisfile_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a
+vorbisfile_example_LDADD = ../lib/libvorbisfile.la ../lib/libvorbis.la $(OGG_LIBS)
 seeking_example_SOURCES = seeking_example.c
-seeking_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a
+seeking_example_LDADD = ../lib/libvorbisfile.la ../lib/libvorbis.la $(OGG_LIBS)
 
 debug:
        $(MAKE) all CFLAGS="@DEBUG@"
index c9d7245..3b45e7b 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.6 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: chaining_example.c,v 1.7 2000/11/06 00:06:53 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,7 +24,7 @@ int main(){
   int i;
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open(stdin,&ov,NULL,-1)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
index 7d7571e..8288af5 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: simple example decoder
- last mod: $Id: decoder_example.c,v 1.13 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: decoder_example.c,v 1.14 2000/11/06 00:06:53 xiphmont Exp $
 
  ********************************************************************/
 
@@ -153,7 +153,7 @@ int main(int argc, char **argv){
          while(i<2){
            result=ogg_stream_packetout(&os,&op);
            if(result==0)break;
-           if(result==-1){
+           if(result<0){
              /* Uh oh; data at some point was corrupted or missing!
                 We can't tolerate that in a header.  Die. */
              fprintf(stderr,"Corrupt secondary header.  Exiting.\n");
@@ -202,7 +202,7 @@ int main(int argc, char **argv){
       while(!eos){
        int result=ogg_sync_pageout(&oy,&og);
        if(result==0)break; /* need more data */
-       if(result==-1){ /* missing or corrupt data at this page position */
+       if(result<0){ /* missing or corrupt data at this page position */
          fprintf(stderr,"Corrupt or missing data in bitstream; "
                  "continuing...\n");
        }else{
@@ -212,7 +212,7 @@ int main(int argc, char **argv){
            result=ogg_stream_packetout(&os,&op);
 
            if(result==0)break; /* need more data */
-           if(result==-1){ /* missing or corrupt data at this page position */
+           if(result<0){ /* missing or corrupt data at this page position */
              /* no reason to complain; already complained above */
            }else{
              /* we have a packet.  Decode it */
index 01dcff7..f9280fb 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.14 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.15 2000/11/06 00:06:53 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <math.h>
-#include <vorbis/mode_C.h>
+#include <vorbis/vorbisenc.h>
 
 #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
 #include <io.h>
@@ -45,7 +45,7 @@ int main(){
   ogg_page         og; /* one Ogg bitstream page.  Vorbis packets are inside */
   ogg_packet       op; /* one raw packet of data for decode */
   
-  vorbis_info     *vi; /* struct that stores all the static vorbis bitstream
+  vorbis_info      vi; /* struct that stores all the static vorbis bitstream
                          settings */
   vorbis_comment   vc; /* struct that stores all the user comments */
 
@@ -79,14 +79,15 @@ int main(){
 
   /* choose an encoding mode */
   /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
-  vi=&info_C;
+  vorbis_info_init(&vi);
+  vorbis_encode_init(&vi,2,44100, -1, 128000, -1);
 
   /* add a comment */
   vorbis_comment_init(&vc);
   vorbis_comment_add(&vc,"Track encoded by encoder_example.c");
 
   /* set up the analysis state and auxiliary encoding storage */
-  vorbis_analysis_init(&vd,vi);
+  vorbis_analysis_init(&vd,&vi);
   vorbis_block_init(&vd,&vb);
   
   /* set up our packet->stream encoder */
@@ -187,6 +188,7 @@ int main(){
   ogg_stream_clear(&os);
   vorbis_block_clear(&vb);
   vorbis_dsp_clear(&vd);
+  vorbis_info_clear(&vi);
   
   /* ogg_page and ogg_packet structs always point to storage in
      libvorbis.  They're never freed or manipulated directly */
index f6d5057..7a62c82 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: illustrate seeking, and test it too
- last mod: $Id: seeking_example.c,v 1.4 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: seeking_example.c,v 1.5 2000/11/06 00:06:54 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,7 +27,7 @@ int main(){
   int i;
 
   /* open the file/pipe on stdin */
-  if(ov_open(stdin,&ov,NULL,-1)==-1){
+  if(ov_open(stdin,&ov,NULL,-1)<0){
     printf("Could not open input as an OggVorbis file.\n\n");
     exit(1);
   }
index c575f4a..1af1ead 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: simple example decoder using vorbisfile
- last mod: $Id: vorbisfile_example.c,v 1.2 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: vorbisfile_example.c,v 1.3 2000/11/06 00:06:54 xiphmont Exp $
 
  ********************************************************************/
 
@@ -65,20 +65,16 @@ int main(int argc, char **argv){
   
   while(!eof){
     long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
-    switch(ret){
-    case 0:
+    if (ret == 0) {
       /* EOF */
       eof=1;
-      break;
-    case -1:
+    } else if (ret < 0) {
       /* error in the stream.  Not a problem, just reporting it in
         case we (the app) cares.  In this case, we don't. */
-      break;
-    default:
+    } else {
       /* we don't bother dealing with sample rate changes, etc, but
         you'll have to*/
       fwrite(pcmout,1,ret,stdout);
-      break;
     }
   }
 
index 7740234..794e8cd 100644 (file)
@@ -4,8 +4,6 @@ AUTOMAKE_OPTIONS = foreign
 
 includedir = $(prefix)/include/vorbis
 
-include_HEADERS = backends.h codec.h mode_B.h mode_D.h modes.h\
-               codebook.h mode_A.h mode_C.h mode_E.h vorbisfile.h
+include_HEADERS = codec.h vorbisfile.h vorbisenc.h
 
-SUBDIRS = book
 
diff --git a/include/vorbis/book/Makefile.am b/include/vorbis/book/Makefile.am
deleted file mode 100644 (file)
index bd7c445..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-AUTOMAKE_OPTIONS = foreign
-
-includedir = $(prefix)/include/vorbis/book
-
-include_HEADERS = lsp12_0.vqh res0_1024a_192_5.vqh res0_128a_192_4.vqh \
-       lsp30_0.vqh res0_1024a_256_1.vqh res0_128a_192_5.vqh \
-       res0_1024a_128_1.vqh res0_1024a_256_2.vqh res0_128a_256_1.vqh \
-       res0_1024a_128_2.vqh res0_1024a_256_3.vqh res0_128a_256_2.vqh \
-       res0_1024a_128_3.vqh res0_1024a_256_4.vqh res0_128a_256_3.vqh \
-       res0_1024a_128_4.vqh res0_1024a_256_5.vqh res0_128a_256_4.vqh \
-       res0_1024a_128_5.vqh res0_1024a_350_1.vqh res0_128a_256_5.vqh \
-       res0_1024a_128_6.vqh res0_1024a_350_2.vqh res0_128a_350_1.vqh \
-       res0_1024a_128_7.vqh res0_1024a_350_3.vqh res0_128a_350_2.vqh \
-       res0_1024a_128_8.vqh res0_1024a_350_4.vqh res0_128a_350_3.vqh \
-       res0_1024a_128_9.vqh res0_1024a_350_5.vqh res0_128a_350_4.vqh \
-       res0_1024a_160_1.vqh res0_128a_128_1.vqh res0_128a_350_5.vqh \
-       res0_1024a_160_2.vqh res0_128a_128_2.vqh resaux0_1024a_128.vqh \
-       res0_1024a_160_3.vqh res0_128a_128_3.vqh resaux0_1024a_160.vqh \
-       res0_1024a_160_4.vqh res0_128a_128_4.vqh resaux0_1024a_192.vqh \
-       res0_1024a_160_5.vqh res0_128a_128_5.vqh resaux0_1024a_256.vqh \
-       res0_1024a_160_6.vqh res0_128a_160_1.vqh resaux0_1024a_350.vqh \
-       res0_1024a_160_7.vqh res0_128a_160_2.vqh resaux0_128a_128.vqh \
-       res0_1024a_160_8.vqh res0_128a_160_3.vqh resaux0_128a_160.vqh \
-       res0_1024a_160_9.vqh res0_128a_160_4.vqh resaux0_128a_192.vqh \
-       res0_1024a_192_1.vqh res0_128a_160_5.vqh resaux0_128a_256.vqh \
-       res0_1024a_192_2.vqh res0_128a_192_1.vqh resaux0_128a_350.vqh \
-       res0_1024a_192_3.vqh res0_128a_192_2.vqh res0_1024a_192_4.vqh \
-       res0_128a_192_3.vqh
index e91f9a9..42ba8c9 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.32 2000/10/12 07:28:03 jack Exp $
+ last mod: $Id: codec.h,v 1.33 2000/11/06 00:06:55 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,69 +24,7 @@ extern "C"
 {
 #endif /* __cplusplus */
 
-#define MAX_BARK 27
-
 #include <ogg/ogg.h>
-#include "vorbis/codebook.h"
-
-typedef void vorbis_look_transform;
-typedef void vorbis_info_time;
-typedef void vorbis_look_time;
-typedef void vorbis_info_floor;
-typedef void vorbis_look_floor;
-typedef void vorbis_echstate_floor;
-typedef void vorbis_info_residue;
-typedef void vorbis_look_residue;
-typedef void vorbis_info_mapping;
-typedef void vorbis_look_mapping;
-
-/* mode ************************************************************/
-typedef struct {
-  int blockflag;
-  int windowtype;
-  int transformtype;
-  int mapping;
-} vorbis_info_mode;
-
-/* psychoacoustic setup ********************************************/
-#define P_BANDS 17
-#define P_LEVELS 11
-typedef struct vorbis_info_psy{
-  int    athp;
-  int    decayp;
-  int    smoothp;
-
-  int    noisecullp;
-  float noisecull_barkwidth;
-
-  float ath_adjatt;
-  float ath_maxatt;
-
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
-  int tonemaskp;
-  float toneatt[P_BANDS][P_LEVELS];
-
-  int peakattp;
-  float peakatt[P_BANDS][P_LEVELS];
-
-  int noisemaskp;
-  float noiseatt[P_BANDS][P_LEVELS];
-
-  float max_curve_dB;
-
-  /* decay setup */
-  float attack_coeff;
-  float decay_coeff;
-} vorbis_info_psy;
-
-/* vorbis_info contains all the setup information specific to the
-   specific compression/decompression mode in progress (eg,
-   psychoacoustic settings, channel setup, options, codebook
-   etc).  
-*********************************************************************/
 
 typedef struct vorbis_info{
   int version;
@@ -111,51 +49,17 @@ typedef struct vorbis_info{
   long bitrate_upper;
   long bitrate_nominal;
   long bitrate_lower;
+  long bitrate_window;
 
-  /* Vorbis supports only short and long blocks, but allows the
-     encoder to choose the sizes */
-
-  long blocksizes[2];
-
-  /* modes are the primary means of supporting on-the-fly different
-     blocksizes, different channel mappings (LR or mid-side),
-     different residue backends, etc.  Each mode consists of a
-     blocksize flag and a mapping (along with the mapping setup */
-
-  int        modes;
-  int        maps;
-  int        times;
-  int        floors;
-  int        residues;
-  int        books;
-  int        psys;     /* encode only */
-
-  vorbis_info_mode    *mode_param[64];
-  int                  map_type[64];
-  vorbis_info_mapping *map_param[64];
-  int                  time_type[64];
-  vorbis_info_time    *time_param[64];
-  int                  floor_type[64];
-  vorbis_info_floor   *floor_param[64];
-  int                  residue_type[64];
-  vorbis_info_residue *residue_param[64];
-  static_codebook     *book_param[256];
-  vorbis_info_psy     *psy_param[64]; /* encode only */
-  
-  /* for block long/sort tuning; encode only */
-  int        envelopesa;
-  float     preecho_thresh;
-  float     preecho_clamp;
-  float     preecho_minenergy;
+  void *codec_setup;
 } vorbis_info;
+
 /* vorbis_dsp_state buffers the current vorbis audio
    analysis/synthesis state.  The DSP state belongs to a specific
    logical bitstream ****************************************************/
 typedef struct vorbis_dsp_state{
   int analysisp;
   vorbis_info *vi;
-  int    modebits;
 
   float **pcm;
   float **pcmret;
@@ -179,34 +83,9 @@ typedef struct vorbis_dsp_state{
   ogg_int64_t floor_bits;
   ogg_int64_t res_bits;
 
-  /* local lookup storage */
-  void                   *ve; /* envelope lookup */    
-  float                **window[2][2][2]; /* block, leadin, leadout, type */
-  vorbis_look_transform **transform[2];    /* block, type */
-  codebook               *fullbooks;
-  /* backend lookups are tied to the mode, not the backend or naked mapping */
-  vorbis_look_mapping   **mode;
-
-  /* local storage, only used on the encoding side.  This way the
-     application does not need to worry about freeing some packets'
-     memory and not others'; packet storage is always tracked.
-     Cleared next call to a _dsp_ function */
-  unsigned char *header;
-  unsigned char *header1;
-  unsigned char *header2;
-
+  void       *backend_state;
 } vorbis_dsp_state;
 
-/* vorbis_block is a single block of data to be processed as part of
-the analysis/synthesis stream; it belongs to a specific logical
-bitstream, but is independant from other vorbis_blocks belonging to
-that logical bitstream. *************************************************/
-
-struct alloc_chain{
-  void *ptr;
-  struct alloc_chain *next;
-};
-
 typedef struct vorbis_block{
   /* necessary stream state for linking to the framing abstraction */
   float  **pcm;       /* this is a pointer into local storage */ 
@@ -218,7 +97,7 @@ typedef struct vorbis_block{
   int   pcmend;
   int   mode;
 
-  int eofflag;
+  int         eofflag;
   ogg_int64_t granulepos;
   ogg_int64_t sequence;
   vorbis_dsp_state *vd; /* For read-only access of configuration */
@@ -239,7 +118,15 @@ typedef struct vorbis_block{
 
 } vorbis_block;
 
-#include "vorbis/backends.h"
+/* vorbis_block is a single block of data to be processed as part of
+the analysis/synthesis stream; it belongs to a specific logical
+bitstream, but is independant from other vorbis_blocks belonging to
+that logical bitstream. *************************************************/
+
+struct alloc_chain{
+  void *ptr;
+  struct alloc_chain *next;
+};
 
 /* vorbis_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,
@@ -311,6 +198,24 @@ extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
 extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
 extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
 
+/* Vorbis ERRORS and return codes ***********************************/
+
+#define OV_FALSE      -1  
+#define OV_EOF        -2
+#define OV_HOLE       -3
+
+#define OV_EREAD      -128
+#define OV_EFAULT     -129
+#define OV_EIMPL      -130
+#define OV_EINVAL     -131
+#define OV_ENOTVORBIS -132
+#define OV_EBADHEADER -133
+#define OV_EVERSION   -134
+#define OV_ENOTAUDIO  -135
+#define OV_EBADPACKET -136
+#define OV_EBADLINK   -137
+#define OV_ENOSEEK    -138
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/include/vorbis/vorbisenc.h b/include/vorbis/vorbisenc.h
new file mode 100644 (file)
index 0000000..af2b435
--- /dev/null
@@ -0,0 +1,47 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
+ * http://www.xiph.org/                                             *
+ *                                                                  *
+ ********************************************************************
+
+ function: vorbis encode-engine setup
+ last mod: $Id: vorbisenc.h,v 1.2 2000/11/06 00:06:56 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _OV_ENC_H_
+#define _OV_ENC_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#include "codec.h"
+
+extern int vorbis_encode_init(vorbis_info *vi,
+                             long channels,
+                             long rate,
+                             
+                             long max_bitrate,
+                             long nominal_bitrate,
+                             long min_bitrate);
+
+extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+
+
index 18de228..333dfe8 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.h,v 1.9 2000/10/13 19:48:02 xiphmont Exp $
+ last mod: $Id: vorbisfile.h,v 1.10 2000/11/06 00:06:56 xiphmont Exp $
 
  ********************************************************************/
 
index 50fd60a..bd77824 100644 (file)
@@ -2,21 +2,30 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+SUBDIRS = modes books
+
 INCLUDES = -I$(top_srcdir)/include
 
-lib_LTLIBRARIES = libvorbis.la libvorbisfile.la
+lib_LTLIBRARIES = libvorbis.la libvorbisfile.la libvorbisenc.la
 
 libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c lpc.c\
                        analysis.c synthesis.c psy.c info.c time0.c floor0.c\
                        res0.c mapping0.c registry.c codebook.c sharedbook.c\
-                       iir.c\
-                       envelope.h lpc.h lsp.h bookinternal.h misc.h psy.h\
-                       masking.h sharedbook.h iir.h os.h
+                       iir.c lookup.c\
+                       envelope.h lpc.h lsp.h codebook.h misc.h psy.h\
+                       masking.h iir.h os.h mdct.h smallft.h\
+                       registry.h scales.h window.h lookup.h lookup_data.h\
+                       codec_internal.h backends.h
 libvorbis_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
 
 libvorbisfile_la_SOURCES = vorbisfile.c
 libvorbisfile_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@
 
+libvorbisenc_la_SOURCES = vorbisenc.c
+libvorbisenc_la_LDFLAGS = -version-info @VE_LIB_CURRENT@:@VE_LIB_REVISION@:@VE_LIB_AGE@
+
+EXTRA_DIST = barkmel.c tone.c psytune.c lookups.pl
+
 debug:
        $(MAKE) all CFLAGS="@DEBUG@"
 
index 2cc2be8..5c6d46c 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.34 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.35 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
 
 /* decides between modes, dispatches to the appropriate mapping. */
 int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
-  vorbis_dsp_state *vd=vb->vd;
-  vorbis_info      *vi=vd->vi;
-  int              type;
-  int              mode=0;
+  vorbis_dsp_state     *vd=vb->vd;
+  backend_lookup_state *b=vd->backend_state;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  int                   type,ret;
+  int                   mode=0;
 
   vb->glue_bits=0;
   vb->time_bits=0;
@@ -44,12 +46,12 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
 
   /* currently lazy.  Short block dispatches to 0, long to 1. */
 
-  if(vb->W &&vi->modes>1)mode=1;
-  type=vi->map_type[vi->mode_param[mode]->mapping];
+  if(vb->W &&ci->modes>1)mode=1;
+  type=ci->map_type[ci->mode_param[mode]->mapping];
   vb->mode=mode;
 
   /* Encode frame mode, pre,post windowsize, then dispatch */
-  oggpack_write(&vb->opb,mode,vd->modebits);
+  oggpack_write(&vb->opb,mode,b->modebits);
   if(vb->W){
     oggpack_write(&vb->opb,vb->lW,1);
     oggpack_write(&vb->opb,vb->nW,1);
@@ -58,18 +60,18 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
     fprintf(stderr,".");
     }*/
 
-  if(_mapping_P[type]->forward(vb,vd->mode[mode]))
-    return(-1);
-
+  if((ret=_mapping_P[type]->forward(vb,b->mode[mode])))
+    return(ret);
+  
   /* set up the packet wrapper */
-
+  
   op->packet=oggpack_get_buffer(&vb->opb);
   op->bytes=oggpack_bytes(&vb->opb);
   op->b_o_s=0;
   op->e_o_s=vb->eofflag;
   op->granulepos=vb->granulepos;
   op->packetno=vb->sequence; /* for sake of completeness */
-
+  
   return(0);
 }
 
similarity index 87%
rename from include/vorbis/backends.h
rename to lib/backends.h
index 557ba6a..01e622b 100644 (file)
@@ -1,19 +1,19 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.12 2000/10/12 03:12:40 xiphmont Exp $
+ last mod: $Id: backends.h,v 1.2 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
    Lookups for each backend aren't exposed because there's no reason
    to do so */
 
-#ifndef _vorbis_time_backend_h_
-#define _vorbis_time_backend_h_
+#ifndef _vorbis_backend_h_
+#define _vorbis_backend_h_
+
+#include "codec_internal.h"
 
 /* this would all be simpler/shorter with templates, but.... */
 /* Transform backend generic *************************************/
@@ -36,6 +38,8 @@ typedef struct{
   vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
   vorbis_look_time *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
                              vorbis_info_time *);
+  vorbis_info_time *(*copy_info)(vorbis_info_time *);
+
   void (*free_info) (vorbis_info_time *);
   void (*free_look) (vorbis_look_time *);
   int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
@@ -54,6 +58,7 @@ typedef struct{
   vorbis_info_floor     *(*unpack)(vorbis_info *,oggpack_buffer *);
   vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
                                   vorbis_info_floor *);
+  vorbis_info_floor     *(*copy_info)(vorbis_info_floor *);
   void (*free_info) (vorbis_info_floor *);
   void (*free_look) (vorbis_look_floor *);
   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
@@ -80,6 +85,7 @@ typedef struct{
   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
   vorbis_look_residue *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
                                 vorbis_info_residue *);
+  vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
   void (*free_info)    (vorbis_info_residue *);
   void (*free_look)    (vorbis_look_residue *);
   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
@@ -115,6 +121,7 @@ typedef struct{
   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
   vorbis_look_mapping *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
                                 vorbis_info_mapping *);
+  vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
   void (*free_info)    (vorbis_info_mapping *);
   void (*free_look)    (vorbis_look_mapping *);
   int  (*forward)      (struct vorbis_block *vb,vorbis_look_mapping *);
index 83a5bf3..d13e0da 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: bark scale utility
- last mod: $Id: barkmel.c,v 1.1 2000/01/04 09:04:58 xiphmont Exp $
+ last mod: $Id: barkmel.c,v 1.2 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
index e71bf5d..4cc7ac4 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.39 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: block.c,v 1.40 2000/11/06 00:07:00 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -34,8 +34,7 @@
 #include "mdct.h"
 #include "lpc.h"
 #include "registry.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
+#include "codebook.h"
 #include "misc.h"
 #include "os.h"
 
@@ -106,9 +105,9 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
 void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
   bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
   if(bytes+vb->localtop>vb->localalloc){
-    /* can't just realloc... there are outstanding pointers */
+    /* can't just _ogg_realloc... there are outstanding pointers */
     if(vb->localstore){
-      struct alloc_chain *link=malloc(sizeof(struct alloc_chain));
+      struct alloc_chain *link=_ogg_malloc(sizeof(struct alloc_chain));
       vb->totaluse+=vb->localtop;
       link->next=vb->reap;
       link->ptr=vb->localstore;
@@ -116,7 +115,7 @@ void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
     }
     /* highly conservative */
     vb->localalloc=bytes;
-    vb->localstore=malloc(vb->localalloc);
+    vb->localstore=_ogg_malloc(vb->localalloc);
     vb->localtop=0;
   }
   {
@@ -139,7 +138,7 @@ void _vorbis_block_ripcord(vorbis_block *vb){
   }
   /* consolidate storage */
   if(vb->totaluse){
-    vb->localstore=realloc(vb->localstore,vb->totaluse+vb->localalloc);
+    vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
     vb->localalloc+=vb->totaluse;
     vb->totaluse=0;
   }
@@ -166,54 +165,58 @@ int vorbis_block_clear(vorbis_block *vb){
 
 static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
   int i;
+  codec_setup_info *ci=vi->codec_setup;
+  backend_lookup_state *b=NULL;
+
   memset(v,0,sizeof(vorbis_dsp_state));
+  b=v->backend_state=_ogg_calloc(1,sizeof(backend_lookup_state));
 
   v->vi=vi;
-  v->modebits=ilog2(vi->modes);
+  b->modebits=ilog2(ci->modes);
 
-  v->transform[0]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
-  v->transform[1]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+  b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+  b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
 
   /* MDCT is tranform 0 */
 
-  v->transform[0][0]=calloc(1,sizeof(mdct_lookup));
-  v->transform[1][0]=calloc(1,sizeof(mdct_lookup));
-  mdct_init(v->transform[0][0],vi->blocksizes[0]);
-  mdct_init(v->transform[1][0],vi->blocksizes[1]);
+  b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup));
+  b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup));
+  mdct_init(b->transform[0][0],ci->blocksizes[0]);
+  mdct_init(b->transform[1][0],ci->blocksizes[1]);
 
-  v->window[0][0][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[0][0][1]=v->window[0][0][0];
-  v->window[0][1][0]=v->window[0][0][0];
-  v->window[0][1][1]=v->window[0][0][0];
-  v->window[1][0][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][0][1]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][1][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][1][1]=calloc(VI_WINDOWB,sizeof(float *));
+  b->window[0][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[0][0][1]=b->window[0][0][0];
+  b->window[0][1][0]=b->window[0][0][0];
+  b->window[0][1][1]=b->window[0][0][0];
+  b->window[1][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][0][1]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][1][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][1][1]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
 
   for(i=0;i<VI_WINDOWB;i++){
-    v->window[0][0][0][i]=
-      _vorbis_window(i,vi->blocksizes[0],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
-    v->window[1][0][0][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
-    v->window[1][0][1][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[1]/2);
-    v->window[1][1][0][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[0]/2);
-    v->window[1][1][1][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[1]/2);
+    b->window[0][0][0][i]=
+      _vorbis_window(i,ci->blocksizes[0],ci->blocksizes[0]/2,ci->blocksizes[0]/2);
+    b->window[1][0][0][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[0]/2);
+    b->window[1][0][1][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[1]/2);
+    b->window[1][1][0][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[0]/2);
+    b->window[1][1][1][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[1]/2);
   }
 
   if(encp){ /* encode/decode differ here */
     /* finish the codebooks */
-    v->fullbooks=calloc(vi->books,sizeof(codebook));
-    for(i=0;i<vi->books;i++)
-      vorbis_book_init_encode(v->fullbooks+i,vi->book_param[i]);
+    b->fullbooks=_ogg_calloc(ci->books,sizeof(codebook));
+    for(i=0;i<ci->books;i++)
+      vorbis_book_init_encode(b->fullbooks+i,ci->book_param[i]);
     v->analysisp=1;
   }else{
     /* finish the codebooks */
-    v->fullbooks=calloc(vi->books,sizeof(codebook));
-    for(i=0;i<vi->books;i++)
-      vorbis_book_init_decode(v->fullbooks+i,vi->book_param[i]);
+    b->fullbooks=_ogg_calloc(ci->books,sizeof(codebook));
+    for(i=0;i<ci->books;i++)
+      vorbis_book_init_decode(b->fullbooks+i,ci->book_param[i]);
   }
 
   /* initialize the storage vectors to a decent size greater than the
@@ -222,12 +225,12 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
   v->pcm_storage=8192; /* we'll assume later that we have
                          a minimum of twice the blocksize of
                          accumulated samples in analysis */
-  v->pcm=malloc(vi->channels*sizeof(float *));
-  v->pcmret=malloc(vi->channels*sizeof(float *));
+  v->pcm=_ogg_malloc(vi->channels*sizeof(float *));
+  v->pcmret=_ogg_malloc(vi->channels*sizeof(float *));
   {
     int i;
     for(i=0;i<vi->channels;i++)
-      v->pcm[i]=calloc(v->pcm_storage,sizeof(float));
+      v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(float));
   }
 
   /* all 1 (large block) or 0 (small block) */
@@ -236,17 +239,17 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
   v->W=0;  /* current window size */
 
   /* all vector indexes */
-  v->centerW=vi->blocksizes[1]/2;
+  v->centerW=ci->blocksizes[1]/2;
 
   v->pcm_current=v->centerW;
 
   /* initialize all the mapping/backend lookups */
-  v->mode=calloc(vi->modes,sizeof(vorbis_look_mapping *));
-  for(i=0;i<vi->modes;i++){
-    int mapnum=vi->mode_param[i]->mapping;
-    int maptype=vi->map_type[mapnum];
-    v->mode[i]=_mapping_P[maptype]->look(v,vi->mode_param[i],
-                                        vi->map_param[mapnum]);
+  b->mode=_ogg_calloc(ci->modes,sizeof(vorbis_look_mapping *));
+  for(i=0;i<ci->modes;i++){
+    int mapnum=ci->mode_param[i]->mapping;
+    int maptype=ci->map_type[mapnum];
+    b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
+                                        ci->map_param[mapnum]);
   }
 
   return(0);
@@ -254,11 +257,14 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
 
 /* arbitrary settings and spec-mandated numbers get filled in here */
 int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
+  backend_lookup_state *b=NULL;
+
   _vds_shared_init(v,vi,1);
+  b=v->backend_state;
 
   /* Initialize the envelope state storage */
-  v->ve=calloc(1,sizeof(envelope_lookup));
-  _ve_envelope_init(v->ve,vi);
+  b->ve=_ogg_calloc(1,sizeof(envelope_lookup));
+  _ve_envelope_init(b->ve,vi);
 
   return(0);
 }
@@ -267,18 +273,39 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
   int i,j,k;
   if(v){
     vorbis_info *vi=v->vi;
+    codec_setup_info *ci=(vi?vi->codec_setup:NULL);
+    backend_lookup_state *b=v->backend_state;
+
+    if(b){
+      if(b->window[0][0][0]){
+       for(i=0;i<VI_WINDOWB;i++)
+         if(b->window[0][0][0][i])free(b->window[0][0][0][i]);
+       free(b->window[0][0][0]);
+       
+       for(j=0;j<2;j++)
+         for(k=0;k<2;k++){
+           for(i=0;i<VI_WINDOWB;i++)
+             if(b->window[1][j][k][i])free(b->window[1][j][k][i]);
+           free(b->window[1][j][k]);
+         }
+      }
 
-    if(v->window[0][0][0]){
-      for(i=0;i<VI_WINDOWB;i++)
-       if(v->window[0][0][0][i])free(v->window[0][0][0][i]);
-      free(v->window[0][0][0]);
-
-      for(j=0;j<2;j++)
-       for(k=0;k<2;k++){
-         for(i=0;i<VI_WINDOWB;i++)
-           if(v->window[1][j][k][i])free(v->window[1][j][k][i]);
-         free(v->window[1][j][k]);
-       }
+      if(b->ve){
+       _ve_envelope_clear(b->ve);
+       free(b->ve);
+      }
+
+      if(b->transform[0]){
+       mdct_clear(b->transform[0][0]);
+       free(b->transform[0][0]);
+       free(b->transform[0]);
+      }
+      if(b->transform[1]){
+       mdct_clear(b->transform[1][0]);
+       free(b->transform[1][0]);
+       free(b->transform[1]);
+      }
+      
     }
     
     if(v->pcm){
@@ -288,42 +315,29 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
       if(v->pcmret)free(v->pcmret);
     }
 
-    if(v->ve){
-      _ve_envelope_clear(v->ve);
-      free(v->ve);
-    }
-
-    if(v->transform[0]){
-      mdct_clear(v->transform[0][0]);
-      free(v->transform[0][0]);
-      free(v->transform[0]);
-    }
-    if(v->transform[1]){
-      mdct_clear(v->transform[1][0]);
-      free(v->transform[1][0]);
-      free(v->transform[1]);
-    }
-
     /* free mode lookups; these are actually vorbis_look_mapping structs */
-    if(vi){
-      for(i=0;i<vi->modes;i++){
-       int mapnum=vi->mode_param[i]->mapping;
-       int maptype=vi->map_type[mapnum];
-       _mapping_P[maptype]->free_look(v->mode[i]);
+    if(ci){
+      for(i=0;i<ci->modes;i++){
+       int mapnum=ci->mode_param[i]->mapping;
+       int maptype=ci->map_type[mapnum];
+       if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
       }
       /* free codebooks */
-      for(i=0;i<vi->books;i++)
-       vorbis_book_clear(v->fullbooks+i);
+      for(i=0;i<ci->books;i++)
+       if(b && b->fullbooks)vorbis_book_clear(b->fullbooks+i);
     }
 
-    if(v->mode)free(v->mode);    
-    if(v->fullbooks)free(v->fullbooks);
-
-    /* free header, header1, header2 */
-    if(v->header)free(v->header);
-    if(v->header1)free(v->header1);
-    if(v->header2)free(v->header2);
-
+    if(b){
+      if(b->mode)free(b->mode);    
+      if(b->fullbooks)free(b->fullbooks);
+      
+      /* free header, header1, header2 */
+      if(b->header)free(b->header);
+      if(b->header1)free(b->header1);
+      if(b->header2)free(b->header2);
+      free(b);
+    }
+    
     memset(v,0,sizeof(vorbis_dsp_state));
   }
 }
@@ -331,11 +345,12 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
 float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
   int i;
   vorbis_info *vi=v->vi;
+  backend_lookup_state *b=v->backend_state;
 
   /* free header, header1, header2 */
-  if(v->header)free(v->header);v->header=NULL;
-  if(v->header1)free(v->header1);v->header1=NULL;
-  if(v->header2)free(v->header2);v->header2=NULL;
+  if(b->header)free(b->header);b->header=NULL;
+  if(b->header1)free(b->header1);b->header1=NULL;
+  if(b->header2)free(b->header2);b->header2=NULL;
 
   /* Do we have enough storage space for the requested buffer? If not,
      expand the PCM (and envelope) storage */
@@ -344,7 +359,7 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
     v->pcm_storage=v->pcm_current+vals*2;
    
     for(i=0;i<vi->channels;i++){
-      v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float));
+      v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(float));
     }
   }
 
@@ -388,6 +403,8 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
 
 int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
   vorbis_info *vi=v->vi;
+  codec_setup_info *ci=vi->codec_setup;
+
   if(vals<=0){
     int order=32;
     int i;
@@ -403,9 +420,9 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
        amplitude off a cliff, creating spread spectrum noise that will
        suck to encode.  Extrapolate for the sake of cleanliness. */
 
-    vorbis_analysis_buffer(v,v->vi->blocksizes[1]*2);
+    vorbis_analysis_buffer(v,ci->blocksizes[1]*2);
     v->eofflag=v->pcm_current;
-    v->pcm_current+=v->vi->blocksizes[1]*2;
+    v->pcm_current+=ci->blocksizes[1]*2;
 
     for(i=0;i<vi->channels;i++){
       if(v->eofflag>order*2){
@@ -414,7 +431,7 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
 
        /* make a predictor filter */
        n=v->eofflag;
-       if(n>v->vi->blocksizes[1])n=v->vi->blocksizes[1];
+       if(n>ci->blocksizes[1])n=ci->blocksizes[1];
        vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
 
        /* run the predictor filter */
@@ -432,14 +449,14 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
   }else{
 
     if(v->pcm_current+vals>v->pcm_storage)
-      return(-1);
+      return(OV_EINVAL);
 
     v->pcm_current+=vals;
 
     /* we may want to reverse extrapolate the beginning of a stream
        too... in case we're beginning on a cliff! */
     /* clumsy, but simple.  It only runs once, so simple is good. */
-    if(!v->preextrapolate && v->pcm_current-v->centerW>v->vi->blocksizes[1])
+    if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1])
       _preextrapolate_helper(v);
 
   }
@@ -451,7 +468,9 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
 int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   int i;
   vorbis_info *vi=v->vi;
-  long beginW=v->centerW-vi->blocksizes[v->W]/2,centerNext;
+  codec_setup_info *ci=vi->codec_setup;
+  backend_lookup_state *b=v->backend_state;
+  long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext;
 
   /* check to see if we're started... */
   if(!v->preextrapolate)return(0);
@@ -463,16 +482,16 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
      the next boundary so we can determine nW (the next window size)
      which lets us compute the shape of the current block's window */
   
-  if(vi->blocksizes[0]<vi->blocksizes[1]){
+  if(ci->blocksizes[0]<ci->blocksizes[1]){
     long largebound;
     long bp;
 
     if(v->W)
       /* min boundary; nW large, next small */
-      largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]/4;
+      largebound=v->centerW+ci->blocksizes[1]*3/4+ci->blocksizes[0]/4;
     else
       /* min boundary; nW large, next small */
-      largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]*3/4;
+      largebound=v->centerW+ci->blocksizes[1]*3/4+ci->blocksizes[0]*3/4;
 
     bp=_ve_envelope_search(v,largebound);
     if(bp==-1)return(0); /* not enough data currently to search for a
@@ -482,12 +501,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   }else
     v->nW=0;
   
-  centerNext=v->centerW+vi->blocksizes[v->W]/4+vi->blocksizes[v->nW]/4;
+  centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4;
 
   {
     /* center of next block + next block maximum right side. */
 
-    long blockbound=centerNext+vi->blocksizes[v->nW]/2;
+    long blockbound=centerNext+ci->blocksizes[v->nW]/2;
     if(v->pcm_current<blockbound)return(0); /* not enough data yet;
                                                although this check is
                                                less strict that the
@@ -513,14 +532,14 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   vb->vd=v;
   vb->sequence=v->sequence;
   vb->granulepos=v->granulepos;
-  vb->pcmend=vi->blocksizes[v->W];
+  vb->pcmend=ci->blocksizes[v->W];
   
   /* copy the vectors; this uses the local storage in vb */
   {
     vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
     for(i=0;i<vi->channels;i++){
       vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
-      memcpy(vb->pcm[i],v->pcm[i]+beginW,vi->blocksizes[v->W]*sizeof(float));
+      memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(float));
     }
   }
   
@@ -538,10 +557,10 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
 
   /* advance storage vectors and clean up */
   {
-    int new_centerNext=vi->blocksizes[1]/2;
+    int new_centerNext=ci->blocksizes[1]/2;
     int movementW=centerNext-new_centerNext;
 
-    _ve_envelope_shift(v->ve,movementW);
+    _ve_envelope_shift(b->ve,movementW);
     v->pcm_current-=movementW;
 
     for(i=0;i<vi->channels;i++)
@@ -573,11 +592,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
 }
 
 int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
+  codec_setup_info *ci=vi->codec_setup;
   _vds_shared_init(v,vi,0);
 
   /* Adjust centerW to allow an easier mechanism for determining output */
   v->pcm_returned=v->centerW;
-  v->centerW-= vi->blocksizes[v->W]/4+vi->blocksizes[v->lW]/4;
+  v->centerW-= ci->blocksizes[v->W]/4+ci->blocksizes[v->lW]/4;
   v->granulepos=-1;
   v->sequence=-1;
 
@@ -590,15 +610,16 @@ int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
 
 int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   vorbis_info *vi=v->vi;
+  codec_setup_info *ci=vi->codec_setup;
 
   /* Shift out any PCM that we returned previously */
   /* centerW is currently the center of the last block added */
-  if(v->pcm_returned  && v->centerW>vi->blocksizes[1]/2){
+  if(v->pcm_returned  && v->centerW>ci->blocksizes[1]/2){
 
     /* don't shift too much; we need to have a minimum PCM buffer of
        1/2 long block */
 
-    int shiftPCM=v->centerW-vi->blocksizes[1]/2;
+    int shiftPCM=v->centerW-ci->blocksizes[1]/2;
     shiftPCM=(v->pcm_returned<shiftPCM?v->pcm_returned:shiftPCM);
 
     v->pcm_current-=shiftPCM;
@@ -628,8 +649,8 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   v->sequence=vb->sequence;
 
   {
-    int sizeW=vi->blocksizes[v->W];
-    int centerW=v->centerW+vi->blocksizes[v->lW]/4+sizeW/4;
+    int sizeW=ci->blocksizes[v->W];
+    int centerW=v->centerW+ci->blocksizes[v->lW]/4+sizeW/4;
     int beginW=centerW-sizeW/2;
     int endW=beginW+sizeW;
     int beginSl;
@@ -639,10 +660,10 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
     /* Do we have enough PCM/mult storage for the block? */
     if(endW>v->pcm_storage){
       /* expand the storage */
-      v->pcm_storage=endW+vi->blocksizes[1];
+      v->pcm_storage=endW+ci->blocksizes[1];
    
       for(i=0;i<vi->channels;i++)
-       v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float)); 
+       v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(float)); 
     }
 
     /* overlap/add PCM */
@@ -650,11 +671,11 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
     switch(v->W){
     case 0:
       beginSl=0;
-      endSl=vi->blocksizes[0]/2;
+      endSl=ci->blocksizes[0]/2;
       break;
     case 1:
-      beginSl=vi->blocksizes[1]/4-vi->blocksizes[v->lW]/4;
-      endSl=beginSl+vi->blocksizes[v->lW]/2;
+      beginSl=ci->blocksizes[1]/4-ci->blocksizes[v->lW]/4;
+      endSl=beginSl+ci->blocksizes[v->lW]/2;
       break;
     }
 
@@ -682,15 +703,30 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
        it reads the last two marked pages in proper sequence */
 
     if(v->granulepos==-1)
-      v->granulepos=vb->granulepos;
+      if(vb->granulepos==-1){
+       v->granulepos=0;
+      }else{
+       v->granulepos=vb->granulepos;
+      }
     else{
       v->granulepos+=(centerW-v->centerW);
       if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
-       if(v->granulepos>vb->granulepos && vb->eofflag){
-         /* partial last frame.  Strip the padding off */
-         centerW-=(v->granulepos-vb->granulepos);
+
+       if(v->granulepos>vb->granulepos){
+         long extra=v->granulepos-vb->granulepos;
+
+         if(vb->eofflag){
+           /* partial last frame.  Strip the extra samples off */
+           centerW-=extra;
+         }else if(vb->sequence == 1){
+           /* partial first frame.  Discard extra leading samples */
+           v->pcm_returned+=extra;
+           if(v->pcm_returned>centerW)v->pcm_returned=centerW;
+           
+         }
+         
        }/* else{ Shouldn't happen *unless* the bitstream is out of
-            spec.  Either way, believe the bitstream } */
+           spec.  Either way, believe the bitstream } */
        v->granulepos=vb->granulepos;
       }
     }
@@ -722,7 +758,7 @@ int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){
 }
 
 int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
-  if(bytes && v->pcm_returned+bytes>v->centerW)return(-1);
+  if(bytes && v->pcm_returned+bytes>v->centerW)return(OV_EINVAL);
   v->pcm_returned+=bytes;
   return(0);
 }
diff --git a/lib/bookinternal.h b/lib/bookinternal.h
deleted file mode 100644 (file)
index 532838b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
- *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
- * http://www.xiph.org/                                             *
- *                                                                  *
- ********************************************************************
-
- function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: bookinternal.h,v 1.9 2000/10/12 03:12:52 xiphmont Exp $
-
- ********************************************************************/
-
-#ifndef _V_INT_CODEBOOK_H_
-#define _V_INT_CODEBOOK_H_
-
-#include <ogg/ogg.h>
-#include "vorbis/codebook.h"
-
-extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
-extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
-
-extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
-extern int vorbis_book_errorv(codebook *book, float *a);
-extern int vorbis_book_encodev(codebook *book, int best,float *a, 
-                              oggpack_buffer *b);
-extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b,
-                               int step,int stagetype);
-
-extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
-extern long vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b,
-                                int step,int stagetype);
-extern long s_vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b,
-                                  int step,int stagetype);
-
-#endif
diff --git a/lib/books/.cvsignore b/lib/books/.cvsignore
new file mode 100644 (file)
index 0000000..282522d
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/lib/books/Makefile.am b/lib/books/Makefile.am
new file mode 100644 (file)
index 0000000..240956a
--- /dev/null
@@ -0,0 +1,27 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+EXTRA_DIST = lsp12_0.vqh lsp30_0.vqh res0_1024a_128_1.vqh res0_1024a_128_2.vqh\
+       res0_1024a_128_3.vqh res0_1024a_128_4.vqh res0_1024a_128_5.vqh\
+       res0_1024a_128_6.vqh res0_1024a_128_7.vqh res0_1024a_128_8.vqh\
+       res0_1024a_128_9.vqh res0_1024a_160_1.vqh res0_1024a_160_2.vqh\
+       res0_1024a_160_3.vqh res0_1024a_160_4.vqh res0_1024a_160_5.vqh\
+       res0_1024a_160_6.vqh res0_1024a_160_7.vqh res0_1024a_160_8.vqh\
+       res0_1024a_160_9.vqh res0_1024a_192_1.vqh res0_1024a_192_2.vqh\
+       res0_1024a_192_3.vqh res0_1024a_192_4.vqh res0_1024a_192_5.vqh\
+       res0_1024a_256_1.vqh res0_1024a_256_2.vqh res0_1024a_256_3.vqh\
+       res0_1024a_256_4.vqh res0_1024a_256_5.vqh res0_1024a_350_1.vqh\
+       res0_1024a_350_2.vqh res0_1024a_350_3.vqh res0_1024a_350_4.vqh\
+       res0_1024a_350_5.vqh res0_128a_128_1.vqh res0_128a_128_2.vqh\
+       res0_128a_128_3.vqh res0_128a_128_4.vqh res0_128a_128_5.vqh\
+       res0_128a_160_1.vqh res0_128a_160_2.vqh res0_128a_160_3.vqh\
+       res0_128a_160_4.vqh res0_128a_160_5.vqh res0_128a_192_1.vqh \
+       res0_128a_192_2.vqh res0_128a_192_3.vqh res0_128a_192_4.vqh\
+       res0_128a_192_5.vqh res0_128a_256_1.vqh res0_128a_256_2.vqh\
+       res0_128a_256_3.vqh res0_128a_256_4.vqh res0_128a_256_5.vqh\
+       res0_128a_350_1.vqh res0_128a_350_2.vqh res0_128a_350_3.vqh\
+       res0_128a_350_4.vqh res0_128a_350_5.vqh resaux0_1024a_128.vqh\
+       resaux0_1024a_160.vqh resaux0_1024a_192.vqh resaux0_1024a_256.vqh\
+       resaux0_1024a_350.vqh resaux0_128a_128.vqh resaux0_128a_160.vqh\
+       resaux0_128a_192.vqh resaux0_128a_256.vqh resaux0_128a_350.vqh
similarity index 99%
rename from include/vorbis/book/lsp12_0.vqh
rename to lib/books/lsp12_0.vqh
index b0a0a27..96ba7e7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_lsp12_0_VQH_
 #define _V_lsp12_0_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_lsp12_0[] = {
        0,
similarity index 99%
rename from include/vorbis/book/lsp30_0.vqh
rename to lib/books/lsp30_0.vqh
index b9e95e4..5041fdc 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_lsp30_0_VQH_
 #define _V_lsp30_0_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_lsp30_0[] = {
        0,
similarity index 81%
rename from include/vorbis/book/res0_1024a_128_1.vqh
rename to lib/books/res0_1024a_128_1.vqh
index 5c5929f..c066d4b 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_1_VQH_
 #define _V_res0_1024a_128_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_1[] = {
        1,
similarity index 81%
rename from include/vorbis/book/res0_1024a_128_2.vqh
rename to lib/books/res0_1024a_128_2.vqh
index fce8c60..3b62cad 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_2_VQH_
 #define _V_res0_1024a_128_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_2[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_1024a_128_3.vqh
rename to lib/books/res0_1024a_128_3.vqh
index 87d9ef8..715b9db 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_3_VQH_
 #define _V_res0_1024a_128_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_3[] = {
        2,
similarity index 90%
rename from include/vorbis/book/res0_1024a_128_4.vqh
rename to lib/books/res0_1024a_128_4.vqh
index e4b49a5..e70b23b 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_4_VQH_
 #define _V_res0_1024a_128_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_4[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_1024a_128_5.vqh
rename to lib/books/res0_1024a_128_5.vqh
index 61a9f6e..458d4d1 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_5_VQH_
 #define _V_res0_1024a_128_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_5[] = {
        3,
similarity index 96%
rename from include/vorbis/book/res0_1024a_128_6.vqh
rename to lib/books/res0_1024a_128_6.vqh
index 28fc527..0f32f6d 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_6_VQH_
 #define _V_res0_1024a_128_6_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_6[] = {
        3,
similarity index 83%
rename from include/vorbis/book/res0_1024a_128_7.vqh
rename to lib/books/res0_1024a_128_7.vqh
index caf231a..4ddab5a 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_7_VQH_
 #define _V_res0_1024a_128_7_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_7[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_1024a_128_8.vqh
rename to lib/books/res0_1024a_128_8.vqh
index cf1f680..17742c7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_8_VQH_
 #define _V_res0_1024a_128_8_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_8[] = {
        11,
similarity index 90%
rename from include/vorbis/book/res0_1024a_128_9.vqh
rename to lib/books/res0_1024a_128_9.vqh
index f3a3de9..0f10102 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_128_9_VQH_
 #define _V_res0_1024a_128_9_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_128_9[] = {
        45,
similarity index 81%
rename from include/vorbis/book/res0_1024a_160_1.vqh
rename to lib/books/res0_1024a_160_1.vqh
index 2523190..42e5f4d 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_1_VQH_
 #define _V_res0_1024a_160_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_1[] = {
        1,
similarity index 81%
rename from include/vorbis/book/res0_1024a_160_2.vqh
rename to lib/books/res0_1024a_160_2.vqh
index 52d70eb..68d6ec9 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_2_VQH_
 #define _V_res0_1024a_160_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_2[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_1024a_160_3.vqh
rename to lib/books/res0_1024a_160_3.vqh
index 33f699e..2217fbf 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_3_VQH_
 #define _V_res0_1024a_160_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_3[] = {
        2,
similarity index 90%
rename from include/vorbis/book/res0_1024a_160_4.vqh
rename to lib/books/res0_1024a_160_4.vqh
index fd61655..5819b38 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_4_VQH_
 #define _V_res0_1024a_160_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_4[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_1024a_160_5.vqh
rename to lib/books/res0_1024a_160_5.vqh
index 0915c2c..cfaab4c 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_5_VQH_
 #define _V_res0_1024a_160_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_5[] = {
        3,
similarity index 96%
rename from include/vorbis/book/res0_1024a_160_6.vqh
rename to lib/books/res0_1024a_160_6.vqh
index 353d6ce..8aa9aec 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_6_VQH_
 #define _V_res0_1024a_160_6_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_6[] = {
        3,
similarity index 83%
rename from include/vorbis/book/res0_1024a_160_7.vqh
rename to lib/books/res0_1024a_160_7.vqh
index 70d1352..b538acc 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_7_VQH_
 #define _V_res0_1024a_160_7_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_7[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_1024a_160_8.vqh
rename to lib/books/res0_1024a_160_8.vqh
index afa7787..d29e52f 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_8_VQH_
 #define _V_res0_1024a_160_8_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_8[] = {
        11,
similarity index 90%
rename from include/vorbis/book/res0_1024a_160_9.vqh
rename to lib/books/res0_1024a_160_9.vqh
index eb5eb1b..920f59b 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_160_9_VQH_
 #define _V_res0_1024a_160_9_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_160_9[] = {
        45,
similarity index 81%
rename from include/vorbis/book/res0_1024a_192_1.vqh
rename to lib/books/res0_1024a_192_1.vqh
index 1d9916d..8e38d98 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_192_1_VQH_
 #define _V_res0_1024a_192_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_192_1[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_1024a_192_2.vqh
rename to lib/books/res0_1024a_192_2.vqh
index f192b65..e8723e8 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_192_2_VQH_
 #define _V_res0_1024a_192_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_192_2[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_1024a_192_3.vqh
rename to lib/books/res0_1024a_192_3.vqh
index b851487..107e88c 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_192_3_VQH_
 #define _V_res0_1024a_192_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_192_3[] = {
        3,
similarity index 82%
rename from include/vorbis/book/res0_1024a_192_4.vqh
rename to lib/books/res0_1024a_192_4.vqh
index 04b81ea..b153a08 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_192_4_VQH_
 #define _V_res0_1024a_192_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_192_4[] = {
        4,
similarity index 90%
rename from include/vorbis/book/res0_1024a_192_5.vqh
rename to lib/books/res0_1024a_192_5.vqh
index 1dd6d39..9d34cba 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_192_5_VQH_
 #define _V_res0_1024a_192_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_192_5[] = {
        45,
similarity index 90%
rename from include/vorbis/book/res0_1024a_256_1.vqh
rename to lib/books/res0_1024a_256_1.vqh
index dc6a3f4..c13527d 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_256_1_VQH_
 #define _V_res0_1024a_256_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_256_1[] = {
        2,
similarity index 83%
rename from include/vorbis/book/res0_1024a_256_2.vqh
rename to lib/books/res0_1024a_256_2.vqh
index 64627b5..c048293 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_256_2_VQH_
 #define _V_res0_1024a_256_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_256_2[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_1024a_256_3.vqh
rename to lib/books/res0_1024a_256_3.vqh
index e88c9c8..a356552 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_256_3_VQH_
 #define _V_res0_1024a_256_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_256_3[] = {
        11,
similarity index 88%
rename from include/vorbis/book/res0_1024a_256_4.vqh
rename to lib/books/res0_1024a_256_4.vqh
index 89e2a79..541f3af 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_256_4_VQH_
 #define _V_res0_1024a_256_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_256_4[] = {
        23,
similarity index 91%
rename from include/vorbis/book/res0_1024a_256_5.vqh
rename to lib/books/res0_1024a_256_5.vqh
index 19e00ae..18abe4b 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_256_5_VQH_
 #define _V_res0_1024a_256_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_256_5[] = {
        88,
similarity index 90%
rename from include/vorbis/book/res0_1024a_350_1.vqh
rename to lib/books/res0_1024a_350_1.vqh
index d9e36dc..664fcd5 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_350_1_VQH_
 #define _V_res0_1024a_350_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_350_1[] = {
        2,
similarity index 83%
rename from include/vorbis/book/res0_1024a_350_2.vqh
rename to lib/books/res0_1024a_350_2.vqh
index 9e8990f..cd7408a 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_350_2_VQH_
 #define _V_res0_1024a_350_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_350_2[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_1024a_350_3.vqh
rename to lib/books/res0_1024a_350_3.vqh
index d7790b0..23487f0 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_350_3_VQH_
 #define _V_res0_1024a_350_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_350_3[] = {
        11,
similarity index 88%
rename from include/vorbis/book/res0_1024a_350_4.vqh
rename to lib/books/res0_1024a_350_4.vqh
index 292d7b5..d63d642 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_350_4_VQH_
 #define _V_res0_1024a_350_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_350_4[] = {
        23,
similarity index 91%
rename from include/vorbis/book/res0_1024a_350_5.vqh
rename to lib/books/res0_1024a_350_5.vqh
index bdc68bf..e8d5361 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_1024a_350_5_VQH_
 #define _V_res0_1024a_350_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_1024a_350_5[] = {
        88,
similarity index 81%
rename from include/vorbis/book/res0_128a_128_1.vqh
rename to lib/books/res0_128a_128_1.vqh
index ca49a37..fb3f878 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_128_1_VQH_
 #define _V_res0_128a_128_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_128_1[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_128a_128_2.vqh
rename to lib/books/res0_128a_128_2.vqh
index 81da615..54170e1 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_128_2_VQH_
 #define _V_res0_128a_128_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_128_2[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_128a_128_3.vqh
rename to lib/books/res0_128a_128_3.vqh
index 3dcc010..82c4006 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_128_3_VQH_
 #define _V_res0_128a_128_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_128_3[] = {
        3,
similarity index 82%
rename from include/vorbis/book/res0_128a_128_4.vqh
rename to lib/books/res0_128a_128_4.vqh
index 23ec180..b23ce56 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_128_4_VQH_
 #define _V_res0_128a_128_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_128_4[] = {
        4,
similarity index 90%
rename from include/vorbis/book/res0_128a_128_5.vqh
rename to lib/books/res0_128a_128_5.vqh
index 36a69ac..b9e49b6 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_128_5_VQH_
 #define _V_res0_128a_128_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_128_5[] = {
        45,
similarity index 81%
rename from include/vorbis/book/res0_128a_160_1.vqh
rename to lib/books/res0_128a_160_1.vqh
index 5393e8b..6213bf8 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_160_1_VQH_
 #define _V_res0_128a_160_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_160_1[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_128a_160_2.vqh
rename to lib/books/res0_128a_160_2.vqh
index f62117b..ef65b04 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_160_2_VQH_
 #define _V_res0_128a_160_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_160_2[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_128a_160_3.vqh
rename to lib/books/res0_128a_160_3.vqh
index 7e9a27b..ff02fac 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_160_3_VQH_
 #define _V_res0_128a_160_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_160_3[] = {
        3,
similarity index 82%
rename from include/vorbis/book/res0_128a_160_4.vqh
rename to lib/books/res0_128a_160_4.vqh
index 1e33866..82b81e7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_160_4_VQH_
 #define _V_res0_128a_160_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_160_4[] = {
        4,
similarity index 90%
rename from include/vorbis/book/res0_128a_160_5.vqh
rename to lib/books/res0_128a_160_5.vqh
index e5c7ffd..d8a577f 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_160_5_VQH_
 #define _V_res0_128a_160_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_160_5[] = {
        45,
similarity index 81%
rename from include/vorbis/book/res0_128a_192_1.vqh
rename to lib/books/res0_128a_192_1.vqh
index 7b7718c..8089ce7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_192_1_VQH_
 #define _V_res0_128a_192_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_192_1[] = {
        1,
similarity index 90%
rename from include/vorbis/book/res0_128a_192_2.vqh
rename to lib/books/res0_128a_192_2.vqh
index ca3f962..6eaf2c7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_192_2_VQH_
 #define _V_res0_128a_192_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_192_2[] = {
        2,
similarity index 96%
rename from include/vorbis/book/res0_128a_192_3.vqh
rename to lib/books/res0_128a_192_3.vqh
index def392f..83a8537 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_192_3_VQH_
 #define _V_res0_128a_192_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_192_3[] = {
        3,
similarity index 82%
rename from include/vorbis/book/res0_128a_192_4.vqh
rename to lib/books/res0_128a_192_4.vqh
index f0b1e54..367e673 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_192_4_VQH_
 #define _V_res0_128a_192_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_192_4[] = {
        4,
similarity index 90%
rename from include/vorbis/book/res0_128a_192_5.vqh
rename to lib/books/res0_128a_192_5.vqh
index 058c9fd..5654c1e 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_192_5_VQH_
 #define _V_res0_128a_192_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_192_5[] = {
        45,
similarity index 90%
rename from include/vorbis/book/res0_128a_256_1.vqh
rename to lib/books/res0_128a_256_1.vqh
index c3093e9..87106e7 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_256_1_VQH_
 #define _V_res0_128a_256_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_256_1[] = {
        2,
similarity index 83%
rename from include/vorbis/book/res0_128a_256_2.vqh
rename to lib/books/res0_128a_256_2.vqh
index c0003e0..559e841 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_256_2_VQH_
 #define _V_res0_128a_256_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_256_2[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_128a_256_3.vqh
rename to lib/books/res0_128a_256_3.vqh
index 69ddeda..7bb5d10 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_256_3_VQH_
 #define _V_res0_128a_256_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_256_3[] = {
        11,
similarity index 88%
rename from include/vorbis/book/res0_128a_256_4.vqh
rename to lib/books/res0_128a_256_4.vqh
index f68f49a..b3fe0e8 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_256_4_VQH_
 #define _V_res0_128a_256_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_256_4[] = {
        23,
similarity index 91%
rename from include/vorbis/book/res0_128a_256_5.vqh
rename to lib/books/res0_128a_256_5.vqh
index 354835a..8bb456d 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_256_5_VQH_
 #define _V_res0_128a_256_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_256_5[] = {
        88,
similarity index 90%
rename from include/vorbis/book/res0_128a_350_1.vqh
rename to lib/books/res0_128a_350_1.vqh
index b3332ef..249c9b0 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_350_1_VQH_
 #define _V_res0_128a_350_1_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_350_1[] = {
        2,
similarity index 83%
rename from include/vorbis/book/res0_128a_350_2.vqh
rename to lib/books/res0_128a_350_2.vqh
index 5ed1753..f1a9180 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_350_2_VQH_
 #define _V_res0_128a_350_2_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_350_2[] = {
        6,
similarity index 86%
rename from include/vorbis/book/res0_128a_350_3.vqh
rename to lib/books/res0_128a_350_3.vqh
index 38d6402..788866f 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_350_3_VQH_
 #define _V_res0_128a_350_3_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_350_3[] = {
        11,
similarity index 88%
rename from include/vorbis/book/res0_128a_350_4.vqh
rename to lib/books/res0_128a_350_4.vqh
index 72215cd..b8bfefb 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_350_4_VQH_
 #define _V_res0_128a_350_4_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_350_4[] = {
        23,
similarity index 91%
rename from include/vorbis/book/res0_128a_350_5.vqh
rename to lib/books/res0_128a_350_5.vqh
index c8c5dff..1ad0fe6 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_res0_128a_350_5_VQH_
 #define _V_res0_128a_350_5_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _vq_quantlist_res0_128a_350_5[] = {
        88,
similarity index 77%
rename from include/vorbis/book/resaux0_1024a_128.vqh
rename to lib/books/resaux0_1024a_128.vqh
index d458b84..109ab62 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_1024a_128_VQH_
 #define _V_resaux0_1024a_128_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_1024a_128[] = {
         2, 6,12,10,14,11,18,11,13,15, 5, 3, 5, 6, 8, 8,
similarity index 77%
rename from include/vorbis/book/resaux0_1024a_160.vqh
rename to lib/books/resaux0_1024a_160.vqh
index 9764826..fa4232f 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_1024a_160_VQH_
 #define _V_resaux0_1024a_160_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_1024a_160[] = {
         2, 6,13,11,15,11,16,11,13,15, 5, 4, 7, 7, 9, 9,
similarity index 74%
rename from include/vorbis/book/resaux0_1024a_192.vqh
rename to lib/books/resaux0_1024a_192.vqh
index f6e0e58..73e0d07 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_1024a_192_VQH_
 #define _V_resaux0_1024a_192_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_1024a_192[] = {
         2, 6,11,11,11,11, 5, 3, 6, 8, 9, 9, 9, 5, 4, 5,
similarity index 93%
rename from include/vorbis/book/resaux0_1024a_256.vqh
rename to lib/books/resaux0_1024a_256.vqh
index cffc25c..a8d1c17 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_1024a_256_VQH_
 #define _V_resaux0_1024a_256_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_1024a_256[] = {
         3, 9,12,12,13,16, 9, 9,13,14,16,17,11,15,17,18,
similarity index 93%
rename from include/vorbis/book/resaux0_1024a_350.vqh
rename to lib/books/resaux0_1024a_350.vqh
index ead2c9d..2b9bf77 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_1024a_350_VQH_
 #define _V_resaux0_1024a_350_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_1024a_350[] = {
         6,17,20,20,19,17,18,16,18,19,19,19,16,16,19,19,
similarity index 93%
rename from include/vorbis/book/resaux0_128a_128.vqh
rename to lib/books/resaux0_128a_128.vqh
index 12651bf..d7b4f3a 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_128a_128_VQH_
 #define _V_resaux0_128a_128_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_128a_128[] = {
         6,15,15,14,14,14,14,14,14,14,14,14,14,14,14,14,
similarity index 93%
rename from include/vorbis/book/resaux0_128a_160.vqh
rename to lib/books/resaux0_128a_160.vqh
index 9d56061..dd7b47f 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_128a_160_VQH_
 #define _V_resaux0_128a_160_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_128a_160[] = {
         6,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
similarity index 93%
rename from include/vorbis/book/resaux0_128a_192.vqh
rename to lib/books/resaux0_128a_192.vqh
index d06722e..de2a30e 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_128a_192_VQH_
 #define _V_resaux0_128a_192_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_128a_192[] = {
         7,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
similarity index 93%
rename from include/vorbis/book/resaux0_128a_256.vqh
rename to lib/books/resaux0_128a_256.vqh
index 4acc2d4..ab01975 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_128a_256_VQH_
 #define _V_resaux0_128a_256_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_128a_256[] = {
         6,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
similarity index 93%
rename from include/vorbis/book/resaux0_128a_350.vqh
rename to lib/books/resaux0_128a_350.vqh
index 06cb1d7..290bf9d 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999             *
- * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company       *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
@@ -17,7 +17,7 @@
 
 #ifndef _V_resaux0_128a_350_VQH_
 #define _V_resaux0_128a_350_VQH_
-#include "vorbis/codebook.h"
+#include "codebook.h"
 
 static long _huff_lengthlist_resaux0_128a_350[] = {
         7,16,16,15,15,15,15,15,15,15,15,15,15,15,15,15,
index 3e0bea6..2f69abd 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.18 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.19 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/codebook.h"
+#include "codebook.h"
 #include "scales.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
 #include "misc.h"
 #include "os.h"
 
@@ -150,6 +148,7 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
 int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   long i,j;
   memset(s,0,sizeof(static_codebook));
+  s->allocedp=1;
 
   /* make sure alignment is correct */
   if(oggpack_read(opb,24)!=0x564342)goto _eofout;
@@ -163,7 +162,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   switch(oggpack_read(opb,1)){
   case 0:
     /* unordered */
-    s->lengthlist=malloc(sizeof(long)*s->entries);
+    s->lengthlist=_ogg_malloc(sizeof(long)*s->entries);
 
     /* allocated but unused entries? */
     if(oggpack_read(opb,1)){
@@ -191,7 +190,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
     /* ordered */
     {
       long length=oggpack_read(opb,5)+1;
-      s->lengthlist=malloc(sizeof(long)*s->entries);
+      s->lengthlist=_ogg_malloc(sizeof(long)*s->entries);
 
       for(i=0;i<s->entries;){
        long num=oggpack_read(opb,_ilog(s->entries-i));
@@ -233,7 +232,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
       }
       
       /* quantized values */
-      s->quantlist=malloc(sizeof(float)*quantvals);
+      s->quantlist=_ogg_malloc(sizeof(float)*quantvals);
       for(i=0;i<quantvals;i++)
        s->quantlist[i]=oggpack_read(opb,s->q_quant);
       
@@ -388,7 +387,7 @@ long vorbis_book_decodevs(codebook *book,float *a,oggpack_buffer *b,
 long s_vorbis_book_decodevs(codebook *book,float *a,oggpack_buffer *b,
                          int step,int addmul){
   long *entry = alloca(sizeof(long)*step);
-  float **t = alloca(sizeof(float)*step);
+  float **t = alloca(sizeof(float *)*step);
   int i,j,o;
 
   for (i = 0; i < step; i++) {
similarity index 63%
rename from include/vorbis/codebook.h
rename to lib/codebook.h
index cb23f70..686d901 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
- function: codebook types
- last mod: $Id: codebook.h,v 1.7 2000/10/12 03:12:41 xiphmont Exp $
+ function: basic shared codebook operations
+ last mod: $Id: codebook.h,v 1.2 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
@@ -56,6 +56,8 @@ typedef struct static_codebook{
   struct encode_aux_nearestmatch *nearest_tree;
   struct encode_aux_threshmatch  *thresh_tree;
   struct encode_aux_pigeonhole  *pigeon_tree;
+
+  int allocedp;
 } static_codebook;
 
 /* this structures an arbitrary trained book to quickly find the
@@ -114,9 +116,42 @@ typedef struct codebook{
 
 } codebook;
 
-#endif
+extern void vorbis_staticbook_clear(static_codebook *b);
+extern void vorbis_staticbook_destroy(static_codebook *b);
+extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
+extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
+extern void vorbis_book_clear(codebook *b);
+
+extern float *_book_unquantize(const static_codebook *b);
+extern float *_book_logdist(const static_codebook *b,float *vals);
+extern float _float32_unpack(long val);
+extern long   _float32_pack(float val);
+extern int  _best(codebook *book, float *a, int step);
+extern int _ilog(unsigned int v);
+extern long _book_maptype1_quantvals(const static_codebook *b);
+
+extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
+extern long vorbis_book_codeword(codebook *book,int entry);
+extern long vorbis_book_codelen(codebook *book,int entry);
 
 
 
+extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
+extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
 
+extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
+extern int vorbis_book_errorv(codebook *book, float *a);
+extern int vorbis_book_encodev(codebook *book, int best,float *a, 
+                              oggpack_buffer *b);
+extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b,
+                               int step,int stagetype);
 
+extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
+extern long vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b,
+                                int step,int stagetype);
+extern long s_vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b,
+                                  int step,int stagetype);
+
+
+
+#endif
diff --git a/lib/codec_internal.h b/lib/codec_internal.h
new file mode 100644 (file)
index 0000000..3787f2c
--- /dev/null
@@ -0,0 +1,112 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
+ * http://www.xiph.org/                                             *
+ *                                                                  *
+ ********************************************************************
+
+ function: libvorbis codec headers
+ last mod: $Id: codec_internal.h,v 1.2 2000/11/06 00:07:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_CODECI_H_
+#define _V_CODECI_H_
+
+#include "envelope.h"
+#include "codebook.h"
+#include "psy.h"
+
+typedef void vorbis_look_time;
+typedef void vorbis_look_mapping;
+typedef void vorbis_look_floor;
+typedef void vorbis_look_residue;
+typedef void vorbis_look_transform;
+
+typedef struct backend_lookup_state {
+  /* local lookup storage */
+  envelope_lookup        *ve; /* envelope lookup */    
+  float                 **window[2][2][2]; /* block, leadin, leadout, type */
+  vorbis_look_transform **transform[2];    /* block, type */
+  codebook               *fullbooks;
+
+  /* backend lookups are tied to the mode, not the backend or naked mapping */
+  int                     modebits;
+  vorbis_look_mapping   **mode;
+
+  /* local storage, only used on the encoding side.  This way the
+     application does not need to worry about freeing some packets'
+     memory and not others'; packet storage is always tracked.
+     Cleared next call to a _dsp_ function */
+  unsigned char *header;
+  unsigned char *header1;
+  unsigned char *header2;
+
+} backend_lookup_state;
+
+/* mode ************************************************************/
+typedef struct {
+  int blockflag;
+  int windowtype;
+  int transformtype;
+  int mapping;
+} vorbis_info_mode;
+
+typedef void vorbis_info_time;
+typedef void vorbis_info_floor;
+typedef void vorbis_info_residue;
+typedef void vorbis_info_mapping;
+
+/* vorbis_info contains all the setup information specific to the
+   specific compression/decompression mode in progress (eg,
+   psychoacoustic settings, channel setup, options, codebook
+   etc).  
+*********************************************************************/
+
+typedef struct codec_setup_info {
+
+  /* Vorbis supports only short and long blocks, but allows the
+     encoder to choose the sizes */
+
+  long blocksizes[2];
+
+  /* modes are the primary means of supporting on-the-fly different
+     blocksizes, different channel mappings (LR or mid-side),
+     different residue backends, etc.  Each mode consists of a
+     blocksize flag and a mapping (along with the mapping setup */
+
+  int        modes;
+  int        maps;
+  int        times;
+  int        floors;
+  int        residues;
+  int        books;
+  int        psys;     /* encode only */
+
+  vorbis_info_mode    *mode_param[64];
+  int                  map_type[64];
+  vorbis_info_mapping *map_param[64];
+  int                  time_type[64];
+  vorbis_info_time    *time_param[64];
+  int                  floor_type[64];
+  vorbis_info_floor   *floor_param[64];
+  int                  residue_type[64];
+  vorbis_info_residue *residue_param[64];
+  static_codebook     *book_param[256];
+  vorbis_info_psy     *psy_param[64]; /* encode only */
+  
+  /* for block long/sort tuning; encode only */
+  int        envelopesa;
+  float     preecho_thresh;
+  float     preecho_clamp;
+  float     preecho_minenergy;
+
+} codec_setup_info;
+
+#endif
index dec162c..82b23b9 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.23 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.24 2000/11/06 00:07:00 xiphmont Exp $
 
  Preecho calculation.
 
@@ -24,6 +24,7 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 
 #include "os.h"
 #include "scales.h"
@@ -72,23 +73,24 @@ static float cheb_highpass_A[]={
   2.3920318913};
 
 void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
+  codec_setup_info *ci=vi->codec_setup;
   int ch=vi->channels;
-  int window=vi->envelopesa;
+  int window=ci->envelopesa;
   int i;
   e->winlength=window;
-  e->minenergy=fromdB(vi->preecho_minenergy);
-  e->iir=calloc(ch,sizeof(IIR_state));
-  e->filtered=calloc(ch,sizeof(float *));
+  e->minenergy=fromdB(ci->preecho_minenergy);
+  e->iir=_ogg_calloc(ch,sizeof(IIR_state));
+  e->filtered=_ogg_calloc(ch,sizeof(float *));
   e->ch=ch;
   e->storage=128;
   for(i=0;i<ch;i++){
     IIR_init(e->iir+i,cheb_highpass_stages,cheb_highpass_gain,
             cheb_highpass_A,cheb_highpass_B);
-    e->filtered[i]=calloc(e->storage,sizeof(float));
+    e->filtered[i]=_ogg_calloc(e->storage,sizeof(float));
   }
 
   drft_init(&e->drft,window);
-  e->window=malloc(e->winlength*sizeof(float));
+  e->window=_ogg_malloc(e->winlength*sizeof(float));
   /* We just use a straight sin(x) window for this */
   for(i=0;i<e->winlength;i++)
     e->window[i]=sin((i+.5)/e->winlength*M_PI);
@@ -156,14 +158,15 @@ static float _ve_deltai(envelope_lookup *ve,IIR_state *iir,
 
 long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
   vorbis_info *vi=v->vi;
-  envelope_lookup *ve=v->ve;
+  codec_setup_info *ci=vi->codec_setup;
+  envelope_lookup *ve=((backend_lookup_state *)(v->backend_state))->ve;
   long i,j;
   
   /* make sure we have enough storage to match the PCM */
   if(v->pcm_storage>ve->storage){
     ve->storage=v->pcm_storage;
     for(i=0;i<ve->ch;i++)
-      ve->filtered[i]=realloc(ve->filtered[i],ve->storage*sizeof(float));
+      ve->filtered[i]=_ogg_realloc(ve->filtered[i],ve->storage*sizeof(float));
   }
 
   /* catch up the highpass to match the pcm */
@@ -171,6 +174,7 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
     float *filtered=ve->filtered[i];
     float *pcm=v->pcm[i];
     IIR_state *iir=ve->iir+i;
+    IIR_clamp(iir,9e-15);
     
     for(j=ve->current;j<v->pcm_current;j++)
       filtered[j]=IIR_filter(iir,pcm[j]);
@@ -180,7 +184,7 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
   /* Now search through our cached highpass data for breaking points */
   /* starting point */
   if(v->W)
-    j=v->centerW+vi->blocksizes[1]/4-vi->blocksizes[0]/4;
+    j=v->centerW+ci->blocksizes[1]/4-ci->blocksizes[0]/4;
   else
     j=v->centerW;
 
@@ -190,14 +194,14 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
       IIR_state *iir=ve->iir+i;
       float m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered);
       
-      if(m>vi->preecho_thresh){
+      if(m>ci->preecho_thresh){
        /*granulepos++;*/
        return(0);
       }
       /*granulepos++;*/
     }
     
-    j+=vi->blocksizes[0]/2;
+    j+=ci->blocksizes[0]/2;
     if(j>=searchpoint)return(1);
   }
   
index 1f214e9..e19910f 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.h,v 1.10 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: envelope.h,v 1.11 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
index bfcee0f..00e884d 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.25 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.26 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "lpc.h"
 #include "lsp.h"
-#include "bookinternal.h"
-#include "sharedbook.h"
+#include "codebook.h"
 #include "scales.h"
 #include "misc.h"
 #include "os.h"
@@ -70,6 +70,13 @@ static long _f0_fit(codebook *book,
 
 /***********************************************/
 
+static vorbis_info_floor *floor0_copy_info (vorbis_info_floor *i){
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  vorbis_info_floor0 *ret=_ogg_malloc(sizeof(vorbis_info_floor0));
+  memcpy(ret,info,sizeof(vorbis_info_floor0));
+  return(ret);
+}
+
 static void floor0_free_info(vorbis_info_floor *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_floor0));
@@ -102,8 +109,10 @@ static void floor0_pack (vorbis_info_floor *i,oggpack_buffer *opb){
 }
 
 static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
   int j;
-  vorbis_info_floor0 *info=malloc(sizeof(vorbis_info_floor0));
+
+  vorbis_info_floor0 *info=_ogg_malloc(sizeof(vorbis_info_floor0));
   info->order=oggpack_read(opb,8);
   info->rate=oggpack_read(opb,16);
   info->barkmap=oggpack_read(opb,16);
@@ -115,12 +124,13 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
   if(info->rate<1)goto err_out;
   if(info->barkmap<1)goto err_out;
   if(info->numbooks<1)goto err_out;
-
+    
   for(j=0;j<info->numbooks;j++){
     info->books[j]=oggpack_read(opb,8);
-    if(info->books[j]<0 || info->books[j]>=vi->books)goto err_out;
+    if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
   }
-  return(info);  
+  return(info);
+
  err_out:
   floor0_free_info(info);
   return(NULL);
@@ -139,10 +149,11 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
   int j;
   float scale;
   vorbis_info        *vi=vd->vi;
+  codec_setup_info   *ci=vi->codec_setup;
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  vorbis_look_floor0 *look=calloc(1,sizeof(vorbis_look_floor0));
+  vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(vorbis_look_floor0));
   look->m=info->order;
-  look->n=vi->blocksizes[mi->blockflag]/2;
+  look->n=ci->blocksizes[mi->blockflag]/2;
   look->ln=info->barkmap;
   look->vi=info;
 
@@ -160,7 +171,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
      the encoder may do what it wishes in filling them.  They're
      necessary in some mapping combinations to keep the scale spacing
      accurate */
-  look->linearmap=malloc((look->n+1)*sizeof(int));
+  look->linearmap=_ogg_malloc((look->n+1)*sizeof(int));
   for(j=0;j<look->n;j++){
     int val=floor( toBARK((info->rate/2.)/look->n*j) 
                   *scale); /* bark numbers represent band edges */
@@ -169,7 +180,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
   }
   look->linearmap[j]=-1;
 
-  look->lsp_look=malloc(look->ln*sizeof(float));
+  look->lsp_look=_ogg_malloc(look->ln*sizeof(float));
   for(j=0;j<look->ln;j++)
     look->lsp_look[j]=2*cos(M_PI/look->ln*j);
 
@@ -282,7 +293,8 @@ static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
 
     /* the spec supports using one of a number of codebooks.  Right
        now, encode using this lib supports only one */
-    codebook *b=vb->vd->fullbooks+info->books[0];
+    backend_lookup_state *be=vb->vd->backend_state;
+    codebook *b=be->fullbooks+info->books[0];
     oggpack_write(&vb->opb,0,_ilog(info->numbooks));
 
     /* LSP <-> LPC is orthogonal and LSP quantizes more stably  */
@@ -354,7 +366,8 @@ static int floor0_inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){
     float *lsp=alloca(sizeof(float)*look->m);
 
     if(booknum!=-1){
-      codebook *b=vb->vd->fullbooks+info->books[booknum];
+      backend_lookup_state *be=vb->vd->backend_state;
+      codebook *b=be->fullbooks+info->books[booknum];
       float last=0.;
       
       memset(out,0,sizeof(double)*look->m);    
@@ -380,7 +393,7 @@ static int floor0_inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){
 
 /* export hooks */
 vorbis_func_floor floor0_exportbundle={
-  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_free_info,
+  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_copy_info,&floor0_free_info,
   &floor0_free_look,&floor0_forward,&floor0_inverse
 };
 
index 57dcb36..1a85649 100644 (file)
--- a/lib/iir.c
+++ b/lib/iir.c
@@ -1,24 +1,25 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: Direct Form I, II IIR filters, plus some specializations
-  last mod: $Id: iir.c,v 1.2 2000/10/12 03:12:52 xiphmont Exp $
+  last mod: $Id: iir.c,v 1.3 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
 /* LPC is actually a degenerate case of form I/II filters, but we need
    both */
 
+#include <ogg/ogg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
@@ -28,10 +29,9 @@ void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B){
   memset(s,0,sizeof(IIR_state));
   s->stages=stages;
   s->gain=gain;
-  s->coeff_A=malloc(stages*sizeof(float));
-  s->coeff_B=malloc((stages+1)*sizeof(float));
-  s->z_A=calloc(stages*2,sizeof(float));
-  s->z_B=calloc(stages*2,sizeof(float));
+  s->coeff_A=_ogg_malloc(stages*sizeof(float));
+  s->coeff_B=_ogg_malloc((stages+1)*sizeof(float));
+  s->z_A=_ogg_calloc(stages*2,sizeof(float));
 
   memcpy(s->coeff_A,A,stages*sizeof(float));
   memcpy(s->coeff_B,B,(stages+1)*sizeof(float));
@@ -42,7 +42,6 @@ void IIR_clear(IIR_state *s){
     free(s->coeff_A);
     free(s->coeff_B);
     free(s->z_A);
-    free(s->z_B);
     memset(s,0,sizeof(IIR_state));
   }
 }
@@ -66,6 +65,17 @@ float IIR_filter(IIR_state *s,float in){
   return(newB);
 }
 
+/* prevents ringing down to underflow */
+void IIR_clamp(IIR_state *s,float thresh){
+  float *zA=s->z_A+s->ring;
+  int i;
+  for(i=0;i<s->stages;i++)
+    if(fabs(zA[i])>=thresh)break;
+  
+  if(i<s->stages)
+    memset(s->z_A,0,sizeof(float)*s->stages*2);
+}
+
 /* this assumes the symmetrical structure of the feed-forward stage of
    a Chebyshev bandpass to save multiplies */
 float IIR_filter_ChebBand(IIR_state *s,float in){
@@ -267,7 +277,7 @@ int main(){
 
   /* run the pregenerated Chebyshev filter, then our own distillation
      through the generic and specialized code */
-  float *work=malloc(128*sizeof(float));
+  float *work=_ogg_malloc(128*sizeof(float));
   IIR_state iir;
   int i;
 
index befb4ce..5169593 100644 (file)
--- a/lib/iir.h
+++ b/lib/iir.h
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: Direct Form I, II IIR filters, plus some specializations
-  last mod: $Id: iir.h,v 1.2 2000/10/12 03:12:52 xiphmont Exp $
+  last mod: $Id: iir.h,v 1.3 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,14 +24,14 @@ typedef struct {
   float *coeff_A;
   float *coeff_B;
   float *z_A;
-  float *z_B;
   int ring;
   float gain;
 } IIR_state;
 
-void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B);
-void IIR_clear(IIR_state *s);
-float IIR_filter(IIR_state *s,float in);
-float IIR_filter_ChebBand(IIR_state *s,float in);
+extern void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B);
+extern void IIR_clear(IIR_state *s);
+extern float IIR_filter(IIR_state *s,float in);
+extern float IIR_filter_ChebBand(IIR_state *s,float in);
+extern void IIR_clamp(IIR_state *s,float thresh);
 
 #endif
index 8418535..90ff887 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.31 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: info.c,v 1.32 2000/11/06 00:07:00 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,9 +24,9 @@
 #include <ctype.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
+#include "backends.h"
+#include "codec_internal.h"
+#include "codebook.h"
 #include "registry.h"
 #include "window.h"
 #include "psy.h"
@@ -60,9 +60,9 @@ void vorbis_comment_init(vorbis_comment *vc){
 }
 
 void vorbis_comment_add(vorbis_comment *vc,char *comment){
-  vc->user_comments=realloc(vc->user_comments,
+  vc->user_comments=_ogg_realloc(vc->user_comments,
                            (vc->comments+2)*sizeof(char *));
-  vc->comment_lengths=realloc(vc->comment_lengths,
+  vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
                            (vc->comments+2)*sizeof(int));
   vc->user_comments[vc->comments]=strdup(comment);
   vc->comment_lengths[vc->comments]=strlen(comment);
@@ -141,56 +141,54 @@ void vorbis_comment_clear(vorbis_comment *vc){
 /* used by synthesis, which has a full, alloced vi */
 void vorbis_info_init(vorbis_info *vi){
   memset(vi,0,sizeof(vorbis_info));
+  vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info));
 }
 
 void vorbis_info_clear(vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
 
-  for(i=0;i<vi->modes;i++)
-    if(vi->mode_param[i])free(vi->mode_param[i]);
-  /*if(vi->mode_param)free(vi->mode_param);*/
-  for(i=0;i<vi->maps;i++) /* unpack does the range checking */
-    _mapping_P[vi->map_type[i]]->free_info(vi->map_param[i]);
-  /*if(vi->map_param)free(vi->map_param);*/
-    
-  for(i=0;i<vi->times;i++) /* unpack does the range checking */
-    _time_P[vi->time_type[i]]->free_info(vi->time_param[i]);
-  /*if(vi->time_param)free(vi->time_param);*/
-    
-  for(i=0;i<vi->floors;i++) /* unpack does the range checking */
-    _floor_P[vi->floor_type[i]]->free_info(vi->floor_param[i]);
-  /*if(vi->floor_param)free(vi->floor_param);*/
+  if(ci){
+
+    for(i=0;i<ci->modes;i++)
+      if(ci->mode_param[i])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]);
+
+    for(i=0;i<ci->times;i++) /* unpack does the range checking */
+      _time_P[ci->time_type[i]]->free_info(ci->time_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]);
     
-  for(i=0;i<vi->residues;i++) /* unpack does the range checking */
-    _residue_P[vi->residue_type[i]]->free_info(vi->residue_param[i]);
-  /*if(vi->residue_param)free(vi->residue_param);*/
-
-  /* the static codebooks *are* freed if you call info_clear, because
-     decode side does alloc a 'static' codebook. Calling clear on the
-     full codebook does not clear the static codebook (that's our
-     responsibility) */
-  for(i=0;i<vi->books;i++){
-    /* just in case the decoder pre-cleared to save space */
-    if(vi->book_param[i]){
-      vorbis_staticbook_clear(vi->book_param[i]);
-      free(vi->book_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]);
+
+    for(i=0;i<ci->books;i++){
+      if(ci->book_param[i]){
+       /* knows if the book was not alloced */
+       vorbis_staticbook_destroy(ci->book_param[i]);
+      }
     }
+    
+    for(i=0;i<ci->psys;i++)
+      _vi_psy_free(ci->psy_param[i]);
+
+    free(ci);
   }
-  /*if(vi->book_param)free(vi->book_param);*/
 
-  for(i=0;i<vi->psys;i++)
-    _vi_psy_free(vi->psy_param[i]);
-  /*if(vi->psy_param)free(vi->psy_param);*/
-  
   memset(vi,0,sizeof(vorbis_info));
 }
 
 /* Header packing/unpacking ********************************************/
 
 static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
+  if(!ci)return(OV_EFAULT);
+
   vi->version=oggpack_read(opb,32);
-  if(vi->version!=0)return(-1);
+  if(vi->version!=0)return(OV_EVERSION);
 
   vi->channels=oggpack_read(opb,8);
   vi->rate=oggpack_read(opb,32);
@@ -199,38 +197,38 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
   vi->bitrate_nominal=oggpack_read(opb,32);
   vi->bitrate_lower=oggpack_read(opb,32);
 
-  vi->blocksizes[0]=1<<oggpack_read(opb,4);
-  vi->blocksizes[1]=1<<oggpack_read(opb,4);
+  ci->blocksizes[0]=1<<oggpack_read(opb,4);
+  ci->blocksizes[1]=1<<oggpack_read(opb,4);
   
   if(vi->rate<1)goto err_out;
   if(vi->channels<1)goto err_out;
-  if(vi->blocksizes[0]<8)goto err_out; 
-  if(vi->blocksizes[1]<vi->blocksizes[0])goto err_out;
+  if(ci->blocksizes[0]<8)goto err_out; 
+  if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
   
   if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
 
   return(0);
  err_out:
   vorbis_info_clear(vi);
-  return(-1);
+  return(OV_EBADHEADER);
 }
 
 static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
   int i;
   int vendorlen=oggpack_read(opb,32);
   if(vendorlen<0)goto err_out;
-  vc->vendor=calloc(vendorlen+1,1);
+  vc->vendor=_ogg_calloc(vendorlen+1,1);
   _v_readstring(opb,vc->vendor,vendorlen);
   vc->comments=oggpack_read(opb,32);
   if(vc->comments<0)goto err_out;
-  vc->user_comments=calloc(vc->comments+1,sizeof(char **));
-  vc->comment_lengths=calloc(vc->comments+1, sizeof(int));
+  vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(char **));
+  vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(int));
            
   for(i=0;i<vc->comments;i++){
     int len=oggpack_read(opb,32);
     if(len<0)goto err_out;
        vc->comment_lengths[i]=len;
-    vc->user_comments[i]=calloc(len+1,1);
+    vc->user_comments[i]=_ogg_calloc(len+1,1);
     _v_readstring(opb,vc->user_comments[i],len);
   }      
   if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
@@ -238,79 +236,81 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
   return(0);
  err_out:
   vorbis_comment_clear(vc);
-  return(-1);
+  return(OV_EBADHEADER);
 }
 
 /* all of the real encoding details are here.  The modes, books,
    everything */
 static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
+  if(!ci)return(OV_EFAULT);
 
   /* codebooks */
-  vi->books=oggpack_read(opb,8)+1;
-  /*vi->book_param=calloc(vi->books,sizeof(static_codebook *));*/
-  for(i=0;i<vi->books;i++){
-    vi->book_param[i]=calloc(1,sizeof(static_codebook));
-    if(vorbis_staticbook_unpack(opb,vi->book_param[i]))goto err_out;
+  ci->books=oggpack_read(opb,8)+1;
+  /*ci->book_param=_ogg_calloc(ci->books,sizeof(static_codebook *));*/
+  for(i=0;i<ci->books;i++){
+    ci->book_param[i]=_ogg_calloc(1,sizeof(static_codebook));
+    if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
   }
 
   /* time backend settings */
-  vi->times=oggpack_read(opb,6)+1;
-  /*vi->time_type=malloc(vi->times*sizeof(int));*/
-  /*vi->time_param=calloc(vi->times,sizeof(void *));*/
-  for(i=0;i<vi->times;i++){
-    vi->time_type[i]=oggpack_read(opb,16);
-    if(vi->time_type[i]<0 || vi->time_type[i]>=VI_TIMEB)goto err_out;
-    vi->time_param[i]=_time_P[vi->time_type[i]]->unpack(vi,opb);
-    if(!vi->time_param[i])goto err_out;
+  ci->times=oggpack_read(opb,6)+1;
+  /*ci->time_type=_ogg_malloc(ci->times*sizeof(int));*/
+  /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
+  for(i=0;i<ci->times;i++){
+    ci->time_type[i]=oggpack_read(opb,16);
+    if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
+    ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
+    if(!ci->time_param[i])goto err_out;
   }
 
   /* floor backend settings */
-  vi->floors=oggpack_read(opb,6)+1;
-  /*vi->floor_type=malloc(vi->floors*sizeof(int));*/
-  /*vi->floor_param=calloc(vi->floors,sizeof(void *));*/
-  for(i=0;i<vi->floors;i++){
-    vi->floor_type[i]=oggpack_read(opb,16);
-    if(vi->floor_type[i]<0 || vi->floor_type[i]>=VI_FLOORB)goto err_out;
-    vi->floor_param[i]=_floor_P[vi->floor_type[i]]->unpack(vi,opb);
-    if(!vi->floor_param[i])goto err_out;
+  ci->floors=oggpack_read(opb,6)+1;
+  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(int));*/
+  /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
+  for(i=0;i<ci->floors;i++){
+    ci->floor_type[i]=oggpack_read(opb,16);
+    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
+    ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
+    if(!ci->floor_param[i])goto err_out;
   }
 
   /* residue backend settings */
-  vi->residues=oggpack_read(opb,6)+1;
-  /*vi->residue_type=malloc(vi->residues*sizeof(int));*/
-  /*vi->residue_param=calloc(vi->residues,sizeof(void *));*/
-  for(i=0;i<vi->residues;i++){
-    vi->residue_type[i]=oggpack_read(opb,16);
-    if(vi->residue_type[i]<0 || vi->residue_type[i]>=VI_RESB)goto err_out;
-    vi->residue_param[i]=_residue_P[vi->residue_type[i]]->unpack(vi,opb);
-    if(!vi->residue_param[i])goto err_out;
+  ci->residues=oggpack_read(opb,6)+1;
+  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(int));*/
+  /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
+  for(i=0;i<ci->residues;i++){
+    ci->residue_type[i]=oggpack_read(opb,16);
+    if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
+    ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
+    if(!ci->residue_param[i])goto err_out;
   }
 
   /* map backend settings */
-  vi->maps=oggpack_read(opb,6)+1;
-  /*vi->map_type=malloc(vi->maps*sizeof(int));*/
-  /*vi->map_param=calloc(vi->maps,sizeof(void *));*/
-  for(i=0;i<vi->maps;i++){
-    vi->map_type[i]=oggpack_read(opb,16);
-    if(vi->map_type[i]<0 || vi->map_type[i]>=VI_MAPB)goto err_out;
-    vi->map_param[i]=_mapping_P[vi->map_type[i]]->unpack(vi,opb);
-    if(!vi->map_param[i])goto err_out;
+  ci->maps=oggpack_read(opb,6)+1;
+  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(int));*/
+  /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
+  for(i=0;i<ci->maps;i++){
+    ci->map_type[i]=oggpack_read(opb,16);
+    if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
+    ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
+    if(!ci->map_param[i])goto err_out;
   }
   
   /* mode settings */
-  vi->modes=oggpack_read(opb,6)+1;
-  /*vi->mode_param=calloc(vi->modes,sizeof(void *));*/
-  for(i=0;i<vi->modes;i++){
-    vi->mode_param[i]=calloc(1,sizeof(vorbis_info_mode));
-    vi->mode_param[i]->blockflag=oggpack_read(opb,1);
-    vi->mode_param[i]->windowtype=oggpack_read(opb,16);
-    vi->mode_param[i]->transformtype=oggpack_read(opb,16);
-    vi->mode_param[i]->mapping=oggpack_read(opb,8);
-
-    if(vi->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
-    if(vi->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
-    if(vi->mode_param[i]->mapping>=vi->maps)goto err_out;
+  ci->modes=oggpack_read(opb,6)+1;
+  /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
+  for(i=0;i<ci->modes;i++){
+    ci->mode_param[i]=_ogg_calloc(1,sizeof(vorbis_info_mode));
+    ci->mode_param[i]->blockflag=oggpack_read(opb,1);
+    ci->mode_param[i]->windowtype=oggpack_read(opb,16);
+    ci->mode_param[i]->transformtype=oggpack_read(opb,16);
+    ci->mode_param[i]->mapping=oggpack_read(opb,8);
+
+    if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
   }
   
   if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
@@ -318,7 +318,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
   return(0);
  err_out:
   vorbis_info_clear(vi);
-  return(-1);
+  return(OV_EBADHEADER);
 }
 
 /* The Vorbis header is in three packets; the initial small packet in
@@ -341,17 +341,17 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
       _v_readstring(&opb,buffer,6);
       if(memcmp(buffer,"vorbis",6)){
        /* not a vorbis header */
-       return(-1);
+       return(OV_ENOTVORBIS);
       }
       switch(packtype){
       case 0x01: /* least significant *bit* is read first */
        if(!op->b_o_s){
          /* Not the initial packet */
-         return(-1);
+         return(OV_EBADHEADER);
        }
        if(vi->rate!=0){
          /* previously initialized info header */
-         return(-1);
+         return(OV_EBADHEADER);
        }
 
        return(_vorbis_unpack_info(vi,&opb));
@@ -359,7 +359,7 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
       case 0x03: /* least significant *bit* is read first */
        if(vi->rate==0){
          /* um... we didn't get the initial header */
-         return(-1);
+         return(OV_EBADHEADER);
        }
 
        return(_vorbis_unpack_comment(vc,&opb));
@@ -367,24 +367,27 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
       case 0x05: /* least significant *bit* is read first */
        if(vi->rate==0 || vc->vendor==NULL){
          /* um... we didn;t get the initial header or comments yet */
-         return(-1);
+         return(OV_EBADHEADER);
        }
 
        return(_vorbis_unpack_books(vi,&opb));
 
       default:
        /* Not a valid vorbis header type */
-       return(-1);
+       return(OV_EBADHEADER);
        break;
       }
     }
   }
-  return(-1);
+  return(OV_EBADHEADER);
 }
 
 /* pack side **********************************************************/
 
 static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
+  if(!ci)return(OV_EFAULT);
+
   /* preamble */  
   oggpack_write(opb,0x01,8);
   _v_writestring(opb,"vorbis");
@@ -398,15 +401,15 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
   oggpack_write(opb,vi->bitrate_nominal,32);
   oggpack_write(opb,vi->bitrate_lower,32);
 
-  oggpack_write(opb,ilog2(vi->blocksizes[0]),4);
-  oggpack_write(opb,ilog2(vi->blocksizes[1]),4);
+  oggpack_write(opb,ilog2(ci->blocksizes[0]),4);
+  oggpack_write(opb,ilog2(ci->blocksizes[1]),4);
   oggpack_write(opb,1,1);
 
   return(0);
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiphophorus libVorbis I 20000508";
+  char temp[]="Xiphophorus libVorbis I 20001031";
 
   /* preamble */  
   oggpack_write(opb,0x03,8);
@@ -436,50 +439,53 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
 }
  
 static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
+  if(!ci)return(OV_EFAULT);
+
   oggpack_write(opb,0x05,8);
   _v_writestring(opb,"vorbis");
 
   /* books */
-  oggpack_write(opb,vi->books-1,8);
-  for(i=0;i<vi->books;i++)
-    if(vorbis_staticbook_pack(vi->book_param[i],opb))goto err_out;
+  oggpack_write(opb,ci->books-1,8);
+  for(i=0;i<ci->books;i++)
+    if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out;
 
   /* times */
-  oggpack_write(opb,vi->times-1,6);
-  for(i=0;i<vi->times;i++){
-    oggpack_write(opb,vi->time_type[i],16);
-    _time_P[vi->time_type[i]]->pack(vi->time_param[i],opb);
+  oggpack_write(opb,ci->times-1,6);
+  for(i=0;i<ci->times;i++){
+    oggpack_write(opb,ci->time_type[i],16);
+    _time_P[ci->time_type[i]]->pack(ci->time_param[i],opb);
   }
 
   /* floors */
-  oggpack_write(opb,vi->floors-1,6);
-  for(i=0;i<vi->floors;i++){
-    oggpack_write(opb,vi->floor_type[i],16);
-    _floor_P[vi->floor_type[i]]->pack(vi->floor_param[i],opb);
+  oggpack_write(opb,ci->floors-1,6);
+  for(i=0;i<ci->floors;i++){
+    oggpack_write(opb,ci->floor_type[i],16);
+    _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
   }
 
   /* residues */
-  oggpack_write(opb,vi->residues-1,6);
-  for(i=0;i<vi->residues;i++){
-    oggpack_write(opb,vi->residue_type[i],16);
-    _residue_P[vi->residue_type[i]]->pack(vi->residue_param[i],opb);
+  oggpack_write(opb,ci->residues-1,6);
+  for(i=0;i<ci->residues;i++){
+    oggpack_write(opb,ci->residue_type[i],16);
+    _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb);
   }
 
   /* maps */
-  oggpack_write(opb,vi->maps-1,6);
-  for(i=0;i<vi->maps;i++){
-    oggpack_write(opb,vi->map_type[i],16);
-    _mapping_P[vi->map_type[i]]->pack(vi,vi->map_param[i],opb);
+  oggpack_write(opb,ci->maps-1,6);
+  for(i=0;i<ci->maps;i++){
+    oggpack_write(opb,ci->map_type[i],16);
+    _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb);
   }
 
   /* modes */
-  oggpack_write(opb,vi->modes-1,6);
-  for(i=0;i<vi->modes;i++){
-    oggpack_write(opb,vi->mode_param[i]->blockflag,1);
-    oggpack_write(opb,vi->mode_param[i]->windowtype,16);
-    oggpack_write(opb,vi->mode_param[i]->transformtype,16);
-    oggpack_write(opb,vi->mode_param[i]->mapping,8);
+  oggpack_write(opb,ci->modes-1,6);
+  for(i=0;i<ci->modes;i++){
+    oggpack_write(opb,ci->mode_param[i]->blockflag,1);
+    oggpack_write(opb,ci->mode_param[i]->windowtype,16);
+    oggpack_write(opb,ci->mode_param[i]->transformtype,16);
+    oggpack_write(opb,ci->mode_param[i]->mapping,8);
   }
   oggpack_write(opb,1,1);
 
@@ -493,8 +499,15 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
                              ogg_packet *op,
                              ogg_packet *op_comm,
                              ogg_packet *op_code){
+  int ret=OV_EIMPL;
   vorbis_info *vi=v->vi;
   oggpack_buffer opb;
+  backend_lookup_state *b=v->backend_state;
+
+  if(!b){
+    ret=OV_EFAULT;
+    goto err_out;
+  }
 
   /* first header packet **********************************************/
 
@@ -502,10 +515,10 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
   if(_vorbis_pack_info(&opb,vi))goto err_out;
 
   /* build the packet */
-  if(v->header)free(v->header);
-  v->header=malloc(oggpack_bytes(&opb));
-  memcpy(v->header,opb.buffer,oggpack_bytes(&opb));
-  op->packet=v->header;
+  if(b->header)free(b->header);
+  b->header=_ogg_malloc(oggpack_bytes(&opb));
+  memcpy(b->header,opb.buffer,oggpack_bytes(&opb));
+  op->packet=b->header;
   op->bytes=oggpack_bytes(&opb);
   op->b_o_s=1;
   op->e_o_s=0;
@@ -516,10 +529,10 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
   oggpack_reset(&opb);
   if(_vorbis_pack_comment(&opb,vc))goto err_out;
 
-  if(v->header1)free(v->header1);
-  v->header1=malloc(oggpack_bytes(&opb));
-  memcpy(v->header1,opb.buffer,oggpack_bytes(&opb));
-  op_comm->packet=v->header1;
+  if(b->header1)free(b->header1);
+  b->header1=_ogg_malloc(oggpack_bytes(&opb));
+  memcpy(b->header1,opb.buffer,oggpack_bytes(&opb));
+  op_comm->packet=b->header1;
   op_comm->bytes=oggpack_bytes(&opb);
   op_comm->b_o_s=0;
   op_comm->e_o_s=0;
@@ -530,10 +543,10 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
   oggpack_reset(&opb);
   if(_vorbis_pack_books(&opb,vi))goto err_out;
 
-  if(v->header2)free(v->header2);
-  v->header2=malloc(oggpack_bytes(&opb));
-  memcpy(v->header2,opb.buffer,oggpack_bytes(&opb));
-  op_code->packet=v->header2;
+  if(b->header2)free(b->header2);
+  b->header2=_ogg_malloc(oggpack_bytes(&opb));
+  memcpy(b->header2,opb.buffer,oggpack_bytes(&opb));
+  op_code->packet=b->header2;
   op_code->bytes=oggpack_bytes(&opb);
   op_code->b_o_s=0;
   op_code->e_o_s=0;
@@ -547,12 +560,12 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
   memset(op_comm,0,sizeof(ogg_packet));
   memset(op_code,0,sizeof(ogg_packet));
 
-  if(v->header)free(v->header);
-  if(v->header1)free(v->header1);
-  if(v->header2)free(v->header2);
-  v->header=NULL;
-  v->header1=NULL;
-  v->header2=NULL;
-  return(-1);
+  if(b->header)free(b->header);
+  if(b->header1)free(b->header1);
+  if(b->header2)free(b->header2);
+  b->header=NULL;
+  b->header1=NULL;
+  b->header2=NULL;
+  return(ret);
 }
 
index ec533b5..4f04dbe 100644 (file)
@@ -1,38 +1,40 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.c,v 1.2 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lookup.c,v 1.3 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
 #include <math.h>
 #include "lookup.h"
 #include "lookup_data.h"
+#include "os.h"
 
 #ifdef FLOAT_LOOKUP
 
 /* interpolated lookup based cos function, domain 0 to PI only */
 float vorbis_coslook(float a){
-  float d=a*(.31830989*(float)COS_LOOKUP_SZ);
-  int i=d;
+  double d=a*(.31830989*(float)COS_LOOKUP_SZ);
+  int i=vorbis_ftoi(d-.5);
+
   return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]);
 }
 
 /* interpolated 1./sqrt(p) where .5 <= p < 1. */
 float vorbis_invsqlook(float a){
-  float d=a*(2.*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
-  int i=d;
+  double d=a*(2.*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
+  int i=vorbis_ftoi(d-.5);
   return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]);
 }
 
@@ -44,7 +46,7 @@ float vorbis_invsq2explook(int a){
 #include <stdio.h>
 /* interpolated lookup based fromdB function, domain -140dB to 0dB only */
 float vorbis_fromdBlook(float a){
-  int i=a*((float)(-(1<<FROMdB2_SHIFT)));
+  int i=vorbis_ftoi(a*((float)(-(1<<FROMdB2_SHIFT)))-5.);
   return (i<0)?1.:
     ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.:
      FROMdB_LOOKUP[i>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
index 8f55d5a..3115dda 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.h,v 1.2 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lookup.h,v 1.3 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index d9f4e76..e7fef0c 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: lookup data; generated by lookups.pl; edit there
-  last mod: $Id: lookup_data.h,v 1.2 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lookup_data.h,v 1.3 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index dbd7f71..1e58700 100755 (executable)
@@ -2,19 +2,19 @@
 print <<'EOD';
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: lookup data; generated by lookups.pl; edit there
-  last mod: $Id: lookups.pl,v 1.2 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lookups.pl,v 1.3 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index a1b8c29..cb532a7 100644 (file)
--- a/lib/lpc.c
+++ b/lib/lpc.c
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.c,v 1.26 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lpc.c,v 1.27 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index fa66295..85ceec5 100644 (file)
--- a/lib/lpc.h
+++ b/lib/lpc.h
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.h,v 1.14 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lpc.h,v 1.15 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index 5211cfe..497661d 100644 (file)
--- a/lib/lsp.c
+++ b/lib/lsp.c
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.c,v 1.11 2000/10/18 21:27:15 jack Exp $
+  last mod: $Id: lsp.c,v 1.12 2000/11/06 00:07:01 xiphmont Exp $
 
   The LSP generation code is taken (with minimal modification) from
   "On the Computation of the LSP Frequencies" by Joseph Rothweiler
@@ -65,11 +65,14 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
                            float amp,float ampoffset){
   int i;
   float wdel=M_PI/ln;
+  vorbis_fpu_control fpu;
+  
+  vorbis_fpu_setround(&fpu);
   for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
 
   i=0;
   while(i<n){
-    int j=0,k=map[i];
+    int k=map[i];
     int qexp;
     float p=.7071067812;
     float q=.7071067812;
@@ -82,16 +85,18 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
       q*=ftmp[1]-w;
       ftmp+=2;
     }while(--c);
-    
+
     q=frexp(p*p*(1.+w)+q*q*(1.-w),&qexp);
     q=vorbis_fromdBlook(amp*             
                        vorbis_invsqlook(q)*
                        vorbis_invsq2explook(qexp+m)- 
                        ampoffset);
 
-    curve[i++]=q;
-    while(map[i]==k)curve[i++]=q;
+    do{
+      curve[i++]=q;
+    }while(map[i]==k);
   }
+  vorbis_fpu_restore(fpu);
 }
 
 #else
index 42f272c..1ee0a30 100644 (file)
--- a/lib/lsp.h
+++ b/lib/lsp.h
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.h,v 1.5 2000/10/12 03:12:53 xiphmont Exp $
+  last mod: $Id: lsp.h,v 1.6 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index 6e3b901..3ee1986 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.16 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.17 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
@@ -21,8 +21,8 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-#include "bookinternal.h"
+#include "codec_internal.h"
+#include "codebook.h"
 #include "registry.h"
 #include "psy.h"
 #include "misc.h"
@@ -56,6 +56,13 @@ typedef struct {
                     invalidate decay */
 } vorbis_look_mapping0;
 
+static vorbis_info_mapping *mapping0_copy_info(vorbis_info_mapping *vm){
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
+  vorbis_info_mapping0 *ret=_ogg_malloc(sizeof(vorbis_info_mapping0));
+  memcpy(ret,info,sizeof(vorbis_info_mapping0));
+  return(ret);
+}
+
 static void mapping0_free_info(vorbis_info_mapping *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_mapping0));
@@ -96,48 +103,49 @@ static void mapping0_free_look(vorbis_look_mapping *look){
 static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
                          vorbis_info_mapping *m){
   int i;
-  vorbis_info *vi=vd->vi;
-  vorbis_look_mapping0 *look=calloc(1,sizeof(vorbis_look_mapping0));
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  vorbis_look_mapping0 *look=_ogg_calloc(1,sizeof(vorbis_look_mapping0));
   vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
   look->mode=vm;
   
-  look->time_look=calloc(info->submaps,sizeof(vorbis_look_time *));
-  look->floor_look=calloc(info->submaps,sizeof(vorbis_look_floor *));
+  look->time_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_time *));
+  look->floor_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_floor *));
 
-  look->residue_look=calloc(info->submaps,sizeof(vorbis_look_residue *));
-  if(vi->psys)look->psy_look=calloc(info->submaps,sizeof(vorbis_look_psy));
+  look->residue_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_residue *));
+  if(ci->psys)look->psy_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_psy));
 
-  look->time_func=calloc(info->submaps,sizeof(vorbis_func_time *));
-  look->floor_func=calloc(info->submaps,sizeof(vorbis_func_floor *));
-  look->residue_func=calloc(info->submaps,sizeof(vorbis_func_residue *));
+  look->time_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_time *));
+  look->floor_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_floor *));
+  look->residue_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_residue *));
   
   for(i=0;i<info->submaps;i++){
     int timenum=info->timesubmap[i];
     int floornum=info->floorsubmap[i];
     int resnum=info->residuesubmap[i];
 
-    look->time_func[i]=_time_P[vi->time_type[timenum]];
+    look->time_func[i]=_time_P[ci->time_type[timenum]];
     look->time_look[i]=look->time_func[i]->
-      look(vd,vm,vi->time_param[timenum]);
-    look->floor_func[i]=_floor_P[vi->floor_type[floornum]];
+      look(vd,vm,ci->time_param[timenum]);
+    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
     look->floor_look[i]=look->floor_func[i]->
-      look(vd,vm,vi->floor_param[floornum]);
-    look->residue_func[i]=_residue_P[vi->residue_type[resnum]];
+      look(vd,vm,ci->floor_param[floornum]);
+    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
     look->residue_look[i]=look->residue_func[i]->
-      look(vd,vm,vi->residue_param[resnum]);
+      look(vd,vm,ci->residue_param[resnum]);
     
-    if(vi->psys && vd->analysisp){
+    if(ci->psys && vd->analysisp){
       int psynum=info->psysubmap[i];
-      _vp_psy_init(look->psy_look+i,vi->psy_param[psynum],
-                  vi->blocksizes[vm->blockflag]/2,vi->rate);
+      _vp_psy_init(look->psy_look+i,ci->psy_param[psynum],
+                  ci->blocksizes[vm->blockflag]/2,vi->rate);
     }
   }
 
   look->ch=vi->channels;
-  if(vi->psys){
-    look->decay=calloc(vi->channels,sizeof(float *));
+  if(ci->psys){
+    look->decay=_ogg_calloc(vi->channels,sizeof(float *));
     for(i=0;i<vi->channels;i++)
-      look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(float));
+      look->decay[i]=_ogg_calloc(ci->blocksizes[vm->blockflag]/2,sizeof(float));
   }
 
   return(look);
@@ -163,7 +171,8 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer
 /* also responsible for range checking */
 static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int i;
-  vorbis_info_mapping0 *info=calloc(1,sizeof(vorbis_info_mapping0));
+  vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(vorbis_info_mapping0));
+  codec_setup_info     *ci=vi->codec_setup;
   memset(info,0,sizeof(vorbis_info_mapping0));
 
   info->submaps=oggpack_read(opb,4)+1;
@@ -176,11 +185,11 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
   }
   for(i=0;i<info->submaps;i++){
     info->timesubmap[i]=oggpack_read(opb,8);
-    if(info->timesubmap[i]>=vi->times)goto err_out;
+    if(info->timesubmap[i]>=ci->times)goto err_out;
     info->floorsubmap[i]=oggpack_read(opb,8);
-    if(info->floorsubmap[i]>=vi->floors)goto err_out;
+    if(info->floorsubmap[i]>=ci->floors)goto err_out;
     info->residuesubmap[i]=oggpack_read(opb,8);
-    if(info->residuesubmap[i]>=vi->residues)goto err_out;
+    if(info->residuesubmap[i]>=ci->residues)goto err_out;
   }
 
   return info;
@@ -203,12 +212,13 @@ static long seq=0;
 static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
   vorbis_dsp_state     *vd=vb->vd;
   vorbis_info          *vi=vd->vi;
+  backend_lookup_state *b=vb->vd->backend_state;
   vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0 *info=look->map;
   vorbis_info_mode     *mode=look->mode;
   int                   n=vb->pcmend;
   int i,j;
-  float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+  float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
 
   float **pcmbundle=alloca(sizeof(float *)*vi->channels);
   int *nonzero=alloca(sizeof(int)*vi->channels);
@@ -229,7 +239,7 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
   /* only MDCT right now.... */
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
-    mdct_forward(vd->transform[vb->W][0],pcm,pcm);
+    mdct_forward(b->transform[vb->W][0],pcm,pcm);
   }
 
   {
@@ -305,13 +315,15 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
 static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
   vorbis_dsp_state     *vd=vb->vd;
   vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  backend_lookup_state *b=vd->backend_state;
   vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0 *info=look->map;
   vorbis_info_mode     *mode=look->mode;
   int                   i,j;
-  long                  n=vb->pcmend=vi->blocksizes[vb->W];
+  long                  n=vb->pcmend=ci->blocksizes[vb->W];
 
-  float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+  float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
   float **pcmbundle=alloca(sizeof(float *)*vi->channels);
   int *nonzero=alloca(sizeof(int)*vi->channels);
   
@@ -346,7 +358,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
     _analysis_output("out",seq+i,pcm,n/2,0,1);
-    mdct_backward(vd->transform[vb->W][0],pcm,pcm);
+    mdct_backward(b->transform[vb->W][0],pcm,pcm);
   }
 
   /* now apply the decoded pre-window time information */
@@ -373,8 +385,8 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
 
 /* export hooks */
 vorbis_func_mapping mapping0_exportbundle={
-  &mapping0_pack,&mapping0_unpack,&mapping0_look,&mapping0_free_info,
-  &mapping0_free_look,&mapping0_forward,&mapping0_inverse
+  &mapping0_pack,&mapping0_unpack,&mapping0_look,&mapping0_copy_info,
+  &mapping0_free_info,&mapping0_free_look,&mapping0_forward,&mapping0_inverse
 };
 
 
index 7d20662..dbd5b8c 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: masking curve data for psychoacoustics
- last mod: $Id: masking.h,v 1.5 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: masking.h,v 1.6 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index b5eee44..d24cd61 100644 (file)
@@ -1,19 +1,19 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: normalized modified discrete cosine transform
            power of two length transform only [16 <= n ]
- last mod: $Id: mdct.c,v 1.17 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.18 2000/11/06 00:07:01 xiphmont Exp $
 
  Algorithm adapted from _The use of multirate filter banks for coding
  of high quality digital audio_, by T. Sporer, K. Brandenburg and
@@ -45,8 +45,8 @@
    some window function algebra. */
 
 void mdct_init(mdct_lookup *lookup,int n){
-  int    *bitrev=malloc(sizeof(int)*(n/4));
-  float *trig=malloc(sizeof(float)*(n+n/4));
+  int    *bitrev=_ogg_malloc(sizeof(int)*(n/4));
+  float *trig=_ogg_malloc(sizeof(float)*(n+n/4));
   float *AE=trig;
   float *AO=trig+1;
   float *BE=AE+n/2;
@@ -108,21 +108,17 @@ static float *_mdct_kernel(float *x, float *w,
     float *w2=w+n4;
     float *A=init->trig+n2;
 
-    for(i=0;i<n4;){
-      float x0=*xA - *xB;
-      float x1;
+    float x0,x1;
+    i=0;
+    do{
+      x0=*xA - *xB;
       w2[i]=    *xA++ + *xB++;
-
-
       x1=       *xA - *xB;
       A-=4;
-
       w[i++]=   x0 * A[0] + x1 * A[1];
       w[i]=     x1 * A[0] - x0 * A[1];
-
       w2[i++]=  *xA++ + *xB++;
-
-    }
+    }while(i<n4);
   }
 
   /* step 3 */
@@ -141,21 +137,60 @@ static float *_mdct_kernel(float *x, float *w,
        int w2=w1-(k0>>1);
        float AEv= A[0],wA;
        float AOv= A[1],wB;
+        int unroll=i;
        wbase-=2;
 
        k0++;
-       for(s=0;s<(2<<i);s++){
-         wB     =w[w1]   -w[w2];
-         x[w1]  =w[w1]   +w[w2];
-
-         wA     =w[++w1] -w[++w2];
-         x[w1]  =w[w1]   +w[w2];
-
-         x[w2]  =wA*AEv  - wB*AOv;
-         x[w2-1]=wB*AEv  + wA*AOv;
-
-         w1-=k0;
-         w2-=k0;
+        unroll--;
+        if(unroll>0){
+          s=2<<unroll;
+          s>>=1;
+          do{
+            wB     =w[w1]   -w[w2];
+            x[w1]  =w[w1]   +w[w2];
+            wA     =w[++w1] -w[++w2];
+            x[w1]  =w[w1]   +w[w2];
+            x[w2]  =wA*AEv  - wB*AOv;
+            x[w2-1]=wB*AEv  + wA*AOv;
+            w1-=k0;
+            w2-=k0;
+            wB     =w[w1]   -w[w2];
+            x[w1]  =w[w1]   +w[w2];
+            wA     =w[++w1] -w[++w2];
+            x[w1]  =w[w1]   +w[w2];
+            x[w2]  =wA*AEv  - wB*AOv;
+            x[w2-1]=wB*AEv  + wA*AOv;
+            w1-=k0;
+            w2-=k0;
+            wB     =w[w1]   -w[w2];
+            x[w1]  =w[w1]   +w[w2];
+            wA     =w[++w1] -w[++w2];
+            x[w1]  =w[w1]   +w[w2];
+            x[w2]  =wA*AEv  - wB*AOv;
+            x[w2-1]=wB*AEv  + wA*AOv;
+            w1-=k0;
+            w2-=k0;
+            wB     =w[w1]   -w[w2];
+            x[w1]  =w[w1]   +w[w2];
+            wA     =w[++w1] -w[++w2];
+            x[w1]  =w[w1]   +w[w2];
+            x[w2]  =wA*AEv  - wB*AOv;
+            x[w2-1]=wB*AEv  + wA*AOv;
+            w1-=k0;
+            w2-=k0;
+          }while(--s);
+        }else{
+          s=2<<i;
+          do{
+            wB     =w[w1]   -w[w2];
+            x[w1]  =w[w1]   +w[w2];
+            wA     =w[++w1] -w[++w2];
+            x[w1]  =w[w1]   +w[w2];
+            x[w2]  =wA*AEv  - wB*AOv;
+            x[w2-1]=wB*AEv  + wA*AOv;
+            w1-=k0;
+            w2-=k0;
+          }while(--s);
        }
        k0--;
 
@@ -174,7 +209,8 @@ static float *_mdct_kernel(float *x, float *w,
     int *bit=init->bitrev;
     float *x1=x;
     float *x2=x+n2-1;
-    for(i=0;i<n8;i++){
+    i=n8-1;
+    do{
       int t1=*bit++;
       int t2=*bit++;
 
@@ -192,7 +228,7 @@ static float *_mdct_kernel(float *x, float *w,
       *x2--=(-wD+wBCO-wACE)*.5;
       *x1++=( wD+wBCO-wACE)*.5; 
       *x2--=( wC-wACO-wBCE)*.5;
-    }
+    }while(i--);
   }
   return(x);
 }
index 23ca8a2..d6d584a 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: modified discrete cosine transform prototypes
- last mod: $Id: mdct.h,v 1.12 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: mdct.h,v 1.13 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
index 7534f4f..b3de4fc 100644 (file)
@@ -1,12 +1,12 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************/
@@ -42,11 +42,11 @@ static void *_insert(void *ptr,char *file,long line){
   if(pinsert>=palloced){
     palloced+=64;
     if(pointers){
-      pointers=(void **)realloc(pointers,sizeof(void **)*palloced);
-      insertlist=(long *)realloc(insertlist,sizeof(long *)*palloced);
+      pointers=(void **)_ogg_realloc(pointers,sizeof(void **)*palloced);
+      insertlist=(long *)_ogg_realloc(insertlist,sizeof(long *)*palloced);
     }else{
-      pointers=(void **)malloc(sizeof(void **)*palloced);
-      insertlist=(long *)malloc(sizeof(long *)*palloced);
+      pointers=(void **)_ogg_malloc(sizeof(void **)*palloced);
+      insertlist=(long *)_ogg_malloc(sizeof(long *)*palloced);
     }
   }
 
@@ -84,14 +84,14 @@ void _VDBG_dump(void){
   pthread_mutex_unlock(&memlock);
 }
 
-extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){
+extern void *_VDBG__ogg_malloc(void *ptr,long bytes,char *file,long line){
   bytes+=HEAD_ALIGN;
   if(ptr){
     ptr-=HEAD_ALIGN;
     _ripremove(ptr);
-    ptr=realloc(ptr,bytes);
+    ptr=_ogg_realloc(ptr,bytes);
   }else{
-    ptr=malloc(bytes);
+    ptr=_ogg_malloc(bytes);
     memset(ptr,0,bytes);
   }
   return _insert(ptr,file,line);
index 6c63a68..5298d79 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: miscellaneous prototypes
- last mod: $Id: misc.h,v 1.5 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: misc.h,v 1.6 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,18 +25,18 @@ extern void _vorbis_block_ripcord(vorbis_block *vb);
 extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB);
 
 #ifdef DEBUG_LEAKS
-extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); 
+extern void *_VDBG__ogg_malloc(void *ptr,long bytes,char *file,long line); 
 extern void _VDBG_free(void *ptr,char *file,long line); 
 
 #ifndef MISC_C 
-#undef malloc
-#undef calloc
-#undef realloc
+#undef _ogg_malloc
+#undef _ogg_calloc
+#undef _ogg_realloc
 #undef free
 
-#define malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)
-#define calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)
-#define realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)
+#define _ogg_malloc(x) _VDBG__ogg_malloc(NULL,(x),__FILE__,__LINE__)
+#define _ogg_calloc(x,y) _VDBG__ogg_malloc(NULL,(x)*(y),__FILE__,__LINE__)
+#define _ogg_realloc(x,y) _VDBG__ogg_malloc((x),(y),__FILE__,__LINE__)
 #define free(x) _VDBG_free((x),__FILE__,__LINE__)
 #endif
 #endif
diff --git a/lib/modes/.cvsignore b/lib/modes/.cvsignore
new file mode 100644 (file)
index 0000000..282522d
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/lib/modes/Makefile.am b/lib/modes/Makefile.am
new file mode 100644 (file)
index 0000000..cc99e40
--- /dev/null
@@ -0,0 +1,5 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+EXTRA_DIST = mode_A.h mode_B.h mode_C.h mode_D.h mode_E.h modes.h
similarity index 84%
rename from include/vorbis/mode_A.h
rename to lib/modes/mode_A.h
index 7a63134..07cbd83 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_A.h,v 1.3 2000/08/15 14:01:02 xiphmont Exp $
+ last mod: $Id: mode_A.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 
 #include <stdio.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
-
-#include "vorbis/book/resaux0_128a_128.vqh"
-#include "vorbis/book/resaux0_1024a_128.vqh"
-
-#include "vorbis/book/res0_128a_128_1.vqh"
-#include "vorbis/book/res0_128a_128_2.vqh"
-#include "vorbis/book/res0_128a_128_3.vqh"
-#include "vorbis/book/res0_128a_128_4.vqh"
-#include "vorbis/book/res0_128a_128_5.vqh"
-#include "vorbis/book/res0_1024a_128_1.vqh"
-#include "vorbis/book/res0_1024a_128_2.vqh"
-#include "vorbis/book/res0_1024a_128_3.vqh"
-#include "vorbis/book/res0_1024a_128_4.vqh"
-#include "vorbis/book/res0_1024a_128_5.vqh"
-#include "vorbis/book/res0_1024a_128_6.vqh"
-#include "vorbis/book/res0_1024a_128_7.vqh"
-#include "vorbis/book/res0_1024a_128_8.vqh"
-#include "vorbis/book/res0_1024a_128_9.vqh"
+#include "backends.h"
+
+#include "books/lsp12_0.vqh"
+#include "books/lsp30_0.vqh"
+
+#include "books/resaux0_128a_128.vqh"
+#include "books/resaux0_1024a_128.vqh"
+
+#include "books/res0_128a_128_1.vqh"
+#include "books/res0_128a_128_2.vqh"
+#include "books/res0_128a_128_3.vqh"
+#include "books/res0_128a_128_4.vqh"
+#include "books/res0_128a_128_5.vqh"
+#include "books/res0_1024a_128_1.vqh"
+#include "books/res0_1024a_128_2.vqh"
+#include "books/res0_1024a_128_3.vqh"
+#include "books/res0_1024a_128_4.vqh"
+#include "books/res0_1024a_128_5.vqh"
+#include "books/res0_1024a_128_6.vqh"
+#include "books/res0_1024a_128_7.vqh"
+#include "books/res0_1024a_128_8.vqh"
+#include "books/res0_1024a_128_9.vqh"
 
 static vorbis_info_psy _psy_set_A={
   1,/*athp*/
@@ -155,9 +155,8 @@ static vorbis_info_mode _mode_set0A={0,0,0,0};
 static vorbis_info_mode _mode_set1A={1,0,0,1};
 
 /* CD quality stereo, no channel coupling */
-vorbis_info info_A={
-  /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
-  0, 2, 44100, 0,0,0,
+codec_setup_info info_A={
+
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
similarity index 84%
rename from include/vorbis/mode_B.h
rename to lib/modes/mode_B.h
index bb40ad8..85f0b45 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_B.h,v 1.1 2000/08/15 11:53:18 xiphmont Exp $
+ last mod: $Id: mode_B.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 
 #include <stdio.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
-
-#include "vorbis/book/resaux0_128a_160.vqh"
-#include "vorbis/book/resaux0_1024a_160.vqh"
-
-#include "vorbis/book/res0_128a_160_1.vqh"
-#include "vorbis/book/res0_128a_160_2.vqh"
-#include "vorbis/book/res0_128a_160_3.vqh"
-#include "vorbis/book/res0_128a_160_4.vqh"
-#include "vorbis/book/res0_128a_160_5.vqh"
-#include "vorbis/book/res0_1024a_160_1.vqh"
-#include "vorbis/book/res0_1024a_160_2.vqh"
-#include "vorbis/book/res0_1024a_160_3.vqh"
-#include "vorbis/book/res0_1024a_160_4.vqh"
-#include "vorbis/book/res0_1024a_160_5.vqh"
-#include "vorbis/book/res0_1024a_160_6.vqh"
-#include "vorbis/book/res0_1024a_160_7.vqh"
-#include "vorbis/book/res0_1024a_160_8.vqh"
-#include "vorbis/book/res0_1024a_160_9.vqh"
+#include "backends.h"
+
+#include "books/lsp12_0.vqh"
+#include "books/lsp30_0.vqh"
+
+#include "books/resaux0_128a_160.vqh"
+#include "books/resaux0_1024a_160.vqh"
+
+#include "books/res0_128a_160_1.vqh"
+#include "books/res0_128a_160_2.vqh"
+#include "books/res0_128a_160_3.vqh"
+#include "books/res0_128a_160_4.vqh"
+#include "books/res0_128a_160_5.vqh"
+#include "books/res0_1024a_160_1.vqh"
+#include "books/res0_1024a_160_2.vqh"
+#include "books/res0_1024a_160_3.vqh"
+#include "books/res0_1024a_160_4.vqh"
+#include "books/res0_1024a_160_5.vqh"
+#include "books/res0_1024a_160_6.vqh"
+#include "books/res0_1024a_160_7.vqh"
+#include "books/res0_1024a_160_8.vqh"
+#include "books/res0_1024a_160_9.vqh"
 
 static vorbis_info_psy _psy_set_B={
   1,/*athp*/
@@ -154,9 +154,8 @@ static vorbis_info_mode _mode_set0B={0,0,0,0};
 static vorbis_info_mode _mode_set1B={1,0,0,1};
 
 /* CD quality stereo, no channel coupling */
-vorbis_info info_B={
-  /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
-  0, 2, 44100, 0,0,0,
+codec_setup_info info_B={
+
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
similarity index 86%
rename from include/vorbis/mode_C.h
rename to lib/modes/mode_C.h
index baf0162..c059dd5 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_C.h,v 1.2 2000/08/15 14:01:02 xiphmont Exp $
+ last mod: $Id: mode_C.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 
 #include <stdio.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
+#include "backends.h"
 
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
+#include "books/lsp12_0.vqh"
+#include "books/lsp30_0.vqh"
 
-#include "vorbis/book/resaux0_128a_192.vqh"
-#include "vorbis/book/resaux0_1024a_192.vqh"
+#include "books/resaux0_128a_192.vqh"
+#include "books/resaux0_1024a_192.vqh"
 
-#include "vorbis/book/res0_128a_192_1.vqh"
-#include "vorbis/book/res0_128a_192_2.vqh"
-#include "vorbis/book/res0_128a_192_3.vqh"
-#include "vorbis/book/res0_128a_192_4.vqh"
-#include "vorbis/book/res0_128a_192_5.vqh"
-#include "vorbis/book/res0_1024a_192_1.vqh"
-#include "vorbis/book/res0_1024a_192_2.vqh"
-#include "vorbis/book/res0_1024a_192_3.vqh"
-#include "vorbis/book/res0_1024a_192_4.vqh"
-#include "vorbis/book/res0_1024a_192_5.vqh"
+#include "books/res0_128a_192_1.vqh"
+#include "books/res0_128a_192_2.vqh"
+#include "books/res0_128a_192_3.vqh"
+#include "books/res0_128a_192_4.vqh"
+#include "books/res0_128a_192_5.vqh"
+#include "books/res0_1024a_192_1.vqh"
+#include "books/res0_1024a_192_2.vqh"
+#include "books/res0_1024a_192_3.vqh"
+#include "books/res0_1024a_192_4.vqh"
+#include "books/res0_1024a_192_5.vqh"
 
 static vorbis_info_psy _psy_set_C={
   1,/*athp*/
@@ -149,9 +149,8 @@ static vorbis_info_mode _mode_set0C={0,0,0,0};
 static vorbis_info_mode _mode_set1C={1,0,0,1};
 
 /* CD quality stereo, no channel coupling */
-vorbis_info info_C={
-  /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
-  0, 2, 44100, 0,0,0,
+codec_setup_info info_C={
+
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
similarity index 83%
rename from include/vorbis/mode_D.h
rename to lib/modes/mode_D.h
index c04e94d..ef949c5 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_D.h,v 1.5 2000/10/12 03:12:41 xiphmont Exp $
+ last mod: $Id: mode_D.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 
 #include <stdio.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
+#include "backends.h"
 
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
+#include "books/lsp12_0.vqh"
+#include "books/lsp30_0.vqh"
 
-#include "vorbis/book/resaux0_128a_256.vqh"
-#include "vorbis/book/resaux0_1024a_256.vqh"
+#include "books/resaux0_128a_256.vqh"
+#include "books/resaux0_1024a_256.vqh"
 
-#include "vorbis/book/res0_128a_256_1.vqh"
-#include "vorbis/book/res0_128a_256_2.vqh"
-#include "vorbis/book/res0_128a_256_3.vqh"
-#include "vorbis/book/res0_128a_256_4.vqh"
-#include "vorbis/book/res0_128a_256_5.vqh"
-#include "vorbis/book/res0_1024a_256_1.vqh"
-#include "vorbis/book/res0_1024a_256_2.vqh"
-#include "vorbis/book/res0_1024a_256_3.vqh"
-#include "vorbis/book/res0_1024a_256_4.vqh"
-#include "vorbis/book/res0_1024a_256_5.vqh"
+#include "books/res0_128a_256_1.vqh"
+#include "books/res0_128a_256_2.vqh"
+#include "books/res0_128a_256_3.vqh"
+#include "books/res0_128a_256_4.vqh"
+#include "books/res0_128a_256_5.vqh"
+#include "books/res0_1024a_256_1.vqh"
+#include "books/res0_1024a_256_2.vqh"
+#include "books/res0_1024a_256_3.vqh"
+#include "books/res0_1024a_256_4.vqh"
+#include "books/res0_1024a_256_5.vqh"
 
 static vorbis_info_psy _psy_set_256 ={
   1,/*athp*/
@@ -132,9 +132,8 @@ static vorbis_info_mode _mode_set0_256={0,0,0,0};
 static vorbis_info_mode _mode_set1_256={1,0,0,1};
 
 /* CD quality stereo, no channel coupling */
-vorbis_info info_D={
-  /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
-  0, 2, 44100, 0,0,0,
+codec_setup_info info_D={
+
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
similarity index 80%
rename from include/vorbis/mode_E.h
rename to lib/modes/mode_E.h
index 6e1c6cc..b1a9711 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_E.h,v 1.3 2000/10/12 03:12:41 xiphmont Exp $
+ last mod: $Id: mode_E.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 
 #include <stdio.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
+#include "backends.h"
 
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
+#include "books/lsp12_0.vqh"
+#include "books/lsp30_0.vqh"
 
-#include "vorbis/book/resaux0_128a_350.vqh"
-#include "vorbis/book/resaux0_1024a_350.vqh"
+#include "books/resaux0_128a_350.vqh"
+#include "books/resaux0_1024a_350.vqh"
 
-#include "vorbis/book/res0_128a_350_1.vqh"
-#include "vorbis/book/res0_128a_350_2.vqh"
-#include "vorbis/book/res0_128a_350_3.vqh"
-#include "vorbis/book/res0_128a_350_4.vqh"
-#include "vorbis/book/res0_128a_350_5.vqh"
-#include "vorbis/book/res0_1024a_350_1.vqh"
-#include "vorbis/book/res0_1024a_350_2.vqh"
-#include "vorbis/book/res0_1024a_350_3.vqh"
-#include "vorbis/book/res0_1024a_350_4.vqh"
-#include "vorbis/book/res0_1024a_350_5.vqh"
+#include "books/res0_128a_350_1.vqh"
+#include "books/res0_128a_350_2.vqh"
+#include "books/res0_128a_350_3.vqh"
+#include "books/res0_128a_350_4.vqh"
+#include "books/res0_128a_350_5.vqh"
+#include "books/res0_1024a_350_1.vqh"
+#include "books/res0_1024a_350_2.vqh"
+#include "books/res0_1024a_350_3.vqh"
+#include "books/res0_1024a_350_4.vqh"
+#include "books/res0_1024a_350_5.vqh"
 
 static vorbis_info_psy _psy_set_E ={
   1,/*athp*/
@@ -116,9 +116,8 @@ static vorbis_info_mode _mode_set0_E={0,0,0,0};
 static vorbis_info_mode _mode_set1_E={1,0,0,1};
 
 /* CD quality stereo, no channel coupling */
-vorbis_info info_E={
-  /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
-  0, 2, 44100, 0,0,0,
+codec_setup_info info_E={
+
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
similarity index 56%
rename from include/vorbis/modes.h
rename to lib/modes/modes.h
index 6cd279f..699a7b0 100644 (file)
@@ -1,28 +1,28 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: modes.h,v 1.20 2000/08/15 11:53:18 xiphmont Exp $
+ last mod: $Id: modes.h,v 1.2 2000/11/06 00:07:24 xiphmont Exp $
 
  ********************************************************************/
 
 #ifndef _V_MODES_H_
 #define _V_MODES_H_
 
-#include "vorbis/mode_A.h"
-#include "vorbis/mode_B.h"
-#include "vorbis/mode_C.h"
-#include "vorbis/mode_D.h"
-#include "vorbis/mode_E.h"
+#include "modes/mode_A.h"
+#include "modes/mode_B.h"
+#include "modes/mode_C.h"
+#include "modes/mode_D.h"
+#include "modes/mode_E.h"
 
 #endif
index 97e1bf3..0d58d7c 100644 (file)
--- a/lib/os.h
+++ b/lib/os.h
@@ -2,23 +2,25 @@
 #define _OS_H
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.10 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: os.h,v 1.11 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
 #include <math.h>
+#include <ogg/os_types.h>
+
 #ifndef _V_IFDEFJAIL_H_
 #define _V_IFDEFJAIL_H_
 
 #  define max(x,y)  ((x)<(y)?(y):(x))
 #endif
 
+
+#if defined(__i386__) && defined(__GNUC__)
+
+/* both GCC and MSVC are kinda stupid about rounding/casting to int.
+   Because of encapsulation constraints (GCC can't see inside the asm
+   block and so we end up doing stupid things like a store/load that
+   is collectively a noop), we do it this way */
+
+/* we must set up the fpu before this works!! */
+
+typedef ogg_int16_t vorbis_fpu_control;
+
+static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
+  ogg_int16_t ret;
+  ogg_int16_t temp;
+  __asm__ __volatile__("fnstcw %0\n\t"
+         "movw %0,%%dx\n\t"
+         "orw $62463,%%dx\n\t"
+         "movw %%dx,%1\n\t"
+         "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
+  *fpu=ret;
+}
+
+static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
+  __asm__ __volatile__("fldcw %0":: "m"(fpu));
+}
+
+/* assumes the FPU is in round mode! */
+static inline int vorbis_ftoi(double f){  /* yes, double!  Otherwise,
+                                             we get extra fst/fld to
+                                             truncate precision */
+  int i;
+  __asm__("fistl %0": "=m"(i) : "t"(f));
+  return(i);
+}
+
+#else
+
+static int vorbis_ftoi(double f){
+  return (int)(f+.5);
+}
+
+
+typedef int vorbis_fpu_control;
+
+static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
+}
+
+static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
+}
+
+#endif
+
 #endif /* _OS_H */
index 3312f81..19f978a 100644 (file)
--- a/lib/psy.c
+++ b/lib/psy.c
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.29 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.30 2000/11/06 00:07:01 xiphmont Exp $
 
  ********************************************************************/
 
@@ -41,6 +41,12 @@ void _vi_psy_free(vorbis_info_psy *i){
   }
 }
 
+vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){
+  vorbis_info_psy *ret=_ogg_malloc(sizeof(vorbis_info_psy));
+  memcpy(ret,i,sizeof(vorbis_info_psy));
+  return(ret);
+}
+
 /* Set up decibel threshhold slopes on a Bark frequency scale */
 /* ATH is the only bit left on a Bark scale.  No reason to change it
    right now */
@@ -172,9 +178,9 @@ static void setup_curve(float **c,
 void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
   long i,j;
   memset(p,0,sizeof(vorbis_look_psy));
-  p->ath=malloc(n*sizeof(float));
-  p->octave=malloc(n*sizeof(int));
-  p->bark=malloc(n*sizeof(float));
+  p->ath=_ogg_malloc(n*sizeof(float));
+  p->octave=_ogg_malloc(n*sizeof(int));
+  p->bark=_ogg_malloc(n*sizeof(float));
   p->vi=vi;
   p->n=n;
 
@@ -193,18 +199,18 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
     p->octave[i]=oc;
   }  
 
-  p->tonecurves=malloc(P_BANDS*sizeof(float **));
-  p->noiseatt=malloc(P_BANDS*sizeof(float **));
-  p->peakatt=malloc(P_BANDS*sizeof(float *));
+  p->tonecurves=_ogg_malloc(P_BANDS*sizeof(float **));
+  p->noiseatt=_ogg_malloc(P_BANDS*sizeof(float **));
+  p->peakatt=_ogg_malloc(P_BANDS*sizeof(float *));
   for(i=0;i<P_BANDS;i++){
-    p->tonecurves[i]=malloc(P_LEVELS*sizeof(float *));
-    p->noiseatt[i]=malloc(P_LEVELS*sizeof(float));
-    p->peakatt[i]=malloc(P_LEVELS*sizeof(float));
+    p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(float *));
+    p->noiseatt[i]=_ogg_malloc(P_LEVELS*sizeof(float));
+    p->peakatt[i]=_ogg_malloc(P_LEVELS*sizeof(float));
   }
 
   for(i=0;i<P_BANDS;i++)
     for(j=0;j<P_LEVELS;j++){
-      p->tonecurves[i][j]=malloc(EHMER_MAX*sizeof(float));
+      p->tonecurves[i][j]=_ogg_malloc(EHMER_MAX*sizeof(float));
     }
 
   /* OK, yeah, this was a silly way to do it */
index ba2596d..1ee9d8c 100644 (file)
--- a/lib/psy.h
+++ b/lib/psy.h
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.15 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.16 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
 #define EHMER_MAX 56
 #endif
 
+/* psychoacoustic setup ********************************************/
+#define MAX_BARK 27
+#define P_BANDS 17
+#define P_LEVELS 11
+typedef struct vorbis_info_psy{
+  int    athp;
+  int    decayp;
+  int    smoothp;
+
+  int    noisecullp;
+  float noisecull_barkwidth;
+
+  float ath_adjatt;
+  float ath_maxatt;
+
+  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
+  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
+  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+
+  int tonemaskp;
+  float toneatt[P_BANDS][P_LEVELS];
+
+  int peakattp;
+  float peakatt[P_BANDS][P_LEVELS];
+
+  int noisemaskp;
+  float noiseatt[P_BANDS][P_LEVELS];
+
+  float max_curve_dB;
+
+  /* decay setup */
+  float attack_coeff;
+  float decay_coeff;
+} vorbis_info_psy;
+
 typedef struct {
   int n;
   struct vorbis_info_psy *vi;
@@ -41,7 +76,10 @@ typedef struct {
 extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
 extern void   _vp_psy_clear(vorbis_look_psy *p);
 extern void  *_vi_psy_dup(void *source);
+
 extern void   _vi_psy_free(vorbis_info_psy *i);
+extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
+
 extern void   _vp_compute_mask(vorbis_look_psy *p,float *f, 
                               float *floor,
                               float *decay);
index 9a467f2..a70bac5 100644 (file)
@@ -1,19 +1,19 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: simple utility that runs audio through the psychoacoustics
            without encoding
- last mod: $Id: psytune.c,v 1.7 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.8 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
@@ -163,7 +163,7 @@ static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){
 
   scale=look->ln/toBARK(22050.);
 
-  look->linearmap=malloc(look->n*sizeof(int));
+  look->linearmap=_ogg_malloc(look->n*sizeof(int));
   for(j=0;j<look->n;j++){
     int val=floor( toBARK(22050./n*j) *scale);
     if(val>look->ln)val=look->ln;
@@ -230,15 +230,15 @@ int main(int argc,char *argv[]){
     argv++;
   }
   
-  pcm[0]=malloc(framesize*sizeof(float));
-  pcm[1]=malloc(framesize*sizeof(float));
-  out[0]=calloc(framesize/2,sizeof(float));
-  out[1]=calloc(framesize/2,sizeof(float));
-  decay[0]=calloc(framesize/2,sizeof(float));
-  decay[1]=calloc(framesize/2,sizeof(float));
-  floor=malloc(framesize*sizeof(float));
-  lpc=malloc(order*sizeof(float));
-  buffer=malloc(framesize*4);
+  pcm[0]=_ogg_malloc(framesize*sizeof(float));
+  pcm[1]=_ogg_malloc(framesize*sizeof(float));
+  out[0]=_ogg_calloc(framesize/2,sizeof(float));
+  out[1]=_ogg_calloc(framesize/2,sizeof(float));
+  decay[0]=_ogg_calloc(framesize/2,sizeof(float));
+  decay[1]=_ogg_calloc(framesize/2,sizeof(float));
+  floor=_ogg_malloc(framesize*sizeof(float));
+  lpc=_ogg_malloc(order*sizeof(float));
+  buffer=_ogg_malloc(framesize*4);
   buffer2=buffer+framesize*2;
   window=_vorbis_window(0,framesize,framesize/2,framesize/2);
   mdct_init(&m_look,framesize);
index 8e3d661..7ce849e 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.3 2000/03/10 13:21:18 xiphmont Exp $
+ last mod: $Id: registry.c,v 1.4 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
index 7a13160..4040aaf 100644 (file)
@@ -1,24 +1,26 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.2 2000/01/22 13:28:30 xiphmont Exp $
+ last mod: $Id: registry.h,v 1.3 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
 #ifndef _V_REG_H_
 #define _V_REG_H_
 
+#include "backends.h"
+
 #define VI_TRANSFORMB 1
 #define VI_WINDOWB 1
 #define VI_TIMEB 1
index d6122eb..95c14fb 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: residue backend 0 implementation
- last mod: $Id: res0.c,v 1.18 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.19 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,9 +27,9 @@
 #include <stdio.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
-#include "bookinternal.h"
-#include "sharedbook.h"
+#include "codebook.h"
 #include "misc.h"
 #include "os.h"
 
@@ -45,6 +45,13 @@ typedef struct {
   int       **decodemap;
 } vorbis_look_residue0;
 
+vorbis_info_residue *res0_copy_info(vorbis_info_residue *vr){
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+  vorbis_info_residue0 *ret=_ogg_malloc(sizeof(vorbis_info_residue0));
+  memcpy(ret,info,sizeof(vorbis_info_residue0));
+  return(ret);
+}
+
 void res0_free_info(vorbis_info_residue *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_residue0));
@@ -89,7 +96,8 @@ void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){
 /* vorbis_info is for range checking */
 vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int j,acc=0;
-  vorbis_info_residue0 *info=calloc(1,sizeof(vorbis_info_residue0));
+  vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(vorbis_info_residue0));
+  codec_setup_info     *ci=vi->codec_setup;
 
   info->begin=oggpack_read(opb,24);
   info->end=oggpack_read(opb,24);
@@ -106,9 +114,9 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   for(j=0;j<acc;j++)
     info->booklist[j]=oggpack_read(opb,8);
 
-  if(info->groupbook>=vi->books)goto errout;
+  if(info->groupbook>=ci->books)goto errout;
   for(j=0;j<acc;j++)
-    if(info->booklist[j]>=vi->books)goto errout;
+    if(info->booklist[j]>=ci->books)goto errout;
 
   return(info);
  errout:
@@ -119,33 +127,35 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
 vorbis_look_residue *res0_look (vorbis_dsp_state *vd,vorbis_info_mode *vm,
                          vorbis_info_residue *vr){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
-  vorbis_look_residue0 *look=calloc(1,sizeof(vorbis_look_residue0));
+  vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(vorbis_look_residue0));
+  backend_lookup_state *be=vd->backend_state;
+
   int j,k,acc=0;
   int dim;
   look->info=info;
   look->map=vm->mapping;
 
   look->parts=info->partitions;
-  look->phrasebook=vd->fullbooks+info->groupbook;
+  look->phrasebook=be->fullbooks+info->groupbook;
   dim=look->phrasebook->dim;
 
-  look->partbooks=calloc(look->parts,sizeof(codebook **));
+  look->partbooks=_ogg_calloc(look->parts,sizeof(codebook **));
 
   for(j=0;j<look->parts;j++){
     int stages=info->secondstages[j];
     if(stages){
-      look->partbooks[j]=malloc(stages*sizeof(codebook *));
+      look->partbooks[j]=_ogg_malloc(stages*sizeof(codebook *));
       for(k=0;k<stages;k++)
-       look->partbooks[j][k]=vd->fullbooks+info->booklist[acc++];
+       look->partbooks[j][k]=be->fullbooks+info->booklist[acc++];
     }
   }
 
   look->partvals=rint(pow(look->parts,dim));
-  look->decodemap=malloc(look->partvals*sizeof(int *));
+  look->decodemap=_ogg_malloc(look->partvals*sizeof(int *));
   for(j=0;j<look->partvals;j++){
     long val=j;
     long mult=look->partvals/look->parts;
-    look->decodemap[j]=malloc(dim*sizeof(int));
+    look->decodemap[j]=_ogg_malloc(dim*sizeof(int));
     for(k=0;k<dim;k++){
       long deco=val/mult;
       val-=deco*mult;
@@ -380,6 +390,7 @@ vorbis_func_residue residue0_exportbundle={
   &res0_pack,
   &res0_unpack,
   &res0_look,
+  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
   &res0_forward,
index 9d48ebb..6bd28df 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h,v 1.6 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: scales.h,v 1.7 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
index 4dc8d4e..f2e7f63 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.9 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.10 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,9 +22,8 @@
 #include <ogg/ogg.h>
 #include "os.h"
 #include "vorbis/codec.h"
-#include "vorbis/codebook.h"
+#include "codebook.h"
 #include "scales.h"
-#include "sharedbook.h"
 
 /**** pack/unpack helpers ******************************************/
 int _ilog(unsigned int v){
@@ -74,7 +73,7 @@ float _float32_unpack(long val){
 long *_make_words(long *l,long n){
   long i,j;
   long marker[33];
-  long *r=malloc(n*sizeof(long));
+  long *r=_ogg_malloc(n*sizeof(long));
   memset(marker,0,sizeof(marker));
 
   for(i=0;i<n;i++){
@@ -143,9 +142,9 @@ long *_make_words(long *l,long n){
 decode_aux *_make_decode_tree(codebook *c){
   const static_codebook *s=c->c;
   long top=0,i,j,n;
-  decode_aux *t=malloc(sizeof(decode_aux));
-  long *ptr0=t->ptr0=calloc(c->entries*2,sizeof(long));
-  long *ptr1=t->ptr1=calloc(c->entries*2,sizeof(long));
+  decode_aux *t=_ogg_malloc(sizeof(decode_aux));
+  long *ptr0=t->ptr0=_ogg_calloc(c->entries*2,sizeof(long));
+  long *ptr1=t->ptr1=_ogg_calloc(c->entries*2,sizeof(long));
   long *codelist=_make_words(s->lengthlist,s->entries);
 
   if(codelist==NULL)return(NULL);
@@ -177,8 +176,8 @@ decode_aux *_make_decode_tree(codebook *c){
   t->tabn = _ilog(c->entries)-4; /* this is magic */
   if(t->tabn<5)t->tabn=5;
   n = 1<<t->tabn;
-  t->tab = malloc(n*sizeof(long));
-  t->tabl = malloc(n*sizeof(int));
+  t->tab = _ogg_malloc(n*sizeof(long));
+  t->tabl = _ogg_malloc(n*sizeof(int));
   for (i = 0; i < n; i++) {
     long p = 0;
     for (j = 0; j < t->tabn && (p > 0 || j == 0); j++) {
@@ -237,7 +236,7 @@ float *_book_unquantize(const static_codebook *b){
     int quantvals;
     float mindel=_float32_unpack(b->q_min);
     float delta=_float32_unpack(b->q_delta);
-    float *r=calloc(b->entries*b->dim,sizeof(float));
+    float *r=_ogg_calloc(b->entries*b->dim,sizeof(float));
 
     /* maptype 1 and 2 both use a quantized value vector, but
        different sizes */
@@ -281,23 +280,33 @@ float *_book_unquantize(const static_codebook *b){
 }
 
 void vorbis_staticbook_clear(static_codebook *b){
-  if(b->quantlist)free(b->quantlist);
-  if(b->lengthlist)free(b->lengthlist);
-  if(b->nearest_tree){
-    free(b->nearest_tree->ptr0);
-    free(b->nearest_tree->ptr1);
-    free(b->nearest_tree->p);
-    free(b->nearest_tree->q);
-    memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch));
-    free(b->nearest_tree);
+  if(b->allocedp){
+    if(b->quantlist)free(b->quantlist);
+    if(b->lengthlist)free(b->lengthlist);
+    if(b->nearest_tree){
+      free(b->nearest_tree->ptr0);
+      free(b->nearest_tree->ptr1);
+      free(b->nearest_tree->p);
+      free(b->nearest_tree->q);
+      memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch));
+      free(b->nearest_tree);
+    }
+    if(b->thresh_tree){
+      free(b->thresh_tree->quantthresh);
+      free(b->thresh_tree->quantmap);
+      memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch));
+      free(b->thresh_tree);
+    }
+
+    memset(b,0,sizeof(static_codebook));
   }
-  if(b->thresh_tree){
-    free(b->thresh_tree->quantthresh);
-    free(b->thresh_tree->quantmap);
-    memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch));
-    free(b->thresh_tree);
+}
+
+void vorbis_staticbook_destroy(static_codebook *b){
+  if(b->allocedp){
+    vorbis_staticbook_clear(b);
+    free(b);
   }
-  memset(b,0,sizeof(static_codebook));
 }
 
 void vorbis_book_clear(codebook *b){
diff --git a/lib/sharedbook.h b/lib/sharedbook.h
deleted file mode 100644 (file)
index aeb8256..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
- *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
- * http://www.xiph.org/                                             *
- *                                                                  *
- ********************************************************************
-
- function: basic shared codebook operations
- last mod: $Id: sharedbook.h,v 1.3 2000/10/12 03:12:54 xiphmont Exp $
-
- ********************************************************************/
-
-#ifndef _V_INT_SHCODEBOOK_H_
-#define _V_INT_SHCODEBOOK_H_
-
-#include "vorbis/codebook.h"
-
-extern void vorbis_staticbook_clear(static_codebook *b);
-extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
-extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
-extern void vorbis_book_clear(codebook *b);
-
-extern float *_book_unquantize(const static_codebook *b);
-extern float *_book_logdist(const static_codebook *b,float *vals);
-extern float _float32_unpack(long val);
-extern long   _float32_pack(float val);
-extern int  _best(codebook *book, float *a, int step);
-extern int _ilog(unsigned int v);
-extern long _book_maptype1_quantvals(const static_codebook *b);
-
-extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
-extern long vorbis_book_codeword(codebook *book,int entry);
-extern long vorbis_book_codelen(codebook *book,int entry);
-
-
-
-#endif
index 492ac37..da670eb 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.9 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: smallft.c,v 1.10 2000/11/06 00:07:02 xiphmont Exp $
 
 ********************************************************************/
 
@@ -1241,8 +1241,8 @@ void drft_backward(drft_lookup *l,float *data){
 
 void drft_init(drft_lookup *l,int n){
   l->n=n;
-  l->trigcache=calloc(3*n,sizeof(float));
-  l->splitcache=calloc(32,sizeof(int));
+  l->trigcache=_ogg_calloc(3*n,sizeof(float));
+  l->splitcache=_ogg_calloc(32,sizeof(int));
   fdrffti(n, l->trigcache, l->splitcache);
 }
 
index 5132772..9bccafb 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: fft transform
- last mod: $Id: smallft.h,v 1.7 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: smallft.h,v 1.8 2000/11/06 00:07:02 xiphmont Exp $
 
 ********************************************************************/
 
index e8aae23..31249dd 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.18 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.19 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
 #include "os.h"
 
 int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
-  vorbis_dsp_state *vd=vb->vd;
-  vorbis_info      *vi=vd->vi;
-  oggpack_buffer   *opb=&vb->opb;
-  int              type,mode,i;
+  vorbis_dsp_state     *vd=vb->vd;
+  backend_lookup_state *b=vd->backend_state;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  oggpack_buffer       *opb=&vb->opb;
+  int                   type,mode,i;
  
   /* first things first.  Make sure decode is ready */
   _vorbis_block_ripcord(vb);
@@ -36,19 +38,19 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
   /* Check the packet type */
   if(oggpack_read(opb,1)!=0){
     /* Oops.  This is not an audio data packet */
-    return(-1);
+    return(OV_ENOTAUDIO);
   }
 
   /* read our mode and pre/post windowsize */
-  mode=oggpack_read(opb,vd->modebits);
-  if(mode==-1)return(-1);
+  mode=oggpack_read(opb,b->modebits);
+  if(mode==-1)return(OV_EBADPACKET);
   
   vb->mode=mode;
-  vb->W=vi->mode_param[mode]->blockflag;
+  vb->W=ci->mode_param[mode]->blockflag;
   if(vb->W){
     vb->lW=oggpack_read(opb,1);
     vb->nW=oggpack_read(opb,1);
-    if(vb->nW==-1)   return(-1);
+    if(vb->nW==-1)   return(OV_EBADPACKET);
   }else{
     vb->lW=0;
     vb->nW=0;
@@ -60,15 +62,15 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
   vb->eofflag=op->e_o_s;
 
   /* alloc pcm passback storage */
-  vb->pcmend=vi->blocksizes[vb->W];
+  vb->pcmend=ci->blocksizes[vb->W];
   vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
   for(i=0;i<vi->channels;i++)
     vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
 
   /* unpack_header enforces range checking */
-  type=vi->map_type[vi->mode_param[mode]->mapping];
+  type=ci->map_type[ci->mode_param[mode]->mapping];
 
-  return(_mapping_P[type]->inverse(vb,vd->mode[mode]));
+  return(_mapping_P[type]->inverse(vb,b->mode[mode]));
 }
 
 
index 8f48670..4d1f88e 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: time backend 0 (dummy)
- last mod: $Id: time0.c,v 1.6 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: time0.c,v 1.7 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
@@ -28,6 +28,9 @@ static vorbis_info_time *time0_unpack (vorbis_info *vi,oggpack_buffer *opb){
   return "";
 
 }
+static vorbis_info_time *time0_copy_info (vorbis_info_time *vi){
+  return "";
+}
 static vorbis_look_time *time0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
                               vorbis_info_time *i){
   return "";
@@ -47,6 +50,6 @@ static int time0_inverse(vorbis_block *vb,vorbis_look_time *i,
 
 /* export hooks */
 vorbis_func_time time0_exportbundle={
-  &time0_pack,&time0_unpack,&time0_look,&time0_free_info,
+  &time0_pack,&time0_unpack,&time0_look,&time0_copy_info,&time0_free_info,
   &time0_free_look,&time0_forward,&time0_inverse
 };
diff --git a/lib/vorbis-errors.txt b/lib/vorbis-errors.txt
new file mode 100644 (file)
index 0000000..1350ed0
--- /dev/null
@@ -0,0 +1,83 @@
+All 'failure' style returns are <0; this either indicates a generic
+'false' value (eg, ready?  T or F) or an error condition.  Code can
+safely just test for < 0, or look at the specific return code for more
+detail.
+
+---------- (internal calls) ------------
+
+
+long _get_next_page()
+    OV_FALSE, OV_EOF, OV_EREAD 
+
+long _get_prev_page()
+    OV_EREAD, OV_FAULT
+
+int _bisect_forward_serialno()
+    OV_EREAD
+
+int _fetch_headers()
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER
+
+int _open_seekable()    
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER, OV_FAULT
+       + ov_raw_seek
+
+int _open_nonseekable()
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER
+
+int _process_packet()
+    OV_EOF, OV_HOLE, OV_EBADLINK
+
+---------- public calls ------------
+
+int vorbis_analysis_headerout()
+    OV_EIMPL
+
+int vorbis_analysis_wrote()
+    OV_EINVAL
+
+int vorbis_synthesis_headerin()
+    OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER
+
+int vorbis_synthesis()
+    OV_ENOTAUDIO, OV_EBADPACKET
+
+int vorbis_synthesis_read()
+    OV_EINVAL
+
+int ov_open_callbacks()   
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER, OV_FAULT
+
+int ov_open()
+    OV_EREAD, OV_ENOTVORBIS, OV_EVERSION, OV_EBADHEADER, OV_FAULT
+
+long ov_bitrate()
+    OV_EINVAL, OV_FALSE
+
+long ov_bitrate_instant()
+    OV_FALSE
+
+ogg_int64_t ov_raw_total()
+    OV_EINVAL
+
+ogg_int64_t ov_pcm_total()
+    OV_EINVAL
+
+double ov_time_total()
+    OV_EINVAL
+
+int ov_raw_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_BADLINK
+
+int ov_pcm_seek_page()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_pcm_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_time_seek()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
+int ov_time_seek_page()
+    OV_ENOSEEK, OV_EINVAL, OV_EREAD, OV_BADLINK, OV_FAULT
+
diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c
new file mode 100644 (file)
index 0000000..4b0ab25
--- /dev/null
@@ -0,0 +1,154 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
+ * http://www.xiph.org/                                             *
+ *                                                                  *
+ ********************************************************************
+
+ function: simple programmatic interface for encoder mode setup
+ last mod: $Id: vorbisenc.c,v 1.2 2000/11/06 00:07:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "vorbis/codec.h"
+#include "vorbis/vorbisenc.h"
+
+#include "codec_internal.h"
+#include "registry.h"
+#include "modes/modes.h"
+
+#include "os.h"
+#include "misc.h"
+
+
+/* deepcopy all but the codebooks; in this usage, they're static
+   (don't copy as they could be big) */
+static void codec_setup_partialcopy(codec_setup_info *ci,
+                                codec_setup_info *cs){
+  int i;
+
+  memcpy(ci,cs,sizeof(codec_setup_info)); /* to get the flat numbers */
+
+  /* codebooks */
+  for(i=0;i<ci->books;i++){
+    ci->book_param[i]=cs->book_param[i];
+  }
+
+  /* time backend settings */
+  for(i=0;i<ci->times;i++){
+    ci->time_param[i]=_time_P[ci->time_type[i]]->
+      copy_info(cs->time_param[i]);
+  }
+
+  /* floor backend settings */
+  for(i=0;i<ci->floors;i++){
+    ci->floor_param[i]=_floor_P[ci->floor_type[i]]->
+      copy_info(cs->floor_param[i]);
+  }
+
+  /* residue backend settings */
+  for(i=0;i<ci->residues;i++){
+    ci->residue_param[i]=_residue_P[ci->residue_type[i]]->
+      copy_info(cs->residue_param[i]);
+  }
+
+  /* map backend settings */
+  for(i=0;i<ci->maps;i++){
+    ci->map_param[i]=_mapping_P[ci->map_type[i]]->
+      copy_info(cs->map_param[i]);
+  }
+  
+  /* mode settings */
+  for(i=0;i<ci->modes;i++){
+    ci->mode_param[i]=_ogg_calloc(1,sizeof(vorbis_info_mode));
+    ci->mode_param[i]->blockflag=cs->mode_param[i]->blockflag;
+    ci->mode_param[i]->windowtype=cs->mode_param[i]->windowtype;
+    ci->mode_param[i]->transformtype=cs->mode_param[i]->transformtype;
+    ci->mode_param[i]->mapping=cs->mode_param[i]->mapping;
+  }
+
+  /* psy settings */
+  for(i=0;i<ci->psys;i++){
+    ci->psy_param[i]=_vi_psy_copy(cs->psy_param[i]);
+  }
+
+}
+
+/* right now, this just encapsultes the old modes behind the interface
+   we'll be using from here on out.  After beta 3, the new bitrate
+   tracking/modding/tuning engine will lurk inside */
+/* encoders will need to use vorbis_info_init beforehand and call
+   vorbis_info clear when all done */
+
+int vorbis_encode_init(vorbis_info *vi,
+                      long channels,
+                      long rate,
+
+                      long max_bitrate,
+                      long nominal_bitrate,
+                      long min_bitrate){
+
+  long bpch;
+  int i,j;
+  codec_setup_info *ci=vi->codec_setup;
+  codec_setup_info *mode=NULL;
+  if(!ci)return(OV_EFAULT);
+
+  vi->version=0;
+  vi->channels=channels;
+  vi->rate=rate;
+  
+  vi->bitrate_upper=max_bitrate;
+  vi->bitrate_nominal=nominal_bitrate;
+  vi->bitrate_lower=min_bitrate;
+  vi->bitrate_window=2;
+
+  /* copy a mode into our allocated storage */
+  bpch=nominal_bitrate/channels;
+  if(bpch<75000){
+    /* mode A */
+    mode=&info_A;
+  }else if(bpch<90000){
+    /* mode B */
+    mode=&info_B;
+  }else if(bpch<110000){
+    /* mode C */
+    mode=&info_C;
+  }else if(bpch<160000){
+    /* mode D */
+    mode=&info_D;
+  }else{
+    /* mode E */
+    mode=&info_E;
+  }
+
+  /* now we have to deepcopy */
+  codec_setup_partialcopy(ci,mode);
+
+  /* adjust for sample rate */
+  for(i=0;i<ci->floors;i++)
+    ((vorbis_info_floor0 *)(ci->floor_param[i]))->rate=rate;
+
+  /* adjust for channels; all our mappings use submap zero now */
+  /* yeah, OK, _ogg_calloc did this for us.  But it's a reminder/placeholder */
+  for(i=0;i<ci->maps;i++)
+    for(j=0;j<channels;j++)
+      ((vorbis_info_mapping0 *)ci->map_param[i])->chmuxlist[j]=0;
+
+  return(0);
+}
+
+int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){
+  return(OV_EIMPL);
+}
+                      
index 0801596..3750cc0 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.30 2000/10/13 19:48:03 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.31 2000/11/06 00:07:02 xiphmont Exp $
 
  ********************************************************************/
 
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
-#include <assert.h>
 
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"
@@ -62,7 +61,7 @@
 static long _get_data(OggVorbis_File *vf){
   char *buffer=ogg_sync_buffer(&vf->oy,CHUNKSIZE);
   long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
-  ogg_sync_wrote(&vf->oy,bytes);
+  if(bytes>0)ogg_sync_wrote(&vf->oy,bytes);
   return(bytes);
 }
 
@@ -83,7 +82,7 @@ static void _seek_helper(OggVorbis_File *vf,long offset){
               0) read no additional data; use cached only
              n) search for a new page beginning for n bytes
 
-   return:   -1) did not find a page 
+   return:   <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)
               n) found a page at absolute offset n */
 
 static long _get_next_page(OggVorbis_File *vf,ogg_page *og,int boundary){
@@ -91,7 +90,7 @@ static long _get_next_page(OggVorbis_File *vf,ogg_page *og,int boundary){
   while(1){
     long more;
 
-    if(boundary>0 && vf->offset>=boundary)return(-1);
+    if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
     more=ogg_sync_pageseek(&vf->oy,og);
     
     if(more<0){
@@ -100,8 +99,12 @@ static long _get_next_page(OggVorbis_File *vf,ogg_page *og,int boundary){
     }else{
       if(more==0){
        /* send more paramedics */
-       if(!boundary)return(-1);
-       if(_get_data(vf)<=0)return(-1);
+       if(!boundary)return(OV_FALSE);
+       {
+         long ret=_get_data(vf);
+         if(ret==0)return(OV_EOF);
+         if(ret<0)return(OV_EREAD);
+       }
       }else{
        /* got a page.  Return the offset at the page beginning,
            advance the internal offset past the page end */
@@ -118,6 +121,7 @@ static long _get_next_page(OggVorbis_File *vf,ogg_page *og,int boundary){
    position. Much dirtier than the above as Ogg doesn't have any
    backward search linkage.  no 'readp' as it will certainly have to
    read. */
+/* returns offset or OV_EREAD, OV_FAULT */
 static long _get_prev_page(OggVorbis_File *vf,ogg_page *og){
   long begin=vf->offset;
   long ret;
@@ -128,7 +132,8 @@ static long _get_prev_page(OggVorbis_File *vf,ogg_page *og){
     _seek_helper(vf,begin);
     while(vf->offset<begin+CHUNKSIZE){
       ret=_get_next_page(vf,og,begin+CHUNKSIZE-vf->offset);
-      if(ret==-1){
+      if(ret==OV_EREAD)return(OV_EREAD);
+      if(ret<0){
        break;
       }else{
        offset=ret;
@@ -139,12 +144,10 @@ static long _get_prev_page(OggVorbis_File *vf,ogg_page *og){
   /* we have the offset.  Actually snork and hold the page now */
   _seek_helper(vf,offset);
   ret=_get_next_page(vf,og,CHUNKSIZE);
-  if(ret==-1){
+  if(ret<0)
     /* this shouldn't be possible */
-    fprintf(stderr,"Missed page fencepost at end of logical bitstream. "
-           "Exiting.\n");
-    exit(1);
-  }
+    return(OV_EFAULT);
+
   return(offset);
 }
 
@@ -152,12 +155,12 @@ static long _get_prev_page(OggVorbis_File *vf,ogg_page *og){
    (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
    finding them all, then unroll and fill the cache at the same time */
-static void _bisect_forward_serialno(OggVorbis_File *vf,
-                                    long begin,
-                                    long searched,
-                                    long end,
-                                    long currentno,
-                                    long m){
+static int _bisect_forward_serialno(OggVorbis_File *vf,
+                                   long begin,
+                                   long searched,
+                                   long end,
+                                   long currentno,
+                                   long m){
   long endsearched=end;
   long next=end;
   ogg_page og;
@@ -176,6 +179,7 @@ static void _bisect_forward_serialno(OggVorbis_File *vf,
     
     _seek_helper(vf,bisect);
     ret=_get_next_page(vf,&og,-1);
+    if(ret==OV_EREAD)return(OV_EREAD);
     if(ret<0 || ogg_page_serialno(&og)!=currentno){
       endsearched=bisect;
       if(ret>=0)next=ret;
@@ -186,17 +190,20 @@ static void _bisect_forward_serialno(OggVorbis_File *vf,
 
   _seek_helper(vf,next);
   ret=_get_next_page(vf,&og,-1);
+  if(ret==OV_EREAD)return(OV_EREAD);
   
-  if(searched>=end || ret==-1){
+  if(searched>=end || ret<0){
     vf->links=m+1;
-    vf->offsets=malloc((m+2)*sizeof(ogg_int64_t));
+    vf->offsets=_ogg_malloc((m+2)*sizeof(ogg_int64_t));
     vf->offsets[m+1]=searched;
   }else{
-    _bisect_forward_serialno(vf,next,vf->offset,
-                            end,ogg_page_serialno(&og),m+1);
+    ret=_bisect_forward_serialno(vf,next,vf->offset,
+                                end,ogg_page_serialno(&og),m+1);
+    if(ret==OV_EREAD)return(OV_EREAD);
   }
   
   vf->offsets[m]=begin;
+  return(0);
 }
 
 /* uses the local ogg_stream storage in vf; this is important for
@@ -205,14 +212,12 @@ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc,
                          long *serialno,ogg_page *og_ptr){
   ogg_page og;
   ogg_packet op;
-  int i,ret;
+  int i,ret=0;
   
   if(!og_ptr){
     ret=_get_next_page(vf,&og,CHUNKSIZE);
-    if(ret==-1){
-      fprintf(stderr,"Did not find initial header for bitstream.\n");
-      return -1;
-    }
+    if(ret==OV_EREAD)return(OV_EREAD);
+    if(ret<0)return OV_ENOTVORBIS;
     og_ptr=&og;
   }
 
@@ -232,18 +237,17 @@ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc,
       int result=ogg_stream_packetout(&vf->os,&op);
       if(result==0)break;
       if(result==-1){
-       fprintf(stderr,"Corrupt header in logical bitstream.\n");
+       ret=OV_EBADHEADER;
        goto bail_header;
       }
-      if(vorbis_synthesis_headerin(vi,vc,&op)){
-       fprintf(stderr,"Illegal header in logical bitstream.\n");
+      if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
        goto bail_header;
       }
       i++;
     }
     if(i<3)
       if(_get_next_page(vf,og_ptr,1)<0){
-       fprintf(stderr,"Missing header in logical bitstream.\n");
+       ret=OV_EBADHEADER;
        goto bail_header;
       }
   }
@@ -253,24 +257,29 @@ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc,
   vorbis_info_clear(vi);
   vorbis_comment_clear(vc);
   ogg_stream_clear(&vf->os);
-  return -1;
+  return ret;
 }
 
 /* last step of the OggVorbis_File initialization; get all the
    vorbis_info structs and PCM positions.  Only called by the seekable
    initialization (local stream storage is hacked slightly; pay
    attention to how that's done) */
+
+/* this is void and does not propogate errors up because we want to be
+   able to open and use damaged bitstreams as well as we can.  Just
+   watch out for missing information for links in the OggVorbis_File
+   struct */
 static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i,
                                  vorbis_comment *first_c,
                                  long dataoffset){
   ogg_page og;
   int i,ret;
   
-  vf->vi=calloc(vf->links,sizeof(vorbis_info));
-  vf->vc=calloc(vf->links,sizeof(vorbis_info));
-  vf->dataoffsets=malloc(vf->links*sizeof(ogg_int64_t));
-  vf->pcmlengths=malloc(vf->links*sizeof(ogg_int64_t));
-  vf->serialnos=malloc(vf->links*sizeof(long));
+  vf->vi=_ogg_calloc(vf->links,sizeof(vorbis_info));
+  vf->vc=_ogg_calloc(vf->links,sizeof(vorbis_info));
+  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(ogg_int64_t));
+  vf->pcmlengths=_ogg_malloc(vf->links*sizeof(ogg_int64_t));
+  vf->serialnos=_ogg_malloc(vf->links*sizeof(long));
   
   for(i=0;i<vf->links;i++){
     if(first_i && first_c && i==0){
@@ -284,8 +293,7 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i,
       /* 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)==-1){
-       fprintf(stderr,"Error opening logical bitstream #%d.\n\n",i+1);
+      if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
        vf->dataoffsets[i]=-1;
       }else{
        vf->dataoffsets[i]=vf->offset;
@@ -301,10 +309,8 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i,
 
       while(1){
        ret=_get_prev_page(vf,&og);
-       if(ret==-1){
-         /* this should not be possible */
-         fprintf(stderr,"Could not find last page of logical "
-                 "bitstream #%d\n\n",i);
+       if(ret<0){
+         /* this should not be possible, actually */
          vorbis_info_clear(vf->vi+i);
          vorbis_comment_clear(vf->vc+i);
          break;
@@ -319,8 +325,8 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i,
   }
 }
 
-static int _make_decode_ready(OggVorbis_File *vf){
-  if(vf->decode_ready)exit(1);
+static void _make_decode_ready(OggVorbis_File *vf){
+  if(vf->decode_ready)return;
   if(vf->seekable){
     vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
   }else{
@@ -328,7 +334,7 @@ static int _make_decode_ready(OggVorbis_File *vf){
   }    
   vorbis_block_init(&vf->vd,&vf->vb);
   vf->decode_ready=1;
-  return(0);
+  return;
 }
 
 static int _open_seekable(OggVorbis_File *vf){
@@ -343,7 +349,7 @@ static int _open_seekable(OggVorbis_File *vf){
   ret=_fetch_headers(vf,&initial_i,&initial_c,&serialno,NULL);
   dataoffset=vf->offset;
   ogg_stream_clear(&vf->os);
-  if(ret==-1)return(-1);
+  if(ret<0)return(ret);
   
   /* we can seek, so set out learning all about this file */
   vf->seekable=1;
@@ -353,18 +359,28 @@ static int _open_seekable(OggVorbis_File *vf){
   /* 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){
+    ogg_stream_clear(&vf->os);
+    return(end);
+  }
 
-  /* moer than one logical bitstream? */
+  /* more than one logical bitstream? */
   if(ogg_page_serialno(&og)!=serialno){
 
     /* Chained bitstream. Bisect-search each logical bitstream
        section.  Do so based on serial number only */
-    _bisect_forward_serialno(vf,0,0,end+1,serialno,0);
+    if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0){
+      ogg_stream_clear(&vf->os);
+      return(OV_EREAD);
+    }
 
   }else{
 
     /* Only one logical bitstream */
-    _bisect_forward_serialno(vf,0,end,end+1,serialno,0);
+    if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0)){
+      ogg_stream_clear(&vf->os);
+      return(OV_EREAD);
+    }
 
   }
 
@@ -374,13 +390,15 @@ static int _open_seekable(OggVorbis_File *vf){
 }
 
 static int _open_nonseekable(OggVorbis_File *vf){
+  int ret;
   /* we cannot seek. Set up a 'single' (current) logical bitstream entry  */
   vf->links=1;
-  vf->vi=calloc(vf->links,sizeof(vorbis_info));
-  vf->vc=calloc(vf->links,sizeof(vorbis_info));
+  vf->vi=_ogg_calloc(vf->links,sizeof(vorbis_info));
+  vf->vc=_ogg_calloc(vf->links,sizeof(vorbis_info));
 
   /* Try to fetch the headers, maintaining all the storage */
-  if(_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL)==-1)return(-1);
+  if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0)
+    return(ret);
   _make_decode_ready(vf);
 
   return 0;
@@ -403,8 +421,8 @@ static void _decode_clear(OggVorbis_File *vf){
    date (seek and read both use this.  seek uses a special hack with
    readp). 
 
-   return: -1) hole in the data (lost packet) 
-            0) need more date (only if readp==0)/eof
+   return: <0) error, OV_HOLE (lost packet) or OV_EOF
+            0) need more data (only if readp==0)
            1) got a packet 
 */
 
@@ -422,9 +440,7 @@ static int _process_packet(OggVorbis_File *vf,int readp){
       int result=ogg_stream_packetout(&vf->os,&op);
       ogg_int64_t granulepos;
       
-      /* if(result==-1)return(-1); hole in the data. For now, swallow
-                                   and go. We'll need to add a real
-                                   error code in a bit. */
+      if(result==-1)return(OV_HOLE); /* hole in the data. */
       if(result>0){
        /* got a packet.  process it */
        granulepos=op.granulepos;
@@ -475,7 +491,7 @@ static int _process_packet(OggVorbis_File *vf,int readp){
     }
 
     if(!readp)return(0);
-    if(_get_next_page(vf,&og,-1)<0)return(0); /* eof. leave unitialized */
+    if(_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 */
@@ -510,14 +526,16 @@ static int _process_packet(OggVorbis_File *vf,int readp){
           boundaries */
        for(link=0;link<vf->links;link++)
          if(vf->serialnos[link]==vf->current_serialno)break;
-       if(link==vf->links)return(-1); /* sign of a bogus stream.  error out,
-                                         leave machine uninitialized */
+       if(link==vf->links)return(OV_EBADLINK); /* sign of a bogus
+                                                  stream.  error out,
+                                                  leave machine
+                                                  uninitialized */
        
        vf->current_link=link;
-
+       
        ogg_stream_init(&vf->os,vf->current_serialno);
        ogg_stream_reset(&vf->os); 
-
+       
       }else{
        /* we're streaming */
        /* fetch the three header packets, build the info struct */
@@ -646,7 +664,7 @@ long ov_seekable(OggVorbis_File *vf){
    vorbis_info structs */
 
 long ov_bitrate(OggVorbis_File *vf,int i){
-  if(i>=vf->links)return(-1);
+  if(i>=vf->links)return(OV_EINVAL);
   if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
   if(i<0){
     ogg_int64_t bits=0;
@@ -670,7 +688,7 @@ long ov_bitrate(OggVorbis_File *vf,int i){
            return vf->vi[i].bitrate_upper;
          }
        }
-       return(-1);
+       return(OV_FALSE);
       }
     }
   }
@@ -681,7 +699,7 @@ long ov_bitrate(OggVorbis_File *vf,int i){
 long ov_bitrate_instant(OggVorbis_File *vf){
   int link=(vf->seekable?vf->current_link:0);
   long ret;
-  if(vf->samptrack==0)return(-1);
+  if(vf->samptrack==0)return(OV_FALSE);
   ret=vf->bittrack/vf->samptrack*vf->vi[link].rate+.5;
   vf->bittrack=0.;
   vf->samptrack=0.;
@@ -690,7 +708,7 @@ long ov_bitrate_instant(OggVorbis_File *vf){
 
 /* Guess */
 long ov_serialnumber(OggVorbis_File *vf,int i){
-  if(i>=vf->links)return(-1);
+  if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1));
   if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
   if(i<0){
     return(vf->current_serialno);
@@ -704,7 +722,7 @@ long ov_serialnumber(OggVorbis_File *vf,int i){
            -1 if the stream is not seekable (we can't know the length)
 */
 ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
-  if(!vf->seekable || i>=vf->links)return(-1);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
   if(i<0){
     long acc=0;
     int i;
@@ -721,7 +739,7 @@ ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
            -1 if the stream is not seekable (we can't know the length)
 */
 ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
-  if(!vf->seekable || i>=vf->links)return(-1);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
   if(i<0){
     ogg_int64_t acc=0;
     int i;
@@ -738,7 +756,7 @@ ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
            -1 if the stream is not seekable (we can't know the length)
 */
 double ov_time_total(OggVorbis_File *vf,int i){
-  if(!vf->seekable || i>=vf->links)return(-1);
+  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
   if(i<0){
     double acc=0;
     int i;
@@ -759,14 +777,14 @@ double ov_time_total(OggVorbis_File *vf,int i){
    returns zero on success, nonzero on failure */
 
 int ov_raw_seek(OggVorbis_File *vf,long pos){
-
-  if(!vf->seekable)return(-1); /* don't dump machine if we can't seek */
-  if(pos<0 || pos>vf->offsets[vf->links])goto seek_error;
+  int flag=0;
+  if(!vf->seekable)return(OV_ENOSEEK); /* don't dump machine if we can't seek */
+  if(pos<0 || pos>vf->offsets[vf->links])return(OV_EINVAL);
 
   /* clear out decoding machine state */
   vf->pcm_offset=-1;
   _decode_clear(vf);
-
+  
   /* seek */
   _seek_helper(vf,pos);
 
@@ -776,29 +794,34 @@ int ov_raw_seek(OggVorbis_File *vf,long pos){
      from a page has the 'granulepos' field set, and that's how the
      helper updates the offset */
 
-  switch(_process_packet(vf,1)){
-  case 0:
-    /* oh, eof. There are no packets remaining.  Set the pcm offset to
-       the end of file */
-    vf->pcm_offset=ov_pcm_total(vf,-1);
-    return(0);
-  case -1:
-    /* error! missing data or invalid bitstream structure */
-    goto seek_error;
-  default:
-    /* all OK */
-    break;
+  while(!flag){
+    switch(_process_packet(vf,1)){
+    case 0:case OV_EOF:
+      /* oh, eof. There are no packets remaining.  Set the pcm offset to
+        the end of file */
+      vf->pcm_offset=ov_pcm_total(vf,-1);
+      return(0);
+    case OV_HOLE:
+      break;
+    case OV_EBADLINK:
+      goto seek_error;
+    default:
+      /* all OK */
+      flag=1;
+      break;
+    }
   }
-
+  
   while(1){
+    /* don't have to check each time through for the updated granule;
+       it's always the last complete packet on a page */
     switch(_process_packet(vf,0)){
-    case 0:
-      /* the offset is set.  If it's a bogus bitstream with no offset
-         information, it's not but that's not our fault.  We still run
+    case 0:case OV_EOF:
+      /* the offset is set unless it's a bogus bitstream with no
+         offset information but that's not our fault.  We still run
          gracefully, we're just missing the offset */
       return(0);
-    case -1:
-      /* error! missing data or invalid bitstream structure */
+    case OV_EBADLINK:
       goto seek_error;
     default:
       /* continue processing packets */
@@ -810,7 +833,7 @@ int ov_raw_seek(OggVorbis_File *vf,long pos){
   /* dump the machine so we're in a known state */
   vf->pcm_offset=-1;
   _decode_clear(vf);
-  return -1;
+  return OV_EBADLINK;
 }
 
 /* Page granularity seek (faster than sample granularity because we
@@ -821,10 +844,11 @@ int ov_raw_seek(OggVorbis_File *vf,long pos){
    arrive at the requested position. */
 int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
   int link=-1;
+  long ret;
   ogg_int64_t total=ov_pcm_total(vf,-1);
 
-  if(!vf->seekable)return(-1); /* don't dump machine if we can't seek */  
-  if(pos<0 || pos>total)goto seek_error;
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(pos<0 || pos>total)return(OV_EINVAL);
 
   /* which bitstream section does this pcm offset occur in? */
   for(link=vf->links-1;link>=0;link--){
@@ -846,7 +870,6 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
     ogg_page og;
     while(begin<end){
       long bisect;
-      long ret;
     
       if(end-begin<CHUNKSIZE){
        bisect=begin;
@@ -856,43 +879,51 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
     
       _seek_helper(vf,bisect);
       ret=_get_next_page(vf,&og,end-bisect);
-      
-      if(ret==-1){
+      switch(ret){
+      case OV_FALSE: case OV_EOF:
        end=bisect;
-      }else{
-       ogg_int64_t granulepos=ogg_page_granulepos(&og);
-       if(granulepos<target){
-         best=ret;  /* raw offset of packet with granulepos */ 
-         begin=vf->offset; /* raw offset of next packet */
-       }else{
-         end=bisect;
+       break;
+      case OV_EREAD:
+       goto seek_error;
+      default:
+       {
+         ogg_int64_t granulepos=ogg_page_granulepos(&og);
+         if(granulepos<target){
+           best=ret;  /* raw offset of packet with granulepos */ 
+           begin=vf->offset; /* raw offset of next packet */
+         }else{
+           end=bisect;
+         }
        }
       }
     }
 
     /* found our page. seek to it (call raw_seek). */
     
-    if(ov_raw_seek(vf,best))goto seek_error;
+    if((ret=ov_raw_seek(vf,best)))goto seek_error;
   }
-
+  
   /* verify result */
-  if(vf->pcm_offset>=pos)goto seek_error;
-  if(pos>ov_pcm_total(vf,-1))goto seek_error;
+  if(vf->pcm_offset>=pos || pos>ov_pcm_total(vf,-1)){
+    ret=OV_EFAULT;
+    goto seek_error;
+  }
   return(0);
-
+  
  seek_error:
   /* dump machine so we're in a known state */
   vf->pcm_offset=-1;
   _decode_clear(vf);
-  return -1;
+  return ret;
 }
 
 /* seek to a sample offset relative to the decompressed pcm stream 
    returns zero on success, nonzero on failure */
 
 int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
-  if(ov_pcm_seek_page(vf,pos))return(-1);
-
+  int ret=ov_pcm_seek_page(vf,pos);
+  if(ret<0)return(ret);
+  
   /* discard samples until we reach the desired position. Crossing a
      logical bitstream boundary with abandon is OK. */
   while(vf->pcm_offset<pos){
@@ -920,8 +951,8 @@ int ov_time_seek(OggVorbis_File *vf,double seconds){
   ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
   double time_total=ov_time_total(vf,-1);
 
-  if(!vf->seekable)return(-1); /* don't dump machine if we can't seek */  
-  if(seconds<0 || seconds>time_total)goto seek_error;
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(seconds<0 || seconds>time_total)return(OV_EINVAL);
   
   /* which bitstream section does this time offset occur in? */
   for(link=vf->links-1;link>=0;link--){
@@ -935,12 +966,6 @@ int ov_time_seek(OggVorbis_File *vf,double seconds){
     ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;
     return(ov_pcm_seek(vf,target));
   }
-
- seek_error:
-  /* dump machine so we're in a known state */
-  vf->pcm_offset=-1;
-  _decode_clear(vf);
-  return -1;
 }
 
 /* page-granularity version of ov_time_seek 
@@ -952,8 +977,8 @@ int ov_time_seek_page(OggVorbis_File *vf,double seconds){
   ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
   double time_total=ov_time_total(vf,-1);
 
-  if(!vf->seekable)return(-1); /* don't dump machine if we can't seek */  
-  if(seconds<0 || seconds>time_total)goto seek_error;
+  if(!vf->seekable)return(OV_ENOSEEK);
+  if(seconds<0 || seconds>time_total)return(OV_EINVAL);
   
   /* which bitstream section does this time offset occur in? */
   for(link=vf->links-1;link>=0;link--){
@@ -967,12 +992,6 @@ int ov_time_seek_page(OggVorbis_File *vf,double seconds){
     ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate;
     return(ov_pcm_seek_page(vf,target));
   }
-
- seek_error:
-  /* dump machine so we're in a known state */
-  vf->pcm_offset=-1;
-  _decode_clear(vf);
-  return -1;
 }
 
 /* tell the current stream offset cursor.  Note that seek followed by
@@ -1059,11 +1078,9 @@ vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
 }
 
 int host_is_big_endian() {
-  short pattern = 0xbabe;
+  ogg_int32_t pattern = 0xfeedface; /* deadbeef */
   unsigned char *bytewise = (unsigned char *)&pattern;
-  if (bytewise[0] == 0xba) return 1;
-
-  assert(bytewise[0] == 0xbe);
+  if (bytewise[0] == 0xfe) return 1;
   return 0;
 }
 
@@ -1089,7 +1106,7 @@ int host_is_big_endian() {
                 word) word size for output.  currently 1 (byte) or 
                       2 (16 bit short)
 
-   return values: -1) error/hole in data
+   return values: -1) error/hole in data (OV_HOLE)
                    0) EOF
                   n) number of bytes of PCM actually returned.  The
                   below works on a packet-by-packet basis, so the
@@ -1112,6 +1129,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
 
        long channels=ov_info(vf,-1)->channels;
        long bytespersample=word * channels;
+       vorbis_fpu_control fpu;
        if(samples>length/bytespersample)samples=length/bytespersample;
        
        /* a tight loop to pack each size */
@@ -1119,63 +1137,79 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
          int val;
          if(word==1){
            int off=(sgned?0:128);
+           vorbis_fpu_setround(&fpu);
            for(j=0;j<samples;j++)
              for(i=0;i<channels;i++){
-               val=(int)(pcm[i][j]*128. + 0.5);
+               val=vorbis_ftoi(pcm[i][j]*128.);
                if(val>127)val=127;
                else if(val<-128)val=-128;
                *buffer++=val+off;
              }
+           vorbis_fpu_restore(fpu);
          }else{
            int off=(sgned?0:32768);
 
            if(host_endian==bigendianp){
              if(sgned){
+
+               vorbis_fpu_setround(&fpu);
                for(i=0;i<channels;i++) { /* It's faster in this order */
                  float *src=pcm[i];
                  short *dest=((short *)buffer)+i;
                  for(j=0;j<samples;j++) {
-                   val=(int)(src[j]*32768. + 0.5);
+                   val=vorbis_ftoi(src[j]*32768.);
                    if(val>32767)val=32767;
                    else if(val<-32768)val=-32768;
                    *dest=val;
                    dest+=channels;
                  }
                }
+               vorbis_fpu_restore(fpu);
+
              }else{
+
+               vorbis_fpu_setround(&fpu);
                for(i=0;i<channels;i++) {
                  float *src=pcm[i];
                  short *dest=((short *)buffer)+i;
                  for(j=0;j<samples;j++) {
-                   val=(int)(src[j]*32768. + 0.5);
+                   val=vorbis_ftoi(src[j]*32768.);
                    if(val>32767)val=32767;
                    else if(val<-32768)val=-32768;
                    *dest=val+off;
                    dest+=channels;
                  }
                }
+               vorbis_fpu_restore(fpu);
+
              }
            }else if(bigendianp){
+
+             vorbis_fpu_setround(&fpu);
              for(j=0;j<samples;j++)
                for(i=0;i<channels;i++){
-                 val=(int)(pcm[i][j]*32768. + 0.5);
+                 val=vorbis_ftoi(pcm[i][j]*32768.);
                  if(val>32767)val=32767;
                  else if(val<-32768)val=-32768;
                  val+=off;
                  *buffer++=(val>>8);
                  *buffer++=(val&0xff);
                }
+             vorbis_fpu_restore(fpu);
+
            }else{
              int val;
+             vorbis_fpu_setround(&fpu);
              for(j=0;j<samples;j++)
                for(i=0;i<channels;i++){
-                 val=(int)(pcm[i][j]*32768. + 0.5);
+                 val=vorbis_ftoi(pcm[i][j]*32768.);
                  if(val>32767)val=32767;
                  else if(val<-32768)val=-32768;
                  val+=off;
                  *buffer++=(val&0xff);
                  *buffer++=(val>>8);
                }
+             vorbis_fpu_restore(fpu);  
 
            }
          }
@@ -1190,12 +1224,12 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
 
     /* suck in another packet */
     switch(_process_packet(vf,1)){
-    case 0:
+    case 0:case OV_EOF:
       return(0);
-    case -1:
-      return -1;
-    default:
-      break;
+    case OV_HOLE:
+      return(OV_HOLE);
+    case OV_EBADLINK:
+      return(OV_EBADLINK);
     }
   }
 }
index 58d5dd0..0ae8d11 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: window functions
- last mod: $Id: window.c,v 1.8 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: window.c,v 1.9 2000/11/06 00:07:03 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,7 +22,7 @@
 #include "misc.h"
 
 float *_vorbis_window(int type, int window,int left,int right){
-  float *ret=calloc(window,sizeof(float));
+  float *ret=_ogg_calloc(window,sizeof(float));
 
   switch(type){
   case 0:
index bfbf747..6132247 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: window functions
- last mod: $Id: window.h,v 1.4 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: window.h,v 1.5 2000/11/06 00:07:03 xiphmont Exp $
 
  ********************************************************************/
 
index 9c528e3..573a8f8 100644 (file)
@@ -1,73 +1,81 @@
-Summary: The OGG Vorbis lossy audio compression codec.
-Name:  vorbis
-Version: 0.0
-Release: 1
-Copyright: GPL
-Group: Development/Libraries
-Source: http://www.xiph.org/vorbis/download/%{name}-%{version}.src.tgz 
-Url: http://www.xiph.org/vorbis/index.html
-BuildRoot: /var/tmp/vorbis-root
+%define name   libvorbis
+%define version        1.0.0
+%define release 1
 
-%description 
-Ogg Vorbis is a fully Open, non-proprietary, patent-and-royalty-free,
-general-purpose compressed audio format for high quality (44.1-48.0kHz,
-16+ bit, polyphonic) audio and music at fixed and variable bitrates
-from 16 to 128 kbps/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.
+Summary:       The Vorbis General Audio Compression Codec
+Name:          %{name}
+Version:       %{version}
+Release:       %{release}
+Group:         Libraries/Multimedia
+Copyright:     LGPL
+URL:           http://www.xiph.org/
+Vendor:                Xiphophorus <team@xiph.org>
+Source:                ftp://ftp.xiph.org/pub/ogg/vorbis/%{name}-%{version}.tar.gz
+BuildRoot:     %{_tmppath}/%{name}-root
+Requires:      libogg >= 1.0.0
+
+%description
+Ogg Vorbis is a fully open, non-proprietary, patent-and-royalty-free,
+general-purpose compressed audio format for audio and music at fixed 
+and variable bitrates from 16 to 128 kbps/channel.
 
 %package devel
-Copyright: LGPL
-Summary: Development library for OGG Vorbis
-Group: Development/Libraries
+Summary:       Vorbis Library Development
+Group:                 Development/Libraries
+Requires:      libogg-devel >= 1.0.0
 
 %description devel
-Ogg Vorbis is a fully Open, non-proprietary, patent-and-royalty-free,
-general-purpose compressed audio format for high quality (44.1-48.0kHz,
-16+ bit, polyphonic) audio and music at fixed and variable bitrates 
-from 16 to 128 kbps/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.
+The libvorbis-devel package contains the header files and documentation
+needed to develop applications with libvorbis.
 
 %prep
-%setup -q
+%setup -q -n %{name}-%{version}
 
 %build
-rm -rf $RPM_BUILD_ROOT
-CFLAGS="${RPM_OPT_FLAGS}" ./configure --prefix=/usr
-make  
+if [ ! -f configure ]; then
+  CFLAGS="$RPM_FLAGS" ./autogen.sh --prefix=/usr
+else
+  CFLAGS="$RPM_FLAGS" ./configure --prefix=/usr
+fi
+make
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
-install -d $RPM_BUILD_ROOT/usr/include/vorbis 
-install -d $RPM_BUILD_ROOT/usr/include/vorbis/book
-install -d $RPM_BUILD_ROOT/usr/lib
-install -d $RPM_BUILD_ROOT/usr/bin
-install -m 0755 lib/libvorbis.a $RPM_BUILD_ROOT/usr/lib/
-install -m 0755 lib/vorbisfile.a $RPM_BUILD_ROOT/usr/lib/
-install -m 0644 include/vorbis/*.h $RPM_BUILD_ROOT/usr/include/vorbis/
-install -m 0644 include/vorbis/book/*.vqh $RPM_BUILD_ROOT/usr/include/vorbis/book/
-install -m 0755 -s huff/{residuesplit,huffbuild} $RPM_BUILD_ROOT/usr/bin
-install -m 0755 -s vq/{genericvqtrain,lspvqtrain,residuevqtrain,\
-vqbuild,vqcascade,vqmetrics,vqpartition} \
-                   $RPM_BUILD_ROOT/usr/bin/
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
 
 %files
 %defattr(-,root,root)
-
-%doc README 
-/usr/bin/*
+%doc COPYING
+%doc README
+/usr/lib/libvorbis.so.*
+/usr/lib/libvorbisfile.so.*
+/usr/lib/libvorbisenc.so.*
 
 %files devel
-%defattr(-,root,root)
-%doc README docs/*.{png,html}
-/usr/include/vorbis/*
-/usr/lib/*
+%doc doc/*.html
+%doc doc/*.txt
+%doc doc/*.png
+%doc doc/vorbisfile/*.html
+%doc doc/vorbisfile/*.css
+/usr/include/vorbis/codec.h
+/usr/include/vorbis/vorbisfile.h
+/usr/include/vorbis/vorbisenc.h
+/usr/lib/libvorbis.a
+/usr/lib/libvorbis.so
+/usr/lib/libvorbisfile.a
+/usr/lib/libvorbisfile.so
+/usr/lib/libvorbisenc.a
+/usr/lib/libvorbisenc.so
+
+%clean 
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
 
 %changelog
-* Sat Apr 29 2000 Peter Jones <pjones@redhat.com>
-- first pass.
+* Sat Oct 21 2000 Jack Moffitt <jack@icecast.org>
+- initial spec file created
index 277574a..536f746 100644 (file)
@@ -1 +1 @@
-#include <sys/types.h>\r#include <string.h>\r#include <stdlib.h>\r\rchar *strdup(const char *inStr)\r{\r     char *outStr = NULL;\r   \r       if (inStr == NULL) {\r           return NULL;\r   }\r      \r       outStr = malloc(strlen(inStr) + 1);\r    \r       if (outStr != NULL) {\r          strcpy(outStr, inStr);\r }\r      \r       return outStr;\r}\r
\ No newline at end of file
+#include <sys/types.h>\r#include <string.h>\r#include <stdlib.h>\r\rchar *strdup(const char *inStr)\r{\r     char *outStr = NULL;\r   \r       if (inStr == NULL) {\r           return NULL;\r   }\r      \r       outStr = _ogg_malloc(strlen(inStr) + 1);\r       \r       if (outStr != NULL) {\r          strcpy(outStr, inStr);\r }\r      \r       return outStr;\r}\r
\ No newline at end of file
diff --git a/vorbis.m4 b/vorbis.m4
new file mode 100644 (file)
index 0000000..0cc4c3c
--- /dev/null
+++ b/vorbis.m4
@@ -0,0 +1,96 @@
+# Configure paths for libvorbis
+# Jack Moffitt <jack@icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+
+dnl AM_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
+dnl
+AC_DEFUN(AM_PATH_VORBIS,
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(vorbis-prefix,[  --with-vorbis-prefix=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
+AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
+
+  if test x$vorbis_prefix != x ; then
+    vorbis_args="$vorbis_args --prefix=$vorbis_prefix"
+    VORBIS_CFLAGS="-I$vorbis_prefix/include"
+    VORBIS_LIBDIR="-L$vorbis_prefix/lib"
+  fi
+
+  VORBIS_LIBS="$VORBIS_LIBDIR -lvorbis -lm"
+  VORBISFILE_LIBS="-lvorbisfile"
+  VORBISENC_LIBS="-lvorbisenc"
+
+  AC_MSG_CHECKING(for Vorbis)
+  no_vorbis=""
+
+
+  if test "x$enable_vorbistest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $VORBIS_CFLAGS"
+    LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
+dnl
+dnl Now check if the installed Vorbis is sufficiently new.
+dnl
+      rm -f conf.vorbistest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vorbis/codec.h>
+
+int main ()
+{
+  system("touch conf.vorbistest");
+  return 0;
+}
+
+],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_vorbis" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.vorbistest ; then
+       :
+     else
+       echo "*** Could not run Vorbis test program, checking why..."
+       CFLAGS="$CFLAGS $VORBIS_CFLAGS"
+       LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <vorbis/codec.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
+       echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
+       echo "*** or that you have moved Vorbis since it was installed." ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     VORBIS_CFLAGS=""
+     VORBIS_LIBS=""
+     VORBISFILE_LIBS=""
+     VORBISENC_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(VORBIS_CFLAGS)
+  AC_SUBST(VORBIS_LIBS)
+  AC_SUBST(VORBISFILE_LIBS)
+  AC_SUBST(VORBISENC_LIBS)
+  rm -f conf.vorbistest
+])
similarity index 69%
rename from vq/Makefile.in
rename to vq/Makefile
index 37d0000..8e401ef 100644 (file)
@@ -1,29 +1,22 @@
-# $Id: Makefile.in,v 1.14 2000/07/17 12:55:37 xiphmont Exp $
+# $Id: Makefile,v 1.2 2000/11/06 00:07:25 xiphmont Exp $
 
 ###############################################################################
 #                                                                             #
-# To build a production vorbis (preferrably using gmake), just type 'make'.   #
-# To build with debugging or profiling information, use 'make debug' or       #
-# 'make profile' respectively.  'make clean' is a good idea between builds    #
-# with different target names, or before a final build.                       #
+# These are vq codebook generation tools for use by team members.  This       #
+# makefile assumes gcc.                                                       #
+#                                                                             #
+# One need not build these utils to make libvorbis                            #
 #                                                                             #
 ###############################################################################
 
-
-# DO NOT EDIT BELOW! ##########################################################
-# (unless, of course, you know what you are doing :) ##########################
-
-@SET_MAKE@
-FLAGS=-I. -I../include @CFLAGS@
-OPT=@OPT@ $(FLAGS)
-DEBUG=@DEBUG@ $(FLAGS)
-PROFILE=@PROFILE@ $(FLAGS)
-CC=@CC@
-LD=@CC@
-LDFLAGS=@LDFLAGS@ $(FLAGS)
-AR=@AR@
-RANLIB=@RANLIB@
-LIBS=@LIBS@ 
+FLAGS=-I. -I../include 
+OPT=-O20 $(FLAGS)
+DEBUG=-g -Wall $(FLAGS)
+PROFILE=-g -pg -O20 $(FLAGS)
+CC=gcc
+LD=gcc
+LDFLAGS=$(FLAGS)
+LIBS=-lm 
 
 HFILES =       ../include/vorbis/codebook.h vqgen.h vqext.h bookutil.h
 
@@ -41,7 +34,7 @@ debug:
 profile: 
        $(MAKE) target CFLAGS="$(PROFILE)"
 
-target:        lspvqtrain genericvqtrain residuevqtrain vqbuild vqcascade vqmetrics latticebuild latticepare latticehint latticetune
+target:        lspvqtrain genericvqtrain residuevqtrain vqbuild vqcascade vqmetrics latticebuild latticepare latticehint latticetune huffbuild residuesplit
 
 lspvqtrain:    $(OFILES) lspdata.o train.o
        $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
@@ -73,6 +66,12 @@ latticepare: $(OFILES) latticepare.o
 latticetune:   $(OFILES) latticetune.o
        $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
 
+huffbuild:     $(OFILES) huffbuild.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+
+residuesplit:  $(OFILES) residuesplit.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
+
 
 $(ALLOFILES):  $(HFILES)
 
@@ -84,7 +83,8 @@ $(OFILES):    $(HFILES)
 clean:
        -rm -f *.o *.a test* *~ *.out *.m config.* \
                lspvqtrain genericvqtrain residuevqtrain\
-               vqbuild vqmetrics latticebuild vqcascade latticepare
+               vqbuild vqmetrics latticebuild vqcascade latticepare\
+               huffbuild residuesplit
 
 distclean:     clean
        -rm -f Makefile
index 8b15155..8eee315 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility functions for loading .vqh and .vqd files
- last mod: $Id: bookutil.c,v 1.17 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: bookutil.c,v 1.18 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
@@ -40,10 +40,10 @@ char *get_line(FILE *in){
       if(sofar+1>=lbufsize){
         if(!lbufsize){  
           lbufsize=1024;
-          linebuffer=malloc(lbufsize);
+          linebuffer=_ogg_malloc(lbufsize);
         }else{
           lbufsize*=2;
-          linebuffer=realloc(linebuffer,lbufsize);
+          linebuffer=_ogg_realloc(linebuffer,lbufsize);
         }
       }
       {
@@ -178,8 +178,8 @@ char *find_seek_to(FILE *in,char *s){
    header-ness will break this routine */
 
 codebook *codebook_load(char *filename){
-  codebook *b=calloc(1,sizeof(codebook));
-  static_codebook *c=(static_codebook *)(b->c=calloc(1,sizeof(static_codebook)));
+  codebook *b=_ogg_calloc(1,sizeof(codebook));
+  static_codebook *c=(static_codebook *)(b->c=_ogg_calloc(1,sizeof(static_codebook)));
   encode_aux_nearestmatch *a=NULL;
   encode_aux_threshmatch *t=NULL;
   encode_aux_pigeonhole *p=NULL;
@@ -215,7 +215,7 @@ codebook *codebook_load(char *filename){
   /* find the auxiliary encode struct[s] (if any) */
   if(find_seek_to(in,"static encode_aux_nearestmatch _vq_aux")){
     /* how big? */
-    c->nearest_tree=a=calloc(1,sizeof(encode_aux_nearestmatch));
+    c->nearest_tree=a=_ogg_calloc(1,sizeof(encode_aux_nearestmatch));
     line=get_line(in);
     line=get_line(in);
     line=get_line(in);
@@ -229,7 +229,7 @@ codebook *codebook_load(char *filename){
     /* load ptr0 */
     find_seek_to(in,"static long _vq_ptr0");
     reset_next_value();
-    a->ptr0=malloc(sizeof(long)*a->aux);
+    a->ptr0=_ogg_malloc(sizeof(long)*a->aux);
     for(i=0;i<a->aux;i++)
       if(get_next_ivalue(in,a->ptr0+i)){
        fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -239,7 +239,7 @@ codebook *codebook_load(char *filename){
     /* load ptr1 */
     find_seek_to(in,"static long _vq_ptr1");
     reset_next_value();
-    a->ptr1=malloc(sizeof(long)*a->aux);
+    a->ptr1=_ogg_malloc(sizeof(long)*a->aux);
     for(i=0;i<a->aux;i++)
       if(get_next_ivalue(in,a->ptr1+i)){
        fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -250,7 +250,7 @@ codebook *codebook_load(char *filename){
     /* load p */
     find_seek_to(in,"static long _vq_p_");
     reset_next_value();
-    a->p=malloc(sizeof(long)*a->aux);
+    a->p=_ogg_malloc(sizeof(long)*a->aux);
     for(i=0;i<a->aux;i++)
       if(get_next_ivalue(in,a->p+i)){
        fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -260,7 +260,7 @@ codebook *codebook_load(char *filename){
     /* load q */
     find_seek_to(in,"static long _vq_q_");
     reset_next_value();
-    a->q=malloc(sizeof(long)*a->aux);
+    a->q=_ogg_malloc(sizeof(long)*a->aux);
     for(i=0;i<a->aux;i++)
       if(get_next_ivalue(in,a->q+i)){
        fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -270,7 +270,7 @@ codebook *codebook_load(char *filename){
   
   if(find_seek_to(in,"static encode_aux_threshmatch _vq_aux")){
     /* how big? */
-    c->thresh_tree=t=calloc(1,sizeof(encode_aux_threshmatch));
+    c->thresh_tree=t=_ogg_calloc(1,sizeof(encode_aux_threshmatch));
     line=get_line(in);
     line=get_line(in);
     line=get_line(in);
@@ -286,7 +286,7 @@ codebook *codebook_load(char *filename){
     /* load quantthresh */
     find_seek_to(in,"static float _vq_quantthresh_");
     reset_next_value();
-    t->quantthresh=malloc(sizeof(float)*t->threshvals);
+    t->quantthresh=_ogg_malloc(sizeof(float)*t->threshvals);
     for(i=0;i<t->threshvals-1;i++)
       if(get_next_value(in,t->quantthresh+i)){
        fprintf(stderr,"out of data 1 while reading codebook %s\n",filename);
@@ -295,7 +295,7 @@ codebook *codebook_load(char *filename){
     /* load quantmap */
     find_seek_to(in,"static long _vq_quantmap_");
     reset_next_value();
-    t->quantmap=malloc(sizeof(long)*t->threshvals);
+    t->quantmap=_ogg_malloc(sizeof(long)*t->threshvals);
     for(i=0;i<t->threshvals;i++)
       if(get_next_ivalue(in,t->quantmap+i)){
        fprintf(stderr,"out of data 2 while reading codebook %s\n",filename);
@@ -306,9 +306,9 @@ codebook *codebook_load(char *filename){
   if(find_seek_to(in,"static encode_aux_pigeonhole _vq_aux")){
     int pigeons=1,i;
     /* how big? */
-    c->pigeon_tree=p=calloc(1,sizeof(encode_aux_pigeonhole));
+    c->pigeon_tree=p=_ogg_calloc(1,sizeof(encode_aux_pigeonhole));
     line=get_line(in);
-    if(sscanf(line,"%lf, %lf, %d, %d",&(p->min),&(p->del),
+    if(sscanf(line,"%f, %f, %d, %d",&(p->min),&(p->del),
              &(p->mapentries),&(p->quantvals))!=4){
       fprintf(stderr,"5: syntax in %s in line:\t %s",filename,line);
       exit(1);
@@ -322,7 +322,7 @@ codebook *codebook_load(char *filename){
     /* load pigeonmap */
     find_seek_to(in,"static long _vq_pigeonmap_");
     reset_next_value();
-    p->pigeonmap=malloc(sizeof(long)*p->mapentries);
+    p->pigeonmap=_ogg_malloc(sizeof(long)*p->mapentries);
     for(i=0;i<p->mapentries;i++)
       if(get_next_ivalue(in,p->pigeonmap+i)){
        fprintf(stderr,"out of data (pigeonmap) while reading codebook %s\n",filename);
@@ -331,7 +331,7 @@ codebook *codebook_load(char *filename){
     /* load fitlist */
     find_seek_to(in,"static long _vq_fitlist_");
     reset_next_value();
-    p->fitlist=malloc(sizeof(long)*p->fittotal);
+    p->fitlist=_ogg_malloc(sizeof(long)*p->fittotal);
     for(i=0;i<p->fittotal;i++)
       if(get_next_ivalue(in,p->fitlist+i)){
        fprintf(stderr,"out of data (fitlist) while reading codebook %s\n",filename);
@@ -341,7 +341,7 @@ codebook *codebook_load(char *filename){
     find_seek_to(in,"static long _vq_fitmap_");
     reset_next_value();
     for(i=0;i<c->dim;i++)pigeons*=p->quantvals;
-    p->fitmap=malloc(sizeof(long)*pigeons);
+    p->fitmap=_ogg_malloc(sizeof(long)*pigeons);
     for(i=0;i<pigeons;i++)
       if(get_next_ivalue(in,p->fitmap+i)){
        fprintf(stderr,"out of data (fitmap) while reading codebook %s\n",filename);
@@ -351,7 +351,7 @@ codebook *codebook_load(char *filename){
     /* load fitlength */
     find_seek_to(in,"static long _vq_fitlength_");
     reset_next_value();
-    p->fitlength=malloc(sizeof(long)*pigeons);
+    p->fitlength=_ogg_malloc(sizeof(long)*pigeons);
     for(i=0;i<pigeons;i++)
       if(get_next_ivalue(in,p->fitlength+i)){
        fprintf(stderr,"out of data (fitlength) while reading codebook %s\n",filename);
@@ -374,7 +374,7 @@ codebook *codebook_load(char *filename){
   /* load the quantized entries */
   find_seek_to(in,"static long _vq_quantlist_");
   reset_next_value();
-  c->quantlist=malloc(sizeof(long)*quant_to_read);
+  c->quantlist=_ogg_malloc(sizeof(long)*quant_to_read);
   for(i=0;i<quant_to_read;i++)
     if(get_next_ivalue(in,c->quantlist+i)){
       fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -384,7 +384,7 @@ codebook *codebook_load(char *filename){
   /* load the lengthlist */
   find_seek_to(in,"static long _vq_lengthlist");
   reset_next_value();
-  c->lengthlist=malloc(sizeof(long)*c->entries);
+  c->lengthlist=_ogg_malloc(sizeof(long)*c->entries);
   for(i=0;i<c->entries;i++)
     if(get_next_ivalue(in,c->lengthlist+i)){
       fprintf(stderr,"out of data while reading codebook %s\n",filename);
@@ -433,7 +433,7 @@ void spinnit(char *s,int n){
 
 void build_tree_from_lengths(int vals, long *hist, long *lengths){
   int i,j;
-  long *membership=malloc(vals*sizeof(long));
+  long *membership=_ogg_malloc(vals*sizeof(long));
   long *histsave=alloca(vals*sizeof(long));
   memcpy(histsave,hist,vals*sizeof(long));
 
@@ -506,7 +506,7 @@ void build_tree_from_lengths0(int vals, long *hist, long *lengths){
      the lengths after the build */
 
   int upper=0,i;
-  long *lengthlist=calloc(vals,sizeof(long));
+  long *lengthlist=_ogg_calloc(vals,sizeof(long));
   long *newhist=alloca(vals*sizeof(long));
 
   for(i=0;i<vals;i++)
@@ -556,7 +556,7 @@ void write_codebook(FILE *out,char *name,const static_codebook *c){
  " ********************************************************************/\n\n");
 
   fprintf(out,"#ifndef _V_%s_VQH_\n#define _V_%s_VQH_\n",name,name);
-  fprintf(out,"#include \"vorbis/codebook.h\"\n\n");
+  fprintf(out,"#include \"codebook.h\"\n\n");
 
   /* first, the static vectors, then the book structure to tie it together. */
   /* quantlist */
@@ -736,7 +736,7 @@ void write_codebook(FILE *out,char *name,const static_codebook *c){
   else
     fprintf(out,"\tNULL,\n");
 
-  fprintf(out,"};\n\n");
+  fprintf(out,"\t0\n};\n\n");
 
   fprintf(out,"\n#endif\n");
 }
index 297aa8c..be9a983 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility functions for loading .vqh and .vqd files
- last mod: $Id: bookutil.h,v 1.7 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: bookutil.h,v 1.8 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
index 2465c19..11e3e90 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building codebooks from training sets
- last mod: $Id: build.c,v 1.15 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: build.c,v 1.16 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
@@ -41,10 +41,10 @@ static char *rline(FILE *in,FILE *out){
       if(sofar>=lbufsize){
        if(!lbufsize){  
          lbufsize=1024;
-         linebuffer=malloc(lbufsize);
+         linebuffer=_ogg_malloc(lbufsize);
        }else{
          lbufsize*=2;
-         linebuffer=realloc(linebuffer,lbufsize);
+         linebuffer=_ogg_realloc(linebuffer,lbufsize);
        }
       }
       {
@@ -147,12 +147,12 @@ int main(int argc,char *argv[]){
   /* save quant data; we don't want to requantize later as our method
      is currently imperfect wrt repeated application */
   i=0;
-  quantlist=malloc(sizeof(long)*v.elements*v.entries);
+  quantlist=_ogg_malloc(sizeof(long)*v.elements*v.entries);
   for(j=0;j<entries;j++){
     float a;
     for(k=0;k<dim;k++){
       line=rline(in,out);
-      sscanf(line,"%lf",&a);
+      sscanf(line,"%f",&a);
       v.entrylist[i]=a;
       quantlist[i++]=rint(a);
     }
@@ -172,7 +172,7 @@ int main(int argc,char *argv[]){
       for(k=0;k<dim+aux;k++){
        line=rline(in,out);
        if(!line)break;
-       sscanf(line,"%lf",b+k);
+       sscanf(line,"%f",b+k);
       }
       if(feof(in))break;
       vqgen_addpoint(&v,b,NULL);
index ab73875..cae7580 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: function call to do simple data cascading
- last mod: $Id: cascade.c,v 1.7 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: cascade.c,v 1.8 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
index eb9de75..30be01e 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: generic euclidian distance metric for VQ codebooks
- last mod: $Id: genericdata.c,v 1.6 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: genericdata.c,v 1.7 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
index 03604e1..60d10f7 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: hufftree builder
- last mod: $Id: huffbuild.c,v 1.5 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: huffbuild.c,v 1.6 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
 #include <string.h>
 #include <math.h>
 #include <stdio.h>
-#include "../vq/bookutil.h"
+#include "bookutil.h"
 
 static int nsofar=0;
 static int getval(FILE *in,int begin,int n,int group,int max){
-  double v;
+  float v;
   int i;
   long val=0;
 
@@ -112,8 +112,8 @@ int main(int argc, char *argv[]){
 
   {
     long vals=pow(maxval,subn);
-    long *hist=malloc(vals*sizeof(long));
-    long *lengths=malloc(vals*sizeof(long));
+    long *hist=_ogg_malloc(vals*sizeof(long));
+    long *lengths=_ogg_malloc(vals*sizeof(long));
     
     for(j=0;j<vals;j++)hist[j]=guard;
     
@@ -162,7 +162,7 @@ int main(int argc, char *argv[]){
  " ********************************************************************/\n\n");
 
     fprintf(file,"#ifndef _V_%s_VQH_\n#define _V_%s_VQH_\n",base,base);
-    fprintf(file,"#include \"vorbis/codebook.h\"\n\n");
+    fprintf(file,"#include \"codebook.h\"\n\n");
     
     /* first, the static vectors, then the book structure to tie it together. */
     /* lengthlist */
@@ -183,7 +183,7 @@ int main(int argc, char *argv[]){
     fprintf(file,"\tNULL,\n");
     fprintf(file,"\tNULL,\n");
     fprintf(file,"\tNULL,\n");
-    fprintf(file,"};\n\n");
+    fprintf(file,"\t0\n};\n\n");
     
     fprintf(file,"\n#endif\n");
     fclose(file);
index 6de7ff6..ef1e577 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building codebooks from lattice descriptions
- last mod: $Id: latticebuild.c,v 1.6 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: latticebuild.c,v 1.7 2000/11/06 00:07:25 xiphmont Exp $
 
  ********************************************************************/
 
@@ -77,7 +77,7 @@ int main(int argc,char *argv[]){
 
   {
     char *ptr;
-    char *filename=calloc(strlen(argv[1])+4,1);
+    char *filename=_ogg_calloc(strlen(argv[1])+4,1);
 
     strcpy(filename,argv[1]);
     in=fopen(filename,"r");
@@ -107,13 +107,13 @@ int main(int argc,char *argv[]){
   entries=pow(quantvals,dim);
   c.dim=dim;
   c.entries=entries;
-  c.lengthlist=malloc(entries*sizeof(long));
+  c.lengthlist=_ogg_malloc(entries*sizeof(long));
   c.maptype=1;
   c.q_sequencep=sequencep;
-  c.quantlist=calloc(quantvals,sizeof(long));
+  c.quantlist=_ogg_calloc(quantvals,sizeof(long));
 
-  quantlist=malloc(sizeof(long)*c.dim*c.entries);
-  hits=malloc(c.entries*sizeof(long));
+  quantlist=_ogg_malloc(sizeof(long)*c.dim*c.entries);
+  hits=_ogg_malloc(c.entries*sizeof(long));
   for(j=0;j<entries;j++)hits[j]=1;
   for(j=0;j<entries;j++)c.lengthlist[j]=1;
 
index 111433e..50bf3f6 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for building thresh/pigeonhole encode hints
- last mod: $Id: latticehint.c,v 1.3 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: latticehint.c,v 1.4 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -58,10 +58,10 @@ static int addtosearch(int entry,long **tempstack,long *tempcount,int add){
   if(ptr){
     while(i--)
       if(*ptr++==add)return(0);
-    tempstack[entry]=realloc(tempstack[entry],
+    tempstack[entry]=_ogg_realloc(tempstack[entry],
                             (tempcount[entry]+1)*sizeof(long));
   }else{
-    tempstack[entry]=malloc(sizeof(long));
+    tempstack[entry]=_ogg_malloc(sizeof(long));
   }
 
   tempstack[entry][tempcount[entry]++]=add;
@@ -166,14 +166,14 @@ int main(int argc,char *argv[]){
     /* yes. Discard any preexisting threshhold hint */
     long quantvals=_book_maptype1_quantvals(c);
     long **quantsort=alloca(quantvals*sizeof(long *));
-    encode_aux_threshmatch *t=calloc(1,sizeof(encode_aux_threshmatch));
+    encode_aux_threshmatch *t=_ogg_calloc(1,sizeof(encode_aux_threshmatch));
     c->thresh_tree=t;
 
     fprintf(stderr,"Adding threshold hint to %s...\n",name);
 
     /* simplest possible threshold hint only */
-    t->quantthresh=calloc(quantvals-1,sizeof(float));
-    t->quantmap=calloc(quantvals,sizeof(int));
+    t->quantthresh=_ogg_calloc(quantvals-1,sizeof(float));
+    t->quantmap=_ogg_calloc(quantvals,sizeof(int));
     t->threshvals=quantvals;
     t->quantvals=quantvals;
 
@@ -212,7 +212,7 @@ int main(int argc,char *argv[]){
     long quantvals=_book_maptype1_quantvals(c);
     int changep=1,factor;
 
-    encode_aux_pigeonhole *p=calloc(1,sizeof(encode_aux_pigeonhole));
+    encode_aux_pigeonhole *p=_ogg_calloc(1,sizeof(encode_aux_pigeonhole));
     c->pigeon_tree=p;
 
     fprintf(stderr,"Adding pigeonhole hint to %s...\n",name);
@@ -237,7 +237,7 @@ int main(int argc,char *argv[]){
       for(i=0;i<quantvals;i++)if(max<c->quantlist[i])max=c->quantlist[i];
       p->mapentries=max;
     }
-    p->pigeonmap=malloc(p->mapentries*sizeof(long));
+    p->pigeonmap=_ogg_malloc(p->mapentries*sizeof(long));
     p->quantvals=(quantvals+factor-1)/factor;
 
     /* pigeonhole roughly on the boundaries of the quantvals; the
@@ -274,11 +274,11 @@ int main(int argc,char *argv[]){
     subpigeons=1;
     for(i=0;i<dim;i++)subpigeons*=p->mapentries;
     for(i=0;i<dim;i++)pigeons*=p->quantvals;
-    temptrack=calloc(dim,sizeof(long));
-    tempmin=calloc(dim,sizeof(float));
-    tempmax=calloc(dim,sizeof(float));
-    tempstack=calloc(pigeons,sizeof(long *));
-    tempcount=calloc(pigeons,sizeof(long));
+    temptrack=_ogg_calloc(dim,sizeof(long));
+    tempmin=_ogg_calloc(dim,sizeof(float));
+    tempmax=_ogg_calloc(dim,sizeof(float));
+    tempstack=_ogg_calloc(pigeons,sizeof(long *));
+    tempcount=_ogg_calloc(pigeons,sizeof(long));
 
     while(1){
       float errorpost=-1;
@@ -338,7 +338,7 @@ int main(int argc,char *argv[]){
 
     /* pare the list of shortlists; merge contained and similar lists
        together */
-    p->fitmap=malloc(pigeons*sizeof(long));
+    p->fitmap=_ogg_malloc(pigeons*sizeof(long));
     for(i=0;i<pigeons;i++)p->fitmap[i]=-1;
     while(changep){
       char buffer[80];
@@ -388,8 +388,8 @@ int main(int argc,char *argv[]){
     
 
     p->fittotal=totalstack;
-    p->fitlist=malloc((totalstack+1)*sizeof(long));
-    p->fitlength=malloc(pigeons*sizeof(long));
+    p->fitlist=_ogg_malloc((totalstack+1)*sizeof(long));
+    p->fitlength=_ogg_malloc(pigeons*sizeof(long));
     {
       long usage=0;
       for(i=0;i<pigeons;i++){
index a063fc9..3e3b41e 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility for paring low hit count cells from lattice codebook
- last mod: $Id: latticepare.c,v 1.5 2000/10/12 03:13:01 xiphmont Exp $
+ last mod: $Id: latticepare.c,v 1.6 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -248,7 +248,7 @@ int main(int argc,char *argv[]){
              if((lines&0xff)==0)spinnit("counting samples...",lines*cols);
              line=setup_line(in);
            }
-           pointlist=malloc((cols*lines+entries*dim)*sizeof(float));
+           pointlist=_ogg_malloc((cols*lines+entries*dim)*sizeof(float));
            
            rewind(in);
            line=setup_line(in);
@@ -312,15 +312,15 @@ int main(int argc,char *argv[]){
     long indexedpoints=0;
     long *entryindex;
     long *reventry;
-    long *membership=malloc(points*sizeof(long));
-    long *firsthead=malloc(entries*sizeof(long));
-    long *secondary=malloc(points*sizeof(long));
-    long *secondhead=malloc(entries*sizeof(long));
-
-    long *cellcount=calloc(entries,sizeof(long));
-    long *cellcount2=calloc(entries,sizeof(long));
-    float *cellerror=calloc(entries,sizeof(float));
-    float *cellerrormax=calloc(entries,sizeof(float));
+    long *membership=_ogg_malloc(points*sizeof(long));
+    long *firsthead=_ogg_malloc(entries*sizeof(long));
+    long *secondary=_ogg_malloc(points*sizeof(long));
+    long *secondhead=_ogg_malloc(entries*sizeof(long));
+
+    long *cellcount=_ogg_calloc(entries,sizeof(long));
+    long *cellcount2=_ogg_calloc(entries,sizeof(long));
+    float *cellerror=_ogg_calloc(entries,sizeof(float));
+    float *cellerrormax=_ogg_calloc(entries,sizeof(float));
     long cellsleft=entries;
     for(i=0;i<points;i++)membership[i]=-1;
     for(i=0;i<entries;i++)firsthead[i]=-1;
@@ -355,7 +355,7 @@ int main(int argc,char *argv[]){
     /* which cells are most heavily populated?  Protect as many from
        dispersal as the user has requested */
     {
-      long **countindex=calloc(entries,sizeof(long *));
+      long **countindex=_ogg_calloc(entries,sizeof(long *));
       for(i=0;i<entries;i++)countindex[i]=cellcount+i;
       qsort(countindex,entries,sizeof(long *),longsort);
       for(i=0;i<protect;i++){
@@ -491,7 +491,7 @@ int main(int argc,char *argv[]){
     free(cellerrormax);
     free(secondary);
 
-    pointindex=malloc(points*sizeof(long));
+    pointindex=_ogg_malloc(points*sizeof(long));
     /* make a point index of fall-through points */
     for(i=0;i<points;i++){
       int best=_best(b,pointlist+i*dim,1);
@@ -501,7 +501,7 @@ int main(int argc,char *argv[]){
     }
 
     /* make an entry index */
-    entryindex=malloc(entries*sizeof(long));
+    entryindex=_ogg_malloc(entries*sizeof(long));
     target=0;
     for(i=0;i<entries;i++){
       if(b->c->lengthlist[i]>0)
@@ -509,17 +509,17 @@ int main(int argc,char *argv[]){
     }
 
     /* make working space for a reverse entry index */
-    reventry=malloc(entries*sizeof(long));
+    reventry=_ogg_malloc(entries*sizeof(long));
 
     /* do the split */
     nt=b->c->nearest_tree=
-      calloc(1,sizeof(encode_aux_nearestmatch));
+      _ogg_calloc(1,sizeof(encode_aux_nearestmatch));
 
     nt->alloc=4096;
-    nt->ptr0=malloc(sizeof(long)*nt->alloc);
-    nt->ptr1=malloc(sizeof(long)*nt->alloc);
-    nt->p=malloc(sizeof(long)*nt->alloc);
-    nt->q=malloc(sizeof(long)*nt->alloc);
+    nt->ptr0=_ogg_malloc(sizeof(long)*nt->alloc);
+    nt->ptr1=_ogg_malloc(sizeof(long)*nt->alloc);
+    nt->p=_ogg_malloc(sizeof(long)*nt->alloc);
+    nt->q=_ogg_malloc(sizeof(long)*nt->alloc);
     nt->aux=0;
 
     fprintf(stderr,"Leaves added: %d              \n",
@@ -558,7 +558,7 @@ int main(int argc,char *argv[]){
        the lengths after the build */
     {
       int upper=0;
-      long *lengthlist=calloc(entries,sizeof(long));
+      long *lengthlist=_ogg_calloc(entries,sizeof(long));
       for(i=0;i<entries;i++){
        if(b->c->lengthlist[i]>0)
          entryindex[upper++]=entryindex[i];
index bf771e4..0c67835 100644 (file)
@@ -1,19 +1,19 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for setting entropy encoding parameters
            for lattice codebooks
- last mod: $Id: latticetune.c,v 1.3 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: latticetune.c,v 1.4 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -80,8 +80,8 @@ int main(int argc,char *argv[]){
   entries=b->entries;
   dim=b->dim;
 
-  hits=malloc(entries*sizeof(long));
-  lengths=calloc(entries,sizeof(long));
+  hits=_ogg_malloc(entries*sizeof(long));
+  lengths=_ogg_calloc(entries,sizeof(long));
   for(j=0;j<entries;j++)hits[j]=guard;
 
   in=fopen(argv[2],"r");
index e2a6119..76c94ac 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: metrics and quantization code for LSP VQ codebooks
- last mod: $Id: lspdata.c,v 1.13 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: lspdata.c,v 1.14 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -117,11 +117,8 @@ float vqext_metric(vqgen *v,float *e, float *p){
   return sqrt(acc/v->elements);
 }
 
-/* Data files are line-vectors, starting with zero.  If we want to
-   train on a subvector starting in the middle, we need to adjust the
-   data as if it was starting at zero.  we also need to add the 'aux'
-   value, which is an extra point at the end so we have leading and
-   trailing space */
+/* Data files are line-vectors, now just deltas.  The codebook entries
+   want to be monotonically increasing, so we adjust */
 
 /* assume vqext_aux==1 */
 void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
@@ -129,12 +126,13 @@ void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
   float base=0;
   int i;
 
-  if(start>0)base=b[start-1];
-  for(i=0;i<dim;i++)a[i]=b[i+start]-base;
+  for(i=0;i<dim;i++)
+    base=a[i]=b[i+start]+base;
+
   if(start+dim+1>cols) /* +aux */
-    a[i]=a[i-1];
+    a[i]=M_PI;
   else
-    a[i]=b[i+start]-base;
+    a[i]=b[i+start]+base;
   
   vqgen_addpoint(v,a,a+dim);
 }
@@ -155,6 +153,6 @@ void vqext_preprocess(vqgen *v){
     }
   }
 
-  weight=malloc(sizeof(float)*v->elements);
+  weight=_ogg_malloc(sizeof(float)*v->elements);
 }
 
index 9624b52..964ce1a 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: function calls to collect codebook metrics
- last mod: $Id: metrics.c,v 1.9 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: metrics.c,v 1.10 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -63,11 +63,11 @@ void process_preprocess(codebook **bs,char *basename){
   while(bs[books])books++;
   
   if(books){
-    histogram=calloc(books,sizeof(float *));
-    histogram_error=calloc(books,sizeof(float *));
-    histogram_errorsq=calloc(books,sizeof(float *));
-    histogram_hi=calloc(books,sizeof(float *));
-    histogram_lo=calloc(books,sizeof(float *));
+    histogram=_ogg_calloc(books,sizeof(float *));
+    histogram_error=_ogg_calloc(books,sizeof(float *));
+    histogram_errorsq=_ogg_calloc(books,sizeof(float *));
+    histogram_hi=_ogg_calloc(books,sizeof(float *));
+    histogram_lo=_ogg_calloc(books,sizeof(float *));
   }else{
     fprintf(stderr,"Specify at least one codebook\n");
     exit(1);
@@ -75,11 +75,11 @@ void process_preprocess(codebook **bs,char *basename){
 
   for(i=0;i<books;i++){
     codebook *b=bs[i];
-    histogram[i]=calloc(b->entries,sizeof(float));
-    histogram_error[i]=calloc(b->entries*b->dim,sizeof(float));
-    histogram_errorsq[i]=calloc(b->entries*b->dim,sizeof(float));
-    histogram_hi[i]=calloc(b->entries*b->dim,sizeof(float));
-    histogram_lo[i]=calloc(b->entries*b->dim,sizeof(float));
+    histogram[i]=_ogg_calloc(b->entries,sizeof(float));
+    histogram_error[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+    histogram_errorsq[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+    histogram_hi[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+    histogram_lo[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
   }
 }
 
index 6e1f1ef..b9203a4 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: metrics and quantization code for residue VQ codebooks
- last mod: $Id: residuedata.c,v 1.4 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: residuedata.c,v 1.5 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -154,7 +154,7 @@ void vqext_preprocess(vqgen *v){
     }
   }  
   vqext_quantize(v,&q);
-  quant_save=malloc(sizeof(float)*v->elements*v->entries);
+  quant_save=_ogg_malloc(sizeof(float)*v->elements*v->entries);
   memcpy(quant_save,_now(v,0),sizeof(float)*v->elements*v->entries);
   vqgen_unquantize(v,&q);
 
index 66bae59..9beab80 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: residue backend 0 partitioner/classifier
- last mod: $Id: residuesplit.c,v 1.5 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: residuesplit.c,v 1.6 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -162,9 +162,9 @@ int main(int argc, char *argv[]){
   /* how many parts?... */
   parts=argc-3;
   
-  ebound=malloc(sizeof(float)*parts);
-  mbound=malloc(sizeof(float)*parts);
-  subgrp=malloc(sizeof(int)*parts);
+  ebound=_ogg_malloc(sizeof(float)*parts);
+  mbound=_ogg_malloc(sizeof(float)*parts);
+  subgrp=_ogg_malloc(sizeof(int)*parts);
   
   for(i=0;i<parts-1;i++){
     char *pos=strchr(argv[4+i],',');
@@ -217,7 +217,7 @@ int main(int argc, char *argv[]){
     }
   }
   
-  vec=malloc(sizeof(float)*n);
+  vec=_ogg_malloc(sizeof(float)*n);
   /* get the input line by line and process it */
   while(!feof(res)){
     if(getline(res,vec,begin,n))
index 64a4122..6f8982c 100644 (file)
--- a/vq/run.c
+++ b/vq/run.c
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for loading and operating on codebooks
- last mod: $Id: run.c,v 1.11 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: run.c,v 1.12 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -44,8 +44,8 @@ extern void process_usage(void);
 
 int main(int argc,char *argv[]){
   char *basename;
-  codebook **b=calloc(1,sizeof(codebook *));
-  int *addmul=calloc(1,sizeof(int));
+  codebook **b=_ogg_calloc(1,sizeof(codebook *));
+  int *addmul=_ogg_calloc(1,sizeof(int));
   int books=0;
   int input=0;
   int interleave=0;
@@ -115,9 +115,9 @@ int main(int argc,char *argv[]){
        dot=strrchr(basename,'.');
        if(dot)*dot='\0';
 
-       b=realloc(b,sizeof(codebook *)*(books+2));
+       b=_ogg_realloc(b,sizeof(codebook *)*(books+2));
        b[books]=codebook_load(name);
-       addmul=realloc(addmul,sizeof(int)*(books+1));
+       addmul=_ogg_realloc(addmul,sizeof(int)*(books+1));
        addmul[books++]=multp;
        b[books]=NULL;
       }
index bd14ee2..3760180 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: utility main for training codebooks
- last mod: $Id: train.c,v 1.19 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: train.c,v 1.20 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -151,7 +151,7 @@ int main(int argc,char *argv[]){
       for(j=0;j<entries;j++){
        for(k=0;k<dim;k++){
          line=rline(in,out,0);
-         sscanf(line,"%lf",&a);
+         sscanf(line,"%f",&a);
          v.entrylist[i++]=a;
        }
       }      
@@ -161,7 +161,7 @@ int main(int argc,char *argv[]){
       i=0;
       for(j=0;j<entries;j++){
        line=rline(in,out,0);
-       sscanf(line,"%lf",&a);
+       sscanf(line,"%f",&a);
        v.bias[i++]=a;
       }
       
@@ -173,7 +173,7 @@ int main(int argc,char *argv[]){
          for(k=0;k<dim+vqext_aux;k++){
            line=rline(in,out,0);
            if(!line)break;
-           sscanf(line,"%lf",b+k);
+           sscanf(line,"%f",b+k);
          }
          if(feof(in))break;
          vqgen_addpoint(&v,b,b+dim);
@@ -206,11 +206,11 @@ int main(int argc,char *argv[]){
        }
        break;
       case 'e':
-       if(sscanf(argv[1],"%lf",&desired)!=1)
+       if(sscanf(argv[1],"%f",&desired)!=1)
          goto syner;
        break;
       case 'd':
-       if(sscanf(argv[1],"%lf",&mindist)!=1)
+       if(sscanf(argv[1],"%f",&mindist)!=1)
          goto syner;
        if(init)v.mindist=mindist;
        break;
@@ -260,6 +260,9 @@ int main(int argc,char *argv[]){
            while(*temp>32)temp++;
            while(*temp==' ')temp++;
          }
+
+         fprintf(stderr,"%d colums per line in file %s\n",cols,file);
+
        }
        {
          int i;
index 34d39fa..dec6064 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: prototypes for extermal metrics specific to data type
- last mod: $Id: vqext.h,v 1.10 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: vqext.h,v 1.11 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
index 494cbbf..df2ebd7 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: train a VQ codebook 
- last mod: $Id: vqgen.c,v 1.34 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: vqgen.c,v 1.35 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -250,13 +250,13 @@ void vqgen_init(vqgen *v,int elements,int aux,int entries,float mindist,
   v->aux=aux;
   v->mindist=mindist;
   v->allocated=32768;
-  v->pointlist=malloc(v->allocated*(v->elements+v->aux)*sizeof(float));
+  v->pointlist=_ogg_malloc(v->allocated*(v->elements+v->aux)*sizeof(float));
 
   v->entries=entries;
-  v->entrylist=malloc(v->entries*v->elements*sizeof(float));
-  v->assigned=malloc(v->entries*sizeof(long));
-  v->bias=calloc(v->entries,sizeof(float));
-  v->max=calloc(v->entries,sizeof(float));
+  v->entrylist=_ogg_malloc(v->entries*v->elements*sizeof(float));
+  v->assigned=_ogg_malloc(v->entries*sizeof(long));
+  v->bias=_ogg_calloc(v->entries,sizeof(float));
+  v->max=_ogg_calloc(v->entries,sizeof(float));
   if(metric)
     v->metric_func=metric;
   else
@@ -279,7 +279,7 @@ void vqgen_addpoint(vqgen *v, float *p,float *a){
 
   if(v->points>=v->allocated){
     v->allocated*=2;
-    v->pointlist=realloc(v->pointlist,v->allocated*(v->elements+v->aux)*
+    v->pointlist=_ogg_realloc(v->pointlist,v->allocated*(v->elements+v->aux)*
                         sizeof(float));
   }
 
@@ -371,10 +371,10 @@ float vqgen_iterate(vqgen *v,int biasp){
   fdesired=(float)v->points/v->entries;
   desired=fdesired;
   desired2=desired*2;
-  new=malloc(sizeof(float)*v->entries*v->elements);
-  new2=malloc(sizeof(float)*v->entries*v->elements);
-  nearcount=malloc(v->entries*sizeof(long));
-  nearbias=malloc(v->entries*desired2*sizeof(float));
+  new=_ogg_malloc(sizeof(float)*v->entries*v->elements);
+  new2=_ogg_malloc(sizeof(float)*v->entries*v->elements);
+  nearcount=_ogg_malloc(v->entries*sizeof(long));
+  nearbias=_ogg_malloc(v->entries*desired2*sizeof(float));
 
   /* fill in nearest points for entry biasing */
   /*memset(v->bias,0,sizeof(float)*v->entries);*/
index 32f27e7..2e681e2 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook 
- last mod: $Id: vqgen.h,v 1.15 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: vqgen.h,v 1.16 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
index aebfcc7..d6ca6bd 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook and the encoding decision 'tree'
- last mod: $Id: vqsplit.c,v 1.20 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: vqsplit.c,v 1.21 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -98,8 +98,8 @@ int vqsp_count(float *entrylist,float *pointlist,int dim,
   long *temppointsB=NULL;
   
   if(splitp){
-    temppointsA=malloc(points*sizeof(long));
-    temppointsB=malloc(points*sizeof(long));
+    temppointsA=_ogg_malloc(points*sizeof(long));
+    temppointsB=_ogg_malloc(points*sizeof(long));
   }
 
   memset(entryA,0,sizeof(long)*entries);
@@ -174,8 +174,8 @@ int lp_split(float *pointlist,long totalpoints,
   int dim=b->dim;
   float *entrylist=b->valuelist;
   long ret;
-  long *entryA=calloc(entries,sizeof(long));
-  long *entryB=calloc(entries,sizeof(long));
+  long *entryA=_ogg_calloc(entries,sizeof(long));
+  long *entryB=_ogg_calloc(entries,sizeof(long));
   long entriesA=0;
   long entriesB=0;
   long entriesC=0;
@@ -320,10 +320,10 @@ int lp_split(float *pointlist,long totalpoints,
     long thisaux=t->aux++;
     if(t->aux>=t->alloc){
       t->alloc*=2;
-      t->ptr0=realloc(t->ptr0,sizeof(long)*t->alloc);
-      t->ptr1=realloc(t->ptr1,sizeof(long)*t->alloc);
-      t->p=realloc(t->p,sizeof(long)*t->alloc);
-      t->q=realloc(t->q,sizeof(long)*t->alloc);
+      t->ptr0=_ogg_realloc(t->ptr0,sizeof(long)*t->alloc);
+      t->ptr1=_ogg_realloc(t->ptr1,sizeof(long)*t->alloc);
+      t->p=_ogg_realloc(t->p,sizeof(long)*t->alloc);
+      t->q=_ogg_realloc(t->q,sizeof(long)*t->alloc);
     }
     
     t->p[thisaux]=besti;
@@ -378,7 +378,7 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
   memset(b,0,sizeof(codebook));
   memset(c,0,sizeof(static_codebook));
   b->c=c;
-  t=c->nearest_tree=calloc(1,sizeof(encode_aux_nearestmatch));
+  t=c->nearest_tree=_ogg_calloc(1,sizeof(encode_aux_nearestmatch));
   c->maptype=2;
 
   /* make sure there are no duplicate entries and that every 
@@ -400,7 +400,7 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
   }
 
   {
-    v->assigned=calloc(v->entries,sizeof(long));
+    v->assigned=_ogg_calloc(v->entries,sizeof(long));
     for(i=0;i<v->points;i++){
       float *ppt=_point(v,i);
       float firstmetric=_Ndist(v->elements,_now(v,0),ppt);
@@ -436,24 +436,24 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
   fprintf(stderr,"Building a book with %ld unique entries...\n",v->entries);
 
   {
-    long *entryindex=malloc(v->entries*sizeof(long *));
-    long *pointindex=malloc(v->points*sizeof(long));
-    long *membership=malloc(v->points*sizeof(long));
-    long *reventry=malloc(v->entries*sizeof(long));
+    long *entryindex=_ogg_malloc(v->entries*sizeof(long *));
+    long *pointindex=_ogg_malloc(v->points*sizeof(long));
+    long *membership=_ogg_malloc(v->points*sizeof(long));
+    long *reventry=_ogg_malloc(v->entries*sizeof(long));
     long pointssofar=0;
       
     for(i=0;i<v->entries;i++)entryindex[i]=i;
     for(i=0;i<v->points;i++)pointindex[i]=i;
 
     t->alloc=4096;
-    t->ptr0=malloc(sizeof(long)*t->alloc);
-    t->ptr1=malloc(sizeof(long)*t->alloc);
-    t->p=malloc(sizeof(long)*t->alloc);
-    t->q=malloc(sizeof(long)*t->alloc);
+    t->ptr0=_ogg_malloc(sizeof(long)*t->alloc);
+    t->ptr1=_ogg_malloc(sizeof(long)*t->alloc);
+    t->p=_ogg_malloc(sizeof(long)*t->alloc);
+    t->q=_ogg_malloc(sizeof(long)*t->alloc);
     t->aux=0;
     c->dim=v->elements;
     c->entries=v->entries;
-    c->lengthlist=calloc(c->entries,sizeof(long));
+    c->lengthlist=_ogg_calloc(c->entries,sizeof(long));
     b->valuelist=v->entrylist; /* temporary; replaced later */
     b->dim=c->dim;
     b->entries=c->entries;
@@ -546,7 +546,7 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
   /* run all training points through the decision tree to get a final
      probability count */
   {
-    long *probability=malloc(c->entries*sizeof(long));
+    long *probability=_ogg_malloc(c->entries*sizeof(long));
     for(i=0;i<c->entries;i++)probability[i]=1; /* trivial guard */
     b->dim=c->dim;
 
@@ -573,8 +573,8 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
      assignment and packing to do it now) */
   {
     long *wordlen=c->lengthlist;
-    long *index=malloc(c->entries*sizeof(long));
-    long *revindex=malloc(c->entries*sizeof(long));
+    long *index=_ogg_malloc(c->entries*sizeof(long));
+    long *revindex=_ogg_malloc(c->entries*sizeof(long));
     int k;
     for(i=0;i<c->entries;i++)index[i]=i;
     isortvals=c->lengthlist;
@@ -594,9 +594,9 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){
     free(revindex);
 
     /* map lengthlist and vallist with index */
-    c->lengthlist=calloc(c->entries,sizeof(long));
-    b->valuelist=malloc(sizeof(float)*c->entries*c->dim);
-    c->quantlist=malloc(sizeof(long)*c->entries*c->dim);
+    c->lengthlist=_ogg_calloc(c->entries,sizeof(long));
+    b->valuelist=_ogg_malloc(sizeof(float)*c->entries*c->dim);
+    c->quantlist=_ogg_malloc(sizeof(long)*c->entries*c->dim);
     for(i=0;i<c->entries;i++){
       long e=index[i];
       for(k=0;k<c->dim;k++){
index bfb105f..8da7fd9 100644 (file)
@@ -1,18 +1,18 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE.  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE.    *
- * PLEASE READ THESE TERMS DISTRIBUTING.                            *
+ * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
+ * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
  *                                                                  *
- * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************
 
  function: build a VQ codebook decision tree 
- last mod: $Id: vqsplit.h,v 1.3 2000/10/12 03:13:02 xiphmont Exp $
+ last mod: $Id: vqsplit.h,v 1.4 2000/11/06 00:07:26 xiphmont Exp $
 
  ********************************************************************/