summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-08-31 09:00:03 +0000
committerMonty <xiphmont@xiph.org>2000-08-31 09:00:03 +0000
commite7fc3692934bb45e2acf33e41193a6db17a14bad (patch)
tree9a21df4c37c728397d216e93a58d777445d12152
parent039bc284b20be003d7a46abc9040e16ebcd739b1 (diff)
downloadlibvorbis-git-e7fc3692934bb45e2acf33e41193a6db17a14bad.tar.gz
take the whole sourcebase to float (minus a few return types where
double is needed for bits). Not tested, and I know there's an encode issue with CACM283 in lsp.c removed the cmdline dir. obsolete. Monty svn path=/branches/branch_postbeta2/vorbis/; revision=612
-rw-r--r--Makefile.in33
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
-rw-r--r--examples/decoder_example.c10
-rw-r--r--examples/encoder_example.c187
-rw-r--r--include/vorbis/backends.h139
-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_160_1.vqh63
-rw-r--r--include/vorbis/book/res0_1024a_160_2.vqh63
-rw-r--r--include/vorbis/book/res0_1024a_160_3.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_160_4.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_160_5.vqh212
-rw-r--r--include/vorbis/book/res0_1024a_160_6.vqh212
-rw-r--r--include/vorbis/book/res0_1024a_160_7.vqh75
-rw-r--r--include/vorbis/book/res0_1024a_160_8.vqh86
-rw-r--r--include/vorbis/book/res0_1024a_160_9.vqh115
-rw-r--r--include/vorbis/book/res0_1024a_192_1.vqh63
-rw-r--r--include/vorbis/book/res0_1024a_192_2.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_192_3.vqh212
-rw-r--r--include/vorbis/book/res0_1024a_192_4.vqh70
-rw-r--r--include/vorbis/book/res0_1024a_192_5.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_1024a_350_1.vqh99
-rw-r--r--include/vorbis/book/res0_1024a_350_2.vqh75
-rw-r--r--include/vorbis/book/res0_1024a_350_3.vqh86
-rw-r--r--include/vorbis/book/res0_1024a_350_4.vqh100
-rw-r--r--include/vorbis/book/res0_1024a_350_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_160_1.vqh63
-rw-r--r--include/vorbis/book/res0_128a_160_2.vqh99
-rw-r--r--include/vorbis/book/res0_128a_160_3.vqh212
-rw-r--r--include/vorbis/book/res0_128a_160_4.vqh70
-rw-r--r--include/vorbis/book/res0_128a_160_5.vqh115
-rw-r--r--include/vorbis/book/res0_128a_192_1.vqh63
-rw-r--r--include/vorbis/book/res0_128a_192_2.vqh99
-rw-r--r--include/vorbis/book/res0_128a_192_3.vqh212
-rw-r--r--include/vorbis/book/res0_128a_192_4.vqh70
-rw-r--r--include/vorbis/book/res0_128a_192_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/res0_128a_350_1.vqh99
-rw-r--r--include/vorbis/book/res0_128a_350_2.vqh75
-rw-r--r--include/vorbis/book/res0_128a_350_3.vqh86
-rw-r--r--include/vorbis/book/res0_128a_350_4.vqh100
-rw-r--r--include/vorbis/book/res0_128a_350_5.vqh133
-rw-r--r--include/vorbis/codebook.h118
-rw-r--r--include/vorbis/codec.h38
-rw-r--r--include/vorbis/vorbisfile.h2
-rw-r--r--lib/analysis.c105
-rw-r--r--lib/block.c728
-rw-r--r--lib/bookinternal.h39
-rw-r--r--lib/codebook.c498
-rw-r--r--lib/envelope.c42
-rw-r--r--lib/envelope.h49
-rw-r--r--lib/floor0.c54
-rw-r--r--lib/framing.c2
-rw-r--r--lib/iir.c302
-rw-r--r--lib/iir.h37
-rw-r--r--lib/lpc.c195
-rw-r--r--lib/lpc.h45
-rw-r--r--lib/lsp.c146
-rw-r--r--lib/lsp.h28
-rw-r--r--lib/mapping0.c381
-rw-r--r--lib/masking.h244
-rw-r--r--lib/mdct.c329
-rw-r--r--lib/mdct.h50
-rw-r--r--lib/misc.h44
-rw-r--r--lib/psy.c276
-rw-r--r--lib/psy.h52
-rw-r--r--lib/psytune.c368
-rw-r--r--lib/res0.c388
-rw-r--r--lib/sharedbook.c74
-rw-r--r--lib/sharedbook.h43
-rw-r--r--lib/smallft.c1255
-rw-r--r--lib/smallft.h35
-rw-r--r--lib/synthesis.c74
-rw-r--r--lib/time0.c51
-rw-r--r--lib/vorbisfile.c10
-rw-r--r--lib/window.c63
-rw-r--r--lib/window.h25
-rw-r--r--vq/bookutil.c742
-rw-r--r--vq/bookutil.h44
-rw-r--r--vq/build.c198
-rw-r--r--vq/cascade.c94
-rw-r--r--vq/genericdata.c62
-rw-r--r--vq/latticebuild.c174
-rw-r--r--vq/latticehint.c418
-rw-r--r--vq/latticepare.c598
-rw-r--r--vq/latticetune.c156
-rw-r--r--vq/lspdata.c160
-rw-r--r--vq/metrics.c298
-rw-r--r--vq/residuedata.c162
-rw-r--r--vq/residuesplit.c240
-rw-r--r--vq/run.c217
-rw-r--r--vq/train.c362
-rw-r--r--vq/vqext.h35
-rw-r--r--vq/vqgen.c570
-rw-r--r--vq/vqgen.h86
-rw-r--r--vq/vqsplit.c614
-rw-r--r--vq/vqsplit.h38
119 files changed, 17833 insertions, 258 deletions
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 00000000..5db761bc
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,33 @@
+# vorbis makefile configured for use with gcc on any platform
+
+# $Id: Makefile.in,v 1.11.2.1 2000/08/31 08:59:58 xiphmont Exp $
+
+###############################################################################
+# #
+# To build a production vorbis (preferrably using gmake), just type 'make'. #
+# To build with debugging or profiling information, use 'make debug' or #
+# 'make profile' respectively. 'make clean' is a good idea between builds #
+# with different target names, or before a final build. #
+# #
+###############################################################################
+
+
+# DO NOT EDIT BELOW! ##########################################################
+# (unless, of course, you know what you are doing :) ##########################
+
+@SET_MAKE@
+
+SUBDIRS = lib examples # vorbis-tools xmms vq huff kmpg
+
+# configure changes items in these, so get distclean to remove them.
+DCLEAN_DIRS = vorbis-tools xmms vq huff kmpg
+
+all debug profile selftest target clean:
+ echo $(MAKECMDGOALS)
+ @for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $(MFLAGS) $(MAKECMDGOALS)) || exit 1; done
+ -rm -f *~
+
+distclean:
+ @for dir in $(SUBDIRS) $(DCLEAN_DIRS); do (cd $$dir && $(MAKE) $(MFLAGS) $(MAKECMDGOALS)) || exit 1; done
+ -rm -f Makefile config.*
+
diff --git a/configure b/configure
index d6aedd33..36214655 100755
--- a/configure
+++ b/configure
@@ -2282,7 +2282,7 @@ ac_given_srcdir=$srcdir
trap 'rm -fr `echo "Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\
vorbis-tools/Makefile\
- vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+ vq/Makefile huff/Makefile xmms/Makefile kmpg/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2378,7 +2378,7 @@ cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\
vorbis-tools/Makefile\
- vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile"}
+ vq/Makefile huff/Makefile xmms/Makefile kmpg/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index 22b5fedc..98178cfe 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.20.2.1 2000/08/31 08:05:47 xiphmont Exp $
+# $Id: configure.in,v 1.20.2.2 2000/08/31 08:59:58 xiphmont Exp $
AC_INIT(lib/mdct.c)
#AC_CONFIG_HEADER(config.h)
@@ -354,5 +354,5 @@ AC_CONFIG_SUBDIRS(vorbis-tools/libao)
AC_OUTPUT(Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\
vorbis-tools/Makefile\
- vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
+ vq/Makefile huff/Makefile xmms/Makefile kmpg/Makefile)
diff --git a/examples/decoder_example.c b/examples/decoder_example.c
index 9d81fc7f..eefdb100 100644
--- a/examples/decoder_example.c
+++ b/examples/decoder_example.c
@@ -12,7 +12,7 @@
********************************************************************
function: simple example decoder
- last mod: $Id: decoder_example.c,v 1.11.2.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: decoder_example.c,v 1.11.2.2 2000/08/31 08:59:58 xiphmont Exp $
********************************************************************/
@@ -216,14 +216,14 @@ int main(int argc, char **argv){
/* no reason to complain; already complained above */
}else{
/* we have a packet. Decode it */
- double **pcm;
+ float **pcm;
int samples;
if(vorbis_synthesis(&vb,&op)==0) /* test for success! */
vorbis_synthesis_blockin(&vd,&vb);
/*
- **pcm is a multichannel double vector. In stereo, for
+ **pcm is a multichannel float vector. In stereo, for
example, pcm[0] is left, and pcm[1] is right. samples is
the size of each channel. Convert the float values
(-1.<=range<=1.) to whatever PCM format and write it out */
@@ -233,11 +233,11 @@ int main(int argc, char **argv){
int clipflag=0;
int bout=(samples<convsize?samples:convsize);
- /* convert doubles to 16 bit signed ints (host order) and
+ /* convert floats to 16 bit signed ints (host order) and
interleave */
for(i=0;i<vi.channels;i++){
ogg_int16_t *ptr=convbuffer+i;
- double *mono=pcm[i];
+ float *mono=pcm[i];
for(j=0;j<bout;j++){
int val=mono[j]*32767.;
/* might as well guard against clipping */
diff --git a/examples/encoder_example.c b/examples/encoder_example.c
new file mode 100644
index 00000000..8cc892f5
--- /dev/null
+++ b/examples/encoder_example.c
@@ -0,0 +1,187 @@
+/********************************************************************
+ * *
+ * 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.13.2.1 2000/08/31 08:59:58 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_C.h"
+
+#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+#if defined(macintosh) && defined(__MWERKS__)
+#include <console.h> /* CodeWarrior's Mac "command-line" support */
+#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;
+
+#if defined(macintosh) && defined(__MWERKS__)
+ int argc = 0;
+ char **argv = NULL;
+ argc = ccommand(&argv); /* get a "command line" from the Mac user */
+ /* this also lets the user set stdin and stdout */
+#endif
+
+ /* 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_C;
+
+ /* 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 */
+ float **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/backends.h b/include/vorbis/backends.h
new file mode 100644
index 00000000..efd7a66e
--- /dev/null
+++ b/include/vorbis/backends.h
@@ -0,0 +1,139 @@
+/********************************************************************
+ * *
+ * 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: libvorbis backend and mapping structures; needed for
+ static mode headers
+ last mod: $Id: backends.h,v 1.11.4.1 2000/08/31 08:59:58 xiphmont Exp $
+
+ ********************************************************************/
+
+/* this is exposed up here because we need it for static modes.
+ Lookups for each backend aren't exposed because there's no reason
+ to do so */
+
+#ifndef _vorbis_time_backend_h_
+#define _vorbis_time_backend_h_
+
+/* this would all be simpler/shorter with templates, but.... */
+/* Transform backend generic *************************************/
+
+/* only mdct right now. Flesh it out more if we ever transcend mdct
+ in the transform domain */
+
+/* Time backend generic ******************************************/
+typedef struct{
+ void (*pack) (vorbis_info_time *,oggpack_buffer *);
+ vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_time *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
+ vorbis_info_time *);
+ void (*free_info) (vorbis_info_time *);
+ void (*free_look) (vorbis_look_time *);
+ int (*forward) (struct vorbis_block *,vorbis_look_time *,
+ float *,float *);
+ int (*inverse) (struct vorbis_block *,vorbis_look_time *,
+ float *,float *);
+} vorbis_func_time;
+
+typedef struct{
+ int dummy;
+} vorbis_info_time0;
+
+/* Floor backend generic *****************************************/
+typedef struct{
+ void (*pack) (vorbis_info_floor *,oggpack_buffer *);
+ vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
+ vorbis_info_floor *);
+ void (*free_info) (vorbis_info_floor *);
+ void (*free_look) (vorbis_look_floor *);
+ int (*forward) (struct vorbis_block *,vorbis_look_floor *,
+ float *,float *);
+ int (*inverse) (struct vorbis_block *,vorbis_look_floor *,
+ float *);
+} vorbis_func_floor;
+
+typedef struct{
+ int order;
+ long rate;
+ long barkmap;
+
+ int ampbits;
+ int ampdB;
+
+ int numbooks; /* <= 16 */
+ int books[16];
+} vorbis_info_floor0;
+
+/* Residue backend generic *****************************************/
+typedef struct{
+ void (*pack) (vorbis_info_residue *,oggpack_buffer *);
+ vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
+ vorbis_info_residue *);
+ void (*free_info) (vorbis_info_residue *);
+ void (*free_look) (vorbis_look_residue *);
+ int (*forward) (struct vorbis_block *,vorbis_look_residue *,
+ float **,int);
+ int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
+ float **,int);
+} vorbis_func_residue;
+
+typedef struct vorbis_info_residue0{
+/* block-partitioned VQ coded straight residue */
+ long begin;
+ long end;
+
+ /* first stage (lossless partitioning) */
+ int grouping; /* group n vectors per partition */
+ int partitions; /* possible codebooks for a partition */
+ int groupbook; /* huffbook for partitioning */
+ int secondstages[64]; /* expanded out to pointers in lookup */
+ int booklist[256]; /* list of second stage books */
+
+ /* encode-only heuristic settings */
+ float entmax[64]; /* book entropy threshholds*/
+ float ampmax[64]; /* book amp threshholds*/
+ int subgrp[64]; /* book heuristic subgroup size */
+ int blimit[64]; /* subgroup position limits */
+
+} vorbis_info_residue0;
+
+/* Mapping backend generic *****************************************/
+typedef struct{
+ void (*pack) (vorbis_info *,vorbis_info_mapping *,
+ oggpack_buffer *);
+ vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
+ vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
+ vorbis_info_mapping *);
+ void (*free_info) (vorbis_info_mapping *);
+ void (*free_look) (vorbis_look_mapping *);
+ int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *);
+ int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
+} vorbis_func_mapping;
+
+typedef struct vorbis_info_mapping0{
+ int submaps; /* <= 16 */
+ int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
+
+ int timesubmap[16]; /* [mux] */
+ int floorsubmap[16]; /* [mux] submap to floors */
+ int residuesubmap[16]; /* [mux] submap to residue */
+ int psysubmap[16]; /* [mux]; encode only */
+} vorbis_info_mapping0;
+
+#endif
+
+
+
+
+
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..5c5929fb
--- /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 float _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..fce8c60a
--- /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 float _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..87d9ef86
--- /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 float _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..e4b49a58
--- /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 float _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..61a9f6ee
--- /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 float _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..28fc5275
--- /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 float _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..caf231a9
--- /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 float _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..cf1f6801
--- /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 float _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..f3a3de94
--- /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 float _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_160_1.vqh b/include/vorbis/book/res0_1024a_160_1.vqh
new file mode 100644
index 00000000..25231909
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_1_VQH_
+#define _V_res0_1024a_160_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_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,15,15,11,15,15, 8,11,11,
+ 11,15,15,12,15,15, 5, 8, 8, 8,11,11, 8,11,11, 8,
+ 11,11,11,15,15,11,15,15, 8,11,11,12,15,15,11,15,
+ 15,
+};
+
+static float _vq_quantthresh_res0_1024a_160_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_1 = {
+ _vq_quantthresh_res0_1024a_160_1,
+ _vq_quantmap_res0_1024a_160_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_1024a_160_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_1024a_160_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_1024a_160_1,
+ NULL,
+ &_vq_auxt_res0_1024a_160_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_2.vqh b/include/vorbis/book/res0_1024a_160_2.vqh
new file mode 100644
index 00000000..52d70eb6
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_2_VQH_
+#define _V_res0_1024a_160_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_2[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_2[] = {
+ 3, 4, 5, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 7, 6,
+ 7, 8, 5, 6, 6, 6, 7, 7, 6, 7, 7, 5, 6, 6, 6, 8,
+ 8, 6, 7, 7, 6, 8, 7, 7, 9, 9, 8, 9, 9, 6, 8, 8,
+ 7, 9, 9, 8, 9, 9, 5, 6, 6, 6, 7, 7, 6, 8, 8, 6,
+ 8, 8, 8, 9, 9, 8, 9, 9, 6, 7, 8, 8, 9, 9, 7, 9,
+ 9,
+};
+
+static float _vq_quantthresh_res0_1024a_160_2[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_2[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_2 = {
+ _vq_quantthresh_res0_1024a_160_2,
+ _vq_quantmap_res0_1024a_160_2,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_1024a_160_2 = {
+ 4, 81,
+ _vq_lengthlist_res0_1024a_160_2,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_1024a_160_2,
+ NULL,
+ &_vq_auxt_res0_1024a_160_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_3.vqh b/include/vorbis/book/res0_1024a_160_3.vqh
new file mode 100644
index 00000000..33f699ef
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_3_VQH_
+#define _V_res0_1024a_160_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_3[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_3[] = {
+ 2, 5, 7, 5, 7, 5, 6, 9, 7, 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, 8,11,10,11,14,
+ 11,15, 7, 9,13, 9,13, 9,12,15,11,15,13,15,18,15,
+ 18,10,11,15,12,15,13,16,19,16,18, 5, 7, 9, 7, 9,
+ 7, 8,11, 8,11,10,11,15,11,15, 7, 9,11, 8,11,10,
+ 11,15,11,15, 7, 9,13, 9,13,10,11,15,11,15,13,16,
+ 18,15,18,10,11,15,12,15,13,15,19,15,18, 5, 7, 9,
+ 7, 9, 7, 8,11, 9,11, 9,11,15,11,15, 7, 9,11, 9,
+ 11, 9,11,15,11,15, 7, 9,11, 9,11, 8,10,13,10,13,
+ 11,13,17,13,17, 9,11,13,10,13,12,14,18,13,17, 9,
+ 11,15,12,15,11,13,17,13,17,15,17,19,18, 0,12,14,
+ 18,13,17,16,17, 0,18,20, 7, 9,11, 9,11, 9,10,13,
+ 10,13,11,13,18,13,16, 9,11,13,11,13,11,13,19,13,
+ 17, 9,11,15,12,15,12,14,17,13,18,15,17,20,17,19,
+ 12,13,17,14,17,16,18,19,18, 0, 7, 9,13, 9,13, 9,
+ 12,15,11,15,13,16, 0,15,19, 9,12,15,12,15,13,15,
+ 19,15,20, 9,11,16,11,15,11,13,18,13,19,15,17, 0,
+ 17, 0,11,14,18,14,17,15,17, 0,17, 0,13,15,20,15,
+ 19,15,18,19,17,20,19,19, 0,20, 0,15,18,19,18,20,
+ 18, 0, 0, 0,20, 9,12,15,11,15,11,13,18,13,16,15,
+ 18, 0,17, 0,12,13,18,14,18,16,17, 0,17, 0,13,16,
+ 18,15,19,15,18, 0,18, 0,18, 0, 0,20, 0,16,18, 0,
+ 19, 0,19, 0, 0,20, 0, 5, 7, 9, 7, 9, 7, 8,11, 9,
+ 11, 9,11,15,12,15, 7, 9,11, 9,11, 9,12,15,11,15,
+ 7, 9,11, 9,11, 9,10,13,10,13,11,13,17,13,17, 9,
+ 10,13,11,13,11,13,17,14,18, 9,12,16,12,15,12,14,
+ 17,13,18,15,18, 0,17, 0,12,13,18,14,17,15,17, 0,
+ 17,20, 7, 9,11, 9,11, 9,10,13,11,13,12,13,17,14,
+ 17, 9,11,13,10,13,12,13,17,13,16,10,11,15,12,16,
+ 12,14,17,14,17,15,18,20,18, 0,11,14,17,14,18,16,
+ 18,20,17,20, 7, 9,13,10,13, 9,11,15,11,15,13,15,
+ 19,15, 0, 9,11,16,12,16,13,16, 0,16,18, 9,11,15,
+ 11,16,11,13,18,13,18,16,18, 0,17, 0,11,13,17,14,
+ 17,15,18,20,17, 0,13,16,20,16,18,15,19, 0,18, 0,
+ 19, 0, 0, 0, 0,15,17,20,16, 0,19,19, 0,20, 0, 9,
+ 11,15,11,16,11,13,17,14,19,16,17,20,18, 0,11,14,
+ 17,13,17,15,17,20,18,20,13,15,18,16,20,15,17, 0,
+ 18, 0, 0,20, 0, 0, 0,15,18, 0,17,19,19,20, 0,20,
+ 20,
+};
+
+static float _vq_quantthresh_res0_1024a_160_3[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_3[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_3 = {
+ _vq_quantthresh_res0_1024a_160_3,
+ _vq_quantmap_res0_1024a_160_3,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_160_3 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_160_3,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_160_3,
+ NULL,
+ &_vq_auxt_res0_1024a_160_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_4.vqh b/include/vorbis/book/res0_1024a_160_4.vqh
new file mode 100644
index 00000000..fd616551
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_4_VQH_
+#define _V_res0_1024a_160_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_4[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_4[] = {
+ 6, 6, 8, 6, 8, 6, 7, 9, 7, 9, 8, 9,11, 9,11, 6,
+ 7, 9, 7, 9, 8, 9,11, 9,11, 6, 7, 9, 7, 9, 7, 7,
+ 9, 7, 9, 9, 9,11,10,12, 7, 7, 9, 7, 9, 9,10,11,
+ 10,12, 8, 9,11, 9,11, 9,10,12,10,12,11,12,14,12,
+ 14, 9,10,12,10,12,11,12,14,12,14, 6, 7, 9, 7, 9,
+ 7, 7, 9, 7, 9, 9,10,12, 9,11, 7, 7,10, 7, 9, 9,
+ 10,12, 9,11, 8, 9,11, 9,11, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,11,12,14,12,13, 6, 7, 9,
+ 7, 9, 7, 7, 9, 7,10, 9,10,12,10,12, 7, 7, 9, 7,
+ 10, 9,10,12,10,12, 7, 7,10, 7, 9, 7, 8,10, 8,10,
+ 10,10,12,10,12, 7, 8,10, 8,10,10,10,12,10,12, 9,
+ 10,12,10,12, 9,10,12,10,13,12,12,14,12,14,10,10,
+ 12,10,12,12,12,14,12,14, 7, 7, 9, 7,10, 7, 8,10,
+ 8,10,10,10,12,10,12, 7, 8,10, 8,10,10,10,12,10,
+ 12, 9,10,12,10,12,10,10,12,10,12,12,12,14,12,14,
+ 10,10,12,10,13,12,13,14,13,14, 8, 9,11, 9,11, 9,
+ 10,12,10,12,11,12,14,12,14, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,10,10,12,10,12,12,12,14,
+ 13,15,10,10,12,10,12,12,13,14,13,14,11,12,14,12,
+ 14,12,12,14,12,15,14,14,16,15,16,12,12,15,12,14,
+ 14,15,17,15,16, 9,10,12,10,12,10,10,12,10,12,12,
+ 12,15,12,14,10,10,12,10,12,12,12,14,12,14,11,12,
+ 14,12,14,12,12,14,12,14,13,14,17,14,16,12,12,14,
+ 12,15,14,15,16,14,16, 6, 7, 9, 7, 9, 7, 7, 9, 7,
+ 10, 9,10,12,10,12, 7, 7,10, 7,10, 9,10,12,10,12,
+ 7, 7,10, 7,10, 7, 8,10, 8,10,10,10,12,10,12, 7,
+ 8,10, 8,10,10,10,12,10,13, 9,10,12,10,12,10,10,
+ 12,10,12,12,12,14,12,14,10,10,12,10,12,12,12,14,
+ 12,15, 7, 7,10, 7,10, 7, 8,10, 8,10,10,10,12,10,
+ 12, 7, 8,10, 8,10,10,10,12,10,12, 9,10,12,10,12,
+ 10,10,12,10,13,12,13,14,13,14,10,10,13,10,12,12,
+ 12,14,12,14, 8, 9,11, 9,11, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,11,12,14,12,14, 9,10,12,
+ 10,12,10,10,13,10,12,12,13,14,12,15,10,10,12,10,
+ 13,12,12,14,13,14,11,12,14,12,14,12,13,14,12,14,
+ 13,15,16,14,16,12,12,14,13,14,14,14,16,15,16, 9,
+ 10,12,10,12,10,10,12,10,13,12,12,14,12,15,10,10,
+ 13,10,12,12,13,15,13,14,11,12,14,12,14,12,12,14,
+ 13,15,14,14,17,15,16,12,12,14,12,14,14,14,17,14,
+ 16,
+};
+
+static float _vq_quantthresh_res0_1024a_160_4[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_4[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_4 = {
+ _vq_quantthresh_res0_1024a_160_4,
+ _vq_quantmap_res0_1024a_160_4,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_160_4 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_160_4,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_160_4,
+ NULL,
+ &_vq_auxt_res0_1024a_160_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_5.vqh b/include/vorbis/book/res0_1024a_160_5.vqh
new file mode 100644
index 00000000..0915c2cc
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_5_VQH_
+#define _V_res0_1024a_160_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_5[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_5[] = {
+ 4, 5, 7, 8, 6, 8, 8, 5, 7, 9,10, 7, 9,10, 8, 9,
+ 11,12, 9,11,12, 8,10,12,15,10,12,15, 6, 7, 9,10,
+ 7, 9,10, 8, 9,11,12, 9,11,12, 8,10,12,14,10,12,
+ 15, 6, 7, 9,10, 7, 9,10, 7, 8,10,11, 8,10,11, 9,
+ 10,12,13,10,12,14,10,11,14,16,11,14,16, 7, 8,10,
+ 11, 8,10,11, 9,10,12,13,10,13,14,10,11,14,16,11,
+ 14,17, 8, 9,11,12, 9,11,12, 9,10,13,13,10,12,14,
+ 11,12,15,16,13,15,16,13,14,15,19,14,17,20, 9,10,
+ 12,14,10,13,14,11,13,15,16,13,15,16,13,14,16,18,
+ 14,17, 0, 8,10,12,14,10,12,14,10,11,14,16,11,14,
+ 16,13,14,16,18,14,16,19,15,16,20,20,17,18, 0,10,
+ 11,14,16,11,14,16,13,14,16,18,14,16,19,16,16,20,
+ 20,17,19,20, 6, 7, 9,10, 7, 9,10, 7, 8,10,11, 8,
+ 10,11, 9,10,13,14,10,12,13,10,11,13,16,11,13,16,
+ 7, 8,10,11, 8,10,11, 9,10,13,14,10,13,14,10,11,
+ 13,16,11,14,17, 8, 9,11,12, 9,11,12, 9,10,12,14,
+ 10,13,13,12,13,15,17,13,15,16,13,14,16,19,14,16,
+ 19, 9,10,13,14,10,13,14,11,13,15,16,13,15,16,13,
+ 14,16,20,14,16,18, 8,10,12,14,10,12,14,10,11,14,
+ 16,12,14,16,13,14,16,19,14,17,20,16,16,19, 0,17,
+ 18, 0,10,12,14,16,11,14,16,13,14,16,19,14,16,19,
+ 15,16,19, 0,16, 0, 0, 6, 7, 9,10, 7, 9,10, 7, 8,
+ 10,11, 8,10,11, 9,10,13,14,10,13,14,10,11,14,16,
+ 12,14,16, 7, 8,10,11, 8,10,11, 9,10,13,14,10,12,
+ 14,10,11,14,16,11,14,17, 7, 8,10,11, 8,10,11, 8,
+ 9,11,12, 9,11,12,10,12,14,15,12,14,15,11,12,15,
+ 19,13,15,18, 8, 9,11,12, 9,11,12,10,11,14,15,12,
+ 14,15,11,13,15,18,13,15,18, 9,10,13,14,10,13,14,
+ 10,12,14,15,12,14,15,13,14,16,17,14,17,17,14,15,
+ 17,20,15,18,20,10,11,14,15,12,14,15,13,14,17,20,
+ 14,16,18,14,15,17,20,15,18, 0,10,12,14,16,12,14,
+ 16,11,13,16,18,13,15,18,14,15,16,19,15,17,20,16,
+ 17,20,20,20, 0, 0,11,13,15,19,13,16,17,14,15,18,
+ 19,15,17,19,16,18, 0, 0,17,18, 0, 7, 8,10,11, 8,
+ 10,11, 8, 9,12,12, 9,11,12,10,12,14,15,11,14,15,
+ 11,13,15,17,12,15,18, 8, 9,11,12, 9,12,13,10,12,
+ 14,15,11,14,15,11,13,15,18,13,16,19, 9,10,13,14,
+ 10,13,14,10,12,14,15,11,14,15,13,14,16,17,14,16,
+ 17,14,15,18, 0,15,16, 0,10,12,14,15,12,14,15,13,
+ 14,17,17,14,17,17,14,15,18,20,15,18, 0,10,12,14,
+ 16,12,14,16,11,13,15,18,13,15,18,14,15,17,19,15,
+ 17, 0,17,18,20, 0,18,19, 0,11,13,15,17,13,16,18,
+ 14,15,18,20,15,17, 0,17,17, 0, 0,18,20, 0, 8, 9,
+ 11,12, 9,11,12, 9,10,13,14,10,13,14,11,13,15,17,
+ 13,15,16,12,14,16,18,14,16,20, 9,10,13,14,10,13,
+ 14,11,13,15,17,13,16,16,12,14,17,18,14,16,20, 9,
+ 10,13,14,10,13,14,10,11,14,15,12,14,14,13,14,17,
+ 18,14,17,17,14,15,17,20,15,18, 0,10,12,14,15,12,
+ 14,15,13,14,17,18,14,17,18,14,15,18, 0,15,18, 0,
+ 11,13,15,16,13,15,16,13,14,16,19,14,16,18,15,16,
+ 19,19,16,19,20,16,17,18,20,17,19, 0,13,14,16,17,
+ 14,17,17,15,17,18, 0,17,19, 0,17,18, 0, 0,17,19,
+ 20,12,14,16,18,14,16,19,14,15,17,18,15,18, 0,16,
+ 17,20, 0,18, 0, 0,18,20,20, 0, 0, 0, 0,14,16,18,
+ 0,15,18, 0,16,18,19, 0,18,18, 0,19,20,20, 0, 0,
+ 0, 0, 9,10,13,13,10,13,14,10,12,14,15,12,14,15,
+ 13,14,17,18,14,17,18,14,16,18,20,15,18, 0,10,12,
+ 14,15,12,14,15,13,14,16,18,14,17,18,14,15,18,19,
+ 15,17,19,11,13,15,16,13,15,16,12,14,17,18,14,17,
+ 17,15,16,18,19,16,20,20,16,18,20, 0,18,19, 0,13,
+ 14,16,18,14,17,18,15,17,18,19,16,18,19,17,18,20,
+ 0,18,19, 0,13,14,16,19,14,17,18,14,15,17, 0,15,
+ 18,20,16,17,19, 0,16,20, 0,19,20, 0, 0,20, 0, 0,
+ 14,15,17, 0,15,18, 0,16,19,19, 0,19, 0, 0,18, 0,
+ 0, 0,20, 0, 0, 8,10,12,14,10,12,14,10,12,14,16,
+ 12,14,17,12,14,17,20,14,16,20,14,16,20, 0,16,20,
+ 0,10,12,14,16,11,14,16,12,14,16,18,14,17,19,14,
+ 17,19, 0,16,18, 0,10,11,14,16,11,14,17,11,13,15,
+ 17,13,16,19,14,15,18, 0,15,18,20,17,18,20, 0,19,
+ 20, 0,11,13,15,18,13,15,17,14,16,18, 0,15,18,20,
+ 17,18, 0, 0,18,19, 0,12,14,16,18,14,16,18,13,15,
+ 17, 0,15,18,20,16,16, 0, 0,17,19, 0,20,19, 0, 0,
+ 0, 0, 0,14,15,18, 0,15,18, 0,16,18,20, 0,18,20,
+ 0,19, 0, 0, 0,20,20,20,15,16,19,20,17,19,20,16,
+ 18,20, 0,17,20, 0,18, 0, 0, 0,20, 0, 0,20, 0, 0,
+ 0, 0, 0, 0,17,17, 0, 0,18,20, 0, 0, 0,20, 0, 0,
+ 0, 0, 0, 0, 0, 0,20, 0, 0,10,11,14,16,11,14,16,
+ 11,13,15,18,13,15,17,14,15,17,20,16,18, 0,17,18,
+ 0, 0,17,19, 0,11,13,15,18,13,15,18,14,15,17, 0,
+ 16,17,20,16,18, 0,20,19,20, 0,13,14,17,19,14,16,
+ 18,14,15,17,20,15,18,19,16,17,18, 0,17, 0,20,19,
+ 0,20, 0,20,20, 0,14,15,18, 0,15,17,20,16,18,19,
+ 0,18,20, 0,18,20, 0, 0,19, 0, 0,15,17,19, 0,17,
+ 18, 0,16,19,19, 0,17, 0, 0,18,20, 0, 0,20, 0, 0,
+ 0, 0, 0, 0,19, 0, 0,17,19,20, 0,18,19, 0,20, 0,
+ 0, 0,20, 0,20, 0, 0, 0, 0, 0, 0, 0, 6, 7, 9,10,
+ 7, 9,10, 7, 8,10,11, 8,10,11, 9,10,13,13,10,13,
+ 14,10,11,14,17,11,14,17, 7, 8,10,11, 8,10,11, 9,
+ 10,13,14,10,13,14,10,11,14,16,11,14,17, 7, 8,10,
+ 11, 8,10,11, 8, 9,12,12, 9,11,12,10,12,14,15,12,
+ 14,15,11,13,15,17,13,15,18, 8, 9,11,12, 9,12,12,
+ 10,12,14,15,12,14,15,11,13,15,18,13,15,18, 9,10,
+ 13,14,10,13,14,10,12,14,15,12,14,15,13,14,16,17,
+ 14,16,17,14,15,19,20,15,18,19,10,12,14,15,12,14,
+ 15,13,14,16,17,14,17,18,14,15,17,20,15,17, 0,10,
+ 11,14,16,12,14,16,11,13,15,18,13,15,18,14,16,18,
+ 19,15,18,19,16,18,20, 0,18, 0, 0,12,13,15,18,13,
+ 15,18,14,15,17,19,15,18,19,16,17,20, 0,19,19, 0,
+ 7, 8,10,11, 8,10,11, 8, 9,11,12, 9,12,12,10,11,
+ 13,15,12,14,15,11,13,15,17,12,15,17, 8, 9,12,13,
+ 9,12,12,10,12,14,15,12,14,15,12,13,15,18,13,15,
+ 18, 9,10,13,14,10,13,14,10,12,14,15,12,14,15,13,
+ 14,17,18,14,17,19,14,15,18,19,15,18, 0,10,12,14,
+ 15,12,14,15,13,14,18,17,14,16,18,14,16,18,20,15,
+ 17,20,10,12,14,17,12,14,16,11,13,15,18,13,16,18,
+ 14,16,17,20,15,17,20,17,19,20, 0,18, 0, 0,12,13,
+ 15, 0,13,15,17,14,15,18,20,15,17,19,17,18, 0, 0,
+ 18,19,20, 8, 9,11,12, 9,11,12, 9,10,13,14,11,13,
+ 14,11,13,15,16,13,15,17,12,14,17,20,14,16,18, 9,
+ 10,13,14,11,13,14,11,13,15,17,13,15,16,12,14,16,
+ 18,14,16,19, 9,10,13,14,10,13,14,10,12,14,15,12,
+ 14,15,13,14,17,18,14,17,18,14,15,17, 0,15,18,19,
+ 10,12,14,15,12,14,15,13,14,17,18,14,17,18,14,15,
+ 18,20,15,18,20,11,13,15,16,13,15,17,13,14,16,18,
+ 14,17,17,15,17,19, 0,17,19, 0,16,17, 0, 0,18,20,
+ 0,13,14,16,19,14,17,18,15,16,19,20,17,19, 0,16,
+ 17,19, 0,18,19, 0,13,13,16,20,14,16,19,14,15,17,
+ 20,15,18,19,17,19,20, 0,17,19,20,19, 0,20, 0,20,
+ 0, 0,14,15,18,20,15,18, 0,16,17,20, 0,18,20, 0,
+ 19, 0,20, 0, 0, 0, 0, 9,10,13,14,10,13,14,10,11,
+ 14,15,12,14,15,13,14,16,18,14,17,18,14,16,18, 0,
+ 15,18,19,10,12,14,15,12,14,15,13,14,16,18,14,16,
+ 18,14,15,18,19,15,18,19,11,13,15,16,13,15,16,13,
+ 14,17,17,14,17,18,15,16,18,20,17,20,19,17,18,20,
+ 0,19,20, 0,13,14,17,18,14,17,17,15,17,19,20,17,
+ 0,19,16,18,19, 0,18,20, 0,13,14,17,20,14,17,19,
+ 14,15,18,19,15,18,20,17,17,20, 0,18,19, 0,19, 0,
+ 0, 0, 0, 0, 0,14,15,18,19,15,17,19,16,18,20, 0,
+ 18,20, 0,20,20, 0, 0,20, 0, 0, 8,10,12,14,10,12,
+ 14,10,12,14,17,11,14,17,12,14,17,18,14,17,19,14,
+ 16,18, 0,17,20, 0,10,11,14,16,12,14,17,12,14,17,
+ 0,14,17,19,14,17,20,20,17,19, 0,10,11,14,16,11,
+ 14,16,11,13,15,18,13,15,18,14,15,18, 0,15,19,20,
+ 16,19,20, 0,18, 0, 0,11,12,15,18,13,15,18,14,15,
+ 17, 0,16,18,19,16,18,19, 0,18, 0, 0,12,14,17,18,
+ 14,16,20,14,15,18, 0,15,18, 0,16,18, 0, 0,18,20,
+ 0,18,20, 0, 0,20, 0, 0,14,15,18,20,15,18,20,16,
+ 18,18, 0,18,20, 0,19,20, 0, 0, 0,20, 0,15,17,19,
+ 0,16,19, 0,17,18,20, 0,18, 0, 0,18, 0,20, 0,20,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,16,18,20,19,18, 0, 0,
+ 20,19, 0, 0,20, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,11,
+ 14,17,12,14,17,11,13,15,17,13,16,18,14,15,18, 0,
+ 15,18,20,16,17,19, 0,18,19, 0,11,13,15,18,13,15,
+ 19,14,15,18, 0,15,19,20,17,18,20, 0,18,18, 0,13,
+ 14,16, 0,14,16,20,14,15,17,19,15,18,19,16,18,19,
+ 0,19, 0, 0, 0, 0, 0, 0,20, 0, 0,14,15,17, 0,15,
+ 17,20,16,17,20, 0,18,18,20,19,20, 0, 0,20, 0, 0,
+ 15,16,19,20,16,20, 0,16,18, 0,20,18,20, 0,18, 0,
+ 0, 0, 0, 0, 0, 0, 0,20, 0, 0, 0, 0,16,18, 0, 0,
+ 19,20, 0,18,20, 0, 0,19,20, 0, 0, 0, 0, 0,20, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_1024a_160_5[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_5[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_5 = {
+ _vq_quantthresh_res0_1024a_160_5,
+ _vq_quantmap_res0_1024a_160_5,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_1024a_160_5 = {
+ 4, 2401,
+ _vq_lengthlist_res0_1024a_160_5,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_160_5,
+ NULL,
+ &_vq_auxt_res0_1024a_160_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_6.vqh b/include/vorbis/book/res0_1024a_160_6.vqh
new file mode 100644
index 00000000..353d6ced
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_6_VQH_
+#define _V_res0_1024a_160_6_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_6[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_6[] = {
+ 7, 8, 9,10, 8, 9,10, 8, 8, 9,10, 8, 9,10, 9, 9,
+ 10,12, 9,10,11,10,10,12,13,10,12,13, 8, 8, 9,10,
+ 8, 9,10, 9, 9,10,12, 9,10,11,10,10,12,13,10,12,
+ 13, 8, 8, 9,10, 8, 9,10, 8, 8, 9,11, 8, 9,11, 9,
+ 9,11,12, 9,11,12,10,11,12,14,11,12,14, 8, 8, 9,
+ 11, 8, 9,11, 9, 9,11,12, 9,11,12,10,11,12,14,11,
+ 12,14, 9, 9,10,12, 9,10,12, 9, 9,11,12, 9,11,12,
+ 10,11,12,13,11,12,13,12,12,13,15,12,13,15, 9, 9,
+ 11,12, 9,11,12,10,11,12,13,11,12,14,12,12,13,15,
+ 12,14,16,10,11,12,13,10,12,13,10,11,12,14,11,12,
+ 14,12,12,14,15,12,14,15,13,14,15,17,14,16,17,10,
+ 11,12,14,11,12,14,12,12,14,15,12,13,16,13,14,15,
+ 18,14,15,17, 8, 8, 9,10, 8, 9,10, 8, 8, 9,11, 8,
+ 9,11, 9, 9,11,12, 9,11,12,10,11,12,14,11,12,14,
+ 8, 8, 9,11, 8, 9,11, 9, 9,11,12, 9,11,12,10,11,
+ 12,14,11,12,13, 9, 9,10,11, 9,10,12, 9, 9,11,12,
+ 9,11,12,10,11,12,14,11,12,14,12,12,14,15,12,13,
+ 15, 9, 9,11,12, 9,11,12,10,11,12,14,11,12,13,12,
+ 12,14,15,12,13,15,10,10,12,13,11,12,13,10,11,12,
+ 14,11,12,14,12,12,13,15,12,14,16,13,14,16,17,14,
+ 15,17,11,11,12,14,11,12,14,12,12,14,16,12,13,15,
+ 13,14,16,17,14,15,17, 8, 8, 9,10, 8, 9,10, 8, 8,
+ 10,11, 8, 9,11, 9, 9,11,12, 9,11,12,10,11,12,14,
+ 11,12,14, 8, 8, 9,11, 8, 9,11, 9, 9,11,12, 9,11,
+ 12,10,11,12,14,11,12,14, 8, 8, 9,11, 8, 9,11, 8,
+ 9,10,11, 9,10,11, 9,10,11,13,10,11,13,11,11,13,
+ 14,11,13,15, 8, 9,10,11, 9,10,11,10,10,11,12,10,
+ 11,13,11,11,13,14,11,13,14, 9, 9,11,12, 9,11,12,
+ 9,10,11,13,10,11,13,11,11,13,14,11,13,14,12,13,
+ 14,15,13,15,15, 9,10,11,13,10,11,13,11,11,13,14,
+ 11,13,14,12,13,14,16,13,14,15,11,11,12,14,11,12,
+ 14,11,11,13,15,11,13,15,12,13,14,15,13,14,16,14,
+ 15,16,16,15,16,18,11,11,13,15,11,13,14,12,13,14,
+ 16,13,15,16,14,15,16,18,15,16,18, 8, 8, 9,11, 8,
+ 10,11, 8, 9,10,11, 9,10,11, 9,10,11,13,10,11,12,
+ 11,11,13,14,11,13,14, 8, 9,10,11, 9,10,11,10,10,
+ 11,13,10,11,13,11,11,13,14,11,13,14, 9, 9,11,12,
+ 10,11,12, 9,10,11,13,10,11,13,11,11,13,14,11,12,
+ 14,12,13,14,16,13,14,15, 9,10,11,13,10,11,13,11,
+ 11,12,14,11,13,14,12,13,14,16,13,15,16,10,11,12,
+ 14,11,13,14,11,12,13,14,11,13,14,12,13,14,16,13,
+ 14,15,14,14,17,18,14,15,16,11,12,13,15,12,13,15,
+ 12,13,14,17,13,14,16,14,14,16,17,15,16,17, 9, 9,
+ 10,12, 9,10,12, 9,10,11,12,10,11,12,10,11,12,13,
+ 11,12,14,12,12,14,15,12,14,16, 9, 9,11,12, 9,11,
+ 12,10,11,12,13,11,12,13,12,12,14,16,12,14,15, 9,
+ 10,11,12,10,11,12,10,10,11,13,10,11,13,11,11,13,
+ 14,11,13,14,12,13,14,16,13,14,16,10,10,11,13,10,
+ 11,13,11,11,13,14,11,13,14,12,13,15,16,13,14,16,
+ 10,11,12,14,11,12,14,11,11,13,14,11,13,15,12,12,
+ 14,16,13,14,16,13,14,15,17,14,16,17,11,11,13,14,
+ 11,13,14,12,13,14,16,13,14,16,13,15,16,18,14,15,
+ 18,12,12,14,16,12,14,16,12,13,14,16,13,14,16,13,
+ 14,15,17,15,15,18,15,15,17,18,16,16,20,12,13,14,
+ 17,13,14,16,14,14,15,18,14,15,18,16,16,18,20,17,
+ 19,18, 9,10,11,12,10,11,12, 9,10,11,13,10,11,13,
+ 11,12,13,14,11,13,14,12,13,14,16,13,14,16,10,10,
+ 11,13,10,11,13,11,11,13,14,11,13,14,12,13,14,16,
+ 13,14,16,10,11,12,14,11,12,14,11,11,13,14,11,13,
+ 14,12,13,14,16,12,14,15,13,14,15,17,14,15,16,11,
+ 11,13,14,11,13,14,12,13,14,16,13,14,15,14,14,16,
+ 17,14,15,17,12,12,14,16,13,14,15,12,13,14,16,13,
+ 14,16,13,14,15,17,14,15,17,15,16,18,18,15,17,18,
+ 12,13,14,16,13,14,16,14,14,15,18,15,16,17,16,17,
+ 17,20,16,17,19,10,10,12,14,11,12,13,11,11,12,14,
+ 11,12,15,12,12,14,16,12,14,16,13,14,16,17,14,16,
+ 18,10,11,12,14,11,12,15,12,12,14,15,12,14,16,14,
+ 14,15,17,14,16,18,11,11,12,14,11,12,14,11,11,13,
+ 15,12,13,15,12,13,14,16,13,14,16,14,15,16,17,15,
+ 16,18,11,11,13,15,12,13,15,12,13,14,16,13,14,16,
+ 14,15,16,20,15,16,18,12,12,14,15,12,14,15,12,13,
+ 14,16,13,14,16,14,14,16,17,14,15,18,15,16,18,18,
+ 17,17,20,12,13,14,16,13,14,16,14,15,17,17,14,16,
+ 18,16,17,18,18,17,18,19,14,14,16,17,14,16,17,14,
+ 15,15,17,15,15,20,15,16,17,18,16,18, 0,16,18,18,
+ 0,17,18,20,14,15,16,18,14,16,18,15,16,19,20,16,
+ 17,18,17,19,20,20,18,19, 0,10,11,12,14,11,12,14,
+ 11,12,13,15,11,13,15,12,13,14,16,13,14,17,15,15,
+ 16,17,15,16,20,11,11,13,15,11,13,14,12,13,14,17,
+ 13,14,16,14,15,16,18,15,17,17,12,12,14,16,12,14,
+ 15,12,13,14,17,13,14,16,14,14,15,17,14,16,17,15,
+ 16,19,20,16,17,17,12,13,14,16,13,14,16,13,14,15,
+ 18,15,15,17,16,16,18,20,16,18,19,14,14,15,18,14,
+ 16,18,14,15,15,17,15,16,18,15,16,17,20,16,17,18,
+ 17,19,19, 0,17,17, 0,14,14,16,18,15,17,17,15,16,
+ 19,18,16,19,18,18,17,19, 0,17,19,20, 8, 8, 9,10,
+ 8, 9,10, 8, 8, 9,11, 8, 9,11, 9, 9,11,12, 9,11,
+ 12,10,11,12,14,11,12,13, 8, 8, 9,11, 8, 9,11, 9,
+ 9,11,12, 9,11,12,11,11,12,14,11,12,14, 8, 8, 9,
+ 11, 8,10,11, 8, 9,10,11, 9,10,11, 9,10,11,13,10,
+ 11,12,11,11,13,14,11,13,14, 8, 9,10,11, 9,10,11,
+ 9,10,11,13,10,11,13,11,11,13,14,11,13,15, 9,10,
+ 11,12, 9,11,12, 9,10,11,13,10,11,13,11,11,13,15,
+ 11,13,14,12,13,14,16,13,14,15, 9,10,11,13,10,11,
+ 13,11,11,12,14,11,13,14,12,13,14,15,13,14,16,11,
+ 11,12,15,11,12,14,11,12,13,14,11,13,15,12,13,14,
+ 16,13,14,16,14,15,15,18,15,16,17,11,11,13,15,11,
+ 13,15,12,13,14,16,13,14,16,14,14,16,17,15,17,17,
+ 8, 8, 9,11, 8,10,11, 8, 9,10,11, 9,10,11, 9,10,
+ 11,13,10,11,13,11,11,13,15,11,13,15, 8, 9,10,11,
+ 9,10,11, 9,10,11,13,10,11,12,11,12,13,14,11,12,
+ 14, 9, 9,11,12,10,11,12,10,10,11,13,10,11,13,11,
+ 11,13,14,11,13,14,12,13,14,15,13,14,15, 9,10,11,
+ 13,10,11,13,11,11,13,14,11,13,14,12,13,14,16,12,
+ 14,16,10,11,12,14,11,12,14,11,11,13,15,12,13,15,
+ 12,13,14,16,13,15,16,14,15,17,17,14,17,17,11,12,
+ 13,15,11,13,15,12,13,14,16,13,14,16,14,15,16,18,
+ 14,15,17, 9, 9,10,12, 9,10,12, 9, 9,11,12,10,11,
+ 12,10,11,12,14,11,12,13,12,12,14,15,12,14,16, 9,
+ 10,11,12,10,11,12,10,11,12,14,11,12,13,12,12,14,
+ 15,13,14,16, 9,10,11,12, 9,11,12,10,10,11,13,10,
+ 11,13,11,11,13,14,11,13,14,12,13,14,16,13,14,16,
+ 10,10,11,13,10,11,13,11,11,13,14,11,13,14,12,13,
+ 14,15,13,14,17,10,11,12,14,11,12,13,11,11,13,14,
+ 11,12,14,12,13,14,16,13,14,15,14,14,15,17,14,16,
+ 17,11,11,13,14,11,13,14,12,13,14,15,13,14,16,14,
+ 14,15,17,14,16,18,12,12,14,16,12,14,15,12,13,14,
+ 17,13,14,17,14,14,16,17,14,16,18,16,16,17,20,16,
+ 17,17,12,13,14,16,13,14,16,14,14,15,16,14,15,17,
+ 16,15,17,17,16,17,18, 9,10,11,12,10,11,12,10,10,
+ 11,13,10,11,13,11,11,13,14,11,13,14,12,13,14,16,
+ 13,14,16,10,10,11,13,10,11,13,11,11,13,14,11,13,
+ 14,13,13,14,17,13,14,16,10,11,12,14,11,12,14,11,
+ 11,13,14,11,13,14,12,13,14,15,13,14,16,14,15,15,
+ 17,14,15,16,11,11,13,14,11,13,14,12,13,14,16,13,
+ 14,16,13,14,16,17,14,15,17,12,12,14,16,12,14,15,
+ 12,13,14,16,13,14,16,14,14,15,17,15,16,17,16,17,
+ 18,19,17,18,18,13,13,14,16,12,14,16,13,14,15,17,
+ 14,15,17,15,16,17,17,16,17,17,10,11,12,14,10,12,
+ 14,10,11,12,14,11,12,14,12,12,14,16,12,14,15,14,
+ 14,16,18,14,15,17,11,11,13,14,11,12,14,12,12,14,
+ 16,13,14,15,14,14,16,17,14,16,17,11,11,12,14,11,
+ 12,14,11,11,13,15,11,13,15,12,13,15,16,13,14,16,
+ 14,15,16,18,15,16,18,11,11,13,15,11,13,15,13,13,
+ 14,16,13,14,16,14,15,17,17,15,18,18,12,12,14,15,
+ 12,14,16,12,13,14,16,13,14,16,13,15,16,17,14,16,
+ 17,16,16,18,20,16,17,20,12,13,14,16,13,14,16,14,
+ 14,15,18,15,15,17,16,16,18, 0,16,17,20,13,14,15,
+ 17,14,15,17,14,14,17,18,15,16,17,15,16,18, 0,16,
+ 17,19,17,18,20,20,18,20, 0,14,14,17,19,15,16,18,
+ 16,16,17,20,16,18,18,17,18,18,20,18, 0, 0,11,11,
+ 12,14,11,12,14,11,11,13,15,11,13,15,12,13,14,16,
+ 13,14,16,14,15,15,18,15,16,17,11,11,13,14,11,13,
+ 15,12,13,15,16,13,14,16,14,15,16,18,15,16,17,12,
+ 12,14,15,12,14,16,12,13,14,17,13,14,16,14,14,16,
+ 17,14,16,17,16,17,18,18,16,17, 0,12,13,14,16,13,
+ 14,16,13,14,16,19,14,15,17,16,16,20, 0,16,17,18,
+ 13,14,15,17,14,16,18,14,14,16,19,15,16,20,16,16,
+ 18,18,16,17,20,18,18, 0,20,18,18,20,14,15,16,18,
+ 15,16,18,15,16,17,20,16,17,19,17,17, 0,19,17,17,
+ 18,
+};
+
+static float _vq_quantthresh_res0_1024a_160_6[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_1024a_160_6[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_6 = {
+ _vq_quantthresh_res0_1024a_160_6,
+ _vq_quantmap_res0_1024a_160_6,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_1024a_160_6 = {
+ 4, 2401,
+ _vq_lengthlist_res0_1024a_160_6,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_160_6,
+ NULL,
+ &_vq_auxt_res0_1024a_160_6,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_7.vqh b/include/vorbis/book/res0_1024a_160_7.vqh
new file mode 100644
index 00000000..70d1352a
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_7_VQH_
+#define _V_res0_1024a_160_7_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_7[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_7[] = {
+ 2, 4, 5, 7, 7, 8, 4, 6, 7, 7, 8, 4, 5, 6, 8, 8,
+ 9, 5, 6, 8, 8, 9, 6, 7, 8, 9, 9,11, 7, 8, 9,10,
+ 11, 7, 8, 9,11,11,12, 8, 9,11,11,12, 7, 8,10,11,
+ 12,13, 8,10,11,12,13, 9,10,11,13,13,14,10,11,12,
+ 13,14, 4, 5, 6, 8, 8, 9, 5, 6, 8, 8, 9, 6, 7, 8,
+ 9, 9,11, 7, 8, 9,10,11, 7, 8, 9,11,11,12, 8, 9,
+ 11,11,12, 7, 8,10,11,12,13, 8,10,11,12,13, 9,10,
+ 11,13,13,14,10,11,12,13,14,
+};
+
+static float _vq_quantthresh_res0_1024a_160_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_160_7[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_7 = {
+ _vq_quantthresh_res0_1024a_160_7,
+ _vq_quantmap_res0_1024a_160_7,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_1024a_160_7 = {
+ 2, 121,
+ _vq_lengthlist_res0_1024a_160_7,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_1024a_160_7,
+ NULL,
+ &_vq_auxt_res0_1024a_160_7,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_8.vqh b/include/vorbis/book/res0_1024a_160_8.vqh
new file mode 100644
index 00000000..afa77872
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_8_VQH_
+#define _V_res0_1024a_160_8_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_8[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_160_8[] = {
+ 3, 4, 6, 6, 7, 7, 7, 8, 4, 6, 6, 6, 7, 7, 8, 4,
+ 6, 7, 7, 8, 8, 8, 9, 5, 7, 7, 8, 8, 8, 9, 6, 7,
+ 8, 9, 9, 9, 9,10, 7, 8, 9, 9, 9, 9,10, 7, 8, 9,
+ 10,10,10,10,11, 8, 9,10,10,10,10,11, 7, 8, 9,10,
+ 10,10,10,11, 8, 9,10,10,10,10,11, 8, 9,10,10,10,
+ 10,11,11, 9,10,10,10,10,11,11, 8, 9,10,11,11,11,
+ 11,12, 9,10,11,11,11,11,12, 9,10,11,12,12,12,12,
+ 13,10,11,12,12,12,12,13, 4, 6, 7, 7, 8, 8, 8, 9,
+ 6, 7, 7, 8, 8, 8, 9, 6, 7, 8, 9, 9, 9, 9,10, 7,
+ 8, 9, 9, 9, 9,10, 7, 8, 9,10,10,10,10,11, 8, 9,
+ 10,10,10,10,11, 7, 8, 9,10,10,10,10,11, 8, 9,10,
+ 10,10,10,11, 8, 9,10,10,10,10,10,11, 9,10,10,10,
+ 10,11,11, 8, 9,10,11,11,11,11,12, 9,10,11,11,11,
+ 11,12, 9,10,11,12,12,12,12,13,10,11,12,12,12,12,
+ 13,
+};
+
+static float _vq_quantthresh_res0_1024a_160_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_160_8[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_160_8 = {
+ _vq_quantthresh_res0_1024a_160_8,
+ _vq_quantmap_res0_1024a_160_8,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_1024a_160_8 = {
+ 2, 225,
+ _vq_lengthlist_res0_1024a_160_8,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_1024a_160_8,
+ NULL,
+ &_vq_auxt_res0_1024a_160_8,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_160_9.vqh b/include/vorbis/book/res0_1024a_160_9.vqh
new file mode 100644
index 00000000..eb5eb1b9
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_160_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_160_9_VQH_
+#define _V_res0_1024a_160_9_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_160_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_160_9[] = {
+ 3, 4, 6, 6, 7, 7, 7, 8, 7,11,14,18, 5, 6, 6, 7,
+ 7, 7, 8, 7,11,15,18, 5, 6, 7, 8, 8, 8, 8, 9, 9,
+ 13,16,19, 6, 7, 8, 8, 8, 8, 9, 9,13,16,19, 6, 7,
+ 8, 9, 9, 9, 9,10,10,13,17, 0, 7, 8, 9, 8, 9, 9,
+ 10,10,13,16, 0, 7, 8, 9, 9, 9, 9,10,10,11,15,17,
+ 0, 8, 9, 9, 9, 9,10,10,11,14,19, 0, 7, 8, 9, 9,
+ 9, 9,10,10,11,15,17, 0, 8, 9, 9, 9, 9,10,10,11,
+ 15,17,19, 7, 8, 9,10,10,10,10,11,11,15,19,19, 8,
+ 9,10,10,10,10,11,11,16,18, 0, 8, 9,10,10,10,10,
+ 11,11,12,16,18, 0, 9,10,10,10,10,11,11,12,16,19,
+ 18, 8, 9,10,11,11,11,11,12,12,16,19, 0, 9,10,11,
+ 11,11,11,12,12,15,19,19, 8,10,11,11,11,11,12,12,
+ 14,18, 0, 0,10,11,11,11,12,12,12,14,17,19, 0,11,
+ 13,15,16,15,15,16,16,17, 0, 0, 0,14,15,15,15,15,
+ 16,17,17, 0, 0, 0,15,18, 0,19,19, 0, 0, 0, 0, 0,
+ 0, 0,18, 0,19,19, 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, 5, 6, 7, 8, 8, 8, 8, 9, 9,12,15,19,
+ 6, 7, 8, 8, 8, 8, 9, 9,13,17, 0, 6, 7, 8, 9, 9,
+ 9, 9,10,10,13,16,19, 7, 8, 9, 9, 9, 9,10,10,13,
+ 18, 0, 7, 8, 9, 9, 9, 9,10,10,11,14,16,19, 8, 9,
+ 9, 9, 9,10,10,11,14,17, 0, 7, 8, 9, 9, 9, 9,10,
+ 10,11,14,16, 0, 8, 9, 9, 9, 9,10,10,11,15,19, 0,
+ 7, 8, 9,10,10,10,10,11,11,15,19,19, 8, 9,10,10,
+ 10,10,11,11,16,18, 0, 8, 9,10,10,10,10,11,11,12,
+ 16,18,18, 9,10,10,10,10,11,11,12,16,18, 0, 8, 9,
+ 10,11,11,11,11,12,12,16,19,19, 9,10,11,11,11,11,
+ 12,12,16,17,18, 8,10,11,12,11,11,12,12,14,18, 0,
+ 0,10,11,11,11,11,12,12,14,18, 0, 0,11,13,15,16,
+ 15,16,16,16,18, 0, 0, 0,13,15,15,15,15,16,16,17,
+ 0, 0, 0,15,18, 0, 0,18, 0, 0, 0, 0, 0, 0, 0,19,
+ 18, 0,19, 0, 0, 0, 0, 0, 0, 0,17, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,19, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_1024a_160_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_160_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_160_9 = {
+ _vq_quantthresh_res0_1024a_160_9,
+ _vq_quantmap_res0_1024a_160_9,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_1024a_160_9 = {
+ 2, 529,
+ _vq_lengthlist_res0_1024a_160_9,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_1024a_160_9,
+ NULL,
+ &_vq_auxt_res0_1024a_160_9,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_192_1.vqh b/include/vorbis/book/res0_1024a_192_1.vqh
new file mode 100644
index 00000000..1d9916d9
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_192_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_192_1_VQH_
+#define _V_res0_1024a_192_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_192_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_192_1[] = {
+ 1, 4, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 9, 9, 7,
+ 9, 9, 5, 7, 7, 7, 9, 9, 8, 9, 9, 5, 7, 7, 7, 9,
+ 9, 8, 9, 9, 8, 9, 9, 9,11,11, 9,11,11, 8, 9, 9,
+ 9,11,11,10,11,11, 5, 7, 7, 8, 9, 9, 8, 9, 9, 8,
+ 9,10,10,11,11,10,11,11, 8,10,10,10,11,11,10,11,
+ 11,
+};
+
+static float _vq_quantthresh_res0_1024a_192_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_1024a_192_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_192_1 = {
+ _vq_quantthresh_res0_1024a_192_1,
+ _vq_quantmap_res0_1024a_192_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_1024a_192_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_1024a_192_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_1024a_192_1,
+ NULL,
+ &_vq_auxt_res0_1024a_192_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_192_2.vqh b/include/vorbis/book/res0_1024a_192_2.vqh
new file mode 100644
index 00000000..f192b654
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_192_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_1024a_192_2_VQH_
+#define _V_res0_1024a_192_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_192_2[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_192_2[] = {
+ 4, 5, 7, 5, 7, 5, 6, 9, 6, 9, 7, 9,11, 9,11, 5,
+ 6, 9, 7, 9, 7, 9,11, 9,11, 5, 7, 9, 7, 9, 7, 8,
+ 10, 8,10, 9,10,12,10,12, 7, 8,10, 8,10, 9,10,12,
+ 10,12, 8, 9,11, 9,11, 9,10,12,10,12,11,12,14,12,
+ 14, 9,10,12,10,12,11,12,14,12,14, 5, 7, 9, 7, 9,
+ 7, 8,10, 8,10, 9,10,12,10,12, 7, 8,10, 8,10, 9,
+ 10,12,10,12, 8, 9,11, 9,11, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,11,12,14,12,14, 5, 7, 9,
+ 7, 9, 7, 8,10, 8,10, 9,10,12,10,12, 7, 8,10, 8,
+ 10, 9,10,12,10,12, 7, 8,10, 8,10, 8, 8,11, 9,11,
+ 10,11,12,11,13, 8, 9,11, 9,11,10,11,12,11,13, 9,
+ 10,12,10,12,10,11,13,11,13,12,13,14,13,15,10,11,
+ 13,11,13,12,13,14,13,15, 7, 8,10, 8,10, 8, 9,11,
+ 9,11,10,11,13,11,12, 8, 9,11, 9,11,10,11,13,11,
+ 13, 9,10,12,10,12,10,11,13,11,13,12,13,15,13,14,
+ 10,11,13,11,13,12,13,15,13,14, 8, 9,11, 9,11, 9,
+ 10,12,10,12,11,12,14,12,14, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,10,11,13,11,13,12,13,15,
+ 13,15,10,11,13,11,13,12,13,15,13,14,11,12,14,12,
+ 14,12,12,14,13,15,14,14,14,14,16,12,13,14,13,14,
+ 14,15,16,14,17, 9,10,12,10,12,10,11,13,11,13,12,
+ 13,15,13,14,10,11,13,11,13,12,13,14,13,15,11,12,
+ 14,12,14,12,13,15,13,15,14,15,16,14,16,12,13,15,
+ 13,15,14,14,16,14,16, 5, 7, 9, 7, 9, 7, 8,10, 8,
+ 10, 9,10,12,10,12, 7, 8,10, 8,10, 9,10,12,10,12,
+ 7, 8,10, 8,10, 8, 9,11, 9,11,10,11,13,11,13, 8,
+ 9,11, 9,11,10,11,13,11,13, 9,10,12,10,12,10,11,
+ 13,11,13,12,13,15,13,14,10,11,13,11,13,12,13,14,
+ 13,15, 7, 8,10, 8,10, 8, 9,11, 9,11,10,11,13,11,
+ 13, 8, 9,11, 9,11,10,11,13,11,12, 9,10,12,10,12,
+ 10,11,13,11,13,12,13,15,13,14,10,11,13,11,13,12,
+ 13,15,13,14, 8, 9,11, 9,11, 9,10,12,10,12,11,12,
+ 14,12,14, 9,10,12,10,12,11,12,14,12,14, 9,10,12,
+ 10,12,10,11,13,11,13,12,13,15,13,14,10,11,13,11,
+ 13,12,13,15,13,15,11,12,14,12,14,12,13,15,13,15,
+ 14,15,16,15,16,12,13,14,13,15,14,14,15,14,17, 9,
+ 10,12,10,12,10,11,13,11,13,12,13,14,13,15,10,11,
+ 13,11,13,12,13,14,13,14,11,12,14,12,14,12,13,15,
+ 13,14,14,14,16,15,16,12,13,14,13,14,14,14,16,14,
+ 14,
+};
+
+static float _vq_quantthresh_res0_1024a_192_2[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_192_2[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_192_2 = {
+ _vq_quantthresh_res0_1024a_192_2,
+ _vq_quantmap_res0_1024a_192_2,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_192_2 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_192_2,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_192_2,
+ NULL,
+ &_vq_auxt_res0_1024a_192_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_192_3.vqh b/include/vorbis/book/res0_1024a_192_3.vqh
new file mode 100644
index 00000000..b8514873
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_192_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_1024a_192_3_VQH_
+#define _V_res0_1024a_192_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_192_3[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_192_3[] = {
+ 5, 6, 8, 9, 6, 8, 9, 6, 7, 9,10, 7, 9,10, 8, 9,
+ 11,12, 9,11,12, 9,10,12,13,10,12,14, 6, 7, 9,10,
+ 7, 9,10, 8, 9,11,12, 9,11,12, 9,10,12,14,10,12,
+ 14, 6, 7, 9,10, 8, 9,10, 8, 8,10,11, 8,10,11, 9,
+ 10,11,12,10,11,12,10,11,12,14,11,13,14, 8, 8,10,
+ 11, 8,10,11, 9,10,11,12,10,11,12,10,11,12,14,11,
+ 13,14, 8, 9,11,12, 9,11,12, 9,10,11,12,10,11,13,
+ 11,11,12,14,11,13,14,12,13,14,15,13,14,16, 9,10,
+ 11,12,10,11,13,11,11,12,14,11,13,14,12,12,14,15,
+ 13,14,15, 9,10,12,13,10,12,13,10,11,13,14,11,13,
+ 14,12,13,14,16,13,14,16,14,14,15,16,15,16,18,10,
+ 11,13,15,11,13,15,12,13,14,16,13,14,16,14,15,15,
+ 17,15,15,17, 6, 8, 9,10, 8, 9,10, 8, 8,10,11, 8,
+ 10,11, 9,10,11,12,10,11,12,10,11,13,14,11,12,14,
+ 8, 8,10,11, 8,10,11, 9,10,11,12,10,11,12,10,11,
+ 12,14,11,12,14, 8, 9,11,12, 9,11,12, 9,10,11,13,
+ 10,11,13,11,11,13,14,11,13,14,12,13,14,15,12,14,
+ 15, 9,10,11,13,10,11,12,11,11,12,14,11,12,14,12,
+ 13,14,15,13,14,15, 9,10,12,13,10,12,13,10,11,13,
+ 14,11,13,14,12,13,14,16,13,14,15,14,15,16,17,14,
+ 15,17,10,11,13,14,11,13,14,12,13,14,16,13,14,15,
+ 14,15,16,17,14,15,17, 6, 8, 9,10, 8, 9,10, 8, 8,
+ 10,11, 8,10,11, 9,10,11,13,10,11,13,10,11,13,15,
+ 11,12,14, 8, 8,10,11, 8,10,11, 9,10,11,12,10,11,
+ 13,10,11,12,14,11,13,14, 8, 8,10,11, 8,10,11, 8,
+ 9,10,12, 9,10,12,10,10,12,13,11,12,13,11,12,13,
+ 15,12,13,15, 8, 9,10,12, 9,10,12,10,10,12,13,10,
+ 12,13,11,12,13,15,12,13,15, 9,10,11,13,10,11,12,
+ 10,10,12,13,11,12,13,11,12,13,14,12,13,14,13,13,
+ 14,15,13,15,16,10,10,12,13,11,12,13,11,12,13,14,
+ 12,13,14,13,13,14,16,13,14,16,10,11,13,14,11,13,
+ 14,11,12,13,15,12,13,15,13,13,14,16,13,14,15,14,
+ 15,16,17,15,16,17,11,12,13,15,12,13,15,13,13,15,
+ 16,13,14,16,15,15,16,17,15,16,17, 8, 8,10,11, 8,
+ 10,11, 8, 9,10,12, 9,10,12,10,10,12,13,10,12,13,
+ 11,12,13,15,12,13,15, 8, 9,10,12, 9,10,12,10,11,
+ 12,13,11,12,13,11,12,13,15,12,13,15, 9,10,11,13,
+ 10,11,13,10,10,12,13,10,12,13,11,12,13,14,12,13,
+ 14,13,13,14,16,13,14,15,10,11,12,13,11,12,13,11,
+ 12,13,14,12,13,14,13,13,14,16,13,15,16,10,11,13,
+ 14,11,13,14,11,12,13,15,12,13,15,13,13,14,16,13,
+ 14,16,15,15,16,17,15,16,17,11,12,13,15,12,13,15,
+ 13,13,14,16,13,15,16,14,15,16,17,15,16,17, 8, 9,
+ 11,12, 9,11,12, 9,10,11,12,10,11,13,11,11,13,14,
+ 11,13,14,12,13,14,16,13,14,16, 9,10,11,13,10,11,
+ 13,11,11,13,14,11,13,14,12,13,14,15,13,14,16, 9,
+ 10,11,13,10,11,13,10,11,12,13,10,12,13,11,12,13,
+ 14,12,13,14,13,13,15,16,13,15,16,10,11,12,13,11,
+ 12,13,11,12,13,14,12,13,14,13,13,14,16,13,14,16,
+ 11,11,13,14,11,13,14,11,12,13,14,12,13,15,13,13,
+ 14,15,13,14,16,14,14,15,17,14,16,17,11,12,13,14,
+ 12,13,15,13,13,14,15,13,14,15,14,15,16,17,14,15,
+ 17,12,13,14,16,13,14,15,13,13,14,16,13,14,16,14,
+ 14,15,17,14,15,17,15,16,17,18,16,18,19,13,13,15,
+ 16,13,15,16,14,15,16,18,15,16,17,16,16,17,20,16,
+ 17,18, 9,10,11,13,10,11,13,10,11,12,13,10,12,13,
+ 11,12,13,15,12,13,14,13,13,15,16,13,14,16,10,10,
+ 12,13,11,12,13,11,12,13,14,12,13,15,13,13,14,16,
+ 13,15,16,11,11,12,14,11,13,14,11,12,13,14,12,13,
+ 14,13,13,14,15,13,14,15,14,14,16,17,14,15,16,11,
+ 12,13,14,12,13,14,13,13,14,15,13,14,15,14,15,15,
+ 17,15,15,17,12,13,14,16,13,14,16,13,13,14,16,13,
+ 14,16,13,14,15,17,14,15,16,15,16,17,19,16,16,18,
+ 13,13,14,16,13,15,16,14,14,15,17,15,16,18,16,16,
+ 17,18,16,18,19, 9,10,12,14,11,12,14,10,11,13,15,
+ 11,13,15,12,13,14,16,13,14,16,14,15,16,17,15,16,
+ 17,10,11,13,14,11,13,15,12,13,14,16,13,14,15,14,
+ 14,16,17,15,15,18,10,11,13,14,11,13,14,11,12,13,
+ 15,12,13,15,13,13,14,16,13,14,16,15,15,16,17,15,
+ 16,17,11,12,13,15,12,13,15,13,13,15,16,13,14,16,
+ 15,15,16,17,15,17,17,12,13,14,15,13,14,16,13,13,
+ 15,16,13,15,16,14,14,15,17,15,16,17,16,17,17,19,
+ 16,17,18,13,13,14,16,13,14,16,14,14,16,18,14,15,
+ 17,16,16,17,20,16,18,18,14,15,16,17,15,16,17,14,
+ 15,17,18,15,16,18,15,16,16,18,16,17,19,17,17,17,
+ 18,17,18, 0,14,15,16,18,15,16,18,16,16,17,19,16,
+ 17,18,17,18,19,21,18,20,19,10,11,13,14,11,13,14,
+ 11,12,13,15,12,13,15,13,13,14,16,13,14,16,14,15,
+ 16,17,15,17,19,11,12,13,15,12,13,15,13,13,14,16,
+ 14,14,16,15,15,16,18,15,16,18,12,13,14,15,13,14,
+ 16,12,13,14,16,13,14,16,14,14,15,18,14,15,18,16,
+ 16,16,18,16,17,18,13,13,14,16,13,15,16,14,14,16,
+ 17,15,16,17,16,16,17,18,16,17,19,14,15,16,17,15,
+ 16,18,14,15,16,19,15,16,18,15,16,17,20,16,17,17,
+ 17,17,19,20,18,17,19,15,15,16,18,15,16,18,16,16,
+ 17,18,16,17,18,18,17,19,20,17,18,19, 7, 8, 9,10,
+ 8, 9,10, 8, 8,10,11, 8,10,11, 9,10,11,12,10,11,
+ 13,10,11,13,14,11,13,14, 8, 8,10,11, 8,10,11, 9,
+ 10,11,13,10,11,13,10,11,13,14,11,13,14, 8, 8,10,
+ 11, 8,10,11, 8, 9,10,12, 9,10,12,10,10,12,13,10,
+ 12,13,11,12,13,15,12,13,15, 8, 9,10,12, 9,10,12,
+ 10,10,12,13,11,12,13,11,12,13,15,12,13,15, 9,10,
+ 11,13,10,11,13,10,11,12,13,10,12,13,11,12,13,14,
+ 12,13,14,13,13,14,16,13,14,16,10,10,12,13,11,12,
+ 13,11,12,13,14,12,13,14,13,13,14,15,13,14,16,10,
+ 11,13,14,11,13,14,11,12,13,15,12,13,15,13,13,15,
+ 16,13,15,16,15,15,16,17,15,16,18,11,12,13,15,12,
+ 13,15,13,13,14,15,13,14,16,15,15,16,17,15,16,18,
+ 8, 8,10,11, 8,10,11, 8, 9,10,12, 9,11,12,10,11,
+ 12,13,10,12,13,11,12,13,14,12,13,15, 8, 9,11,12,
+ 9,10,12,10,11,12,13,10,12,13,11,12,13,15,12,13,
+ 15, 9,10,11,13,10,11,13,10,10,12,13,11,12,13,11,
+ 12,13,14,12,13,14,13,13,14,16,13,14,16,10,11,12,
+ 13,11,12,13,11,12,13,14,12,13,14,13,13,14,16,13,
+ 14,16,10,11,13,15,11,13,14,11,12,13,15,12,13,15,
+ 13,13,14,16,13,15,16,15,15,16,18,15,16,17,11,12,
+ 13,15,12,13,15,13,13,15,16,13,14,16,14,15,16,17,
+ 15,16,17, 8, 9,11,12, 9,11,12, 9,10,11,13,10,11,
+ 13,11,11,12,14,11,12,14,12,13,14,15,13,14,15, 9,
+ 10,11,13,10,11,13,11,11,13,14,11,13,14,12,13,14,
+ 15,13,14,16, 9,10,11,13,10,11,13,10,11,12,13,11,
+ 12,13,11,12,13,14,12,13,14,13,13,14,16,13,14,16,
+ 10,11,12,13,11,12,13,11,12,13,14,12,13,15,13,13,
+ 14,16,13,14,16,11,11,13,14,11,13,14,11,12,13,15,
+ 12,13,14,13,13,14,16,13,14,15,14,14,16,17,14,15,
+ 17,11,12,13,14,12,13,14,13,13,14,16,13,14,16,14,
+ 14,15,16,14,16,17,12,13,14,16,13,14,16,13,13,14,
+ 16,13,15,16,14,14,16,17,15,16,17,16,16,17,18,16,
+ 17,19,13,13,14,16,13,15,16,14,14,15,17,14,16,17,
+ 15,16,16,17,16,17,19, 9,10,11,13,10,11,13,10,10,
+ 12,13,11,12,13,11,12,13,14,12,13,14,13,13,14,16,
+ 13,14,16,10,11,12,13,11,12,13,11,12,13,14,12,13,
+ 14,13,13,14,16,13,14,16,11,11,13,14,11,13,14,11,
+ 12,13,14,12,13,14,13,13,14,15,13,14,16,14,15,16,
+ 17,14,16,17,11,12,13,14,12,13,15,13,13,14,15,13,
+ 14,15,14,15,16,17,14,16,16,12,13,14,16,13,14,16,
+ 13,13,14,16,13,15,16,14,14,15,17,15,15,17,16,16,
+ 17,18,16,17,19,13,13,14,16,13,14,16,14,15,15,17,
+ 14,15,17,16,16,17,19,16,16,17, 9,10,12,14,10,12,
+ 14,10,11,13,14,11,13,14,12,13,14,16,13,14,16,14,
+ 15,16,17,15,16,17,10,11,13,15,11,13,15,12,13,14,
+ 16,13,14,16,14,15,16,17,15,16,18,10,11,13,14,11,
+ 13,14,11,12,13,15,12,13,15,13,13,14,16,13,15,16,
+ 15,15,17,18,15,16,18,11,12,13,15,12,13,15,13,13,
+ 14,16,14,15,17,15,15,16,17,15,16,17,12,13,14,16,
+ 13,14,16,13,13,15,16,13,15,16,14,15,15,17,14,15,
+ 17,16,16,17,18,16,17,18,12,13,14,16,13,15,16,14,
+ 14,15,17,14,16,17,16,16,16,17,16,18,19,14,15,16,
+ 17,15,16,17,15,15,16,17,15,16,17,16,16,17,19,16,
+ 17,18,18,17,18,19,17,19,20,14,15,16,18,15,16,18,
+ 15,15,17,18,16,17,18,17,17,17,19,18,19,20,10,11,
+ 13,14,11,13,15,11,12,13,15,12,13,15,13,13,14,16,
+ 13,15,16,15,15,17,18,15,16,17,11,12,13,15,12,13,
+ 15,13,13,15,16,13,15,16,14,15,16,17,15,16,17,12,
+ 13,14,16,13,14,16,13,13,14,16,13,15,17,14,15,16,
+ 17,14,16,17,16,16,17,21,16,17,20,13,13,15,16,13,
+ 14,16,14,15,16,17,14,15,17,16,17,18,19,16,17,18,
+ 14,15,16,18,15,16,17,14,15,16,17,15,16,18,16,16,
+ 17,18,16,17,18,17,19,18,20,18,18,20,15,15,17,18,
+ 15,16,18,16,16,17,18,16,16,18,17,17,19,19,17,18,
+ 19,
+};
+
+static float _vq_quantthresh_res0_1024a_192_3[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_1024a_192_3[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_192_3 = {
+ _vq_quantthresh_res0_1024a_192_3,
+ _vq_quantmap_res0_1024a_192_3,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_1024a_192_3 = {
+ 4, 2401,
+ _vq_lengthlist_res0_1024a_192_3,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_192_3,
+ NULL,
+ &_vq_auxt_res0_1024a_192_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_192_4.vqh b/include/vorbis/book/res0_1024a_192_4.vqh
new file mode 100644
index 00000000..04b81ea9
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_192_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_1024a_192_4_VQH_
+#define _V_res0_1024a_192_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_192_4[] = {
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 3,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_192_4[] = {
+ 3, 4, 5, 7, 7, 4, 5, 7, 7, 4, 5, 6, 7, 8, 5, 6,
+ 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 7, 7, 8,10,10,
+ 7, 8,10,10, 7, 8, 9,10,11, 8, 9,10,11, 4, 5, 6,
+ 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 9, 6, 7, 8, 9, 7,
+ 7, 8, 9,10, 7, 8, 9,10, 7, 8, 9,10,11, 8, 9,10,
+ 11,
+};
+
+static float _vq_quantthresh_res0_1024a_192_4[] = {
+ -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5,
+};
+
+static long _vq_quantmap_res0_1024a_192_4[] = {
+ 8, 7, 6, 5, 0, 1, 2, 3,
+ 4,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_192_4 = {
+ _vq_quantthresh_res0_1024a_192_4,
+ _vq_quantmap_res0_1024a_192_4,
+ 9,
+ 9
+};
+
+static static_codebook _vq_book_res0_1024a_192_4 = {
+ 2, 81,
+ _vq_lengthlist_res0_1024a_192_4,
+ 1, -531628032, 1611661312, 4, 0,
+ _vq_quantlist_res0_1024a_192_4,
+ NULL,
+ &_vq_auxt_res0_1024a_192_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_192_5.vqh b/include/vorbis/book/res0_1024a_192_5.vqh
new file mode 100644
index 00000000..1dd6d395
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_192_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_1024a_192_5_VQH_
+#define _V_res0_1024a_192_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_192_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_1024a_192_5[] = {
+ 3, 5, 6, 7, 7, 7, 8, 9,11,14,18,22, 5, 6, 7, 7,
+ 7, 8, 9,11,14,18, 0, 5, 6, 6, 7, 7, 8, 9,10,12,
+ 16,19,24, 6, 6, 7, 7, 8, 9,10,12,16,20,24, 6, 6,
+ 7, 8, 8, 9,10,11,13,17,20, 0, 6, 7, 8, 8, 9,10,
+ 11,13,17,20, 0, 7, 7, 8, 9, 9, 9,10,11,14,18,20,
+ 0, 7, 8, 9, 9, 9,10,11,14,17,21, 0, 7, 8, 8, 9,
+ 9, 9,10,11,14,18,23, 0, 8, 8, 9, 9, 9,10,11,14,
+ 18,21, 0, 7, 8, 9, 9,10,10,11,12,14,19, 0, 0, 8,
+ 9, 9,10,10,11,12,14,18,21, 0, 8, 9,10,11,11,11,
+ 11,12,14,18, 0,22, 9,10,11,11,11,11,12,14,18,22,
+ 0, 9,10,11,12,12,12,12,13,15,19,21,21,10,11,12,
+ 12,12,12,13,15,19,22,23,11,12,13,14,14,14,15,15,
+ 17,19, 0, 0,13,14,14,14,14,15,15,17,19, 0, 0,14,
+ 16,18,18,18,19,19,19,19, 0, 0, 0,17,17,18,18,18,
+ 19,19,20, 0, 0, 0,18,20,22,23, 0,23,23, 0, 0, 0,
+ 0, 0,22,22, 0, 0, 0,23,23, 0, 0, 0, 0,20, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 6, 6, 7, 7, 8, 9,10,12,15,20,21,
+ 6, 6, 7, 7, 8, 9,10,12,16,19, 0, 6, 6, 7, 8, 8,
+ 9,10,11,13,17,19,21, 6, 7, 8, 8, 9,10,11,13,17,
+ 20,23, 7, 7, 8, 9, 9, 9,10,11,14,17,20,23, 7, 8,
+ 9, 9, 9,10,11,14,17,21, 0, 7, 8, 8, 9, 9, 9,10,
+ 11,14,17,20,22, 8, 8, 9, 9, 9,10,11,14,18, 0, 0,
+ 7, 8, 9, 9,10,10,11,12,14,19,21, 0, 8, 9, 9,10,
+ 10,11,12,14,18,22, 0, 8, 9,10,11,11,11,11,12,14,
+ 18,22,23, 9,10,11,11,11,11,12,14,19,22, 0, 9,10,
+ 11,12,12,12,12,13,15,18,21,23,10,11,12,12,12,12,
+ 13,15,19,22,23,11,12,14,14,14,14,15,15,17,20, 0,
+ 0,12,14,14,14,14,14,15,17,20,23, 0,14,16,18,19,
+ 18,18,19,19,20, 0, 0, 0,16,18,19,18,18,19,19,21,
+ 0, 0, 0,18, 0,23, 0,23, 0, 0, 0, 0, 0, 0, 0,21,
+ 0, 0, 0,22,22, 0, 0, 0, 0, 0,21, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_1024a_192_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_1024a_192_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_1024a_192_5 = {
+ _vq_quantthresh_res0_1024a_192_5,
+ _vq_quantmap_res0_1024a_192_5,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_1024a_192_5 = {
+ 2, 529,
+ _vq_lengthlist_res0_1024a_192_5,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_1024a_192_5,
+ NULL,
+ &_vq_auxt_res0_1024a_192_5,
+ 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..dc6a3f49
--- /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 float _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..64627b5d
--- /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 float _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..e88c9c80
--- /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 float _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..89e2a792
--- /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 float _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..19e00ae4
--- /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 float _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_1024a_350_1.vqh b/include/vorbis/book/res0_1024a_350_1.vqh
new file mode 100644
index 00000000..d9e36dcb
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_350_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_350_1_VQH_
+#define _V_res0_1024a_350_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_350_1[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_350_1[] = {
+ 2, 5, 8, 5, 8, 5, 7, 9, 7, 9, 9,10,12,10,11, 5,
+ 7, 9, 7, 9, 9,10,12,10,12, 5, 7, 9, 7,10, 7, 8,
+ 10, 8,10,10,11,12,11,12, 7, 8,10, 8,10,10,10,12,
+ 11,12, 9,10,12,10,12,10,11,12,11,13,12,13,14,13,
+ 14,10,11,13,11,13,12,12,14,13,14, 6, 7, 9, 7,10,
+ 7, 8,10, 8,10,10,11,12,10,12, 7, 8,10, 8,10,10,
+ 11,12,11,12, 9,10,12,10,12,10,11,13,11,13,12,13,
+ 14,13,14,10,11,13,11,13,13,13,15,13,14, 5, 7,10,
+ 7,10, 7, 8,11, 8,10,10,11,13,11,13, 7, 8,10, 8,
+ 11,10,11,12,11,12, 7, 8,11, 8,10, 8, 9,11, 9,11,
+ 11,12,13,12,13, 8, 9,11, 9,11,11,11,13,12,13,10,
+ 11,13,11,12,11,12,13,12,14,13,13,13,14,15,11,12,
+ 13,12,13,13,13,15,13,15, 7, 8,11, 8,11, 8, 9,11,
+ 9,11,11,12,13,12,13, 8, 9,11, 9,11,11,12,13,12,
+ 13,10,11,13,11,13,11,12,13,12,13,13,14,15,13,14,
+ 11,12,13,12,13,13,13,15,13,16, 9,10,12,10,12,10,
+ 11,13,11,13,12,13,15,13,15,10,11,13,11,13,12,13,
+ 14,13,14,10,11,13,11,13,11,12,14,12,13,13,14,15,
+ 14,15,11,12,14,12,13,13,14,15,14,15,12,13,15,13,
+ 14,13,13,16,13,15,14,13,14,15,16,13,14,16,14,14,
+ 15,16,16,16,16,10,11,13,11,13,11,12,13,12,14,13,
+ 14,15,13,14,11,12,13,12,13,13,13,15,13,15,12,13,
+ 14,13,15,12,13,15,13,16,14,15,16,14,14,13,14,15,
+ 14,15,15,15,16,16,17, 5, 7,10, 7,10, 7, 8,10, 8,
+ 10,10,11,12,11,12, 7, 8,10, 8,11,10,11,13,11,13,
+ 7, 8,11, 8,11, 9, 9,11, 9,11,11,11,13,12,13, 8,
+ 9,11,10,11,11,12,13,12,13,10,11,13,11,13,11,12,
+ 13,12,13,13,14,15,13,15,11,12,14,12,13,13,13,13,
+ 14,15, 7, 8,11, 9,11, 9, 9,11,10,11,11,12,14,11,
+ 13, 8,10,12, 9,11,11,12,13,12,12,10,11,12,11,13,
+ 11,12,13,12,14,13,13,15,14,15,11,12,14,12,14,13,
+ 13,15,13,14, 9,10,12,10,12,10,11,13,11,13,12,13,
+ 15,13,14,10,11,13,11,13,12,13,15,13,15,10,11,13,
+ 11,13,11,12,14,12,13,13,13,15,13,15,11,12,13,12,
+ 13,13,14,15,14,15,13,13,14,13,14,13,14,15,14,15,
+ 15,16,16,16,16,12,13,15,13,16,15,14,15,15,17,10,
+ 11,13,11,13,11,12,13,12,14,13,13,14,14,15,11,12,
+ 14,12,13,13,14,15,14,15,12,13,14,13,15,13,14,15,
+ 14,14,15,15,16,15,17,13,13,15,13,15,15,15,17,14,
+ 14,
+};
+
+static float _vq_quantthresh_res0_1024a_350_1[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_1024a_350_1[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_350_1 = {
+ _vq_quantthresh_res0_1024a_350_1,
+ _vq_quantmap_res0_1024a_350_1,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_1024a_350_1 = {
+ 4, 625,
+ _vq_lengthlist_res0_1024a_350_1,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_1024a_350_1,
+ NULL,
+ &_vq_auxt_res0_1024a_350_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_350_2.vqh b/include/vorbis/book/res0_1024a_350_2.vqh
new file mode 100644
index 00000000..9e8990fe
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_350_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_350_2_VQH_
+#define _V_res0_1024a_350_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_350_2[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_350_2[] = {
+ 4, 5, 6, 6, 7, 8, 5, 6, 6, 7, 8, 5, 5, 6, 7, 7,
+ 8, 5, 6, 7, 7, 8, 6, 6, 7, 7, 7, 9, 6, 6, 7, 8,
+ 9, 7, 7, 7, 8, 8, 9, 7, 7, 8, 8, 9, 7, 7, 8, 8,
+ 8, 9, 7, 8, 8, 8, 9, 8, 8, 9, 9, 9,10, 8, 9, 9,
+ 9,10, 5, 5, 6, 7, 7, 8, 5, 6, 7, 7, 8, 6, 6, 7,
+ 7, 8, 9, 6, 7, 7, 8, 9, 7, 7, 7, 8, 8, 9, 7, 7,
+ 8, 8, 9, 7, 7, 8, 8, 8, 9, 7, 8, 8, 8, 9, 8, 8,
+ 9, 9, 9,10, 8, 9, 9, 9,10,
+};
+
+static float _vq_quantthresh_res0_1024a_350_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_350_2[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_350_2 = {
+ _vq_quantthresh_res0_1024a_350_2,
+ _vq_quantmap_res0_1024a_350_2,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_1024a_350_2 = {
+ 2, 121,
+ _vq_lengthlist_res0_1024a_350_2,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_1024a_350_2,
+ NULL,
+ &_vq_auxt_res0_1024a_350_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_350_3.vqh b/include/vorbis/book/res0_1024a_350_3.vqh
new file mode 100644
index 00000000..d7790b07
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_350_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_350_3_VQH_
+#define _V_res0_1024a_350_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_350_3[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_1024a_350_3[] = {
+ 5, 6, 6, 7, 7, 7, 8, 9, 6, 7, 7, 7, 7, 8, 9, 6,
+ 6, 7, 7, 7, 8, 8,10, 6, 7, 7, 7, 8, 8, 9, 7, 7,
+ 7, 7, 7, 8, 9,10, 7, 7, 7, 7, 8, 9,10, 7, 7, 7,
+ 8, 8, 8, 9,10, 7, 7, 8, 8, 8, 9,10, 7, 7, 7, 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,10,10,10,10,10,11,
+ 12,10,10,10,10,10,11,12, 6, 6, 7, 7, 7, 8, 8, 9,
+ 6, 7, 7, 7, 8, 8, 9, 7, 7, 7, 7, 7, 8, 9,10, 7,
+ 7, 7, 7, 8, 9,10, 7, 7, 7, 8, 8, 8, 9,10, 7, 7,
+ 8, 8, 8, 9,10, 7, 7, 7, 8, 8, 8, 9,10, 7, 7, 8,
+ 8, 8, 9,10, 8, 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,10,10,10,10,10,11,12,10,10,10,10,10,11,
+ 12,
+};
+
+static float _vq_quantthresh_res0_1024a_350_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_350_3[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_1024a_350_3 = {
+ _vq_quantthresh_res0_1024a_350_3,
+ _vq_quantmap_res0_1024a_350_3,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_1024a_350_3 = {
+ 2, 225,
+ _vq_lengthlist_res0_1024a_350_3,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_1024a_350_3,
+ NULL,
+ &_vq_auxt_res0_1024a_350_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_350_4.vqh b/include/vorbis/book/res0_1024a_350_4.vqh
new file mode 100644
index 00000000..292d7b5c
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_350_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_350_4_VQH_
+#define _V_res0_1024a_350_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_350_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_350_4[] = {
+ 5, 6, 7, 7, 7, 8, 8, 8, 8,10, 6, 7, 7, 7, 7, 8,
+ 8, 8,10, 6, 6, 7, 8, 8, 8, 8, 8, 9,11, 6, 7, 8,
+ 8, 8, 8, 8, 9,11, 7, 7, 8, 8, 8, 8, 9, 9, 9,11,
+ 7, 8, 8, 8, 8, 9, 9, 9,11, 7, 8, 8, 8, 8, 8, 9,
+ 9,10,12, 8, 8, 9, 8, 9, 9, 9,10,12, 7, 8, 8, 8,
+ 8, 8, 9, 9, 9,12, 8, 8, 8, 8, 8, 9, 9, 9,12, 8,
+ 8, 8, 9, 8, 8, 9, 9,10,12, 8, 8, 9, 8, 8, 9, 9,
+ 10,12, 8, 8, 9, 9, 9, 9, 9, 9,10,12, 8, 9, 9, 9,
+ 9, 9, 9,10,12, 8, 9, 9, 9, 9, 9, 9,10,10,12, 9,
+ 9, 9, 9, 9, 9,10,10,12, 9, 9, 9,10,10,10,10,10,
+ 11,13, 9,10,10,10,10,10,10,11,13,10,11,12,12,12,
+ 12,13,13,13,15,11,12,12,12,13,13,13,13,15, 6, 6,
+ 7, 8, 8, 8, 8, 9, 9,11, 6, 7, 8, 8, 8, 8, 9, 9,
+ 11, 7, 7, 8, 8, 8, 8, 9, 9, 9,11, 7, 8, 8, 8, 8,
+ 9, 9, 9,11, 7, 8, 8, 8, 8, 9, 9, 9,10,12, 8, 8,
+ 9, 8, 9, 9, 9,10,12, 7, 8, 8, 8, 8, 8, 9, 9, 9,
+ 12, 8, 8, 8, 8, 8, 9, 9, 9,12, 8, 8, 8, 9, 8, 8,
+ 9, 9,10,12, 8, 8, 9, 8, 8, 9, 9,10,12, 8, 8, 9,
+ 9, 9, 9, 9, 9,10,12, 8, 9, 9, 9, 9, 9, 9,10,12,
+ 8, 9, 9, 9, 9, 9, 9,10,10,12, 9, 9, 9, 9, 9, 9,
+ 10,10,12, 9, 9, 9,10,10,10,10,10,11,13, 9, 9,10,
+ 10,10,10,10,11,13,10,11,12,12,12,12,13,13,13,15,
+ 11,12,12,12,12,13,13,13,15,
+};
+
+static float _vq_quantthresh_res0_1024a_350_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_350_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_350_4 = {
+ _vq_quantthresh_res0_1024a_350_4,
+ _vq_quantmap_res0_1024a_350_4,
+ 19,
+ 19
+};
+
+static static_codebook _vq_book_res0_1024a_350_4 = {
+ 2, 361,
+ _vq_lengthlist_res0_1024a_350_4,
+ 1, -526974976, 1611661312, 6, 0,
+ _vq_quantlist_res0_1024a_350_4,
+ NULL,
+ &_vq_auxt_res0_1024a_350_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_1024a_350_5.vqh b/include/vorbis/book/res0_1024a_350_5.vqh
new file mode 100644
index 00000000..bdc68bf7
--- /dev/null
+++ b/include/vorbis/book/res0_1024a_350_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_350_5_VQH_
+#define _V_res0_1024a_350_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_1024a_350_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_350_5[] = {
+ 4, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9,10,11,10, 6, 7,
+ 7, 7, 8, 8, 8, 8, 9, 9,10,11,10, 6, 7, 7, 8, 8,
+ 8, 8, 8, 9,10, 9,11,12,11, 7, 8, 8, 8, 8, 8, 8,
+ 9,10, 9,11,12,11, 7, 8, 8, 9, 9, 9, 9, 9, 9,10,
+ 10,12,13,12, 8, 8, 9, 9, 9, 9, 9, 9,10,10,12,12,
+ 12, 7, 8, 9, 9, 9, 9, 9, 9,10,11,11,12,13,12, 8,
+ 9, 9, 9, 9, 9, 9,10,11,10,12,13,12, 7, 8, 9, 9,
+ 9, 9, 9, 9, 9,10,10,12,13,12, 8, 9, 9, 9, 9, 9,
+ 9, 9,10,10,12,12,12, 8, 8, 9, 9, 9, 9, 9, 9, 9,
+ 10,10,12,13,12, 8, 9, 9, 9, 9, 9, 9, 9,10,10,11,
+ 12,11, 8, 9, 9, 9, 9, 9, 9, 9, 9,11,10,12,13,13,
+ 9, 9, 9, 9, 9, 9, 9, 9,11,10,12,12,12, 8, 9, 9,
+ 9, 9, 9, 9, 9,10,10,10,12,13,13, 9, 9, 9, 9, 9,
+ 9, 9, 9,11,10,11,12,12, 9, 9,10,10,10,10,10,10,
+ 10,11,11,13,14,13, 9,10,10,10,10,10,10,10,11,11,
+ 12,13,13,10,10,11,11,11,11,11,12,12,13,12,14,15,
+ 14,10,11,11,11,11,11,12,12,13,13,14,14,14, 9,10,
+ 11,12,12,12,12,12,12,13,14,15,17,15,10,11,12,12,
+ 12,12,12,12,13,15,16,16,15,11,12,13,14,14,14,14,
+ 15,15,15,17,18,18,15,12,13,14,14,15,15,15,15,16,
+ 18,18,17,15,11,13,14,16,15,15,16,16,18,18,18,20,
+ 18,16,13,14,15,15,15,17,17,17,20,19,20,20,15,10,
+ 12,13,13,13,13,13,14,14,15,15,15,15,12,12,13,13,
+ 13,13,13,14,15,15,15,15,16,12, 6, 7, 7, 8, 8, 8,
+ 8, 8, 9,10, 9,11,12,11, 7, 8, 8, 8, 8, 8, 8, 9,
+ 10, 9,11,12,11, 7, 8, 8, 9, 9, 9, 9, 9, 9,10,10,
+ 12,13,12, 8, 8, 9, 8, 9, 9, 9, 9,10,10,12,12,12,
+ 7, 8, 9, 9, 9, 9, 9, 9,10,11,11,12,13,12, 8, 9,
+ 9, 9, 9, 9, 9,10,11,10,12,13,12, 8, 8, 9, 9, 9,
+ 9, 9, 9, 9,10,10,12,13,12, 8, 9, 9, 9, 9, 9, 9,
+ 9,11,10,11,12,12, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,
+ 10,12,13,12, 8, 9, 9, 9, 9, 9, 9, 9,10,10,11,12,
+ 12, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,12,13,13, 9,
+ 9, 9, 9, 9, 9, 9, 9,11,10,12,12,12, 8, 9, 9, 9,
+ 9, 9, 9, 9,10,11,10,12,13,13, 9, 9, 9, 9, 9, 9,
+ 9,10,11,10,12,12,12, 9, 9,10,10,10,10,10,10,10,
+ 11,11,13,13,13, 9,10,10,10,10,10,10,10,11,11,12,
+ 13,13,10,10,11,11,11,11,11,12,12,13,13,14,15,14,
+ 10,11,11,11,11,12,11,12,13,12,13,14,14, 9,10,11,
+ 12,12,12,12,12,12,13,14,16,17,15,10,11,12,12,12,
+ 12,12,12,13,15,16,16,15,11,12,13,14,14,14,14,15,
+ 15,16,16,17,18,15,12,13,14,14,14,14,15,15,16,16,
+ 18,20,15,12,13,15,15,15,15,16,17,18,18,18,18,19,
+ 16,13,14,16,16,16,17,17,16,18, 0,19,20,15,10,11,
+ 13,13,12,13,13,14,14,15,16,16,16,12,12,12,13,13,
+ 13,13,14,14,15,15,16,16,12,
+};
+
+static float _vq_quantthresh_res0_1024a_350_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_350_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_350_5 = {
+ _vq_quantthresh_res0_1024a_350_5,
+ _vq_quantmap_res0_1024a_350_5,
+ 27,
+ 27
+};
+
+static static_codebook _vq_book_res0_1024a_350_5 = {
+ 2, 729,
+ _vq_lengthlist_res0_1024a_350_5,
+ 1, -522846208, 1611661312, 8, 0,
+ _vq_quantlist_res0_1024a_350_5,
+ NULL,
+ &_vq_auxt_res0_1024a_350_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..ca49a377
--- /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 float _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..81da6151
--- /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 float _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..3dcc0105
--- /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 float _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..23ec1803
--- /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 float _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..36a69ac0
--- /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 float _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_160_1.vqh b/include/vorbis/book/res0_128a_160_1.vqh
new file mode 100644
index 00000000..5393e8b5
--- /dev/null
+++ b/include/vorbis/book/res0_128a_160_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_160_1_VQH_
+#define _V_res0_128a_160_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_160_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_160_1[] = {
+ 2, 4, 4, 4, 6, 6, 4, 6, 6, 5, 7, 6, 6, 7, 8, 6,
+ 7, 8, 5, 6, 7, 6, 8, 7, 6, 8, 7, 6, 7, 7, 7, 8,
+ 9, 7, 8, 8, 7, 9, 8, 8, 9,10, 9,10, 9, 7, 8, 9,
+ 8,10, 9, 9,10,10, 6, 7, 7, 7, 8, 8, 7, 9, 9, 7,
+ 9, 8, 9,10, 9, 8, 9,10, 7, 8, 9, 9,10,10, 8,10,
+ 9,
+};
+
+static float _vq_quantthresh_res0_128a_160_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_128a_160_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_160_1 = {
+ _vq_quantthresh_res0_128a_160_1,
+ _vq_quantmap_res0_128a_160_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_128a_160_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_128a_160_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_128a_160_1,
+ NULL,
+ &_vq_auxt_res0_128a_160_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_160_2.vqh b/include/vorbis/book/res0_128a_160_2.vqh
new file mode 100644
index 00000000..f62117b5
--- /dev/null
+++ b/include/vorbis/book/res0_128a_160_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_160_2_VQH_
+#define _V_res0_128a_160_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_160_2[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_160_2[] = {
+ 4, 5, 7, 5, 7, 5, 6, 8, 6, 8, 7, 9,11, 9,11, 5,
+ 6, 8, 6, 8, 8, 9,11, 9,11, 5, 6, 9, 6, 9, 6, 7,
+ 10, 8,10, 9,10,13,10,13, 6, 7,10, 7,10, 9,10,13,
+ 10,13, 8, 9,12, 9,12, 9,10,13,10,13,12,13, 0,13,
+ 16, 9,10,13,10,13,12,13,17,13,16, 5, 6, 9, 6, 9,
+ 6, 7,10, 7,10, 9,10,13,10,12, 6, 7,10, 8,10, 9,
+ 10,13,10,12, 8, 9,12, 9,12, 9,10,13,10,13,12,13,
+ 16,13,14, 9,10,14,10,13,12,13,17,13,15, 6, 7, 9,
+ 7, 9, 7, 8,11, 8,10, 9,10,13,10,14, 7, 8,10, 8,
+ 10, 9,10,12,10,13, 7, 8,10, 8,10, 8, 9,11, 9,12,
+ 11,11,13,11,13, 8, 9,11, 9,11,10,12,14,11,14, 9,
+ 11,13,11,13,10,11,14,12,14,13,13,17,15, 0,11,12,
+ 15,12,16,13,15,17,14,17, 7, 8,10, 8,10, 8, 9,11,
+ 9,11,10,12,15,11,13, 8, 9,11, 9,12,10,11,14,11,
+ 14, 9,10,13,10,14,10,11,14,11,14,13,14,17,13,16,
+ 10,12,14,12,15,13,14,16,14, 0, 8,10,13, 9,12,10,
+ 11,13,11,14,13,14, 0,14,17,10,10,13,11,13,12,14,
+ 15,13,15,10,11,13,11,14,11,11,16,12,14,15,14,17,
+ 15, 0,11,12,14,12,13,13,16,17,14, 0,13,14,17,13,
+ 16,13,14,16,14,16,17,15, 0,16,17,13,14, 0,16,16,
+ 17,16,17,17, 0,10,11,14,11,14,11,12,14,11,14,14,
+ 15, 0,14,16,11,12,15,11,15,15,15,17,15,15,13,13,
+ 16,13,16,13,15,16,14,17,17,17, 0,16,17,14,16, 0,
+ 14, 0,17,17, 0,17, 0, 6, 7, 9, 7, 9, 7, 8,10, 8,
+ 10, 9,10,13,10,13, 7, 8,10, 8,10, 9,10,13,10,13,
+ 7, 8,10, 8,10, 8, 9,12, 9,11,10,11,14,12,14, 8,
+ 9,11, 9,12,10,11,13,11,14, 9,11,13,10,13,11,11,
+ 14,12,16,13,15,17,14,17,11,11,14,12,14,13,13,16,
+ 15,16, 7, 8,10, 8,10, 8, 9,11, 9,12,10,12,13,12,
+ 14, 8, 9,12, 9,11,10,12,15,11,14, 9,10,14,11,14,
+ 11,12,14,12,14,13,14,17,14,17,10,12,15,11,14,13,
+ 14,16,13,15, 9,10,12, 9,13,10,11,14,11,14,12,13,
+ 16,13,15,10,11,14,10,14,13,13,16,14,17, 9,11,14,
+ 10,14,11,12,15,12,15,13,15,17,15, 0,11,12,14,12,
+ 15,14,14, 0,15, 0,12,14,16,13,16,14,14,17,15,16,
+ 17,16, 0,16,17,13,15, 0,16,16,16,15, 0,16, 0,10,
+ 11,13,11,13,11,12,15,12,14,13,15, 0,15,17,11,12,
+ 14,12,14,13,16,17,14, 0,13,14,15,13,16,14,14,16,
+ 14,15,17,17, 0, 0, 0,13,15, 0,14, 0,14, 0,17,15,
+ 17,
+};
+
+static float _vq_quantthresh_res0_128a_160_2[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_128a_160_2[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_160_2 = {
+ _vq_quantthresh_res0_128a_160_2,
+ _vq_quantmap_res0_128a_160_2,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_128a_160_2 = {
+ 4, 625,
+ _vq_lengthlist_res0_128a_160_2,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_160_2,
+ NULL,
+ &_vq_auxt_res0_128a_160_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_160_3.vqh b/include/vorbis/book/res0_128a_160_3.vqh
new file mode 100644
index 00000000..7e9a27b6
--- /dev/null
+++ b/include/vorbis/book/res0_128a_160_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_160_3_VQH_
+#define _V_res0_128a_160_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_160_3[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_160_3[] = {
+ 4, 5, 7, 7, 5, 7, 7, 5, 7, 9, 9, 7, 9, 9, 7, 9,
+ 11,11, 9,10,13, 8,10,12,15,10,12, 0, 6, 7, 9, 9,
+ 7, 9, 9, 8, 9,11,11, 9,11,13, 8,10,12,14,10,11,
+ 14, 6, 7, 9,10, 7, 9,10, 7, 8,10,11, 8,10,11, 9,
+ 10,13,12,10,13,13,10,11,14,15,11,13,14, 7, 8,10,
+ 11, 8,10,11, 9,10,12,12,10,13, 0,10,11,12,15,11,
+ 13,15, 8, 9,11,13, 9,12,13, 9,10,13,14,10,14,13,
+ 11,12,15, 0,12,15,14,13,13,15,15,13,15, 0, 9,10,
+ 13,14,11,12,14,11,12,13,15,14,14, 0,13,14,14, 0,
+ 15, 0, 0, 9,10,13,15,10,14,15,10,11,13, 0,12,14,
+ 0,13,15, 0,15,13, 0, 0,15,15, 0, 0, 0, 0, 0,10,
+ 11,14,15,11,14,14,12,14,15, 0,13,15, 0,15,15, 0,
+ 0, 0, 0, 0, 6, 7, 9,10, 7, 9, 9, 7, 8,10,11, 8,
+ 10,11, 9,11,12,13,10,12,13,10,11,13,14,11,14,14,
+ 7, 8,10,11, 8,10,11, 9,10,13,13,10,12,13,10,11,
+ 13,15,11,13,15, 8, 9,12,12, 9,11,13, 9,11,13,14,
+ 11,12,14,11,12,14, 0,12,14, 0,12,14, 0, 0,14,14,
+ 15, 9,10,14,15,10,13,14,12,13,15,15,13, 0, 0,12,
+ 14, 0, 0,14,15,15, 9,10,13,14,10,13, 0,10,12,15,
+ 0,11,13, 0,12,14, 0, 0,14,15, 0,15,15, 0, 0,14,
+ 15, 0,10,12,14, 0,11,13, 0,12,13,15, 0,14,15,15,
+ 0,15, 0, 0,14, 0, 0, 6, 7, 9,10, 7,10,10, 7, 8,
+ 10,11, 8,11,11, 9,10,12,14,10,13,13,10,11,14,14,
+ 11,13, 0, 7, 8,10,11, 8,10,11, 9,11,12,13,11,13,
+ 13,10,11,15, 0,11,13, 0, 7, 8,10,12, 8,10,11, 8,
+ 9,11,13, 9,12,13,10,12,14,13,12,12,15,12,12,15,
+ 0,12,15,15, 8, 9,12,13, 9,12,12,11,12,14,14,11,
+ 13,13,11,12, 0,14,12, 0,14, 9,11,12,14,10,13,13,
+ 10,11,13,15,12,14, 0,13,13,15,15,13,14, 0,14,14,
+ 14, 0, 0, 0, 0,10,11,13,15,12,13,15,13,14,15, 0,
+ 0,15, 0,13, 0, 0, 0,15, 0, 0,10,11,14, 0,11,13,
+ 15,11,12, 0, 0,12,15, 0,13,14, 0, 0,13, 0, 0, 0,
+ 0, 0, 0,14, 0, 0,12,13,14, 0,13, 0, 0,15,14, 0,
+ 0, 0,15, 0,14, 0, 0, 0, 0, 0, 0, 7, 8,11,11, 8,
+ 11,11, 8,10,11,12,10,11,12,10,11,14,14,11,14,14,
+ 11,13, 0, 0,12,14,15, 8, 9,12,13, 9,12,13,10,11,
+ 13,15,12,13,15,11,12,14,14,12,13, 0,10,10,12,14,
+ 10,15,14,10,11,13,14,11,14,14,12,13, 0, 0,13,15,
+ 15,14,14, 0, 0,14, 0, 0,11,11,14,15,12,14,14,13,
+ 13,15, 0,14, 0, 0,13,15, 0, 0,15,15, 0,10,12,15,
+ 14,11,14,15,12,12, 0, 0,14,14, 0,13, 0, 0, 0,14,
+ 0, 0,14, 0, 0, 0, 0, 0, 0,12,13,14, 0,13,15, 0,
+ 13,14, 0, 0,15, 0, 0, 0, 0, 0, 0,15, 0, 0, 8,10,
+ 13,13,10,11,14,10,11,14,14,11,13,13,12,12,14,14,
+ 12,14, 0,13,15,14, 0,14,15, 0,10,10,12,13,11,13,
+ 14,12,13,14,15,13,15, 0,14,15, 0, 0,14, 0, 0, 9,
+ 11,13,14,11,12,13,11,12,13,15,12,15, 0,14,14, 0,
+ 0, 0, 0, 0,12,14, 0, 0,15, 0, 0,11,12,14,14,11,
+ 14,14,12,13,15, 0,13,14, 0,14,14, 0, 0,15, 0, 0,
+ 12,12,13,15,12, 0,14,12,14, 0, 0,13,15, 0,14,15,
+ 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,14,15, 0,
+ 15,15, 0,15,14, 0, 0, 0,15, 0, 0,15,15, 0, 0, 0,
+ 0,13,12, 0, 0,13,15, 0,14,14,15, 0,15, 0,15, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0,15,
+ 0, 0, 0, 0,14, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,10,11,13,15,11,12,15,11,12,13,14,12,13,14,
+ 14, 0,15, 0,13, 0, 0,14, 0, 0, 0,15,14, 0,10,11,
+ 12,14,11,14,14,14,14, 0, 0,14, 0, 0,13,15,15, 0,
+ 0, 0, 0,12,13,14,15,12,15, 0,12,14,15, 0,14, 0,
+ 0,14, 0, 0, 0,15, 0, 0, 0, 0, 0, 0,15, 0, 0,13,
+ 15, 0,15,14, 0,15,13,15, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,13, 0, 0, 0,14, 0, 0,14, 0, 0, 0,14,
+ 0, 0,14, 0, 0,15,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 14,14, 0, 0, 0, 0, 0,15, 0,15, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 9,10,13, 0,11,13, 0,10,12,14,14,
+ 12,14, 0,12, 0,14, 0,14, 0, 0,14, 0, 0, 0,15, 0,
+ 0,10,11,15,15,12,14,15,13,13, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 0, 0,10,12,14, 0,11,14,15,11,13, 0,
+ 15,13,14,15,13, 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0,12,12,15, 0,12,15, 0,13,15, 0,14,15, 0, 0,
+ 15, 0, 0, 0, 0, 0, 0,13,13, 0, 0,13,15, 0,13,15,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,14,15,15, 0,15, 0, 0, 0,15, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,15,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 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,11,14, 0,12, 0, 0,
+ 12,13,14,15,13, 0, 0,13, 0, 0, 0, 0,15, 0,15, 0,
+ 0, 0, 0, 0, 0,12,13,14, 0,13, 0, 0,13,14, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,15, 0, 0,13,14,15, 0,15, 0,
+ 0,14,14,15, 0, 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,15,14, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0,
+ 0, 0,14, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7,10,10,
+ 7, 9,10, 7, 8,11,11, 8,10,12, 9,10,12,13,10,12,
+ 15,10,12,13,14,12,15, 0, 7, 8,10,11, 8,11,12, 9,
+ 10,13,13,10,12,13,10,12,13,15,11,15, 0, 7, 8,11,
+ 11, 8,11,11, 8, 9,11,12, 9,11,12,10,12,14,15,12,
+ 13, 0,12,13,14,15,14, 0, 0, 8, 9,11,13, 9,12,13,
+ 10,12,13,14,11,15,15,12,12,13,14,14,14, 0,10,11,
+ 12,15,10,12,14,10,13,15,15,11,15,14,13,13,14, 0,
+ 13,13, 0,13,15, 0, 0, 0, 0, 0,10,11,13,14,11,15,
+ 14,12,15, 0, 0,14,15, 0,14,15,15, 0,14,15, 0,10,
+ 12, 0, 0,11,14, 0,11,12, 0, 0,12,14, 0,15, 0,14,
+ 0,14, 0, 0,15, 0, 0, 0, 0, 0, 0,12,13, 0, 0,13,
+ 15, 0,13, 0,15, 0,14,15, 0,14,14, 0, 0, 0, 0, 0,
+ 7, 8,11,11, 8,10,11, 8, 9,12,12,10,11,12,10,12,
+ 13,13,12,15,14,11,12,15, 0,12,14, 0, 8, 9,12,14,
+ 9,12,12,11,12,14,14,11,13,15,12,13,14,14,12,14,
+ 0, 9,10,13,15,10,13,15,11,11,14,14,12,14,15,12,
+ 14, 0,15,15, 0, 0,12,14, 0, 0,15, 0, 0,11,12,13,
+ 0,11,14,13,13,13, 0,15,13,14, 0,15, 0, 0, 0,14,
+ 15, 0,11,12, 0, 0,12,15, 0,12,14, 0,14,13, 0,15,
+ 13,14, 0, 0,15, 0,15,15, 0, 0, 0, 0, 0, 0,12,14,
+ 14,15,13,14, 0,14, 0, 0, 0,13, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8, 9,12,14, 9,11,13, 9,10,13,15,10,13,
+ 13,12,13,15, 0,13, 0, 0,14,13, 0, 0,15,15,15, 9,
+ 11,13,14,10,13,13,11,13,14,15,13,15, 0,13,13, 0,
+ 15,15,15, 0,10,11,12,14,11,13,15,11,12,15,15,12,
+ 14, 0,12,15,15, 0,15,15, 0,13,14, 0, 0,15,15, 0,
+ 11,11, 0, 0,12,14, 0,14,13,15, 0,15,15, 0,14,14,
+ 0, 0, 0, 0, 0,12,13, 0, 0,15,14,14,12,14, 0, 0,
+ 14,15, 0,14,15, 0, 0,15,14, 0,15,15, 0, 0, 0, 0,
+ 0,14,13,14, 0,14, 0, 0,14,15, 0, 0, 0, 0, 0,15,
+ 0, 0, 0,15, 0, 0,12,15, 0, 0,13,15, 0,15, 0, 0,
+ 0,13, 0, 0,14, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,14,15, 0, 0,13,15, 0,15,14, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,10,11,13, 0,11,13,15,11,12,
+ 13, 0,12,14, 0,12,14,15, 0,13, 0,15,13, 0, 0, 0,
+ 15, 0, 0,11,12,13,14,12,14, 0,13,14,14, 0,13,14,
+ 0, 0,15, 0,15, 0, 0, 0,12,13,14, 0,12, 0, 0,12,
+ 0,15, 0,14,15, 0,14,15, 0, 0,15, 0, 0, 0, 0, 0,
+ 0,15, 0, 0,13,14,15, 0,13,15,15,14,14, 0, 0,15,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0,14, 0, 0,
+ 14, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0,
+ 0, 0, 0, 0, 0,13,15, 0, 0,14, 0, 0,14, 0, 0, 0,
+ 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,11,14, 0,10,13,
+ 0,10,12,14, 0,11,14, 0,14,15,15,14,14, 0, 0,14,
+ 0, 0, 0,15, 0, 0,10,11,14,14,12,14,14,13,14,15,
+ 0,14,15, 0,15, 0, 0, 0,14, 0, 0,10,12,14, 0,12,
+ 14, 0,12,13,15, 0,13,15, 0,13, 0, 0, 0, 0, 0, 0,
+ 14, 0, 0, 0, 0, 0, 0,14,12, 0, 0,13,15, 0,14, 0,
+ 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,14, 0, 0,
+ 14,15, 0,13,14, 0, 0,15, 0, 0,15,15, 0, 0,15, 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,15, 0,
+ 0,14, 0, 0, 0,15, 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,
+ 15, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,12,
+ 15, 0,12,14,15,12,13,15, 0,12, 0, 0,14,15, 0, 0,
+ 14, 0, 0,15, 0, 0, 0, 0, 0, 0,12,13,15, 0,13,15,
+ 15,14, 0, 0, 0, 0,15, 0,14, 0, 0, 0,15, 0, 0,14,
+ 13,15, 0,13, 0, 0,15,14, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0,14,
+ 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0,
+ 15,15, 0, 0,15, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_128a_160_3[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_128a_160_3[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_160_3 = {
+ _vq_quantthresh_res0_128a_160_3,
+ _vq_quantmap_res0_128a_160_3,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_128a_160_3 = {
+ 4, 2401,
+ _vq_lengthlist_res0_128a_160_3,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_160_3,
+ NULL,
+ &_vq_auxt_res0_128a_160_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_160_4.vqh b/include/vorbis/book/res0_128a_160_4.vqh
new file mode 100644
index 00000000..1e33866a
--- /dev/null
+++ b/include/vorbis/book/res0_128a_160_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_160_4_VQH_
+#define _V_res0_128a_160_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_160_4[] = {
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 3,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_160_4[] = {
+ 2, 4, 5, 7, 6, 3, 5, 7, 6, 4, 5, 7, 9, 8, 5, 7,
+ 8, 8, 6, 7, 8,10, 9, 7, 9,10,10, 7, 8,10,11,12,
+ 9,11,12,12, 7, 8,11,14,14, 8,11,12,13, 4, 5, 7,
+ 8, 8, 5, 7, 8, 8, 6, 7, 9,10,10, 7, 9,10,10, 8,
+ 8,10,12,11, 9,11,13,12, 7, 8,10,13,13, 9,11,12,
+ 13,
+};
+
+static float _vq_quantthresh_res0_128a_160_4[] = {
+ -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5,
+};
+
+static long _vq_quantmap_res0_128a_160_4[] = {
+ 8, 7, 6, 5, 0, 1, 2, 3,
+ 4,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_160_4 = {
+ _vq_quantthresh_res0_128a_160_4,
+ _vq_quantmap_res0_128a_160_4,
+ 9,
+ 9
+};
+
+static static_codebook _vq_book_res0_128a_160_4 = {
+ 2, 81,
+ _vq_lengthlist_res0_128a_160_4,
+ 1, -531628032, 1611661312, 4, 0,
+ _vq_quantlist_res0_128a_160_4,
+ NULL,
+ &_vq_auxt_res0_128a_160_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_160_5.vqh b/include/vorbis/book/res0_128a_160_5.vqh
new file mode 100644
index 00000000..e5c7ffd3
--- /dev/null
+++ b/include/vorbis/book/res0_128a_160_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_160_5_VQH_
+#define _V_res0_128a_160_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_160_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_160_5[] = {
+ 3, 4, 5, 6, 6, 6, 6, 7, 9,14,18, 0, 4, 5, 6, 6,
+ 6, 6, 7, 9,13,17, 0, 5, 5, 6, 7, 7, 7, 7, 8,10,
+ 13, 0, 0, 5, 6, 7, 7, 7, 7, 8,10,14,18, 0, 7, 7,
+ 8, 9, 9, 9, 9, 9,12,15, 0, 0, 7, 8, 9, 9, 9, 9,
+ 9,11,16, 0, 0, 9, 9,10,11,10,10,11,12,14, 0, 0,
+ 0, 9,10,10,11,11,11,11,13,18, 0, 0,10,10,11,12,
+ 12,12,12,13,14,18, 0, 0,10,11,12,12,12,12,13,16,
+ 0, 0, 0,11,12,13,14,14,14,14,17,17, 0, 0, 0,12,
+ 13,14,14,14,14,15,16,18, 0, 0,12,14,15,15,16,15,
+ 16,17, 0, 0, 0, 0,14,15,17,16,16,18,17, 0, 0, 0,
+ 0,13,17, 0, 0,18, 0, 0, 0,18, 0, 0, 0,16,17,17,
+ 18, 0,18, 0, 0, 0, 0, 0,14,17,18,18, 0, 0, 0, 0,
+ 0, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,17,
+ 18, 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,18, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 5, 5, 6, 7, 7, 7, 7, 8,10,14, 0, 0,
+ 5, 6, 7, 7, 7, 7, 8,10,14,18, 0, 7, 7, 8, 9, 9,
+ 9, 9, 9,11,15, 0, 0, 7, 8, 9, 9, 9, 9, 9,11,17,
+ 0, 0, 9, 9,10,11,10,11,11,11,14,17, 0, 0, 9,10,
+ 10,11,11,11,11,14, 0, 0, 0,10,11,11,12,12,12,12,
+ 13,15,18, 0, 0,11,11,12,12,12,12,13,15, 0, 0, 0,
+ 11,12,13,14,14,14,14,16,17, 0, 0, 0,12,13,14,13,
+ 15,14,15,16, 0, 0, 0,12,14,15,16,16,17,15, 0,18,
+ 0, 0, 0,14,16,17,16,16,16,18, 0, 0, 0, 0,14,17,
+ 16,18, 0, 0,16, 0, 0, 0, 0, 0,15,18,17,18,18, 0,
+ 0, 0, 0, 0, 0,14,17, 0,18, 0,18, 0, 0, 0, 0, 0,
+ 0,17,18,18, 0, 0, 0, 0, 0, 0, 0, 0,15,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,18, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_128a_160_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_160_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_160_5 = {
+ _vq_quantthresh_res0_128a_160_5,
+ _vq_quantmap_res0_128a_160_5,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_128a_160_5 = {
+ 2, 529,
+ _vq_lengthlist_res0_128a_160_5,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_128a_160_5,
+ NULL,
+ &_vq_auxt_res0_128a_160_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_192_1.vqh b/include/vorbis/book/res0_128a_192_1.vqh
new file mode 100644
index 00000000..7b7718c6
--- /dev/null
+++ b/include/vorbis/book/res0_128a_192_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_192_1_VQH_
+#define _V_res0_128a_192_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_192_1[] = {
+ 1,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_192_1[] = {
+ 1, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 8, 7,
+ 8, 8, 5, 7, 7, 7, 8, 8, 7, 9, 8, 7, 8, 8, 9,10,
+ 10, 8, 9, 9, 9,10, 9,10, 9,11,10,11,11, 9, 9,10,
+ 10,11,10,10,11,11, 7, 8, 8, 8, 9, 9, 9,10,10, 9,
+ 10, 9,10,11,11,10,10,11, 9,10,10,10,11,11, 9,11,
+ 8,
+};
+
+static float _vq_quantthresh_res0_128a_192_1[] = {
+ -0.5, 0.5,
+};
+
+static long _vq_quantmap_res0_128a_192_1[] = {
+ 2, 0, 1,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_192_1 = {
+ _vq_quantthresh_res0_128a_192_1,
+ _vq_quantmap_res0_128a_192_1,
+ 3,
+ 3
+};
+
+static static_codebook _vq_book_res0_128a_192_1 = {
+ 4, 81,
+ _vq_lengthlist_res0_128a_192_1,
+ 1, -535822336, 1611661312, 2, 0,
+ _vq_quantlist_res0_128a_192_1,
+ NULL,
+ &_vq_auxt_res0_128a_192_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_192_2.vqh b/include/vorbis/book/res0_128a_192_2.vqh
new file mode 100644
index 00000000..ca3f9628
--- /dev/null
+++ b/include/vorbis/book/res0_128a_192_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_192_2_VQH_
+#define _V_res0_128a_192_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_192_2[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_192_2[] = {
+ 4, 5, 6, 5, 6, 5, 6, 7, 6, 7, 7, 8,10, 8,10, 5,
+ 6, 7, 6, 7, 7, 8,10, 8,10, 6, 7, 8, 6, 8, 7, 7,
+ 9, 7, 9, 9, 9,11, 9,11, 7, 7, 9, 7, 9, 9, 9,11,
+ 10,11, 9, 9,11, 9,11, 9,10,12,10,12,11,11,13,12,
+ 13, 9,10,11,10,11,11,11,13,12,13, 6, 6, 8, 7, 8,
+ 7, 7, 9, 7, 9, 9, 9,11, 9,11, 7, 7, 9, 7, 9, 9,
+ 9,11, 9,10, 8, 9,11, 9,11, 9,10,11,10,12,11,12,
+ 13,12,13, 9,10,11,10,11,11,12,13,11,13, 7, 7, 9,
+ 7, 9, 8, 8,10, 8,10,10,10,12,10,11, 7, 8, 9, 8,
+ 10, 9,10,11,10,12, 8, 8,10, 8,10, 8, 9,10, 9,10,
+ 10,10,12,11,13, 8, 9,10, 9,10,10,11,12,10,12,10,
+ 11,12,10,12,10,11,12,11,12,12,11,13,12,14,10,11,
+ 13,11,13,13,13,15,12,16, 8, 8,10, 8,10, 8, 9,11,
+ 9,10,10,11,12,10,12, 8, 9,10, 9,11,10,11,12,11,
+ 12,10,11,12,11,12,10,11,12,11,13,12,14,15,11,12,
+ 11,11,12,11,12,12,12,14,13,13, 9,10,12,10,12,10,
+ 11,12,11,13,12,13,14,13,15,10,11,12,11,12,12,12,
+ 14,12,14,10,11,13,11,12,11,11,13,11,13,13,13,15,
+ 13,14,11,12,13,12,12,13,13,14,13,14,12,13,15,13,
+ 13,12,13,14,12,15,14,13,14,14,15,12,13,14,14,15,
+ 14,15,18,15,18,10,11,13,11,12,11,11,13,12,13,13,
+ 14,15,13,14,11,11,13,11,13,13,13,15,14,14,12,12,
+ 14,13,14,12,12,16,12,15,14,15,15,13,15,13,13,15,
+ 14,15,14,14,16,15,17, 7, 7, 9, 7, 9, 7, 8, 9, 8,
+ 9, 9,10,11,10,11, 8, 8,10, 8,10, 9,10,11,10,12,
+ 8, 8,10, 8,10, 9, 9,11, 9,10,10,10,12,10,12, 8,
+ 9,10, 9,10,10,10,11,11,13,10,10,12,10,12,11,11,
+ 13,11,12,12,12,14,12,14,10,11,12,11,12,12,11,12,
+ 13,14, 8, 8,10, 8,10, 8, 9,10, 9,11,10,11,12,10,
+ 12, 8, 9,11, 9,10,10,11,12,11,11,10,10,12,11,12,
+ 11,11,12,11,13,12,12,14,13,14,10,11,12,10,12,12,
+ 12,14,11,12,10,10,12,10,12,11,11,12,11,13,12,12,
+ 14,12,13,11,11,12,11,12,12,13,14,13,14,10,11,13,
+ 10,11,11,11,13,11,12,13,13,15,13,14,11,11,13,11,
+ 13,13,13,14,13,14,12,12,15,13,13,13,13,16,12,14,
+ 14,15,15,15,15,12,12,14,13,14,13,13,14,15,15,10,
+ 11,12,11,13,11,12,12,11,13,12,13,15,13,16,11,11,
+ 13,11,13,12,13,14,13,14,13,13,14,13,14,14,13,14,
+ 13,14,14,14,16,15,16,12,13,14,13,13,13,14,16,14,
+ 16,
+};
+
+static float _vq_quantthresh_res0_128a_192_2[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_128a_192_2[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_192_2 = {
+ _vq_quantthresh_res0_128a_192_2,
+ _vq_quantmap_res0_128a_192_2,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_128a_192_2 = {
+ 4, 625,
+ _vq_lengthlist_res0_128a_192_2,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_192_2,
+ NULL,
+ &_vq_auxt_res0_128a_192_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_192_3.vqh b/include/vorbis/book/res0_128a_192_3.vqh
new file mode 100644
index 00000000..def392f2
--- /dev/null
+++ b/include/vorbis/book/res0_128a_192_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_192_3_VQH_
+#define _V_res0_128a_192_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_192_3[] = {
+ 3,
+ 4,
+ 5,
+ 6,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_192_3[] = {
+ 5, 6, 7, 8, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 8, 9,
+ 10,11, 9,10,11, 9,10,11,13,10,11,13, 6, 7, 8, 9,
+ 7, 8, 9, 8, 8,10,11, 9,10,11, 9,10,11,13,10,11,
+ 13, 7, 7, 9,10, 7, 9, 9, 7, 8, 9,10, 8, 9,10, 9,
+ 9,11,11, 9,11,12,10,10,12,14,11,12,14, 7, 8, 9,
+ 10, 8, 9,10, 9, 9,10,11, 9,10,12,10,11,12,13,11,
+ 12,14, 9, 9,11,12, 9,11,12, 9,10,11,12,10,11,12,
+ 10,10,12,14,11,12,13,12,12,13,15,12,14,15, 9,10,
+ 11,12,10,11,12,10,10,12,13,11,12,14,11,12,14,14,
+ 12,15,16,11,11,12,14,11,12,14,11,11,13,15,11,12,
+ 17,12,12,13,16,12,13, 0,14,14,15,16,15,16,17,11,
+ 11,13,15,11,13,15,12,12,13,16,13,14,16,14,14,16,
+ 17,14,15,16, 7, 7, 9, 9, 7, 9, 9, 8, 8, 9,10, 8,
+ 9,10, 9, 9,11,12, 9,10,11,10,11,12,13,11,12,13,
+ 8, 8, 9,10, 8, 9,10, 9, 9,11,12, 9,10,12,10,11,
+ 12,14,11,12,12, 9, 9,10,11,10,11,11, 9,10,11,12,
+ 10,11,12,10,11,12,13,11,12,14,12,12,14,15,12,13,
+ 14, 9,10,11,12,10,11,13,10,11,12,13,11,12,13,12,
+ 12,13,15,12,13,15,10,11,12,14,11,12,14,11,11,12,
+ 14,11,12,14,12,12,13,17,13,14,16,14,14,15,16,14,
+ 15, 0,11,11,13,14,11,13,15,12,13,14,16,12,14,14,
+ 15,14,15,15,15,17,15, 7, 8, 9,10, 8, 9,10, 8, 9,
+ 10,11, 8,10,11, 9,10,11,12,10,11,12,10,12,13,14,
+ 11,12,14, 8, 8,10,11, 8, 9,11, 9, 9,11,12,10,11,
+ 12,10,11,12,14,11,12,13, 8, 9,10,11, 9,10,11, 8,
+ 9,10,11, 9,10,11,10,10,11,12,10,11,13,11,12,13,
+ 14,12,13,15, 9, 9,10,11, 9,10,11,10,10,11,12,10,
+ 11,12,11,11,12,14,12,13,14,10,10,11,12,10,11,12,
+ 10,10,11,13,10,12,13,11,11,12,13,11,12,15,13,13,
+ 13,15,13,15,16,10,10,12,13,10,11,13,11,11,12,14,
+ 12,13,14,12,12,14,16,13,15,17,11,12,12,15,12,12,
+ 14,12,12,13,15,12,13,15,12,13,14,14,13,14,16,14,
+ 14,15, 0,15,16,17,12,12,13,15,11,14,16,12,14,14,
+ 16,13,14,15,15,14, 0,16,16,16,17, 8, 9,10,10, 9,
+ 10,11, 8, 9,10,11, 9,10,11,10,10,11,12,10,11,12,
+ 11,12,12,15,11,12,15, 9, 9,10,11, 9,10,11,10,10,
+ 11,12,10,11,13,11,11,12,14,12,12,14,10,10,11,12,
+ 10,11,13,10,10,11,12,10,11,12,11,11,12,15,11,12,
+ 13,13,13,15,16,12,14,15,10,10,11,13,10,11,13,11,
+ 11,13,14,11,13,14,13,13,15, 0,13,15,16,11,11,13,
+ 15,12,13,15,11,12,13,15,12,14,15,12,14,14,15,12,
+ 13,16,14,14,16,17,14,15,16,12,12,13,15,12,13,17,
+ 13,13,14,17,13,14,15,14,16,16, 0,15,16, 0,10,10,
+ 11,12,10,11,12,10,10,11,12,10,12,12,11,11,13,14,
+ 11,13,13,13,13,15,15,13,14,15,10,10,11,12,10,11,
+ 13,11,11,12,14,12,12,13,12,13,14,15,13,14,15,10,
+ 10,11,13,10,11,13,10,11,12,14,11,12,13,11,12,13,
+ 14,12,13,16,13,13,14,16,14,15,16,10,11,12,13,11,
+ 12,13,11,12,13,13,11,12,14,12,13,14,16,14,14,15,
+ 11,12,13,14,11,13,13,12,11,13,14,11,13,15,12,12,
+ 14,14,13,14,16,15,14,15, 0,14,15,16,12,12,13,15,
+ 12,12,14,12,13,14,17,13,14,16,14,14,15,17,15,16,
+ 15,12,13,15,14,13,13,16,13,13,15,15,13,16,15,14,
+ 14,14,16,14,15,17,16,15,15,17,16,16, 0,13,13,14,
+ 15,13,15,16,14,14,16,17,15,14,17,16,15,16,17,17,
+ 17, 0,10,11,12,13,11,12,13,10,11,12,13,11,12,13,
+ 11,12,13,14,12,12,14,13,13,14,17,14,14,15,10,11,
+ 12,13,11,11,13,12,11,13,15,12,13,15,13,13,14,16,
+ 14,14,16,11,11,13,14,12,12,15,11,12,13,14,12,13,
+ 14,12,13,14,16,13,13,15,14,15,15, 0,14,15, 0,12,
+ 12,12,14,12,13,15,12,14,13,14,13,14,15,15,16,16,
+ 17,14,15, 0,12,13,14,15,13,14, 0,13,14,15,16,13,
+ 14, 0,14,14,16,17,13,15,16,17,16, 0,17,15,15,17,
+ 13,13,15,16,13,15,16,15,15, 0,15,14,16, 0,16,17,
+ 0, 0,16, 0, 0,11,12,13,14,12,12,14,12,12,13,15,
+ 12,13,14,13,13,15,16,13,14,16,15,15, 0, 0,14,15,
+ 0,12,12,13,15,12,14,14,12,12,14,16,13,14,15,14,
+ 14,17,17,14,16,17,12,12,14,16,12,13,15,12,13,14,
+ 15,12,14,15,13,13,15,15,14,15,16,15,16,17,17,16,
+ 16, 0,12,12,13,15,13,13,16,13,14,15,16,13,14,15,
+ 14,16, 0,16,16,16,17,13,13,14,15,14,15,15,13,13,
+ 15,17,13,15,15,15,15,15,17,16,17,17,16,17,16, 0,
+ 17, 0, 0,13,14,15, 0,14,15,17,14,15,15,16,15,16,
+ 0,15,17,16,17,16, 0, 0,16,15, 0,17,15,15,17,15,
+ 14,16,16,16,16,17,17,16,15, 0,15,16, 0, 0, 0,17,
+ 0, 0, 0, 0,15,15,15,17,15,16, 0,15,16, 0, 0, 0,
+ 16, 0,17, 0, 0, 0, 0, 0, 0,12,13,14,14,12,13,14,
+ 12,12,13, 0,12,13,15,14,14,14,15,14,16,16,15,16,
+ 17, 0,15,16,16,12,13,13,15,13,13,15,14,13,14,17,
+ 14,15,17,14,14,15,17,16,16,17,13,13,14,15,14,14,
+ 16,13,13,15,15,13,14,16,14,15,16,17,15,15,16,15,
+ 16, 0, 0,16,16,17,13,13,15,16,13,15,16,15,14,16,
+ 0,15,16,17,16,16,17,17,16, 0, 0,14,15,16,16,15,
+ 15, 0,16,15,16,17,16,15, 0,16,17,16, 0,17, 0, 0,
+ 0,16,17, 0,16,17,17,15,15,16,17,16,16, 0,16,17,
+ 17, 0,17,17, 0,17,16, 0, 0,17, 0, 0, 7, 8, 9,10,
+ 8, 9,10, 8, 8,10,10, 8, 9,11, 9,10,11,12,10,11,
+ 12,11,11,12,14,11,12,13, 8, 8,10,11, 9,10,11,10,
+ 10,11,12,10,11,12,11,11,12,15,11,12,14, 8, 9,10,
+ 11, 9,10,11, 9, 9,10,11, 9,10,11,10,10,11,13,10,
+ 11,13,11,11,13,15,12,13,14, 9, 9,10,11, 9,10,11,
+ 10,10,11,12,10,11,12,11,11,13,15,12,13,14,10,10,
+ 11,12,10,11,12,10,11,12,13,10,11,13,11,12,13,15,
+ 12,13,14,13,13,14,16,13,15,16,10,10,12,12,10,11,
+ 13,11,11,12,14,11,12,14,13,12,13,15,13,14,16,11,
+ 12,13,15,11,13,14,12,12,13,15,12,13,15,12,13,14,
+ 16,13,15,17,14,15,16, 0,15,15,17,12,12,13,15,11,
+ 13,15,13,13,15,15,13,14,15,14,14,15,17,16,17,17,
+ 8, 8,10,11, 9,10,11, 9, 9,10,11, 9,10,11,10,10,
+ 11,12,10,12,12,11,12,13,14,12,13,14, 8, 9,10,11,
+ 9,10,11,10,11,11,13,10,11,13,11,12,13,14,11,13,
+ 15,10,10,11,12,10,11,13,10,10,11,13,11,12,13,11,
+ 11,12,15,11,12,14,13,13,14,15,13,13,16,10,10,11,
+ 12,10,11,13,11,12,13,14,11,12,14,12,14,14,15,13,
+ 13,15,12,12,13,14,12,12,15,11,12,13,14,12,14,15,
+ 12,13,14,17,13,15,16,14,15,16,17,15,15, 0,11,12,
+ 13,14,12,13,14,13,13,14,17,12,14,15,14,15,16, 0,
+ 14,15, 0, 9,10,11,12,10,11,12,10,10,11,12,10,11,
+ 13,11,11,12,15,11,12,13,13,12,14,16,13,14,16,10,
+ 10,11,13,10,11,13,11,11,13,14,12,13,14,12,13,14,
+ 14,12,15,15,10,10,12,13,10,11,13,10,11,11,13,11,
+ 12,14,12,12,13,13,12,12,14,13,13,14,15,13,14,15,
+ 10,11,12,13,11,12,13,12,12,13,14,13,13,14,13,13,
+ 14,17,14,15,17,11,11,13,14,12,12,13,11,12,13,15,
+ 12,13,13,13,13,14,15,13,14,15,14,14,15, 0,14,15,
+ 17,12,12,13,15,12,13,14,13,13,13,15,13,14,15,14,
+ 14,15,17,15,16,17,13,13,14,15,13,14,15,13,14,15,
+ 17,13,14,15,15,15,15, 0,15,15, 0,16,17, 0, 0,16,
+ 0,17,13,13,15,15,14,14,16,14,14,14,16,15,16,17,
+ 15,15,15,17,16,16, 0,10,10,12,13,11,12,13,10,11,
+ 12,13,11,12,14,11,11,12,14,12,13,14,13,13,14,16,
+ 13,15,15,10,11,11,13,10,12,13,12,12,13,15,12,13,
+ 14,13,13,15,16,13,15,16,11,12,12,14,12,12,14,12,
+ 12,13,14,12,13,14,13,14,14,15,13,14,16,14,15,15,
+ 17,15,16,17,11,12,13,15,11,13,14,13,13,15,16,12,
+ 14,14,13,14,16,17,15,15,16,14,15,15,16,13,15,16,
+ 14,14,15,17,14,15,17,14,14,15,15,14,16,15,15,17,
+ 0,16,16,16, 0,13,14,15,16,13,14,15,14,15,16,17,
+ 13,14, 0,15,17,17, 0,17,15, 0,11,12,13,14,12,13,
+ 14,12,12,13,16,12,13,14,13,13,13,15,13,14,17, 0,
+ 14,15,17,14,15,17,12,12,12,14,12,15,16,13,13,14,
+ 0,13,14,16,15,16,16,17,16,16,16,12,13,13,15,12,
+ 13,15,12,12,13,15,12,13,15,13,14,14,17,13,14,17,
+ 16,15,15,16,16, 0, 0,12,13,14,16,12,13,15,13,14,
+ 15,15,13,16,17,15,15,15,17,15,17, 0,13,13,15,17,
+ 14,15,15,13,13,14, 0,14,14,16,14,14,17, 0,15,15,
+ 16,15,16, 0, 0,16, 0,17,13,13,14,17,14,15,15,14,
+ 15,14,16,14,17,17,16,15,16,16,17, 0, 0,14,15,15,
+ 0,15,16, 0,14,16,16,17,15,16, 0,16,15,17, 0,16,
+ 17, 0,17,17, 0, 0, 0,17, 0,15,14,16,17,15,16,16,
+ 17,15, 0, 0, 0, 0,17,16,16, 0, 0, 0, 0, 0,12,12,
+ 13,14,12,13,14,12,12,13,14,13,14,16,14,13,14,16,
+ 13,15,17,15,14,17, 0,15,15,16,12,13,14,15,13,13,
+ 15,14,14,15,15,13,14,17,16,15,17,17,15,16, 0,13,
+ 13,15,15,14,15,15,14,14,14,15,15,15,16,15,14,16,
+ 16,16,16,17, 0,17,16, 0,16, 0, 0,14,14,14,17,13,
+ 15,15,15,15,17,17,15,16,16,15,15, 0, 0,15, 0, 0,
+ 14,15,16, 0,15, 0, 0,16,17,16, 0,15,16,17,16, 0,
+ 0,17,17, 0, 0, 0,16, 0,17,17, 0, 0,14,16,15, 0,
+ 15, 0,17,15,16,16,17,15, 0, 0, 0,17, 0, 0, 0,15,
+ 0,
+};
+
+static float _vq_quantthresh_res0_128a_192_3[] = {
+ -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+};
+
+static long _vq_quantmap_res0_128a_192_3[] = {
+ 6, 5, 4, 0, 1, 2, 3,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_192_3 = {
+ _vq_quantthresh_res0_128a_192_3,
+ _vq_quantmap_res0_128a_192_3,
+ 7,
+ 7
+};
+
+static static_codebook _vq_book_res0_128a_192_3 = {
+ 4, 2401,
+ _vq_lengthlist_res0_128a_192_3,
+ 1, -533200896, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_192_3,
+ NULL,
+ &_vq_auxt_res0_128a_192_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_192_4.vqh b/include/vorbis/book/res0_128a_192_4.vqh
new file mode 100644
index 00000000..f0b1e548
--- /dev/null
+++ b/include/vorbis/book/res0_128a_192_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_192_4_VQH_
+#define _V_res0_128a_192_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_192_4[] = {
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 3,
+ 2,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_192_4[] = {
+ 3, 4, 5, 6, 6, 4, 5, 6, 7, 4, 5, 6, 7, 7, 5, 6,
+ 7, 7, 6, 6, 7, 8, 9, 6, 7, 8, 9, 7, 7, 8,10,10,
+ 7, 8,10,10, 7, 8, 9,11,12, 8, 9,10,12, 4, 5, 6,
+ 7, 7, 5, 6, 7, 7, 6, 6, 7, 8, 9, 6, 7, 8, 9, 7,
+ 7, 8,10,10, 7, 8,10,10, 8, 8, 9,11,12, 8, 9,10,
+ 12,
+};
+
+static float _vq_quantthresh_res0_128a_192_4[] = {
+ -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5,
+};
+
+static long _vq_quantmap_res0_128a_192_4[] = {
+ 8, 7, 6, 5, 0, 1, 2, 3,
+ 4,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_192_4 = {
+ _vq_quantthresh_res0_128a_192_4,
+ _vq_quantmap_res0_128a_192_4,
+ 9,
+ 9
+};
+
+static static_codebook _vq_book_res0_128a_192_4 = {
+ 2, 81,
+ _vq_lengthlist_res0_128a_192_4,
+ 1, -531628032, 1611661312, 4, 0,
+ _vq_quantlist_res0_128a_192_4,
+ NULL,
+ &_vq_auxt_res0_128a_192_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_192_5.vqh b/include/vorbis/book/res0_128a_192_5.vqh
new file mode 100644
index 00000000..058c9fde
--- /dev/null
+++ b/include/vorbis/book/res0_128a_192_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_192_5_VQH_
+#define _V_res0_128a_192_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_192_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_192_5[] = {
+ 5, 5, 6, 6, 6, 7, 7, 8,10,13,17, 0, 5, 6, 6, 6,
+ 7, 7, 8,10,13,16,20, 5, 6, 6, 7, 7, 7, 7, 8,10,
+ 14,17, 0, 6, 6, 7, 7, 7, 7, 8,10,13,17, 0, 6, 7,
+ 7, 7, 7, 7, 8, 8,10,14,20,20, 7, 7, 7, 7, 7, 8,
+ 8,10,14,19, 0, 7, 8, 8, 8, 8, 8, 9, 9,11,15,20,
+ 0, 8, 8, 8, 8, 8, 8, 9,11,15, 0, 0, 8, 8, 9, 9,
+ 9, 9, 9,10,12,15,18, 0, 9, 9, 9, 9, 9, 9,10,12,
+ 15,18, 0, 9,10,10,11,10,10,11,11,13,16, 0, 0, 9,
+ 10,11,10,10,11,11,13,15,18, 0,11,11,12,13,12,12,
+ 12,13,14,18,18, 0,11,12,12,12,12,13,13,14,18,19,
+ 0,13,13,14,14,14,14,14,15,16,19, 0, 0,13,14,14,
+ 14,14,14,14,16,19, 0, 0,14,15,15,16,17,19,18,17,
+ 19, 0, 0, 0,15,16,16,16,16,18,17,18,19, 0, 0,15,
+ 16,19,18, 0, 0, 0, 0, 0, 0, 0, 0,16,17,18,19,18,
+ 19,19, 0, 0, 0, 0,18,17, 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, 5, 6, 6, 7, 7, 7, 7, 8,10,13,17, 0,
+ 6, 6, 7, 7, 7, 7, 8,10,13,19, 0, 6, 7, 7, 7, 7,
+ 7, 8, 8,10,14, 0, 0, 7, 7, 7, 7, 7, 8, 8,10,14,
+ 19, 0, 7, 8, 8, 8, 8, 8, 9, 9,11,15,19, 0, 8, 8,
+ 8, 8, 8, 9, 9,11,15,18, 0, 8, 8, 9, 9, 9, 9, 9,
+ 10,12,16,19, 0, 9, 9, 9, 9, 9, 9,10,12,14,19, 0,
+ 9,10,10,11,10,10,11,11,13,16,18, 0, 9,10,11,10,
+ 10,11,11,13,15,19, 0,11,11,12,13,12,12,13,13,14,
+ 18, 0, 0,11,12,13,12,12,12,13,15,17, 0, 0,13,13,
+ 14,14,13,14,14,14,16,19, 0, 0,13,14,15,14,14,15,
+ 14,16,18, 0, 0,15,15,16,18,16,17,17,17,19, 0, 0,
+ 0,15,16,16,16,16,18,19,18, 0, 0, 0,16,17,18, 0,
+ 0,18, 0,19, 0, 0, 0, 0,16,18,19,19, 0,19,19, 0,
+ 0, 0, 0,16,17,19,19, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,19, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,19,19, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_128a_192_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_192_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_192_5 = {
+ _vq_quantthresh_res0_128a_192_5,
+ _vq_quantmap_res0_128a_192_5,
+ 23,
+ 23
+};
+
+static static_codebook _vq_book_res0_128a_192_5 = {
+ 2, 529,
+ _vq_lengthlist_res0_128a_192_5,
+ 1, -524910592, 1611661312, 7, 0,
+ _vq_quantlist_res0_128a_192_5,
+ NULL,
+ &_vq_auxt_res0_128a_192_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..c3093e90
--- /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 float _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..c0003e00
--- /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 float _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..69ddeda3
--- /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 float _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..f68f49a1
--- /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 float _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..354835a1
--- /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 float _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/res0_128a_350_1.vqh b/include/vorbis/book/res0_128a_350_1.vqh
new file mode 100644
index 00000000..b3332ef3
--- /dev/null
+++ b/include/vorbis/book/res0_128a_350_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_350_1_VQH_
+#define _V_res0_128a_350_1_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_350_1[] = {
+ 2,
+ 3,
+ 4,
+ 1,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_350_1[] = {
+ 2, 5,10, 5,10, 5, 7, 0, 7, 9,10, 8, 0,10, 0, 5,
+ 7, 8, 7,10, 8,10, 0,10, 0, 5, 8, 0, 9,10, 7, 0,
+ 10, 8, 9,10, 0, 0,10, 0, 6, 7, 0,10,10, 8, 8, 0,
+ 10, 0,10,10, 0, 9,10,10,10, 0, 0, 0,10, 0, 0, 0,
+ 0, 0, 0, 0,10,10,10, 0, 0, 0, 0, 6, 7, 9, 8, 9,
+ 6,10,10, 7,10, 9,10, 0,10, 0, 9, 8,10,10,10, 8,
+ 0, 0,10, 0, 9,10,10, 0,10, 9, 0,10,10, 0,10, 0,
+ 0, 0, 0,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 9, 9,
+ 8, 0, 7, 8, 0, 0, 0, 9,10,10, 0, 0, 8,10, 0, 9,
+ 0,10, 0, 0, 0, 0, 8,10, 0, 9, 0, 0, 0, 0,10, 0,
+ 0, 0, 0, 0, 0, 8,10, 0, 7, 0,10, 0, 0, 9, 0, 0,
+ 0, 0,10, 0, 0,10, 0, 9, 0, 0, 9, 0,10, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 0, 8, 0, 7, 0, 0,
+ 8, 0,10,10, 0, 0, 0, 9,10, 8, 0, 0, 0, 0, 0, 0,
+ 0, 0,10,10, 0, 0, 9, 8, 0, 0, 0,10, 0, 0, 0, 0,
+ 10, 0,10, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 9,
+ 0, 0, 0, 0, 0, 0, 0,10, 0, 9,10, 0, 0,10, 8, 9,
+ 0, 0, 0, 9, 0, 0, 0, 0,10, 0, 0, 0, 0,10,10, 0,
+ 0, 0, 0, 0, 0, 0, 0,10, 0, 0, 0, 0,10, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0,
+ 10, 0, 0,10, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 5,10, 0, 8, 0, 8,10,10, 8,
+ 0, 0, 0, 0, 0, 0, 9, 9, 0,10, 0, 0, 0, 9, 9, 0,
+ 6, 8, 0, 9, 0, 7, 0, 0, 7, 9, 9, 0, 9, 8, 0, 7,
+ 7, 0, 9, 9, 0, 0, 0, 9, 0, 9, 0, 0, 8, 9, 0, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 8, 9, 0, 0, 0,
+ 0, 0, 7, 0, 0, 0, 0, 8, 8, 0, 0, 0, 8, 0, 0, 0,
+ 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 9, 9, 8,
+ 0, 0, 0, 0, 8, 9, 9, 0, 0, 9, 0, 0, 0, 0, 8, 0,
+ 0, 8, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 9, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+
+static float _vq_quantthresh_res0_128a_350_1[] = {
+ -1.5, -0.5, 0.5, 1.5,
+};
+
+static long _vq_quantmap_res0_128a_350_1[] = {
+ 4, 3, 0, 1, 2,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_350_1 = {
+ _vq_quantthresh_res0_128a_350_1,
+ _vq_quantmap_res0_128a_350_1,
+ 5,
+ 5
+};
+
+static static_codebook _vq_book_res0_128a_350_1 = {
+ 4, 625,
+ _vq_lengthlist_res0_128a_350_1,
+ 1, -533725184, 1611661312, 3, 0,
+ _vq_quantlist_res0_128a_350_1,
+ NULL,
+ &_vq_auxt_res0_128a_350_1,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_350_2.vqh b/include/vorbis/book/res0_128a_350_2.vqh
new file mode 100644
index 00000000..5ed17536
--- /dev/null
+++ b/include/vorbis/book/res0_128a_350_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_350_2_VQH_
+#define _V_res0_128a_350_2_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_350_2[] = {
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 12,
+ 5,
+ 4,
+ 3,
+ 2,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_350_2[] = {
+ 5, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7,
+ 7, 6, 6, 6, 7, 7, 6, 6, 7, 7, 7, 8, 6, 7, 7, 7,
+ 8, 7, 7, 8, 8, 8, 8, 7, 7, 8, 8, 8, 7, 7, 8, 8,
+ 8, 8, 7, 8, 8, 8, 9, 8, 8, 8, 9, 9, 8, 8, 8, 9,
+ 9, 9, 6, 6, 6, 6, 7, 7, 6, 6, 7, 7, 7, 6, 6, 7,
+ 7, 7, 8, 7, 7, 7, 7, 8, 7, 7, 8, 8, 8, 8, 7, 7,
+ 8, 8, 8, 7, 7, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8,
+ 9, 9, 9, 9, 8, 8, 9, 8, 9,
+};
+
+static float _vq_quantthresh_res0_128a_350_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_350_2[] = {
+ 10, 9, 8, 7, 6, 0, 1, 2,
+ 3, 4, 5,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_350_2 = {
+ _vq_quantthresh_res0_128a_350_2,
+ _vq_quantmap_res0_128a_350_2,
+ 11,
+ 11
+};
+
+static static_codebook _vq_book_res0_128a_350_2 = {
+ 2, 121,
+ _vq_lengthlist_res0_128a_350_2,
+ 1, -531103744, 1611661312, 4, 0,
+ _vq_quantlist_res0_128a_350_2,
+ NULL,
+ &_vq_auxt_res0_128a_350_2,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_350_3.vqh b/include/vorbis/book/res0_128a_350_3.vqh
new file mode 100644
index 00000000..38d64029
--- /dev/null
+++ b/include/vorbis/book/res0_128a_350_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_350_3_VQH_
+#define _V_res0_128a_350_3_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_350_3[] = {
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 17,
+ 19,
+ 22,
+ 10,
+ 9,
+ 8,
+ 7,
+ 5,
+ 3,
+ 0,
+};
+
+static long _vq_lengthlist_res0_128a_350_3[] = {
+ 6, 6, 7, 7, 7, 7, 7, 8, 6, 7, 7, 7, 7, 7, 8, 7,
+ 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 8, 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, 7, 8, 8, 8,
+ 7, 8, 8, 9, 7, 8, 8, 7, 8, 8, 9, 8, 8, 8, 8, 8,
+ 8, 8, 9, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 9, 8, 8,
+ 9,10, 8, 9, 9, 8, 8, 9,10, 9, 9,10,10, 9, 9,10,
+ 10, 9,10,10, 9, 9,10,10, 7, 7, 7, 7, 7, 7, 8, 8,
+ 7, 7, 7, 7, 7, 8, 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, 7, 8, 8, 8, 7, 8, 8, 9, 7, 8, 8,
+ 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8,
+ 8, 8, 9, 8, 8, 9, 9, 8, 8, 9,10, 8, 8, 9, 8, 8,
+ 9,10, 9, 9,10,10, 9, 9,10,10, 9,10,10, 9, 9,10,
+ 10,
+};
+
+static float _vq_quantthresh_res0_128a_350_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_350_3[] = {
+ 14, 13, 12, 11, 10, 9, 8, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+};
+
+static encode_aux_threshmatch _vq_auxt_res0_128a_350_3 = {
+ _vq_quantthresh_res0_128a_350_3,
+ _vq_quantmap_res0_128a_350_3,
+ 15,
+ 15
+};
+
+static static_codebook _vq_book_res0_128a_350_3 = {
+ 2, 225,
+ _vq_lengthlist_res0_128a_350_3,
+ 1, -529137664, 1611661312, 5, 0,
+ _vq_quantlist_res0_128a_350_3,
+ NULL,
+ &_vq_auxt_res0_128a_350_3,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_350_4.vqh b/include/vorbis/book/res0_128a_350_4.vqh
new file mode 100644
index 00000000..72215cd4
--- /dev/null
+++ b/include/vorbis/book/res0_128a_350_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_350_4_VQH_
+#define _V_res0_128a_350_4_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_350_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_350_4[] = {
+ 7, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8,
+ 8, 8,10, 8, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8,
+ 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8, 8, 8, 9,10,
+ 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 9, 8, 8, 8,
+ 8, 9,10, 8, 8, 9, 8, 8, 8, 8, 9,10, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8, 8, 8,10, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8, 8,
+ 8,10, 8, 9, 9, 9, 8, 8, 8, 8, 8,10, 9, 9, 9, 8,
+ 8, 8, 8, 8,10, 9, 9, 9, 9, 9, 8, 8, 8, 9,10, 9,
+ 9, 9, 9, 8, 8, 8, 9,10,10,10,10,10,10, 9, 9, 9,
+ 10,11,10,10,10,10, 9, 9, 9,10,11,12,12,12,12,12,
+ 12,12,12,12,13,12,12,12,12,12,12,12,12,13, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8, 8, 8,
+ 10, 8, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8,
+ 8, 8, 8,10, 8, 8, 8, 9, 8, 8, 8, 8, 9,10, 8, 8,
+ 9, 8, 8, 8, 8, 9,10, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 10, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8,10, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 9, 9,
+ 9, 8, 8, 8, 8, 8,10, 9, 9, 9, 8, 8, 8, 8, 8,10,
+ 9, 9, 9, 9, 9, 8, 8, 8, 9,10, 9, 9, 9, 9, 8, 8,
+ 8, 9,10,10,10,10,10,10, 9, 9, 9,10,11,10,10,10,
+ 10,10, 9, 9,10,11,12,12,12,12,12,12,12,12,12,13,
+ 12,12,12,12,12,12,12,12,13,
+};
+
+static float _vq_quantthresh_res0_128a_350_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_350_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_350_4 = {
+ _vq_quantthresh_res0_128a_350_4,
+ _vq_quantmap_res0_128a_350_4,
+ 19,
+ 19
+};
+
+static static_codebook _vq_book_res0_128a_350_4 = {
+ 2, 361,
+ _vq_lengthlist_res0_128a_350_4,
+ 1, -526974976, 1611661312, 6, 0,
+ _vq_quantlist_res0_128a_350_4,
+ NULL,
+ &_vq_auxt_res0_128a_350_4,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/book/res0_128a_350_5.vqh b/include/vorbis/book/res0_128a_350_5.vqh
new file mode 100644
index 00000000..c8c5dff4
--- /dev/null
+++ b/include/vorbis/book/res0_128a_350_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_350_5_VQH_
+#define _V_res0_128a_350_5_VQH_
+#include "vorbis/codebook.h"
+
+static long _vq_quantlist_res0_128a_350_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_350_5[] = {
+ 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9,11,11,11, 7, 8,
+ 8, 8, 8, 8, 8, 8, 9, 9,11,13,12, 7, 8, 8, 9, 8,
+ 8, 8, 8, 8,10,10,12,13,14, 8, 8, 8, 8, 8, 8, 8,
+ 8, 9, 9,12,13,14, 8, 8, 9, 9, 8, 8, 8, 8, 8,10,
+ 10,12,15,14, 8, 9, 9, 8, 8, 8, 8, 8,10,10,12,14,
+ 13, 9, 9, 9, 9, 9, 8, 8, 8, 9,10,10,13,14,15, 9,
+ 9, 9, 9, 8, 9, 8, 9,10,10,12,15,16, 8, 8, 9, 9,
+ 8, 8, 8, 8, 8,10,10,12,14,14, 8, 9, 9, 8, 8, 8,
+ 8, 8,10, 9,12,14,17, 8, 8, 9, 9, 8, 8, 8, 8, 8,
+ 10,10,12,14,16, 9, 9, 9, 8, 8, 8, 8, 8,10, 9,12,
+ 14, 0, 9, 9, 9, 9, 8, 8, 8, 8, 8,10,10,13,14,15,
+ 9, 9, 9, 9, 8, 8, 8, 8,10, 9,12,15,16, 9, 9, 9,
+ 9, 9, 9, 8, 8, 9,10,10,12,14,15, 9, 9, 9, 9, 8,
+ 8, 8, 9,10,10,12,14, 0,10,10,10,10,10, 9,10, 9,
+ 10,11,11,14, 0, 0,10,10,10,10, 9,10, 9,10,11,11,
+ 13,17, 0,11,11,11,12,12,11,11,11,11,13,12,14,16,
+ 17,11,12,11,12,11,12,11,12,12,12,15,17, 0,11,11,
+ 11,12,12,11,12,11,12,13,14,16, 0, 0,11,12,12,12,
+ 11,11,11,12,13,14,17, 0, 0,12,13,13,13,14,14,14,
+ 14,14,14, 0, 0, 0, 0,13,13,13,14,13,14,14,13,15,
+ 16,16, 0, 0,13,15,16,17,15,17,17,16, 0,17, 0, 0,
+ 0, 0,13,15,15,15,15,16,15,16,17, 0,16, 0, 0,12,
+ 14,15, 0, 0,17,16,15,16, 0, 0, 0, 0, 0,14,16,17,
+ 16,16,15,15,15,17,17, 0, 0, 0, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8,10,10,12,13,14, 8, 8, 9, 8, 8, 8, 8, 8,
+ 9, 9,12,14,14, 8, 8, 9, 9, 8, 8, 8, 8, 8,10,10,
+ 12,14,14, 8, 9, 9, 8, 8, 8, 8, 8,10,10,12,14,15,
+ 9, 9, 9, 9, 9, 9, 8, 8, 9,10,10,13,14,17, 9, 9,
+ 9, 8, 8, 8, 8, 9,10,10,12,15,16, 8, 8, 9, 9, 8,
+ 8, 8, 8, 8,10,10,12,14,16, 8, 9, 9, 8, 8, 8, 8,
+ 8,10, 9,12,14,16, 8, 8, 9, 9, 8, 8, 8, 8, 8,10,
+ 10,12,15,15, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9,11,14,
+ 16, 9, 9, 9, 9, 9, 8, 8, 8, 8,10,10,12,15,16, 9,
+ 9, 9, 9, 8, 8, 8, 8,10,10,12,14,15, 9, 9, 9, 9,
+ 9, 8, 8, 8, 9,10,10,12,14,16, 9, 9, 9, 9, 8, 8,
+ 8, 9,10,10,12,15,15,10,10,10,10,10, 9, 9, 9,10,
+ 11,11,13,15,17,10,10,10,10, 9, 9, 9,10,11,11,13,
+ 17,17,11,11,12,11,12,11,11,11,12,13,13,15,17, 0,
+ 11,11,12,11,11,11,11,11,12,12,15,17,17,11,12,11,
+ 12,11,11,11,11,12,13,15, 0, 0, 0,11,12,12,12,11,
+ 12,12,12,12,14,16, 0, 0,13,13,13,13,15,14,14,14,
+ 14,14,16,17, 0, 0,13,14,15,14,14,14,14,14,15,16,
+ 0, 0, 0,13,14,16,15,15, 0,17,15,17,17, 0, 0, 0,
+ 0,15,15,16,15,15,16,16,16,17,17,17, 0, 0,13,15,
+ 17,17,16,15,17,16,16, 0, 0, 0, 0, 0,14,16,15,16,
+ 16,15,15,14,17,16, 0, 0, 0,
+};
+
+static float _vq_quantthresh_res0_128a_350_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_350_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_350_5 = {
+ _vq_quantthresh_res0_128a_350_5,
+ _vq_quantmap_res0_128a_350_5,
+ 27,
+ 27
+};
+
+static static_codebook _vq_book_res0_128a_350_5 = {
+ 2, 729,
+ _vq_lengthlist_res0_128a_350_5,
+ 1, -522846208, 1611661312, 8, 0,
+ _vq_quantlist_res0_128a_350_5,
+ NULL,
+ &_vq_auxt_res0_128a_350_5,
+ NULL,
+};
+
+
+#endif
diff --git a/include/vorbis/codebook.h b/include/vorbis/codebook.h
new file mode 100644
index 00000000..b1cc6224
--- /dev/null
+++ b/include/vorbis/codebook.h
@@ -0,0 +1,118 @@
+/********************************************************************
+ * *
+ * 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: codebook types
+ last mod: $Id: codebook.h,v 1.6.4.1 2000/08/31 08:59:58 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_CODEBOOK_H_
+#define _V_CODEBOOK_H_
+
+/* This structure encapsulates huffman and VQ style encoding books; it
+ doesn't do anything specific to either.
+
+ valuelist/quantlist are nonNULL (and q_* significant) only if
+ there's entry->value mapping to be done.
+
+ If encode-side mapping must be done (and thus the entry needs to be
+ hunted), the auxiliary encode pointer will point to a decision
+ tree. This is true of both VQ and huffman, but is mostly useful
+ with VQ.
+
+*/
+
+typedef struct static_codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long *lengthlist; /* codeword lengths in bits */
+
+ /* mapping ***************************************************************/
+ int maptype; /* 0=none
+ 1=implicitly populated values from map column
+ 2=listed arbitrary values */
+
+ /* The below does a linear, single monotonic sequence mapping. */
+ long q_min; /* packed 32 bit float; quant value 0 maps to minval */
+ long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
+ int q_quant; /* bits: 0 < quant <= 16 */
+ int q_sequencep; /* bitflag */
+
+ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
+ map == 2: list of dim*entries quantized entry vals
+ */
+
+ /* encode helpers ********************************************************/
+ struct encode_aux_nearestmatch *nearest_tree;
+ struct encode_aux_threshmatch *thresh_tree;
+ struct encode_aux_pigeonhole *pigeon_tree;
+} static_codebook;
+
+/* this structures an arbitrary trained book to quickly find the
+ nearest cell match */
+typedef struct encode_aux_nearestmatch{
+ /* pre-calculated partitioning tree */
+ long *ptr0;
+ long *ptr1;
+
+ long *p; /* decision points (each is an entry) */
+ long *q; /* decision points (each is an entry) */
+ long aux; /* number of tree entries */
+ long alloc;
+} encode_aux_nearestmatch;
+
+/* assumes a maptype of 1; encode side only, so that's OK */
+typedef struct encode_aux_threshmatch{
+ float *quantthresh;
+ long *quantmap;
+ int quantvals;
+ int threshvals;
+} encode_aux_threshmatch;
+
+typedef struct encode_aux_pigeonhole{
+ float min;
+ float del;
+
+ int mapentries;
+ int quantvals;
+ long *pigeonmap;
+
+ long fittotal;
+ long *fitlist;
+ long *fitmap;
+ long *fitlength;
+} encode_aux_pigeonhole;
+
+typedef struct decode_aux{
+ long *ptr0;
+ long *ptr1;
+ long aux; /* number of tree entries */
+} decode_aux;
+
+typedef struct codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ const static_codebook *c;
+
+ float *valuelist; /* list of dim*entries actual entry values */
+ long *codelist; /* list of bitstream codewords for each entry */
+ struct decode_aux *decode_tree;
+
+} codebook;
+
+#endif
+
+
+
+
+
diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h
index 581a23cb..6a5954ee 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.27.2.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.27.2.2 2000/08/31 08:59:58 xiphmont Exp $
********************************************************************/
@@ -58,29 +58,29 @@ typedef struct vorbis_info_psy{
int smoothp;
int noisecullp;
- double noisecull_barkwidth;
+ float noisecull_barkwidth;
- double ath_adjatt;
- double ath_maxatt;
+ float ath_adjatt;
+ float ath_maxatt;
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
/* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
/* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
int tonemaskp;
- double toneatt[P_BANDS][P_LEVELS];
+ float toneatt[P_BANDS][P_LEVELS];
int peakattp;
- double peakatt[P_BANDS][P_LEVELS];
+ float peakatt[P_BANDS][P_LEVELS];
int noisemaskp;
- double noiseatt[P_BANDS][P_LEVELS];
+ float noiseatt[P_BANDS][P_LEVELS];
- double max_curve_dB;
+ float max_curve_dB;
/* decay setup */
- double attack_coeff;
- double decay_coeff;
+ float attack_coeff;
+ float decay_coeff;
} vorbis_info_psy;
/* vorbis_info contains all the setup information specific to the
@@ -145,9 +145,9 @@ typedef struct vorbis_info{
/* for block long/sort tuning; encode only */
int envelopesa;
- double preecho_thresh;
- double preecho_clamp;
- double preecho_minenergy;
+ float preecho_thresh;
+ float preecho_clamp;
+ float preecho_minenergy;
} vorbis_info;
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
@@ -233,8 +233,8 @@ typedef struct vorbis_dsp_state{
vorbis_info *vi;
int modebits;
- double **pcm;
- double **pcmret;
+ float **pcm;
+ float **pcmret;
int pcm_storage;
int pcm_current;
int pcm_returned;
@@ -257,7 +257,7 @@ typedef struct vorbis_dsp_state{
/* local lookup storage */
void *ve; /* envelope lookup */
- double **window[2][2][2]; /* block, leadin, leadout, type */
+ float **window[2][2][2]; /* block, leadin, leadout, type */
vorbis_look_transform **transform[2]; /* block, type */
codebook *fullbooks;
/* backend lookups are tied to the mode, not the backend or naked mapping */
@@ -285,7 +285,7 @@ struct alloc_chain{
typedef struct vorbis_block{
/* necessary stream state for linking to the framing abstraction */
- double **pcm; /* this is a pointer into local storage */
+ float **pcm; /* this is a pointer into local storage */
oggpack_buffer opb;
long lW;
@@ -408,7 +408,7 @@ extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
ogg_packet *op,
ogg_packet *op_comm,
ogg_packet *op_code);
-extern double **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
+extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
@@ -420,7 +420,7 @@ extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
-extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,double ***pcm);
+extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
#ifdef __cplusplus
diff --git a/include/vorbis/vorbisfile.h b/include/vorbis/vorbisfile.h
index a7a8433e..798d95f4 100644
--- a/include/vorbis/vorbisfile.h
+++ b/include/vorbis/vorbisfile.h
@@ -12,7 +12,7 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.h,v 1.6.6.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: vorbisfile.h,v 1.6.6.2 2000/08/31 08:59:59 xiphmont Exp $
********************************************************************/
diff --git a/lib/analysis.c b/lib/analysis.c
new file mode 100644
index 00000000..0179a7d4
--- /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.33.2.1 2000/08/31 08:59:59 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,float *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/block.c b/lib/block.c
new file mode 100644
index 00000000..b6bd7681
--- /dev/null
+++ b/lib/block.c
@@ -0,0 +1,728 @@
+/********************************************************************
+ * *
+ * 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: PCM data vector blocking, windowing and dis/reassembly
+ last mod: $Id: block.c,v 1.38.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ Handle windowing, overlap-add, etc of the PCM vectors. This is made
+ more amusing by Vorbis' current two allowed block sizes.
+
+ Vorbis manipulates the dynamic range of the incoming PCM data
+ envelope to minimise time-domain energy leakage from percussive and
+ plosive waveforms being quantized in the MDCT domain.
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "vorbis/codec.h"
+
+#include "window.h"
+#include "envelope.h"
+#include "mdct.h"
+#include "lpc.h"
+#include "bitwise.h"
+#include "registry.h"
+#include "sharedbook.h"
+#include "bookinternal.h"
+#include "misc.h"
+#include "os.h"
+
+static int ilog2(unsigned int v){
+ int ret=0;
+ while(v>1){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+/* pcm accumulator examples (not exhaustive):
+
+ <-------------- lW ---------------->
+ <--------------- W ---------------->
+: .....|..... _______________ |
+: .''' | '''_--- | |\ |
+:.....''' |_____--- '''......| | \_______|
+:.................|__________________|_______|__|______|
+ |<------ Sl ------>| > Sr < |endW
+ |beginSl |endSl | |endSr
+ |beginW |endlW |beginSr
+
+
+ |< lW >|
+ <--------------- W ---------------->
+ | | .. ______________ |
+ | | ' `/ | ---_ |
+ |___.'___/`. | ---_____|
+ |_______|__|_______|_________________|
+ | >|Sl|< |<------ Sr ----->|endW
+ | | |endSl |beginSr |endSr
+ |beginW | |endlW
+ mult[0] |beginSl mult[n]
+
+ <-------------- lW ----------------->
+ |<--W-->|
+: .............. ___ | |
+: .''' |`/ \ | |
+:.....''' |/`....\|...|
+:.........................|___|___|___|
+ |Sl |Sr |endW
+ | | |endSr
+ | |beginSr
+ | |endSl
+ |beginSl
+ |beginW
+*/
+
+/* block abstraction setup *********************************************/
+
+#ifndef WORD_ALIGN
+#define WORD_ALIGN 8
+#endif
+
+int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
+ memset(vb,0,sizeof(vorbis_block));
+ vb->vd=v;
+ vb->localalloc=0;
+ vb->localstore=NULL;
+ if(v->analysisp)
+ _oggpack_writeinit(&vb->opb);
+
+ return(0);
+}
+
+void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
+ bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
+ if(bytes+vb->localtop>vb->localalloc){
+ /* can't just realloc... there are outstanding pointers */
+ if(vb->localstore){
+ struct alloc_chain *link=malloc(sizeof(struct alloc_chain));
+ vb->totaluse+=vb->localtop;
+ link->next=vb->reap;
+ link->ptr=vb->localstore;
+ vb->reap=link;
+ }
+ /* highly conservative */
+ vb->localalloc=bytes;
+ vb->localstore=malloc(vb->localalloc);
+ vb->localtop=0;
+ }
+ {
+ void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
+ vb->localtop+=bytes;
+ return ret;
+ }
+}
+
+/* reap the chain, pull the ripcord */
+void _vorbis_block_ripcord(vorbis_block *vb){
+ /* reap the chain */
+ struct alloc_chain *reap=vb->reap;
+ while(reap){
+ struct alloc_chain *next=reap->next;
+ free(reap->ptr);
+ memset(reap,0,sizeof(struct alloc_chain));
+ free(reap);
+ reap=next;
+ }
+ /* consolidate storage */
+ if(vb->totaluse){
+ vb->localstore=realloc(vb->localstore,vb->totaluse+vb->localalloc);
+ vb->localalloc+=vb->totaluse;
+ vb->totaluse=0;
+ }
+
+ /* pull the ripcord */
+ vb->localtop=0;
+ vb->reap=NULL;
+}
+
+int vorbis_block_clear(vorbis_block *vb){
+ if(vb->vd)
+ if(vb->vd->analysisp)
+ _oggpack_writeclear(&vb->opb);
+ _vorbis_block_ripcord(vb);
+ if(vb->localstore)free(vb->localstore);
+
+ memset(vb,0,sizeof(vorbis_block));
+ return(0);
+}
+
+/* Analysis side code, but directly related to blocking. Thus it's
+ here and not in analysis.c (which is for analysis transforms only).
+ The init is here because some of it is shared */
+
+static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
+ int i;
+ memset(v,0,sizeof(vorbis_dsp_state));
+
+ v->vi=vi;
+ v->modebits=ilog2(vi->modes);
+
+ v->transform[0]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+ v->transform[1]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+
+ /* MDCT is tranform 0 */
+
+ v->transform[0][0]=calloc(1,sizeof(mdct_lookup));
+ v->transform[1][0]=calloc(1,sizeof(mdct_lookup));
+ mdct_init(v->transform[0][0],vi->blocksizes[0]);
+ mdct_init(v->transform[1][0],vi->blocksizes[1]);
+
+ v->window[0][0][0]=calloc(VI_WINDOWB,sizeof(float *));
+ v->window[0][0][1]=v->window[0][0][0];
+ v->window[0][1][0]=v->window[0][0][0];
+ v->window[0][1][1]=v->window[0][0][0];
+ v->window[1][0][0]=calloc(VI_WINDOWB,sizeof(float *));
+ v->window[1][0][1]=calloc(VI_WINDOWB,sizeof(float *));
+ v->window[1][1][0]=calloc(VI_WINDOWB,sizeof(float *));
+ v->window[1][1][1]=calloc(VI_WINDOWB,sizeof(float *));
+
+ for(i=0;i<VI_WINDOWB;i++){
+ v->window[0][0][0][i]=
+ _vorbis_window(i,vi->blocksizes[0],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
+ v->window[1][0][0][i]=
+ _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
+ v->window[1][0][1][i]=
+ _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[1]/2);
+ v->window[1][1][0][i]=
+ _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[0]/2);
+ v->window[1][1][1][i]=
+ _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[1]/2);
+ }
+
+ if(encp){ /* encode/decode differ here */
+ /* finish the codebooks */
+ v->fullbooks=calloc(vi->books,sizeof(codebook));
+ for(i=0;i<vi->books;i++)
+ vorbis_book_init_encode(v->fullbooks+i,vi->book_param[i]);
+ v->analysisp=1;
+ }else{
+ /* finish the codebooks */
+ v->fullbooks=calloc(vi->books,sizeof(codebook));
+ for(i=0;i<vi->books;i++)
+ vorbis_book_init_decode(v->fullbooks+i,vi->book_param[i]);
+ }
+
+ /* initialize the storage vectors to a decent size greater than the
+ minimum */
+
+ v->pcm_storage=8192; /* we'll assume later that we have
+ a minimum of twice the blocksize of
+ accumulated samples in analysis */
+ v->pcm=malloc(vi->channels*sizeof(float *));
+ v->pcmret=malloc(vi->channels*sizeof(float *));
+ {
+ int i;
+ for(i=0;i<vi->channels;i++)
+ v->pcm[i]=calloc(v->pcm_storage,sizeof(float));
+ }
+
+ /* all 1 (large block) or 0 (small block) */
+ /* explicitly set for the sake of clarity */
+ v->lW=0; /* previous window size */
+ v->W=0; /* current window size */
+
+ /* all vector indexes */
+ v->centerW=vi->blocksizes[1]/2;
+
+ v->pcm_current=v->centerW;
+
+ /* initialize all the mapping/backend lookups */
+ v->mode=calloc(vi->modes,sizeof(vorbis_look_mapping *));
+ for(i=0;i<vi->modes;i++){
+ int mapnum=vi->mode_param[i]->mapping;
+ int maptype=vi->map_type[mapnum];
+ v->mode[i]=_mapping_P[maptype]->look(v,vi->mode_param[i],
+ vi->map_param[mapnum]);
+ }
+
+ return(0);
+}
+
+/* arbitrary settings and spec-mandated numbers get filled in here */
+int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
+ _vds_shared_init(v,vi,1);
+
+ /* Initialize the envelope state storage */
+ v->ve=calloc(1,sizeof(envelope_lookup));
+ _ve_envelope_init(v->ve,vi);
+
+ return(0);
+}
+
+void vorbis_dsp_clear(vorbis_dsp_state *v){
+ int i,j,k;
+ if(v){
+ vorbis_info *vi=v->vi;
+
+ if(v->window[0][0][0]){
+ for(i=0;i<VI_WINDOWB;i++)
+ if(v->window[0][0][0][i])free(v->window[0][0][0][i]);
+ free(v->window[0][0][0]);
+
+ for(j=0;j<2;j++)
+ for(k=0;k<2;k++){
+ for(i=0;i<VI_WINDOWB;i++)
+ if(v->window[1][j][k][i])free(v->window[1][j][k][i]);
+ free(v->window[1][j][k]);
+ }
+ }
+
+ if(v->pcm){
+ for(i=0;i<vi->channels;i++)
+ if(v->pcm[i])free(v->pcm[i]);
+ free(v->pcm);
+ if(v->pcmret)free(v->pcmret);
+ }
+
+ if(v->ve){
+ _ve_envelope_clear(v->ve);
+ free(v->ve);
+ }
+
+ if(v->transform[0]){
+ mdct_clear(v->transform[0][0]);
+ free(v->transform[0][0]);
+ free(v->transform[0]);
+ }
+ if(v->transform[1]){
+ mdct_clear(v->transform[1][0]);
+ free(v->transform[1][0]);
+ free(v->transform[1]);
+ }
+
+ /* free mode lookups; these are actually vorbis_look_mapping structs */
+ if(vi){
+ for(i=0;i<vi->modes;i++){
+ int mapnum=vi->mode_param[i]->mapping;
+ int maptype=vi->map_type[mapnum];
+ _mapping_P[maptype]->free_look(v->mode[i]);
+ }
+ /* free codebooks */
+ for(i=0;i<vi->books;i++)
+ vorbis_book_clear(v->fullbooks+i);
+ }
+
+ if(v->mode)free(v->mode);
+ if(v->fullbooks)free(v->fullbooks);
+
+ /* free header, header1, header2 */
+ if(v->header)free(v->header);
+ if(v->header1)free(v->header1);
+ if(v->header2)free(v->header2);
+
+ memset(v,0,sizeof(vorbis_dsp_state));
+ }
+}
+
+float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
+ int i;
+ vorbis_info *vi=v->vi;
+
+ /* free header, header1, header2 */
+ if(v->header)free(v->header);v->header=NULL;
+ if(v->header1)free(v->header1);v->header1=NULL;
+ if(v->header2)free(v->header2);v->header2=NULL;
+
+ /* Do we have enough storage space for the requested buffer? If not,
+ expand the PCM (and envelope) storage */
+
+ if(v->pcm_current+vals>=v->pcm_storage){
+ v->pcm_storage=v->pcm_current+vals*2;
+
+ for(i=0;i<vi->channels;i++){
+ v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float));
+ }
+ }
+
+ for(i=0;i<vi->channels;i++)
+ v->pcmret[i]=v->pcm[i]+v->pcm_current;
+
+ return(v->pcmret);
+}
+
+static void _preextrapolate_helper(vorbis_dsp_state *v){
+ int i;
+ int order=32;
+ float *lpc=alloca(order*sizeof(float));
+ float *work=alloca(v->pcm_current*sizeof(float));
+ long j;
+ v->preextrapolate=1;
+
+ if(v->pcm_current-v->centerW>order*2){ /* safety */
+ for(i=0;i<v->vi->channels;i++){
+
+ /* need to run the extrapolation in reverse! */
+ for(j=0;j<v->pcm_current;j++)
+ work[j]=v->pcm[i][v->pcm_current-j-1];
+
+ /* prime as above */
+ vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
+
+ /* run the predictor filter */
+ vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
+ order,
+ work+v->pcm_current-v->centerW,
+ v->centerW);
+ for(j=0;j<v->pcm_current;j++)
+ v->pcm[i][v->pcm_current-j-1]=work[j];
+ }
+ }
+}
+
+
+/* call with val<=0 to set eof */
+
+int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
+ vorbis_info *vi=v->vi;
+ if(vals<=0){
+ int order=32;
+ int i;
+ float *lpc=alloca(order*sizeof(float));
+
+ /* if it wasn't done earlier (very short sample) */
+ if(!v->preextrapolate)
+ _preextrapolate_helper(v);
+
+ /* We're encoding the end of the stream. Just make sure we have
+ [at least] a full block of zeroes at the end. */
+ /* actually, we don't want zeroes; that could drop a large
+ amplitude off a cliff, creating spread spectrum noise that will
+ suck to encode. Extrapolate for the sake of cleanliness. */
+
+ vorbis_analysis_buffer(v,v->vi->blocksizes[1]*2);
+ v->eofflag=v->pcm_current;
+ v->pcm_current+=v->vi->blocksizes[1]*2;
+
+ for(i=0;i<vi->channels;i++){
+ if(v->eofflag>order*2){
+ /* extrapolate with LPC to fill in */
+ long n;
+
+ /* make a predictor filter */
+ n=v->eofflag;
+ if(n>v->vi->blocksizes[1])n=v->vi->blocksizes[1];
+ vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
+
+ /* run the predictor filter */
+ vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
+ v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
+ }else{
+ /* not enough data to extrapolate (unlikely to happen due to
+ guarding the overlap, but bulletproof in case that
+ assumtion goes away). zeroes will do. */
+ memset(v->pcm[i]+v->eofflag,0,
+ (v->pcm_current-v->eofflag)*sizeof(float));
+
+ }
+ }
+ }else{
+
+ if(v->pcm_current+vals>v->pcm_storage)
+ return(-1);
+
+ v->pcm_current+=vals;
+
+ /* we may want to reverse extrapolate the beginning of a stream
+ too... in case we're beginning on a cliff! */
+ /* clumsy, but simple. It only runs once, so simple is good. */
+ if(!v->preextrapolate && v->pcm_current-v->centerW>v->vi->blocksizes[1])
+ _preextrapolate_helper(v);
+
+ }
+ return(0);
+}
+
+/* do the deltas, envelope shaping, pre-echo and determine the size of
+ the next block on which to continue analysis */
+int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
+ int i;
+ vorbis_info *vi=v->vi;
+ long beginW=v->centerW-vi->blocksizes[v->W]/2,centerNext;
+
+ /* check to see if we're started... */
+ if(!v->preextrapolate)return(0);
+
+ /* check to see if we're done... */
+ if(v->eofflag==-1)return(0);
+
+ /* By our invariant, we have lW, W and centerW set. Search for
+ the next boundary so we can determine nW (the next window size)
+ which lets us compute the shape of the current block's window */
+
+ if(vi->blocksizes[0]<vi->blocksizes[1]){
+ long largebound;
+ long bp;
+
+ if(v->W)
+ /* min boundary; nW large, next small */
+ largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]/4;
+ else
+ /* min boundary; nW large, next small */
+ largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]*3/4;
+
+ bp=_ve_envelope_search(v,largebound);
+ if(bp==-1)return(0); /* not enough data currently to search for a
+ full long block */
+ v->nW=bp;
+
+ }else
+ v->nW=0;
+
+ centerNext=v->centerW+vi->blocksizes[v->W]/4+vi->blocksizes[v->nW]/4;
+
+ {
+ /* center of next block + next block maximum right side. */
+
+ long blockbound=centerNext+vi->blocksizes[v->nW]/2;
+ if(v->pcm_current<blockbound)return(0); /* not enough data yet;
+ although this check is
+ less strict that the
+ _ve_envelope_search,
+ the search is not run
+ if we only use one
+ block size */
+ }
+
+ /* fill in the block. Note that for a short window, lW and nW are *short*
+ regardless of actual settings in the stream */
+
+ _vorbis_block_ripcord(vb);
+ if(v->W){
+ vb->lW=v->lW;
+ vb->W=v->W;
+ vb->nW=v->nW;
+ }else{
+ vb->lW=0;
+ vb->W=v->W;
+ vb->nW=0;
+ }
+ vb->vd=v;
+ vb->sequence=v->sequence;
+ vb->frameno=v->frameno;
+ vb->pcmend=vi->blocksizes[v->W];
+
+ /* copy the vectors; this uses the local storage in vb */
+ {
+ vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
+ for(i=0;i<vi->channels;i++){
+ vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
+ memcpy(vb->pcm[i],v->pcm[i]+beginW,vi->blocksizes[v->W]*sizeof(float));
+ }
+ }
+
+ /* handle eof detection: eof==0 means that we've not yet received EOF
+ eof>0 marks the last 'real' sample in pcm[]
+ eof<0 'no more to do'; doesn't get here */
+
+ if(v->eofflag){
+ if(v->centerW>=v->eofflag){
+ v->eofflag=-1;
+ vb->eofflag=1;
+ return(1);
+ }
+ }
+
+ /* advance storage vectors and clean up */
+ {
+ int new_centerNext=vi->blocksizes[1]/2;
+ int movementW=centerNext-new_centerNext;
+
+ _ve_envelope_shift(v->ve,movementW);
+ v->pcm_current-=movementW;
+
+ for(i=0;i<vi->channels;i++)
+ memmove(v->pcm[i],v->pcm[i]+movementW,
+ v->pcm_current*sizeof(float));
+
+
+ v->lW=v->W;
+ v->W=v->nW;
+ v->centerW=new_centerNext;
+
+ v->sequence++;
+
+ if(v->eofflag){
+ v->eofflag-=movementW;
+ /* do not add padding to end of stream! */
+ if(v->centerW>=v->eofflag){
+ v->frameno+=movementW-(v->centerW-v->eofflag);
+ }else{
+ v->frameno+=movementW;
+ }
+ }else{
+ v->frameno+=movementW;
+ }
+ }
+
+ /* done */
+ return(1);
+}
+
+int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
+ _vds_shared_init(v,vi,0);
+
+ /* Adjust centerW to allow an easier mechanism for determining output */
+ v->pcm_returned=v->centerW;
+ v->centerW-= vi->blocksizes[v->W]/4+vi->blocksizes[v->lW]/4;
+ v->frameno=-1;
+ v->sequence=-1;
+
+ return(0);
+}
+
+/* Unike in analysis, the window is only partially applied for each
+ block. The time domain envelope is not yet handled at the point of
+ calling (as it relies on the previous block). */
+
+int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
+ vorbis_info *vi=v->vi;
+
+ /* Shift out any PCM that we returned previously */
+ /* centerW is currently the center of the last block added */
+ if(v->pcm_returned && v->centerW>vi->blocksizes[1]/2){
+
+ /* don't shift too much; we need to have a minimum PCM buffer of
+ 1/2 long block */
+
+ int shiftPCM=v->centerW-vi->blocksizes[1]/2;
+ shiftPCM=(v->pcm_returned<shiftPCM?v->pcm_returned:shiftPCM);
+
+ v->pcm_current-=shiftPCM;
+ v->centerW-=shiftPCM;
+ v->pcm_returned-=shiftPCM;
+
+ if(shiftPCM){
+ int i;
+ for(i=0;i<vi->channels;i++)
+ memmove(v->pcm[i],v->pcm[i]+shiftPCM,
+ v->pcm_current*sizeof(float));
+ }
+ }
+
+ v->lW=v->W;
+ v->W=vb->W;
+ v->nW=-1;
+
+ v->glue_bits+=vb->glue_bits;
+ v->time_bits+=vb->time_bits;
+ v->floor_bits+=vb->floor_bits;
+ v->res_bits+=vb->res_bits;
+
+ if(v->sequence+1 != vb->sequence)v->frameno=-1; /* out of sequence;
+ lose count */
+
+ v->sequence=vb->sequence;
+
+ {
+ int sizeW=vi->blocksizes[v->W];
+ int centerW=v->centerW+vi->blocksizes[v->lW]/4+sizeW/4;
+ int beginW=centerW-sizeW/2;
+ int endW=beginW+sizeW;
+ int beginSl;
+ int endSl;
+ int i,j;
+
+ /* Do we have enough PCM/mult storage for the block? */
+ if(endW>v->pcm_storage){
+ /* expand the storage */
+ v->pcm_storage=endW+vi->blocksizes[1];
+
+ for(i=0;i<vi->channels;i++)
+ v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float));
+ }
+
+ /* overlap/add PCM */
+
+ switch(v->W){
+ case 0:
+ beginSl=0;
+ endSl=vi->blocksizes[0]/2;
+ break;
+ case 1:
+ beginSl=vi->blocksizes[1]/4-vi->blocksizes[v->lW]/4;
+ endSl=beginSl+vi->blocksizes[v->lW]/2;
+ break;
+ }
+
+ for(j=0;j<vi->channels;j++){
+ float *pcm=v->pcm[j]+beginW;
+
+ /* the overlap/add section */
+ for(i=beginSl;i<endSl;i++)
+ pcm[i]+=vb->pcm[j][i];
+ /* the remaining section */
+ for(;i<sizeW;i++)
+ pcm[i]=vb->pcm[j][i];
+ }
+
+ /* track the frame number... This is for convenience, but also
+ making sure our last packet doesn't end with added padding. If
+ the last packet is partial, the number of samples we'll have to
+ return will be past the vb->frameno.
+
+ This is not foolproof! It will be confused if we begin
+ decoding at the last page after a seek or hole. In that case,
+ we don't have a starting point to judge where the last frame
+ is. For this reason, vorbisfile will always try to make sure
+ it reads the last two marked pages in proper sequence */
+
+ if(v->frameno==-1)
+ v->frameno=vb->frameno;
+ else{
+ v->frameno+=(centerW-v->centerW);
+ if(vb->frameno!=-1 && v->frameno!=vb->frameno){
+ if(v->frameno>vb->frameno && vb->eofflag){
+ /* partial last frame. Strip the padding off */
+ centerW-=(v->frameno-vb->frameno);
+ }/* else{ Shouldn't happen *unless* the bitstream is out of
+ spec. Either way, believe the bitstream } */
+ v->frameno=vb->frameno;
+ }
+ }
+
+ /* Update, cleanup */
+
+ v->centerW=centerW;
+ v->pcm_current=endW;
+
+ if(vb->eofflag)v->eofflag=1;
+ }
+
+ return(0);
+}
+
+/* pcm==NULL indicates we just want the pending samples, no more */
+int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){
+ vorbis_info *vi=v->vi;
+ if(v->pcm_returned<v->centerW){
+ if(pcm){
+ int i;
+ for(i=0;i<vi->channels;i++)
+ v->pcmret[i]=v->pcm[i]+v->pcm_returned;
+ *pcm=v->pcmret;
+ }
+ return(v->centerW-v->pcm_returned);
+ }
+ return(0);
+}
+
+int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
+ if(bytes && v->pcm_returned+bytes>v->centerW)return(-1);
+ v->pcm_returned+=bytes;
+ return(0);
+}
+
diff --git a/lib/bookinternal.h b/lib/bookinternal.h
new file mode 100644
index 00000000..2b2b7f91
--- /dev/null
+++ b/lib/bookinternal.h
@@ -0,0 +1,39 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: basic codebook pack/unpack/code/decode operations
+ last mod: $Id: bookinternal.h,v 1.8.6.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_INT_CODEBOOK_H_
+#define _V_INT_CODEBOOK_H_
+
+#include "vorbis/codebook.h"
+#include "bitwise.h"
+
+extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
+extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
+
+extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
+extern int vorbis_book_errorv(codebook *book, float *a);
+extern int vorbis_book_encodev(codebook *book, int best,float *a,
+ oggpack_buffer *b);
+extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b,
+ int step,int stagetype);
+
+extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
+extern long vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b,
+ int step,int stagetype);
+
+#endif
diff --git a/lib/codebook.c b/lib/codebook.c
new file mode 100644
index 00000000..ca6824eb
--- /dev/null
+++ b/lib/codebook.c
@@ -0,0 +1,498 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: basic codebook pack/unpack/code/decode operations
+ last mod: $Id: codebook.c,v 1.17.4.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "vorbis/codec.h"
+#include "vorbis/codebook.h"
+#include "bitwise.h"
+#include "scales.h"
+#include "sharedbook.h"
+#include "bookinternal.h"
+#include "misc.h"
+#include "os.h"
+
+/* packs the given codebook into the bitstream **************************/
+
+int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
+ long i,j;
+ int ordered=0;
+
+ /* first the basic parameters */
+ _oggpack_write(opb,0x564342,24);
+ _oggpack_write(opb,c->dim,16);
+ _oggpack_write(opb,c->entries,24);
+
+ /* pack the codewords. There are two packings; length ordered and
+ length random. Decide between the two now. */
+
+ for(i=1;i<c->entries;i++)
+ if(c->lengthlist[i]<c->lengthlist[i-1])break;
+ if(i==c->entries)ordered=1;
+
+ if(ordered){
+ /* length ordered. We only need to say how many codewords of
+ each length. The actual codewords are generated
+ deterministically */
+
+ long count=0;
+ _oggpack_write(opb,1,1); /* ordered */
+ _oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */
+
+ for(i=1;i<c->entries;i++){
+ long this=c->lengthlist[i];
+ long last=c->lengthlist[i-1];
+ if(this>last){
+ for(j=last;j<this;j++){
+ _oggpack_write(opb,i-count,_ilog(c->entries-count));
+ count=i;
+ }
+ }
+ }
+ _oggpack_write(opb,i-count,_ilog(c->entries-count));
+
+ }else{
+ /* length random. Again, we don't code the codeword itself, just
+ the length. This time, though, we have to encode each length */
+ _oggpack_write(opb,0,1); /* unordered */
+
+ /* algortihmic mapping has use for 'unused entries', which we tag
+ here. The algorithmic mapping happens as usual, but the unused
+ entry has no codeword. */
+ for(i=0;i<c->entries;i++)
+ if(c->lengthlist[i]==0)break;
+
+ if(i==c->entries){
+ _oggpack_write(opb,0,1); /* no unused entries */
+ for(i=0;i<c->entries;i++)
+ _oggpack_write(opb,c->lengthlist[i]-1,5);
+ }else{
+ _oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
+ for(i=0;i<c->entries;i++){
+ if(c->lengthlist[i]==0){
+ _oggpack_write(opb,0,1);
+ }else{
+ _oggpack_write(opb,1,1);
+ _oggpack_write(opb,c->lengthlist[i]-1,5);
+ }
+ }
+ }
+ }
+
+ /* is the entry number the desired return value, or do we have a
+ mapping? If we have a mapping, what type? */
+ _oggpack_write(opb,c->maptype,4);
+ switch(c->maptype){
+ case 0:
+ /* no mapping */
+ break;
+ case 1:case 2:
+ /* implicitly populated value mapping */
+ /* explicitly populated value mapping */
+
+ if(!c->quantlist){
+ /* no quantlist? error */
+ return(-1);
+ }
+
+ /* values that define the dequantization */
+ _oggpack_write(opb,c->q_min,32);
+ _oggpack_write(opb,c->q_delta,32);
+ _oggpack_write(opb,c->q_quant-1,4);
+ _oggpack_write(opb,c->q_sequencep,1);
+
+ {
+ int quantvals;
+ switch(c->maptype){
+ case 1:
+ /* a single column of (c->entries/c->dim) quantized values for
+ building a full value list algorithmically (square lattice) */
+ quantvals=_book_maptype1_quantvals(c);
+ break;
+ case 2:
+ /* every value (c->entries*c->dim total) specified explicitly */
+ quantvals=c->entries*c->dim;
+ break;
+ }
+
+ /* quantized values */
+ for(i=0;i<quantvals;i++)
+ _oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
+
+ }
+ break;
+ default:
+ /* error case; we don't have any other map types now */
+ return(-1);
+ }
+
+ return(0);
+}
+
+/* unpacks a codebook from the packet buffer into the codebook struct,
+ readies the codebook auxiliary structures for decode *************/
+int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
+ long i,j;
+ memset(s,0,sizeof(static_codebook));
+
+ /* make sure alignment is correct */
+ if(_oggpack_read(opb,24)!=0x564342)goto _eofout;
+
+ /* first the basic parameters */
+ s->dim=_oggpack_read(opb,16);
+ s->entries=_oggpack_read(opb,24);
+ if(s->entries==-1)goto _eofout;
+
+ /* codeword ordering.... length ordered or unordered? */
+ switch(_oggpack_read(opb,1)){
+ case 0:
+ /* unordered */
+ s->lengthlist=malloc(sizeof(long)*s->entries);
+
+ /* allocated but unused entries? */
+ if(_oggpack_read(opb,1)){
+ /* yes, unused entries */
+
+ for(i=0;i<s->entries;i++){
+ if(_oggpack_read(opb,1)){
+ long num=_oggpack_read(opb,5);
+ if(num==-1)goto _eofout;
+ s->lengthlist[i]=num+1;
+ }else
+ s->lengthlist[i]=0;
+ }
+ }else{
+ /* all entries used; no tagging */
+ for(i=0;i<s->entries;i++){
+ long num=_oggpack_read(opb,5);
+ if(num==-1)goto _eofout;
+ s->lengthlist[i]=num+1;
+ }
+ }
+
+ break;
+ case 1:
+ /* ordered */
+ {
+ long length=_oggpack_read(opb,5)+1;
+ s->lengthlist=malloc(sizeof(long)*s->entries);
+
+ for(i=0;i<s->entries;){
+ long num=_oggpack_read(opb,_ilog(s->entries-i));
+ if(num==-1)goto _eofout;
+ for(j=0;j<num;j++,i++)
+ s->lengthlist[i]=length;
+ length++;
+ }
+ }
+ break;
+ default:
+ /* EOF */
+ return(-1);
+ }
+
+ /* Do we have a mapping to unpack? */
+ switch((s->maptype=_oggpack_read(opb,4))){
+ case 0:
+ /* no mapping */
+ break;
+ case 1: case 2:
+ /* implicitly populated value mapping */
+ /* explicitly populated value mapping */
+
+ s->q_min=_oggpack_read(opb,32);
+ s->q_delta=_oggpack_read(opb,32);
+ s->q_quant=_oggpack_read(opb,4)+1;
+ s->q_sequencep=_oggpack_read(opb,1);
+
+ {
+ int quantvals;
+ switch(s->maptype){
+ case 1:
+ quantvals=_book_maptype1_quantvals(s);
+ break;
+ case 2:
+ quantvals=s->entries*s->dim;
+ break;
+ }
+
+ /* quantized values */
+ s->quantlist=malloc(sizeof(float)*quantvals);
+ for(i=0;i<quantvals;i++)
+ s->quantlist[i]=_oggpack_read(opb,s->q_quant);
+
+ if(s->quantlist[quantvals-1]==-1)goto _eofout;
+ }
+ break;
+ default:
+ goto _errout;
+ }
+
+ /* all set */
+ return(0);
+
+ _errout:
+ _eofout:
+ vorbis_staticbook_clear(s);
+ return(-1);
+}
+
+/* returns the number of bits ************************************************/
+int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){
+ _oggpack_write(b,book->codelist[a],book->c->lengthlist[a]);
+ return(book->c->lengthlist[a]);
+}
+
+/* One the encode side, our vector writers are each designed for a
+specific purpose, and the encoder is not flexible without modification:
+
+The LSP vector coder uses a single stage nearest-match with no
+interleave, so no step and no error return. This is specced by floor0
+and doesn't change.
+
+Residue0 encoding interleaves, uses multiple stages, and each stage
+peels of a specific amount of resolution from a lattice (thus we want
+to match by threshhold, not nearest match). Residue doesn't *have* to
+be encoded that way, but to change it, one will need to add more
+infrastructure on the encode side (decode side is specced and simpler) */
+
+/* floor0 LSP (single stage, non interleaved, nearest match) */
+/* returns entry number and *modifies a* to the quantization value *****/
+int vorbis_book_errorv(codebook *book,float *a){
+ int dim=book->dim,k;
+ int best=_best(book,a,1);
+ for(k=0;k<dim;k++)
+ a[k]=(book->valuelist+best*dim)[k];
+ return(best);
+}
+
+/* returns the number of bits and *modifies a* to the quantization value *****/
+int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){
+ int k,dim=book->dim;
+ for(k=0;k<dim;k++)
+ a[k]=(book->valuelist+best*dim)[k];
+ return(vorbis_book_encode(book,best,b));
+}
+
+/* res0 (multistage, interleave, lattice) */
+/* returns the number of bits and *modifies a* to the remainder value ********/
+int vorbis_book_encodevs(codebook *book,float *a,oggpack_buffer *b,
+ int step,int addmul){
+
+ int best=vorbis_book_besterror(book,a,step,addmul);
+ return(vorbis_book_encode(book,best,b));
+}
+
+/* Decode side is specced and easier, because we don't need to find
+ matches using different criteria; we simply read and map. There are
+ two things we need to do 'depending':
+
+ We may need to support interleave. We don't really, but it's
+ convenient to do it here rather than rebuild the vector later.
+
+ Cascades may be additive or multiplicitive; this is not inherent in
+ the codebook, but set in the code using the codebook. Like
+ interleaving, it's easiest to do it here.
+ stage==0 -> declarative (set the value)
+ stage==1 -> additive
+ stage==2 -> multiplicitive */
+
+/* returns the entry number or -1 on eof *************************************/
+long vorbis_book_decode(codebook *book, oggpack_buffer *b){
+ long ptr=0;
+ decode_aux *t=book->decode_tree;
+ do{
+ switch(_oggpack_read1(b)){
+ case 0:
+ ptr=t->ptr0[ptr];
+ break;
+ case 1:
+ ptr=t->ptr1[ptr];
+ break;
+ case -1:
+ return(-1);
+ }
+ }while(ptr>0);
+ return(-ptr);
+}
+
+/* returns the entry number or -1 on eof *************************************/
+long vorbis_book_decodevs(codebook *book,float *a,oggpack_buffer *b,
+ int step,int addmul){
+ long entry=vorbis_book_decode(book,b);
+ int i,o;
+ if(entry==-1)return(-1);
+ switch(addmul){
+ case -1:
+ for(i=0,o=0;i<book->dim;i++,o+=step)
+ a[o]=(book->valuelist+entry*book->dim)[i];
+ break;
+ case 0:
+ for(i=0,o=0;i<book->dim;i++,o+=step)
+ a[o]+=(book->valuelist+entry*book->dim)[i];
+ break;
+ case 1:
+ for(i=0,o=0;i<book->dim;i++,o+=step)
+ a[o]*=(book->valuelist+entry*book->dim)[i];
+ break;
+ }
+ return(entry);
+}
+
+#ifdef _V_SELFTEST
+
+/* Simple enough; pack a few candidate codebooks, unpack them. Code a
+ number of vectors through (keeping track of the quantized values),
+ and decode using the unpacked book. quantized version of in should
+ exactly equal out */
+
+#include <stdio.h>
+
+#include "vorbis/book/lsp20_0.vqh"
+#include "vorbis/book/res0a_13.vqh"
+#define TESTSIZE 40
+
+float test1[TESTSIZE]={
+ 0.105939,
+ 0.215373,
+ 0.429117,
+ 0.587974,
+
+ 0.181173,
+ 0.296583,
+ 0.515707,
+ 0.715261,
+
+ 0.162327,
+ 0.263834,
+ 0.342876,
+ 0.406025,
+
+ 0.103571,
+ 0.223561,
+ 0.368513,
+ 0.540313,
+
+ 0.136672,
+ 0.395882,
+ 0.587183,
+ 0.652476,
+
+ 0.114338,
+ 0.417300,
+ 0.525486,
+ 0.698679,
+
+ 0.147492,
+ 0.324481,
+ 0.643089,
+ 0.757582,
+
+ 0.139556,
+ 0.215795,
+ 0.324559,
+ 0.399387,
+
+ 0.120236,
+ 0.267420,
+ 0.446940,
+ 0.608760,
+
+ 0.115587,
+ 0.287234,
+ 0.571081,
+ 0.708603,
+};
+
+float test3[TESTSIZE]={
+ 0,1,-2,3,4,-5,6,7,8,9,
+ 8,-2,7,-1,4,6,8,3,1,-9,
+ 10,11,12,13,14,15,26,17,18,19,
+ 30,-25,-30,-1,-5,-32,4,3,-2,0};
+
+static_codebook *testlist[]={&_vq_book_lsp20_0,
+ &_vq_book_res0a_13,NULL};
+float *testvec[]={test1,test3};
+
+int main(){
+ oggpack_buffer write;
+ oggpack_buffer read;
+ long ptr=0,i;
+ _oggpack_writeinit(&write);
+
+ fprintf(stderr,"Testing codebook abstraction...:\n");
+
+ while(testlist[ptr]){
+ codebook c;
+ static_codebook s;
+ float *qv=alloca(sizeof(float)*TESTSIZE);
+ float *iv=alloca(sizeof(float)*TESTSIZE);
+ memcpy(qv,testvec[ptr],sizeof(float)*TESTSIZE);
+ memset(iv,0,sizeof(float)*TESTSIZE);
+
+ fprintf(stderr,"\tpacking/coding %ld... ",ptr);
+
+ /* pack the codebook, write the testvector */
+ _oggpack_reset(&write);
+ vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory
+ we can write */
+ vorbis_staticbook_pack(testlist[ptr],&write);
+ fprintf(stderr,"Codebook size %ld bytes... ",_oggpack_bytes(&write));
+ for(i=0;i<TESTSIZE;i+=c.dim){
+ int best=_best(&c,qv+i,1);
+ vorbis_book_encodev(&c,best,qv+i,&write);
+ }
+ vorbis_book_clear(&c);
+
+ fprintf(stderr,"OK.\n");
+ fprintf(stderr,"\tunpacking/decoding %ld... ",ptr);
+
+ /* transfer the write data to a read buffer and unpack/read */
+ _oggpack_readinit(&read,_oggpack_buffer(&write),_oggpack_bytes(&write));
+ if(vorbis_staticbook_unpack(&read,&s)){
+ fprintf(stderr,"Error unpacking codebook.\n");
+ exit(1);
+ }
+ if(vorbis_book_init_decode(&c,&s)){
+ fprintf(stderr,"Error initializing codebook.\n");
+ exit(1);
+ }
+
+ for(i=0;i<TESTSIZE;i+=c.dim)
+ if(vorbis_book_decodevs(&c,iv+i,&read,1,-1)==-1){
+ fprintf(stderr,"Error reading codebook test data (EOP).\n");
+ exit(1);
+ }
+ for(i=0;i<TESTSIZE;i++)
+ if(fabs(qv[i]-iv[i])>.000001){
+ fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
+ iv[i],qv[i],i);
+ exit(1);
+ }
+
+ fprintf(stderr,"OK\n");
+ ptr++;
+ }
+
+ /* The above is the trivial stuff; now try unquantizing a log scale codebook */
+
+ exit(0);
+}
+
+#endif
diff --git a/lib/envelope.c b/lib/envelope.c
index 5f1fdf0c..1d0090a5 100644
--- a/lib/envelope.c
+++ b/lib/envelope.c
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.21.2.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.21.2.2 2000/08/31 09:00:00 xiphmont Exp $
Preecho calculation.
@@ -40,9 +40,9 @@
#if 0
static int cheb_bandpass_stages=10;
-static double cheb_bandpass_gain=5.589612458e+01;
-static double cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1};
-static double cheb_bandpass_A[]={
+static float cheb_bandpass_gain=5.589612458e+01;
+static float cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1};
+static float cheb_bandpass_A[]={
-0.1917409386,
0.0078657069,
-0.7126903444,
@@ -56,10 +56,10 @@ static double cheb_bandpass_A[]={
#endif
static int cheb_highpass_stages=10;
-static double cheb_highpass_gain= 5.291963434e+01;
+static float cheb_highpass_gain= 5.291963434e+01;
/* z^-stage, z^-stage+1... */
-static double cheb_highpass_B[]={1,-10,45,-120,210,-252,210,-120,45,-10,1};
-static double cheb_highpass_A[]={
+static float cheb_highpass_B[]={1,-10,45,-120,210,-252,210,-120,45,-10,1};
+static float cheb_highpass_A[]={
-0.1247628029,
0.1334086523,
-0.3997715614,
@@ -78,17 +78,17 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
e->winlength=window;
e->minenergy=fromdB(vi->preecho_minenergy);
e->iir=calloc(ch,sizeof(IIR_state));
- e->filtered=calloc(ch,sizeof(double *));
+ e->filtered=calloc(ch,sizeof(float *));
e->ch=ch;
e->storage=128;
for(i=0;i<ch;i++){
IIR_init(e->iir+i,cheb_highpass_stages,cheb_highpass_gain,
cheb_highpass_A,cheb_highpass_B);
- e->filtered[i]=calloc(e->storage,sizeof(double));
+ e->filtered[i]=calloc(e->storage,sizeof(float));
}
drft_init(&e->drft,window);
- e->window=malloc(e->winlength*sizeof(double));
+ e->window=malloc(e->winlength*sizeof(float));
/* We just use a straight sin(x) window for this */
for(i=0;i<e->winlength;i++)
e->window[i]=sin((i+.5)/e->winlength*M_PI);
@@ -106,13 +106,13 @@ void _ve_envelope_clear(envelope_lookup *e){
memset(e,0,sizeof(envelope_lookup));
}
-static double _ve_deltai(envelope_lookup *ve,IIR_state *iir,
- double *pre,double *post){
+static float _ve_deltai(envelope_lookup *ve,IIR_state *iir,
+ float *pre,float *post){
long n2=ve->winlength*2;
long n=ve->winlength;
- double *workA=alloca(sizeof(double)*n2),A=0.;
- double *workB=alloca(sizeof(double)*n2),B=0.;
+ float *workA=alloca(sizeof(float)*n2),A=0.;
+ float *workB=alloca(sizeof(float)*n2),B=0.;
long i;
/*_analysis_output("A",frameno,pre,n,0,0);
@@ -133,7 +133,7 @@ static double _ve_deltai(envelope_lookup *ve,IIR_state *iir,
basing blocks on quantization noise that outweighs the signal
itself (for low power signals) */
{
- double min=ve->minenergy;
+ float min=ve->minenergy;
for(i=0;i<n;i++){
if(fabs(workA[i])<min)workA[i]=min;
if(fabs(workB[i])<min)workB[i]=min;
@@ -163,13 +163,13 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
if(v->pcm_storage>ve->storage){
ve->storage=v->pcm_storage;
for(i=0;i<ve->ch;i++)
- ve->filtered[i]=realloc(ve->filtered[i],ve->storage*sizeof(double));
+ ve->filtered[i]=realloc(ve->filtered[i],ve->storage*sizeof(float));
}
/* catch up the highpass to match the pcm */
for(i=0;i<ve->ch;i++){
- double *filtered=ve->filtered[i];
- double *pcm=v->pcm[i];
+ float *filtered=ve->filtered[i];
+ float *pcm=v->pcm[i];
IIR_state *iir=ve->iir+i;
for(j=ve->current;j<v->pcm_current;j++)
@@ -186,9 +186,9 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
while(j+ve->winlength<=v->pcm_current){
for(i=0;i<ve->ch;i++){
- double *filtered=ve->filtered[i]+j;
+ float *filtered=ve->filtered[i]+j;
IIR_state *iir=ve->iir+i;
- double m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered);
+ float m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered);
if(m>vi->preecho_thresh){
/*frameno++;*/
@@ -208,7 +208,7 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){
int i;
for(i=0;i<e->ch;i++)
memmove(e->filtered[i],e->filtered[i]+shift,(e->current-shift)*
- sizeof(double));
+ sizeof(float));
e->current-=shift;
}
diff --git a/lib/envelope.h b/lib/envelope.h
new file mode 100644
index 00000000..b1f0a94c
--- /dev/null
+++ b/lib/envelope.h
@@ -0,0 +1,49 @@
+/********************************************************************
+ * *
+ * 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: PCM data envelope analysis and manipulation
+ last mod: $Id: envelope.h,v 1.9.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_ENVELOPE_
+#define _V_ENVELOPE_
+
+#include "iir.h"
+#include "smallft.h"
+
+#define EORDER 16
+
+typedef struct {
+ int ch;
+ int winlength;
+ int searchstep;
+ float minenergy;
+
+ IIR_state *iir;
+ float **filtered;
+ long storage;
+ long current;
+
+ drft_lookup drft;
+ float *window;
+} envelope_lookup;
+
+extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi);
+extern void _ve_envelope_clear(envelope_lookup *e);
+extern long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint);
+extern void _ve_envelope_shift(envelope_lookup *e,long shift);
+
+
+#endif
+
diff --git a/lib/floor0.c b/lib/floor0.c
index b2f1c6af..8a3518ea 100644
--- a/lib/floor0.c
+++ b/lib/floor0.c
@@ -12,7 +12,7 @@
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.23.2.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.23.2.2 2000/08/31 09:00:00 xiphmont Exp $
********************************************************************/
@@ -41,19 +41,19 @@ typedef struct {
vorbis_info_floor0 *vi;
lpc_lookup lpclook;
- double *lsp_look;
+ float *lsp_look;
} vorbis_look_floor0;
/* infrastructure for finding fit */
static long _f0_fit(codebook *book,
- double *orig,
- double *workfit,
+ float *orig,
+ float *workfit,
int cursor){
int dim=book->dim;
- double norm,base=0.;
+ float norm,base=0.;
int i,best=0;
- double *lsp=workfit+cursor;
+ float *lsp=workfit+cursor;
if(cursor)base=workfit[cursor-1];
norm=orig[cursor+dim-1]-base;
@@ -62,7 +62,7 @@ static long _f0_fit(codebook *book,
lsp[i]=(orig[i+cursor]-base);
best=_best(book,lsp,1);
- memcpy(lsp,book->valuelist+best*dim,dim*sizeof(double));
+ memcpy(lsp,book->valuelist+best*dim,dim*sizeof(float));
for(i=0;i<dim;i++)
lsp[i]+=base;
return(best);
@@ -137,7 +137,7 @@ static vorbis_info_floor *unpack (vorbis_info *vi,oggpack_buffer *opb){
static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
vorbis_info_floor *i){
int j;
- double scale;
+ float scale;
vorbis_info *vi=vd->vi;
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
vorbis_look_floor0 *look=calloc(1,sizeof(vorbis_look_floor0));
@@ -168,7 +168,7 @@ static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
look->linearmap[j]=val;
}
- look->lsp_look=malloc(look->ln*sizeof(double));
+ look->lsp_look=malloc(look->ln*sizeof(float));
for(j=0;j<look->ln;j++)
look->lsp_look[j]=2*cos(M_PI/look->ln*j);
@@ -178,16 +178,16 @@ static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
/* less efficient than the decode side (written for clarity). We're
not bottlenecked here anyway */
-double _curve_to_lpc(double *curve,double *lpc,
+float _curve_to_lpc(float *curve,float *lpc,
vorbis_look_floor0 *l,long frameno){
/* map the input curve to a bark-scale curve for encoding */
int mapped=l->ln;
- double *work=alloca(sizeof(double)*mapped);
+ float *work=alloca(sizeof(float)*mapped);
int i,j,last=0;
int bark=0;
- memset(work,0,sizeof(double)*mapped);
+ memset(work,0,sizeof(float)*mapped);
/* Only the decode side is behavior-specced; for now in the encoder,
we select the maximum value of each band as representative (this
@@ -211,7 +211,7 @@ double _curve_to_lpc(double *curve,double *lpc,
/* we'll always have a bin zero, so we don't need to guard init */
long span=bark-last;
for(j=1;j<span;j++){
- double del=(double)j/span;
+ float del=(float)j/span;
work[j+last]=work[bark]*del+work[last]*(1.-del);
}
}
@@ -241,14 +241,14 @@ double _curve_to_lpc(double *curve,double *lpc,
/* generate the whole freq response curve of an LSP IIR filter */
-void _lsp_to_curve(double *curve,double *lsp,double amp,
+void _lsp_to_curve(float *curve,float *lsp,float amp,
vorbis_look_floor0 *l,char *name,long frameno){
/* l->m+1 must be less than l->ln, but guard in case we get a bad stream */
- double *lcurve=alloca(sizeof(double)*l->ln);
+ float *lcurve=alloca(sizeof(float)*l->ln);
int i;
if(amp==0){
- memset(curve,0,sizeof(double)*l->n);
+ memset(curve,0,sizeof(float)*l->n);
return;
}
vorbis_lsp_to_curve(lcurve,l->ln,lsp,l->m,amp,l->lsp_look);
@@ -259,12 +259,12 @@ void _lsp_to_curve(double *curve,double *lsp,double amp,
static long seq=0;
static int forward(vorbis_block *vb,vorbis_look_floor *i,
- double *in,double *out){
+ float *in,float *out){
long j;
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
vorbis_info_floor0 *info=look->vi;
- double *work=alloca((look->ln+look->n)*sizeof(double));
- double amp;
+ float *work=alloca((look->ln+look->n)*sizeof(float));
+ float amp;
long bits=0;
#ifdef TRAIN_LSP
@@ -322,7 +322,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i,
#if 1
#ifdef TRAIN_LSP
{
- double last=0.;
+ float last=0.;
for(j=0;j<look->m;j++){
fprintf(of,"%.12g, ",out[j]-last);
last=out[j];
@@ -349,7 +349,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i,
#ifdef ANALYSIS
{
- double last=0;
+ float last=0;
for(j=0;j<look->m;j++){
out[j]=work[j]-last;
last=work[j];
@@ -369,12 +369,12 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i,
return(1);
}
- memset(out,0,sizeof(double)*look->n);
+ memset(out,0,sizeof(float)*look->n);
seq++;
return(0);
}
-static int inverse(vorbis_block *vb,vorbis_look_floor *i,double *out){
+static int inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
vorbis_info_floor0 *info=look->vi;
int j,k;
@@ -382,14 +382,14 @@ static int inverse(vorbis_block *vb,vorbis_look_floor *i,double *out){
int ampraw=_oggpack_read(&vb->opb,info->ampbits);
if(ampraw>0){ /* also handles the -1 out of data case */
long maxval=(1<<info->ampbits)-1;
- double amp=(float)ampraw/maxval*info->ampdB;
+ float amp=(float)ampraw/maxval*info->ampdB;
int booknum=_oggpack_read(&vb->opb,_ilog(info->numbooks));
if(booknum!=-1){
codebook *b=vb->vd->fullbooks+info->books[booknum];
- double last=0.;
+ float last=0.;
- memset(out,0,sizeof(double)*look->m);
+ memset(out,0,sizeof(float)*look->m);
for(j=0;j<look->m;j+=b->dim)
if(vorbis_book_decodevs(b,out+j,&vb->opb,1,-1)==-1)goto eop;
@@ -407,7 +407,7 @@ static int inverse(vorbis_block *vb,vorbis_look_floor *i,double *out){
}
eop:
- memset(out,0,sizeof(double)*look->n);
+ memset(out,0,sizeof(float)*look->n);
return(0);
}
diff --git a/lib/framing.c b/lib/framing.c
index 39c4841b..3d892fcf 100644
--- a/lib/framing.c
+++ b/lib/framing.c
@@ -13,7 +13,7 @@
function: code raw [Vorbis] packets into framed OggSquish stream and
decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.24.2.1 2000/08/31 08:05:47 xiphmont Exp $
+ last mod: $Id: framing.c,v 1.24.2.2 2000/08/31 09:00:00 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
diff --git a/lib/iir.c b/lib/iir.c
new file mode 100644
index 00000000..e9c086ce
--- /dev/null
+++ b/lib/iir.c
@@ -0,0 +1,302 @@
+/********************************************************************
+ * *
+ * 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: Direct Form I, II IIR filters, plus some specializations
+ last mod: $Id: iir.c,v 1.1.4.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+/* LPC is actually a degenerate case of form I/II filters, but we need
+ both */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "iir.h"
+
+void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B){
+ memset(s,0,sizeof(IIR_state));
+ s->stages=stages;
+ s->gain=gain;
+ s->coeff_A=malloc(stages*sizeof(float));
+ s->coeff_B=malloc((stages+1)*sizeof(float));
+ s->z_A=calloc(stages*2,sizeof(float));
+ s->z_B=calloc(stages*2,sizeof(float));
+
+ memcpy(s->coeff_A,A,stages*sizeof(float));
+ memcpy(s->coeff_B,B,(stages+1)*sizeof(float));
+}
+
+void IIR_clear(IIR_state *s){
+ if(s){
+ free(s->coeff_A);
+ free(s->coeff_B);
+ free(s->z_A);
+ free(s->z_B);
+ memset(s,0,sizeof(IIR_state));
+ }
+}
+
+float IIR_filter(IIR_state *s,float in){
+ int stages=s->stages,i;
+ float newA;
+ float newB=0;
+ float *zA=s->z_A+s->ring;
+
+ newA=in/=s->gain;
+ for(i=0;i<stages;i++){
+ newA+= s->coeff_A[i] * zA[i];
+ newB+= s->coeff_B[i] * zA[i];
+ }
+ newB+=newA*s->coeff_B[stages];
+
+ zA[0]=zA[stages]=newA;
+ if(++s->ring>=stages)s->ring=0;
+
+ return(newB);
+}
+
+/* this assumes the symmetrical structure of the feed-forward stage of
+ a Chebyshev bandpass to save multiplies */
+float IIR_filter_ChebBand(IIR_state *s,float in){
+ int stages=s->stages,i;
+ float newA;
+ float newB=0;
+ float *zA=s->z_A+s->ring;
+
+ newA=in/=s->gain;
+
+ newA+= s->coeff_A[0] * zA[0];
+ for(i=1;i<(stages>>1);i++){
+ newA+= s->coeff_A[i] * zA[i];
+ newB+= s->coeff_B[i] * (zA[i]-zA[stages-i]);
+ }
+ newB+= s->coeff_B[i] * zA[i];
+ for(;i<stages;i++)
+ newA+= s->coeff_A[i] * zA[i];
+
+ newB+= newA-zA[0];
+
+ zA[0]=zA[stages]=newA;
+ if(++s->ring>=stages)s->ring=0;
+
+ return(newB);
+}
+
+#ifdef _V_SELFTEST
+
+/* z^-stage, z^-stage+1... */
+static float cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1};
+static float cheb_bandpass_A[]={-0.6665900311,
+ 1.0070146601,
+ -3.1262875409,
+ 3.5017171569,
+ -6.2779211945,
+ 5.2966481740,
+ -6.7570216587,
+ 4.0760335768,
+ -3.9134284363,
+ 1.3997338886};
+
+static float data[128]={
+ 0.0426331,
+ 0.0384521,
+ 0.0345764,
+ 0.0346069,
+ 0.0314636,
+ 0.0310059,
+ 0.0318604,
+ 0.0336304,
+ 0.036438,
+ 0.0348511,
+ 0.0354919,
+ 0.0343628,
+ 0.0325623,
+ 0.0318909,
+ 0.0263367,
+ 0.0225525,
+ 0.0195618,
+ 0.0160828,
+ 0.0168762,
+ 0.0145569,
+ 0.0126343,
+ 0.0127258,
+ 0.00820923,
+ 0.00787354,
+ 0.00558472,
+ 0.00204468,
+ 3.05176e-05,
+ -0.00357056,
+ -0.00570679,
+ -0.00991821,
+ -0.0101013,
+ -0.00881958,
+ -0.0108948,
+ -0.0110168,
+ -0.0119324,
+ -0.0161438,
+ -0.0194702,
+ -0.0229187,
+ -0.0260315,
+ -0.0282288,
+ -0.0306091,
+ -0.0330505,
+ -0.0364685,
+ -0.0385742,
+ -0.0428772,
+ -0.043457,
+ -0.0425415,
+ -0.0462341,
+ -0.0467529,
+ -0.0489807,
+ -0.0520325,
+ -0.0558167,
+ -0.0596924,
+ -0.0591431,
+ -0.0612793,
+ -0.0618591,
+ -0.0615845,
+ -0.0634155,
+ -0.0639648,
+ -0.0683594,
+ -0.0718079,
+ -0.0729675,
+ -0.0791931,
+ -0.0860901,
+ -0.0885315,
+ -0.088623,
+ -0.089386,
+ -0.0899353,
+ -0.0886841,
+ -0.0910645,
+ -0.0948181,
+ -0.0919495,
+ -0.0891418,
+ -0.0916443,
+ -0.096344,
+ -0.100464,
+ -0.105499,
+ -0.108612,
+ -0.112213,
+ -0.117676,
+ -0.120911,
+ -0.124329,
+ -0.122162,
+ -0.120605,
+ -0.12326,
+ -0.12619,
+ -0.128998,
+ -0.13205,
+ -0.134247,
+ -0.137939,
+ -0.143555,
+ -0.14389,
+ -0.14859,
+ -0.153717,
+ -0.159851,
+ -0.164551,
+ -0.162811,
+ -0.164276,
+ -0.156952,
+ -0.140564,
+ -0.123291,
+ -0.10321,
+ -0.0827637,
+ -0.0652466,
+ -0.053772,
+ -0.0509949,
+ -0.0577698,
+ -0.0818176,
+ -0.114929,
+ -0.148895,
+ -0.181122,
+ -0.200714,
+ -0.21048,
+ -0.203644,
+ -0.179413,
+ -0.145325,
+ -0.104492,
+ -0.0658264,
+ -0.0332031,
+ -0.0106201,
+ -0.00363159,
+ -0.00909424,
+ -0.0244141,
+ -0.0422058,
+ -0.0537415,
+ -0.0610046,
+ -0.0609741,
+ -0.0547791};
+
+/* comparison test code from http://www-users.cs.york.ac.uk/~fisher/mkfilter/
+ (the above page kicks ass, BTW)*/
+
+#define NZEROS 10
+#define NPOLES 10
+#define GAIN 4.599477515e+02
+
+static float xv[NZEROS+1], yv[NPOLES+1];
+
+static float filterloop(float next){
+ xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5];
+ xv[5] = xv[6]; xv[6] = xv[7]; xv[7] = xv[8]; xv[8] = xv[9]; xv[9] = xv[10];
+ xv[10] = next / GAIN;
+ yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = yv[5];
+ yv[5] = yv[6]; yv[6] = yv[7]; yv[7] = yv[8]; yv[8] = yv[9]; yv[9] = yv[10];
+ yv[10] = (xv[10] - xv[0]) + 5 * (xv[2] - xv[8]) + 10 * (xv[6] - xv[4])
+ + ( -0.6665900311 * yv[0]) + ( 1.0070146601 * yv[1])
+ + ( -3.1262875409 * yv[2]) + ( 3.5017171569 * yv[3])
+ + ( -6.2779211945 * yv[4]) + ( 5.2966481740 * yv[5])
+ + ( -6.7570216587 * yv[6]) + ( 4.0760335768 * yv[7])
+ + ( -3.9134284363 * yv[8]) + ( 1.3997338886 * yv[9]);
+ return(yv[10]);
+}
+
+#include <stdio.h>
+int main(){
+
+ /* run the pregenerated Chebyshev filter, then our own distillation
+ through the generic and specialized code */
+ float *work=malloc(128*sizeof(float));
+ IIR_state iir;
+ int i;
+
+ for(i=0;i<128;i++)work[i]=filterloop(data[i]);
+ {
+ FILE *out=fopen("IIR_ref.m","w");
+ for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
+ fclose(out);
+ }
+
+ IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B);
+ for(i=0;i<128;i++)work[i]=IIR_filter(&iir,data[i]);
+ {
+ FILE *out=fopen("IIR_gen.m","w");
+ for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
+ fclose(out);
+ }
+ IIR_clear(&iir);
+
+ IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B);
+ for(i=0;i<128;i++)work[i]=IIR_filter_ChebBand(&iir,data[i]);
+ {
+ FILE *out=fopen("IIR_cheb.m","w");
+ for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
+ fclose(out);
+ }
+ IIR_clear(&iir);
+
+ return(0);
+}
+
+#endif
diff --git a/lib/iir.h b/lib/iir.h
new file mode 100644
index 00000000..39c7d7b5
--- /dev/null
+++ b/lib/iir.h
@@ -0,0 +1,37 @@
+/********************************************************************
+ * *
+ * 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: Direct Form I, II IIR filters, plus some specializations
+ last mod: $Id: iir.h,v 1.1.4.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_IIR_H_
+#define _V_IIR_H_
+
+typedef struct {
+ int stages;
+ float *coeff_A;
+ float *coeff_B;
+ float *z_A;
+ float *z_B;
+ int ring;
+ float gain;
+} IIR_state;
+
+void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B);
+void IIR_clear(IIR_state *s);
+float IIR_filter(IIR_state *s,float in);
+float IIR_filter_ChebBand(IIR_state *s,float in);
+
+#endif
diff --git a/lib/lpc.c b/lib/lpc.c
new file mode 100644
index 00000000..76d43bdc
--- /dev/null
+++ b/lib/lpc.c
@@ -0,0 +1,195 @@
+/********************************************************************
+ * *
+ * 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: LPC low level routines
+ last mod: $Id: lpc.c,v 1.25.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+/* Some of these routines (autocorrelator, LPC coefficient estimator)
+ are derived from code written by Jutta Degener and Carsten Bormann;
+ thus we include their copyright below. The entirety of this file
+ is freely redistributable on the condition that both of these
+ copyright notices are preserved without modification. */
+
+/* Preserved Copyright: *********************************************/
+
+/* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
+Technische Universita"t Berlin
+
+Any use of this software is permitted provided that this notice is not
+removed and that neither the authors nor the Technische Universita"t
+Berlin are deemed to have made any representations as to the
+suitability of this software for any purpose nor are held responsible
+for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR
+THIS SOFTWARE.
+
+As a matter of courtesy, the authors request to be informed about uses
+this software has found, about bugs in this software, and about any
+improvements that may be of general interest.
+
+Berlin, 28.11.1994
+Jutta Degener
+Carsten Bormann
+
+*********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "os.h"
+#include "smallft.h"
+#include "lpc.h"
+#include "scales.h"
+#include "misc.h"
+
+/* Autocorrelation LPC coeff generation algorithm invented by
+ N. Levinson in 1947, modified by J. Durbin in 1959. */
+
+/* Input : n elements of time doamin data
+ Output: m lpc coefficients, excitation energy */
+
+float vorbis_lpc_from_data(float *data,float *lpc,int n,int m){
+ float *aut=alloca(sizeof(float)*(m+1));
+ float error;
+ int i,j;
+
+ /* autocorrelation, p+1 lag coefficients */
+
+ j=m+1;
+ while(j--){
+ float d=0;
+ for(i=j;i<n;i++)d+=data[i]*data[i-j];
+ aut[j]=d;
+ }
+
+ /* Generate lpc coefficients from autocorr values */
+
+ error=aut[0];
+ if(error==0){
+ memset(lpc,0,m*sizeof(float));
+ return 0;
+ }
+
+ for(i=0;i<m;i++){
+ float r=-aut[i+1];
+
+ /* Sum up this iteration's reflection coefficient; note that in
+ Vorbis we don't save it. If anyone wants to recycle this code
+ and needs reflection coefficients, save the results of 'r' from
+ each iteration. */
+
+ for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
+ r/=error;
+
+ /* Update LPC coefficients and total error */
+
+ lpc[i]=r;
+ for(j=0;j<i/2;j++){
+ float tmp=lpc[j];
+ lpc[j]+=r*lpc[i-1-j];
+ lpc[i-1-j]+=r*tmp;
+ }
+ if(i%2)lpc[j]+=lpc[j]*r;
+
+ error*=1.0-r*r;
+ }
+
+ /* we need the error value to know how big an impulse to hit the
+ filter with later */
+
+ return error;
+}
+
+/* Input : n element envelope spectral curve
+ Output: m lpc coefficients, excitation energy */
+
+float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l){
+ int n=l->ln;
+ int m=l->m;
+ float *work=alloca(sizeof(float)*(n+n));
+ float fscale=.5/n;
+ int i,j;
+
+ /* input is a real curve. make it complex-real */
+ /* This mixes phase, but the LPC generation doesn't care. */
+ for(i=0;i<n;i++){
+ work[i*2]=curve[i]*fscale;
+ work[i*2+1]=0;
+ }
+ work[n*2-1]=curve[n-1]*fscale;
+
+ n*=2;
+ drft_backward(&l->fft,work);
+
+ /* The autocorrelation will not be circular. Shift, else we lose
+ most of the power in the edges. */
+
+ for(i=0,j=n/2;i<n/2;){
+ float temp=work[i];
+ work[i++]=work[j];
+ work[j++]=temp;
+ }
+
+ /* we *could* shave speed here by skimping on the edges (thus
+ speeding up the autocorrelation in vorbis_lpc_from_data) but we
+ don't right now. */
+
+ return(vorbis_lpc_from_data(work,lpc,n,m));
+}
+
+void lpc_init(lpc_lookup *l,long mapped, int m){
+ memset(l,0,sizeof(lpc_lookup));
+
+ l->ln=mapped;
+ l->m=m;
+
+ /* we cheat decoding the LPC spectrum via FFTs */
+ drft_init(&l->fft,mapped*2);
+
+}
+
+void lpc_clear(lpc_lookup *l){
+ if(l){
+ drft_clear(&l->fft);
+ }
+}
+
+void vorbis_lpc_predict(float *coeff,float *prime,int m,
+ float *data,long n){
+
+ /* in: coeff[0...m-1] LPC coefficients
+ prime[0...m-1] initial values (allocated size of n+m-1)
+ out: data[0...n-1] data samples */
+
+ long i,j,o,p;
+ float y;
+ float *work=alloca(sizeof(float)*(m+n));
+
+ if(!prime)
+ for(i=0;i<m;i++)
+ work[i]=0.;
+ else
+ for(i=0;i<m;i++)
+ work[i]=prime[i];
+
+ for(i=0;i<n;i++){
+ y=0;
+ o=i;
+ p=m;
+ for(j=0;j<m;j++)
+ y-=work[o++]*coeff[--p];
+
+ data[i]=work[o]=y;
+ }
+}
diff --git a/lib/lpc.h b/lib/lpc.h
new file mode 100644
index 00000000..e95712f4
--- /dev/null
+++ b/lib/lpc.h
@@ -0,0 +1,45 @@
+/********************************************************************
+ * *
+ * 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: LPC low level routines
+ last mod: $Id: lpc.h,v 1.13.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_LPC_H_
+#define _V_LPC_H_
+
+#include "vorbis/codec.h"
+#include "smallft.h"
+
+typedef struct lpclook{
+ /* en/decode lookups */
+ drft_lookup fft;
+
+ int ln;
+ int m;
+
+} lpc_lookup;
+
+extern void lpc_init(lpc_lookup *l,long mapped, int m);
+extern void lpc_clear(lpc_lookup *l);
+
+/* simple linear scale LPC code */
+extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
+extern float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l);
+
+extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
+ float *data,long n);
+
+
+#endif
diff --git a/lib/lsp.c b/lib/lsp.c
new file mode 100644
index 00000000..bc1dbcc0
--- /dev/null
+++ b/lib/lsp.c
@@ -0,0 +1,146 @@
+/********************************************************************
+ * *
+ * 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: LSP (also called LSF) conversion routines
+ last mod: $Id: lsp.c,v 1.9.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ The LSP generation code is taken (with minimal modification) from
+ "On the Computation of the LSP Frequencies" by Joseph Rothweiler
+ <rothwlr@altavista.net>, available at:
+
+ http://www2.xtdl.com/~rothwlr/lsfpaper/lsfpage.html
+
+ ********************************************************************/
+
+/* Note that the lpc-lsp conversion finds the roots of polynomial with
+ an iterative root polisher (CACM algorithm 283). It *is* possible
+ to confuse this algorithm into not converging; that should only
+ happen with absurdly closely spaced roots (very sharp peaks in the
+ LPC f response) which in turn should be impossible in our use of
+ the code. If this *does* happen anyway, it's a bug in the floor
+ finder; find the cause of the confusion (probably a single bin
+ spike or accidental near-float-limit resolution problems) and
+ correct it. */
+
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+#include "lsp.h"
+#include "os.h"
+#include "misc.h"
+
+void vorbis_lsp_to_curve(float *curve,int n,float *lsp,int m,float amp,
+ float *w){
+ int i,j,k;
+ float *coslsp=alloca(m*sizeof(float));
+ for(i=0;i<m;i++)coslsp[i]=2*cos(lsp[i]);
+
+ for(k=0;k<n;k++){
+ float p=.70710678118654752440;
+ float q=.70710678118654752440;
+ for(j=0;j<m;){
+ p*= *w-coslsp[j++];
+ q*= *w-coslsp[j++];
+ }
+ curve[k]=amp/sqrt(p*p*(1.+ *w*.5)+q*q*(1.- *w*.5));
+ w++;
+ }
+}
+
+static void cheby(float *g, int ord) {
+ int i, j;
+
+ g[0] *= 0.5;
+ for(i=2; i<= ord; i++) {
+ for(j=ord; j >= i; j--) {
+ g[j-2] -= g[j];
+ g[j] += g[j];
+ }
+ }
+}
+
+static int comp(const void *a,const void *b){
+ if(*(float *)a<*(float *)b)
+ return(1);
+ else
+ return(-1);
+}
+
+/* CACM algorithm 283. */
+static void cacm283(float *a,int ord,float *r){
+ int i, k;
+ float val, p, delta, error;
+ float rooti;
+
+ for(i=0; i<ord;i++) r[i] = 2.0 * (i+0.5) / ord - 1.0;
+
+ for(error=1 ; error > 1.e-12; ) {
+ error = 0;
+ for( i=0; i<ord; i++) { /* Update each point. */
+ rooti = r[i];
+ val = a[ord];
+ p = a[ord];
+ for(k=ord-1; k>= 0; k--) {
+ val = val * rooti + a[k];
+ if (k != i) p *= rooti - r[k];
+ }
+ delta = val/p;
+ r[i] -= delta;
+
+ error += delta*delta;
+ }
+ }
+
+ /* Replaced the original bubble sort with a real sort. With your
+ help, we can eliminate the bubble sort in our lifetime. --Monty */
+
+ qsort(r,ord,sizeof(float),comp);
+
+}
+
+/* Convert lpc coefficients to lsp coefficients */
+void vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
+ int order2=m/2;
+ float *g1=alloca(sizeof(float)*(order2+1));
+ float *g2=alloca(sizeof(float)*(order2+1));
+ float *g1r=alloca(sizeof(float)*(order2+1));
+ float *g2r=alloca(sizeof(float)*(order2+1));
+ int i;
+
+ /* Compute the lengths of the x polynomials. */
+ /* Compute the first half of K & R F1 & F2 polynomials. */
+ /* Compute half of the symmetric and antisymmetric polynomials. */
+ /* Remove the roots at +1 and -1. */
+
+ g1[order2] = 1.0;
+ for(i=0;i<order2;i++) g1[order2-i-1] = lpc[i]+lpc[m-i-1];
+ g2[order2] = 1.0;
+ for(i=0;i<order2;i++) g2[order2-i-1] = lpc[i]-lpc[m-i-1];
+
+ for(i=0; i<order2;i++) g1[order2-i-1] -= g1[order2-i];
+ for(i=0; i<order2;i++) g2[order2-i-1] += g2[order2-i];
+
+ /* Convert into polynomials in cos(alpha) */
+ cheby(g1,order2);
+ cheby(g2,order2);
+
+ /* Find the roots of the 2 even polynomials.*/
+
+ cacm283(g1,order2,g1r);
+ cacm283(g2,order2,g2r);
+
+ for(i=0;i<m;i+=2){
+ lsp[i] = acos(g1r[i/2]);
+ lsp[i+1] = acos(g2r[i/2]);
+ }
+}
diff --git a/lib/lsp.h b/lib/lsp.h
new file mode 100644
index 00000000..09589c75
--- /dev/null
+++ b/lib/lsp.h
@@ -0,0 +1,28 @@
+/********************************************************************
+ * *
+ * 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: LSP (also called LSF) conversion routines
+ last mod: $Id: lsp.h,v 1.4.2.1 2000/08/31 09:00:00 xiphmont Exp $
+
+ ********************************************************************/
+
+
+#ifndef _V_LSP_H_
+#define _V_LSP_H_
+
+extern void vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
+extern void vorbis_lsp_to_curve(float *curve,int n,
+ float *lsp,int m,float amp,
+ float *w);
+
+#endif
diff --git a/lib/mapping0.c b/lib/mapping0.c
new file mode 100644
index 00000000..8f6ad6f9
--- /dev/null
+++ b/lib/mapping0.c
@@ -0,0 +1,381 @@
+/********************************************************************
+ * *
+ * 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.15.2.1 2000/08/31 09:00:00 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;
+ float **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(float *));
+ for(i=0;i<vi->channels;i++)
+ look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(float));
+ }
+
+ 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 "os.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "envelope.h"
+#include "mdct.h"
+#include "psy.h"
+#include "bitwise.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;
+ float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+
+ float **pcmbundle=alloca(sizeof(float *)*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++){
+ float *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++){
+ float *pcm=vb->pcm[i];
+ mdct_forward(vd->transform[vb->W][0],pcm,pcm);
+ }
+
+ {
+ float *floor=_vorbis_block_alloc(vb,n*sizeof(float)/2);
+
+ for(i=0;i<vi->channels;i++){
+ float *pcm=vb->pcm[i];
+ float *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(float)/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];
+
+ float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+ float **pcmbundle=alloca(sizeof(float *)*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++){
+ float *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++){
+ float *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++){
+ float *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/masking.h b/lib/masking.h
new file mode 100644
index 00000000..227b0e76
--- /dev/null
+++ b/lib/masking.h
@@ -0,0 +1,244 @@
+/********************************************************************
+ * *
+ * 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: masking curve data for psychoacoustics
+ last mod: $Id: masking.h,v 1.4.2.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_MASKING_H_
+#define _V_MASKING_H_
+
+/* Not really an ATH, more a bottom curve to limit LSP dynamic range */
+float ATH_Bark_dB[]={
+ 15, 15, 15, 15, 11, 10, 8, 7, 7, 7,
+ 6, 2, 0, 0, -3, -5, -6, -6, -4.5, 2.5,
+ 10, 15, 15, 15, 15, 15, 15};
+
+/* The below masking curves are straight from the R. Ehmer
+ (J. Acoustical Society of America) papers ca 1958-59. I modified
+ them slightly as Ehmer does not correct for the Absolute Threshold
+ of Hearing, and the low dB portions of the curves are thus highly
+ suspect. */
+
+/* Let's all do the Trek thing and just call them 'Ehmer curves' ;-)
+ Note these are octaves, not Bark scale. */
+
+#define EHMER_OFFSET 16
+#define EHMER_MAX 56
+
+float tone_125_40dB_SL[EHMER_MAX]={
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 27, 26, 25, 23, 21,
+ 20, 18, 16, 14, 12, 11, 9, 7, 5, 3, 2, 0, -2, -4, -6, -8,
+ -10, -12, -14, -16, -18, -20, -23, -25, -28,-30,-34,-37,-40,-44,-48,-52,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_125_60dB_SL[EHMER_MAX]={
+ 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 47, 46, 45, 43, 41,
+ 40, 38, 36, 34, 32, 31, 29, 27, 25, 23, 22, 20, 18, 16, 14, 12,
+ 10, 8, 6, 4, 2, 0, -3, -5, -8,-10,-14,-17,-20,-24,-28,-32,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_125_80dB_SL[EHMER_MAX]={
+ 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 67, 66, 65, 63, 61,
+ 60, 58, 56, 54, 52, 51, 49, 47, 45, 43, 42, 40, 38, 36, 34, 32,
+ 30, 28, 26, 24, 22, 20, 17, 15, 12, 10, 6, 3, 0, -4, -8,-12,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_125_100dB_SL[EHMER_MAX]={
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 83, 82, 81, 80, 79,
+ 78, 77, 75, 74, 73, 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, 60,
+ 58, 57, 55, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 31, 29,
+ 27, 24, 22, 20, 18, 15, 13, 11};
+
+float tone_250_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -19, -13, -7, -1, 4, 9, 15, 20,
+ 22, 23, 22, 19, 18, 18, 16, 13, 9, 7, 3, 1, -1, -3, -6, -8,
+ -10, -13, -16, -19, -21, -24, -28, -32, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_250_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, -5, 1, 7, 13, 19, 25, 30, 33,
+ 36, 39, 38, 37, 38, 39, 39, 40, 38, 36, 35, 34, 33, 31, 29, 28,
+ 28, 28, 25, 20, 14, 10, 5, 0, -5,-10,-15,-20,-25,-30,-35,-40,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_250_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, 10, 17, 24, 30, 37, 41, 48, 49,
+ 50, 53, 54, 53, 53, 54, 55, 57, 57, 57, 58, 59, 60, 58, 57, 58,
+ 59, 58, 57, 54, 52, 50, 49, 47, 46, 47, 46, 44, 43, 42, 41, 40,
+ 38, 32, 27, 22, 17, 11, 6, 0};
+/* no data, just interpolated from 80 */
+float tone_250_100dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, 15, 25, 34, 40, 50, 56, 60, 70,
+ 70, 73, 74, 73, 73, 74, 75, 77, 77, 77, 78, 79, 80, 78, 77, 78,
+ 79, 78, 77, 74, 72, 70, 69, 67, 66, 67, 66, 64, 63, 62, 61, 60,
+ 58, 52, 47, 42, 37, 31, 26, 20};
+
+float tone_500_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -40, -26, -20, -14, -8, -2, 4, 10, 17,
+ 23, 16, 12, 9, 6, 3, 0, -3, -7, -10, -13, -16, -20, -23, -26, -30,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_500_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -18, -12, -6, 0, 6, 13, 20, 30,
+ 39, 34, 31, 29, 29, 27, 24, 21, 18, 16, 13, 8, 6, 3, 1, -1,
+ -5, -2, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_500_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -22,-16,-10, 0, 10, 20, 32, 43,
+ 53, 52, 52, 50, 49, 50, 52, 55, 55, 54, 51, 49, 46, 44, 44, 42,
+ 38, 34, 32, 29, 29, 28, 25, 23, 20, 16, 10, 7, 4, 2, -1, -4,
+ -7, -10, -15, -20, -25, -30, -35, -40};
+float tone_500_100dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, -7, 2, 10, 19, 27, 35, 55, 56,
+ 62, 61, 60, 58, 57, 57, 59, 63, 65, 66, 62, 60, 57, 57, 58, 58,
+ 57, 56, 56, 56, 57, 57, 56, 57, 57, 54, 47, 41, 37, 28, 21, 16,
+ 10, 3, -3, -8, -13, -18, -23, -28};
+
+float tone_1000_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -55, -40, -30, -20, -10, 0, 9, 20,
+ 27, 20, 13, 14, 13, 5, -1, -6, -11, -20, -30,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_1000_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -43, -33,-23,-13, -3, 7, 17, 25, 37,
+ 42, 33, 25, 25, 23, 18, 13, 9, 4, -1, -7,-13,-18, -23, -28, -33,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_1000_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -35, -25,-14, -4, 6, 16, 27, 33, 50,
+ 59, 57, 47, 41, 40, 43, 47, 48, 47, 42, 39, 37, 37, 36, 35, 32,
+ 30, 27, 21, 15, 5, -2, -10, -18, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_1000_100dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900, -40, -30, -20,-10, 0, 10, 23, 33, 45, 60,
+ 70, 72, 55, 49, 43, 40, 44, 54, 59, 58, 49, 43, 52, 57, 57, 58,
+ 58, 54, 49, 47, 42, 39, 33, 28, 20, 15, 5, 0, -5,-15,-20,-25,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_2000_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -3, 5, 12, 20,
+ 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_2000_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31,
+ 38, 34, 24, 17, 14, 13, 11, 7, 3, -2, -6, -10, -14, -20, -26, -32,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_2000_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 13, 28, 40,
+ 51, 51, 43, 35, 28, 29, 35, 37, 37, 35, 31, 28, 25, 22, 19, 15,
+ 11, 8, 6, 2, -6, -14, -22, -30, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_2000_100dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -10, 6, 25, 42, 60,
+ 66, 60, 53, 43, 35, 31, 34, 47, 58, 51, 43, 45, 54, 59, 59, 56,
+ 54, 51, 40, 29, 20, 11, 2, -8, -17, -26, -35,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_4000_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, 0, 3, 10, 18,
+ 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_4000_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31,
+ 38, 33, 28, 23, 19, 14, 11, 8, 3, -2, -7, -12, -17, -22, -27, -37,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_4000_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900,-900, -60, -50, -40, -29, -12, 5, 19, 37,
+ 51, 49, 40, 35, 36, 36, 36, 33, 32, 24, 18, 8, -3, -12, -20, -29,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_4000_100dB_SL[EHMER_MAX]={
+ -20, -12, -8, -4, 0, 4, 8, 11, 15, 22, 26, 28, 32, 36, 43, 52,
+ 62, 59, 50, 48, 50, 50, 45, 36, 45, 30, 20, 10, 0, -10, -19, -28,
+ -37,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_8000_40dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -50, -41, -30, -21, -12, 0, 3, 10, 18,
+ 23, 20, 16, 15, 16, 18, 21, 23, 25, 27, 29, 32, 35, 38, 41, 44,
+ 47, 50, 55, 60, 85,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+ -900,-900,-900,-900,-900,-900,-900,-900};
+float tone_8000_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, -21, -18, -14, -10, 0, 3, 15, 30,
+ 43, 40, 36, 35, 36, 38, 41, 43, 45, 47, 49, 52, 55, 58, 61, 64,
+ 67, 70, 75, 80,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+float tone_8000_80dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900,-900,-900, -10, -1, 2, 6, 10, 13, 19, 25, 35,
+ 63, 60, 56, 55, 56, 58, 61, 63, 65, 70, 75, 80, 85, 90, 95, 100,
+ 100, 100, 100, 100,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float tone_8000_100dB_SL[EHMER_MAX]={
+ -18, -12, -7, -3, 0, 2, 6, 9, 12, 19, 22, 21, 19, 21, 40, 40,
+ 80, 60, 35, 25, 15, 5, -5, -15, -25, -35,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+#if 0 /* not used for the time being */
+float noise_500_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900,-900, -20, -11, -2, 7, 16, 25, 34, 43, 52, 61, 66,
+ 69, 68, 58, 50, 44, 38, 32, 28, 25, 24, 20, 18, 17, 12, 10, 8,
+ 5, 0, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_500_80dB_SL[EHMER_MAX]={
+-900,-900,-900, -20, -10, -1, 8, 17, 26, 35, 44, 53, 62, 70, 79, 83,
+ 85, 85, 81, 77, 74, 71, 68, 63, 61, 59, 56, 55, 54, 52, 48, 47,
+ 45, 46, 45, 43, 40, 37, 33, 32, 35, 32, 30, 29, 20, 10, 0, -10,
+ -20, -30,-900,-900,-900,-900,-900,-900};
+
+float noise_1000_60dB_SL[EHMER_MAX]={
+-900,-900,-900,-900, -24, -15, -6, 3, 12, 21, 28, 34, 40, 48, 57, 60,
+ 61, 56, 54, 45, 36, 27, 21, 19, 17, 13, 10, 0, -10, -20, -20,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_1000_80dB_SL[EHMER_MAX]={
+-900, -26, -17, -8, 1, 10, 19, 28, 37, 41, 46, 51, 58, 68, 74, 81,
+ 80, 81, 70, 66, 58, 61, 59, 55, 54, 53, 52, 49, 48, 42, 38, 38,
+ 39, 34, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_2000_60dB_SL[EHMER_MAX]={
+-900,-900,-900, -34, -25, -16, -7, 2, 11, 18, 23, 30, 35, 42, 51, 58,
+ 58, 57, 50, 40,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_2000_80dB_SL[EHMER_MAX]={
+-900, -26, -17, -8, 1, 10, 19, 28, 33, 38, 43, 48, 53, 62, 70, 77,
+ 77, 75, 70, 67, 68, 66, 62, 61, 60, 59, 52, 47, 39, 35, 34, 35,
+ 35, 33, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_4000_60dB_SL[EHMER_MAX]={
+-900,-900,-900, -34, -25, -16, -7, 2, 11, 20, 25, 31, 37, 45, 56, 62,
+ 64, 61,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+float noise_4000_80dB_SL[EHMER_MAX]={
+-900, -26, -17, -8, 1, 10, 19, 26, 33, 39, 45, 50, 55, 65, 75, 82,
+ 84, 81, 78, 72, 70, 69, 66, 61, 50, 48, 46, 40, 35, 30, 25, 20,
+ 15, 10, 5, 0, -10, -20, -30,-900, -900,-900,-900,-900,-900,-900,-900,-900,
+-900,-900,-900,-900,-900,-900,-900,-900};
+
+#endif
+#endif
+
+
diff --git a/lib/mdct.c b/lib/mdct.c
new file mode 100644
index 00000000..f03bab31
--- /dev/null
+++ b/lib/mdct.c
@@ -0,0 +1,329 @@
+/********************************************************************
+ * *
+ * 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: normalized modified discrete cosine transform
+ power of two length transform only [16 <= n ]
+ last mod: $Id: mdct.c,v 1.16.8.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ Algorithm adapted from _The use of multirate filter banks for coding
+ of high quality digital audio_, by T. Sporer, K. Brandenburg and
+ B. Edler, collection of the European Signal Processing Conference
+ (EUSIPCO), Amsterdam, June 1992, Vol.1, pp 211-214
+
+ Note that the below code won't make much sense without the paper;
+ The presented algorithm was already fairly polished, and the code
+ once followed it closely. The current code both corrects several
+ typos in the paper and goes beyond the presented optimizations
+ (steps 4 through 6 are, for example, entirely eliminated).
+
+ This module DOES NOT INCLUDE code to generate the window function.
+ Everybody has their own weird favorite including me... I happen to
+ like the properties of y=sin(2PI*sin^2(x)), but others may vehemently
+ disagree.
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "mdct.h"
+#include "os.h"
+#include "misc.h"
+
+/* build lookups for trig functions; also pre-figure scaling and
+ some window function algebra. */
+
+void mdct_init(mdct_lookup *lookup,int n){
+ int *bitrev=malloc(sizeof(int)*(n/4));
+ float *trig=malloc(sizeof(float)*(n+n/4));
+ float *AE=trig;
+ float *AO=trig+1;
+ float *BE=AE+n/2;
+ float *BO=BE+1;
+ float *CE=BE+n/2;
+ float *CO=CE+1;
+
+ int i;
+ int log2n=lookup->log2n=rint(log(n)/log(2));
+ lookup->n=n;
+ lookup->trig=trig;
+ lookup->bitrev=bitrev;
+
+ /* trig lookups... */
+
+ for(i=0;i<n/4;i++){
+ AE[i*2]=cos((M_PI/n)*(4*i));
+ AO[i*2]=-sin((M_PI/n)*(4*i));
+ BE[i*2]=cos((M_PI/(2*n))*(2*i+1));
+ BO[i*2]=sin((M_PI/(2*n))*(2*i+1));
+ }
+ for(i=0;i<n/8;i++){
+ CE[i*2]=cos((M_PI/n)*(4*i+2));
+ CO[i*2]=-sin((M_PI/n)*(4*i+2));
+ }
+
+ /* bitreverse lookup... */
+
+ {
+ int mask=(1<<(log2n-1))-1,i,j;
+ int msb=1<<(log2n-2);
+ for(i=0;i<n/8;i++){
+ int acc=0;
+ for(j=0;msb>>j;j++)
+ if((msb>>j)&i)acc|=1<<j;
+ bitrev[i*2]=((~acc)&mask);
+ bitrev[i*2+1]=acc;
+ }
+ }
+}
+
+void mdct_clear(mdct_lookup *l){
+ if(l){
+ if(l->trig)free(l->trig);
+ if(l->bitrev)free(l->bitrev);
+ memset(l,0,sizeof(mdct_lookup));
+ }
+}
+
+static float *_mdct_kernel(float *x, float *w,
+ int n, int n2, int n4, int n8,
+ mdct_lookup *init){
+ int i;
+ /* step 2 */
+
+ {
+ float *xA=x+n4;
+ float *xB=x;
+ float *w2=w+n4;
+ float *A=init->trig+n2;
+
+ for(i=0;i<n4;){
+ float x0=*xA - *xB;
+ float x1;
+ w2[i]= *xA++ + *xB++;
+
+
+ x1= *xA - *xB;
+ A-=4;
+
+ w[i++]= x0 * A[0] + x1 * A[1];
+ w[i]= x1 * A[0] - x0 * A[1];
+
+ w2[i++]= *xA++ + *xB++;
+
+ }
+ }
+
+ /* step 3 */
+
+ {
+ int r,s;
+ for(i=0;i<init->log2n-3;i++){
+ int k0=n>>(i+2);
+ int k1=1<<(i+3);
+ int wbase=n2-2;
+ float *A=init->trig;
+ float *temp;
+
+ for(r=0;r<(k0>>2);r++){
+ int w1=wbase;
+ int w2=w1-(k0>>1);
+ float AEv= A[0],wA;
+ float AOv= A[1],wB;
+ wbase-=2;
+
+ k0++;
+ for(s=0;s<(2<<i);s++){
+ wB =w[w1] -w[w2];
+ x[w1] =w[w1] +w[w2];
+
+ wA =w[++w1] -w[++w2];
+ x[w1] =w[w1] +w[w2];
+
+ x[w2] =wA*AEv - wB*AOv;
+ x[w2-1]=wB*AEv + wA*AOv;
+
+ w1-=k0;
+ w2-=k0;
+ }
+ k0--;
+
+ A+=k1;
+ }
+
+ temp=w;
+ w=x;
+ x=temp;
+ }
+ }
+
+ /* step 4, 5, 6, 7 */
+ {
+ float *C=init->trig+n;
+ int *bit=init->bitrev;
+ float *x1=x;
+ float *x2=x+n2-1;
+ for(i=0;i<n8;i++){
+ int t1=*bit++;
+ int t2=*bit++;
+
+ float wA=w[t1]-w[t2+1];
+ float wB=w[t1-1]+w[t2];
+ float wC=w[t1]+w[t2+1];
+ float wD=w[t1-1]-w[t2];
+
+ float wACE=wA* *C;
+ float wBCE=wB* *C++;
+ float wACO=wA* *C;
+ float wBCO=wB* *C++;
+
+ *x1++=( wC+wACO+wBCE)*.5;
+ *x2--=(-wD+wBCO-wACE)*.5;
+ *x1++=( wD+wBCO-wACE)*.5;
+ *x2--=( wC-wACO-wBCE)*.5;
+ }
+ }
+ return(x);
+}
+
+void mdct_forward(mdct_lookup *init, float *in, float *out){
+ int n=init->n;
+ float *x=alloca(sizeof(float)*(n/2));
+ float *w=alloca(sizeof(float)*(n/2));
+ float *xx;
+ int n2=n>>1;
+ int n4=n>>2;
+ int n8=n>>3;
+ int i;
+
+ /* window + rotate + step 1 */
+ {
+ float tempA,tempB;
+ int in1=n2+n4-4;
+ int in2=in1+5;
+ float *A=init->trig+n2;
+
+ i=0;
+
+ for(i=0;i<n8;i+=2){
+ A-=2;
+ tempA= in[in1+2] + in[in2];
+ tempB= in[in1] + in[in2+2];
+ in1 -=4;in2 +=4;
+ x[i]= tempB*A[1] + tempA*A[0];
+ x[i+1]= tempB*A[0] - tempA*A[1];
+ }
+
+ in2=1;
+
+ for(;i<n2-n8;i+=2){
+ A-=2;
+ tempA= in[in1+2] - in[in2];
+ tempB= in[in1] - in[in2+2];
+ in1 -=4;in2 +=4;
+ x[i]= tempB*A[1] + tempA*A[0];
+ x[i+1]= tempB*A[0] - tempA*A[1];
+ }
+
+ in1=n-4;
+
+ for(;i<n2;i+=2){
+ A-=2;
+ tempA= -in[in1+2] - in[in2];
+ tempB= -in[in1] - in[in2+2];
+ in1 -=4;in2 +=4;
+ x[i]= tempB*A[1] + tempA*A[0];
+ x[i+1]= tempB*A[0] - tempA*A[1];
+ }
+ }
+
+ xx=_mdct_kernel(x,w,n,n2,n4,n8,init);
+
+ /* step 8 */
+
+ {
+ float *B=init->trig+n2;
+ float *out2=out+n2;
+ float scale=4./n;
+ for(i=0;i<n4;i++){
+ out[i] =(xx[0]*B[0]+xx[1]*B[1])*scale;
+ *(--out2)=(xx[0]*B[1]-xx[1]*B[0])*scale;
+
+ xx+=2;
+ B+=2;
+ }
+ }
+}
+
+void mdct_backward(mdct_lookup *init, float *in, float *out){
+ int n=init->n;
+ float *x=alloca(sizeof(float)*(n/2));
+ float *w=alloca(sizeof(float)*(n/2));
+ float *xx;
+ int n2=n>>1;
+ int n4=n>>2;
+ int n8=n>>3;
+ int i;
+
+ /* rotate + step 1 */
+ {
+ float *inO=in+1;
+ float *xO= x;
+ float *A=init->trig+n2;
+
+ for(i=0;i<n8;i++){
+ A-=2;
+ *xO++=-*(inO+2)*A[1] - *inO*A[0];
+ *xO++= *inO*A[1] - *(inO+2)*A[0];
+ inO+=4;
+ }
+
+ inO=in+n2-4;
+
+ for(i=0;i<n8;i++){
+ A-=2;
+ *xO++=*inO*A[1] + *(inO+2)*A[0];
+ *xO++=*inO*A[0] - *(inO+2)*A[1];
+ inO-=4;
+ }
+
+ }
+
+ xx=_mdct_kernel(x,w,n,n2,n4,n8,init);
+
+ /* step 8 */
+
+ {
+ float *B=init->trig+n2;
+ int o1=n4,o2=o1-1;
+ int o3=n4+n2,o4=o3-1;
+
+ for(i=0;i<n4;i++){
+ float temp1= (*xx * B[1] - *(xx+1) * B[0]);
+ float temp2=-(*xx * B[0] + *(xx+1) * B[1]);
+
+ out[o1]=-temp1;
+ out[o2]= temp1;
+ out[o3]= temp2;
+ out[o4]= temp2;
+
+ o1++;
+ o2--;
+ o3++;
+ o4--;
+ xx+=2;
+ B+=2;
+ }
+ }
+}
diff --git a/lib/mdct.h b/lib/mdct.h
new file mode 100644
index 00000000..f13c6c2c
--- /dev/null
+++ b/lib/mdct.h
@@ -0,0 +1,50 @@
+/********************************************************************
+ * *
+ * 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: modified discrete cosine transform prototypes
+ last mod: $Id: mdct.h,v 1.11.6.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _OGG_mdct_H_
+#define _OGG_mdct_H_
+
+#include "vorbis/codec.h"
+
+typedef struct {
+ int n;
+ int log2n;
+
+ float *trig;
+ int *bitrev;
+
+} mdct_lookup;
+
+extern void mdct_init(mdct_lookup *lookup,int n);
+extern void mdct_clear(mdct_lookup *l);
+extern void mdct_forward(mdct_lookup *init, float *in, float *out);
+extern void mdct_backward(mdct_lookup *init, float *in, float *out);
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/misc.h b/lib/misc.h
new file mode 100644
index 00000000..29ba88dc
--- /dev/null
+++ b/lib/misc.h
@@ -0,0 +1,44 @@
+/********************************************************************
+ * *
+ * 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: miscellaneous prototypes
+ last mod: $Id: misc.h,v 1.4.8.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_RANDOM_H_
+#define _V_RANDOM_H_
+#include "vorbis/codec.h"
+
+extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
+extern void _vorbis_block_ripcord(vorbis_block *vb);
+extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB);
+
+#ifdef DEBUG_LEAKS
+extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
+extern void _VDBG_free(void *ptr,char *file,long line);
+
+#ifndef MISC_C
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+
+#define malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)
+#define calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)
+#define realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)
+#define free(x) _VDBG_free((x),__FILE__,__LINE__)
+#endif
+#endif
+
+#endif
diff --git a/lib/psy.c b/lib/psy.c
index ce2e2555..2854dc80 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.26.2.1 2000/08/31 08:05:48 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.26.2.2 2000/08/31 09:00:01 xiphmont Exp $
********************************************************************/
@@ -44,14 +44,14 @@ void _vi_psy_free(vorbis_info_psy *i){
/* Set up decibel threshhold slopes on a Bark frequency scale */
/* ATH is the only bit left on a Bark scale. No reason to change it
right now */
-static void set_curve(double *ref,double *c,int n, double crate){
+static void set_curve(float *ref,float *c,int n, float crate){
int i,j=0;
for(i=0;i<MAX_BARK-1;i++){
int endpos=rint(fromBARK(i+1)*2*n/crate);
- double base=ref[i];
+ float base=ref[i];
if(j<endpos){
- double delta=(ref[i+1]-base)/(endpos-j);
+ float delta=(ref[i+1]-base)/(endpos-j);
for(;j<endpos && j<n;j++){
c[j]=base;
base+=delta;
@@ -60,24 +60,24 @@ static void set_curve(double *ref,double *c,int n, double crate){
}
}
-static void min_curve(double *c,
- double *c2){
+static void min_curve(float *c,
+ float *c2){
int i;
for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i];
}
-static void max_curve(double *c,
- double *c2){
+static void max_curve(float *c,
+ float *c2){
int i;
for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i];
}
-static void attenuate_curve(double *c,double att){
+static void attenuate_curve(float *c,float att){
int i;
for(i=0;i<EHMER_MAX;i++)
c[i]+=att;
}
-static void linear_curve(double *c){
+static void linear_curve(float *c){
int i;
for(i=0;i<EHMER_MAX;i++)
if(c[i]<=-200.)
@@ -86,21 +86,21 @@ static void linear_curve(double *c){
c[i]=fromdB(c[i]);
}
-static void interp_curve(double *c,double *c1,double *c2,double del){
+static void interp_curve(float *c,float *c1,float *c2,float del){
int i;
for(i=0;i<EHMER_MAX;i++)
c[i]=c2[i]*del+c1[i]*(1.-del);
}
-static void setup_curve(double **c,
+static void setup_curve(float **c,
int band,
- double *curveatt_dB){
+ float *curveatt_dB){
int i,j;
- double ath[EHMER_MAX];
- double tempc[P_LEVELS][EHMER_MAX];
+ float ath[EHMER_MAX];
+ float tempc[P_LEVELS][EHMER_MAX];
- memcpy(c[0],c[4],sizeof(double)*EHMER_MAX);
- memcpy(c[2],c[4],sizeof(double)*EHMER_MAX);
+ memcpy(c[0],c[4],sizeof(float)*EHMER_MAX);
+ memcpy(c[2],c[4],sizeof(float)*EHMER_MAX);
/* we add back in the ATH to avoid low level curves falling off to
-infinity and unneccessarily cutting off high level curves in the
@@ -109,12 +109,12 @@ static void setup_curve(double **c,
mask too little than too much, so be pessimal. */
for(i=0;i<EHMER_MAX;i++){
- double oc_min=band*.5-1+(i-EHMER_OFFSET)*.125;
- double oc_max=band*.5-1+(i-EHMER_OFFSET+1)*.125;
- double bark=toBARK(fromOC(oc_min));
+ float oc_min=band*.5-1+(i-EHMER_OFFSET)*.125;
+ float oc_max=band*.5-1+(i-EHMER_OFFSET+1)*.125;
+ float bark=toBARK(fromOC(oc_min));
int ibark=floor(bark);
- double del=bark-ibark;
- double ath_min,ath_max;
+ float del=bark-ibark;
+ float ath_min,ath_max;
if(ibark<26)
ath_min=ATH_Bark_dB[ibark]*(1.-del)+ATH_Bark_dB[ibark+1]*del;
@@ -143,7 +143,7 @@ static void setup_curve(double **c,
/* make temp curves with the ATH overlayed */
for(i=0;i<P_LEVELS;i++){
attenuate_curve(c[i],curveatt_dB[i]);
- memcpy(tempc[i],ath,EHMER_MAX*sizeof(double));
+ memcpy(tempc[i],ath,EHMER_MAX*sizeof(float));
attenuate_curve(tempc[i],-i*10.);
max_curve(tempc[i],c[i]);
}
@@ -172,9 +172,9 @@ static void setup_curve(double **c,
void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
long i,j;
memset(p,0,sizeof(vorbis_look_psy));
- p->ath=malloc(n*sizeof(double));
+ p->ath=malloc(n*sizeof(float));
p->octave=malloc(n*sizeof(int));
- p->bark=malloc(n*sizeof(double));
+ p->bark=malloc(n*sizeof(float));
p->vi=vi;
p->n=n;
@@ -193,70 +193,70 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
p->octave[i]=oc;
}
- p->tonecurves=malloc(P_BANDS*sizeof(double **));
- p->noiseatt=malloc(P_BANDS*sizeof(double **));
- p->peakatt=malloc(P_BANDS*sizeof(double *));
+ p->tonecurves=malloc(P_BANDS*sizeof(float **));
+ p->noiseatt=malloc(P_BANDS*sizeof(float **));
+ p->peakatt=malloc(P_BANDS*sizeof(float *));
for(i=0;i<P_BANDS;i++){
- p->tonecurves[i]=malloc(P_LEVELS*sizeof(double *));
- p->noiseatt[i]=malloc(P_LEVELS*sizeof(double));
- p->peakatt[i]=malloc(P_LEVELS*sizeof(double));
+ p->tonecurves[i]=malloc(P_LEVELS*sizeof(float *));
+ p->noiseatt[i]=malloc(P_LEVELS*sizeof(float));
+ p->peakatt[i]=malloc(P_LEVELS*sizeof(float));
}
for(i=0;i<P_BANDS;i++)
for(j=0;j<P_LEVELS;j++){
- p->tonecurves[i][j]=malloc(EHMER_MAX*sizeof(double));
+ p->tonecurves[i][j]=malloc(EHMER_MAX*sizeof(float));
}
/* OK, yeah, this was a silly way to do it */
- memcpy(p->tonecurves[0][4],tone_125_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[0][6],tone_125_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[0][8],tone_125_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[0][10],tone_125_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[2][4],tone_125_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[2][6],tone_125_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[2][8],tone_125_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[2][10],tone_125_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[4][4],tone_250_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[4][6],tone_250_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[4][8],tone_250_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[4][10],tone_250_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[6][4],tone_500_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[6][6],tone_500_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[6][8],tone_500_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[6][10],tone_500_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[8][4],tone_1000_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[8][6],tone_1000_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[8][8],tone_1000_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[8][10],tone_1000_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[10][4],tone_2000_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[10][6],tone_2000_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[10][8],tone_2000_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[10][10],tone_2000_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[12][4],tone_4000_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[12][6],tone_4000_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[12][8],tone_4000_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[12][10],tone_4000_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[14][4],tone_8000_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[14][6],tone_8000_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[14][8],tone_8000_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[14][10],tone_8000_100dB_SL,sizeof(double)*EHMER_MAX);
-
- memcpy(p->tonecurves[16][4],tone_8000_40dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[16][6],tone_8000_60dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[16][8],tone_8000_80dB_SL,sizeof(double)*EHMER_MAX);
- memcpy(p->tonecurves[16][10],tone_8000_100dB_SL,sizeof(double)*EHMER_MAX);
+ memcpy(p->tonecurves[0][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[0][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[0][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[0][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[2][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[2][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[2][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[2][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[4][4],tone_250_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[4][6],tone_250_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[4][8],tone_250_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[4][10],tone_250_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[6][4],tone_500_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[6][6],tone_500_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[6][8],tone_500_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[6][10],tone_500_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[8][4],tone_1000_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[8][6],tone_1000_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[8][8],tone_1000_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[8][10],tone_1000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[10][4],tone_2000_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[10][6],tone_2000_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[10][8],tone_2000_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[10][10],tone_2000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[12][4],tone_4000_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[12][6],tone_4000_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[12][8],tone_4000_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[12][10],tone_4000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[14][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[14][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[14][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[14][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+ memcpy(p->tonecurves[16][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[16][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[16][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
+ memcpy(p->tonecurves[16][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
/* interpolate curves between */
for(i=1;i<P_BANDS;i+=2)
for(j=4;j<P_LEVELS;j+=2){
- memcpy(p->tonecurves[i][j],p->tonecurves[i-1][j],EHMER_MAX*sizeof(double));
+ memcpy(p->tonecurves[i][j],p->tonecurves[i-1][j],EHMER_MAX*sizeof(float));
/*interp_curve(p->tonecurves[i][j],
p->tonecurves[i-1][j],
p->tonecurves[i+1][j],.5);*/
@@ -303,17 +303,17 @@ void _vp_psy_clear(vorbis_look_psy *p){
}
}
-static void compute_decay_fixed(vorbis_look_psy *p,double *f, double *decay, int n){
+static void compute_decay_fixed(vorbis_look_psy *p,float *f, float *decay, int n){
/* handle decay */
int i;
- double decscale=fromdB(p->vi->decay_coeff*n);
- double attscale=1./fromdB(p->vi->attack_coeff);
+ float decscale=fromdB(p->vi->decay_coeff*n);
+ float attscale=1./fromdB(p->vi->attack_coeff);
for(i=10;i<n;i++){
- double pre=decay[i];
+ float pre=decay[i];
if(decay[i]){
- double val=decay[i]*decscale;
- double att=fabs(f[i]/val);
+ float val=decay[i]*decscale;
+ float att=fabs(f[i]/val);
if(att>attscale)
decay[i]=fabs(f[i]/attscale);
@@ -343,13 +343,13 @@ static long _eights[EHMER_MAX+1]={
88752,96785,105545,115097,
125515};
-static int seed_curve(double *flr,
- double **curves,
- double amp,double specmax,
- int x,int n,double specatt,
+static int seed_curve(float *flr,
+ float **curves,
+ float amp,float specmax,
+ int x,int n,float specatt,
int maxEH){
int i;
- double *curve;
+ float *curve;
/* make this attenuation adjustable */
int choice=(int)((todB(amp)-specmax+specatt)/10.+.5);
@@ -365,9 +365,9 @@ static int seed_curve(double *flr,
if(curve[i]>0.)break;
for(;i>=0;i--){
- double lin=curve[i];
+ float lin=curve[i];
if(lin>0.){
- double *fp=flr+((x*_eights[i])>>12);
+ float *fp=flr+((x*_eights[i])>>12);
lin*=amp;
if(*fp<lin)*fp=lin;
}else break;
@@ -375,10 +375,10 @@ static int seed_curve(double *flr,
return(maxEH);
}
-static void seed_peak(double *flr,
- double *att,
- double amp,double specmax,
- int x,int n,double specatt){
+static void seed_peak(float *flr,
+ float *att,
+ float amp,float specmax,
+ int x,int n,float specatt){
int prevx=(x*_eights[16])>>12;
/* make this attenuation adjustable */
@@ -387,7 +387,7 @@ static void seed_peak(double *flr,
if(choice>=P_LEVELS)choice=P_LEVELS-1;
if(prevx<n){
- double lin=att[choice];
+ float lin=att[choice];
if(lin){
lin*=amp;
if(flr[prevx]<lin)flr[prevx]=lin;
@@ -396,11 +396,11 @@ static void seed_peak(double *flr,
}
static void seed_generic(vorbis_look_psy *p,
- double ***curves,
- double *f,
- double *flr,
- double *seeds,
- double specmax){
+ float ***curves,
+ float *f,
+ float *flr,
+ float *seeds,
+ float specmax){
vorbis_info_psy *vi=p->vi;
long n=p->n,i;
int maxEH=EHMER_MAX-1;
@@ -414,10 +414,10 @@ static void seed_generic(vorbis_look_psy *p,
}
static void seed_att(vorbis_look_psy *p,
- double **att,
- double *f,
- double *flr,
- double specmax){
+ float **att,
+ float *f,
+ float *flr,
+ float specmax){
vorbis_info_psy *vi=p->vi;
long n=p->n,i;
@@ -428,17 +428,17 @@ static void seed_att(vorbis_look_psy *p,
}
static void seed_point(vorbis_look_psy *p,
- double **att,
- double *f,
- double *flr,
- double specmax){
+ float **att,
+ float *f,
+ float *flr,
+ float specmax){
vorbis_info_psy *vi=p->vi;
long n=p->n,i;
for(i=0;i<n;i++){
/* make this attenuation adjustable */
int choice=rint((todB(f[i])-specmax+vi->max_curve_dB)/10.+.5);
- double lin;
+ float lin;
if(choice<0)choice=0;
if(choice>=P_LEVELS)choice=P_LEVELS-1;
lin=att[p->octave[i]][choice]*f[i];
@@ -447,10 +447,10 @@ static void seed_point(vorbis_look_psy *p,
}
/* bleaugh, this is more complicated than it needs to be */
-static void max_seeds(vorbis_look_psy *p,double *seeds,double *flr){
+static void max_seeds(vorbis_look_psy *p,float *seeds,float *flr){
long n=p->n,i,j;
long *posstack=alloca(n*sizeof(long));
- double *ampstack=alloca(n*sizeof(double));
+ float *ampstack=alloca(n*sizeof(float));
long stack=0;
for(i=0;i<n;i++){
@@ -505,14 +505,14 @@ static void max_seeds(vorbis_look_psy *p,double *seeds,double *flr){
had in Grad Skool... I didn't solve it at the time ;-) */
}
-static void bark_noise(long n,double *b,double *f,double *noise){
+static void bark_noise(long n,float *b,float *f,float *noise){
long i=1,lo=0,hi=2;
- double acc=0.,val,del=0.;
+ float acc=0.,val,del=0.;
- double *norm=alloca(n*sizeof(double));
+ float *norm=alloca(n*sizeof(float));
- memset(noise,0,n*sizeof(double));
- memset(norm,0,n*sizeof(double));
+ memset(noise,0,n*sizeof(float));
+ memset(norm,0,n*sizeof(float));
while(hi<n){
val=todB(f[i]*f[i])+400.;
@@ -579,27 +579,27 @@ static void bark_noise(long n,double *b,double *f,double *noise){
noise[i]=0.;
norm[i]=0;
}else{
- double v=acc/val-400;
+ float v=acc/val-400;
noise[i]=sqrt(fromdB(v));
}
}
}
-void _vp_compute_mask(vorbis_look_psy *p,double *f,
- double *flr,
- double *decay){
- double *smooth=alloca(sizeof(double)*p->n);
+void _vp_compute_mask(vorbis_look_psy *p,float *f,
+ float *flr,
+ float *decay){
+ float *smooth=alloca(sizeof(float)*p->n);
int i,n=p->n;
- double specmax=0.;
+ float specmax=0.;
- double *seed=alloca(sizeof(double)*p->n);
- double *seed2=alloca(sizeof(double)*p->n);
+ float *seed=alloca(sizeof(float)*p->n);
+ float *seed2=alloca(sizeof(float)*p->n);
- memset(flr,0,n*sizeof(double));
+ memset(flr,0,n*sizeof(float));
/* noise masking */
if(p->vi->noisemaskp){
- memset(seed,0,n*sizeof(double));
+ memset(seed,0,n*sizeof(float));
bark_noise(n,p->bark,f,seed);
seed_point(p,p->noiseatt,seed,flr,specmax);
@@ -611,12 +611,12 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
/* compute power^.5 of three neighboring bins to smooth for peaks
that get split twixt bins/peaks that nail the bin. This evens
out treatment as we're not doing additive masking any longer. */
- double acc=smooth[0]*smooth[0]+smooth[1]*smooth[1];
- double prev=smooth[0];
+ float acc=smooth[0]*smooth[0]+smooth[1]*smooth[1];
+ float prev=smooth[0];
smooth[0]=sqrt(acc);
for(i=1;i<n-1;i++){
- double this=smooth[i];
+ float this=smooth[i];
acc+=smooth[i+1]*smooth[i+1];
if(acc<0)acc=0; /* it can happen due to finite precision */
smooth[i]=sqrt(acc);
@@ -634,27 +634,27 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
/* set the ATH (floating below specmax by a specified att) */
if(p->vi->athp){
- double att=specmax+p->vi->ath_adjatt;
+ float att=specmax+p->vi->ath_adjatt;
if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
att=fromdB(att);
for(i=0;i<n;i++){
- double av=p->ath[i]*att;
+ float av=p->ath[i]*att;
if(av>flr[i])flr[i]=av;
}
}
/* peak attenuation ******/
if(p->vi->peakattp){
- memset(seed,0,n*sizeof(double));
+ memset(seed,0,n*sizeof(float));
seed_att(p,p->peakatt,smooth,seed,specmax);
max_seeds(p,seed,flr);
}
/* tone masking */
if(p->vi->tonemaskp){
- memset(seed,0,n*sizeof(double));
- memset(seed2,0,n*sizeof(double));
+ memset(seed,0,n*sizeof(float));
+ memset(seed2,0,n*sizeof(float));
seed_generic(p,p->tonecurves,smooth,flr,seed2,specmax);
max_seeds(p,seed2,seed2);
@@ -676,7 +676,7 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
it than to just tack it on */
for(i=0;i<n;i++)if(2.*f[i]>flr[i] || -2.*f[i]>flr[i])break;
- if(i==n)memset(flr,0,sizeof(double)*n);
+ if(i==n)memset(flr,0,sizeof(float)*n);
}
@@ -684,8 +684,8 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f,
/* this applies the floor and (optionally) tries to preserve noise
energy in low resolution portions of the spectrum */
/* f and flr are *linear* scale, not dB */
-void _vp_apply_floor(vorbis_look_psy *p,double *f, double *flr){
- double *work=alloca(p->n*sizeof(double));
+void _vp_apply_floor(vorbis_look_psy *p,float *f, float *flr){
+ float *work=alloca(p->n*sizeof(float));
int j;
/* subtract the floor */
@@ -696,7 +696,7 @@ void _vp_apply_floor(vorbis_look_psy *p,double *f, double *flr){
work[j]=f[j]/flr[j];
}
- memcpy(f,work,p->n*sizeof(double));
+ memcpy(f,work,p->n*sizeof(float));
}
diff --git a/lib/psy.h b/lib/psy.h
new file mode 100644
index 00000000..a65bb296
--- /dev/null
+++ b/lib/psy.h
@@ -0,0 +1,52 @@
+/********************************************************************
+ * *
+ * 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: random psychoacoustics (not including preecho)
+ last mod: $Id: psy.h,v 1.14.2.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_PSY_H_
+#define _V_PSY_H_
+#include "smallft.h"
+
+#ifndef EHMER_MAX
+#define EHMER_MAX 56
+#endif
+
+typedef struct {
+ int n;
+ struct vorbis_info_psy *vi;
+
+ float ***tonecurves;
+ float **peakatt;
+ float **noiseatt;
+
+ float *ath;
+ int *octave;
+ float *bark;
+
+} vorbis_look_psy;
+
+extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
+extern void _vp_psy_clear(vorbis_look_psy *p);
+extern void *_vi_psy_dup(void *source);
+extern void _vi_psy_free(vorbis_info_psy *i);
+extern void _vp_compute_mask(vorbis_look_psy *p,float *f,
+ float *floor,
+ float *decay);
+extern void _vp_apply_floor(vorbis_look_psy *p,float *f,float *flr);
+
+#endif
+
+
diff --git a/lib/psytune.c b/lib/psytune.c
new file mode 100644
index 00000000..ecc83ff3
--- /dev/null
+++ b/lib/psytune.c
@@ -0,0 +1,368 @@
+/********************************************************************
+ * *
+ * 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 utility that runs audio through the psychoacoustics
+ without encoding
+ last mod: $Id: psytune.c,v 1.6.2.1 2000/08/31 09:00:01 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "vorbis/codec.h"
+#include "os.h"
+#include "psy.h"
+#include "mdct.h"
+#include "window.h"
+#include "scales.h"
+#include "lpc.h"
+#include "lsp.h"
+
+static vorbis_info_psy _psy_set0={
+ 1,/*athp*/
+ 1,/*decayp*/
+ 1,/*smoothp*/
+ 0,.2,
+
+ -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.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
+ {-40.,-40.,-40.,-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*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
+ {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-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.}, /*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*/
+ { 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.,
+
+ -0, -.005, /* attack/decay control */
+};
+
+static int noisy=0;
+void analysis(char *base,int i,float *v,int n,int bark,int dB){
+ if(noisy){
+ int j;
+ FILE *of;
+ char buffer[80];
+ sprintf(buffer,"%s_%d.m",base,i);
+ of=fopen(buffer,"w");
+
+ 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 ",(float)j);
+
+ if(dB){
+ fprintf(of,"%g\n",todB(fabs(v[j])));
+ }else{
+ fprintf(of,"%g\n",v[j]);
+ }
+ }
+ }
+ fclose(of);
+ }
+}
+
+typedef struct {
+ long n;
+ int ln;
+ int m;
+ int *linearmap;
+
+ vorbis_info_floor0 *vi;
+ lpc_lookup lpclook;
+} vorbis_look_floor0;
+
+extern float _curve_to_lpc(float *curve,float *lpc,vorbis_look_floor0 *l,
+ long frameno);
+extern void _lsp_to_curve(float *curve,float *lpc,float amp,
+ vorbis_look_floor0 *l,char *name,long frameno);
+
+long frameno=0;
+
+/* hacked from floor0.c */
+static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){
+ int j;
+ float scale;
+ look->m=m;
+ look->n=n;
+ look->ln=ln;
+ lpc_init(&look->lpclook,look->ln,look->m);
+
+ scale=look->ln/toBARK(22050.);
+
+ look->linearmap=malloc(look->n*sizeof(int));
+ for(j=0;j<look->n;j++){
+ int val=floor( toBARK(22050./n*j) *scale);
+ if(val>look->ln)val=look->ln;
+ look->linearmap[j]=val;
+ }
+}
+
+int main(int argc,char *argv[]){
+ int eos=0;
+ float nonz=0.;
+ float acc=0.;
+ float tot=0.;
+
+ int framesize=2048;
+ int order=32;
+ int map=256;
+
+ float *pcm[2],*out[2],*window,*decay[2],*lpc,*floor;
+ signed char *buffer,*buffer2;
+ mdct_lookup m_look;
+ vorbis_look_psy p_look;
+ long i,j,k;
+
+ vorbis_look_floor0 floorlook;
+
+ int ath=0;
+ int decayp=0;
+
+ argv++;
+ while(*argv){
+ if(*argv[0]=='-'){
+ /* option */
+ if(argv[0][1]=='v'){
+ noisy=0;
+ }
+ if(argv[0][1]=='A'){
+ ath=0;
+ }
+ if(argv[0][1]=='D'){
+ decayp=0;
+ }
+ if(argv[0][1]=='X'){
+ ath=0;
+ decayp=0;
+ }
+ }else
+ if(*argv[0]=='+'){
+ /* option */
+ if(argv[0][1]=='v'){
+ noisy=1;
+ }
+ if(argv[0][1]=='A'){
+ ath=1;
+ }
+ if(argv[0][1]=='D'){
+ decayp=1;
+ }
+ if(argv[0][1]=='X'){
+ ath=1;
+ decayp=1;
+ }
+ }else
+ framesize=atoi(argv[0]);
+ argv++;
+ }
+
+ pcm[0]=malloc(framesize*sizeof(float));
+ pcm[1]=malloc(framesize*sizeof(float));
+ out[0]=calloc(framesize/2,sizeof(float));
+ out[1]=calloc(framesize/2,sizeof(float));
+ decay[0]=calloc(framesize/2,sizeof(float));
+ decay[1]=calloc(framesize/2,sizeof(float));
+ floor=malloc(framesize*sizeof(float));
+ lpc=malloc(order*sizeof(float));
+ buffer=malloc(framesize*4);
+ buffer2=buffer+framesize*2;
+ window=_vorbis_window(0,framesize,framesize/2,framesize/2);
+ mdct_init(&m_look,framesize);
+ _vp_psy_init(&p_look,&_psy_set0,framesize/2,44100);
+ floorinit(&floorlook,framesize/2,order,map);
+
+ for(i=0;i<P_BANDS;i++)
+ for(j=0;j<P_LEVELS;j++)
+ analysis("Ptonecurve",i*100+j,p_look.tonecurves[i][j],EHMER_MAX,0,1);
+
+ /* we cheat on the WAV header; we just bypass 44 bytes and never
+ verify that it matches 16bit/stereo/44.1kHz. */
+
+ fread(buffer,1,44,stdin);
+ fwrite(buffer,1,44,stdout);
+ memset(buffer,0,framesize*2);
+
+ analysis("window",0,window,framesize,0,0);
+
+ fprintf(stderr,"Processing for frame size %d...\n",framesize);
+
+ while(!eos){
+ long bytes=fread(buffer2,1,framesize*2,stdin);
+ if(bytes<framesize*2)
+ memset(buffer2+bytes,0,framesize*2-bytes);
+
+ if(bytes!=0){
+
+ /* uninterleave samples */
+ for(i=0;i<framesize;i++){
+ pcm[0][i]=((buffer[i*4+1]<<8)|
+ (0x00ff&(int)buffer[i*4]))/32768.;
+ pcm[1][i]=((buffer[i*4+3]<<8)|
+ (0x00ff&(int)buffer[i*4+2]))/32768.;
+ }
+
+ for(i=0;i<2;i++){
+ float amp;
+
+ analysis("pre",frameno,pcm[i],framesize,0,0);
+
+ /* do the psychacoustics */
+ for(j=0;j<framesize;j++)
+ pcm[i][j]*=window[j];
+
+ mdct_forward(&m_look,pcm[i],pcm[i]);
+
+ analysis("mdct",frameno,pcm[i],framesize/2,1,1);
+
+ _vp_compute_mask(&p_look,pcm[i],floor,decay[i]);
+
+ analysis("prefloor",frameno,floor,framesize/2,1,1);
+ analysis("decay",frameno,decay[i],framesize/2,1,1);
+
+ for(j=0;j<framesize/2;j++)floor[j]=todB(floor[j])+150;
+ amp=_curve_to_lpc(floor,lpc,&floorlook,frameno);
+ vorbis_lpc_to_lsp(lpc,lpc,order);
+ _lsp_to_curve(floor,lpc,sqrt(amp),&floorlook,"Ffloor",frameno);
+ for(j=0;j<framesize/2;j++)floor[j]=fromdB(floor[j]-150);
+ 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 */
+ for(j=0;j<framesize/2;j++){
+ float val=rint(pcm[i][j]);
+ tot++;
+ if(val){
+ nonz++;
+ acc+=log(fabs(val)*2.+1.)/log(2);
+ pcm[i][j]=val*floor[j];
+ }else{
+ pcm[i][j]=0;
+ }
+ }
+
+ analysis("final",frameno,pcm[i],framesize/2,1,1);
+
+ /* take it back to time */
+ mdct_backward(&m_look,pcm[i],pcm[i]);
+ for(j=0;j<framesize/2;j++)
+ out[i][j]+=pcm[i][j]*window[j];
+
+ frameno++;
+ }
+
+ /* write data. Use the part of buffer we're about to shift out */
+ for(i=0;i<2;i++){
+ char *ptr=buffer+i*2;
+ float *mono=out[i];
+ for(j=0;j<framesize/2;j++){
+ int val=mono[j]*32767.;
+ /* might as well guard against clipping */
+ if(val>32767)val=32767;
+ if(val<-32768)val=-32768;
+ ptr[0]=val&0xff;
+ ptr[1]=(val>>8)&0xff;
+ ptr+=4;
+ }
+ }
+
+ fprintf(stderr,"*");
+ fwrite(buffer,1,framesize*2,stdout);
+ memmove(buffer,buffer2,framesize*2);
+
+ for(i=0;i<2;i++){
+ for(j=0,k=framesize/2;j<framesize/2;j++,k++)
+ out[i][j]=pcm[i][k]*window[k];
+ }
+ }else
+ eos=1;
+ }
+ fprintf(stderr,"average raw bits of entropy: %.03g/sample\n",acc/tot);
+ fprintf(stderr,"average nonzero samples: %.03g/%d\n",nonz/tot*framesize/2,
+ framesize/2);
+ fprintf(stderr,"Done\n\n");
+ return 0;
+}
diff --git a/lib/res0.c b/lib/res0.c
new file mode 100644
index 00000000..370eca48
--- /dev/null
+++ b/lib/res0.c
@@ -0,0 +1,388 @@
+/********************************************************************
+ * *
+ * 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.17.2.1 2000/08/31 09:00:01 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++){
+ int cascade=info->secondstages[j]=_oggpack_read(opb,4);
+ if(cascade>1)goto errout; /* temporary! when cascading gets
+ reworked and actually used, we don't
+ want old code to DTWT */
+ acc+=cascade;
+ }
+ 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(float *vec,int n,vorbis_look_residue0 *look,
+ int auxparts,int auxpartnum){
+ vorbis_info_residue0 *info=look->info;
+ int i,j=0;
+ float max,localmax=0.;
+ float temp[128];
+ float 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,float *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,float *work,float *vec, int n,
+ int stages, codebook **books){
+ int i,j;
+
+ memset(work,0,sizeof(float)*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,
+ float **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,float **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 *));
+ float *work=alloca(sizeof(float)*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(float)*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(float)*(transend-i));
+ }
+
+ return(0);
+
+ errout:
+ for(j=0;j<ch;j++)
+ memset(in[j],0,sizeof(float)*transend);
+ return(0);
+}
+
+vorbis_func_residue residue0_exportbundle={
+ &pack,
+ &unpack,
+ &look,
+ &free_info,
+ &free_look,
+ &forward,
+ &inverse
+};
diff --git a/lib/sharedbook.c b/lib/sharedbook.c
index 320f3d3a..b598f678 100644
--- a/lib/sharedbook.c
+++ b/lib/sharedbook.c
@@ -12,7 +12,7 @@
********************************************************************
function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.7.4.1 2000/08/31 08:05:48 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.7.4.2 2000/08/31 09:00:02 xiphmont Exp $
********************************************************************/
@@ -45,7 +45,7 @@ int _ilog(unsigned int v){
#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
/* doesn't currently guard under/overflow */
-long _float32_pack(double val){
+long _float32_pack(float val){
int sign=0;
long exp;
long mant;
@@ -60,10 +60,10 @@ long _float32_pack(double val){
return(sign|exp|mant);
}
-double _float32_unpack(long val){
- double mant=val&0x1fffff;
- double sign=val&0x80000000;
- double exp =(val&0x7fe00000)>>VQ_FMAN;
+float _float32_unpack(long val){
+ float mant=val&0x1fffff;
+ float sign=val&0x80000000;
+ float exp =(val&0x7fe00000)>>VQ_FMAN;
if(sign)mant= -mant;
return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS));
}
@@ -212,13 +212,13 @@ long _book_maptype1_quantvals(const static_codebook *b){
generated algorithmically (each column of the vector counts through
the values in the quant vector). in map type 2, all the values came
in in an explicit list. Both value lists must be unpacked */
-double *_book_unquantize(const static_codebook *b){
+float *_book_unquantize(const static_codebook *b){
long j,k;
if(b->maptype==1 || b->maptype==2){
int quantvals;
- double mindel=_float32_unpack(b->q_min);
- double delta=_float32_unpack(b->q_delta);
- double *r=calloc(b->entries*b->dim,sizeof(double));
+ float mindel=_float32_unpack(b->q_min);
+ float delta=_float32_unpack(b->q_delta);
+ float *r=calloc(b->entries*b->dim,sizeof(float));
/* maptype 1 and 2 both use a quantized value vector, but
different sizes */
@@ -233,11 +233,11 @@ double *_book_unquantize(const static_codebook *b){
that */
quantvals=_book_maptype1_quantvals(b);
for(j=0;j<b->entries;j++){
- double last=0.;
+ float last=0.;
int indexdiv=1;
for(k=0;k<b->dim;k++){
int index= (j/indexdiv)%quantvals;
- double val=b->quantlist[index];
+ float val=b->quantlist[index];
val=fabs(val)*delta+mindel+last;
if(b->q_sequencep)last=val;
r[j*b->dim+k]=val;
@@ -247,9 +247,9 @@ double *_book_unquantize(const static_codebook *b){
break;
case 2:
for(j=0;j<b->entries;j++){
- double last=0.;
+ float last=0.;
for(k=0;k<b->dim;k++){
- double val=b->quantlist[j*b->dim+k];
+ float val=b->quantlist[j*b->dim+k];
val=fabs(val)*delta+mindel+last;
if(b->q_sequencep)last=val;
r[j*b->dim+k]=val;
@@ -319,25 +319,25 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
return(-1);
}
-static double _dist(int el,double *ref, double *b,int step){
+static float _dist(int el,float *ref, float *b,int step){
int i;
- double acc=0.;
+ float acc=0.;
for(i=0;i<el;i++){
- double val=(ref[i]-b[i*step]);
+ float val=(ref[i]-b[i*step]);
acc+=val*val;
}
return(acc);
}
#include <stdio.h>
-int _best(codebook *book, double *a, int step){
+int _best(codebook *book, float *a, int step){
encode_aux_nearestmatch *nt=book->c->nearest_tree;
encode_aux_threshmatch *tt=book->c->thresh_tree;
encode_aux_pigeonhole *pt=book->c->pigeon_tree;
int dim=book->dim;
int ptr=0,k,o;
/*int savebest=-1;
- double saverr;*/
+ float saverr;*/
/* do we have a threshhold encode hint? */
if(tt){
@@ -364,14 +364,14 @@ int _best(codebook *book, double *a, int step){
if(pt){
const static_codebook *c=book->c;
int i,besti=-1;
- double best;
+ float best;
int entry=0;
/* dealing with sequentialness is a pain in the ass */
if(c->q_sequencep){
int pv;
long mul=1;
- double qlast=0;
+ float qlast=0;
for(k=0,o=0;k<dim;k++,o+=step){
pv=(int)((a[o]-qlast-pt->min)/pt->del);
if(pv<0 || pv>=pt->mapentries)break;
@@ -393,7 +393,7 @@ int _best(codebook *book, double *a, int step){
/* search the abbreviated list */
long *list=pt->fitlist+pt->fitmap[entry];
for(i=0;i<pt->fitlength[entry];i++){
- double this=_dist(dim,book->valuelist+list[i]*dim,a,step);
+ float this=_dist(dim,book->valuelist+list[i]*dim,a,step);
if(besti==-1 || this<best){
best=this;
besti=list[i];
@@ -407,9 +407,9 @@ int _best(codebook *book, double *a, int step){
if(nt){
/* optimized using the decision tree */
while(1){
- double c=0.;
- double *p=book->valuelist+nt->p[ptr];
- double *q=book->valuelist+nt->q[ptr];
+ float c=0.;
+ float *p=book->valuelist+nt->p[ptr];
+ float *q=book->valuelist+nt->q[ptr];
for(k=0,o=0;k<dim;k++,o+=step)
c+=(p[k]-q[k])*(a[o]-(p[k]+q[k])*.5);
@@ -427,11 +427,11 @@ int _best(codebook *book, double *a, int step){
{
const static_codebook *c=book->c;
int i,besti=-1;
- double best;
- double *e=book->valuelist;
+ float best;
+ float *e=book->valuelist;
for(i=0;i<book->entries;i++){
if(c->lengthlist[i]>0){
- double this=_dist(dim,e,a,step);
+ float this=_dist(dim,e,a,step);
if(besti==-1 || this<best){
best=this;
besti=i;
@@ -459,7 +459,7 @@ int _best(codebook *book, double *a, int step){
}
/* returns the entry number and *modifies a* to the remainder value ********/
-int vorbis_book_besterror(codebook *book,double *a,int step,int addmul){
+int vorbis_book_besterror(codebook *book,float *a,int step,int addmul){
int dim=book->dim,i,o;
int best=_best(book,a,step);
switch(addmul){
@@ -469,7 +469,7 @@ int vorbis_book_besterror(codebook *book,double *a,int step,int addmul){
break;
case 1:
for(i=0,o=0;i<dim;i++,o+=step){
- double val=(book->valuelist+best*dim)[i];
+ float val=(book->valuelist+best*dim)[i];
if(val==0){
a[o]=0;
}else{
@@ -519,7 +519,7 @@ static_codebook test1={
NULL,
NULL,NULL
};
-static double *test1_result=NULL;
+static float *test1_result=NULL;
/* linear, full mapping, nonsequential */
static_codebook test2={
@@ -530,7 +530,7 @@ static_codebook test2={
full_quantlist1,
NULL,NULL
};
-static double test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
+static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
/* linear, full mapping, sequential */
static_codebook test3={
@@ -541,7 +541,7 @@ static_codebook test3={
full_quantlist1,
NULL,NULL
};
-static double test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
+static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
/* linear, algorithmic mapping, nonsequential */
static_codebook test4={
@@ -552,7 +552,7 @@ static_codebook test4={
partial_quantlist1,
NULL,NULL
};
-static double test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
+static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
-3, 4,-3, 4, 4,-3, -1, 4,-3,
-3,-1,-3, 4,-1,-3, -1,-1,-3,
-3,-3, 4, 4,-3, 4, -1,-3, 4,
@@ -571,7 +571,7 @@ static_codebook test5={
partial_quantlist1,
NULL,NULL
};
-static double test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
+static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
-3, 1,-2, 4, 8, 5, -1, 3, 0,
-3,-4,-7, 4, 3, 0, -1,-2,-5,
-3,-6,-2, 4, 1, 5, -1,-4, 0,
@@ -581,8 +581,8 @@ static double test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
-3, 1, 0, 4, 8, 7, -1, 3, 2,
-3,-4,-5, 4, 3, 2, -1,-2,-3};
-void run_test(static_codebook *b,double *comp){
- double *out=_book_unquantize(b);
+void run_test(static_codebook *b,float *comp){
+ float *out=_book_unquantize(b);
int i;
if(comp){
diff --git a/lib/sharedbook.h b/lib/sharedbook.h
new file mode 100644
index 00000000..6b2bff8e
--- /dev/null
+++ b/lib/sharedbook.h
@@ -0,0 +1,43 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: basic shared codebook operations
+ last mod: $Id: sharedbook.h,v 1.2.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_INT_SHCODEBOOK_H_
+#define _V_INT_SHCODEBOOK_H_
+
+#include "vorbis/codebook.h"
+
+extern void vorbis_staticbook_clear(static_codebook *b);
+extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
+extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
+extern void vorbis_book_clear(codebook *b);
+
+extern float *_book_unquantize(const static_codebook *b);
+extern float *_book_logdist(const static_codebook *b,float *vals);
+extern float _float32_unpack(long val);
+extern long _float32_pack(float val);
+extern int _best(codebook *book, float *a, int step);
+extern int _ilog(unsigned int v);
+extern long _book_maptype1_quantvals(const static_codebook *b);
+
+extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
+extern long vorbis_book_codeword(codebook *book,int entry);
+extern long vorbis_book_codelen(codebook *book,int entry);
+
+
+
+#endif
diff --git a/lib/smallft.c b/lib/smallft.c
new file mode 100644
index 00000000..0eaffd5d
--- /dev/null
+++ b/lib/smallft.c
@@ -0,0 +1,1255 @@
+/********************************************************************
+ * *
+ * 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: *unnormalized* fft transform
+ last mod: $Id: smallft.c,v 1.8.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+********************************************************************/
+
+/* FFT implementation from OggSquish, minus cosine transforms,
+ * minus all but radix 2/4 case. In Vorbis we only need this
+ * cut-down version.
+ *
+ * To do more than just power-of-two sized vectors, see the full
+ * version I wrote for NetLib.
+ *
+ * Note that the packing is a little strange; rather than the FFT r/i
+ * packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1,
+ * it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the
+ * FORTRAN version
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "smallft.h"
+#include "misc.h"
+
+static void drfti1(int n, float *wa, int *ifac){
+ static int ntryh[4] = { 4,2,3,5 };
+ static float tpi = 6.28318530717958647692528676655900577;
+ float arg,argh,argld,fi;
+ int ntry=0,i,j=-1;
+ int k1, l1, l2, ib;
+ int ld, ii, ip, is, nq, nr;
+ int ido, ipm, nfm1;
+ int nl=n;
+ int nf=0;
+
+ L101:
+ j++;
+ if (j < 4)
+ ntry=ntryh[j];
+ else
+ ntry+=2;
+
+ L104:
+ nq=nl/ntry;
+ nr=nl-ntry*nq;
+ if (nr!=0) goto L101;
+
+ nf++;
+ ifac[nf+1]=ntry;
+ nl=nq;
+ if(ntry!=2)goto L107;
+ if(nf==1)goto L107;
+
+ for (i=1;i<nf;i++){
+ ib=nf-i+1;
+ ifac[ib+1]=ifac[ib];
+ }
+ ifac[2] = 2;
+
+ L107:
+ if(nl!=1)goto L104;
+ ifac[0]=n;
+ ifac[1]=nf;
+ argh=tpi/n;
+ is=0;
+ nfm1=nf-1;
+ l1=1;
+
+ if(nfm1==0)return;
+
+ for (k1=0;k1<nfm1;k1++){
+ ip=ifac[k1+2];
+ ld=0;
+ l2=l1*ip;
+ ido=n/l2;
+ ipm=ip-1;
+
+ for (j=0;j<ipm;j++){
+ ld+=l1;
+ i=is;
+ argld=(float)ld*argh;
+ fi=0.;
+ for (ii=2;ii<ido;ii+=2){
+ fi+=1.;
+ arg=fi*argld;
+ wa[i++]=cos(arg);
+ wa[i++]=sin(arg);
+ }
+ is+=ido;
+ }
+ l1=l2;
+ }
+}
+
+static void fdrffti(int n, float *wsave, int *ifac){
+
+ if (n == 1) return;
+ drfti1(n, wsave+n, ifac);
+}
+
+static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
+ int i,k;
+ float ti2,tr2;
+ int t0,t1,t2,t3,t4,t5,t6;
+
+ t1=0;
+ t0=(t2=l1*ido);
+ t3=ido<<1;
+ for(k=0;k<l1;k++){
+ ch[t1<<1]=cc[t1]+cc[t2];
+ ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
+ t1+=ido;
+ t2+=ido;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ t2=t0;
+ for(k=0;k<l1;k++){
+ t3=t2;
+ t4=(t1<<1)+(ido<<1);
+ t5=t1;
+ t6=t1+t1;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4-=2;
+ t5+=2;
+ t6+=2;
+ tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+ ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+ ch[t6]=cc[t5]+ti2;
+ ch[t4]=ti2-cc[t5];
+ ch[t6-1]=cc[t5-1]+tr2;
+ ch[t4-1]=cc[t5-1]-tr2;
+ }
+ t1+=ido;
+ t2+=ido;
+ }
+
+ if(ido%2==1)return;
+
+ L105:
+ t3=(t2=(t1=ido)-1);
+ t2+=t0;
+ for(k=0;k<l1;k++){
+ ch[t1]=-cc[t2];
+ ch[t1-1]=cc[t3];
+ t1+=ido<<1;
+ t2+=ido;
+ t3+=ido;
+ }
+}
+
+static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2,float *wa3){
+ static float hsqt2 = .70710678118654752440084436210485;
+ int i,k,t0,t1,t2,t3,t4,t5,t6;
+ float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+ t0=l1*ido;
+
+ t1=t0;
+ t4=t1<<1;
+ t2=t1+(t1<<1);
+ t3=0;
+
+ for(k=0;k<l1;k++){
+ tr1=cc[t1]+cc[t2];
+ tr2=cc[t3]+cc[t4];
+
+ ch[t5=t3<<2]=tr1+tr2;
+ ch[(ido<<2)+t5-1]=tr2-tr1;
+ ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4];
+ ch[t5]=cc[t2]-cc[t1];
+
+ t1+=ido;
+ t2+=ido;
+ t3+=ido;
+ t4+=ido;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+
+ t1=0;
+ for(k=0;k<l1;k++){
+ t2=t1;
+ t4=t1<<2;
+ t5=(t6=ido<<1)+t4;
+ for(i=2;i<ido;i+=2){
+ t3=(t2+=2);
+ t4+=2;
+ t5-=2;
+
+ t3+=t0;
+ cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
+ ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
+ t3+=t0;
+ cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3];
+ ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1];
+ t3+=t0;
+ cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3];
+ ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1];
+
+ tr1=cr2+cr4;
+ tr4=cr4-cr2;
+ ti1=ci2+ci4;
+ ti4=ci2-ci4;
+
+ ti2=cc[t2]+ci3;
+ ti3=cc[t2]-ci3;
+ tr2=cc[t2-1]+cr3;
+ tr3=cc[t2-1]-cr3;
+
+ ch[t4-1]=tr1+tr2;
+ ch[t4]=ti1+ti2;
+
+ ch[t5-1]=tr3-ti4;
+ ch[t5]=tr4-ti3;
+
+ ch[t4+t6-1]=ti4+tr3;
+ ch[t4+t6]=tr4+ti3;
+
+ ch[t5+t6-1]=tr2-tr1;
+ ch[t5+t6]=ti1-ti2;
+ }
+ t1+=ido;
+ }
+ if(ido&1)return;
+
+ L105:
+
+ t2=(t1=t0+ido-1)+(t0<<1);
+ t3=ido<<2;
+ t4=ido;
+ t5=ido<<1;
+ t6=ido;
+
+ for(k=0;k<l1;k++){
+ ti1=-hsqt2*(cc[t1]+cc[t2]);
+ tr1=hsqt2*(cc[t1]-cc[t2]);
+
+ ch[t4-1]=tr1+cc[t6-1];
+ ch[t4+t5-1]=cc[t6-1]-tr1;
+
+ ch[t4]=ti1-cc[t1+t0];
+ ch[t4+t5]=ti1+cc[t1+t0];
+
+ t1+=ido;
+ t2+=ido;
+ t4+=t3;
+ t6+=ido;
+ }
+}
+
+static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
+ float *c2,float *ch,float *ch2,float *wa){
+
+ static float tpi=6.28318530717958647692528676655900577;
+ int idij,ipph,i,j,k,l,ic,ik,is;
+ int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+ float dc2,ai1,ai2,ar1,ar2,ds2;
+ int nbd;
+ float dcp,arg,dsp,ar1h,ar2h;
+ int idp2,ipp2;
+
+ arg=tpi/(float)ip;
+ dcp=cos(arg);
+ dsp=sin(arg);
+ ipph=(ip+1)>>1;
+ ipp2=ip;
+ idp2=ido;
+ nbd=(ido-1)>>1;
+ t0=l1*ido;
+ t10=ip*ido;
+
+ if(ido==1)goto L119;
+ for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik];
+
+ t1=0;
+ for(j=1;j<ip;j++){
+ t1+=t0;
+ t2=t1;
+ for(k=0;k<l1;k++){
+ ch[t2]=c1[t2];
+ t2+=ido;
+ }
+ }
+
+ is=-ido;
+ t1=0;
+ if(nbd>l1){
+ for(j=1;j<ip;j++){
+ t1+=t0;
+ is+=ido;
+ t2= -ido+t1;
+ for(k=0;k<l1;k++){
+ idij=is-1;
+ t2+=ido;
+ t3=t2;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t3+=2;
+ ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+ ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
+ }
+ }
+ }
+ }else{
+
+ for(j=1;j<ip;j++){
+ is+=ido;
+ idij=is-1;
+ t1+=t0;
+ t2=t1;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t2+=2;
+ t3=t2;
+ for(k=0;k<l1;k++){
+ ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
+ ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
+ t3+=ido;
+ }
+ }
+ }
+ }
+
+ t1=0;
+ t2=ipp2*t0;
+ if(nbd<l1){
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5=t3-ido;
+ t6=t4-ido;
+ for(k=0;k<l1;k++){
+ t5+=ido;
+ t6+=ido;
+ c1[t5-1]=ch[t5-1]+ch[t6-1];
+ c1[t6-1]=ch[t5]-ch[t6];
+ c1[t5]=ch[t5]+ch[t6];
+ c1[t6]=ch[t6-1]-ch[t5-1];
+ }
+ }
+ }
+ }else{
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ c1[t5-1]=ch[t5-1]+ch[t6-1];
+ c1[t6-1]=ch[t5]-ch[t6];
+ c1[t5]=ch[t5]+ch[t6];
+ c1[t6]=ch[t6-1]-ch[t5-1];
+ }
+ t3+=ido;
+ t4+=ido;
+ }
+ }
+ }
+
+L119:
+ for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+ t1=0;
+ t2=ipp2*idl1;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1-ido;
+ t4=t2-ido;
+ for(k=0;k<l1;k++){
+ t3+=ido;
+ t4+=ido;
+ c1[t3]=ch[t3]+ch[t4];
+ c1[t4]=ch[t4]-ch[t3];
+ }
+ }
+
+ ar1=1.;
+ ai1=0.;
+ t1=0;
+ t2=ipp2*idl1;
+ t3=(ip-1)*idl1;
+ for(l=1;l<ipph;l++){
+ t1+=idl1;
+ t2-=idl1;
+ ar1h=dcp*ar1-dsp*ai1;
+ ai1=dcp*ai1+dsp*ar1;
+ ar1=ar1h;
+ t4=t1;
+ t5=t2;
+ t6=t3;
+ t7=idl1;
+
+ for(ik=0;ik<idl1;ik++){
+ ch2[t4++]=c2[ik]+ar1*c2[t7++];
+ ch2[t5++]=ai1*c2[t6++];
+ }
+
+ dc2=ar1;
+ ds2=ai1;
+ ar2=ar1;
+ ai2=ai1;
+
+ t4=idl1;
+ t5=(ipp2-1)*idl1;
+ for(j=2;j<ipph;j++){
+ t4+=idl1;
+ t5-=idl1;
+
+ ar2h=dc2*ar2-ds2*ai2;
+ ai2=dc2*ai2+ds2*ar2;
+ ar2=ar2h;
+
+ t6=t1;
+ t7=t2;
+ t8=t4;
+ t9=t5;
+ for(ik=0;ik<idl1;ik++){
+ ch2[t6++]+=ar2*c2[t8++];
+ ch2[t7++]+=ai2*c2[t9++];
+ }
+ }
+ }
+
+ t1=0;
+ for(j=1;j<ipph;j++){
+ t1+=idl1;
+ t2=t1;
+ for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++];
+ }
+
+ if(ido<l1)goto L132;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t4=t2;
+ for(i=0;i<ido;i++)cc[t4++]=ch[t3++];
+ t1+=ido;
+ t2+=t10;
+ }
+
+ goto L135;
+
+ L132:
+ for(i=0;i<ido;i++){
+ t1=i;
+ t2=i;
+ for(k=0;k<l1;k++){
+ cc[t2]=ch[t1];
+ t1+=ido;
+ t2+=t10;
+ }
+ }
+
+ L135:
+ t1=0;
+ t2=ido<<1;
+ t3=0;
+ t4=ipp2*t0;
+ for(j=1;j<ipph;j++){
+
+ t1+=t2;
+ t3+=t0;
+ t4-=t0;
+
+ t5=t1;
+ t6=t3;
+ t7=t4;
+
+ for(k=0;k<l1;k++){
+ cc[t5-1]=ch[t6];
+ cc[t5]=ch[t7];
+ t5+=t10;
+ t6+=ido;
+ t7+=ido;
+ }
+ }
+
+ if(ido==1)return;
+ if(nbd<l1)goto L141;
+
+ t1=-ido;
+ t3=0;
+ t4=0;
+ t5=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t2;
+ t3+=t2;
+ t4+=t0;
+ t5-=t0;
+ t6=t1;
+ t7=t3;
+ t8=t4;
+ t9=t5;
+ for(k=0;k<l1;k++){
+ for(i=2;i<ido;i+=2){
+ ic=idp2-i;
+ cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1];
+ cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1];
+ cc[i+t7]=ch[i+t8]+ch[i+t9];
+ cc[ic+t6]=ch[i+t9]-ch[i+t8];
+ }
+ t6+=t10;
+ t7+=t10;
+ t8+=ido;
+ t9+=ido;
+ }
+ }
+ return;
+
+ L141:
+
+ t1=-ido;
+ t3=0;
+ t4=0;
+ t5=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t2;
+ t3+=t2;
+ t4+=t0;
+ t5-=t0;
+ for(i=2;i<ido;i+=2){
+ t6=idp2+t1-i;
+ t7=i+t3;
+ t8=i+t4;
+ t9=i+t5;
+ for(k=0;k<l1;k++){
+ cc[t7-1]=ch[t8-1]+ch[t9-1];
+ cc[t6-1]=ch[t8-1]-ch[t9-1];
+ cc[t7]=ch[t8]+ch[t9];
+ cc[t6]=ch[t9]-ch[t8];
+ t6+=t10;
+ t7+=t10;
+ t8+=ido;
+ t9+=ido;
+ }
+ }
+ }
+}
+
+static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){
+ int i,k1,l1,l2;
+ int na,kh,nf;
+ int ip,iw,ido,idl1,ix2,ix3;
+
+ nf=ifac[1];
+ na=1;
+ l2=n;
+ iw=n;
+
+ for(k1=0;k1<nf;k1++){
+ kh=nf-k1;
+ ip=ifac[kh+1];
+ l1=l2/ip;
+ ido=n/l2;
+ idl1=ido*l1;
+ iw-=(ip-1)*ido;
+ na=1-na;
+
+ if(ip!=4)goto L102;
+
+ ix2=iw+ido;
+ ix3=ix2+ido;
+ if(na!=0)
+ dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ else
+ dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ goto L110;
+
+ L102:
+ if(ip!=2)goto L104;
+ if(na!=0)goto L103;
+
+ dradf2(ido,l1,c,ch,wa+iw-1);
+ goto L110;
+
+ L103:
+ dradf2(ido,l1,ch,c,wa+iw-1);
+ goto L110;
+
+ L104:
+ if(ido==1)na=1-na;
+ if(na!=0)goto L109;
+
+ dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+ na=1;
+ goto L110;
+
+ L109:
+ dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+ na=0;
+
+ L110:
+ l2=l1;
+ }
+
+ if(na==1)return;
+
+ for(i=0;i<n;i++)c[i]=ch[i];
+}
+
+static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
+ int i,k,t0,t1,t2,t3,t4,t5,t6;
+ float ti2,tr2;
+
+ t0=l1*ido;
+
+ t1=0;
+ t2=0;
+ t3=(ido<<1)-1;
+ for(k=0;k<l1;k++){
+ ch[t1]=cc[t2]+cc[t3+t2];
+ ch[t1+t0]=cc[t2]-cc[t3+t2];
+ t2=(t1+=ido)<<1;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t5=(t4=t2)+(ido<<1);
+ t6=t0+t1;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5-=2;
+ t6+=2;
+ ch[t3-1]=cc[t4-1]+cc[t5-1];
+ tr2=cc[t4-1]-cc[t5-1];
+ ch[t3]=cc[t4]-cc[t5];
+ ti2=cc[t4]+cc[t5];
+ ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2;
+ ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2;
+ }
+ t2=(t1+=ido)<<1;
+ }
+
+ if(ido%2==1)return;
+
+L105:
+ t1=ido-1;
+ t2=ido-1;
+ for(k=0;k<l1;k++){
+ ch[t1]=cc[t2]+cc[t2];
+ ch[t1+t0]=-(cc[t2+1]+cc[t2+1]);
+ t1+=ido;
+ t2+=ido<<1;
+ }
+}
+
+static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2){
+ static float taur = -.5;
+ static float taui = .86602540378443864676372317075293618;
+ int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+ float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2;
+ t0=l1*ido;
+
+ t1=0;
+ t2=t0<<1;
+ t3=ido<<1;
+ t4=ido+(ido<<1);
+ t5=0;
+ for(k=0;k<l1;k++){
+ tr2=cc[t3-1]+cc[t3-1];
+ cr2=cc[t5]+(taur*tr2);
+ ch[t1]=cc[t5]+tr2;
+ ci3=taui*(cc[t3]+cc[t3]);
+ ch[t1+t0]=cr2-ci3;
+ ch[t1+t2]=cr2+ci3;
+ t1+=ido;
+ t3+=t4;
+ t5+=t4;
+ }
+
+ if(ido==1)return;
+
+ t1=0;
+ t3=ido<<1;
+ for(k=0;k<l1;k++){
+ t7=t1+(t1<<1);
+ t6=(t5=t7+t3);
+ t8=t1;
+ t10=(t9=t1+t0)+t0;
+
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6-=2;
+ t7+=2;
+ t8+=2;
+ t9+=2;
+ t10+=2;
+ tr2=cc[t5-1]+cc[t6-1];
+ cr2=cc[t7-1]+(taur*tr2);
+ ch[t8-1]=cc[t7-1]+tr2;
+ ti2=cc[t5]-cc[t6];
+ ci2=cc[t7]+(taur*ti2);
+ ch[t8]=cc[t7]+ti2;
+ cr3=taui*(cc[t5-1]-cc[t6-1]);
+ ci3=taui*(cc[t5]+cc[t6]);
+ dr2=cr2-ci3;
+ dr3=cr2+ci3;
+ di2=ci2+cr3;
+ di3=ci2-cr3;
+ ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2;
+ ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2;
+ ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3;
+ ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3;
+ }
+ t1+=ido;
+ }
+}
+
+static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
+ float *wa2,float *wa3){
+ static float sqrt2=1.4142135623730950488016887242097;
+ int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
+ float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
+ t0=l1*ido;
+
+ t1=0;
+ t2=ido<<2;
+ t3=0;
+ t6=ido<<1;
+ for(k=0;k<l1;k++){
+ t4=t3+t6;
+ t5=t1;
+ tr3=cc[t4-1]+cc[t4-1];
+ tr4=cc[t4]+cc[t4];
+ tr1=cc[t3]-cc[(t4+=t6)-1];
+ tr2=cc[t3]+cc[t4-1];
+ ch[t5]=tr2+tr3;
+ ch[t5+=t0]=tr1-tr4;
+ ch[t5+=t0]=tr2-tr3;
+ ch[t5+=t0]=tr1+tr4;
+ t1+=ido;
+ t3+=t2;
+ }
+
+ if(ido<2)return;
+ if(ido==2)goto L105;
+
+ t1=0;
+ for(k=0;k<l1;k++){
+ t5=(t4=(t3=(t2=t1<<2)+t6))+t6;
+ t7=t1;
+ for(i=2;i<ido;i+=2){
+ t2+=2;
+ t3+=2;
+ t4-=2;
+ t5-=2;
+ t7+=2;
+ ti1=cc[t2]+cc[t5];
+ ti2=cc[t2]-cc[t5];
+ ti3=cc[t3]-cc[t4];
+ tr4=cc[t3]+cc[t4];
+ tr1=cc[t2-1]-cc[t5-1];
+ tr2=cc[t2-1]+cc[t5-1];
+ ti4=cc[t3-1]-cc[t4-1];
+ tr3=cc[t3-1]+cc[t4-1];
+ ch[t7-1]=tr2+tr3;
+ cr3=tr2-tr3;
+ ch[t7]=ti2+ti3;
+ ci3=ti2-ti3;
+ cr2=tr1-tr4;
+ cr4=tr1+tr4;
+ ci2=ti1+ti4;
+ ci4=ti1-ti4;
+
+ ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2;
+ ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2;
+ ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3;
+ ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3;
+ ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4;
+ ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4;
+ }
+ t1+=ido;
+ }
+
+ if(ido%2 == 1)return;
+
+ L105:
+
+ t1=ido;
+ t2=ido<<2;
+ t3=ido-1;
+ t4=ido+(ido<<1);
+ for(k=0;k<l1;k++){
+ t5=t3;
+ ti1=cc[t1]+cc[t4];
+ ti2=cc[t4]-cc[t1];
+ tr1=cc[t1-1]-cc[t4-1];
+ tr2=cc[t1-1]+cc[t4-1];
+ ch[t5]=tr2+tr2;
+ ch[t5+=t0]=sqrt2*(tr1-ti1);
+ ch[t5+=t0]=ti2+ti2;
+ ch[t5+=t0]=-sqrt2*(tr1+ti1);
+
+ t3+=ido;
+ t1+=t2;
+ t4+=t2;
+ }
+}
+
+static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
+ float *c2,float *ch,float *ch2,float *wa){
+ static float tpi=6.28318530717958647692528676655900577;
+ int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,
+ t11,t12;
+ float dc2,ai1,ai2,ar1,ar2,ds2;
+ int nbd;
+ float dcp,arg,dsp,ar1h,ar2h;
+ int ipp2;
+
+ t10=ip*ido;
+ t0=l1*ido;
+ arg=tpi/(float)ip;
+ dcp=cos(arg);
+ dsp=sin(arg);
+ nbd=(ido-1)>>1;
+ ipp2=ip;
+ ipph=(ip+1)>>1;
+ if(ido<l1)goto L103;
+
+ t1=0;
+ t2=0;
+ for(k=0;k<l1;k++){
+ t3=t1;
+ t4=t2;
+ for(i=0;i<ido;i++){
+ ch[t3]=cc[t4];
+ t3++;
+ t4++;
+ }
+ t1+=ido;
+ t2+=t10;
+ }
+ goto L106;
+
+ L103:
+ t1=0;
+ for(i=0;i<ido;i++){
+ t2=t1;
+ t3=t1;
+ for(k=0;k<l1;k++){
+ ch[t2]=cc[t3];
+ t2+=ido;
+ t3+=t10;
+ }
+ t1++;
+ }
+
+ L106:
+ t1=0;
+ t2=ipp2*t0;
+ t7=(t5=ido<<1);
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ t6=t5;
+ for(k=0;k<l1;k++){
+ ch[t3]=cc[t6-1]+cc[t6-1];
+ ch[t4]=cc[t6]+cc[t6];
+ t3+=ido;
+ t4+=ido;
+ t6+=t10;
+ }
+ t5+=t7;
+ }
+
+ if (ido == 1)goto L116;
+ if(nbd<l1)goto L112;
+
+ t1=0;
+ t2=ipp2*t0;
+ t7=0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+
+ t7+=(ido<<1);
+ t8=t7;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ t9=t8;
+ t11=t8;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ t9+=2;
+ t11-=2;
+ ch[t5-1]=cc[t9-1]+cc[t11-1];
+ ch[t6-1]=cc[t9-1]-cc[t11-1];
+ ch[t5]=cc[t9]-cc[t11];
+ ch[t6]=cc[t9]+cc[t11];
+ }
+ t3+=ido;
+ t4+=ido;
+ t8+=t10;
+ }
+ }
+ goto L116;
+
+ L112:
+ t1=0;
+ t2=ipp2*t0;
+ t7=0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ t7+=(ido<<1);
+ t8=t7;
+ t9=t7;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t8+=2;
+ t9-=2;
+ t5=t3;
+ t6=t4;
+ t11=t8;
+ t12=t9;
+ for(k=0;k<l1;k++){
+ ch[t5-1]=cc[t11-1]+cc[t12-1];
+ ch[t6-1]=cc[t11-1]-cc[t12-1];
+ ch[t5]=cc[t11]-cc[t12];
+ ch[t6]=cc[t11]+cc[t12];
+ t5+=ido;
+ t6+=ido;
+ t11+=t10;
+ t12+=t10;
+ }
+ }
+ }
+
+L116:
+ ar1=1.;
+ ai1=0.;
+ t1=0;
+ t9=(t2=ipp2*idl1);
+ t3=(ip-1)*idl1;
+ for(l=1;l<ipph;l++){
+ t1+=idl1;
+ t2-=idl1;
+
+ ar1h=dcp*ar1-dsp*ai1;
+ ai1=dcp*ai1+dsp*ar1;
+ ar1=ar1h;
+ t4=t1;
+ t5=t2;
+ t6=0;
+ t7=idl1;
+ t8=t3;
+ for(ik=0;ik<idl1;ik++){
+ c2[t4++]=ch2[t6++]+ar1*ch2[t7++];
+ c2[t5++]=ai1*ch2[t8++];
+ }
+ dc2=ar1;
+ ds2=ai1;
+ ar2=ar1;
+ ai2=ai1;
+
+ t6=idl1;
+ t7=t9-idl1;
+ for(j=2;j<ipph;j++){
+ t6+=idl1;
+ t7-=idl1;
+ ar2h=dc2*ar2-ds2*ai2;
+ ai2=dc2*ai2+ds2*ar2;
+ ar2=ar2h;
+ t4=t1;
+ t5=t2;
+ t11=t6;
+ t12=t7;
+ for(ik=0;ik<idl1;ik++){
+ c2[t4++]+=ar2*ch2[t11++];
+ c2[t5++]+=ai2*ch2[t12++];
+ }
+ }
+ }
+
+ t1=0;
+ for(j=1;j<ipph;j++){
+ t1+=idl1;
+ t2=t1;
+ for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++];
+ }
+
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ ch[t3]=c1[t3]-c1[t4];
+ ch[t4]=c1[t3]+c1[t4];
+ t3+=ido;
+ t4+=ido;
+ }
+ }
+
+ if(ido==1)goto L132;
+ if(nbd<l1)goto L128;
+
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(k=0;k<l1;k++){
+ t5=t3;
+ t6=t4;
+ for(i=2;i<ido;i+=2){
+ t5+=2;
+ t6+=2;
+ ch[t5-1]=c1[t5-1]-c1[t6];
+ ch[t6-1]=c1[t5-1]+c1[t6];
+ ch[t5]=c1[t5]+c1[t6-1];
+ ch[t6]=c1[t5]-c1[t6-1];
+ }
+ t3+=ido;
+ t4+=ido;
+ }
+ }
+ goto L132;
+
+ L128:
+ t1=0;
+ t2=ipp2*t0;
+ for(j=1;j<ipph;j++){
+ t1+=t0;
+ t2-=t0;
+ t3=t1;
+ t4=t2;
+ for(i=2;i<ido;i+=2){
+ t3+=2;
+ t4+=2;
+ t5=t3;
+ t6=t4;
+ for(k=0;k<l1;k++){
+ ch[t5-1]=c1[t5-1]-c1[t6];
+ ch[t6-1]=c1[t5-1]+c1[t6];
+ ch[t5]=c1[t5]+c1[t6-1];
+ ch[t6]=c1[t5]-c1[t6-1];
+ t5+=ido;
+ t6+=ido;
+ }
+ }
+ }
+
+L132:
+ if(ido==1)return;
+
+ for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
+
+ t1=0;
+ for(j=1;j<ip;j++){
+ t2=(t1+=t0);
+ for(k=0;k<l1;k++){
+ c1[t2]=ch[t2];
+ t2+=ido;
+ }
+ }
+
+ if(nbd>l1)goto L139;
+
+ is= -ido-1;
+ t1=0;
+ for(j=1;j<ip;j++){
+ is+=ido;
+ t1+=t0;
+ idij=is;
+ t2=t1;
+ for(i=2;i<ido;i+=2){
+ t2+=2;
+ idij+=2;
+ t3=t2;
+ for(k=0;k<l1;k++){
+ c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+ c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+ t3+=ido;
+ }
+ }
+ }
+ return;
+
+ L139:
+ is= -ido-1;
+ t1=0;
+ for(j=1;j<ip;j++){
+ is+=ido;
+ t1+=t0;
+ t2=t1;
+ for(k=0;k<l1;k++){
+ idij=is;
+ t3=t2;
+ for(i=2;i<ido;i+=2){
+ idij+=2;
+ t3+=2;
+ c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
+ c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
+ }
+ t2+=ido;
+ }
+ }
+}
+
+static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){
+ int i,k1,l1,l2;
+ int na;
+ int nf,ip,iw,ix2,ix3,ido,idl1;
+
+ nf=ifac[1];
+ na=0;
+ l1=1;
+ iw=1;
+
+ for(k1=0;k1<nf;k1++){
+ ip=ifac[k1 + 2];
+ l2=ip*l1;
+ ido=n/l2;
+ idl1=ido*l1;
+ if(ip!=4)goto L103;
+ ix2=iw+ido;
+ ix3=ix2+ido;
+
+ if(na!=0)
+ dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ else
+ dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
+ na=1-na;
+ goto L115;
+
+ L103:
+ if(ip!=2)goto L106;
+
+ if(na!=0)
+ dradb2(ido,l1,ch,c,wa+iw-1);
+ else
+ dradb2(ido,l1,c,ch,wa+iw-1);
+ na=1-na;
+ goto L115;
+
+ L106:
+ if(ip!=3)goto L109;
+
+ ix2=iw+ido;
+ if(na!=0)
+ dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1);
+ else
+ dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1);
+ na=1-na;
+ goto L115;
+
+ L109:
+/* The radix five case can be translated later..... */
+/* if(ip!=5)goto L112;
+
+ ix2=iw+ido;
+ ix3=ix2+ido;
+ ix4=ix3+ido;
+ if(na!=0)
+ dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+ else
+ dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
+ na=1-na;
+ goto L115;
+
+ L112:*/
+ if(na!=0)
+ dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
+ else
+ dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
+ if(ido==1)na=1-na;
+
+ L115:
+ l1=l2;
+ iw+=(ip-1)*ido;
+ }
+
+ if(na==0)return;
+
+ for(i=0;i<n;i++)c[i]=ch[i];
+}
+
+void drft_forward(drft_lookup *l,float *data){
+ if(l->n==1)return;
+ drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
+}
+
+void drft_backward(drft_lookup *l,float *data){
+ if (l->n==1)return;
+ drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
+}
+
+void drft_init(drft_lookup *l,int n){
+ l->n=n;
+ l->trigcache=calloc(3*n,sizeof(float));
+ l->splitcache=calloc(32,sizeof(int));
+ fdrffti(n, l->trigcache, l->splitcache);
+}
+
+void drft_clear(drft_lookup *l){
+ if(l){
+ if(l->trigcache)free(l->trigcache);
+ if(l->splitcache)free(l->splitcache);
+ memset(l,0,sizeof(drft_lookup));
+ }
+}
diff --git a/lib/smallft.h b/lib/smallft.h
new file mode 100644
index 00000000..f9607eb0
--- /dev/null
+++ b/lib/smallft.h
@@ -0,0 +1,35 @@
+/********************************************************************
+ * *
+ * 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: fft transform
+ last mod: $Id: smallft.h,v 1.6.10.1 2000/08/31 09:00:02 xiphmont Exp $
+
+********************************************************************/
+
+#ifndef _V_SMFT_H_
+#define _V_SMFT_H_
+
+#include "vorbis/codec.h"
+
+typedef struct {
+ int n;
+ float *trigcache;
+ int *splitcache;
+} drft_lookup;
+
+extern void drft_forward(drft_lookup *l,float *data);
+extern void drft_backward(drft_lookup *l,float *data);
+extern void drft_init(drft_lookup *l,int n);
+extern void drft_clear(drft_lookup *l);
+
+#endif
diff --git a/lib/synthesis.c b/lib/synthesis.c
new file mode 100644
index 00000000..d9108eac
--- /dev/null
+++ b/lib/synthesis.c
@@ -0,0 +1,74 @@
+/********************************************************************
+ * *
+ * 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 synthesis
+ last mod: $Id: synthesis.c,v 1.17.4.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "registry.h"
+#include "bitwise.h"
+#include "misc.h"
+#include "os.h"
+
+int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ oggpack_buffer *opb=&vb->opb;
+ int type,mode,i;
+
+ /* first things first. Make sure decode is ready */
+ _vorbis_block_ripcord(vb);
+ _oggpack_readinit(opb,op->packet,op->bytes);
+
+ /* Check the packet type */
+ if(_oggpack_read(opb,1)!=0){
+ /* Oops. This is not an audio data packet */
+ return(-1);
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=_oggpack_read(opb,vd->modebits);
+ if(mode==-1)return(-1);
+
+ vb->mode=mode;
+ vb->W=vi->mode_param[mode]->blockflag;
+ if(vb->W){
+ vb->lW=_oggpack_read(opb,1);
+ vb->nW=_oggpack_read(opb,1);
+ if(vb->nW==-1) return(-1);
+ }else{
+ vb->lW=0;
+ vb->nW=0;
+ }
+
+ /* more setup */
+ vb->frameno=op->frameno;
+ vb->sequence=op->packetno-3; /* first block is third packet */
+ vb->eofflag=op->e_o_s;
+
+ /* alloc pcm passback storage */
+ vb->pcmend=vi->blocksizes[vb->W];
+ vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
+ for(i=0;i<vi->channels;i++)
+ vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
+
+ /* unpack_header enforces range checking */
+ type=vi->map_type[vi->mode_param[mode]->mapping];
+
+ return(_mapping_P[type]->inverse(vb,vd->mode[mode]));
+}
+
+
diff --git a/lib/time0.c b/lib/time0.c
new file mode 100644
index 00000000..4fa644f9
--- /dev/null
+++ b/lib/time0.c
@@ -0,0 +1,51 @@
+/********************************************************************
+ * *
+ * 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: time backend 0 (dummy)
+ last mod: $Id: time0.c,v 1.5.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "vorbis/codec.h"
+#include "registry.h"
+#include "misc.h"
+
+static void pack (vorbis_info_time *i,oggpack_buffer *opb){
+}
+static vorbis_info_time *unpack (vorbis_info *vi,oggpack_buffer *opb){
+ return "";
+
+}
+static vorbis_look_time *look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
+ vorbis_info_time *i){
+ return "";
+}
+static void free_info(vorbis_info_time *i){
+}
+static void free_look(vorbis_look_time *i){
+}
+static int forward(vorbis_block *vb,vorbis_look_time *i,
+ float *in,float *out){
+ return(0);
+}
+static int inverse(vorbis_block *vb,vorbis_look_time *i,
+ float *in,float *out){
+ return(0);
+}
+
+/* export hooks */
+vorbis_func_time time0_exportbundle={
+ &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse
+};
diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c
index 10a33dab..b7c80cfb 100644
--- a/lib/vorbisfile.c
+++ b/lib/vorbisfile.c
@@ -12,7 +12,7 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.27.2.1 2000/08/31 08:05:48 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.27.2.2 2000/08/31 09:00:02 xiphmont Exp $
********************************************************************/
@@ -873,7 +873,7 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
/* discard samples until we reach the desired position. Crossing a
logical bitstream boundary with abandon is OK. */
while(vf->pcm_offset<pos){
- double **pcm;
+ float **pcm;
long target=pos-vf->pcm_offset;
long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
@@ -1056,7 +1056,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
while(1){
if(vf->decode_ready){
- double **pcm;
+ float **pcm;
long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
if(samples){
/* yay! proceed to pack data into the byte buffer */
@@ -1083,7 +1083,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
if(host_endian==bigendianp){
if(sgned){
for(i=0;i<channels;i++) { /* It's faster in this order */
- double *src=pcm[i];
+ float *src=pcm[i];
short *dest=((short *)buffer)+i;
for(j=0;j<samples;j++) {
val=(int)(src[j]*32768. + 0.5);
@@ -1095,7 +1095,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length,
}
}else{
for(i=0;i<channels;i++) {
- double *src=pcm[i];
+ float *src=pcm[i];
short *dest=((short *)buffer)+i;
for(j=0;j<samples;j++) {
val=(int)(src[j]*32768. + 0.5);
diff --git a/lib/window.c b/lib/window.c
new file mode 100644
index 00000000..872a73ef
--- /dev/null
+++ b/lib/window.c
@@ -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-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: window functions
+ last mod: $Id: window.c,v 1.7.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include "os.h"
+#include "misc.h"
+
+float *_vorbis_window(int type, int window,int left,int right){
+ float *ret=calloc(window,sizeof(float));
+
+ switch(type){
+ case 0:
+ /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) */
+ {
+ int leftbegin=window/4-left/2;
+ int rightbegin=window-window/4-right/2;
+ int i;
+
+ for(i=0;i<left;i++){
+ float x=(i+.5)/left*M_PI/2.;
+ x=sin(x);
+ x*=x;
+ x*=M_PI/2.;
+ x=sin(x);
+ ret[i+leftbegin]=x;
+ }
+
+ for(i=leftbegin+left;i<rightbegin;i++)
+ ret[i]=1.;
+
+ for(i=0;i<right;i++){
+ float x=(right-i-.5)/right*M_PI/2.;
+ x=sin(x);
+ x*=x;
+ x*=M_PI/2.;
+ x=sin(x);
+ ret[i+rightbegin]=x;
+ }
+ }
+ break;
+ default:
+ free(ret);
+ return(NULL);
+ }
+ return(ret);
+}
+
diff --git a/lib/window.h b/lib/window.h
new file mode 100644
index 00000000..3dff8221
--- /dev/null
+++ b/lib/window.h
@@ -0,0 +1,25 @@
+/********************************************************************
+ * *
+ * 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: window functions
+ last mod: $Id: window.h,v 1.3.10.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_WINDOW_
+#define _V_WINDOW_
+
+#define VI_WINDOWB 1
+extern float *_vorbis_window(int type,int window,int left,int right);
+
+#endif
diff --git a/vq/bookutil.c b/vq/bookutil.c
new file mode 100644
index 00000000..2221279e
--- /dev/null
+++ b/vq/bookutil.c
@@ -0,0 +1,742 @@
+/********************************************************************
+ * *
+ * 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 functions for loading .vqh and .vqd files
+ last mod: $Id: bookutil.c,v 1.16.2.1 2000/08/31 09:00:02 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"
+
+/* A few little utils for reading files */
+/* read a line. Use global, persistent buffering */
+static char *linebuffer=NULL;
+static int lbufsize=0;
+char *get_line(FILE *in){
+ long sofar=0;
+ if(feof(in))return NULL;
+
+ while(1){
+ int gotline=0;
+
+ while(!gotline){
+ if(sofar+1>=lbufsize){
+ if(!lbufsize){
+ lbufsize=1024;
+ linebuffer=malloc(lbufsize);
+ }else{
+ lbufsize*=2;
+ linebuffer=realloc(linebuffer,lbufsize);
+ }
+ }
+ {
+ long c=fgetc(in);
+ switch(c){
+ case EOF:
+ if(sofar==0)return(NULL);
+ /* fallthrough correct */
+ case '\n':
+ linebuffer[sofar]='\0';
+ gotline=1;
+ break;
+ default:
+ linebuffer[sofar++]=c;
+ linebuffer[sofar]='\0';
+ break;
+ }
+ }
+ }
+
+ if(linebuffer[0]=='#'){
+ sofar=0;
+ }else{
+ return(linebuffer);
+ }
+ }
+}
+
+/* read the next numerical value from the given file */
+static char *value_line_buff=NULL;
+
+int get_line_value(FILE *in,float *value){
+ char *next;
+
+ if(!value_line_buff)return(-1);
+
+ *value=strtod(value_line_buff, &next);
+ if(next==value_line_buff){
+ value_line_buff=NULL;
+ return(-1);
+ }else{
+ value_line_buff=next;
+ while(*value_line_buff>44)value_line_buff++;
+ if(*value_line_buff==44)value_line_buff++;
+ return(0);
+ }
+}
+
+int get_next_value(FILE *in,float *value){
+ while(1){
+ if(get_line_value(in,value)){
+ value_line_buff=get_line(in);
+ if(!value_line_buff)return(-1);
+ }else{
+ return(0);
+ }
+ }
+}
+
+int get_next_ivalue(FILE *in,long *ivalue){
+ float value;
+ int ret=get_next_value(in,&value);
+ *ivalue=value;
+ return(ret);
+}
+
+static float sequence_base=0.;
+static int v_sofar=0;
+void reset_next_value(void){
+ value_line_buff=NULL;
+ sequence_base=0.;
+ v_sofar=0;
+}
+
+char *setup_line(FILE *in){
+ reset_next_value();
+ value_line_buff=get_line(in);
+ return(value_line_buff);
+}
+
+
+int get_vector(codebook *b,FILE *in,int start, int n,float *a){
+ int i;
+ const static_codebook *c=b->c;
+
+ while(1){
+
+ if(v_sofar==n || get_line_value(in,a)){
+ reset_next_value();
+ if(get_next_value(in,a))
+ break;
+ for(i=0;i<start;i++){
+ sequence_base=*a;
+ get_line_value(in,a);
+ }
+ }
+
+ for(i=1;i<c->dim;i++)
+ if(get_line_value(in,a+i))
+ break;
+
+ if(i==c->dim){
+ float temp=a[c->dim-1];
+ for(i=0;i<c->dim;i++)a[i]-=sequence_base;
+ if(c->q_sequencep)sequence_base=temp;
+ v_sofar++;
+ return(0);
+ }
+ sequence_base=0.;
+ }
+
+ return(-1);
+}
+
+/* read lines fromt he beginning until we find one containing the
+ specified string */
+char *find_seek_to(FILE *in,char *s){
+ rewind(in);
+ while(1){
+ char *line=get_line(in);
+ if(line){
+ if(strstr(line,s))
+ return(line);
+ }else
+ return(NULL);
+ }
+}
+
+
+/* this reads the format as written by vqbuild/latticebuild; innocent
+ (legal) tweaking of the file that would not affect its valid
+ header-ness will break this routine */
+
+codebook *codebook_load(char *filename){
+ codebook *b=calloc(1,sizeof(codebook));
+ static_codebook *c=(static_codebook *)(b->c=calloc(1,sizeof(static_codebook)));
+ encode_aux_nearestmatch *a=NULL;
+ encode_aux_threshmatch *t=NULL;
+ encode_aux_pigeonhole *p=NULL;
+ int quant_to_read=0;
+ FILE *in=fopen(filename,"r");
+ char *line;
+ long i;
+
+ if(in==NULL){
+ fprintf(stderr,"Couldn't open codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* find the codebook struct */
+ find_seek_to(in,"static static_codebook _vq_book_");
+
+ /* get the major important values */
+ line=get_line(in);
+ if(sscanf(line,"%ld, %ld,",
+ &(c->dim),&(c->entries))!=2){
+ fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ line=get_line(in);
+ line=get_line(in);
+ if(sscanf(line,"%d, %ld, %ld, %d, %d,",
+ &(c->maptype),&(c->q_min),&(c->q_delta),&(c->q_quant),
+ &(c->q_sequencep))!=5){
+ fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+
+ /* find the auxiliary encode struct[s] (if any) */
+ if(find_seek_to(in,"static encode_aux_nearestmatch _vq_aux")){
+ /* how big? */
+ c->nearest_tree=a=calloc(1,sizeof(encode_aux_nearestmatch));
+ line=get_line(in);
+ line=get_line(in);
+ line=get_line(in);
+ line=get_line(in);
+ line=get_line(in);
+ if(sscanf(line,"%ld, %ld",&(a->aux),&(a->alloc))!=2){
+ fprintf(stderr,"2: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+
+ /* load ptr0 */
+ find_seek_to(in,"static long _vq_ptr0");
+ reset_next_value();
+ a->ptr0=malloc(sizeof(long)*a->aux);
+ for(i=0;i<a->aux;i++)
+ if(get_next_ivalue(in,a->ptr0+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* load ptr1 */
+ find_seek_to(in,"static long _vq_ptr1");
+ reset_next_value();
+ a->ptr1=malloc(sizeof(long)*a->aux);
+ for(i=0;i<a->aux;i++)
+ if(get_next_ivalue(in,a->ptr1+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+
+ /* load p */
+ find_seek_to(in,"static long _vq_p_");
+ reset_next_value();
+ a->p=malloc(sizeof(long)*a->aux);
+ for(i=0;i<a->aux;i++)
+ if(get_next_ivalue(in,a->p+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* load q */
+ find_seek_to(in,"static long _vq_q_");
+ reset_next_value();
+ a->q=malloc(sizeof(long)*a->aux);
+ for(i=0;i<a->aux;i++)
+ if(get_next_ivalue(in,a->q+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+ }
+
+ if(find_seek_to(in,"static encode_aux_threshmatch _vq_aux")){
+ /* how big? */
+ c->thresh_tree=t=calloc(1,sizeof(encode_aux_threshmatch));
+ line=get_line(in);
+ line=get_line(in);
+ line=get_line(in);
+ if(sscanf(line,"%d",&(t->quantvals))!=1){
+ fprintf(stderr,"3: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ line=get_line(in);
+ if(sscanf(line,"%d",&(t->threshvals))!=1){
+ fprintf(stderr,"4: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ /* load quantthresh */
+ find_seek_to(in,"static float _vq_quantthresh_");
+ reset_next_value();
+ t->quantthresh=malloc(sizeof(float)*t->threshvals);
+ for(i=0;i<t->threshvals-1;i++)
+ if(get_next_value(in,t->quantthresh+i)){
+ fprintf(stderr,"out of data 1 while reading codebook %s\n",filename);
+ exit(1);
+ }
+ /* load quantmap */
+ find_seek_to(in,"static long _vq_quantmap_");
+ reset_next_value();
+ t->quantmap=malloc(sizeof(long)*t->threshvals);
+ for(i=0;i<t->threshvals;i++)
+ if(get_next_ivalue(in,t->quantmap+i)){
+ fprintf(stderr,"out of data 2 while reading codebook %s\n",filename);
+ exit(1);
+ }
+ }
+
+ if(find_seek_to(in,"static encode_aux_pigeonhole _vq_aux")){
+ int pigeons=1,i;
+ /* how big? */
+ c->pigeon_tree=p=calloc(1,sizeof(encode_aux_pigeonhole));
+ line=get_line(in);
+ if(sscanf(line,"%lf, %lf, %d, %d",&(p->min),&(p->del),
+ &(p->mapentries),&(p->quantvals))!=4){
+ fprintf(stderr,"5: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ line=get_line(in);
+ line=get_line(in);
+ if(sscanf(line,"%ld",&(p->fittotal))!=1){
+ fprintf(stderr,"6: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ /* load pigeonmap */
+ find_seek_to(in,"static long _vq_pigeonmap_");
+ reset_next_value();
+ p->pigeonmap=malloc(sizeof(long)*p->mapentries);
+ for(i=0;i<p->mapentries;i++)
+ if(get_next_ivalue(in,p->pigeonmap+i)){
+ fprintf(stderr,"out of data (pigeonmap) while reading codebook %s\n",filename);
+ exit(1);
+ }
+ /* load fitlist */
+ find_seek_to(in,"static long _vq_fitlist_");
+ reset_next_value();
+ p->fitlist=malloc(sizeof(long)*p->fittotal);
+ for(i=0;i<p->fittotal;i++)
+ if(get_next_ivalue(in,p->fitlist+i)){
+ fprintf(stderr,"out of data (fitlist) while reading codebook %s\n",filename);
+ exit(1);
+ }
+ /* load fitmap */
+ find_seek_to(in,"static long _vq_fitmap_");
+ reset_next_value();
+ for(i=0;i<c->dim;i++)pigeons*=p->quantvals;
+ p->fitmap=malloc(sizeof(long)*pigeons);
+ for(i=0;i<pigeons;i++)
+ if(get_next_ivalue(in,p->fitmap+i)){
+ fprintf(stderr,"out of data (fitmap) while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* load fitlength */
+ find_seek_to(in,"static long _vq_fitlength_");
+ reset_next_value();
+ p->fitlength=malloc(sizeof(long)*pigeons);
+ for(i=0;i<pigeons;i++)
+ if(get_next_ivalue(in,p->fitlength+i)){
+ fprintf(stderr,"out of data (fitlength) while reading codebook %s\n",filename);
+ exit(1);
+ }
+ }
+
+ switch(c->maptype){
+ case 0:
+ quant_to_read=0;
+ break;
+ case 1:
+ quant_to_read=_book_maptype1_quantvals(c);
+ break;
+ case 2:
+ quant_to_read=c->entries*c->dim;
+ break;
+ }
+
+ /* load the quantized entries */
+ find_seek_to(in,"static long _vq_quantlist_");
+ reset_next_value();
+ c->quantlist=malloc(sizeof(long)*quant_to_read);
+ for(i=0;i<quant_to_read;i++)
+ if(get_next_ivalue(in,c->quantlist+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* load the lengthlist */
+ find_seek_to(in,"static long _vq_lengthlist");
+ reset_next_value();
+ c->lengthlist=malloc(sizeof(long)*c->entries);
+ for(i=0;i<c->entries;i++)
+ if(get_next_ivalue(in,c->lengthlist+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* got it all */
+ fclose(in);
+
+ vorbis_book_init_encode(b,c);
+
+ return(b);
+}
+
+void spinnit(char *s,int n){
+ static int p=0;
+ static long lasttime=0;
+ long test;
+ struct timeval thistime;
+
+ gettimeofday(&thistime,NULL);
+ test=thistime.tv_sec*10+thistime.tv_usec/100000;
+ if(lasttime!=test){
+ lasttime=test;
+
+ fprintf(stderr,"%s%d ",s,n);
+
+ p++;if(p>3)p=0;
+ switch(p){
+ case 0:
+ fprintf(stderr,"| \r");
+ break;
+ case 1:
+ fprintf(stderr,"/ \r");
+ break;
+ case 2:
+ fprintf(stderr,"- \r");
+ break;
+ case 3:
+ fprintf(stderr,"\\ \r");
+ break;
+ }
+ fflush(stderr);
+ }
+}
+
+void build_tree_from_lengths(int vals, long *hist, long *lengths){
+ int i,j;
+ long *membership=malloc(vals*sizeof(long));
+ long *histsave=alloca(vals*sizeof(long));
+ memcpy(histsave,hist,vals*sizeof(long));
+
+ for(i=0;i<vals;i++)membership[i]=i;
+
+ /* find codeword lengths */
+ /* much more elegant means exist. Brute force n^2, minimum thought */
+ for(i=vals;i>1;i--){
+ int first=-1,second=-1;
+ long least=-1;
+
+ spinnit("building... ",i);
+
+ /* find the two nodes to join */
+ for(j=0;j<vals;j++)
+ if(least==-1 || hist[j]<least){
+ least=hist[j];
+ first=membership[j];
+ }
+ least=-1;
+ for(j=0;j<vals;j++)
+ if((least==-1 || hist[j]<least) && membership[j]!=first){
+ least=hist[j];
+ second=membership[j];
+ }
+ if(first==-1 || second==-1){
+ fprintf(stderr,"huffman fault; no free branch\n");
+ exit(1);
+ }
+
+ /* join them */
+ least=hist[first]+hist[second];
+ for(j=0;j<vals;j++)
+ if(membership[j]==first || membership[j]==second){
+ membership[j]=first;
+ hist[j]=least;
+ lengths[j]++;
+ }
+ }
+ for(i=0;i<vals-1;i++)
+ if(membership[i]!=membership[i+1]){
+ fprintf(stderr,"huffman fault; failed to build single tree\n");
+ exit(1);
+ }
+
+ /* for sanity check purposes: how many bits would it have taken to
+ encode the training set? */
+ {
+ long bitsum=0;
+ long samples=0;
+ for(i=0;i<vals;i++){
+ bitsum+=(histsave[i]-1)*lengths[i];
+ samples+=histsave[i]-1;
+ }
+
+ if(samples){
+ fprintf(stderr,"\rTotal samples in training set: %ld \n",samples);
+ fprintf(stderr,"\rTotal bits used to represent training set: %ld\n",
+ bitsum);
+ }
+ }
+
+ free(membership);
+}
+
+/* wrap build_tree_from_lengths to allow zero entries in the histogram */
+void build_tree_from_lengths0(int vals, long *hist, long *lengths){
+
+ /* pack the 'sparse' hit list into a dense list, then unpack
+ the lengths after the build */
+
+ int upper=0,i;
+ long *lengthlist=calloc(vals,sizeof(long));
+ long *newhist=alloca(vals*sizeof(long));
+
+ for(i=0;i<vals;i++)
+ if(hist[i]>0)
+ newhist[upper++]=hist[i];
+
+ if(upper != vals){
+ fprintf(stderr,"\rEliminating %d unused entries; %d entries remain\n",
+ vals-upper,upper);
+ }
+
+ build_tree_from_lengths(upper,newhist,lengthlist);
+
+ upper=0;
+ for(i=0;i<vals;i++)
+ if(hist[i]>0)
+ lengths[i]=lengthlist[upper++];
+ else
+ lengths[i]=0;
+
+ free(lengthlist);
+}
+
+void write_codebook(FILE *out,char *name,const static_codebook *c){
+ encode_aux_pigeonhole *p=c->pigeon_tree;
+ encode_aux_threshmatch *t=c->thresh_tree;
+ encode_aux_nearestmatch *n=c->nearest_tree;
+ int i,j,k;
+
+ /* save the book in C header form */
+ fprintf(out,
+ "/********************************************************************\n"
+ " * *\n"
+ " * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *\n"
+ " * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *\n"
+ " * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *\n"
+ " * PLEASE READ THESE TERMS DISTRIBUTING. *\n"
+ " * *\n"
+ " * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *\n"
+ " * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *\n"
+ " * http://www.xiph.org/ *\n"
+ " * *\n"
+ " ********************************************************************\n"
+ "\n"
+ " function: static codebook autogenerated by vq/somethingorother\n"
+ "\n"
+ " ********************************************************************/\n\n");
+
+ fprintf(out,"#ifndef _V_%s_VQH_\n#define _V_%s_VQH_\n",name,name);
+ fprintf(out,"#include \"vorbis/codebook.h\"\n\n");
+
+ /* first, the static vectors, then the book structure to tie it together. */
+ /* quantlist */
+ if(c->quantlist){
+ long vals=(c->maptype==1?_book_maptype1_quantvals(c):c->entries*c->dim);
+ fprintf(out,"static long _vq_quantlist_%s[] = {\n",name);
+ for(j=0;j<vals;j++){
+ fprintf(out,"\t%ld,\n",c->quantlist[j]);
+ }
+ fprintf(out,"};\n\n");
+ }
+
+ /* lengthlist */
+ fprintf(out,"static long _vq_lengthlist_%s[] = {\n",name);
+ for(j=0;j<c->entries;){
+ fprintf(out,"\t");
+ for(k=0;k<16 && j<c->entries;k++,j++)
+ fprintf(out,"%2ld,",c->lengthlist[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ if(t){
+ /* quantthresh */
+ fprintf(out,"static float _vq_quantthresh_%s[] = {\n",name);
+ for(j=0;j<t->threshvals-1;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<t->threshvals-1;k++,j++)
+ fprintf(out,"%.5g, ",t->quantthresh[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ /* quantmap */
+ fprintf(out,"static long _vq_quantmap_%s[] = {\n",name);
+ for(j=0;j<t->threshvals;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<t->threshvals;k++,j++)
+ fprintf(out,"%5ld,",t->quantmap[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ fprintf(out,"static encode_aux_threshmatch _vq_auxt_%s = {\n",name);
+ fprintf(out,"\t_vq_quantthresh_%s,\n",name);
+ fprintf(out,"\t_vq_quantmap_%s,\n",name);
+ fprintf(out,"\t%d,\n",t->quantvals);
+ fprintf(out,"\t%d\n};\n\n",t->threshvals);
+ }
+
+ if(p){
+ int pigeons=1;
+ for(i=0;i<c->dim;i++)pigeons*=p->quantvals;
+
+ /* pigeonmap */
+ fprintf(out,"static long _vq_pigeonmap_%s[] = {\n",name);
+ for(j=0;j<p->mapentries;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<p->mapentries;k++,j++)
+ fprintf(out,"%5ld, ",p->pigeonmap[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+ /* fitlist */
+ fprintf(out,"static long _vq_fitlist_%s[] = {\n",name);
+ for(j=0;j<p->fittotal;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<p->fittotal;k++,j++)
+ fprintf(out,"%5ld, ",p->fitlist[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+ /* fitmap */
+ fprintf(out,"static long _vq_fitmap_%s[] = {\n",name);
+ for(j=0;j<pigeons;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<pigeons;k++,j++)
+ fprintf(out,"%5ld, ",p->fitmap[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+ /* fitlength */
+ fprintf(out,"static long _vq_fitlength_%s[] = {\n",name);
+ for(j=0;j<pigeons;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<pigeons;k++,j++)
+ fprintf(out,"%5ld, ",p->fitlength[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ fprintf(out,"static encode_aux_pigeonhole _vq_auxp_%s = {\n",name);
+ fprintf(out,"\t%g, %g, %d, %d,\n",
+ p->min,p->del,p->mapentries,p->quantvals);
+
+ fprintf(out,"\t_vq_pigeonmap_%s,\n",name);
+
+ fprintf(out,"\t%ld,\n",p->fittotal);
+ fprintf(out,"\t_vq_fitlist_%s,\n",name);
+ fprintf(out,"\t_vq_fitmap_%s,\n",name);
+ fprintf(out,"\t_vq_fitlength_%s\n};\n\n",name);
+ }
+
+ if(n){
+
+ /* ptr0 */
+ fprintf(out,"static long _vq_ptr0_%s[] = {\n",name);
+ for(j=0;j<n->aux;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<n->aux;k++,j++)
+ fprintf(out,"%6ld,",n->ptr0[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ /* ptr1 */
+ fprintf(out,"static long _vq_ptr1_%s[] = {\n",name);
+ for(j=0;j<n->aux;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<n->aux;k++,j++)
+ fprintf(out,"%6ld,",n->ptr1[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ /* p */
+ fprintf(out,"static long _vq_p_%s[] = {\n",name);
+ for(j=0;j<n->aux;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<n->aux;k++,j++)
+ fprintf(out,"%6ld,",n->p[j]*c->dim);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ /* q */
+ fprintf(out,"static long _vq_q_%s[] = {\n",name);
+ for(j=0;j<n->aux;){
+ fprintf(out,"\t");
+ for(k=0;k<8 && j<n->aux;k++,j++)
+ fprintf(out,"%6ld,",n->q[j]*c->dim);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ fprintf(out,"static encode_aux_nearestmatch _vq_auxn_%s = {\n",name);
+ fprintf(out,"\t_vq_ptr0_%s,\n",name);
+ fprintf(out,"\t_vq_ptr1_%s,\n",name);
+ fprintf(out,"\t_vq_p_%s,\n",name);
+ fprintf(out,"\t_vq_q_%s,\n",name);
+ fprintf(out,"\t%ld, %ld\n};\n\n",n->aux,n->aux);
+ }
+
+ /* tie it all together */
+
+ fprintf(out,"static static_codebook _vq_book_%s = {\n",name);
+
+ fprintf(out,"\t%ld, %ld,\n",c->dim,c->entries);
+ fprintf(out,"\t_vq_lengthlist_%s,\n",name);
+ fprintf(out,"\t%d, %ld, %ld, %d, %d,\n",
+ c->maptype,c->q_min,c->q_delta,c->q_quant,c->q_sequencep);
+ if(c->quantlist)
+ fprintf(out,"\t_vq_quantlist_%s,\n",name);
+ else
+ fprintf(out,"\tNULL,\n");
+
+ if(n)
+ fprintf(out,"\t&_vq_auxn_%s,\n",name);
+ else
+ fprintf(out,"\tNULL,\n");
+ if(t)
+ fprintf(out,"\t&_vq_auxt_%s,\n",name);
+ else
+ fprintf(out,"\tNULL,\n");
+ if(p)
+ fprintf(out,"\t&_vq_auxp_%s,\n",name);
+ else
+ fprintf(out,"\tNULL,\n");
+
+ fprintf(out,"};\n\n");
+
+ fprintf(out,"\n#endif\n");
+}
diff --git a/vq/bookutil.h b/vq/bookutil.h
new file mode 100644
index 00000000..7a7a6089
--- /dev/null
+++ b/vq/bookutil.h
@@ -0,0 +1,44 @@
+/********************************************************************
+ * *
+ * 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 functions for loading .vqh and .vqd files
+ last mod: $Id: bookutil.h,v 1.6.4.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_BOOKUTIL_H_
+#define _V_BOOKUTIL_H_
+
+#include <stdio.h>
+#include <sys/time.h>
+
+#include "vorbis/codebook.h"
+
+extern char *get_line(FILE *in);
+extern char *setup_line(FILE *in);
+extern int get_line_value(FILE *in,float *value);
+extern int get_next_value(FILE *in,float *value);
+extern int get_next_ivalue(FILE *in,long *ivalue);
+extern void reset_next_value(void);
+extern int get_vector(codebook *b,FILE *in,int start,int num,float *a);
+extern char *find_seek_to(FILE *in,char *s);
+
+extern codebook *codebook_load(char *filename);
+extern void write_codebook(FILE *out,char *name,const static_codebook *c);
+
+extern void spinnit(char *s,int n);
+extern void build_tree_from_lengths(int vals, long *hist, long *lengths);
+extern void build_tree_from_lengths0(int vals, long *hist, long *lengths);
+
+#endif
+
diff --git a/vq/build.c b/vq/build.c
new file mode 100644
index 00000000..b64ee826
--- /dev/null
+++ b/vq/build.c
@@ -0,0 +1,198 @@
+/********************************************************************
+ * *
+ * 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 training sets
+ last mod: $Id: build.c,v 1.14.6.1 2000/08/31 09:00:02 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"
+
+#include "vqgen.h"
+#include "vqsplit.h"
+
+static char *linebuffer=NULL;
+static int lbufsize=0;
+static char *rline(FILE *in,FILE *out){
+ long sofar=0;
+ if(feof(in))return NULL;
+
+ while(1){
+ int gotline=0;
+
+ while(!gotline){
+ if(sofar>=lbufsize){
+ if(!lbufsize){
+ lbufsize=1024;
+ linebuffer=malloc(lbufsize);
+ }else{
+ lbufsize*=2;
+ linebuffer=realloc(linebuffer,lbufsize);
+ }
+ }
+ {
+ long c=fgetc(in);
+ switch(c){
+ case '\n':
+ case EOF:
+ gotline=1;
+ break;
+ default:
+ linebuffer[sofar++]=c;
+ linebuffer[sofar]='\0';
+ break;
+ }
+ }
+ }
+
+ if(linebuffer[0]=='#'){
+ sofar=0;
+ }else{
+ return(linebuffer);
+ }
+ }
+}
+
+/* command line:
+ buildvq file
+*/
+
+int main(int argc,char *argv[]){
+ vqgen v;
+ static_codebook c;
+ codebook b;
+ quant_meta q;
+
+ long *quantlist=NULL;
+ int entries=-1,dim=-1,aux=-1;
+ FILE *out=NULL;
+ FILE *in=NULL;
+ char *line,*name;
+ long i,j,k;
+
+ b.c=&c;
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Need a trained data set on the command line.\n");
+ exit(1);
+ }
+
+ {
+ char *ptr;
+ char *filename=strdup(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);
+ sprintf(ptr,".vqh");
+ }else{
+ name=strdup(filename);
+ strcat(filename,".vqh");
+ }
+
+ out=fopen(filename,"w");
+ if(out==NULL){
+ fprintf(stderr,"Unable to open %s for writing\n",filename);
+ exit(1);
+ }
+ }
+
+ /* suck in the trained book */
+
+ /* read book type, but it doesn't matter */
+ line=rline(in,out);
+
+ line=rline(in,out);
+ if(sscanf(line,"%d %d %d",&entries,&dim,&aux)!=3){
+ fprintf(stderr,"Syntax error reading book file\n");
+ exit(1);
+ }
+
+ /* just use it to allocate mem */
+ vqgen_init(&v,dim,0,entries,0.,NULL,NULL,0);
+
+ /* quant */
+ line=rline(in,out);
+ if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta,
+ &q.quant,&q.sequencep)!=4){
+ fprintf(stderr,"Syntax error reading book file\n");
+ exit(1);
+ }
+
+ /* quantized entries */
+ /* save quant data; we don't want to requantize later as our method
+ is currently imperfect wrt repeated application */
+ i=0;
+ quantlist=malloc(sizeof(long)*v.elements*v.entries);
+ for(j=0;j<entries;j++){
+ float a;
+ for(k=0;k<dim;k++){
+ line=rline(in,out);
+ sscanf(line,"%lf",&a);
+ v.entrylist[i]=a;
+ quantlist[i++]=rint(a);
+ }
+ }
+
+ /* ignore bias */
+ for(j=0;j<entries;j++)line=rline(in,out);
+ free(v.bias);
+ v.bias=NULL;
+
+ /* training points */
+ {
+ float *b=alloca(sizeof(float)*(dim+aux));
+ i=0;
+ v.entries=0; /* hack to avoid reseeding */
+ while(1){
+ for(k=0;k<dim+aux;k++){
+ line=rline(in,out);
+ if(!line)break;
+ sscanf(line,"%lf",b+k);
+ }
+ if(feof(in))break;
+ vqgen_addpoint(&v,b,NULL);
+ }
+ v.entries=entries;
+ }
+
+ fclose(in);
+ vqgen_unquantize(&v,&q);
+
+ /* build the book */
+ vqsp_book(&v,&b,quantlist);
+ c.q_min=q.min;
+ c.q_delta=q.delta;
+ c.q_quant=q.quant;
+ c.q_sequencep=q.sequencep;
+
+ /* save the book in C header form */
+ write_codebook(out,name,b.c);
+
+ fclose(out);
+ exit(0);
+}
diff --git a/vq/cascade.c b/vq/cascade.c
new file mode 100644
index 00000000..c86c7821
--- /dev/null
+++ b/vq/cascade.c
@@ -0,0 +1,94 @@
+/********************************************************************
+ * *
+ * 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: function call to do simple data cascading
+ last mod: $Id: cascade.c,v 1.6.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+/* this one outputs residue to stdout. */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include "vorbis/codebook.h"
+#include "../lib/sharedbook.h"
+#include "bookutil.h"
+
+/* set up metrics */
+
+float count=0.;
+
+
+void process_preprocess(codebook **bs,char *basename){
+}
+
+void process_postprocess(codebook **b,char *basename){
+ fprintf(stderr,"Done. \n");
+}
+
+float process_one(codebook *b,float *a,int dim,int step,int addmul,
+ float base){
+ int j;
+
+ if(b->c->q_sequencep){
+ float temp;
+ for(j=0;j<dim;j++){
+ temp=a[j*step];
+ a[j*step]-=base;
+ }
+ base=temp;
+ }
+
+ vorbis_book_besterror(b,a,step,addmul);
+
+ return base;
+}
+
+void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){
+ int i,bi=0;
+ int booknum=0;
+
+ while(*bs){
+ float base=0.;
+ codebook *b=*bs;
+ int dim=b->dim;
+
+ if(inter){
+ for(i=0;i<n/dim;i++)
+ base=process_one(b,a+i,dim,n/dim,addmul[bi],base);
+ }else{
+ for(i=0;i<=n-dim;i+=dim)
+ base=process_one(b,a+i,dim,1,addmul[bi],base);
+ }
+
+ bs++;
+ booknum++;
+ bi++;
+ }
+
+ for(i=0;i<n;i++)
+ fprintf(stdout,"%f, ",a[i]);
+ fprintf(stdout,"\n");
+
+ if((long)(count++)%100)spinnit("working.... lines: ",count);
+}
+
+void process_usage(void){
+ fprintf(stderr,
+ "usage: vqcascade [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n"
+ " datafile.vqd [datafile.vqd]...\n\n"
+ " data can be taken on stdin. residual error data sent to\n"
+ " stdout.\n\n");
+
+}
diff --git a/vq/genericdata.c b/vq/genericdata.c
new file mode 100644
index 00000000..ce7ee320
--- /dev/null
+++ b/vq/genericdata.c
@@ -0,0 +1,62 @@
+/********************************************************************
+ * *
+ * 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: generic euclidian distance metric for VQ codebooks
+ last mod: $Id: genericdata.c,v 1.5.8.1 2000/08/31 09:00:02 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include "vqgen.h"
+#include "vqext.h"
+
+char *vqext_booktype="GENERICdata";
+int vqext_aux=0;
+quant_meta q={0,0,0,0}; /* non sequence data; each scalar
+ independent */
+
+void vqext_quantize(vqgen *v,quant_meta *q){
+ vqgen_quantize(v,q);
+}
+
+float *vqext_weight(vqgen *v,float *p){
+ /*noop*/
+ return(p);
+}
+
+ /* candidate,actual */
+float vqext_metric(vqgen *v,float *e, float *p){
+ int i;
+ float acc=0.;
+ for(i=0;i<v->elements;i++){
+ float val=p[i]-e[i];
+ acc+=val*val;
+ }
+ return sqrt(acc/v->elements);
+}
+
+void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
+ vqgen_addpoint(v,b+start,NULL);
+}
+
+void vqext_preprocess(vqgen *v){
+ /* noop */
+}
+
+
+
+
+
+
diff --git a/vq/latticebuild.c b/vq/latticebuild.c
new file mode 100644
index 00000000..8717b0b3
--- /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.5.2.1 2000/08/31 09:00:02 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;
+ float *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 */
+ {
+ float min=quantlist[0];
+ float 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++){
+ float 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
new file mode 100644
index 00000000..a88a65e8
--- /dev/null
+++ b/vq/latticehint.c
@@ -0,0 +1,418 @@
+/********************************************************************
+ * *
+ * 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 thresh/pigeonhole encode hints
+ last mod: $Id: latticehint.c,v 1.2.2.1 2000/08/31 09:00:02 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 "../lib/scales.h"
+#include "bookutil.h"
+#include "vqgen.h"
+#include "vqsplit.h"
+
+/* The purpose of this util is to build encode hints for lattice
+ codebooks so that brute forcing each codebook entry isn't needed.
+ Threshhold hints are for books in which each scalar in the vector
+ is independant (eg, residue) and pigeonhole lookups provide a
+ minimum error fit for words where the scalars are interdependant
+ (each affecting the fit of the next in sequence) as in an LSP
+ sequential book (or can be used along with a sparse threshhold map,
+ like a splitting tree that need not be trained)
+
+ If the input book is non-sequential, a threshhold hint is built.
+ If the input book is sequential, a pigeonholing hist is built.
+ If the book is sparse, a pigeonholing hint is built, possibly in addition
+ to the threshhold hint
+
+ command line:
+ latticehint book.vqh
+
+ latticehint produces book.vqh on stdout */
+
+static int longsort(const void *a, const void *b){
+ return(**((long **)a)-**((long **)b));
+}
+
+static int addtosearch(int entry,long **tempstack,long *tempcount,int add){
+ long *ptr=tempstack[entry];
+ long i=tempcount[entry];
+
+ if(ptr){
+ while(i--)
+ if(*ptr++==add)return(0);
+ tempstack[entry]=realloc(tempstack[entry],
+ (tempcount[entry]+1)*sizeof(long));
+ }else{
+ tempstack[entry]=malloc(sizeof(long));
+ }
+
+ tempstack[entry][tempcount[entry]++]=add;
+ return(1);
+}
+
+static void setvals(int dim,encode_aux_pigeonhole *p,
+ long *temptrack,float *tempmin,float *tempmax,
+ int seqp){
+ int i;
+ float last=0.;
+ for(i=0;i<dim;i++){
+ tempmin[i]=(temptrack[i])*p->del+p->min+last;
+ tempmax[i]=tempmin[i]+p->del;
+ if(seqp)last=tempmin[i];
+ }
+}
+
+/* note that things are currently set up such that input fits that
+ quantize outside the pigeonmap are dropped and brute-forced. So we
+ can ignore the <0 and >=n boundary cases in min/max error */
+
+static float minerror(int dim,float *a,encode_aux_pigeonhole *p,
+ long *temptrack,float *tempmin,float *tempmax){
+ int i;
+ float err=0.;
+ for(i=0;i<dim;i++){
+ float eval=0.;
+ if(a[i]<tempmin[i]){
+ eval=tempmin[i]-a[i];
+ }else if(a[i]>tempmax[i]){
+ eval=a[i]-tempmax[i];
+ }
+ err+=eval*eval;
+ }
+ return(err);
+}
+
+static float maxerror(int dim,float *a,encode_aux_pigeonhole *p,
+ long *temptrack,float *tempmin,float *tempmax){
+ int i;
+ float err=0.,eval;
+ for(i=0;i<dim;i++){
+ if(a[i]<tempmin[i]){
+ eval=tempmax[i]-a[i];
+ }else if(a[i]>tempmax[i]){
+ eval=a[i]-tempmin[i];
+ }else{
+ float t1=a[i]-tempmin[i];
+ eval=tempmax[i]-a[i];
+ if(t1>eval)eval=t1;
+ }
+ err+=eval*eval;
+ }
+ return(err);
+}
+
+int main(int argc,char *argv[]){
+ codebook *b;
+ static_codebook *c;
+ int entries=-1,dim=-1;
+ float 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])dB=1;
+
+ {
+ 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;
+ min=_float32_unpack(c->q_min);
+ del=_float32_unpack(c->q_delta);
+
+ /* Do we want to gen a threshold hint? */
+ if(c->q_sequencep==0){
+ /* yes. Discard any preexisting threshhold hint */
+ long quantvals=_book_maptype1_quantvals(c);
+ long **quantsort=alloca(quantvals*sizeof(long *));
+ encode_aux_threshmatch *t=calloc(1,sizeof(encode_aux_threshmatch));
+ c->thresh_tree=t;
+
+ fprintf(stderr,"Adding threshold hint to %s...\n",name);
+
+ /* simplest possible threshold hint only */
+ t->quantthresh=calloc(quantvals-1,sizeof(float));
+ t->quantmap=calloc(quantvals,sizeof(int));
+ t->threshvals=quantvals;
+ t->quantvals=quantvals;
+
+ /* the quantvals may not be in order; sort em first */
+ for(i=0;i<quantvals;i++)quantsort[i]=c->quantlist+i;
+ qsort(quantsort,quantvals,sizeof(long *),longsort);
+
+ /* 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++){
+ float v1=*(quantsort[i])*del+min;
+ float 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? */
+ for(i=0;i<entries;i++)if(c->lengthlist[i]==0)break;
+ if(c->q_sequencep || i<entries){
+ long **tempstack;
+ long *tempcount;
+ long *temptrack;
+ float *tempmin;
+ float *tempmax;
+ long totalstack=0;
+ long pigeons;
+ long subpigeons;
+ long quantvals=_book_maptype1_quantvals(c);
+ int changep=1,factor;
+
+ encode_aux_pigeonhole *p=calloc(1,sizeof(encode_aux_pigeonhole));
+ c->pigeon_tree=p;
+
+ fprintf(stderr,"Adding pigeonhole hint to %s...\n",name);
+
+ /* the idea is that we quantize uniformly, even in a nonuniform
+ lattice, so that quantization of one scalar has a predictable
+ result on the next sequential scalar in a greedy matching
+ algorithm. We generate a lookup based on the quantization of
+ the vector (pigeonmap groups quantized entries together) and
+ list the entries that could possible be the best fit for any
+ given member of that pigeonhole. The encode process then has a
+ much smaller list to brute force */
+
+ /* find our pigeonhole-specific quantization values, fill in the
+ quant value->pigeonhole map */
+ factor=3;
+ p->del=del;
+ p->min=min;
+ p->quantvals=quantvals;
+ {
+ int max=0;
+ for(i=0;i<quantvals;i++)if(max<c->quantlist[i])max=c->quantlist[i];
+ p->mapentries=max;
+ }
+ p->pigeonmap=malloc(p->mapentries*sizeof(long));
+ p->quantvals=(quantvals+factor-1)/factor;
+
+ /* pigeonhole roughly on the boundaries of the quantvals; the
+ exact pigeonhole grouping is an optimization issue, not a
+ correctness issue */
+ for(i=0;i<p->mapentries;i++){
+ float thisval=del*i+min; /* middle of the quant zone */
+ int quant=0;
+ float err=fabs(c->quantlist[0]*del+min-thisval);
+ for(j=1;j<quantvals;j++){
+ float thiserr=fabs(c->quantlist[j]*del+min-thisval);
+ if(thiserr<err){
+ quant=j/factor;
+ err=thiserr;
+ }
+ }
+ p->pigeonmap[i]=quant;
+ }
+
+ /* pigeonmap complete. Now do the grungy business of finding the
+ entries that could possibly be the best fit for a value appearing
+ in the pigeonhole. The trick that allows the below to work is the
+ uniform quantization; even though the scalars may be 'sequential'
+ (each a delta from the last), the uniform quantization means that
+ the error variance is *not* dependant. Given a pigeonhole and an
+ entry, we can find the minimum and maximum possible errors
+ (relative to the entry) for any point that could appear in the
+ pigeonhole */
+
+ /* must iterate over both pigeonholes and entries */
+ /* temporarily (in order to avoid thinking hard), we grow each
+ pigeonhole seperately, the build a stack of 'em later */
+ pigeons=1;
+ subpigeons=1;
+ for(i=0;i<dim;i++)subpigeons*=p->mapentries;
+ for(i=0;i<dim;i++)pigeons*=p->quantvals;
+ temptrack=calloc(dim,sizeof(long));
+ tempmin=calloc(dim,sizeof(float));
+ tempmax=calloc(dim,sizeof(float));
+ tempstack=calloc(pigeons,sizeof(long *));
+ tempcount=calloc(pigeons,sizeof(long));
+
+ while(1){
+ float errorpost=-1;
+ char buffer[80];
+
+ /* map our current pigeonhole to a 'big pigeonhole' so we know
+ what list we're after */
+ int entry=0;
+ for(i=dim-1;i>=0;i--)entry=entry*p->quantvals+p->pigeonmap[temptrack[i]];
+ setvals(dim,p,temptrack,tempmin,tempmax,c->q_sequencep);
+ sprintf(buffer,"Building pigeonhole search list [%ld]...",totalstack);
+
+
+ /* Search all entries to find the one with the minimum possible
+ maximum error. Record that error */
+ for(i=0;i<entries;i++){
+ if(c->lengthlist[i]>0){
+ float this=maxerror(dim,b->valuelist+i*dim,p,
+ temptrack,tempmin,tempmax);
+ if(errorpost==-1 || this<errorpost)errorpost=this;
+ spinnit(buffer,subpigeons);
+ }
+ }
+
+ /* Our search list will contain all entries with a minimum
+ possible error <= our errorpost */
+ for(i=0;i<entries;i++)
+ if(c->lengthlist[i]>0){
+ spinnit(buffer,subpigeons);
+ if(minerror(dim,b->valuelist+i*dim,p,
+ temptrack,tempmin,tempmax)<errorpost)
+ totalstack+=addtosearch(entry,tempstack,tempcount,i);
+ }
+
+ for(i=0;i<dim;i++){
+ temptrack[i]++;
+ if(temptrack[i]<p->mapentries)break;
+ temptrack[i]=0;
+ }
+ if(i==dim)break;
+ subpigeons--;
+ }
+
+ fprintf(stderr,"\r "
+ "\rTotal search list size (all entries): %ld\n",totalstack);
+
+ /* pare the index of lists for improbable quantizations (where
+ improbable is determined by c->lengthlist; we assume that
+ pigeonholing is in sync with the codeword cells, which it is */
+ /*for(i=0;i<entries;i++){
+ float probability= 1./(1<<c->lengthlist[i]);
+ if(c->lengthlist[i]==0 || probability*entries<cutoff){
+ totalstack-=tempcount[i];
+ tempcount[i]=0;
+ }
+ }*/
+
+ /* pare the list of shortlists; merge contained and similar lists
+ together */
+ p->fitmap=malloc(pigeons*sizeof(long));
+ for(i=0;i<pigeons;i++)p->fitmap[i]=-1;
+ while(changep){
+ char buffer[80];
+ changep=0;
+
+ for(i=0;i<pigeons;i++){
+ if(p->fitmap[i]<0 && tempcount[i]){
+ for(j=i+1;j<pigeons;j++){
+ if(p->fitmap[j]<0 && tempcount[j]){
+ /* is one list a superset, or are they sufficiently similar? */
+ int amiss=0,bmiss=0,ii,jj;
+ for(ii=0;ii<tempcount[i];ii++){
+ for(jj=0;jj<tempcount[j];jj++)
+ if(tempstack[i][ii]==tempstack[j][jj])break;
+ if(jj==tempcount[j])amiss++;
+ }
+ for(jj=0;jj<tempcount[j];jj++){
+ for(ii=0;ii<tempcount[i];ii++)
+ if(tempstack[i][ii]==tempstack[j][jj])break;
+ if(ii==tempcount[i])bmiss++;
+ }
+ if(amiss==0 ||
+ bmiss==0 ||
+ (amiss*2<tempcount[i] && bmiss*2<tempcount[j] &&
+ tempcount[i]+bmiss<entries/30)){
+
+ /*superset/similar Add all of one to the other. */
+ for(jj=0;jj<tempcount[j];jj++)
+ totalstack+=addtosearch(i,tempstack,tempcount,
+ tempstack[j][jj]);
+ totalstack-=tempcount[j];
+ p->fitmap[j]=i;
+ changep=1;
+ }
+ }
+ }
+ sprintf(buffer,"Consolidating [%ld total, %s]... ",totalstack,
+ changep?"reit":"nochange");
+ spinnit(buffer,pigeons-i);
+ }
+ }
+ }
+
+ /* repack the temp stack in final form */
+ fprintf(stderr,"\r "
+ "\rFinal total list size: %ld\n",totalstack);
+
+
+ p->fittotal=totalstack;
+ p->fitlist=malloc((totalstack+1)*sizeof(long));
+ p->fitlength=malloc(pigeons*sizeof(long));
+ {
+ long usage=0;
+ for(i=0;i<pigeons;i++){
+ if(p->fitmap[i]==-1){
+ if(tempcount[i])
+ memcpy(p->fitlist+usage,tempstack[i],tempcount[i]*sizeof(long));
+ p->fitmap[i]=usage;
+ p->fitlength[i]=tempcount[i];
+ usage+=tempcount[i];
+ if(usage>totalstack){
+ fprintf(stderr,"Internal error; usage>totalstack\n");
+ exit(1);
+ }
+ }else{
+ p->fitlength[i]=p->fitlength[p->fitmap[i]];
+ p->fitmap[i]=p->fitmap[p->fitmap[i]];
+ }
+ }
+ }
+ }
+
+ write_codebook(stdout,name,c);
+ fprintf(stderr,"\r "
+ "\nDone.\n");
+ exit(0);
+}
diff --git a/vq/latticepare.c b/vq/latticepare.c
new file mode 100644
index 00000000..13e40a90
--- /dev/null
+++ b/vq/latticepare.c
@@ -0,0 +1,598 @@
+/********************************************************************
+ * *
+ * 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 for paring low hit count cells from lattice codebook
+ last mod: $Id: latticepare.c,v 1.4.4.1 2000/08/31 09:00:03 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 "../lib/scales.h"
+#include "bookutil.h"
+#include "vqgen.h"
+#include "vqsplit.h"
+#include "../lib/os.h"
+
+/* Lattice codebooks have two strengths: important fetaures that are
+ poorly modelled by global error minimization training (eg, strong
+ peaks) are not neglected 2) compact quantized representation.
+
+ A fully populated lattice codebook, however, swings point 1 too far
+ in the opposite direction; rare features need not be modelled quite
+ so religiously and as such, we waste bits unless we eliminate the
+ least common cells. The codebook rep supports unused cells, so we
+ need to tag such cells and build an auxiliary (non-thresh) search
+ mechanism to find the proper match quickly */
+
+/* two basic steps; first is pare the cell for which dispersal creates
+ the least additional error. This will naturally choose
+ low-population cells and cells that have not taken on points from
+ neighboring paring (but does not result in the lattice collapsing
+ inward and leaving low population ares totally unmodelled). After
+ paring has removed the desired number of cells, we need to build an
+ auxiliary search for each culled point */
+
+/* Although lattice books (due to threshhold-based matching) do not
+ actually use error to make cell selections (in fact, it need not
+ bear any relation), the 'secondbest' entry finder here is in fact
+ error/distance based, so latticepare is only useful on such books */
+
+/* command line:
+ latticepare latticebook.vqh input_data.vqd <target_cells>
+
+ produces a new output book on stdout
+*/
+
+static float _dist(int el,float *a, float *b){
+ int i;
+ float acc=0.;
+ for(i=0;i<el;i++){
+ float val=(a[i]-b[i]);
+ acc+=val*val;
+ }
+ return(acc);
+}
+
+static float *pointlist;
+static long points=0;
+
+void add_vector(codebook *b,float *vec,long n){
+ int dim=b->dim,i,j;
+ int step=n/dim;
+ for(i=0;i<step;i++){
+ for(j=i;j<n;j+=step){
+ pointlist[points++]=vec[j];
+ }
+ }
+}
+
+static int bestm(codebook *b,float *vec){
+ encode_aux_threshmatch *tt=b->c->thresh_tree;
+ int dim=b->dim;
+ int i,k,o;
+ int best=0;
+
+ /* what would be the closest match if the codebook was fully
+ populated? */
+
+ for(k=0,o=dim-1;k<dim;k++,o--){
+ int i;
+ for(i=0;i<tt->threshvals-1;i++)
+ if(vec[o]<tt->quantthresh[i])break;
+ best=(best*tt->quantvals)+tt->quantmap[i];
+ }
+ return(best);
+}
+
+static int closest(codebook *b,float *vec,int current){
+ encode_aux_threshmatch *tt=b->c->thresh_tree;
+ int dim=b->dim;
+ int i,k,o;
+
+ float bestmetric=0;
+ int bestentry=-1;
+ int best=bestm(b,vec);
+
+ if(current<0 && b->c->lengthlist[best]>0)return best;
+
+ for(i=0;i<b->entries;i++){
+ if(b->c->lengthlist[i]>0 && i!=best && i!=current){
+ float thismetric=_dist(dim, vec, b->valuelist+i*dim);
+ if(bestentry==-1 || thismetric<bestmetric){
+ bestentry=i;
+ bestmetric=thismetric;
+ }
+ }
+ }
+
+ return(bestentry);
+}
+
+static float _heuristic(codebook *b,float *ppt,int secondbest){
+ float *secondcell=b->valuelist+secondbest*b->dim;
+ int best=bestm(b,ppt);
+ float *firstcell=b->valuelist+best*b->dim;
+ float error=_dist(b->dim,firstcell,secondcell);
+ float *zero=alloca(b->dim*sizeof(float));
+ float fromzero;
+
+ memset(zero,0,b->dim*sizeof(float));
+ fromzero=sqrt(_dist(b->dim,firstcell,zero));
+
+ return(error/fromzero);
+}
+
+static int longsort(const void *a, const void *b){
+ return **(long **)b-**(long **)a;
+}
+
+void usage(void){
+ fprintf(stderr,"Ogg/Vorbis lattice codebook paring utility\n\n"
+ "usage: latticepare book.vqh data.vqd <target_cells> <protected_cells> base\n"
+ "where <target_cells> is the desired number of final cells (or -1\n"
+ " for no change)\n"
+ " <protected_cells> is the number of highest-hit count cells\n"
+ " to protect from dispersal\n"
+ " base is the base name (not including .vqh) of the new\n"
+ " book\n\n");
+ exit(1);
+}
+
+int main(int argc,char *argv[]){
+ char *basename;
+ codebook *b=NULL;
+ int entries=0;
+ int dim=0;
+ long i,j,target=-1,protect=-1;
+ FILE *out=NULL;
+
+ int argnum=0;
+
+ argv++;
+ if(*argv==NULL){
+ usage();
+ exit(1);
+ }
+
+ while(*argv){
+ if(*argv[0]=='-'){
+
+ argv++;
+
+ }else{
+ switch (argnum++){
+ case 0:case 1:
+ {
+ /* yes, this is evil. However, it's very convenient to parse file
+ extentions */
+
+ /* input file. What kind? */
+ char *dot;
+ char *ext=NULL;
+ char *name=strdup(*argv++);
+ dot=strrchr(name,'.');
+ if(dot)
+ ext=dot+1;
+ else{
+ ext="";
+
+ }
+
+
+ /* codebook */
+ if(!strcmp(ext,"vqh")){
+
+ basename=strrchr(name,'/');
+ if(basename)
+ basename=strdup(basename)+1;
+ else
+ basename=strdup(name);
+ dot=strrchr(basename,'.');
+ if(dot)*dot='\0';
+
+ b=codebook_load(name);
+ dim=b->dim;
+ entries=b->entries;
+ }
+
+ /* data file; we do actually need to suck it into memory */
+ /* we're dealing with just one book, so we can de-interleave */
+ if(!strcmp(ext,"vqd") && !points){
+ int cols;
+ long lines=0;
+ char *line;
+ float *vec;
+ FILE *in=fopen(name,"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",name);
+ exit(1);
+ }
+
+ reset_next_value();
+ line=setup_line(in);
+ /* count cols before we start reading */
+ {
+ char *temp=line;
+ while(*temp==' ')temp++;
+ for(cols=0;*temp;cols++){
+ while(*temp>32)temp++;
+ while(*temp==' ')temp++;
+ }
+ }
+ vec=alloca(cols*sizeof(float));
+ /* count, then load, to avoid fragmenting the hell out of
+ memory */
+ while(line){
+ lines++;
+ 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);
+ }
+ if((lines&0xff)==0)spinnit("counting samples...",lines*cols);
+ line=setup_line(in);
+ }
+ pointlist=malloc((cols*lines+entries*dim)*sizeof(float));
+
+ rewind(in);
+ line=setup_line(in);
+ while(line){
+ lines--;
+ 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);
+ }
+ /* deinterleave, add to heap */
+ add_vector(b,vec,cols);
+ if((lines&0xff)==0)spinnit("loading samples...",lines*cols);
+
+ line=setup_line(in);
+ }
+ fclose(in);
+ }
+ }
+ break;
+ case 2:
+ target=atol(*argv++);
+ if(target==0)target=entries;
+ break;
+ case 3:
+ protect=atol(*argv++);
+ break;
+ case 4:
+ {
+ char *buff=alloca(strlen(*argv)+5);
+ sprintf(buff,"%s.vqh",*argv);
+ basename=*argv++;
+
+ out=fopen(buff,"w");
+ if(!out){
+ fprintf(stderr,"unable ot open %s for output",buff);
+ exit(1);
+ }
+ }
+ break;
+ default:
+ usage();
+ }
+ }
+ }
+ if(!entries || !points || !out)usage();
+ if(target==-1)usage();
+
+ /* add guard points */
+ for(i=0;i<entries;i++)
+ for(j=0;j<dim;j++)
+ pointlist[points++]=b->valuelist[i*dim+j];
+
+ points/=dim;
+
+ /* set up auxiliary vectors for error tracking */
+ {
+ encode_aux_nearestmatch *nt=NULL;
+ long pointssofar=0;
+ long *pointindex;
+ long indexedpoints=0;
+ long *entryindex;
+ long *reventry;
+ long *membership=malloc(points*sizeof(long));
+ long *firsthead=malloc(entries*sizeof(long));
+ long *secondary=malloc(points*sizeof(long));
+ long *secondhead=malloc(entries*sizeof(long));
+
+ long *cellcount=calloc(entries,sizeof(long));
+ long *cellcount2=calloc(entries,sizeof(long));
+ float *cellerror=calloc(entries,sizeof(float));
+ float *cellerrormax=calloc(entries,sizeof(float));
+ long cellsleft=entries;
+ for(i=0;i<points;i++)membership[i]=-1;
+ for(i=0;i<entries;i++)firsthead[i]=-1;
+ for(i=0;i<points;i++)secondary[i]=-1;
+ for(i=0;i<entries;i++)secondhead[i]=-1;
+
+ for(i=0;i<points;i++){
+ /* assign vectors to the nearest cell. Also keep track of second
+ nearest for error statistics */
+ float *ppt=pointlist+i*dim;
+ int firstentry=closest(b,ppt,-1);
+ int secondentry=closest(b,ppt,firstentry);
+ float firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt);
+ float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt);
+
+ if(!(i&0xff))spinnit("initializing... ",points-i);
+
+ membership[i]=firsthead[firstentry];
+ firsthead[firstentry]=i;
+ secondary[i]=secondhead[secondentry];
+ secondhead[secondentry]=i;
+
+ if(i<points-entries){
+ cellerror[firstentry]+=secondmetric-firstmetric;
+ cellerrormax[firstentry]=max(cellerrormax[firstentry],
+ _heuristic(b,ppt,secondentry));
+ cellcount[firstentry]++;
+ cellcount2[secondentry]++;
+ }
+ }
+
+ /* which cells are most heavily populated? Protect as many from
+ dispersal as the user has requested */
+ {
+ long **countindex=calloc(entries,sizeof(long *));
+ for(i=0;i<entries;i++)countindex[i]=cellcount+i;
+ qsort(countindex,entries,sizeof(long *),longsort);
+ for(i=0;i<protect;i++){
+ int ptr=countindex[i]-cellcount;
+ cellerrormax[ptr]=9e50;
+ }
+ }
+
+ {
+ fprintf(stderr,"\r");
+ for(i=0;i<entries;i++){
+ /* decompose index */
+ int entry=i;
+ for(j=0;j<dim;j++){
+ fprintf(stderr,"%d:",entry%b->c->thresh_tree->quantvals);
+ entry/=b->c->thresh_tree->quantvals;
+ }
+
+ fprintf(stderr,":%ld/%ld, ",cellcount[i],cellcount2[i]);
+ }
+ fprintf(stderr,"\n");
+ }
+
+ /* do the automatic cull request */
+ while(cellsleft>target){
+ int bestcell=-1;
+ float besterror=0;
+ float besterror2=0;
+ long head=-1;
+ char spinbuf[80];
+ sprintf(spinbuf,"cells left to eliminate: %ld : ",cellsleft-target);
+
+ /* find the cell with lowest removal impact */
+ for(i=0;i<entries;i++){
+ if(b->c->lengthlist[i]>0){
+ if(bestcell==-1 || cellerrormax[i]<=besterror2){
+ if(bestcell==-1 || cellerrormax[i]<besterror2 ||
+ besterror>cellerror[i]){
+ besterror=cellerror[i];
+ besterror2=cellerrormax[i];
+ bestcell=i;
+ }
+ }
+ }
+ }
+
+ fprintf(stderr,"\reliminating cell %d \n"
+ " dispersal error of %g max/%g total (%ld hits)\n",
+ bestcell,besterror2,besterror,cellcount[bestcell]);
+
+ /* disperse it. move each point out, adding it (properly) to
+ the second best */
+ b->c->lengthlist[bestcell]=0;
+ head=firsthead[bestcell];
+ firsthead[bestcell]=-1;
+ while(head!=-1){
+ /* head is a point number */
+ float *ppt=pointlist+head*dim;
+ int firstentry=closest(b,ppt,-1);
+ int secondentry=closest(b,ppt,firstentry);
+ float firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt);
+ float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt);
+ long next=membership[head];
+
+ if(head<points-entries){
+ cellcount[firstentry]++;
+ cellcount[bestcell]--;
+ cellerror[firstentry]+=secondmetric-firstmetric;
+ cellerrormax[firstentry]=max(cellerrormax[firstentry],
+ _heuristic(b,ppt,secondentry));
+ }
+
+ membership[head]=firsthead[firstentry];
+ firsthead[firstentry]=head;
+ head=next;
+ if(cellcount[bestcell]%128==0)
+ spinnit(spinbuf,cellcount[bestcell]+cellcount2[bestcell]);
+
+ }
+
+ /* now see that all points that had the dispersed cell as second
+ choice have second choice reassigned */
+ head=secondhead[bestcell];
+ secondhead[bestcell]=-1;
+ while(head!=-1){
+ float *ppt=pointlist+head*dim;
+ /* who are we assigned to now? */
+ int firstentry=closest(b,ppt,-1);
+ /* what is the new second closest match? */
+ int secondentry=closest(b,ppt,firstentry);
+ /* old second closest is the cell being disbanded */
+ float oldsecondmetric=_dist(dim,b->valuelist+dim*bestcell,ppt);
+ /* new second closest error */
+ float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt);
+ long next=secondary[head];
+
+ if(head<points-entries){
+ cellcount2[secondentry]++;
+ cellcount2[bestcell]--;
+ cellerror[firstentry]+=secondmetric-oldsecondmetric;
+ cellerrormax[firstentry]=max(cellerrormax[firstentry],
+ _heuristic(b,ppt,secondentry));
+ }
+
+ secondary[head]=secondhead[secondentry];
+ secondhead[secondentry]=head;
+ head=next;
+
+ if(cellcount2[bestcell]%128==0)
+ spinnit(spinbuf,cellcount2[bestcell]);
+ }
+
+ cellsleft--;
+ }
+
+ /* paring is over. Build decision trees using points that now fall
+ through the thresh matcher. */
+ /* we don't free membership; we flatten it in order to use in lp_split */
+
+ for(i=0;i<entries;i++){
+ long head=firsthead[i];
+ spinnit("rearranging membership cache... ",entries-i);
+ while(head!=-1){
+ long next=membership[head];
+ membership[head]=i;
+ head=next;
+ }
+ }
+
+ free(secondhead);
+ free(firsthead);
+ free(cellerror);
+ free(cellerrormax);
+ free(secondary);
+
+ pointindex=malloc(points*sizeof(long));
+ /* make a point index of fall-through points */
+ for(i=0;i<points;i++){
+ int best=_best(b,pointlist+i*dim,1);
+ if(best==-1)
+ pointindex[indexedpoints++]=i;
+ spinnit("finding orphaned points... ",points-i);
+ }
+
+ /* make an entry index */
+ entryindex=malloc(entries*sizeof(long));
+ target=0;
+ for(i=0;i<entries;i++){
+ if(b->c->lengthlist[i]>0)
+ entryindex[target++]=i;
+ }
+
+ /* make working space for a reverse entry index */
+ reventry=malloc(entries*sizeof(long));
+
+ /* do the split */
+ nt=b->c->nearest_tree=
+ calloc(1,sizeof(encode_aux_nearestmatch));
+
+ nt->alloc=4096;
+ nt->ptr0=malloc(sizeof(long)*nt->alloc);
+ nt->ptr1=malloc(sizeof(long)*nt->alloc);
+ nt->p=malloc(sizeof(long)*nt->alloc);
+ nt->q=malloc(sizeof(long)*nt->alloc);
+ nt->aux=0;
+
+ fprintf(stderr,"Leaves added: %d \n",
+ lp_split(pointlist,points,
+ b,entryindex,target,
+ pointindex,indexedpoints,
+ membership,reventry,
+ 0,&pointssofar));
+ free(membership);
+ free(reventry);
+ free(pointindex);
+
+ /* hack alert. I should just change the damned splitter and
+ codebook writer */
+ for(i=0;i<nt->aux;i++)nt->p[i]*=dim;
+ for(i=0;i<nt->aux;i++)nt->q[i]*=dim;
+
+ /* recount hits. Build new lengthlist. reuse entryindex storage */
+ for(i=0;i<entries;i++)entryindex[i]=1;
+ for(i=0;i<points-entries;i++){
+ int best=_best(b,pointlist+i*dim,1);
+ float *a=pointlist+i*dim;
+ if(!(i&0xff))spinnit("counting hits...",i);
+ if(best==-1){
+ fprintf(stderr,"\nINTERNAL ERROR; a point count not be matched to a\n"
+ "codebook entry. The new decision tree is broken.\n");
+ exit(1);
+ }
+ entryindex[best]++;
+ }
+ for(i=0;i<nt->aux;i++)nt->p[i]/=dim;
+ for(i=0;i<nt->aux;i++)nt->q[i]/=dim;
+
+ /* the lengthlist builder doesn't actually deal with 0 hit entries.
+ So, we pack the 'sparse' hit list into a dense list, then unpack
+ the lengths after the build */
+ {
+ int upper=0;
+ long *lengthlist=calloc(entries,sizeof(long));
+ for(i=0;i<entries;i++){
+ if(b->c->lengthlist[i]>0)
+ entryindex[upper++]=entryindex[i];
+ else{
+ if(entryindex[i]>1){
+ fprintf(stderr,"\nINTERNAL ERROR; _best matched to unused entry\n");
+ exit(1);
+ }
+ }
+ }
+
+ /* sanity check */
+ if(upper != target){
+ fprintf(stderr,"\nINTERNAL ERROR; packed the wrong number of entries\n");
+ exit(1);
+ }
+
+ build_tree_from_lengths(upper,entryindex,lengthlist);
+
+ upper=0;
+ for(i=0;i<entries;i++){
+ if(b->c->lengthlist[i]>0)
+ b->c->lengthlist[i]=lengthlist[upper++];
+ }
+
+ }
+ }
+ /* we're done. write it out. */
+ write_codebook(out,basename,b->c);
+
+ fprintf(stderr,"\r \nDone.\n");
+ return(0);
+}
+
+
+
+
diff --git a/vq/latticetune.c b/vq/latticetune.c
new file mode 100644
index 00000000..72f91142
--- /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.2.2.1 2000/08/31 09:00:03 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;
+ float *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(float)*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/lspdata.c b/vq/lspdata.c
new file mode 100644
index 00000000..3ead7d4b
--- /dev/null
+++ b/vq/lspdata.c
@@ -0,0 +1,160 @@
+/********************************************************************
+ * *
+ * 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: metrics and quantization code for LSP VQ codebooks
+ last mod: $Id: lspdata.c,v 1.12.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include "vqgen.h"
+#include "vqext.h"
+#include "../lib/sharedbook.h"
+
+char *vqext_booktype="LSPdata";
+quant_meta q={0,0,0,1}; /* set sequence data */
+int vqext_aux=1;
+
+float global_maxdel=M_PI;
+float global_mindel=M_PI;
+#if 0
+void vqext_quantize(vqgen *v,quant_meta *q){
+ float delta,mindel;
+ float maxquant=((1<<q->quant)-1);
+ int j,k;
+
+ /* first find the basic delta amount from the maximum span to be
+ encoded. Loosen the delta slightly to allow for additional error
+ during sequence quantization */
+
+ delta=(global_maxdel-global_mindel)/((1<<q->quant)-1.5);
+
+ q->min=_float32_pack(global_mindel);
+ q->delta=_float32_pack(delta);
+
+ mindel=_float32_unpack(q->min);
+ delta=_float32_unpack(q->delta);
+
+ for(j=0;j<v->entries;j++){
+ float last=0;
+ for(k=0;k<v->elements;k++){
+ float val=_now(v,j)[k];
+ float now=rint((val-last-mindel)/delta);
+
+ _now(v,j)[k]=now;
+ if(now<0){
+ /* be paranoid; this should be impossible */
+ fprintf(stderr,"fault; quantized value<0\n");
+ exit(1);
+ }
+
+ if(now>maxquant){
+ /* be paranoid; this should be impossible */
+ fprintf(stderr,"fault; quantized value>max\n");
+ exit(1);
+ }
+ last=(now*delta)+mindel+last;
+ }
+ }
+
+}
+#else
+void vqext_quantize(vqgen *v,quant_meta *q){
+ vqgen_quantize(v,q);
+}
+#endif
+
+float *weight=NULL;
+#if 0
+/* LSP training metric. We weight error proportional to distance
+ *between* LSP vector values. The idea of this metric is not to set
+ final cells, but get the midpoint spacing into a form conducive to
+ what we want, which is weighting toward preserving narrower
+ features. */
+
+#define FUDGE (global_maxdel-weight[i])
+
+float *vqext_weight(vqgen *v,float *p){
+ int i;
+ int el=v->elements;
+ float lastp=0.;
+ for(i=0;i<el;i++){
+ float predist=(p[i]-lastp);
+ float postdist=(p[i+1]-p[i]);
+ weight[i]=(predist<postdist?predist:postdist);
+ lastp=p[i];
+ }
+ return p;
+}
+#else
+#define FUDGE 1.
+float *vqext_weight(vqgen *v,float *p){
+ return p;
+}
+#endif
+
+ /* candidate,actual */
+float vqext_metric(vqgen *v,float *e, float *p){
+ int i;
+ int el=v->elements;
+ float acc=0.;
+ for(i=0;i<el;i++){
+ float val=(p[i]-e[i])*FUDGE;
+ acc+=val*val;
+ }
+ return sqrt(acc/v->elements);
+}
+
+/* Data files are line-vectors, starting with zero. If we want to
+ train on a subvector starting in the middle, we need to adjust the
+ data as if it was starting at zero. we also need to add the 'aux'
+ value, which is an extra point at the end so we have leading and
+ trailing space */
+
+/* assume vqext_aux==1 */
+void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
+ float *a=alloca(sizeof(float)*(dim+1)); /* +aux */
+ float base=0;
+ int i;
+
+ if(start>0)base=b[start-1];
+ for(i=0;i<dim;i++)a[i]=b[i+start]-base;
+ if(start+dim+1>cols) /* +aux */
+ a[i]=a[i-1];
+ else
+ a[i]=b[i+start]-base;
+
+ vqgen_addpoint(v,a,a+dim);
+}
+
+/* we just need to calc the global_maxdel from the training set */
+void vqext_preprocess(vqgen *v){
+ long j,k;
+
+ global_maxdel=0.;
+ global_mindel=M_PI;
+ for(j=0;j<v->points;j++){
+ float last=0.;
+ for(k=0;k<v->elements+v->aux;k++){
+ float p=_point(v,j)[k];
+ if(p-last>global_maxdel)global_maxdel=p-last;
+ if(p-last<global_mindel)global_mindel=p-last;
+ last=p;
+ }
+ }
+
+ weight=malloc(sizeof(float)*v->elements);
+}
+
diff --git a/vq/metrics.c b/vq/metrics.c
new file mode 100644
index 00000000..11fd7569
--- /dev/null
+++ b/vq/metrics.c
@@ -0,0 +1,298 @@
+/********************************************************************
+ * *
+ * 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: function calls to collect codebook metrics
+ last mod: $Id: metrics.c,v 1.8.6.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include "vorbis/codebook.h"
+#include "../lib/sharedbook.h"
+#include "bookutil.h"
+
+/* collect the following metrics:
+
+ mean and mean squared amplitude
+ mean and mean squared error
+ mean and mean squared error (per sample) by entry
+ worst case fit by entry
+ entry cell size
+ hits by entry
+ total bits
+ total samples
+ (average bits per sample)*/
+
+
+/* set up metrics */
+
+float meanamplitude_acc=0.;
+float meanamplitudesq_acc=0.;
+float meanerror_acc=0.;
+float meanerrorsq_acc=0.;
+
+float **histogram=NULL;
+float **histogram_error=NULL;
+float **histogram_errorsq=NULL;
+float **histogram_hi=NULL;
+float **histogram_lo=NULL;
+float bits=0.;
+float count=0.;
+
+static float *_now(codebook *c, int i){
+ return c->valuelist+i*c->c->dim;
+}
+
+int books=0;
+
+void process_preprocess(codebook **bs,char *basename){
+ int i;
+ while(bs[books])books++;
+
+ if(books){
+ histogram=calloc(books,sizeof(float *));
+ histogram_error=calloc(books,sizeof(float *));
+ histogram_errorsq=calloc(books,sizeof(float *));
+ histogram_hi=calloc(books,sizeof(float *));
+ histogram_lo=calloc(books,sizeof(float *));
+ }else{
+ fprintf(stderr,"Specify at least one codebook\n");
+ exit(1);
+ }
+
+ for(i=0;i<books;i++){
+ codebook *b=bs[i];
+ histogram[i]=calloc(b->entries,sizeof(float));
+ histogram_error[i]=calloc(b->entries*b->dim,sizeof(float));
+ histogram_errorsq[i]=calloc(b->entries*b->dim,sizeof(float));
+ histogram_hi[i]=calloc(b->entries*b->dim,sizeof(float));
+ histogram_lo[i]=calloc(b->entries*b->dim,sizeof(float));
+ }
+}
+
+static float _dist(int el,float *a, float *b){
+ int i;
+ float acc=0.;
+ for(i=0;i<el;i++){
+ float val=(a[i]-b[i]);
+ acc+=val*val;
+ }
+ return acc;
+}
+
+void cell_spacing(codebook *c){
+ int j,k;
+ float min=-1,max=-1,mean=0.,meansq=0.;
+ long total=0;
+
+ /* minimum, maximum, mean, ms cell spacing */
+ for(j=0;j<c->c->entries;j++){
+ if(c->c->lengthlist[j]>0){
+ float localmin=-1.;
+ for(k=0;k<c->c->entries;k++){
+ if(c->c->lengthlist[k]>0){
+ float this=_dist(c->c->dim,_now(c,j),_now(c,k));
+ if(j!=k &&
+ (localmin==-1 || this<localmin))
+ localmin=this;
+ }
+ }
+
+ if(min==-1 || localmin<min)min=localmin;
+ if(max==-1 || localmin>max)max=localmin;
+ mean+=sqrt(localmin);
+ meansq+=localmin;
+ total++;
+ }
+ }
+
+ fprintf(stderr,"\tminimum cell spacing (closest side): %g\n",sqrt(min));
+ fprintf(stderr,"\tmaximum cell spacing (closest side): %g\n",sqrt(max));
+ fprintf(stderr,"\tmean closest side spacing: %g\n",mean/total);
+ fprintf(stderr,"\tmean sq closest side spacing: %g\n",sqrt(meansq/total));
+}
+
+void process_postprocess(codebook **bs,char *basename){
+ int i,k,book;
+ char *buffer=alloca(strlen(basename)+80);
+
+ fprintf(stderr,"Done. Processed %ld data points:\n\n",
+ (long)count);
+
+ fprintf(stderr,"Global statistics:******************\n\n");
+
+ fprintf(stderr,"\ttotal samples: %ld\n",(long)count);
+ fprintf(stderr,"\ttotal bits required to code: %ld\n",(long)bits);
+ fprintf(stderr,"\taverage bits per sample: %g\n\n",bits/count);
+
+ fprintf(stderr,"\tmean sample amplitude: %g\n",
+ meanamplitude_acc/count);
+ fprintf(stderr,"\tmean squared sample amplitude: %g\n\n",
+ sqrt(meanamplitudesq_acc/count));
+
+ fprintf(stderr,"\tmean code error: %g\n",
+ meanerror_acc/count);
+ fprintf(stderr,"\tmean squared code error: %g\n\n",
+ sqrt(meanerrorsq_acc/count));
+
+ for(book=0;book<books;book++){
+ FILE *out;
+ codebook *b=bs[book];
+ int n=b->c->entries;
+ int dim=b->c->dim;
+
+ fprintf(stderr,"Book %d statistics:------------------\n",book);
+
+ cell_spacing(b);
+
+ sprintf(buffer,"%s-%d-mse.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ sqrt((histogram_errorsq[book]+i*dim)[k]/histogram[book][i]));
+ }
+ }
+ fclose(out);
+
+ sprintf(buffer,"%s-%d-me.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ (histogram_error[book]+i*dim)[k]/histogram[book][i]);
+ }
+ }
+ fclose(out);
+
+ sprintf(buffer,"%s-%d-worst.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ (b->valuelist+i*dim)[k]+(histogram_lo[book]+i*dim)[k],
+ (b->valuelist+i*dim)[k]+(histogram_hi[book]+i*dim)[k]);
+ }
+ }
+ fclose(out);
+ }
+}
+
+float process_one(codebook *b,int book,float *a,int dim,int step,int addmul,
+ float base){
+ int j,entry;
+ float amplitude=0.;
+
+ if(book==0){
+ float last=base;
+ for(j=0;j<dim;j++){
+ amplitude=a[j*step]-(b->c->q_sequencep?last:0);
+ meanamplitude_acc+=fabs(amplitude);
+ meanamplitudesq_acc+=amplitude*amplitude;
+ count++;
+ last=a[j*step];
+ }
+ }
+
+ if(b->c->q_sequencep){
+ float temp;
+ for(j=0;j<dim;j++){
+ temp=a[j*step];
+ a[j*step]-=base;
+ }
+ base=temp;
+ }
+
+ entry=vorbis_book_besterror(b,a,step,addmul);
+
+ if(entry==-1){
+ fprintf(stderr,"Internal error: _best returned -1.\n");
+ exit(1);
+ }
+
+ histogram[book][entry]++;
+ bits+=vorbis_book_codelen(b,entry);
+
+ for(j=0;j<dim;j++){
+ float error=a[j*step];
+
+ if(book==books-1){
+ meanerror_acc+=fabs(error);
+ meanerrorsq_acc+=error*error;
+ }
+ histogram_errorsq[book][entry*dim+j]+=error*error;
+ histogram_error[book][entry*dim+j]+=fabs(error);
+ if(histogram[book][entry]==0 || histogram_hi[book][entry*dim+j]<error)
+ histogram_hi[book][entry*dim+j]=error;
+ if(histogram[book][entry]==0 || histogram_lo[book][entry*dim+j]>error)
+ histogram_lo[book][entry*dim+j]=error;
+ }
+ return base;
+}
+
+
+void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){
+ int bi;
+ int i;
+
+ for(bi=0;bi<books;bi++){
+ codebook *b=bs[bi];
+ int dim=b->dim;
+ float base=0.;
+
+ if(inter){
+ for(i=0;i<n/dim;i++)
+ base=process_one(b,bi,a+i,dim,n/dim,addmul[bi],base);
+ }else{
+ for(i=0;i<=n-dim;i+=dim)
+ base=process_one(b,bi,a+i,dim,1,addmul[bi],base);
+ }
+ }
+
+ if((long)(count)%100)spinnit("working.... samples: ",count);
+}
+
+void process_usage(void){
+ fprintf(stderr,
+ "usage: vqmetrics [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n"
+ " datafile.vqd [datafile.vqd]...\n\n"
+ " data can be taken on stdin. -i indicates interleaved coding.\n"
+ " Output goes to output files:\n"
+ " basename-me.m: gnuplot: mean error by entry value\n"
+ " basename-mse.m: gnuplot: mean square error by entry value\n"
+ " basename-worst.m: gnuplot: worst error by entry value\n"
+ " basename-distance.m: gnuplot file showing distance probability\n"
+ "\n");
+
+}
diff --git a/vq/residuedata.c b/vq/residuedata.c
new file mode 100644
index 00000000..26b0fee5
--- /dev/null
+++ b/vq/residuedata.c
@@ -0,0 +1,162 @@
+/********************************************************************
+ * *
+ * 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: metrics and quantization code for residue VQ codebooks
+ last mod: $Id: residuedata.c,v 1.3.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include "vqgen.h"
+#include "bookutil.h"
+#include "../lib/sharedbook.h"
+#include "../lib/scales.h"
+#include "vqext.h"
+
+float scalequant=3.;
+char *vqext_booktype="RESdata";
+quant_meta q={0,0,0,0}; /* set sequence data */
+int vqext_aux=0;
+
+static float *quant_save=NULL;
+
+float *vqext_weight(vqgen *v,float *p){
+ return p;
+}
+
+/* quantize aligned on unit boundaries. Because our grid is likely
+ very coarse, play 'shuffle the blocks'; don't allow multiple
+ entries to fill the same spot as is nearly certain to happen. */
+
+void vqext_quantize(vqgen *v,quant_meta *q){
+ int j,k;
+ long dim=v->elements;
+ long n=v->entries;
+ float max=-1;
+ float *test=alloca(sizeof(float)*dim);
+ int moved=0;
+
+
+ /* allow movement only to unoccupied coordinates on the coarse grid */
+ for(j=0;j<n;j++){
+ for(k=0;k<dim;k++){
+ float val=_now(v,j)[k];
+ float norm=rint(fabs(val)/scalequant);
+ if(norm>max)max=norm;
+ test[k]=norm;
+ }
+
+ /* allow move only if unoccupied */
+ if(quant_save){
+ for(k=0;k<n;k++)
+ if(j!=k && memcmp(test,quant_save+dim*k,dim*sizeof(float))==0)
+ break;
+ if(k==n){
+ if(memcmp(test,quant_save+dim*j,dim*sizeof(float)))
+ moved++;
+ memcpy(quant_save+dim*j,test,sizeof(float)*dim);
+ }
+ }else{
+ memcpy(_now(v,j),test,sizeof(float)*dim);
+ }
+ }
+
+ /* unlike the other trainers, we fill in our quantization
+ information (as we know granularity beforehand and don't need to
+ maximize it) */
+
+ q->min=_float32_pack(0.);
+ q->delta=_float32_pack(scalequant);
+ q->quant=_ilog(max);
+
+ if(quant_save){
+ memcpy(_now(v,0),quant_save,sizeof(float)*dim*n);
+ fprintf(stderr,"cells shifted this iteration: %d\n",moved);
+ }
+}
+
+ /* candidate,actual */
+float vqext_metric(vqgen *v,float *e, float *p){
+ int i;
+ float acc=0.;
+ for(i=0;i<v->elements;i++){
+ float val=p[i]-e[i];
+ acc+=val*val;
+ }
+ return sqrt(acc);
+}
+
+/* We don't interleave here; we assume that the interleave is provided
+ for us by residuesplit in vorbis/huff/ */
+void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
+ vqgen_addpoint(v,b+start,NULL);
+}
+
+/* need to reseed because of the coarse quantization we tend to use on
+ residuals (which causes lots & lots of dupes) */
+void vqext_preprocess(vqgen *v){
+ long i,j,k,l;
+ float *test=alloca(sizeof(float)*v->elements);
+ scalequant=q.quant;
+
+ vqext_quantize(v,&q);
+ vqgen_unquantize(v,&q);
+
+ /* if there are any dupes, reseed */
+ for(k=0;k<v->entries;k++){
+ for(l=0;l<k;l++){
+ if(memcmp(_now(v,k),_now(v,l),sizeof(float)*v->elements)==0)
+ break;
+ }
+ if(l<k)break;
+ }
+
+ if(k<v->entries){
+ fprintf(stderr,"reseeding with quantization....\n");
+
+ /* seed the inputs to input points, but points on unit boundaries,
+ ignoring quantbits for now, making sure each seed is unique */
+
+ for(i=0,j=0;i<v->points && j<v->entries;i++){
+ for(k=0;k<v->elements;k++){
+ float val=_point(v,i)[k];
+ test[k]=rint(val/scalequant)*scalequant;
+ }
+
+ for(l=0;l<j;l++){
+ for(k=0;k<v->elements;k++)
+ if(test[k]!=_now(v,l)[k])
+ break;
+ if(k==v->elements)break;
+ }
+ if(l==j){
+ memcpy(_now(v,j),test,v->elements*sizeof(float));
+ j++;
+ }
+ }
+
+ if(j<v->elements){
+ fprintf(stderr,"Not enough unique entries after prequantization\n");
+ exit(1);
+ }
+ }
+ vqext_quantize(v,&q);
+ quant_save=malloc(sizeof(float)*v->elements*v->entries);
+ memcpy(quant_save,_now(v,0),sizeof(float)*v->elements*v->entries);
+ vqgen_unquantize(v,&q);
+
+}
+
diff --git a/vq/residuesplit.c b/vq/residuesplit.c
new file mode 100644
index 00000000..6329a2ef
--- /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.4.2.1 2000/08/31 08:59:58 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(float *vec,int n,float *entropy){
+ int i,j=0;
+ float max=0.;
+ float 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(float *res,int n,float *ebound,float *mbound,int *subgrp,int parts, int subn){
+ long i,j;
+ float entropy[8];
+ int aux;
+
+ for(i=0;i<=n-subn;i+=subn){
+ float 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,float *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;
+ float *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(float)*parts);
+ mbound=malloc(sizeof(float)*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(float)*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);
+}
+
+
+
+
diff --git a/vq/run.c b/vq/run.c
new file mode 100644
index 00000000..0158e797
--- /dev/null
+++ b/vq/run.c
@@ -0,0 +1,217 @@
+/********************************************************************
+ * *
+ * 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 loading and operating on codebooks
+ last mod: $Id: run.c,v 1.10.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include "bookutil.h"
+
+/* command line:
+ utilname [-i] +|* input_book.vqh [+|* input_book.vqh]
+ input_data.vqd [input_data.vqd]
+
+ produces output data on stdout
+ (may also take input data from stdin)
+
+ */
+
+extern void process_preprocess(codebook **b,char *basename);
+extern void process_postprocess(codebook **b,char *basename);
+extern void process_vector(codebook **b,int *addmul, int inter,float *a,int n);
+extern void process_usage(void);
+
+int main(int argc,char *argv[]){
+ char *basename;
+ codebook **b=calloc(1,sizeof(codebook *));
+ int *addmul=calloc(1,sizeof(int));
+ int books=0;
+ int input=0;
+ int interleave=0;
+ int j;
+ int start=0;
+ int num=-1;
+ argv++;
+
+ if(*argv==NULL){
+ process_usage();
+ exit(1);
+ }
+
+ /* yes, this is evil. However, it's very convenient to parse file
+ extentions */
+
+ while(*argv){
+ if(*argv[0]=='-'){
+ /* option */
+ if(argv[0][1]=='s'){
+ /* subvector */
+ if(sscanf(argv[1],"%d,%d",&start,&num)!=2){
+ num= -1;
+ if(sscanf(argv[1],"%d",&start)!=1){
+ fprintf(stderr,"Syntax error using -s\n");
+ exit(1);
+ }
+ }
+ argv+=2;
+ }
+ if(argv[0][1]=='i'){
+ /* interleave */
+ interleave=1;
+ argv+=1;
+ }
+ }else{
+ /* input file. What kind? */
+ char *dot;
+ char *ext=NULL;
+ char *name=strdup(*argv++);
+ dot=strrchr(name,'.');
+ if(dot)
+ ext=dot+1;
+ else
+ ext="";
+
+ /* codebook */
+ if(!strcmp(ext,"vqh")){
+ int multp=0;
+ if(input){
+ fprintf(stderr,"specify all input data (.vqd) files following\n"
+ "codebook header (.vqh) files\n");
+ exit(1);
+ }
+ /* is it additive or multiplicative? */
+ if(name[0]=='*'){
+ multp=1;
+ name++;
+ }
+ if(name[0]=='+')name++;
+
+ basename=strrchr(name,'/');
+ if(basename)
+ basename=strdup(basename)+1;
+ else
+ basename=strdup(name);
+ dot=strrchr(basename,'.');
+ if(dot)*dot='\0';
+
+ b=realloc(b,sizeof(codebook *)*(books+2));
+ b[books]=codebook_load(name);
+ addmul=realloc(addmul,sizeof(int)*(books+1));
+ addmul[books++]=multp;
+ b[books]=NULL;
+ }
+
+ /* data file */
+ if(!strcmp(ext,"vqd")){
+ int cols;
+ long lines=0;
+ char *line;
+ float *vec;
+ FILE *in=fopen(name,"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",name);
+ exit(1);
+ }
+
+ if(!input){
+ process_preprocess(b,basename);
+ input++;
+ }
+
+ reset_next_value();
+ line=setup_line(in);
+ /* count cols before we start reading */
+ {
+ char *temp=line;
+ while(*temp==' ')temp++;
+ for(cols=0;*temp;cols++){
+ while(*temp>32)temp++;
+ while(*temp==' ')temp++;
+ }
+ }
+ vec=alloca(cols*sizeof(float));
+ while(line){
+ lines++;
+ 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);
+ }
+ /* ignores -s for now */
+ process_vector(b,addmul,interleave,vec,cols);
+
+ line=setup_line(in);
+ }
+ fclose(in);
+ }
+ }
+ }
+
+ /* take any data from stdin */
+ {
+ struct stat st;
+ if(fstat(STDIN_FILENO,&st)==-1){
+ fprintf(stderr,"Could not stat STDIN\n");
+ exit(1);
+ }
+ if((S_IFIFO|S_IFREG|S_IFSOCK)&st.st_mode){
+ int cols;
+ char *line;
+ long lines=0;
+ float *vec;
+ if(!input){
+ process_preprocess(b,basename);
+ input++;
+ }
+
+ line=setup_line(stdin);
+ /* count cols before we start reading */
+ {
+ char *temp=line;
+ while(*temp==' ')temp++;
+ for(cols=0;*temp;cols++){
+ while(*temp>32)temp++;
+ while(*temp==' ')temp++;
+ }
+ }
+ vec=alloca(cols*sizeof(float));
+ while(line){
+ lines++;
+ for(j=0;j<cols;j++)
+ if(get_line_value(stdin,vec+j)){
+ fprintf(stderr,"Too few columns on line %ld in data file\n",lines);
+ exit(1);
+ }
+ /* ignores -s for now */
+ process_vector(b,addmul,interleave,vec,cols);
+
+ line=setup_line(stdin);
+ }
+ }
+ }
+
+ process_postprocess(b,basename);
+
+ return 0;
+}
diff --git a/vq/train.c b/vq/train.c
new file mode 100644
index 00000000..833a12cb
--- /dev/null
+++ b/vq/train.c
@@ -0,0 +1,362 @@
+/********************************************************************
+ * *
+ * 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 training codebooks
+ last mod: $Id: train.c,v 1.18.6.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include <signal.h>
+#include "vqgen.h"
+#include "vqext.h"
+#include "bookutil.h"
+
+static char *rline(FILE *in,FILE *out,int pass){
+ while(1){
+ char *line=get_line(in);
+ if(line && line[0]=='#'){
+ if(pass)fprintf(out,"%s\n",line);
+ }else{
+ return(line);
+ }
+ }
+}
+
+/* command line:
+ trainvq vqfile [options] trainfile [trainfile]
+
+ options: -params entries,dim,quant
+ -subvector start[,num]
+ -error desired_error
+ -iterations iterations
+*/
+
+static void usage(void){
+ fprintf(stderr, "\nOggVorbis %s VQ codebook trainer\n\n"
+ "<foo>vqtrain vqfile [options] [datasetfile] [datasetfile]\n"
+ "options: -p[arams] <entries,dim,quant>\n"
+ " -s[ubvector] <start[,num]>\n"
+ " -e[rror] <desired_error>\n"
+ " -i[terations] <maxiterations>\n"
+ " -d[istance] quantization mesh spacing for density limitation\n"
+ " -b <dummy> eliminate cell size biasing; use normal LBG\n\n"
+ " -c <dummy> Use centroid (not median) midpoints\n"
+
+ "examples:\n"
+ " train a new codebook to 1%% tolerance on datafile 'foo':\n"
+ " xxxvqtrain book -p 256,6,8 -e .01 foo\n"
+ " (produces a trained set in book-0.vqi)\n\n"
+ " continue training 'book-0.vqi' (produces book-1.vqi):\n"
+ " xxxvqtrain book-0.vqi\n\n"
+ " add subvector from element 1 to <dimension> from files\n"
+ " data*.m to the training in progress, prodicing book-1.vqi:\n"
+ " xxxvqtrain book-0.vqi -s 1,1 data*.m\n\n",vqext_booktype);
+}
+
+int exiting=0;
+void setexit(int dummy){
+ fprintf(stderr,"\nexiting... please wait to finish this iteration\n");
+ exiting=1;
+}
+
+int main(int argc,char *argv[]){
+ vqgen v;
+
+ int entries=-1,dim=-1;
+ int start=0,num=-1;
+ float desired=.05,mindist=0.;
+ int iter=1000;
+ int biasp=1;
+ int centroid=0;
+
+ FILE *out=NULL;
+ char *line;
+ long i,j,k;
+ int init=0;
+ q.quant=-1;
+
+ argv++;
+ if(!*argv){
+ usage();
+ exit(0);
+ }
+
+ /* get the book name, a preexisting book to continue training */
+ {
+ FILE *in=NULL;
+ char *filename=alloca(strlen(*argv)+30),*ptr;
+
+ strcpy(filename,*argv);
+ in=fopen(filename,"r");
+ ptr=strrchr(filename,'-');
+ if(ptr){
+ int num;
+ ptr++;
+ num=atoi(ptr);
+ sprintf(ptr,"%d.vqi",num+1);
+ }else
+ strcat(filename,"-0.vqi");
+
+ out=fopen(filename,"w");
+ if(out==NULL){
+ fprintf(stderr,"Unable to open %s for writing\n",filename);
+ exit(1);
+ }
+
+ if(in){
+ /* we wish to suck in a preexisting book and continue to train it */
+ float a;
+
+ line=rline(in,out,1);
+ if(strcmp(line,vqext_booktype)){
+ fprintf(stderr,"wrong book type; %s!=%s\n",line,vqext_booktype);
+ exit(1);
+ }
+
+ line=rline(in,out,1);
+ if(sscanf(line,"%d %d %d",&entries,&dim,&vqext_aux)!=3){
+ fprintf(stderr,"Syntax error reading book file\n");
+ exit(1);
+ }
+
+ vqgen_init(&v,dim,vqext_aux,entries,mindist,
+ vqext_metric,vqext_weight,centroid);
+ init=1;
+
+ /* quant setup */
+ line=rline(in,out,1);
+ if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta,
+ &q.quant,&q.sequencep)!=4){
+ fprintf(stderr,"Syntax error reading book file\n");
+ exit(1);
+ }
+
+ /* quantized entries */
+ i=0;
+ for(j=0;j<entries;j++){
+ for(k=0;k<dim;k++){
+ line=rline(in,out,0);
+ sscanf(line,"%lf",&a);
+ v.entrylist[i++]=a;
+ }
+ }
+ vqgen_unquantize(&v,&q);
+
+ /* bias */
+ i=0;
+ for(j=0;j<entries;j++){
+ line=rline(in,out,0);
+ sscanf(line,"%lf",&a);
+ v.bias[i++]=a;
+ }
+
+ v.seeded=1;
+ {
+ float *b=alloca((dim+vqext_aux)*sizeof(float));
+ i=0;
+ while(1){
+ for(k=0;k<dim+vqext_aux;k++){
+ line=rline(in,out,0);
+ if(!line)break;
+ sscanf(line,"%lf",b+k);
+ }
+ if(feof(in))break;
+ vqgen_addpoint(&v,b,b+dim);
+ }
+ }
+
+ fclose(in);
+ }
+ }
+
+ /* get the rest... */
+ argv=argv++;
+ while(*argv){
+ if(argv[0][0]=='-'){
+ /* it's an option */
+ if(!argv[1]){
+ fprintf(stderr,"Option %s missing argument.\n",argv[0]);
+ exit(1);
+ }
+ switch(argv[0][1]){
+ case 'p':
+ if(sscanf(argv[1],"%d,%d,%d",&entries,&dim,&q.quant)!=3)
+ goto syner;
+ break;
+ case 's':
+ if(sscanf(argv[1],"%d,%d",&start,&num)!=2){
+ num= -1;
+ if(sscanf(argv[1],"%d",&start)!=1)
+ goto syner;
+ }
+ break;
+ case 'e':
+ if(sscanf(argv[1],"%lf",&desired)!=1)
+ goto syner;
+ break;
+ case 'd':
+ if(sscanf(argv[1],"%lf",&mindist)!=1)
+ goto syner;
+ if(init)v.mindist=mindist;
+ break;
+ case 'i':
+ if(sscanf(argv[1],"%d",&iter)!=1)
+ goto syner;
+ break;
+ case 'b':
+ biasp=0;
+ break;
+ case 'c':
+ centroid=1;
+ break;
+ default:
+ fprintf(stderr,"Unknown option %s\n",argv[0]);
+ exit(1);
+ }
+ argv+=2;
+ }else{
+ /* it's an input file */
+ char *file=strdup(*argv++);
+ FILE *in;
+ int cols=-1;
+
+ if(!init){
+ if(dim==-1 || entries==-1 || q.quant==-1){
+ fprintf(stderr,"-p required when training a new set\n");
+ exit(1);
+ }
+ vqgen_init(&v,dim,vqext_aux,entries,mindist,
+ vqext_metric,vqext_weight,centroid);
+ init=1;
+ }
+
+ in=fopen(file,"r");
+ if(in==NULL){
+ fprintf(stderr,"Could not open input file %s\n",file);
+ exit(1);
+ }
+ fprintf(out,"# training file entry: %s\n",file);
+
+ while((line=rline(in,out,0))){
+ if(cols==-1){
+ char *temp=line;
+ while(*temp==' ')temp++;
+ for(cols=0;*temp;cols++){
+ while(*temp>32)temp++;
+ while(*temp==' ')temp++;
+ }
+ }
+ {
+ int i;
+ float b[cols];
+ if(start+num*dim>cols){
+ fprintf(stderr,"ran out of columns reading %s\n",file);
+ exit(1);
+ }
+ while(*line==' ')line++;
+ for(i=0;i<cols;i++){
+
+ /* static length buffer bug workaround */
+ char *temp=line;
+ char old;
+ while(*temp>32)temp++;
+
+ old=temp[0];
+ temp[0]='\0';
+ b[i]=atof(line);
+ temp[0]=old;
+
+ while(*line>32)line++;
+ while(*line==' ')line++;
+ }
+ if(num<=0)num=(cols-start)/dim;
+ for(i=0;i<num;i++)
+ vqext_addpoint_adj(&v,b,start+i*dim,dim,cols,num);
+
+ }
+ }
+ fclose(in);
+ }
+ }
+
+ if(!init){
+ fprintf(stderr,"No input files!\n");
+ exit(1);
+ }
+
+ vqext_preprocess(&v);
+
+ /* train the book */
+ signal(SIGTERM,setexit);
+ signal(SIGINT,setexit);
+
+ for(i=0;i<iter && !exiting;i++){
+ float result;
+ if(i!=0){
+ vqgen_unquantize(&v,&q);
+ vqgen_cellmetric(&v);
+ }
+ result=vqgen_iterate(&v,biasp);
+ vqext_quantize(&v,&q);
+ if(result<desired)break;
+ }
+
+ /* save the book */
+
+ fprintf(out,"# OggVorbis VQ codebook trainer, intermediate file\n");
+ fprintf(out,"%s\n",vqext_booktype);
+ fprintf(out,"%d %d %d\n",entries,dim,vqext_aux);
+ fprintf(out,"%ld %ld %d %d\n",
+ q.min,q.delta,q.quant,q.sequencep);
+
+ /* quantized entries */
+ fprintf(out,"# quantized entries---\n");
+ i=0;
+ for(j=0;j<entries;j++)
+ for(k=0;k<dim;k++)
+ fprintf(out,"%d\n",(int)(rint(v.entrylist[i++])));
+
+ fprintf(out,"# biases---\n");
+ i=0;
+ for(j=0;j<entries;j++)
+ fprintf(out,"%f\n",v.bias[i++]);
+
+ /* we may have done the density limiting mesh trick; refetch the
+ training points from the temp file */
+
+ rewind(v.asciipoints);
+ fprintf(out,"# points---\n");
+ {
+ /* sloppy, no error handling */
+ long bytes;
+ char buff[4096];
+ while((bytes=fread(buff,1,4096,v.asciipoints)))
+ while(bytes)bytes-=fwrite(buff,1,bytes,out);
+ }
+
+ fclose(out);
+ fclose(v.asciipoints);
+
+ vqgen_unquantize(&v,&q);
+ vqgen_cellmetric(&v);
+ exit(0);
+
+ syner:
+ fprintf(stderr,"Syntax error in argument '%s'\n",*argv);
+ exit(1);
+}
diff --git a/vq/vqext.h b/vq/vqext.h
new file mode 100644
index 00000000..48c957d1
--- /dev/null
+++ b/vq/vqext.h
@@ -0,0 +1,35 @@
+/********************************************************************
+ * *
+ * 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: prototypes for extermal metrics specific to data type
+ last mod: $Id: vqext.h,v 1.9.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_VQEXT_
+#define _V_VQEXT_
+
+#include "vqgen.h"
+
+extern char *vqext_booktype;
+extern quant_meta q;
+extern int vqext_aux;
+
+extern float vqext_metric(vqgen *v,float *e, float *p);
+extern float *vqext_weight(vqgen *v,float *p);
+extern void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num);
+extern void vqext_preprocess(vqgen *v);
+extern void vqext_quantize(vqgen *v,quant_meta *);
+
+
+#endif
diff --git a/vq/vqgen.c b/vq/vqgen.c
new file mode 100644
index 00000000..f0709423
--- /dev/null
+++ b/vq/vqgen.c
@@ -0,0 +1,570 @@
+/********************************************************************
+ * *
+ * 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: train a VQ codebook
+ last mod: $Id: vqgen.c,v 1.33.4.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+/* This code is *not* part of libvorbis. It is used to generate
+ trained codebooks offline and then spit the results into a
+ pregenerated codebook that is compiled into libvorbis. It is an
+ expensive (but good) algorithm. Run it on big iron. */
+
+/* There are so many optimizations to explore in *both* stages that
+ considering the undertaking is almost withering. For now, we brute
+ force it all */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#include "vqgen.h"
+#include "bookutil.h"
+#include "../lib/sharedbook.h"
+
+/* Codebook generation happens in two steps:
+
+ 1) Train the codebook with data collected from the encoder: We use
+ one of a few error metrics (which represent the distance between a
+ given data point and a candidate point in the training set) to
+ divide the training set up into cells representing roughly equal
+ probability of occurring.
+
+ 2) Generate the codebook and auxiliary data from the trained data set
+*/
+
+/* Codebook training ****************************************************
+ *
+ * The basic idea here is that a VQ codebook is like an m-dimensional
+ * foam with n bubbles. The bubbles compete for space/volume and are
+ * 'pressurized' [biased] according to some metric. The basic alg
+ * iterates through allowing the bubbles to compete for space until
+ * they converge (if the damping is dome properly) on a steady-state
+ * solution. Individual input points, collected from libvorbis, are
+ * used to train the algorithm monte-carlo style. */
+
+/* internal helpers *****************************************************/
+#define vN(data,i) (data+v->elements*i)
+
+/* default metric; squared 'distance' from desired value. */
+float _dist(vqgen *v,float *a, float *b){
+ int i;
+ int el=v->elements;
+ float acc=0.;
+ for(i=0;i<el;i++){
+ float val=(a[i]-b[i]);
+ acc+=val*val;
+ }
+ return sqrt(acc);
+}
+
+float *_weight_null(vqgen *v,float *a){
+ return a;
+}
+
+/* *must* be beefed up. */
+void _vqgen_seed(vqgen *v){
+ long i;
+ for(i=0;i<v->entries;i++)
+ memcpy(_now(v,i),_point(v,i),sizeof(float)*v->elements);
+ v->seeded=1;
+}
+
+int directdsort(const void *a, const void *b){
+ float av=*((float *)a);
+ float bv=*((float *)b);
+ if(av>bv)return(-1);
+ return(1);
+}
+
+void vqgen_cellmetric(vqgen *v){
+ int j,k;
+ float min=-1.,max=-1.,mean=0.,acc=0.;
+ long dup=0,unused=0;
+ #ifdef NOISY
+ int i;
+ char buff[80];
+ float spacings[v->entries];
+ int count=0;
+ FILE *cells;
+ sprintf(buff,"cellspace%d.m",v->it);
+ cells=fopen(buff,"w");
+#endif
+
+ /* minimum, maximum, cell spacing */
+ for(j=0;j<v->entries;j++){
+ float localmin=-1.;
+
+ for(k=0;k<v->entries;k++){
+ if(j!=k){
+ float this=_dist(v,_now(v,j),_now(v,k));
+ if(this>0){
+ if(v->assigned[k] && (localmin==-1 || this<localmin))
+ localmin=this;
+ }else{
+ if(k<j){
+ dup++;
+ break;
+ }
+ }
+ }
+ }
+ if(k<v->entries)continue;
+
+ if(v->assigned[j]==0){
+ unused++;
+ continue;
+ }
+
+ localmin=v->max[j]+localmin/2; /* this gives us rough diameter */
+ if(min==-1 || localmin<min)min=localmin;
+ if(max==-1 || localmin>max)max=localmin;
+ mean+=localmin;
+ acc++;
+#ifdef NOISY
+ spacings[count++]=localmin;
+#endif
+ }
+
+ fprintf(stderr,"cell diameter: %.03g::%.03g::%.03g (%ld unused/%ld dup)\n",
+ min,mean/acc,max,unused,dup);
+
+#ifdef NOISY
+ qsort(spacings,count,sizeof(float),directdsort);
+ for(i=0;i<count;i++)
+ fprintf(cells,"%g\n",spacings[i]);
+ fclose(cells);
+#endif
+
+}
+
+/* External calls *******************************************************/
+
+/* We have two forms of quantization; in the first, each vector
+ element in the codebook entry is orthogonal. Residues would use this
+ quantization for example.
+
+ In the second, we have a sequence of monotonically increasing
+ values that we wish to quantize as deltas (to save space). We
+ still need to quantize so that absolute values are accurate. For
+ example, LSP quantizes all absolute values, but the book encodes
+ distance between values because each successive value is larger
+ than the preceeding value. Thus the desired quantibits apply to
+ the encoded (delta) values, not abs positions. This requires minor
+ additional encode-side trickery. */
+
+void vqgen_quantize(vqgen *v,quant_meta *q){
+
+ float maxdel;
+ float mindel;
+
+ float delta;
+ float maxquant=((1<<q->quant)-1);
+
+ int j,k;
+
+ mindel=maxdel=_now(v,0)[0];
+
+ for(j=0;j<v->entries;j++){
+ float last=0.;
+ for(k=0;k<v->elements;k++){
+ if(mindel>_now(v,j)[k]-last)mindel=_now(v,j)[k]-last;
+ if(maxdel<_now(v,j)[k]-last)maxdel=_now(v,j)[k]-last;
+ if(q->sequencep)last=_now(v,j)[k];
+ }
+ }
+
+
+ /* first find the basic delta amount from the maximum span to be
+ encoded. Loosen the delta slightly to allow for additional error
+ during sequence quantization */
+
+ delta=(maxdel-mindel)/((1<<q->quant)-1.5);
+
+ q->min=_float32_pack(mindel);
+ q->delta=_float32_pack(delta);
+
+ mindel=_float32_unpack(q->min);
+ delta=_float32_unpack(q->delta);
+
+ for(j=0;j<v->entries;j++){
+ float last=0;
+ for(k=0;k<v->elements;k++){
+ float val=_now(v,j)[k];
+ float now=rint((val-last-mindel)/delta);
+
+ _now(v,j)[k]=now;
+ if(now<0){
+ /* be paranoid; this should be impossible */
+ fprintf(stderr,"fault; quantized value<0\n");
+ exit(1);
+ }
+
+ if(now>maxquant){
+ /* be paranoid; this should be impossible */
+ fprintf(stderr,"fault; quantized value>max\n");
+ exit(1);
+ }
+ if(q->sequencep)last=(now*delta)+mindel+last;
+ }
+ }
+}
+
+/* much easier :-). Unlike in the codebook, we don't un-log log
+ scales; we just make sure they're properly offset. */
+void vqgen_unquantize(vqgen *v,quant_meta *q){
+ long j,k;
+ float mindel=_float32_unpack(q->min);
+ float delta=_float32_unpack(q->delta);
+
+ for(j=0;j<v->entries;j++){
+ float last=0.;
+ for(k=0;k<v->elements;k++){
+ float now=_now(v,j)[k];
+ now=fabs(now)*delta+last+mindel;
+ if(q->sequencep)last=now;
+ _now(v,j)[k]=now;
+ }
+ }
+}
+
+void vqgen_init(vqgen *v,int elements,int aux,int entries,float mindist,
+ float (*metric)(vqgen *,float *, float *),
+ float *(*weight)(vqgen *,float *),int centroid){
+ memset(v,0,sizeof(vqgen));
+
+ v->centroid=centroid;
+ v->elements=elements;
+ v->aux=aux;
+ v->mindist=mindist;
+ v->allocated=32768;
+ v->pointlist=malloc(v->allocated*(v->elements+v->aux)*sizeof(float));
+
+ v->entries=entries;
+ v->entrylist=malloc(v->entries*v->elements*sizeof(float));
+ v->assigned=malloc(v->entries*sizeof(long));
+ v->bias=calloc(v->entries,sizeof(float));
+ v->max=calloc(v->entries,sizeof(float));
+ if(metric)
+ v->metric_func=metric;
+ else
+ v->metric_func=_dist;
+ if(weight)
+ v->weight_func=weight;
+ else
+ v->weight_func=_weight_null;
+
+ v->asciipoints=tmpfile();
+
+}
+
+void vqgen_addpoint(vqgen *v, float *p,float *a){
+ int k;
+ for(k=0;k<v->elements;k++)
+ fprintf(v->asciipoints,"%.12g\n",p[k]);
+ for(k=0;k<v->aux;k++)
+ fprintf(v->asciipoints,"%.12g\n",a[k]);
+
+ if(v->points>=v->allocated){
+ v->allocated*=2;
+ v->pointlist=realloc(v->pointlist,v->allocated*(v->elements+v->aux)*
+ sizeof(float));
+ }
+
+ memcpy(_point(v,v->points),p,sizeof(float)*v->elements);
+ if(v->aux)memcpy(_point(v,v->points)+v->elements,a,sizeof(float)*v->aux);
+
+ /* quantize to the density mesh if it's selected */
+ if(v->mindist>0.){
+ /* quantize to the mesh */
+ for(k=0;k<v->elements+v->aux;k++)
+ _point(v,v->points)[k]=
+ rint(_point(v,v->points)[k]/v->mindist)*v->mindist;
+ }
+ v->points++;
+ if(!(v->points&0xff))spinnit("loading... ",v->points);
+}
+
+/* yes, not threadsafe. These utils aren't */
+static int sortit=0;
+static int sortsize=0;
+static int meshcomp(const void *a,const void *b){
+ if(((sortit++)&0xfff)==0)spinnit("sorting mesh...",sortit);
+ return(memcmp(a,b,sortsize));
+}
+
+void vqgen_sortmesh(vqgen *v){
+ sortit=0;
+ if(v->mindist>0.){
+ long i,march=1;
+
+ /* sort to make uniqueness detection trivial */
+ sortsize=(v->elements+v->aux)*sizeof(float);
+ qsort(v->pointlist,v->points,sortsize,meshcomp);
+
+ /* now march through and eliminate dupes */
+ for(i=1;i<v->points;i++){
+ if(memcmp(_point(v,i),_point(v,i-1),sortsize)){
+ /* a new, unique entry. march it down */
+ if(i>march)memcpy(_point(v,march),_point(v,i),sortsize);
+ march++;
+ }
+ spinnit("eliminating density... ",v->points-i);
+ }
+
+ /* we're done */
+ fprintf(stderr,"\r%ld training points remining out of %ld"
+ " after density mesh (%ld%%)\n",march,v->points,march*100/v->points);
+ v->points=march;
+
+ }
+ v->sorted=1;
+}
+
+float vqgen_iterate(vqgen *v,int biasp){
+ long i,j,k;
+
+ float fdesired;
+ long desired;
+ long desired2;
+
+ float asserror=0.;
+ float meterror=0.;
+ float *new;
+ float *new2;
+ long *nearcount;
+ float *nearbias;
+ #ifdef NOISY
+ char buff[80];
+ FILE *assig;
+ FILE *bias;
+ FILE *cells;
+ sprintf(buff,"cells%d.m",v->it);
+ cells=fopen(buff,"w");
+ sprintf(buff,"assig%d.m",v->it);
+ assig=fopen(buff,"w");
+ sprintf(buff,"bias%d.m",v->it);
+ bias=fopen(buff,"w");
+ #endif
+
+
+ if(v->entries<2){
+ fprintf(stderr,"generation requires at least two entries\n");
+ exit(1);
+ }
+
+ if(!v->sorted)vqgen_sortmesh(v);
+ if(!v->seeded)_vqgen_seed(v);
+
+ fdesired=(float)v->points/v->entries;
+ desired=fdesired;
+ desired2=desired*2;
+ new=malloc(sizeof(float)*v->entries*v->elements);
+ new2=malloc(sizeof(float)*v->entries*v->elements);
+ nearcount=malloc(v->entries*sizeof(long));
+ nearbias=malloc(v->entries*desired2*sizeof(float));
+
+ /* fill in nearest points for entry biasing */
+ /*memset(v->bias,0,sizeof(float)*v->entries);*/
+ memset(nearcount,0,sizeof(long)*v->entries);
+ memset(v->assigned,0,sizeof(long)*v->entries);
+ if(biasp){
+ for(i=0;i<v->points;i++){
+ float *ppt=v->weight_func(v,_point(v,i));
+ float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
+ float secondmetric=v->metric_func(v,_now(v,1),ppt)+v->bias[1];
+ long firstentry=0;
+ long secondentry=1;
+
+ if(!(i&0xff))spinnit("biasing... ",v->points+v->points+v->entries-i);
+
+ if(firstmetric>secondmetric){
+ float temp=firstmetric;
+ firstmetric=secondmetric;
+ secondmetric=temp;
+ firstentry=1;
+ secondentry=0;
+ }
+
+ for(j=2;j<v->entries;j++){
+ float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
+ if(thismetric<secondmetric){
+ if(thismetric<firstmetric){
+ secondmetric=firstmetric;
+ secondentry=firstentry;
+ firstmetric=thismetric;
+ firstentry=j;
+ }else{
+ secondmetric=thismetric;
+ secondentry=j;
+ }
+ }
+ }
+
+ j=firstentry;
+ for(j=0;j<v->entries;j++){
+
+ float thismetric,localmetric;
+ float *nearbiasptr=nearbias+desired2*j;
+ long k=nearcount[j];
+
+ localmetric=v->metric_func(v,_now(v,j),ppt);
+ /* 'thismetric' is to be the bias value necessary in the current
+ arrangement for entry j to capture point i */
+ if(firstentry==j){
+ /* use the secondary entry as the threshhold */
+ thismetric=secondmetric-localmetric;
+ }else{
+ /* use the primary entry as the threshhold */
+ thismetric=firstmetric-localmetric;
+ }
+
+ /* support the idea of 'minimum distance'... if we want the
+ cells in a codebook to be roughly some minimum size (as with
+ the low resolution residue books) */
+
+ /* a cute two-stage delayed sorting hack */
+ if(k<desired){
+ nearbiasptr[k]=thismetric;
+ k++;
+ if(k==desired){
+ spinnit("biasing... ",v->points+v->points+v->entries-i);
+ qsort(nearbiasptr,desired,sizeof(float),directdsort);
+ }
+
+ }else if(thismetric>nearbiasptr[desired-1]){
+ nearbiasptr[k]=thismetric;
+ k++;
+ if(k==desired2){
+ spinnit("biasing... ",v->points+v->points+v->entries-i);
+ qsort(nearbiasptr,desired2,sizeof(float),directdsort);
+ k=desired;
+ }
+ }
+ nearcount[j]=k;
+ }
+ }
+
+ /* inflate/deflate */
+
+ for(i=0;i<v->entries;i++){
+ float *nearbiasptr=nearbias+desired2*i;
+
+ spinnit("biasing... ",v->points+v->entries-i);
+
+ /* due to the delayed sorting, we likely need to finish it off....*/
+ if(nearcount[i]>desired)
+ qsort(nearbiasptr,nearcount[i],sizeof(float),directdsort);
+
+ v->bias[i]=nearbiasptr[desired-1];
+
+ }
+ }else{
+ memset(v->bias,0,v->entries*sizeof(float));
+ }
+
+ /* Now assign with new bias and find new midpoints */
+ for(i=0;i<v->points;i++){
+ float *ppt=v->weight_func(v,_point(v,i));
+ float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
+ long firstentry=0;
+
+ if(!(i&0xff))spinnit("centering... ",v->points-i);
+
+ for(j=0;j<v->entries;j++){
+ float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
+ if(thismetric<firstmetric){
+ firstmetric=thismetric;
+ firstentry=j;
+ }
+ }
+
+ j=firstentry;
+
+#ifdef NOISY
+ fprintf(cells,"%g %g\n%g %g\n\n",
+ _now(v,j)[0],_now(v,j)[1],
+ ppt[0],ppt[1]);
+#endif
+
+ firstmetric-=v->bias[j];
+ meterror+=firstmetric;
+
+ if(v->centroid==0){
+ /* set up midpoints for next iter */
+ if(v->assigned[j]++){
+ for(k=0;k<v->elements;k++)
+ vN(new,j)[k]+=ppt[k];
+ if(firstmetric>v->max[j])v->max[j]=firstmetric;
+ }else{
+ for(k=0;k<v->elements;k++)
+ vN(new,j)[k]=ppt[k];
+ v->max[j]=firstmetric;
+ }
+ }else{
+ /* centroid */
+ if(v->assigned[j]++){
+ for(k=0;k<v->elements;k++){
+ if(vN(new,j)[k]>ppt[k])vN(new,j)[k]=ppt[k];
+ if(vN(new2,j)[k]<ppt[k])vN(new2,j)[k]=ppt[k];
+ }
+ if(firstmetric>v->max[firstentry])v->max[j]=firstmetric;
+ }else{
+ for(k=0;k<v->elements;k++){
+ vN(new,j)[k]=ppt[k];
+ vN(new2,j)[k]=ppt[k];
+ }
+ v->max[firstentry]=firstmetric;
+ }
+ }
+ }
+
+ /* assign midpoints */
+
+ for(j=0;j<v->entries;j++){
+#ifdef NOISY
+ fprintf(assig,"%ld\n",v->assigned[j]);
+ fprintf(bias,"%g\n",v->bias[j]);
+#endif
+ asserror+=fabs(v->assigned[j]-fdesired);
+ if(v->assigned[j]){
+ if(v->centroid==0){
+ for(k=0;k<v->elements;k++)
+ _now(v,j)[k]=vN(new,j)[k]/v->assigned[j];
+ }else{
+ for(k=0;k<v->elements;k++)
+ _now(v,j)[k]=(vN(new,j)[k]+vN(new2,j)[k])/2.;
+ }
+ }
+ }
+
+ asserror/=(v->entries*fdesired);
+
+ fprintf(stderr,"Pass #%d... ",v->it);
+ fprintf(stderr,": dist %g(%g) metric error=%g \n",
+ asserror,fdesired,meterror/v->points);
+ v->it++;
+
+ free(new);
+ free(nearcount);
+ free(nearbias);
+#ifdef NOISY
+ fclose(assig);
+ fclose(bias);
+ fclose(cells);
+#endif
+ return(asserror);
+}
+
diff --git a/vq/vqgen.h b/vq/vqgen.h
new file mode 100644
index 00000000..51bdf49b
--- /dev/null
+++ b/vq/vqgen.h
@@ -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-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: build a VQ codebook
+ last mod: $Id: vqgen.h,v 1.14.6.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _VQGEN_H_
+#define _VQGEN_H_
+
+typedef struct vqgen{
+ int seeded;
+ int sorted;
+
+ int it;
+ int elements;
+
+ int aux;
+ float mindist;
+ int centroid;
+
+ /* point cache */
+ float *pointlist;
+ long points;
+ long allocated;
+
+ /* entries */
+ float *entrylist;
+ long *assigned;
+ float *bias;
+ long entries;
+ float *max;
+
+ float (*metric_func) (struct vqgen *v,float *entry,float *point);
+ float *(*weight_func) (struct vqgen *v,float *point);
+
+ FILE *asciipoints;
+} vqgen;
+
+typedef struct {
+ long min; /* packed 24 bit float */
+ long delta; /* packed 24 bit float */
+ int quant; /* 0 < quant <= 16 */
+ int sequencep; /* bitflag */
+} quant_meta;
+
+static inline float *_point(vqgen *v,long ptr){
+ return v->pointlist+((v->elements+v->aux)*ptr);
+}
+
+static inline float *_aux(vqgen *v,long ptr){
+ return _point(v,ptr)+v->aux;
+}
+
+static inline float *_now(vqgen *v,long ptr){
+ return v->entrylist+(v->elements*ptr);
+}
+
+extern void vqgen_init(vqgen *v,
+ int elements,int aux,int entries,float mindist,
+ float (*metric)(vqgen *,float *, float *),
+ float *(*weight)(vqgen *,float *),int centroid);
+extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
+
+extern float vqgen_iterate(vqgen *v,int biasp);
+extern void vqgen_unquantize(vqgen *v,quant_meta *q);
+extern void vqgen_quantize(vqgen *v,quant_meta *q);
+extern void vqgen_cellmetric(vqgen *v);
+
+#endif
+
+
+
+
+
diff --git a/vq/vqsplit.c b/vq/vqsplit.c
new file mode 100644
index 00000000..9ffae29b
--- /dev/null
+++ b/vq/vqsplit.c
@@ -0,0 +1,614 @@
+/********************************************************************
+ * *
+ * 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: build a VQ codebook and the encoding decision 'tree'
+ last mod: $Id: vqsplit.c,v 1.19.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+/* This code is *not* part of libvorbis. It is used to generate
+ trained codebooks offline and then spit the results into a
+ pregenerated codebook that is compiled into libvorbis. It is an
+ expensive (but good) algorithm. Run it on big iron. */
+
+/* There are so many optimizations to explore in *both* stages that
+ considering the undertaking is almost withering. For now, we brute
+ force it all */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "vqgen.h"
+#include "vqsplit.h"
+#include "bookutil.h"
+#include "../lib/sharedbook.h"
+
+/* Codebook generation happens in two steps:
+
+ 1) Train the codebook with data collected from the encoder: We use
+ one of a few error metrics (which represent the distance between a
+ given data point and a candidate point in the training set) to
+ divide the training set up into cells representing roughly equal
+ probability of occurring.
+
+ 2) Generate the codebook and auxiliary data from the trained data set
+*/
+
+/* Building a codebook from trained set **********************************
+
+ The codebook in raw form is technically finished once it's trained.
+ However, we want to finalize the representative codebook values for
+ each entry and generate auxiliary information to optimize encoding.
+ We generate the auxiliary coding tree using collected data,
+ probably the same data as in the original training */
+
+/* At each recursion, the data set is split in half. Cells with data
+ points on side A go into set A, same with set B. The sets may
+ overlap. If the cell overlaps the deviding line only very slightly
+ (provided parameter), we may choose to ignore the overlap in order
+ to pare the tree down */
+
+long *isortvals;
+int iascsort(const void *a,const void *b){
+ long av=isortvals[*((long *)a)];
+ long bv=isortvals[*((long *)b)];
+ return(av-bv);
+}
+
+static float _Ndist(int el,float *a, float *b){
+ int i;
+ float acc=0.;
+ for(i=0;i<el;i++){
+ float val=(a[i]-b[i]);
+ acc+=val*val;
+ }
+ return sqrt(acc);
+}
+
+#define _Npoint(i) (pointlist+dim*(i))
+#define _Nnow(i) (entrylist+dim*(i))
+
+
+/* goes through the split, but just counts it and returns a metric*/
+int vqsp_count(float *entrylist,float *pointlist,int dim,
+ long *membership,long *reventry,
+ long *entryindex,long entries,
+ long *pointindex,long points,int splitp,
+ long *entryA,long *entryB,
+ long besti,long bestj,
+ long *entriesA,long *entriesB,long *entriesC){
+ long i,j;
+ long A=0,B=0,C=0;
+ long pointsA=0;
+ long pointsB=0;
+ long *temppointsA=NULL;
+ long *temppointsB=NULL;
+
+ if(splitp){
+ temppointsA=malloc(points*sizeof(long));
+ temppointsB=malloc(points*sizeof(long));
+ }
+
+ memset(entryA,0,sizeof(long)*entries);
+ memset(entryB,0,sizeof(long)*entries);
+
+ /* Do the points belonging to this cell occur on sideA, sideB or
+ both? */
+
+ for(i=0;i<points;i++){
+ float *ppt=_Npoint(pointindex[i]);
+ long firstentry=membership[pointindex[i]];
+
+ if(firstentry==besti){
+ entryA[reventry[firstentry]]=1;
+ if(splitp)temppointsA[pointsA++]=pointindex[i];
+ continue;
+ }
+ if(firstentry==bestj){
+ entryB[reventry[firstentry]]=1;
+ if(splitp)temppointsB[pointsB++]=pointindex[i];
+ continue;
+ }
+ {
+ float distA=_Ndist(dim,ppt,_Nnow(besti));
+ float distB=_Ndist(dim,ppt,_Nnow(bestj));
+ if(distA<distB){
+ entryA[reventry[firstentry]]=1;
+ if(splitp)temppointsA[pointsA++]=pointindex[i];
+ }else{
+ entryB[reventry[firstentry]]=1;
+ if(splitp)temppointsB[pointsB++]=pointindex[i];
+ }
+ }
+ }
+
+ /* The entry splitting isn't total, so that storage has to be
+ allocated for recursion. Reuse the entryA/entryB vectors */
+ /* keep the entries in ascending order (relative to the original
+ list); we rely on that stability when ordering p/q choice */
+ for(j=0;j<entries;j++){
+ if(entryA[j] && entryB[j])C++;
+ if(entryA[j])entryA[A++]=entryindex[j];
+ if(entryB[j])entryB[B++]=entryindex[j];
+ }
+ *entriesA=A;
+ *entriesB=B;
+ *entriesC=C;
+ if(splitp){
+ memcpy(pointindex,temppointsA,sizeof(long)*pointsA);
+ memcpy(pointindex+pointsA,temppointsB,sizeof(long)*pointsB);
+ free(temppointsA);
+ free(temppointsB);
+ }
+ return(pointsA);
+}
+
+int lp_split(float *pointlist,long totalpoints,
+ codebook *b,
+ long *entryindex,long entries,
+ long *pointindex,long points,
+ long *membership,long *reventry,
+ long depth, long *pointsofar){
+
+ encode_aux_nearestmatch *t=b->c->nearest_tree;
+
+ /* The encoder, regardless of book, will be using a straight
+ euclidian distance-to-point metric to determine closest point.
+ Thus we split the cells using the same (we've already trained the
+ codebook set spacing and distribution using special metrics and
+ even a midpoint division won't disturb the basic properties) */
+
+ int dim=b->dim;
+ float *entrylist=b->valuelist;
+ long ret;
+ long *entryA=calloc(entries,sizeof(long));
+ long *entryB=calloc(entries,sizeof(long));
+ long entriesA=0;
+ long entriesB=0;
+ long entriesC=0;
+ long pointsA=0;
+ long i,j,k;
+
+ long besti=-1;
+ long bestj=-1;
+
+ char spinbuf[80];
+ sprintf(spinbuf,"splitting [%ld left]... ",totalpoints-*pointsofar);
+
+ /* one reverse index needed */
+ for(i=0;i<b->entries;i++)reventry[i]=-1;
+ for(i=0;i<entries;i++)reventry[entryindex[i]]=i;
+
+ /* We need to find the dividing hyperplane. find the median of each
+ axis as the centerpoint and the normal facing farthest point */
+
+ /* more than one way to do this part. For small sets, we can brute
+ force it. */
+
+ if(entries<8 || (float)points*entries*entries<16.*1024*1024){
+ /* try every pair possibility */
+ float best=0;
+ float this;
+ for(i=0;i<entries-1;i++){
+ for(j=i+1;j<entries;j++){
+ spinnit(spinbuf,entries-i);
+ vqsp_count(b->valuelist,pointlist,dim,
+ membership,reventry,
+ entryindex,entries,
+ pointindex,points,0,
+ entryA,entryB,
+ entryindex[i],entryindex[j],
+ &entriesA,&entriesB,&entriesC);
+ this=(entriesA-entriesC)*(entriesB-entriesC);
+
+ /* when choosing best, we also want some form of stability to
+ make sure more branches are pared later; secondary
+ weighting isn;t needed as the entry lists are in ascending
+ order, and we always try p/q in the same sequence */
+
+ if( (besti==-1) ||
+ (this>best) ){
+
+ best=this;
+ besti=entryindex[i];
+ bestj=entryindex[j];
+
+ }
+ }
+ }
+ }else{
+ float *p=alloca(dim*sizeof(float));
+ float *q=alloca(dim*sizeof(float));
+ float best=0.;
+
+ /* try COG/normal and furthest pairs */
+ /* meanpoint */
+ /* eventually, we want to select the closest entry and figure n/c
+ from p/q (because storing n/c is too large */
+ for(k=0;k<dim;k++){
+ spinnit(spinbuf,entries);
+
+ p[k]=0.;
+ for(j=0;j<entries;j++)
+ p[k]+=b->valuelist[entryindex[j]*dim+k];
+ p[k]/=entries;
+
+ }
+
+ /* we go through the entries one by one, looking for the entry on
+ the other side closest to the point of reflection through the
+ center */
+
+ for(i=0;i<entries;i++){
+ float *ppi=_Nnow(entryindex[i]);
+ float ref_best=0.;
+ float ref_j=-1;
+ float this;
+ spinnit(spinbuf,entries-i);
+
+ for(k=0;k<dim;k++)
+ q[k]=2*p[k]-ppi[k];
+
+ for(j=0;j<entries;j++){
+ if(j!=i){
+ float this=_Ndist(dim,q,_Nnow(entryindex[j]));
+ if(ref_j==-1 || this<=ref_best){ /* <=, not <; very important */
+ ref_best=this;
+ ref_j=entryindex[j];
+ }
+ }
+ }
+
+ vqsp_count(b->valuelist,pointlist,dim,
+ membership,reventry,
+ entryindex,entries,
+ pointindex,points,0,
+ entryA,entryB,
+ entryindex[i],ref_j,
+ &entriesA,&entriesB,&entriesC);
+ this=(entriesA-entriesC)*(entriesB-entriesC);
+
+ /* when choosing best, we also want some form of stability to
+ make sure more branches are pared later; secondary
+ weighting isn;t needed as the entry lists are in ascending
+ order, and we always try p/q in the same sequence */
+
+ if( (besti==-1) ||
+ (this>best) ){
+
+ best=this;
+ besti=entryindex[i];
+ bestj=ref_j;
+
+ }
+ }
+ if(besti>bestj){
+ long temp=besti;
+ besti=bestj;
+ bestj=temp;
+ }
+
+ }
+
+ /* find cells enclosing points */
+ /* count A/B points */
+
+ pointsA=vqsp_count(b->valuelist,pointlist,dim,
+ membership,reventry,
+ entryindex,entries,
+ pointindex,points,1,
+ entryA,entryB,
+ besti,bestj,
+ &entriesA,&entriesB,&entriesC);
+
+ /* fprintf(stderr,"split: total=%ld depth=%ld set A=%ld:%ld:%ld=B\n",
+ entries,depth,entriesA-entriesC,entriesC,entriesB-entriesC);*/
+ {
+ long thisaux=t->aux++;
+ if(t->aux>=t->alloc){
+ t->alloc*=2;
+ t->ptr0=realloc(t->ptr0,sizeof(long)*t->alloc);
+ t->ptr1=realloc(t->ptr1,sizeof(long)*t->alloc);
+ t->p=realloc(t->p,sizeof(long)*t->alloc);
+ t->q=realloc(t->q,sizeof(long)*t->alloc);
+ }
+
+ t->p[thisaux]=besti;
+ t->q[thisaux]=bestj;
+
+ if(entriesA==1){
+ ret=1;
+ t->ptr0[thisaux]=entryA[0];
+ *pointsofar+=pointsA;
+ }else{
+ t->ptr0[thisaux]= -t->aux;
+ ret=lp_split(pointlist,totalpoints,b,entryA,entriesA,pointindex,pointsA,
+ membership,reventry,depth+1,pointsofar);
+ }
+ if(entriesB==1){
+ ret++;
+ t->ptr1[thisaux]=entryB[0];
+ *pointsofar+=points-pointsA;
+ }else{
+ t->ptr1[thisaux]= -t->aux;
+ ret+=lp_split(pointlist,totalpoints,b,entryB,entriesB,pointindex+pointsA,
+ points-pointsA,membership,reventry,
+ depth+1,pointsofar);
+ }
+ }
+ free(entryA);
+ free(entryB);
+ return(ret);
+}
+
+static int _node_eq(encode_aux_nearestmatch *v, long a, long b){
+ long Aptr0=v->ptr0[a];
+ long Aptr1=v->ptr1[a];
+ long Bptr0=v->ptr0[b];
+ long Bptr1=v->ptr1[b];
+
+ /* the possibility of choosing the same p and q, but switched, can;t
+ happen because we always look for the best p/q in the same search
+ order and the search is stable */
+
+ if(Aptr0==Bptr0 && Aptr1==Bptr1)
+ return(1);
+
+ return(0);
+}
+
+void vqsp_book(vqgen *v, codebook *b, long *quantlist){
+ long i,j;
+ static_codebook *c=(static_codebook *)b->c;
+ encode_aux_nearestmatch *t;
+
+ memset(b,0,sizeof(codebook));
+ memset(c,0,sizeof(static_codebook));
+ b->c=c;
+ t=c->nearest_tree=calloc(1,sizeof(encode_aux_nearestmatch));
+ c->maptype=2;
+
+ /* make sure there are no duplicate entries and that every
+ entry has points */
+
+ for(i=0;i<v->entries;){
+ /* duplicate? if so, eliminate */
+ for(j=0;j<i;j++){
+ if(_Ndist(v->elements,_now(v,i),_now(v,j))==0.){
+ fprintf(stderr,"found a duplicate entry! removing...\n");
+ v->entries--;
+ memcpy(_now(v,i),_now(v,v->entries),sizeof(float)*v->elements);
+ memcpy(quantlist+i*v->elements,quantlist+v->entries*v->elements,
+ sizeof(long)*v->elements);
+ break;
+ }
+ }
+ if(j==i)i++;
+ }
+
+ {
+ v->assigned=calloc(v->entries,sizeof(long));
+ for(i=0;i<v->points;i++){
+ float *ppt=_point(v,i);
+ float firstmetric=_Ndist(v->elements,_now(v,0),ppt);
+ long firstentry=0;
+
+ if(!(i&0xff))spinnit("checking... ",v->points-i);
+
+ for(j=0;j<v->entries;j++){
+ float thismetric=_Ndist(v->elements,_now(v,j),ppt);
+ if(thismetric<firstmetric){
+ firstmetric=thismetric;
+ firstentry=j;
+ }
+ }
+
+ v->assigned[firstentry]++;
+ }
+
+ for(j=0;j<v->entries;){
+ if(v->assigned[j]==0){
+ fprintf(stderr,"found an unused entry! removing...\n");
+ v->entries--;
+ memcpy(_now(v,j),_now(v,v->entries),sizeof(float)*v->elements);
+ v->assigned[j]=v->assigned[v->elements];
+ memcpy(quantlist+j*v->elements,quantlist+v->entries*v->elements,
+ sizeof(long)*v->elements);
+ continue;
+ }
+ j++;
+ }
+ }
+
+ fprintf(stderr,"Building a book with %ld unique entries...\n",v->entries);
+
+ {
+ long *entryindex=malloc(v->entries*sizeof(long *));
+ long *pointindex=malloc(v->points*sizeof(long));
+ long *membership=malloc(v->points*sizeof(long));
+ long *reventry=malloc(v->entries*sizeof(long));
+ long pointssofar=0;
+
+ for(i=0;i<v->entries;i++)entryindex[i]=i;
+ for(i=0;i<v->points;i++)pointindex[i]=i;
+
+ t->alloc=4096;
+ t->ptr0=malloc(sizeof(long)*t->alloc);
+ t->ptr1=malloc(sizeof(long)*t->alloc);
+ t->p=malloc(sizeof(long)*t->alloc);
+ t->q=malloc(sizeof(long)*t->alloc);
+ t->aux=0;
+ c->dim=v->elements;
+ c->entries=v->entries;
+ c->lengthlist=calloc(c->entries,sizeof(long));
+ b->valuelist=v->entrylist; /* temporary; replaced later */
+ b->dim=c->dim;
+ b->entries=c->entries;
+
+ for(i=0;i<v->points;i++)membership[i]=-1;
+ for(i=0;i<v->points;i++){
+ float *ppt=_point(v,i);
+ long firstentry=0;
+ float firstmetric=_Ndist(v->elements,_now(v,0),ppt);
+
+ if(!(i&0xff))spinnit("assigning... ",v->points-i);
+
+ for(j=1;j<v->entries;j++){
+ if(v->assigned[j]!=-1){
+ float thismetric=_Ndist(v->elements,_now(v,j),ppt);
+ if(thismetric<=firstmetric){
+ firstmetric=thismetric;
+ firstentry=j;
+ }
+ }
+ }
+
+ membership[i]=firstentry;
+ }
+
+ fprintf(stderr,"Leaves added: %d \n",
+ lp_split(v->pointlist,v->points,
+ b,entryindex,v->entries,
+ pointindex,v->points,
+ membership,reventry,
+ 0,&pointssofar));
+
+ free(pointindex);
+ free(membership);
+ free(reventry);
+
+ fprintf(stderr,"Paring/rerouting redundant branches... ");
+
+ /* The tree is likely big and redundant. Pare and reroute branches */
+ {
+ int changedflag=1;
+
+ while(changedflag){
+ changedflag=0;
+
+ /* span the tree node by node; list unique decision nodes and
+ short circuit redundant branches */
+
+ for(i=0;i<t->aux;){
+ int k;
+
+ /* check list of unique decisions */
+ for(j=0;j<i;j++)
+ if(_node_eq(t,i,j))break;
+
+ if(j<i){
+ /* a redundant entry; find all higher nodes referencing it and
+ short circuit them to the previously noted unique entry */
+ changedflag=1;
+ for(k=0;k<t->aux;k++){
+ if(t->ptr0[k]==-i)t->ptr0[k]=-j;
+ if(t->ptr1[k]==-i)t->ptr1[k]=-j;
+ }
+
+ /* Now, we need to fill in the hole from this redundant
+ entry in the listing. Insert the last entry in the list.
+ Fix the forward pointers to that last entry */
+ t->aux--;
+ t->ptr0[i]=t->ptr0[t->aux];
+ t->ptr1[i]=t->ptr1[t->aux];
+ t->p[i]=t->p[t->aux];
+ t->q[i]=t->q[t->aux];
+ for(k=0;k<t->aux;k++){
+ if(t->ptr0[k]==-t->aux)t->ptr0[k]=-i;
+ if(t->ptr1[k]==-t->aux)t->ptr1[k]=-i;
+ }
+ /* hole plugged */
+
+ }else
+ i++;
+ }
+
+ fprintf(stderr,"\rParing/rerouting redundant branches... "
+ "%ld remaining ",t->aux);
+ }
+ fprintf(stderr,"\n");
+ }
+ }
+
+ /* run all training points through the decision tree to get a final
+ probability count */
+ {
+ long *probability=malloc(c->entries*sizeof(long));
+ for(i=0;i<c->entries;i++)probability[i]=1; /* trivial guard */
+ b->dim=c->dim;
+
+ /* sigh. A necessary hack */
+ for(i=0;i<t->aux;i++)t->p[i]*=c->dim;
+ for(i=0;i<t->aux;i++)t->q[i]*=c->dim;
+
+ for(i=0;i<v->points;i++){
+ /* we use the linear matcher regardless becuase the trainer
+ doesn't convert log to linear */
+ int ret=_best(b,v->pointlist+i*v->elements,1);
+ probability[ret]++;
+ if(!(i&0xff))spinnit("counting hits... ",v->points-i);
+ }
+ for(i=0;i<t->aux;i++)t->p[i]/=c->dim;
+ for(i=0;i<t->aux;i++)t->q[i]/=c->dim;
+
+ build_tree_from_lengths(c->entries,probability,c->lengthlist);
+
+ free(probability);
+ }
+
+ /* Sort the entries by codeword length, short to long (eases
+ assignment and packing to do it now) */
+ {
+ long *wordlen=c->lengthlist;
+ long *index=malloc(c->entries*sizeof(long));
+ long *revindex=malloc(c->entries*sizeof(long));
+ int k;
+ for(i=0;i<c->entries;i++)index[i]=i;
+ isortvals=c->lengthlist;
+ qsort(index,c->entries,sizeof(long),iascsort);
+
+ /* rearrange storage; ptr0/1 first as it needs a reverse index */
+ /* n and c stay unchanged */
+ for(i=0;i<c->entries;i++)revindex[index[i]]=i;
+ for(i=0;i<t->aux;i++){
+ if(!(i&0x3f))spinnit("sorting... ",t->aux-i);
+
+ if(t->ptr0[i]>=0)t->ptr0[i]=revindex[t->ptr0[i]];
+ if(t->ptr1[i]>=0)t->ptr1[i]=revindex[t->ptr1[i]];
+ t->p[i]=revindex[t->p[i]];
+ t->q[i]=revindex[t->q[i]];
+ }
+ free(revindex);
+
+ /* map lengthlist and vallist with index */
+ c->lengthlist=calloc(c->entries,sizeof(long));
+ b->valuelist=malloc(sizeof(float)*c->entries*c->dim);
+ c->quantlist=malloc(sizeof(long)*c->entries*c->dim);
+ for(i=0;i<c->entries;i++){
+ long e=index[i];
+ for(k=0;k<c->dim;k++){
+ b->valuelist[i*c->dim+k]=v->entrylist[e*c->dim+k];
+ c->quantlist[i*c->dim+k]=quantlist[e*c->dim+k];
+ }
+ c->lengthlist[i]=wordlen[e];
+ }
+
+ free(wordlen);
+ }
+
+ fprintf(stderr,"Done. \n\n");
+}
+
diff --git a/vq/vqsplit.h b/vq/vqsplit.h
new file mode 100644
index 00000000..b770f95b
--- /dev/null
+++ b/vq/vqsplit.h
@@ -0,0 +1,38 @@
+/********************************************************************
+ * *
+ * 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: build a VQ codebook decision tree
+ last mod: $Id: vqsplit.h,v 1.2.8.1 2000/08/31 09:00:03 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _VQSPL_H_
+#define _VQSPL_H_
+
+#include "vorbis/codebook.h"
+
+extern void vqsp_book(vqgen *v,codebook *b,long *quantlist);
+extern int vqenc_entry(codebook *b,float *val);
+extern int lp_split(float *pointlist,long totalpoints,
+ codebook *b,
+ long *entryindex,long entries,
+ long *pointindex,long points,
+ long *membership,long *reventry,
+ long depth, long *pointsofar);
+
+#endif
+
+
+
+
+