[xiph-cvs] cvs commit: vorbis/vq Makefile bookutil.c bookutil.h build.c cascade.c genericdata.c huffbuild.c latticebuild.c latticehint.c latticepare.c latticetune.c lspdata.c metrics.c residuedata.c residuesplit.c run.c train.c vqext.h vqgen.c vqgen.h vqsplit.c vqsplit.h Makefile.in

Monty xiphmont at xiph.org
Sun Nov 5 16:07:32 PST 2000



xiphmont    00/11/05 16:07:29

  Modified:    .        .cvsignore Makefile.am configure.in libvorbis.spec
               doc      Makefile.am
               examples .cvsignore Makefile.am chaining_example.c
                        decoder_example.c encoder_example.c
                        seeking_example.c vorbisfile_example.c
               include/vorbis Makefile.am codec.h vorbisfile.h
               lib      Makefile.am analysis.c barkmel.c block.c codebook.c
                        envelope.c envelope.h floor0.c iir.c iir.h info.c
                        lookup.c lookup.h lookup_data.h lookups.pl lpc.c
                        lpc.h lsp.c lsp.h mapping0.c masking.h mdct.c
                        mdct.h misc.c misc.h os.h psy.c psy.h psytune.c
                        registry.c registry.h res0.c scales.h sharedbook.c
                        smallft.c smallft.h synthesis.c time0.c
                        vorbisfile.c window.c window.h
               mac/compat strdup.c
               vq       bookutil.c bookutil.h build.c cascade.c
                        genericdata.c huffbuild.c latticebuild.c
                        latticehint.c latticepare.c latticetune.c lspdata.c
                        metrics.c residuedata.c residuesplit.c run.c
                        train.c vqext.h vqgen.c vqgen.h vqsplit.c vqsplit.h
  Added:       .        acinclude.m4 vorbis.m4
               doc      vorbis-clip.txt vorbis-errors.txt
               doc/vorbisfile .cvsignore Makefile.am 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_seek_page.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_seek_page.html ov_time_tell.html
                        ov_time_total.html overview.html reference.html
                        seekexample.html seeking.html
                        seeking_example_c.html seeking_test_c.html
                        seekingexample.html style.css vorbis_comment.html
                        vorbis_info.html vorbisfile_example_c.html
               include/vorbis vorbisenc.h
               lib      backends.h codebook.h codec_internal.h
                        vorbis-errors.txt vorbisenc.c
               lib/books .cvsignore Makefile.am 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
               lib/modes .cvsignore Makefile.am mode_A.h mode_B.h mode_C.h
                        mode_D.h mode_E.h modes.h
               vq       Makefile
  Removed:     doc      framing.html oggstream.html stream.png
               include/vorbis backends.h codebook.h mode_A.h mode_B.h
                        mode_C.h mode_D.h mode_E.h modes.h
               include/vorbis/book .cvsignore Makefile.am 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
               lib      bookinternal.h sharedbook.h
               vq       Makefile.in
  Log:
  Merge branch_beta3 onto the mainline.
  
  Monty

Revision  Changes    Path
1.3       +1 -0      vorbis/.cvsignore

Index: .cvsignore
===================================================================
RCS file: /usr/local/cvsroot/vorbis/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	2000/10/12 03:12:36	1.2
+++ .cvsignore	2000/11/06 00:06:45	1.3
@@ -11,3 +11,4 @@
 .libs
 .deps
 *.ogg
+vorbis-config

1.3       +4 -1      vorbis/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am	2000/10/12 03:12:36	1.2
+++ Makefile.am	2000/11/06 00:06:45	1.3
@@ -4,7 +4,10 @@
 
 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@"

1.26      +10 -124   vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- configure.in	2000/10/31 18:40:48	1.25
+++ configure.in	2000/11/06 00:06:45	1.26
@@ -15,12 +15,18 @@
 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 @@
 
 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 @@
         *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 @@
         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 @@
 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(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)

1.3       +64 -56    vorbis/libvorbis.spec

Index: libvorbis.spec
===================================================================
RCS file: /usr/local/cvsroot/vorbis/libvorbis.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- libvorbis.spec	2000/10/12 03:12:37	1.2
+++ libvorbis.spec	2000/11/06 00:06:45	1.3
@@ -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
-
-%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.
+%define name	libvorbis
+%define version	1.0.0
+%define release 1
+
+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 at 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
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
 
-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
-
 %files
 %defattr(-,root,root)
+%doc COPYING
+%doc README
+/usr/lib/libvorbis.so.*
+/usr/lib/libvorbisfile.so.*
+/usr/lib/libvorbisenc.so.*
 
