summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-08-15 08:33:48 +0000
committerMonty <xiphmont@xiph.org>2000-08-15 08:33:48 +0000
commit1d051d3b55415bae2860f9566bc967273d386531 (patch)
treeabdeaa4d7780cf5b6521dcc370ecafbc8df6a481
parent18352fb71d7680b431dd56fdb0d1ef82f64f4b7b (diff)
downloadlibvorbis-git-monty_branch_20000724.tar.gz
Incremental update. Nearing beta 2, four more new descriptions to go...monty_branch_20000724
Monty svn path=/branches/monty_branch_20000724/vorbis/; revision=585
-rwxr-xr-xconfigure2320
-rw-r--r--configure.in243
-rw-r--r--debian/README.debian14
-rw-r--r--debian/README.examples11
-rw-r--r--debian/changelog16
-rw-r--r--debian/control78
-rw-r--r--debian/copyright25
-rw-r--r--debian/dirs3
-rw-r--r--debian/docs3
-rw-r--r--debian/examples6
-rw-r--r--debian/mp3tovorbis.dirs1
-rw-r--r--debian/mp3tovorbis.docs1
-rw-r--r--debian/ogg123.dirs1
-rw-r--r--debian/ogg123.docs1
-rw-r--r--debian/override.Lintian1
-rwxr-xr-xdebian/rules197
-rw-r--r--debian/vorbize.dirs1
-rw-r--r--debian/vorbize.docs1
-rw-r--r--debian/xmms-vorbis.dirs1
-rw-r--r--debian/xmms-vorbis.docs2
-rw-r--r--doc/masking.xcfbin6405537 -> 0 bytes
-rw-r--r--examples/encoder_example.c177
-rw-r--r--include/vorbis/book/res0_1024a_128_1.vqh63
-rw-r--r--include/vorbis/book/res0_1024a_128_2.vqh63
-rw-r--r--include/vorbis/book/res0_1024a_128_3.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_128_4.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_128_5.vqh212
-rw-r--r--include/vorbis/book/res0_1024a_128_6.vqh212
-rw-r--r--include/vorbis/book/res0_1024a_128_7.vqh75
-rw-r--r--include/vorbis/book/res0_1024a_128_8.vqh86
-rw-r--r--include/vorbis/book/res0_1024a_128_9.vqh115
-rw-r--r--include/vorbis/book/res0_1024a_256_1.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_256_2.vqh75
-rw-r--r--include/vorbis/book/res0_1024a_256_3.vqh86
-rw-r--r--include/vorbis/book/res0_1024a_256_4.vqh100
-rw-r--r--include/vorbis/book/res0_1024a_256_5.vqh133
-rw-r--r--include/vorbis/book/res0_128a_128_1.vqh63
-rw-r--r--include/vorbis/book/res0_128a_128_2.vqh99
-rw-r--r--include/vorbis/book/res0_128a_128_3.vqh212
-rw-r--r--include/vorbis/book/res0_128a_128_4.vqh70
-rw-r--r--include/vorbis/book/res0_128a_128_5.vqh115
-rw-r--r--include/vorbis/book/res0_128a_256_1.vqh99
-rw-r--r--include/vorbis/book/res0_128a_256_2.vqh75
-rw-r--r--include/vorbis/book/res0_128a_256_3.vqh86
-rw-r--r--include/vorbis/book/res0_128a_256_4.vqh100
-rw-r--r--include/vorbis/book/res0_128a_256_5.vqh133
-rw-r--r--include/vorbis/book/resaux0_1024a_128.vqh42
-rw-r--r--include/vorbis/book/resaux0_1024a_256.vqh116
-rw-r--r--include/vorbis/book/resaux0_128a_128.vqh116
-rw-r--r--include/vorbis/book/resaux0_128a_256.vqh116
-rw-r--r--include/vorbis/codec.h7
-rw-r--r--include/vorbis/mode_A.h206
-rw-r--r--include/vorbis/mode_D.h179
-rw-r--r--include/vorbis/modes.h231
-rw-r--r--lib/analysis.c105
-rw-r--r--lib/framing.c1623
-rw-r--r--lib/info.c543
-rw-r--r--lib/mapping0.c383
-rw-r--r--lib/psy.c110
-rw-r--r--lib/psytune.c64
-rw-r--r--lib/res0.c384
-rw-r--r--lib/vorbisfile.c1156
-rw-r--r--vq/latticebuild.c174
-rw-r--r--vq/latticehint.c25
-rw-r--r--vq/latticetune.c156
-rw-r--r--vq/residuesplit.c240
66 files changed, 11306 insertions, 342 deletions
diff --git a/configure b/configure
new file mode 100755
index 00000000..5d0e7154
--- /dev/null
+++ b/configure
@@ -0,0 +1,2320 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=lib/mdct.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+#AC_CONFIG_HEADER(config.h)
+
+cp configure.guess config.guess
+cp configure.sub config.sub
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:556: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+case $host in
+ *-*-irix*)
+ if test -z "$CC"; then
+ CC=cc
+ fi
+ echo $ac_n "checking for ALwritesamps in -laudio""... $ac_c" 1>&6
+echo "configure:583: checking for ALwritesamps in -laudio" >&5
+ac_lib_var=`echo audio'_'ALwritesamps | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-laudio $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 591 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char ALwritesamps();
+
+int main() {
+ALwritesamps()
+; return 0; }
+EOF
+if { (eval echo configure:602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo audio | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-laudio $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ ;;
+# BeOS does not use -lm
+# *-*-beos)
+# LIBS=""
+# ;;
+# added better check below
+
+esac
+
+if test -z "$CC"; then
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:642: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:672: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:723: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 766 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:802: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:830: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+fi
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:863: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 878 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:884: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 895 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 912 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:918: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:945: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:975: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AR="ar"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+AR="$ac_cv_prog_AR"
+if test -n "$AR"; then
+ echo "$ac_t""$AR" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+# Extract the first word of "install", so it can be a program name with args.
+set dummy install; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1004: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_INSTALL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$INSTALL"; then
+ ac_cv_prog_INSTALL="$INSTALL" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_INSTALL="install"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+INSTALL="$ac_cv_prog_INSTALL"
+if test -n "$INSTALL"; then
+ echo "$ac_t""$INSTALL" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+#not everyone uses libm (eg, BeOS)
+#AC_CHECK_LIB(m, cos, LIBS="-lm"; AC_DEFINE(HAVE_LIBM), LIBS="")
+# We no longer use config.h
+echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6
+echo "configure:1035: checking for cos in -lm" >&5
+ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1043 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char cos();
+
+int main() {
+cos()
+; return 0; }
+EOF
+if { (eval echo configure:1054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="-lm"
+else
+ echo "$ac_t""no" 1>&6
+LIBS=""
+fi
+
+
+if test -z "$GCC"; then
+ case $host in
+ *-*-irix*)
+ DEBUG="-g -signed"
+ OPT="-O2 -w -signed"
+ PROFILE="-p -g3 -O2 -signed" ;;
+ sparc-sun-solaris*)
+ DEBUG="-v -g"
+ OPT="-xO4 -fast -w -fsimple -native -xcg92"
+ PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
+ *)
+ DEBUG="-g"
+ OPT="-O"
+ PROFILE="-g -p" ;;
+ esac
+else
+
+ case $host in
+ *86-*-linux*)
+ DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
+ PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char"
+
+ # 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
+ # clobber is missing in the mathinline header, thus indicating
+ # the buggy version
+
+ cat > conftest.$ac_ext <<EOF
+#line 1105 "configure"
+#include "confdefs.h"
+
+ #define __LIBC_INTERNAL_MATH_INLINES 1
+ #define __OPTIMIZE__
+ #include <math.h>
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "log10.*fldlg2.*fxch" >/dev/null 2>&1; then
+ rm -rf conftest*
+ bad=maybe
+else
+ rm -rf conftest*
+ bad=no
+fi
+rm -f conftest*
+
+ if test ${bad} = "maybe" ;then
+ cat > conftest.$ac_ext <<EOF
+#line 1125 "configure"
+#include "confdefs.h"
+
+ #define __LIBC_INTERNAL_MATH_INLINES 1
+ #define __OPTIMIZE__
+ #include <math.h>
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "log10.*fldlg2.*fxch.*st\([0123456789]*\)" >/dev/null 2>&1; then
+ rm -rf conftest*
+ bad=no
+else
+ rm -rf conftest*
+ bad=yes
+fi
+rm -f conftest*
+
+ fi
+ if test ${bad} = "yes" ;then
+ echo "configure: warning: " 1>&2
+ echo "configure: warning: ********************************************************" 1>&2
+ echo "configure: warning: * The glibc headers on this machine have a serious bug *" 1>&2
+ echo "configure: warning: * in /usr/include/bits/mathinline.h This bug affects *" 1>&2
+ echo "configure: warning: * all floating point code, not just Ogg, built on this *" 1>&2
+ echo "configure: warning: * machine. Upgrading to glibc 2.1.3 is strongly urged *" 1>&2
+ echo "configure: warning: * to correct the problem. Note that upgrading glibc *" 1>&2
+ echo "configure: warning: * will not fix any previously built programs; this is *" 1>&2
+ echo "configure: warning: * a compile-time time bug. *" 1>&2
+ echo "configure: warning: * To work around the problem for this build of Ogg, *" 1>&2
+ echo "configure: warning: * autoconf is disabling all math inlining. This will *" 1>&2
+ echo "configure: warning: * hurt Ogg performace but is necessary for an Ogg that *" 1>&2
+ echo "configure: warning: * will actually work. Once glibc is upgraded, rerun *" 1>&2
+ echo "configure: warning: * configure and make to build with inlining. *" 1>&2
+ echo "configure: warning: ********************************************************" 1>&2
+ echo "configure: warning: " 1>&2
+
+ OPT=${OPT}" -D__NO_MATH_INLINES"
+ PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
+ fi;;
+ *-*-linux*)
+ DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
+ PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
+ sparc-sun-*)
+ DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
+ OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
+ PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
+ *)
+ DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -D__NO_MATH_INLINES -fsigned-char"
+ PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
+ esac
+fi
+
+subdirs="vorbis-tools/libao"
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1184: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1189 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1214 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1232 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1253 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+
+CFLAGS=""
+
+
+#AC_CHECK_LIB(pthread, pthread_create,
+# pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
+# We no longer use config.h
+echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+echo "configure:1295: checking for pthread_create in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpthread $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1303 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
+EOF
+if { (eval echo configure:1314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ pthread_lib="-lpthread"
+else
+ echo "$ac_t""no" 1>&6
+:
+fi
+
+
+#dnl Linuxthreads require you to define _REENTRANT in all threaded
+#dnl code. Bogus, bogus...
+#
+#if test -n "$pthread_lib"; then
+# case $host in
+# i?86-*-linux*)
+# AC_DEFINE(_REENTRANT)
+# ;;
+# esac
+#fi
+# We no longer use config.h
+
+#if test -n "$x_libraries"; then
+# XOGG="yes"
+#
+# dnl If we find libgtk installed, great; otherwise assume we have
+# dnl to build it ourselves.
+#
+# AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
+#
+# dnl libpthread is required for xogg.
+#
+# if test -z "$pthread_lib"; then XOGG=""; fi
+#
+# dnl If we don't have libgtk installed, and we don't have a libgtk
+# dnl subdirectory to build the library ourself, we can't build xogg.
+#
+# if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
+# XOGG=""
+# LIBGTKDIR=""
+# fi
+#fi
+
+
+dummy="__noconf"
+
+#if test -d "$LIBGTKDIR"; then
+# enable_shared="no"; export enable_shared
+# dummy="libgtk"
+# AC_CONFIG_SUBDIRS("$dummy")
+# X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
+#fi
+
+echo $ac_n "checking size of short""... $ac_c" 1>&6
+echo "configure:1380: checking size of short" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1388 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(short));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_short=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_short=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_short" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+EOF
+
+
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+echo "configure:1419: checking size of int" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1427 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(int));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_int=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_int=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:1458: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1466 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+echo $ac_n "checking size of long long""... $ac_c" 1>&6
+echo "configure:1497: checking size of long long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1505 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+EOF
+
+
+
+case 2 in
+ $ac_cv_sizeof_short) SIZE16="short";;
+ $ac_cv_sizeof_int) SIZE16="int";;
+esac
+
+case 4 in
+ $ac_cv_sizeof_short) SIZE32="short";;
+ $ac_cv_sizeof_int) SIZE32="int";;
+ $ac_cv_sizeof_long) SIZE32="long";;
+esac
+
+case 8 in
+ $ac_cv_sizeof_int) SIZE64="int";;
+ $ac_cv_sizeof_long) SIZE64="long";;
+ $ac_cv_sizeof_long_long) SIZE64="long long";;
+esac
+
+if test -z "$SIZE16"; then
+ { echo "configure: error: No 16 bit type found on this platform!" 1>&2; exit 1; }
+fi
+if test -z "$SIZE32"; then
+ { echo "configure: error: No 32 bit type found on this platform!" 1>&2; exit 1; }
+fi
+if test -z "$SIZE64"; then
+ echo "configure: warning: No 64 bit type found on this platform!" 1>&2
+fi
+
+#AC_CHECK_HEADER(alloca.h,AC_DEFINE(USE_ALLOCA_H),:)
+#AC_CHECK_HEADER(memory.h,AC_DEFINE(USE_MEMORY_H),:)
+# We no longer use config.h
+ac_safe=`echo "alloca.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for alloca.h""... $ac_c" 1>&6
+echo "configure:1568: checking for alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1573 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ CFLAGS="$CFLAGS -DUSE_ALLOCA_H"
+else
+ echo "$ac_t""no" 1>&6
+:
+fi
+
+ac_safe=`echo "memory.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for memory.h""... $ac_c" 1>&6
+echo "configure:1602: checking for memory.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1607 "configure"
+#include "confdefs.h"
+#include <memory.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ CFLAGS="$CFLAGS -DUSE_MEMORY_H"
+else
+ echo "$ac_t""no" 1>&6
+:
+fi
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1636: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1641 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1711: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1716 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+ cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:1746: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1751 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:1759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm=time.h
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+ cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1781: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:1808: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_memcmp_clean=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1816 "configure"
+#include "confdefs.h"
+
+main()
+{
+ char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+ exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:1826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_memcmp_clean=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1844: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1849 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:1866: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+for ac_func in gettimeofday select strcspn strerror strspn sigaction
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1887: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1892 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+
+
+
+
+
+
+
+#AC_SUBST(XOGG)
+#AC_SUBST(LIBGTKDIR)
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+
+trap 'rm -fr `echo "Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\
+ vorbis-tools/libao/Makefile vq/Makefile huff/Makefile cmdline/Makefile\
+ xmms/Makefile kmpg/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@RANLIB@%$RANLIB%g
+s%@AR@%$AR%g
+s%@INSTALL@%$INSTALL%g
+s%@subdirs@%$subdirs%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@SIZE16@%$SIZE16%g
+s%@SIZE32@%$SIZE32%g
+s%@SIZE64@%$SIZE64%g
+s%@OPT@%$OPT%g
+s%@DEBUG@%$DEBUG%g
+s%@PROFILE@%$PROFILE%g
+s%@pthread_lib@%$pthread_lib%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\
+ vorbis-tools/libao/Makefile vq/Makefile huff/Makefile cmdline/Makefile\
+ xmms/Makefile kmpg/Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in vorbis-tools/libao; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 00000000..26f37b9d
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,243 @@
+# $Id: configure.in,v 1.18.2.1 2000/08/15 08:32:58 xiphmont Exp $
+
+AC_INIT(lib/mdct.c)
+#AC_CONFIG_HEADER(config.h)
+
+cp configure.guess config.guess
+cp configure.sub config.sub
+
+AC_CANONICAL_HOST
+
+dnl If we're on IRIX, we wanna use cc even if gcc is there (unless the user
+dnl has overriden us)...
+case $host in
+ *-*-irix*)
+ if test -z "$CC"; then
+ CC=cc
+ fi
+ AC_CHECK_LIB(audio, ALwritesamps)
+ ;;
+# BeOS does not use -lm
+# *-*-beos)
+# LIBS=""
+# ;;
+# added better check below
+
+esac
+
+if test -z "$CC"; then
+ AC_PROG_CC
+fi
+AC_PROG_CPP
+AC_PROG_RANLIB
+AC_CHECK_PROG(AR,ar,ar)
+AC_CHECK_PROG(INSTALL,install,install)
+
+#not everyone uses libm (eg, BeOS)
+#AC_CHECK_LIB(m, cos, LIBS="-lm"; AC_DEFINE(HAVE_LIBM), LIBS="")
+# We no longer use config.h
+AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
+
+dnl Set some target options
+if test -z "$GCC"; then
+ case $host in
+ *-*-irix*)
+ DEBUG="-g -signed"
+ OPT="-O2 -w -signed"
+ PROFILE="-p -g3 -O2 -signed" ;;
+ sparc-sun-solaris*)
+ DEBUG="-v -g"
+ OPT="-xO4 -fast -w -fsimple -native -xcg92"
+ PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
+ *)
+ DEBUG="-g"
+ OPT="-O"
+ PROFILE="-g -p" ;;
+ esac
+else
+
+ case $host in
+ *86-*-linux*)
+ DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
+ PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char"
+
+ # 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
+ # clobber is missing in the mathinline header, thus indicating
+ # the buggy version
+
+ AC_EGREP_CPP(log10.*fldlg2.*fxch,[
+ #define __LIBC_INTERNAL_MATH_INLINES 1
+ #define __OPTIMIZE__
+ #include <math.h>
+ ],bad=maybe,bad=no)
+ if test ${bad} = "maybe" ;then
+ AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
+ [
+ #define __LIBC_INTERNAL_MATH_INLINES 1
+ #define __OPTIMIZE__
+ #include <math.h>
+ ],bad=no,bad=yes)
+ fi
+ if test ${bad} = "yes" ;then
+ AC_MSG_WARN([ ])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
+ AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
+ AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
+ AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
+ AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
+ AC_MSG_WARN([* will not fix any previously built programs; this is *])
+ AC_MSG_WARN([* a compile-time time bug. *])
+ AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
+ AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
+ AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
+ AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
+ AC_MSG_WARN([* configure and make to build with inlining. *])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([ ])
+
+ OPT=${OPT}" -D__NO_MATH_INLINES"
+ PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
+ fi;;
+ *-*-linux*)
+ DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
+ PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
+ sparc-sun-*)
+ DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
+ OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
+ PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
+ *)
+ DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
+ OPT="-O20 -D__NO_MATH_INLINES -fsigned-char"
+ PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
+ esac
+fi
+
+AC_HEADER_STDC
+
+CFLAGS=""
+
+dnl AC_PATH_X
+dnl AC_PATH_XTRA
+
+#AC_CHECK_LIB(pthread, pthread_create,
+# pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
+# We no longer use config.h
+AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
+
+#dnl Linuxthreads require you to define _REENTRANT in all threaded
+#dnl code. Bogus, bogus...
+#
+#if test -n "$pthread_lib"; then
+# case $host in
+# i?86-*-linux*)
+# AC_DEFINE(_REENTRANT)
+# ;;
+# esac
+#fi
+# We no longer use config.h
+
+#if test -n "$x_libraries"; then
+# XOGG="yes"
+#
+# dnl If we find libgtk installed, great; otherwise assume we have
+# dnl to build it ourselves.
+#
+# AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
+#
+# dnl libpthread is required for xogg.
+#
+# if test -z "$pthread_lib"; then XOGG=""; fi
+#
+# dnl If we don't have libgtk installed, and we don't have a libgtk
+# dnl subdirectory to build the library ourself, we can't build xogg.
+#
+# if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
+# XOGG=""
+# LIBGTKDIR=""
+# fi
+#fi
+
+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"
+
+#if test -d "$LIBGTKDIR"; then
+# enable_shared="no"; export enable_shared
+# dummy="libgtk"
+# AC_CONFIG_SUBDIRS("$dummy")
+# X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
+#fi
+
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+
+case 2 in
+ $ac_cv_sizeof_short) SIZE16="short";;
+ $ac_cv_sizeof_int) SIZE16="int";;
+esac
+
+case 4 in
+ $ac_cv_sizeof_short) SIZE32="short";;
+ $ac_cv_sizeof_int) SIZE32="int";;
+ $ac_cv_sizeof_long) SIZE32="long";;
+esac
+
+case 8 in
+ $ac_cv_sizeof_int) SIZE64="int";;
+ $ac_cv_sizeof_long) SIZE64="long";;
+ $ac_cv_sizeof_long_long) SIZE64="long long";;
+esac
+
+if test -z "$SIZE16"; then
+ AC_MSG_ERROR(No 16 bit type found on this platform!)
+fi
+if test -z "$SIZE32"; then
+ AC_MSG_ERROR(No 32 bit type found on this platform!)
+fi
+if test -z "$SIZE64"; then
+ AC_MSG_WARN(No 64 bit type found on this platform!)
+fi
+
+#AC_CHECK_HEADER(alloca.h,AC_DEFINE(USE_ALLOCA_H),:)
+#AC_CHECK_HEADER(memory.h,AC_DEFINE(USE_MEMORY_H),:)
+# We no longer use config.h
+AC_CHECK_HEADER(alloca.h,CFLAGS="$CFLAGS -DUSE_ALLOCA_H",:)
+AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
+
+AC_C_CONST
+AC_HEADER_TIME
+AC_STRUCT_TM
+
+AC_PROG_MAKE_SET
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction)
+
+AC_SUBST(SIZE16)
+AC_SUBST(SIZE32)
+AC_SUBST(SIZE64)
+AC_SUBST(OPT)
+AC_SUBST(LIBS)
+AC_SUBST(DEBUG)
+AC_SUBST(PROFILE)
+AC_SUBST(CC)
+AC_SUBST(RANLIB)
+#AC_SUBST(XOGG)
+#AC_SUBST(LIBGTKDIR)
+AC_SUBST(pthread_lib)
+
+AC_CONFIG_SUBDIRS(vorbis-tools/libao)
+
+AC_OUTPUT(Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\
+ vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
+
diff --git a/debian/README.debian b/debian/README.debian
new file mode 100644
index 00000000..aa3db803
--- /dev/null
+++ b/debian/README.debian
@@ -0,0 +1,14 @@
+Ogg Vorbis for Debian
+---------------------
+
+Ogg Vorbis currently does not have a shared library. it is a goal for the
+future, but presently, any compiling using the codec should be done as
+follows:
+
+ gcc [flags] -c X.c
+ gcc [flags] /usr/lib/vorbisfile.a /usr/lib/libvorbis.a \
+ X.o -o X
+
+Of course, only include the .a's that are required for your program.
+
+ -- Michael Beattie <mickyb@es.co.nz>, Mon, 26 Jun 2000 18:59:56 +1200
diff --git a/debian/README.examples b/debian/README.examples
new file mode 100644
index 00000000..a7598865
--- /dev/null
+++ b/debian/README.examples
@@ -0,0 +1,11 @@
+Example tools using vorbis.
+
+The examples/ directory contains some example source files to build tools
+using the vorbis codec. The Makefile is only included to show how they are
+compiled. It contains relative references to the libraries in the source
+tree, so it will *not* work without being edited first.
+
+The misc.h included in chaining_example and seeking_test just allows the
+use of a debugging malloc. (defined in misc.c) It is safe to comment out.
+
+ -- Michael Beattie <mickyb@es.co.nz>, Mon, 26 Jun 2000 18:59:56 +1200
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 00000000..767c008b
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,16 @@
+vorbis (1.0beta1-1) unstable; urgency=low
+
+ * First Beta, Ready for debian release.
+
+ -- Michael Beattie <mickyb@es.co.nz> Fri, 30 Jun 2000 19:26:59 +1200
+
+vorbis (0.0-1) unstable; urgency=low
+
+ * Initial Release.
+ * Initial package, not placed in archive.
+
+ -- Michael Beattie <mickyb@es.co.nz> Mon, 26 Jun 2000 18:59:56 +1200
+
+Local variables:
+mode: debian-changelog
+End:
diff --git a/debian/control b/debian/control
new file mode 100644
index 00000000..463d9ff6
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,78 @@
+Source: vorbis
+Section: sound
+Priority: optional
+Maintainer: Michael Beattie <mickyb@es.co.nz>
+Standards-Version: 3.0.1
+
+Package: libvorbis-dev
+Section: devel
+Architecture: any
+Description: The OGG Vorbis lossy audio compression codec.
+ This Package contains the development library's and header files for
+ Ogg Vorbis.
+ .
+ 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.
+
+Package: xmms-vorbis
+Architecture: i386
+Depends: ${shlibs:Depends}, xmms
+Description: An xmms plugin to play Ogg Vorbis files.
+ This Package contains a plugin for xmms to play files encoded using the
+ Ogg Vorbis lossy audio compression codec.
+ .
+ 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.
+
+Package: ogg123
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: A player for Ogg Vorbis files.
+ This Package contains a commandline player for files encoded using the
+ Ogg Vorbis lossy audio compression codec.
+ .
+ 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.
+
+Package: vorbize
+Architecture: any
+Depends: ${shlibs:Depends}
+Suggests: ogg123 | xmms-vorbis
+Description: An encoder for the Ogg Vorbis lossy audio compression codec.
+ This Package contains an Ogg Vorbis encoder.
+ NOTE: Currently vorbis only works with 44kHz, 16bit stereo raw PCM or
+ wav files. Use sox to coax any other formats into line.
+ .
+ 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.
+
+Package: mp3tovorbis
+Architecture: any
+Depends: vorbize, mpg123
+Description: An encoder for the Ogg Vorbis lossy audio compression codec.
+ This Package contains an mp3tovorbis script which you can use to
+ convert your .mp3 files to .ogg
+ NOTE: this will only work on 44kHz 16bit stereo mp3's
+ .
+ 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.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 00000000..a2463f8e
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,25 @@
+This package was debianized by Michael Beattie <mickyb@es.co.nz> on
+Mon, 26 Jun 2000 18:59:56 +1200.
+
+It was downloaded from http://www.xiph.org/ogg/vorbis/ (via CVS)
+
+Upstream Author(s): Monty <monty@xiph.org>
+
+Copyright:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 dated June, 1991.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in /usr/share/common-licenses/GPL'.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 00000000..0d97de53
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,3 @@
+usr/lib
+usr/include/vorbis/book
+usr/share/doc/libvorbis-dev/html
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 00000000..a7d3a859
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README
+todo.txt
+debian/README.examples
diff --git a/debian/examples b/debian/examples
new file mode 100644
index 00000000..a1adfae4
--- /dev/null
+++ b/debian/examples
@@ -0,0 +1,6 @@
+examples/Makefile
+examples/chaining_example.c
+examples/decoder_example.c
+examples/encoder_example.c
+examples/seeking_test.c
+examples/vorbisfile_example.c
diff --git a/debian/mp3tovorbis.dirs b/debian/mp3tovorbis.dirs
new file mode 100644
index 00000000..e7724817
--- /dev/null
+++ b/debian/mp3tovorbis.dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/mp3tovorbis.docs b/debian/mp3tovorbis.docs
new file mode 100644
index 00000000..843d9055
--- /dev/null
+++ b/debian/mp3tovorbis.docs
@@ -0,0 +1 @@
+vorbis-tools/README \ No newline at end of file
diff --git a/debian/ogg123.dirs b/debian/ogg123.dirs
new file mode 100644
index 00000000..e7724817
--- /dev/null
+++ b/debian/ogg123.dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/ogg123.docs b/debian/ogg123.docs
new file mode 100644
index 00000000..8f7da824
--- /dev/null
+++ b/debian/ogg123.docs
@@ -0,0 +1 @@
+vorbis-tools/README
diff --git a/debian/override.Lintian b/debian/override.Lintian
new file mode 100644
index 00000000..5733a47a
--- /dev/null
+++ b/debian/override.Lintian
@@ -0,0 +1 @@
+xmms-vorbis: shlib-with-non-pic-code
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..6c4105cc
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,197 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 by Joey Hess.
+# Modified for Ogg Vorbis, 2000 by Michael Beattie
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+ # Add here commands to compile the package.
+ $(MAKE)
+ cd vorbis-tools && $(MAKE) && $(MAKE) ogg123
+ cd xmms && $(MAKE)
+
+ touch build-stamp
+
+EXTRA_CLEAN= vorbis-tools cmdline xmms vq huff kmpg
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) distclean
+ -@for dir in $(EXTRA_CLEAN); do (cd $$dir && $(MAKE) $(MFLAGS) distclean) || exit 1; done
+
+ dh_clean
+
+
+# Build architecture-independent files here.
+binary-arch: libvorbis-dev ogg123 vorbize xmms-vorbis mp3tovorbis
+
+libvorbis-dev: DH_OPTIONS=-plibvorbis-dev
+libvorbis-dev: build
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testversion 1.1.17
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ -cp -a include/vorbis/*.h `pwd`/debian/tmp/usr/include/vorbis/
+ -cp -a include/vorbis/book/*.vqh `pwd`/debian/tmp/usr/include/vorbis/book/
+ -cp lib/*.a `pwd`/debian/tmp/usr/lib/
+
+ -cp docs/*.html docs/*.png `pwd`/debian/tmp/usr/share/doc/libvorbis-dev/html/
+
+ dh_installdocs
+ dh_installexamples
+ dh_installmanpages
+# dh_installinfo
+# dh_undocumented
+ dh_installchangelogs
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+# dh_makeshlibs
+# dh_shlibdeps
+ dh_gencontrol -u -isp
+ dh_md5sums
+ dh_builddeb
+
+
+
+ogg123: DH_OPTIONS=-pogg123
+ogg123: build
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testversion 1.1.17
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ install -m 755 vorbis-tools/ogg123 `pwd`/debian/ogg123/usr/bin/
+
+ dh_installdocs
+# dh_installmenu
+ dh_installmanpages
+# dh_installinfo
+ dh_undocumented ogg123.1
+ dh_installchangelogs vorbis-tools/Changelog
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+# dh_makeshlibs
+ dh_shlibdeps
+ dh_gencontrol -u -isp
+ dh_md5sums
+ dh_builddeb
+
+
+
+vorbize: DH_OPTIONS=-pvorbize
+vorbize: build
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testversion 1.1.17
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ install -m 755 vorbis-tools/vorbize `pwd`/debian/vorbize/usr/bin/
+
+ dh_installdocs
+# dh_installmenu
+ dh_installmanpages
+# dh_installinfo
+ dh_undocumented vorbize.1
+ dh_installchangelogs vorbis-tools/Changelog
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+# dh_makeshlibs
+ dh_shlibdeps
+ dh_gencontrol -u -isp
+ dh_md5sums
+ dh_builddeb
+
+
+
+mp3tovorbis: DH_OPTIONS=-pmp3tovorbis
+mp3tovorbis: build
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testversion 1.1.17
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ install -m 755 vorbis-tools/mp3tovorbis `pwd`/debian/mp3tovorbis/usr/bin/
+
+ dh_installdocs
+# dh_installmenu
+ dh_installmanpages
+# dh_installinfo
+ dh_undocumented mp3tovorbis.1
+ dh_installchangelogs vorbis-tools/Changelog
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+# dh_makeshlibs
+# dh_shlibdeps
+ dh_gencontrol -u -isp
+ dh_md5sums
+ dh_builddeb
+
+
+
+xmms-vorbis: DH_OPTIONS=-pxmms-vorbis
+xmms-vorbis: build install
+ # Need this version of debhelper for DH_OPTIONS to work.
+ dh_testversion 1.1.17
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ install -m 644 xmms/libvorbis.so `pwd`/debian/xmms-vorbis/usr/lib/xmms/Input/
+
+ dh_installdocs
+ dh_installchangelogs
+ dh_strip
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+#
+ dh_shlibdeps
+ dh_gencontrol -u -isp
+ dh_md5sums
+ dh_builddeb
+
+
+# Build architecture-dependent files here.
+binary-indep:
+
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/vorbize.dirs b/debian/vorbize.dirs
new file mode 100644
index 00000000..e7724817
--- /dev/null
+++ b/debian/vorbize.dirs
@@ -0,0 +1 @@
+usr/bin
diff --git a/debian/vorbize.docs b/debian/vorbize.docs
new file mode 100644
index 00000000..843d9055
--- /dev/null
+++ b/debian/vorbize.docs
@@ -0,0 +1 @@
+vorbis-tools/README \ No newline at end of file
diff --git a/debian/xmms-vorbis.dirs b/debian/xmms-vorbis.dirs
new file mode 100644
index 00000000..d382c88a
--- /dev/null
+++ b/debian/xmms-vorbis.dirs
@@ -0,0 +1 @@
+usr/lib/xmms/Input
diff --git a/debian/xmms-vorbis.docs b/debian/xmms-vorbis.docs
new file mode 100644
index 00000000..76a44b63
--- /dev/null
+++ b/debian/xmms-vorbis.docs
@@ -0,0 +1,2 @@
+xmms/README
+debian/override.Lintian
diff --git a/doc/masking.xcf b/doc/masking.xcf
deleted file mode 100644
index 23541ed4..00000000
--- a/doc/masking.xcf
+++ /dev/null
Binary files differ
diff --git a/examples/encoder_example.c b/examples/encoder_example.c
new file mode 100644
index 00000000..b9dae40a
--- /dev/null
+++ b/examples/encoder_example.c
@@ -0,0 +1,177 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: simple example encoder
+ last mod: $Id: encoder_example.c,v 1.8.4.1 2000/08/15 08:33:35 xiphmont Exp $
+
+ ********************************************************************/
+
+/* takes a stereo 16bit 44.1kHz WAV file from stdin and encodes it into
+ a Vorbis bitstream */
+
+/* Note that this is POSIX, not ANSI, code */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include "vorbis/mode_A.h"
+
+#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+
+#define READ 1024
+signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */
+
+int main(){
+ ogg_stream_state os; /* take physical pages, weld into a logical
+ stream of packets */
+ 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
+ settings */
+ vorbis_comment vc; /* struct that stores all the user comments */
+
+ vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
+ vorbis_block vb; /* local working space for packet->PCM decode */
+
+ int eos=0;
+
+ /* we cheat on the WAV header; we just bypass 44 bytes and never
+ verify that it matches 16bit/stereo/44.1kHz. This is just an
+ example, after all. */
+
+#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
+ /* Beware the evil ifdef. We avoid these where we can, but this one we
+ cannot. Don't add any more, you'll probably go to hell if you do. */
+ _setmode( _fileno( stdin ), _O_BINARY );
+ _setmode( _fileno( stdout ), _O_BINARY );
+#endif
+
+
+ fread(readbuffer,1,44,stdin);
+
+ /********** Encode setup ************/
+
+ /* choose an encoding mode */
+ /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
+ vi=&info_A;
+
+ /* 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_block_init(&vd,&vb);
+
+ /* set up our packet->stream encoder */
+ /* pick a random serial number; that way we can more likely build
+ chained streams just by concatenation */
+ srand(time(NULL));
+ ogg_stream_init(&os,rand());
+
+ /* Vorbis streams begin with three headers; the initial header (with
+ most of the codec setup parameters) which is mandated by the Ogg
+ bitstream spec. The second header holds any comment fields. The
+ third header holds the bitstream codebook. We merely need to
+ make the headers, then pass them to libvorbis one at a time;
+ libvorbis handles the additional Ogg bitstream constraints */
+
+ {
+ ogg_packet header;
+ ogg_packet header_comm;
+ ogg_packet header_code;
+
+ vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
+ ogg_stream_packetin(&os,&header); /* automatically placed in its own
+ page */
+ ogg_stream_packetin(&os,&header_comm);
+ ogg_stream_packetin(&os,&header_code);
+
+ /* no need to write out here. We'll get to that in the main loop */
+ }
+
+ while(!eos){
+ long i;
+ long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */
+
+ if(bytes==0){
+ /* end of file. this can be done implicitly in the mainline,
+ but it's easier to see here in non-clever fashion.
+ Tell the library we're at end of stream so that it can handle
+ the last frame and mark end of stream in the output properly */
+ vorbis_analysis_wrote(&vd,0);
+
+ }else{
+ /* data to encode */
+
+ /* expose the buffer to submit data */
+ double **buffer=vorbis_analysis_buffer(&vd,READ);
+
+ /* uninterleave samples */
+ for(i=0;i<bytes/4;i++){
+ buffer[0][i]=((readbuffer[i*4+1]<<8)|
+ (0x00ff&(int)readbuffer[i*4]))/32768.;
+ buffer[1][i]=((readbuffer[i*4+3]<<8)|
+ (0x00ff&(int)readbuffer[i*4+2]))/32768.;
+ }
+
+ /* tell the library how much we actually submitted */
+ vorbis_analysis_wrote(&vd,i);
+ }
+
+ /* vorbis does some data preanalysis, then divvies up blocks for
+ more involved (potentially parallel) processing. Get a single
+ block for encoding now */
+ while(vorbis_analysis_blockout(&vd,&vb)==1){
+
+ /* analysis */
+ vorbis_analysis(&vb,&op);
+
+ /* weld the packet into the bitstream */
+ ogg_stream_packetin(&os,&op);
+
+ /* write out pages (if any) */
+ while(!eos){
+ int result=ogg_stream_pageout(&os,&og);
+ if(result==0)break;
+ fwrite(og.header,1,og.header_len,stdout);
+ fwrite(og.body,1,og.body_len,stdout);
+
+ /* this could be set above, but for illustrative purposes, I do
+ it here (to show that vorbis does know where the stream ends) */
+
+ if(ogg_page_eos(&og))eos=1;
+
+ }
+ }
+ }
+
+ /* clean up and exit. vorbis_info_clear() must be called last */
+
+ ogg_stream_clear(&os);
+ vorbis_block_clear(&vb);
+ vorbis_dsp_clear(&vd);
+
+ /* ogg_page and ogg_packet structs always point to storage in
+ libvorbis. They're never freed or manipulated directly */
+
+ fprintf(stderr,"Done.\n");
+ return(0);
+}
+
diff --git a/include/vorbis/book/res0_1024a_128_1.vqh b/include/vorbis/book/res0_1024a_128_1.vqh
new file mode 100644
index 00000000..03d13fc4
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_1.vqh
@@ -0,0 +1,63 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_1_VQH_
+#define _V_res0_1024a_128_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_1[] = {
+ 1, 4, 4, 4, 7, 7, 4, 7, 7, 5, 8, 8, 8,11,11, 8,
+ 11,11, 5, 8, 8, 8,11,11, 8,11,11, 5, 8, 8, 8,11,
+ 11, 8,11,11, 8,11,11,11,14,14,11,15,15, 8,11,11,
+ 11,14,14,12,15,15, 5, 8, 8, 8,11,11, 8,11,11, 8,
+ 11,11,11,15,14,11,14,15, 8,11,12,12,15,15,11,14,
+ 14,
+};
+
+static double _vq_quantthresh_res0_1024a_128_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_1 = {
+ _vq_quantthresh_res0_1024a_128_1,
+ _vq_quantmap_res0_1024a_128_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_1024a_128_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_1024a_128_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_1024a_128_1,
+ NULL,
+ &_vq_auxt_res0_1024a_128_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_2.vqh b/include/vorbis/book/res0_1024a_128_2.vqh
new file mode 100644
index 00000000..2f9947b8
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_2.vqh
@@ -0,0 +1,63 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_2_VQH_
+#define _V_res0_1024a_128_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_2[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_2[] = {
+ 3, 4, 5, 4, 6, 6, 5, 6, 6, 4, 6, 6, 6, 8, 8, 6,
+ 8, 8, 5, 6, 6, 6, 8, 8, 6, 8, 8, 5, 6, 6, 6, 8,
+ 8, 6, 8, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 8, 8,
+ 8, 9, 9, 8, 9, 9, 5, 6, 6, 6, 8, 8, 6, 8, 8, 6,
+ 8, 8, 8, 9, 9, 8, 9, 9, 6, 8, 8, 8, 9, 9, 8, 9,
+ 9,
+};
+
+static double _vq_quantthresh_res0_1024a_128_2[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_2[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_2 = {
+ _vq_quantthresh_res0_1024a_128_2,
+ _vq_quantmap_res0_1024a_128_2,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_1024a_128_2 = {
+ 4, 81,
+ _vq_lengthlist_res0_1024a_128_2,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_1024a_128_2,
+ NULL,
+ &_vq_auxt_res0_1024a_128_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_3.vqh b/include/vorbis/book/res0_1024a_128_3.vqh
new file mode 100644
index 00000000..54894619
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_3.vqh
@@ -0,0 +1,99 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_3_VQH_
+#define _V_res0_1024a_128_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_3[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_3[] = {
+ 2, 5, 7, 5, 7, 5, 6, 9, 6, 9, 7, 9,13, 9,13, 5,
+ 6, 9, 7, 9, 7, 9,13, 9,13, 5, 7, 9, 7, 9, 7, 8,
+ 11, 8,11, 9,11,15,11,15, 7, 8,11, 9,11, 9,11,15,
+ 11,15, 7, 9,12, 9,12, 9,11,15,11,15,13,15,19,15,
+ 19, 9,11,15,12,15,13,15,18,15,18, 5, 7, 9, 7, 9,
+ 7, 9,11, 8,11, 9,11,15,11,15, 7, 9,11, 9,11, 9,
+ 11,15,11,15, 7, 9,12, 9,13, 9,11,15,12,15,13,15,
+ 19,15,18, 9,11,15,12,15,13,15,19,15,18, 5, 7, 9,
+ 7, 9, 7, 9,11, 9,11, 9,11,15,12,15, 7, 9,11, 9,
+ 11, 9,11,15,11,15, 7, 9,11, 9,11, 9,10,13,11,13,
+ 11,13,17,13,17, 9,11,14,11,13,11,13,18,14,17, 9,
+ 11,15,12,15,11,13,18,14,18,15,18,19,18,22,11,14,
+ 18,14,18,15,18,22,18,20, 7, 9,11, 9,11, 9,11,13,
+ 11,13,11,14,17,13,17, 9,11,13,11,14,11,13,18,14,
+ 17, 9,12,15,11,15,11,14,17,13,18,15,17,21,17,19,
+ 12,14,18,14,19,16,18, 0,18, 0, 7, 9,13, 9,13, 9,
+ 11,16,12,16,13,15,19,15,21, 9,11,16,11,16,13,15,
+ 19,15,19, 9,11,15,12,16,11,13,17,14,18,16,18, 0,
+ 18,19,11,14,17,13,17,15,18, 0,18,21,13,16,20,15,
+ 21,15,18, 0,17,21,19,19, 0,20, 0,16,19, 0,18,20,
+ 21, 0, 0,20,21, 9,11,16,11,15,11,13,18,13,17,15,
+ 18,20,17,20,11,14,18,14,18,15,18,21,18,21,13,16,
+ 18,16,19,15,18,20,17,19,20, 0,21,19, 0,15,18, 0,
+ 18,21,20,20, 0,21, 0, 5, 7, 9, 7, 9, 7, 9,11, 9,
+ 11, 9,11,15,11,15, 7, 9,11, 9,11, 9,11,15,11,15,
+ 7, 9,11, 9,11, 9,11,13,11,13,11,14,18,14,18, 9,
+ 11,13,11,13,11,13,17,14,18, 9,12,15,12,16,11,14,
+ 18,14,18,15,18,21,18,21,11,13,17,14,19,15,17,19,
+ 18,21, 7, 9,11, 9,11, 9,11,14,11,13,12,14,17,14,
+ 17, 9,11,13,11,13,12,14,17,13,17, 9,11,16,12,16,
+ 11,14,18,14,18,16,19, 0,18, 0,11,14,18,13,18,16,
+ 18, 0,17,20, 7, 9,13, 9,13, 9,12,16,12,15,13,15,
+ 19,16,19, 9,12,16,12,15,13,15,18,15,20, 9,11,15,
+ 12,15,11,14,18,13,17,15,18,20,18,21,11,13,17,14,
+ 18,15,17,20,18, 0,13,15,19,16,18,15,18,21,17, 0,
+ 19,20, 0,21, 0,15,17,20,18, 0,21,20,21,21, 0, 9,
+ 11,15,12,15,11,14,18,14,19,16,17, 0,18, 0,11,14,
+ 17,14,18,15,17,20,17,21,13,15,19,16,20,15,18, 0,
+ 17,21,20,21, 0, 0, 0,15,17,21,18,20,19, 0,21,19,
+ 21,
+};
+
+static double _vq_quantthresh_res0_1024a_128_3[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_3[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_3 = {
+ _vq_quantthresh_res0_1024a_128_3,
+ _vq_quantmap_res0_1024a_128_3,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_128_3 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_128_3,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_128_3,
+ NULL,
+ &_vq_auxt_res0_1024a_128_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_4.vqh b/include/vorbis/book/res0_1024a_128_4.vqh
new file mode 100644
index 00000000..b872fcf2
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_4.vqh
@@ -0,0 +1,99 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_4_VQH_
+#define _V_res0_1024a_128_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_4[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_4[] = {
+ 5, 6, 8, 6, 8, 6, 6, 9, 6, 9, 8, 9,11, 9,11, 6,
+ 6, 9, 6, 9, 8, 9,11, 9,11, 6, 6, 9, 6, 9, 6, 7,
+ 10, 7,10, 9,10,12,10,12, 6, 7,10, 7,10, 9,10,12,
+ 10,12, 8, 9,11, 9,11, 9,10,12,10,13,11,12,15,13,
+ 15, 9,10,12,10,12,11,12,15,13,15, 6, 6, 9, 7, 9,
+ 6, 7,10, 7,10, 9,10,12,10,12, 6, 7,10, 7,10, 9,
+ 10,12,10,12, 8, 9,11, 9,11, 9,10,12,10,12,11,12,
+ 15,12,14, 9,10,13,10,12,11,13,15,12,15, 6, 7, 9,
+ 7, 9, 7, 7,10, 8,10, 9,10,12,10,12, 6, 7,10, 8,
+ 10, 9,10,12,10,12, 6, 8,10, 8,10, 7, 8,11, 9,11,
+ 10,11,13,11,14, 7, 9,11, 9,11,10,11,14,11,14, 9,
+ 10,13,10,12,10,11,13,11,14,13,13,15,14,16,10,11,
+ 14,11,14,12,13,17,14,16, 7, 8,10, 8,10, 7, 9,11,
+ 8,11,10,11,14,11,14, 7, 9,11, 9,11,10,11,14,11,
+ 14, 9,10,13,10,13,10,11,14,11,14,12,14,16,13,16,
+ 10,11,13,11,14,12,14,17,14,16, 8, 9,11, 9,11, 9,
+ 10,13,10,13,11,13,15,13,15, 9,10,12,10,12,11,13,
+ 15,13,15, 9,10,12,10,13,10,11,14,11,14,13,13,16,
+ 14,17,10,11,14,11,14,13,14,17,14,15,11,13,15,12,
+ 15,12,14,16,14,17,15,16,18,16,20,13,14,16,14,16,
+ 15,17, 0,16,20, 9,10,13,10,13,10,11,14,11,14,13,
+ 14,17,14,16,10,11,14,11,14,13,14,16,14,16,11,13,
+ 16,13,16,12,14,16,13,17,15,17,18,15,18,13,14,16,
+ 14,18,16,16,18,16,19, 6, 7, 9, 7, 9, 6, 7,10, 7,
+ 10, 9,10,12,10,12, 7, 8,10, 8,10, 9,10,12,10,12,
+ 6, 8,10, 7,10, 7, 9,11, 8,11,10,11,14,11,13, 7,
+ 9,11, 9,11,10,11,13,11,14, 9,10,13,10,12,10,11,
+ 14,11,14,13,14,17,14,16,10,11,14,11,14,12,13,16,
+ 14,16, 7, 7,10, 8,10, 7, 8,11, 9,11,10,11,14,11,
+ 14, 7, 9,11, 8,11,10,11,14,11,13, 9,10,13,10,13,
+ 10,11,14,11,14,13,14,17,14,16,10,11,14,11,14,12,
+ 14,17,13,15, 8, 9,11, 9,11, 9,10,13,10,13,11,13,
+ 15,13,15, 9,10,13,10,13,11,13,15,13,15, 9,10,13,
+ 10,13,10,11,14,11,14,13,14,17,14,17,10,11,14,11,
+ 14,13,14,16,14,17,11,13,15,13,15,13,14,16,14,16,
+ 15,16,19,18,19,12,13,18,14,17,15,15,17,17,19, 9,
+ 10,13,10,13,10,11,14,11,14,13,14,16,14,16,10,11,
+ 14,11,14,13,14,17,14,16,11,13,16,13,15,13,14,17,
+ 14,17,16,17,18,16,19,12,14,17,14,17,15,17,18,15,
+ 17,
+};
+
+static double _vq_quantthresh_res0_1024a_128_4[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_4[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_4 = {
+ _vq_quantthresh_res0_1024a_128_4,
+ _vq_quantmap_res0_1024a_128_4,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_128_4 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_128_4,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_128_4,
+ NULL,
+ &_vq_auxt_res0_1024a_128_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_5.vqh b/include/vorbis/book/res0_1024a_128_5.vqh
new file mode 100644
index 00000000..5621facb
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_5.vqh
@@ -0,0 +1,212 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_5_VQH_
+#define _V_res0_1024a_128_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_5[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_5[] = {
+ 3, 5, 7, 7, 5, 7, 7, 5, 7, 9,10, 7, 9,10, 7, 9,
+ 11,12, 9,11,12, 7,10,12,14,10,12,14, 5, 7, 9,10,
+ 7, 9,10, 7, 9,12,12, 9,12,12, 7,10,12,14,10,12,
+ 14, 5, 7, 9,10, 7, 9,10, 7, 9,11,11, 9,11,11, 9,
+ 11,13,14,11,13,14,10,12,14,16,12,14,16, 7, 9,11,
+ 12, 9,11,11, 9,11,13,14,11,13,14,10,12,14,16,12,
+ 14,17, 7, 9,11,12, 9,11,12, 9,11,14,14,11,14,14,
+ 12,14,16,17,14,16,17,13,14,16,17,14,17,17, 9,11,
+ 14,14,11,13,14,12,14,16,17,14,16,16,13,15,16,18,
+ 14,17,20, 7,10,12,13,10,12,13,10,12,14,15,12,14,
+ 15,13,14,16,18,14,17,18,15,17,19, 0,16,18, 0,10,
+ 12,15,16,12,14,16,13,15,17,19,15,16, 0,15,16,18,
+ 18,17,19,19, 5, 7, 9,10, 7, 9, 9, 7, 9,11,11, 9,
+ 11,12, 9,11,13,14,11,13,14,10,12,14,16,12,14,16,
+ 7, 9,11,12, 9,11,12, 9,11,14,14,11,14,14,10,12,
+ 14,16,12,14,16, 7, 9,11,12, 9,11,12, 9,11,14,14,
+ 11,14,14,12,14,16,17,13,15,17,12,14,17,19,14,16,
+ 18, 9,11,14,14,11,14,14,12,14,16,17,14,16,17,13,
+ 15,17,20,14,16,18, 8,10,12,13,10,12,13,10,12,14,
+ 15,12,14,16,13,15,17,18,14,17,18,15,17,18,20,16,
+ 18,19,10,12,14,16,12,15,16,12,14,16,19,15,16,18,
+ 15,16,18, 0,16,18,20, 5, 7, 9,10, 7, 9,10, 7, 9,
+ 11,12, 9,11,12, 9,11,14,14,11,14,15,10,12,14,17,
+ 12,14,17, 7, 9,11,12, 9,11,12, 9,11,14,14,11,13,
+ 14,10,12,14,16,12,14,16, 7, 9,11,12, 9,11,12, 9,
+ 10,13,13,10,13,13,11,13,15,16,13,15,16,12,13,15,
+ 18,14,16,20, 9,11,13,13,10,13,14,11,13,15,16,13,
+ 15,16,12,14,16,17,13,16,19, 9,11,14,15,11,14,14,
+ 11,13,16,16,13,15,16,14,15,17,19,15,18,19,15,16,
+ 17,18,16,19,20,11,13,15,17,13,16,16,14,15,18,18,
+ 16,17,18,15,16,18,19,16,18, 0,10,12,14,17,12,14,
+ 16,12,14,16,18,13,16,19,15,16,19, 0,16,19,19,16,
+ 18,20,19,19,20, 0,12,14,17,19,14,16,17,15,16,19,
+ 0,17,19,18,17,18, 0, 0,19,20,20, 7, 9,11,12, 9,
+ 11,12, 9,10,13,13,10,13,14,11,13,15,16,13,15,16,
+ 12,13,16,18,13,16,17, 9,10,13,13,11,13,14,11,13,
+ 15,16,13,15,16,12,13,16,17,13,16,19,10,11,14,14,
+ 11,14,14,11,13,16,16,13,16,16,14,15,18,18,15,18,
+ 18,15,17,18, 0,16,17,19,11,13,15,16,13,15,16,14,
+ 15,18,19,15,18,18,15,16,20, 0,17,18, 0,10,12,14,
+ 17,12,14,16,12,14,16,19,14,17,19,15,16, 0, 0,16,
+ 18, 0,17,18,20, 0,17,20, 0,12,14,16,19,14,16,18,
+ 15,16,19,20,16,18,19,16,19, 0, 0,19,20, 0, 8,10,
+ 12,12,10,12,12, 9,11,14,15,11,14,14,12,14,16,17,
+ 14,16,17,12,15,19,19,15,17,18, 9,11,14,14,11,14,
+ 14,12,14,17,18,14,17,17,12,15,18,17,14,17, 0,10,
+ 11,14,14,11,14,14,11,13,16,17,13,16,17,14,16,18,
+ 18,15,18,18,15,16,18, 0,17,20,20,11,13,15,17,13,
+ 16,16,14,15,19,18,15,19,19,15,16,19,20,16,18, 0,
+ 12,14,16,17,14,16,18,14,15,19,19,16,18,20,16,17,
+ 20,18,17, 0, 0,17,17,19,20,19, 0, 0,14,15,18,20,
+ 16,17,20,16,19, 0,20,18,20, 0,18,19,18, 0,19, 0,
+ 0,13,15,17,19,15,19,19,15,16,19, 0,16,18,20,16,
+ 17,19, 0,18, 0, 0,18,18,20, 0, 0, 0, 0,15,17,19,
+ 19,17,18, 0,17,18,20, 0,19,20, 0,20, 0, 0, 0,20,
+ 0, 0,10,11,14,15,12,14,14,11,13,16,17,13,16,16,
+ 14,16,18,18,16,18,19,15,16,19,20,16,18, 0,11,13,
+ 17,17,13,15,16,14,16,17,19,16,19,20,15,16,19,19,
+ 17,19,18,12,14,16,18,14,17,17,13,15,20,17,16,17,
+ 18,16,17, 0,20,17,19,19,17,19,19, 0,18,18,18,14,
+ 15,20,20,16,19,20,16,18, 0,20,18,19, 0,17,19,20,
+ 20,20,20, 0,13,15,17,20,15,17,18,14,16,19, 0,16,
+ 19, 0,16,19,20, 0,17,19, 0,20, 0,20, 0,18,19, 0,
+ 15,16,18,20,17,18, 0,17,19,20, 0,19, 0, 0,19, 0,
+ 0, 0,19, 0, 0, 8,10,12,14,10,12,14,10,12,14,16,
+ 12,15,16,12,15,17,19,15,16,19,14,17,20, 0,16,18,
+ 0,10,12,15,16,12,15,16,12,15,17,19,14,18,19,14,
+ 16,19,20,17,19, 0,10,12,15,17,12,15,16,12,14,17,
+ 17,14,16,20,15,17,18,20,16,18, 0,17,19,19, 0,19,
+ 0, 0,12,14,16,19,14,16,18,15,17,20, 0,16,18, 0,
+ 16,19,20, 0,20,19, 0,13,15,17,19,15,17,19,15,16,
+ 19,19,16,20,19,17,19,19,20,19, 0, 0,20,20, 0,20,
+ 0, 0, 0,14,17,20, 0,16,18,20,17,19, 0, 0,19,19,
+ 19,20,20, 0, 0,17,20, 0,15,18,18, 0,18,20,20,16,
+ 20,20,20,18, 0, 0,18,19,20, 0, 0, 0, 0,19, 0, 0,
+ 0,20, 0, 0,17,18, 0, 0,19, 0, 0,18,20, 0, 0,19,
+ 20, 0,20, 0, 0, 0,20, 0, 0,10,12,15,17,12,15,17,
+ 12,14,17, 0,14,17,18,15,17,19,19,16,18,20,16,18,
+ 0,19,19, 0, 0,12,14,16,18,14,17,17,15,16,18, 0,
+ 16,19, 0,16,20, 0, 0,19, 0, 0,13,15,18,20,15,17,
+ 19,14,16,19, 0,16,19, 0,17,20,19,20,19,19,20,20,
+ 0, 0,20,20,19, 0,15,16,19, 0,16, 0,20,17,19,20,
+ 0,20, 0, 0,20,20,20, 0,20, 0, 0,15,17,19, 0,18,
+ 19,20,17,18, 0,20,18,20, 0,19,20, 0,20, 0,20, 0,
+ 19,19, 0, 0,20, 0, 0,18,19,20, 0,19, 0, 0,20, 0,
+ 0, 0, 0, 0, 0,20, 0, 0, 0, 0, 0, 0, 5, 7, 9,10,
+ 7, 9,10, 7, 9,11,12, 9,11,12, 9,11,14,14,11,14,
+ 14,10,12,14,17,12,14,16, 7, 9,11,12, 9,11,12, 9,
+ 11,14,14,11,14,14,10,12,14,17,12,14,17, 7, 9,11,
+ 12, 9,11,12, 9,10,13,13,10,13,13,11,13,15,16,13,
+ 15,15,12,14,16,18,14,16,18, 9,10,13,13,11,13,13,
+ 11,13,15,15,13,15,16,12,13,16,17,14,16,17,10,11,
+ 14,15,11,14,14,11,13,16,16,13,16,16,14,15,19,19,
+ 15,18,18,15,16,17,20,16,17,18,11,13,15,17,13,15,
+ 16,14,15,17,17,16,18,18,15,16,18,19,16,19,19,10,
+ 12,14,16,12,15,16,12,14,17,18,14,16,19,15,16,19,
+ 0,17,19,19,16,18,20, 0,20, 0, 0,12,14,16,19,14,
+ 16,18,15,16,20, 0,16,19,19,17,18,18,19,18,19, 0,
+ 7, 9,11,12, 9,11,12, 9,10,13,14,11,13,14,11,13,
+ 15,16,13,15,16,12,13,16,17,14,16,17, 9,10,13,13,
+ 10,13,13,11,13,15,16,13,15,15,12,14,16,18,14,16,
+ 18,10,11,14,14,11,14,14,11,13,15,16,13,16,17,14,
+ 15,19,18,16,19,18,15,16, 0,19,16,17,20,11,13,16,
+ 16,13,16,16,14,16,17,18,16,17,19,15,16,19, 0,16,
+ 17,18,10,12,15,17,12,15,16,12,14,16,18,14,17,18,
+ 15,17,17,20,16,18, 0,17,19,19, 0,19,20, 0,12,14,
+ 17,18,14,16,18,15,16,19,19,16,20,20,17,18,19,19,
+ 18,18,19, 8,10,12,12,10,12,12, 9,11,14,15,11,14,
+ 15,12,14,16,18,14,16,17,12,14,18,18,14,17, 0,10,
+ 11,14,14,11,14,14,12,14,16,17,14,16,17,12,15,17,
+ 20,15,18,19,10,11,14,15,12,14,15,12,13,16,16,13,
+ 16,16,14,16,18,18,16,18,18,15,16,19,20,17, 0,19,
+ 11,13,15,16,13,16,16,14,15,17,19,16,19,19,15,16,
+ 19,19,16,18,20,12,14,16,17,14,17,16,14,16,18,19,
+ 15,19,19,16,17, 0,20,17,20,19,18,19,20,20,19, 0,
+ 0,14,16,18,18,16,18,19,17,19, 0,18,17,20, 0,16,
+ 20,18,20,19, 0, 0,13,15,17,19,15,18,18,14,17, 0,
+ 0,16,19,20,17,20, 0, 0,19,20, 0,19, 0, 0, 0,20,
+ 0, 0,15,17,19,20,17,18, 0,17,17,19,20,19,20, 0,
+ 19,19, 0, 0, 0, 0, 0,10,11,14,14,12,14,14,11,13,
+ 16,16,13,16,16,14,16,18,18,16,18,18,14,17,19, 0,
+ 16,19,20,11,13,15,16,13,16,16,14,16,18,20,16,20,
+ 18,15,17,18, 0,17,19, 0,12,14,17,17,14,17,17,14,
+ 16,19,20,16,18,19,16,18, 0, 0,19,19, 0,17,19, 0,
+ 0, 0, 0, 0,14,16,20,18,15,17,18,16,19,20,19,17,
+ 19,19,17,18,19, 0,17,19, 0,13,15,19,20,15,18,19,
+ 15,17,19, 0,17,19, 0,17,19, 0,20,19, 0, 0, 0, 0,
+ 20, 0,20, 0, 0,14,16,18,20,17,20, 0,17,19, 0, 0,
+ 19, 0,20,18, 0, 0, 0,19, 0, 0, 8,10,12,14,10,12,
+ 14,10,12,15,16,12,14,17,12,15,17,19,15,18,19,14,
+ 17,18,19,16,19,19,10,12,14,16,12,15,17,12,15,16,
+ 20,15,17,19,14,17,19,20,17, 0, 0,10,12,15,16,12,
+ 15,16,12,14,17,19,14,16,18,15,17,19,20,16,19,19,
+ 17, 0,19, 0,18, 0, 0,12,14,17,17,14,17,18,15,16,
+ 18, 0,17,18,19,16,19,20,20, 0,20, 0,13,15,17,20,
+ 15,17,18,15,16,19, 0,17, 0, 0,17,20, 0, 0,18,20,
+ 0,20, 0, 0, 0,19, 0, 0,14,16,18,19,17,19,20,17,
+ 19,20, 0,20,20, 0,18,18, 0, 0,20, 0, 0,15,16,19,
+ 19,18,19, 0,17,20,19, 0,18, 0, 0,19,20, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,17, 0, 0, 0,19, 0, 0,
+ 18,20,20,19, 0, 0, 0, 0,20,19, 0,20, 0, 0,10,12,
+ 15,16,12,15,17,12,14,17,18,14,17,19,15,16,19,20,
+ 17,19, 0,16,20,19, 0,18,20, 0,12,14,16,18,14,16,
+ 19,15,16,18,19,16,17,20,17, 0, 0, 0,19, 0, 0,13,
+ 15,18,20,15,18,19,15,17,18,19,16,18, 0,17,18,19,
+ 0,19, 0, 0,19, 0,20, 0, 0, 0, 0,14,16,19, 0,17,
+ 18,20,17,18, 0, 0,18,19, 0, 0, 0, 0, 0,19, 0, 0,
+ 15,17,19,19,18,20, 0,18,19, 0,20,20, 0, 0,19, 0,
+ 0, 0, 0, 0, 0,20, 0, 0, 0, 0, 0, 0,17,19,18, 0,
+ 18, 0,20,19, 0, 0, 0,20,19, 0,20, 0, 0, 0,20,18,
+ 0,
+};
+
+static double _vq_quantthresh_res0_1024a_128_5[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_5[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_5 = {
+ _vq_quantthresh_res0_1024a_128_5,
+ _vq_quantmap_res0_1024a_128_5,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_1024a_128_5 = {
+ 4, 2401,
+ _vq_lengthlist_res0_1024a_128_5,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_128_5,
+ NULL,
+ &_vq_auxt_res0_1024a_128_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_6.vqh b/include/vorbis/book/res0_1024a_128_6.vqh
new file mode 100644
index 00000000..b97a1e6f
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_6.vqh
@@ -0,0 +1,212 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_6_VQH_
+#define _V_res0_1024a_128_6_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_6[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_6[] = {
+ 6, 7, 8, 9, 7, 8, 9, 7, 7, 9, 9, 7, 9,10, 8, 9,
+ 10,11, 9,10,11, 9,10,11,12,10,11,12, 7, 8, 9,10,
+ 7, 9,10, 8, 9,10,11, 9,10,11, 9,10,11,12,10,11,
+ 12, 7, 8, 9,10, 8, 9,10, 8, 8, 9,11, 8, 9,11, 9,
+ 10,11,12, 9,11,11,10,11,12,13,11,12,13, 7, 8,10,
+ 10, 8, 9,10, 9, 9,10,11,10,11,12,10,11,12,13,11,
+ 12,13, 8, 9,10,11, 9,11,12, 9,10,11,13,10,11,12,
+ 10,11,12,13,11,12,13,11,12,14,15,12,13,15, 9, 9,
+ 11,12, 9,11,12,10,11,12,14,11,12,13,11,12,14, 0,
+ 12,13,14, 9,10,12,13,10,12,14,10,11,13,15,11,13,
+ 14,11,12,14,16,13,14,15,13,15,16,15,14,15, 0,10,
+ 11,12,13,11,13,13,11,12,16,15,12,13,15,12,15,16,
+ 0,14,16,15, 7, 8, 9,10, 8, 9,10, 8, 8, 9,10, 8,
+ 10,11, 9, 9,11,12, 9,11,12,10,11,11,14,10,11,13,
+ 8, 8, 9,10, 8, 9,11, 9,10,11,11, 9,10,11,10,11,
+ 12,14,11,12,13, 8, 9,10,11, 9,10,11, 9,10,11,12,
+ 10,11,12,10,11,12,14,11,12,14,11,12,13,14,12,13,
+ 15, 9,10,11,12,10,11,13,10,11,12,14,11,12,13,11,
+ 12,14,14,12,13,15, 9,10,12,13,10,12,13,10,11,12,
+ 15,11,13,15,11,14,13,15,13,14,14,13,15,15, 0,15,
+ 15,15,10,11,13,14,11,14,13,12,12,14,15,12,15,16,
+ 13,14,16,16,15,14, 0, 7, 8, 9,10, 8, 9,10, 8, 8,
+ 9,11, 8,10,11, 9, 9,11,12, 9,11,12,10,11,12,13,
+ 11,12,13, 8, 8, 9,11, 8,10,11, 9, 9,11,12, 9,11,
+ 12,10,11,12,13,10,12,14, 8, 8,10,11, 8,10,11, 8,
+ 9,10,11, 9,10,12, 9,10,11,13,11,12,13,11,11,13,
+ 16,12,13,14, 8, 9,10,11, 9,10,12,10,11,11,13,10,
+ 12,12,11,12,13,15,12,13,15, 9,10,11,13,10,12,12,
+ 9,10,12,13,10,12,13,11,11,13,13,12,15,13,13,13,
+ 14,16,13,15, 0, 9,10,13,14,10,13,13,11,12,14, 0,
+ 12,13, 0,12,13,14,14,13,15,15,10,11,12,14,11,13,
+ 14,11,11,13,15,11,15,16,12,13,14,15,13,15,16,14,
+ 14,16,16,16,16, 0,11,12,14,14,12,14,16,12,14,14,
+ 16,14,13, 0,13, 0,16, 0,14, 0, 0, 8, 8,10,11, 8,
+ 10,11, 8, 9,10,11, 9,10,12,10,10,12,14,10,12,12,
+ 11,12,13,15,12,15,14, 8, 9,11,12, 9,11,12, 9,10,
+ 12,13,10,12,12,11,12,12,15,11,13,14, 9,10,11,12,
+ 10,12,12,10,10,12,13,10,12,12,11,12,13,15,11,13,
+ 14,12,13,16,15,13, 0,16, 9,11,12,13,10,12,15,11,
+ 13,13,14,12,13,15,12,13, 0, 0,13,16, 0,10,11,12,
+ 14,11,13,16,10,11,14,14,11,13,16,12,13,15,16,13,
+ 14,15,15,14,15, 0, 0,16,15,11,12,14,14,11,14,15,
+ 13,14,16, 0,13,14,15,14,15,14,16,15,14, 0, 8, 9,
+ 10,11, 9,10,11, 9,10,11,12,10,11,13,10,11,12,13,
+ 11,13,15,11,12,15,15,12,15,14, 9,10,11,12,10,11,
+ 12,10,11,14,13,11,13,14,12,12,15,15,12,15,15, 9,
+ 10,11,12,10,11,13,10,11,14,14,10,12,13,11,12,14,
+ 15,12,15,14,13,13,15,15,13,15,15,10,11,12,13,11,
+ 12,13,11,13,15,15,12,15,15,13,14,15, 0,14,15,15,
+ 10,11,14,15,11,13,15,11,12,14,15,12,15,14,13,12,
+ 14, 0,14,15, 0,15,15,15,16, 0, 0, 0,11,12,13,15,
+ 12,13,15,12,13,15,15,15,14,16,15,15,15, 0,14,14,
+ 16,12,14,15, 0,13,13,15,12,13,15, 0,13, 0, 0,14,
+ 14,16, 0,15,16, 0,15,15,16, 0, 0, 0, 0,12,15,16,
+ 16,14,14,16,15,16,16, 0,15,15, 0, 0, 0,16, 0, 0,
+ 0, 0, 9,10,12,13,10,11,12,10,10,12,13,11,12,14,
+ 11,12,15,16,12,14,16,13,13,15,15,13,15,15, 9,11,
+ 12,13,11,13,14,11,12,15, 0,12,13, 0,14,13,15, 0,
+ 14,15,16,10,11,13,15,12,13,16,11,12,13,16,12,14,
+ 15,13,15,15,16,13,15,16,14, 0,16,16,15, 0, 0,11,
+ 12,14,15,12,14, 0,12,14,14,16,16,15,16,14,15,16,
+ 0,15, 0,16,12,12,14, 0,13,14, 0,13,13,16,15,13,
+ 15, 0,15,16,16, 0,14,15,16, 0, 0, 0, 0,16,16, 0,
+ 12,12,15,14,14,16,16,14,15,16,16, 0, 0,16,15, 0,
+ 0,16, 0,16, 0,10,10,11,13,10,12,13,10,11,13,15,
+ 11,13,15,12,13,13, 0,13,13,16,13,14, 0, 0,13,16,
+ 0,11,11,14,13,11,13,15,11,12,16,15,13,14,14,13,
+ 15,15,16, 0, 0, 0,10,11,13,15,11,13,15,11,12,14,
+ 15,12,14,15,13,13,15, 0,14,14, 0,15,16, 0, 0,14,
+ 0,16,11,12,13,14,12,13,15,12,15,14, 0,14,16,15,
+ 14,13, 0, 0,15,16, 0,12,12,15,16,13, 0, 0,12,13,
+ 16, 0,14,15, 0,13,15,15,16,14,16, 0,16, 0,16, 0,
+ 16, 0, 0,13,13,15, 0,15,15,16,15,15, 0, 0, 0,16,
+ 0,16,15, 0, 0,15, 0, 0,12,14, 0, 0,15, 0, 0,14,
+ 14,16, 0,14,16, 0,16,16, 0,16, 0, 0, 0, 0,16, 0,
+ 16, 0, 0, 0,15, 0, 0, 0,15, 0, 0,15, 0, 0, 0,15,
+ 0, 0, 0,16, 0, 0, 0, 0, 0,10,12,13,14,11,12,15,
+ 11,13,14,16,11,15,16,13,14,16, 0,14,14,15,16, 0,
+ 0, 0,16, 0, 0,11,12,15,16,12,15,14,12,14,16,15,
+ 12,15,16,14,15,16, 0,16, 0,16,12,12,15,16,13,14,
+ 16,12,13,15, 0,14,15, 0,16,15, 0, 0,14,16, 0, 0,
+ 0,16, 0,16, 0, 0,13,12,16, 0,13,16, 0,14,16, 0,
+ 0,16,15, 0,16,16, 0, 0, 0, 0, 0,13,13, 0,16,15,
+ 16, 0,14,15,16,16,16,15, 0,15,16, 0, 0, 0,16, 0,
+ 15, 0, 0, 0, 0,16, 0,16,15, 0,16, 0,16, 0,16, 0,
+ 0,16, 0,16, 0,15, 0, 0, 0, 0, 0, 0, 7, 8, 9,10,
+ 8, 9,10, 8, 8, 9,12, 8, 9,10, 9, 9,11,12, 9,11,
+ 12,10,11,12,13,10,12,13, 8, 8, 9,11, 8,10,10, 9,
+ 10,11,12,10,11,12,10,11,12,13,11,12,14, 8, 8,10,
+ 11, 8,10,10, 8, 9,10,11, 9,10,11, 9,10,12,12,10,
+ 12,14,11,12,12,15,11,13,15, 8, 9,10,12, 9,10,11,
+ 10,10,12,12,10,12,13,11,12,13,14,11,12,16, 9,10,
+ 12,12,10,11,13, 9,10,12,13,10,12,14,11,12,14,13,
+ 12,13,16,12,13,14,15,13,15,16,10,10,12,13,10,12,
+ 14,11,11,12,16,12,13,15,12,12,14,15,13,16, 0,10,
+ 11,14,14,11,13,15,11,12,13, 0,12,13,14,12,12,16,
+ 16,14,14, 0,14,14,14, 0,14, 0, 0,11,12,13,15,12,
+ 14,15,13,13,14, 0,13,13,15,14,14,15, 0,15,14,16,
+ 8, 8,10,11, 8,10,11, 8, 9,10,13, 9,11,12,10,10,
+ 12,12,10,11,12,11,12,13, 0,11,14,14, 8, 9,10,11,
+ 9,10,11, 9,10,12,14,10,12,13,11,11,13,14,11,12,
+ 14, 9,10,11,12,10,12,13, 9,10,12,13,10,12,13,11,
+ 12,13,16,12,13,14,12,13,14,16,13,14,14,10,11,12,
+ 13,10,12,13,11,12,15,15,11,14,14,13,13,15, 0,12,
+ 13, 0,10,11,13,16,11,13,15,11,12,13,14,11,13,15,
+ 12,13,14, 0,14,15,16,13,16,16,16,16,14, 0,11,12,
+ 12,14,11,14,14,12,13,16, 0,13,16,15,14,14,15, 0,
+ 15,16, 0, 8, 9,10,11, 9,10,11, 9,10,12,12,10,11,
+ 12,11,11,13,13,11,13,14,12,12,13,14,13,13,15, 9,
+ 10,12,12,10,11,12,11,11,13,13,11,12,13,11,12,15,
+ 0,14,14, 0, 9,10,12,13,10,11,13,10,10,12,13,11,
+ 12,13,11,12,13,14,12,13,16,13,12,15,16,14,14, 0,
+ 10,10,12,13,10,12,14,11,12,14, 0,12,13,14,13,14,
+ 15, 0,14,15, 0,11,11,13,16,11,14,13,11,12,14,16,
+ 12,13,14,12,13,14, 0,13,15,16,14,14,16, 0,14, 0,
+ 0,11,13,14,15,12,15,13,12,13,14,16,14,14, 0,14,
+ 16,16,16, 0, 0, 0,11,13,16,16,12,14,16,13,14,16,
+ 0,13, 0,16,14,14, 0,16,14,16, 0,16, 0,16, 0, 0,
+ 0, 0,12,14, 0,16,14,15,16,14,14, 0,15,14,16, 0,
+ 0, 0, 0, 0,16, 0, 0, 9,10,11,12,10,11,13,10,11,
+ 12,13,11,13,13,11,12,14,14,12,13,14,13,13,14,14,
+ 14,14, 0, 9,11,12,14,10,12,12,11,12,14,14,12,13,
+ 14,13,12,16,16,13,14, 0,10,11,13,14,11,14,15,11,
+ 11,14,14,13,14,16,13,13, 0,15,13,16, 0,16,14,16,
+ 0,16,15, 0,11,12,14,15,12,13,16,12,14, 0, 0,14,
+ 16,16,13,15,15, 0,14,15,16,11,13,16, 0,13,14,15,
+ 12,14,15, 0,14,14,16,13,14,15, 0,14, 0, 0, 0, 0,
+ 0, 0,15,16, 0,12,13,14,16,13,14, 0,14,16, 0, 0,
+ 14,15,16, 0,16,16,16,15,16, 0,10,10,12,13,10,12,
+ 13,10,11,13,14,11,12,14,12,13,14,14,12,13, 0,13,
+ 14,15,16,13,14,16,10,11,13,14,12,13,14,12,12,14,
+ 16,13,14,15,13,15,14,15,14,15, 0,10,11,13,14,11,
+ 12,14,11,12,15,15,12,13,14,13,13,14,16,13,15, 0,
+ 14,14,16, 0, 0,14, 0,11,12,13,16,12,14,16,12,14,
+ 0,16,13,16,16,15,15, 0, 0,14, 0, 0,11,12,14,15,
+ 13,14,15,12,14,16, 0,14,14, 0,14,16,16, 0,15,15,
+ 0,14,16, 0, 0,15,16, 0,12,13,14, 0,13,14,15,14,
+ 14, 0, 0,15, 0, 0,14, 0, 0, 0, 0, 0, 0,13,14,16,
+ 16,15,15, 0,14,16, 0, 0,15, 0, 0,14, 0, 0, 0,15,
+ 16, 0, 0, 0, 0, 0, 0, 0, 0,13,14,16, 0,15, 0, 0,
+ 13,16, 0, 0,16, 0, 0,16, 0,16, 0, 0, 0, 0,10,11,
+ 13,14,11,14,14,11,11,14, 0,12,15,16,13,14,15, 0,
+ 14, 0,15,15,14,16, 0,15, 0,16,11,13,14,14,12,14,
+ 14,12,13,16, 0,13,15,16,15, 0, 0, 0,15,16, 0,12,
+ 13,14, 0,13,16,14,12,13,14,16,14,16,16,15,14,16,
+ 16, 0,16, 0,15, 0, 0, 0,16, 0, 0,12,14,15, 0,14,
+ 14,16,14,16,16, 0,14,16, 0,16, 0, 0, 0,16,16, 0,
+ 14,16,15, 0,16, 0,16,13,14, 0, 0, 0, 0,16, 0,15,
+ 0, 0, 0, 0, 0,16, 0,16, 0, 0, 0, 0,14,14, 0, 0,
+ 14, 0, 0,15, 0,15, 0, 0,16, 0,16, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static double _vq_quantthresh_res0_1024a_128_6[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_6[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_6 = {
+ _vq_quantthresh_res0_1024a_128_6,
+ _vq_quantmap_res0_1024a_128_6,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_1024a_128_6 = {
+ 4, 2401,
+ _vq_lengthlist_res0_1024a_128_6,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_128_6,
+ NULL,
+ &_vq_auxt_res0_1024a_128_6,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_7.vqh b/include/vorbis/book/res0_1024a_128_7.vqh
new file mode 100644
index 00000000..833db7fc
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_7.vqh
@@ -0,0 +1,75 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_7_VQH_
+#define _V_res0_1024a_128_7_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_7[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_7[] = {
+ 1, 4, 6, 7, 7, 8, 4, 6, 7, 7, 8, 4, 6, 8, 9, 9,
+ 10, 6, 8, 9, 9,10, 7, 8,10,11,11,12, 8,10,11,11,
+ 12, 8,10,11,12,12,13,10,11,12,12,13, 7,10,11,12,
+ 13,14,10,11,13,13,14, 9,11,13,14,14,15,11,13,14,
+ 14,15, 4, 6, 8, 9, 9,10, 6, 8, 9, 9,10, 7, 8,10,
+ 11,11,12, 8,10,11,11,12, 8,10,11,12,12,13,10,11,
+ 12,12,13, 8,10,11,13,13,14,10,11,13,13,14, 9,11,
+ 13,14,14,15,11,13,14,14,15,
+};
+
+static double _vq_quantthresh_res0_1024a_128_7[] = {
+ -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ 3.5, 5,
+};
+
+static long _vq_quantmap_res0_1024a_128_7[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_7 = {
+ _vq_quantthresh_res0_1024a_128_7,
+ _vq_quantmap_res0_1024a_128_7,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_1024a_128_7 = {
+ 2, 121,
+ _vq_lengthlist_res0_1024a_128_7,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_1024a_128_7,
+ NULL,
+ &_vq_auxt_res0_1024a_128_7,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_8.vqh b/include/vorbis/book/res0_1024a_128_8.vqh
new file mode 100644
index 00000000..b50a0e64
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_8.vqh
@@ -0,0 +1,86 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_8_VQH_
+#define _V_res0_1024a_128_8_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_8[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_8[] = {
+ 2, 4, 6, 7, 7, 7, 7, 8, 4, 6, 7, 7, 7, 7, 8, 5,
+ 6, 7, 8, 8, 9, 8, 9, 6, 7, 8, 8, 9, 8, 9, 6, 8,
+ 9, 9, 9, 9, 9,10, 8, 9, 9, 9, 9, 9,10, 7, 8, 9,
+ 10,10,10,10,11, 8, 9,10,10,10,10,11, 7, 9, 9,10,
+ 10,10,10,11, 9, 9,10,10,10,10,11, 7, 9,10,10,10,
+ 10,10,11, 9,10,10,10,10,10,11, 7, 9,10,11,10,11,
+ 11,12, 9,10,10,10,11,11,12, 8,10,11,11,11,11,12,
+ 12,10,11,11,11,11,12,12, 5, 6, 7, 8, 8, 8, 8, 9,
+ 6, 7, 8, 8, 9, 8, 9, 6, 8, 9, 9, 9, 9, 9,10, 8,
+ 9, 9, 9, 9, 9,10, 7, 8, 9,10,10,10,10,11, 8, 9,
+ 10,10,10,10,11, 7, 9, 9,10,10,10,10,11, 8, 9,10,
+ 10,10,10,11, 7, 9,10,10,10,10,10,11, 9,10,10,10,
+ 10,10,11, 7, 9,10,10,10,11,11,12, 9,10,11,10,11,
+ 11,12, 8,10,11,11,11,11,12,12,10,11,11,11,11,12,
+ 12,
+};
+
+static double _vq_quantthresh_res0_1024a_128_8[] = {
+ -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5,
+ 1.5, 2.5, 3.5, 5, 7, 9.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_8[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_8 = {
+ _vq_quantthresh_res0_1024a_128_8,
+ _vq_quantmap_res0_1024a_128_8,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_1024a_128_8 = {
+ 2, 225,
+ _vq_lengthlist_res0_1024a_128_8,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_1024a_128_8,
+ NULL,
+ &_vq_auxt_res0_1024a_128_8,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_128_9.vqh b/include/vorbis/book/res0_1024a_128_9.vqh
new file mode 100644
index 00000000..45f09269
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_128_9.vqh
@@ -0,0 +1,115 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_128_9_VQH_
+#define _V_res0_1024a_128_9_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_128_9[] = {
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 51,
+ 53,
+ 56,
+ 61,
+ 68,
+ 77,
+ 90,
+ 44,
+ 43,
+ 42,
+ 41,
+ 39,
+ 37,
+ 34,
+ 29,
+ 22,
+ 13,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_128_9[] = {
+ 3, 5, 6, 7, 7, 7, 8, 8, 8,11,14,20, 5, 6, 7, 7,
+ 7, 8, 8, 8,11,15,18, 5, 6, 7, 8, 8, 8, 8, 9, 9,
+ 13,15,20, 6, 7, 8, 8, 8, 8, 9, 9,13,16,19, 6, 7,
+ 8, 8, 8, 9, 9,10,10,13,15, 0, 7, 8, 8, 8, 9, 9,
+ 10,10,13,16, 0, 7, 8, 9, 9, 9, 9,10,10,11,14,18,
+ 0, 8, 8, 9, 9, 9,10,10,11,14,16, 0, 7, 8, 9, 9,
+ 9, 9,10,10,11,15,18, 0, 8, 9, 9, 9, 9, 9,10,11,
+ 14,17,19, 7, 8, 9, 9, 9, 9,10,10,11,15,19, 0, 8,
+ 9, 9, 9, 9,10,10,11,16, 0, 0, 7, 9, 9,10,10,10,
+ 10,11,11,17,18, 0, 9, 9,10,10,10,10,11,11,16,19,
+ 0, 8, 9,10,10,10,10,11,11,12,16, 0, 0, 9,10,11,
+ 10,11,11,11,12,15, 0, 0, 8, 9,10,11,11,11,11,12,
+ 14,16, 0, 0,10,10,11,11,11,11,12,14,18, 0, 0,11,
+ 14,14,15,14,16,15,15,17, 0, 0, 0,13,14,14,14,15,
+ 15,15,19,19, 0, 0,14,17,18, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,16,19, 0, 0,19, 0, 0, 0, 0, 0, 0,18, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 6, 7, 8, 8, 8, 8, 9, 9,13,15,19,
+ 6, 7, 8, 8, 8, 8, 9, 9,13,17, 0, 6, 7, 8, 8, 8,
+ 9, 9,10,10,13,15,17, 7, 8, 8, 8, 9, 9,10,10,13,
+ 16, 0, 6, 8, 9, 9, 9, 9,10,10,11,14,15,19, 8, 9,
+ 9, 9, 9,10,10,11,14,17, 0, 7, 8, 9, 9, 9, 9,10,
+ 10,11,15,16, 0, 8, 9, 9, 9, 9,10,10,11,15,18, 0,
+ 7, 8, 9, 9, 9,10,10,10,11,15,19, 0, 8, 9, 9, 9,
+ 9,10,10,11,15, 0, 0, 7, 9, 9,10,10,10,10,11,11,
+ 15,19, 0, 9, 9,10,10,10,10,11,11,15,19,19, 8, 9,
+ 10,10,10,10,11,11,12,15, 0, 0, 9,10,10,10,10,11,
+ 11,12,16,19, 0, 8,10,10,11,11,11,11,12,14,19, 0,
+ 0,10,10,11,11,11,11,12,14,18, 0, 0,11,13,15,14,
+ 15,15,15,16,17, 0, 0, 0,13,15,15,14,14,16,15,17,
+ 0, 0, 0,14,19,17, 0, 0, 0, 0,19, 0, 0, 0, 0,17,
+ 18,19,18,19, 0, 0, 0, 0, 0, 0,16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,19, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static double _vq_quantthresh_res0_1024a_128_9[] = {
+ -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5,
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5,
+ 7, 9.5, 13.5, 19.5, 27.5, 38.5,
+};
+
+static long _vq_quantmap_res0_1024a_128_9[] = {
+ 22, 21, 20, 19, 18, 17, 16, 15,
+ 14, 13, 12, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_128_9 = {
+ _vq_quantthresh_res0_1024a_128_9,
+ _vq_quantmap_res0_1024a_128_9,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_1024a_128_9 = {
+ 2, 529,
+ _vq_lengthlist_res0_1024a_128_9,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_1024a_128_9,
+ NULL,
+ &_vq_auxt_res0_1024a_128_9,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_256_1.vqh b/include/vorbis/book/res0_1024a_256_1.vqh
new file mode 100644
index 00000000..5b07388a
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_256_1.vqh
@@ -0,0 +1,99 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_256_1_VQH_
+#define _V_res0_1024a_256_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_256_1[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_256_1[] = {
+ 2, 4, 8, 4, 8, 5, 7,10, 7,10, 9,10,12,10,12, 5,
+ 7,10, 7,10, 9,10,12,10,12, 5, 7,10, 7,10, 7, 8,
+ 11, 8,11,10,11,13,11,13, 7, 8,11, 8,11,10,11,13,
+ 11,13, 9,10,13,10,13,10,11,13,11,13,13,14,15,14,
+ 15,11,11,13,11,13,13,13,15,13,15, 5, 7,10, 7,10,
+ 7, 8,11, 8,11,10,11,13,11,13, 7, 8,11, 8,11,10,
+ 11,13,11,13, 9,10,12,10,13,10,11,13,11,13,13,14,
+ 15,14,15,11,11,13,11,13,13,14,15,13,15, 5, 7,10,
+ 7,10, 7, 8,11, 8,11,10,11,13,11,13, 7, 8,11, 8,
+ 11,10,11,13,11,13, 7, 8,11, 8,11, 9,10,12,10,12,
+ 11,12,14,12,14, 9,10,12,10,12,11,12,14,12,14,10,
+ 11,14,11,14,11,12,14,12,14,13,14,16,14,16,11,12,
+ 14,12,14,14,14,16,14,16, 7, 9,11, 9,11, 9,10,12,
+ 10,12,11,12,14,12,14, 9,10,12,10,12,11,12,14,12,
+ 14,11,12,13,11,14,11,12,14,12,14,14,14,16,14,15,
+ 12,12,14,12,14,14,14,16,14,16, 9,11,13,11,13,11,
+ 12,14,11,14,13,14,16,14,15,10,11,13,12,14,13,14,
+ 15,14,15,10,12,14,11,14,11,12,14,12,14,14,14,16,
+ 14,16,12,12,14,12,14,14,14,16,14,16,13,14,16,14,
+ 15,14,14,16,14,16,15,16,15,16,17,14,14,16,14,16,
+ 16,16,18,16,17,11,12,13,12,14,12,12,14,12,14,14,
+ 14,16,14,16,12,12,14,12,14,14,14,16,14,16,13,14,
+ 15,14,16,14,14,16,14,16,15,16,18,16,17,14,14,16,
+ 14,16,15,17,18,16,18, 5, 7,10, 7,10, 7, 8,11, 8,
+ 11,10,11,13,11,13, 7, 8,11, 8,11,10,11,13,11,13,
+ 7, 9,11, 9,11, 9,10,12,10,12,11,12,14,12,14, 9,
+ 10,12,10,12,12,12,14,12,14,10,11,13,11,14,11,12,
+ 14,12,14,14,14,16,14,16,11,12,14,12,14,14,14,15,
+ 14,16, 7, 9,11, 9,11, 9,10,12,10,12,12,12,14,12,
+ 14, 9,10,12,10,12,11,12,14,12,14,11,11,13,12,14,
+ 12,12,14,12,14,14,14,16,15,16,11,12,14,12,14,13,
+ 14,16,14,15, 9,11,13,11,13,11,11,14,11,14,13,13,
+ 15,14,15,11,11,14,12,14,13,14,15,14,15,11,12,14,
+ 12,14,11,12,14,12,14,14,14,16,15,16,12,12,14,12,
+ 14,14,14,16,14,16,13,14,15,14,16,14,14,16,15,16,
+ 15,16,18,16,17,14,14,16,14,16,16,15,17,16,18,10,
+ 11,14,12,14,12,12,14,12,14,14,14,16,15,16,12,12,
+ 14,12,14,14,14,16,14,16,13,14,16,14,15,14,15,16,
+ 15,16,16,16,17,16,17,13,14,16,14,16,16,16,17,15,
+ 16,
+};
+
+static double _vq_quantthresh_res0_1024a_256_1[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_256_1[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_256_1 = {
+ _vq_quantthresh_res0_1024a_256_1,
+ _vq_quantmap_res0_1024a_256_1,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_256_1 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_256_1,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_256_1,
+ NULL,
+ &_vq_auxt_res0_1024a_256_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_256_2.vqh b/include/vorbis/book/res0_1024a_256_2.vqh
new file mode 100644
index 00000000..9fd433c5
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_256_2.vqh
@@ -0,0 +1,75 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_256_2_VQH_
+#define _V_res0_1024a_256_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_256_2[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_256_2[] = {
+ 3, 4, 6, 7, 7, 9, 4, 6, 7, 7, 9, 4, 5, 6, 7, 8,
+ 9, 5, 6, 7, 8, 9, 6, 6, 7, 8, 8,10, 6, 7, 8, 8,
+ 10, 7, 7, 8, 9, 9,10, 7, 8, 9, 9,10, 8, 8, 8, 9,
+ 9,10, 8, 9, 9,10,10, 9, 9,10,10,11,11, 9,10,10,
+ 11,11, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 6, 6, 7,
+ 8, 8,10, 6, 7, 8, 8,10, 7, 7, 8, 9, 9,10, 7, 8,
+ 9, 9,10, 8, 8, 9, 9, 9,10, 8, 9, 9,10,10, 9, 9,
+ 10,10,11,11, 9,10,10,11,11,
+};
+
+static double _vq_quantthresh_res0_1024a_256_2[] = {
+ -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ 3.5, 5,
+};
+
+static long _vq_quantmap_res0_1024a_256_2[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_256_2 = {
+ _vq_quantthresh_res0_1024a_256_2,
+ _vq_quantmap_res0_1024a_256_2,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_1024a_256_2 = {
+ 2, 121,
+ _vq_lengthlist_res0_1024a_256_2,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_1024a_256_2,
+ NULL,
+ &_vq_auxt_res0_1024a_256_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_256_3.vqh b/include/vorbis/book/res0_1024a_256_3.vqh
new file mode 100644
index 00000000..589b87b9
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_256_3.vqh
@@ -0,0 +1,86 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_256_3_VQH_
+#define _V_res0_1024a_256_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_256_3[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_256_3[] = {
+ 5, 6, 6, 7, 7, 7, 8, 8, 6, 6, 7, 7, 7, 8, 9, 6,
+ 6, 7, 7, 7, 8, 8, 9, 6, 7, 7, 7, 8, 8, 9, 6, 7,
+ 7, 8, 7, 8, 8,10, 7, 7, 8, 7, 8, 8,10, 7, 7, 8,
+ 8, 8, 8, 9,10, 7, 8, 8, 8, 8, 9,10, 7, 7, 8, 8,
+ 8, 8, 9,10, 7, 8, 8, 8, 8, 9,10, 7, 8, 8, 8, 8,
+ 8, 9,10, 8, 8, 8, 8, 8, 9,10, 8, 8, 9, 9, 9, 9,
+ 10,11, 8, 9, 9, 9, 9,10,11, 9, 9,10,10,10,10,11,
+ 12, 9,10,10,10,10,11,12, 6, 6, 7, 7, 7, 8, 8, 9,
+ 6, 7, 7, 7, 8, 8, 9, 6, 7, 7, 8, 7, 8, 8, 9, 7,
+ 7, 8, 7, 8, 8,10, 7, 7, 8, 8, 8, 8, 9,10, 7, 8,
+ 8, 8, 8, 9,10, 7, 7, 8, 8, 8, 8, 9,10, 7, 7, 8,
+ 8, 8, 9,10, 7, 8, 8, 8, 8, 8, 9,10, 8, 8, 8, 8,
+ 8, 9,10, 8, 8, 9, 9, 9, 9,10,11, 8, 9, 9, 9, 9,
+ 10,11, 9, 9,10,10,10,10,11,12, 9,10,10,10,10,11,
+ 12,
+};
+
+static double _vq_quantthresh_res0_1024a_256_3[] = {
+ -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5,
+ 1.5, 2.5, 3.5, 5, 7, 9.5,
+};
+
+static long _vq_quantmap_res0_1024a_256_3[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_256_3 = {
+ _vq_quantthresh_res0_1024a_256_3,
+ _vq_quantmap_res0_1024a_256_3,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_1024a_256_3 = {
+ 2, 225,
+ _vq_lengthlist_res0_1024a_256_3,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_1024a_256_3,
+ NULL,
+ &_vq_auxt_res0_1024a_256_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_256_4.vqh b/include/vorbis/book/res0_1024a_256_4.vqh
new file mode 100644
index 00000000..0ee7e515
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_256_4.vqh
@@ -0,0 +1,100 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_256_4_VQH_
+#define _V_res0_1024a_256_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_256_4[] = {
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 29,
+ 31,
+ 34,
+ 39,
+ 46,
+ 22,
+ 21,
+ 20,
+ 19,
+ 17,
+ 15,
+ 12,
+ 7,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_256_4[] = {
+ 4, 5, 6, 7, 7, 7, 8, 8, 8,10, 5, 6, 7, 7, 7, 8,
+ 8, 8,10, 5, 6, 7, 8, 8, 8, 8, 9, 9,11, 6, 7, 8,
+ 8, 8, 8, 9, 9,11, 6, 7, 8, 8, 8, 8, 9, 9, 9,12,
+ 7, 8, 8, 8, 8, 9, 9, 9,12, 7, 8, 8, 9, 9, 9, 9,
+ 10,10,13, 8, 8, 9, 9, 9, 9,10,10,13, 7, 8, 8, 9,
+ 9, 9, 9,10,10,13, 8, 8, 9, 9, 9, 9,10,10,13, 7,
+ 8, 9, 9, 9, 9, 9,10,10,13, 8, 9, 9, 9, 9, 9,10,
+ 10,13, 8, 8, 9, 9, 9, 9,10,10,11,14, 9, 9, 9, 9,
+ 9,10,10,11,13, 8, 9,10,10,10,10,10,11,11,14, 9,
+ 10,10,10,10,10,11,11,14, 8, 9,10,10,10,11,11,11,
+ 13,15, 9,10,10,10,11,11,11,12,15,11,12,13,14,14,
+ 14,15,15,15,17,12,13,14,14,14,14,14,15,17, 5, 6,
+ 7, 8, 8, 8, 8, 9, 9,11, 6, 7, 8, 8, 8, 8, 9, 9,
+ 11, 6, 7, 8, 8, 8, 8, 9, 9, 9,12, 7, 8, 8, 8, 8,
+ 9, 9, 9,12, 7, 8, 8, 9, 9, 9, 9,10,10,13, 8, 8,
+ 9, 9, 9, 9,10,10,13, 7, 8, 8, 9, 9, 9, 9,10,10,
+ 13, 8, 8, 9, 9, 9, 9,10,10,13, 8, 8, 9, 9, 9, 9,
+ 9,10,10,13, 8, 9, 9, 9, 9, 9,10,10,13, 8, 8, 9,
+ 9, 9, 9,10,10,11,13, 9, 9, 9, 9, 9,10,10,11,13,
+ 8, 9,10,10,10,10,10,11,11,14, 9,10,10,10,10,10,
+ 11,11,14, 8, 9,10,10,10,11,11,11,12,15, 9,10,10,
+ 10,11,11,11,12,15,11,12,13,14,14,14,14,15,15,17,
+ 12,13,14,14,14,14,14,15,17,
+};
+
+static double _vq_quantthresh_res0_1024a_256_4[] = {
+ -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5,
+ -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5,
+ 13.5, 19.5,
+};
+
+static long _vq_quantmap_res0_1024a_256_4[] = {
+ 18, 17, 16, 15, 14, 13, 12, 11,
+ 10, 0, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_256_4 = {
+ _vq_quantthresh_res0_1024a_256_4,
+ _vq_quantmap_res0_1024a_256_4,
+ 19,
+ 19
+};
+
+static static_codebook _vq_book_res0_1024a_256_4 = {
+ 2, 361,
+ _vq_lengthlist_res0_1024a_256_4,
+ 1, -526974976, 1611661312, 6, 0,
+ _vq_quantlist_res0_1024a_256_4,
+ NULL,
+ &_vq_auxt_res0_1024a_256_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_256_5.vqh b/include/vorbis/book/res0_1024a_256_5.vqh
new file mode 100644
index 00000000..6084889e
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_256_5.vqh
@@ -0,0 +1,133 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_1024a_256_5_VQH_
+#define _V_res0_1024a_256_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_256_5[] = {
+ 88,
+ 89,
+ 90,
+ 91,
+ 92,
+ 94,
+ 96,
+ 99,
+ 104,
+ 111,
+ 120,
+ 133,
+ 151,
+ 176,
+ 87,
+ 86,
+ 85,
+ 84,
+ 82,
+ 80,
+ 77,
+ 72,
+ 65,
+ 56,
+ 43,
+ 25,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_256_5[] = {
+ 3, 5, 6, 7, 7, 7, 7, 8, 9,10, 8,10,12,11, 5, 6,
+ 6, 7, 7, 8, 8, 9,10, 7,11,12,12, 5, 6, 7, 8, 8,
+ 8, 8, 9,10,12, 9,13,15,15, 6, 7, 8, 8, 8, 9, 9,
+ 10,12, 9,12,14,13, 6, 7, 8, 9, 9, 9,10,10,11,12,
+ 10,13,15,15, 7, 8, 9, 9, 9,10,10,10,13,10,13,16,
+ 15, 7, 8, 9,10, 9,10,10,10,11,14,11,14, 0,16, 8,
+ 9,10, 9,10,10,10,11,14,11,14,16, 0, 7, 8, 9,10,
+ 10,10,10,10,11,14,11,14,15,15, 8, 9, 9, 9,10,10,
+ 10,11,14,11,14, 0,16, 7, 9, 9,10,10,10,10,10,11,
+ 14,11,14,14, 0, 8, 9,10,10,10,10,10,11,13,11,14,
+ 16,16, 8, 9,10,11,10,10,10,10,11,14,11,14,15,16,
+ 9,10,10,10,10,10,10,12,14,11,14,15,15, 8, 9,10,
+ 11,10,10,11,11,12,14,11,13,15,15, 9,10,11,10,11,
+ 11,11,12,14,11,13,14,15, 9,10,11,12,12,12,12,12,
+ 12,14,12,13,14,16,10,11,12,12,12,13,12,13,15,12,
+ 14,14,15, 9,12,13,15,15,14,14,16,15, 0,13,15,16,
+ 16,12,15,16,16,14,14,16, 0,16,15, 0, 0,16, 7, 9,
+ 10,12,12,12,13,12,13,14,16, 0, 0,15, 9,11,12,12,
+ 12,13,12,13,14,16, 0, 0,15, 9,12,13,15, 0,16,16,
+ 16, 0,16,16, 0, 0,16,12,14,15,16,15,16,16, 0, 0,
+ 16, 0, 0, 0,11,12,15,16, 0,16,16,15,15,16,16, 0,
+ 0,16,13,15, 0,16, 0, 0, 0, 0, 0,16, 0, 0,15,11,
+ 14,14, 0,15, 0,16, 0,15,16,15, 0, 0,16,13,15, 0,
+ 16, 0,15, 0,15,15,16, 0, 0,16, 5, 6, 7, 8, 8, 8,
+ 9, 9,10,12, 9,12,14,14, 6, 7, 8, 8, 8, 9, 9,10,
+ 12, 9,13,13,15, 6, 7, 8, 9, 9, 9, 9, 9,11,13,10,
+ 13,15,15, 7, 8, 9, 9, 9, 9,10,11,13,10,13,16,14,
+ 7, 8, 9, 9, 9,10,10,10,11,13,11,14,16, 0, 8, 9,
+ 9, 9,10,10,10,11,14,11,15,16,15, 7, 8, 9, 9,10,
+ 10,10,10,12,13,11,15,16,16, 8, 9, 9, 9,10,10,10,
+ 11,14,10,15, 0,16, 8, 8, 9,10,10,10,10,10,11,14,
+ 11,13,16,15, 9, 9,10,10,10,10,10,11,14,10,14, 0,
+ 15, 8, 9,10,11,10,10,10,11,12,13,11,14,15,15, 9,
+ 10,10,10,10,10,11,11,14,11,14,16,16, 8, 9,10,11,
+ 10,11,11,11,12,14,11,13,15,14, 9,10,11,10,10,11,
+ 10,12,15,11,13,15,14, 9,10,11,12,12,12,12,12,14,
+ 15,12,15,14,16,10,11,12,11,12,12,12,13,15,12,14,
+ 14,16,10,12,14,15,14,14,15, 0, 0,16,13,15,15, 0,
+ 12,13,14,15,14,14,15, 0,15,14,16,16,16, 7,10,11,
+ 12,11,13,13,14,12,16, 0, 0, 0, 0,10,11,12,12,12,
+ 13,13,13,15,15,15, 0,16,10,11,13,13, 0, 0, 0,16,
+ 0,16, 0, 0, 0, 0,12,14,16,15, 0, 0,16, 0, 0, 0,
+ 0, 0,16,11,12,15, 0,16, 0,16, 0, 0, 0, 0, 0, 0,
+ 0,12, 0, 0,15,16,16,16, 0, 0,16, 0, 0, 0,11,15,
+ 16, 0,14, 0, 0, 0,15, 0,16, 0, 0,15,14,14,15,15,
+ 15, 0, 0, 0,16,16, 0,16,16,
+};
+
+static double _vq_quantthresh_res0_1024a_256_5[] = {
+ -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7,
+ -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5,
+ 54, 75.5,
+};
+
+static long _vq_quantmap_res0_1024a_256_5[] = {
+ 26, 25, 24, 23, 22, 21, 20, 19,
+ 18, 17, 16, 15, 14, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_256_5 = {
+ _vq_quantthresh_res0_1024a_256_5,
+ _vq_quantmap_res0_1024a_256_5,
+ 27,
+ 27
+};
+
+static static_codebook _vq_book_res0_1024a_256_5 = {
+ 2, 729,
+ _vq_lengthlist_res0_1024a_256_5,
+ 1, -522846208, 1611661312, 8, 0,
+ _vq_quantlist_res0_1024a_256_5,
+ NULL,
+ &_vq_auxt_res0_1024a_256_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_128_1.vqh b/include/vorbis/book/res0_128a_128_1.vqh
new file mode 100644
index 00000000..3f77bce7
--- /dev/null
+++ b/include/vorbis/book/res0_128a_128_1.vqh
@@ -0,0 +1,63 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_128_1_VQH_
+#define _V_res0_128a_128_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_128_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_128_1[] = {
+ 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 9,10, 7,
+ 9,10, 5, 7, 8, 7,10, 9, 7,10, 9, 5, 8, 8, 8,10,
+ 10, 7,10,10, 7,10,10,10,12,13,10,12,13, 8,10,10,
+ 9,13,12,10,12,13, 5, 8, 8, 8,10,10, 8,10,10, 7,
+ 10,10,10,12,12,10,12,13, 8,10,10,10,13,13,10,13,
+ 12,
+};
+
+static double _vq_quantthresh_res0_128a_128_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_128a_128_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_128_1 = {
+ _vq_quantthresh_res0_128a_128_1,
+ _vq_quantmap_res0_128a_128_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_128a_128_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_128a_128_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_128a_128_1,
+ NULL,
+ &_vq_auxt_res0_128a_128_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_128_2.vqh b/include/vorbis/book/res0_128a_128_2.vqh
new file mode 100644
index 00000000..909401a7
--- /dev/null
+++ b/include/vorbis/book/res0_128a_128_2.vqh
@@ -0,0 +1,99 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_128_2_VQH_
+#define _V_res0_128a_128_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_128_2[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_128_2[] = {
+ 2, 5, 6, 4, 6, 4, 7, 9, 7, 9, 7, 9,14, 9,13, 5,
+ 7, 9, 7, 9, 7, 9,13, 9,13, 5, 7, 9, 7,10, 7, 9,
+ 12, 9,12, 9,11,15,12, 0, 7, 9,11, 9,11, 9,12,16,
+ 11,15, 7, 9,14,10,14, 9,12,16,12, 0,12, 0, 0,15,
+ 16, 9,11, 0,12, 0,13,16,15,16, 0, 5, 7, 9, 7, 9,
+ 7, 9,11, 9,11, 9,12,15,11,16, 7, 9,11, 9,12, 9,
+ 12, 0,12, 0, 7,10,14,10, 0, 9,11, 0,12,16,14,15,
+ 0,15, 0, 9,12,15,12,15,14,16, 0,16, 0, 5, 7,10,
+ 7,10, 7, 9,12, 9,12,10,12, 0,12,16, 7, 9,12, 9,
+ 13,10,12,16,12,14, 7, 9,12, 9,11, 9,12,14,11,14,
+ 12,14, 0,14, 0, 9,11,13,11,16,12,14, 0,16, 0, 9,
+ 12,16,12,15,11,14,16,13, 0,15,16, 0, 0, 0,11,13,
+ 0,14, 0, 0, 0, 0, 0,16, 7, 9,11, 9,12, 9,11,13,
+ 11,13,12,15, 0,14,16, 9,11,14,11,13,12,14, 0,15,
+ 0,10,12, 0,12, 0,11,16, 0,13,16, 0, 0, 0, 0, 0,
+ 12,14,16,14, 0,16, 0, 0, 0, 0, 7,10,13,10,16,10,
+ 12,16,13,16,14, 0, 0,16, 0,10,12, 0,12, 0,15, 0,
+ 0, 0, 0, 9,12, 0,12, 0,12,15, 0,14, 0, 0,16, 0,
+ 16, 0,11,14,15,13, 0,16,16, 0, 0, 0,14,15, 0,16,
+ 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,10,12,15,13,16,12,14, 0,13, 0, 0,
+ 0, 0,16, 0,12,14, 0,14, 0,15, 0, 0,16, 0,14,15,
+ 0,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,16,15, 0,
+ 0, 0, 0, 0, 0, 0, 0, 5, 7,10, 7,10, 7, 9,12, 9,
+ 13,10,13,16,12,16, 7, 9,12, 9,12,10,13,16,12,15,
+ 7, 9,13, 9,12, 9,11,15,11,15,12,16, 0,15,16, 9,
+ 11,14,12,14,11,14,16, 0,16,10,12,16,11, 0,12,13,
+ 0,15, 0,16, 0, 0, 0, 0,12,13, 0,14,16, 0,15, 0,
+ 0, 0, 7,10,12, 9,12, 9,11,15,11,14,12,14, 0,14,
+ 15, 9,11,16,11,15,12,15,16,14, 0,10,13, 0,13, 0,
+ 12,14, 0,15,16, 0,16, 0, 0, 0,12,15, 0,16, 0,14,
+ 0, 0, 0, 0, 7,10, 0,10,14,10,12,16,12,16,15,16,
+ 0,16,16,10,12,14,12, 0,15, 0, 0, 0, 0,10,12, 0,
+ 13, 0,12,14, 0, 0, 0,16, 0, 0,16, 0,12,14, 0,14,
+ 0, 0, 0, 0, 0, 0,15,15, 0, 0, 0,15, 0, 0,15, 0,
+ 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
+ 13, 0,12,16,12,14, 0,14,16, 0, 0, 0, 0, 0,13,14,
+ 0,15, 0,16, 0, 0, 0, 0,14, 0, 0,16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,14,16, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static double _vq_quantthresh_res0_128a_128_2[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_128a_128_2[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_128_2 = {
+ _vq_quantthresh_res0_128a_128_2,
+ _vq_quantmap_res0_128a_128_2,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_128a_128_2 = {
+ 4, 625,
+ _vq_lengthlist_res0_128a_128_2,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_128_2,
+ NULL,
+ &_vq_auxt_res0_128a_128_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_128_3.vqh b/include/vorbis/book/res0_128a_128_3.vqh
new file mode 100644
index 00000000..de58bddb
--- /dev/null
+++ b/include/vorbis/book/res0_128a_128_3.vqh
@@ -0,0 +1,212 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_128_3_VQH_
+#define _V_res0_128a_128_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_128_3[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_128_3[] = {
+ 2, 5, 7, 6, 5, 6, 6, 5, 7, 8, 8, 7, 8, 9, 8,10,
+ 12,12,10,10,11, 8,10,13,14,10,13,13, 5, 7, 9, 9,
+ 7, 9, 9, 8, 9,11,13, 9,12,11, 7,10,13,14,10,13,
+ 13, 5, 7, 9, 9, 7, 9, 9, 7, 9,11,11, 9,11,11,10,
+ 11,12, 0,11, 0,14,10, 0, 0,14,12, 0, 0, 7, 9,12,
+ 11, 8,10,10,11,12, 0,14,11,14,14,10,12, 0, 0,12,
+ 14,13, 8,10,12,14,11,12,12,10,11,13,14,11,14,13,
+ 12,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,12,
+ 0,12,12,14,12,13,14, 0, 0,13, 0, 0, 0, 0, 0, 0,
+ 14, 0, 0, 8,10, 0, 0,11, 0,14,11,13, 0, 0,13, 0,
+ 0,13, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,11,
+ 12,14, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0,13, 0, 0,
+ 0, 0, 0, 0, 5, 7, 9, 9, 7, 9, 9, 7, 9,10,11, 9,
+ 10,11,10,11,14,14,11,14,14,10,12,13,14,12, 0, 0,
+ 7, 8,11,11, 9,11,10,10,12,14,12,11, 0,14,11,13,
+ 13,12,13,14,13, 8,10,14,13,10,14,13,10,13,14, 0,
+ 13,12, 0, 0,14, 0, 0, 0, 0, 0,14,14, 0, 0, 0, 0,
+ 0,10,11,12,14,11, 0,13,12,14, 0, 0,14, 0, 0,14,
+ 14, 0, 0, 0, 0, 0, 8,11, 0, 0,11,14,14,10,12, 0,
+ 14,14, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,10,14,14, 0,12, 0, 0,14, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 5, 7, 9, 9, 7, 9,10, 8,10,
+ 10,10, 9,11,10,11,13,11, 0,12,14, 0,11,14, 0, 0,
+ 0,14, 0, 8, 9,11,11, 9,12,11,11,13,12,14,11,14,
+ 0,10,14,13,14,12, 0, 0, 8, 9,11,12,10,11,11, 9,
+ 11,13,12,11,12,13, 0, 0, 0, 0,13,14, 0,13, 0, 0,
+ 0, 0, 0, 0, 9,12,12,13,11,14, 0,14,14,14, 0, 0,
+ 0, 0,14, 0, 0, 0, 0, 0, 0,11,11, 0, 0,13, 0,13,
+ 12, 0, 0, 0,14, 0, 0, 0,14, 0,14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,13, 0, 0, 0, 0,
+ 0,11, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,10,11,11,10,
+ 11,11, 9,12,13,12,12,12,14,11, 0, 0,13,13, 0, 0,
+ 12,14, 0, 0, 0, 0, 0, 9,12,12,12,11,14,12,13,14,
+ 0,14, 0, 0, 0,12, 0, 0,14, 0, 0, 0,11,13, 0, 0,
+ 14, 0, 0,13,14, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,12, 0, 0, 0,14, 0, 0, 0,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,11, 0,
+ 0,12, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,11,
+ 14, 0,11,14,14,11,12,14, 0,12, 0,13,13, 0, 0, 0,
+ 14, 0, 0,14, 0, 0, 0, 0, 0, 0,11,13, 0,14,13,14,
+ 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0,10,
+ 11, 0, 0,12,14, 0,12, 0, 0, 0, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,14, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 13, 0, 0, 0,14, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,10,12, 0, 0,14,14,14,11,14,13, 0,13, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,14,14,
+ 14,14, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 8,10,14,14,11, 0,14,13,14,13, 0,
+ 14, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,10,12, 0, 0,13, 0, 0,14,14, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,12, 0, 0, 0,14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,13, 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,11, 0, 0, 0,14,14, 0,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 9, 9,
+ 8, 9, 9, 8, 9,11,11, 9,11,14,11,11,14,14,11, 0,
+ 13,11, 0,14, 0,12,14, 0, 8, 9,11,14,10,11,10,11,
+ 12,14,14,14, 0,12,10,12, 0, 0,12, 0,13, 7, 9,10,
+ 11, 9,11,11,10,11,12,14,11,13,12,13, 0,14,14,14,
+ 0,14,14, 0,13, 0, 0, 0, 0,10,11,14,12,11,14,12,
+ 12,14,13,14, 0,14, 0,13,14, 0, 0,14, 0, 0,11,13,
+ 12, 0, 0,14, 0,12, 0,14, 0, 0, 0,13,13, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,14,14, 0,14, 0,
+ 0, 0, 0, 0, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0,10,
+ 14, 0,12,14, 0, 0,14,12, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0,
+ 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 8,10,11,11, 9,12,10, 9,12,13, 0,13, 0, 0,12,14,
+ 13, 0,12, 0, 0,14, 0, 0, 0,14, 0, 0, 9,11,13,14,
+ 11,14,12,14, 0, 0, 0,14,14, 0,13, 0, 0, 0,14,14,
+ 0,11,13, 0, 0,13, 0, 0,13, 0, 0, 0,14, 0, 0,14,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,13, 0,
+ 0, 0, 0,14, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,12,14, 0, 0,12, 0, 0,14, 0, 0, 0, 0, 0, 0,
+ 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8,10,13, 0,10,13,13,10,13, 0, 0,14,14,
+ 14, 0, 0, 0, 0,14, 0, 0, 0,14, 0, 0, 0, 0, 0,10,
+ 13, 0,12,13, 0,14, 0, 0, 0, 0, 0, 0, 0, 0,14, 0,
+ 0, 0, 0, 0,11,12,14, 0, 0,14,14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 13,14, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,14,13, 0, 0, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,10,14,14, 0,12,13,14,13,14,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,14, 0, 0, 0,14, 0, 0,13,14, 0, 0,14, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,11, 0, 0,10,14,
+ 0,11,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,
+ 0, 0, 0, 0, 0, 0,12, 0, 0, 0,14,14, 0,13, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11, 0, 0, 0, 0,
+ 14,14,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,14,
+ 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,
+ 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static double _vq_quantthresh_res0_128a_128_3[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_128a_128_3[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_128_3 = {
+ _vq_quantthresh_res0_128a_128_3,
+ _vq_quantmap_res0_128a_128_3,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_128a_128_3 = {
+ 4, 2401,
+ _vq_lengthlist_res0_128a_128_3,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_128_3,
+ NULL,
+ &_vq_auxt_res0_128a_128_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_128_4.vqh b/include/vorbis/book/res0_128a_128_4.vqh
new file mode 100644
index 00000000..c2a52041
--- /dev/null
+++ b/include/vorbis/book/res0_128a_128_4.vqh
@@ -0,0 +1,70 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_128_4_VQH_
+#define _V_res0_128a_128_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_128_4[] = {
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 3,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_128_4[] = {
+ 2, 3, 5, 6, 6, 3, 5, 6, 5, 4, 5, 7, 8, 7, 6, 7,
+ 8, 7, 7, 9,11,13,11, 9,10,11,11, 9,11,13,13,14,
+ 11,13,13,15, 8,11,13,13,15,11,14, 0,15, 4, 5, 7,
+ 8, 7, 5, 7, 8, 7, 7, 9,11,11,10, 9,11,13,11, 9,
+ 11,14,13,13,11,13,13,13, 8,11,14,15,13,12,14, 0,
+ 14,
+};
+
+static double _vq_quantthresh_res0_128a_128_4[] = {
+ -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5,
+};
+
+static long _vq_quantmap_res0_128a_128_4[] = {
+ 8, 7, 6, 5, 0, 1, 2, 3,
+ 4,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_128_4 = {
+ _vq_quantthresh_res0_128a_128_4,
+ _vq_quantmap_res0_128a_128_4,
+ 9,
+ 9
+};
+
+static static_codebook _vq_book_res0_128a_128_4 = {
+ 2, 81,
+ _vq_lengthlist_res0_128a_128_4,
+ 1, -531628032, 1611661312, 4, 0,
+ _vq_quantlist_res0_128a_128_4,
+ NULL,
+ &_vq_auxt_res0_128a_128_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_128_5.vqh b/include/vorbis/book/res0_128a_128_5.vqh
new file mode 100644
index 00000000..21b4ad08
--- /dev/null
+++ b/include/vorbis/book/res0_128a_128_5.vqh
@@ -0,0 +1,115 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_128_5_VQH_
+#define _V_res0_128a_128_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_128_5[] = {
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 51,
+ 53,
+ 56,
+ 61,
+ 68,
+ 77,
+ 90,
+ 44,
+ 43,
+ 42,
+ 41,
+ 39,
+ 37,
+ 34,
+ 29,
+ 22,
+ 13,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_128_5[] = {
+ 2, 3, 5, 6, 7, 6, 7, 7, 9,14,19, 0, 3, 5, 6, 6,
+ 6, 7, 7, 9,13, 0, 0, 4, 6, 7, 8, 8, 8, 9, 9,11,
+ 15, 0, 0, 6, 7, 8, 8, 8, 8, 9,11,15, 0, 0, 8, 9,
+ 11,11,12,12,12,12,14, 0, 0, 0, 9,10,12,12,12,12,
+ 13,15,19, 0, 0,11,12,13,14,14,15,15,16,18, 0, 0,
+ 0,12,13,15,15,14,14,15,17, 0, 0, 0,12,14,15,15,
+ 17,15,18,18,18, 0, 0, 0,14,15,17,17,16,18,16, 0,
+ 0, 0, 0,12,15,16,15, 0,18,18, 0, 0, 0, 0, 0,15,
+ 16,17,17, 0, 0, 0, 0, 0, 0, 0,13,16,17,17, 0,18,
+ 18, 0, 0, 0, 0, 0,18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,14,18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,16, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,16,18, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,18,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 6, 7, 8, 8, 8, 9, 9,11,18, 0, 0,
+ 6, 7, 8, 8, 8, 8, 9,11,15, 0, 0, 8, 9,11,12,12,
+ 12,12,12,15, 0, 0, 0, 9,11,11,12,12,12,13,15,18,
+ 0, 0,11,12,13,14,14,14,14,15,18, 0, 0, 0,12,14,
+ 15,14,15,15,15,18, 0, 0, 0,12,14,16,15,17,16,18,
+ 17, 0, 0, 0, 0,14,15,17,15,15,17,17,17, 0, 0, 0,
+ 12,15,17,17,17,18, 0, 0, 0, 0, 0, 0,15,17,18,18,
+ 17, 0, 0, 0, 0, 0, 0,13, 0,18, 0, 0,18, 0, 0, 0,
+ 0, 0, 0,17, 0,18,18, 0, 0, 0, 0, 0, 0, 0,14, 0,
+ 0,18, 0,18, 0, 0, 0, 0, 0, 0,17, 0,18, 0, 0, 0,
+ 0, 0, 0, 0, 0,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,17, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static double _vq_quantthresh_res0_128a_128_5[] = {
+ -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5,
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5,
+ 7, 9.5, 13.5, 19.5, 27.5, 38.5,
+};
+
+static long _vq_quantmap_res0_128a_128_5[] = {
+ 22, 21, 20, 19, 18, 17, 16, 15,
+ 14, 13, 12, 0, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_128_5 = {
+ _vq_quantthresh_res0_128a_128_5,
+ _vq_quantmap_res0_128a_128_5,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_128a_128_5 = {
+ 2, 529,
+ _vq_lengthlist_res0_128a_128_5,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_128a_128_5,
+ NULL,
+ &_vq_auxt_res0_128a_128_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_256_1.vqh b/include/vorbis/book/res0_128a_256_1.vqh
new file mode 100644
index 00000000..74cc6769
--- /dev/null
+++ b/include/vorbis/book/res0_128a_256_1.vqh
@@ -0,0 +1,99 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_256_1_VQH_
+#define _V_res0_128a_256_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_256_1[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_256_1[] = {
+ 2, 3, 6, 3, 6, 5, 6, 8, 6, 8, 9, 9,11, 9,11, 5,
+ 6, 8, 6, 8, 9, 9,10, 9,10, 6, 7, 9, 7, 8, 7, 8,
+ 9, 8,10,10,11,11,10,12, 7, 8, 9, 8,10,10,10,12,
+ 11,13,10,11,12,10,12,11,11,12,11,12,12,13,14,13,
+ 16,11,12,13,11,13,12,12,14,12,14, 6, 7, 8, 7, 9,
+ 7, 8,10, 8, 9,10,11,12,10,12, 7, 8,10, 8,10,10,
+ 10,12,10,11,10,11,12,11,12,10,11,13,12,12,13,13,
+ 13,13, 0,11,12,12,11,12,12,13,13,14,14, 7, 8,11,
+ 8,10, 9, 9,11, 9,11,12,12,13,12,13, 8, 9,11, 9,
+ 10,12,11,13,12,12, 9,10,12,10,11,10, 9,11,11,12,
+ 12,12,12,14,14,10,11,12,10,11,13,12,13,13,13,12,
+ 12,13,13,14,13,13,14,12,14, 0,14,13,16,16,13,13,
+ 15,13,14,14,16,15,13,14, 9,10,11,10,12,10,11,12,
+ 10,11,12,13,13,12,13,10,10,11,11,12,13,15,13,12,
+ 15,12,12,13,12,13,12,13,14,13,14,14,14, 0,14,14,
+ 13,13,14,13,14,14,14,16,16,15,11,13,15,14,13,13,
+ 13,16,12,16,14,16,16,14,16,13,15,16,13,14,16,16,
+ 15,15, 0,13,13,15,13,16,13,14,15,16,14, 0,15, 0,
+ 0, 0,15,14,15,15,15,14,16, 0,15,16,15,16,16,16,
+ 16,16,15,16, 0,16,16,16,14,15, 0,16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,13,13,15,13,15,14,14,16,14, 0, 0,
+ 16, 0, 0,16,14,13,15,14,15,14,16, 0, 0, 0,14,14,
+ 0, 0,15,16,16,15,16, 0, 0,15, 0,15,16, 0, 0,16,
+ 16, 0, 0, 0, 0, 0,16, 7, 8,10, 8,10, 9,10,11, 9,
+ 11,11,12,12,12,12, 9,10,11,10,11,11,12,14,12,12,
+ 9,10,11, 9,11,10,11,12,11,12,13,12,13,12,13,10,
+ 10,12,11,13,13,12,13,14,14,12,12,14,12,14,12,13,
+ 14,12,14,14,16,15,15,16,12,13,16,12,16,13,13,14,
+ 14,16, 9,10,11,10,11,10,11,12,10,12,12,13,14,13,
+ 13,10,11,12, 9,10,12,13,14,12,12,14,12,13,12,16,
+ 12,13,14,13,14,13,16,14,15, 0,13,14,14,13,15,14,
+ 14,16,13,14,11,12,16,13,14,13,14,13,13,14,15,14,
+ 16,15,15,13,13,14,13,14,15, 0, 0,15, 0,13,14,15,
+ 16,15,13,15,16,13,15,16,14, 0,16,15,14,14,16,15,
+ 0,16,16, 0,16, 0,16,14, 0,15, 0,16, 0, 0,15,15,
+ 0, 0,15,16, 0,16, 0, 0,15, 0,16,16, 0, 0, 0,12,
+ 14,16,13, 0,13,14,13,16, 0, 0,16, 0,14, 0,16,14,
+ 0,16,16,16, 0, 0,16, 0,16,16, 0,16, 0,16,15, 0,
+ 0, 0,15, 0, 0, 0, 0,16,15, 0,15, 0, 0, 0, 0,14,
+ 14,
+};
+
+static double _vq_quantthresh_res0_128a_256_1[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_128a_256_1[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_256_1 = {
+ _vq_quantthresh_res0_128a_256_1,
+ _vq_quantmap_res0_128a_256_1,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_128a_256_1 = {
+ 4, 625,
+ _vq_lengthlist_res0_128a_256_1,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_256_1,
+ NULL,
+ &_vq_auxt_res0_128a_256_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_256_2.vqh b/include/vorbis/book/res0_128a_256_2.vqh
new file mode 100644
index 00000000..c7fa2229
--- /dev/null
+++ b/include/vorbis/book/res0_128a_256_2.vqh
@@ -0,0 +1,75 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_256_2_VQH_
+#define _V_res0_128a_256_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_256_2[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_256_2[] = {
+ 3, 4, 5, 6, 6, 7, 4, 5, 6, 6, 7, 5, 5, 6, 6, 7,
+ 8, 5, 6, 6, 7, 8, 6, 7, 7, 8, 8, 9, 7, 7, 8, 8,
+ 9, 8, 8, 8, 9, 9,10, 8, 8, 9, 9,10, 9, 9, 9,10,
+ 10,10, 9, 9,10,10,10,10,11,11,11,11,12,11,11,11,
+ 11,12, 5, 5, 6, 6, 7, 8, 5, 6, 6, 7, 8, 6, 6, 7,
+ 8, 8, 9, 6, 7, 8, 8, 9, 8, 8, 8, 9, 9,10, 8, 8,
+ 9, 9,10, 9, 9, 9,10,10,10, 9, 9,10,10,10,10,10,
+ 11,11,11,12,10,11,11,11,12,
+};
+
+static double _vq_quantthresh_res0_128a_256_2[] = {
+ -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ 3.5, 5,
+};
+
+static long _vq_quantmap_res0_128a_256_2[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_256_2 = {
+ _vq_quantthresh_res0_128a_256_2,
+ _vq_quantmap_res0_128a_256_2,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_128a_256_2 = {
+ 2, 121,
+ _vq_lengthlist_res0_128a_256_2,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_128a_256_2,
+ NULL,
+ &_vq_auxt_res0_128a_256_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_256_3.vqh b/include/vorbis/book/res0_128a_256_3.vqh
new file mode 100644
index 00000000..596df5e2
--- /dev/null
+++ b/include/vorbis/book/res0_128a_256_3.vqh
@@ -0,0 +1,86 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_256_3_VQH_
+#define _V_res0_128a_256_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_256_3[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_256_3[] = {
+ 6, 6, 6, 7, 7, 7, 7, 8, 6, 6, 7, 7, 7, 7, 8, 6,
+ 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 8, 7, 7,
+ 7, 8, 7, 7, 8, 9, 7, 7, 8, 7, 7, 8, 9, 8, 8, 8,
+ 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8,
+ 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8,
+ 8, 8, 9, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8,
+ 9, 9, 9, 9, 9, 8, 8, 9, 9, 9,10,10,10, 9, 9, 9,
+ 10,10,10,10, 9, 9,10,10, 6, 7, 7, 7, 7, 7, 7, 8,
+ 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 8, 7, 7, 8, 9, 7,
+ 7, 8, 7, 7, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8,
+ 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8,
+ 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8,
+ 8, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 8,
+ 9, 9, 9, 9,10,10, 9, 9,10,10,10,10,10, 9, 9,10,
+ 10,
+};
+
+static double _vq_quantthresh_res0_128a_256_3[] = {
+ -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5,
+ 1.5, 2.5, 3.5, 5, 7, 9.5,
+};
+
+static long _vq_quantmap_res0_128a_256_3[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_256_3 = {
+ _vq_quantthresh_res0_128a_256_3,
+ _vq_quantmap_res0_128a_256_3,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_128a_256_3 = {
+ 2, 225,
+ _vq_lengthlist_res0_128a_256_3,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_128a_256_3,
+ NULL,
+ &_vq_auxt_res0_128a_256_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_256_4.vqh b/include/vorbis/book/res0_128a_256_4.vqh
new file mode 100644
index 00000000..3ad345ff
--- /dev/null
+++ b/include/vorbis/book/res0_128a_256_4.vqh
@@ -0,0 +1,100 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_256_4_VQH_
+#define _V_res0_128a_256_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_256_4[] = {
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 29,
+ 31,
+ 34,
+ 39,
+ 46,
+ 22,
+ 21,
+ 20,
+ 19,
+ 17,
+ 15,
+ 12,
+ 7,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_256_4[] = {
+ 7, 7, 8, 8, 8, 7, 8, 8, 8,11, 7, 8, 8, 7, 7, 8,
+ 8, 8,11, 8, 8, 8, 8, 8, 8, 8, 8, 8,11, 8, 8, 8,
+ 8, 8, 8, 8, 8,11, 8, 8, 8, 8, 8, 8, 8, 8, 9,12,
+ 8, 8, 8, 8, 8, 8, 8, 9,11, 8, 8, 8, 9, 8, 8, 8,
+ 8, 9,11, 8, 8, 9, 8, 8, 8, 8, 9,12, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8,11, 8, 8, 8, 8, 8, 8, 8, 9,11, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,11, 8, 8, 8, 8, 8, 8, 8,
+ 8,11, 8, 8, 8, 9, 8, 8, 8, 8, 9,12, 8, 8, 9, 8,
+ 8, 8, 8, 9,11, 9, 9, 9, 9, 9, 8, 8, 8, 9,12, 9,
+ 9, 9, 9, 8, 8, 8, 9,12,10,10,10,10,10, 9,10,10,
+ 11,13,10,10,10,10, 9, 9,10,11,13,13,12,13,13,12,
+ 12,12,12,13,16,12,13,13,12,12,13,12,13,15, 8, 8,
+ 8, 8, 8, 8, 8, 8, 9,11, 8, 8, 8, 8, 8, 8, 8, 8,
+ 11, 8, 8, 8, 8, 8, 8, 8, 8, 9,12, 8, 8, 8, 8, 8,
+ 8, 8, 9,11, 8, 8, 8, 8, 8, 8, 8, 8, 9,12, 8, 8,
+ 8, 8, 8, 8, 8, 9,11, 8, 8, 8, 8, 8, 8, 8, 8, 9,
+ 11, 8, 8, 8, 8, 8, 8, 8, 8,11, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8,11, 8, 8, 8, 8, 7, 8, 8, 8,11, 8, 8, 8,
+ 9, 8, 8, 8, 8, 9,11, 8, 8, 8, 8, 8, 8, 8, 9,11,
+ 9, 9, 9, 9, 9, 8, 8, 8, 9,12, 9, 9, 9, 8, 8, 8,
+ 8, 9,12,10,10,10,10,10, 9,10,10,11,13,10,10,10,
+ 10, 9, 9,10,11,13,12,12,12,13,13,12,12,12,13,14,
+ 12,13,13,12,12,12,13,13,16,
+};
+
+static double _vq_quantthresh_res0_128a_256_4[] = {
+ -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5,
+ -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5,
+ 13.5, 19.5,
+};
+
+static long _vq_quantmap_res0_128a_256_4[] = {
+ 18, 17, 16, 15, 14, 13, 12, 11,
+ 10, 0, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_256_4 = {
+ _vq_quantthresh_res0_128a_256_4,
+ _vq_quantmap_res0_128a_256_4,
+ 19,
+ 19
+};
+
+static static_codebook _vq_book_res0_128a_256_4 = {
+ 2, 361,
+ _vq_lengthlist_res0_128a_256_4,
+ 1, -526974976, 1611661312, 6, 0,
+ _vq_quantlist_res0_128a_256_4,
+ NULL,
+ &_vq_auxt_res0_128a_256_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_256_5.vqh b/include/vorbis/book/res0_128a_256_5.vqh
new file mode 100644
index 00000000..ed32a2bf
--- /dev/null
+++ b/include/vorbis/book/res0_128a_256_5.vqh
@@ -0,0 +1,133 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by vq/somethingorother
+
+ ********************************************************************/
+
+#ifndef _V_res0_128a_256_5_VQH_
+#define _V_res0_128a_256_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_256_5[] = {
+ 88,
+ 89,
+ 90,
+ 91,
+ 92,
+ 94,
+ 96,
+ 99,
+ 104,
+ 111,
+ 120,
+ 133,
+ 151,
+ 176,
+ 87,
+ 86,
+ 85,
+ 84,
+ 82,
+ 80,
+ 77,
+ 72,
+ 65,
+ 56,
+ 43,
+ 25,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_256_5[] = {
+ 6, 7, 7, 7, 7, 7, 7, 7, 8,11, 9,11,13, 0, 6, 7,
+ 8, 7, 7, 7, 7, 8,11, 9,12,15,13, 7, 7, 7, 8, 8,
+ 8, 8, 8, 9,11, 9,13,15, 0, 7, 7, 8, 8, 8, 8, 8,
+ 9,11, 9,13,13, 0, 7, 8, 8, 9, 8, 8, 9, 8, 9,11,
+ 10,12,14, 0, 8, 8, 9, 8, 8, 8, 8, 9,11,10,12, 0,
+ 0, 8, 9, 9, 9, 9, 9, 9, 9, 9,11,11,12, 0, 0, 9,
+ 8, 9, 9, 8, 9, 9,10,12,10,13, 0, 0, 8, 8, 8, 8,
+ 8, 8, 8, 8, 9,12,10, 0, 0, 0, 8, 8, 9, 8, 8, 8,
+ 8,10,11,10, 0, 0, 0, 8, 8, 8, 9, 8, 8, 8, 8, 9,
+ 12,11,14,14, 0, 8, 8, 9, 9, 8, 8, 9, 9,11,10,13,
+ 0, 0, 9, 8, 9, 9, 9, 9, 9, 8,10,14,12,14, 0, 0,
+ 8, 9, 9, 8, 8, 9, 9,10,13,10,13, 0, 0, 9, 9, 9,
+ 10, 9, 9, 9, 9,10,13,11,13, 0, 0, 9, 9,10, 9, 9,
+ 9, 9,10,13,11,14, 0, 0, 9,10,10,10,10,10,10,10,
+ 11, 0,11,14, 0, 0,10,10,10,10,10,10,10,11,13,11,
+ 0, 0, 0,10,11,11,13,11,11,12,13,12, 0,14, 0, 0,
+ 0,11,11,13,12,12,12,11, 0,14,14, 0, 0, 0,10,10,
+ 11,10,10,10,10,10,13,13, 0, 0, 0, 0,10,10,11,10,
+ 10,11,11,11,13, 0, 0, 0, 0,11,12,13,14, 0, 0,14,
+ 14, 0, 0, 0, 0, 0, 0,13,11,13,13, 0, 0,14,14,14,
+ 0, 0, 0, 0,12,14,14,14, 0,14, 0,14, 0, 0, 0, 0,
+ 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 8, 8, 8,
+ 8, 8, 9,10,10,14, 0, 0, 7, 8, 8, 8, 8, 8, 8, 9,
+ 11,10,12, 0, 0, 8, 7, 8, 8, 8, 8, 8, 8, 9,11,10,
+ 0, 0, 0, 8, 8, 9, 8, 8, 8, 8, 9,11,11,14,14, 0,
+ 8, 8, 8, 9, 8, 8, 8, 9,10,11,10,14, 0, 0, 8, 8,
+ 9, 9, 8, 9, 9, 9,11,11, 0, 0, 0, 8, 8, 8, 9, 8,
+ 8, 8, 8, 9,13,10, 0, 0, 0, 8, 8, 9, 8, 8, 8, 8,
+ 10,11,10,14,13, 0, 8, 8, 9, 8, 8, 8, 9, 9, 9,12,
+ 11, 0, 0, 0, 9, 8, 9, 8, 8, 8, 9, 9,13,11,14, 0,
+ 0, 8, 8, 9, 9, 9, 8, 9, 8,10,12,11,14, 0, 0, 8,
+ 9, 9, 9, 9,10, 9,10,12,10,14, 0, 0, 8, 9, 9, 9,
+ 9, 9, 9, 9,10,13,11, 0, 0, 0, 9, 9, 9, 9, 9, 9,
+ 9,10,12,10, 0, 0, 0, 9,10,10,11,10,10,10,10,12,
+ 13,12, 0, 0, 0, 9, 9,10,12,10,10,10,12,14,12, 0,
+ 0, 0,10,11,11,12,11,12,12,13,13,13,13, 0, 0, 0,
+ 11,13,11,11,12,12,12,13,14,13,13, 0, 0,10,10,11,
+ 10,11,10,11,10,12,13, 0, 0, 0, 0,10,10,10,11,12,
+ 10,11,11,13, 0, 0, 0, 0,10,13,13,13,14, 0,14,12,
+ 0, 0, 0, 0, 0, 0,10,12,13, 0,13,13,12,14,14, 0,
+ 0, 0, 0,12,12,14, 0,14, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,12,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,
+ 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0,
+ 14, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static double _vq_quantthresh_res0_128a_256_5[] = {
+ -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7,
+ -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5,
+ 54, 75.5,
+};
+
+static long _vq_quantmap_res0_128a_256_5[] = {
+ 26, 25, 24, 23, 22, 21, 20, 19,
+ 18, 17, 16, 15, 14, 0, 1, 2,
+ 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_256_5 = {
+ _vq_quantthresh_res0_128a_256_5,
+ _vq_quantmap_res0_128a_256_5,
+ 27,
+ 27
+};
+
+static static_codebook _vq_book_res0_128a_256_5 = {
+ 2, 729,
+ _vq_lengthlist_res0_128a_256_5,
+ 1, -522846208, 1611661312, 8, 0,
+ _vq_quantlist_res0_128a_256_5,
+ NULL,
+ &_vq_auxt_res0_128a_256_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/resaux0_1024a_128.vqh b/include/vorbis/book/resaux0_1024a_128.vqh
new file mode 100644
index 00000000..d458b846
--- /dev/null
+++ b/include/vorbis/book/resaux0_1024a_128.vqh
@@ -0,0 +1,42 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by huff/huffbuld
+
+ ********************************************************************/
+
+#ifndef _V_resaux0_1024a_128_VQH_
+#define _V_resaux0_1024a_128_VQH_
+#include "vorbis/codebook.h"
+
+static long _huff_lengthlist_resaux0_1024a_128[] = {
+ 2, 6,12,10,14,11,18,11,13,15, 5, 3, 5, 6, 8, 8,
+ 12, 8,10,12,10, 5, 4, 5, 7, 8,12, 9,12,15, 9, 5,
+ 5, 5, 6, 6,11, 7,10,13,13, 7, 7, 6, 7, 8,11, 9,
+ 12,16,10, 7, 7, 6, 8, 7,11, 7, 9,13,17,12,12,11,
+ 11,11,14,12,15,18, 9, 7, 8, 6, 8, 6,11, 6, 7,11,
+ 10, 9, 9, 8, 9, 7,10, 6, 7,10,12,11,12,10,10, 8,
+ 11, 7, 8,11,
+};
+
+static static_codebook _huff_book_resaux0_1024a_128 = {
+ 2, 100,
+ _huff_lengthlist_resaux0_1024a_128,
+ 0, 0, 0, 0, 0,
+ NULL,
+ NULL,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/resaux0_1024a_256.vqh b/include/vorbis/book/resaux0_1024a_256.vqh
new file mode 100644
index 00000000..cffc25c5
--- /dev/null
+++ b/include/vorbis/book/resaux0_1024a_256.vqh
@@ -0,0 +1,116 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by huff/huffbuld
+
+ ********************************************************************/
+
+#ifndef _V_resaux0_1024a_256_VQH_
+#define _V_resaux0_1024a_256_VQH_
+#include "vorbis/codebook.h"
+
+static long _huff_lengthlist_resaux0_1024a_256[] = {
+ 3, 9,12,12,13,16, 9, 9,13,14,16,17,11,15,17,18,
+ 18,20,12,14,17,17,20,19,14,13,16,16,17,19,19,19,
+ 19,18,18,17, 8,11,16,18,18,18,10, 9,13,16,17,18,
+ 14,15,15,16,18,19,13,16,17,18,18,19,14,16,17,18,
+ 18,19,17,18,18,19,19,19,14,17,19,18,18,19,15,16,
+ 16,18,19,19,16,17,15,17,18,19,15,17,17,17,18,19,
+ 14,18,18,19,18,19,18,19,19,19,19,19,14,18,17,19,
+ 19,19,15,17,17,17,18,19,19,18,19,17,19,19,16,18,
+ 19,19,19,19,16,19,19,19,19,19,19,19,19,19,19,19,
+ 13,17,17,19,19,19,16,19,19,19,18,19,16,19,19,19,
+ 19,19,17,19,19,19,19,19,17,19,19,19,19,19,19,19,
+ 19,19,19,19,16,19,19,19,19,19,18,19,19,19,19,19,
+ 18,19,19,19,19,19,19,19,19,19,19,19,18,19,19,19,
+ 19,19,17,19,19,19,19,19, 6,10,13,15,15,16, 8, 9,
+ 14,17,16,19,12,15,15,18,17,19,13,15,17,18,19,19,
+ 15,14,16,18,19,19,19,19,19,19,19,19, 6, 8,15,15,
+ 16,16, 5, 4, 8,13,13,17,11, 8, 9,12,15,19,10,11,
+ 13,13,14,18,12,13,15,14,16,19,16,18,19,19,19,19,
+ 12,14,17,18,19,19,11, 8,10,13,16,19,15, 9, 8,11,
+ 15,19,14,13,11,12,14,19,15,14,14,14,16,19,18,18,
+ 19,19,19,19,13,16,18,16,17,19,14,12,13,14,16,19,
+ 16,12,12,13,15,19,16,15,12,12,15,19,16,16,14,15,
+ 17,19,18,19,19,19,19,19,14,16,17,17,18,19,14,13,
+ 14,15,17,19,15,16,15,14,16,19,16,15,15,15,17,19,
+ 17,16,16,18,19,19,19,19,19,19,19,19,17,19,18,18,
+ 19,19,18,17,18,19,19,19,16,19,18,19,19,19,17,17,
+ 18,19,19,19,19,17,19,19,19,19,19,19,19,19,19,19,
+ 12,13,17,17,18,19,13,13,16,18,19,19,18,17,16,19,
+ 19,19,19,18,18,19,19,19,19,19,19,19,19,19,19,19,
+ 19,19,19,19,10,12,16,18,17,18, 9, 6, 9,13,15,17,
+ 13, 8, 8,12,15,19,13,12,12,13,15,19,13,13,13,15,
+ 18,19,15,16,17,19,19,19,11,14,17,17,19,18,11, 6,
+ 8,12,14,16,14, 6, 4, 8,12,19,14,10, 7, 8,11,18,
+ 14,12,10,11,13,16,17,17,16,18,19,19,14,16,17,17,
+ 16,19,14,10,11,12,14,18,15, 9, 7, 8,11,18,15,11,
+ 7, 6,10,18,16,13,10,10,12,19,18,19,18,18,18,19,
+ 17,18,18,18,18,19,16,12,12,13,16,19,16,12,10,11,
+ 12,16,17,13,10, 9,12,18,18,14,12,12,14,19,17,19,
+ 19,19,18,19,19,19,19,19,19,19,18,18,16,19,19,19,
+ 19,18,16,16,16,19,18,17,17,17,18,19,19,18,18,18,
+ 18,19,19,19,19,19,19,19,11,14,18,19,19,19,15,13,
+ 18,19,19,19,16,17,18,18,19,19,19,17,18,19,19,19,
+ 19,19,19,19,19,19,19,19,19,19,19,19,14,14,17,19,
+ 19,19,13, 9,11,14,16,19,15,11,10,12,15,19,15,13,
+ 12,12,14,19,16,15,14,14,16,19,17,18,19,18,19,19,
+ 12,14,17,17,19,19,13, 9,10,12,14,17,13, 8, 6, 7,
+ 11,16,13,11, 7, 6,10,17,14,13,10, 9,11,16,19,17,
+ 16,16,15,19,12,15,16,16,17,19,13,10,10,11,12,17,
+ 15, 9, 6, 6, 9,16,14, 9, 5, 3, 7,14,16,11, 8, 6,
+ 8,14,18,17,15,15,15,17,13,14,17,18,19,19,15,12,
+ 13,13,15,18,18,12,10, 9,11,15,19,11, 8, 6, 8,15,
+ 18,12,10, 8, 9,14,18,18,15,14,14,17,19,18,19,19,
+ 19,19,19,17,16,18,19,19,19,19,16,15,17,19,19,18,
+ 15,15,15,19,19,16,15,15,15,19,19,19,18,17,18,19,
+ 11,13,19,19,19,19,17,13,19,18,19,19,16,18,18,17,
+ 19,19,18,18,19,19,19,19,19,19,19,19,19,19,19,19,
+ 19,19,19,19,15,16,19,18,19,19,16,12,13,14,16,19,
+ 18,13,12,12,14,19,17,15,13,12,13,17,17,16,15,13,
+ 14,19,19,16,17,16,17,19,13,15,16,18,19,19,16,11,
+ 11,13,15,18,14,11, 9,10,12,18,14,13,10, 8,10,18,
+ 15,14,11,10,11,16,19,18,17,15,15,18,11,14,18,18,
+ 18,19,13,11,12,13,13,17,15,11, 9, 9,10,16,15,11,
+ 8, 5, 7,14,17,12, 9, 6, 7,13,19,17,15,14,13,17,
+ 11,15,18,19,19,19,14,13,14,14,15,18,17,12,11,10,
+ 11,16,17,11, 9, 6, 7,13,19,12,10, 6, 6,12,19,16,
+ 14,13,13,17,16,15,19,19,19,19,17,14,16,17,18,19,
+ 19,18,16,14,16,17,19,16,15,13,14,19,19,15,14,13,
+ 13,18,19,17,16,17,16,19,15,15,19,19,19,19,19,13,
+ 13,19,19,19,19,18,14,16,19,19,19,19,19,19,19,19,
+ 19,19,19,19,19,19,19,19,19,19,19,19,18,19,19,19,
+ 19,19,19,17,18,18,19,19,19,19,15,14,18,19,19,19,
+ 16,14,17,19,19,17,18,15,16,19,19,17,19,19,18,19,
+ 16,18,19,19,19,19,19,16,17,18,19,19,19,17,17,15,
+ 17,19,17,17,15,12,15,19,18,15,14,14,15,19,19,19,
+ 17,16,18,18,13,15,19,19,19,19,18,16,17,17,16,19,
+ 19,16,15,15,15,18,18,16,14,11,12,17,18,15,14,12,
+ 12,16,19,19,17,17,17,19,14,16,19,19,19,19,18,17,
+ 18,18,19,19,18,16,18,15,15,18,19,16,14,11,12,17,
+ 19,16,13,11,11,15,19,18,16,17,16,19,18,19,19,19,
+ 19,19,19,18,19,19,19,19,19,19,19,17,18,19,19,18,
+ 17,17,18,19,19,18,15,18,17,19,19,19,18,19,19,19,
+};
+
+static static_codebook _huff_book_resaux0_1024a_256 = {
+ 4, 1296,
+ _huff_lengthlist_resaux0_1024a_256,
+ 0, 0, 0, 0, 0,
+ NULL,
+ NULL,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/resaux0_128a_128.vqh b/include/vorbis/book/resaux0_128a_128.vqh
new file mode 100644
index 00000000..12651bf1
--- /dev/null
+++ b/include/vorbis/book/resaux0_128a_128.vqh
@@ -0,0 +1,116 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by huff/huffbuld
+
+ ********************************************************************/
+
+#ifndef _V_resaux0_128a_128_VQH_
+#define _V_resaux0_128a_128_VQH_
+#include "vorbis/codebook.h"
+
+static long _huff_lengthlist_resaux0_128a_128[] = {
+ 6,15,15,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,11,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,10,13,14,14,
+ 14,14,10,11,13,14,14,14,14,13,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 10,13,14,14,14,14,13,13,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14, 9,13,14,14,14,14, 9, 8,11,14,14,14,
+ 14,11,13,14,14,14,14,13,14,14,14,14,14,13,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,12,11,
+ 14,14,14,14,13,13,13,14,14,14,13,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,
+ 14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,13,
+ 14,14,14,14,13,14,14,14,14,14,13,14,14,14,14,14,
+ 14,14,14,14,14,14,13,13,14,14,14,14,14,13,14,14,
+ 14,14,14,14,14,14,14,14,13,14,14,14,13,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,
+ 14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,10,13,14,14,14,14,12,13,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14, 9,13,14,14,
+ 14,14, 7, 7,10,14,14,13,11,10,13,14,14,14,14,13,
+ 13,14,14,14,13,14,14,14,14,14,14,14,14,14,14,14,
+ 11,14,13,14,14,14,10,10,14,14,14,14,13,11,13,14,
+ 14,14,14,13,14,14,14,14,14,14,14,14,14,14,12,14,
+ 14,14,14,14,14,14,14,14,14,14,13,12,14,14,14,14,
+ 13,14,14,14,14,14,13,14,14,14,14,14,13,13,14,14,
+ 14,14,13,14,14,14,13,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,13,13,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,13,14,14,14,14,14,13,13,14,14,
+ 14,14,12,13,14,14,14,14,14,13,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,12,14,14,14,14,13,
+ 9,14,14,14,14,14,12,12,14,14,14,14,14,13,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14, 8,11,14,14,14,14, 6, 5, 9,12,13,13,
+ 10, 8,11,14,14,13,12,12,13,14,14,14,13,13,14,14,
+ 14,14,13,13,14,14,14,14,11,13,14,14,14,14, 8, 8,
+ 10,13,14,14,10,10,12,14,14,14,13,12,14,13,14,13,
+ 12,14,13,13,14,14,10,13,14,14,14,14,13,14,14,14,
+ 14,14,11,11,13,14,14,14,12,13,13,14,14,14,12,13,
+ 14,14,14,13,14,14,14,14,14,14,12,13,14,14,14,14,
+ 14,13,14,14,14,14,13,12,13,14,14,14,12,13,12,14,
+ 14,14,12,13,13,14,14,14,12,13,14,14,14,14,12,14,
+ 14,14,14,14,13,14,14,14,14,14,12,12,13,14,14,14,
+ 13,12,13,14,13,14,13,14,14,14,14,14,13,14,14,14,
+ 14,14,12,12,14,14,14,14, 5,12,14,14,14,14,10,10,
+ 14,14,14,14,14,13,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14, 4, 9,12,14,
+ 13,14, 3, 2, 5, 9, 9,10, 6, 5, 7,10,12,13, 9, 9,
+ 11,12,13,14,11,11,12,13,14,14,12,12,14,14,14,14,
+ 7,11,12,13,13,13, 4, 4, 7,10,12,14, 6, 6, 9,12,
+ 14,14, 9,10,12,13,12,13,11,11,13,13,14,14,11,12,
+ 14,14,14,14, 9,12,13,13,13,14, 7, 8,11,12,13,12,
+ 8, 9,11,14,14,14,10,12,14,14,14,14,11,12,14,14,
+ 14,14,10,12,13,14,14,14,10,14,14,13,12,13, 9,10,
+ 12,12,12,12,10,11,12,14,14,14,11,12,12,14,14,14,
+ 11,14,13,13,14,14,10,13,14,14,14,14,11,14,14,14,
+ 14,13,10,11,13,13,13,13,11,13,14,13,14,14,13,12,
+ 13,13,14,14,12,13,14,14,14,14,12,14,14,14,14,14,
+};
+
+static static_codebook _huff_book_resaux0_128a_128 = {
+ 4, 1296,
+ _huff_lengthlist_resaux0_128a_128,
+ 0, 0, 0, 0, 0,
+ NULL,
+ NULL,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/resaux0_128a_256.vqh b/include/vorbis/book/resaux0_128a_256.vqh
new file mode 100644
index 00000000..4acc2d46
--- /dev/null
+++ b/include/vorbis/book/resaux0_128a_256.vqh
@@ -0,0 +1,116 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: static codebook autogenerated by huff/huffbuld
+
+ ********************************************************************/
+
+#ifndef _V_resaux0_128a_256_VQH_
+#define _V_resaux0_128a_256_VQH_
+#include "vorbis/codebook.h"
+
+static long _huff_lengthlist_resaux0_128a_256[] = {
+ 6,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,12,13,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,13,14,14,14,14,14,14,14,13,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,13,14,14,14,14,14,14,14,14,14,14,14,14,13,
+ 14,14,14,14,14,14,14,14,13,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,12,14,14,14,
+ 14,14,14,13,14,14,14,14,14,13,13,14,14,14,14,14,
+ 13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,11,12,14,14,14,14,12,10,14,
+ 14,14,13,13,12,14,14,14,13,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,11,11,14,14,14,14,
+ 9, 7, 7,11,14,14,10, 7, 6, 8,11,14,11,11,10, 9,
+ 12,14,14,14,13,14,14,14,14,14,14,14,14,14,12,11,
+ 14,14,14,14,10, 8, 9,12,13,14,10, 7, 7, 9,11,14,
+ 12,10, 9,10,11,14,14,14,14,13,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,13,
+ 13,14,13,14,14,13,13,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,14,
+ 14,14,10,12,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,10,
+ 12,14,14,14,14,10, 8,13,14,14,14,11, 9,12,13,14,
+ 13,14,14,14,14,14,14,14,14,14,14,14,13,14,14,14,
+ 14,14, 7, 8,11,13,14,14, 5, 4, 5, 8,11,13, 6, 4,
+ 3, 5, 8,14, 9, 7, 6, 7, 9,13,14,14,13,12,13,14,
+ 13,14,14,14,14,14, 7, 8,14,13,13,14, 5, 4, 6, 9,
+ 11,14, 6, 4, 4, 5, 8,13, 9, 6, 6, 7, 9,13,13,11,
+ 11,12,13,14,14,14,14,14,14,14,12,12,13,14,13,14,
+ 10,10,11,12,13,14,11,10,10,12,14,14,14,12,11,12,
+ 13,14,13,11,14,13,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,12,14,14,14,14,13,11,14,14,14,14,14,
+ 13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,13,14,14,14,14,13,13,13,
+ 14,14,13,14,12,12,14,14,14,14,14,14,14,14,14,14,
+ 14,14,14,14,14,14,14,14,14,14,10,12,14,11,10,14,
+ 9, 8,10,13,13,14,10, 8, 8,11,12,13,11,10,11,12,
+ 13,14,13,13,14,14,14,14,13,14,14,14,14,14,10,10,
+ 14,13,14,14, 8, 8,10,13,13,14,10, 8, 8,11,13,14,
+ 11,10, 9,12,14,14,13,13,14,14,14,14,14,14,14,14,
+ 14,14,12,14,14,14,14,14,13,13,13,13,14,14,14,13,
+ 13,14,14,14,14,12,13,14,14,14,14,12,14,14,14,14,
+};
+
+static static_codebook _huff_book_resaux0_128a_256 = {
+ 4, 1296,
+ _huff_lengthlist_resaux0_128a_256,
+ 0, 0, 0, 0, 0,
+ NULL,
+ NULL,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h
index 4d813294..a9a92879 100644
--- a/include/vorbis/codec.h
+++ b/include/vorbis/codec.h
@@ -12,7 +12,7 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.21.2.2 2000/07/31 19:40:59 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.21.2.3 2000/08/15 08:33:36 xiphmont Exp $
********************************************************************/
@@ -329,6 +329,7 @@ typedef struct vorbis_comment{
/* unlimited user comment fields. libvorbis writes 'libvorbis'
whatever vendor is set to in encode */
char **user_comments;
+ int *comment_lengths;
int comments;
char *vendor;
@@ -351,6 +352,7 @@ typedef struct vorbis_comment{
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
+extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
/* OggSquish BITSREAM PRIMITIVES: decoding **************************/
@@ -388,6 +390,9 @@ extern void vorbis_info_init(vorbis_info *vi);
extern void vorbis_info_clear(vorbis_info *vi);
extern void vorbis_comment_init(vorbis_comment *vc);
extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
+extern void vorbis_comment_add_tag(vorbis_comment *vc,
+ char *tag, char *contents);
+extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
extern void vorbis_comment_clear(vorbis_comment *vc);
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
diff --git a/include/vorbis/mode_A.h b/include/vorbis/mode_A.h
new file mode 100644
index 00000000..799cb986
--- /dev/null
+++ b/include/vorbis/mode_A.h
@@ -0,0 +1,206 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: predefined encoding modes
+ last mod: $Id: mode_A.h,v 1.1.2.1 2000/08/15 08:33:36 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_MODES_A_H_
+#define _V_MODES_A_H_
+
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/backends.h"
+
+#include "vorbis/book/lsp12_0.vqh"
+#include "vorbis/book/lsp30_0.vqh"
+
+#include "vorbis/book/resaux0_128a_128.vqh"
+#include "vorbis/book/resaux0_1024a_128.vqh"
+
+#include "vorbis/book/res0_128a_128_1.vqh"
+#include "vorbis/book/res0_128a_128_2.vqh"
+#include "vorbis/book/res0_128a_128_3.vqh"
+#include "vorbis/book/res0_128a_128_4.vqh"
+#include "vorbis/book/res0_128a_128_5.vqh"
+#include "vorbis/book/res0_1024a_128_1.vqh"
+#include "vorbis/book/res0_1024a_128_2.vqh"
+#include "vorbis/book/res0_1024a_128_3.vqh"
+#include "vorbis/book/res0_1024a_128_4.vqh"
+#include "vorbis/book/res0_1024a_128_5.vqh"
+#include "vorbis/book/res0_1024a_128_6.vqh"
+#include "vorbis/book/res0_1024a_128_7.vqh"
+#include "vorbis/book/res0_1024a_128_8.vqh"
+#include "vorbis/book/res0_1024a_128_9.vqh"
+
+static vorbis_info_psy _psy_set_A={
+ 1,/*athp*/
+ 1,/*decayp*/
+ 1,/*smoothp*/
+ 0,.1,
+
+ -100.,
+ -140.,
+
+ /* 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 */
+
+ 1,/* tonemaskp */
+ /* 0 10 20 30 40 50 60 70 80 90 100 */
+ {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
+ {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
+ {-30.,-30.,-35.,-37.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
+ {-20.,-25.,-30.,-35.,-35.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
+ {-20.,-25.,-30.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/
+ {-20.,-24.,-26.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/
+ },
+
+ 1,/* peakattp */
+ {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
+ { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
+ { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
+ },
+
+ 1,/*noisemaskp */
+ /* 0 10 20 30 40 50 60 70 80 90 100 */
+ {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/
+ { 10., 10., 10., 6., 6., 5., 4., 3., 2., 1., 0.}, /*700*/
+
+ { 10., 10., 10., 10., 10., 8., 7., 6., 5., 4., 3.}, /*1000*/
+ { 10., 10., 10., 10., 10., 8., 7., 6., 5., 4., 3.}, /*1400*/
+ { 10., 10., 10., 10., 8., 8., 7., 6., 5., 4., 3.}, /*2000*/
+ { 10., 10., 10., 10., 8., 8., 7., 6., 5., 4., 3.}, /*2800*/
+ { 10., 10., 10., 10., 10., 10., 8., 6., 5., 4., 3.}, /*4000*/
+ { 10., 10., 10., 10., 10., 10., 8., 8., 6., 6., 6.}, /*5600*/
+ { 10., 10., 10., 10., 10., 10., 8., 8., 8., 8., 8.}, /*8000*/
+ { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*11500*/
+ { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*16000*/
+ },
+
+ 110.,
+
+ -0., -.004 /* attack/decay control */
+};
+
+
+/* with GNUisms, this could be short and readable. Oh well */
+static vorbis_info_time0 _time_set0A={0};
+static vorbis_info_floor0 _floor_set0A={12, 44100, 64, 12,150, 1, {0} };
+static vorbis_info_floor0 _floor_set1A={30, 44100, 256, 12,150, 1, {1} };
+static vorbis_info_residue0 _residue_set0A={0,128, 32,6,2,
+ {0,1,1,1,1,1},
+ {4,5,6,7,8},
+
+ {0,99999,9999,9999,9999},
+ {99,1.5,2.5,3.5,5},
+ {5,5,5,5,5},
+ {99,99,99,99,99}};
+
+static vorbis_info_residue0 _residue_set1A={0,1024, 32,10,3,
+ {0,1,1,1,1,1,1,1,1,1},
+ {9,10,11,12,13,14,15,16,17},
+
+ {0,9,9999,17,9999,
+ 27,9999,9999,9999},
+ {99,1.5,1.5,2.5,2.5,3.5,3.5,7,13},
+ {5,5,5,5,5,5,5,5,5},
+ {99,99,99,99,99,99,99,99,99}};
+
+static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0}};
+static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {0}};
+static vorbis_info_mode _mode_set0A={0,0,0,0};
+static vorbis_info_mode _mode_set1A={1,0,0,1};
+
+/* CD quality stereo, no channel coupling */
+vorbis_info info_A={
+ /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
+ 0, 2, 44100, 0,0,0,
+ /* smallblock, largeblock */
+ {256, 2048},
+ /* modes,maps,times,floors,residues,books,psys */
+ 2, 2, 1, 2, 2, 18, 1,
+ /* modes */
+ {&_mode_set0A,&_mode_set1A},
+ /* maps */
+ {0,0},{&_mapping_set0A,&_mapping_set1A},
+ /* times */
+ {0,0},{&_time_set0A},
+ /* floors */
+ {0,0},{&_floor_set0A,&_floor_set1A},
+ /* residue */
+ {0,0},{&_residue_set0A,&_residue_set1A},
+ /* books */
+ {&_vq_book_lsp12_0, /* 0 */
+ &_vq_book_lsp30_0, /* 1 */
+
+ &_huff_book_resaux0_128a_128,
+ &_huff_book_resaux0_1024a_128,
+
+ &_vq_book_res0_128a_128_1,
+ &_vq_book_res0_128a_128_2,
+ &_vq_book_res0_128a_128_3,
+ &_vq_book_res0_128a_128_4,
+ &_vq_book_res0_128a_128_5,
+ &_vq_book_res0_1024a_128_1,
+ &_vq_book_res0_1024a_128_2,
+ &_vq_book_res0_1024a_128_3,
+ &_vq_book_res0_1024a_128_4,
+ &_vq_book_res0_1024a_128_5,
+ &_vq_book_res0_1024a_128_6,
+ &_vq_book_res0_1024a_128_7,
+ &_vq_book_res0_1024a_128_8,
+ &_vq_book_res0_1024a_128_9,
+
+ },
+ /* psy */
+ {&_psy_set_A},
+ /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+ 256, 32, 6, -96.
+};
+
+#define PREDEF_INFO_MAX 0
+
+#endif
diff --git a/include/vorbis/mode_D.h b/include/vorbis/mode_D.h
new file mode 100644
index 00000000..f0d1fa7e
--- /dev/null
+++ b/include/vorbis/mode_D.h
@@ -0,0 +1,179 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: predefined encoding modes
+ last mod: $Id: mode_D.h,v 1.1.2.1 2000/08/15 08:33:36 xiphmont Exp $
+
+ ********************************************************************/
+
+/* this is really a freeform VBR mode. It roughly centers on 256 kbps stereo */
+
+#ifndef _V_MODES_D_H_
+#define _V_MODES_D_H_
+
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/backends.h"
+
+#include "vorbis/book/lsp12_0.vqh"
+#include "vorbis/book/lsp30_0.vqh"
+
+#include "vorbis/book/resaux0_128a_256.vqh"
+#include "vorbis/book/resaux0_1024a_256.vqh"
+
+#include "vorbis/book/res0_128a_256_1.vqh"
+#include "vorbis/book/res0_128a_256_2.vqh"
+#include "vorbis/book/res0_128a_256_3.vqh"
+#include "vorbis/book/res0_128a_256_4.vqh"
+#include "vorbis/book/res0_128a_256_5.vqh"
+#include "vorbis/book/res0_1024a_256_1.vqh"
+#include "vorbis/book/res0_1024a_256_2.vqh"
+#include "vorbis/book/res0_1024a_256_3.vqh"
+#include "vorbis/book/res0_1024a_256_4.vqh"
+#include "vorbis/book/res0_1024a_256_5.vqh"
+
+static vorbis_info_psy _psy_set_256 ={
+ 1,/*athp*/
+ 0,/*decayp*/
+ 1,/*smoothp*/
+ 0,.1,
+
+ -100.,
+ -140.,
+
+ /* 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 */
+
+ 1,/* tonemaskp */
+ /* 0 10 20 30 40 50 60 70 80 90 100 */
+ {{-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*63*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*125*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*175*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*250*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*350*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*500*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*700*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*1000*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*1400*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2000*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2800*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*4000*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*5600*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*8000*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*11500*/
+ {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*16000*/
+ },
+
+ 1,/* peakattp */
+ {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*175*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*250*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*350*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*500*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*700*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*1000*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*1400*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*2000*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*2800*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*4000*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*5600*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*8000*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*11500*/
+ {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*16000*/
+ },
+
+ 0,/*noisemaskp */
+ /* 0 10 20 30 40 50 60 70 80 90 100 */
+ {},
+
+ 110.,
+
+ -0., -.004 /* attack/decay control */
+};
+
+/* with GNUisms, this could be short and readable. Oh well */
+static vorbis_info_time0 _time_set0_256={0};
+static vorbis_info_floor0 _floor_set0_256={12, 44100, 64, 12,150, 1, {0} };
+static vorbis_info_floor0 _floor_set1_256={30, 44100, 256, 12,150, 1, {1} };
+static vorbis_info_residue0 _residue_set0_256={0,128, 32,6,2,
+ {0,1,1,1,1,1},
+ {4,5,6,7,8},
+
+ {0,9999,9999,9999,9999},
+ {99,2.5,7,13.5,27.5},
+ {5,5,5,5,5},
+ {99,99,99,99,99}};
+
+static vorbis_info_residue0 _residue_set1_256={0,1024, 32,6,3,
+ {0,1,1,1,1,1},
+ {9,10,11,12,13},
+
+ {0,9999,9999,9999,9999},
+ {99,2.5,7,13.5,27.5},
+ {5,5,5,5,5},
+ {99,99,99,99,99}};
+
+static vorbis_info_mapping0 _mapping_set0_256={1, {0,0}, {0}, {0}, {0}, {0}};
+static vorbis_info_mapping0 _mapping_set1_256={1, {0,0}, {0}, {1}, {1}, {0}};
+static vorbis_info_mode _mode_set0_256={0,0,0,0};
+static vorbis_info_mode _mode_set1_256={1,0,0,1};
+
+/* CD quality stereo, no channel coupling */
+vorbis_info info_D={
+ /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
+ 0, 2, 44100, 0,0,0,
+ /* smallblock, largeblock */
+ {256, 2048},
+ /* modes,maps,times,floors,residues,books,psys */
+ 2, 2, 1, 2, 2, 14, 1,
+ /* modes */
+ {&_mode_set0_256,&_mode_set1_256},
+ /* maps */
+ {0,0},{&_mapping_set0_256,&_mapping_set1_256},
+ /* times */
+ {0,0},{&_time_set0_256},
+ /* floors */
+ {0,0},{&_floor_set0_256,&_floor_set1_256},
+ /* residue */
+ {0,0},{&_residue_set0_256,&_residue_set1_256},
+ /* books */
+ {&_vq_book_lsp12_0, /* 0 */
+ &_vq_book_lsp30_0, /* 1 */
+
+ &_huff_book_resaux0_128a_256,
+ &_huff_book_resaux0_1024a_256,
+
+ &_vq_book_res0_128a_256_1,
+ &_vq_book_res0_128a_256_2,
+ &_vq_book_res0_128a_256_3,
+ &_vq_book_res0_128a_256_4,
+ &_vq_book_res0_128a_256_5,
+ &_vq_book_res0_1024a_256_1,
+ &_vq_book_res0_1024a_256_2,
+ &_vq_book_res0_1024a_256_3,
+ &_vq_book_res0_1024a_256_4,
+ &_vq_book_res0_1024a_256_5,
+
+ },
+ /* psy */
+ {&_psy_set_256},
+ /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+ 256, 24, 6, -96.
+};
+
+#define PREDEF_INFO_MAX 0
+
+#endif
diff --git a/include/vorbis/modes.h b/include/vorbis/modes.h
index 5c1262e5..b5e06562 100644
--- a/include/vorbis/modes.h
+++ b/include/vorbis/modes.h
@@ -12,239 +12,14 @@
********************************************************************
function: predefined encoding modes
- last mod: $Id: modes.h,v 1.16.2.8 2000/08/09 20:22:04 xiphmont Exp $
+ last mod: $Id: modes.h,v 1.16.2.9 2000/08/15 08:33:36 xiphmont Exp $
********************************************************************/
#ifndef _V_MODES_H_
#define _V_MODES_H_
-#include <stdio.h>
-#include "vorbis/codec.h"
-#include "vorbis/backends.h"
-
-#include "vorbis/book/lsp12_0.vqh"
-#include "vorbis/book/lsp30_0.vqh"
-#include "vorbis/book/resaux0_short.vqh"
-#include "vorbis/book/resaux0_long.vqh"
-#include "vorbis/book/resaux0b_long.vqh"
-
-#include "vorbis/book/res0b_1.vqh"
-#include "vorbis/book/res0b_2.vqh"
-#include "vorbis/book/res0b_3.vqh"
-#include "vorbis/book/res0b_4.vqh"
-#include "vorbis/book/res0b_5.vqh"
-#include "vorbis/book/res0b_6.vqh"
-#include "vorbis/book/res0b_7.vqh"
-#include "vorbis/book/res0b_8.vqh"
-#include "vorbis/book/res0b_9.vqh"
-#include "vorbis/book/res0b_10.vqh"
-#include "vorbis/book/res0b_11.vqh"
-#include "vorbis/book/res0b_12.vqh"
-#include "vorbis/book/res0b_13.vqh"
-
-#include "vorbis/book/res0a_1.vqh"
-#include "vorbis/book/res0a_2.vqh"
-#include "vorbis/book/res0a_3.vqh"
-#include "vorbis/book/res0a_4.vqh"
-#include "vorbis/book/res0a_5.vqh"
-#include "vorbis/book/res0a_6.vqh"
-#include "vorbis/book/res0a_7.vqh"
-#include "vorbis/book/res0a_8.vqh"
-#include "vorbis/book/res0a_9.vqh"
-#include "vorbis/book/res0a_10.vqh"
-#include "vorbis/book/res0a_11.vqh"
-#include "vorbis/book/res0a_12.vqh"
-#include "vorbis/book/res0a_13.vqh"
-
-/* A farily high quality setting mix */
-
-static vorbis_info_psy _psy_set0={
- 1,/*athp*/
- 1,/*decayp*/
- 1,/*smoothp*/
- 0,.1,
-
- -100.,
- -140.,
-
- /* 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 */
-
- 1,/* tonemaskp */
- /* 0 10 20 30 40 50 60 70 80 90 100 */
- {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
- {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
- {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
- {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
- {-30.,-30.,-35.,-37.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
- {-20.,-25.,-30.,-35.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*8000*/
- {-20.,-25.,-30.,-33.,-35.,-45.,-55.,-65.,-75.,-83., -90.}, /*11500*/
- {-20.,-24.,-26.,-32.,-35.,-45.,-55.,-65.,-75.,-83., -90.}, /*16000*/
- },
-
- 1,/* peakattp */
- /* 0 10 20 30 40 50 60 70 80 90 100 */
- {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
- {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
- {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
- { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
- { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
- { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
- },
-
- 0,/*noisemaskp */
- /* 0 10 20 30 40 50 60 70 80 90 100 */
- {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/
- { 10., 10., 10., 6., 6., 5., 4., 3., 2., 1., 0.}, /*700*/
-
- { 10., 10., 10., 10., 10., 8., 7., 6., 5., 4., 3.}, /*1000*/
- { 10., 10., 10., 10., 10., 8., 7., 6., 5., 4., 3.}, /*1400*/
- { 10., 10., 10., 10., 8., 8., 7., 6., 5., 4., 3.}, /*2000*/
- { 10., 10., 10., 10., 8., 8., 7., 6., 5., 4., 3.}, /*2800*/
- { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*4000*/
- { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*5600*/
- { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*8000*/
- { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*11500*/
- { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*16000*/
-
- },
-
- 110.,
-
- 0., -.005 /* attack/decay control */
-};
-
-
-
-/* with GNUisms, this could be short and readable. Oh well */
-static vorbis_info_time0 _time_set0={0};
-static vorbis_info_floor0 _floor_set0={12, 44100, 64, 12,150, 1, {0} };
-static vorbis_info_floor0 _floor_set1={30, 44100, 256, 12,150, 1, {1} };
-static vorbis_info_residue0 _residue_set0={0,128, 64,14,2,
- {0,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {4,5,6,7,8,9,10,11,12,13,14,15,16},
-
- {0,16,9999,30,9999,41,9999,47,9999,60,9999,128,9999},
- {1.5,1.5,1.5,2.5,2.5,3.5,3.5,5,5,9,9,18,18},
- {6,6,6,6,6,6,6,6,6,6,6,6,6},
- {99,99,99,99,99,99,99,
- 99,99,99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1={0,1024, 64,14,3,
- {0,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,1,1,1,1,1,1,1,1,1,1,1,1,1},
- {4,5,6,7,8,9,10,11,12,13,14,15,16,
- 17,18,19,20,21,22,23,24,25,26,27,28,29},
-
- {0, 16,9999, 30,9999, 41,9999,
- 47,9999,60,9999,128,9999,9999,
- 0, 16,9999, 30,9999, 41,9999,
- 47,9999,60,9999,128,9999},
-
- {1.5, 1.5,1.5, 2.5,2.5, 3.5,3.5,
- 5,5, 9,9, 18,18, 9999,
- 1.5, 1.5,1.5, 2.5,2.5, 3.5,3.5,
- 5,5, 9,9, 18,18},
-
- {6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6},/*6==64*/
-
- {
- 99,99,99,99,99,99,99,
- 99,99,99,99,99,99}};
-
-static vorbis_info_mapping0 _mapping_set0={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1={1, {0,0}, {0}, {1}, {1}, {0}};
-static vorbis_info_mode _mode_set0={0,0,0,0};
-static vorbis_info_mode _mode_set1={1,0,0,1};
-
-/* CD quality stereo, no channel coupling */
-vorbis_info info_A={
- /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */
- 0, 2, 44100, 0,0,0,
- /* smallblock, largeblock */
- {256, 2048},
- /* modes,maps,times,floors,residues,books,psys */
- 2, 2, 1, 2, 2, 30, 1,
- /* modes */
- {&_mode_set0,&_mode_set1},
- /* maps */
- {0,0},{&_mapping_set0,&_mapping_set1},
- /* times */
- {0,0},{&_time_set0},
- /* floors */
- {0,0},{&_floor_set0,&_floor_set1},
- /* residue */
- {0,0},{&_residue_set0,&_residue_set1},
- /* books */
- {&_vq_book_lsp12_0, /* 0 */
- &_vq_book_lsp30_0, /* 1 */
-
- &_huff_book_resaux0_short,
- &_huff_book_resaux0b_long,
-
- &_vq_book_res0a_1,
- &_vq_book_res0a_2,
- &_vq_book_res0a_3,
- &_vq_book_res0a_4,
- &_vq_book_res0a_5,
- &_vq_book_res0a_6,
- &_vq_book_res0a_7,
- &_vq_book_res0a_8,
- &_vq_book_res0a_9,
- &_vq_book_res0a_10,
- &_vq_book_res0a_11,
- &_vq_book_res0a_12,
- &_vq_book_res0a_13,
- &_vq_book_res0b_1,
- &_vq_book_res0b_2,
- &_vq_book_res0b_3,
- &_vq_book_res0b_4,
- &_vq_book_res0b_5,
- &_vq_book_res0b_6,
- &_vq_book_res0b_7,
- &_vq_book_res0b_8,
- &_vq_book_res0b_9,
- &_vq_book_res0b_10,
- &_vq_book_res0b_11,
- &_vq_book_res0b_12,
- &_vq_book_res0b_13,
- },
- /* psy */
- {&_psy_set0},
- /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
- 256, 32, 6, -96.
-};
-
-#define PREDEF_INFO_MAX 0
+#include "vorbis/mode_A.h"
+#include "vorbis/mode_D.h"
#endif
diff --git a/lib/analysis.c b/lib/analysis.c
new file mode 100644
index 00000000..54735277
--- /dev/null
+++ b/lib/analysis.c
@@ -0,0 +1,105 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: single-block PCM analysis mode dispatch
+ last mod: $Id: analysis.c,v 1.31.2.1 2000/08/15 08:33:43 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "vorbis/codec.h"
+#include "bitwise.h"
+#include "registry.h"
+#include "scales.h"
+#include "os.h"
+
+/* 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;
+
+ vb->glue_bits=0;
+ vb->time_bits=0;
+ vb->floor_bits=0;
+ vb->res_bits=0;
+
+ /* first things first. Make sure encode is ready */
+ _oggpack_reset(&vb->opb);
+ /* Encode the packet type */
+ _oggpack_write(&vb->opb,0,1);
+
+ /* 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];
+ vb->mode=mode;
+
+ /* Encode frame mode, pre,post windowsize, then dispatch */
+ _oggpack_write(&vb->opb,mode,vd->modebits);
+ if(vb->W){
+ _oggpack_write(&vb->opb,vb->lW,1);
+ _oggpack_write(&vb->opb,vb->nW,1);
+ /*fprintf(stderr,"*");
+ }else{
+ fprintf(stderr,".");*/
+ }
+
+ if(_mapping_P[type]->forward(vb,vd->mode[mode]))
+ return(-1);
+
+ /* set up the packet wrapper */
+
+ op->packet=_oggpack_buffer(&vb->opb);
+ op->bytes=_oggpack_bytes(&vb->opb);
+ op->b_o_s=0;
+ op->e_o_s=vb->eofflag;
+ op->frameno=vb->frameno;
+ op->packetno=vb->sequence; /* for sake of completeness */
+
+ return(0);
+}
+
+/* there was no great place to put this.... */
+void _analysis_output(char *base,int i,double *v,int n,int bark,int dB){
+#ifdef ANALYSIS
+ int j;
+ FILE *of;
+ char buffer[80];
+ sprintf(buffer,"%s_%d.m",base,i);
+ of=fopen(buffer,"w");
+
+ if(!of)perror("failed to open data dump file");
+
+ for(j=0;j<n;j++){
+ if(dB && v[j]==0)
+ fprintf(of,"\n\n");
+ else{
+ if(bark)
+ fprintf(of,"%g ",toBARK(22050.*j/n));
+ else
+ fprintf(of,"%g ",(double)j);
+
+ if(dB){
+ fprintf(of,"%g\n",todB(fabs(v[j])));
+ }else{
+ fprintf(of,"%g\n",v[j]);
+ }
+ }
+ }
+ fclose(of);
+#endif
+}
diff --git a/lib/framing.c b/lib/framing.c
new file mode 100644
index 00000000..60bd5bcc
--- /dev/null
+++ b/lib/framing.c
@@ -0,0 +1,1623 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and the XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: code raw [Vorbis] packets into framed OggSquish stream and
+ decode Ogg streams back into raw packets
+ last mod: $Id: framing.c,v 1.21.2.1 2000/08/15 08:33:43 xiphmont Exp $
+
+ note: The CRC code is directly derived from public domain code by
+ Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
+ for details.
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "vorbis/codec.h"
+#include "misc.h"
+
+/* A complete description of Ogg framing exists in docs/framing.html */
+
+int ogg_page_version(ogg_page *og){
+ return((int)(og->header[4]));
+}
+
+int ogg_page_continued(ogg_page *og){
+ return((int)(og->header[5]&0x01));
+}
+
+int ogg_page_bos(ogg_page *og){
+ return((int)(og->header[5]&0x02));
+}
+
+int ogg_page_eos(ogg_page *og){
+ return((int)(og->header[5]&0x04));
+}
+
+int64_t ogg_page_frameno(ogg_page *og){
+ unsigned char *page=og->header;
+ int64_t pcmpos=page[13]&(0xff);
+ pcmpos= (pcmpos<<8)|(page[12]&0xff);
+ pcmpos= (pcmpos<<8)|(page[11]&0xff);
+ pcmpos= (pcmpos<<8)|(page[10]&0xff);
+ pcmpos= (pcmpos<<8)|(page[9]&0xff);
+ pcmpos= (pcmpos<<8)|(page[8]&0xff);
+ pcmpos= (pcmpos<<8)|(page[7]&0xff);
+ pcmpos= (pcmpos<<8)|(page[6]&0xff);
+ return(pcmpos);
+}
+
+int ogg_page_serialno(ogg_page *og){
+ return(og->header[14] |
+ (og->header[15]<<8) |
+ (og->header[16]<<16) |
+ (og->header[17]<<24));
+}
+
+int ogg_page_pageno(ogg_page *og){
+ return(og->header[18] |
+ (og->header[19]<<8) |
+ (og->header[20]<<16) |
+ (og->header[21]<<24));
+}
+
+/* helper to initialize lookup for direct-table CRC */
+
+static unsigned vorbis_size32_t crc_lookup[256];
+static int crc_ready=0;
+
+static unsigned vorbis_size32_t _ogg_crc_entry(unsigned long index){
+ int i;
+ unsigned long r;
+
+ r = index << 24;
+ for (i=0; i<8; i++)
+ if (r & 0x80000000UL)
+ r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
+ polynomial, although we use an
+ unreflected alg and an init/final
+ of 0, not 0xffffffff */
+ else
+ r<<=1;
+ return (r & 0xffffffffUL);
+}
+
+/* mind this in threaded code; sync_init and stream_init call it.
+ It's thread safe only after the first time it returns */
+
+static void _ogg_crc_init(void){
+ if(!crc_ready){
+ /* initialize the crc_lookup table */
+ int i;
+ for (i=0;i<256;i++)
+ crc_lookup[i]=_ogg_crc_entry((unsigned long)i);
+ crc_ready=0;
+ }
+}
+
+/* init the encode/decode logical stream state */
+
+int ogg_stream_init(ogg_stream_state *os,int serialno){
+ if(os){
+ memset(os,0,sizeof(ogg_stream_state));
+ os->body_storage=16*1024;
+ os->body_data=malloc(os->body_storage*sizeof(char));
+
+ os->lacing_storage=1024;
+ os->lacing_vals=malloc(os->lacing_storage*sizeof(int));
+ os->pcm_vals=malloc(os->lacing_storage*sizeof(int64_t));
+
+ /* initialize the crc_lookup table if not done */
+ _ogg_crc_init();
+
+ os->serialno=serialno;
+
+ return(0);
+ }
+ return(-1);
+}
+
+/* _clear does not free os, only the non-flat storage within */
+int ogg_stream_clear(ogg_stream_state *os){
+ if(os){
+ if(os->body_data)free(os->body_data);
+ if(os->lacing_vals)free(os->lacing_vals);
+ if(os->pcm_vals)free(os->pcm_vals);
+
+ memset(os,0,sizeof(ogg_stream_state));
+ }
+ return(0);
+}
+
+int ogg_stream_destroy(ogg_stream_state *os){
+ if(os){
+ ogg_stream_clear(os);
+ free(os);
+ }
+ return(0);
+}
+
+/* Helpers for ogg_stream_encode; this keeps the structure and
+ what's happening fairly clear */
+
+static void _os_body_expand(ogg_stream_state *os,int needed){
+ if(os->body_storage<=os->body_fill+needed){
+ os->body_storage+=(needed+1024);
+ os->body_data=realloc(os->body_data,os->body_storage);
+ }
+}
+
+static void _os_lacing_expand(ogg_stream_state *os,int needed){
+ if(os->lacing_storage<=os->lacing_fill+needed){
+ os->lacing_storage+=(needed+32);
+ os->lacing_vals=realloc(os->lacing_vals,os->lacing_storage*sizeof(int));
+ os->pcm_vals=realloc(os->pcm_vals,os->lacing_storage*sizeof(int64_t));
+ }
+}
+
+/* checksum the page */
+/* Direct table CRC; note that this will be faster in the future if we
+ perform the checksum silmultaneously with other copies */
+
+static void _os_checksum(ogg_page *og){
+ unsigned vorbis_size32_t crc_reg=0;
+ int i;
+
+ for(i=0;i<og->header_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
+ for(i=0;i<og->body_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
+
+ og->header[22]=crc_reg&0xff;
+ og->header[23]=(crc_reg>>8)&0xff;
+ og->header[24]=(crc_reg>>16)&0xff;
+ og->header[25]=(crc_reg>>24)&0xff;
+}
+
+/* submit data to the internal buffer of the framing engine */
+int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
+ int lacing_vals=op->bytes/255+1,i;
+
+ if(os->body_returned){
+ /* advance packet data according to the body_returned pointer. We
+ had to keep it around to return a pointer into the buffer last
+ call */
+
+ os->body_fill-=os->body_returned;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+os->body_returned,
+ os->body_fill*sizeof(char));
+ os->body_returned=0;
+ }
+
+ /* make sure we have the buffer storage */
+ _os_body_expand(os,op->bytes);
+ _os_lacing_expand(os,lacing_vals);
+
+ /* Copy in the submitted packet. Yes, the copy is a waste; this is
+ the liability of overly clean abstraction for the time being. It
+ will actually be fairly easy to eliminate the extra copy in the
+ future */
+
+ memcpy(os->body_data+os->body_fill,op->packet,op->bytes);
+ os->body_fill+=op->bytes;
+
+ /* Store lacing vals for this packet */
+ for(i=0;i<lacing_vals-1;i++){
+ os->lacing_vals[os->lacing_fill+i]=255;
+ os->pcm_vals[os->lacing_fill+i]=os->pcmpos;
+ }
+ os->lacing_vals[os->lacing_fill+i]=(op->bytes)%255;
+ os->pcmpos=os->pcm_vals[os->lacing_fill+i]=op->frameno;
+
+ /* flag the first segment as the beginning of the packet */
+ os->lacing_vals[os->lacing_fill]|= 0x100;
+
+ os->lacing_fill+=lacing_vals;
+
+ /* for the sake of completeness */
+ os->packetno++;
+
+ if(op->e_o_s)os->e_o_s=1;
+
+ return(0);
+}
+
+/* This will flush remaining packets into a page (returning nonzero),
+ even if there is not enough data to trigger a flush normally
+ (undersized page). If there are no packets or partial packets to
+ flush, ogg_stream_flush returns 0. Note that ogg_stream_flush will
+ try to flush a normal sized page like ogg_stream_pageout; a call to
+ ogg_stream_flush does not gurantee that all packets have flushed.
+ Only a return value of 0 from ogg_stream_flush indicates all packet
+ data is flushed into pages.
+
+ ogg_stream_page will flush the last page in a stream even if it's
+ undersized; you almost certainly want to use ogg_stream_pageout
+ (and *not* ogg_stream_flush) unless you need to flush an undersized
+ page in the middle of a stream for some reason. */
+
+int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
+ int i;
+ int vals=0;
+ int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
+ int bytes=0;
+ long acc=0;
+ int64_t pcm_pos=os->pcm_vals[0];
+
+ if(maxvals==0)return(0);
+
+ /* construct a page */
+ /* decide how many segments to include */
+
+ /* If this is the initial header case, the first page must only include
+ the initial header packet */
+ if(os->b_o_s==0){ /* 'initial header page' case */
+ pcm_pos=0;
+ for(vals=0;vals<maxvals;vals++){
+ if((os->lacing_vals[vals]&0x0ff)<255){
+ vals++;
+ break;
+ }
+ }
+ }else{
+ for(vals=0;vals<maxvals;vals++){
+ if(acc>4096)break;
+ acc+=os->lacing_vals[vals]&0x0ff;
+ pcm_pos=os->pcm_vals[vals];
+ }
+ }
+
+ /* construct the header in temp storage */
+ memcpy(os->header,"OggS",4);
+
+ /* stream structure version */
+ os->header[4]=0x00;
+
+ /* continued packet flag? */
+ os->header[5]=0x00;
+ if((os->lacing_vals[0]&0x100)==0)os->header[5]|=0x01;
+ /* first page flag? */
+ if(os->b_o_s==0)os->header[5]|=0x02;
+ /* last page flag? */
+ if(os->e_o_s && os->lacing_fill==vals)os->header[5]|=0x04;
+ os->b_o_s=1;
+
+ /* 64 bits of PCM position */
+ for(i=6;i<14;i++){
+ os->header[i]=(pcm_pos&0xff);
+ pcm_pos>>=8;
+ }
+
+ /* 32 bits of stream serial number */
+ {
+ long serialno=os->serialno;
+ for(i=14;i<18;i++){
+ os->header[i]=(serialno&0xff);
+ serialno>>=8;
+ }
+ }
+
+ /* 32 bits of page counter (we have both counter and page header
+ because this val can roll over) */
+ if(os->pageno==-1)os->pageno=0; /* because someone called
+ stream_reset; this would be a
+ strange thing to do in an
+ encode stream, but it has
+ plausible uses */
+ {
+ long pageno=os->pageno++;
+ for(i=18;i<22;i++){
+ os->header[i]=(pageno&0xff);
+ pageno>>=8;
+ }
+ }
+
+ /* zero for computation; filled in later */
+ os->header[22]=0;
+ os->header[23]=0;
+ os->header[24]=0;
+ os->header[25]=0;
+
+ /* segment table */
+ os->header[26]=vals&0xff;
+ for(i=0;i<vals;i++)
+ bytes+=os->header[i+27]=(os->lacing_vals[i]&0xff);
+
+ /* set pointers in the ogg_page struct */
+ og->header=os->header;
+ og->header_len=os->header_fill=vals+27;
+ og->body=os->body_data+os->body_returned;
+ og->body_len=bytes;
+
+ /* advance the lacing data and set the body_returned pointer */
+
+ os->lacing_fill-=vals;
+ memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(int));
+ memmove(os->pcm_vals,os->pcm_vals+vals,os->lacing_fill*sizeof(int64_t));
+ os->body_returned+=bytes;
+
+ /* calculate the checksum */
+
+ _os_checksum(og);
+
+ /* done */
+ return(1);
+}
+
+
+/* This constructs pages from buffered packet segments. The pointers
+returned are to static buffers; do not free. The returned buffers are
+good only until the next call (using the same ogg_stream_state) */
+
+int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
+
+ if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */
+ os->body_fill-os->body_returned > 4096 ||/* 'page nominal size' case */
+ os->lacing_fill>=255 || /* 'segment table full' case */
+ (os->lacing_fill&&!os->b_o_s)){ /* 'initial header page' case */
+
+ return(ogg_stream_flush(os,og));
+ }
+
+ /* not enough data to construct a page and not end of stream */
+ return(0);
+}
+
+int ogg_stream_eof(ogg_stream_state *os){
+ return os->e_o_s;
+}
+
+/* DECODING PRIMITIVES: packet streaming layer **********************/
+
+/* This has two layers to place more of the multi-serialno and paging
+ control in the application's hands. First, we expose a data buffer
+ using ogg_sync_buffer(). The app either copies into the
+ buffer, or passes it directly to read(), etc. We then call
+ ogg_sync_wrote() to tell how many bytes we just added.
+
+ Pages are returned (pointers into the buffer in ogg_sync_state)
+ by ogg_sync_pageout(). The page is then submitted to
+ ogg_stream_pagein() along with the appropriate
+ ogg_stream_state* (ie, matching serialno). We then get raw
+ packets out calling ogg_stream_packetout() with a
+ ogg_stream_state. See the 'frame-prog.txt' docs for details and
+ example code. */
+
+/* initialize the struct to a known state */
+int ogg_sync_init(ogg_sync_state *oy){
+ if(oy){
+ memset(oy,0,sizeof(ogg_sync_state));
+ _ogg_crc_init();
+ }
+ return(0);
+}
+
+/* clear non-flat storage within */
+int ogg_sync_clear(ogg_sync_state *oy){
+ if(oy){
+ if(oy->data)free(oy->data);
+ ogg_sync_init(oy);
+ }
+ return(0);
+}
+
+char *ogg_sync_buffer(ogg_sync_state *oy, long size){
+
+ /* first, clear out any space that has been previously returned */
+ if(oy->returned){
+ oy->fill-=oy->returned;
+ if(oy->fill>0)
+ memmove(oy->data,oy->data+oy->returned,
+ (oy->fill)*sizeof(char));
+ oy->returned=0;
+ }
+
+ if(size>oy->storage-oy->fill){
+ /* We need to extend the internal buffer */
+ long newsize=size+oy->fill+4096; /* an extra page to be nice */
+
+ if(oy->data)
+ oy->data=realloc(oy->data,newsize);
+ else
+ oy->data=malloc(newsize);
+ oy->storage=newsize;
+ }
+
+ /* expose a segment at least as large as requested at the fill mark */
+ return((char *)oy->data+oy->fill);
+}
+
+int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
+ if(oy->fill+bytes>oy->storage)return(-1);
+ oy->fill+=bytes;
+ return(0);
+}
+
+/* sync the stream. This is meant to be useful for finding page
+ boundaries.
+
+ return values for this:
+ -n) skipped n bytes
+ 0) page not ready; more data (no bytes skipped)
+ n) page synced at current location; page length n bytes
+
+*/
+
+long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
+ unsigned char *page=oy->data+oy->returned;
+ unsigned char *next;
+ long bytes=oy->fill-oy->returned;
+
+ if(oy->headerbytes==0){
+ int headerbytes,i;
+ if(bytes<27)return(0); /* not enough for a header */
+
+ /* verify capture pattern */
+ if(memcmp(page,"OggS",4))goto sync_fail;
+
+ headerbytes=page[26]+27;
+ if(bytes<headerbytes)return(0); /* not enough for header + seg table */
+
+ /* count up body length in the segment table */
+
+ for(i=0;i<page[26];i++)
+ oy->bodybytes+=page[27+i];
+ oy->headerbytes=headerbytes;
+ }
+
+ if(oy->bodybytes+oy->headerbytes>bytes)return(0);
+
+ /* The whole test page is buffered. Verify the checksum */
+ {
+ /* Grab the checksum bytes, set the header field to zero */
+ char chksum[4];
+ ogg_page log;
+
+ memcpy(chksum,page+22,4);
+ memset(page+22,0,4);
+
+ /* set up a temp page struct and recompute the checksum */
+ log.header=page;
+ log.header_len=oy->headerbytes;
+ log.body=page+oy->headerbytes;
+ log.body_len=oy->bodybytes;
+ _os_checksum(&log);
+
+ /* Compare */
+ if(memcmp(chksum,page+22,4)){
+ /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
+ at all) */
+ /* replace the computed checksum with the one actually read in */
+ memcpy(page+22,chksum,4);
+
+ /* Bad checksum. Lose sync */
+ goto sync_fail;
+ }
+ }
+
+ /* yes, have a whole page all ready to go */
+ {
+ unsigned char *page=oy->data+oy->returned;
+ long bytes;
+
+ if(og){
+ og->header=page;
+ og->header_len=oy->headerbytes;
+ og->body=page+oy->headerbytes;
+ og->body_len=oy->bodybytes;
+ }
+
+ oy->unsynced=0;
+ oy->returned+=(bytes=oy->headerbytes+oy->bodybytes);
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(bytes);
+ }
+
+ sync_fail:
+
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+
+ /* search for possible capture */
+ next=memchr(page+1,'O',bytes-1);
+ if(!next)
+ next=oy->data+oy->fill;
+
+ oy->returned=next-oy->data;
+ return(-(next-page));
+}
+
+/* sync the stream and get a page. Keep trying until we find a page.
+ Supress 'sync errors' after reporting the first.
+
+ return values:
+ -1) recapture (hole in data)
+ 0) need more data
+ 1) page returned
+
+ Returns pointers into buffered data; invalidated by next call to
+ _stream, _clear, _init, or _buffer */
+
+int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
+
+ /* all we need to do is verify a page at the head of the stream
+ buffer. If it doesn't verify, we look for the next potential
+ frame */
+
+ while(1){
+ long ret=ogg_sync_pageseek(oy,og);
+ if(ret>0){
+ /* have a page */
+ return(1);
+ }
+ if(ret==0){
+ /* need more data */
+ return(0);
+ }
+
+ /* head did not start a synced page... skipped some bytes */
+ if(!oy->unsynced){
+ oy->unsynced=1;
+ return(-1);
+ }
+
+ /* loop. keep looking */
+
+ }
+}
+
+/* add the incoming page to the stream state; we decompose the page
+ into packet segments here as well. */
+
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+ unsigned char *header=og->header;
+ unsigned char *body=og->body;
+ long bodysize=og->body_len;
+ int segptr=0;
+
+ int version=ogg_page_version(og);
+ int continued=ogg_page_continued(og);
+ int bos=ogg_page_bos(og);
+ int eos=ogg_page_eos(og);
+ int64_t pcmpos=ogg_page_frameno(og);
+ int serialno=ogg_page_serialno(og);
+ int pageno=ogg_page_pageno(og);
+ int segments=header[26];
+
+ /* clean up 'returned data' */
+ {
+ long lr=os->lacing_returned;
+ long br=os->body_returned;
+
+ /* body data */
+ if(br){
+ os->body_fill-=br;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+br,os->body_fill);
+ os->body_returned=0;
+ }
+
+ if(lr){
+ /* segment table */
+ if(os->lacing_fill-lr){
+ memmove(os->lacing_vals,os->lacing_vals+lr,
+ (os->lacing_fill-lr)*sizeof(int));
+ memmove(os->pcm_vals,os->pcm_vals+lr,
+ (os->lacing_fill-lr)*sizeof(int64_t));
+ }
+ os->lacing_fill-=lr;
+ os->lacing_packet-=lr;
+ os->lacing_returned=0;
+ }
+ }
+
+ /* check the serial number */
+ if(serialno!=os->serialno)return(-1);
+ if(version>0)return(-1);
+
+ _os_lacing_expand(os,segments+1);
+
+ /* are we in sequence? */
+ if(pageno!=os->pageno){
+ int i;
+
+ /* unroll previous partial packet (if any) */
+ for(i=os->lacing_packet;i<os->lacing_fill;i++)
+ os->body_fill-=os->lacing_vals[i]&0xff;
+ os->lacing_fill=os->lacing_packet;
+
+ /* make a note of dropped data in segment table */
+ if(os->pageno!=-1){
+ os->lacing_vals[os->lacing_fill++]=0x400;
+ os->lacing_packet++;
+ }
+
+ /* are we a 'continued packet' page? If so, we'll need to skip
+ some segments */
+ if(continued){
+ bos=0;
+ for(;segptr<segments;segptr++){
+ int val=header[27+segptr];
+ body+=val;
+ bodysize-=val;
+ if(val<255){
+ segptr++;
+ break;
+ }
+ }
+ }
+ }
+
+ if(bodysize){
+ _os_body_expand(os,bodysize);
+ memcpy(os->body_data+os->body_fill,body,bodysize);
+ os->body_fill+=bodysize;
+ }
+
+ {
+ int saved=-1;
+ while(segptr<segments){
+ int val=header[27+segptr];
+ os->lacing_vals[os->lacing_fill]=val;
+ os->pcm_vals[os->lacing_fill]=-1;
+
+ if(bos){
+ os->lacing_vals[os->lacing_fill]|=0x100;
+ bos=0;
+ }
+
+ if(val<255)saved=os->lacing_fill;
+
+ os->lacing_fill++;
+ segptr++;
+
+ if(val<255)os->lacing_packet=os->lacing_fill;
+ }
+
+ /* set the pcmpos on the last pcmval of the last full packet */
+ if(saved!=-1){
+ os->pcm_vals[saved]=pcmpos;
+ }
+
+ }
+
+ if(eos){
+ os->e_o_s=1;
+ if(os->lacing_fill>0)
+ os->lacing_vals[os->lacing_fill-1]|=0x200;
+ }
+
+ os->pageno=pageno+1;
+
+ return(0);
+}
+
+/* clear things to an initial state. Good to call, eg, before seeking */
+int ogg_sync_reset(ogg_sync_state *oy){
+ oy->fill=0;
+ oy->returned=0;
+ oy->unsynced=0;
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(0);
+}
+
+int ogg_stream_reset(ogg_stream_state *os){
+ os->body_fill=0;
+ os->body_returned=0;
+
+ os->lacing_fill=0;
+ os->lacing_packet=0;
+ os->lacing_returned=0;
+
+ os->header_fill=0;
+
+ os->e_o_s=0;
+ os->b_o_s=0;
+ os->pageno=-1;
+ os->packetno=0;
+ os->pcmpos=0;
+
+ return(0);
+}
+
+int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
+
+ /* The last part of decode. We have the stream broken into packet
+ segments. Now we need to group them into packets (or return the
+ out of sync markers) */
+
+ int ptr=os->lacing_returned;
+
+ if(os->lacing_packet<=ptr)return(0);
+
+ if(os->lacing_vals[ptr]&0x400){
+ /* We lost sync here; let the app know */
+ os->lacing_returned++;
+
+ /* we need to tell the codec there's a gap; it might need to
+ handle previous packet dependencies. */
+ os->packetno++;
+ return(-1);
+ }
+
+ /* Gather the whole packet. We'll have no holes or a partial packet */
+ {
+ int size=os->lacing_vals[ptr]&0xff;
+ int bytes=0;
+
+ op->packet=os->body_data+os->body_returned;
+ op->e_o_s=os->lacing_vals[ptr]&0x200; /* last packet of the stream? */
+ op->b_o_s=os->lacing_vals[ptr]&0x100; /* first packet of the stream? */
+ bytes+=size;
+
+ while(size==255){
+ int val=os->lacing_vals[++ptr];
+ size=val&0xff;
+ if(val&0x200)op->e_o_s=0x200;
+ bytes+=size;
+ }
+
+ op->packetno=os->packetno;
+ op->frameno=os->pcm_vals[ptr];
+ op->bytes=bytes;
+
+ os->body_returned+=bytes;
+ os->lacing_returned=ptr+1;
+ }
+ os->packetno++;
+ return(1);
+}
+
+#ifdef _V_SELFTEST
+#include <stdio.h>
+
+ogg_stream_state os_en, os_de;
+ogg_sync_state oy;
+
+void checkpacket(ogg_packet *op,int len, int no, int pos){
+ long j;
+ static int sequence=0;
+ static int lastno=0;
+
+ if(op->bytes!=len){
+ fprintf(stderr,"incorrect packet length!\n");
+ exit(1);
+ }
+ if(op->frameno!=pos){
+ fprintf(stderr,"incorrect packet position!\n");
+ exit(1);
+ }
+
+ /* packet number just follows sequence/gap; adjust the input number
+ for that */
+ if(no==0){
+ sequence=0;
+ }else{
+ sequence++;
+ if(no>lastno+1)
+ sequence++;
+ }
+ lastno=no;
+ if(op->packetno!=sequence){
+ fprintf(stderr,"incorrect packet sequence %ld != %d\n",
+ (long)(op->packetno),sequence);
+ exit(1);
+ }
+
+ /* Test data */
+ for(j=0;j<op->bytes;j++)
+ if(op->packet[j]!=((j+no)&0xff)){
+ fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
+ j,op->packet[j],(j+no)&0xff);
+ exit(1);
+ }
+}
+
+void check_page(unsigned char *data,const int *header,ogg_page *og){
+ long j;
+ /* Test data */
+ for(j=0;j<og->body_len;j++)
+ if(og->body[j]!=data[j]){
+ fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
+ j,data[j],og->body[j]);
+ exit(1);
+ }
+
+ /* Test header */
+ for(j=0;j<og->header_len;j++){
+ if(og->header[j]!=header[j]){
+ fprintf(stderr,"header content mismatch at pos %ld:\n",j);
+ for(j=0;j<header[26]+27;j++)
+ fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
+ fprintf(stderr,"\n");
+ exit(1);
+ }
+ }
+ if(og->header_len!=header[26]+27){
+ fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
+ og->header_len,header[26]+27);
+ exit(1);
+ }
+}
+
+void print_header(ogg_page *og){
+ int j;
+ fprintf(stderr,"\nHEADER:\n");
+ fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n",
+ og->header[0],og->header[1],og->header[2],og->header[3],
+ (int)og->header[4],(int)og->header[5]);
+
+ fprintf(stderr," pcmpos: %d serialno: %d pageno: %d\n",
+ (og->header[9]<<24)|(og->header[8]<<16)|
+ (og->header[7]<<8)|og->header[6],
+ (og->header[17]<<24)|(og->header[16]<<16)|
+ (og->header[15]<<8)|og->header[14],
+ (og->header[21]<<24)|(og->header[20]<<16)|
+ (og->header[19]<<8)|og->header[18]);
+
+ fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (",
+ (int)og->header[22],(int)og->header[23],
+ (int)og->header[24],(int)og->header[25],
+ (int)og->header[26]);
+
+ for(j=27;j<og->header_len;j++)
+ fprintf(stderr,"%d ",(int)og->header[j]);
+ fprintf(stderr,")\n\n");
+}
+
+void copy_page(ogg_page *og){
+ unsigned char *temp=malloc(og->header_len);
+ memcpy(temp,og->header,og->header_len);
+ og->header=temp;
+
+ temp=malloc(og->body_len);
+ memcpy(temp,og->body,og->body_len);
+ og->body=temp;
+}
+
+void error(void){
+ fprintf(stderr,"error!\n");
+ exit(1);
+}
+
+/* 17 only */
+const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x15,0xed,0xec,0x91,
+ 1,
+ 17};
+
+/* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x59,0x10,0x6c,0x2c,
+ 1,
+ 17};
+const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x89,0x33,0x85,0xce,
+ 13,
+ 254,255,0,255,1,255,245,255,255,0,
+ 255,255,90};
+
+/* nil packets; beginning,middle,end */
+const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x5c,0x3f,0x66,0xcb,
+ 17,
+ 17,254,255,0,0,255,1,0,255,245,255,255,0,
+ 255,255,90,0};
+
+/* large initial packet */
+const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x01,0x27,0x31,0xaa,
+ 18,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,10};
+
+const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x7f,0x4e,0x8a,0xd2,
+ 4,
+ 255,4,255,0};
+
+
+/* continuing packet test */
+const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x34,0x24,0xd5,0x29,
+ 17,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xc8,0xc3,0xcb,0xed,
+ 5,
+ 10,255,4,255,0};
+
+
+/* page with the 255 segment limit */
+const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xed,0x2a,0x2e,0xa7,
+ 255,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10};
+
+const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x6c,0x3b,0x82,0x3d,
+ 1,
+ 50};
+
+
+/* packet that overspans over an entire page */
+const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
+ 17,
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xbd,0xd5,0xb5,0x8b,
+ 17,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255};
+
+const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,3,0,0,0,
+ 0xef,0xdd,0x88,0xde,
+ 7,
+ 255,255,75,255,4,255,0};
+
+/* packet that overspans over an entire page */
+const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x3c,0xd9,0x4d,0x3f,
+ 17,
+ 100,255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255};
+
+const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xd4,0xe0,0x60,0xe5,
+ 1,0};
+
+void test_pack(const int *pl, const int **headers){
+ unsigned char *data=malloc(1024*1024); /* for scripted test cases only */
+ long inptr=0;
+ long outptr=0;
+ long deptr=0;
+ long depacket=0;
+ long pcm_pos=7;
+ int i,j,packets,pageno=0,pageout=0;
+ int eosflag=0;
+ int bosflag=0;
+
+ ogg_stream_reset(&os_en);
+ ogg_stream_reset(&os_de);
+ ogg_sync_reset(&oy);
+
+ for(packets=0;;packets++)if(pl[packets]==-1)break;
+
+ for(i=0;i<packets;i++){
+ /* construct a test packet */
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.frameno=pcm_pos;
+
+ pcm_pos+=1024;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+
+ /* submit the test packet */
+ ogg_stream_packetin(&os_en,&op);
+
+ /* retrieve any finished pages */
+ {
+ ogg_page og;
+
+ while(ogg_stream_pageout(&os_en,&og)){
+ /* We have a page. Check it carefully */
+
+ fprintf(stderr,"%d, ",pageno);
+
+ if(headers[pageno]==NULL){
+ fprintf(stderr,"coded too many pages!\n");
+ exit(1);
+ }
+
+ check_page(data+outptr,headers[pageno],&og);
+
+ outptr+=og.body_len;
+ pageno++;
+
+ /* have a complete page; submit it to sync/decode */
+
+ {
+ ogg_page og_de;
+ ogg_packet op_de;
+ char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
+ memcpy(buf,og.header,og.header_len);
+ memcpy(buf+og.header_len,og.body,og.body_len);
+ ogg_sync_wrote(&oy,og.header_len+og.body_len);
+
+ while(ogg_sync_pageout(&oy,&og_de)>0){
+ /* got a page. Happy happy. Verify that it's good. */
+
+ check_page(data+deptr,headers[pageout],&og_de);
+ deptr+=og_de.body_len;
+ pageout++;
+
+ /* submit it to deconstitution */
+ ogg_stream_pagein(&os_de,&og_de);
+
+ /* packets out? */
+ while(ogg_stream_packetout(&os_de,&op_de)>0){
+
+ /* verify the packet! */
+ /* check data */
+ if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
+ fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
+ /* check bos flag */
+ if(bosflag==0 && op_de.b_o_s==0){
+ fprintf(stderr,"b_o_s flag not set on packet!\n");
+ exit(1);
+ }
+ if(bosflag && op_de.b_o_s){
+ fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
+ exit(1);
+ }
+ bosflag=1;
+ depacket+=op_de.bytes;
+
+ /* check eos flag */
+ if(eosflag){
+ fprintf(stderr,"Multiple decoded packets with eos flag!\n");
+ exit(1);
+ }
+
+ if(op_de.e_o_s)eosflag=1;
+
+ /* check pcmpos flag */
+ if(op_de.frameno!=-1){
+ fprintf(stderr," pcm:%ld ",(long)op_de.frameno);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ free(data);
+ if(headers[pageno]!=NULL){
+ fprintf(stderr,"did not write last page!\n");
+ exit(1);
+ }
+ if(headers[pageout]!=NULL){
+ fprintf(stderr,"did not decode last page!\n");
+ exit(1);
+ }
+ if(inptr!=outptr){
+ fprintf(stderr,"encoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=deptr){
+ fprintf(stderr,"decoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=depacket){
+ fprintf(stderr,"decoded packet data incomplete!\n");
+ exit(1);
+ }
+ if(!eosflag){
+ fprintf(stderr,"Never got a packet with EOS set!\n");
+ exit(1);
+ }
+ fprintf(stderr,"ok.\n");
+}
+
+int main(void){
+
+ ogg_stream_init(&os_en,0x04030201);
+ ogg_stream_init(&os_de,0x04030201);
+ ogg_sync_init(&oy);
+
+ /* Exercise each code path in the framing code. Also verify that
+ the checksums are working. */
+
+ {
+ /* 17 only */
+ const int packets[]={17, -1};
+ const int *headret[]={head1_0,NULL};
+
+ fprintf(stderr,"testing single page encoding... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+ const int packets[]={17, 254, 255, 256, 500, 510, 600, -1};
+ const int *headret[]={head1_1,head2_1,NULL};
+
+ fprintf(stderr,"testing basic page encoding... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* nil packets; beginning,middle,end */
+ const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
+ const int *headret[]={head1_2,head2_2,NULL};
+
+ fprintf(stderr,"testing basic nil packets... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* large initial packet */
+ const int packets[]={4345,259,255,-1};
+ const int *headret[]={head1_3,head2_3,NULL};
+
+ fprintf(stderr,"testing initial-packet lacing > 4k... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* continuing packet test */
+ const int packets[]={0,4345,259,255,-1};
+ const int *headret[]={head1_4,head2_4,head3_4,NULL};
+
+ fprintf(stderr,"testing single packet page span... ");
+ test_pack(packets,headret);
+ }
+
+ /* page with the 255 segment limit */
+ {
+
+ const int packets[]={0,10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,50,-1};
+ const int *headret[]={head1_5,head2_5,head3_5,NULL};
+
+ fprintf(stderr,"testing max packet segments... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* packet that overspans over an entire page */
+ const int packets[]={0,100,9000,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing very large packets... ");
+ test_pack(packets,headret);
+ }
+
+ {
+ /* term only page. why not? */
+ const int packets[]={0,100,4080,-1};
+ const int *headret[]={head1_7,head2_7,head3_7,NULL};
+
+ fprintf(stderr,"testing zero data page (1 nil packet)... ");
+ test_pack(packets,headret);
+ }
+
+
+
+ {
+ /* build a bunch of pages for testing */
+ unsigned char *data=malloc(1024*1024);
+ int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
+ int inptr=0,i,j;
+ ogg_page og[5];
+
+ ogg_stream_reset(&os_en);
+
+ for(i=0;pl[i]!=-1;i++){
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.frameno=(i+1)*1000;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+ ogg_stream_packetin(&os_en,&op);
+ }
+
+ free(data);
+
+ /* retrieve finished pages */
+ for(i=0;i<5;i++){
+ if(ogg_stream_pageout(&os_en,&og[i])==0){
+ fprintf(stderr,"Too few pages output building sync tests!\n");
+ exit(1);
+ }
+ copy_page(&og[i]);
+ }
+
+ /* Test lost pages on pagein/packetout: no rollback */
+ {
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,76,5,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,34,6,-1);
+ fprintf(stderr,"ok.\n");
+ }
+
+ /* Test lost pages on pagein/packetout: rollback with continuation */
+ {
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages (rollback required)... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){
+ memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header,
+ og[i].header_len);
+ ogg_sync_wrote(&oy,og[i].header_len);
+ memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
+ ogg_sync_wrote(&oy,og[i].body_len);
+ }
+
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+ ogg_sync_pageout(&oy,&temp);
+ /* skip */
+ ogg_sync_pageout(&oy,&temp);
+ ogg_stream_pagein(&os_de,&temp);
+
+ /* do we get the expected results/packets? */
+
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,0,0,0);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,100,1,-1);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,4079,2,3000);
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,2956,3,4000);
+ if(ogg_stream_packetout(&os_de,&test)!=-1){
+ fprintf(stderr,"Error: loss of page did not return error\n");
+ exit(1);
+ }
+ if(ogg_stream_packetout(&os_de,&test)!=1)error();
+ checkpacket(&test,300,13,14000);
+ fprintf(stderr,"ok.\n");
+ }
+
+ /* the rest only test sync */
+ {
+ ogg_page og_de;
+ /* Test fractional page inputs: incomplete capture */
+ fprintf(stderr,"Testing sync on partial inputs... ");
+ ogg_sync_reset(&oy);
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 3);
+ ogg_sync_wrote(&oy,3);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete fixed header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete header */
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23,
+ 5);
+ ogg_sync_wrote(&oy,5);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ /* Test fractional page inputs: incomplete body */
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28,
+ og[1].header_len-28);
+ ogg_sync_wrote(&oy,og[1].header_len-28);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000);
+ ogg_sync_wrote(&oy,1000);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000,
+ og[1].body_len-1000);
+ ogg_sync_wrote(&oy,og[1].body_len-1000);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
+ }
+
+ /* Test fractional page inputs: page + incomplete capture */
+ {
+ ogg_page og_de;
+ fprintf(stderr,"Testing sync on 1+partial inputs... ");
+ ogg_sync_reset(&oy);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20,
+ og[1].header_len-20);
+ ogg_sync_wrote(&oy,og[1].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
+ }
+
+ /* Test recapture: garbage + page */
+ {
+ ogg_page og_de;
+ fprintf(stderr,"Testing search for capture... ");
+ ogg_sync_reset(&oy);
+
+ /* 'garbage' */
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ 20);
+ ogg_sync_wrote(&oy,20);
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20,
+ og[2].header_len-20);
+ ogg_sync_wrote(&oy,og[2].header_len-20);
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len);
+ ogg_sync_wrote(&oy,og[2].body_len);
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
+ }
+
+ /* Test recapture: page + garbage + page */
+ {
+ ogg_page og_de;
+ fprintf(stderr,"Testing recapture... ");
+ ogg_sync_reset(&oy);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header,
+ og[1].header_len);
+ ogg_sync_wrote(&oy,og[1].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,
+ og[1].body_len);
+ ogg_sync_wrote(&oy,og[1].body_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header,
+ og[2].header_len);
+ ogg_sync_wrote(&oy,og[2].header_len);
+
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body,
+ og[2].body_len-5);
+ ogg_sync_wrote(&oy,og[2].body_len-5);
+
+ memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header,
+ og[3].header_len);
+ ogg_sync_wrote(&oy,og[3].header_len);
+
+ memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body,
+ og[3].body_len);
+ ogg_sync_wrote(&oy,og[3].body_len);
+
+ if(ogg_sync_pageout(&oy,&og_de)>0)error();
+ if(ogg_sync_pageout(&oy,&og_de)<=0)error();
+
+ fprintf(stderr,"ok.\n");
+ }
+ }
+
+ return(0);
+}
+
+#endif
+
+
+
+
diff --git a/lib/info.c b/lib/info.c
new file mode 100644
index 00000000..c04080eb
--- /dev/null
+++ b/lib/info.c
@@ -0,0 +1,543 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: maintain the info structure, info <-> header packets
+ last mod: $Id: info.c,v 1.25.2.1 2000/08/15 08:33:44 xiphmont Exp $
+
+ ********************************************************************/
+
+/* general handling of the header and the vorbis_info structure (and
+ substructures) */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "vorbis/codec.h"
+#include "vorbis/backends.h"
+#include "bitwise.h"
+#include "sharedbook.h"
+#include "bookinternal.h"
+#include "registry.h"
+#include "window.h"
+#include "psy.h"
+#include "misc.h"
+#include "os.h"
+
+/* helpers */
+static int ilog2(unsigned int v){
+ int ret=0;
+ while(v>1){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+static void _v_writestring(oggpack_buffer *o,char *s){
+ while(*s){
+ _oggpack_write(o,*s++,8);
+ }
+}
+
+static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
+ while(bytes--){
+ *buf++=_oggpack_read(o,8);
+ }
+}
+
+void vorbis_comment_init(vorbis_comment *vc){
+ memset(vc,0,sizeof(vorbis_comment));
+}
+
+void vorbis_comment_add(vorbis_comment *vc,char *comment){
+ vc->user_comments=realloc(vc->user_comments,
+ (vc->comments+2)*sizeof(char *));
+ vc->comment_lengths=realloc(vc->comment_lengths,
+ (vc->comments+2)*sizeof(int));
+ vc->user_comments[vc->comments]=strdup(comment);
+ vc->comment_lengths[vc->comments]=strlen(comment);
+ vc->comments++;
+ vc->user_comments[vc->comments]=NULL;
+}
+
+void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){
+ char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
+ strcpy(comment, tag);
+ strcat(comment, "=");
+ strcat(comment, contents);
+ vorbis_comment_add(vc, comment);
+}
+
+/* This is more or less the same as strncasecmp - but that doesn't exist
+ * everywhere, and this is a fairly trivial function, so we include it */
+static int tagcompare(const char *s1, const char *s2, int n){
+ int c=0;
+ while(c < n){
+ if(toupper(s1[c]) != toupper(s2[c]))
+ return !0;
+ c++;
+ }
+ return 0;
+}
+
+char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
+ long i;
+ int found = 0;
+ int taglen = strlen(tag);
+ char *fulltag = alloca(taglen+ 2);
+
+ strcpy(fulltag, tag);
+ strcat(fulltag, "=");
+
+ for(i=0;i<vc->comments;i++){
+ if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
+ if(count == found)
+ /* We return a pointer to the data, not a copy */
+ return vc->user_comments[i] + taglen + 1;
+ else
+ found++;
+ }
+ }
+ return NULL; /* didn't find anything */
+}
+
+void vorbis_comment_clear(vorbis_comment *vc){
+ if(vc){
+ long i;
+ for(i=0;i<vc->comments;i++)
+ if(vc->user_comments[i])free(vc->user_comments[i]);
+ if(vc->user_comments)free(vc->user_comments);
+ if(vc->comment_lengths)free(vc->comment_lengths);
+ if(vc->vendor)free(vc->vendor);
+ }
+ memset(vc,0,sizeof(vorbis_comment));
+}
+
+/* used by synthesis, which has a full, alloced vi */
+void vorbis_info_init(vorbis_info *vi){
+ memset(vi,0,sizeof(vorbis_info));
+}
+
+void vorbis_info_clear(vorbis_info *vi){
+ 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);*/
+
+ 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]);
+ }
+ }
+ /*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){
+ vi->version=_oggpack_read(opb,32);
+ if(vi->version!=0)return(-1);
+
+ vi->channels=_oggpack_read(opb,8);
+ vi->rate=_oggpack_read(opb,32);
+
+ vi->bitrate_upper=_oggpack_read(opb,32);
+ 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);
+
+ 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(_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
+
+ return(0);
+ err_out:
+ vorbis_info_clear(vi);
+ return(-1);
+}
+
+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);
+ _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));
+
+ 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);
+ _v_readstring(opb,vc->user_comments[i],len);
+ }
+ if(_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
+
+ return(0);
+ err_out:
+ vorbis_comment_clear(vc);
+ return(-1);
+}
+
+/* all of the real encoding details are here. The modes, books,
+ everything */
+static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+ int i;
+
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ /* 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;
+ }
+
+ if(_oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
+
+ return(0);
+ err_out:
+ vorbis_info_clear(vi);
+ return(-1);
+}
+
+/* The Vorbis header is in three packets; the initial small packet in
+ the first page that identifies basic parameters, a second packet
+ with bitstream comments and a third packet that holds the
+ codebook. */
+
+int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
+ oggpack_buffer opb;
+
+ if(op){
+ _oggpack_readinit(&opb,op->packet,op->bytes);
+
+ /* Which of the three types of header is this? */
+ /* Also verify header-ness, vorbis */
+ {
+ char buffer[6];
+ int packtype=_oggpack_read(&opb,8);
+ memset(buffer,0,6);
+ _v_readstring(&opb,buffer,6);
+ if(memcmp(buffer,"vorbis",6)){
+ /* not a vorbis header */
+ return(-1);
+ }
+ switch(packtype){
+ case 0x01: /* least significant *bit* is read first */
+ if(!op->b_o_s){
+ /* Not the initial packet */
+ return(-1);
+ }
+ if(vi->rate!=0){
+ /* previously initialized info header */
+ return(-1);
+ }
+
+ return(_vorbis_unpack_info(vi,&opb));
+
+ case 0x03: /* least significant *bit* is read first */
+ if(vi->rate==0){
+ /* um... we didn't get the initial header */
+ return(-1);
+ }
+
+ return(_vorbis_unpack_comment(vc,&opb));
+
+ 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(_vorbis_unpack_books(vi,&opb));
+
+ default:
+ /* Not a valid vorbis header type */
+ return(-1);
+ break;
+ }
+ }
+ }
+ return(-1);
+}
+
+/* pack side **********************************************************/
+
+static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
+ /* preamble */
+ _oggpack_write(opb,0x01,8);
+ _v_writestring(opb,"vorbis");
+
+ /* basic information about the stream */
+ _oggpack_write(opb,0x00,32);
+ _oggpack_write(opb,vi->channels,8);
+ _oggpack_write(opb,vi->rate,32);
+
+ _oggpack_write(opb,vi->bitrate_upper,32);
+ _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,1,1);
+
+ return(0);
+}
+
+static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
+ char temp[]="Xiphophorus libVorbis I 20000508";
+
+ /* preamble */
+ _oggpack_write(opb,0x03,8);
+ _v_writestring(opb,"vorbis");
+
+ /* vendor */
+ _oggpack_write(opb,strlen(temp),32);
+ _v_writestring(opb,temp);
+
+ /* comments */
+
+ _oggpack_write(opb,vc->comments,32);
+ if(vc->comments){
+ int i;
+ for(i=0;i<vc->comments;i++){
+ if(vc->user_comments[i]){
+ _oggpack_write(opb,vc->comment_lengths[i],32);
+ _v_writestring(opb,vc->user_comments[i]);
+ }else{
+ _oggpack_write(opb,0,32);
+ }
+ }
+ }
+ _oggpack_write(opb,1,1);
+
+ return(0);
+}
+
+static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
+ int i;
+ _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;
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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,1,1);
+
+ return(0);
+err_out:
+ return(-1);
+}
+
+int vorbis_analysis_headerout(vorbis_dsp_state *v,
+ vorbis_comment *vc,
+ ogg_packet *op,
+ ogg_packet *op_comm,
+ ogg_packet *op_code){
+ vorbis_info *vi=v->vi;
+ oggpack_buffer opb;
+
+ /* first header packet **********************************************/
+
+ _oggpack_writeinit(&opb);
+ 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;
+ op->bytes=_oggpack_bytes(&opb);
+ op->b_o_s=1;
+ op->e_o_s=0;
+ op->frameno=0;
+
+ /* second header packet (comments) **********************************/
+
+ _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;
+ op_comm->bytes=_oggpack_bytes(&opb);
+ op_comm->b_o_s=0;
+ op_comm->e_o_s=0;
+ op_comm->frameno=0;
+
+ /* third header packet (modes/codebooks) ****************************/
+
+ _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;
+ op_code->bytes=_oggpack_bytes(&opb);
+ op_code->b_o_s=0;
+ op_code->e_o_s=0;
+ op_code->frameno=0;
+
+ _oggpack_writeclear(&opb);
+ return(0);
+ err_out:
+ _oggpack_writeclear(&opb);
+ memset(op,0,sizeof(ogg_packet));
+ 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);
+}
+
diff --git a/lib/mapping0.c b/lib/mapping0.c
new file mode 100644
index 00000000..989e169b
--- /dev/null
+++ b/lib/mapping0.c
@@ -0,0 +1,383 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: channel mapping 0 implementation
+ last mod: $Id: mapping0.c,v 1.14.2.1 2000/08/15 08:33:44 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "vorbis/codec.h"
+#include "vorbis/backends.h"
+#include "bitwise.h"
+#include "bookinternal.h"
+#include "registry.h"
+#include "psy.h"
+#include "misc.h"
+
+/* simplistic, wasteful way of doing this (unique lookup for each
+ mode/submapping); there should be a central repository for
+ identical lookups. That will require minor work, so I'm putting it
+ off as low priority.
+
+ Why a lookup for each backend in a given mode? Because the
+ blocksize is set by the mode, and low backend lookups may require
+ parameters from other areas of the mode/mapping */
+
+typedef struct {
+ vorbis_info_mode *mode;
+ vorbis_info_mapping0 *map;
+
+ vorbis_look_time **time_look;
+ vorbis_look_floor **floor_look;
+
+ vorbis_look_residue **residue_look;
+ vorbis_look_psy *psy_look;
+
+ vorbis_func_time **time_func;
+ vorbis_func_floor **floor_func;
+ vorbis_func_residue **residue_func;
+
+ int ch;
+ double **decay;
+ long lastframe; /* if a different mode is called, we need to
+ invalidate decay */
+} vorbis_look_mapping0;
+
+static void free_info(vorbis_info_mapping *i){
+ if(i){
+ memset(i,0,sizeof(vorbis_info_mapping0));
+ free(i);
+ }
+}
+
+static void free_look(vorbis_look_mapping *look){
+ int i;
+ vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
+ if(l){
+ for(i=0;i<l->map->submaps;i++){
+ l->time_func[i]->free_look(l->time_look[i]);
+ l->floor_func[i]->free_look(l->floor_look[i]);
+ l->residue_func[i]->free_look(l->residue_look[i]);
+ if(l->psy_look)_vp_psy_clear(l->psy_look+i);
+ }
+
+ if(l->decay){
+ for(i=0;i<l->ch;i++){
+ if(l->decay[i])free(l->decay[i]);
+ }
+ free(l->decay);
+ }
+
+ free(l->time_func);
+ free(l->floor_func);
+ free(l->residue_func);
+ free(l->time_look);
+ free(l->floor_look);
+ free(l->residue_look);
+ if(l->psy_look)free(l->psy_look);
+ memset(l,0,sizeof(vorbis_look_mapping0));
+ free(l);
+ }
+}
+
+static vorbis_look_mapping *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_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->residue_look=calloc(info->submaps,sizeof(vorbis_look_residue *));
+ if(vi->psys)look->psy_look=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 *));
+
+ 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_look[i]=look->time_func[i]->
+ look(vd,vm,vi->time_param[timenum]);
+ look->floor_func[i]=_floor_P[vi->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->residue_look[i]=look->residue_func[i]->
+ look(vd,vm,vi->residue_param[resnum]);
+
+ if(vi->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);
+ }
+ }
+
+ look->ch=vi->channels;
+ if(vi->psys){
+ look->decay=calloc(vi->channels,sizeof(double *));
+ for(i=0;i<vi->channels;i++)
+ look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(double));
+ }
+
+ return(look);
+}
+
+static void pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer *opb){
+ int i;
+ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
+
+ _oggpack_write(opb,info->submaps-1,4);
+ /* we don't write the channel submappings if we only have one... */
+ if(info->submaps>1){
+ for(i=0;i<vi->channels;i++)
+ _oggpack_write(opb,info->chmuxlist[i],4);
+ }
+ for(i=0;i<info->submaps;i++){
+ _oggpack_write(opb,info->timesubmap[i],8);
+ _oggpack_write(opb,info->floorsubmap[i],8);
+ _oggpack_write(opb,info->residuesubmap[i],8);
+ }
+}
+
+/* also responsible for range checking */
+static vorbis_info_mapping *unpack(vorbis_info *vi,oggpack_buffer *opb){
+ int i;
+ vorbis_info_mapping0 *info=calloc(1,sizeof(vorbis_info_mapping0));
+ memset(info,0,sizeof(vorbis_info_mapping0));
+
+ info->submaps=_oggpack_read(opb,4)+1;
+
+ if(info->submaps>1){
+ for(i=0;i<vi->channels;i++){
+ info->chmuxlist[i]=_oggpack_read(opb,4);
+ if(info->chmuxlist[i]>=info->submaps)goto err_out;
+ }
+ }
+ for(i=0;i<info->submaps;i++){
+ info->timesubmap[i]=_oggpack_read(opb,8);
+ if(info->timesubmap[i]>=vi->times)goto err_out;
+ info->floorsubmap[i]=_oggpack_read(opb,8);
+ if(info->floorsubmap[i]>=vi->floors)goto err_out;
+ info->residuesubmap[i]=_oggpack_read(opb,8);
+ if(info->residuesubmap[i]>=vi->residues)goto err_out;
+ }
+
+ return info;
+
+ err_out:
+ free_info(info);
+ return(NULL);
+}
+
+#include <stdio.h>
+#include "os.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "envelope.h"
+#include "mdct.h"
+#include "psy.h"
+#include "bitwise.h"
+#include "spectrum.h"
+#include "scales.h"
+
+/* no time mapping implementation for now */
+static long seq=0;
+static int forward(vorbis_block *vb,vorbis_look_mapping *l){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ 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;
+ double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+
+ double **pcmbundle=alloca(sizeof(double *)*vi->channels);
+ int *nonzero=alloca(sizeof(int)*vi->channels);
+
+ /* time domain pre-window: NONE IMPLEMENTED */
+
+ /* window the PCM data: takes PCM vector, vb; modifies PCM vector */
+
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ for(j=0;j<n;j++)
+ pcm[j]*=window[j];
+ }
+
+ /* time-domain post-window: NONE IMPLEMENTED */
+
+ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+ /* only MDCT right now.... */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ mdct_forward(vd->transform[vb->W][0],pcm,pcm);
+ }
+
+ {
+ double *floor=_vorbis_block_alloc(vb,n*sizeof(double)/2);
+
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ double *decay=look->decay[i];
+ int submap=info->chmuxlist[i];
+
+ /* if some other mode/mapping was called last frame, our decay
+ accumulator is out of date. Clear it. */
+ if(look->lastframe+1 != vb->sequence)
+ memset(decay,0,n*sizeof(double)/2);
+
+ /* perform psychoacoustics; do masking */
+ _vp_compute_mask(look->psy_look+submap,pcm,floor,decay);
+
+ _analysis_output("decay",seq,decay,n/2,0,1);
+ _analysis_output("mdct",seq,pcm,n/2,0,1);
+ _analysis_output("lmdct",seq,pcm,n/2,0,0);
+ _analysis_output("prefloor",seq,floor,n/2,0,1);
+
+ /* perform floor encoding */
+ nonzero[i]=look->floor_func[submap]->
+ forward(vb,look->floor_look[submap],floor,floor);
+
+ _analysis_output("floor",seq,floor,n/2,0,1);
+
+ /* apply the floor, do optional noise levelling */
+ _vp_apply_floor(look->psy_look+submap,pcm,floor);
+
+ _analysis_output("res",seq++,pcm,n/2,0,0);
+
+#ifdef TRAIN_RES
+ if(nonzero[i]){
+ FILE *of;
+ char buffer[80];
+ int i;
+
+ sprintf(buffer,"residue_%d.vqd",vb->mode);
+ of=fopen(buffer,"a");
+ for(i=0;i<n/2;i++)
+ fprintf(of,"%.2f, ",pcm[i]);
+ fprintf(of,"\n");
+ fclose(of);
+ }
+#endif
+
+ }
+
+ /* perform residue encoding with residue mapping; this is
+ multiplexed. All the channels belonging to one submap are
+ encoded (values interleaved), then the next submap, etc */
+
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i && nonzero[j]==1){
+ pcmbundle[ch_in_bundle++]=vb->pcm[j];
+ }
+ }
+
+ look->residue_func[i]->forward(vb,look->residue_look[i],
+ pcmbundle,ch_in_bundle);
+ }
+ }
+
+ look->lastframe=vb->sequence;
+ return(0);
+}
+
+static int inverse(vorbis_block *vb,vorbis_look_mapping *l){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ 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];
+
+ double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+ double **pcmbundle=alloca(sizeof(double *)*vi->channels);
+ int *nonzero=alloca(sizeof(int)*vi->channels);
+
+ /* time domain information decode (note that applying the
+ information would have to happen later; we'll probably add a
+ function entry to the harness for that later */
+ /* NOT IMPLEMENTED */
+
+ /* recover the spectral envelope; store it in the PCM vector for now */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ int submap=info->chmuxlist[i];
+ nonzero[i]=look->floor_func[submap]->
+ inverse(vb,look->floor_look[submap],pcm);
+ _analysis_output("ifloor",seq+i,pcm,n/2,0,1);
+ }
+
+ /* recover the residue, apply directly to the spectral envelope */
+
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i && nonzero[j])
+ pcmbundle[ch_in_bundle++]=vb->pcm[j];
+ }
+
+ look->residue_func[i]->inverse(vb,look->residue_look[i],pcmbundle,ch_in_bundle);
+ }
+
+ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+ /* only MDCT right now.... */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ _analysis_output("out",seq+i,pcm,n/2,0,1);
+ mdct_backward(vd->transform[vb->W][0],pcm,pcm);
+ }
+
+ /* now apply the decoded pre-window time information */
+ /* NOT IMPLEMENTED */
+
+ /* window the data */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ if(nonzero[i])
+ for(j=0;j<n;j++)
+ pcm[j]*=window[j];
+ else
+ for(j=0;j<n;j++)
+ pcm[j]=0.;
+ _analysis_output("final",seq++,pcm,n,0,0);
+ }
+
+ /* now apply the decoded post-window time information */
+ /* NOT IMPLEMENTED */
+
+ /* all done! */
+ return(0);
+}
+
+/* export hooks */
+vorbis_func_mapping mapping0_exportbundle={
+ &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse
+};
+
+
+
diff --git a/lib/psy.c b/lib/psy.c
index 35710de9..fa59a11e 100644
--- a/lib/psy.c
+++ b/lib/psy.c
@@ -12,7 +12,7 @@
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.23.4.9 2000/08/09 20:22:04 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.23.4.10 2000/08/15 08:33:44 xiphmont Exp $
********************************************************************/
@@ -303,28 +303,6 @@ void _vp_psy_clear(vorbis_look_psy *p){
}
}
-static void compute_decay_adaptive(vorbis_look_psy *p,double *f, double *decay, int n){
- /* handle decay */
- int i;
- double decscale=1.-pow(p->vi->decay_coeff,n);
- double attscale=1.-pow(p->vi->attack_coeff,n);
- static int frameno=0;
-
- _analysis_output("drive",frameno,f,n,0,1);
- _analysis_output("decay",frameno++,decay,n,0,1);
-
- for(i=0;i<n;i++){
- double del=f[i]-decay[i];
- if(del>0)
- /* add energy */
- decay[i]+=del*attscale;
- else
- /* remove energy */
- decay[i]+=del*decscale;
- if(decay[i]>f[i])f[i]=decay[i];
- }
-}
-
static void compute_decay_fixed(vorbis_look_psy *p,double *f, double *decay, int n){
/* handle decay */
int i;
@@ -333,9 +311,6 @@ static void compute_decay_fixed(vorbis_look_psy *p,double *f, double *decay, int
static int frameno=0;
- _analysis_output("drive",frameno,f,n,0,1);
- _analysis_output("decay",frameno++,decay,n,0,1);
-
for(i=0;i<n;i++){
double pre=decay[i];
if(decay[i]){
@@ -543,7 +518,7 @@ static void bark_noise(long n,double *b,double *f,double *noise){
memset(norm,0,n*sizeof(double));
while(hi<n){
- val=todB(f[i]*f[i])+200.;
+ val=todB(f[i]*f[i])+400.;
del=1./(i-lo);
noise[lo]+=val*del;
noise[i]-=val*del;
@@ -558,8 +533,8 @@ static void bark_noise(long n,double *b,double *f,double *noise){
i++;
- for(;b[hi]-.5<b[i] && hi<n;hi++);
- for(;b[lo]+.5<b[i] && lo<i;lo++);
+ for(;hi<n && b[hi]-.3<b[i];hi++);
+ for(;lo<i-1 && b[lo]+.3<b[i];lo++);
if(i==hi)hi++;
}
@@ -569,8 +544,7 @@ static void bark_noise(long n,double *b,double *f,double *noise){
long hilo=hi-lo;
for(;i<n;i++){
- val=todB(f[i]*f[i])+200.;
-
+ val=todB(f[i]*f[i])+400.;
del=1./(hii);
noise[i]-=val*del;
norm[i]-=del;
@@ -582,7 +556,7 @@ static void bark_noise(long n,double *b,double *f,double *noise){
norm[i]-=del;
}
for(i=1,lo=n-ilo;lo<n;lo++,i++){
- val=todB(f[n-i]*f[n-i])+200.;
+ val=todB(f[n-i]*f[n-i])+400.;
del=1./ilo;
noise[lo]+=val*del;
norm[lo]+=del;
@@ -605,10 +579,13 @@ static void bark_noise(long n,double *b,double *f,double *noise){
for(i=0;i<n;i++){
val+=norm[i];
acc+=noise[i];
- if(val==0)
+ if(val==0){
noise[i]=0.;
- else
- noise[i]=sqrt(fromdB(acc/val-200.));
+ norm[i]=0;
+ }else{
+ double v=acc/val-400;
+ noise[i]=sqrt(fromdB(v));
+ }
}
}
@@ -625,23 +602,24 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
double *flr,
double *decay){
double *smooth=alloca(sizeof(double)*p->n);
- double *seed=alloca(sizeof(double)*p->n);
int i,n=p->n;
double specmax=0.;
+ double *seed=alloca(sizeof(double)*p->n);
+ double *seed2=alloca(sizeof(double)*p->n);
+
memset(flr,0,n*sizeof(double));
- memset(seed,0,n*sizeof(double));
/* noise masking */
if(p->vi->noisemaskp){
- /* don't use the smoothed data for noise */
- bark_noise(n,p->bark,f,smooth);
- /*_analysis_output("noise",frameno,work2,n,0,1);*/
- seed_point(p,p->noiseatt,smooth,flr,specmax);
+ memset(seed,0,n*sizeof(double));
+ bark_noise(n,p->bark,f,seed);
+ seed_point(p,p->noiseatt,seed,flr,specmax);
+
}
+ /* smooth the data is that's called for ********************************/
for(i=0;i<n;i++)smooth[i]=fabs(f[i]);
-
if(p->vi->smoothp){
/* compute power^.5 of three neighboring bins to smooth for peaks
that get split twixt bins/peaks that nail the bin. This evens
@@ -660,7 +638,7 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
smooth[n-1]=sqrt(acc);
}
- /* find the highest peak so we know the limits */
+ /* find the highest peak so we know the limits *************************/
for(i=0;i<n;i++){
if(smooth[i]>specmax)specmax=smooth[i];
}
@@ -678,52 +656,32 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
}
}
- /* peak attenuation */
+ /* peak attenuation ******/
if(p->vi->peakattp){
memset(seed,0,n*sizeof(double));
seed_att(p,p->peakatt,smooth,seed,specmax);
max_seeds(p,seed,flr);
}
- /* seed the tone masking */
+ /* tone masking */
if(p->vi->tonemaskp){
memset(seed,0,n*sizeof(double));
+ memset(seed2,0,n*sizeof(double));
- seed_generic(p,p->tonecurves,smooth,flr,seed,specmax);
-
- /* chase the seeds */
- max_seeds(p,seed,seed);
+ seed_generic(p,p->tonecurves,smooth,flr,seed2,specmax);
+ max_seeds(p,seed2,seed2);
+
+ for(i=0;i<n;i++)if(seed2[i]<flr[i])seed2[i]=flr[i];
+ for(i=0;i<n;i++)if(seed2[i]<decay[i])seed2[i]=decay[i];
+ seed_generic(p,p->tonecurves,smooth,seed2,seed,specmax);
+ max_seeds(p,seed,seed);
+
if(p->vi->decayp)
compute_decay_fixed(p,seed,decay,n);
-
+
for(i=0;i<n;i++)if(flr[i]<seed[i])flr[i]=seed[i];
-
- }
-
- /* noise culling */
- if(p->vi->noisecullp){
- int j;
-
- /* march down from Nyquist to the first peak that exceeds the
- masking threshhold */
- for(i=n-1;i>0;i--){
- if(flr[i]<fabs(f[i])){
- break;
- }else{
- f[i]=0;
- }
- }
-
- /* take the edge off the steep ATH rise in treble */
- /*for(j=i+1;j<n;j++)
- flr[j]=flr[j-1];*/
-
- /* Smooth the falloff a bit */
-
- /* cull out addiitonal bands */
-
-
+
}
frameno++;
diff --git a/lib/psytune.c b/lib/psytune.c
index 2b5120bb..5191db0a 100644
--- a/lib/psytune.c
+++ b/lib/psytune.c
@@ -13,7 +13,7 @@
function: simple utility that runs audio through the psychoacoustics
without encoding
- last mod: $Id: psytune.c,v 1.4.4.2 2000/07/31 19:41:00 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.4.4.3 2000/08/15 08:33:45 xiphmont Exp $
********************************************************************/
@@ -34,7 +34,7 @@ static vorbis_info_psy _psy_set0={
1,/*athp*/
1,/*decayp*/
1,/*smoothp*/
- 1,.2,
+ 0,.2,
-100.,
-140.,
@@ -64,28 +64,27 @@ static vorbis_info_psy _psy_set0={
{-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
},
- 0,/* peakattp */
- /* 0 10 20 30 40 50 60 70 80 90 100 */
+ 1,/* peakattp */
{{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
- {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*175*/
- {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*250*/
- {-14.,-16.,-18.,-19.,-20.,-20.,-20.,-21.,-22.,-22.,-22.}, /*350*/
- {-14.,-16.,-18.,-18.,-18.,-19.,-20.,-20.,-20.,-22.,-22.}, /*500*/
- {-14.,-16.,-18.,-18.,-18.,-18.,-18.,-19.,-20.,-22.,-22.}, /*700*/
- {-14.,-16.,-16.,-17.,-18.,-18.,-18.,-19.,-20.,-22.,-22.}, /*1000*/
- {-14.,-16.,-16.,-17.,-18.,-18.,-18.,-19.,-20.,-22.,-22.}, /*1400*/
- {-14.,-15.,-18.,-18.,-18.,-18.,-18.,-19.,-20.,-22.,-22.}, /*2000*/
- {-14.,-14.,-18.,-18.,-18.,-18.,-18.,-19.,-20.,-22.,-22.}, /*2800*/
- {-12.,-13.,-16.,-17.,-17.,-17.,-18.,-19.,-20.,-22.,-22.}, /*4000*/
- {-10.,-12.,-14.,-15.,-16.,-16.,-17.,-18.,-20.,-22.,-22.}, /*5600*/
- { -8.,-11.,-12.,-13.,-14.,-15.,-16.,-17.,-18.,-22.,-22.}, /*8000*/
- { -8.,-10.,-12.,-13.,-14.,-15.,-16.,-16.,-16.,-22.,-22.}, /*11500*/
- { -8.,-10.,-12.,-13.,-14.,-15.,-16.,-16.,-16.,-22.,-22.}, /*16000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+ { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
+ { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
+ { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
},
- 0,/*noisemaskp */
+ 1,/*noisemaskp */
/* 0 10 20 30 40 50 60 70 80 90 100 */
{{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/
{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/
@@ -93,25 +92,25 @@ static vorbis_info_psy _psy_set0={
{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/
{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/
{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*700*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*100*/
- {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*1400/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*2000*/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*2800*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
+ {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
+ { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/
+ { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/
+ { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/
+ { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2800*/
{ -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*4000*/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*5600*/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*8000*/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*11500*/
- { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*16000*/
+ { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, /*5600*/
+ { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*8000*/
+ { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*11500*/
+ { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*16000*/
},
110.,
- .9998, .9998, /* attack/decay control */
+ -0, -.005, /* attack/decay control */
};
-static int noisy=1;
+static int noisy=0;
void analysis(char *base,int i,double *v,int n,int bark,int dB){
if(noisy){
int j;
@@ -305,6 +304,9 @@ int main(int argc,char *argv[]){
analysis("floor",frameno,floor,framesize/2,1,1);
_vp_apply_floor(&p_look,pcm[i],floor);
+ /*r(j=0;j<framesize/2;j++)
+ if(fabs(pcm[i][j])<1.)pcm[i][j]=0;*/
+
analysis("quant",frameno,pcm[i],framesize/2,1,1);
/* re-add floor */
diff --git a/lib/res0.c b/lib/res0.c
new file mode 100644
index 00000000..1f07a36e
--- /dev/null
+++ b/lib/res0.c
@@ -0,0 +1,384 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: residue backend 0 implementation
+ last mod: $Id: res0.c,v 1.15.4.1 2000/08/15 08:33:46 xiphmont Exp $
+
+ ********************************************************************/
+
+/* Slow, slow, slow, simpleminded and did I mention it was slow? The
+ encode/decode loops are coded for clarity and performance is not
+ yet even a nagging little idea lurking in the shadows. Oh and BTW,
+ it's slow. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "bitwise.h"
+#include "registry.h"
+#include "bookinternal.h"
+#include "sharedbook.h"
+#include "misc.h"
+#include "os.h"
+
+typedef struct {
+ vorbis_info_residue0 *info;
+ int map;
+
+ int parts;
+ codebook *phrasebook;
+ codebook ***partbooks;
+
+ int partvals;
+ int **decodemap;
+} vorbis_look_residue0;
+
+void free_info(vorbis_info_residue *i){
+ if(i){
+ memset(i,0,sizeof(vorbis_info_residue0));
+ free(i);
+ }
+}
+
+void free_look(vorbis_look_residue *i){
+ int j;
+ if(i){
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
+ for(j=0;j<look->parts;j++)
+ if(look->partbooks[j])free(look->partbooks[j]);
+ free(look->partbooks);
+ for(j=0;j<look->partvals;j++)
+ free(look->decodemap[j]);
+ free(look->decodemap);
+ memset(i,0,sizeof(vorbis_look_residue0));
+ free(i);
+ }
+}
+
+void pack(vorbis_info_residue *vr,oggpack_buffer *opb){
+ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+ int j,acc=0;
+ _oggpack_write(opb,info->begin,24);
+ _oggpack_write(opb,info->end,24);
+
+ _oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and
+ code with a partitioned book */
+ _oggpack_write(opb,info->partitions-1,6); /* possible partition choices */
+ _oggpack_write(opb,info->groupbook,8); /* group huffman book */
+ for(j=0;j<info->partitions;j++){
+ _oggpack_write(opb,info->secondstages[j],4); /* zero *is* a valid choice */
+ acc+=info->secondstages[j];
+ }
+ for(j=0;j<acc;j++)
+ _oggpack_write(opb,info->booklist[j],8);
+
+}
+
+/* vorbis_info is for range checking */
+vorbis_info_residue *unpack(vorbis_info *vi,oggpack_buffer *opb){
+ int j,acc=0;
+ vorbis_info_residue0 *info=calloc(1,sizeof(vorbis_info_residue0));
+
+ info->begin=_oggpack_read(opb,24);
+ info->end=_oggpack_read(opb,24);
+ info->grouping=_oggpack_read(opb,24)+1;
+ info->partitions=_oggpack_read(opb,6)+1;
+ info->groupbook=_oggpack_read(opb,8);
+ for(j=0;j<info->partitions;j++){
+ acc+=info->secondstages[j]=_oggpack_read(opb,4);
+ }
+ for(j=0;j<acc;j++)
+ info->booklist[j]=_oggpack_read(opb,8);
+
+ if(info->groupbook>=vi->books)goto errout;
+ for(j=0;j<acc;j++)
+ if(info->booklist[j]>=vi->books)goto errout;
+
+ return(info);
+ errout:
+ free_info(info);
+ return(NULL);
+}
+
+vorbis_look_residue *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));
+ int j,k,acc=0;
+ int dim;
+ look->info=info;
+ look->map=vm->mapping;
+
+ look->parts=info->partitions;
+ look->phrasebook=vd->fullbooks+info->groupbook;
+ dim=look->phrasebook->dim;
+
+ look->partbooks=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 *));
+ for(k=0;k<stages;k++)
+ look->partbooks[j][k]=vd->fullbooks+info->booklist[acc++];
+ }
+ }
+
+ look->partvals=rint(pow(look->parts,dim));
+ look->decodemap=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));
+ for(k=0;k<dim;k++){
+ long deco=val/mult;
+ val-=deco*mult;
+ mult/=look->parts;
+ look->decodemap[j][k]=deco;
+ }
+ }
+
+ return(look);
+}
+
+
+/* does not guard against invalid settings; eg, a subn of 16 and a
+ subgroup request of 32. Max subn of 128 */
+static int _testhack(double *vec,int n,vorbis_look_residue0 *look,
+ int auxparts,int auxpartnum){
+ vorbis_info_residue0 *info=look->info;
+ int i,j=0;
+ double max,localmax=0.;
+ double temp[128];
+ double entropy[8];
+
+ /* setup */
+ for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
+
+ /* handle case subgrp==1 outside */
+ for(i=0;i<n;i++)
+ if(temp[i]>localmax)localmax=temp[i];
+ max=localmax;
+
+ for(i=0;i<n;i++)temp[i]=rint(temp[i]);
+
+ while(1){
+ entropy[j]=localmax;
+ n>>=1;
+ j++;
+
+ if(n<=0)break;
+ for(i=0;i<n;i++){
+ temp[i]+=temp[i+n];
+ }
+ localmax=0.;
+ for(i=0;i<n;i++)
+ if(temp[i]>localmax)localmax=temp[i];
+ }
+
+ for(i=0;i<auxparts-1;i++)
+ if(auxpartnum<info->blimit[i] &&
+ entropy[info->subgrp[i]]<=info->entmax[i] &&
+ max<=info->ampmax[i])
+ break;
+
+ return(i);
+}
+
+static int _encodepart(oggpack_buffer *opb,double *vec, int n,
+ int stages, codebook **books,int mode,int part){
+ int i,j,bits=0;
+
+ for(j=0;j<stages;j++){
+ int dim=books[j]->dim;
+ int step=n/dim;
+ for(i=0;i<step;i++){
+ int entry=vorbis_book_besterror(books[j],vec+i,step,0);
+#ifdef TRAIN_RESENT
+ {
+ char buf[80];
+ FILE *f;
+ sprintf(buf,"res0_%da%d_%d.vqd",mode,j,part);
+ f=fopen(buf,"a");
+ fprintf(f,"%d\n",entry);
+ fclose(f);
+ }
+#endif
+ bits+=vorbis_book_encode(books[j],entry,opb);
+ }
+ }
+
+ return(bits);
+}
+
+static int _decodepart(oggpack_buffer *opb,double *work,double *vec, int n,
+ int stages, codebook **books){
+ int i,j;
+
+ memset(work,0,sizeof(double)*n);
+ for(j=0;j<stages;j++){
+ int dim=books[j]->dim;
+ int step=n/dim;
+ for(i=0;i<step;i++)
+ if(vorbis_book_decodevs(books[j],work+i,opb,step,0)==-1)
+ return(-1);
+ }
+
+ for(i=0;i<n;i++)
+ vec[i]*=work[i];
+
+ return(0);
+}
+
+int forward(vorbis_block *vb,vorbis_look_residue *vl,
+ double **in,int ch){
+ long i,j,k,l;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int possible_partitions=info->partitions;
+ int partitions_per_word=look->phrasebook->dim;
+ int n=info->end-info->begin;
+ long phrasebits=0,resbitsT=0;
+ long *resbits=alloca(sizeof(long)*possible_partitions);
+ long *resvals=alloca(sizeof(long)*possible_partitions);
+
+ int partvals=n/samples_per_partition;
+ int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+ long **partword=_vorbis_block_alloc(vb,ch*sizeof(long *));
+
+ partvals=partwords*partitions_per_word;
+
+ /* we find the patition type for each partition of each
+ channel. We'll go back and do the interleaved encoding in a
+ bit. For now, clarity */
+
+ memset(resbits,0,sizeof(long)*possible_partitions);
+ memset(resvals,0,sizeof(long)*possible_partitions);
+
+ for(i=0;i<ch;i++){
+ partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(long));
+ memset(partword[i],0,n/samples_per_partition*sizeof(long));
+ }
+
+ for(i=info->begin,l=0;i<info->end;i+=samples_per_partition,l++){
+ for(j=0;j<ch;j++)
+ /* do the partition decision based on the number of 'bits'
+ needed to encode the block */
+ partword[j][l]=
+ _testhack(in[j]+i,samples_per_partition,look,possible_partitions,l);
+
+ }
+ /* we code the partition words for each channel, then the residual
+ words for a partition per channel until we've written all the
+ residual words for that partition word. Then write the next
+ parition channel words... */
+
+ for(i=info->begin,l=0;i<info->end;){
+ /* first we encode a partition codeword for each channel */
+ for(j=0;j<ch;j++){
+ long val=partword[j][l];
+ for(k=1;k<partitions_per_word;k++)
+ val= val*possible_partitions+partword[j][l+k];
+ phrasebits+=vorbis_book_encode(look->phrasebook,val,&vb->opb);
+ }
+ /* now we encode interleaved residual values for the partitions */
+ for(k=0;k<partitions_per_word;k++,l++,i+=samples_per_partition)
+ for(j=0;j<ch;j++){
+ resbits[partword[j][l]]+=
+ _encodepart(&vb->opb,in[j]+i,samples_per_partition,
+ info->secondstages[partword[j][l]],
+ look->partbooks[partword[j][l]],look->map,partword[j][l]);
+ resvals[partword[j][l]]+=samples_per_partition;
+ }
+
+ }
+
+ for(i=0;i<possible_partitions;i++)resbitsT+=resbits[i];
+ /*fprintf(stderr,
+ "Encoded %ld res vectors in %ld phrasing and %ld res bits\n\t",
+ ch*(info->end-info->begin),phrasebits,resbitsT);
+ for(i=0;i<possible_partitions;i++)
+ fprintf(stderr,"%ld(%ld):%ld ",i,resvals[i],resbits[i]);
+ fprintf(stderr,"\n");*/
+
+ return(0);
+}
+
+/* a truncated packet here just means 'stop working'; it's not an error */
+int inverse(vorbis_block *vb,vorbis_look_residue *vl,double **in,int ch){
+ long i,j,k,l,transend=vb->pcmend/2;
+ vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+ vorbis_info_residue0 *info=look->info;
+
+ /* move all this setup out later */
+ int samples_per_partition=info->grouping;
+ int partitions_per_word=look->phrasebook->dim;
+ int n=info->end-info->begin;
+
+ int partvals=n/samples_per_partition;
+ int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
+ int **partword=alloca(ch*sizeof(long *));
+ double *work=alloca(sizeof(double)*samples_per_partition);
+ partvals=partwords*partitions_per_word;
+
+ /* make sure we're zeroed up to the start */
+ for(j=0;j<ch;j++)
+ memset(in[j],0,sizeof(double)*info->begin);
+
+ for(i=info->begin,l=0;i<info->end;){
+ /* fetch the partition word for each channel */
+ for(j=0;j<ch;j++){
+ int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
+ if(temp==-1)goto eopbreak;
+ partword[j]=look->decodemap[temp];
+ if(partword[j]==NULL)goto errout;
+ }
+
+ /* now we decode interleaved residual values for the partitions */
+ for(k=0;k<partitions_per_word;k++,l++,i+=samples_per_partition)
+ for(j=0;j<ch;j++){
+ int part=partword[j][k];
+ if(_decodepart(&vb->opb,work,in[j]+i,samples_per_partition,
+ info->secondstages[part],
+ look->partbooks[part])==-1)goto eopbreak;
+ }
+ }
+
+ eopbreak:
+ if(i<transend){
+ for(j=0;j<ch;j++)
+ memset(in[j]+i,0,sizeof(double)*(transend-i));
+ }
+
+ return(0);
+
+ errout:
+ for(j=0;j<ch;j++)
+ memset(in[j],0,sizeof(double)*transend);
+ return(0);
+}
+
+vorbis_func_residue residue0_exportbundle={
+ &pack,
+ &unpack,
+ &look,
+ &free_info,
+ &free_look,
+ &forward,
+ &inverse
+};
diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c
new file mode 100644
index 00000000..eb49fc80
--- /dev/null
+++ b/lib/vorbisfile.c
@@ -0,0 +1,1156 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: stdio-based convenience library for opening/seeking/decoding
+ last mod: $Id: vorbisfile.c,v 1.25.4.1 2000/08/15 08:33:46 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+
+#include "os.h"
+#include "misc.h"
+
+/* A 'chained bitstream' is a Vorbis bitstream that contains more than
+ one logical bitstream arranged end to end (the only form of Ogg
+ multiplexing allowed in a Vorbis bitstream; grouping [parallel
+ multiplexing] is not allowed in Vorbis) */
+
+/* A Vorbis file can be played beginning to end (streamed) without
+ worrying ahead of time about chaining (see decoder_example.c). If
+ we have the whole file, however, and want random access
+ (seeking/scrubbing) or desire to know the total length/time of a
+ file, we need to account for the possibility of chaining. */
+
+/* We can handle things a number of ways; we can determine the entire
+ bitstream structure right off the bat, or find pieces on demand.
+ This example determines and caches structure for the entire
+ bitstream, but builds a virtual decoder on the fly when moving
+ between links in the chain. */
+
+/* There are also different ways to implement seeking. Enough
+ information exists in an Ogg bitstream to seek to
+ sample-granularity positions in the output. Or, one can seek by
+ picking some portion of the stream roughly in the desired area if
+ we only want course navigation through the stream. */
+
+/*************************************************************************
+ * Many, many internal helpers. The intention is not to be confusing;
+ * rampant duplication and monolithic function implementation would be
+ * harder to understand anyway. The high level functions are last. Begin
+ * grokking near the end of the file */
+
+/* read a little more data from the file/pipe into the ogg_sync framer */
+#define CHUNKSIZE 4096
+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);
+ return(bytes);
+}
+
+/* save a tiny smidge of verbosity to make the code more readable */
+static void _seek_helper(OggVorbis_File *vf,long offset){
+ (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
+ vf->offset=offset;
+ ogg_sync_reset(&vf->oy);
+}
+
+/* The read/seek functions track absolute position within the stream */
+
+/* from the head of the stream, get the next page. boundary specifies
+ if the function is allowed to fetch more data from the stream (and
+ how much) or only use internally buffered data.
+
+ boundary: -1) unbounded search
+ 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
+ n) found a page at absolute offset n */
+
+static long _get_next_page(OggVorbis_File *vf,ogg_page *og,int boundary){
+ if(boundary>0)boundary+=vf->offset;
+ while(1){
+ long more;
+
+ if(boundary>0 && vf->offset>=boundary)return(-1);
+ more=ogg_sync_pageseek(&vf->oy,og);
+
+ if(more<0){
+ /* skipped n bytes */
+ vf->offset-=more;
+ }else{
+ if(more==0){
+ /* send more paramedics */
+ if(!boundary)return(-1);
+ if(_get_data(vf)<=0)return(-1);
+ }else{
+ /* got a page. Return the offset at the page beginning,
+ advance the internal offset past the page end */
+ long ret=vf->offset;
+ vf->offset+=more;
+ return(ret);
+
+ }
+ }
+ }
+}
+
+/* find the latest page beginning before the current stream cursor
+ position. Much dirtier than the above as Ogg doesn't have any
+ backward search linkage. no 'readp' as it will certainly have to
+ read. */
+static long _get_prev_page(OggVorbis_File *vf,ogg_page *og){
+ long begin=vf->offset;
+ long ret;
+ int offset=-1;
+
+ while(offset==-1){
+ begin-=CHUNKSIZE;
+ _seek_helper(vf,begin);
+ while(vf->offset<begin+CHUNKSIZE){
+ ret=_get_next_page(vf,og,begin+CHUNKSIZE-vf->offset);
+ if(ret==-1){
+ break;
+ }else{
+ offset=ret;
+ }
+ }
+ }
+
+ /* 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){
+ /* this shouldn't be possible */
+ fprintf(stderr,"Missed page fencepost at end of logical bitstream. "
+ "Exiting.\n");
+ exit(1);
+ }
+ return(offset);
+}
+
+/* finds each bitstream link one at a time using a bisection search
+ (has to begin by knowing the offset of the lb's initial page).
+ Recurses for each link so it can alloc the link storage after
+ 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){
+ long endsearched=end;
+ long next=end;
+ ogg_page og;
+ long ret;
+
+ /* the below guards against garbage seperating the last and
+ first pages of two links. */
+ while(searched<endsearched){
+ long bisect;
+
+ if(endsearched-searched<CHUNKSIZE){
+ bisect=searched;
+ }else{
+ bisect=(searched+endsearched)/2;
+ }
+
+ _seek_helper(vf,bisect);
+ ret=_get_next_page(vf,&og,-1);
+ if(ret<0 || ogg_page_serialno(&og)!=currentno){
+ endsearched=bisect;
+ if(ret>=0)next=ret;
+ }else{
+ searched=ret+og.header_len+og.body_len;
+ }
+ }
+
+ _seek_helper(vf,next);
+ ret=_get_next_page(vf,&og,-1);
+
+ if(searched>=end || ret==-1){
+ vf->links=m+1;
+ vf->offsets=malloc((m+2)*sizeof(int64_t));
+ vf->offsets[m+1]=searched;
+ }else{
+ _bisect_forward_serialno(vf,next,vf->offset,
+ end,ogg_page_serialno(&og),m+1);
+ }
+
+ vf->offsets[m]=begin;
+}
+
+/* uses the local ogg_stream storage in vf; this is important for
+ non-streaming input sources */
+static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc,
+ long *serialno){
+ ogg_page og;
+ ogg_packet op;
+ int i,ret;
+
+ ret=_get_next_page(vf,&og,CHUNKSIZE);
+ if(ret==-1){
+ fprintf(stderr,"Did not find initial header for bitstream.\n");
+ return -1;
+ }
+
+ if(serialno)*serialno=ogg_page_serialno(&og);
+ ogg_stream_init(&vf->os,ogg_page_serialno(&og));
+
+ /* extract the initial header from the first page and verify that the
+ Ogg bitstream is in fact Vorbis data */
+
+ vorbis_info_init(vi);
+ vorbis_comment_init(vc);
+
+ i=0;
+ while(i<3){
+ ogg_stream_pagein(&vf->os,&og);
+ while(i<3){
+ int result=ogg_stream_packetout(&vf->os,&op);
+ if(result==0)break;
+ if(result==-1){
+ fprintf(stderr,"Corrupt header in logical bitstream.\n");
+ goto bail_header;
+ }
+ if(vorbis_synthesis_headerin(vi,vc,&op)){
+ fprintf(stderr,"Illegal header in logical bitstream.\n");
+ goto bail_header;
+ }
+ i++;
+ }
+ if(i<3)
+ if(_get_next_page(vf,&og,1)<0){
+ fprintf(stderr,"Missing header in logical bitstream.\n");
+ goto bail_header;
+ }
+ }
+ return 0;
+
+ bail_header:
+ vorbis_info_clear(vi);
+ vorbis_comment_clear(vc);
+ ogg_stream_clear(&vf->os);
+ return -1;
+}
+
+/* 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) */
+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(int64_t));
+ vf->pcmlengths=malloc(vf->links*sizeof(int64_t));
+ vf->serialnos=malloc(vf->links*sizeof(long));
+
+ for(i=0;i<vf->links;i++){
+ if(first_i && first_c && i==0){
+ /* we already grabbed the initial header earlier. This just
+ saves the waste of grabbing it again */
+ memcpy(vf->vi+i,first_i,sizeof(vorbis_info));
+ memcpy(vf->vc+i,first_c,sizeof(vorbis_comment));
+ vf->dataoffsets[i]=dataoffset;
+ }else{
+
+ /* seek to the location of the initial header */
+
+ _seek_helper(vf,vf->offsets[i]);
+ if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL)==-1){
+ fprintf(stderr,"Error opening logical bitstream #%d.\n\n",i+1);
+ vf->dataoffsets[i]=-1;
+ }else{
+ vf->dataoffsets[i]=vf->offset;
+ ogg_stream_clear(&vf->os);
+ }
+ }
+
+ /* get the serial number and PCM length of this link. To do this,
+ get the last page of the stream */
+ {
+ long end=vf->offsets[i+1];
+ _seek_helper(vf,end);
+
+ 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);
+ vorbis_info_clear(vf->vi+i);
+ vorbis_comment_clear(vf->vc+i);
+ break;
+ }
+ if(ogg_page_frameno(&og)!=-1){
+ vf->serialnos[i]=ogg_page_serialno(&og);
+ vf->pcmlengths[i]=ogg_page_frameno(&og);
+ break;
+ }
+ }
+ }
+ }
+}
+
+static int _make_decode_ready(OggVorbis_File *vf){
+ if(vf->decode_ready)exit(1);
+ vorbis_synthesis_init(&vf->vd,vf->vi);
+ vorbis_block_init(&vf->vd,&vf->vb);
+ vf->decode_ready=1;
+ return(0);
+}
+
+static int _open_seekable(OggVorbis_File *vf){
+ vorbis_info initial_i;
+ vorbis_comment initial_c;
+ long serialno,end;
+ int ret;
+ long dataoffset;
+ ogg_page og;
+
+ /* is this even vorbis...? */
+ ret=_fetch_headers(vf,&initial_i,&initial_c,&serialno);
+ dataoffset=vf->offset;
+ ogg_stream_clear(&vf->os);
+ if(ret==-1)return(-1);
+
+ /* we can seek, so set out learning all about this file */
+ vf->seekable=1;
+ (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
+ vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
+
+ /* 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);
+
+ /* moer 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);
+
+ }else{
+
+ /* Only one logical bitstream */
+ _bisect_forward_serialno(vf,0,end,end+1,serialno,0);
+
+ }
+
+ _prefetch_all_headers(vf,&initial_i,&initial_c,dataoffset);
+ return(ov_raw_seek(vf,0));
+
+}
+
+static int _open_nonseekable(OggVorbis_File *vf){
+ /* 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));
+
+ /* Try to fetch the headers, maintaining all the storage */
+ if(_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno)==-1)return(-1);
+ _make_decode_ready(vf);
+
+ return 0;
+}
+
+/* clear out the current logical bitstream decoder */
+static void _decode_clear(OggVorbis_File *vf){
+ ogg_stream_clear(&vf->os);
+ vorbis_dsp_clear(&vf->vd);
+ vorbis_block_clear(&vf->vb);
+ vf->decode_ready=0;
+
+ vf->bittrack=0.;
+ vf->samptrack=0.;
+}
+
+/* fetch and process a packet. Handles the case where we're at a
+ bitstream boundary and dumps the decoding machine. If the decoding
+ machine is unloaded, it loads it. It also keeps pcm_offset up to
+ 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
+ 1) got a packet
+*/
+
+static int _process_packet(OggVorbis_File *vf,int readp){
+ ogg_page og;
+
+ /* handle one packet. Try to fetch it from current stream state */
+ /* extract packets from page */
+ while(1){
+
+ /* process a packet if we can. If the machine isn't loaded,
+ neither is a page */
+ if(vf->decode_ready){
+ ogg_packet op;
+ int result=ogg_stream_packetout(&vf->os,&op);
+ int64_t frameno;
+
+ /* 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>0){
+ /* got a packet. process it */
+ frameno=op.frameno;
+ if(!vorbis_synthesis(&vf->vb,&op)){ /* lazy check for lazy
+ header handling. The
+ header packets aren't
+ audio, so if/when we
+ submit them,
+ vorbis_synthesis will
+ reject them */
+
+ /* suck in the synthesis data and track bitrate */
+ {
+ int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL);
+ vorbis_synthesis_blockin(&vf->vd,&vf->vb);
+ vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples;
+ vf->bittrack+=op.bytes*8;
+ }
+
+ /* update the pcm offset. */
+ if(frameno!=-1 && !op.e_o_s){
+ int link=(vf->seekable?vf->current_link:0);
+ int i,samples;
+
+ /* this packet has a pcm_offset on it (the last packet
+ completed on a page carries the offset) After processing
+ (above), we know the pcm position of the *last* sample
+ ready to be returned. Find the offset of the *first*
+
+ As an aside, this trick is inaccurate if we begin
+ reading anew right at the last page; the end-of-stream
+ frameno declares the last frame in the stream, and the
+ last packet of the last page may be a partial frame.
+ So, we need a previous frameno from an in-sequence page
+ to have a reference point. Thus the !op.e_o_s clause
+ above */
+
+ samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
+
+ frameno-=samples;
+ for(i=0;i<link;i++)
+ frameno+=vf->pcmlengths[i];
+ vf->pcm_offset=frameno;
+ }
+ return(1);
+ }
+ }
+ }
+
+ if(!readp)return(0);
+ if(_get_next_page(vf,&og,-1)<0)return(0); /* eof. leave unitialized */
+
+ /* bitrate tracking; add the header's bytes here, the body bytes
+ are done by packet above */
+ vf->bittrack+=og.header_len*8;
+
+ /* has our decoding just traversed a bitstream boundary? */
+ if(vf->decode_ready){
+ if(vf->current_serialno!=ogg_page_serialno(&og)){
+ _decode_clear(vf);
+ }
+ }
+
+ /* Do we need to load a new machine before submitting the page? */
+ /* This is different in the seekable and non-seekable cases.
+
+ In the seekable case, we already have all the header
+ information loaded and cached; we just initialize the machine
+ with it and continue on our merry way.
+
+ In the non-seekable (streaming) case, we'll only be at a
+ boundary if we just left the previous logical bitstream and
+ we're now nominally at the header of the next bitstream
+ */
+
+ if(!vf->decode_ready){
+ int link;
+ if(vf->seekable){
+ vf->current_serialno=ogg_page_serialno(&og);
+
+ /* match the serialno to bitstream section. We use this rather than
+ offset positions to avoid problems near logical bitstream
+ boundaries */
+ for(link=0;link<vf->links;link++)
+ if(vf->serialnos[link]==vf->current_serialno)break;
+ if(link==vf->links)return(-1); /* 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 */
+
+ _fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno);
+ vf->current_link++;
+ link=0;
+ }
+
+ _make_decode_ready(vf);
+ }
+ ogg_stream_pagein(&vf->os,&og);
+ }
+}
+
+/**********************************************************************
+ * The helpers are over; it's all toplevel interface from here on out */
+
+/* clear out the OggVorbis_File struct */
+int ov_clear(OggVorbis_File *vf){
+ if(vf){
+ vorbis_block_clear(&vf->vb);
+ vorbis_dsp_clear(&vf->vd);
+ ogg_stream_clear(&vf->os);
+
+ if(vf->vi && vf->links){
+ int i;
+ for(i=0;i<vf->links;i++){
+ vorbis_info_clear(vf->vi+i);
+ vorbis_comment_clear(vf->vc+i);
+ }
+ free(vf->vi);
+ free(vf->vc);
+ }
+ if(vf->dataoffsets)free(vf->dataoffsets);
+ if(vf->pcmlengths)free(vf->pcmlengths);
+ if(vf->serialnos)free(vf->serialnos);
+ if(vf->offsets)free(vf->offsets);
+ ogg_sync_clear(&vf->oy);
+ if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
+ memset(vf,0,sizeof(OggVorbis_File));
+ }
+#ifdef DEBUG_LEAKS
+ _VDBG_dump();
+#endif
+ return(0);
+}
+
+static int _fseek64_wrap(FILE *f,int64_t off,int whence){
+ return fseek(f,(int)off,whence);
+}
+
+/* inspects the OggVorbis file and finds/documents all the logical
+ bitstreams contained in it. Tries to be tolerant of logical
+ bitstream sections that are truncated/woogie.
+
+ return: -1) error
+ 0) OK
+*/
+
+int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
+ ov_callbacks callbacks = {
+ (size_t (*)(void *, size_t, size_t, void *)) fread,
+ (int (*)(void *, int64_t, int)) _fseek64_wrap,
+ (int (*)(void *)) fclose,
+ (long (*)(void *)) ftell
+ };
+
+ return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
+}
+
+
+int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
+ ov_callbacks callbacks)
+{
+ long offset=callbacks.seek_func(f,0,SEEK_CUR);
+ int ret;
+
+ memset(vf,0,sizeof(OggVorbis_File));
+ vf->datasource=f;
+ vf->callbacks = callbacks;
+
+ /* init the framing state */
+ ogg_sync_init(&vf->oy);
+
+ /* perhaps some data was previously read into a buffer for testing
+ against other stream types. Allow initialization from this
+ previously read data (as we may be reading from a non-seekable
+ stream) */
+ if(initial){
+ char *buffer=ogg_sync_buffer(&vf->oy,ibytes);
+ memcpy(buffer,initial,ibytes);
+ ogg_sync_wrote(&vf->oy,ibytes);
+ }
+
+ /* can we seek? Stevens suggests the seek test was portable */
+ if(offset!=-1){
+ ret=_open_seekable(vf);
+ }else{
+ ret=_open_nonseekable(vf);
+ }
+ if(ret){
+ vf->datasource=NULL;
+ ov_clear(vf);
+ }
+ return(ret);
+}
+
+/* How many logical bitstreams in this physical bitstream? */
+long ov_streams(OggVorbis_File *vf){
+ return vf->links;
+}
+
+/* Is the FILE * associated with vf seekable? */
+long ov_seekable(OggVorbis_File *vf){
+ return vf->seekable;
+}
+
+/* returns the bitrate for a given logical bitstream or the entire
+ physical bitstream. If the file is open for random access, it will
+ find the *actual* average bitrate. If the file is streaming, it
+ returns the nominal bitrate (if set) else the average of the
+ upper/lower bounds (if set) else -1 (unset).
+
+ If you want the actual bitrate field settings, get them from the
+ vorbis_info structs */
+
+long ov_bitrate(OggVorbis_File *vf,int i){
+ if(i>=vf->links)return(-1);
+ if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
+ if(i<0){
+ int64_t bits=0;
+ int i;
+ for(i=0;i<vf->links;i++)
+ bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
+ return(rint(bits/ov_time_total(vf,-1)));
+ }else{
+ if(vf->seekable){
+ /* return the actual bitrate */
+ return(rint((vf->offsets[i+1]-vf->dataoffsets[i])*8/ov_time_total(vf,i)));
+ }else{
+ /* return nominal if set */
+ if(vf->vi[i].bitrate_nominal>0){
+ return vf->vi[i].bitrate_nominal;
+ }else{
+ if(vf->vi[i].bitrate_upper>0){
+ if(vf->vi[i].bitrate_lower>0){
+ return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2;
+ }else{
+ return vf->vi[i].bitrate_upper;
+ }
+ }
+ return(-1);
+ }
+ }
+ }
+}
+
+/* returns the actual bitrate since last call. returns -1 if no
+ additional data to offer since last call (or at beginning of stream) */
+long ov_bitrate_instant(OggVorbis_File *vf){
+ int link=(vf->seekable?vf->current_link:0);
+ long ret;
+ if(vf->samptrack==0)return(-1);
+ ret=vf->bittrack/vf->samptrack*vf->vi[link].rate+.5;
+ vf->bittrack=0.;
+ vf->samptrack=0.;
+ return(ret);
+}
+
+/* Guess */
+long ov_serialnumber(OggVorbis_File *vf,int i){
+ if(i>=vf->links)return(-1);
+ if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
+ if(i<0){
+ return(vf->current_serialno);
+ }else{
+ return(vf->serialnos[i]);
+ }
+}
+
+/* returns: total raw (compressed) length of content if i==-1
+ raw (compressed) length of that logical bitstream for i==0 to n
+ -1 if the stream is not seekable (we can't know the length)
+*/
+int64_t ov_raw_total(OggVorbis_File *vf,int i){
+ if(!vf->seekable || i>=vf->links)return(-1);
+ if(i<0){
+ long acc=0;
+ int i;
+ for(i=0;i<vf->links;i++)
+ acc+=ov_raw_total(vf,i);
+ return(acc);
+ }else{
+ return(vf->offsets[i+1]-vf->offsets[i]);
+ }
+}
+
+/* returns: total PCM length (samples) of content if i==-1
+ PCM length (samples) of that logical bitstream for i==0 to n
+ -1 if the stream is not seekable (we can't know the length)
+*/
+int64_t ov_pcm_total(OggVorbis_File *vf,int i){
+ if(!vf->seekable || i>=vf->links)return(-1);
+ if(i<0){
+ int64_t acc=0;
+ int i;
+ for(i=0;i<vf->links;i++)
+ acc+=ov_pcm_total(vf,i);
+ return(acc);
+ }else{
+ return(vf->pcmlengths[i]);
+ }
+}
+
+/* returns: total seconds of content if i==-1
+ seconds in that logical bitstream for i==0 to n
+ -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(i<0){
+ double acc=0;
+ int i;
+ for(i=0;i<vf->links;i++)
+ acc+=ov_time_total(vf,i);
+ return(acc);
+ }else{
+ return((float)(vf->pcmlengths[i])/vf->vi[i].rate);
+ }
+}
+
+/* seek to an offset relative to the *compressed* data. This also
+ immediately sucks in and decodes pages to update the PCM cursor. It
+ will cross a logical bitstream boundary, but only if it can't get
+ any packets out of the tail of the bitstream we seek to (so no
+ surprises).
+
+ 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;
+
+ /* clear out decoding machine state */
+ vf->pcm_offset=-1;
+ _decode_clear(vf);
+
+ /* seek */
+ _seek_helper(vf,pos);
+
+ /* we need to make sure the pcm_offset is set. We use the
+ _fetch_packet helper to process one packet with readp set, then
+ call it until it returns '0' with readp not set (the last packet
+ from a page has the 'frameno' 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(1){
+ 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
+ gracefully, we're just missing the offset */
+ return(0);
+ case -1:
+ /* error! missing data or invalid bitstream structure */
+ goto seek_error;
+ default:
+ /* continue processing packets */
+ break;
+ }
+ }
+
+ seek_error:
+ /* dump the machine so we're in a known state */
+ vf->pcm_offset=-1;
+ _decode_clear(vf);
+ return -1;
+}
+
+/* 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,int64_t pos){
+ int link=-1;
+ 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;
+
+ /* which bitstream section does this pcm offset occur in? */
+ for(link=vf->links-1;link>=0;link--){
+ total-=vf->pcmlengths[link];
+ if(pos>=total)break;
+ }
+
+ /* search within the logical bitstream for the page with the highest
+ pcm_pos preceeding (or equal to) pos. There is a danger here;
+ missing pages or incorrect frame number information in the
+ bitstream could make our task impossible. Account for that (it
+ would be an error condition) */
+ {
+ int64_t target=pos-total;
+ long end=vf->offsets[link+1];
+ long begin=vf->offsets[link];
+ long best=begin;
+
+ ogg_page og;
+ while(begin<end){
+ long bisect;
+ long ret;
+
+ if(end-begin<CHUNKSIZE){
+ bisect=begin;
+ }else{
+ bisect=(end+begin)/2;
+ }
+
+ _seek_helper(vf,bisect);
+ ret=_get_next_page(vf,&og,end-bisect);
+
+ if(ret==-1){
+ end=bisect;
+ }else{
+ int64_t frameno=ogg_page_frameno(&og);
+ if(frameno<target){
+ best=ret; /* raw offset of packet with frameno */
+ 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;
+ }
+
+ /* verify result */
+ if(vf->pcm_offset>=pos)goto seek_error;
+ if(pos>ov_pcm_total(vf,-1))goto seek_error;
+
+ /* discard samples until we reach the desired position. Crossing a
+ logical bitstream boundary with abandon is OK. */
+ while(vf->pcm_offset<pos){
+ double **pcm;
+ long target=pos-vf->pcm_offset;
+ long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
+
+ if(samples>target)samples=target;
+ vorbis_synthesis_read(&vf->vd,samples);
+ vf->pcm_offset+=samples;
+
+ if(samples<target)
+ if(_process_packet(vf,1)==0)
+ vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
+ }
+ return 0;
+
+ seek_error:
+ /* dump machine so we're in a known state */
+ vf->pcm_offset=-1;
+ _decode_clear(vf);
+ return -1;
+}
+
+/* seek to a playback time relative to the decompressed pcm stream
+ returns zero on success, nonzero on failure */
+int ov_time_seek(OggVorbis_File *vf,double seconds){
+ /* translate time to PCM position and call ov_pcm_seek */
+
+ int link=-1;
+ 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;
+
+ /* which bitstream section does this time offset occur in? */
+ for(link=vf->links-1;link>=0;link--){
+ pcm_total-=vf->pcmlengths[link];
+ time_total-=ov_time_total(vf,link);
+ if(seconds>=time_total)break;
+ }
+
+ /* enough information to convert time offset to pcm offset */
+ {
+ 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;
+}
+
+/* tell the current stream offset cursor. Note that seek followed by
+ tell will likely not give the set offset due to caching */
+int64_t ov_raw_tell(OggVorbis_File *vf){
+ return(vf->offset);
+}
+
+/* return PCM offset (sample) of next PCM sample to be read */
+int64_t ov_pcm_tell(OggVorbis_File *vf){
+ return(vf->pcm_offset);
+}
+
+/* return time offset (seconds) of next PCM sample to be read */
+double ov_time_tell(OggVorbis_File *vf){
+ /* translate time to PCM position and call ov_pcm_seek */
+
+ int link=-1;
+ int64_t pcm_total=0;
+ double time_total=0.;
+
+ if(vf->seekable){
+ pcm_total=ov_pcm_total(vf,-1);
+ time_total=ov_time_total(vf,-1);
+
+ /* which bitstream section does this time offset occur in? */
+ for(link=vf->links-1;link>=0;link--){
+ pcm_total-=vf->pcmlengths[link];
+ time_total-=ov_time_total(vf,link);
+ if(vf->pcm_offset>=pcm_total)break;
+ }
+ }
+
+ return((double)time_total+(double)(vf->pcm_offset-pcm_total)/vf->vi[link].rate);
+}
+
+/* link: -1) return the vorbis_info struct for the bitstream section
+ currently being decoded
+ 0-n) to request information for a specific bitstream section
+
+ In the case of a non-seekable bitstream, any call returns the
+ current bitstream. NULL in the case that the machine is not
+ initialized */
+
+vorbis_info *ov_info(OggVorbis_File *vf,int link){
+ if(vf->seekable){
+ if(link<0)
+ if(vf->decode_ready)
+ return vf->vi+vf->current_link;
+ else
+ return NULL;
+ else
+ if(link>=vf->links)
+ return NULL;
+ else
+ return vf->vi+link;
+ }else{
+ if(vf->decode_ready)
+ return vf->vi;
+ else
+ return NULL;
+ }
+}
+
+/* grr, strong typing, grr, no templates/inheritence, grr */
+vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
+ if(vf->seekable){
+ if(link<0)
+ if(vf->decode_ready)
+ return vf->vc+vf->current_link;
+ else
+ return NULL;
+ else
+ if(link>=vf->links)
+ return NULL;
+ else
+ return vf->vc+link;
+ }else{
+ if(vf->decode_ready)
+ return vf->vc;
+ else
+ return NULL;
+ }
+}
+
+int host_is_big_endian() {
+ short pattern = 0xbabe;
+ unsigned char *bytewise = (unsigned char *)&pattern;
+ if (bytewise[0] == 0xba) return 1;
+
+ assert(bytewise[0] == 0xbe);
+ return 0;
+}
+
+/* up to this point, everything could more or less hide the multiple
+ logical bitstream nature of chaining from the toplevel application
+ if the toplevel application didn't particularly care. However, at
+ the point that we actually read audio back, the multiple-section
+ nature must surface: Multiple bitstream sections do not necessarily
+ have to have the same number of channels or sampling rate.
+
+ ov_read returns the sequential logical bitstream number currently
+ being decoded along with the PCM data in order that the toplevel
+ application can take action on channel/sample rate changes. This
+ number will be incremented even for streamed (non-seekable) streams
+ (for seekable streams, it represents the actual logical bitstream
+ index within the physical bitstream. Note that the accessor
+ functions above are aware of this dichotomy).
+
+ input values: buffer) a buffer to hold packed PCM data for return
+ length) the byte length requested to be placed into buffer
+ bigendianp) should the data be packed LSB first (0) or
+ MSB first (1)
+ word) word size for output. currently 1 (byte) or
+ 2 (16 bit short)
+
+ return values: -1) error/hole in data
+ 0) EOF
+ n) number of bytes of PCM actually returned. The
+ below works on a packet-by-packet basis, so the
+ return length is not related to the 'length' passed
+ in, just guaranteed to fit.
+
+ *section) set to the logical bitstream number */
+
+long ov_read(OggVorbis_File *vf,char *buffer,int length,
+ int bigendianp,int word,int sgned,int *bitstream){
+ int i,j;
+ int host_endian = host_is_big_endian();
+
+ while(1){
+ if(vf->decode_ready){
+ double **pcm;
+ long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
+ if(samples){
+ /* yay! proceed to pack data into the byte buffer */
+
+ long channels=ov_info(vf,-1)->channels;
+ long bytespersample=word * channels;
+ if(samples>length/bytespersample)samples=length/bytespersample;
+
+ /* a tight loop to pack each size */
+ {
+ int val;
+ if(word==1){
+ int off=(sgned?0:128);
+ for(j=0;j<samples;j++)
+ for(i=0;i<channels;i++){
+ val=(int)(pcm[i][j]*128. + 0.5);
+ if(val>127)val=127;
+ else if(val<-128)val=-128;
+ *buffer++=val+off;
+ }
+ }else{
+ int off=(sgned?0:32768);
+
+ if(host_endian==bigendianp){
+ if(sgned){
+ for(i=0;i<channels;i++) { /* It's faster in this order */
+ double *src=pcm[i];
+ short *dest=((short *)buffer)+i;
+ for(j=0;j<samples;j++) {
+ val=(int)(src[j]*32768. + 0.5);
+ if(val>32767)val=32767;
+ else if(val<-32768)val=-32768;
+ *dest=val;
+ dest+=channels;
+ }
+ }
+ }else{
+ for(i=0;i<channels;i++) {
+ double *src=pcm[i];
+ short *dest=((short *)buffer)+i;
+ for(j=0;j<samples;j++) {
+ val=(int)(src[j]*32768. + 0.5);
+ if(val>32767)val=32767;
+ else if(val<-32768)val=-32768;
+ *dest=val+off;
+ dest+=channels;
+ }
+ }
+ }
+ }else if(bigendianp){
+ for(j=0;j<samples;j++)
+ for(i=0;i<channels;i++){
+ val=(int)(pcm[i][j]*32768. + 0.5);
+ if(val>32767)val=32767;
+ else if(val<-32768)val=-32768;
+ val+=off;
+ *buffer++=(val>>8);
+ *buffer++=(val&0xff);
+ }
+ }else{
+ int val;
+ for(j=0;j<samples;j++)
+ for(i=0;i<channels;i++){
+ val=(int)(pcm[i][j]*32768. + 0.5);
+ if(val>32767)val=32767;
+ else if(val<-32768)val=-32768;
+ val+=off;
+ *buffer++=(val&0xff);
+ *buffer++=(val>>8);
+ }
+
+ }
+ }
+ }
+
+ vorbis_synthesis_read(&vf->vd,samples);
+ vf->pcm_offset+=samples;
+ if(bitstream)*bitstream=vf->current_link;
+ return(samples*bytespersample);
+ }
+ }
+
+ /* suck in another packet */
+ switch(_process_packet(vf,1)){
+ case 0:
+ return(0);
+ case -1:
+ return -1;
+ default:
+ break;
+ }
+ }
+}
+
+
+
+
diff --git a/vq/latticebuild.c b/vq/latticebuild.c
new file mode 100644
index 00000000..7655a47f
--- /dev/null
+++ b/vq/latticebuild.c
@@ -0,0 +1,174 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: utility main for building codebooks from lattice descriptions
+ last mod: $Id: latticebuild.c,v 1.4.2.1 2000/08/15 08:33:48 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "vorbis/codebook.h"
+#include "../lib/sharedbook.h"
+#include "bookutil.h"
+
+/* The purpose of this util is just to finish packaging the
+ description into a static codebook. It used to count hits for a
+ histogram, but I've divorced that out to add some flexibility (it
+ currently generates an equal probability codebook)
+
+ command line:
+ latticebuild description.vql
+
+ the lattice description file contains two lines:
+
+ <n> <dim> <multiplicitavep> <sequentialp>
+ <value_0> <value_1> <value_2> ... <value_n-1>
+
+ a threshmap (or pigeonmap) struct is generated by latticehint;
+ there are fun tricks one can do with the threshmap and cascades,
+ but the utils don't know them...
+
+ entropy encoding is done by feeding an entry list collected from a
+ training set and feeding it to latticetune along with the book.
+
+ latticebuild produces a codebook on stdout */
+
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+int main(int argc,char *argv[]){
+ codebook b;
+ static_codebook c;
+ double *quantlist;
+ long *hits;
+
+ int entries=-1,dim=-1,quantvals=-1,addmul=-1,sequencep=0;
+ FILE *in=NULL;
+ char *line,*name;
+ long i,j;
+
+ memset(&b,0,sizeof(b));
+ memset(&c,0,sizeof(c));
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Need a lattice description file on the command line.\n");
+ exit(1);
+ }
+
+ {
+ char *ptr;
+ char *filename=calloc(strlen(argv[1])+4,1);
+
+ strcpy(filename,argv[1]);
+ in=fopen(filename,"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",filename);
+ exit(1);
+ }
+
+ ptr=strrchr(filename,'.');
+ if(ptr){
+ *ptr='\0';
+ name=strdup(filename);
+ }else{
+ name=strdup(filename);
+ }
+
+ }
+
+ /* read the description */
+ line=get_line(in);
+ if(sscanf(line,"%d %d %d %d",&quantvals,&dim,&addmul,&sequencep)!=4){
+ if(sscanf(line,"%d %d %d",&quantvals,&dim,&addmul)!=3){
+ fprintf(stderr,"Syntax error reading book file (line 1)\n");
+ exit(1);
+ }
+ }
+ entries=pow(quantvals,dim);
+ c.dim=dim;
+ c.entries=entries;
+ c.lengthlist=malloc(entries*sizeof(long));
+ c.maptype=1;
+ c.q_sequencep=sequencep;
+ c.quantlist=calloc(quantvals,sizeof(long));
+
+ quantlist=malloc(sizeof(long)*c.dim*c.entries);
+ hits=malloc(c.entries*sizeof(long));
+ for(j=0;j<entries;j++)hits[j]=1;
+ for(j=0;j<entries;j++)c.lengthlist[j]=1;
+
+ reset_next_value();
+ setup_line(in);
+ for(j=0;j<quantvals;j++){
+ if(get_line_value(in,quantlist+j)==-1){
+ fprintf(stderr,"Ran out of data on line 2 of description file\n");
+ exit(1);
+ }
+ }
+
+ /* gen a real quant list from the more easily human-grokked input */
+ {
+ double min=quantlist[0];
+ double mindel=-1;
+ int fac=1;
+ for(j=1;j<quantvals;j++)if(quantlist[j]<min)min=quantlist[j];
+ for(j=0;j<quantvals;j++)
+ for(i=j+1;i<quantvals;i++)
+ if(mindel==-1 || fabs(quantlist[j]-quantlist[i])<mindel)
+ mindel=fabs(quantlist[j]-quantlist[i]);
+
+ j=0;
+ while(j<quantvals){
+ for(j=0;j<quantvals;j++){
+ double test=(quantlist[j]-min)/(mindel/fac);
+ if( fabs(rint(test)-test)>.000001) break;
+ }
+ if(j<quantvals)fac++;
+ }
+
+ mindel/=fac;
+ fprintf(stderr,"min=%g mindel=%g\n",min,mindel);
+
+ c.q_min=_float32_pack(min);
+ c.q_delta=_float32_pack(mindel);
+ c.q_quant=0;
+
+ min=_float32_unpack(c.q_min);
+ mindel=_float32_unpack(c.q_delta);
+ for(j=0;j<quantvals;j++){
+ c.quantlist[j]=rint((quantlist[j]-min)/mindel);
+ if(ilog(c.quantlist[j])>c.q_quant)c.q_quant=ilog(c.quantlist[j]);
+ }
+ }
+
+ /* build the [default] codeword lengths */
+ memset(c.lengthlist,0,sizeof(long)*entries);
+ for(i=0;i<entries;i++)hits[i]=1;
+ build_tree_from_lengths(entries,hits,c.lengthlist);
+
+ /* save the book in C header form */
+ write_codebook(stdout,name,&c);
+ fprintf(stderr,"\r "
+ "\nDone.\n");
+ exit(0);
+}
diff --git a/vq/latticehint.c b/vq/latticehint.c
index b147e157..f6f5af09 100644
--- a/vq/latticehint.c
+++ b/vq/latticehint.c
@@ -12,7 +12,7 @@
********************************************************************
function: utility main for building thresh/pigeonhole encode hints
- last mod: $Id: latticehint.c,v 1.1.2.3 2000/08/07 20:44:18 xiphmont Exp $
+ last mod: $Id: latticehint.c,v 1.1.2.4 2000/08/15 08:33:48 xiphmont Exp $
********************************************************************/
@@ -23,6 +23,7 @@
#include <errno.h>
#include "vorbis/codebook.h"
#include "../lib/sharedbook.h"
+#include "../lib/scales.h"
#include "bookutil.h"
#include "vqgen.h"
#include "vqsplit.h"
@@ -122,16 +123,17 @@ int main(int argc,char *argv[]){
codebook *b;
static_codebook *c;
int entries=-1,dim=-1;
- double min,del,cutoff=1.;
+ double min,del;
char *name;
long i,j;
+ long dB=0;
if(argv[1]==NULL){
fprintf(stderr,"Need a lattice book on the command line.\n");
exit(1);
}
- if(argv[2])cutoff=atof(argv[2]);
+ if(argv[2])dB=1;
{
char *ptr;
@@ -181,8 +183,19 @@ int main(int argc,char *argv[]){
/* ok, gen the map and thresholds */
for(i=0;i<quantvals;i++)t->quantmap[i]=quantsort[i]-c->quantlist;
- for(i=0;i<quantvals-1;i++)
- t->quantthresh[i]=(*(quantsort[i])+*(quantsort[i+1]))*.5*del+min;
+ for(i=0;i<quantvals-1;i++){
+ double v1=*(quantsort[i])*del+min;
+ double v2=*(quantsort[i+1])*del+min;
+ if(dB){
+ if(fabs(v1)<.01)v1=(v1+v2)*.5;
+ if(fabs(v2)<.01)v2=(v1+v2)*.5;
+ t->quantthresh[i]=fromdB((todB(v1)+todB(v2))*.5);
+ if(v1<0 || v2<0)t->quantthresh[i]*=-1;
+
+ }else{
+ t->quantthresh[i]=(v1+v2)*.5;
+ }
+ }
}
/* Do we want to gen a pigeonhole hint? */
@@ -215,7 +228,7 @@ int main(int argc,char *argv[]){
/* find our pigeonhole-specific quantization values, fill in the
quant value->pigeonhole map */
- factor=2;
+ factor=3;
p->del=del;
p->min=min;
p->quantvals=quantvals;
diff --git a/vq/latticetune.c b/vq/latticetune.c
new file mode 100644
index 00000000..5b5b2424
--- /dev/null
+++ b/vq/latticetune.c
@@ -0,0 +1,156 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: utility main for setting entropy encoding parameters
+ for lattice codebooks
+ last mod: $Id: latticetune.c,v 1.1.2.1 2000/08/15 08:33:48 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "vorbis/codebook.h"
+#include "../lib/sharedbook.h"
+#include "bookutil.h"
+
+/* This util takes a training-collected file listing codewords used in
+ LSP fitting, then generates new codeword lengths for maximally
+ efficient integer-bits entropy encoding.
+
+ command line:
+ latticetune book.vqh input.vqd [unused_entriesp]
+
+ latticetune produces book.vqh on stdout */
+
+int main(int argc,char *argv[]){
+ codebook *b;
+ static_codebook *c;
+ long *lengths;
+ long *hits;
+
+ int entries=-1,dim=-1,guard=1;
+ FILE *in=NULL;
+ char *line,*name;
+ long j;
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Need a lattice codebook on the command line.\n");
+ exit(1);
+ }
+ if(argv[2]==NULL){
+ fprintf(stderr,"Need a codeword data file on the command line.\n");
+ exit(1);
+ }
+ if(argv[3]!=NULL)guard=0;
+
+ {
+ char *ptr;
+ char *filename=strdup(argv[1]);
+
+ b=codebook_load(filename);
+ c=(static_codebook *)(b->c);
+
+ ptr=strrchr(filename,'.');
+ if(ptr){
+ *ptr='\0';
+ name=strdup(filename);
+ }else{
+ name=strdup(filename);
+ }
+ }
+
+ if(c->maptype!=1){
+ fprintf(stderr,"Provided book is not a latticebook.\n");
+ exit(1);
+ }
+
+ entries=b->entries;
+ dim=b->dim;
+
+ hits=malloc(entries*sizeof(long));
+ lengths=calloc(entries,sizeof(long));
+ for(j=0;j<entries;j++)hits[j]=guard;
+
+ in=fopen(argv[2],"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",argv[2]);
+ exit(1);
+ }
+
+ if(!strcmp(argv[0],"latticetune")){
+ long lines=0;
+ line=setup_line(in);
+ while(line){
+ long code;
+ lines++;
+ if(!(lines&0xfff))spinnit("codewords so far...",lines);
+
+ if(sscanf(line,"%ld",&code)==1)
+ hits[code]++;
+
+ line=setup_line(in);
+ }
+ }
+
+ if(!strcmp(argv[0],"restune")){
+ long step;
+ long lines=0;
+ long cols=-1;
+ double *vec;
+ line=setup_line(in);
+ while(line){
+ int code;
+ if(!(lines&0xfff))spinnit("codewords so far...",lines);
+
+ if(cols==-1){
+ char *temp=line;
+ while(*temp==' ')temp++;
+ for(cols=0;*temp;cols++){
+ while(*temp>32)temp++;
+ while(*temp==' ')temp++;
+ }
+ vec=alloca(sizeof(double)*cols);
+ step=cols/dim;
+ }
+
+ for(j=0;j<cols;j++)
+ if(get_line_value(in,vec+j)){
+ fprintf(stderr,"Too few columns on line %ld in data file\n",lines);
+ exit(1);
+ }
+
+ for(j=0;j<step;j++){
+ lines++;
+ code=_best(b,vec+j,step);
+ hits[code]++;
+ }
+
+ line=setup_line(in);
+ }
+ }
+
+ fclose(in);
+
+ /* build the codeword lengths */
+ build_tree_from_lengths0(entries,hits,lengths);
+
+ c->lengthlist=lengths;
+ write_codebook(stdout,name,c);
+
+ fprintf(stderr,"\r "
+ "\nDone.\n");
+ exit(0);
+}
diff --git a/vq/residuesplit.c b/vq/residuesplit.c
new file mode 100644
index 00000000..126261f4
--- /dev/null
+++ b/vq/residuesplit.c
@@ -0,0 +1,240 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: residue backend 0 partitioner/classifier
+ last mod: $Id: residuesplit.c,v 1.3.4.1 2000/08/15 08:33:35 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+#include "../vq/bookutil.h"
+#include "../lib/sharedbook.h"
+
+/* does not guard against invalid settings; eg, a subn of 16 and a
+ subgroup request of 32. Max subn of 128 */
+static void _testhack(double *vec,int n,double *entropy){
+ int i,j=0;
+ double max=0.;
+ double temp[128];
+
+ /* setup */
+ for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
+
+ /* handle case subgrp==1 outside */
+ for(i=0;i<n;i++)
+ if(temp[i]>max)max=temp[i];
+
+ for(i=0;i<n;i++)temp[i]=rint(temp[i]);
+
+ while(1){
+ entropy[j]=max;
+ n>>=1;
+ j++;
+
+ if(n<=0)break;
+ for(i=0;i<n;i++){
+ temp[i]+=temp[i+n];
+ }
+ max=0.;
+ for(i=0;i<n;i++)
+ if(temp[i]>max)max=temp[i];
+ }
+}
+
+static FILE *of;
+static FILE **or;
+
+/* we evaluate the the entropy measure for each interleaved subgroup */
+/* This is currently a bit specific to/hardwired for mapping 0; things
+ will need to change in the future when we get real multichannel
+ mappings */
+int quantaux(double *res,int n,double *ebound,double *mbound,int *subgrp,int parts, int subn){
+ long i,j;
+ double entropy[8];
+ int aux;
+
+ for(i=0;i<=n-subn;i+=subn){
+ double max=0.;
+
+ _testhack(res+i,subn,entropy);
+ for(j=0;j<subn;j++)
+ if(fabs(res[i+j])>max)max=fabs(res[i+j]);
+
+ for(j=0;j<parts-1;j++)
+ if(entropy[subgrp[j]]<=ebound[j] &&
+ max<=mbound[j])
+ break;
+ aux=j;
+
+ fprintf(of,"%d, ",aux);
+
+ for(j=0;j<subn;j++)
+ fprintf(or[aux],"%g, ",res[j+i]);
+
+ fprintf(or[aux],"\n");
+ }
+
+ fprintf(of,"\n");
+
+ return(0);
+}
+
+static int getline(FILE *in,double *vec,int begin,int n){
+ int i,next=0;
+
+ reset_next_value();
+ if(get_next_value(in,vec))return(0);
+ if(begin){
+ for(i=1;i<begin;i++)
+ get_line_value(in,vec);
+ next=0;
+ }else{
+ next=1;
+ }
+
+ for(i=next;i<n;i++)
+ if(get_line_value(in,vec+i)){
+ fprintf(stderr,"ran out of columns in input data\n");
+ exit(1);
+ }
+
+ return(1);
+}
+
+static void usage(){
+ fprintf(stderr,
+ "usage:\n"
+ "residuesplit <res> <begin,n,group> <baseout> <ent,peak,sub> [<ent,peak,sub>]...\n"
+ " where begin,n,group is first scalar, \n"
+ " number of scalars of each in line,\n"
+ " number of scalars in a group\n"
+ " ent is the maximum entropy value allowed for membership in a group\n"
+ " peak is the maximum amplitude value allowed for membership in a group\n"
+ " subn is the maximum entropy value allowed for membership in a group\n"
+
+ "eg: residuesplit mask.vqd floor.vqd 0,1024,16 res 0,.5,16 3,1.5,8 \n"
+ "produces resaux.vqd and res_0...n.vqd\n\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[]){
+ char *buffer;
+ char *base;
+ int i,parts,begin,n,subn,*subgrp;
+ FILE *res;
+ double *ebound,*mbound,*vec;
+ long c=0;
+ if(argc<5)usage();
+
+ base=strdup(argv[3]);
+ buffer=alloca(strlen(base)+20);
+ {
+ char *pos=strchr(argv[2],',');
+ begin=atoi(argv[2]);
+ if(!pos)
+ usage();
+ else
+ n=atoi(pos+1);
+ pos=strchr(pos+1,',');
+ if(!pos)
+ usage();
+ else
+ subn=atoi(pos+1);
+ if(n/subn*subn != n){
+ fprintf(stderr,"n must be divisible by group\n");
+ exit(1);
+ }
+ }
+
+ /* how many parts?... */
+ parts=argc-3;
+
+ ebound=malloc(sizeof(double)*parts);
+ mbound=malloc(sizeof(double)*parts);
+ subgrp=malloc(sizeof(int)*parts);
+
+ for(i=0;i<parts-1;i++){
+ char *pos=strchr(argv[4+i],',');
+ if(*argv[4+i]==',')
+ ebound[i]=1e50;
+ else
+ ebound[i]=atof(argv[4+i]);
+
+ if(!pos){
+ mbound[i]=1e50;
+ subgrp[i]=_ilog(subn)-1;
+ }else{
+ if(*(pos+1)==',')
+ mbound[i]=1e50;
+ else
+ mbound[i]=atof(pos+1);
+ pos=strchr(pos+1,',');
+
+ if(!pos){
+ subgrp[i]=_ilog(subn)-1;
+ }else{
+ subgrp[i]=_ilog(atoi(pos+1))-1;
+ }
+ }
+ }
+
+ ebound[i]=1e50;
+ mbound[i]=1e50;
+ subgrp[i]=_ilog(subn)-1;
+
+ res=fopen(argv[1],"r");
+ if(!res){
+ fprintf(stderr,"Could not open file %s\n",argv[1]);
+ exit(1);
+ }
+
+ or=alloca(parts*sizeof(FILE*));
+ sprintf(buffer,"%saux.vqd",base);
+ of=fopen(buffer,"w");
+ if(!of){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+ for(i=0;i<parts;i++){
+ sprintf(buffer,"%s_%d.vqd",base,i);
+ or[i]=fopen(buffer,"w");
+ if(!or[i]){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+ }
+
+ vec=malloc(sizeof(double)*n);
+ /* get the input line by line and process it */
+ while(!feof(res)){
+ if(getline(res,vec,begin,n))
+ quantaux(vec,n,ebound,mbound,subgrp,parts,subn);
+ c++;
+ if(!(c&0xf)){
+ spinnit("kB so far...",(int)(ftell(res)/1024));
+ }
+ }
+ fclose(res);
+ fclose(of);
+ for(i=0;i<parts;i++)
+ fclose(or[i]);
+ fprintf(stderr,"\rDone \n");
+ return(0);
+}
+
+
+
+