-%doc README 
-/usr/bin/*
-
 %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 at redhat.com>
-- first pass.
+* Sat Oct 21 2000 Jack Moffitt <jack at icecast.org>
+- initial spec file created

1.2       +95 -0     vorbis/acinclude.m4

1.2       +96 -0     vorbis/vorbis.m4

1.4       +3 -1      vorbis/doc/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/doc/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.am	2000/10/31 18:42:58	1.3
+++ Makefile.am	2000/11/06 00:06:46	1.4
@@ -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

1.2       +139 -0    vorbis/doc/vorbis-clip.txt

1.2       +103 -0    vorbis/doc/vorbis-errors.txt

1.2       +2 -0      vorbis/doc/vorbisfile/.cvsignore

1.2       +19 -0     vorbis/doc/vorbisfile/Makefile.am

1.2       +105 -0    vorbis/doc/vorbisfile/OggVorbis_File.html

1.2       +86 -0     vorbis/doc/vorbisfile/chaining_example_c.html

1.2       +158 -0    vorbis/doc/vorbisfile/chainingexample.html

1.2       +63 -0     vorbis/doc/vorbisfile/datastructures.html

1.2       +50 -0     vorbis/doc/vorbisfile/decoding.html

1.2       +205 -0    vorbis/doc/vorbisfile/example.html

1.2       +39 -0     vorbis/doc/vorbisfile/exampleindex.html

1.2       +96 -0     vorbis/doc/vorbisfile/fileinfo.html

1.2       +42 -0     vorbis/doc/vorbisfile/index.html

1.2       +56 -0     vorbis/doc/vorbisfile/initialization.html

1.2       +73 -0     vorbis/doc/vorbisfile/ov_bitrate.html

1.2       +65 -0     vorbis/doc/vorbisfile/ov_bitrate_instant.html

1.2       +66 -0     vorbis/doc/vorbisfile/ov_callbacks.html

1.2       +63 -0     vorbis/doc/vorbisfile/ov_clear.html

1.2       +65 -0     vorbis/doc/vorbisfile/ov_comment.html

1.2       +65 -0     vorbis/doc/vorbisfile/ov_info.html

1.2       +112 -0    vorbis/doc/vorbisfile/ov_open.html

1.2       +108 -0    vorbis/doc/vorbisfile/ov_open_callbacks.html

1.2       +82 -0     vorbis/doc/vorbisfile/ov_pcm_seek.html

1.2       +83 -0     vorbis/doc/vorbisfile/ov_pcm_seek_page.html

1.2       +61 -0     vorbis/doc/vorbisfile/ov_pcm_tell.html

1.2       +66 -0     vorbis/doc/vorbisfile/ov_pcm_total.html

1.2       +77 -0     vorbis/doc/vorbisfile/ov_raw_seek.html

1.2       +61 -0     vorbis/doc/vorbisfile/ov_raw_tell.html

1.2       +66 -0     vorbis/doc/vorbisfile/ov_raw_total.html

1.2       +99 -0     vorbis/doc/vorbisfile/ov_read.html

1.2       +65 -0     vorbis/doc/vorbisfile/ov_seekable.html

1.2       +67 -0     vorbis/doc/vorbisfile/ov_serialnumber.html

1.2       +65 -0     vorbis/doc/vorbisfile/ov_streams.html

1.2       +71 -0     vorbis/doc/vorbisfile/ov_time_seek.html

1.2       +84 -0     vorbis/doc/vorbisfile/ov_time_seek_page.html

1.2       +63 -0     vorbis/doc/vorbisfile/ov_time_tell.html

1.2       +74 -0     vorbis/doc/vorbisfile/ov_time_total.html

1.2       +44 -0     vorbis/doc/vorbisfile/overview.html

1.2       +66 -0     vorbis/doc/vorbisfile/reference.html

1.2       +139 -0    vorbis/doc/vorbisfile/seekexample.html

1.2       +67 -0     vorbis/doc/vorbisfile/seeking.html

1.2       +83 -0     vorbis/doc/vorbisfile/seeking_example_c.html

1.2       +83 -0     vorbis/doc/vorbisfile/seeking_test_c.html

1.2       +204 -0    vorbis/doc/vorbisfile/seekingexample.html

1.2       +7 -0      vorbis/doc/vorbisfile/style.css

1.2       +67 -0     vorbis/doc/vorbisfile/vorbis_comment.html

1.2       +102 -0    vorbis/doc/vorbisfile/vorbis_info.html

1.2       +106 -0    vorbis/doc/vorbisfile/vorbisfile_example_c.html

1.3       +1 -0      vorbis/examples/.cvsignore

Index: .cvsignore
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore	2000/10/12 03:12:39	1.2
+++ .cvsignore	2000/11/06 00:06:53	1.3
@@ -6,3 +6,4 @@
 decoder_example
 chaining_example
 vorbisfile_example
+seeking_example

1.4       +5 -4      vorbis/examples/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.am	2000/10/13 19:48:02	1.3
+++ Makefile.am	2000/11/06 00:06:53	1.4
@@ -7,16 +7,17 @@
 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@"

1.7       +7 -7      vorbis/examples/chaining_example.c

Index: chaining_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/chaining_example.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- chaining_example.c	2000/10/12 03:12:39	1.6
+++ chaining_example.c	2000/11/06 00:06:53	1.7
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 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);
   }

1.14      +9 -9      vorbis/examples/decoder_example.c

Index: decoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/decoder_example.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- decoder_example.c	2000/10/12 03:12:39	1.13
+++ decoder_example.c	2000/11/06 00:06:53	1.14
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
           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 @@
       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 @@
             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 */

1.15      +12 -10    vorbis/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- encoder_example.c	2000/10/12 03:12:39	1.14
+++ encoder_example.c	2000/11/06 00:06:53	1.15
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 
   /* 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 @@
   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 */

1.5       +7 -7      vorbis/examples/seeking_example.c

Index: seeking_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/seeking_example.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- seeking_example.c	2000/10/12 03:12:39	1.4
+++ seeking_example.c	2000/11/06 00:06:54	1.5
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 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);
   }

1.3       +9 -13     vorbis/examples/vorbisfile_example.c

Index: vorbisfile_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/vorbisfile_example.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vorbisfile_example.c	2000/10/12 03:12:39	1.2
+++ vorbisfile_example.c	2000/11/06 00:06:54	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   
   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;
     }
   }
 

1.3       +1 -3      vorbis/include/vorbis/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am	2000/10/12 03:12:40	1.2
+++ Makefile.am	2000/11/06 00:06:55	1.3
@@ -4,8 +4,6 @@
 
 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
 

1.33      +38 -133   vorbis/include/vorbis/codec.h

Index: codec.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/codec.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- codec.h	2000/10/12 07:28:03	1.32
+++ codec.h	2000/11/06 00:06:55	1.33
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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,70 +24,8 @@
 {
 #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;
   int channels;
@@ -111,51 +49,17 @@
   long bitrate_upper;
   long bitrate_nominal;
   long bitrate_lower;
-
-  /* Vorbis supports only short and long blocks, but allows the
-     encoder to choose the sizes */
-
-  long blocksizes[2];
+  long bitrate_window;
 
-  /* 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 @@
   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 @@
   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 */
@@ -238,8 +117,16 @@
   long res_bits;
 
 } vorbis_block;
+
+/* 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. *************************************************/
 
-#include "vorbis/backends.h"
+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,
@@ -310,6 +197,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
 }

1.10      +6 -6      vorbis/include/vorbis/vorbisfile.h

Index: vorbisfile.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/vorbisfile.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- vorbisfile.h	2000/10/13 19:48:02	1.9
+++ vorbisfile.h	2000/11/06 00:06:56	1.10
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.2       +47 -0     vorbis/include/vorbis/vorbisenc.h

1.3       +13 -4     vorbis/lib/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am	2000/10/12 03:12:52	1.2
+++ Makefile.am	2000/11/06 00:07:00	1.3
@@ -2,20 +2,29 @@
 
 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@"

1.35      +20 -18    vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- analysis.c	2000/10/12 03:12:52	1.34
+++ analysis.c	2000/11/06 00:07:00	1.35
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -27,10 +27,12 @@
 
 /* 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 @@
 
   /* 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 @@
     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);
 }
 

1.2       +6 -6      vorbis/lib/barkmel.c

Index: barkmel.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/barkmel.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- barkmel.c	2000/01/04 09:04:58	1.1
+++ barkmel.c	2000/11/06 00:07:00	1.2
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.40      +169 -133  vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- block.c	2000/10/12 03:12:52	1.39
+++ block.c	2000/11/06 00:07:00	1.40
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 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 @@
     }
     /* highly conservative */
     vb->localalloc=bytes;
-    vb->localstore=malloc(vb->localalloc);
+    vb->localstore=_ogg_malloc(vb->localalloc);
     vb->localtop=0;
   }
   {
@@ -139,7 +138,7 @@
   }
   /* 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 @@
 
 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]);
-
-  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->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]);
+
+  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 @@
   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 @@
   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 @@
 
 /* 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 @@
   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(b->ve){
+	_ve_envelope_clear(b->ve);
+	free(b->ve);
+      }
 
-    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->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 @@
       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 @@
 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 @@
     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 @@
 
 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 @@
        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 @@
 
         /* 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 @@
   }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_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 @@
      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 @@
   }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 @@
   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 @@
 
   /* 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_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_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 @@
   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 @@
     /* 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 @@
     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 @@
        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_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);
 }

1.19      +12 -13    vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- codebook.c	2000/10/12 03:12:52	1.18
+++ codebook.c	2000/11/06 00:07:00	1.19
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -21,10 +21,8 @@
 #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_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 @@
   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 @@
     /* 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 @@
       }
       
       /* 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 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++) {

1.24      +21 -17    vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- envelope.c	2000/10/12 03:12:52	1.23
+++ envelope.c	2000/11/06 00:07:00	1.24
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 
 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 @@
     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 @@
   /* 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 @@
       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);
   }
   

1.11      +6 -6      vorbis/lib/envelope.h

Index: envelope.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- envelope.h	2000/10/12 03:12:52	1.10
+++ envelope.h	2000/11/06 00:07:00	1.11
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.26      +32 -19    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- floor0.c	2000/10/12 03:12:52	1.25
+++ floor0.c	2000/11/06 00:07:00	1.26
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -21,11 +21,11 @@
 #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 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 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 @@
   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 @@
   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 @@
      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 @@
   }
   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 @@
 
     /* 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 @@
     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 @@
 
 /* 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
 };
 

1.3       +22 -12    vorbis/lib/iir.c

Index: iir.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/iir.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- iir.c	2000/10/12 03:12:52	1.2
+++ iir.c	2000/11/06 00:07:00	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
     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 @@
   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 @@
 
   /* 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;
 

1.3       +11 -11    vorbis/lib/iir.h

Index: iir.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/iir.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- iir.h	2000/10/12 03:12:52	1.2
+++ iir.h	2000/11/06 00:07:00	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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

1.32      +172 -159  vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- info.c	2000/10/12 03:12:52	1.31
+++ info.c	2000/11/06 00:07:00	1.32
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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_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 @@
 /* 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 @@
   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 @@
   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 @@
   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 @@
       _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 @@
       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 @@
       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 @@
   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_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 @@
                               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 @@
   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 @@
   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 @@
   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 @@
   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);
 }
 

1.3       +13 -11    vorbis/lib/lookup.c

Index: lookup.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lookup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lookup.c	2000/10/12 03:12:53	1.2
+++ lookup.c	2000/11/06 00:07:01	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 #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]);

1.3       +6 -6      vorbis/lib/lookup.h

Index: lookup.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lookup.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lookup.h	2000/10/12 03:12:53	1.2
+++ lookup.h	2000/11/06 00:07:01	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.3       +6 -6      vorbis/lib/lookup_data.h

Index: lookup_data.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lookup_data.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lookup_data.h	2000/10/12 03:12:53	1.2
+++ lookup_data.h	2000/11/06 00:07:01	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.3       +6 -6      vorbis/lib/lookups.pl

Index: lookups.pl
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lookups.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lookups.pl	2000/10/12 03:12:53	1.2
+++ lookups.pl	2000/11/06 00:07:01	1.3
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.27      +6 -6      vorbis/lib/lpc.c

Index: lpc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lpc.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- lpc.c	2000/10/12 03:12:53	1.26
+++ lpc.c	2000/11/06 00:07:01	1.27
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.15      +6 -6      vorbis/lib/lpc.h

Index: lpc.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lpc.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- lpc.h	2000/10/12 03:12:53	1.14
+++ lpc.h	2000/11/06 00:07:01	1.15
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.12      +15 -10    vorbis/lib/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lsp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- lsp.c	2000/10/18 21:27:15	1.11
+++ lsp.c	2000/11/06 00:07:01	1.12
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
                             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 @@
       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

1.6       +6 -6      vorbis/lib/lsp.h

Index: lsp.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lsp.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- lsp.h	2000/10/12 03:12:53	1.5
+++ lsp.h	2000/11/06 00:07:01	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.17      +52 -40    vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- mapping0.c	2000/10/12 03:12:53	1.16
+++ mapping0.c	2000/11/06 00:07:01	1.17
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
                      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 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 @@
 /* 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 @@
   }
   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 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 @@
   /* 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_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 @@
   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 @@
 
 /* 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
 };
 
 

1.6       +6 -6      vorbis/lib/masking.h

Index: masking.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/masking.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- masking.h	2000/10/12 03:12:53	1.5
+++ masking.h	2000/11/06 00:07:01	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.18      +67 -31    vorbis/lib/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- mdct.c	2000/10/12 03:12:53	1.17
+++ mdct.c	2000/11/06 00:07:01	1.18
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
     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 @@
         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 @@
     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 @@
       *x2--=(-wD+wBCO-wACE)*.5;
       *x1++=( wD+wBCO-wACE)*.5; 
       *x2--=( wC-wACO-wBCE)*.5;
-    }
+    }while(i--);
   }
   return(x);
 }

1.13      +6 -6      vorbis/lib/mdct.h

Index: mdct.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- mdct.h	2000/10/12 03:12:53	1.12
+++ mdct.h	2000/11/06 00:07:01	1.13
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.2       +12 -12    vorbis/lib/misc.c

Index: misc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/misc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- misc.c	2000/03/10 23:55:19	1.1
+++ misc.c	2000/11/06 00:07:01	1.2
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at xiph.org> and the XIPHOPHORUS Company            *
  * http://www.xiph.org/                                             *
  *                                                                  *
  ********************************************************************/
@@ -42,11 +42,11 @@
   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 @@
   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);

1.6       +13 -13    vorbis/lib/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/misc.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- misc.h	2000/10/12 03:12:53	1.5
+++ misc.h	2000/11/06 00:07:01	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 _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

1.11      +61 -6     vorbis/lib/os.h

Index: os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- os.h	2000/10/12 03:12:53	1.10
+++ os.h	2000/11/06 00:07:01	1.11
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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_
 
@@ -55,6 +57,59 @@
 
 #ifndef max
 #  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 */

1.30      +22 -16    vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- psy.c	2000/10/12 03:12:53	1.29
+++ psy.c	2000/11/06 00:07:01	1.30
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   }
 }
 
+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 @@
 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 @@
     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 */

1.16      +44 -6     vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- psy.h	2000/10/12 03:12:53	1.15
+++ psy.h	2000/11/06 00:07:02	1.16
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -24,6 +24,41 @@
 #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 @@
 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);

1.8       +16 -16    vorbis/lib/psytune.c

Index: psytune.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psytune.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- psytune.c	2000/10/12 03:12:53	1.7
+++ psytune.c	2000/11/06 00:07:02	1.8
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 
   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 @@
     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);

1.4       +6 -6      vorbis/lib/registry.c

Index: registry.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- registry.c	2000/03/10 13:21:18	1.3
+++ registry.c	2000/11/06 00:07:02	1.4
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.3       +8 -6      vorbis/lib/registry.h

Index: registry.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- registry.h	2000/01/22 13:28:30	1.2
+++ registry.h	2000/11/06 00:07:02	1.3
@@ -1,23 +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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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

1.19      +29 -18    vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- res0.c	2000/10/12 03:12:53	1.18
+++ res0.c	2000/11/06 00:07:02	1.19
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 /* 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 @@
   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_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 @@
   &res0_pack,
   &res0_unpack,
   &res0_look,
+  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
   &res0_forward,

1.7       +6 -6      vorbis/lib/scales.h

Index: scales.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/scales.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- scales.h	2000/10/12 03:12:54	1.6
+++ scales.h	2000/11/06 00:07:02	1.7
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.10      +39 -30    vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sharedbook.c	2000/10/12 03:12:54	1.9
+++ sharedbook.c	2000/11/06 00:07:02	1.10
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 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 @@
 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 @@
   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 @@
     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 @@
 }
 
 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){

1.10      +8 -8      vorbis/lib/smallft.c

Index: smallft.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/smallft.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- smallft.c	2000/10/12 03:12:54	1.9
+++ smallft.c	2000/11/06 00:07:02	1.10
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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_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);
 }
 

1.8       +6 -6      vorbis/lib/smallft.h

Index: smallft.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/smallft.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- smallft.h	2000/10/12 03:12:54	1.7
+++ smallft.h	2000/11/06 00:07:02	1.8
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
 ********************************************************************/
 

1.19      +20 -18    vorbis/lib/synthesis.c

Index: synthesis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/synthesis.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- synthesis.c	2000/10/12 03:12:54	1.18
+++ synthesis.c	2000/11/06 00:07:02	1.19
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -24,10 +24,12 @@
 #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 @@
   /* 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 @@
   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]));
 }
 
 

1.7       +10 -7     vorbis/lib/time0.c

Index: time0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/time0.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- time0.c	2000/10/12 03:12:54	1.6
+++ time0.c	2000/11/06 00:07:02	1.7
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 
 /* 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
 };

1.31      +184 -150  vorbis/lib/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- vorbisfile.c	2000/10/13 19:48:03	1.30
+++ vorbisfile.c	2000/11/06 00:07:02	1.31
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
               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 @@
   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 @@
     }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 @@
    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 @@
     _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 @@
   /* 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 @@
    (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 @@
     
     _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 @@
 
   _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 @@
                           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 @@
       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 @@
   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 @@
       /* 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 @@
 
       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 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 @@
   }    
   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 @@
   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 @@
   /* 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_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 @@
    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 @@
       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 @@
     }
 
     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 @@
            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 @@
    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 @@
             return vf->vi[i].bitrate_upper;
           }
         }
-	return(-1);
+	return(OV_FALSE);
       }
     }
   }
@@ -681,7 +699,7 @@
 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 @@
 
 /* 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 @@
             -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 @@
             -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 @@
             -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 @@
    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 @@
      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 @@
   /* 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 @@
    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 @@
     ogg_page og;
     while(begin<end){
       long bisect;
-      long ret;
     
       if(end-begin<CHUNKSIZE){
         bisect=begin;
@@ -856,43 +879,51 @@
     
       _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 @@
   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 @@
     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 @@
   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 @@
     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 @@
 }
 
 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 @@
                  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 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 @@
           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 @@
 
     /* 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);
     }
   }
 }

1.9       +7 -7      vorbis/lib/window.c

Index: window.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/window.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- window.c	2000/10/12 03:12:54	1.8
+++ window.c	2000/11/06 00:07:03	1.9
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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:

1.5       +6 -6      vorbis/lib/window.h

Index: window.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/window.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- window.h	2000/10/12 03:12:54	1.4
+++ window.h	2000/11/06 00:07:03	1.5
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.2       +146 -0    vorbis/lib/backends.h

1.2       +157 -0    vorbis/lib/codebook.h

1.2       +112 -0    vorbis/lib/codec_internal.h

1.2       +83 -0     vorbis/lib/vorbis-errors.txt

1.2       +154 -0    vorbis/lib/vorbisenc.c

1.2       +2 -0      vorbis/lib/books/.cvsignore

1.2       +27 -0     vorbis/lib/books/Makefile.am

1.2       +1157 -0   vorbis/lib/books/lsp12_0.vqh

1.2       +2073 -0   vorbis/lib/books/lsp30_0.vqh

1.2       +63 -0     vorbis/lib/books/res0_1024a_128_1.vqh

1.2       +63 -0     vorbis/lib/books/res0_1024a_128_2.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_128_3.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_128_4.vqh

1.2       +212 -0    vorbis/lib/books/res0_1024a_128_5.vqh

1.2       +212 -0    vorbis/lib/books/res0_1024a_128_6.vqh

1.2       +75 -0     vorbis/lib/books/res0_1024a_128_7.vqh

1.2       +86 -0     vorbis/lib/books/res0_1024a_128_8.vqh

1.2       +115 -0    vorbis/lib/books/res0_1024a_128_9.vqh

1.2       +63 -0     vorbis/lib/books/res0_1024a_160_1.vqh

1.2       +63 -0     vorbis/lib/books/res0_1024a_160_2.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_160_3.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_160_4.vqh

1.2       +212 -0    vorbis/lib/books/res0_1024a_160_5.vqh

1.2       +212 -0    vorbis/lib/books/res0_1024a_160_6.vqh

1.2       +75 -0     vorbis/lib/books/res0_1024a_160_7.vqh

1.2       +86 -0     vorbis/lib/books/res0_1024a_160_8.vqh

1.2       +115 -0    vorbis/lib/books/res0_1024a_160_9.vqh

1.2       +63 -0     vorbis/lib/books/res0_1024a_192_1.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_192_2.vqh

1.2       +212 -0    vorbis/lib/books/res0_1024a_192_3.vqh

1.2       +70 -0     vorbis/lib/books/res0_1024a_192_4.vqh

1.2       +115 -0    vorbis/lib/books/res0_1024a_192_5.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_256_1.vqh

1.2       +75 -0     vorbis/lib/books/res0_1024a_256_2.vqh

1.2       +86 -0     vorbis/lib/books/res0_1024a_256_3.vqh

1.2       +100 -0    vorbis/lib/books/res0_1024a_256_4.vqh

1.2       +133 -0    vorbis/lib/books/res0_1024a_256_5.vqh

1.2       +99 -0     vorbis/lib/books/res0_1024a_350_1.vqh

1.2       +75 -0     vorbis/lib/books/res0_1024a_350_2.vqh

1.2       +86 -0     vorbis/lib/books/res0_1024a_350_3.vqh

1.2       +100 -0    vorbis/lib/books/res0_1024a_350_4.vqh

1.2       +133 -0    vorbis/lib/books/res0_1024a_350_5.vqh

1.2       +63 -0     vorbis/lib/books/res0_128a_128_1.vqh

1.2       +99 -0     vorbis/lib/books/res0_128a_128_2.vqh

1.2       +212 -0    vorbis/lib/books/res0_128a_128_3.vqh

1.2       +70 -0     vorbis/lib/books/res0_128a_128_4.vqh

1.2       +115 -0    vorbis/lib/books/res0_128a_128_5.vqh

1.2       +63 -0     vorbis/lib/books/res0_128a_160_1.vqh

1.2       +99 -0     vorbis/lib/books/res0_128a_160_2.vqh

1.2       +212 -0    vorbis/lib/books/res0_128a_160_3.vqh

1.2       +70 -0     vorbis/lib/books/res0_128a_160_4.vqh

1.2       +115 -0    vorbis/lib/books/res0_128a_160_5.vqh

1.2       +63 -0     vorbis/lib/books/res0_128a_192_1.vqh

1.2       +99 -0     vorbis/lib/books/res0_128a_192_2.vqh

1.2       +212 -0    vorbis/lib/books/res0_128a_192_3.vqh

1.2       +70 -0     vorbis/lib/books/res0_128a_192_4.vqh

1.2       +115 -0    vorbis/lib/books/res0_128a_192_5.vqh

1.2       +99 -0     vorbis/lib/books/res0_128a_256_1.vqh

1.2       +75 -0     vorbis/lib/books/res0_128a_256_2.vqh

1.2       +86 -0     vorbis/lib/books/res0_128a_256_3.vqh

1.2       +100 -0    vorbis/lib/books/res0_128a_256_4.vqh

1.2       +133 -0    vorbis/lib/books/res0_128a_256_5.vqh

1.2       +99 -0     vorbis/lib/books/res0_128a_350_1.vqh

1.2       +75 -0     vorbis/lib/books/res0_128a_350_2.vqh

1.2       +86 -0     vorbis/lib/books/res0_128a_350_3.vqh

1.2       +100 -0    vorbis/lib/books/res0_128a_350_4.vqh

1.2       +133 -0    vorbis/lib/books/res0_128a_350_5.vqh

1.2       +42 -0     vorbis/lib/books/resaux0_1024a_128.vqh

1.2       +42 -0     vorbis/lib/books/resaux0_1024a_160.vqh

1.2       +38 -0     vorbis/lib/books/resaux0_1024a_192.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_1024a_256.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_1024a_350.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_128a_128.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_128a_160.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_128a_192.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_128a_256.vqh

1.2       +116 -0    vorbis/lib/books/resaux0_128a_350.vqh

1.2       +2 -0      vorbis/lib/modes/.cvsignore

1.2       +5 -0      vorbis/lib/modes/Makefile.am

1.2       +205 -0    vorbis/lib/modes/mode_A.h

1.2       +204 -0    vorbis/lib/modes/mode_B.h

1.2       +195 -0    vorbis/lib/modes/mode_C.h

1.2       +178 -0    vorbis/lib/modes/mode_D.h

1.2       +162 -0    vorbis/lib/modes/mode_E.h

1.2       +28 -0     vorbis/lib/modes/modes.h

1.2       +1 -1      vorbis/mac/compat/strdup.c

Index: strdup.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/mac/compat/strdup.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- strdup.c	2000/08/14 22:33:50	1.1
+++ strdup.c	2000/11/06 00:07:25	1.2
@@ -1 +1 @@
-#include <sys/types.h>
#include <string.h>
#include <stdlib.h>

char *strdup(const char *inStr)
{
	char *outStr = NULL;
	
	if (inStr == NULL) {
		return NULL;
	}
	
	outStr = malloc(strlen(inStr) + 1);
	
	if (outStr != NULL) {
		strcpy(outStr, inStr);
	}
	
	return outStr;
}
\ No newline at end of file
+#include <sys/types.h>
#include <string.h>
#include <stdlib.h>

char *strdup(const char *inStr)
{
	char *outStr = NULL;
	
	if (inStr == NULL) {
		return NULL;
	}
	
	outStr = _ogg_malloc(strlen(inStr) + 1);
	
	if (outStr != NULL) {
		strcpy(outStr, inStr);
	}
	
	return outStr;
}
\ No newline at end of file

1.18      +30 -30    vorbis/vq/bookutil.c

Index: bookutil.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/bookutil.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- bookutil.c	2000/10/12 03:13:01	1.17
+++ bookutil.c	2000/11/06 00:07:25	1.18
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
       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 @@
    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 @@
   /* 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 @@
     /* 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 @@
     /* 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 @@
     /* 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 @@
     /* 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 @@
   
   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 @@
     /* 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 @@
     /* 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 @@
   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 @@
     /* 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 @@
     /* 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 @@
     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 @@
     /* 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 @@
   /* 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 @@
   /* 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 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 @@
      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 @@
  " ********************************************************************/\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 @@
   else
     fprintf(out,"\tNULL,\n");
 
-  fprintf(out,"};\n\n");
+  fprintf(out,"\t0\n};\n\n");
 
   fprintf(out,"\n#endif\n");
 }

1.8       +6 -6      vorbis/vq/bookutil.h

Index: bookutil.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/bookutil.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- bookutil.h	2000/10/12 03:13:01	1.7
+++ bookutil.h	2000/11/06 00:07:25	1.8
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.16      +11 -11    vorbis/vq/build.c

Index: build.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/build.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- build.c	2000/10/12 03:13:01	1.15
+++ build.c	2000/11/06 00:07:25	1.16
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
       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 @@
   /* 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 @@
       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);

1.8       +6 -6      vorbis/vq/cascade.c

Index: cascade.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/cascade.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- cascade.c	2000/10/12 03:13:01	1.7
+++ cascade.c	2000/11/06 00:07:25	1.8
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.7       +6 -6      vorbis/vq/genericdata.c

Index: genericdata.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/genericdata.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- genericdata.c	2000/10/12 03:13:01	1.6
+++ genericdata.c	2000/11/06 00:07:25	1.7
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.6       +12 -12    vorbis/vq/huffbuild.c

Index: huffbuild.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/huffbuild.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- huffbuild.c	2000/10/12 03:13:01	1.5
+++ huffbuild.c	2000/11/06 00:07:25	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 
@@ -20,11 +20,11 @@
 #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 @@
 
   {
     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 @@
  " ********************************************************************/\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 @@
     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);

1.7       +11 -11    vorbis/vq/latticebuild.c

Index: latticebuild.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticebuild.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- latticebuild.c	2000/10/12 03:13:01	1.6
+++ latticebuild.c	2000/11/06 00:07:25	1.7
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 
   {
     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 @@
   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;
 

1.4       +21 -21    vorbis/vq/latticehint.c

Index: latticehint.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticehint.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- latticehint.c	2000/10/12 03:13:01	1.3
+++ latticehint.c	2000/11/06 00:07:26	1.4
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
     /* 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 @@
     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 @@
       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 @@
     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 @@
 
     /* 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 @@
     
 
     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++){

1.6       +26 -26    vorbis/vq/latticepare.c

Index: latticepare.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticepare.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- latticepare.c	2000/10/12 03:13:01	1.5
+++ latticepare.c	2000/11/06 00:07:26	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
               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 @@
     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 @@
     /* 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 @@
     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 @@
     }
 
     /* 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 @@
     }
 
     /* 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 @@
        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];

1.4       +8 -8      vorbis/vq/latticetune.c

Index: latticetune.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticetune.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- latticetune.c	2000/10/12 03:13:02	1.3
+++ latticetune.c	2000/11/06 00:07:26	1.4
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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");

1.14      +14 -16    vorbis/vq/lspdata.c

Index: lspdata.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/lspdata.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- lspdata.c	2000/10/12 03:13:02	1.13
+++ lspdata.c	2000/11/06 00:07:26	1.14
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
   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 @@
     }
   }
 
-  weight=malloc(sizeof(float)*v->elements);
+  weight=_ogg_malloc(sizeof(float)*v->elements);
 }
 

1.10      +16 -16    vorbis/vq/metrics.c

Index: metrics.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/metrics.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- metrics.c	2000/10/12 03:13:02	1.9
+++ metrics.c	2000/11/06 00:07:26	1.10
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 
   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));
   }
 }
 

1.5       +7 -7      vorbis/vq/residuedata.c

Index: residuedata.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/residuedata.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- residuedata.c	2000/10/12 03:13:02	1.4
+++ residuedata.c	2000/11/06 00:07:26	1.5
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
     }
   }  
   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);
 

1.6       +10 -10    vorbis/vq/residuesplit.c

Index: residuesplit.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/residuesplit.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- residuesplit.c	2000/10/12 03:13:02	1.5
+++ residuesplit.c	2000/11/06 00:07:26	1.6
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   /* 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 @@
     }
   }
   
-  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))

1.12      +10 -10    vorbis/vq/run.c

Index: run.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/run.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- run.c	2000/10/12 03:13:02	1.11
+++ run.c	2000/11/06 00:07:26	1.12
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
 
 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 @@
         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;
       }

1.20      +14 -11    vorbis/vq/train.c

Index: train.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/train.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- train.c	2000/10/12 03:13:02	1.19
+++ train.c	2000/11/06 00:07:26	1.20
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
       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 @@
       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 @@
           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 @@
         }
         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 @@
             while(*temp>32)temp++;
             while(*temp==' ')temp++;
           }
+
+	  fprintf(stderr,"%d colums per line in file %s\n",cols,file);
+
         }
         {
           int i;

1.11      +6 -6      vorbis/vq/vqext.h

Index: vqext.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/vqext.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- vqext.h	2000/10/12 03:13:02	1.10
+++ vqext.h	2000/11/06 00:07:26	1.11
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.35      +16 -16    vorbis/vq/vqgen.c

Index: vqgen.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/vqgen.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- vqgen.c	2000/10/12 03:13:02	1.34
+++ vqgen.c	2000/11/06 00:07:26	1.35
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 @@
 
   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 @@
   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);*/

1.16      +6 -6      vorbis/vq/vqgen.h

Index: vqgen.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/vqgen.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- vqgen.h	2000/10/12 03:13:02	1.15
+++ vqgen.h	2000/11/06 00:07:26	1.16
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.21      +31 -31    vorbis/vq/vqsplit.c

Index: vqsplit.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/vqsplit.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vqsplit.c	2000/10/12 03:13:02	1.20
+++ vqsplit.c	2000/11/06 00:07:26	1.21
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 @@
   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 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 @@
     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 @@
   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 @@
   }
 
   {
-    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 @@
   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 @@
   /* 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 @@
      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 @@
     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++){

1.4       +6 -6      vorbis/vq/vqsplit.h

Index: vqsplit.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/vqsplit.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- vqsplit.h	2000/10/12 03:13:02	1.3
+++ vqsplit.h	2000/11/06 00:07:26	1.4
@@ -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 at xiph.org> and The XIPHOPHORUS Company            *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
+ * by Monty <monty at 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 $
 
  ********************************************************************/
 

1.2       +90 -0     vorbis/vq/Makefile

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list