[xiph-cvs] cvs commit: vorbis/vq 44c0.vqs 44c1.vqs 44c2.vqs 44c3.vqs 44c4.vqs 44c5.vqs 44c6.vqs 44c7.vqs 44c8.vqs 44c9.vqs Makefile.am bookutil.c huffbuild.c

Monty xiphmont at xiph.org
Fri Jun 28 15:20:02 PDT 2002



xiphmont    02/06/28 15:19:59

  Modified:    .        configure.in
               examples encoder_example.c
               lib      Makefile.am analysis.c backends.h barkmel.c
                        bitrate.c bitrate.h block.c codebook.c codebook.h
                        codec_internal.h floor0.c floor1.c info.c
                        mapping0.c masking.h mdct.c misc.h os.h psy.c psy.h
                        registry.c registry.h res0.c scales.h sharedbook.c
                        synthesis.c vorbisenc.c
               lib/books/coupled Makefile.am
               lib/books/floor Makefile.am
               lib/books/uncoupled Makefile.am
               lib/modes Makefile.am floor_44.h psych_44.h residue_44.h
               vq       44c0.vqs 44c1.vqs 44c2.vqs 44c3.vqs 44c4.vqs
                        44c5.vqs 44c6.vqs 44c7.vqs 44c8.vqs 44c9.vqs
                        Makefile.am bookutil.c huffbuild.c
  Added:       lib      highlevel.h
               lib/books/coupled res_books_44c.h
               lib/books/floor floor_books.h
               lib/modes setup_44.h
  Removed:     lib      registry-api.h
               lib/books/coupled _44c0_long.vqh _44c0_s0_p0_r0.vqh
                        _44c0_s0_p0_r1.vqh _44c0_s0_p1_0.vqh
                        _44c0_s0_p2_0.vqh _44c0_s0_p3_0.vqh
                        _44c0_s0_p4_0.vqh _44c0_s0_p4_1.vqh
                        _44c0_s0_p5_0.vqh _44c0_s0_p6_0.vqh
                        _44c0_s0_p7_0.vqh _44c0_s0_p7_1.vqh
                        _44c0_s0_p7_2.vqh _44c0_s0_pN_r0.vqh
                        _44c0_s0_pN_r1.vqh _44c0_s1_p5_0.vqh
                        _44c0_s1_p5_s0.vqh _44c0_s1_p6_0.vqh
                        _44c0_s1_p6_s0.vqh _44c0_s1_p7_0.vqh
                        _44c0_s1_p7_1.vqh _44c0_s1_p7_2.vqh
                        _44c0_s1_p7_s0.vqh _44c0_s1_pS_r0.vqh
                        _44c0_s1_pS_r1.vqh _44c0_s2_p6_0.vqh
                        _44c0_s2_p6_s0.vqh _44c0_s2_p7_0.vqh
                        _44c0_s2_p7_1.vqh _44c0_s2_p7_2.vqh
                        _44c0_s2_p7_s0.vqh _44c0_s3_p7_0.vqh
                        _44c0_s3_p7_1.vqh _44c0_s3_p7_2.vqh
                        _44c0_s3_p7_s0.vqh _44c0_s4_p7_0.vqh
                        _44c0_s4_p7_1.vqh _44c0_s4_p7_2.vqh _44c0_short.vqh
                        _44c1_long.vqh _44c1_s0_p1_0.vqh _44c1_s0_p2_0.vqh
                        _44c1_s0_p3_0.vqh _44c1_s0_p4_0.vqh
                        _44c1_s0_p4_1.vqh _44c1_s0_p5_0.vqh
                        _44c1_s0_p6_0.vqh _44c1_s0_p7_0.vqh
                        _44c1_s0_p7_1.vqh _44c1_s0_p7_2.vqh
                        _44c1_s1_p5_0.vqh _44c1_s1_p6_0.vqh
                        _44c1_s1_p7_0.vqh _44c1_s1_p7_1.vqh
                        _44c1_s1_p7_2.vqh _44c1_s2_p6_0.vqh
                        _44c1_s2_p7_0.vqh _44c1_s2_p7_1.vqh
                        _44c1_s2_p7_2.vqh _44c1_s3_p7_0.vqh
                        _44c1_s3_p7_1.vqh _44c1_s3_p7_2.vqh _44c1_short.vqh
                        _44c2_long.vqh _44c2_s0_p1_0.vqh _44c2_s0_p2_0.vqh
                        _44c2_s0_p3_0.vqh _44c2_s0_p4_0.vqh
                        _44c2_s0_p4_1.vqh _44c2_s0_p5_0.vqh
                        _44c2_s0_p6_0.vqh _44c2_s0_p7_0.vqh
                        _44c2_s0_p7_1.vqh _44c2_s0_p7_2.vqh
                        _44c2_s1_p5_0.vqh _44c2_s1_p6_0.vqh
                        _44c2_s1_p7_0.vqh _44c2_s1_p7_1.vqh
                        _44c2_s1_p7_2.vqh _44c2_s2_p6_0.vqh
                        _44c2_s2_p7_0.vqh _44c2_s2_p7_1.vqh
                        _44c2_s2_p7_2.vqh _44c2_s3_p7_0.vqh
                        _44c2_s3_p7_1.vqh _44c2_s3_p7_2.vqh _44c2_short.vqh
                        _44c3_long.vqh _44c3_s0_p1_0.vqh _44c3_s0_p2_0.vqh
                        _44c3_s0_p3_0.vqh _44c3_s0_p4_0.vqh
                        _44c3_s0_p4_1.vqh _44c3_s0_p5_0.vqh
                        _44c3_s0_p6_0.vqh _44c3_s0_p7_0.vqh
                        _44c3_s0_p7_1.vqh _44c3_s0_p7_2.vqh
                        _44c3_s1_p5_0.vqh _44c3_s1_p6_0.vqh
                        _44c3_s1_p7_0.vqh _44c3_s1_p7_1.vqh
                        _44c3_s1_p7_2.vqh _44c3_s2_p6_0.vqh
                        _44c3_s2_p7_0.vqh _44c3_s2_p7_1.vqh
                        _44c3_s2_p7_2.vqh _44c3_s3_p7_0.vqh
                        _44c3_s3_p7_1.vqh _44c3_s3_p7_2.vqh _44c3_short.vqh
                        _44c4_long.vqh _44c4_s0_p2_0.vqh _44c4_s0_p3_0.vqh
                        _44c4_s0_p4_0.vqh _44c4_s0_p5_0.vqh
                        _44c4_s0_p6_0.vqh _44c4_s1_p2_0.vqh
                        _44c4_s1_p4_0.vqh _44c4_s1_p6_0.vqh
                        _44c4_s1_p7_0.vqh _44c4_s1_p7_1.vqh
                        _44c4_s1_p8_0.vqh _44c4_s1_p8_1.vqh
                        _44c4_s1_p9_0.vqh _44c4_s1_p9_1.vqh
                        _44c4_s1_p9_2.vqh _44c4_short.vqh _44c5_long.vqh
                        _44c5_s0_p1_0.vqh _44c5_s0_p2_0.vqh
                        _44c5_s0_p3_0.vqh _44c5_s0_p4_0.vqh
                        _44c5_s0_p5_0.vqh _44c5_s0_p6_0.vqh
                        _44c5_s0_p7_0.vqh _44c5_s0_p7_1.vqh
                        _44c5_s0_p8_0.vqh _44c5_s0_p8_1.vqh
                        _44c5_s0_p9_0.vqh _44c5_s0_p9_1.vqh
                        _44c5_s0_p9_2.vqh _44c5_s1_p2_0.vqh
                        _44c5_s1_p4_0.vqh _44c5_s1_p6_0.vqh
                        _44c5_s1_p7_0.vqh _44c5_s1_p7_1.vqh
                        _44c5_s1_p8_0.vqh _44c5_s1_p8_1.vqh
                        _44c5_s1_p9_0.vqh _44c5_s1_p9_1.vqh
                        _44c5_s1_p9_2.vqh _44c5_s2_p6_0.vqh
                        _44c5_s2_p7_0.vqh _44c5_s2_p7_1.vqh
                        _44c5_s2_p8_0.vqh _44c5_s2_p8_1.vqh
                        _44c5_s2_p9_0.vqh _44c5_s2_p9_1.vqh
                        _44c5_s2_p9_2.vqh _44c5_s3_p7_0.vqh
                        _44c5_s3_p7_1.vqh _44c5_s3_p8_0.vqh
                        _44c5_s3_p8_1.vqh _44c5_s3_p9_0.vqh
                        _44c5_s3_p9_1.vqh _44c5_s3_p9_2.vqh _44c5_short.vqh
                        _44c6_long.vqh _44c6_s0_p1_0.vqh _44c6_s0_p2_0.vqh
                        _44c6_s0_p3_0.vqh _44c6_s0_p4_0.vqh
                        _44c6_s0_p5_0.vqh _44c6_s0_p6_0.vqh
                        _44c6_s0_p7_0.vqh _44c6_s0_p7_1.vqh
                        _44c6_s0_p8_0.vqh _44c6_s0_p8_1.vqh
                        _44c6_s0_p9_0.vqh _44c6_s0_p9_1.vqh
                        _44c6_s0_p9_2.vqh _44c6_s1_p2_0.vqh
                        _44c6_s1_p4_0.vqh _44c6_s1_p6_0.vqh
                        _44c6_s1_p7_0.vqh _44c6_s1_p7_1.vqh
                        _44c6_s1_p8_0.vqh _44c6_s1_p8_1.vqh
                        _44c6_s1_p9_0.vqh _44c6_s1_p9_1.vqh
                        _44c6_s1_p9_2.vqh _44c6_s2_p6_0.vqh
                        _44c6_s2_p7_0.vqh _44c6_s2_p7_1.vqh
                        _44c6_s2_p8_0.vqh _44c6_s2_p8_1.vqh
                        _44c6_s2_p9_0.vqh _44c6_s2_p9_1.vqh
                        _44c6_s2_p9_2.vqh _44c6_s3_p7_0.vqh
                        _44c6_s3_p7_1.vqh _44c6_s3_p8_0.vqh
                        _44c6_s3_p8_1.vqh _44c6_s3_p9_0.vqh
                        _44c6_s3_p9_1.vqh _44c6_s3_p9_2.vqh _44c6_short.vqh
                        _44c7_long.vqh _44c7_s0_p0_r0.vqh
                        _44c7_s0_p0_r1.vqh _44c7_s0_p1_0.vqh
                        _44c7_s0_p1_1.vqh _44c7_s0_p2_0.vqh
                        _44c7_s0_p2_1.vqh _44c7_s0_p3_0.vqh
                        _44c7_s0_p4_0.vqh _44c7_s0_p5_0.vqh
                        _44c7_s0_p6_0.vqh _44c7_s0_p6_1.vqh
                        _44c7_s0_p7_0.vqh _44c7_s0_p7_1.vqh
                        _44c7_s0_p8_0.vqh _44c7_s0_p8_1.vqh
                        _44c7_s0_p9_0.vqh _44c7_s0_p9_1.vqh
                        _44c7_s0_p9_2.vqh _44c7_s0_pN_r0.vqh
                        _44c7_s0_pN_r1.vqh _44c7_short.vqh _44c8_long.vqh
                        _44c8_s0_p1_0.vqh _44c8_s0_p1_1.vqh
                        _44c8_s0_p2_0.vqh _44c8_s0_p2_1.vqh
                        _44c8_s0_p3_0.vqh _44c8_s0_p4_0.vqh
                        _44c8_s0_p5_0.vqh _44c8_s0_p6_0.vqh
                        _44c8_s0_p6_1.vqh _44c8_s0_p7_0.vqh
                        _44c8_s0_p7_1.vqh _44c8_s0_p8_0.vqh
                        _44c8_s0_p8_1.vqh _44c8_s0_p9_0.vqh
                        _44c8_s0_p9_1.vqh _44c8_s0_p9_2.vqh _44c8_short.vqh
                        _44c9_long.vqh _44c9_s0_p1_0.vqh _44c9_s0_p1_1.vqh
                        _44c9_s0_p2_0.vqh _44c9_s0_p2_1.vqh
                        _44c9_s0_p3_0.vqh _44c9_s0_p4_0.vqh
                        _44c9_s0_p5_0.vqh _44c9_s0_p6_0.vqh
                        _44c9_s0_p6_1.vqh _44c9_s0_p7_0.vqh
                        _44c9_s0_p7_1.vqh _44c9_s0_p8_0.vqh
                        _44c9_s0_p8_1.vqh _44c9_s0_p9_0.vqh
                        _44c9_s0_p9_1.vqh _44c9_s0_p9_2.vqh _44c9_short.vqh
               lib/books/floor line_1024x31_0sub0.vqh
                        line_1024x31_0sub1.vqh line_1024x31_1sub0.vqh
                        line_1024x31_1sub1.vqh line_1024x31_2sub1.vqh
                        line_1024x31_2sub2.vqh line_1024x31_2sub3.vqh
                        line_1024x31_3sub1.vqh line_1024x31_3sub2.vqh
                        line_1024x31_3sub3.vqh line_1024x31_class0.vqh
                        line_1024x31_class1.vqh line_1024x31_class2.vqh
                        line_1024x31_class3.vqh line_128x19_0sub0.vqh
                        line_128x19_1sub1.vqh line_128x19_1sub2.vqh
                        line_128x19_1sub3.vqh line_128x19_2sub1.vqh
                        line_128x19_2sub2.vqh line_128x19_2sub3.vqh
                        line_128x19_class1.vqh line_128x19_class2.vqh
                        line_128x7_0sub0.vqh line_128x7_1sub1.vqh
                        line_128x7_1sub2.vqh line_128x7_1sub3.vqh
                        line_128x7_2sub1.vqh line_128x7_2sub2.vqh
                        line_128x7_2sub3.vqh line_128x7_class1.vqh
                        line_128x7_class2.vqh line_128x9_0sub0.vqh
                        line_128x9_1sub1.vqh line_128x9_1sub2.vqh
                        line_128x9_1sub3.vqh line_128x9_2sub1.vqh
                        line_128x9_2sub2.vqh line_128x9_2sub3.vqh
                        line_128x9_class1.vqh line_128x9_class2.vqh
               lib/books/uncoupled _44u0_p0_r0.vqh _44u0_p0_r1.vqh
                        _44u0_p1_0.vqh _44u0_p1_r0.vqh _44u0_p1_r1.vqh
                        _44u0_p2_0.vqh _44u0_p3_0.vqh _44u0_p4_0.vqh
                        _44u0_p4_1.vqh _44u0_p5_0.vqh _44u0_p6_0.vqh
                        _44u0_p7_0.vqh _44u0_p7_1.vqh _44u0_p7_2.vqh
                        _44u4_p0_r0.vqh _44u4_p0_r1.vqh _44u4_p1_0.vqh
                        _44u4_p1_r0.vqh _44u4_p1_r1.vqh _44u4_p2_0.vqh
                        _44u4_p3_0.vqh _44u4_p4_0.vqh _44u4_p5_0.vqh
                        _44u4_p6_0.vqh _44u4_p7_0.vqh _44u4_p7_1.vqh
                        _44u4_p8_0.vqh _44u4_p8_1.vqh _44u4_p9_0.vqh
                        _44u4_p9_1.vqh _44u4_p9_2.vqh _44u7_p0_r0.vqh
                        _44u7_p0_r1.vqh _44u7_p1_0.vqh _44u7_p1_r0.vqh
                        _44u7_p1_r1.vqh _44u7_p2_0.vqh _44u7_p2_1.vqh
                        _44u7_p3_0.vqh _44u7_p4_0.vqh _44u7_p5_0.vqh
                        _44u7_p6_0.vqh _44u7_p7_0.vqh _44u7_p7_1.vqh
                        _44u7_p8_0.vqh _44u7_p8_1.vqh _44u7_p9_0.vqh
                        _44u7_p9_1.vqh _44u7_p9_2.vqh
  Log:
  The 'Grand Simplification' officially becomes the mainline toward rc4.
  
  Currently, only 44/48kHz stereo is supported.

Revision  Changes    Path
1.55      +3 -3      vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- configure.in	2002/03/18 03:31:16	1.54
+++ configure.in	2002/06/28 22:19:33	1.55
@@ -5,7 +5,7 @@
 dnl ------------------------------------------------
 
 AC_INIT(lib/mdct.c)
-AM_INIT_AUTOMAKE(libvorbis,1.0rc3)
+AM_INIT_AUTOMAKE(libvorbis,1.0rc4)
 
 dnl Library versioning
 
@@ -121,8 +121,8 @@
                   fi;;
         powerpc-*-linux*)
                 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES"
-		CFLAGS="-O3 -ffast-math -mfused-madd -mpowerpc-gpopt -mpowerpc-gfxopt -D_REENTRANT"
-		PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mpowerpc-gpopt -mpowerpc-gfxopt -D_REENTRANT";;
+		CFLAGS="-O3 -ffast-math -mfused-madd -D_REENTRANT"
+		PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";;
         *-*-linux*)
                 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
                 CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"

<p><p>1.41      +3 -2      vorbis/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- encoder_example.c	2002/03/29 07:10:38	1.40
+++ encoder_example.c	2002/06/28 22:19:34	1.41
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.40 2002/03/29 07:10:38 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.41 2002/06/28 22:19:34 xiphmont Exp $
 
  ********************************************************************/
 
@@ -97,7 +97,8 @@
   /* (quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR) */
   vorbis_info_init(&vi);
 
-  vorbis_encode_init_vbr(&vi,2,44100,.4);
+  //vorbis_encode_init(&vi,2,44100,-1,82000,-1);
+  vorbis_encode_init_vbr(&vi,2,44100,.9);
 
   /* add a comment */
   vorbis_comment_init(&vc);

<p><p>1.15      +3 -3      vorbis/lib/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Makefile.am	2002/03/18 05:06:39	1.14
+++ Makefile.am	2002/06/28 22:19:34	1.15
@@ -9,12 +9,12 @@
 lib_LTLIBRARIES = libvorbis.la libvorbisfile.la libvorbisenc.la
 
 libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c \
-			lpc.c analysis.c synthesis.c psy.c info.c time0.c \
+			lpc.c analysis.c synthesis.c psy.c info.c \
                         floor1.c floor0.c\
                         res0.c mapping0.c registry.c codebook.c sharedbook.c\
                         lookup.c bitrate.c\
                         envelope.h lpc.h lsp.h codebook.h misc.h psy.h\
-			masking.h os.h mdct.h smallft.h\
+			masking.h os.h mdct.h smallft.h highlevel.h\
                         registry.h scales.h window.h lookup.h lookup_data.h\
                         codec_internal.h backends.h bitrate.h 
 libvorbis_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
@@ -22,7 +22,7 @@
 libvorbisfile_la_SOURCES = vorbisfile.c
 libvorbisfile_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@
 
-libvorbisenc_la_SOURCES = vorbisenc.c registry-api.h
+libvorbisenc_la_SOURCES = vorbisenc.c 
 libvorbisenc_la_LDFLAGS = -version-info @VE_LIB_CURRENT@:@VE_LIB_REVISION@:@VE_LIB_AGE@
 
 EXTRA_PROGRAMS = barkmel tone psytune

<p><p>1.52      +35 -37    vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- analysis.c	2002/03/29 07:10:38	1.51
+++ analysis.c	2002/06/28 22:19:34	1.52
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.51 2002/03/29 07:10:38 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.52 2002/06/28 22:19:34 xiphmont Exp $
 
  ********************************************************************/
 
@@ -30,12 +30,7 @@
 
 /* decides between modes, dispatches to the appropriate mapping. */
 int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
-  vorbis_dsp_state     *vd=vb->vd;
-  backend_lookup_state *b=vd->backend_state;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=vi->codec_setup;
-  int                   type,ret;
-  int                   mode=0;
+  int                   ret;
 
   vb->glue_bits=0;
   vb->time_bits=0;
@@ -44,26 +39,20 @@
 
   /* 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 &&ci->modes>1)mode=1;
-  type=ci->map_type[ci->mode_param[mode]->mapping];
-  vb->mode=mode;
-
-  /* Encode frame mode, pre,post windowsize, then dispatch */
-  oggpack_write(&vb->opb,mode,b->modebits);
-  if(vb->W){
-    oggpack_write(&vb->opb,vb->lW,1);
-    oggpack_write(&vb->opb,vb->nW,1);
-  }
+  /* we only have one mapping type (0), and we let the mapping code
+     itself figure out what soft mode to use.  This allows easier
+     bitrate management */
 
-  if((ret=_mapping_P[type]->forward(vb,b->mode[mode])))
+  if((ret=_mapping_P[0]->forward(vb)))
     return(ret);
 
   if(op){
+    if(vorbis_bitrate_managed(vb))
+      /* The app is using a bitmanaged mode... but not using the
+         bitrate management interface. */
+      return(OV_EINVAL);
+    
     op->packet=oggpack_get_buffer(&vb->opb);
     op->bytes=oggpack_bytes(&vb->opb);
     op->b_o_s=0;
@@ -90,18 +79,20 @@
       if(dB && v[j]==0)
         fprintf(of,"\n\n");
       else{
-	if(bark)
-	  fprintf(of,"%g ",toBARK(22050.f*j/n));
-	else
-	  if(off!=0)
-	    fprintf(of,"%g ",(double)(j+off)/44100.);
+	if(v[j]>-900.){
+	  if(bark)
+	    fprintf(of,"%f ",toBARK(22050.f*j/n));
           else
-	    fprintf(of,"%g ",(double)j);
-
-	if(dB){
-	  fprintf(of,"%g\n",todB(v+j));
-	}else{
-	  fprintf(of,"%g\n",v[j]);
+	    if(off!=0)
+	      fprintf(of,"%f ",(double)(j+off)/44100.);
+	    else
+	    fprintf(of,"%f ",(double)j);
+	  
+	  if(dB){
+	    fprintf(of,"%f\n",todB(v+j));
+	  }else{
+	    fprintf(of,"%f\n",v[j]);
+	  }
         }
       }
     }
@@ -109,11 +100,18 @@
     /*  } */
 }
 
-void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
-#ifdef ANALYSIS
-  if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB);
-#endif
+void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
+		      ogg_int64_t off){
+  if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
 }
+
+
+
+
+
+
+
+
 
 
 

<p><p>1.13      +12 -59    vorbis/lib/backends.h

Index: backends.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/backends.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- backends.h	2001/12/20 01:00:26	1.12
+++ backends.h	2002/06/28 22:19:35	1.13
@@ -12,7 +12,7 @@
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.12 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: backends.h,v 1.13 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,44 +26,13 @@
 #include "codec_internal.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 *);
-  vorbis_info_time *(*copy_info)(vorbis_info_time *);
-
-  void (*free_info) (vorbis_info_time *);
-  void (*free_look) (vorbis_look_time *);
-  int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
-		     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 *);
-  vorbis_info_floor     *(*copy_info)(vorbis_info_floor *);
+  vorbis_look_floor     *(*look)  (vorbis_dsp_state *,vorbis_info_floor *);
   void (*free_info) (vorbis_info_floor *);
   void (*free_look) (vorbis_look_floor *);
-  int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
-		     float *, const float *, /* in */
-		     const float *, const float *, /* in */
-		     float *);                     /* out */
   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
                      void *buffer,float *);
@@ -85,6 +54,7 @@
 
 } vorbis_info_floor0;
 
+
 #define VIF_POSIT 63
 #define VIF_CLASS 16
 #define VIF_PARTS 31
@@ -107,12 +77,8 @@
   float maxunder;  
   float maxerr;    
 
-  int   twofitminsize;
-  int   twofitminused;
-  int   twofitweight;  
+  float twofitweight;  
   float twofitatten;
-  int   unusedminsize;
-  int   unusedmin_n;
 
   int   n;
 
@@ -122,15 +88,14 @@
 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_look_residue *(*look)  (vorbis_dsp_state *,
                                  vorbis_info_residue *);
-  vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
   void (*free_info)    (vorbis_info_residue *);
   void (*free_look)    (vorbis_look_residue *);
   long **(*class)      (struct vorbis_block *,vorbis_look_residue *,
                         float **,int *,int);
   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
-			float **,float **,int *,int,int,long **,ogg_uint32_t *);
+			float **,float **,int *,int,long **);
   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
                         float **,int *,int);
 } vorbis_func_residue;
@@ -147,11 +112,9 @@
   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 */
+  float  classmetric1[64];  
+  float  classmetric2[64];  
+
 } vorbis_info_residue0;
 
 /* Mapping backend generic *****************************************/
@@ -159,34 +122,24 @@
   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 *);
-  vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *);
   void (*free_info)    (vorbis_info_mapping *);
-  void (*free_look)    (vorbis_look_mapping *);
-  int  (*forward)      (struct vorbis_block *vb,vorbis_look_mapping *);
-  int  (*inverse)      (struct vorbis_block *vb,vorbis_look_mapping *);
+  int  (*forward)      (struct vorbis_block *vb);
+  int  (*inverse)      (struct vorbis_block *vb,vorbis_info_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   psy[2]; /* by blocktype; impulse/padding for short,
-                   transition/normal for long */
-
   int   coupling_steps;
   int   coupling_mag[256];
   int   coupling_ang[256];
+
 } vorbis_info_mapping0;
 
 #endif
-
-
-
 
 

<p><p>1.10      +2 -9      vorbis/lib/barkmel.c

Index: barkmel.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/barkmel.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- barkmel.c	2001/12/20 01:00:26	1.9
+++ barkmel.c	2002/06/28 22:19:35	1.10
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: bark scale utility
- last mod: $Id: barkmel.c,v 1.9 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: barkmel.c,v 1.10 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -51,14 +51,7 @@
 
 
   }
-  {
-    float i;
-    int j;
-    for(i=0.,j=0;i<28;i+=1,j++){
-      fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n",
-	      j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.));
-    }
-  }
+
   return(0);
 }
 

<p><p>1.13      +112 -195  vorbis/lib/bitrate.c

Index: bitrate.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/bitrate.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- bitrate.c	2002/06/14 17:14:58	1.12
+++ bitrate.c	2002/06/28 22:19:35	1.13
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: bitrate tracking and management
- last mod: $Id: bitrate.c,v 1.12 2002/06/14 17:14:58 msmith Exp $
+ last mod: $Id: bitrate.c,v 1.13 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,60 +27,35 @@
 #include "bitrate.h"
 
 
-static long BINBITS(bitrate_manager_state *bm,long pos,long inbin){
+static long BINBYTES(bitrate_manager_state *bm,long pos,long bin){
   int bins=bm->queue_bins;
-  int bin=((inbin&0x7fffffffUL)>>BITTRACK_BPT);
-  ogg_uint32_t lobits=0;
-  ogg_uint32_t hibits=0;
-  ogg_uint32_t bitdel;
-  
-  if(bin>0)lobits=bm->queue_binned[pos*bins+bin-1];
-  if(bin<bins)
-    hibits=bm->queue_binned[pos*bins+bin];
-  else
-    hibits=lobits;
-
-  bitdel=hibits-lobits;
-
-  return(lobits+bitdel*(inbin&((1<<BITTRACK_BPT)-1))/(1<<BITTRACK_BPT));
-
+  return(bm->queue_binned[pos*bins+bin]);
 }
 
-#define LIMITBITS(pos,bin) ((bin)>-bins?\
-                 bm->minmax_binstack[(pos)*bins*2+((bin)+bins)-1]:0)
+#define LIMITBYTES(pos,bin) (bm->minmax_binstack[(pos)*bins*2+((bin)+bins)])
 
-static long LACING_ADJUST(long bits){
-  int addto=((bits+7)/8+1)/256+1;
-  return( ((bits+7)/8+addto)*8 );
+static long LACING_ADJUST(long bytes){
+  int addto=bytes/255+1;
+  return(bytes+addto);
 }
 
-static double floater_interpolate(bitrate_manager_state *bm,vorbis_info *vi,
+static int floater_interpolate(bitrate_manager_state *bm,vorbis_info *vi,
                                   double desired_rate){
-  int bin=bm->avgfloat*BITTRACK_DIVISOR-1.;
-  double lobitrate;
-  double hibitrate;
-  
-  lobitrate=(double)(bin==0?0:bm->avg_binacc[bin-1])/bm->avg_sampleacc*vi->rate;
+  int bin=rint(bm->avgfloat);
+  double lobitrate,hibitrate;
+
+
+  lobitrate=(double)(bm->avg_binacc[bin]*8)/bm->avg_sampleacc*vi->rate;
   while(lobitrate>desired_rate && bin>0){
     bin--;
-    lobitrate=(double)(bin==0?0:bm->avg_binacc[bin-1])/bm->avg_sampleacc*vi->rate;
+    lobitrate=(double)(bm->avg_binacc[bin]*8)/bm->avg_sampleacc*vi->rate;
   }
 
-  hibitrate=(double)(bin>=bm->queue_bins?bm->avg_binacc[bm->queue_bins-1]:
-		     bm->avg_binacc[bin])/bm->avg_sampleacc*vi->rate;
-  while(hibitrate<desired_rate && bin<bm->queue_bins){
-    bin++;
-    if(bin<bm->queue_bins)
-      hibitrate=(double)bm->avg_binacc[bin]/bm->avg_sampleacc*vi->rate;
+  if(bin+1<bm->queue_bins){
+    hibitrate=(double)(bm->avg_binacc[bin+1]*8)/bm->avg_sampleacc*vi->rate;
+    if(fabs(hibitrate-desired_rate) < fabs(lobitrate-desired_rate))bin++;
   }
-
-  /* interpolate */
-  if(bin==bm->queue_bins){
-    return bin/(double)BITTRACK_DIVISOR;
-  }else{
-    double delta=(desired_rate-lobitrate)/(hibitrate-lobitrate);
-    return (bin+delta)/BITTRACK_DIVISOR;
-  }
+  return(bin);
 }
 
 /* try out a new limit */
@@ -89,13 +64,13 @@
   long acc=bm->minmax_acctotal;
   long bins=bm->queue_bins;
   
-  acc-=LIMITBITS(i,0);
-  acc+=LIMITBITS(i,limit);
+  acc-=LIMITBYTES(i,0);
+  acc+=LIMITBYTES(i,limit);
 
   while(i-->0){
     if(bm->minmax_limitstack[i]<=limit)break;
-    acc-=LIMITBITS(i,bm->minmax_limitstack[i]);
-    acc+=LIMITBITS(i,limit);
+    acc-=LIMITBYTES(i,bm->minmax_limitstack[i]);
+    acc+=LIMITBYTES(i,limit);
   }
   return(acc);
 }
@@ -123,20 +98,19 @@
        (bi->queue_avgmin>0 || bi->queue_avgmax>0 || bi->queue_hardmax>0 ||
         bi->queue_hardmin>0)){
       long maxpackets=maxlatency/(ci->blocksizes[0]>>1)+3;
-      long bins=BITTRACK_DIVISOR*ci->passlimit[ci->coupling_passes-1];
+      long bins=PACKETBLOBS;
       
       bm->queue_size=maxpackets;
       bm->queue_bins=bins;
-      bm->queue_binned=_ogg_malloc(maxpackets*bins*sizeof(*bm->queue_binned));
-      bm->queue_actual=_ogg_malloc(maxpackets*sizeof(*bm->queue_actual));
+      bm->queue_binned=_ogg_calloc(maxpackets,bins*sizeof(*bm->queue_binned));
+      bm->queue_actual=_ogg_calloc(maxpackets,sizeof(*bm->queue_actual));
       
       if((bi->queue_avgmin>0 || bi->queue_avgmax>0) &&
          bi->queue_avg_time>0){
         
         bm->avg_binacc=_ogg_calloc(bins,sizeof(*bm->avg_binacc));
-	bm->avgfloat=bi->avgfloat_initial;
+	bm->avgfloat=PACKETBLOBS/2;
         
-	
       }else{
         bm->avg_tail= -1;
       }
@@ -155,15 +129,16 @@
       }
       
       /* space for the packet queueing */
-      bm->queue_packet_buffers=_ogg_calloc(maxpackets,sizeof(*bm->queue_packet_buffers));
-      bm->queue_packets=_ogg_calloc(maxpackets,sizeof(*bm->queue_packets));
+      bm->packetbuffers=_ogg_calloc(maxpackets,sizeof(*bm->packetbuffers));
+      bm->packets=_ogg_calloc(maxpackets,sizeof(*bm->packets));
       for(i=0;i<maxpackets;i++)
-	oggpack_writeinit(bm->queue_packet_buffers+i);
+	oggpack_writeinit(bm->packetbuffers+i);
       
     }else{
-      bm->queue_packet_buffers=_ogg_calloc(1,sizeof(*bm->queue_packet_buffers));
-      bm->queue_packets=_ogg_calloc(1,sizeof(*bm->queue_packets));
-      oggpack_writeinit(bm->queue_packet_buffers);
+      bm->packetbuffers=_ogg_calloc(1,sizeof(*bm->packetbuffers));
+      bm->packets=_ogg_calloc(1,sizeof(*bm->packets));
+      oggpack_writeinit(bm->packetbuffers);
+
     }      
   }
 }
@@ -177,17 +152,18 @@
     if(bm->minmax_binstack)_ogg_free(bm->minmax_binstack);
     if(bm->minmax_posstack)_ogg_free(bm->minmax_posstack);
     if(bm->minmax_limitstack)_ogg_free(bm->minmax_limitstack);
-    if(bm->queue_packet_buffers){
+
+    if(bm->packetbuffers){
       if(bm->queue_size==0){
-	oggpack_writeclear(bm->queue_packet_buffers);
-	_ogg_free(bm->queue_packet_buffers);
+	oggpack_writeclear(bm->packetbuffers);
       }else{
         for(i=0;i<bm->queue_size;i++)
-	  oggpack_writeclear(bm->queue_packet_buffers+i);
-	_ogg_free(bm->queue_packet_buffers);
+	  oggpack_writeclear(bm->packetbuffers+i);	
       }
+      _ogg_free(bm->packetbuffers);
     }
-    if(bm->queue_packets)_ogg_free(bm->queue_packets);
+    if(bm->packets)_ogg_free(bm->packets);
+    
     memset(bm,0,sizeof(*bm));
   }
 }
@@ -201,10 +177,6 @@
   return(0);
 }
 
-int vorbis_bitrate_maxmarkers(void){
-  return 8*BITTRACK_DIVISOR;
-}
-
 /* finish taking in the block we just processed */
 int vorbis_bitrate_addblock(vorbis_block *vb){
   int i; 
@@ -233,15 +205,15 @@
                                      being claimed */
     bm->queue_head++;
 
-    bm->queue_packets[0].packet=oggpack_get_buffer(&vb->opb);
-    bm->queue_packets[0].bytes=oggpack_bytes(&vb->opb);
-    bm->queue_packets[0].b_o_s=0;
-    bm->queue_packets[0].e_o_s=vb->eofflag;
-    bm->queue_packets[0].granulepos=vb->granulepos;
-    bm->queue_packets[0].packetno=vb->sequence; /* for sake of completeness */
+    bm->packets[0].packet=oggpack_get_buffer(&vb->opb);
+    bm->packets[0].bytes=oggpack_bytes(&vb->opb);
+    bm->packets[0].b_o_s=0;
+    bm->packets[0].e_o_s=vb->eofflag;
+    bm->packets[0].granulepos=vb->granulepos;
+    bm->packets[0].packetno=vb->sequence; /* for sake of completeness */
 
-    memcpy(&temp,bm->queue_packet_buffers,sizeof(vb->opb));
-    memcpy(bm->queue_packet_buffers,&vb->opb,sizeof(vb->opb));
+    memcpy(&temp,bm->packetbuffers,sizeof(vb->opb));
+    memcpy(bm->packetbuffers,&vb->opb,sizeof(vb->opb));
     memcpy(&vb->opb,&temp,sizeof(vb->opb));
 
     return(0);
@@ -260,20 +232,23 @@
   bm->queue_actual[head]=(vb->W?0x80000000UL:0);
 
   /* buffer packet fields */
-  bm->queue_packets[head].packet=oggpack_get_buffer(&vb->opb);
-  bm->queue_packets[head].bytes=oggpack_bytes(&vb->opb);
-  bm->queue_packets[head].b_o_s=0;
-  bm->queue_packets[head].e_o_s=vb->eofflag;
-  bm->queue_packets[head].granulepos=vb->granulepos;
-  bm->queue_packets[head].packetno=vb->sequence; /* for sake of completeness */
+  bm->packets[head].packet=oggpack_get_buffer(&vb->opb);
+  bm->packets[head].bytes=oggpack_bytes(&vb->opb);
+  bm->packets[head].b_o_s=0;
+  bm->packets[head].e_o_s=vb->eofflag;
+  bm->packets[head].granulepos=vb->granulepos;
+  bm->packets[head].packetno=vb->sequence; /* for sake of completeness */
 
   /* swap packet buffers */
-  memcpy(&temp,bm->queue_packet_buffers+head,sizeof(vb->opb));
-  memcpy(bm->queue_packet_buffers+head,&vb->opb,sizeof(vb->opb));
+  memcpy(&temp,bm->packetbuffers+head,sizeof(vb->opb));
+  memcpy(bm->packetbuffers+head,&vb->opb,sizeof(vb->opb));
   memcpy(&vb->opb,&temp,sizeof(vb->opb));
 
   /* save markers */
-  memcpy(head_ptr,vbi->packet_markers,sizeof(*head_ptr)*bins);
+  head_ptr[0]=vbi->packetblob_markers[0];
+  for(i=1;i<PACKETBLOBS;i++){
+    head_ptr[i]=vbi->packetblob_markers[i]-vbi->packetblob_markers[i-1];
+  }
 
   if(bm->avg_binacc)
     new_minmax_head=minmax_head=bm->avg_center;
@@ -301,12 +276,10 @@
         int samples=ci->blocksizes[vb->W]>>1;
         double upper=floater_interpolate(bm,vi,bi->queue_avgmax);
         double lower=floater_interpolate(bm,vi,bi->queue_avgmin);
-	double new=bi->avgfloat_initial,slew;
+	double new=PACKETBLOBS/2.,slew;
         int bin;
         
-	if(upper>0. && upper<new)new=upper;
-	if(lower<bi->avgfloat_minimum)
-	  lower=bi->avgfloat_minimum;
+	if(upper<new)new=upper;
         if(lower>new)new=lower;
         
         slew=(new-bm->avgfloat)/samples*vi->rate;
@@ -317,9 +290,11 @@
           new=bm->avgfloat+bi->avgfloat_upslew_max/vi->rate*samples;
         
         bm->avgfloat=new;
-
         /* apply the average floater to new blocks */
-	bin=bm->avgfloat*(BITTRACK_DIVISOR<<BITTRACK_BPT);
+	bin=rint(bm->avgfloat);
+
+	/*fprintf(stderr,"%d ",bin);*/
+
         
         while(bm->avg_centeracc>desired_center){
           samples=ci->blocksizes[bm->queue_actual[bm->avg_center]&
@@ -329,50 +304,10 @@
           
           bm->avg_centeracc-=samples;
           bm->avg_center++;
-	  if(bm->noisetrigger_postpone)bm->noisetrigger_postpone-=samples;
           if(bm->avg_center>=bm->queue_size)bm->avg_center=0;
         }
         new_minmax_head=bm->avg_center;
         
-	/* track noise bias triggers and noise bias */
-	if(bm->avgfloat<bi->avgfloat_noise_lowtrigger)
-	  bm->noisetrigger_request+=1.f;
-	else
-	  if(bm->noisetrigger_request>0. && bm->avgnoise>0.)
-	    bm->noisetrigger_request-=.2f;
-	
-	if(bm->avgfloat>bi->avgfloat_noise_hightrigger)
-	  bm->noisetrigger_request-=1.f;
-	else
-	  if(bm->noisetrigger_request<0 && bm->avgnoise<0.)
-	    bm->noisetrigger_request+=.2f;
-	
-	if(bm->noisetrigger_postpone<=0){
-	  if(bm->noisetrigger_request<0.){
-	    bm->avgnoise-=1.f;
-	    if(-bm->noisetrigger_request>(signed long)(bm->avg_sampleacc)/2)
-	      bm->avgnoise-=1.f;
-	    bm->noisetrigger_postpone=bm->avg_sampleacc/2;
-	  }
-	  if(bm->noisetrigger_request>0.){
-	    bm->avgnoise+=1.f;
-	    if(bm->noisetrigger_request>(signed long)(bm->avg_sampleacc)/2)
-	      bm->avgnoise+=1.f;
-	    bm->noisetrigger_postpone=bm->avg_sampleacc/2;
-	  }
-	  
-	  /* we generally want the noise bias to drift back to zero */
-	  bm->noisetrigger_request=0.f;
-	  if(bm->avgnoise>0)
-	    bm->noisetrigger_request= -1.;
-	  if(bm->avgnoise<0)
-	    bm->noisetrigger_request= +1.;
-	  
-	  if(bm->avgnoise<bi->avgfloat_noise_minval)
-	    bm->avgnoise=bi->avgfloat_noise_minval;
-	  if(bm->avgnoise>bi->avgfloat_noise_maxval)
-	    bm->avgnoise=bi->avgfloat_noise_maxval;
-	}
       }
       
       /* update the avg tail if needed */
@@ -392,7 +327,7 @@
     /* if we're not using an average tracker, the 'float' is nailed to
        the avgfloat_initial value.  It needs to be set for the min/max
        to deal properly */
-    long bin=bi->avgfloat_initial*(BITTRACK_DIVISOR<<BITTRACK_BPT);
+    long bin=PACKETBLOBS/2;
     bm->queue_actual[head]|=bin;
     new_minmax_head=next_head;
   }	
@@ -407,42 +342,16 @@
       int samples=ci->blocksizes[bm->queue_actual[minmax_head]&
                                 0x80000000UL?1:0]>>1;
       
-	/* the construction here is not parallel to the floater's
-	   stack.  
-
-	   floater[bin-1]  <-> floater supported at bin
-	   ...
-	   floater[0]      <-> floater supported at 1
-	   supported at zero is implicit.  
-	   the BINBITS macro performs offsetting
-
-     
-      bin  minmax[bin*2-1] <-> floater supported at bin
-	   ...
-	1  minmax[bin]     <-> floater supported at 1
-	0  minmax[bin-1]   <-> no limit/support (limited to/supported at bin 0,
-	                                         ie, no effect)
-       -1  minmax[bin-2]   <-> floater limited to bin-1
-	   ...
-    -bin+1  minmax[0]       <-> floater limited to 1
-	    limited to zero (val= -bin) is implicit
-	*/
       for(i=0;i<(unsigned int)bins;i++){
         bm->minmax_binstack[bm->minmax_stackptr*bins*2+bins+i]+=
-	  LACING_ADJUST(
-	  BINBITS(bm,minmax_head,
-		  (bm->queue_actual[minmax_head]&0x7fffffffUL)>
-		  ((i+1)<<BITTRACK_BPT)?
-		  bm->queue_actual[minmax_head]:
-		  ((i+1)<<BITTRACK_BPT)));
+	  LACING_ADJUST(BINBYTES(bm,minmax_head,
+				(bm->queue_actual[minmax_head]&0x7fffffffUL)>i?
+				bm->queue_actual[minmax_head]:i));
         
         bm->minmax_binstack[bm->minmax_stackptr*bins*2+i]+=
-	  LACING_ADJUST(
-	  BINBITS(bm,minmax_head,
-		  (bm->queue_actual[minmax_head]&0x7fffffffUL)<
-		  ((i+1)<<BITTRACK_BPT)?
-		  bm->queue_actual[minmax_head]:
-		  ((i+1)<<BITTRACK_BPT)));
+	  LACING_ADJUST(BINBYTES(bm,minmax_head,
+				(bm->queue_actual[minmax_head]&0x7fffffffUL)<i?
+				bm->queue_actual[minmax_head]:i));
       }
       
       bm->minmax_posstack[bm->minmax_stackptr]=minmax_head; /* not one
@@ -452,7 +361,7 @@
       bm->minmax_limitstack[bm->minmax_stackptr]=0;
       bm->minmax_sampleacc+=samples;
       bm->minmax_acctotal+=
-	LACING_ADJUST(BINBITS(bm,minmax_head,bm->queue_actual[minmax_head]));
+	LACING_ADJUST(BINBYTES(bm,minmax_head,bm->queue_actual[minmax_head]));
       
       minmax_head++;
       if(minmax_head>=bm->queue_size)minmax_head=0;
@@ -460,14 +369,15 @@
     
     /* check limits, enforce changes */
     if(bm->minmax_sampleacc>sampledesired){
-      double bitrate=(double)bm->minmax_acctotal/bm->minmax_sampleacc*vi->rate;
+      double bitrate=(double)(bm->minmax_acctotal*8)/
+	bm->minmax_sampleacc*vi->rate;
       int limit=0;
       
       if((bi->queue_hardmax>0 && bitrate>bi->queue_hardmax) || 
          (bi->queue_hardmin>0 && bitrate<bi->queue_hardmin)){
         int newstack;
         int stackctr;
-	long bitsum=limit_sum(bm,0);
+	long bitsum=limit_sum(bm,0)*8;
 
         bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate;
 
@@ -476,13 +386,13 @@
            where we see the whole point of the limit stacks.  */
         if(bi->queue_hardmax>0 && bitrate>bi->queue_hardmax){
           for(limit=-1;limit>-bins;limit--){
-	    long bitsum=limit_sum(bm,limit);
+	    long bitsum=limit_sum(bm,limit)*8;
             bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate;
             if(bitrate<=bi->queue_hardmax)break;
           }
         }else if(bitrate<bi->queue_hardmin){
           for(limit=1;limit<bins;limit++){
-	    long bitsum=limit_sum(bm,limit);
+	    long bitsum=limit_sum(bm,limit)*8;
             bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate;
             if(bitrate>=bi->queue_hardmin)break;
           }
@@ -490,11 +400,11 @@
         }
 
         for(i=limit-1;i>-bins;i--){
-	  long bitsum=limit_sum(bm,i);
+	  long bitsum=limit_sum(bm,i)*8;
           bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate;
         }
 
-	bitsum=limit_sum(bm,limit);
+	bitsum=limit_sum(bm,limit)*8;
         bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate;
 
         /* trace the limit backward, stop when we see a lower limit */
@@ -509,8 +419,8 @@
         stackctr=bm->minmax_stackptr;
         while(stackctr>newstack){
           bm->minmax_acctotal-=
-	    LIMITBITS(stackctr,bm->minmax_limitstack[stackctr]);
-	  bm->minmax_acctotal+=LIMITBITS(stackctr,limit);
+	    LIMITBYTES(stackctr,bm->minmax_limitstack[stackctr]);
+	  bm->minmax_acctotal+=LIMITBYTES(stackctr,limit);
 
           if(stackctr<bm->minmax_stackptr)
             for(i=0;i<bins*2;i++)
@@ -543,24 +453,24 @@
 
       for(i=0;i<bins;i++){
         bm->minmax_binstack[bins+i]-= /* always comes off the stack bottom */
-	  LACING_ADJUST(BINBITS(bm,bm->minmax_tail,
-				actual>((i+1)<<BITTRACK_BPT)?
-				actual:((i+1)<<BITTRACK_BPT)));
+	  LACING_ADJUST(BINBYTES(bm,bm->minmax_tail,
+				actual>i?
+				actual:i));
         bm->minmax_binstack[i]-= 
-	  LACING_ADJUST(BINBITS(bm,bm->minmax_tail,
-				actual<((i+1)<<BITTRACK_BPT)?
-				actual:((i+1)<<BITTRACK_BPT)));
+	  LACING_ADJUST(BINBYTES(bm,bm->minmax_tail,
+				actual<i?
+				actual:i));
       }
 
       /* always perform in this order; max overrules min */
-      if((bm->minmax_limitstack[0]<<BITTRACK_BPT)>actual)
-	actual=(bm->minmax_limitstack[0]<<BITTRACK_BPT);
-      if(((bins+bm->minmax_limitstack[0])<<BITTRACK_BPT)<actual)
-	actual=(bins+bm->minmax_limitstack[0])<<BITTRACK_BPT;
-
-      bm->minmax_acctotal-=LACING_ADJUST(BINBITS(bm,bm->minmax_tail,actual));
+      if(bm->minmax_limitstack[0]>actual)
+	actual=bm->minmax_limitstack[0];
+      if(bins+bm->minmax_limitstack[0]<actual)
+	actual=bins+bm->minmax_limitstack[0];
+      
+      bm->minmax_acctotal-=LACING_ADJUST(BINBYTES(bm,bm->minmax_tail,actual));
       bm->minmax_sampleacc-=samples;
-     
+      
       /* revise queue_actual to reflect the limit */
       bm->queue_actual[bm->minmax_tail]&=0x80000000UL;
       bm->queue_actual[bm->minmax_tail]|=actual;
@@ -597,21 +507,28 @@
   if(bm->queue_size==0){
     if(bm->queue_head==0)return(0);
 
-    memcpy(op,bm->queue_packets,sizeof(*op));
+    memcpy(op,bm->packets,sizeof(*op));
     bm->queue_head=0;
 
   }else{
-    long bin;
-    long bytes;
 
     if(bm->next_to_flush==bm->last_to_flush)return(0);
 
-    bin=bm->queue_actual[bm->next_to_flush];
-    bytes=(BINBITS(bm,bm->next_to_flush,bin)+7)/8;
-    
-    memcpy(op,bm->queue_packets+bm->next_to_flush,sizeof(*op));
-
-    if(bytes<op->bytes)op->bytes=bytes;
+    {
+      long bin=bm->queue_actual[bm->next_to_flush]&0x7fffffff,i;
+      long bins=bm->queue_bins;
+      ogg_uint32_t *markers=bm->queue_binned+bins*bm->next_to_flush;
+      long bytes=markers[bin];
+
+      memcpy(op,bm->packets+bm->next_to_flush,sizeof(*op));
+
+      /* we have [PACKETBLOBS] possible packets all squished together in
+	 the buffer, in sequence.  count in to number [bin] */
+      for(i=0;i<bin;i++)
+	op->packet+=markers[i];
+      op->bytes=bytes;
+	
+    }
 
     bm->next_to_flush++;
     if(bm->next_to_flush>=bm->queue_size)bm->next_to_flush=0;

<p><p>1.6       +4 -15     vorbis/lib/bitrate.h

Index: bitrate.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/bitrate.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- bitrate.h	2001/12/23 11:53:52	1.5
+++ bitrate.h	2002/06/28 22:19:35	1.6
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: bitrate tracking and management
- last mod: $Id: bitrate.h,v 1.5 2001/12/23 11:53:52 xiphmont Exp $
+ last mod: $Id: bitrate.h,v 1.6 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,8 +23,6 @@
 #include "os.h"
 
 /* encode side bitrate tracking */
-#define BITTRACK_DIVISOR 16
-#define BITTRACK_BPT     6
 typedef struct bitrate_manager_state {
   ogg_uint32_t  *queue_binned;
   ogg_uint32_t  *queue_actual;
@@ -55,13 +53,10 @@
   int            last_to_flush;
   
   double         avgfloat;
-  double         avgnoise;
-  long           noisetrigger_postpone;
-  double         noisetrigger_request;
 
   /* unfortunately, we need to hold queued packet data somewhere */
-  oggpack_buffer *queue_packet_buffers;
-  ogg_packet     *queue_packets;
+  oggpack_buffer *packetbuffers;
+  ogg_packet     *packets;
 
 } bitrate_manager_state;
 
@@ -75,20 +70,14 @@
   double queue_avgmin;
   double queue_avgmax;
 
-  double avgfloat_initial; /* set by mode */
-  double avgfloat_minimum; /* set by mode */
   double avgfloat_downslew_max;
   double avgfloat_upslew_max;
-  double avgfloat_noise_lowtrigger;
-  double avgfloat_noise_hightrigger;
-  double avgfloat_noise_minval;
-  double avgfloat_noise_maxval;
+
 } bitrate_manager_info;
 
 extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs);
 extern void vorbis_bitrate_clear(bitrate_manager_state *bs);
 extern int vorbis_bitrate_managed(vorbis_block *vb);
-extern int vorbis_bitrate_maxmarkers(void);
 extern int vorbis_bitrate_addblock(vorbis_block *vb);
 extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op);
 

<p><p>1.65      +61 -34    vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- block.c	2002/03/29 07:34:09	1.64
+++ block.c	2002/06/28 22:19:35	1.65
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.64 2002/03/29 07:34:09 xiphmont Exp $
+ last mod: $Id: block.c,v 1.65 2002/06/28 22:19:35 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -33,7 +33,8 @@
 
 static int ilog2(unsigned int v){
   int ret=0;
-  while(v>1){
+  if(v)--v;
+  while(v){
     ret++;
     v>>=1;
   }
@@ -94,8 +95,6 @@
       vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal));
     oggpack_writeinit(&vb->opb);
     vbi->ampmax=-9999;
-    vbi->packet_markers=_ogg_malloc(vorbis_bitrate_maxmarkers()*
-			       sizeof(*vbi->packet_markers));
   }
   
   return(0);
@@ -154,12 +153,8 @@
   _vorbis_block_ripcord(vb);
   if(vb->localstore)_ogg_free(vb->localstore);
 
-  if(vb->internal){
-    vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
-    if(vbi->packet_markers)_ogg_free(vbi->packet_markers);
-
+  if(vb->internal)
     _ogg_free(vb->internal);
-  }
 
   memset(vb,0,sizeof(*vb));
   return(0);
@@ -195,12 +190,27 @@
   b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
 
   if(encp){ /* encode/decode differ here */
+
+    /* analysis always needs an fft */
+    drft_init(&b->fft_look[0],ci->blocksizes[0]);
+    drft_init(&b->fft_look[1],ci->blocksizes[1]);
+
     /* finish the codebooks */
     if(!ci->fullbooks){
       ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
       for(i=0;i<ci->books;i++)
         vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
     }
+
+    b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy));
+    for(i=0;i<ci->psys;i++){
+      _vp_psy_init(b->psy+i,
+		   ci->psy_param[i],
+		   &ci->psy_g_param,
+		   ci->blocksizes[ci->psy_param[i]->blockflag]/2,
+		   vi->rate);
+    }
+
     v->analysisp=1;
   }else{
     /* finish the codebooks */
@@ -236,14 +246,17 @@
 
   v->pcm_current=v->centerW;
 
-  /* initialize all the mapping/backend lookups */
-  b->mode=_ogg_calloc(ci->modes,sizeof(*b->mode));
-  for(i=0;i<ci->modes;i++){
-    int mapnum=ci->mode_param[i]->mapping;
-    int maptype=ci->map_type[mapnum];
-    b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
-					 ci->map_param[mapnum]);
-  }
+  /* initialize all the backend lookups */
+  b->flr=_ogg_calloc(ci->floors,sizeof(*b->flr));
+  b->residue=_ogg_calloc(ci->residues,sizeof(*b->residue));
+
+  for(i=0;i<ci->floors;i++)
+    b->flr[i]=_floor_P[ci->floor_type[i]]->
+      look(v,ci->floor_param[i]);
+
+  for(i=0;i<ci->residues;i++)
+    b->residue[i]=_residue_P[ci->residue_type[i]]->
+      look(v,ci->residue_param[i]);    
 
   return(0);
 }
@@ -293,8 +306,31 @@
         _ogg_free(b->transform[1][0]);
         _ogg_free(b->transform[1]);
       }
+
+      if(b->flr){
+	for(i=0;i<ci->floors;i++)
+	  _floor_P[ci->floor_type[i]]->
+	    free_look(b->flr[i]);
+	_ogg_free(b->flr);
+      }
+      if(b->residue){
+	for(i=0;i<ci->residues;i++)
+	  _residue_P[ci->residue_type[i]]->
+	    free_look(b->residue[i]);
+	_ogg_free(b->residue);
+      }
+      if(b->psy){
+	for(i=0;i<ci->psys;i++)
+	  _vp_psy_clear(b->psy+i);
+	_ogg_free(b->psy);
+      }
+
       if(b->psy_g_look)_vp_global_free(b->psy_g_look);
       vorbis_bitrate_clear(&b->bms);
+
+      drft_clear(&b->fft_look[0]);
+      drft_clear(&b->fft_look[1]);
+
     }
     
     if(v->pcm){
@@ -304,18 +340,7 @@
       if(v->pcmret)_ogg_free(v->pcmret);
     }
 
-    /* free mode lookups; these are actually vorbis_look_mapping structs */
-    if(ci){
-      for(i=0;i<ci->modes;i++){
-	int mapnum=ci->mode_param[i]->mapping;
-	int maptype=ci->map_type[mapnum];
-	if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
-      }
-    }
-
     if(b){
-      if(b->mode)_ogg_free(b->mode);    
-      
       /* free header, header1, header2 */
       if(b->header)_ogg_free(b->header);
       if(b->header1)_ogg_free(b->header1);
@@ -471,16 +496,18 @@
   /* 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(ci->blocksizes[0]<ci->blocksizes[1]){
+
+  /* we do an envelope search even on a single blocksize; we may still
+     be throwing more bits at impulses, and envelope search handles
+     marking impulses too. */
+  {  
     long bp=_ve_envelope_search(v);
     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+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4;
 
   {
@@ -568,7 +595,7 @@
 
   /* advance storage vectors and clean up */
   {
-    int new_centerNext=ci->blocksizes[1]/2+gi->delaycache;
+    int new_centerNext=ci->blocksizes[1]/2;
     int movementW=centerNext-new_centerNext;
 
     if(movementW>0){

<p><p>1.39      +1 -10     vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- codebook.c	2002/01/22 02:16:40	1.38
+++ codebook.c	2002/06/28 22:19:35	1.39
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.38 2002/01/22 02:16:40 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.39 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -287,15 +287,6 @@
   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));
 }
 

<p><p>1.13      +1 -3      vorbis/lib/codebook.h

Index: codebook.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- codebook.h	2002/01/21 20:51:28	1.12
+++ codebook.h	2002/06/28 22:19:35	1.13
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: codebook.h,v 1.12 2002/01/21 20:51:28 xiphmont Exp $
+ last mod: $Id: codebook.h,v 1.13 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -143,8 +143,6 @@
 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_add(codebook *book, float *a, 

<p><p>1.15      +16 -57    vorbis/lib/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codec_internal.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- codec_internal.h	2002/01/22 11:59:00	1.14
+++ codec_internal.h	2002/06/28 22:19:35	1.15
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.14 2002/01/22 11:59:00 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.15 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,16 +26,16 @@
 #define BLOCKTYPE_TRANSITION 0 
 #define BLOCKTYPE_LONG       1
 
+#define PACKETBLOBS 15
+
 typedef struct vorbis_block_internal{
   float  **pcmdelay;  /* this is a pointer into local storage */ 
   float  ampmax;
   int    blocktype;
 
-  ogg_uint32_t *packet_markers;
+  ogg_uint32_t   packetblob_markers[PACKETBLOBS];
 } vorbis_block_internal;
 
-typedef void vorbis_look_time;
-typedef void vorbis_look_mapping;
 typedef void vorbis_look_floor;
 typedef void vorbis_look_residue;
 typedef void vorbis_look_transform;
@@ -48,7 +48,6 @@
   int mapping;
 } vorbis_info_mode;
 
-typedef void vorbis_info_time;
 typedef void vorbis_info_floor;
 typedef void vorbis_info_residue;
 typedef void vorbis_info_mapping;
@@ -61,11 +60,13 @@
   envelope_lookup        *ve; /* envelope lookup */    
   float                  *window[2];
   vorbis_look_transform **transform[2];    /* block, type */
-  vorbis_look_psy_global *psy_g_look;
+  drft_lookup             fft_look[2];
 
-  /* backend lookups are tied to the mode, not the backend or naked mapping */
   int                     modebits;
-  vorbis_look_mapping   **mode;
+  vorbis_look_floor     **flr;
+  vorbis_look_residue   **residue;
+  vorbis_look_psy        *psy;
+  vorbis_look_psy_global *psy_g_look;
 
   /* local storage, only used on the encoding side.  This way the
      application does not need to worry about freeing some packets'
@@ -79,53 +80,13 @@
 
 } backend_lookup_state;
 
-/* high level configuration information for setting things up
-   step-by-step with the detaile vorbis_encode_ctl interface */
-
-typedef struct highlevel_block {
-  double tone_mask_quality;
-  double tone_peaklimit_quality;
-
-  double noise_bias_quality;
-  double noise_compand_quality;
-
-  double ath_quality;
-
-} highlevel_block;
-
-typedef struct highlevel_encode_setup {
-  double base_quality;       /* these have to be tracked by the ctl */
-  double base_quality_short; /* interface so that the right books get */
-  double base_quality_long;  /* chosen... */
-
-  int short_block_p;
-  int long_block_p;
-  int impulse_block_p;
-
-  int stereo_couple_p;
-  int stereo_backfill_p;
-  int residue_backfill_p;
-
-  int    stereo_point_dB;
-  double stereo_point_kHz[2];
-  double lowpass_kHz[2];
-
-  double ath_floating_dB;
-  double ath_absolute_dB;
-
-  double amplitude_track_dBpersec;
-  double trigger_quality;
-
-  highlevel_block blocktype[4]; /* impulse, padding, trans, long */
-  
-} highlevel_encode_setup;
-
 /* codec_setup_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,
    psychoacoustic settings, channel setup, options, codebook
    etc).  
 *********************************************************************/
 
+#include "highlevel.h"
 typedef struct codec_setup_info {
 
   /* Vorbis supports only short and long blocks, but allows the
@@ -140,7 +101,6 @@
 
   int        modes;
   int        maps;
-  int        times;
   int        floors;
   int        residues;
   int        books;
@@ -149,8 +109,6 @@
   vorbis_info_mode       *mode_param[64];
   int                     map_type[64];
   vorbis_info_mapping    *map_param[64];
-  int                     time_type[64];
-  vorbis_info_time       *time_param[64];
   int                     floor_type[64];
   vorbis_info_floor      *floor_param[64];
   int                     residue_type[64];
@@ -158,17 +116,18 @@
   static_codebook        *book_param[256];
   codebook               *fullbooks;
 
-  vorbis_info_psy        *psy_param[64]; /* encode only */
+  vorbis_info_psy        *psy_param[4]; /* encode only */
   vorbis_info_psy_global psy_g_param;
 
   bitrate_manager_info   bi;
-  highlevel_encode_setup hi;
-
-  int    passlimit[32];     /* iteration limit per couple/quant pass */
-  int    coupling_passes;
+  highlevel_encode_setup hi; /* used only by vorbisenc.c.  It's a
+                                highly redundant structure, but
+                                improves clarity of program flow. */
+  
 } codec_setup_info;
 
 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
 extern void _vp_global_free(vorbis_look_psy_global *look);
 
 #endif
+

<p><p>1.52      +57 -294   vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- floor0.c	2002/02/26 05:21:35	1.51
+++ floor0.c	2002/06/28 22:19:35	1.52
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.51 2002/02/26 05:21:35 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.52 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -33,10 +33,10 @@
 #include <stdio.h>
 
 typedef struct {
-  long n;
   int ln;
   int  m;
-  int *linearmap;
+  int **linearmap;
+  int  n[2];
 
   vorbis_info_floor0 *vi;
   lpc_lookup lpclook;
@@ -46,38 +46,9 @@
   long frames;
 } vorbis_look_floor0;
 
-/* infrastructure for finding fit */
-static long _f0_fit(codebook *book,
-		    float *orig,
-		    float *workfit,
-		    int cursor){
-  int dim=book->dim;
-  float norm,base=0.f;
-  int i,best=0;
-  float *lsp=workfit+cursor;
-
-  if(cursor)base=workfit[cursor-1];
-  norm=orig[cursor+dim-1]-base;
-
-  for(i=0;i<dim;i++)
-    lsp[i]=(orig[i+cursor]-base);
-  best=_best(book,lsp,1);
-
-  memcpy(lsp,book->valuelist+best*dim,dim*sizeof(*lsp));
-  for(i=0;i<dim;i++)
-    lsp[i]+=base;
-  return(best);
-}
 
 /***********************************************/
 
-static vorbis_info_floor *floor0_copy_info (vorbis_info_floor *i){
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  vorbis_info_floor0 *ret=_ogg_malloc(sizeof(*ret));
-  memcpy(ret,info,sizeof(*ret));
-  return(ret);
-}
-
 static void floor0_free_info(vorbis_info_floor *i){
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
   if(info){
@@ -89,11 +60,14 @@
 static void floor0_free_look(vorbis_look_floor *i){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   if(look){
+
+    if(look->linearmap){
 
-    /*fprintf(stderr,"floor 0 bit usage %f\n",
-      (float)look->bits/look->frames);*/
+      if(look->linearmap[0])_ogg_free(look->linearmap[0]);
+      if(look->linearmap[1])_ogg_free(look->linearmap[1]);
 
-    if(look->linearmap)_ogg_free(look->linearmap);
+      _ogg_free(look->linearmap);
+    }
     if(look->lsp_look)_ogg_free(look->lsp_look);
     lpc_clear(&look->lpclook);
     memset(look,0,sizeof(*look));
@@ -101,19 +75,6 @@
   }
 }
 
-static void floor0_pack (vorbis_info_floor *i,oggpack_buffer *opb){
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  int j;
-  oggpack_write(opb,info->order,8);
-  oggpack_write(opb,info->rate,16);
-  oggpack_write(opb,info->barkmap,16);
-  oggpack_write(opb,info->ampbits,6);
-  oggpack_write(opb,info->ampdB,8);
-  oggpack_write(opb,info->numbooks-1,4);
-  for(j=0;j<info->numbooks;j++)
-    oggpack_write(opb,info->books[j],8);
-}
-
 static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
   codec_setup_info     *ci=vi->codec_setup;
   int j;
@@ -150,42 +111,54 @@
    Note that the scale depends on the sampling rate as well as the
    linear block and mapping sizes */
 
-static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
-                              vorbis_info_floor *i){
+static void floor0_map_lazy_init(vorbis_block      *vb,
+				 vorbis_info_floor *infoX,
+				 vorbis_look_floor0 *look){
+  if(!look->linearmap[vb->W]){
+    vorbis_dsp_state   *vd=vb->vd;
+    vorbis_info        *vi=vd->vi;
+    codec_setup_info   *ci=vi->codec_setup;
+    vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX;
+    int W=vb->W;
+    int n=ci->blocksizes[W]/2,j;
+
+    /* we choose a scaling constant so that:
+       floor(bark(rate/2-1)*C)=mapped-1
+     floor(bark(rate/2)*C)=mapped */
+    float scale=look->ln/toBARK(info->rate/2.f);
+    
+    /* the mapping from a linear scale to a smaller bark scale is
+       straightforward.  We do *not* make sure that the linear mapping
+       does not skip bark-scale bins; the decoder simply skips them and
+       the encoder may do what it wishes in filling them.  They're
+       necessary in some mapping combinations to keep the scale spacing
+       accurate */
+    look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
+    for(j=0;j<n;j++){
+      int val=floor( toBARK((info->rate/2.f)/n*j) 
+		     *scale); /* bark numbers represent band edges */
+      if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
+      look->linearmap[W][j]=val;
+    }
+    look->linearmap[W][j]=-1;
+    look->n[W]=n;
+  }
+}
+
+static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
+				      vorbis_info_floor *i){
   int j;
-  float scale;
-  vorbis_info        *vi=vd->vi;
-  codec_setup_info   *ci=vi->codec_setup;
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
   vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
   look->m=info->order;
-  look->n=ci->blocksizes[mi->blockflag]/2;
   look->ln=info->barkmap;
   look->vi=info;
 
   if(vd->analysisp)
     lpc_init(&look->lpclook,look->ln,look->m);
 
-  /* we choose a scaling constant so that:
-     floor(bark(rate/2-1)*C)=mapped-1
-     floor(bark(rate/2)*C)=mapped */
-  scale=look->ln/toBARK(info->rate/2.f);
+  look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap));
 
-  /* the mapping from a linear scale to a smaller bark scale is
-     straightforward.  We do *not* make sure that the linear mapping
-     does not skip bark-scale bins; the decoder simply skips them and
-     the encoder may do what it wishes in filling them.  They're
-     necessary in some mapping combinations to keep the scale spacing
-     accurate */
-  look->linearmap=_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
-  for(j=0;j<look->n;j++){
-    int val=floor( toBARK((info->rate/2.f)/look->n*j) 
-		   *scale); /* bark numbers represent band edges */
-    if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
-    look->linearmap[j]=val;
-  }
-  look->linearmap[j]=-1;
-
   look->lsp_look=_ogg_malloc(look->ln*sizeof(*look->lsp_look));
   for(j=0;j<look->ln;j++)
     look->lsp_look[j]=2*cos(M_PI/look->ln*j);
@@ -193,227 +166,11 @@
   return look;
 }
 
-/* less efficient than the decode side (written for clarity).  We're
-   not bottlenecked here anyway */
-
-float _curve_to_lpc(float *curve,float *lpc,
-		     vorbis_look_floor0 *l){
-  /* map the input curve to a bark-scale curve for encoding */
-  
-  int mapped=l->ln;
-  float *work=alloca(sizeof(*work)*mapped);
-  int i,j,last=0;
-  int bark=0;
-  static int seq=0;
-
-  memset(work,0,sizeof(*work)*mapped);
-  
-  /* Only the decode side is behavior-specced; for now in the encoder,
-     we select the maximum value of each band as representative (this
-     helps make sure peaks don't go out of range.  In error terms,
-     selecting min would make more sense, but the codebook is trained
-     numerically, so we don't actually lose.  We'd still want to
-     use the original curve for error and noise estimation */
-  
-  for(i=0;i<l->n;i++){
-    bark=l->linearmap[i];
-    if(work[bark]<curve[i])work[bark]=curve[i];
-    if(bark>last+1){
-      /* If the bark scale is climbing rapidly, some bins may end up
-         going unused.  This isn't a waste actually; it keeps the
-         scale resolution even so that the LPC generator has an easy
-         time.  However, if we leave the bins empty we lose energy.
-         So, fill 'em in.  The decoder does not do anything with  he
-         unused bins, so we can fill them anyway we like to end up
-         with a better spectral curve */
-
-      /* 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++){
-	float del=(float)j/span;
-	work[j+last]=work[bark]*del+work[last]*(1.f-del);
-      }
-    }
-    last=bark;
-  }
-
-  /* If we're over-ranged to avoid edge effects, fill in the end of spectrum gap */
-  for(i=bark+1;i<mapped;i++)
-    work[i]=work[i-1];
-
-
-  /**********************/
-
-  for(i=0;i<l->n;i++)
-    curve[i]-=150;
-
-  _analysis_output("barkfloor",seq,work,bark,0,0);
-  _analysis_output("barkcurve",seq++,curve,l->n,1,0);
-
-  for(i=0;i<l->n;i++)
-    curve[i]+=150;
-
-  /**********************/
-  
-  return vorbis_lpc_from_curve(work,lpc,&(l->lpclook));
-}
-
-static int floor0_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  float *mdct, const float *logmdct,   /* in */
-			  const float *logmask, const float *logmax, /* in */
-			  float *codedflr){          /* out */
-  long j;
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)in;
-  vorbis_info_floor0 *info=look->vi;
-  float amp;
-  long val=0;
-  static int seq=0;
-
-#ifdef TRAIN_LSP
-  FILE *of;
-  FILE *ef;
-  char buffer[80];
-
-#if 1
-  sprintf(buffer,"lsp0coeff_%d.vqd",vb->mode);
-  of=fopen(buffer,"a");
-#endif
-#endif
-
-  seq++;
-
-
-  /* our floor comes in on a [-Inf...0] dB scale.  The curve has to be
-     positive, so we offset it. */
-
-  for(j=0;j<look->n;j++)
-    codedflr[j]=logmask[j]+info->ampdB;
-
-  /* use 'out' as temp storage */
-  /* Convert our floor to a set of lpc coefficients */ 
-  amp=sqrt(_curve_to_lpc(codedflr,codedflr,look));
-
-  /* amp is in the range (0. to ampdB].  Encode that range using
-     ampbits bits */
- 
-  {
-    long maxval=(1L<<info->ampbits)-1;
-    
-    val=rint(amp/info->ampdB*maxval);
-
-    if(val<0)val=0;           /* likely */
-    if(val>maxval)val=maxval; /* not bloody likely */
-
-    if(val>0)
-      amp=(float)val/maxval*info->ampdB;
-    else
-      amp=0;
-  }
-
-  if(val){
-    /* LSP <-> LPC is orthogonal and LSP quantizes more stably  */
-    _analysis_output("lpc",seq-1,codedflr,look->m,0,0);
-    if(vorbis_lpc_to_lsp(codedflr,codedflr,look->m))
-      val=0;
-
-  }
-
-  oggpack_write(&vb->opb,val,info->ampbits);
-  look->bits+=info->ampbits+1;
-  look->frames++;
-
-  if(val){
-    float *lspwork=alloca(look->m*sizeof(*lspwork));
-
-    /* the spec supports using one of a number of codebooks.  Right
-       now, encode using this lib supports only one */
-    codec_setup_info  *ci=vb->vd->vi->codec_setup;
-    codebook *b;
-    int booknum;
-
-    _analysis_output("lsp",seq-1,codedflr,look->m,0,0);
-
-    /* which codebook to use? We do it only by range right now. */
-    if(info->numbooks>1){
-      float last=0.;
-      for(j=0;j<look->m;j++){
-	float val=codedflr[j]-last;
-	if(val<info->lessthan || val>info->greaterthan)break;
-	last=codedflr[j];
-      }
-      if(j<look->m)
-	booknum=0;
-      else
-	booknum=1;
-    }else
-      booknum=0;
-
-    b=ci->fullbooks+info->books[booknum];
-    oggpack_write(&vb->opb,booknum,_ilog(info->numbooks));
-    look->bits+=_ilog(info->numbooks);
-
-#ifdef TRAIN_LSP
-    {
-      float last=0.f;
-      for(j=0;j<look->m;j++){
-	fprintf(of,"%.12g, ",codedflr[j]-last);
-	last=codedflr[j];
-      }
-    }
-    fprintf(of,"\n");
-    fclose(of);
-
-    sprintf(buffer,"lsp0ent_m%d_b%d.vqd",vb->mode,booknum);
-    ef=fopen(buffer,"a");
-
-#endif
-
-    /* code the spectral envelope, and keep track of the actual
-       quantized values; we don't want creeping error as each block is
-       nailed to the last quantized value of the previous block. */
-
-    for(j=0;j<look->m;j+=b->dim){
-      int entry=_f0_fit(b,codedflr,lspwork,j);
-      look->bits+=vorbis_book_encode(b,entry,&vb->opb);
-
-#ifdef TRAIN_LSP
-      fprintf(ef,"%d,\n",entry);
-#endif
-
-    }
-
-#ifdef TRAIN_LSP
-    fclose(ef);
-#endif
-
-    _analysis_output("lsp2",seq-1,lspwork,look->m,0,0);
-
-    /* take the coefficients back to a spectral envelope curve */
-    for(j=0;j<look->n;j++)
-      codedflr[j]=1.f;
-    vorbis_lsp_to_curve(codedflr,look->linearmap,look->n,look->ln,
-			lspwork,look->m,amp,(float)info->ampdB);
-
-    _analysis_output("barklsp",seq-1,codedflr,look->n,1,1);
-    _analysis_output("lsp3",seq-1,codedflr,look->n,0,1);
-
-    return(val);
-  }
-
-#ifdef TRAIN_LSP
-    fclose(of);
-#endif
-
-  memset(codedflr,0,sizeof(*codedflr)*look->n);
-  memset(mdct,0,sizeof(*mdct)*look->n);
-  return(val);
-}
-
 static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
   int j,k;
-  
+
   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;
@@ -446,23 +203,29 @@
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
   
+  floor0_map_lazy_init(vb,info,look);
+
   if(memo){
     float *lsp=(float *)memo;
     float amp=lsp[look->m];
 
     /* take the coefficients back to a spectral envelope curve */
-    vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
+    vorbis_lsp_to_curve(out,
+			look->linearmap[vb->W],
+			look->n[vb->W],
+			look->ln,
                         lsp,look->m,amp,(float)info->ampdB);
     return(1);
   }
-  memset(out,0,sizeof(*out)*look->n);
+  memset(out,0,sizeof(*out)*look->n[vb->W]);
   return(0);
 }
 
 /* export hooks */
 vorbis_func_floor floor0_exportbundle={
-  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_copy_info,&floor0_free_info,
-  &floor0_free_look,&floor0_forward,&floor0_inverse1,&floor0_inverse2
+  NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
+  &floor0_free_look,&floor0_inverse1,&floor0_inverse2
 };
+
 
 

<p><p>1.21      +356 -414  vorbis/lib/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor1.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- floor1.c	2002/01/22 08:06:06	1.20
+++ floor1.c	2002/06/28 22:19:35	1.21
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.20 2002/01/22 08:06:06 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.21 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -59,20 +59,12 @@
   long xya; 
   long n;
   long an;
-  long un;
   long edgey0;
   long edgey1;
 } lsfit_acc;
 
 /***********************************************/
  
-static vorbis_info_floor *floor1_copy_info (vorbis_info_floor *i){
-  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
-  vorbis_info_floor1 *ret=_ogg_malloc(sizeof(*ret));
-  memcpy(ret,info,sizeof(*ret));
-  return(ret);
-}
-
 static void floor1_free_info(vorbis_info_floor *i){
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
   if(info){
@@ -203,8 +195,8 @@
   return(**(int **)a-**(int **)b);
 }
 
-static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
-                              vorbis_info_floor *in){
+static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
+				      vorbis_info_floor *in){
 
   int *sortpointer[VIF_POSIT+2];
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
@@ -301,71 +293,71 @@
   return i;
 }
 
-static float FLOOR_fromdB_LOOKUP[256]={
-	1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
-	1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
-	1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
-	2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
-	2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
-	3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
-	4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
-	6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
-	7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
-	1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
-	1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
-	1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
-	2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
-	2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
-	3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
-	4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
-	5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
-	7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
-	9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
-	1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
-	1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
-	2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
-	2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
-	3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
-	4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
-	5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
-	7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
-	9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
-	0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
-	0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
-	0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
-	0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
-	0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
-	0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
-	0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
-	0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
-	0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
-	0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
-	0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
-	0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
-	0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
-	0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
-	0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
-	0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
-	0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
-	0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
-	0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
-	0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
-	0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
-	0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
-	0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
-	0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
-	0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
-	0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
-	0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
-	0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
-	0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
-	0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
-	0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
-	0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
-	0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
-	0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
-	0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
-	0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
+static float FLOOR1_fromdB_LOOKUP[256]={
+  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
+  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
+  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
+  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
+  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
+  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
+  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
+  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
+  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
+  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
+  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
+  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
+  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
+  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
+  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
+  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
+  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
+  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
+  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
+  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
+  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
+  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
+  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
+  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
+  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
+  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
+  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
+  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
+  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
+  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
+  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
+  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
+  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
+  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
+  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
+  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
+  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
+  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
+  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
+  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
+  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
+  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
+  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
+  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
+  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
+  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
+  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
+  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
+  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
+  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
+  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
+  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
+  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
+  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
+  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
+  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
+  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
+  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
+  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
+  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
+  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
+  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
+  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
+  0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
 };
 
 static void render_line(int x0,int x1,int y0,int y1,float *d){
@@ -380,7 +372,7 @@
 
   ady-=abs(base*adx);
 
-  d[x]*=FLOOR_fromdB_LOOKUP[y];
+  d[x]*=FLOOR1_fromdB_LOOKUP[y];
   while(++x<x1){
     err=err+ady;
     if(err>=adx){
@@ -389,11 +381,11 @@
     }else{
       y+=base;
     }
-    d[x]*=FLOOR_fromdB_LOOKUP[y];
+    d[x]*=FLOOR1_fromdB_LOOKUP[y];
   }
 }
 
-static void render_line0(int x0,int x1,int y0,int y1,float *d){
+static void render_line0(int x0,int x1,int y0,int y1,int *d){
   int dy=y1-y0;
   int adx=x1-x0;
   int ady=abs(dy);
@@ -405,7 +397,7 @@
 
   ady-=abs(base*adx);
 
-  d[x]=FLOOR_fromdB_LOOKUP[y];
+  d[x]=y;
   while(++x<x1){
     err=err+ady;
     if(err>=adx){
@@ -414,7 +406,7 @@
     }else{
       y+=base;
     }
-    d[x]=FLOOR_fromdB_LOOKUP[y];
+    d[x]=y;
   }
 }
 
@@ -463,12 +455,8 @@
 
   /* weight toward the actually used frequencies if we meet the threshhold */
   {
-    int weight;
-    if(nb<info->twofitminsize || na<info->twofitminused){
-      weight=0;
-    }else{
-      weight=nb*info->twofitweight/na;
-    }
+    int weight=info->twofitweight/na;
+
     a->xa=xa*weight+xb;
     a->ya=ya*weight+yb;
     a->x2a=x2a*weight+x2b;
@@ -476,8 +464,6 @@
     a->xya=xya*weight+xyb;
     a->an=na*weight+nb;
     a->n=nb;
-    a->un=na;
-    if(nb>=info->unusedminsize)a->un++;
   }
 
   a->edgey1=-200;
@@ -485,28 +471,25 @@
     int quantized=vorbis_dBquant(flr+i);
     a->edgey1=quantized;
   }
-  return(a->n);
+  return(na);
 }
 
-/* returns < 0 on too few points to fit, >=0 (meansq error) on success */
-static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1){
+static void fit_line(lsfit_acc *a,int fits,int *y0,int *y1){
   long x=0,y=0,x2=0,y2=0,xy=0,n=0,an=0,i;
   long x0=a[0].x0;
   long x1=a[fits-1].x1;
 
   for(i=0;i<fits;i++){
-    if(a[i].un){
-      x+=a[i].xa;
-      y+=a[i].ya;
-      x2+=a[i].x2a;
-      y2+=a[i].y2a;
-      xy+=a[i].xya;
-      n+=a[i].n;
-      an+=a[i].an;
-    }
+    x+=a[i].xa;
+    y+=a[i].ya;
+    x2+=a[i].x2a;
+    y2+=a[i].y2a;
+    xy+=a[i].xya;
+    n+=a[i].n;
+    an+=a[i].an;
   }
 
-  if(*y0>=0){  /* hint used to break degenerate cases */
+  if(*y0>=0){
     x+=   x0;
     y+=  *y0;
     x2+=  x0 *  x0;
@@ -516,7 +499,7 @@
     an++;
   }
 
-  if(*y1>=0){  /* hint used to break degenerate cases */
+  if(*y1>=0){
     x+=   x1;
     y+=  *y1;
     x2+=  x1 *  x1;
@@ -525,8 +508,6 @@
     n++;
     an++;
   }
-
-  if(n<2)return(n-2);
   
   {
     /* need 64 bit multiplies, which C doesn't give portably as int */
@@ -546,7 +527,6 @@
     if(*y0<0)*y0=0;
     if(*y1<0)*y1=0;
 
-    return(0);
   }
 }
 
@@ -577,12 +557,12 @@
 
   ady-=abs(base*adx);
   
+  mse=(y-val);
+  mse*=mse;
+  n++;
   if(mdct[x]+info->twofitatten>=mask[x]){
     if(y+info->maxover<val)return(1);
     if(y-info->maxunder>val)return(1);
-    mse=(y-val);
-    mse*=mse;
-    n++;
   }
 
   while(++x<x1){
@@ -594,22 +574,20 @@
       y+=base;
     }
 
+    val=vorbis_dBquant(mask+x);
+    mse+=((y-val)*(y-val));
+    n++;
     if(mdct[x]+info->twofitatten>=mask[x]){
-      val=vorbis_dBquant(mask+x);
       if(val){
         if(y+info->maxover<val)return(1);
         if(y-info->maxunder>val)return(1);
-	mse+=((y-val)*(y-val));
-	n++;
       }
     }
   }
   
-  if(n){
-    if(info->maxover*info->maxover/n>info->maxerr)return(0);
-    if(info->maxunder*info->maxunder/n>info->maxerr)return(0);
-    if(mse/n>info->maxerr)return(1);
-  }
+  if(info->maxover*info->maxover/n>info->maxerr)return(0);
+  if(info->maxunder*info->maxunder/n>info->maxerr)return(0);
+  if(mse/n>info->maxerr)return(1);
   return(0);
 }
 
@@ -622,52 +600,38 @@
   return (A[pos]+B[pos])>>1;
 }
 
-static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  float *mdct, const float *logmdct,   /* in */
-			  const float *logmask, const float *logmax, /* in */
-			  float *codedflr){          /* out */
-  static int seq=0;
-  long i,j,k,l;
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+static int seq=0;
+
+int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+			  const float *logmdct,   /* in */
+			  const float *logmask){
+  long i,j;
   vorbis_info_floor1 *info=look->vi;
-  long n=info->n;
+  long n=look->n;
   long posts=look->posts;
   long nonzero=0;
   lsfit_acc fits[VIF_POSIT+1];
   int fit_valueA[VIF_POSIT+2]; /* index by range list position */
   int fit_valueB[VIF_POSIT+2]; /* index by range list position */
-  int fit_flag[VIF_POSIT+2];
 
   int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */
   int hineighbor[VIF_POSIT+2]; 
+  int *output=NULL;
   int memo[VIF_POSIT+2];
-  codec_setup_info *ci=vb->vd->vi->codec_setup;
-  static_codebook **sbooks=ci->book_param;
-  codebook *books=NULL;
-  int writeflag=0;
-
-  if(vb->vd->backend_state){
-    books=ci->fullbooks;   
-    writeflag=1;
-  }
 
-  memset(fit_flag,0,sizeof(fit_flag));
+  for(i=0;i<posts;i++)fit_valueA[i]=-200; /* mark all unused */
+  for(i=0;i<posts;i++)fit_valueB[i]=-200; /* mark all unused */
   for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */
   for(i=0;i<posts;i++)hineighbor[i]=1; /* 1 for the implicit post at n */
   for(i=0;i<posts;i++)memo[i]=-1;      /* no neighbor yet */
 
-  /* Scan back from high edge to first 'used' frequency */
-  for(;n>info->unusedmin_n;n--)
-    if(logmdct[n-1]>-floor1_rangedB && 
-       logmdct[n-1]+info->twofitatten>logmask[n-1])break;
-
   /* quantize the relevant floor points and collect them into line fit
      structures (one per minimal division) at the same time */
   if(posts==0){
-    nonzero+=accumulate_fit(logmask,logmax,0,n,fits,n,info);
+    nonzero+=accumulate_fit(logmask,logmdct,0,n,fits,n,info);
   }else{
     for(i=0;i<posts-1;i++)
-      nonzero+=accumulate_fit(logmask,logmax,look->sorted_index[i],
+      nonzero+=accumulate_fit(logmask,logmdct,look->sorted_index[i],
                               look->sorted_index[i+1],fits+i,
                               n,info);
   }
@@ -676,175 +640,185 @@
     /* start by fitting the implicit base case.... */
     int y0=-200;
     int y1=-200;
-    int mse=fit_line(fits,posts-1,&y0,&y1);
-    if(mse<0){
-      /* Only a single nonzero point */
-      y0=-200;
-      y1=0;
-      fit_line(fits,posts-1,&y0,&y1);
-    }
+    fit_line(fits,posts-1,&y0,&y1);
 
-    fit_flag[0]=1;
-    fit_flag[1]=1;
     fit_valueA[0]=y0;
     fit_valueB[0]=y0;
     fit_valueB[1]=y1;
     fit_valueA[1]=y1;
 
-    if(mse>=0){
-      /* Non degenerate case */
-      /* start progressive splitting.  This is a greedy, non-optimal
-	 algorithm, but simple and close enough to the best
-	 answer. */
-      for(i=2;i<posts;i++){
-	int sortpos=look->reverse_index[i];
-	int ln=loneighbor[sortpos];
-	int hn=hineighbor[sortpos];
-
-	/* eliminate repeat searches of a particular range with a memo */
-	if(memo[ln]!=hn){
-	  /* haven't performed this error search yet */
-	  int lsortpos=look->reverse_index[ln];
-	  int hsortpos=look->reverse_index[hn];
-	  memo[ln]=hn;
-
-	  /* if this is an empty segment, its endpoints don't matter.
-	     Mark as such */
-	  for(j=lsortpos;j<hsortpos;j++)
-	    if(fits[j].un)break;
-	  if(j==hsortpos){
-	    /* empty segment; important to note that this does not
-               break 0/n post case */
-	    fit_valueB[ln]=-200;
-	    if(fit_valueA[ln]<0)
-	      fit_flag[ln]=0;
-	    fit_valueA[hn]=-200;
-	    if(fit_valueB[hn]<0)
-	      fit_flag[hn]=0;
- 
-	  }else{
-	    /* A note: we want to bound/minimize *local*, not global, error */
-	    int lx=info->postlist[ln];
-	    int hx=info->postlist[hn];	  
-	    int ly=post_Y(fit_valueA,fit_valueB,ln);
-	    int hy=post_Y(fit_valueA,fit_valueB,hn);
+    /* Non degenerate case */
+    /* start progressive splitting.  This is a greedy, non-optimal
+       algorithm, but simple and close enough to the best
+       answer. */
+    for(i=2;i<posts;i++){
+      int sortpos=look->reverse_index[i];
+      int ln=loneighbor[sortpos];
+      int hn=hineighbor[sortpos];
+      
+      /* eliminate repeat searches of a particular range with a memo */
+      if(memo[ln]!=hn){
+	/* haven't performed this error search yet */
+	int lsortpos=look->reverse_index[ln];
+	int hsortpos=look->reverse_index[hn];
+	memo[ln]=hn;
+		
+	{
+	  /* A note: we want to bound/minimize *local*, not global, error */
+	  int lx=info->postlist[ln];
+	  int hx=info->postlist[hn];	  
+	  int ly=post_Y(fit_valueA,fit_valueB,ln);
+	  int hy=post_Y(fit_valueA,fit_valueB,hn);
+	  
+	  if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){
+	    /* outside error bounds/begin search area.  Split it. */
+	    int ly0=-200;
+	    int ly1=-200;
+	    int hy0=-200;
+	    int hy1=-200;
+	    fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1);
+	    fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1);
             
-	    if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){
-	      /* outside error bounds/begin search area.  Split it. */
-	      int ly0=-200;
-	      int ly1=-200;
-	      int hy0=-200;
-	      int hy1=-200;
-	      int lmse=fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1);
-	      int hmse=fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1);
-	      
-	      /* the boundary/sparsity cases are the hard part.  They
-                 don't happen often given that we use the full mask
-                 curve (weighted) now, but when they do happen they
-                 can go boom. Pay them detailed attention */
-	      /* cases for a segment:
-		 >=0) normal fit (>=2 unique points)
-		 -1) one point on x0;
-		 one point on x1; <-- disallowed by fit_line
-		 -2) one point in between x0 and x1
-		 -3) no points */
-
-	      switch(lmse){ 
-	      case -2:  
-		/* no points in the low segment */
-		break;
-	      case -1:
-		ly0=fits[lsortpos].edgey0;
-		break;
-		/*default:
-		  break;*/
-	      }
-
-	      switch(hmse){ 
-	      case -2:  
-		/* no points in the hi segment */
-		break;
-	      case -1:
-		hy0=fits[sortpos].edgey0;
-		break;
-	      }
-
-	      /* store new edge values */
-	      fit_valueB[ln]=ly0;
-	      if(ln==0 && ly0>=0)fit_valueA[ln]=ly0;
-	      fit_valueA[i]=ly1;
-	      fit_valueB[i]=hy0;
-	      fit_valueA[hn]=hy1;
-	      if(hn==1 && hy1>=0)fit_valueB[hn]=hy1;
-
-	      if(ly0<0 && fit_valueA[ln]<0)
-		fit_flag[ln]=0;
-	      if(hy1<0 && fit_valueB[hn]<0)
-		fit_flag[hn]=0;
-
-	      if(ly1>=0 || hy0>=0){
-		/* store new neighbor values */
-		for(j=sortpos-1;j>=0;j--)
-		  if(hineighbor[j]==hn)
+	    /* store new edge values */
+	    fit_valueB[ln]=ly0;
+	    if(ln==0)fit_valueA[ln]=ly0;
+	    fit_valueA[i]=ly1;
+	    fit_valueB[i]=hy0;
+	    fit_valueA[hn]=hy1;
+	    if(hn==1)fit_valueB[hn]=hy1;
+	    
+	    if(ly1>=0 || hy0>=0){
+	      /* store new neighbor values */
+	      for(j=sortpos-1;j>=0;j--)
+		if(hineighbor[j]==hn)
                   hineighbor[j]=i;
-		  else
-		    break;
-		for(j=sortpos+1;j<posts;j++)
-		  if(loneighbor[j]==ln)
-		    loneighbor[j]=i;
-		  else
-		    break;
-		
-		/* store flag (set) */
-		fit_flag[i]=1;
-	      }
+		else
+		  break;
+	      for(j=sortpos+1;j<posts;j++)
+		if(loneighbor[j]==ln)
+		  loneighbor[j]=i;
+		else
+		  break;
+	      
             }
+	  }else{
+	    
+	    fit_valueA[i]=-200;
+	    fit_valueB[i]=-200;
           }
         }
       }
     }
+  
+    output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
+    
+    output[0]=post_Y(fit_valueA,fit_valueB,0);
+    output[1]=post_Y(fit_valueA,fit_valueB,1);
+    
+    /* fill in posts marked as not using a fit; we will zero
+       back out to 'unused' when encoding them so long as curve
+       interpolation doesn't force them into use */
+    for(i=2;i<posts;i++){
+      int ln=look->loneighbor[i-2];
+      int hn=look->hineighbor[i-2];
+      int x0=info->postlist[ln];
+      int x1=info->postlist[hn];
+      int y0=output[ln];
+      int y1=output[hn];
+      
+      int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
+      int vx=post_Y(fit_valueA,fit_valueB,i);
+      
+      if(vx>=0 && predicted!=vx){ 
+	output[i]=vx;
+      }else{
+	output[i]= predicted|0x8000;
+      }
+    }
+  }
+
+  return(output);
+  
+}
+		
+int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+			  int *A,int *B,
+			  int del){
+
+  long i;
+  long posts=look->posts;
+  int *output=NULL;
+  
+  if(A && B){
+    output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
+    
+    for(i=0;i<posts;i++){
+      output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16;
+      if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000;
+    }
+  }
+
+  return(output);
+}
+
+
+int floor1_encode(vorbis_block *vb,vorbis_look_floor1 *look,
+		  int *post,int *ilogmask){
+
+  long i,j;
+  vorbis_info_floor1 *info=look->vi;
+  long n=look->n;
+  long posts=look->posts;
+  codec_setup_info *ci=vb->vd->vi->codec_setup;
+  int out[VIF_POSIT+2];
+  static_codebook **sbooks=ci->book_param;
+  codebook *books=ci->fullbooks;
+  static long seq=0; 
 
-    /* quantize values to multiplier spec */
-    switch(info->mult){
-    case 1: /* 1024 -> 256 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>2;
-      break;
-    case 2: /* 1024 -> 128 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>3;
-      break;
-    case 3: /* 1024 -> 86 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)/12;
-      break;
-    case 4: /* 1024 -> 64 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>4;
-      break;
+  /* quantize values to multiplier spec */
+  if(post){
+    for(i=0;i<posts;i++){
+      int val=post[i]&0x7fff;
+      switch(info->mult){
+      case 1: /* 1024 -> 256 */
+	val>>=2;
+	break;
+      case 2: /* 1024 -> 128 */
+	val>>=3;
+	break;
+      case 3: /* 1024 -> 86 */
+	val/=12;
+	break;
+      case 4: /* 1024 -> 64 */
+	val>>=4;
+	break;
+      }
+      post[i]=val | (post[i]&0x8000);
     }
 
+    out[0]=post[0];
+    out[1]=post[1];
+
     /* find prediction values for each post and subtract them */
     for(i=2;i<posts;i++){
-      int sp=look->reverse_index[i];
       int ln=look->loneighbor[i-2];
       int hn=look->hineighbor[i-2];
       int x0=info->postlist[ln];
       int x1=info->postlist[hn];
-      int y0=fit_valueA[ln];
-      int y1=fit_valueA[hn];
-	
+      int y0=post[ln];
+      int y1=post[hn];
+      
       int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
-	
-      if(fit_flag[i]){
+      
+      if((post[i]&0x8000) || (predicted==post[i])){
+	post[i]=predicted|0x8000; /* in case there was roundoff jitter
+				     in interpolation */
+	out[i]=0;
+      }else{
         int headroom=(look->quant_q-predicted<predicted?
                       look->quant_q-predicted:predicted);
         
-	int val=fit_valueA[i]-predicted;
+	int val=post[i]-predicted;
         
         /* at this point the 'deviation' value is in the range +/- max
            range, but the real, unique range can always be mapped to
@@ -862,163 +836,131 @@
             val= val+headroom;
           else
             val<<=1;
-	
-	fit_valueB[i]=val;
-	
-	/* unroll the neighbor arrays */
-	for(j=sp+1;j<posts;j++)
-	  if(loneighbor[j]==i)
-	    loneighbor[j]=loneighbor[sp];
-	  else
-	    break;
-	for(j=sp-1;j>=0;j--)
-	  if(hineighbor[j]==i)
-	    hineighbor[j]=hineighbor[sp];
-	  else
-	    break;
         
-      }else{
-	fit_valueA[i]=predicted;
-	fit_valueB[i]=0;
-      }
-      if(fit_valueB[i]==0)
-	fit_valueA[i]|=0x8000;
-      else{
-	fit_valueA[look->loneighbor[i-2]]&=0x7fff;
-	fit_valueA[look->hineighbor[i-2]]&=0x7fff;
+	out[i]=val;
+	post[ln]&=0x7fff;
+	post[hn]&=0x7fff;
       }
     }
-
+    
     /* we have everything we need. pack it out */
     /* mark nontrivial floor */
-    if(writeflag){
-      oggpack_write(&vb->opb,1,1);
+    oggpack_write(&vb->opb,1,1);
       
-      /* beginning/end post */
-      look->frames++;
-      look->postbits+=ilog(look->quant_q-1)*2;
-      oggpack_write(&vb->opb,fit_valueA[0],ilog(look->quant_q-1));
-      oggpack_write(&vb->opb,fit_valueA[1],ilog(look->quant_q-1));
+    /* beginning/end post */
+    look->frames++;
+    look->postbits+=ilog(look->quant_q-1)*2;
+    oggpack_write(&vb->opb,out[0],ilog(look->quant_q-1));
+    oggpack_write(&vb->opb,out[1],ilog(look->quant_q-1));
       
       
-      /* partition by partition */
-      for(i=0,j=2;i<info->partitions;i++){
-	int class=info->partitionclass[i];
-	int cdim=info->class_dim[class];
-	int csubbits=info->class_subs[class];
-	int csub=1<<csubbits;
-	int bookas[8]={0,0,0,0,0,0,0,0};
-	int cval=0;
-	int cshift=0;
-	
-	/* generate the partition's first stage cascade value */
-	if(csubbits){
-	  int maxval[8];
-	  for(k=0;k<csub;k++){
-	    int booknum=info->class_subbook[class][k];
-	    if(booknum<0){
-	      maxval[k]=1;
-	    }else{
-	      maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
-	    }
+    /* partition by partition */
+    for(i=0,j=2;i<info->partitions;i++){
+      int class=info->partitionclass[i];
+      int cdim=info->class_dim[class];
+      int csubbits=info->class_subs[class];
+      int csub=1<<csubbits;
+      int bookas[8]={0,0,0,0,0,0,0,0};
+      int cval=0;
+      int cshift=0;
+      int k,l;
+
+      /* generate the partition's first stage cascade value */
+      if(csubbits){
+	int maxval[8];
+	for(k=0;k<csub;k++){
+	  int booknum=info->class_subbook[class][k];
+	  if(booknum<0){
+	    maxval[k]=1;
+	  }else{
+	    maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
           }
-	  for(k=0;k<cdim;k++){
-	    for(l=0;l<csub;l++){
-	      int val=fit_valueB[j+k];
-	      if(val<maxval[l]){
-		bookas[k]=l;
-		break;
-	      }
+	}
+	for(k=0;k<cdim;k++){
+	  for(l=0;l<csub;l++){
+	    int val=out[j+k];
+	    if(val<maxval[l]){
+	      bookas[k]=l;
+	      break;
             }
-	    cval|= bookas[k]<<cshift;
-	    cshift+=csubbits;
           }
-	  /* write it */
-	  look->phrasebits+=
+	  cval|= bookas[k]<<cshift;
+	  cshift+=csubbits;
+	}
+	/* write it */
+	look->phrasebits+=
           vorbis_book_encode(books+info->class_book[class],cval,&vb->opb);
+	
+#ifdef TRAIN_FLOOR1
+	{
+	  FILE *of;
+	  char buffer[80];
+	  sprintf(buffer,"line_%dx%ld_class%d.vqd",
+		  vb->pcmend/2,posts-2,class);
+	  of=fopen(buffer,"a");
+	  fprintf(of,"%d\n",cval);
+	  fclose(of);
+	}
+#endif
+      }
+	
+      /* write post values */
+      for(k=0;k<cdim;k++){
+	int book=info->class_subbook[class][bookas[k]];
+	if(book>=0){
+	  /* hack to allow training with 'bad' books */
+	  if(out[j+k]<(books+book)->entries)
+	    look->postbits+=vorbis_book_encode(books+book,
+					       out[j+k],&vb->opb);
+	  /*else
+	    fprintf(stderr,"+!");*/
           
 #ifdef TRAIN_FLOOR1
           {
             FILE *of;
             char buffer[80];
-	    sprintf(buffer,"line_%dx%ld_class%d.vqd",
-		    vb->pcmend/2,posts-2,class);
+	    sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
+		    vb->pcmend/2,posts-2,class,bookas[k]);
             of=fopen(buffer,"a");
-	    fprintf(of,"%d\n",cval);
+	    fprintf(of,"%d\n",out[j+k]);
             fclose(of);
           }
 #endif
         }
-	
-	/* write post values */
-	for(k=0;k<cdim;k++){
-	  int book=info->class_subbook[class][bookas[k]];
-	  if(book>=0){
-	    /* hack to allow training with 'bad' books */
-	    if(fit_valueB[j+k]<(books+book)->entries)
-	      look->postbits+=vorbis_book_encode(books+book,
-						 fit_valueB[j+k],&vb->opb);
-	    /*else
-	      fprintf(stderr,"+!");*/
-
-#ifdef TRAIN_FLOOR1
-	    {
-	      FILE *of;
-	      char buffer[80];
-	      sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
-		      vb->pcmend/2,posts-2,class,bookas[k]);
-	      of=fopen(buffer,"a");
-	      fprintf(of,"%d\n",fit_valueB[j+k]);
-	      fclose(of);
-	    }
-#endif
-	  }
-	}
-	j+=cdim;
       }
+      j+=cdim;
     }
-
+    
     {
       /* generate quantized floor equivalent to what we'd unpack in decode */
-      int hx;
+      /* render the lines */
+      int hx=0;
       int lx=0;
-      int ly=fit_valueA[0]*info->mult;
-
-      for(j=1;j<posts;j++){
+      int ly=post[0]*info->mult;
+      for(j=1;j<look->posts;j++){
         int current=look->forward_index[j];
-	if(!(fit_valueA[current]&0x8000)){
-	  int hy=(fit_valueA[current]&0x7fff)*info->mult;
-	  hx=info->postlist[current];
-	  
-	  render_line0(lx,hx,ly,hy,codedflr);
+	int hy=post[current]&0x7fff;
+	if(hy==post[current]){
           
+	  hy*=info->mult;
+	  hx=info->postlist[current];
+	
+	  render_line0(lx,hx,ly,hy,ilogmask);
+	
           lx=hx;
           ly=hy;
         }
       }
-      for(j=lx;j<vb->pcmend/2;j++)codedflr[j]=codedflr[j-1]; /* be certain */
-
-      /* use it to create residue vector.  Eliminate mdct elements
-         that were below the error training attenuation relative to
-         the original mask.  This avoids portions of the floor fit
-         that were considered 'unused' in fitting from being used in
-         coding residue if the unfit values are significantly below
-         the original input mask */
-
-      for(j=0;j<n;j++)
-	if(logmdct[j]+info->twofitatten<logmask[j])
-	  mdct[j]=0.f;
-      for(j=n;j<vb->pcmend/2;j++)mdct[j]=0.f;
-
-    }    
-
+      for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */    
+      seq++;
+      return(1);
+    }
   }else{
-    if(writeflag)oggpack_write(&vb->opb,0,1);
-    memset(codedflr,0,n*sizeof(*codedflr));
-    memset(mdct,0,n*sizeof(*mdct));
+    oggpack_write(&vb->opb,0,1);
+    memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask));
+    seq++;
+    return(0);
   }
-  seq++;
-  return(nonzero);
 }
 
 static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
@@ -1037,7 +979,6 @@
     fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
 
     /* partition by partition */
-    /* partition by partition */
     for(i=0,j=2;i<info->partitions;i++){
       int class=info->partitionclass[i];
       int cdim=info->class_dim[class];
@@ -1082,7 +1023,7 @@
           if(hiroom>loroom){
             val = val-loroom;
           }else{
-	  val = -1-(val-hiroom);
+	    val = -1-(val-hiroom);
           }
         }else{
           if(val&1){
@@ -1114,7 +1055,7 @@
   vorbis_info_floor1 *info=look->vi;
 
   codec_setup_info   *ci=vb->vd->vi->codec_setup;
-  int                  n=ci->blocksizes[vb->mode]/2;
+  int                  n=ci->blocksizes[vb->W]/2;
   int j;
 
   if(memo){
@@ -1137,7 +1078,7 @@
         ly=hy;
       }
     }
-    for(j=hx;j<n;j++)out[j]*=ly; /* be certain */    
+    for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */    
     return(1);
   }
   memset(out,0,sizeof(*out)*n);
@@ -1146,7 +1087,8 @@
 
 /* export hooks */
 vorbis_func_floor floor1_exportbundle={
-  &floor1_pack,&floor1_unpack,&floor1_look,&floor1_copy_info,&floor1_free_info,
-  &floor1_free_look,&floor1_forward,&floor1_inverse1,&floor1_inverse2
+  &floor1_pack,&floor1_unpack,&floor1_look,&floor1_free_info,
+  &floor1_free_look,&floor1_inverse1,&floor1_inverse2
 };
+
 

<p><p>1.54      +16 -21    vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- info.c	2002/01/22 08:06:07	1.53
+++ info.c	2002/06/28 22:19:35	1.54
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.53 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: info.c,v 1.54 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -163,9 +163,6 @@
     for(i=0;i<ci->maps;i++) /* unpack does the range checking */
       _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
 
-    for(i=0;i<ci->times;i++) /* unpack does the range checking */
-      _time_P[ci->time_type[i]]->free_info(ci->time_param[i]);
-
     for(i=0;i<ci->floors;i++) /* unpack does the range checking */
       _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
     
@@ -265,15 +262,13 @@
     if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
   }
 
-  /* time backend settings */
-  ci->times=oggpack_read(opb,6)+1;
-  /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
-  /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
-  for(i=0;i<ci->times;i++){
-    ci->time_type[i]=oggpack_read(opb,16);
-    if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
-    ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
-    if(!ci->time_param[i])goto err_out;
+  /* time backend settings; hooks are unused */
+  {
+    int times=oggpack_read(opb,6)+1;
+    for(i=0;i<times;i++){
+      int test=oggpack_read(opb,16);
+      if(test<0 || test>=VI_TIMEB)goto err_out;
+    }
   }
 
   /* floor backend settings */
@@ -420,7 +415,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiphophorus libVorbis I 20011231";
+  char temp[]="Xiphophorus libVorbis I 20020623";
   int bytes = strlen(temp);
 
   /* preamble */  
@@ -463,18 +458,18 @@
   for(i=0;i<ci->books;i++)
     if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out;
 
-  /* times */
-  oggpack_write(opb,ci->times-1,6);
-  for(i=0;i<ci->times;i++){
-    oggpack_write(opb,ci->time_type[i],16);
-    _time_P[ci->time_type[i]]->pack(ci->time_param[i],opb);
-  }
+  /* times; hook placeholders */
+  oggpack_write(opb,0,6);
+  oggpack_write(opb,0,16);
 
   /* floors */
   oggpack_write(opb,ci->floors-1,6);
   for(i=0;i<ci->floors;i++){
     oggpack_write(opb,ci->floor_type[i],16);
-    _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
+    if(_floor_P[ci->floor_type[i]]->pack)
+      _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
+    else
+      goto err_out;
   }
 
   /* residues */

<p><p>1.50      +434 -376  vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- mapping0.c	2002/04/06 03:07:25	1.49
+++ mapping0.c	2002/06/28 22:19:35	1.50
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.49 2002/04/06 03:07:25 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.50 2002/06/28 22:19:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -37,35 +37,6 @@
    blocksize is set by the mode, and low backend lookups may require
    parameters from other areas of the mode/mapping */
 
-extern int analysis_noisy;
-
-typedef struct {
-  drft_lookup fft_look;
-  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[2];
-
-  vorbis_func_time **time_func;
-  vorbis_func_floor **floor_func;
-  vorbis_func_residue **residue_func;
-
-  int ch;
-  long lastframe; /* if a different mode is called, we need to 
-		     invalidate decay */
-} vorbis_look_mapping0;
-
-static vorbis_info_mapping *mapping0_copy_info(vorbis_info_mapping *vm){
-  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
-  vorbis_info_mapping0 *ret=_ogg_malloc(sizeof(*ret));
-  memcpy(ret,info,sizeof(*ret));
-  return(ret);
-}
-
 static void mapping0_free_info(vorbis_info_mapping *i){
   vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
   if(info){
@@ -73,106 +44,11 @@
     _ogg_free(info);
   }
 }
-
-static void mapping0_free_look(vorbis_look_mapping *look){
-  int i;
-  vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
-  if(l){
-    drft_clear(&l->fft_look);
-
-    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[1] && l->psy_look[1]!=l->psy_look[0]){
-      _vp_psy_clear(l->psy_look[1]);
-      _ogg_free(l->psy_look[1]);
-    }
-    if(l->psy_look[0]){
-      _vp_psy_clear(l->psy_look[0]);
-      _ogg_free(l->psy_look[0]);
-    }
-    _ogg_free(l->time_func);
-    _ogg_free(l->floor_func);
-    _ogg_free(l->residue_func);
-    _ogg_free(l->time_look);
-    _ogg_free(l->floor_look);
-    _ogg_free(l->residue_look);
-    memset(l,0,sizeof(*l));
-    _ogg_free(l);
-  }
-}
-
-static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
-			  vorbis_info_mapping *m){
-  int i;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=vi->codec_setup;
-  vorbis_look_mapping0 *look=_ogg_calloc(1,sizeof(*look));
-  vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
-  look->mode=vm;
-  
-  look->time_look=_ogg_calloc(info->submaps,sizeof(*look->time_look));
-  look->floor_look=_ogg_calloc(info->submaps,sizeof(*look->floor_look));
-
-  look->residue_look=_ogg_calloc(info->submaps,sizeof(*look->residue_look));
-
-  look->time_func=_ogg_calloc(info->submaps,sizeof(*look->time_func));
-  look->floor_func=_ogg_calloc(info->submaps,sizeof(*look->floor_func));
-  look->residue_func=_ogg_calloc(info->submaps,sizeof(*look->residue_func));
-  
-  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[ci->time_type[timenum]];
-    look->time_look[i]=look->time_func[i]->
-      look(vd,vm,ci->time_param[timenum]);
-    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
-    look->floor_look[i]=look->floor_func[i]->
-      look(vd,vm,ci->floor_param[floornum]);
-    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
-    look->residue_look[i]=look->residue_func[i]->
-      look(vd,vm,ci->residue_param[resnum]);
-    
-  }
-  if(ci->psys && vd->analysisp){
-    if(info->psy[0] != info->psy[1]){
-
-      int psynum=info->psy[0];
-      look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0]));      
-      _vp_psy_init(look->psy_look[0],ci->psy_param[psynum],
-		   &ci->psy_g_param,
-		   ci->blocksizes[vm->blockflag]/2,vi->rate);
-
-      psynum=info->psy[1];
-      look->psy_look[1]=_ogg_calloc(1,sizeof(*look->psy_look[1]));      
-      _vp_psy_init(look->psy_look[1],ci->psy_param[psynum],
-		   &ci->psy_g_param,
-		   ci->blocksizes[vm->blockflag]/2,vi->rate);
-    }else{
-
-      int psynum=info->psy[0];
-      look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0]));      
-      look->psy_look[1]=look->psy_look[0];
-      _vp_psy_init(look->psy_look[0],ci->psy_param[psynum],
-		   &ci->psy_g_param,
-		   ci->blocksizes[vm->blockflag]/2,vi->rate);
-
-    }
-  }
-
-  look->ch=vi->channels;
-
-  if(vd->analysisp)drft_init(&look->fft_look,ci->blocksizes[vm->blockflag]);
-  return(look);
-}
 
-static int ilog2(unsigned int v){
+static int ilog(unsigned int v){
   int ret=0;
-  while(v>1){
+  if(v)--v;
+  while(v){
     ret++;
     v>>=1;
   }
@@ -202,8 +78,8 @@
     oggpack_write(opb,info->coupling_steps-1,8);
     
     for(i=0;i<info->coupling_steps;i++){
-      oggpack_write(opb,info->coupling_mag[i],ilog2(vi->channels));
-      oggpack_write(opb,info->coupling_ang[i],ilog2(vi->channels));
+      oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels));
+      oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels));
     }
   }else
     oggpack_write(opb,0,1);
@@ -216,7 +92,7 @@
       oggpack_write(opb,info->chmuxlist[i],4);
   }
   for(i=0;i<info->submaps;i++){
-    oggpack_write(opb,info->timesubmap[i],8);
+    oggpack_write(opb,0,8); /* time submap unused */
     oggpack_write(opb,info->floorsubmap[i],8);
     oggpack_write(opb,info->residuesubmap[i],8);
   }
@@ -238,8 +114,8 @@
     info->coupling_steps=oggpack_read(opb,8)+1;
 
     for(i=0;i<info->coupling_steps;i++){
-      int testM=info->coupling_mag[i]=oggpack_read(opb,ilog2(vi->channels));
-      int testA=info->coupling_ang[i]=oggpack_read(opb,ilog2(vi->channels));
+      int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
+      int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
 
       if(testM<0 || 
          testA<0 || 
@@ -259,8 +135,7 @@
     }
   }
   for(i=0;i<info->submaps;i++){
-    info->timesubmap[i]=oggpack_read(opb,8);
-    if(info->timesubmap[i]>=ci->times)goto err_out;
+    oggpack_read(opb,8); /* time submap unused */
     info->floorsubmap[i]=oggpack_read(opb,8);
     if(info->floorsubmap[i]>=ci->floors)goto err_out;
     info->residuesubmap[i]=oggpack_read(opb,8);
@@ -282,308 +157,497 @@
 #include "psy.h"
 #include "scales.h"
 
-/* no time mapping implementation for now */
+#if 0
 static long seq=0;
 static ogg_int64_t total=0;
-extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off);
+#endif 
 
-static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
+extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look,
+		       const float *logmdct,   /* in */
+		       const float *logmask);
+extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look,
+				   int *A,int *B,
+				   int del);
+extern int floor1_encode(vorbis_block *vb,vorbis_look_floor *look,
+			 int *post,int *ilogmask);
+
+
+static int mapping0_forward(vorbis_block *vb){
   vorbis_dsp_state      *vd=vb->vd;
   vorbis_info           *vi=vd->vi;
   codec_setup_info      *ci=vi->codec_setup;
   backend_lookup_state  *b=vb->vd->backend_state;
-  bitrate_manager_state *bm=&b->bms;
-  vorbis_look_mapping0  *look=(vorbis_look_mapping0 *)l;
-  vorbis_info_mapping0  *info=look->map;
-  vorbis_info_mode      *mode=look->mode;
   vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
   int                    n=vb->pcmend;
-  int i,j;
-  int   *nonzero=alloca(sizeof(*nonzero)*vi->channels);
+  int i,j,k;
 
-  float *work=_vorbis_block_alloc(vb,n*sizeof(*work));
-
+  int    *nonzero    = alloca(sizeof(*nonzero)*vi->channels);
+  float  **gmdct     = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
+  int    **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch));
+  int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
+  
   float global_ampmax=vbi->ampmax;
   float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
   int blocktype=vbi->blocktype;
 
-  /* we differentiate between short and long block types to help the
-     masking engine; the window shapes also matter.
-     impulse block (a short block in which an impulse occurs)
-     padding block (a short block that pads between a transitional 
-          long block and an impulse block, or vice versa)
-     transition block (the wqeird one; a long block with the transition 
-          window; affects bass/midrange response and that must be 
-	  accounted for in masking) 
-     long block (run of the mill long block)
-  */
+  int modenumber=vb->W;
+  vorbis_info_mapping0 *info=ci->map_param[modenumber];
+  vorbis_look_psy *psy_look=
+    b->psy+blocktype+(vb->W?2:0);
+
+  vb->mode=modenumber;
 
   for(i=0;i<vi->channels;i++){
     float scale=4.f/n;
     float scale_dB;
 
-    /* the following makes things clearer to *me* anyway */
     float *pcm     =vb->pcm[i]; 
-    float *fft     =work;
-    float *logfft  =pcm+n/2;
+    float *logfft  =pcm;
 
-    /*float *res     =pcm;
-    float *mdct    =pcm;
-    float *codedflr=pcm+n/2;
-    float *logmax  =work;
-    float *logmask =work+n/2;*/
+    gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
 
     scale_dB=todB(&scale);
-    /*_analysis_output_always("pcm",seq+i,pcm,n,0,0,total-n/2);*/
 
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
+      else
+	_analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
+#endif
+  
     /* window the PCM data */
     _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
-    memcpy(fft,pcm,sizeof(*fft)*n);
-    
-    /*_analysis_output_always("windowed",seq+i,pcm,n,0,0,total-n/2);*/
+
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
+      else
+	_analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
+#endif
 
     /* transform the PCM data */
     /* only MDCT right now.... */
-    mdct_forward(b->transform[vb->W][0],pcm,pcm);
+    mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]);
     
     /* FFT yields more accurate tonal estimation (not phase sensitive) */
-    drft_forward(&look->fft_look,fft);
-    fft[0]*=scale;
-    logfft[0]=todB(fft);
+    drft_forward(&b->fft_look[vb->W],pcm);
+    logfft[0]=scale_dB+todB(pcm);
     local_ampmax[i]=logfft[0];
     for(j=1;j<n-1;j+=2){
-      float temp=fft[j]*fft[j]+fft[j+1]*fft[j+1];
+      float temp=pcm[j]*pcm[j]+pcm[j+1]*pcm[j+1];
       temp=logfft[(j+1)>>1]=scale_dB+.5f*todB(&temp);
       if(temp>local_ampmax[i])local_ampmax[i]=temp;
     }
 
     if(local_ampmax[i]>0.f)local_ampmax[i]=0.f;
     if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i];
+
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output("fftL",seq,logfft,n/2,1,0,0);
+      else
+	_analysis_output("fftR",seq,logfft,n/2,1,0,0);
+#endif
 
-    /*_analysis_output("fft",seq+i,logfft,n/2,1,0);*/
   }
+  
+  {
+    float   *noise        = _vorbis_block_alloc(vb,n/2*sizeof(*noise));
+    float   *tone         = _vorbis_block_alloc(vb,n/2*sizeof(*tone));
+    
+    for(i=0;i<vi->channels;i++){
+      /* the encoder setup assumes that all the modes used by any
+	 specific bitrate tweaking use the same floor */
+      
+      int submap=info->chmuxlist[i];
+      
+      /* the following makes things clearer to *me* anyway */
+      float *mdct    =gmdct[i];
+      float *logfft  =vb->pcm[i];
+      
+      float *logmdct =logfft+n/2;
+      float *logmask =logfft;
 
-  for(i=0;i<vi->channels;i++){
-    int submap=info->chmuxlist[i];
+      vb->mode=modenumber;
 
-    /* the following makes things clearer to *me* anyway */
-    float *mdct    =vb->pcm[i]; 
-    float *res     =mdct;
-    float *codedflr=mdct+n/2;
-    float *logfft  =mdct+n/2;
-
-    float *logmdct =work;
-    float *logmax  =mdct+n/2;
-    float *logmask =work+n/2;
-
-    /*
-    for(j=0;j<n/2;j+=2){
-      logmdct[j>>1]=FABS(mdct+j)+FABS(mdct+j+1);
-      logmdct[j>>1]=todB(logmdct+(j>>1));
-    }
-    _analysis_output_always("mdct2",seq+i,logmdct,n/4,1,0,total-n/2);*/
+      floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts));
+      memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
+      
+      for(j=0;j<n/2;j++)
+	logmdct[j]=todB(mdct+j);
 
+#if 0
+      if(vi->channels==2){
+	if(i==0)
+	  _analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
+	else
+	  _analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
+      }else{
+	_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
+      }
+#endif 
+      
+      /* first step; noise masking.  Not only does 'noise masking'
+         give us curves from which we can decide how much resolution
+         to give noise parts of the spectrum, it also implicitly hands
+         us a tonality estimate (the larger the value in the
+         'noise_depth' vector, the more tonal that area is) */
+
+      _vp_noisemask(psy_look,
+		    logmdct,
+		    noise); /* noise does not have by-frequency offset
+                               bias applied yet */
+#if 0
+      if(vi->channels==2){
+	if(i==0)
+	  _analysis_output("noiseL",seq,noise,n/2,1,0,0);
+	else
+	  _analysis_output("noiseR",seq,noise,n/2,1,0,0);
+      }
+#endif
 
-    for(j=0;j<n/2;j++)
-      logmdct[j]=todB(mdct+j);
-    //_analysis_output_always("mdct",seq+i,logmdct,n/2,0,0,0);
+      /* second step: 'all the other crap'; all the stuff that isn't
+         computed/fit for bitrate management goes in the second psy
+         vector.  This includes tone masking, peak limiting and ATH */
+
+      _vp_tonemask(psy_look,
+		   logfft,
+		   tone,
+		   global_ampmax,
+		   local_ampmax[i]);
+
+#if 0
+      if(vi->channels==2){
+	if(i==0)
+	  _analysis_output("toneL",seq,tone,n/2,1,0,0);
+	else
+	  _analysis_output("toneR",seq,tone,n/2,1,0,0);
+      }
+#endif
 
+      /* third step; we offset the noise vectors, overlay tone
+	 masking.  We then do a floor1-specific line fit.  If we're
+	 performing bitrate management, the line fit is performed
+	 multiple times for up/down tweakage on demand. */
+      
+      _vp_offset_and_mix(psy_look,
+			 noise,
+			 tone,
+			 1,
+			 logmask);
+
+#if 0
+      if(vi->channels==2){
+	if(i==0)
+	  _analysis_output("mask1L",seq,logmask,n/2,1,0,0);
+	else
+	  _analysis_output("mask1R",seq,logmask,n/2,1,0,0);
+      }
+#endif
 
-    /* perform psychoacoustics; do masking */
-    _vp_compute_mask(look->psy_look[blocktype],
-		     logfft, /* -> logmax */
+      /* this algorithm is hardwired to floor 1 for now; abort out if
+         we're *not* floor1.  This won't happen unless someone has
+         broken the encode setup lib.  Guard it anyway. */
+      if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
+
+      floor_posts[i][PACKETBLOBS/2]=
+	floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+		   logmdct,
+		   logmask);
+      
+      /* are we managing bitrate?  If so, perform two more fits for
+         later rate tweaking (fits represent hi/lo) */
+      if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
+	/* higher rate by way of lower noise curve */
+
+	_vp_offset_and_mix(psy_look,
+			   noise,
+			   tone,
+			   2,
+			   logmask);
+
+#if 0
+	if(vi->channels==2){
+	  if(i==0)
+	    _analysis_output("mask2L",seq,logmask,n/2,1,0,0);
+	  else
+	    _analysis_output("mask2R",seq,logmask,n/2,1,0,0);
+	}
+#endif
+	
+	floor_posts[i][PACKETBLOBS-1]=
+	  floor1_fit(vb,b->flr[info->floorsubmap[submap]],
                      logmdct,
-		     logmask,
-		     global_ampmax,
-		     local_ampmax[i],
-		     bm->avgnoise);
-
-    /*_analysis_output("mask",seq+i,logmask,n/2,1,0);*/
-    /* perform floor encoding */
-    nonzero[i]=look->floor_func[submap]->
-      forward(vb,look->floor_look[submap],
-	      mdct,
-	      logmdct,
-	      logmask,
-	      logmax,
-
-	      codedflr);
-
-
-    _vp_remove_floor(look->psy_look[blocktype],
-		     mdct,
-		     codedflr,
-		     res);
-
-    /*for(j=0;j<n/2;j++)
-      if(fabs(res[j])>1200){
-	analysis_noisy=1;
-	fprintf(stderr,"%ld ",seq+i);
-	}*/
-
-    /*_analysis_output("codedflr",seq+i,codedflr,n/2,1,1);*/
+		     logmask);
       
-  }
+	/* lower rate by way of higher noise curve */
+	_vp_offset_and_mix(psy_look,
+			   noise,
+			   tone,
+			   0,
+			   logmask);
+
+#if 0
+	if(vi->channels==2)
+	  if(i==0)
+	    _analysis_output("mask0L",seq,logmask,n/2,1,0,0);
+	  else
+	    _analysis_output("mask0R",seq,logmask,n/2,1,0,0);
+#endif
 
+	floor_posts[i][0]=
+	  floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+		     logmdct,
+		     logmask);
+	
+	/* we also interpolate a range of intermediate curves for
+           intermediate rates */
+	for(k=1;k<PACKETBLOBS/2;k++)
+	  floor_posts[i][k]=
+	    floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+				   floor_posts[i][0],
+				   floor_posts[i][PACKETBLOBS/2],
+				   k*65536/(PACKETBLOBS/2));
+	for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
+	  floor_posts[i][k]=
+	    floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+				   floor_posts[i][PACKETBLOBS/2],
+				   floor_posts[i][PACKETBLOBS-1],
+				   (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
+      }
+    }
+  }
   vbi->ampmax=global_ampmax;
-
-  /* partition based prequantization and channel coupling */
-  /* Steps in prequant and coupling:
-
-     classify by |mag| across all pcm vectors 
 
-     down-couple/down-quantize from perfect residue ->  quantized vector 
-     
-     do{ 
-        encode quantized vector; add encoded values to 'so-far' vector
-        more? [not yet at bitrate/not yet at target]
-          yes{
-              down-couple/down-quantize from perfect-'so-far' -> 
-	        quantized vector; when subtracting coupling, 
-		account for +/- out-of-phase component
-          }no{  
-              break
-          }
-     }
-     done.
-
-     quantization in each iteration is done (after circular normalization 
-     in coupling) using a by-iteration quantization granule value.
+  /*
+    the next phases are performed once for vbr-only and PACKETBLOB
+    times for bitrate managed modes.
+    
+    1) encode actual mode being used
+    2) encode the floor for each channel, compute coded mask curve/res
+    3) normalize and couple.
+    4) encode residue
+    5) save packet bytes to the packetblob vector
+    
   */
-   
-  {
-    float  **pcm=vb->pcm;
-    float  **quantized=alloca(sizeof(*quantized)*vi->channels);
-    float  **sofar=alloca(sizeof(*sofar)*vi->channels);
-
-    long  ***classifications=alloca(sizeof(*classifications)*info->submaps);
-    float ***qbundle=alloca(sizeof(*qbundle)*info->submaps);
-    float ***pcmbundle=alloca(sizeof(*pcmbundle)*info->submaps);
-    float ***sobundle=alloca(sizeof(*sobundle)*info->submaps);
-    int    **zerobundle=alloca(sizeof(*zerobundle)*info->submaps);
-    int     *chbundle=alloca(sizeof(*chbundle)*info->submaps);
-    int      chcounter=0;
 
-    /* play a little loose with this abstraction */
-    int   quant_passes=ci->coupling_passes;
+  /* iterate over the many masking curve fits we've created */
 
-    for(i=0;i<vi->channels;i++){
-      quantized[i]=_vorbis_block_alloc(vb,n*sizeof(*sofar[i]));
-      sofar[i]=quantized[i]+n/2;
-      memset(sofar[i],0,sizeof(*sofar[i])*n/2);
-    }
-
-    qbundle[0]=alloca(sizeof(*qbundle[0])*vi->channels);
-    pcmbundle[0]=alloca(sizeof(*pcmbundle[0])*vi->channels);
-    sobundle[0]=alloca(sizeof(*sobundle[0])*vi->channels);
-    zerobundle[0]=alloca(sizeof(*zerobundle[0])*vi->channels);
+  {
+    float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels);
+    float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
+    int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
+    int **sortindex=alloca(sizeof(*sortindex)*vi->channels);
+    float **mag_memo;
+    int **mag_sort;
+
+    mag_memo=_vp_quantize_couple_memo(vb,
+				      psy_look,
+				      info,
+				      gmdct);    
+
+    mag_sort=_vp_quantize_couple_sort(vb,
+				      psy_look,
+				      info,
+				      mag_memo);    
 
-    /* initial down-quantized coupling */
-    
-    if(info->coupling_steps==0){
-      /* this assumes all or nothing coupling right now.  it should pass
-	 through any channels left uncoupled, but it doesn't do that now */
+    memset(sortindex,0,sizeof(*sortindex)*vi->channels);
+    if(psy_look->vi->normal_channel_p){
       for(i=0;i<vi->channels;i++){
-	float *lpcm=pcm[i];
-	float *lqua=quantized[i];
-	for(j=0;j<n/2;j++)
-	  lqua[j]=lpcm[j];
-      }
-    }else{
-      _vp_quantize_couple(look->psy_look[blocktype],
-			  info,
-			  pcm,
-			  sofar,
-			  quantized,
-			  nonzero,
-			  0);
-    }
-
-    /* classify, by submap */
-
-    for(i=0;i<info->submaps;i++){
-      int ch_in_bundle=0;
-      qbundle[i]=qbundle[0]+chcounter;
-      sobundle[i]=sobundle[0]+chcounter;
-      zerobundle[i]=zerobundle[0]+chcounter;
-
-      for(j=0;j<vi->channels;j++){
-	if(info->chmuxlist[j]==i){
-	  if(nonzero[j])
-	    zerobundle[i][ch_in_bundle]=1;
-	  else
-	    zerobundle[i][ch_in_bundle]=0;
-	  qbundle[i][ch_in_bundle]=quantized[j];
-	  pcmbundle[i][ch_in_bundle]=pcm[j];
-	  sobundle[i][ch_in_bundle++]=sofar[j];
-	}
+	float *mdct    =gmdct[i];
+	sortindex[i]=alloca(sizeof(**sortindex)*n/2);
+	_vp_noise_normalize_sort(psy_look,mdct,sortindex[i]);
       }
-      chbundle[i]=ch_in_bundle;
-      chcounter+=ch_in_bundle;
-
-      classifications[i]=look->residue_func[i]->
-	class(vb,look->residue_look[i],pcmbundle[i],zerobundle[i],chbundle[i]);
     }
-
-    /* actual encoding loop; we pack all the iterations to collect
-       management data */
 
-    for(i=0;i<quant_passes;){
+    for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
+	k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
+	k++){
+
+      /* start out our new packet blob with packet type and mode */
+      /* Encode the packet type */
+      oggpack_write(&vb->opb,0,1);
+      /* Encode the modenumber */
+      /* Encode frame mode, pre,post windowsize, then dispatch */
+      oggpack_write(&vb->opb,modenumber,b->modebits);
+      if(vb->W){
+	oggpack_write(&vb->opb,vb->lW,1);
+	oggpack_write(&vb->opb,vb->nW,1);
+      }
 
-      /* perform residue encoding of this pass's quantized residue
-         vector, according residue mapping */
-    
-      for(j=0;j<info->submaps;j++){
-	look->residue_func[j]->
-	  forward(vb,look->residue_look[j],
-		  qbundle[j],sobundle[j],zerobundle[j],chbundle[j],
-		  i,classifications[j],vbi->packet_markers);
+      /* encode floor, compute masking curve, sep out residue */
+      for(i=0;i<vi->channels;i++){
+	int submap=info->chmuxlist[i];
+	float *mdct    =gmdct[i];
+	float *res     =vb->pcm[i];
+	int   *ilogmask=ilogmaskch[i]=
+	  _vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
+      
+	nonzero[i]=floor1_encode(vb,b->flr[info->floorsubmap[submap]],
+				 floor_posts[i][k],
+				 ilogmask);
+#if 0
+	{
+	  static float FLOOR1_fromdB_LOOKUP[256]={
+	    1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
+	    1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
+	    1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
+	    2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
+	    2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
+	    3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
+	    4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
+	    6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
+	    7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
+	    1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
+	    1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
+	    1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
+	    2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
+	    2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
+	    3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
+	    4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
+	    5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
+	    7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
+	    9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
+	    1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
+	    1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
+	    2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
+	    2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
+	    3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
+	    4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
+	    5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
+	    7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
+	    9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
+	    0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
+	    0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
+	    0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
+	    0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
+	    0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
+	    0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
+	    0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
+	    0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
+	    0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
+	    0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
+	    0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
+	    0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
+	    0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
+	    0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
+	    0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
+	    0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
+	    0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
+	    0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
+	    0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
+	    0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
+	    0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
+	    0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
+	    0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
+	    0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
+	    0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
+	    0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
+	    0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
+	    0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
+	    0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
+	    0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
+	    0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
+	    0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
+	    0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
+	    0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
+	    0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
+	    0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
+	  };
+
+	  char buf[80];
+	  sprintf(buf,"maskI%c%d",i?'L':'R',k);
+	  float work[n/2];
+	  for(j=0;j<n/2;j++)
+	    work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]];
+	  _analysis_output(buf,seq,work,n/2,1,1,0);
+	}
+#endif
+	_vp_remove_floor(psy_look,
+			 mdct,
+			 ilogmask,
+			 res,
+			 ci->psy_g_param.sliding_lowpass[vb->W][k]);
+	_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
         
+#if 0
+	{
+	  char buf[80];
+	  sprintf(buf,"resI%d",k,i);
+	  _analysis_output(buf,seq,res,n/2,1,1,0);
+	}
+#endif
       }
-      i++;
-	
-      if(i<quant_passes){
-	/* down-couple/down-quantize from perfect-'so-far' -> 
-	 new quantized vector */
-	if(info->coupling_steps==0){
-	  /* this assumes all or nothing coupling right now.  it should pass
-	     through any channels left uncoupled, but it doesn't do that now */
-	  int k;
-	  for(k=0;k<vi->channels;k++){
-	    float *lpcm=pcm[k];
-	    float *lsof=sofar[k];
-	    float *lqua=quantized[k];
-	    for(j=0;j<n/2;j++)
-	      lqua[j]=lpcm[j]-lsof[j];
+      
+      /* our iteration is now based on masking curve, not prequant and
+	 coupling.  Only one prequant/coupling step */
+      
+      /* quantize/couple */
+      /* incomplete implementation that assumes the tree is all depth
+         one, or no tree at all */
+      if(info->coupling_steps){
+	_vp_couple(k,
+		   &ci->psy_g_param,
+		   psy_look,
+		   info,
+		   vb->pcm,
+		   mag_memo,
+		   mag_sort,
+		   ilogmaskch,
+		   nonzero);
+      }else{
+	for(i=0;i<vi->channels;i++)
+	  memcpy(vb->pcm[i]+n/2,vb->pcm[i],n/2*sizeof(**vb->pcm));
+      }
+      
+      /* classify and encode by submap */
+      for(i=0;i<info->submaps;i++){
+	int ch_in_bundle=0;
+	long **classifications;
+	int resnum=info->residuesubmap[i];
+
+	for(j=0;j<vi->channels;j++){
+	  if(info->chmuxlist[j]==i){
+	    zerobundle[ch_in_bundle]=0;
+	    if(nonzero[j])zerobundle[ch_in_bundle]=1;
+	    res_bundle[ch_in_bundle]=vb->pcm[j];
+	    couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
           }
-	}else{
-
-	  _vp_quantize_couple(look->psy_look[blocktype],
-			      info,
-			      pcm,
-			      sofar,
-			      quantized,
-			      nonzero,
-			      i);
         }
+	
+	classifications=_residue_P[ci->residue_type[resnum]]->
+	  class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
+	
+	_residue_P[ci->residue_type[resnum]]->
+	  forward(vb,b->residue[resnum],
+		  couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
       }
+      
+      /* ok, done encoding.  Mark this protopacket and prepare next. */
+      oggpack_writealign(&vb->opb);
+      vbi->packetblob_markers[k]=oggpack_bytes(&vb->opb);
+      
     }
-    seq+=vi->channels;
-  } 
+    
+  }
 
+#if 0
+  seq++;
   total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4;
-  look->lastframe=vb->sequence;
+#endif
   return(0);
 }
 
-static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
+static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
   vorbis_dsp_state     *vd=vb->vd;
   vorbis_info          *vi=vd->vi;
   codec_setup_info     *ci=vi->codec_setup;
   backend_lookup_state *b=vd->backend_state;
-  vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
-  vorbis_info_mapping0 *info=look->map;
-  vorbis_info_mode     *mode=look->mode;
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l;
+
   int                   i,j;
   long                  n=vb->pcmend=ci->blocksizes[vb->W];
 
@@ -593,16 +657,11 @@
   int   *nonzero  =alloca(sizeof(*nonzero)*vi->channels);
   void **floormemo=alloca(sizeof(*floormemo)*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++){
     int submap=info->chmuxlist[i];
-    floormemo[i]=look->floor_func[submap]->
-      inverse1(vb,look->floor_look[submap]);
+    floormemo[i]=_floor_P[ci->floor_type[info->floorsubmap[submap]]]->
+      inverse1(vb,b->flr[info->floorsubmap[submap]]);
     if(floormemo[i])
       nonzero[i]=1;
     else
@@ -631,9 +690,10 @@
         pcmbundle[ch_in_bundle++]=vb->pcm[j];
       }
     }
-    
-    look->residue_func[i]->inverse(vb,look->residue_look[i],
-				   pcmbundle,zerobundle,ch_in_bundle);
+
+    _residue_P[ci->residue_type[info->residuesubmap[i]]]->
+      inverse(vb,b->residue[info->residuesubmap[i]],
+	      pcmbundle,zerobundle,ch_in_bundle);
   }
 
   /* channel coupling */
@@ -668,8 +728,9 @@
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
     int submap=info->chmuxlist[i];
-    look->floor_func[submap]->
-      inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
+    _floor_P[ci->floor_type[info->floorsubmap[submap]]]->
+      inverse2(vb,b->flr[info->floorsubmap[submap]],
+	       floormemo[i],pcm);
   }
 
   /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
@@ -698,10 +759,7 @@
 vorbis_func_mapping mapping0_exportbundle={
   &mapping0_pack,
   &mapping0_unpack,
-  &mapping0_look,
-  &mapping0_copy_info,
   &mapping0_free_info,
-  &mapping0_free_look,
   &mapping0_forward,
   &mapping0_inverse
 };

<p><p>1.22      +759 -193  vorbis/lib/masking.h

Index: masking.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/masking.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- masking.h	2001/12/22 09:40:39	1.21
+++ masking.h	2002/06/28 22:19:36	1.22
@@ -5,214 +5,780 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: masking curve data for psychoacoustics
- last mod: $Id: masking.h,v 1.21 2001/12/22 09:40:39 xiphmont Exp $
+ last mod: $Id: masking.h,v 1.22 2002/06/28 22:19:36 xiphmont Exp $
 
  ********************************************************************/
 
 #ifndef _V_MASKING_H_
 #define _V_MASKING_H_
 
-static float ATH_Bark_dB_lspconservative[]={  
-   15,   15,   15,    15,    11,    10,     8,    7,    7,    7,
-    6,    2,    0,     0,    -3,    -5,    -6,   -6, -4.5f, 2.5f,
-   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. */
+/* more detailed ATH */
 
-/* Let's all do the Trek thing and just call them 'Ehmer curves' ;-)
-   Note these are octaves, not Bark scale. */
+#define MAX_ATH 88
+static float ATH[]={
+  /*15*/  -20, -24, -26, -30, -34, -37, -40, -43,  
+  /*31*/  -46, -49, -53, -56, -58, -60, -62, -64,
+  /*63*/  -66, -68, -69, -70, -71, -72, -73, -74, 
+  /*125*/ -75, -76, -77, -78, -80, -81, -82, -83,
+  /*250*/ -84, -85, -86, -87, -88, -88, -89, -89, 
+  /*500*/ -90, -91, -91, -92, -93, -94, -95, -96,
+  /*1k*/  -96, -97, -98, -98, -99, -99,-100,-100,
+  /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107,
+  /*4k*/ -107,-105,-103,-102,-101, -99, -98, -96,
+  /*8k*/  -95, -95, -96, -97, -96, -95, -93, -90,
+  /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30
+};
+
+/* The tone masking curves from Ehmer's and Fielder's papers have been
+   replaced by an empirically collected data set.  The previously
+   published values were, far too often, simply on crack. */
 
 #define EHMER_OFFSET 16
 #define EHMER_MAX 56
 
-static float tone_125_40dB_SL[EHMER_MAX]={
-  20,  20,  20,  20,  20,  20,  20,  20,   20, 20, 20, 20, 20, 20, 20, 20,  
-  20,  18,  16,  14,  12,  11,   9,   7,    5,  3,  2,  0, -2, -4, -6, -8,
- -10, -12, -14, -16, -18, -20, -900, -900,  -900,-900,-900,-900,-900,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_125_60dB_SL[EHMER_MAX]={
-  40,  40,  40,  40,  40,  40,  40,  40,   40, 40, 40, 40, 40, 40, 40, 40,  
-  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,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_125_80dB_SL[EHMER_MAX]={
-  60,  60,  60,  60,  60,  60,  60,  60,   60, 60, 60, 60, 60, 60, 60, 60,  
-  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};
-static float tone_125_100dB_SL[EHMER_MAX]={
-  78,  78,  78,  78,  78,  78,  78,  78,   78, 78, 78, 78, 78, 78, 78, 78,  
-  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};
-
-static 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,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static 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,-900,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static 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 */
-static 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};
-
-static float tone_500_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900, -20, -14,  -8,  -2,   4,  10,  17,
-  23,  16,  12,   9,   6,   3,   0,  -3,    -7, -10, -13, -16, -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,-900,-900};
-static 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,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_500_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900, -900,-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,-900,-900,-900,-900};
-static 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,-900,-900};
-
-static float tone_1000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900, -20, -10,  0,   9,  20,
-  27,  20,  13,  14,  13,   5,  -1,  -6,   -11, -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,-900,-900,-900,-900,-900};
-static float tone_1000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-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};
-static float tone_1000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-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};
-static float tone_1000_100dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-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,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_2000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   5,  12,  20,
-  24,  14,   8,   0,  -5,-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};
-static float tone_2000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   8,  19,  31,
-  38,  30,  15,  15,  15,  13,   8,   5,    -2,-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};
-static float tone_2000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   2,  10,  22,  38,
-  52,  51,  40,  30,  28,  30,  33,  37,    37,  35,  31,  26,  20,  15,  10,   5,
-   0,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_2000_100dB_SL[EHMER_MAX]={  
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   6,  20,  40,  55,
-  66,  60,  53,  40,  35,  31,  34,  42,    58,  48,  43,  45,  52,  57,  50,  42,
-  45,  45,  35,  25,  20,  11,   2,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_4000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   2,   4,  18,
-  24,  10,   5,   0,  -5,-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};
-
-static float tone_4000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   2,   4,  20,
-  38,  30,  22,  15,  10,   5,   0, -10,  -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};
-
-static float tone_4000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   0,   4,  10,  35,
-  51,  49,  35,  35,  36,  36,  36,  31,    25,  20,  10,   0,-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};
-
-static float tone_4000_100dB_SL[EHMER_MAX]={
--900,  -5,   1,   3,   5,   8,  10,  12,    14,  20,  26,  28,  32,  36,  41,  51,
-  61,  59,  45,  45,  48,  48,  40,  25,    40,  30,  18,   5,  0, -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};
-
-
-/* here the data collected by ehmer is clearly suspect as I have
-   several samples that provide counterexamples.  the data below is
-   derated from Ehmers original numbers */
-
-static float tone_8000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
-  26,  21,  14,   5,   0,  0,   0,    0,    20,  35,  55,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70, 70,  70,   70,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,  5,   12,  30,
-  43,  34,  22,  15,  10,   5,   0,   0,    20,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
-  63,  50,  35,  35,  36,  36,  36,  31,    40,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
- -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_100dB_SL[EHMER_MAX]={
- -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
-  70,  50,  30,  30,  30,  30,  30,  32,    43,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
-
-/* a complete guess, but reasonably conservative and borne out by some
-   empirical testing */
-
-static float tone_16000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
-  26,  35,  55,  70,  70,  70,  70,  70,   70,  70,  70,  70,  70, 70,  70,  70, 
--900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,  5,   12,  30,
-  43,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
-  63,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
- -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_100dB_SL[EHMER_MAX]={
- -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
-  70,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
+/* masking tones from -50 to 0dB, 62.5 through 16kHz at half octaves
+   test tones from -2 octaves to +5 octaves sampled at eighth octaves */
+/* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL
+   for collection of these curves) */
+
+static float tonemasks[P_BANDS][6][EHMER_MAX]={
+  /* 62.5 Hz */
+  {{ -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60, 
+     -60,  -60,  -60,  -60,  -62,  -62,  -65,  -73, 
+     -69,  -68,  -68,  -67,  -70,  -70,  -72,  -74, 
+     -75,  -79,  -79,  -80,  -83,  -88,  -93, -100, 
+     -110, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48, 
+     -48,  -48,  -48,  -48,  -48,  -53,  -61,  -66, 
+     -66,  -68,  -67,  -70,  -76,  -76,  -72,  -73, 
+     -75,  -76,  -78,  -79,  -83,  -88,  -93, -100, 
+     -110, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37, 
+     -38,  -40,  -42,  -46,  -48,  -53,  -55,  -62, 
+     -65,  -58,  -56,  -56,  -61,  -60,  -65,  -67, 
+     -69,  -71,  -77,  -77,  -78,  -80,  -82,  -84, 
+     -88,  -93,  -98, -106, -112, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25, 
+     -25,  -26,  -27,  -29,  -32,  -38,  -48,  -52, 
+     -52,  -50,  -48,  -48,  -51,  -52,  -54,  -60, 
+     -67,  -67,  -66,  -68,  -69,  -73,  -73,  -76, 
+     -80,  -81,  -81,  -85,  -85,  -86,  -88,  -93, 
+     -100, -110, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16, 
+     -17,  -19,  -20,  -22,  -26,  -28,  -31,  -40, 
+     -47,  -39,  -39,  -40,  -42,  -43,  -47,  -51, 
+     -57,  -52,  -55,  -55,  -60,  -58,  -62,  -63, 
+     -70,  -67,  -69,  -72,  -73,  -77,  -80,  -82, 
+     -83,  -87,  -90,  -94,  -98, -104, -115, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   {  -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8, 
+      -8,   -8,  -10,  -11,  -15,  -19,  -25,  -30, 
+      -34,  -31,  -30,  -31,  -29,  -32,  -35,  -42, 
+      -48,  -42,  -44,  -46,  -50,  -50,  -51,  -52, 
+      -59,  -54,  -55,  -55,  -58,  -62,  -63,  -66, 
+      -72,  -73,  -76,  -75,  -78,  -80,  -80,  -81, 
+      -84,  -88,  -90,  -94,  -98, -101, -106, -110}}, 
+  /* 88Hz */
+  {{ -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66, 
+     -66,  -66,  -66,  -66,  -66,  -67,  -67,  -67, 
+     -76,  -72,  -71,  -74,  -76,  -76,  -75,  -78, 
+     -79,  -79,  -81,  -83,  -86,  -89,  -93,  -97, 
+     -100, -105, -110, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47, 
+     -47,  -47,  -47,  -48,  -51,  -55,  -59,  -66, 
+     -66,  -66,  -67,  -66,  -68,  -69,  -70,  -74, 
+     -79,  -77,  -77,  -78,  -80,  -81,  -82,  -84, 
+     -86,  -88,  -91,  -95, -100, -108, -116, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36, 
+     -36,  -37,  -37,  -41,  -44,  -48,  -51,  -58, 
+     -62,  -60,  -57,  -59,  -59,  -60,  -63,  -65, 
+     -72,  -71,  -70,  -72,  -74,  -77,  -76,  -78, 
+     -81,  -81,  -80,  -83,  -86,  -91,  -96, -100, 
+     -105, -110, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28, 
+     -28,  -30,  -32,  -32,  -33,  -35,  -41,  -49, 
+     -50,  -49,  -47,  -48,  -48,  -52,  -51,  -57, 
+     -65,  -61,  -59,  -61,  -64,  -69,  -70,  -74, 
+     -77,  -77,  -78,  -81,  -84,  -85,  -87,  -90, 
+     -92,  -96, -100, -107, -112, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19, 
+     -20,  -21,  -23,  -27,  -30,  -35,  -36,  -41, 
+     -46,  -44,  -42,  -40,  -41,  -41,  -43,  -48, 
+     -55,  -53,  -52,  -53,  -56,  -59,  -58,  -60, 
+     -67,  -66,  -69,  -71,  -72,  -75,  -79,  -81, 
+     -84,  -87,  -90,  -93,  -97, -101, -107, -114, 
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   {  -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9, 
+      -11,  -12,  -12,  -15,  -16,  -20,  -23,  -30, 
+      -37,  -34,  -33,  -34,  -31,  -32,  -32,  -38, 
+      -47,  -44,  -41,  -40,  -47,  -49,  -46,  -46, 
+      -58,  -50,  -50,  -54,  -58,  -62,  -64,  -67, 
+      -67,  -70,  -72,  -76,  -79,  -83,  -87,  -91, 
+      -96, -100, -104, -110, -999, -999, -999, -999}}, 
+  /* 125 Hz */
+  {{ -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62, 
+     -62,  -62,  -63,  -64,  -66,  -67,  -66,  -68, 
+     -75,  -72,  -76,  -75,  -76,  -78,  -79,  -82, 
+     -84,  -85,  -90,  -94, -101, -110, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59, 
+     -59,  -59,  -59,  -60,  -60,  -61,  -63,  -66, 
+     -71,  -68,  -70,  -70,  -71,  -72,  -72,  -75, 
+     -81,  -78,  -79,  -82,  -83,  -86,  -90,  -97, 
+     -103, -113, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53, 
+     -53,  -54,  -55,  -57,  -56,  -57,  -55,  -61, 
+     -65,  -60,  -60,  -62,  -63,  -63,  -66,  -68, 
+     -74,  -73,  -75,  -75,  -78,  -80,  -80,  -82, 
+     -85,  -90,  -96, -101, -108, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46, 
+     -46,  -46,  -47,  -47,  -47,  -47,  -48,  -51, 
+     -57,  -51,  -49,  -50,  -51,  -53,  -54,  -59, 
+     -66,  -60,  -62,  -67,  -67,  -70,  -72,  -75, 
+     -76,  -78,  -81,  -85,  -88,  -94,  -97, -104, 
+     -112, -999, -999, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36, 
+     -39,  -41,  -42,  -42,  -39,  -38,  -41,  -43, 
+     -52,  -44,  -40,  -39,  -37,  -37,  -40,  -47, 
+     -54,  -50,  -48,  -50,  -55,  -61,  -59,  -62, 
+     -66,  -66,  -66,  -69,  -69,  -73,  -74,  -74, 
+     -75,  -77,  -79,  -82,  -87,  -91,  -95, -100, 
+     -108, -115, -999, -999, -999, -999, -999, -999}, 
+   { -28,  -26,  -24,  -22,  -20,  -20,  -23,  -29, 
+     -30,  -31,  -28,  -27,  -28,  -28,  -28,  -35, 
+     -40,  -33,  -32,  -29,  -30,  -30,  -30,  -37, 
+     -45,  -41,  -37,  -38,  -45,  -47,  -47,  -48, 
+     -53,  -49,  -48,  -50,  -49,  -49,  -51,  -52, 
+     -58,  -56,  -57,  -56,  -60,  -61,  -62,  -70, 
+     -72,  -74,  -78,  -83,  -88,  -93, -100, -106}}, 
+  /* 177 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -110, -105, -100,  -95,  -91,  -87,  -83, 
+    -80,  -78,  -76,  -78,  -78,  -81,  -83,  -85, 
+    -86,  -85,  -86,  -87,  -90,  -97, -107, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -110, -105, -100,  -95,  -90, 
+    -85,  -81,  -77,  -73,  -70,  -67,  -67,  -68, 
+    -75,  -73,  -70,  -69,  -70,  -72,  -75,  -79, 
+    -84,  -83,  -84,  -86,  -88,  -89,  -89,  -93, 
+    -98, -105, -112, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-105, -100,  -95,  -90,  -85,  -80,  -76,  -71, 
+    -68,  -68,  -65,  -63,  -63,  -62,  -62,  -64, 
+    -65,  -64,  -61,  -62,  -63,  -64,  -66,  -68, 
+    -73,  -73,  -74,  -75,  -76,  -81,  -83,  -85, 
+    -88,  -89,  -92,  -95, -100, -108, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -80,  -75,  -71,  -68,  -65,  -63,  -62,  -61, 
+     -61,  -61,  -61,  -59,  -56,  -57,  -53,  -50, 
+     -58,  -52,  -50,  -50,  -52,  -53,  -54,  -58, 
+     -67,  -63,  -67,  -68,  -72,  -75,  -78,  -80, 
+     -81,  -81,  -82,  -85,  -89,  -90,  -93,  -97, 
+     -101, -107, -114, -999, -999, -999, -999, -999, 
+     -999, -999, -999, -999, -999, -999, -999, -999}, 
+   { -65,  -61,  -59,  -57,  -56,  -55,  -55,  -56, 
+     -56,  -57,  -55,  -53,  -52,  -47,  -44,  -44, 
+     -50,  -44,  -41,  -39,  -39,  -42,  -40,  -46, 
+     -51,  -49,  -50,  -53,  -54,  -63,  -60,  -61, 
+     -62,  -66,  -66,  -66,  -70,  -73,  -74,  -75, 
+     -76,  -75,  -79,  -85,  -89,  -91,  -96, -102, 
+     -110, -999, -999, -999, -999, -999, -999, -999}, 
+   { -52,  -50,  -49,  -49,  -48,  -48,  -48,  -49, 
+     -50,  -50,  -49,  -46,  -43,  -39,  -35,  -33, 
+     -38,  -36,  -32,  -29,  -32,  -32,  -32,  -35, 
+     -44,  -39,  -38,  -38,  -46,  -50,  -45,  -46, 
+     -53,  -50,  -50,  -50,  -54,  -54,  -53,  -53, 
+     -56,  -57,  -59,  -66,  -70,  -72,  -74,  -79, 
+     -83,  -85,  -90, -97, -114, -999, -999, -999}}, 
+  /* 250 Hz */
+  {{-999, -999, -999, -999, -999, -999, -110, -105, 
+    -100,  -95,  -90,  -86,  -80,  -75,  -75,  -79, 
+    -80,  -79,  -80,  -81,  -82,  -88,  -95, -103, 
+    -110, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -108, -103,  -98,  -93, 
+    -88,  -83,  -79,  -78,  -75,  -71,  -67,  -68, 
+    -73,  -73,  -72,  -73,  -75,  -77,  -80,  -82, 
+    -88,  -93, -100, -107, -114, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -110, -105, -101,  -96,  -90, 
+    -86,  -81,  -77,  -73,  -69,  -66,  -61,  -62, 
+    -66,  -64,  -62,  -65,  -66,  -70,  -72,  -76, 
+    -81,  -80,  -84,  -90,  -95, -102, -110, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -107, -103,  -97,  -92,  -88, 
+    -83,  -79,  -74,  -70,  -66,  -59,  -53,  -58, 
+    -62,  -55,  -54,  -54,  -54,  -58,  -61,  -62, 
+    -72,  -70,  -72,  -75,  -78,  -80,  -81,  -80, 
+    -83,  -83,  -88,  -93, -100, -107, -115, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -105, -100,  -95,  -90,  -85, 
+    -80,  -75,  -70,  -66,  -62,  -56,  -48,  -44, 
+    -48,  -46,  -46,  -43,  -46,  -48,  -48,  -51, 
+    -58,  -58,  -59,  -60,  -62,  -62,  -61,  -61, 
+    -65,  -64,  -65,  -68,  -70,  -74,  -75,  -78, 
+    -81,  -86,  -95, -110, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999,  -999, -105, -100,  -95,  -90,  -85,  -80, 
+    -75,  -70,  -65,  -61,  -55,  -49,  -39,  -33, 
+    -40,  -35,  -32,  -38,  -40,  -33,  -35,  -37, 
+    -46,  -41,  -45,  -44,  -46,  -42,  -45,  -46, 
+    -52,  -50,  -50,  -50,  -54,  -54,  -55,  -57, 
+    -62,  -64,  -66,  -68,  -70,  -76,  -81,  -90, 
+    -100, -110, -999, -999, -999, -999, -999, -999}}, 
+  /* 354 hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -105,  -98,  -90,  -85,  -82,  -83,  -80,  -78, 
+    -84,  -79,  -80,  -83,  -87,  -89,  -91,  -93, 
+    -99, -106, -117, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -105,  -98,  -90,  -85,  -80,  -75,  -70,  -68, 
+    -74,  -72,  -74,  -77,  -80,  -82,  -85,  -87, 
+    -92,  -89,  -91,  -95, -100, -106, -112, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -105,  -98,  -90,  -83,  -75,  -71,  -63,  -64, 
+    -67,  -62,  -64,  -67,  -70,  -73,  -77,  -81, 
+    -84,  -83,  -85,  -89,  -90,  -93,  -98, -104, 
+    -109, -114, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -103,  -96,  -88,  -81,  -75,  -68,  -58,  -54, 
+    -56,  -54,  -56,  -56,  -58,  -60,  -63,  -66, 
+    -74,  -69,  -72,  -72,  -75,  -74,  -77,  -81, 
+    -81,  -82,  -84,  -87,  -93,  -96,  -99, -104, 
+    -110, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -108, -102,  -96, 
+    -91,  -85,  -80,  -74,  -68,  -60,  -51,  -46, 
+    -48,  -46,  -43,  -45,  -47,  -47,  -49,  -48, 
+    -56,  -53,  -55,  -58,  -57,  -63,  -58,  -60, 
+    -66,  -64,  -67,  -70,  -70,  -74,  -77,  -84, 
+    -86,  -89,  -91,  -93,  -94, -101, -109, -118, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -108, -103,  -98,  -93,  -88, 
+    -83,  -78,  -73,  -68,  -60,  -53,  -44,  -35, 
+    -38,  -38,  -34,  -34,  -36,  -40,  -41,  -44, 
+    -51,  -45,  -46,  -47,  -46,  -54,  -50,  -49, 
+    -50,  -50,  -50,  -51,  -54,  -57,  -58,  -60, 
+    -66,  -66,  -66,  -64,  -65,  -68,  -77,  -82, 
+    -87,  -95, -110, -999, -999, -999, -999, -999}}, 
+  /* 500 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -107, -102,  -97,  -92,  -87,  -83,  -78,  -75, 
+    -82,  -79,  -83,  -85,  -89,  -92,  -95,  -98, 
+    -101, -105, -109, -113, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -106, 
+    -100,  -95,  -90,  -86,  -81,  -78,  -74,  -69, 
+    -74,  -74,  -76,  -79,  -83,  -84,  -86,  -89, 
+    -92,  -97,  -93, -100, -103, -107, -110, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -106, -100, 
+    -95, -90, -87, -83, -80, -75, -69, -60, 
+    -66, -66, -68, -70, -74, -78, -79, -81, 
+    -81, -83, -84, -87, -93, -96, -99, -103, 
+    -107, -110, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -108, -103, -98, 
+    -93, -89, -85, -82, -78, -71, -62, -55, 
+    -58, -58, -54, -54, -55, -59, -61, -62, 
+    -70, -66, -66, -67, -70, -72, -75, -78, 
+    -84, -84, -84, -88, -91, -90, -95, -98, 
+    -102, -103, -106, -110, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -108, -103,  -98,  -94, 
+    -90,  -87,  -82,  -79,  -73,  -67,  -58,  -47, 
+    -50,  -45,  -41,  -45,  -48,  -44,  -44,  -49, 
+    -54,  -51,  -48,  -47,  -49,  -50,  -51,  -57, 
+    -58,  -60,  -63,  -69,  -70,  -69,  -71,  -74, 
+    -78,  -82,  -90,  -95, -101, -105, -110, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -105, -101, -97, -93, -90, 
+    -85, -80, -77, -72, -65, -56, -48, -37, 
+    -40, -36, -34, -40, -50, -47, -38, -41, 
+    -47, -38, -35, -39, -38, -43, -40, -45, 
+    -50, -45, -44, -47, -50, -55, -48, -48, 
+    -52, -66, -70, -76, -82, -90, -97, -105, 
+    -110, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 707 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -108, -103,  -98,  -93,  -86,  -79,  -76, 
+    -83,  -81,  -85,  -87,  -89,  -93,  -98, -102, 
+    -107, -112, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -108, -103,  -98,  -93,  -86,  -79,  -71, 
+    -77,  -74,  -77,  -79,  -81,  -84,  -85,  -90, 
+    -92,  -93,  -92,  -98, -101, -108, -112, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -108, -103,  -98,  -93,  -87,  -78,  -68,  -65, 
+    -66,  -62,  -65,  -67,  -70,  -73,  -75,  -78, 
+    -82,  -82,  -83,  -84,  -91,  -93,  -98, -102, 
+    -106, -110, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -105, -100, -95, -90, -82, -74, -62, -57, 
+    -58, -56, -51, -52, -52, -54, -54, -58, 
+    -66, -59, -60, -63, -66, -69, -73, -79, 
+    -83, -84, -80, -81, -81, -82, -88, -92, 
+    -98, -105, -113, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -107, 
+    -102,  -97,  -92,  -84,  -79,  -69,  -57,  -47, 
+    -52,  -47,  -44,  -45,  -50,  -52,  -42,  -42, 
+    -53,  -43,  -43,  -48,  -51,  -56,  -55,  -52, 
+    -57,  -59,  -61,  -62,  -67,  -71,  -78,  -83, 
+    -86,  -94,  -98, -103, -110, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -105, -100, 
+    -95,  -90,  -84,  -78,  -70,  -61,  -51,  -41, 
+    -40,  -38,  -40,  -46,  -52,  -51,  -41,  -40, 
+    -46,  -40,  -38,  -38,  -41,  -46,  -41,  -46, 
+    -47,  -43,  -43,  -45,  -41,  -45,  -56,  -67, 
+    -68,  -83,  -87,  -90,  -95, -102, -107, -113, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 1000 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -109, -105, -101,  -96,  -91,  -84,  -77, 
+    -82,  -82,  -85,  -89,  -94, -100, -106, -110, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -106, -103,  -98,  -92,  -85,  -80,  -71, 
+    -75,  -72,  -76,  -80,  -84,  -86,  -89,  -93, 
+    -100, -107, -113, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -107, 
+    -104, -101,  -97,  -92,  -88,  -84,  -80,  -64, 
+    -66,  -63,  -64,  -66,  -69,  -73,  -77,  -83, 
+    -83,  -86,  -91,  -98, -104, -111, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -107, 
+    -104, -101,  -97,  -92,  -90,  -84,  -74,  -57, 
+    -58,  -52,  -55,  -54,  -50,  -52,  -50,  -52, 
+    -63,  -62,  -69,  -76,  -77,  -78,  -78,  -79, 
+    -82,  -88,  -94, -100, -106, -111, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -106, -102, 
+    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -50, 
+    -50,  -41,  -44,  -49,  -47,  -50,  -50,  -44, 
+    -55,  -46,  -47,  -48,  -48,  -54,  -49,  -49, 
+    -58,  -62,  -71,  -81,  -87,  -92,  -97, -102, 
+    -108, -114, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -106, -102, 
+    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -45, 
+    -43,  -41,  -47,  -50,  -51,  -50,  -49,  -45, 
+    -47,  -41,  -44,  -41,  -39,  -43,  -38,  -37, 
+    -40,  -41,  -44,  -50,  -58,  -65,  -73,  -79, 
+    -85,  -92,  -97, -101, -105, -109, -113, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 1414 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -107, -100,  -95,  -87,  -81, 
+    -85,  -83,  -88,  -93, -100, -107, -114, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -107, -101,  -95,  -88,  -83,  -76, 
+    -73,  -72,  -79,  -84,  -90,  -95, -100, -105, 
+    -110, -115, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -104,  -98,  -92,  -87,  -81,  -70, 
+    -65,  -62,  -67,  -71,  -74,  -80,  -85,  -91, 
+    -95,  -99, -103, -108, -111, -114, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -103,  -97,  -90,  -85,  -76,  -60, 
+    -56,  -54,  -60,  -62,  -61,  -56,  -63,  -65, 
+    -73,  -74,  -77,  -75,  -78,  -81,  -86,  -87, 
+    -88,  -91,  -94,  -98, -103, -110, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -105, 
+    -100,  -97,  -92,  -86,  -81,  -79,  -70,  -57, 
+    -51,  -47,  -51,  -58,  -60,  -56,  -53,  -50, 
+    -58,  -52,  -50,  -50,  -53,  -55,  -64,  -69, 
+    -71,  -85,  -82,  -78,  -81,  -85,  -95, -102, 
+    -112, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -105, 
+    -100,  -97,  -92,  -85,  -83,  -79,  -72,  -49, 
+    -40,  -43,  -43,  -54,  -56,  -51,  -50,  -40, 
+    -43,  -38,  -36,  -35,  -37,  -38,  -37,  -44, 
+    -54,  -60,  -57,  -60,  -70,  -75,  -84,  -92, 
+    -103, -112, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 2000 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -102,  -95,  -89,  -82, 
+    -83,  -84,  -90,  -92,  -99, -107, -113, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -107, -101,  -95,  -89,  -83,  -72, 
+    -74,  -78,  -85,  -88,  -88,  -90,  -92,  -98, 
+    -105, -111, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -109, -103, -97, -93, -87, -81, -70, 
+    -70, -67, -75, -73, -76, -79, -81, -83, 
+    -88, -89, -97, -103, -110, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -107, -100,  -94,  -88,  -83,  -75,  -63, 
+    -59,  -59,  -63,  -66,  -60,  -62,  -67,  -67, 
+    -77,  -76,  -81,  -88,  -86,  -92,  -96, -102, 
+    -109, -116, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -105,  -98,  -92,  -86,  -81,  -73,  -56, 
+    -52,  -47,  -55,  -60,  -58,  -52,  -51,  -45, 
+    -49,  -50,  -53,  -54,  -61,  -71,  -70,  -69, 
+    -78,  -79,  -87,  -90,  -96, -104, -112, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -103,  -96,  -90,  -86,  -78,  -70,  -51, 
+    -42,  -47,  -48,  -55,  -54,  -54,  -53,  -42, 
+    -35,  -28,  -33,  -38,  -36,  -43,  -41,  -43, 
+    -46,  -60,  -68,  -78,  -82,  -89,  -94,  -99, 
+    -104, -109, -114, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 2828 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -110, -100,  -90,  -79, 
+    -85,  -81,  -82,  -82,  -89,  -94,  -99, -103, 
+    -109, -115, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -105,  -97,  -85,  -72, 
+    -74,  -70,  -70,  -70,  -76,  -85,  -91,  -93, 
+    -97, -103, -109, -115, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -112,  -93,  -81,  -68, 
+    -62,  -60,  -60,  -57,  -58,  -68,  -77,  -82, 
+    -90,  -93,  -98, -104, -109, -113, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -113, -100,  -93,  -84,  -63, 
+    -58,  -48,  -53,  -54,  -52,  -44,  -47,  -56, 
+    -66,  -72,  -76,  -71,  -80,  -75,  -90,  -95, 
+    -98, -101, -103, -106, -108, -111, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -105,  -95,  -86,  -74,  -53, 
+    -50,  -38,  -43,  -49,  -43,  -42,  -39,  -39, 
+    -46,  -49,  -49,  -46,  -58,  -61,  -74,  -81, 
+    -87,  -92,  -94,  -97,  -99, -102, -105, -108, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -108,  -99,  -90,  -76,  -66,  -45, 
+    -43,  -41,  -44,  -47,  -43,  -47,  -40,  -30, 
+    -31,  -31,  -39,  -33,  -40,  -41,  -43,  -53, 
+    -59,  -70,  -73,  -77,  -79,  -82,  -84,  -87, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 4000 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110,  -91,  -76, 
+    -75,  -85,  -93,  -98, -104, -110, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110,  -91,  -70, 
+    -70,  -75,  -86,  -89,  -94,  -98, -101, -106, 
+    -110, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -110,  -95,  -80,  -60, 
+    -65,  -64,  -74,  -83,  -88,  -91,  -95,  -99, 
+    -103, -107, -110, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -110,  -95,  -80,  -58, 
+    -55,  -49,  -66,  -68,  -71,  -78,  -78,  -80, 
+    -88,  -85,  -89,  -97, -100, -105, -110, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -110,  -95,  -80,  -53, 
+    -52,  -41,  -59,  -59,  -49,  -58,  -56,  -63, 
+    -86,  -79,  -90,  -93,  -98, -103, -107, -112, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110,  -97,  -91,  -73,  -45, 
+    -40,  -33,  -53,  -61,  -49,  -54,  -50,  -50, 
+    -60,  -52,  -67,  -74,  -81,  -92,  -96, -100, 
+    -105, -110, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 5657 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -113, -106,  -99,  -92,  -77, 
+    -80,  -88,  -97, -106, -115, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -116, -109, -102,  -95,  -89,  -74, 
+    -72,  -88,  -87,  -95, -102, -109, -116, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -116, -109, -102,  -95,  -89,  -75, 
+    -66,  -74,  -77,  -78,  -86,  -87,  -90,  -96, 
+    -105, -115, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -115, -108, -101,  -94,  -88,  -66, 
+    -56,  -61,  -70,  -65,  -78,  -72,  -83,  -84, 
+    -93,  -98, -105, -110, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -110, -105,  -95,  -89,  -82,  -57, 
+    -52,  -52,  -59,  -56,  -59,  -58,  -69,  -67, 
+    -88,  -82,  -82,  -89,  -94, -100, -108, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -110, -101,  -96,  -90,  -83,  -77,  -54, 
+    -43,  -38,  -50,  -48,  -52,  -48,  -42,  -42, 
+    -51,  -52,  -53,  -59,  -65,  -71,  -78,  -85, 
+    -95, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 8000 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -120, -105,  -86,  -68, 
+    -78,  -79,  -90, -100, -110, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -120, -105,  -86,  -66, 
+    -73,  -77,  -88,  -96, -105, -115, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -120, -105,  -92,  -80,  -61, 
+    -64,  -68,  -80,  -87,  -92, -100, -110, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -120, -104,  -91,  -79,  -52, 
+    -60,  -54,  -64,  -69,  -77,  -80,  -82,  -84, 
+    -85,  -87,  -88,  -90, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -118, -100,  -87,  -77,  -49, 
+    -50,  -44,  -58,  -61,  -61,  -67,  -65,  -62, 
+    -62,  -62,  -65,  -68, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -115,  -98,  -84,  -62,  -49, 
+    -44,  -38,  -46,  -49,  -49,  -46,  -39,  -37, 
+    -39,  -40,  -42,  -43, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 11314 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110,  -88,  -74, 
+    -77,  -82,  -82,  -85,  -90,  -94,  -99, -104, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110,  -88,  -66, 
+    -70,  -81,  -80,  -81,  -84,  -88,  -91,  -93, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110,  -88,  -61, 
+    -63,  -70,  -71,  -74,  -77,  -80,  -83,  -85, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -110, -86, -62, 
+    -63,  -62,  -62,  -58,  -52,  -50,  -50,  -52, 
+    -54, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -118, -108,  -84,  -53, 
+    -50,  -50,  -50,  -55,  -47,  -45,  -40,  -40, 
+    -40, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -118, -100,  -73,  -43, 
+    -37,  -42,  -43,  -53,  -38,  -37,  -35,  -35, 
+    -38, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  /* 16000 Hz */
+  {{-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -91,  -84,  -74, 
+    -80,  -80,  -80,  -80,  -80, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -91,  -84,  -74, 
+    -68,  -68,  -68,  -68,  -68, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -86,  -78,  -70, 
+    -60,  -45,  -30,  -21, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -87,  -78,  -67, 
+    -48,  -38,  -29,  -21, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -86,  -69,  -56, 
+    -45,  -35,  -33,  -29, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}, 
+   {-999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -110, -100,  -83,  -71,  -48, 
+    -27,  -38,  -37,  -34, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999, 
+    -999, -999, -999, -999, -999, -999, -999, -999}}
+}; 
 
 #endif

<p><p>1.31      +1 -1      vorbis/lib/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mdct.c	2002/06/24 14:11:40	1.30
+++ mdct.c	2002/06/28 22:19:36	1.31
@@ -12,7 +12,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.30 2002/06/24 14:11:40 msmith Exp $
+ last mod: $Id: mdct.c,v 1.31 2002/06/28 22:19:36 xiphmont Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,

<p><p>1.12      +5 -2      vorbis/lib/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/misc.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- misc.h	2002/01/22 08:06:07	1.11
+++ misc.h	2002/06/28 22:19:37	1.12
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: miscellaneous prototypes
- last mod: $Id: misc.h,v 1.11 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: misc.h,v 1.12 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -19,9 +19,12 @@
 #define _V_RANDOM_H_
 #include "vorbis/codec.h"
 
+extern int analysis_noisy;
+
 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);
+extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
+			     ogg_int64_t off);
 
 #ifdef DEBUG_MALLOC
 

<p><p>1.30      +1 -26     vorbis/lib/os.h

Index: os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- os.h	2002/03/18 03:30:23	1.29
+++ os.h	2002/06/28 22:19:37	1.30
@@ -13,7 +13,7 @@
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.29 2002/03/18 03:30:23 segher Exp $
+ last mod: $Id: os.h,v 1.30 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -40,31 +40,6 @@
 #  define rint(x)   (floor((x)+0.5f)) 
 #  define NO_FLOAT_MATH_LIB
 #  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
-#endif
-
-#ifdef HAVE_SQRTF
-#  define sqrt sqrtf
-#endif
-#ifdef HAVE_LOGF
-#  define log logf
-#endif
-#ifdef HAVE_EXPF
-#  define exp expf
-#endif
-#ifdef HAVE_ACOSF
-#  define acos acosf
-#endif
-#ifdef HAVE_ATANF
-#  define atan atanf
-#endif
-#ifdef HAVE_FREXPF
-#  define frexp frexpf
-#endif
-#ifdef HAVE_RINTF
-#  define rint rintf
-#endif
-#ifdef HAVE_FLOORF
-#  define floor floorf
 #endif
 
 #ifndef FAST_HYPOT

<p><p>1.68      +661 -617  vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- psy.c	2002/03/24 21:04:01	1.67
+++ psy.c	2002/06/28 22:19:37	1.68
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.67 2002/03/24 21:04:01 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.68 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -30,10 +30,8 @@
 #include "misc.h"
 
 #define NEGINF -9999.f
+static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
 
-/* Why Bark scale for encoding but not masking computation? Because
-   masking has a strong harmonic dependency */
-
 vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy_global *gi=&ci->psy_g_param;
@@ -67,31 +65,6 @@
   }
 }
 
-vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){
-  vorbis_info_psy *ret=_ogg_malloc(sizeof(*ret));
-  memcpy(ret,i,sizeof(*ret));
-  return(ret);
-}
-
-/* Set up decibel threshold 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(float *ref,float *c,int n, float crate){
-  int i,j=0;
-
-  for(i=0;i<MAX_BARK-1;i++){
-    int endpos=rint(fromBARK((float)(i+1))*2*n/crate);
-    float base=ref[i];
-    if(j<endpos){
-      float delta=(ref[i+1]-base)/(endpos-j);
-      for(;j<endpos && j<n;j++){
-	c[j]=base;
-	base+=delta;
-      }
-    }
-  }
-}
-
 static void min_curve(float *c,
                        float *c2){
   int i;  
@@ -109,116 +82,175 @@
     c[i]+=att;
 }
 
-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.f-del);
-}
-
-extern int analysis_noisy;
-static void setup_curve(float **c,
-			int band,
-			float *curveatt_dB){
-  int i,j;
+static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
+				  float center_boost, float center_decay_rate){
+  int i,j,k,m;
   float ath[EHMER_MAX];
-  float tempc[P_LEVELS][EHMER_MAX];
-  float *ATH=ATH_Bark_dB_lspconservative; /* just for limiting here */
+  float workc[P_BANDS][P_LEVELS][EHMER_MAX];
+  float athc[P_LEVELS][EHMER_MAX];
+  float *brute_buffer=alloca(n*sizeof(*brute_buffer));
+
+  float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS);
+
+  memset(workc,0,sizeof(workc));
+
+  for(i=0;i<P_BANDS;i++){
+    /* we add back in the ATH to avoid low level curves falling off to
+       -infinity and unnecessarily cutting off high level curves in the
+       curve limiting (last step). */
+
+    /* A half-band's settings must be valid over the whole band, and
+       it's better to mask too little than too much */  
+    int ath_offset=i*4;
+    for(j=0;j<EHMER_MAX;j++){
+      float min=999.;
+      for(k=0;k<4;k++)
+	if(j+k+ath_offset<MAX_ATH){
+	  if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset];
+	}else{
+	  if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1];
+	}
+      ath[j]=min;
+    }
+
+    /* copy curves into working space, replicate the 50dB curve to 30
+       and 40, replicate the 100dB curve to 110 */
+    for(j=0;j<6;j++)
+      memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j]));
+    memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
+    memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
+    
+    /* apply centered curve boost/decay */
+    for(j=0;j<P_LEVELS;j++){
+      for(k=0;k<EHMER_MAX;k++){
+	float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate;
+	if(adj<0. && center_boost>0)adj=0.;
+	if(adj>0. && center_boost<0)adj=0.;
+	workc[i][j][k]+=adj;
+      }
+    }
+
+    /* normalize curves so the driving amplitude is 0dB */
+    /* make temp curves with the ATH overlayed */
+    for(j=0;j<P_LEVELS;j++){
+      attenuate_curve(workc[i][j],curveatt_dB[i]+100.-(j<2?2:j)*10.-P_LEVEL_0);
+      memcpy(athc[j],ath,EHMER_MAX*sizeof(**athc));
+      attenuate_curve(athc[j],+100.-j*10.f-P_LEVEL_0);
+      max_curve(athc[j],workc[i][j]);
+    }
 
-  memcpy(c[0]+2,c[4]+2,sizeof(*c[0])*EHMER_MAX);
-  memcpy(c[2]+2,c[4]+2,sizeof(*c[2])*EHMER_MAX);
+    /* Now limit the louder curves.
+       
+       the idea is this: We don't know what the playback attenuation
+       will be; 0dB SL moves every time the user twiddles the volume
+       knob. So that means we have to use a single 'most pessimal' curve
+       for all masking amplitudes, right?  Wrong.  The *loudest* sound
+       can be in (we assume) a range of ...+100dB] SL.  However, sounds
+       20dB down will be in a range ...+80], 40dB down is from ...+60],
+       etc... */
+    
+    for(j=1;j<P_LEVELS;j++){
+      min_curve(athc[j],athc[j-1]);
+      min_curve(workc[i][j],athc[j]);
+    }
+  }
 
-  /* we add back in the ATH to avoid low level curves falling off to
-     -infinity and unnecessarily cutting off high level curves in the
-     curve limiting (last step).  But again, remember... a half-band's
-     settings must be valid over the whole band, and it's better to
-     mask too little than too much, so be pessimistical. */
-
-  for(i=0;i<EHMER_MAX;i++){
-    float oc_min=band*.5+(i-EHMER_OFFSET)*.125;
-    float oc_max=band*.5+(i-EHMER_OFFSET+1)*.125;
-    float bark=toBARK(fromOC(oc_min));
-    int ibark=floor(bark);
-    float del=bark-ibark;
-    float ath_min,ath_max;
-
-    if(ibark<26)
-      ath_min=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del;
-    else
-      ath_min=ATH[25];
-
-    bark=toBARK(fromOC(oc_max));
-    ibark=floor(bark);
-    del=bark-ibark;
-
-    if(ibark<26)
-      ath_max=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del;
-    else
-      ath_max=ATH[25];
-
-    ath[i]=min(ath_min,ath_max);
-  }
-
-  /* The c array comes in as dB curves at 20 40 60 80 100 dB.
-     interpolate intermediate dB curves */
-  for(i=1;i<P_LEVELS;i+=2){
-    interp_curve(c[i]+2,c[i-1]+2,c[i+1]+2,.5);
-  }
-
-  /* normalize curves so the driving amplitude is 0dB */
-  /* make temp curves with the ATH overlayed */
-  for(i=0;i<P_LEVELS;i++){
-    attenuate_curve(c[i]+2,curveatt_dB[i]);
-    memcpy(tempc[i],ath,EHMER_MAX*sizeof(*tempc[i]));
-    attenuate_curve(tempc[i],-i*10.f);
-    max_curve(tempc[i],c[i]+2);
-  }
-
-  /* Now limit the louder curves.
-
-     the idea is this: We don't know what the playback attenuation
-     will be; 0dB SL moves every time the user twiddles the volume
-     knob. So that means we have to use a single 'most pessimal' curve
-     for all masking amplitudes, right?  Wrong.  The *loudest* sound
-     can be in (we assume) a range of ...+100dB] SL.  However, sounds
-     20dB down will be in a range ...+80], 40dB down is from ...+60],
-     etc... */
-
-  for(j=1;j<P_LEVELS;j++){
-    min_curve(tempc[j],tempc[j-1]);
-    min_curve(c[j]+2,tempc[j]);
-  }
-
-  /* add fenceposts */
-  for(j=0;j<P_LEVELS;j++){
-
-    for(i=0;i<EHMER_OFFSET;i++)
-      if(c[j][i+2]>-200.f)break;  
-    c[j][0]=i;
-
-    for(i=EHMER_MAX-1;i>EHMER_OFFSET+1;i--)
-      if(c[j][i+2]>-200.f)
-	break;
-    c[j][1]=i;
+  for(i=0;i<P_BANDS;i++){
+    int hi_curve,lo_curve,bin;
+    ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS);
+
+    /* low frequency curves are measured with greater resolution than
+       the MDCT/FFT will actually give us; we want the curve applied
+       to the tone data to be pessimistic and thus apply the minimum
+       masking possible for a given bin.  That means that a single bin
+       could span more than one octave and that the curve will be a
+       composite of multiple octaves.  It also may mean that a single
+       bin may span > an eighth of an octave and that the eighth
+       octave values may also be composited. */
+    
+    /* which octave curves will we be compositing? */
+    bin=floor(fromOC(i*.5)/binHz);
+    lo_curve=  ceil(toOC(bin*binHz+1)*2);
+    hi_curve=  floor(toOC((bin+1)*binHz)*2);
+    if(lo_curve>i)lo_curve=i;
+    if(lo_curve<0)lo_curve=0;
+    if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1;
 
+    for(m=0;m<P_LEVELS;m++){
+      ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2));
+      
+      for(j=0;j<n;j++)brute_buffer[j]=999.;
+      
+      /* render the curve into bins, then pull values back into curve.
+	 The point is that any inherent subsampling aliasing results in
+	 a safe minimum */
+      for(k=lo_curve;k<=hi_curve;k++){
+	int l=0;
+
+	for(j=0;j<EHMER_MAX;j++){
+	  int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
+	  int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
+	  
+	  if(lo_bin<0)lo_bin=0;
+	  if(lo_bin>n)lo_bin=n;
+	  if(lo_bin<l)l=lo_bin;
+	  if(hi_bin<0)hi_bin=0;
+	  if(hi_bin>n)hi_bin=n;
+
+	  for(;l<hi_bin && l<n;l++)
+	    if(brute_buffer[l]>workc[k][m][j])
+	      brute_buffer[l]=workc[k][m][j];
+	}
+
+	for(;l<n;l++)
+	  if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
+	    brute_buffer[l]=workc[k][m][EHMER_MAX-1];
+
+      }
+
+      for(j=0;j<EHMER_MAX;j++){
+	int bin=fromOC(j*.125+i*.5-2.)/binHz;
+	if(bin<0){
+	  ret[i][m][j+2]=-999.;
+	}else{
+	  if(bin>=n){
+	    ret[i][m][j+2]=-999.;
+	  }else{
+	    ret[i][m][j+2]=brute_buffer[bin];
+	  }
+	}
+      }
+
+      /* add fenceposts */
+      for(j=0;j<EHMER_OFFSET;j++)
+	if(ret[i][m][j+2]>-200.f)break;  
+      ret[i][m][0]=j;
+      
+      for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--)
+	if(ret[i][m][j+2]>-200.f)
+	  break;
+      ret[i][m][1]=j;
+
+    }
   }
+
+  return(ret);
 }
 
 void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
                   vorbis_info_psy_global *gi,int n,long rate){
-  long i,j,k,lo=-99,hi=0;
+  long i,j,lo=-99,hi=0;
   long maxoc;
   memset(p,0,sizeof(*p));
 
-
   p->eighth_octave_lines=gi->eighth_octave_lines;
   p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1;
 
   p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines;
   maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
   p->total_octave_lines=maxoc-p->firstoc+1;
+  p->ath=_ogg_malloc(n*sizeof(*p->ath));
 
-  if(vi->ath)
-    p->ath=_ogg_malloc(n*sizeof(*p->ath));
   p->octave=_ogg_malloc(n*sizeof(*p->octave));
   p->bark=_ogg_malloc(n*sizeof(*p->bark));
   p->vi=vi;
@@ -226,8 +258,19 @@
   p->rate=rate;
 
   /* set up the lookups for a given blocksize and sample rate */
-  if(vi->ath)
-    set_curve(vi->ath, p->ath,n,(float)rate);
+
+  for(i=0,j=0;i<MAX_ATH-1;i++){
+    int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate);
+    float base=ATH[i];
+    if(j<endpos){
+      float delta=(ATH[i+1]-base)/(endpos-j);
+      for(;j<endpos && j<n;j++){
+        p->ath[j]=base+100.;
+        base+=delta;
+      }
+    }
+  }
+
   for(i=0;i<n;i++){
     float bark=toBARK(rate/(2*n)*i); 
 
@@ -244,249 +287,14 @@
   for(i=0;i<n;i++)
     p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
-  p->tonecurves=_ogg_malloc(P_BANDS*sizeof(*p->tonecurves));
-  p->noisethresh=_ogg_malloc(n*sizeof(*p->noisethresh));
-  p->noiseoffset=_ogg_malloc(n*sizeof(*p->noiseoffset));
-  for(i=0;i<P_BANDS;i++)
-    p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(*p->tonecurves[i]));
-  
-  for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++)
-      p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(*p->tonecurves[i][j]));
-  
-
-  /* OK, yeah, this was a silly way to do it */
-  memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[0][4])*EHMER_MAX);
-  memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[0][6])*EHMER_MAX);
-  memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[0][8])*EHMER_MAX);
-  memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[0][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[2][4])*EHMER_MAX);
-  memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[2][6])*EHMER_MAX);
-  memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[2][8])*EHMER_MAX);
-  memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[2][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(*p->tonecurves[4][4])*EHMER_MAX);
-  memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(*p->tonecurves[4][6])*EHMER_MAX);
-  memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(*p->tonecurves[4][8])*EHMER_MAX);
-  memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(*p->tonecurves[4][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(*p->tonecurves[6][4])*EHMER_MAX);
-  memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(*p->tonecurves[6][6])*EHMER_MAX);
-  memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(*p->tonecurves[6][8])*EHMER_MAX);
-  memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(*p->tonecurves[6][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(*p->tonecurves[8][4])*EHMER_MAX);
-  memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(*p->tonecurves[8][6])*EHMER_MAX);
-  memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(*p->tonecurves[8][8])*EHMER_MAX);
-  memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(*p->tonecurves[8][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(*p->tonecurves[10][4])*EHMER_MAX);
-  memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(*p->tonecurves[10][6])*EHMER_MAX);
-  memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(*p->tonecurves[10][8])*EHMER_MAX);
-  memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(*p->tonecurves[10][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(*p->tonecurves[12][4])*EHMER_MAX);
-  memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(*p->tonecurves[12][6])*EHMER_MAX);
-  memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(*p->tonecurves[12][8])*EHMER_MAX);
-  memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(*p->tonecurves[12][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[14][4])*EHMER_MAX);
-  memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[14][6])*EHMER_MAX);
-  memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[14][8])*EHMER_MAX);
-  memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[14][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[16][4]+2,tone_16000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX);
-  memcpy(p->tonecurves[16][6]+2,tone_16000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX);
-  memcpy(p->tonecurves[16][8]+2,tone_16000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX);
-  memcpy(p->tonecurves[16][10]+2,tone_16000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX);
-
-  for(i=0;i<P_BANDS;i+=2)
-    for(j=4;j<P_LEVELS;j+=2)
-      for(k=2;k<EHMER_MAX+2;k++)
-	p->tonecurves[i][j][k]+=vi->tone_masteratt;
-
-  /* interpolate curves between */
-  for(i=1;i<P_BANDS;i+=2)
-    for(j=4;j<P_LEVELS;j+=2){
-      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(*p->tonecurves[i][j]));
-      /*interp_curve(p->tonecurves[i][j],
-		   p->tonecurves[i-1][j],
-		   p->tonecurves[i+1][j],.5);*/
-      min_curve(p->tonecurves[i][j]+2,p->tonecurves[i+1][j]+2);
-    }
-
-  /* set up the final curves */
-  for(i=0;i<P_BANDS;i++)
-    setup_curve(p->tonecurves[i],i,vi->toneatt.block[i]);
-
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-     _analysis_output("curve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("curve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
-
-  if(vi->curvelimitp){
-    /* value limit the tonal masking curves; the peakatt not only
-       optionally specifies maximum dynamic depth, but also
-       limits the masking curves to a minimum depth  */
-    for(i=0;i<P_BANDS;i++)
-      for(j=0;j<P_LEVELS;j++){
-	for(k=2;k<EHMER_OFFSET+2+vi->curvelimitp;k++)
-	  if(p->tonecurves[i][j][k]> vi->peakatt.block[i][j])
-	    p->tonecurves[i][j][k]=  vi->peakatt.block[i][j];
-	  else
-	    break;
-      }
-  }
-
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("licurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
-
-  if(vi->peakattp) /* we limit maximum depth only optionally */
-    for(i=0;i<P_BANDS;i++)
-      for(j=0;j<P_LEVELS;j++)
-	if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->peakatt.block[i][j])
-	  p->tonecurves[i][j][EHMER_OFFSET+2]=  vi->peakatt.block[i][j];
-
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("pcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
-
-  /* but guarding is mandatory */
-  for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++)
-      if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->tone_guard)
-	  p->tonecurves[i][j][EHMER_OFFSET+2]=  vi->tone_guard;
-
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
-  for(i=0;i<P_LEVELS;i++)
-    _analysis_output("fcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
-
+  p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n,
+				  vi->tone_centerboost,vi->tone_decay);
+  
   /* set up rolling noise median */
+  p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
+  for(i=0;i<P_NOISECURVES;i++)
+    p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
+  
   for(i=0;i<n;i++){
     float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
     int inthalfoc;
@@ -496,16 +304,21 @@
     if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
     inthalfoc=(int)halfoc;
     del=halfoc-inthalfoc;
-    p->noiseoffset[i]=
-      p->vi->noiseoff[inthalfoc]*(1.-del) + 
-      p->vi->noiseoff[inthalfoc+1]*del;
+    
+    for(j=0;j<P_NOISECURVES;j++)
+      p->noiseoffset[j][i]=
+	p->vi->noiseoff[j][inthalfoc]*(1.-del) + 
+	p->vi->noiseoff[j][inthalfoc+1]*del;
+    
   }
-
-  analysis_noisy=1;
-  _analysis_output("noiseoff",0,p->noiseoffset,n,1,0);
-  _analysis_output("noisethresh",0,p->noisethresh,n,1,0);
-  analysis_noisy=1;
-
+#if 0
+  {
+    static int ls=0;
+    _analysis_output_always("noiseoff0",ls,p->noiseoffset[0],n,1,0,0);
+    _analysis_output_always("noiseoff1",ls,p->noiseoffset[1],n,1,0,0);
+    _analysis_output_always("noiseoff2",ls++,p->noiseoffset[2],n,1,0,0);
+  }
+#endif
 }
 
 void _vp_psy_clear(vorbis_look_psy *p){
@@ -524,7 +337,6 @@
       _ogg_free(p->tonecurves);
     }
     _ogg_free(p->noiseoffset);
-    _ogg_free(p->noisethresh);
     memset(p,0,sizeof(*p));
   }
 }
@@ -539,13 +351,13 @@
   int seedptr;
   const float *posts,*curve;
 
-  int choice=(int)((amp+dBoffset)*.1f);
+  int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f);
   choice=max(choice,0);
   choice=min(choice,P_LEVELS-1);
   posts=curves[choice];
   curve=posts+2;
   post1=(int)posts[1];
-  seedptr=oc+(posts[0]-16)*linesper-(linesper>>1);
+  seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1);
 
   for(i=posts[0];i<post1;i++){
     if(seedptr>0){
@@ -581,6 +393,7 @@
       oc=oc>>p->shiftoc;
       if(oc>=P_BANDS)oc=P_BANDS-1;
       if(oc<0)oc=0;
+
       seed_curve(seed,
                  curves[oc],
                  max,
@@ -685,191 +498,293 @@
 }
 
 static void bark_noise_hybridmp(int n,const long *b,
-				const float *f,
-				float *noise,
-				const float offset,
-				const int fixed){
-  long i,hi=b[0]>>16,lo=b[0]>>16,hif=0,lof=0;
-  double xa=0,xb=0;
-  double ya=0,yb=0;
-  double x2a=0,x2b=0;
-  double xya=0,xyb=0; 
-  double na=0,nb=0;
-
-  for(i=0;i<n;i++){
-    if(hi<n){
-      /* find new lo/hi */
-      int bi=b[i]&0xffffL;
-      for(;hi<bi;hi++){
-	int ii=(hi<0?-hi:hi);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	na  += nn;
-	xa  += hi*nn;
-	ya  += bin*nn;
-	x2a += hi*hi*nn;
-	xya += hi*bin*nn;
-      }
-      bi=b[i]>>16;
-      for(;lo<bi;lo++){
-	int ii=(lo<0?-lo:lo);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	na  -= nn;
-	xa  -= lo*nn;
-	ya  -= bin*nn;
-	x2a -= lo*lo*nn;
-	xya -= lo*bin*nn;
-      }
-    }
-
-    if(hif<n && fixed>0){
-      int bi=i+fixed/2;
-      if(bi>n)bi=n;
-
-      for(;hif<bi;hif++){
-	int ii=(hif<0?-hif:hif);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	nb  += nn;
-	xb  += hif*nn;
-	yb  += bin*nn;
-	x2b += hif*hif*nn;
-	xyb += hif*bin*nn;
-      }
-      bi=i-(fixed+1)/2;
-      for(;lof<bi;lof++){
-	int ii=(lof<0?-lof:lof);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	nb  -= nn;
-	xb  -= lof*nn;
-	yb  -= bin*nn;
-	x2b -= lof*lof*nn;
-	xyb -= lof*bin*nn;
-      }
-    }
-
-    {    
-      double va=0.f;
-      
-      if(na>2){
-        double denom=1./(na*x2a-xa*xa);
-        double a=(ya*x2a-xya*xa)*denom;
-        double b=(na*xya-xa*ya)*denom;
-        va=a+b*i;
-      }
-      if(va<0.)va=0.;
-
-      if(fixed>0){
-        double vb=0.f;
+                                const float *f,
+                                float *noise,
+                                const float offset,
+                                const int fixed){
+  
+  float *N=alloca((n+1)*sizeof(*N));
+  float *X=alloca((n+1)*sizeof(*N));
+  float *XX=alloca((n+1)*sizeof(*N));
+  float *Y=alloca((n+1)*sizeof(*N));
+  float *XY=alloca((n+1)*sizeof(*N));
 
-        if(nb>2){
-          double denomf=1./(nb*x2b-xb*xb);
-          double af=(yb*x2b-xyb*xb)*denomf;
-          double bf=(nb*xyb-xb*yb)*denomf;
-          vb=af+bf*i;
-        }
-        if(vb<0.)vb=0.;
-        if(va>vb && vb>0.)va=vb;
+  float tN, tX, tXX, tY, tXY;
+  float fi;
+  int i;
 
-      }
+  int lo, hi;
+  float R, A, B, D;
+  
+  tN = tX = tXX = tY = tXY = 0.f;
+  for (i = 0, fi = 0.f; i < n; i++, fi += 1.f) {
+    float w, x, y;
+    
+    x = fi;
+    y = f[i] + offset;
+    if (y < 1.f) y = 1.f;
+    w = y * y;
+    N[i] = tN;
+    X[i] = tX;
+    XX[i] = tXX;
+    Y[i] = tY;
+    XY[i] = tXY;
+    tN += w;
+    tX += w * x;
+    tXX += w * x * x;
+    tY += w * y;
+    tXY += w * x * y;
+  }
+  N[i] = tN;
+  X[i] = tX;
+  XX[i] = tXX;
+  Y[i] = tY;
+  XY[i] = tXY;
+  
+  for (i = 0, fi = 0.f;; i++, fi += 1.f) {
+    
+    lo = b[i] >> 16;
+    if( lo>=0 ) break;
+    hi = b[i] & 0xffff;
+    
+    tN = N[hi] + N[-lo];
+    tX = X[hi] - X[-lo];
+    tXX = XX[hi] + XX[-lo];
+    tY = Y[hi] + Y[-lo];    
+    tXY = XY[hi] - XY[-lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    if (R < 0.f)
+      R = 0.f;
+    
+    noise[i] = R - offset;
+  }
+  
+  for ( ; hi < n; i++, fi += 1.f) {
+    
+    lo = b[i] >> 16;
+    hi = b[i] & 0xffff;
+    
+    tN = N[hi] - N[lo];
+    tX = X[hi] - X[lo];
+    tXX = XX[hi] - XX[lo];
+    tY = Y[hi] - Y[lo];
+    tXY = XY[hi] - XY[lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    if (R < 0.f) R = 0.f;
+    
+    noise[i] = R - offset;
+  }
+  for ( ; i < n; i++, fi += 1.f) {
+    
+    R = (A + fi * B) / D;
+    if (R < 0.f) R = 0.f;
+    
+    noise[i] = R - offset;
+  }
+  
+  if (fixed <= 0) return;
+  
+  for (i = 0, fi = 0.f; i < (fixed + 1) / 2; i++, fi += 1.f) {
+    hi = i + fixed / 2;
+    lo = hi - fixed;
+    
+    tN = N[hi] + N[-lo];
+    tX = X[hi] - X[-lo];
+    tXX = XX[hi] + XX[-lo];
+    tY = Y[hi] + Y[-lo];
+    tXY = XY[hi] - XY[-lo];
+    
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
 
-      noise[i]=va-offset;
-    }
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
   }
-}
+  for ( ; hi < n; i++, fi += 1.f) {
+    
+    hi = i + fixed / 2;
+    lo = hi - fixed;
+    
+    tN = N[hi] - N[lo];
+    tX = X[hi] - X[lo];
+    tXX = XX[hi] - XX[lo];
+    tY = Y[hi] - Y[lo];
+    tXY = XY[hi] - XY[lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
+  }
+  for ( ; i < n; i++, fi += 1.f) {
+    R = (A + fi * B) / D;
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
+  }
+}
+
+static float FLOOR1_fromdB_INV_LOOKUP[256]={
+  0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, 
+  7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, 
+  5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, 
+  4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F, 
+  3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F, 
+  2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F, 
+  2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F, 
+  1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F, 
+  1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F, 
+  973377.F, 913981.F, 858210.F, 805842.F, 
+  756669.F, 710497.F, 667142.F, 626433.F, 
+  588208.F, 552316.F, 518613.F, 486967.F, 
+  457252.F, 429351.F, 403152.F, 378551.F, 
+  355452.F, 333762.F, 313396.F, 294273.F, 
+  276316.F, 259455.F, 243623.F, 228757.F, 
+  214798.F, 201691.F, 189384.F, 177828.F, 
+  166977.F, 156788.F, 147221.F, 138237.F, 
+  129802.F, 121881.F, 114444.F, 107461.F, 
+  100903.F, 94746.3F, 88964.9F, 83536.2F, 
+  78438.8F, 73652.5F, 69158.2F, 64938.1F, 
+  60975.6F, 57254.9F, 53761.2F, 50480.6F, 
+  47400.3F, 44507.9F, 41792.0F, 39241.9F, 
+  36847.3F, 34598.9F, 32487.7F, 30505.3F, 
+  28643.8F, 26896.0F, 25254.8F, 23713.7F, 
+  22266.7F, 20908.0F, 19632.2F, 18434.2F, 
+  17309.4F, 16253.1F, 15261.4F, 14330.1F, 
+  13455.7F, 12634.6F, 11863.7F, 11139.7F, 
+  10460.0F, 9821.72F, 9222.39F, 8659.64F, 
+  8131.23F, 7635.06F, 7169.17F, 6731.70F, 
+  6320.93F, 5935.23F, 5573.06F, 5232.99F, 
+  4913.67F, 4613.84F, 4332.30F, 4067.94F, 
+  3819.72F, 3586.64F, 3367.78F, 3162.28F, 
+  2969.31F, 2788.13F, 2617.99F, 2458.24F, 
+  2308.24F, 2167.39F, 2035.14F, 1910.95F, 
+  1794.35F, 1684.85F, 1582.04F, 1485.51F, 
+  1394.86F, 1309.75F, 1229.83F, 1154.78F, 
+  1084.32F, 1018.15F, 956.024F, 897.687F, 
+  842.910F, 791.475F, 743.179F, 697.830F, 
+  655.249F, 615.265F, 577.722F, 542.469F, 
+  509.367F, 478.286F, 449.101F, 421.696F, 
+  395.964F, 371.803F, 349.115F, 327.812F, 
+  307.809F, 289.026F, 271.390F, 254.830F, 
+  239.280F, 224.679F, 210.969F, 198.096F, 
+  186.008F, 174.658F, 164.000F, 153.993F, 
+  144.596F, 135.773F, 127.488F, 119.708F, 
+  112.404F, 105.545F, 99.1046F, 93.0572F, 
+  87.3788F, 82.0469F, 77.0404F, 72.3394F, 
+  67.9252F, 63.7804F, 59.8885F, 56.2341F, 
+  52.8027F, 49.5807F, 46.5553F, 43.7144F, 
+  41.0470F, 38.5423F, 36.1904F, 33.9821F, 
+  31.9085F, 29.9614F, 28.1332F, 26.4165F, 
+  24.8045F, 23.2910F, 21.8697F, 20.5352F, 
+  19.2822F, 18.1056F, 17.0008F, 15.9634F, 
+  14.9893F, 14.0746F, 13.2158F, 12.4094F, 
+  11.6522F, 10.9411F, 10.2735F, 9.64662F, 
+  9.05798F, 8.50526F, 7.98626F, 7.49894F, 
+  7.04135F, 6.61169F, 6.20824F, 5.82941F, 
+  5.47370F, 5.13970F, 4.82607F, 4.53158F, 
+  4.25507F, 3.99542F, 3.75162F, 3.52269F, 
+  3.30774F, 3.10590F, 2.91638F, 2.73842F, 
+  2.57132F, 2.41442F, 2.26709F, 2.12875F, 
+  1.99885F, 1.87688F, 1.76236F, 1.65482F, 
+  1.55384F, 1.45902F, 1.36999F, 1.28640F, 
+  1.20790F, 1.13419F, 1.06499F, 1.F
+};
 
-   
 void _vp_remove_floor(vorbis_look_psy *p,
                       float *mdct,
-		      float *codedflr,
-		      float *residue){ 
-  int i,n=p->n;
-  
-  for(i=0;i<n;i++)
-    if(mdct[i]!=0.f)
-      residue[i]=mdct[i]/codedflr[i];
-    else
-      residue[i]=0.f;
-}
-  
+		      int *codedflr,
+		      float *residue,
+		      int sliding_lowpass){ 
 
-void _vp_compute_mask(vorbis_look_psy *p,
-		      float *logfft, 
-		      float *logmdct, 
-		      float *logmask, 
-		      float global_specmax,
-		      float local_specmax,
-		      float bitrate_noise_offset){
   int i,n=p->n;
-  static int seq=0;
-
-  float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
-  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
+ 
+  if(sliding_lowpass>n)sliding_lowpass=n;
+  
+  for(i=0;i<sliding_lowpass;i++){
+    residue[i]=
+      mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
+  }
 
-  /* noise masking */
-  if(p->vi->noisemaskp){
-    float *work=alloca(n*sizeof(*work));
+  for(;i<n;i++)
+    residue[i]=0.;
+}
 
-    bark_noise_hybridmp(n,p->bark,logmdct,logmask,
-			140.,-1);
+void _vp_noisemask(vorbis_look_psy *p,
+		   float *logmdct, 
+		   float *logmask){
 
-    for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
+  int i,n=p->n;
+  float *work=alloca(n*sizeof(*work));
+  
+  bark_noise_hybridmp(n,p->bark,logmdct,logmask,
+		      140.,-1);
 
-    bark_noise_hybridmp(n,p->bark,work,logmask,0.,
-			p->vi->noisewindowfixed);
+  for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
 
-    for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
+  bark_noise_hybridmp(n,p->bark,work,logmask,0.,
+		      p->vi->noisewindowfixed);
 
-    /* work[i] holds the median line (.5), logmask holds the upper
-       envelope line (1.) */
-    _analysis_output("noisemedian",seq,work,n,1,0);
+  for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
 
-    for(i=0;i<n;i++)logmask[i]+=work[i];
-    _analysis_output("noiseenvelope",seq,logmask,n,1,0);
-    for(i=0;i<n;i++)logmask[i]-=work[i];
+  /* work[i] holds the median line (.5), logmask holds the upper
+     envelope line (1.) */
+  
+  for(i=0;i<n;i++){
+    int dB=logmask[i]+.5;
+    if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
+    logmask[i]= work[i]+p->vi->noisecompand[dB];
+  }
+}
 
-    for(i=0;i<n;i++){
-      int dB=logmask[i]+.5;
-      if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
-      logmask[i]= work[i]+p->vi->noisecompand[dB]+p->noiseoffset[i]+bitrate_noise_offset;
-      if(logmask[i]>p->vi->noisemaxsupp)logmask[i]=p->vi->noisemaxsupp;
-    }
-    _analysis_output("noise",seq,logmask,n,1,0);
+void _vp_tonemask(vorbis_look_psy *p,
+		  float *logfft,
+		  float *logmask,
+		  float global_specmax,
+		  float local_specmax){
 
-  }else{
-    for(i=0;i<n;i++)logmask[i]=NEGINF;
-  }
+  int i,n=p->n;
 
+  float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
+  float att=local_specmax+p->vi->ath_adjatt;
+  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
+  
   /* set the ATH (floating below localmax, not global max by a
      specified att) */
-  if(p->vi->ath){
-    float att=local_specmax+p->vi->ath_adjatt;
-    if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
-
-    for(i=0;i<n;i++){
-      float av=p->ath[i]+att;
-      if(av>logmask[i])logmask[i]=av;
-    }
-  }
+  if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
+  
+  for(i=0;i<n;i++)
+    logmask[i]=p->ath[i]+att;
 
   /* tone masking */
   seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax);
   max_seeds(p,seed,logmask);
 
-  /* doing this here is clean, but we need to find a faster way to do
-     it than to just tack it on */
-
-  for(i=0;i<n;i++)if(logmdct[i]>=logmask[i])break;
-  if(i==n)
-    for(i=0;i<n;i++)logmask[i]=NEGINF;
-  else
-    for(i=0;i<n;i++)
-      logfft[i]=max(logmdct[i],logfft[i]);
-
-  seq++;
+}
 
+void _vp_offset_and_mix(vorbis_look_psy *p,
+			float *noise,
+			float *tone,
+			int offset_select,
+			float *logmask){
+  int i,n=p->n;
+  float toneatt=p->vi->tone_masteratt[offset_select];
+  
+  for(i=0;i<n;i++){
+    float val= noise[i]+p->noiseoffset[offset_select][i];
+    if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
+    logmask[i]=max(val,tone[i]+toneatt);
+  }
 }
 
 float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
@@ -886,122 +801,251 @@
 }
 
 static void couple_lossless(float A, float B, 
-			    float granule,float igranule,
-			    float *mag, float *ang,
-			    int flip_p){
-
-  if(fabs(A)>fabs(B)){
-    A=rint(A*igranule)*granule; /* must be done *after* the comparison */
-    B=rint(B*igranule)*granule;
+			    float *qA, float *qB){
+  int test1=fabs(*qA)>fabs(*qB);
+  test1-= fabs(*qA)<fabs(*qB);
   
-    *mag=A; *ang=(A>0.f?A-B:B-A);
+  if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
+  if(test1==1){
+    *qB=(*qA>0.f?*qA-*qB:*qB-*qA);
   }else{
-    A=rint(A*igranule)*granule;
-    B=rint(B*igranule)*granule;
-  
-    *mag=B; *ang=(B>0.f?A-B:B-A);
+    float temp=*qB;  
+    *qB=(*qB>0.f?*qA-*qB:*qB-*qA);
+    *qA=temp;
+  }
+
+  if(*qB>fabs(*qA)*1.9999f){
+    *qB= -fabs(*qA)*2.f;
+    *qA= -*qA;
   }
+}
+
+static float hypot_lookup[32]={
+  -0.009935, -0.011245, -0.012726, -0.014397, 
+  -0.016282, -0.018407, -0.020800, -0.023494, 
+  -0.026522, -0.029923, -0.033737, -0.038010, 
+  -0.042787, -0.048121, -0.054064, -0.060671, 
+  -0.068000, -0.076109, -0.085054, -0.094892, 
+  -0.105675, -0.117451, -0.130260, -0.144134, 
+  -0.159093, -0.175146, -0.192286, -0.210490, 
+  -0.229718, -0.249913, -0.271001, -0.292893};
+
+static void precomputed_couple_point(float premag,
+				     int floorA,int floorB,
+				     float *mag, float *ang){
+  
+  int test=(floorA>floorB)-1;
+  int offset=31-abs(floorA-floorB);
+  float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
+
+  floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
+
+  *mag=premag*floormag;
 
-  if(flip_p && *ang>fabs(*mag)*1.9999f){
-    *ang= -fabs(*mag)*2.f;
-    *mag= -*mag;
+  *ang=0.f;
+}
+
+/* just like below, this is currently set up to only do
+   single-step-depth coupling.  Otherwise, we'd have to do more
+   copying (which will be inevitable later) */
+
+/* doing the real circular magnitude calculation is audibly superior
+   to (A+B)/sqrt(2) */
+static float cardoid_hypot(float a, float b){
+  if(a>0.){
+    if(b>0.)return sqrt(a*a+b*b);
+    if(a>-b)return sqrt(a*a-b*b);
+    return -sqrt(b*b-a*a);
   }
+  if(b<0.)return -sqrt(a*a+b*b);
+  if(-a>b)return -sqrt(a*a-b*b);
+  return sqrt(b*b-a*a);
 }
 
-static void couple_point(float A, float B, float fA, float fB, 
-			 float granule,float igranule,
-			 float fmag, float *mag, float *ang){
+float **_vp_quantize_couple_memo(vorbis_block *vb,
+				 vorbis_look_psy *p,
+				 vorbis_info_mapping0 *vi,
+				 float **mdct){
+  
+  int i,j,n=p->n;
+  float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+  
+  for(i=0;i<vi->coupling_steps;i++){
+    float *mdctM=mdct[vi->coupling_mag[i]];
+    float *mdctA=mdct[vi->coupling_ang[i]];
+    ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+    for(j=0;j<n;j++)
+      ret[i][j]=cardoid_hypot(mdctM[j],mdctA[j]);
+  }
 
-  float origmag=FAST_HYPOT(A*fA,B*fB),corr;
+  return(ret);
+}
 
-  if(fmag!=0.f){
+/* this is for per-channel noise normalization */
+static int apsort(const void *a, const void *b){
+  if(fabs(**(float **)a)>fabs(**(float **)b))return -1;
+  return 1;
+}
+
+int **_vp_quantize_couple_sort(vorbis_block *vb,
+				 vorbis_look_psy *p,
+				 vorbis_info_mapping0 *vi,
+				 float **mags){
+
+
+  if(p->vi->normal_point_p){
+    int i,j,k,n=p->n;
+    int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+    int partition=p->vi->normal_partition;
+    float **work=alloca(sizeof(*work)*partition);
     
-    if(fabs(A)>fabs(B)){
-      *mag=A;
-    }else{
-      *mag=B;
+    for(i=0;i<vi->coupling_steps;i++){
+      ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+      
+      for(j=0;j<n;j+=partition){
+	for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
+	qsort(work,partition,sizeof(*work),apsort);
+	for(k=0;k<partition;k++)ret[i][k+j]=work[k]-mags[i];
+      }
     }
-    
-    corr=origmag/FAST_HYPOT(fA,fB);
-    *mag=unitnorm(*mag)*floor(corr*igranule+.5f)*granule; 
-    *ang=0.f;
+    return(ret);
+  }
+  return(NULL);
+}
 
-  }else{
-    *mag=0.f;
-    *ang=0.f;
-  }    
+void _vp_noise_normalize_sort(vorbis_look_psy *p,
+			      float *magnitudes,int *sortedindex){
+  int i,j,n=p->n;
+  vorbis_info_psy *vi=p->vi;
+  int partition=vi->normal_partition;
+  float **work=alloca(sizeof(*work)*partition);
+  int start=vi->normal_start;
+
+  for(j=start;j<n;j+=partition){
+    if(j+partition>n)partition=n-j;
+    for(i=0;i<partition;i++)work[i]=magnitudes+i+j;
+    qsort(work,partition,sizeof(*work),apsort);
+    for(i=0;i<partition;i++){
+      sortedindex[i+j-start]=work[i]-magnitudes;
+    }
+  }
+}
+
+void _vp_noise_normalize(vorbis_look_psy *p,
+			 float *in,float *out,int *sortedindex){
+  int flag=0,i,j=0,n=p->n;
+  vorbis_info_psy *vi=p->vi;
+  int partition=vi->normal_partition;
+  int start=vi->normal_start;
+
+  if(vi->normal_channel_p){
+    for(;j<start;j++)
+      out[j]=rint(in[j]);
+    
+    for(;j+partition<=n;j+=partition){
+      float acc=0.;
+      int k;
+      
+      for(i=j;i<j+partition;i++)
+	acc+=in[i]*in[i];
+      
+      for(i=0;i<partition;i++){
+	k=sortedindex[i+j-start];
+	
+	if(in[k]*in[k]>=.25f){
+	  out[k]=rint(in[k]);
+	  acc-=in[k]*in[k];
+	  flag=1;
+	}else{
+	  if(acc<vi->normal_thresh)break;
+	  out[k]=unitnorm(in[k]);
+	  acc-=1.;
+	}
+      }
+      
+      //if(!flag && i<3)i=0;
+      for(;i<partition;i++){
+	k=sortedindex[i+j-start];
+	out[k]=0.;
+      }
+    }
+  }
+  
+  for(;j<n;j++)
+    out[j]=rint(in[j]);
+  
 }
 
-void _vp_quantize_couple(vorbis_look_psy *p,
-			 vorbis_info_mapping0 *vi,
-			 float **pcm,
-			 float **sofar,
-			 float **quantized,
-			 int   *nonzero,
-			 int   passno){
+void _vp_couple(int blobno,
+		vorbis_info_psy_global *g,
+		vorbis_look_psy *p,
+		vorbis_info_mapping0 *vi,
+		float **res,
+		float **mag_memo,
+		int   **mag_sort,
+		int   **ifloor,
+		int   *nonzero){
 
   int i,j,k,n=p->n;
-  vorbis_info_psy *info=p->vi;
 
   /* perform any requested channel coupling */
+  /* point stereo can only be used in a first stage (in this encoder)
+     because of the dependency on floor lookups */
   for(i=0;i<vi->coupling_steps;i++){
-    float granulem=info->couple_pass[passno].granulem;
-    float igranulem=info->couple_pass[passno].igranulem;
+
+    /* once we're doing multistage coupling in which a channel goes
+       through more than one coupling step, the floor vector
+       magnitudes will also have to be recalculated an propogated
+       along with PCM.  Right now, we're not (that will wait until 5.1
+       most likely), so the code isn't here yet. The memory management
+       here is all assuming single depth couplings anyway. */
 
     /* make sure coupling a zero and a nonzero channel results in two
        nonzero channels. */
     if(nonzero[vi->coupling_mag[i]] ||
        nonzero[vi->coupling_ang[i]]){
-      
-      float *pcmM=pcm[vi->coupling_mag[i]];
-      float *pcmA=pcm[vi->coupling_ang[i]];
-      float *floorM=pcm[vi->coupling_mag[i]]+n;
-      float *floorA=pcm[vi->coupling_ang[i]]+n;
-      float *sofarM=sofar[vi->coupling_mag[i]];
-      float *sofarA=sofar[vi->coupling_ang[i]];
-      float *qM=quantized[vi->coupling_mag[i]];
-      float *qA=quantized[vi->coupling_ang[i]];
+     
+
+      float *rM=res[vi->coupling_mag[i]];
+      float *rA=res[vi->coupling_ang[i]];
+      float *qM=rM+n;
+      float *qA=rA+n;
+      int *floorM=ifloor[vi->coupling_mag[i]];
+      int *floorA=ifloor[vi->coupling_ang[i]];
+      int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
+      float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
+      float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
+      int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
 
       nonzero[vi->coupling_mag[i]]=1; 
       nonzero[vi->coupling_ang[i]]=1; 
 
-      for(j=0,k=0;j<n;k++){
-	vp_couple *part=info->couple_pass[passno].couple_pass+k;
-	float rqlimit=part->outofphase_requant_limit;
-	int flip_p=part->outofphase_redundant_flip_p;
-    
-	for(;j<part->limit && j<p->n;j++){
-	  /* partition by partition; k is our by-location partition
-	     class counter */
-	  float ang,mag,fmag=max(fabs(pcmM[j]),fabs(pcmA[j]));
-
-	  if(fmag<part->amppost_point){
-	    couple_point(pcmM[j],pcmA[j],floorM[j],floorA[j],
-			 granulem,igranulem,fmag,&mag,&ang);
+      for(j=0;j<p->n;j+=partition){
+	float acc=0.f;
 
+	for(k=0;k<partition;k++){
+	  int l=k+j;
+	  if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
+	     (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
+	    precomputed_couple_point(mag_memo[i][l],
+				     floorM[l],floorA[l],
+				     qM+l,qA+l);
+	    if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
           }else{
-	    couple_lossless(pcmM[j],pcmA[j],
-			    granulem,igranulem,&mag,&ang,flip_p);
-	  }
-
-	  /* executive decision time: when requantizing and recoupling
-	     residue in order to progressively encode at finer
-	     resolution, an out of phase component that originally
-	     quntized to 2*mag can flip flop magnitude/angle if it
-	     requantizes to not-quite out of phase.  If that happens,
-	     we opt not to fill in additional resolution (in order to
-	     simplify the iterative codebook design and
-	     efficiency). */
-
-	  qM[j]=mag-sofarM[j];
-	  qA[j]=ang-sofarA[j];
-	 
-	  if(qA[j]<-rqlimit || qA[j]>rqlimit){
-	    qM[j]=0.f;
-	    qA[j]=0.f;
+	    couple_lossless(rM[l],rA[l],qM+l,qA+l);
           }
         }
+	
+	if(p->vi->normal_point_p)
+	  for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
+	    int l=mag_sort[i][j+k];
+	    if(l>=limit && rint(qM[l])==0.f){
+	      qM[l]=unitnorm(qM[l]);
+	      acc-=1.f;
+	    }
+	  } 
       }
     }
   }
 }
+

<p><p>1.29      +82 -72    vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- psy.h	2002/03/29 07:10:39	1.28
+++ psy.h	2002/06/28 22:19:37	1.29
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.28 2002/03/29 07:10:39 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.29 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,47 +27,24 @@
 #endif
 
 /* psychoacoustic setup ********************************************/
-#define MAX_BARK 27
-#define P_BANDS 17
-#define P_LEVELS 11
-
-typedef struct vp_couple{
-  int limit;        /* sample post */
-
-  int outofphase_redundant_flip_p;
-  float outofphase_requant_limit;
-
-  float amppost_point;
-  
-} vp_couple;
-
-typedef struct vp_couple_pass{  
-  float granulem;
-  float igranulem;
-
-  vp_couple couple_pass[8];
-} vp_couple_pass;
-
-typedef struct vp_attenblock{
-  float block[P_BANDS][P_LEVELS];
-} vp_attenblock;
+#define P_BANDS 17      /* 62Hz to 16kHz */
+#define P_LEVELS 8      /* 30dB to 100dB */
+#define P_LEVEL_0 30.    /* 30 dB */
+#define P_NOISECURVES 3
 
 #define NOISE_COMPAND_LEVELS 40
 typedef struct vorbis_info_psy{
-  float  ath[27];
+  int   blockflag;
 
-  float  ath_adjatt;
-  float  ath_maxatt;
+  float ath_adjatt;
+  float ath_maxatt;
 
-  float tone_masteratt;
-  float tone_guard;
+  float tone_masteratt[P_NOISECURVES];
+  float tone_centerboost;
+  float tone_decay;
   float tone_abs_limit;
-  vp_attenblock toneatt;
+  float toneatt[P_BANDS];
 
-  int peakattp;
-  int curvelimitp;
-  vp_attenblock peakatt;
-
   int noisemaskp;
   float noisemaxsupp;
   float noisewindowlo;
@@ -75,36 +52,44 @@
   int   noisewindowlomin;
   int   noisewindowhimin;
   int   noisewindowfixed;
-  float noiseoff[P_BANDS];
+  float noiseoff[P_NOISECURVES][P_BANDS];
   float noisecompand[NOISE_COMPAND_LEVELS];
 
   float max_curve_dB;
-
-  vp_couple_pass couple_pass[8];
 
+  int normal_channel_p;
+  int normal_point_p;
+  int normal_start;
+  int normal_partition;
+  double normal_thresh;
 } vorbis_info_psy;
 
 typedef struct{
-  int       eighth_octave_lines;
+  int   eighth_octave_lines;
 
   /* for block long/short tuning; encode only */
-  float     preecho_thresh[VE_BANDS];
-  float     postecho_thresh[VE_BANDS];
-  float     stretch_penalty;
-  float     preecho_minenergy;
-
-  float     ampmax_att_per_sec;
-
-  /* delay caching... how many samples to keep around prior to our
-     current block to aid in analysis? */
-  int       delaycache;
+  float preecho_thresh[VE_BANDS];
+  float postecho_thresh[VE_BANDS];
+  float stretch_penalty;
+  float preecho_minenergy;
+
+  float ampmax_att_per_sec;
+
+  /* channel coupling config */
+  int   coupling_pkHz[PACKETBLOBS];  
+  int   coupling_pointlimit[2][PACKETBLOBS];  
+  int   coupling_prepointamp[PACKETBLOBS];  
+  int   coupling_postpointamp[PACKETBLOBS];  
+  int   sliding_lowpass[2][PACKETBLOBS];  
+
 } vorbis_info_psy_global;
 
 typedef struct {
-  float   ampmax;
-  int     channels;
+  float ampmax;
+  int   channels;
 
   vorbis_info_psy_global *gi;
+  int   coupling_pointlimit[2][P_NOISECURVES];  
 } vorbis_look_psy_global;
 
 
@@ -113,8 +98,7 @@
   struct vorbis_info_psy *vi;
 
   float ***tonecurves;
-  float *noisethresh;
-  float *noiseoffset;
+  float **noiseoffset;
 
   float *ath;
   long  *octave;             /* in n.ocshift format */
@@ -137,27 +121,53 @@
 
 extern void _vp_remove_floor(vorbis_look_psy *p,
                              float *mdct,
-			     float *codedflr,
-			     float *residue);
+			     int *icodedflr,
+			     float *residue,
+			     int sliding_lowpass);
+
+extern void _vp_noisemask(vorbis_look_psy *p,
+			  float *logmdct, 
+			  float *logmask);
+
+extern void _vp_tonemask(vorbis_look_psy *p,
+			 float *logfft,
+			 float *logmask,
+			 float global_specmax,
+			 float local_specmax);
+
+extern void _vp_offset_and_mix(vorbis_look_psy *p,
+			       float *noise,
+			       float *tone,
+			       int offset_select,
+			       float *logmask);
 
-extern void   _vp_compute_mask(vorbis_look_psy *p,
-			       float *fft, 
-			       float *mdct, 
-			       float *mask, 
-			       float global_specmax,
-			       float local_specmax,
-			       float bitrate_noise_offset);
-
-extern void _vp_quantize_couple(vorbis_look_psy *p,
-			 vorbis_info_mapping0 *vi,
-			 float **pcm,
-			 float **sofar,
-			 float **quantized,
-			 int   *nonzero,
-			 int   passno);
-
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
-#endif
+extern float **_vp_quantize_couple_memo(vorbis_block *vb,
+					vorbis_look_psy *p,
+					vorbis_info_mapping0 *vi,
+					float **mdct);
+
+extern void _vp_couple(int blobno,
+		       vorbis_info_psy_global *g,
+		       vorbis_look_psy *p,
+		       vorbis_info_mapping0 *vi,
+		       float **res,
+		       float **mag_memo,
+		       int   **mag_sort,
+		       int   **ifloor,
+		       int   *nonzero);
+
+extern void _vp_noise_normalize(vorbis_look_psy *p,
+				float *in,float *out,int *sortedindex);
+
+extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
+				     float *magnitudes,int *sortedindex);
+
+extern int **_vp_quantize_couple_sort(vorbis_block *vb,
+				      vorbis_look_psy *p,
+				      vorbis_info_mapping0 *vi,
+				      float **mags);
 
+#endif
 

<p><p>1.14      +1 -15     vorbis/lib/registry.c

Index: registry.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- registry.c	2001/12/20 01:00:29	1.13
+++ registry.c	2002/06/28 22:19:37	1.14
@@ -11,21 +11,17 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.13 2001/12/20 01:00:29 segher Exp $
+ last mod: $Id: registry.c,v 1.14 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
 #include "vorbis/codec.h"
 #include "codec_internal.h"
 #include "registry.h"
-#include "registry-api.h"
 #include "misc.h"
-
-
 /* seems like major overkill now; the backend numbers will grow into
    the infrastructure soon enough */
 
-extern vorbis_func_time      time0_exportbundle;
 extern vorbis_func_floor     floor0_exportbundle;
 extern vorbis_func_floor     floor1_exportbundle;
 extern vorbis_func_residue   residue0_exportbundle;
@@ -33,10 +29,6 @@
 extern vorbis_func_residue   residue2_exportbundle;
 extern vorbis_func_mapping   mapping0_exportbundle;
 
-vorbis_func_time      *_time_P[]={
-  &time0_exportbundle,
-};
-
 vorbis_func_floor     *_floor_P[]={
   &floor0_exportbundle,
   &floor1_exportbundle,
@@ -51,10 +43,4 @@
 vorbis_func_mapping   *_mapping_P[]={
   &mapping0_exportbundle,
 };
-
-/* make Windows happy; can't access the registry directly outside of
-   libvorbis, and vorbisenc needs a few functions */
-void residue_free_info(vorbis_info_residue *r,int type){
-  _residue_P[type]->free_info(r);
-}
 

<p><p>1.12      +4 -11     vorbis/lib/registry.h

Index: registry.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- registry.h	2001/12/20 01:00:29	1.11
+++ registry.h	2002/06/28 22:19:37	1.12
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.11 2001/12/20 01:00:29 segher Exp $
+ last mod: $Id: registry.h,v 1.12 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,15 +25,8 @@
 #define VI_RESB 3
 #define VI_MAPB 1
 
-#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
-# define EXTERN __declspec(dllimport) extern
-#else
-# define EXTERN extern
-#endif
-
-EXTERN vorbis_func_time      *_time_P[];
-EXTERN vorbis_func_floor     *_floor_P[];
-EXTERN vorbis_func_residue   *_residue_P[];
-EXTERN vorbis_func_mapping   *_mapping_P[];
+extern vorbis_func_floor     *_floor_P[];
+extern vorbis_func_residue   *_residue_P[];
+extern vorbis_func_mapping   *_mapping_P[];
 
 #endif

<p><p>1.46      +165 -222  vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- res0.c	2002/01/22 08:06:07	1.45
+++ res0.c	2002/06/28 22:19:37	1.46
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.45 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.46 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -37,7 +37,6 @@
 
 typedef struct {
   vorbis_info_residue0 *info;
-  int         map;
   
   int         parts;
   int         stages;
@@ -52,26 +51,17 @@
   long      phrasebits;
   long      frames;
 
-  int       qoffsets[BITTRACK_DIVISOR+1];
-
 #ifdef TRAIN_RES
+  int        train_seq;
   long      *training_data[8][64];
   float      training_max[8][64];
   float      training_min[8][64];
-  int       longp;
   float     tmin;
   float     tmax;
 #endif
 
 } vorbis_look_residue0;
 
-vorbis_info_residue *res0_copy_info(vorbis_info_residue *vr){
-  vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
-  vorbis_info_residue0 *ret=_ogg_malloc(sizeof(*ret));
-  memcpy(ret,info,sizeof(*ret));
-  return(ret);
-}
-
 void res0_free_info(vorbis_info_residue *i){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
   if(info){
@@ -90,7 +80,7 @@
     {
       int j,k,l;
       for(j=0;j<look->parts;j++){
-	fprintf(stderr,"partition %d: ",j);
+	/*fprintf(stderr,"partition %d: ",j);*/
         for(k=0;k<8;k++)
           if(look->training_data[k][j]){
             char buffer[80];
@@ -106,19 +96,20 @@
             
             fclose(of);
             
-	    fprintf(stderr,"%d(%.2f|%.2f) ",k,look->training_min[k][j],look->training_max[k][j]);
+	    /*fprintf(stderr,"%d(%.2f|%.2f) ",k,
+	      look->training_min[k][j],look->training_max[k][j]);*/
 
             _ogg_free(look->training_data[k][j]);
           }
-	fprintf(stderr,"\n");
+	/*fprintf(stderr,"\n");*/
       }
     }
     fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax);
 
-    fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
+    /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
             (float)look->phrasebits/look->frames,
             (float)look->postbits/look->frames,
-	    (float)(look->postbits+look->phrasebits)/look->frames);
+	    (float)(look->postbits+look->phrasebits)/look->frames);*/
 #endif
 
 
@@ -237,8 +228,8 @@
   return(NULL);
 }
 
-vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
-			  vorbis_info_residue *vr){
+vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
+			       vorbis_info_residue *vr){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
   vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look));
   codec_setup_info     *ci=vd->vi->codec_setup;
@@ -247,7 +238,6 @@
   int dim;
   int maxstage=0;
   look->info=info;
-  look->map=vm->mapping;
 
   look->parts=info->partitions;
   look->fullbooks=ci->fullbooks;
@@ -286,115 +276,74 @@
       look->decodemap[j][k]=deco;
     }
   }
-
+#ifdef TRAIN_RES
   {
-    int samples_per_partition=info->grouping;
-    int n=info->end-info->begin,i;
-    int partvals=n/samples_per_partition;
-
-    for(i=0;i<BITTRACK_DIVISOR;i++)
-      look->qoffsets[i]=partvals*(i+1)/BITTRACK_DIVISOR;
-
-    look->qoffsets[i]=9999999;
+    static int train_seq=0;
+    look->train_seq=train_seq++;
   }
-
+#endif
   return(look);
 }
-
-
-#if 0
-/* does not guard against invalid settings; eg, a subn of 16 and a
-   subgroup request of 32.  Max subn of 128 */
-static int _interleaved_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.f;
-  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]);
+/* break an abstraction and copy some code for performance purposes */
+static int local_book_besterror(codebook *book,float *a){
+  int dim=book->dim,i,k,o;
+  int best=0;
+  encode_aux_threshmatch *tt=book->c->thresh_tree;
+
+  /* find the quant val of each scalar */
+  for(k=0,o=dim;k<dim;++k){
+    float val=a[--o];
+    i=tt->threshvals>>1;
+
+    if(val<tt->quantthresh[i]){      
+      if(val<tt->quantthresh[i-1]){
+	for(--i;i>0;--i)
+	  if(val>=tt->quantthresh[i-1])
+	    break;
+      }
+    }else{
+      
+      for(++i;i<tt->threshvals-1;++i)
+	if(val<tt->quantthresh[i])break;
+      
+    }
+    
+    best=(best*tt->quantvals)+tt->quantmap[i];
+  }
+  /* regular lattices are easy :-) */
   
-  while(1){
-    entropy[j]=localmax;
-    n>>=1;
-    if(!n)break;
-    j++;
-
-    for(i=0;i<n;i++){
-      temp[i]+=temp[i+n];
+  if(book->c->lengthlist[best]<=0){
+    const static_codebook *c=book->c;
+    int i,j;
+    float bestf=0.f;
+    float *e=book->valuelist;
+    best=-1;
+    for(i=0;i<book->entries;i++){
+      if(c->lengthlist[i]>0){
+	float this=0.f;
+	for(j=0;j<dim;j++){
+	  float val=(e[j]-a[j]);
+	  this+=val*val;
+	}
+	if(best==-1 || this<bestf){
+	  bestf=this;
+	  best=i;
+	}
+      }
+      e++;
     }
-    localmax=0.f;
-    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);
-}
-#endif
-
-
-static int _testhack(float *vec,int n,vorbis_look_residue0 *look,
-		     int auxparts,int auxpartnum){
-  vorbis_info_residue0 *info=look->info;
-  int i;
-  float max=0.f;
-  float temp[128];
-  float entropy=0.f;
-
-  /* setup */
-  for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
-
-  for(i=0;i<n;i++)
-    if(temp[i]>max)max=temp[i];
-
-  for(i=0;i<n;i++)temp[i]=rint(temp[i]);
-
-  for(i=0;i<n;i++)
-    entropy+=temp[i];
-
-  for(i=0;i<auxparts-1;i++)
-    if(auxpartnum<info->blimit[i] &&
-       entropy<=info->entmax[i] &&
-       max<=info->ampmax[i])
-      break;
-
-  return(i);
-}
-
-static int _interleaved_encodepart(oggpack_buffer *opb,float *vec, int n,
-				   codebook *book,long *acc){
-  int i,bits=0;
-  int dim=book->dim;
-  int step=n/dim;
-
-  for(i=0;i<step;i++){
-    int entry=vorbis_book_besterror(book,vec+i,step,0);
-
-#ifdef TRAIN_RES
-    acc[entry]++;
-#endif
 
-    bits+=vorbis_book_encode(book,entry,opb);
+  {
+    float *ptr=book->valuelist+best*dim;
+    for(i=0;i<dim;i++)
+      *a++ -= *ptr++;
   }
 
-  return(bits);
+  return(best);
 }
- 
+
 static int _encodepart(oggpack_buffer *opb,float *vec, int n,
                        codebook *book,long *acc){
   int i,bits=0;
@@ -402,7 +351,7 @@
   int step=n/dim;
 
   for(i=0;i<step;i++){
-    int entry=vorbis_book_besterror(book,vec+i*dim,1,0);
+    int entry=local_book_besterror(book,vec+i*dim);
 
 #ifdef TRAIN_RES
     acc[entry]++;
@@ -415,21 +364,21 @@
 }
 
 static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
-		       float **in,int ch,
-		       int (*classify)(float *,int,vorbis_look_residue0 *,
-				       int,int)){
-  long i,j;
+		       float **in,int ch){
+  long i,j,k;
   vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
   vorbis_info_residue0 *info=look->info;
+  vorbis_info           *vi=vb->vd->vi;
+  codec_setup_info      *ci=vi->codec_setup;
 
   /* move all this setup out later */
   int samples_per_partition=info->grouping;
   int possible_partitions=info->partitions;
   int n=info->end-info->begin;
-
+  
   int partvals=n/samples_per_partition;
   long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword));
-
+  float scale=vi->rate/ci->blocksizes[vb->W]*.001;
   /* we find the partition type for each partition of each
      channel.  We'll go back and do the interleaved encoding in a
      bit.  For now, clarity */
@@ -438,25 +387,31 @@
     partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i]));
     memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i]));
   }
-
-  for(i=0;i<partvals;i++){
-    for(j=0;j<ch;j++)
-      /* do the partition decision based on the 'entropy'
-         int the block */
-      partword[j][i]=
-	classify(in[j]+i*samples_per_partition+info->begin,
-		 samples_per_partition,look,possible_partitions,i);
   
+  for(i=0;i<partvals;i++){
+    int offset=i*samples_per_partition+info->begin;
+    float cur=offset*scale;
+    for(j=0;j<ch;j++){
+      float max=0.;
+      for(k=0;k<samples_per_partition;k++)
+	if(fabs(in[j][offset+k])>max)max=fabs(in[j][offset+k]);
+      
+      for(k=0;k<possible_partitions-1;k++)
+	if(max<=info->classmetric1[k] &&
+	   cur<info->classmetric2[k])
+	  break;
+      
+      partword[j][i]=k;  
+    }
   }
 
-#ifdef TRAIN_RES
-  look->longp=vb->W;
+#ifdef TRAIN_RESAUX
   {
     FILE *of;
     char buffer[80];
   
     for(i=0;i<ch;i++){
-      sprintf(buffer,"resaux_%s.vqd",(vb->mode?"long":"short"));
+      sprintf(buffer,"resaux_%d.vqd",look->train_seq);
       of=fopen(buffer,"a");
       for(j=0;j<partvals;j++)
         fprintf(of,"%ld, ",partword[i][j]);
@@ -470,10 +425,11 @@
   return(partword);
 }
 
-static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,
-		       float **in,int ch,
-		       int (*classify)(float *,int,vorbis_look_residue0 *,
-				       int,int)){
+/* designed for stereo or other modes where the partition size is an
+   integer multiple of the number of channels encoded in the current
+   submap */
+static long **_2class(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;
@@ -485,7 +441,6 @@
 
   int partvals=n/samples_per_partition;
   long **partword=_vorbis_block_alloc(vb,sizeof(*partword));
-  float *work=alloca(sizeof(*work)*samples_per_partition);
 
 #ifdef TRAIN_RES
   FILE *of;
@@ -494,26 +449,28 @@
   
   partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
   memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
-
-  for(i=0,j=0,k=0,l=info->begin;i<partvals;i++){
-    for(k=0;k<samples_per_partition;k++){
-      work[k]=in[j][l];
-      j++;
-      if(j>=ch){
-	j=0;
-	l++;
-      }
-    }
 
-    partword[0][i]=
-      classify(work,samples_per_partition,look,possible_partitions,i);
+  for(i=0,l=info->begin/ch;i<partvals;i++){
+    float magmax=0.f;
+    float angmax=0.f;
+    for(j=0;j<samples_per_partition;j+=ch){
+      if(fabs(in[0][l])>magmax)magmax=fabs(in[0][l]);
+      for(k=1;k<ch;k++)
+	if(fabs(in[k][l])>angmax)angmax=fabs(in[k][l]);
+      l++;
+    }
+
+    for(j=0;j<possible_partitions-1;j++)
+      if(magmax<=info->classmetric1[j] &&
+	 angmax<=info->classmetric2[j])
+	break;
 
+    partword[0][i]=j;
 
   }  
-
-#ifdef TRAIN_RES
-  look->longp=vb->W;
-  sprintf(buffer,"resaux_%s.vqd",(vb->mode?"long":"short"));
+  
+#ifdef TRAIN_RESAUX
+  sprintf(buffer,"resaux_%d.vqd",look->train_seq);
   of=fopen(buffer,"a");
   for(i=0;i<partvals;i++)
     fprintf(of,"%ld, ",partword[0][i]);
@@ -528,18 +485,14 @@
 
 static int _01forward(vorbis_block *vb,vorbis_look_residue *vl,
                       float **in,int ch,
-		      int pass,long **partword,
+		      long **partword,
                       int (*encode)(oggpack_buffer *,float *,int,
-				    codebook *,long *),
-		      ogg_uint32_t *stats){
+				    codebook *,long *)){
   long i,j,k,s;
   vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
   vorbis_info_residue0 *info=look->info;
 
   vorbis_dsp_state      *vd=vb->vd;
-  vorbis_info           *vi=vd->vi;
-  codec_setup_info      *ci=vi->codec_setup;
-
 
   /* move all this setup out later */
   int samples_per_partition=info->grouping;
@@ -567,10 +520,7 @@
      residual words for that partition word.  Then write the next
      partition channel words... */
 
-  for(s=(pass==0?0:ci->passlimit[pass-1]);s<ci->passlimit[pass];s++){
-    int bin=0;
-    ogg_uint32_t *qptr=NULL;
-    if(stats)qptr=stats+s*BITTRACK_DIVISOR;
+  for(s=0;s<look->stages;s++){
 
     for(i=0;i<partvals;){
 
@@ -599,9 +549,6 @@
       for(k=0;k<partitions_per_word && i<partvals;k++,i++){
         long offset=i*samples_per_partition+info->begin;
         
-	if(qptr)while(i>=look->qoffsets[bin])
-	  qptr[bin++]=oggpack_bits(&vb->opb);
-
         for(j=0;j<ch;j++){
           if(s==0)resvals[partword[j][i]]+=samples_per_partition;
           if(info->secondstages[partword[j][i]]&(1<<s)){
@@ -633,8 +580,6 @@
           }
         }
       }
-      if(qptr)while(i>=look->qoffsets[bin])
-	qptr[bin++]=oggpack_bits(&vb->opb);
     }
   }
 
@@ -710,6 +655,7 @@
   return(0);
 }
 
+#if 0
 /* residue 0 and 1 are just slight variants of one another. 0 is
    interleaved, 1 is not */
 long **res0_class(vorbis_block *vb,vorbis_look_residue *vl,
@@ -721,40 +667,41 @@
       in[used++]=in[i];
   if(used)
     /*return(_01class(vb,vl,in,used,_interleaved_testhack));*/
-    return(_01class(vb,vl,in,used,_testhack));
+    return(_01class(vb,vl,in,used));
   else
     return(0);
 }
 
 int res0_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass, long **partword,ogg_uint32_t *stats){
+		 long **partword){
   /* we encode only the nonzero parts of a bundle */
   int i,j,used=0,n=vb->pcmend/2;
   for(i=0;i<ch;i++)
     if(nonzero[i]){
-      for(j=0;j<n;j++)
-	out[i][j]+=in[i][j];
+      if(out)
+	for(j=0;j<n;j++)
+	  out[i][j]+=in[i][j];
       in[used++]=in[i];
     }
   if(used){
-    int ret=_01forward(vb,vl,in,used,pass,partword,
-		      _interleaved_encodepart,stats);
-    used=0;
-    for(i=0;i<ch;i++)
-      if(nonzero[i]){
-	for(j=0;j<n;j++)
-	  out[i][j]-=in[used][j];
-	used++;
-      }
+    int ret=_01forward(vb,vl,in,used,partword,
+		      _interleaved_encodepart);
+    if(out){
+      used=0;
+      for(i=0;i<ch;i++)
+	if(nonzero[i]){
+	  for(j=0;j<n;j++)
+	    out[i][j]-=in[used][j];
+	  used++;
+	}
+    }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
+#endif
 
 int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,int *nonzero,int ch){
@@ -770,29 +717,29 @@
 
 int res1_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass, long **partword, ogg_uint32_t *stats){
+		 long **partword){
   int i,j,used=0,n=vb->pcmend/2;
   for(i=0;i<ch;i++)
     if(nonzero[i]){
-      for(j=0;j<n;j++)
-	out[i][j]+=in[i][j];
+      if(out)
+	for(j=0;j<n;j++)
+	  out[i][j]+=in[i][j];
       in[used++]=in[i];
     }
 
   if(used){
-    int ret=_01forward(vb,vl,in,used,pass,partword,_encodepart,stats);
-    used=0;
-    for(i=0;i<ch;i++)
-      if(nonzero[i]){
-	for(j=0;j<n;j++)
-	  out[i][j]-=in[used][j];
-	used++;
-      }
+    int ret=_01forward(vb,vl,in,used,partword,_encodepart);
+    if(out){
+      used=0;
+      for(i=0;i<ch;i++)
+	if(nonzero[i]){
+	  for(j=0;j<n;j++)
+	    out[i][j]-=in[used][j];
+	  used++;
+	}
+    }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
@@ -804,7 +751,7 @@
     if(nonzero[i])
       in[used++]=in[i];
   if(used)
-    return(_01class(vb,vl,in,used,_testhack));
+    return(_01class(vb,vl,in,used));
   else
     return(0);
 }
@@ -825,10 +772,9 @@
                   float **in,int *nonzero,int ch){
   int i,used=0;
   for(i=0;i<ch;i++)
-    if(nonzero[i])
-      in[used++]=in[i];
+    if(nonzero[i])used++;
   if(used)
-    return(_2class(vb,vl,in,used,_testhack));
+    return(_2class(vb,vl,in,ch));
   else
     return(0);
 }
@@ -838,7 +784,7 @@
 
 int res2_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass,long **partword,ogg_uint32_t *stats){
+		 long **partword){
   long i,j,k,n=vb->pcmend/2,used=0;
 
   /* don't duplicate the code; use a working vector hack for now and
@@ -853,20 +799,19 @@
   }
   
   if(used){
-    int ret=_01forward(vb,vl,&work,1,pass,partword,_encodepart,stats);
+    int ret=_01forward(vb,vl,&work,1,partword,_encodepart);
     /* update the sofar vector */
-    for(i=0;i<ch;i++){
-      float *pcm=in[i];
-      float *sofar=out[i];
-      for(j=0,k=i;j<n;j++,k+=ch)
-	sofar[j]+=pcm[j]-work[k];
-
+    if(out){
+      for(i=0;i<ch;i++){
+	float *pcm=in[i];
+	float *sofar=out[i];
+	for(j=0,k=i;j<n;j++,k+=ch)
+	  sofar[j]+=pcm[j]-work[k];
+	
+      }
     }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
@@ -923,14 +868,13 @@
 
 
 vorbis_func_residue residue0_exportbundle={
-  &res0_pack,
+  NULL,
   &res0_unpack,
   &res0_look,
-  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
-  &res0_class,
-  &res0_forward,
+  NULL,
+  NULL,
   &res0_inverse
 };
 
@@ -938,7 +882,6 @@
   &res0_pack,
   &res0_unpack,
   &res0_look,
-  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
   &res1_class,
@@ -950,10 +893,10 @@
   &res0_pack,
   &res0_unpack,
   &res0_look,
-  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
   &res2_class,
   &res2_forward,
   &res2_inverse
 };
+

<p><p>1.25      +2 -1      vorbis/lib/scales.h

Index: scales.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/scales.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- scales.h	2002/03/29 08:18:23	1.24
+++ scales.h	2002/06/28 22:19:37	1.25
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h,v 1.24 2002/03/29 08:18:23 xiphmont Exp $
+ last mod: $Id: scales.h,v 1.25 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,6 +22,7 @@
 #include "os.h"
 
 /* 20log10(x) */
+#define VORBIS_IEEE_FLOAT32 1
 #ifdef VORBIS_IEEE_FLOAT32
 
 static float unitnorm(float x){

<p><p>1.28      +23 -33    vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- sharedbook.c	2002/01/22 08:06:07	1.27
+++ sharedbook.c	2002/06/28 22:19:37	1.28
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.27 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.28 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -441,26 +441,37 @@
 }
 
 int _best(codebook *book, float *a, int step){
-  encode_aux_nearestmatch *nt=book->c->nearest_tree;
   encode_aux_threshmatch *tt=book->c->thresh_tree;
+
+#if 0
+  encode_aux_nearestmatch *nt=book->c->nearest_tree;
   encode_aux_pigeonhole *pt=book->c->pigeon_tree;
+#endif
   int dim=book->dim;
-  int ptr=0,k,o;
+  int k,o;
   /*int savebest=-1;
     float saverr;*/
 
   /* do we have a threshhold encode hint? */
   if(tt){
-    int index=0;
+    int index=0,i;
     /* find the quant val of each scalar */
     for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
-      int i;
-      /* linear search the quant list for now; it's small and although
-	 with > ~8 entries, it would be faster to bisect, this would be
-	 a misplaced optimization for now */
-      for(i=0;i<tt->threshvals-1;i++)
-	if(a[o]<tt->quantthresh[i])break;
 
+      i=tt->threshvals>>1;
+      if(a[o]<tt->quantthresh[i]){
+
+	for(;i>0;i--)
+	  if(a[o]>=tt->quantthresh[i-1])
+	    break;
+	
+      }else{
+
+	for(i++;i<tt->threshvals-1;i++)
+	  if(a[o]<tt->quantthresh[i])break;
+
+      }
+
       index=(index*tt->quantvals)+tt->quantmap[i];
     }
     /* regular lattices are easy :-) */
@@ -470,6 +481,7 @@
       return(index);
   }
 
+#if 0
   /* do we have a pigeonhole encode hint? */
   if(pt){
     const static_codebook *c=book->c;
@@ -532,6 +544,7 @@
     }
     return(-ptr);
   }
+#endif 
 
   /* brute force it! */
   {
@@ -566,29 +579,6 @@
       }*/
     return(besti);
   }
-}
-
-/* returns the entry number and *modifies a* to the remainder value ********/
-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){
-  case 0:
-    for(i=0,o=0;i<dim;i++,o+=step)
-      a[o]-=(book->valuelist+best*dim)[i];
-    break;
-  case 1:
-    for(i=0,o=0;i<dim;i++,o+=step){
-      float val=(book->valuelist+best*dim)[i];
-      if(val==0){
-	a[o]=0;
-      }else{
-	a[o]/=val;
-      }
-    }
-    break;
-  }
-  return(best);
 }
 
 long vorbis_book_codeword(codebook *book,int entry){

<p><p>1.27      +6 -2      vorbis/lib/synthesis.c

Index: synthesis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/synthesis.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- synthesis.c	2002/02/28 04:12:48	1.26
+++ synthesis.c	2002/06/28 22:19:37	1.27
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.26 2002/02/28 04:12:48 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.27 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
@@ -48,6 +48,9 @@
   vb->mode=mode;
   vb->W=ci->mode_param[mode]->blockflag;
   if(vb->W){
+
+    /* this doesn;t get mapped through mode selection as it's used
+       only for window selection */
     vb->lW=oggpack_read(opb,1);
     vb->nW=oggpack_read(opb,1);
     if(vb->nW==-1)   return(OV_EBADPACKET);
@@ -70,7 +73,8 @@
   /* unpack_header enforces range checking */
   type=ci->map_type[ci->mode_param[mode]->mapping];
 
-  return(_mapping_P[type]->inverse(vb,b->mode[mode]));
+  return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
+						   mapping]));
 }
 
 /* used to track pcm position without actually performing decode.

<p><p>1.40      +637 -717  vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- vorbisenc.c	2002/03/24 21:04:01	1.39
+++ vorbisenc.c	2002/06/28 22:19:37	1.40
@@ -11,114 +11,173 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.39 2002/03/24 21:04:01 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.40 2002/06/28 22:19:37 xiphmont Exp $
 
  ********************************************************************/
 
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <stdarg.h>
 
 #include "vorbis/codec.h"
 #include "vorbis/vorbisenc.h"
 
 #include "codec_internal.h"
-#include "registry-api.h"
 
 #include "os.h"
 #include "misc.h"
 
 /* careful with this; it's using static array sizing to make managing
    all the modes a little less annoying.  If we use a residue backend
-   with > 10 partition types, or a different division of iteration,
+   with > 12 partition types, or a different division of iteration,
    this needs to be updated. */
 typedef struct {
-  vorbis_info_residue0 *res[2];
-  static_codebook *book_aux[2];
-  static_codebook *books_base[5][10][3];
-  static_codebook *books_stereo_backfill[5][10];
-  static_codebook *books_residue_backfill[5][10][2];
+  static_codebook *books[12][3];
+} static_bookblock;
+
+typedef struct {
+  int res_type;
+  int limit_type; /* 0 lowpass limited, 1 point stereo limited */
+  vorbis_info_residue0 *res;
+  static_codebook  *book_aux;
+  static_codebook  *book_aux_managed;
+  static_bookblock *books_base;
+  static_bookblock *books_base_managed;
 } vorbis_residue_template;
 
-static double stereo_threshholds[]={0.0, 2.5, 4.5, 8.5, 16.5};
+typedef struct {
+  vorbis_info_mapping0    *map;
+  vorbis_residue_template *res;
+} vorbis_mapping_template;
 
 typedef struct vp_adjblock{
-  int block[P_BANDS][P_LEVELS];
+  int block[P_BANDS];
 } vp_adjblock;
+
+typedef struct {
+  int data[NOISE_COMPAND_LEVELS];
+} compandblock;
+
+/* high level configuration information for setting things up
+   step-by-step with the detailed vorbis_encode_ctl interface.
+   There's a fair amount of redundancy such that interactive setup
+   does not directly deal with any vorbis_info or codec_setup_info
+   initialization; it's all stored (until full init) in this highlevel
+   setup, then flushed out to the real codec setup structs later. */
+
+typedef struct {
+  int att[P_NOISECURVES];
+  float boost;
+  float decay;
+} att3;
+typedef struct { int data[P_NOISECURVES]; } adj3; 
+
+typedef struct {
+  int   pre[PACKETBLOBS];
+  int   post[PACKETBLOBS];
+  float kHz[PACKETBLOBS];
+  float lowpasskHz[PACKETBLOBS];
+} adj_stereo;
+
+typedef struct {
+  int lo;
+  int hi;
+  int fixed;
+} noiseguard;
+typedef struct {
+  int data[P_NOISECURVES][17];
+} noise3;
+
+typedef struct {
+  int      mappings;
+  double  *rate_mapping;
+  double  *quality_mapping;
+  int      coupling_restriction;
+  long     bitrate_min_restriction;
+  long     bitrate_max_restriction;
+
+
+  int     *blocksize_short;
+  int     *blocksize_long;
+
+  att3    *psy_tone_masteratt;
+  int     *psy_tone_0dB;
+  int     *psy_tone_dBsuppress;
+
+  vp_adjblock *psy_tone_adj_impulse;
+  vp_adjblock *psy_tone_adj_long;
+  vp_adjblock *psy_tone_adj_other;
+
+  noiseguard  *psy_noiseguards;
+  noise3      *psy_noise_bias_impulse;
+  noise3      *psy_noise_bias_padding;
+  noise3      *psy_noise_bias_trans;
+  noise3      *psy_noise_bias_long;
+  int         *psy_noise_dBsuppress;
+
+  compandblock  *psy_noise_compand;
+  double        *psy_noise_compand_short_mapping;
+  double        *psy_noise_compand_long_mapping;
+
+  int      *psy_noise_normal_start[2];
+  int      *psy_noise_normal_partition[2];
+  double   *psy_noise_normal_thresh;
+
+  int      *psy_ath_float;
+  int      *psy_ath_abs;
+
+  double   *psy_lowpass;
+
+  vorbis_info_psy_global *global_params;
+  double     *global_mapping;
+  adj_stereo *stereo_modes;
+
+  static_codebook ***floor_books;
+  vorbis_info_floor1 *floor_params;
+  int *floor_short_mapping;
+  int *floor_long_mapping;
+
+  vorbis_mapping_template *maps;
+} ve_setup_data_template;
+
+#include "modes/setup_44.h"
+
+static ve_setup_data_template *setup_list[]={
+  &ve_setup_44_stereo,
 
-#include "modes/residue_44.h"
-#include "modes/psych_44.h"
-#include "modes/floor_44.h"
 
+  0
+};
+
+
 /* a few static coder conventions */
-static vorbis_info_time0 _time_dummy={0};
-static vorbis_info_mode _mode_set_short={0,0,0,0};
-static vorbis_info_mode _mode_set_long={1,0,0,1};
-
-/* mapping conventions:
-   only one submap (this would change for efficient 5.1 support for example)*/
-/* Four psychoacoustic profiles are used, one for each blocktype */
-static vorbis_info_mapping0 _mapping_set_short={
-  1, {0,0}, {0}, {0}, {0}, {0,1}, 0,{0},{0}};
-static vorbis_info_mapping0 _mapping_set_long={
-  1, {0,0}, {0}, {1}, {1}, {2,3}, 0,{0},{0}};
+static vorbis_info_mode _mode_template[2]={
+  {0,0,0,0},
+  {1,0,0,1}
+};
 
-static int vorbis_encode_toplevel_setup(vorbis_info *vi,int small,int large,int ch,long rate){
+
+static int vorbis_encode_toplevel_setup(vorbis_info *vi,int ch,long rate){
   if(vi && vi->codec_setup){
-    codec_setup_info *ci=vi->codec_setup;
 
     vi->version=0;
     vi->channels=ch;
     vi->rate=rate;
-    
-    ci->blocksizes[0]=small;
-    ci->blocksizes[1]=large;
 
-    /* time mapping hooks are unused in vorbis I */
-    ci->times=1;
-    ci->time_type[0]=0;
-    ci->time_param[0]=_ogg_calloc(1,sizeof(_time_dummy));
-    memcpy(ci->time_param[0],&_time_dummy,sizeof(_time_dummy));
-
-    /* by convention, two modes: one for short, one for long blocks.
-       short block mode uses mapping sero, long block uses mapping 1 */
-    ci->modes=2;
-    ci->mode_param[0]=_ogg_calloc(1,sizeof(_mode_set_short));
-    memcpy(ci->mode_param[0],&_mode_set_short,sizeof(_mode_set_short));
-    ci->mode_param[1]=_ogg_calloc(1,sizeof(_mode_set_long));
-    memcpy(ci->mode_param[1],&_mode_set_long,sizeof(_mode_set_long));
-
-    /* by convention two mappings, both mapping type zero (polyphonic
-       PCM), first for short, second for long blocks */
-    ci->maps=2;
-    ci->map_type[0]=0;
-    ci->map_param[0]=_ogg_calloc(1,sizeof(_mapping_set_short));
-    memcpy(ci->map_param[0],&_mapping_set_short,sizeof(_mapping_set_short));
-    ci->map_type[1]=0;
-    ci->map_param[1]=_ogg_calloc(1,sizeof(_mapping_set_long));
-    memcpy(ci->map_param[1],&_mapping_set_long,sizeof(_mapping_set_long));
-
     return(0);
   }
   return(OV_EINVAL);
 }
 
-static int vorbis_encode_floor_setup(vorbis_info *vi,double q,int block,
-				    static_codebook    ***books, 
-				    vorbis_info_floor1 *in, 
-				    ...){
-  int x[11],i,k,iq=rint(q*10);
+static int vorbis_encode_floor_setup(vorbis_info *vi,double s,int block,
+				     static_codebook    ***books, 
+				     vorbis_info_floor1 *in, 
+				     int *x){
+  int i,k,is=rint(s);
   vorbis_info_floor1 *f=_ogg_calloc(1,sizeof(*f));
   codec_setup_info *ci=vi->codec_setup;
-  va_list ap;
-
-  va_start(ap,in);
-  for(i=0;i<11;i++)
-    x[i]=va_arg(ap,int);
-  va_end(ap);
 
-  memcpy(f,in+x[iq],sizeof(*f));
+  memcpy(f,in+x[is],sizeof(*f));
   /* fill in the lowpass field, even if it's temporary */
   f->n=ci->blocksizes[block]>>1;
 
@@ -139,7 +198,7 @@
     }
 
     for(i=0;i<=maxbook;i++)
-      ci->book_param[ci->books++]=books[x[iq]][i];
+      ci->book_param[ci->books++]=books[x[is]][i];
   }
 
   /* for now, we're only using floor 1 */
@@ -150,227 +209,191 @@
   return(0);
 }
 
-static int vorbis_encode_global_psych_setup(vorbis_info *vi,double q,
-					   vorbis_info_psy_global *in, ...){
-  int i,iq=q*10;
-  double x[11],dq;
+static int vorbis_encode_global_psych_setup(vorbis_info *vi,double s,
+					    vorbis_info_psy_global *in, 
+					    double *x){
+  int i,is=s;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy_global *g=&ci->psy_g_param;
-  va_list ap;
   
-  va_start(ap,in);
-  for(i=0;i<11;i++)
-    x[i]=va_arg(ap,double);
-  va_end(ap);
-
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
-
-  memcpy(g,in+(int)x[iq],sizeof(*g));
-
-  dq=x[iq]*(1.-dq)+x[iq+1]*dq;
-  iq=(int)dq;
-  dq-=iq;
-  if(dq==0 && iq>0){
-    iq--;
-    dq=1.;
+  memcpy(g,in+(int)x[is],sizeof(*g));
+  
+  ds=x[is]*(1.-ds)+x[is+1]*ds;
+  is=(int)ds;
+  ds-=is;
+  if(ds==0 && is>0){
+    is--;
+    ds=1.;
   }
-
+  
   /* interpolate the trigger threshholds */
   for(i=0;i<4;i++){
-    g->preecho_thresh[i]=in[iq].preecho_thresh[i]*(1.-dq)+in[iq+1].preecho_thresh[i]*dq;
-    g->postecho_thresh[i]=in[iq].postecho_thresh[i]*(1.-dq)+in[iq+1].postecho_thresh[i]*dq;
+    g->preecho_thresh[i]=in[is].preecho_thresh[i]*(1.-ds)+in[is+1].preecho_thresh[i]*ds;
+    g->postecho_thresh[i]=in[is].postecho_thresh[i]*(1.-ds)+in[is+1].postecho_thresh[i]*ds;
   }
   g->ampmax_att_per_sec=ci->hi.amplitude_track_dBpersec;
   return(0);
 }
 
-static int vorbis_encode_psyset_setup(vorbis_info *vi,int block){
+static int vorbis_encode_global_stereo(vorbis_info *vi,
+				       highlevel_encode_setup *hi,
+				       adj_stereo *p){
+  float s=hi->stereo_point_setting;
+  int i,is=s;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
-  vorbis_info_psy *p=ci->psy_param[block];
+  vorbis_info_psy_global *g=&ci->psy_g_param;
 
+  memcpy(g->coupling_prepointamp,p[is].pre,sizeof(*p[is].pre)*PACKETBLOBS);
+  memcpy(g->coupling_postpointamp,p[is].post,sizeof(*p[is].post)*PACKETBLOBS);
+
+  if(hi->managed){
+    /* interpolate the kHz threshholds */
+    for(i=0;i<PACKETBLOBS;i++){
+      float kHz=p[is].kHz[i]*(1.-ds)+p[is+1].kHz[i]*ds;
+      g->coupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0];
+      g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1];
+      g->coupling_pkHz[i]=kHz;
+
+      kHz=p[is].lowpasskHz[i]*(1.-ds)+p[is+1].lowpasskHz[i]*ds;
+      g->sliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0];
+      g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1];
+    }
+  }else{
+    float kHz=p[is].kHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].kHz[PACKETBLOBS/2]*ds;
+    for(i=0;i<PACKETBLOBS;i++){
+      g->coupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0];
+      g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1];
+      g->coupling_pkHz[i]=kHz;
+    }
+
+    kHz=p[is].lowpasskHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].lowpasskHz[PACKETBLOBS/2]*ds;
+    for(i=0;i<PACKETBLOBS;i++){
+      g->sliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0];
+      g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1];
+    }
+  }
+
+  return(0);
+}
+
+static int vorbis_encode_psyset_setup(vorbis_info *vi,double s,
+				      int *nn_start,
+				      int *nn_partition,
+				      double *nn_thresh,
+				      int block){
+  codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy *p=ci->psy_param[block];
+  highlevel_encode_setup *hi=&ci->hi;
+  int is=s;
+  
   if(block>=ci->psys)
     ci->psys=block+1;
   if(!p){
     p=_ogg_calloc(1,sizeof(*p));
     ci->psy_param[block]=p;
   }
-
+  
   memcpy(p,&_psy_info_template,sizeof(*p));
+  p->blockflag=block>>1;
 
+  if(hi->noise_normalize_p){
+    p->normal_channel_p=1;
+    p->normal_point_p=1;
+    p->normal_start=nn_start[is];
+    p->normal_partition=nn_partition[is];
+    p->normal_thresh=nn_thresh[is];
+  }
+    
   return 0;
 }
 
-static int vorbis_encode_tonemask_setup(vorbis_info *vi,double q,int block,
-				       double *att,
-				       double *max,
-				       int *peaklimit_bands,
-				       vp_adjblock *in){
-  int i,j,iq;
-  double dq;
+static int vorbis_encode_tonemask_setup(vorbis_info *vi,double s,int block,
+					att3 *att,
+					int  *max,
+					vp_adjblock *in){
+  int i,is=s;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
 
-  iq=q*10;
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
+  /* 0 and 2 are only used by bitmanagement, but there's no harm to always
+     filling the values in here */
+  p->tone_masteratt[0]=att[is].att[0]*(1.-ds)+att[is+1].att[0]*ds;
+  p->tone_masteratt[1]=att[is].att[1]*(1.-ds)+att[is+1].att[1]*ds;
+  p->tone_masteratt[2]=att[is].att[2]*(1.-ds)+att[is+1].att[2]*ds;
+  p->tone_centerboost=att[is].boost*(1.-ds)+att[is+1].boost*ds;
+  p->tone_decay=att[is].decay*(1.-ds)+att[is+1].decay*ds;
 
-  p->tone_masteratt=att[iq]*(1.-dq)+att[iq+1]*dq;
-  p->max_curve_dB=max[iq]*(1.-dq)+max[iq+1]*dq;
-  p->curvelimitp=peaklimit_bands[iq];
+  p->max_curve_dB=max[is]*(1.-ds)+max[is+1]*ds;
 
-  iq=q*5.;
-  if(iq==5){
-    iq=5;
-    dq=1.;
-  }else{
-    dq=q*5.-iq;
-  }
-  
   for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++)
-      p->toneatt.block[i][j]=(j<4?4:j)*-10.+
-	in[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq;
+    p->toneatt[i]=in[is].block[i]*(1.-ds)+in[is+1].block[i]*ds;
   return(0);
 }
 
 
-static int vorbis_encode_compand_setup(vorbis_info *vi,double q,int block,
-				      float in[][NOISE_COMPAND_LEVELS], ...){
-  int i,iq=q*10;
-  double x[11],dq;
+static int vorbis_encode_compand_setup(vorbis_info *vi,double s,int block,
+				       compandblock *in, double *x){
+  int i,is=s;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
-  va_list ap;
-  
-  va_start(ap,in);
-  for(i=0;i<11;i++)
-    x[i]=va_arg(ap,double);
-  va_end(ap);
-
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
 
-  dq=x[iq]*(1.-dq)+x[iq+1]*dq;
-  iq=(int)dq;
-  dq-=iq;
-  if(dq==0 && iq>0){
-    iq--;
-    dq=1.;
+  ds=x[is]*(1.-ds)+x[is+1]*ds;
+  is=(int)ds;
+  ds-=is;
+  if(ds==0 && is>0){
+    is--;
+    ds=1.;
   }
 
   /* interpolate the compander settings */
   for(i=0;i<NOISE_COMPAND_LEVELS;i++)
-    p->noisecompand[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq;
+    p->noisecompand[i]=in[is].data[i]*(1.-ds)+in[is+1].data[i]*ds;
   return(0);
 }
 
-static int vorbis_encode_peak_setup(vorbis_info *vi,double q,int block,
-				    double *guard,
-				    double *suppress,
-				    vp_adjblock *in){
-  int i,j,iq;
-  double dq;
+static int vorbis_encode_peak_setup(vorbis_info *vi,double s,int block,
+				    int *suppress){
+  int is=s;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
 
-  iq=q*10;
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
+  p->tone_abs_limit=suppress[is]*(1.-ds)+suppress[is+1]*ds;
 
-  p->peakattp=1;
-  p->tone_guard=guard[iq]*(1.-dq)+guard[iq+1]*dq;
-  p->tone_abs_limit=suppress[iq]*(1.-dq)+suppress[iq+1]*dq;
-
-  iq=q*5.;
-  if(iq==5){
-    iq=5;
-    dq=1.;
-  }else{
-    dq=q*5.-iq;
-  }
-
-  for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++)
-      p->peakatt.block[i][j]=(j<4?4:j)*-10.+
-	in[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq;
   return(0);
 }
 
-static int vorbis_encode_noisebias_setup(vorbis_info *vi,double q,int block,
-					 double *suppress,
-					 int in[][17],int guard[33]){
-  int i,iq=q*10;
-  double dq;
+static int vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block,
+					 int *suppress,
+					 noise3 *in,
+					 noiseguard *guard){
+  int i,is=s,j;
+  double ds=s-is;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
 
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
+  p->noisemaxsupp=suppress[is]*(1.-ds)+suppress[is+1]*ds;
+  p->noisewindowlomin=guard[block].lo;
+  p->noisewindowhimin=guard[block].hi;
+  p->noisewindowfixed=guard[block].fixed;
+
+  for(j=0;j<P_NOISECURVES;j++)
+    for(i=0;i<P_BANDS;i++)
+      p->noiseoff[j][i]=in[is].data[j][i]*(1.-ds)+in[is+1].data[j][i]*ds;
 
-  p->noisemaxsupp=suppress[iq]*(1.-dq)+suppress[iq+1]*dq;
-  p->noisewindowlomin=guard[iq*3];
-  p->noisewindowhimin=guard[iq*3+1];
-  p->noisewindowfixed=guard[iq*3+2];
-  
-  for(i=0;i<P_BANDS;i++)
-    p->noiseoff[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq;
   return(0);
 }
 
-static int vorbis_encode_ath_setup(vorbis_info *vi,double q,int block,
-				   float in[][27], ...){
-  int i,iq=q*10;
-  double x[11],dq;
+static int vorbis_encode_ath_setup(vorbis_info *vi,int block){
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
-  va_list ap;
-  
-  va_start(ap,in);
-  for(i=0;i<11;i++)
-    x[i]=va_arg(ap,double);
-  va_end(ap);
 
   p->ath_adjatt=ci->hi.ath_floating_dB;
   p->ath_maxatt=ci->hi.ath_absolute_dB;
-
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
-
-  dq=x[iq]*(1.-dq)+x[iq+1]*dq;
-  iq=(int)dq;
-  dq-=iq;
-  if(dq==0 && iq>0){
-    iq--;
-    dq=1.;
-  }
-
-  for(i=0;i<27;i++)
-    p->ath[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq;
   return(0);
 }
 
@@ -383,221 +406,212 @@
   return(ci->books++);
 }
 
-static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block,
-				       int coupled_p,
-				       int stereo_backfill_p,
-				       int residue_backfill_p,
-				       vorbis_residue_template *in,
-				       int point_dB,
-				       double point_kHz){
-
-  int i,iq=q*10;
-  int n,k;
-  int partition_position=0;
-  int res_position=0;
-  int iterations=1;
-  int amplitude_select=0;
-
-  codec_setup_info *ci=vi->codec_setup;
-  vorbis_info_residue0 *r;
-  vorbis_info_psy *psy=ci->psy_param[block*2];
-  
-  /* may be re-called due to ctl */
-  if(ci->residue_param[block])
-    /* free preexisting instance */
-    residue_free_info(ci->residue_param[block],ci->residue_type[block]);
-
-  r=ci->residue_param[block]=_ogg_malloc(sizeof(*r));
-  memcpy(r,in[iq].res[block],sizeof(*r));
-  if(ci->residues<=block)ci->residues=block+1;
+static void vorbis_encode_blocksize_setup(vorbis_info *vi,double s,
+					 int *shortb,int *longb){
 
-  if(block){
-    r->grouping=32;
-  }else{
-    r->grouping=16;
-  }
+  codec_setup_info *ci=vi->codec_setup;
+  int is=s;
+  
+  int blockshort=shortb[is];
+  int blocklong=longb[is];
+  ci->blocksizes[0]=blockshort;
+  ci->blocksizes[1]=blocklong;
 
-  /* for uncoupled, we use type 1, else type 2 */
-  if(coupled_p){
-    ci->residue_type[block]=2;
-  }else{
-    ci->residue_type[block]=1;
-  }
+}
+
+static void vorbis_encode_residue_setup(vorbis_info *vi,
+				       int number, int block,
+				       vorbis_residue_template *res){
+
+  codec_setup_info *ci=vi->codec_setup;
+  int i,n;
+  
+  vorbis_info_residue0 *r=ci->residue_param[number]=
+    _ogg_malloc(sizeof(*r));
+  
+  memcpy(r,res->res,sizeof(*r));
+  if(ci->residues<=number)ci->residues=number+1;
 
-  switch(ci->residue_type[block]){
-  case 1:
-    n=r->end=ci->blocksizes[block?1:0]>>1; /* to be adjusted by lowpass later */
-    partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping);
-    res_position=partition_position*r->grouping;
+  switch(ci->blocksizes[block]){
+  case 64:case 128:case 256:case 512:
+    r->grouping=16;
     break;
-  case 2:
-    n=r->end=(ci->blocksizes[block?1:0]>>1)*vi->channels; /* to be adjusted by lowpass later */
-    partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping);
-    res_position=partition_position*r->grouping/vi->channels;
+  default:
+    r->grouping=32;
     break;
   }
+  ci->residue_type[number]=res->res_type;
 
-  for(i=0;i<r->partitions;i++)
-    if(r->blimit[i]<0)r->blimit[i]=partition_position;
-
-  for(i=0;i<r->partitions;i++)
-    for(k=0;k<3;k++)
-      if(in[iq].books_base[point_dB][i][k])
-	r->secondstages[i]|=(1<<k);
+  /* to be adjusted by lowpass/pointlimit later */
+  n=r->end=ci->blocksizes[block]>>1; 
+  if(res->res_type==2)
+    n=r->end*=vi->channels;
   
-  ci->passlimit[0]=3;
-    
-  if(coupled_p){
-    vorbis_info_mapping0 *map=ci->map_param[block];
-
-    map->coupling_steps=1;
-    map->coupling_mag[0]=0;
-    map->coupling_ang[0]=1;
-
-    psy->couple_pass[0].granulem=1.;
-    psy->couple_pass[0].igranulem=1.;
-
-    psy->couple_pass[0].couple_pass[0].limit=res_position;
-    psy->couple_pass[0].couple_pass[0].outofphase_redundant_flip_p=1;
-    psy->couple_pass[0].couple_pass[0].outofphase_requant_limit=9e10;
-    psy->couple_pass[0].couple_pass[0].amppost_point=0;
-    psy->couple_pass[0].couple_pass[1].limit=9999;
-    psy->couple_pass[0].couple_pass[1].outofphase_redundant_flip_p=1;
-    psy->couple_pass[0].couple_pass[1].outofphase_requant_limit=9e10;
-    psy->couple_pass[0].couple_pass[1].amppost_point=
-      stereo_threshholds[point_dB];
-    amplitude_select=point_dB;
-
-    if(stereo_backfill_p && amplitude_select){
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[1].couple_pass[1].amppost_point=stereo_threshholds[amplitude_select-1];
-      ci->passlimit[1]=4;
-      for(i=0;i<r->partitions;i++)
-	if(in[iq].books_stereo_backfill[amplitude_select][i])
-	  r->secondstages[i]|=8;
-      amplitude_select=amplitude_select-1;
-      iterations++;
-    }
+  /* fill in all the books */
+  {
+    int booklist=0,k;
     
-    if(residue_backfill_p){
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[iterations].granulem=.333333333;
-      psy->couple_pass[iterations].igranulem=3.;
-      psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=1.;
-      psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=1.;
-      for(i=0;i<r->partitions;i++)
-	if(in[iq].books_residue_backfill[amplitude_select][i][0])
-	  r->secondstages[i]|=(1<<(iterations+2));
-      ci->passlimit[iterations]=ci->passlimit[iterations-1]+1;
-      iterations++;
-      
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[iterations].granulem=.1111111111;
-      psy->couple_pass[iterations].igranulem=9.;
-      psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=.3;
-      psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=.3;
+    if(ci->hi.managed){
       for(i=0;i<r->partitions;i++)
-	if(in[iq].books_residue_backfill[amplitude_select][i][1])
-	  r->secondstages[i]|=(1<<(iterations+2));
-      ci->passlimit[iterations]=ci->passlimit[iterations-1]+1;
-      iterations++;
-    }
-    ci->coupling_passes=iterations;
-
-  }else{
+	for(k=0;k<3;k++)
+	  if(res->books_base_managed->books[i][k])
+	    r->secondstages[i]|=(1<<k);
 
-    if(residue_backfill_p){
+      r->groupbook=book_dup_or_new(ci,res->book_aux_managed);
+      ci->book_param[r->groupbook]=res->book_aux_managed;      
+    
       for(i=0;i<r->partitions;i++){
-	if(in[iq].books_residue_backfill[0][i][0])
-	  r->secondstages[i]|=8;
-	if(in[iq].books_residue_backfill[0][i][1])
-	  r->secondstages[i]|=16;
-      }
-      ci->passlimit[1]=4;
-      ci->passlimit[2]=5;
-      ci->coupling_passes=3;
-    }else
-      ci->coupling_passes=1;
-  }
-  
-  memcpy(&ci->psy_param[block*2+1]->couple_pass,
-	 &ci->psy_param[block*2]->couple_pass,
-	 sizeof(psy->couple_pass));
-  
-  /* fill in all the books */
-  {
-    int booklist=0,k;
-    r->groupbook=ci->books;
-    ci->book_param[ci->books++]=in[iq].book_aux[block];
-    for(i=0;i<r->partitions;i++){
-      for(k=0;k<3;k++){
-	if(in[iq].books_base[point_dB][i][k]){
-	  int bookid=book_dup_or_new(ci,in[iq].books_base[point_dB][i][k]);
-	  r->booklist[booklist++]=bookid;
-	  ci->book_param[bookid]=in[iq].books_base[point_dB][i][k];
+	for(k=0;k<3;k++){
+	  if(res->books_base_managed->books[i][k]){
+	    int bookid=book_dup_or_new(ci,res->books_base_managed->books[i][k]);
+	    r->booklist[booklist++]=bookid;
+	    ci->book_param[bookid]=res->books_base_managed->books[i][k];
+	  }
         }
-      }
-      if(coupled_p && stereo_backfill_p && point_dB &&
-	 in[iq].books_stereo_backfill[point_dB][i]){
-	int bookid=book_dup_or_new(ci,in[iq].books_stereo_backfill[point_dB][i]);
-	r->booklist[booklist++]=bookid;
-	ci->book_param[bookid]=in[iq].books_stereo_backfill[point_dB][i];
       }
-      if(residue_backfill_p){
-	for(k=0;k<2;k++){
-	  if(in[iq].books_residue_backfill[amplitude_select][i][k]){
-	    int bookid=book_dup_or_new(ci,in[iq].books_residue_backfill[amplitude_select][i][k]);
+
+    }else{
+
+      for(i=0;i<r->partitions;i++)
+	for(k=0;k<3;k++)
+	  if(res->books_base->books[i][k])
+	    r->secondstages[i]|=(1<<k);
+  
+      r->groupbook=book_dup_or_new(ci,res->book_aux);
+      ci->book_param[r->groupbook]=res->book_aux;
+      
+      for(i=0;i<r->partitions;i++){
+	for(k=0;k<3;k++){
+	  if(res->books_base->books[i][k]){
+	    int bookid=book_dup_or_new(ci,res->books_base->books[i][k]);
             r->booklist[booklist++]=bookid;
-	    ci->book_param[bookid]=in[iq].books_residue_backfill[amplitude_select][i][k];
+	    ci->book_param[bookid]=res->books_base->books[i][k];
           }
         }
       }
     }
   }
-
-  return(0);
+  
+  /* lowpass setup/pointlimit */
+  {
+    double freq=ci->hi.lowpass_kHz*1000.;
+    vorbis_info_floor1 *f=ci->floor_param[block]; /* by convention */
+    double nyq=vi->rate/2.;
+    long blocksize=ci->blocksizes[block]>>1;
+
+    /* lowpass needs to be set in the floor and the residue. */    
+    if(freq>nyq)freq=nyq;
+    /* in the floor, the granularity can be very fine; it doesn't alter
+       the encoding structure, only the samples used to fit the floor
+       approximation */
+    f->n=freq/nyq*blocksize; 
+
+    /* this res may by limited by the maximum pointlimit of the mode,
+       not the lowpass. the floor is always lowpass limited. */
+    if(res->limit_type){
+      if(ci->hi.managed)
+	freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS-1]*1000.;
+      else
+	freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS/2]*1000.;
+      if(freq>nyq)freq=nyq;
+    }
+    
+    /* in the residue, we're constrained, physically, by partition
+       boundaries.  We still lowpass 'wherever', but we have to round up
+       here to next boundary, or the vorbis spec will round it *down* to
+       previous boundary in encode/decode */
+    if(ci->residue_type[block]==2)
+      r->end=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */
+	r->grouping;
+    else
+      r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */
+	r->grouping;
+  }
 }      
 
-static int vorbis_encode_lowpass_setup(vorbis_info *vi,double q,int block){
-  int iq=q*10;
-  double dq;
-  double freq;
-  codec_setup_info *ci=vi->codec_setup;
-  vorbis_info_floor1 *f=ci->floor_param[block];
-  vorbis_info_residue0 *r=ci->residue_param[block];
-  int blocksize=ci->blocksizes[block]>>1;
-  double nyq=vi->rate/2.;
-
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
+/* we assume two maps in this encoder */
+static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s,
+					  vorbis_mapping_template *maps){
+
+  codec_setup_info *ci=vi->codec_setup;
+  int i,j,is=s;
+  vorbis_info_mapping0 *map=maps[is].map;
+  vorbis_info_mode *mode=_mode_template;
+  vorbis_residue_template *res=maps[is].res;
+
+  for(i=0;i<2;i++){
+
+    ci->map_param[i]=_ogg_calloc(1,sizeof(*map));
+    ci->mode_param[i]=_ogg_calloc(1,sizeof(*mode));
+  
+    memcpy(ci->mode_param[i],mode+i,sizeof(*_mode_template));
+    if(i>=ci->modes)ci->modes=i+1;
+
+    ci->map_type[i]=0;
+    memcpy(ci->map_param[i],map+i,sizeof(*map));
+    if(i>=ci->maps)ci->maps=i+1;
+    
+    for(j=0;j<map[i].submaps;j++)
+      vorbis_encode_residue_setup(vi,map[i].residuesubmap[j],i
+				  ,res+map[i].residuesubmap[j]);
+  }
+}
+
+static double setting_to_approx_bitrate(vorbis_info *vi){
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
+  ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup;
+  int is=hi->base_setting;
+  double ds=hi->base_setting-is;
+  int ch=vi->channels;
+  double *r=setup->rate_mapping;
+
+  if(r==NULL)
+    return(-1);
+  
+  return((r[is]*(1.-ds)+r[is+1]*ds)*ch);  
+}
+
+static void get_setup_template(vorbis_info *vi,
+			       long ch,long srate,
+			       double req,int q_or_bitrate){
+  int i=0,j;
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
+
+  while(setup_list[i]){
+    if(setup_list[i]->coupling_restriction==-1 ||
+       setup_list[i]->coupling_restriction==ch){
+      if(srate>=setup_list[i]->bitrate_min_restriction &&
+	 srate<=setup_list[i]->bitrate_max_restriction){
+	int mappings=setup_list[i]->mappings;
+	double *map=(q_or_bitrate?
+		     setup_list[i]->rate_mapping:
+		     setup_list[i]->quality_mapping);
+	if(q_or_bitrate)req/=ch;
+
+	/* the template matches.  Does the requested quality mode
+	   fall within this template's modes? */
+	if(req<map[0])continue;
+	if(req>map[setup_list[i]->mappings])continue;
+	for(j=0;j<mappings;j++)
+	  if(req>=map[j] && req<map[j+1])break;
+	/* an all-points match */
+	hi->setup=setup_list[i];
+	if(j==mappings)
+	  hi->base_setting=j-.001;
+	else{
+	  float low=map[j];
+	  float high=map[j+1];
+	  float del=(req-low)/(high-low);
+	  hi->base_setting=j+del;
+	}
+	return;
+      }
+    }
   }
   
-  freq=ci->hi.lowpass_kHz[block]*1000.;
-  if(freq>vi->rate/2)freq=vi->rate/2;
-  /* lowpass needs to be set in the floor and the residue. */
-
-  /* in the floor, the granularity can be very fine; it doesn't alter
-     the encoding structure, only the samples used to fit the floor
-     approximation */
-  f->n=freq/nyq*blocksize;
-
-  /* in the residue, we're constrained, physically, by partition
-     boundaries.  We still lowpass 'wherever', but we have to round up
-     here to next boundary, or the vorbis spec will round it *down* to
-     previous boundary in encode/decode */
-  if(ci->residue_type[block]==2)
-    r->end=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */
-      r->grouping;
-  else
-    r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */
-      r->grouping;
-  return(0);
+  hi->setup=NULL;
 }
 
 /* encoders will need to use vorbis_info_init beforehand and call
@@ -608,282 +622,225 @@
 
 /* the final setup call */
 int vorbis_encode_setup_init(vorbis_info *vi){
-  int ret=0;
-  /*long rate=vi->rate;*/
-  long channels=vi->channels;
+  int ret=0,i0=0;
   codec_setup_info *ci=vi->codec_setup;
+  ve_setup_data_template *setup=NULL;
   highlevel_encode_setup *hi=&ci->hi;
 
-  ret|=vorbis_encode_floor_setup(vi,hi->base_quality_short,0,
-				_floor_44_128_books,_floor_44_128,
-				0,1,1,2,2,2,2,2,2,2,2);
-  ret|=vorbis_encode_floor_setup(vi,hi->base_quality_long,1,
-				_floor_44_1024_books,_floor_44_1024,
-				0,0,0,0,0,0,0,0,0,0,0);
-  
-  ret|=vorbis_encode_global_psych_setup(vi,hi->trigger_quality,_psy_global_44,
-				       0., 1., 1.5, 2., 2., 2.5, 3., 3.5, 4., 4., 4.);
-
-  ret|=vorbis_encode_psyset_setup(vi,0);
-  ret|=vorbis_encode_psyset_setup(vi,1);
-  ret|=vorbis_encode_psyset_setup(vi,2);
-  ret|=vorbis_encode_psyset_setup(vi,3);
-  
-  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[0].tone_mask_quality,0,
-				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
-				    _vp_tonemask_adj_otherblock);
-  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[1].tone_mask_quality,1,
-				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
-				    _vp_tonemask_adj_otherblock);
-  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[2].tone_mask_quality,2,
-				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
-				    _vp_tonemask_adj_otherblock);
-  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[3].tone_mask_quality,3,
-				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
-				    _vp_tonemask_adj_longblock);
-  
-  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[0].noise_compand_quality,
-				  0,_psy_compand_44_short,
-				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[1].noise_compand_quality,
-				  1,_psy_compand_44_short,
-				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[2].noise_compand_quality,
-				  2,_psy_compand_44,
-				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[3].noise_compand_quality,
-				  3,_psy_compand_44,
-				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[0].tone_peaklimit_quality,
-				0,_psy_tone_masterguard,_psy_tone_suppress,
-				_vp_peakguard);
-  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[1].tone_peaklimit_quality,
-				1,_psy_tone_masterguard,_psy_tone_suppress,
-				_vp_peakguard);
-  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[2].tone_peaklimit_quality,
-				2,_psy_tone_masterguard,_psy_tone_suppress,
-				_vp_peakguard);
-  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[3].tone_peaklimit_quality,
-				3,_psy_tone_masterguard,_psy_tone_suppress,
-				_vp_peakguard);
-
-  if(hi->impulse_block_p){
-    ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[0].noise_bias_quality,
-				       0,_psy_noise_suppress,_psy_noisebias_impulse,
-				       _psy_noiseguards_short);
-  }else{
-    ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[0].noise_bias_quality,
-				       0,_psy_noise_suppress,_psy_noisebias_other,
-				       _psy_noiseguards_short);
-  }
-
-  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[1].noise_bias_quality,
-				    1,_psy_noise_suppress,_psy_noisebias_other,
-				      _psy_noiseguards_short);
-  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[2].noise_bias_quality,
-				      2,_psy_noise_suppress,_psy_noisebias_other,
-				    _psy_noiseguards_long);
-  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[3].noise_bias_quality,
-				    3,_psy_noise_suppress,_psy_noisebias_long,
-				    _psy_noiseguards_long);
-
-  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[0].ath_quality,0,ATH_Bark_dB,
-			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[1].ath_quality,1,ATH_Bark_dB,
-			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[2].ath_quality,2,ATH_Bark_dB,
-			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[3].ath_quality,3,ATH_Bark_dB,
-			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
+  if(ci==NULL)return(OV_EINVAL);
+  if(!hi->impulse_block_p)i0=1;
 
+  /* too low/high an ATH floater is nonsensical, but doesn't break anything */
+  if(hi->ath_floating_dB>-80)hi->ath_floating_dB=-80;
+  if(hi->ath_floating_dB<-200)hi->ath_floating_dB=-200;
+
+  /* again, bound this to avoid the app shooting itself int he foot
+     too badly */
+  if(hi->amplitude_track_dBpersec>0.)hi->amplitude_track_dBpersec=0.;
+  if(hi->amplitude_track_dBpersec<-99999.)hi->amplitude_track_dBpersec=-99999.;
+  
+  /* get the appropriate setup template; matches the fetch in previous
+     stages */
+  setup=(ve_setup_data_template *)hi->setup;
+  if(setup==NULL)return(OV_EINVAL);
+
+  /* choose block sizes from configured sizes as well as paying
+     attention to long_block_p and short_block_p.  If the configured
+     short and long blocks are the same length, we set long_block_p
+     and unset short_block_p */
+  vorbis_encode_blocksize_setup(vi,hi->base_setting,
+				setup->blocksize_short,
+				setup->blocksize_long);
+  
+  /* floor setup; choose proper floor params.  Allocated on the floor
+     stack in order; if we alloc only long floor, it's 0 */
+  ret|=vorbis_encode_floor_setup(vi,hi->short_setting,0,
+				 setup->floor_books,
+				 setup->floor_params,
+				 setup->floor_short_mapping);
+  ret|=vorbis_encode_floor_setup(vi,hi->long_setting,1,
+				 setup->floor_books,
+				 setup->floor_params,
+				 setup->floor_long_mapping);
+  
+  /* setup of [mostly] short block detection and stereo*/
+  ret|=vorbis_encode_global_psych_setup(vi,hi->trigger_setting,
+					setup->global_params,
+					setup->global_mapping);
+  ret|=vorbis_encode_global_stereo(vi,hi,setup->stereo_modes);
+
+  /* basic psych setup and noise normalization */
+  ret|=vorbis_encode_psyset_setup(vi,hi->short_setting,
+				  setup->psy_noise_normal_start[0],
+				  setup->psy_noise_normal_partition[0],  
+				  setup->psy_noise_normal_thresh,  
+				  0);
+  ret|=vorbis_encode_psyset_setup(vi,hi->short_setting,
+				  setup->psy_noise_normal_start[0],
+				  setup->psy_noise_normal_partition[0],  
+				  setup->psy_noise_normal_thresh,  
+				  1);
+  ret|=vorbis_encode_psyset_setup(vi,hi->long_setting,
+				  setup->psy_noise_normal_start[1],
+				  setup->psy_noise_normal_partition[1],  
+				  setup->psy_noise_normal_thresh,  
+				  2);
+  ret|=vorbis_encode_psyset_setup(vi,hi->long_setting,
+				  setup->psy_noise_normal_start[1],
+				  setup->psy_noise_normal_partition[1],  
+				  setup->psy_noise_normal_thresh,  
+				  3);
+
+  /* tone masking setup */
+  ret|=vorbis_encode_tonemask_setup(vi,hi->block[i0].tone_mask_setting,0,
+				    setup->psy_tone_masteratt,
+				    setup->psy_tone_0dB,
+				    setup->psy_tone_adj_impulse);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->block[1].tone_mask_setting,1,
+				    setup->psy_tone_masteratt,
+				    setup->psy_tone_0dB,
+				    setup->psy_tone_adj_other);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->block[2].tone_mask_setting,2,
+				    setup->psy_tone_masteratt,
+				    setup->psy_tone_0dB,
+				    setup->psy_tone_adj_other);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->block[3].tone_mask_setting,3,
+				    setup->psy_tone_masteratt,
+				    setup->psy_tone_0dB,
+				    setup->psy_tone_adj_long);
+
+  /* noise companding setup */
+  ret|=vorbis_encode_compand_setup(vi,hi->block[i0].noise_compand_setting,0,
+				   setup->psy_noise_compand,
+				   setup->psy_noise_compand_short_mapping);
+  ret|=vorbis_encode_compand_setup(vi,hi->block[1].noise_compand_setting,1,
+				   setup->psy_noise_compand,
+				   setup->psy_noise_compand_short_mapping);
+  ret|=vorbis_encode_compand_setup(vi,hi->block[2].noise_compand_setting,2,
+				   setup->psy_noise_compand,
+				   setup->psy_noise_compand_long_mapping);
+  ret|=vorbis_encode_compand_setup(vi,hi->block[3].noise_compand_setting,3,
+				   setup->psy_noise_compand,
+				   setup->psy_noise_compand_long_mapping);
+
+  /* peak guarding setup  */
+  ret|=vorbis_encode_peak_setup(vi,hi->block[i0].tone_peaklimit_setting,0,
+				setup->psy_tone_dBsuppress);
+  ret|=vorbis_encode_peak_setup(vi,hi->block[1].tone_peaklimit_setting,1,
+				setup->psy_tone_dBsuppress);
+  ret|=vorbis_encode_peak_setup(vi,hi->block[2].tone_peaklimit_setting,2,
+				setup->psy_tone_dBsuppress);
+  ret|=vorbis_encode_peak_setup(vi,hi->block[3].tone_peaklimit_setting,3,
+				setup->psy_tone_dBsuppress);
+
+  /* noise bias setup */
+  ret|=vorbis_encode_noisebias_setup(vi,hi->block[i0].noise_bias_setting,0,
+				     setup->psy_noise_dBsuppress,
+				     setup->psy_noise_bias_impulse,
+				     setup->psy_noiseguards);
+  ret|=vorbis_encode_noisebias_setup(vi,hi->block[1].noise_bias_setting,1,
+				     setup->psy_noise_dBsuppress,
+				     setup->psy_noise_bias_padding,
+				     setup->psy_noiseguards);
+  ret|=vorbis_encode_noisebias_setup(vi,hi->block[2].noise_bias_setting,2,
+				     setup->psy_noise_dBsuppress,
+				     setup->psy_noise_bias_trans,
+				     setup->psy_noiseguards);
+  ret|=vorbis_encode_noisebias_setup(vi,hi->block[3].noise_bias_setting,3,
+				     setup->psy_noise_dBsuppress,
+				     setup->psy_noise_bias_long,
+				     setup->psy_noiseguards);
+
+  ret|=vorbis_encode_ath_setup(vi,0);
+  ret|=vorbis_encode_ath_setup(vi,1);
+  ret|=vorbis_encode_ath_setup(vi,2);
+  ret|=vorbis_encode_ath_setup(vi,3);
+
   if(ret){
     vorbis_info_clear(vi);
     return ret; 
   }
 
-  if(channels==2 && hi->stereo_couple_p){
-    /* setup specific to stereo coupling */
-    
-    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
-				    1, /* coupled */
-				    hi->stereo_backfill_p,
-				    hi->residue_backfill_p, 
-				    _residue_template_44_stereo,
-				    hi->stereo_point_dB,
-				    hi->stereo_point_kHz[0]);
-      
-    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
-				    1, /* coupled */
-				    hi->stereo_backfill_p,
-				    hi->residue_backfill_p, 
-				    _residue_template_44_stereo,
-				    hi->stereo_point_dB,
-				    hi->stereo_point_kHz[1]);
+  vorbis_encode_map_n_res_setup(vi,hi->base_setting,setup->maps);
 
-  }else{
-    /* setup specific to non-stereo (mono or uncoupled polyphonic)
-       coupling */
-    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
-				    0, /* uncoupled */
-				    0,
-				    hi->residue_backfill_p, 
-				    _residue_template_44_uncoupled,
-				    0,
-				    hi->stereo_point_kHz[0]); /* just
-				    used as an encoding partitioning
-				    point */
-      
-    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
-				    0, /* uncoupled */
-				    0,
-				    hi->residue_backfill_p, 
-				    _residue_template_44_uncoupled,
-				    0,
-				    hi->stereo_point_kHz[1]); /* just
-				    used as an encoding partitioning
-				    point */
+  /* set bitrate readonlies and management */
+  vi->bitrate_nominal=setting_to_approx_bitrate(vi);
+  vi->bitrate_lower=hi->bitrate_min;
+  vi->bitrate_upper=hi->bitrate_max;
+  vi->bitrate_window=hi->bitrate_limit_window;
+
+  if(hi->managed){
+    ci->bi.queue_avg_time=hi->bitrate_av_window;
+    ci->bi.queue_avg_center=hi->bitrate_av_window_center;
+    ci->bi.queue_minmax_time=hi->bitrate_limit_window;
+    ci->bi.queue_hardmin=hi->bitrate_min;
+    ci->bi.queue_hardmax=hi->bitrate_max;
+    ci->bi.queue_avgmin=hi->bitrate_av_lo;
+    ci->bi.queue_avgmax=hi->bitrate_av_hi;
+    ci->bi.avgfloat_downslew_max=-999999.f;
+    ci->bi.avgfloat_upslew_max=999999.f;
   }
-  ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[0],0);
-  ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[1],1);
-    
-  if(ret)
-    vorbis_info_clear(vi);
-  return(ret);
-
-}
 
-/* this is only tuned for 44.1kHz right now.  S'ok, for other rates it
-   just doesn't guess */
-static double ratepch_un44[11]=
-    {40000.,50000.,60000.,70000.,75000.,85000.,105000.,
-     115000.,135000.,160000.,250000.};
-static double ratepch_st44[11]=
-    {32000.,40000.,48000.,56000.,64000.,
-     80000.,96000.,112000.,128000.,160000.,250000.};
-
-static double vbr_to_approx_bitrate(int ch,int coupled,
-				    double q,long srate){
-  int iq=q*10.;
-  double dq;
-  double *r=NULL;
-
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
-
-  if(srate>42000 && srate<46000){
-    if(coupled)
-      r=ratepch_st44;
-    else
-      r=ratepch_un44;
-  }
-  
-  if(r==NULL)
-    return(-1);
+  return(ret);
   
-  return((r[iq]*(1.-dq)+r[iq+1]*dq)*ch);  
 }
 
-static double approx_bitrate_to_vbr(int ch,int coupled,
-				    double bitrate,long srate){
-  double *r=NULL,del;
-  int i;
+static int vorbis_encode_setup_setting(vorbis_info *vi,
+				       long  channels,
+				       long  rate){
+  int ret=0,i,is;
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
+  ve_setup_data_template *setup=hi->setup;
+  double ds;
 
-  if(srate>42000 && srate<46000){
-    if(coupled)
-      r=ratepch_st44;
-    else
-      r=ratepch_un44;
-  }
-  
-  if(r==NULL)
-    return(-1.);
+  ret=vorbis_encode_toplevel_setup(vi,channels,rate);
+  if(ret)return(ret);
 
-  bitrate/=ch;
+  is=hi->base_setting;
+  ds=hi->base_setting-is;
 
-  if(bitrate<=r[0])return(0.);
-  for(i=0;i<10;i++)
-    if(r[i]<bitrate && r[i+1]>=bitrate)break;
-  if(i==10)return(10.);
+  hi->short_setting=hi->base_setting;
+  hi->long_setting=hi->base_setting;
 
-  del=(bitrate-r[i])/(r[i+1]-r[i]);
-  
-  return((i+del)*.1);
-}
+  hi->managed=0;
 
-/* only populates the high-level settings so that we can tweak with ctl before final setup */
-int vorbis_encode_setup_vbr(vorbis_info *vi,
-			    long channels,
-			    long rate,
-			    
-			    float base_quality){
-  int ret=0,i,iq;
-  double dq;
-  codec_setup_info *ci=vi->codec_setup;
-  highlevel_encode_setup *hi=&ci->hi;
-  
-  base_quality+=.0001;
-  if(base_quality<0.)base_quality=0.;
-  if(base_quality>.999)base_quality=.999;
-
-  iq=base_quality*10;
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=base_quality*10.-iq;
-  }
+  hi->impulse_block_p=1;
+  hi->noise_normalize_p=1;
 
-  ret|=vorbis_encode_toplevel_setup(vi,256,2048,channels,rate);
-  hi->base_quality=base_quality;
-  hi->base_quality_short=base_quality;
-  hi->base_quality_long=base_quality;
-  hi->trigger_quality=base_quality;
+  hi->stereo_point_setting=hi->base_setting;
+  hi->lowpass_kHz=
+    setup->psy_lowpass[is]*(1.-ds)+setup->psy_lowpass[is+1]*ds;  
+  
+  hi->ath_floating_dB=setup->psy_ath_float[is]*(1.-ds)+
+    setup->psy_ath_float[is+1]*ds;
+  hi->ath_absolute_dB=setup->psy_ath_abs[is]*(1.-ds)+
+    setup->psy_ath_abs[is+1]*ds;
 
+  hi->amplitude_track_dBpersec=-6.;
+  hi->trigger_setting=hi->base_setting;
+
   for(i=0;i<4;i++){
-    hi->blocktype[i].tone_mask_quality=base_quality;
-    hi->blocktype[i].tone_peaklimit_quality=base_quality;
-    hi->blocktype[i].noise_bias_quality=base_quality;
-    hi->blocktype[i].noise_compand_quality=base_quality;
-    hi->blocktype[i].ath_quality=base_quality;
+    hi->block[i].tone_mask_setting=hi->base_setting;
+    hi->block[i].tone_peaklimit_setting=hi->base_setting;
+    hi->block[i].noise_bias_setting=hi->base_setting;
+    hi->block[i].noise_compand_setting=hi->base_setting;
   }
 
-  hi->short_block_p=1;
-  hi->long_block_p=1;
-  hi->impulse_block_p=1;
-  hi->amplitude_track_dBpersec=-6.;
+  return(ret);
+}
 
-  hi->stereo_couple_p=1; /* only relevant if a two channel input */
-  hi->stereo_backfill_p=0;
-  hi->residue_backfill_p=0;
-
-  /* set the ATH floaters */
-  hi->ath_floating_dB=_psy_ath_floater[iq]*(1.-dq)+_psy_ath_floater[iq+1]*dq;
-  hi->ath_absolute_dB=_psy_ath_abs[iq]*(1.-dq)+_psy_ath_abs[iq+1]*dq;
-
-  /* set stereo dB and Hz */
-  hi->stereo_point_dB=_psy_stereo_point_dB_44[iq];
-  hi->stereo_point_kHz[0]=_psy_stereo_point_kHz_44[0][iq]*(1.-dq)+
-    _psy_stereo_point_kHz_44[0][iq+1]*dq;
-  hi->stereo_point_kHz[1]=_psy_stereo_point_kHz_44[1][iq]*(1.-dq)+
-    _psy_stereo_point_kHz_44[1][iq+1]*dq;
-  
-  /* set lowpass */
-  hi->lowpass_kHz[0]=
-    hi->lowpass_kHz[1]=
-    _psy_lowpass_44[iq]*(1.-dq)+_psy_lowpass_44[iq+1]*dq;
-
-  /* set bitrate approximation */
-  vi->bitrate_nominal=vbr_to_approx_bitrate(vi->channels,hi->stereo_couple_p,
-					    base_quality,vi->rate);
-  vi->bitrate_lower=-1;
-  vi->bitrate_upper=-1;
-  vi->bitrate_window=-1;
+int vorbis_encode_setup_vbr(vorbis_info *vi,
+			    long  channels,
+			    long  rate,			    
+			    float quality){
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
 
-  return(ret);
+  get_setup_template(vi,channels,rate,quality,0);
+  if(!hi->setup)return OV_EIMPL;
+  
+  return vorbis_encode_setup_setting(vi,channels,rate);
 }
 
 int vorbis_encode_init_vbr(vorbis_info *vi,
@@ -914,8 +871,9 @@
                                 long nominal_bitrate,
                                 long min_bitrate){
 
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
   double tnominal=nominal_bitrate;
-  double approx_vbr;
   int ret=0;
 
   if(nominal_bitrate<=0.){
@@ -929,64 +887,26 @@
       }
     }
   }
-
-  approx_vbr=approx_bitrate_to_vbr(channels,(channels==2), 
-				   (float)nominal_bitrate,rate);
-  if(approx_vbr<0)return(OV_EIMPL);
 
-
-  ret=vorbis_encode_setup_vbr(vi,channels,rate,approx_vbr);
+  get_setup_template(vi,channels,rate,nominal_bitrate,1);
+  if(!hi->setup)return OV_EIMPL;
+  
+  ret=vorbis_encode_setup_setting(vi,channels,rate);
   if(ret){
     vorbis_info_clear(vi);
     return ret; 
   }
 
-  /* adjust to make management's life easier.  Use the ctl() interface
-     once it's implemented */
-  {
-    codec_setup_info *ci=vi->codec_setup;
-    highlevel_encode_setup *hi=&ci->hi;
+  /* initialize management with sane defaults */
+  ci->hi.managed=1;
 
-    /* backfills */
-    hi->stereo_backfill_p=1;
-    hi->residue_backfill_p=1;
-
-    /* no impulse blocks */
-    hi->impulse_block_p=0;
-    /* de-rate stereo */
-    if(hi->stereo_point_dB && hi->stereo_couple_p && channels==2){
-      hi->stereo_point_dB++;
-      if(hi->stereo_point_dB>3)hi->stereo_point_dB=3;
-    }      
-    /* slug the vbr noise setting*/
-    hi->blocktype[0].noise_bias_quality-=.1;
-    if(hi->blocktype[0].noise_bias_quality<0.)
-      hi->blocktype[0].noise_bias_quality=0.;
-    hi->blocktype[1].noise_bias_quality-=.1;
-    if(hi->blocktype[1].noise_bias_quality<0.)
-      hi->blocktype[1].noise_bias_quality=0.;
-    hi->blocktype[2].noise_bias_quality-=.05;
-    if(hi->blocktype[2].noise_bias_quality<0.)
-      hi->blocktype[2].noise_bias_quality=0.;
-    hi->blocktype[3].noise_bias_quality-=.05;
-    if(hi->blocktype[3].noise_bias_quality<0.)
-      hi->blocktype[3].noise_bias_quality=0.;
-   
-    /* initialize management.  Currently hardcoded for 44, but so is above. */
-    memcpy(&ci->bi,&_bm_44_default,sizeof(ci->bi));
-    ci->bi.queue_hardmin=min_bitrate;
-    ci->bi.queue_hardmax=max_bitrate;
-    
-    ci->bi.queue_avgmin=tnominal;
-    ci->bi.queue_avgmax=tnominal;
-
-    /* adjust management */
-    ci->bi.avgfloat_noise_maxval=_bm_max_noise_offset[(int)approx_vbr];
-
-  }
-  vi->bitrate_nominal = nominal_bitrate;
-  vi->bitrate_lower = min_bitrate;
-  vi->bitrate_upper = max_bitrate;
+  ci->hi.bitrate_av_window=4.;
+  ci->hi.bitrate_av_window_center=.5;
+  ci->hi.bitrate_limit_window=2.;
+  ci->hi.bitrate_min=min_bitrate;
+  ci->hi.bitrate_max=max_bitrate;
+  ci->hi.bitrate_av_lo=tnominal;
+  ci->hi.bitrate_av_hi=tnominal;
 
   return(ret);
 }

<p><p>1.2       +56 -0     vorbis/lib/highlevel.h

<p><p><p>1.2       +1 -102    vorbis/lib/books/coupled/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/books/coupled/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.am	2001/12/31 23:54:34	1.1
+++ Makefile.am	2002/06/28 22:19:44	1.2
@@ -2,105 +2,4 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-EXTRA_DIST = _44c0_long.vqh _44c0_s0_p0_r0.vqh _44c0_s0_p0_r1.vqh \
-	_44c0_s0_p1_0.vqh _44c0_s0_p2_0.vqh _44c0_s0_p3_0.vqh\
-	_44c0_s0_p4_0.vqh _44c0_s0_p4_1.vqh _44c0_s0_p5_0.vqh\
-	_44c0_s0_p6_0.vqh _44c0_s0_p7_0.vqh _44c0_s0_p7_1.vqh\
-	_44c0_s0_p7_2.vqh _44c0_s0_pN_r0.vqh _44c0_s0_pN_r1.vqh\
-	_44c0_s1_p5_0.vqh _44c0_s1_p5_s0.vqh _44c0_s1_p6_0.vqh\
-	_44c0_s1_p6_s0.vqh _44c0_s1_p7_0.vqh _44c0_s1_p7_1.vqh _44c0_s1_p7_2.vqh\
-	_44c0_s1_p7_s0.vqh _44c0_s1_pS_r0.vqh _44c0_s1_pS_r1.vqh\
-	_44c0_s2_p6_0.vqh _44c0_s2_p6_s0.vqh _44c0_s2_p7_0.vqh\
-	_44c0_s2_p7_1.vqh _44c0_s2_p7_2.vqh _44c0_s2_p7_s0.vqh _44c0_s3_p7_0.vqh\
-	_44c0_s3_p7_1.vqh _44c0_s3_p7_2.vqh _44c0_s3_p7_s0.vqh\
-	_44c0_s4_p7_0.vqh _44c0_s4_p7_1.vqh _44c0_s4_p7_2.vqh _44c0_short.vqh\
-	_44c1_long.vqh _44c1_s0_p1_0.vqh _44c1_s0_p2_0.vqh\
-	_44c1_s0_p3_0.vqh _44c1_s0_p4_0.vqh _44c1_s0_p4_1.vqh\
-	_44c1_s0_p5_0.vqh _44c1_s0_p6_0.vqh _44c1_s0_p7_0.vqh\
-	_44c1_s0_p7_1.vqh _44c1_s0_p7_2.vqh _44c1_s1_p5_0.vqh\
-	_44c1_s1_p6_0.vqh _44c1_s1_p7_0.vqh _44c1_s1_p7_1.vqh\
-	_44c1_s1_p7_2.vqh _44c1_s2_p6_0.vqh _44c1_s2_p7_0.vqh\
-	_44c1_s2_p7_1.vqh _44c1_s2_p7_2.vqh _44c1_s3_p7_0.vqh\
-	_44c1_s3_p7_1.vqh _44c1_s3_p7_2.vqh _44c1_short.vqh\
-	_44c2_long.vqh _44c2_s0_p1_0.vqh _44c2_s0_p2_0.vqh\
-	_44c2_s0_p3_0.vqh _44c2_s0_p4_0.vqh _44c2_s0_p4_1.vqh\
-	_44c2_s0_p5_0.vqh _44c2_s0_p6_0.vqh _44c2_s0_p7_0.vqh\
-	_44c2_s0_p7_1.vqh _44c2_s0_p7_2.vqh _44c2_s1_p5_0.vqh\
-	_44c2_s1_p6_0.vqh _44c2_s1_p7_0.vqh _44c2_s1_p7_1.vqh\
-	_44c2_s1_p7_2.vqh _44c2_s2_p6_0.vqh _44c2_s2_p7_0.vqh\
-	_44c2_s2_p7_1.vqh _44c2_s2_p7_2.vqh _44c2_s3_p7_0.vqh\
-	_44c2_s3_p7_1.vqh _44c2_s3_p7_2.vqh _44c2_short.vqh\
-	_44c3_long.vqh _44c3_s0_p1_0.vqh _44c3_s0_p2_0.vqh\
-	_44c3_s0_p3_0.vqh _44c3_s0_p4_0.vqh _44c3_s0_p4_1.vqh\
-	_44c3_s0_p5_0.vqh _44c3_s0_p6_0.vqh _44c3_s0_p7_0.vqh\
-	_44c3_s0_p7_1.vqh _44c3_s0_p7_2.vqh _44c3_s1_p5_0.vqh\
-	_44c3_s1_p6_0.vqh _44c3_s1_p7_0.vqh _44c3_s1_p7_1.vqh\
-	_44c3_s1_p7_2.vqh _44c3_s2_p6_0.vqh _44c3_s2_p7_0.vqh\
-	_44c3_s2_p7_1.vqh _44c3_s2_p7_2.vqh _44c3_s3_p7_0.vqh\
-	_44c3_s3_p7_1.vqh _44c3_s3_p7_2.vqh _44c3_short.vqh\
-	_44c4_long.vqd _44c4_long.vqh _44c4_s0_p0_r0.vqh\
-	_44c4_s0_p0_r1.vqh _44c4_s0_p1_0.vqh _44c4_s0_p2_0.vqh\
-	_44c4_s0_p3_0.vqh _44c4_s0_p4_0.vqh _44c4_s0_p5_0.vqh\
-	_44c4_s0_p6_0.vqh _44c4_s0_p7_0.vqh _44c4_s0_p7_1.vqh\
-	_44c4_s0_p8_0.vqh _44c4_s0_p8_1.vqh _44c4_s0_p9_0.vqh\
-	_44c4_s0_p9_1.vqh _44c4_s0_p9_2.vqh _44c4_s0_pN_r0.vqh\
-	_44c4_s0_pN_r1.vqh _44c4_s1_p2_0.vqh _44c4_s1_p2_s0.vqh\
-	_44c4_s1_p4_0.vqh _44c4_s1_p4_s0.vqh _44c4_s1_p6_0.vqh\
-	_44c4_s1_p6_s0.vqh _44c4_s1_p7_0.vqh _44c4_s1_p7_1.vqh\
-	_44c4_s1_p7_s0.vqh _44c4_s1_p8_0.vqh _44c4_s1_p8_1.vqh\
-	_44c4_s1_p8_s0.vqh _44c4_s1_p9_0.vqh _44c4_s1_p9_1.vqh\
-	_44c4_s1_p9_2.vqh _44c4_s1_p9_s0.vqh _44c4_s1_pS_r0.vqh\
-	_44c4_s1_pS_r1.vqh _44c4_s2_p6_0.vqh _44c4_s2_p6_s0.vqh\
-	_44c4_s2_p7_0.vqh _44c4_s2_p7_1.vqh _44c4_s2_p7_s0.vqh\
-	_44c4_s2_p8_0.vqh _44c4_s2_p8_1.vqh _44c4_s2_p8_s0.vqh\
-	_44c4_s2_p9_0.vqh _44c4_s2_p9_1.vqh _44c4_s2_p9_2.vqh\
-	_44c4_s2_p9_s0.vqh _44c4_s3_p7_0.vqh _44c4_s3_p7_1.vqh\
-	_44c4_s3_p8_0.vqh _44c4_s3_p8_1.vqh _44c4_s3_p9_0.vqh\
-	_44c4_s3_p9_1.vqh _44c4_s3_p9_2.vqh _44c4_s3_p9_s0.vqh\
-	_44c4_short.vqd _44c4_short.vqh _44c5_long.vqh\
-	_44c5_s0_p1_0.vqh _44c5_s0_p2_0.vqh _44c5_s0_p3_0.vqh\
-	_44c5_s0_p4_0.vqh _44c5_s0_p5_0.vqh _44c5_s0_p6_0.vqh\
-	_44c5_s0_p7_0.vqh _44c5_s0_p7_1.vqh _44c5_s0_p8_0.vqh\
-	_44c5_s0_p8_1.vqh _44c5_s0_p9_0.vqh _44c5_s0_p9_1.vqh\
-	_44c5_s0_p9_2.vqh _44c5_s1_p2_0.vqh _44c5_s1_p4_0.vqh\
-	_44c5_s1_p6_0.vqh _44c5_s1_p7_0.vqh _44c5_s1_p7_1.vqh\
-	_44c5_s1_p8_0.vqh _44c5_s1_p8_1.vqh _44c5_s1_p9_0.vqh\
-	_44c5_s1_p9_1.vqh _44c5_s1_p9_2.vqh _44c5_s2_p6_0.vqh\
-	_44c5_s2_p7_0.vqh _44c5_s2_p7_1.vqh _44c5_s2_p8_0.vqh\
-	_44c5_s2_p8_1.vqh _44c5_s2_p9_0.vqh _44c5_s2_p9_1.vqh\
-	_44c5_s2_p9_2.vqh _44c5_s3_p7_0.vqh _44c5_s3_p7_1.vqh\
-	_44c5_s3_p8_0.vqh _44c5_s3_p8_1.vqh _44c5_s3_p9_0.vqh\
-	_44c5_s3_p9_1.vqh _44c5_s3_p9_2.vqh _44c5_short.vqh\
-	_44c6_long.vqh _44c6_s0_p1_0.vqh _44c6_s0_p2_0.vqh\
-	_44c6_s0_p3_0.vqh _44c6_s0_p4_0.vqh _44c6_s0_p5_0.vqh\
-	_44c6_s0_p6_0.vqh _44c6_s0_p7_0.vqh _44c6_s0_p7_1.vqh\
-	_44c6_s0_p8_0.vqh _44c6_s0_p8_1.vqh _44c6_s0_p9_0.vqh\
-	_44c6_s0_p9_1.vqh _44c6_s0_p9_2.vqh _44c6_s1_p2_0.vqh\
-	_44c6_s1_p4_0.vqh _44c6_s1_p6_0.vqh _44c6_s1_p7_0.vqh\
-	_44c6_s1_p7_1.vqh _44c6_s1_p8_0.vqh _44c6_s1_p8_1.vqh\
-	_44c6_s1_p9_0.vqh _44c6_s1_p9_1.vqh _44c6_s1_p9_2.vqh\
-	_44c6_s2_p6_0.vqh _44c6_s2_p7_0.vqh _44c6_s2_p7_1.vqh\
-	_44c6_s2_p8_0.vqh _44c6_s2_p8_1.vqh _44c6_s2_p9_0.vqh\
-	_44c6_s2_p9_1.vqh _44c6_s2_p9_2.vqh _44c6_s3_p7_0.vqh\
-	_44c6_s3_p7_1.vqh _44c6_s3_p8_0.vqh _44c6_s3_p8_1.vqh\
-	_44c6_s3_p9_0.vqh _44c6_s3_p9_1.vqh _44c6_s3_p9_2.vqh\
-	_44c6_short.vqh _44c7_long.vqh _44c7_s0_p0_r0.vqh\
-	_44c7_s0_p0_r1.vqh _44c7_s0_p1_0.vqh _44c7_s0_p1_1.vqh\
-	_44c7_s0_p2_0.vqh _44c7_s0_p2_1.vqh _44c7_s0_p3_0.vqh\
-	_44c7_s0_p4_0.vqh _44c7_s0_p5_0.vqh _44c7_s0_p6_0.vqh\
-	_44c7_s0_p6_1.vqh _44c7_s0_p7_0.vqh _44c7_s0_p7_1.vqh\
-	_44c7_s0_p8_0.vqh _44c7_s0_p8_1.vqh _44c7_s0_p9_0.vqh\
-	_44c7_s0_p9_1.vqh _44c7_s0_p9_2.vqh _44c7_s0_pN_r0.vqh\
-	_44c7_s0_pN_r1.vqh _44c7_short.vqh _44c8_long.vqh\
-	_44c8_s0_p1_0.vqh _44c8_s0_p1_1.vqh _44c8_s0_p2_0.vqh\
-	_44c8_s0_p2_1.vqh _44c8_s0_p3_0.vqh _44c8_s0_p4_0.vqh\
-	_44c8_s0_p5_0.vqh _44c8_s0_p6_0.vqh _44c8_s0_p6_1.vqh\
-	_44c8_s0_p7_0.vqh _44c8_s0_p7_1.vqh _44c8_s0_p8_0.vqh\
-	_44c8_s0_p8_1.vqh _44c8_s0_p9_0.vqh _44c8_s0_p9_1.vqh\
-	_44c8_s0_p9_2.vqh _44c8_short.vqh _44c9_long.vqh\
-	_44c9_s0_p1_0.vqh _44c9_s0_p1_1.vqh _44c9_s0_p2_0.vqh\
-	_44c9_s0_p2_1.vqh _44c9_s0_p3_0.vqh _44c9_s0_p4_0.vqh\
-	_44c9_s0_p5_0.vqh _44c9_s0_p6_0.vqh _44c9_s0_p6_1.vqh\
-	_44c9_s0_p7_0.vqh _44c9_s0_p7_1.vqh _44c9_s0_p8_0.vqh\
-	_44c9_s0_p8_1.vqh _44c9_s0_p9_0.vqh _44c9_s0_p9_1.vqh\
-	_44c9_s0_p9_2.vqh _44c9_short.vqh
+EXTRA_DIST = res_books_44c.h
\ No newline at end of file

<p><p>1.2       +13762 -0  vorbis/lib/books/coupled/res_books_44c.h

<p><p><p>1.2       +1 -14     vorbis/lib/books/floor/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/books/floor/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.am	2001/12/31 23:54:34	1.1
+++ Makefile.am	2002/06/28 22:19:51	1.2
@@ -2,17 +2,4 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-EXTRA_DIST = line_1024x31_0sub0.vqh line_1024x31_0sub1.vqh\
-	line_1024x31_1sub0.vqh line_1024x31_1sub1.vqh line_1024x31_2sub1.vqh\
-	line_1024x31_2sub2.vqh line_1024x31_2sub3.vqh line_1024x31_3sub1.vqh\
-	line_1024x31_3sub2.vqh line_1024x31_3sub3.vqh line_1024x31_class0.vqh\
-	line_1024x31_class1.vqh line_1024x31_class2.vqh line_1024x31_class3.vqh\
-	line_128x19_0sub0.vqh line_128x19_1sub1.vqh line_128x19_1sub2.vqh\
-	line_128x19_1sub3.vqh line_128x19_2sub1.vqh line_128x19_2sub2.vqh\
-	line_128x19_2sub3.vqh line_128x19_class1.vqh line_128x19_class2.vqh\
-	line_128x7_0sub0.vqh line_128x7_1sub1.vqh line_128x7_1sub2.vqh\
-	line_128x7_1sub3.vqh line_128x7_2sub1.vqh line_128x7_2sub2.vqh\
-	line_128x7_2sub3.vqh line_128x7_class1.vqh line_128x7_class2.vqh\
-	line_128x9_0sub0.vqh line_128x9_1sub1.vqh line_128x9_1sub2.vqh\
-	line_128x9_1sub3.vqh line_128x9_2sub1.vqh line_128x9_2sub2.vqh\
-	line_128x9_2sub3.vqh line_128x9_class1.vqh line_128x9_class2.vqh
+EXTRA_DIST = floor_books.h

<p><p>1.2       +992 -0    vorbis/lib/books/floor/floor_books.h

<p><p><p>1.2       +1 -16     vorbis/lib/books/uncoupled/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/books/uncoupled/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.am	2001/12/31 23:54:35	1.1
+++ Makefile.am	2002/06/28 22:19:53	1.2
@@ -2,19 +2,4 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-EXTRA_DIST = _44u0_p0_r0.vqh _44u0_p0_r1.vqh _44u0_p1_0.vqh\
-	_44u0_p1_r0.vqh _44u0_p1_r1.vqh _44u0_p2_0.vqh _44u0_p3_0.vqh\
-	_44u0_p4_0.vqh _44u0_p4_1.vqh _44u0_p5_0.vqh\
-	_44u0_p6_0.vqh _44u0_p7_0.vqh _44u0_p7_1.vqh\
-	_44u0_p7_2.vqh _44u4_p0_r0.vqh _44u4_p0_r1.vqh\
-	_44u4_p1_0.vqh _44u4_p1_r0.vqh _44u4_p1_r1.vqh\
-	_44u4_p2_0.vqh _44u4_p3_0.vqh _44u4_p4_0.vqh\
-	_44u4_p5_0.vqh _44u4_p6_0.vqh _44u4_p7_0.vqh\
-	_44u4_p7_1.vqh _44u4_p8_0.vqh _44u4_p8_1.vqh\
-	_44u4_p9_0.vqh _44u4_p9_1.vqh _44u4_p9_2.vqh\
-	_44u7_p0_r0.vqh _44u7_p0_r1.vqh _44u7_p1_0.vqh\
-	_44u7_p1_r0.vqh _44u7_p1_r1.vqh _44u7_p2_0.vqh\
-	_44u7_p2_1.vqh _44u7_p3_0.vqh _44u7_p4_0.vqh\
-	_44u7_p5_0.vqh _44u7_p6_0.vqh _44u7_p7_0.vqh\
-	_44u7_p7_1.vqh _44u7_p8_0.vqh _44u7_p8_1.vqh\
-	_44u7_p9_0.vqh _44u7_p9_1.vqh _44u7_p9_2.vqh
+EXTRA_DIST =
\ No newline at end of file

<p><p>1.8       +1 -1      vorbis/lib/modes/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.am	2001/12/12 09:45:55	1.7
+++ Makefile.am	2002/06/28 22:19:54	1.8
@@ -2,4 +2,4 @@
 
 AUTOMAKE_OPTIONS = foreign
 
-EXTRA_DIST = floor_44.h psych_44.h residue_44.h
+EXTRA_DIST = floor_44.h psych_44.h residue_44.h setup_44.h

<p><p>1.3       +137 -139  vorbis/lib/modes/floor_44.h

Index: floor_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/floor_44.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- floor_44.h	2001/12/12 09:45:55	1.2
+++ floor_44.h	2002/06/28 22:19:54	1.3
@@ -11,174 +11,172 @@
  ********************************************************************
 
  function: key floor settings for 44.1/48kHz
- last mod: $Id: floor_44.h,v 1.2 2001/12/12 09:45:55 xiphmont Exp $
+ last mod: $Id: floor_44.h,v 1.3 2002/06/28 22:19:54 xiphmont Exp $
 
  ********************************************************************/
 
 #include "vorbis/codec.h"
 #include "backends.h"
+#include "books/floor/floor_books.h"
 
-#include "books/floor/line_128x7_class1.vqh"
-#include "books/floor/line_128x7_class2.vqh"
-
-#include "books/floor/line_128x7_0sub0.vqh"
-#include "books/floor/line_128x7_1sub1.vqh"
-#include "books/floor/line_128x7_1sub2.vqh"
-#include "books/floor/line_128x7_1sub3.vqh"
-#include "books/floor/line_128x7_2sub1.vqh"
-#include "books/floor/line_128x7_2sub2.vqh"
-#include "books/floor/line_128x7_2sub3.vqh"
-
-#include "books/floor/line_128x9_class1.vqh"
-#include "books/floor/line_128x9_class2.vqh"
-
-#include "books/floor/line_128x9_0sub0.vqh"
-#include "books/floor/line_128x9_1sub1.vqh"
-#include "books/floor/line_128x9_1sub2.vqh"
-#include "books/floor/line_128x9_1sub3.vqh"
-#include "books/floor/line_128x9_2sub1.vqh"
-#include "books/floor/line_128x9_2sub2.vqh"
-#include "books/floor/line_128x9_2sub3.vqh"
-
-#include "books/floor/line_128x19_class1.vqh"
-#include "books/floor/line_128x19_class2.vqh"
-
-#include "books/floor/line_128x19_0sub0.vqh"
-#include "books/floor/line_128x19_1sub1.vqh"
-#include "books/floor/line_128x19_1sub2.vqh"
-#include "books/floor/line_128x19_1sub3.vqh"
-#include "books/floor/line_128x19_2sub1.vqh"
-#include "books/floor/line_128x19_2sub2.vqh"
-#include "books/floor/line_128x19_2sub3.vqh"
-
-#include "books/floor/line_1024x31_class0.vqh"
-#include "books/floor/line_1024x31_class1.vqh"
-#include "books/floor/line_1024x31_class2.vqh"
-#include "books/floor/line_1024x31_class3.vqh"
-
-#include "books/floor/line_1024x31_0sub0.vqh"
-#include "books/floor/line_1024x31_0sub1.vqh"
-#include "books/floor/line_1024x31_1sub0.vqh"
-#include "books/floor/line_1024x31_1sub1.vqh"
-#include "books/floor/line_1024x31_2sub1.vqh"
-#include "books/floor/line_1024x31_2sub2.vqh"
-#include "books/floor/line_1024x31_2sub3.vqh"
-#include "books/floor/line_1024x31_3sub1.vqh"
-#include "books/floor/line_1024x31_3sub2.vqh"
-#include "books/floor/line_1024x31_3sub3.vqh"
-
+static static_codebook *_floor_44_128x4_books[]={
+  &_huff_book_line_128x4_class0,
+  &_huff_book_line_128x4_0sub0,
+  &_huff_book_line_128x4_0sub1,
+  &_huff_book_line_128x4_0sub2,
+  &_huff_book_line_128x4_0sub3,
+};
 static static_codebook *_floor_44_128x7_books[]={
+  &_huff_book_line_128x7_class0,
   &_huff_book_line_128x7_class1,
-  &_huff_book_line_128x7_class2,
   
-  &_huff_book_line_128x7_0sub0,
+  &_huff_book_line_128x7_0sub1,
+  &_huff_book_line_128x7_0sub2,
+  &_huff_book_line_128x7_0sub3,
   &_huff_book_line_128x7_1sub1,
   &_huff_book_line_128x7_1sub2,
-  &_huff_book_line_128x7_1sub3,
-  &_huff_book_line_128x7_2sub1,
-  &_huff_book_line_128x7_2sub2,
-  &_huff_book_line_128x7_2sub3, 
-};
-static static_codebook *_floor_44_128x9_books[]={
-  &_huff_book_line_128x9_class1,
-  &_huff_book_line_128x9_class2,
+  &_huff_book_line_128x7_1sub3, 
+};
+static static_codebook *_floor_44_128x11_books[]={
+  &_huff_book_line_128x11_class1,
+  &_huff_book_line_128x11_class2,
+  &_huff_book_line_128x11_class3,
   
-  &_huff_book_line_128x9_0sub0,
-  &_huff_book_line_128x9_1sub1,
-  &_huff_book_line_128x9_1sub2,
-  &_huff_book_line_128x9_1sub3,
-  &_huff_book_line_128x9_2sub1,
-  &_huff_book_line_128x9_2sub2,
-  &_huff_book_line_128x9_2sub3, 
-};
-static static_codebook *_floor_44_128x19_books[]={
-  &_huff_book_line_128x19_class1,
-  &_huff_book_line_128x19_class2,
+  &_huff_book_line_128x11_0sub0,
+  &_huff_book_line_128x11_1sub0,
+  &_huff_book_line_128x11_1sub1,
+  &_huff_book_line_128x11_2sub1,
+  &_huff_book_line_128x11_2sub2,
+  &_huff_book_line_128x11_2sub3, 
+  &_huff_book_line_128x11_3sub1,
+  &_huff_book_line_128x11_3sub2,
+  &_huff_book_line_128x11_3sub3, 
+};
+static static_codebook *_floor_44_128x17_books[]={
+  &_huff_book_line_128x17_class1,
+  &_huff_book_line_128x17_class2,
+  &_huff_book_line_128x17_class3,
   
-  &_huff_book_line_128x19_0sub0,
-  &_huff_book_line_128x19_1sub1,
-  &_huff_book_line_128x19_1sub2,
-  &_huff_book_line_128x19_1sub3,
-  &_huff_book_line_128x19_2sub1,
-  &_huff_book_line_128x19_2sub2,
-  &_huff_book_line_128x19_2sub3, 
-};
-
-static static_codebook **_floor_44_128_books[3]={
+  &_huff_book_line_128x17_0sub0,
+  &_huff_book_line_128x17_1sub0,
+  &_huff_book_line_128x17_1sub1,
+  &_huff_book_line_128x17_2sub1,
+  &_huff_book_line_128x17_2sub2,
+  &_huff_book_line_128x17_2sub3, 
+  &_huff_book_line_128x17_3sub1,
+  &_huff_book_line_128x17_3sub2,
+  &_huff_book_line_128x17_3sub3, 
+};
+static static_codebook *_floor_44_1024x27_books[]={
+  &_huff_book_line_1024x27_class1,
+  &_huff_book_line_1024x27_class2,
+  &_huff_book_line_1024x27_class3,
+  &_huff_book_line_1024x27_class4,
+  
+  &_huff_book_line_1024x27_0sub0,
+  &_huff_book_line_1024x27_1sub0,
+  &_huff_book_line_1024x27_1sub1,
+  &_huff_book_line_1024x27_2sub0,
+  &_huff_book_line_1024x27_2sub1,
+  &_huff_book_line_1024x27_3sub1,
+  &_huff_book_line_1024x27_3sub2,
+  &_huff_book_line_1024x27_3sub3,
+  &_huff_book_line_1024x27_4sub1,
+  &_huff_book_line_1024x27_4sub2,
+  &_huff_book_line_1024x27_4sub3,
+};
+
+static static_codebook **_floor_44_books[9]={
+  _floor_44_128x4_books,
+  _floor_44_128x4_books,
+  _floor_44_128x7_books,
   _floor_44_128x7_books,
-  _floor_44_128x9_books,
-  _floor_44_128x19_books,
+  _floor_44_128x11_books,
+  _floor_44_128x17_books,
+  _floor_44_128x17_books,
+  _floor_44_1024x27_books,
+  _floor_44_1024x27_books
 };
 
-static static_codebook *_floor_44_1024x31_books[]={
-    &_huff_book_line_1024x31_class0,
-    &_huff_book_line_1024x31_class1,
-    &_huff_book_line_1024x31_class2,
-    &_huff_book_line_1024x31_class3,
-    
-    &_huff_book_line_1024x31_0sub0,
-    &_huff_book_line_1024x31_0sub1,
-    &_huff_book_line_1024x31_1sub0, 
-    &_huff_book_line_1024x31_1sub1,
-    &_huff_book_line_1024x31_2sub1,  
-    &_huff_book_line_1024x31_2sub2,
-    &_huff_book_line_1024x31_2sub3, 
-    &_huff_book_line_1024x31_3sub1,
-    &_huff_book_line_1024x31_3sub2,
-    &_huff_book_line_1024x31_3sub3,
-};
+static vorbis_info_floor1 _floor_44[9]={
+  /* 128 x 4 */
+  {
+    1,{0},{4},{2},{0},
+    {{1,2,3,4}},
+    4,{0,128, 33,8,16,70},
 
-static static_codebook **_floor_44_1024_books[1]={
-  _floor_44_1024x31_books
-};
+    60,30,500,   0.,18.,  -1
+  },
+  /* 256 x 4 */
+  {
+    1,{0},{4},{2},{0},
+    {{1,2,3,4}},
+    4,{0,256, 66,16,32,140},
 
-static vorbis_info_floor1 _floor_44_128[3]={
+    60,30,500,   0.,18.,  -1
+  },
+  /* 128 x 7 */
   {
-    3,{0,1,2},{1,3,3},{0,2,2},{-1,0,1},
-    {{2},{-1,3,4,5},{-1,6,7,8}},
-    4,{0,128, 7, 2,1,4, 23,13,45},
+    2,{0,1},{3,4},{2,2},{0,1},
+    {{-1,2,3,4},{-1,5,6,7}},
+    4,{0,128, 14,4,58, 2,8,28,90},
     
-    60,30,500,
-    999,999,0,18.,
-    8,70,
-    -1 /* lowpass! */
+    60,30,500,   0.,18.,  -1
   },
-
+  /* 256 x 7 */
   {
-    3,{0,1,2},{1,4,4},{0,2,2},{-1,0,1},
-    {{2},{-1,3,4,5},{-1,6,7,8}},
-    4,{0,128, 13, 4,2,7,1,  44,30,62,20},
+    2,{0,1},{3,4},{2,2},{0,1},
+    {{-1,2,3,4},{-1,5,6,7}},
+    4,{0,256, 28,8,116, 4,16,56,180},
     
-    60,30,500,
-    999,999,0,18.,
-    8,70,
-    -1 /* lowpass! */
+    60,30,500,   0.,18.,  -1
   },
 
-
+  /* 128 x 11 */
   {
-    6,{0,1,1,1,2,2},{4,3,3},{0,2,2},{-1,0,1},
-    {{2},{-1,3,4,5},{-1,6,7,8}},
-    2,{0,128, 6,17,30,58, 2,1,4, 11,8,14, 23,20,26, 41,35,48, 84,69,103},
+    4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
+    {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
     
-    60,30,500,
-    999,999,1,18.,
-    8,70,
-    -1 /* lowpass */
-  }
-};
-
-static vorbis_info_floor1 _floor_44_1024[1]={
+    2,{0,128,  8,33,  4,16,70,  2,6,12,  23,46,90},
+    
+     60,30,500,   0,18.,  -1
+  },
+    
+  /* 128 x 17 */
   {
-    10,{0,1,2,2,2,2,2, 3,3,3},{3,4,3,3},{1,1,2,2},{0,1,2,3},
-    {{4,5},{6,7},{-1,8,9,10},{-1,11,12,13}},
-    2,{0,1024, 88,31,243, 14,54,143,460, 6,3,10, 22,18,26, 41,36,47, 
-       69,61,78, 112,99,126, 185,162,211, 329,282,387, 672,553,825},
+    6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
+    {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
+    2,{0,128,  12,46,  4,8,16,  23,33,70,  2,6,10,  14,19,28,  39,58,90},
+
+    60,30,500,    0,18.,  -1 
+  },
   
-    60,30,400,
-    20,8,1,18.,
-    20,600,
-    -1 /* lowpass */
+  /* 1024 x 17 */
+  {
+    6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
+    {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
+    2,{0,1024,  93,372,  33,65,130,  186,260,556,  
+       14,46,79,  111,158,220,  312,464,720},
+    
+    60,30,500,    0,18.,  -1 /* lowpass! */
+  },
+  /* 1024 x 27 */
+  {
+    8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
+    {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
+    2,{0,1024,   93,23,372, 6,46,186,750,  14,33,65, 130,260,556,
+       3,10,18,28,  39,55,79,111,  158,220,312,  464,650,850},
+    
+    60,30,500,    3,18.,  -1 /* lowpass */
+  },
+  /* 2048 x 27 */
+  {
+    8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
+    {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
+    2,{0,2048,   186,46,744, 12,92,372,1500,  28,66,130, 260,520,1112,
+       6,20,36,56,  78,110,158,222,  316,440,624,  928,1300,1700},
+    
+    60,30,500,    3,18.,  -1 /* lowpass */
   }
 };
 

<p><p>1.16      +404 -584  vorbis/lib/modes/psych_44.h

Index: psych_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/psych_44.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- psych_44.h	2002/04/08 21:12:38	1.15
+++ psych_44.h	2002/06/28 22:19:54	1.16
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.15 2002/04/08 21:12:38 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.16 2002/06/28 22:19:54 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,635 +23,455 @@
   {8,   /* lines per eighth octave */
    {20.f,14.f,12.f,12.f,12.f,12.f,12.f}, 
    {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 2,-75.f,
-   -6.f, 0,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
    {14.f,10.f,10.f,10.f,10.f,10.f,10.f}, 
    {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f,-25.f}, 2,-80.f,
-   -6.f, 0,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
    {12.f,10.f,10.f,10.f,10.f,10.f,10.f}, 
    {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f,-15.f}, 0,-80.f,
-   -6.f, 0,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
    {10.f,8.f,8.f,8.f,8.f,8.f,8.f}, 
    {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-80.f,
-   -6.f, 0,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
    {10.f,6.f,6.f,6.f,6.f,6.f,6.f}, 
    {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f,
-   -6.f, 0,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
 };
 
 /* noise compander lookups * low, mid, high quality ****************/
-
-static float _psy_compand_44_short[3][NOISE_COMPAND_LEVELS]={
-  /* sub-mode Z */
-  {
-    0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f,  7.f,     /* 7dB */
-    8.f, 9.f,10.f,11.f,12.f,13.f,14.f, 15.f,     /* 15dB */
-    16.f,17.f,18.f,19.f,20.f,21.f,22.f, 23.f,     /* 23dB */
-    24.f,25.f,26.f,27.f,28.f,29.f,30.f, 31.f,     /* 31dB */
-    32.f,33.f,34.f,35.f,36.f,37.f,38.f, 39.f,     /* 39dB */
-  },
-  /* mode_Z nominal */
-  {
-     0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f,  6.f,     /* 7dB */
-     7.f, 7.f, 7.f, 7.f, 6.f, 6.f, 6.f,  7.f,     /* 15dB */
-     7.f, 8.f, 9.f,10.f,11.f,12.f,13.f, 14.f,     /* 23dB */
-    15.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f,     /* 31dB */
-    19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f,     /* 39dB */
-  },
-  /* mode A */
-  {
-    0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 5.f,  5.f,     /* 7dB */
-    6.f, 6.f, 6.f, 5.f, 4.f, 4.f, 4.f,  4.f,     /* 15dB */
-    4.f, 4.f, 5.f, 5.f, 5.f, 6.f, 6.f,  6.f,     /* 23dB */
-    7.f, 7.f, 7.f, 8.f, 8.f, 8.f, 9.f, 10.f,     /* 31dB */
-    11.f,12.f,13.f,14.f,15.f,16.f,17.f, 18.f,     /* 39dB */
-  }
-};
-
-static float _psy_compand_44[3][NOISE_COMPAND_LEVELS]={
-  /* sub-mode Z */
-  {
-     0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f,  7.f,     /* 7dB */
-     8.f, 9.f,10.f,11.f,12.f,13.f,14.f, 15.f,     /* 15dB */
-    16.f,17.f,18.f,19.f,20.f,21.f,22.f, 23.f,     /* 23dB */
-    24.f,25.f,26.f,27.f,28.f,29.f,30.f, 31.f,     /* 31dB */
-    32.f,33.f,34.f,35.f,36.f,37.f,38.f, 39.f,     /* 39dB */
-  },
-  /* mode_Z nominal */
-  {
-    0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f,  7.f,     /* 7dB */
-    8.f, 9.f,10.f,11.f,12.f,12.f,13.f, 13.f,     /* 15dB */
-    13.f,14.f,14.f,14.f,15.f,15.f,15.f, 15.f,     /* 23dB */
-    16.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f,     /* 31dB */
-    19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f,     /* 39dB */
-  },
-  /* mode A */
-  {
-    0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f,  7.f,     /* 7dB */
-    8.f, 8.f, 7.f, 6.f, 5.f, 4.f, 4.f,  4.f,     /* 15dB */
-    4.f, 4.f, 5.f, 5.f, 5.f, 6.f, 6.f,  6.f,     /* 23dB */
-    7.f, 7.f, 7.f, 8.f, 8.f, 8.f, 9.f, 10.f,     /* 31dB */
-    11.f,12.f,13.f,14.f,15.f,16.f,17.f, 18.f,     /* 39dB */
-  }
+static compandblock _psy_compand_44[6]={
+  /* sub-mode Z short */
+  {{
+    0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+    8, 9,10,11,12,13,14, 15,     /* 15dB */
+    16,17,18,19,20,21,22, 23,     /* 23dB */
+    24,25,26,27,28,29,30, 31,     /* 31dB */
+    32,33,34,35,36,37,38, 39,     /* 39dB */
+  }},
+  /* mode_Z nominal short*/
+  {{
+     0, 1, 2, 3, 4, 5, 6,  6,     /* 7dB */
+     7, 7, 7, 7, 6, 6, 6,  7,     /* 15dB */
+     7, 8, 9,10,11,12,13, 14,     /* 23dB */
+    15,16,17,17,17,18,18, 19,     /* 31dB */
+    19,19,20,21,22,23,24, 25,     /* 39dB */
+  }},
+  /* mode A short */
+  {{
+    0, 1, 2, 3, 4, 5, 5,  5,     /* 7dB */
+    6, 6, 6, 5, 4, 4, 4,  4,     /* 15dB */
+    4, 4, 5, 5, 5, 6, 6,  6,     /* 23dB */
+    7, 7, 7, 8, 8, 8, 9, 10,     /* 31dB */
+    11,12,13,14,15,16,17, 18,     /* 39dB */
+  }},
+  /* sub-mode Z long */
+  {{
+     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+     8, 9,10,11,12,13,14, 15,     /* 15dB */
+    16,17,18,19,20,21,22, 23,     /* 23dB */
+    24,25,26,27,28,29,30, 31,     /* 31dB */
+    32,33,34,35,36,37,38, 39,     /* 39dB */
+  }},
+  /* mode_Z nominal long */
+  {{
+    0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+    8, 9,10,11,12,12,13, 13,     /* 15dB */
+    13,14,14,14,15,15,15, 15,     /* 23dB */
+    16,16,17,17,17,18,18, 19,     /* 31dB */
+    19,19,20,21,22,23,24, 25,     /* 39dB */
+  }},
+  /* mode A long */
+  {{
+    0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+    8, 8, 7, 6, 5, 4, 4,  4,     /* 15dB */
+    4, 4, 5, 5, 5, 6, 6,  6,     /* 23dB */
+    7, 7, 7, 8, 8, 8, 9, 10,     /* 31dB */
+    11,12,13,14,15,16,17, 18,     /* 39dB */
+  }}
 };
 
 /* tonal masking curve level adjustments *************************/
-static vp_adjblock _vp_tonemask_adj_longblock[6]={
+static vp_adjblock _vp_tonemask_adj_longblock[11]={
   /* adjust for mode zero */
-  {{
-    { 10, 10,  5,                               }, /*63*/
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 125 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 250 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 500 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 1000 */
-    { 10, 10,  5,                               }, 
-
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 2000 */
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 4000 */
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 8000 */
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, 
-    { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /* 16000 */
-  }},
-
-  /* adjust for mode two */
-  {{
-    { 10, 10,  5,                               }, /*63*/
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 125 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 250 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 500 */
-    { 10, 10,  5,                               }, 
-    { 10, 10,  5,                               }, /* 1000 */
-    { 10, 10,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    { 10,  5,  5,                               }, /* 4000 */
-    { 10, 10,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  7,  5,  5, 10, 10, 10,  5,   }, 
-    { 16, 16, 14,  8,  8,  8, 10, 10, 10,  5,   }, /* 16000 */
-  }},
-
-  /* adjust for mode four */
-  {{
-    { 10,  5,  5,                               }, /*63*/
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 125 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 250 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 500 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 1000 */
-    { 10,  5,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    { 10,  5,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  5,  5,  5, 10, 10, 10,  5,   }, 
-    { 16, 16, 14,  8,  8,  8, 10, 10, 10,  5,   }, /* 16000 */
-  }},
-
-  /* adjust for mode six */
-  {{
-    { 10,  5,  5,                               }, /*63*/
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 125 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 250 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 500 */
-    { 10,  5,  5,                               }, 
-    { 10,  5,  5,                               }, /* 1000 */
-    { 10,  5,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    { 10,  5,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  5,  5,  5,  5,  5,  5,       }, 
-    { 12, 10, 10,  5,  5,  5,  5,  5,  5,       }, /* 16000 */
-  }},
-
-  /* adjust for mode eight */
-  {{
-    {  0,                                       }, /*63*/
-    {  0,                                       }, 
-    {  0,                                       }, /* 125 */
-    {  0,                                       }, 
-    {  0,                                       }, /* 250 */
-    {  0,                                       }, 
-    {  0,                                       }, /* 500 */
-    {  0,                                       }, 
-    {  0,                                       }, /* 1000 */
-    {  0,                                       }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    {  0,                                       },
-    {  0,                                       }, /* 8000 */
-    {  0,                                       }, 
-    {  5,  5,  5,  5,  5,  5,  5,               }, /* 16000 */
-  }},
-
-  /* adjust for mode ten */
-  {{
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15},
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*1000*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/
-    {  0,  0,  0, -5,-10,-10,-10,-15,-15,-15,-15}, 
-    {  0,  0,  0,  0,  0, -5, -5,-10,-15,-15,-15}, /*16000*/
-  }},
+  /* 63     125     250     500     1     2     4     8    16 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 1 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
+  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
 };
-
-static vp_adjblock _vp_tonemask_adj_otherblock[6]={
+static vp_adjblock _vp_tonemask_adj_otherblock[11]={
   /* adjust for mode zero */
-  {{
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*63*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*125*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*250*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  5,  5,  5,  0, -5, -5, -5, -5, -5, -5, -5}, /*500*/
-    {  5,  5,  5,  0, -5, -5, -5, -5, -5, -5, -5},
-
-    {  5,  5,  5,                               }, /*1000*/
-    {  5,  5,  5,                               }, 
-
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*2000*/
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, 
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*4000*/
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, 
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*8000*/
-    { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, 
-    { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /*16000*/
-  }},
-
-  /* adjust for mode two */
-  {{
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*63*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*125*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, /*250*/
-    {  0,  0,  0,  0,-10,-10,-10,-10,-10,-10,-10}, 
-    {  5,  5,  5,  0, -5, -5, -5, -5, -5, -5, -5}, /*500*/
-    {  5,  5,  5,  0, -5, -5, -5, -5, -5, -5, -5},
-
-    { 10, 10,  5,                               }, /* 1000 */
-    { 10, 10,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    { 10,  5,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  7,  5,  5, 10, 10, 10,  5,   }, 
-    { 16, 16, 14,  8,  8,  8, 10, 10, 10,  5,   }, /* 16000 */
-  }},
-
-  /* adjust for mode four */
-  {{
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-
-    {  5,  5,  5,                               }, /* 1000 */
-    {  5,  5,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    { 10,  5,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  5,  5,  5, 10, 10, 10,  5,   }, 
-    { 16, 16, 14,  8,  8,  8, 10, 10, 10,  5,   }, /* 16000 */
-  }},
-
-  /* adjust for mode six */
-  {{
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-
-    {  5,  5,  5,                               }, /* 1000 */
-    {  5,  5,  5,                               }, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    { 10,  5,  5,                               },
-    { 10, 10,  7,  5,                           }, /* 8000 */
-    { 10, 10,  7,  5,  5,  5,  5,  5,  5,       }, 
-    { 12, 10, 10,  5,  5,  5,  5,  5,  5,       }, /* 16000 */
-  }},
-
-  /* adjust for mode eight */
-  {{
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*63*/
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, 
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*125*/
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, 
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*250*/
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, 
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*500*/
-    {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, 
-
-    {  0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15}, 
-
-    {  0,                                       }, /* 2000 */
-    {  0,                                       },
-    {  0,                                       }, /* 4000 */
-    {  0,                                       },
-    {  0,                                       }, /* 8000 */
-    {  0,                                       }, 
-    {  5,  5,  5,  5,  5,  5,  5,               }, /* 16000 */
-  }},
-
-  /* adjust for mode ten */
-  {{
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, /*63*/
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, 
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, /*125*/
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, 
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, /*250*/
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20},
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, /*500*/
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, 
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, /*1000*/
-    {  0,  0,  0, -5,-15,-20,-20,-20,-20,-20,-20}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, 
-    {  0,  0,  0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/
-    {  0,  0,  0, -5,-10,-10,-10,-15,-15,-15,-15}, 
-    {  0,  0,  0,  0,  0, -5, -5,-10,-15,-15,-15}, /*16000*/
-  }},
+  /* 63     125     250     500       1     2     4     8    16 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 1 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
+  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
+};
+
+static noise3 _psy_noisebias_trans[11]={
+  /*  63     125     250     500      1k       2k      4k      8k     16k*/
+  /* 0 */
+  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  0,  0,  0,  2,  4,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},
+  /* 1 */
+  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},
+  /* 2 */
+  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 3 */
+  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  4},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 4 */
+  {{{-20,-20,-20,-20,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  4},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 5 */
+  {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
+    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
+    {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
+  /* 6 */
+  {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4, 7},
+    {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -4, -2,  2},
+    {-34,-34,-34,-34,-30,-26,-24,-18,-17,-15,-15,-15,-15,-13,-13,-12, -8}}},
+  /* 7 */
+  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-32,-32,-32,-32,-28,-24,-24,-18,-14,-12,-10, -8, -8, -8, -6, -4,  0},
+    {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},
+  /* 8 */
+  {{{-26,-26,-26,-26,-26,-26,-20,-14,-10, -2, -2, -2, -2, -1,  0,  1,  5},
+    {-36,-36,-36,-36,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
+    {-36,-36,-36,-36,-34,-30,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
+  /* 9 */
+  {{{-30,-30,-30,-30,-30,-30,-30,-22,-16,-10, -6, -6, -6, -6, -6, -4, -2},
+    {-40,-40,-40,-40,-35,-35,-35,-29,-23,-19,-17,-15,-15,-15,-13,-11, -7},
+    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
+  /* 10 */
+  {{{-30,-30,-30,-30,-30,-30,-30,-28,-20,-14,-14,-14,-14,-14,-14,-12,-10},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-20},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
+};
+
+static noise3 _psy_noisebias_long[11]={
+    /*63     125     250     500      1k       2k      4k      8k     16k*/
+  /* 0 */
+  {{{-10,-10,-10,-10,-10,-10, -8, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2,  0,  0,  0,  0,  2,  4,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
+  /* 1 */
+  {{{-10,-10,-10,-10,-10,-10, -8, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
+    {-20,-20,-20,-20,-20,-20,-20,-14, -8, -8, -8, -8, -8, -6, -6, -6, -4}}},
+  /* 2 */
+  {{{-10,-10,-10,-10,-10,-10,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 3 */
+  {{{-10,-10,-10,-10,-10,-10,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  4},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 4 */
+  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  4},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+  /* 5 */
+  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
+    {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -2,  0,  2},
+    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
+  /* 6 */
+  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
+    {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -6, -6, -6, -6, -4, -2,  2},
+    {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12, -8}}},
+  /* 7 */
+  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  0,  0,  0,  0,  1,  2,  3,  7},
+    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-10, -8, -8, -8, -8, -6, -4,  0},
+    {-26,-26,-26,-26,-26,-26,-26,-22,-20,-19,-19,-19,-19,-18,-17,-16,-12}}},
+  /* 8 */
+  {{{-20,-20,-20,-20,-20,-20,-20,-14, -8, -2, -2, -2, -2, -1,  0,  1,  5},
+    {-26,-26,-26,-26,-26,-26,-26,-20,-16,-12,-10,-10,-10,-10, -8, -6, -2},
+    {-28,-28,-28,-28,-28,-28,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
+  /* 9 */
+  {{{-24,-24,-24,-24,-24,-24,-24,-20,-16,-10, -6, -6, -6, -6, -6, -4, -2},
+    {-30,-30,-30,-30,-30,-30,-30,-25,-21,-17,-15,-15,-15,-15,-13,-11, -7},
+    {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
+  /* 10 */
+  {{{-24,-24,-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-14,-14,-14,-12,-10},
+    {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-20},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
+};
+
+static noise3 _psy_noisebias_impulse[11]={
+  /*  63     125     250     500      1k      2k      4k      8k     16k*/
+  /* 0 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  4,  4,  5,  5,  5,  5,  10},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -2,  2,  2,  4,  4,  5,   8},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4,  -2}}},
+  /* 1 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  4,  4,  5,  5,  5,  5,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4,  0,  0,  0,  0,  0,  4},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8,-10,-10, -8, -8, -8, -6, -4}}},
+  /* 2 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  2,  2,  2,  2,  3,  4,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4,  0,  0,  0,  0,  0,  4},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
+  /* 3 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  2,  2,  2,  2,  3,  4,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4, -1, -1, -1, -1,  0,  3},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
+  /* 4 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4, -1, -1, -1, -1,  0,  3},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
+  /* 5 */
+  {{{-24,-24,-24,-24,-22,-20,-14,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -8, -6, -3, -3, -3, -2, -1,  2},
+    {-34,-34,-34,-34,-30,-26,-24,-18,-14,-12,-12,-12,-12,-12,-10, -9, -5}}},
+  /* 6 */
+  {{{-24,-24,-24,-24,-22,-20,-14,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-34,-34,-34,-34,-30,-30,-24,-20,-14,-10, -6, -6, -6, -6, -3, -2,  2},
+    {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},
+  /* 7 */
+  {{{-24,-24,-24,-24,-22,-20,-14,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-34,-34,-34,-34,-30,-30,-30,-24,-16,-12,-10, -8, -8, -8, -7, -6, -2},
+    {-34,-34,-34,-34,-32,-32,-30,-24,-20,-19,-19,-19,-19,-19,-17,-16,-12}}},
+  /* 8 */
+  {{{-28,-28,-28,-28,-26,-22,-20,-14,-10, -2, -2, -2, -2, -1,  0,  1,  5},
+    {-34,-34,-34,-34,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -9, -8, -4},
+    {-36,-36,-36,-36,-36,-34,-28,-24,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
+  /* 9 */
+  {{{-30,-30,-30,-30,-30,-26,-24,-20,-16,-10, -8, -8, -8, -8, -8, -6, -4},
+    {-40,-40,-40,-40,-35,-35,-35,-29,-23,-19,-17,-15,-15,-15,-15,-15,-10},
+    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
+  /* 10 */
+  {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-16,-16,-16,-16,-16,-14,-12},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-20},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
+};
+
+static noise3 _psy_noisebias_padding[11]={
+  /*  63     125     250     500      1k       2k      4k      8k     16k*/
+  /* 0 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  4,  4,  5,  5,  5,  8, 10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  2,  3,  6,  6,  8, 10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -4, -4, -2,  0,  2}}},
+  /* 1 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  4,  4,  5,  5,  5,  8, 10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -6, -4, -2,  0}}},
+  /* 2 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  2,  2,  4,  4,  5,  6,  10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
+  /* 3 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  2,  2,  2,  3,  3,  4,  6,  9},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
+  /* 4 */
+  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  1,  1,  1,  2,  2,  3,  5,  8},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
+  /* 5 */
+  {{{-24,-24,-24,-24,-24,-20,-18,-12, -8, -2,  1,  1,  2,  2,  3,  5,  8},
+    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -3, -3, -3, -3, -2,  0,  4},
+    {-34,-34,-34,-34,-30,-26,-24,-18,-14,-10,-10,-10,-10,-10, -8, -5, -3}}},
+  /* 6 */
+  {{{-24,-24,-24,-24,-24,-20,-18,-12, -8, -2,  1,  1,  2,  2,  3,  5,  8},
+    {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -4, -4, -4, -4, -3, -1,  4},
+    {-34,-34,-34,-34,-34,-30,-26,-20,-16,-13,-13,-13,-13,-13,-11, -8, -6}}},
+  /* 7 */
+  {{{-24,-24,-24,-24,-24,-20,-18,-12, -8, -2,  1,  1,  2,  2,  3,  5,  8},
+    {-34,-34,-34,-34,-30,-30,-30,-24,-16,-10, -8, -6, -6, -6, -5, -3,  1},
+    {-34,-34,-34,-34,-32,-32,-28,-22,-18,-16,-16,-16,-16,-16,-14,-12,-10}}},
+  /* 8 */
+  {{{-28,-28,-28,-28,-26,-22,-20,-14,-10, -4,  0,  0,  0,  0,  1,  3,  6},
+    {-34,-34,-34,-34,-30,-30,-30,-24,-16,-12,-10, -8, -8, -8, -7, -5, -2},
+    {-36,-36,-36,-36,-36,-34,-28,-22,-20,-20,-20,-20,-20,-20,-20,-16,-14}}},
+  /* 9 */
+  {{{-30,-30,-30,-30,-30,-26,-24,-20,-16,-10, -4, -4, -4, -4, -4, -2,  0},
+    {-40,-40,-40,-40,-35,-35,-35,-29,-21,-17,-15,-13,-13,-13,-12,-10, -7},
+    {-40,-40,-40,-40,-40,-40,-40,-32,-26,-24,-24,-24,-24,-24,-24,-20,-18}}},
+  /* 10 */
+  {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-12,-12,-12,-12,-12,-10, -8},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-25,-25,-25,-25,-25,-25,-15},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
+};
+
+static noiseguard _psy_noiseguards_44[4]={
+  {4,4,15},
+  {4,4,15},
+  {10,10,100},
+  {10,10,100},
+};
+
+static int _psy_tone_suppress[11]={
+  -20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
 };
 
-static vp_adjblock _vp_peakguard[6]={
-  /* zero */
-  {{
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*63*/
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*125*/
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*250*/
-    {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},
-    {-10,-10,-10,-10,-16,-16,-18,-20,-22,-24,-24},/*500*/
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*1000*/
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*2000*/
-    {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24},
-    {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24},/*4000*/
-    {-10,-10,-10,-12,-12,-14,-16,-18,-22,-24,-24},
-    {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24},/*8000*/
-    {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24},
-    {-10,-10,-10,-10,-10,-12,-16,-18,-22,-24,-24},/*16000*/
-  }},
-  /* two */
-  {{
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*63*/
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*125*/
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*250*/
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},
-    {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*500*/
-    {-10,-10,-10,-10,-14,-14,-14,-20,-26,-30,-30},
-    {-10,-10,-10,-10,-14,-14,-14,-20,-22,-30,-30},/*1000*/
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*2000*/
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*4000*/
-    {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},
-    {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},/*8000*/
-    {-10,-10,-10,-10,-10,-10,-10,-11,-22,-30,-30},
-    {-10,-10,-10,-10,-10,-10,-10,-10,-20,-30,-30},/*16000*/
-  }},
-  /* four */
-  {{
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/
-    {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},
-    {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},/*250*/
-    {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},
-    {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},/*500*/
-    {-10,-10,-10,-10,-14,-16,-20,-24,-26,-32,-40},
-    {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*1000*/
-    {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},
-    {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*2000*/
-    {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},
-    {-10,-10,-10,-10,-14,-14,-16,-20,-22,-32,-40},/*4000*/
-    {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},
-    {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},/*8000*/
-    {-10,-10,-10,-10,-10,-10,-10,-11,-22,-32,-40},
-    {-10,-10,-10,-10,-10,-10,-10,-10,-20,-32,-40},/*16000*/
-  }},
-  /* six */
-  {{
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*250*/
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},
-    {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*500*/
-    {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},
-    {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},/*1000*/
-    {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},
-    {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*2000*/
-    {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},
-    {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*4000*/
-    {-14,-14,-14,-20,-22,-22,-24,-24,-26,-32,-40},
-    {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},/*8000*/
-    {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},
-    {-14,-14,-14,-18,-20,-20,-22,-24,-24,-32,-40},/*16000*/
-  }},
-  /* eight */
-  {{
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*63*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*88*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*125*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*170*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*250*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*350*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*500*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*700*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1400*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2800*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*4000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*5600*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*8000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*11500*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*16600*/
-  }},
-  /* ten */
-  {{
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*63*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*88*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*125*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*170*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*250*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*350*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*500*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*700*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1400*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2800*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*4000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*5600*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*8000*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*11500*/
-    {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*16600*/
-  }}
-};
-
-static int _psy_noisebias_long[11][17]={
-  /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2,  1,  1,  2,  2,  4},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1,  0,  0,  2},
-
-  {-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2,  0},
-  {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4},
-  {-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-
-  {-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
-  {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
-};
-
-static int _psy_noisebias_impulse[11][17]={
-  /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
-  {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2},
-  {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2},
-
-  {-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-  {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
-
-  {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16},
-  {-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50},
-};
-
-static int _psy_noisebias_other[11][17]={
-  /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10},
-  {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2,  1,  1,  2,  2,  4},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1,  0,  1,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1,  0,  0,  2},
-
-  {-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2,  0},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-
-  {-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
-  {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
-};
-
-static int _psy_noiseguards_short[33]={
-  2,2,-1,
-  4,4,-1,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-  4,4,15,
-};
-static int _psy_noiseguards_long[33]={
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-  10,10,100,
-};
-
-static double _psy_tone_masteratt[11]={
-  3.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
-};
-
-static double _psy_tone_masterguard[11]={
-  -18.,-24.,-24.,-24.,-26.,-40.,-40.,-40.,-45.,-45.,-45.,
-};
-
-static double _psy_tone_suppress[11]={
-  -10.,-20.,-20.,-20.,-30.,-30.,-40.,-40.,-45.,-45.,-45.,
-};
-
-static double _psy_tone_0dB[11]={
-  95.,95.,95.,95.,95.,105.,105.,105.,105.,105.,105.,
-};
-
-static double _psy_noise_suppress[11]={
-   -0.,-24.,-24.,-24.,-24.,-30.,-40.,-40.,-45.,-45.,-45.,
+static int _psy_tone_0dB[11]={
+  95,95,95,95,95,105,105,105,105,105,105,
 };
 
-static int _psy_ehmer_bandlimit[11]={
-  0,0,0,0,4,4,30,30,30,30,30,
+static int _psy_noise_suppress[11]={
+ -24,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
 };
 
 static vorbis_info_psy _psy_info_template={
-    {-1},-110.,-140.,
-    /* tonemask att,guard,suppr,curves  peakattp,curvelimitp,peaksettings*/
-    0.f,            -40.f,-40.f, {{{0.}}},         1,          0,        {{{0.}}},
-    
-    /*noisemaskp,supp, low/high window, low/hi guard, minimum */
-    1,          -0.f,         .5f, .5f,         0,0,0,
-    {-1},{-1},105.f,{{-1,-1,{{-1,-1,-1,-1}}}}
+  -1,
+  -110.,-140.,
+  /* tonemask att boost/decay,suppr,curves */
+  {0.f,0.f,0.f},     0.,0.,    -40.f, {0.},  
+  
+  /*noisemaskp,supp, low/high window, low/hi guard, minimum */
+  1,          -0.f,         .5f, .5f,         0,0,0,
+  {{-1},{-1},{-1}},{-1},105.f,
+
+  0,0,-1,-1,0.,
 };
 
 /* ath ****************/
 
-static double _psy_ath_floater[11]={
-  -100.,-100.,-100.,-100.,-100.,-100.,-105.,-105.,-105.,-110.,-120.,
+static int _psy_ath_floater[11]={
+  -100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
 };
 
-static double _psy_ath_abs[11]={
-  -110.,-110.,-120.,-140.,-140.,-140.,-140.,-140.,-140.,-140.,-150.,
+static int _psy_ath_abs[11]={
+  -110,-110,-120,-130,-140,-140,-140,-140,-140,-140,-150,
 };
 
-static float ATH_Bark_dB[][27]={
-  {
-     0.f,  15.f,  15.f,   15.f,   11.f,       10.f,   8.f,  7.f,   7.f,  7.f,
-     6.f,   2.f,   0.f,    0.f,   -2.f,       -5.f,  -6.f, -6.f,  -4.f,  4.f,
-    14.f,  20.f,  19.f,   17.f,   30.f,       60.f,  70.f,
-  },
-  {
-    0.f,  15.f,  15.f,   15.f,   11.f,       10.f,   8.f,  7.f,   7.f,  7.f,
-    6.f,   2.f,   0.f,    0.f,   -2.f,       -5.f,  -6.f, -6.f,  -4.f,  0.f,
-    2.f,   6.f,   5.f,    5.f,   15.f,       30.f,  50.f,
-  },
-  {
-    0.f,  15.f,  15.f,   15.f,   11.f,       10.f,   8.f,  7.f,   7.f,  7.f,
-    6.f,   2.f,   0.f,    0.f,   -3.f,       -5.f,  -6.f, -6.f, -4.5f, -4.f,
-    2.f,   6.f,   5.f,    5.f,   15.f,       20.f,  40.f,
-  }
-};
-
-/* stereo ****************/
-static int _psy_stereo_point_dB_44[11]={3,  3,  2,  2,   1,  0,  0,  0,  0,  0,  0};
-static double _psy_stereo_point_kHz_44[2][11]={
-  {4., 6., 6., 6., 10., 6., 6., 4., 4., 4., 4.},
-  {6., 6., 6., 10., 10., 6., 6., 4., 4., 4., 4.}
+/* stereo setup.  These don't map directly to quality level, there's
+   an additional indirection as several of the below may be used in a
+   single bitmanaged stream
+
+****************/
+
+/* various stereo possibilities */
+
+/* stereo mode by base quality level */
+static adj_stereo _psy_stereo_modes_44[11]={
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         0  */
+  {{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  5,  4,  3},
+   {  4,  4,  4,  4,  4,  4,  4,  4,  4,  5,  6,  7,  8,  8,  8},
+   {  7,  8, 10, 12, 14, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         1  */
+  {{  4,  4,  4,  4,  4,  4,  3,  3,  2,  1,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  6,  6,  6,  5,  5,  5,  5,  5,  5,  4,  3},
+   {  4,  4,  4,  4,  4,  5,  6,  6,  6,  6,  6,  8,  8,  8,  8},
+   {  8, 10, 12, 14, 15, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         2  */
+  {{  4,  4,  4,  3,  3,  3,  2,  2,  2,  1,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  7,  5,  5,  5,  5,  5,  5,  5,  4,  3,  2,  1},
+   {  4,  4,  4,  4,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
+   { 10, 12, 14, 16, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         3  */
+  {{  3,  3,  3,  3,  3,  3,  2,  1,  1,  0,  0,  0,  0,  0,  0},
+   {  7,  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  3,  2,  1},
+   {  6,  6,  6,  6,  6,  6,  6,  6,  8,  8, 10, 10, 10, 10, 10},
+   { 12, 14, 16, 18, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         4  */
+  {{  3,  3,  3,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  7,  6,  5,  4,  4,  4,  4,  4,  4,  4,  3,  3,  2,  1,  0},
+   {  6,  6,  6,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 14, 15, 16, 18, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         5  */
+  {{  2,  2,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  5,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  2,  1,  0,  0},
+   {  6,  6,  6,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 14, 16, 18, 20, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         6  */
+  {{  2,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  4,  3,  2,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         7  */
+  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  3,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         8  */
+  {{  0,  0,  0,  0,  0,  0,  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,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         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},
+   {  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14        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},
+   {  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+};
+
+/* tone master attenuation by base quality mode and bitrate tweak */
+
+static att3 _psy_tone_masteratt_44[11]={
+  {{ 42,  20,   8}, -6, 1.25}, /* 0 */
+  {{ 38,  14,   4}, -4, 1.25}, /* 1 */
+  {{ 30,  10,  -2},  0,    0}, /* 2 */
+  {{ 25,  10,  -4},  0,    0}, /* 3 */
+  {{ 20,  10,  -4},  0,    0}, /* 4 */
+  {{ 16,   6,  -6},  0,    0}, /* 5 */
+  {{ 16,   3, -10},  0,    0}, /* 6 */
+  {{ 14,   1, -14},  0,    0}, /* 7 */
+  {{ 10,   0, -16},  0,    0}, /* 8 */
+  {{  8,  -2, -16},  0,    0}, /* 9 */
+  {{  2,  -2, -16},  0,    0}, /* 10 */
 };
 
-/* lowpass **************/
+/* lowpass by mode **************/
 static double _psy_lowpass_44[11]={
   15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
 };
 
-/* management noise offset */
+/* noise normalization **********/
 
-static double _bm_max_noise_offset[11]={
-  1.,2.,3.,3.,4.,4.,4.,4.,4.,4.,4.
+static int _noise_start_short_44[10]={
+  16,16,16,16,16,16,16,16,16,16
+};
+static int _noise_start_long_44[10]={
+  128,128,128,128,128,128,128,128,128,128
+};
+static int _noise_part_short_44[10]={
+  8,8,8,8,8,8,8,8,8,8
+};
+static int _noise_part_long_44[10]={
+  32,32,32,32,32,32,32,32,32,32
+};
+static double _noise_thresh_44[10]={
+  .2,.2,.3,.4,.5,.5,.5,.5,.5,.5,
 };

<p><p>1.12      +214 -1350 vorbis/lib/modes/residue_44.h

Index: residue_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/residue_44.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- residue_44.h	2001/12/23 11:53:54	1.11
+++ residue_44.h	2002/06/28 22:19:54	1.12
@@ -11,25 +11,14 @@
  ********************************************************************
 
  function: toplevel residue templates for 32/44.1/48kHz
- last mod: $Id: residue_44.h,v 1.11 2001/12/23 11:53:54 xiphmont Exp $
+ last mod: $Id: residue_44.h,v 1.12 2002/06/28 22:19:54 xiphmont Exp $
 
  ********************************************************************/
 
 #include "vorbis/codec.h"
 #include "backends.h"
+#include "books/coupled/res_books_44c.h"
 
-static bitrate_manager_info _bm_44_default={
-  /* progressive coding and bitrate controls */
-  4.,.0,
-  2.,       0,           0,  
-            0,           0,
-           
-  4.0,2.3, -9999,              .02, 
-
-  3.2,5.0,
-  0.,0.
-};
-
 /***** residue backends *********************************************/
 
 /* the books used depend on stereo-or-not, but the residue setup below
@@ -38,1369 +27,244 @@
    at 1/3 and 1/9, as well as an optional middle pass for stereo
    backfill */
 
-/*     0   1   2   4  26   1   2   4  26   +      
-           0   0   0   0         
-
-       0   1   2   3   4   5   6   7   8   9
-   1                   .               .   .
-   2                   .               .   .
-   4       .   .   .       .   .   .       .
- 
-       0   4   4   4   3   4   4   4   3   7 */
-static vorbis_info_residue0 _residue_44_low={
-  0,-1, -1, 8,-1,
-  {0},
-  {-1},
-  {9999, 9999, 9999, 9999, 9999, 9999, 9999},
-  {  .5,  1.5,  2.5,  4.5, 26.5,  1.5,  4.5},
-  {0},
-  {  99,   -1,   -1,   -1,   -1,   99,   99}
-};
-/* 26 doesn't cascade well; use 28 instead */
-static vorbis_info_residue0 _residue_44_low_un={
-  0,-1, -1, 8,-1,
-  {0},
-  {-1},
-  {9999, 9999, 9999, 9999, 9999, 9999, 9999},
-  {  .5,  1.5,  2.5,  4.5, 28.5,  1.5,  4.5},
-  {0},
-  {  99,   -1,   -1,   -1,   -1,   99,   99}
-};
-
-/*     0   1   2   4   1   2   4  16  42   +      
-           0   0   0            
 
-       0   1   2   3   4   5   6   7   8   9
-   1                               .   .   .
-   2                               .   .   .
-   4       .   .   .   .   .   .           .
- 
-       0   4   4   4   4   4   4   3   3   7 */
 static vorbis_info_residue0 _residue_44_mid={
   0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
+  /*  0     1     2     3     4     5     6     7     8  */
   {0},
   {-1},
-  {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
-  {  .5,  1.5,  1.5,  2.5,  2.5,  4.5,  4.5, 16.5, 42.5},
-  {0},
-  {  99,   -1,   99,   -1,   99,   -1,   99,   99,   99}
+  {  .5,  1.5,  1.5,  2.5,  2.5,  4.5,  8.5,  16.5, 32.5},
+  {  .5,   .5, 999.,   .5,  999., 4.5,  8.5,  16.5, 32.5},
 };
 
-
-/*     0   8  42   1   2   4   8  16  56   +      
-           0   0   0            
-
-       0   1   2   3   4   5   6   7   8   9
-   1           .                   .   .   .
-   2           .                   .   .   .
-   4       .       .   .   .   .           .
- 
-       0   4   3   4   4   4   4   3   3   7 */
 static vorbis_info_residue0 _residue_44_high={
-  0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
-  {0},
-  {-1},
-  {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
-  {  .5,  8.5, 42.5,  1.5,  2.5,  4.5,  8.5, 16.5, 56.5},
-  {0},
-  {  99,   -1,   -1,   99,   99,   99,   99,   99,   99}
-};
-/* 56 doesn't cascade well; use 59 */
-static vorbis_info_residue0 _residue_44_high_un={
   0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
+  /*  0     1     2     3     4     5     6     7     8  */
   {0},
   {-1},
-  {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
-  {  .5,  8.5, 42.5,  1.5,  2.5,  4.5,  8.5, 16.5, 59.5},
-  {0},
-  {  99,   -1,   -1,   99,   99,   99,   99,   99,   99}
+  {  .5,  1.5,  2.5,  4.5,  8.5, 16.5, 32.5, 71.5,157.5},
+  {  .5,  1.5,  2.5,  3.5,  4.5,  8.5, 16.5, 71.5,157.5},
 };
 
-#include "books/coupled/_44c0_short.vqh"
-#include "books/coupled/_44c0_long.vqh"
+/* mapping conventions:
+   only one submap (this would change for efficient 5.1 support for example)*/
+/* Four psychoacoustic profiles are used, one for each blocktype */
+static vorbis_info_mapping0 _map_nominal[2]={
+  {1, {0,0}, {0}, {0}, 1,{0},{1}},
+  {1, {0,0}, {1}, {1}, 1,{0},{1}}
+};
 
-#include "books/coupled/_44c0_s0_p1_0.vqh"
-#include "books/coupled/_44c0_s0_p2_0.vqh"
-#include "books/coupled/_44c0_s0_p3_0.vqh"
-#include "books/coupled/_44c0_s0_p4_0.vqh"
-#include "books/coupled/_44c0_s0_p4_1.vqh"
-#include "books/coupled/_44c0_s0_p5_0.vqh"
-#include "books/coupled/_44c0_s1_p5_0.vqh"
-#include "books/coupled/_44c0_s0_p6_0.vqh"
-#include "books/coupled/_44c0_s1_p6_0.vqh"
-#include "books/coupled/_44c0_s2_p6_0.vqh"
-#include "books/coupled/_44c0_s0_p7_0.vqh"
-#include "books/coupled/_44c0_s0_p7_1.vqh"
-#include "books/coupled/_44c0_s0_p7_2.vqh"
-#include "books/coupled/_44c0_s1_p7_0.vqh"
-#include "books/coupled/_44c0_s1_p7_1.vqh"
-#include "books/coupled/_44c0_s1_p7_2.vqh"
-#include "books/coupled/_44c0_s2_p7_0.vqh"
-#include "books/coupled/_44c0_s2_p7_1.vqh"
-#include "books/coupled/_44c0_s2_p7_2.vqh"
-#include "books/coupled/_44c0_s3_p7_0.vqh"
-#include "books/coupled/_44c0_s3_p7_1.vqh"
-#include "books/coupled/_44c0_s3_p7_2.vqh"
-
-#include "books/coupled/_44c0_s1_p5_s0.vqh"
-#include "books/coupled/_44c0_s1_p6_s0.vqh"
-#include "books/coupled/_44c0_s1_p7_s0.vqh"
-#include "books/coupled/_44c0_s2_p6_s0.vqh"
-#include "books/coupled/_44c0_s2_p7_s0.vqh"
-#include "books/coupled/_44c0_s3_p7_s0.vqh"
-
-#include "books/coupled/_44c0_s0_p0_r0.vqh"
-#include "books/coupled/_44c0_s0_pN_r0.vqh"
-#include "books/coupled/_44c0_s1_pS_r0.vqh"
-#include "books/coupled/_44c0_s0_p0_r1.vqh"
-#include "books/coupled/_44c0_s0_pN_r1.vqh"
-#include "books/coupled/_44c0_s1_pS_r1.vqh"
-
-#include "books/coupled/_44c1_short.vqh"
-#include "books/coupled/_44c1_long.vqh"
-
-#include "books/coupled/_44c1_s0_p1_0.vqh"
-#include "books/coupled/_44c1_s0_p2_0.vqh"
-#include "books/coupled/_44c1_s0_p3_0.vqh"
-#include "books/coupled/_44c1_s0_p4_0.vqh"
-#include "books/coupled/_44c1_s0_p4_1.vqh"
-#include "books/coupled/_44c1_s0_p5_0.vqh"
-#include "books/coupled/_44c1_s1_p5_0.vqh"
-#include "books/coupled/_44c1_s0_p6_0.vqh"
-#include "books/coupled/_44c1_s1_p6_0.vqh"
-#include "books/coupled/_44c1_s2_p6_0.vqh"
-#include "books/coupled/_44c1_s0_p7_0.vqh"
-#include "books/coupled/_44c1_s0_p7_1.vqh"
-#include "books/coupled/_44c1_s0_p7_2.vqh"
-#include "books/coupled/_44c1_s1_p7_0.vqh"
-#include "books/coupled/_44c1_s1_p7_1.vqh"
-#include "books/coupled/_44c1_s1_p7_2.vqh"
-#include "books/coupled/_44c1_s2_p7_0.vqh"
-#include "books/coupled/_44c1_s2_p7_1.vqh"
-#include "books/coupled/_44c1_s2_p7_2.vqh"
-#include "books/coupled/_44c1_s3_p7_0.vqh"
-#include "books/coupled/_44c1_s3_p7_1.vqh"
-#include "books/coupled/_44c1_s3_p7_2.vqh"
-
-#include "books/coupled/_44c2_short.vqh"
-#include "books/coupled/_44c2_long.vqh"
-
-#include "books/coupled/_44c2_s0_p1_0.vqh"
-#include "books/coupled/_44c2_s0_p2_0.vqh"
-#include "books/coupled/_44c2_s0_p3_0.vqh"
-#include "books/coupled/_44c2_s0_p4_0.vqh"
-#include "books/coupled/_44c2_s0_p4_1.vqh"
-#include "books/coupled/_44c2_s0_p5_0.vqh"
-#include "books/coupled/_44c2_s1_p5_0.vqh"
-#include "books/coupled/_44c2_s0_p6_0.vqh"
-#include "books/coupled/_44c2_s1_p6_0.vqh"
-#include "books/coupled/_44c2_s2_p6_0.vqh"
-#include "books/coupled/_44c2_s0_p7_0.vqh"
-#include "books/coupled/_44c2_s0_p7_1.vqh"
-#include "books/coupled/_44c2_s0_p7_2.vqh"
-#include "books/coupled/_44c2_s1_p7_0.vqh"
-#include "books/coupled/_44c2_s1_p7_1.vqh"
-#include "books/coupled/_44c2_s1_p7_2.vqh"
-#include "books/coupled/_44c2_s2_p7_0.vqh"
-#include "books/coupled/_44c2_s2_p7_1.vqh"
-#include "books/coupled/_44c2_s2_p7_2.vqh"
-#include "books/coupled/_44c2_s3_p7_0.vqh"
-#include "books/coupled/_44c2_s3_p7_1.vqh"
-#include "books/coupled/_44c2_s3_p7_2.vqh"
-
-
-#include "books/coupled/_44c3_short.vqh"
-#include "books/coupled/_44c3_long.vqh"
-
-#include "books/coupled/_44c3_s0_p1_0.vqh"
-#include "books/coupled/_44c3_s0_p2_0.vqh"
-#include "books/coupled/_44c3_s0_p3_0.vqh"
-#include "books/coupled/_44c3_s0_p4_0.vqh"
-#include "books/coupled/_44c3_s0_p4_1.vqh"
-#include "books/coupled/_44c3_s0_p5_0.vqh"
-#include "books/coupled/_44c3_s1_p5_0.vqh"
-#include "books/coupled/_44c3_s0_p6_0.vqh"
-#include "books/coupled/_44c3_s1_p6_0.vqh"
-#include "books/coupled/_44c3_s2_p6_0.vqh"
-#include "books/coupled/_44c3_s0_p7_0.vqh"
-#include "books/coupled/_44c3_s0_p7_1.vqh"
-#include "books/coupled/_44c3_s0_p7_2.vqh"
-#include "books/coupled/_44c3_s1_p7_0.vqh"
-#include "books/coupled/_44c3_s1_p7_1.vqh"
-#include "books/coupled/_44c3_s1_p7_2.vqh"
-#include "books/coupled/_44c3_s2_p7_0.vqh"
-#include "books/coupled/_44c3_s2_p7_1.vqh"
-#include "books/coupled/_44c3_s2_p7_2.vqh"
-#include "books/coupled/_44c3_s3_p7_0.vqh"
-#include "books/coupled/_44c3_s3_p7_1.vqh"
-#include "books/coupled/_44c3_s3_p7_2.vqh"
-
-#include "books/coupled/_44c4_short.vqh"
-#include "books/coupled/_44c4_long.vqh"
-
-#include "books/coupled/_44c4_s0_p1_0.vqh"
-#include "books/coupled/_44c4_s0_p2_0.vqh"
-#include "books/coupled/_44c4_s1_p2_0.vqh"
-#include "books/coupled/_44c4_s0_p3_0.vqh"
-#include "books/coupled/_44c4_s0_p4_0.vqh"
-#include "books/coupled/_44c4_s1_p4_0.vqh"
-#include "books/coupled/_44c4_s0_p5_0.vqh"
-#include "books/coupled/_44c4_s0_p6_0.vqh"
-#include "books/coupled/_44c4_s1_p6_0.vqh"
-#include "books/coupled/_44c4_s2_p6_0.vqh"
-#include "books/coupled/_44c4_s0_p7_0.vqh"
-#include "books/coupled/_44c4_s0_p7_1.vqh"
-#include "books/coupled/_44c4_s1_p7_0.vqh"
-#include "books/coupled/_44c4_s1_p7_1.vqh"
-#include "books/coupled/_44c4_s2_p7_0.vqh"
-#include "books/coupled/_44c4_s2_p7_1.vqh"
-#include "books/coupled/_44c4_s3_p7_0.vqh"
-#include "books/coupled/_44c4_s3_p7_1.vqh"
-#include "books/coupled/_44c4_s0_p8_0.vqh"
-#include "books/coupled/_44c4_s0_p8_1.vqh"
-#include "books/coupled/_44c4_s1_p8_0.vqh"
-#include "books/coupled/_44c4_s1_p8_1.vqh"
-#include "books/coupled/_44c4_s2_p8_0.vqh"
-#include "books/coupled/_44c4_s2_p8_1.vqh"
-#include "books/coupled/_44c4_s3_p8_0.vqh"
-#include "books/coupled/_44c4_s3_p8_1.vqh"
-#include "books/coupled/_44c4_s0_p9_0.vqh"
-#include "books/coupled/_44c4_s0_p9_1.vqh"
-#include "books/coupled/_44c4_s0_p9_2.vqh"
-#include "books/coupled/_44c4_s1_p9_0.vqh"
-#include "books/coupled/_44c4_s1_p9_1.vqh"
-#include "books/coupled/_44c4_s1_p9_2.vqh"
-#include "books/coupled/_44c4_s2_p9_0.vqh"
-#include "books/coupled/_44c4_s2_p9_1.vqh"
-#include "books/coupled/_44c4_s2_p9_2.vqh"
-#include "books/coupled/_44c4_s3_p9_0.vqh"
-#include "books/coupled/_44c4_s3_p9_1.vqh"
-#include "books/coupled/_44c4_s3_p9_2.vqh"
-
-#include "books/coupled/_44c4_s1_p2_s0.vqh"
-#include "books/coupled/_44c4_s1_p4_s0.vqh"
-#include "books/coupled/_44c4_s1_p6_s0.vqh"
-#include "books/coupled/_44c4_s1_p7_s0.vqh"
-#include "books/coupled/_44c4_s1_p8_s0.vqh"
-#include "books/coupled/_44c4_s1_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s2_p6_s0.vqh"
-#include "books/coupled/_44c4_s2_p7_s0.vqh"
-#include "books/coupled/_44c4_s2_p8_s0.vqh"
-#include "books/coupled/_44c4_s2_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s3_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s0_p0_r0.vqh"
-#include "books/coupled/_44c4_s0_p0_r1.vqh"
-#include "books/coupled/_44c4_s0_pN_r0.vqh"
-#include "books/coupled/_44c4_s0_pN_r1.vqh"
-#include "books/coupled/_44c4_s1_pS_r0.vqh"
-#include "books/coupled/_44c4_s1_pS_r1.vqh"
-
-#include "books/coupled/_44c5_short.vqh"
-#include "books/coupled/_44c5_long.vqh"
-
-#include "books/coupled/_44c5_s0_p1_0.vqh"
-#include "books/coupled/_44c5_s0_p2_0.vqh"
-#include "books/coupled/_44c5_s1_p2_0.vqh"
-#include "books/coupled/_44c5_s0_p3_0.vqh"
-#include "books/coupled/_44c5_s0_p4_0.vqh"
-#include "books/coupled/_44c5_s1_p4_0.vqh"
-#include "books/coupled/_44c5_s0_p5_0.vqh"
-#include "books/coupled/_44c5_s0_p6_0.vqh"
-#include "books/coupled/_44c5_s1_p6_0.vqh"
-#include "books/coupled/_44c5_s2_p6_0.vqh"
-#include "books/coupled/_44c5_s0_p7_0.vqh"
-#include "books/coupled/_44c5_s0_p7_1.vqh"
-#include "books/coupled/_44c5_s1_p7_0.vqh"
-#include "books/coupled/_44c5_s1_p7_1.vqh"
-#include "books/coupled/_44c5_s2_p7_0.vqh"
-#include "books/coupled/_44c5_s2_p7_1.vqh"
-#include "books/coupled/_44c5_s3_p7_0.vqh"
-#include "books/coupled/_44c5_s3_p7_1.vqh"
-#include "books/coupled/_44c5_s0_p8_0.vqh"
-#include "books/coupled/_44c5_s0_p8_1.vqh"
-#include "books/coupled/_44c5_s1_p8_0.vqh"
-#include "books/coupled/_44c5_s1_p8_1.vqh"
-#include "books/coupled/_44c5_s2_p8_0.vqh"
-#include "books/coupled/_44c5_s2_p8_1.vqh"
-#include "books/coupled/_44c5_s3_p8_0.vqh"
-#include "books/coupled/_44c5_s3_p8_1.vqh"
-#include "books/coupled/_44c5_s0_p9_0.vqh"
-#include "books/coupled/_44c5_s0_p9_1.vqh"
-#include "books/coupled/_44c5_s0_p9_2.vqh"
-#include "books/coupled/_44c5_s1_p9_0.vqh"
-#include "books/coupled/_44c5_s1_p9_1.vqh"
-#include "books/coupled/_44c5_s1_p9_2.vqh"
-#include "books/coupled/_44c5_s2_p9_0.vqh"
-#include "books/coupled/_44c5_s2_p9_1.vqh"
-#include "books/coupled/_44c5_s2_p9_2.vqh"
-#include "books/coupled/_44c5_s3_p9_0.vqh"
-#include "books/coupled/_44c5_s3_p9_1.vqh"
-#include "books/coupled/_44c5_s3_p9_2.vqh"
-
-#include "books/coupled/_44c6_short.vqh"
-#include "books/coupled/_44c6_long.vqh"
-
-#include "books/coupled/_44c6_s0_p1_0.vqh"
-#include "books/coupled/_44c6_s0_p2_0.vqh"
-#include "books/coupled/_44c6_s1_p2_0.vqh"
-#include "books/coupled/_44c6_s0_p3_0.vqh"
-#include "books/coupled/_44c6_s0_p4_0.vqh"
-#include "books/coupled/_44c6_s1_p4_0.vqh"
-#include "books/coupled/_44c6_s0_p5_0.vqh"
-#include "books/coupled/_44c6_s0_p6_0.vqh"
-#include "books/coupled/_44c6_s1_p6_0.vqh"
-#include "books/coupled/_44c6_s2_p6_0.vqh"
-#include "books/coupled/_44c6_s0_p7_0.vqh"
-#include "books/coupled/_44c6_s0_p7_1.vqh"
-#include "books/coupled/_44c6_s1_p7_0.vqh"
-#include "books/coupled/_44c6_s1_p7_1.vqh"
-#include "books/coupled/_44c6_s2_p7_0.vqh"
-#include "books/coupled/_44c6_s2_p7_1.vqh"
-#include "books/coupled/_44c6_s3_p7_0.vqh"
-#include "books/coupled/_44c6_s3_p7_1.vqh"
-#include "books/coupled/_44c6_s0_p8_0.vqh"
-#include "books/coupled/_44c6_s0_p8_1.vqh"
-#include "books/coupled/_44c6_s1_p8_0.vqh"
-#include "books/coupled/_44c6_s1_p8_1.vqh"
-#include "books/coupled/_44c6_s2_p8_0.vqh"
-#include "books/coupled/_44c6_s2_p8_1.vqh"
-#include "books/coupled/_44c6_s3_p8_0.vqh"
-#include "books/coupled/_44c6_s3_p8_1.vqh"
-#include "books/coupled/_44c6_s0_p9_0.vqh"
-#include "books/coupled/_44c6_s0_p9_1.vqh"
-#include "books/coupled/_44c6_s0_p9_2.vqh"
-#include "books/coupled/_44c6_s1_p9_0.vqh"
-#include "books/coupled/_44c6_s1_p9_1.vqh"
-#include "books/coupled/_44c6_s1_p9_2.vqh"
-#include "books/coupled/_44c6_s2_p9_0.vqh"
-#include "books/coupled/_44c6_s2_p9_1.vqh"
-#include "books/coupled/_44c6_s2_p9_2.vqh"
-#include "books/coupled/_44c6_s3_p9_0.vqh"
-#include "books/coupled/_44c6_s3_p9_1.vqh"
-#include "books/coupled/_44c6_s3_p9_2.vqh"
-
-#include "books/coupled/_44c7_short.vqh"
-#include "books/coupled/_44c7_long.vqh"
-
-#include "books/coupled/_44c7_s0_p1_0.vqh"
-#include "books/coupled/_44c7_s0_p1_1.vqh"
-#include "books/coupled/_44c7_s0_p2_0.vqh"
-#include "books/coupled/_44c7_s0_p2_1.vqh"
-#include "books/coupled/_44c7_s0_p3_0.vqh"
-#include "books/coupled/_44c7_s0_p4_0.vqh"
-#include "books/coupled/_44c7_s0_p5_0.vqh"
-#include "books/coupled/_44c7_s0_p6_0.vqh"
-#include "books/coupled/_44c7_s0_p6_1.vqh"
-#include "books/coupled/_44c7_s0_p7_0.vqh"
-#include "books/coupled/_44c7_s0_p7_1.vqh"
-#include "books/coupled/_44c7_s0_p8_0.vqh"
-#include "books/coupled/_44c7_s0_p8_1.vqh"
-#include "books/coupled/_44c7_s0_p9_0.vqh"
-#include "books/coupled/_44c7_s0_p9_1.vqh"
-#include "books/coupled/_44c7_s0_p9_2.vqh"
-
-#include "books/coupled/_44c7_s0_p0_r0.vqh"
-#include "books/coupled/_44c7_s0_p0_r1.vqh"
-#include "books/coupled/_44c7_s0_pN_r0.vqh"
-#include "books/coupled/_44c7_s0_pN_r1.vqh"
-
-#include "books/coupled/_44c8_short.vqh"
-#include "books/coupled/_44c8_long.vqh"
-
-#include "books/coupled/_44c8_s0_p1_0.vqh"
-#include "books/coupled/_44c8_s0_p1_1.vqh"
-#include "books/coupled/_44c8_s0_p2_0.vqh"
-#include "books/coupled/_44c8_s0_p2_1.vqh"
-#include "books/coupled/_44c8_s0_p3_0.vqh"
-#include "books/coupled/_44c8_s0_p4_0.vqh"
-#include "books/coupled/_44c8_s0_p5_0.vqh"
-#include "books/coupled/_44c8_s0_p6_0.vqh"
-#include "books/coupled/_44c8_s0_p6_1.vqh"
-#include "books/coupled/_44c8_s0_p7_0.vqh"
-#include "books/coupled/_44c8_s0_p7_1.vqh"
-#include "books/coupled/_44c8_s0_p8_0.vqh"
-#include "books/coupled/_44c8_s0_p8_1.vqh"
-#include "books/coupled/_44c8_s0_p9_0.vqh"
-#include "books/coupled/_44c8_s0_p9_1.vqh"
-#include "books/coupled/_44c8_s0_p9_2.vqh"
-
-#include "books/coupled/_44c9_short.vqh"
-#include "books/coupled/_44c9_long.vqh"
-
-#include "books/coupled/_44c9_s0_p1_0.vqh"
-#include "books/coupled/_44c9_s0_p1_1.vqh"
-#include "books/coupled/_44c9_s0_p2_0.vqh"
-#include "books/coupled/_44c9_s0_p2_1.vqh"
-#include "books/coupled/_44c9_s0_p3_0.vqh"
-#include "books/coupled/_44c9_s0_p4_0.vqh"
-#include "books/coupled/_44c9_s0_p5_0.vqh"
-#include "books/coupled/_44c9_s0_p6_0.vqh"
-#include "books/coupled/_44c9_s0_p6_1.vqh"
-#include "books/coupled/_44c9_s0_p7_0.vqh"
-#include "books/coupled/_44c9_s0_p7_1.vqh"
-#include "books/coupled/_44c9_s0_p8_0.vqh"
-#include "books/coupled/_44c9_s0_p8_1.vqh"
-#include "books/coupled/_44c9_s0_p9_0.vqh"
-#include "books/coupled/_44c9_s0_p9_1.vqh"
-#include "books/coupled/_44c9_s0_p9_2.vqh"
-
-/* residue backfill is entered in the template array as if stereo
-   backfill is not in use.  It's up to vorbisenc to make the
-   appropriate index adjustment */
-static vorbis_residue_template _residue_template_44_stereo[11]={
-  /* mode 0; 64-ish */
-  {{&_residue_44_low, &_residue_44_low},  
-   {&_huff_book__44c0_short,&_huff_book__44c0_long},
-   /* mostly temporary entries pending training */
-   { {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0},
-      {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s0_p5_0},{0,0,&_44c0_s0_p6_0},
-      {&_44c0_s0_p7_0,&_44c0_s0_p7_1,&_44c0_s0_p7_2}}, /* lossless stereo */
-     {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0},
-      {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s1_p6_0},
-      {&_44c0_s1_p7_0,&_44c0_s1_p7_1,&_44c0_s1_p7_2}}, /* 6dB (2.5) stereo */
-     {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0},
-      {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s2_p6_0},
-      {&_44c0_s2_p7_0,&_44c0_s2_p7_1,&_44c0_s2_p7_2}}, /* 12dB (4.5) stereo */
-     {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0},
-      {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s2_p6_0},
-      {&_44c0_s3_p7_0,&_44c0_s3_p7_1,&_44c0_s3_p7_2}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-  /* mode 1; 80-ish */
-  {{&_residue_44_low, &_residue_44_low},  
-   {&_huff_book__44c1_short,&_huff_book__44c1_long},
-   /* mostly temporary entries pending training */
-   { {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0},
-      {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s0_p5_0},{0,0,&_44c1_s0_p6_0},
-      {&_44c1_s0_p7_0,&_44c1_s0_p7_1,&_44c1_s0_p7_2}}, /* lossless stereo */
-     {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0},
-      {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s1_p6_0},
-      {&_44c1_s1_p7_0,&_44c1_s1_p7_1,&_44c1_s1_p7_2}}, /* 6dB (2.5) stereo */
-     {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0},
-      {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s2_p6_0},
-      {&_44c1_s2_p7_0,&_44c1_s2_p7_1,&_44c1_s2_p7_2}}, /* 12dB (4.5) stereo */
-     {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0},
-      {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s2_p6_0},
-      {&_44c1_s3_p7_0,&_44c1_s3_p7_1,&_44c1_s3_p7_2}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-  /* mode 2; 96-ish */
-  {{&_residue_44_low, &_residue_44_low},  
-   {&_huff_book__44c2_short,&_huff_book__44c2_long},
-   /* mostly temporary entries pending training */
-   { {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0},
-      {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s0_p5_0},{0,0,&_44c2_s0_p6_0},
-      {&_44c2_s0_p7_0,&_44c2_s0_p7_1,&_44c2_s0_p7_2}}, /* lossless stereo */
-     {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0},
-      {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s1_p6_0},
-      {&_44c2_s1_p7_0,&_44c2_s1_p7_1,&_44c2_s1_p7_2}}, /* 6dB (2.5) stereo */
-     {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0},
-      {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s2_p6_0},
-      {&_44c2_s2_p7_0,&_44c2_s2_p7_1,&_44c2_s2_p7_2}}, /* 12dB (4.5) stereo */
-     {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0},
-      {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s2_p6_0},
-      {&_44c2_s3_p7_0,&_44c2_s3_p7_1,&_44c2_s3_p7_2}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-  /* mode 3; 112-ish */
-  {{&_residue_44_low, &_residue_44_low},  
-   {&_huff_book__44c3_short,&_huff_book__44c3_long},
-   /* mostly temporary entries pending training */
-   { {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0},
-      {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s0_p5_0},{0,0,&_44c3_s0_p6_0},
-      {&_44c3_s0_p7_0,&_44c3_s0_p7_1,&_44c3_s0_p7_2}}, /* lossless stereo */
-     {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0},
-      {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s1_p6_0},
-      {&_44c3_s1_p7_0,&_44c3_s1_p7_1,&_44c3_s1_p7_2}}, /* 6dB (2.5) stereo */
-     {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0},
-      {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s2_p6_0},
-      {&_44c3_s2_p7_0,&_44c3_s2_p7_1,&_44c3_s2_p7_2}}, /* 12dB (4.5) stereo */
-     {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0},
-      {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s2_p6_0},
-      {&_44c3_s3_p7_0,&_44c3_s3_p7_1,&_44c3_s3_p7_2}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-
-  /* mode 4; 128-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c4_short,&_huff_book__44c4_long},
-   { 
-     {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s0_p2_0},{0,0,&_44c4_s0_p3_0},
-      {0,0,&_44c4_s0_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s0_p6_0},
-      {&_44c4_s0_p7_0,&_44c4_s0_p7_1},{&_44c4_s0_p8_0,&_44c4_s0_p8_1},
-      {&_44c4_s0_p9_0,&_44c4_s0_p9_1,&_44c4_s0_p9_2}},
-     {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0},
-      {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s1_p6_0},
-      {&_44c4_s1_p7_0,&_44c4_s1_p7_1},{&_44c4_s1_p8_0,&_44c4_s1_p8_1},
-      {&_44c4_s1_p9_0,&_44c4_s1_p9_1,&_44c4_s1_p9_2}},
-     {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0},
-      {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s2_p6_0},
-      {&_44c4_s2_p7_0,&_44c4_s2_p7_1},{&_44c4_s2_p8_0,&_44c4_s2_p8_1},
-      {&_44c4_s2_p9_0,&_44c4_s2_p9_1,&_44c4_s2_p9_2}},
-     {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0},
-      {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s2_p6_0},
-      {&_44c4_s3_p7_0,&_44c4_s3_p7_1},{&_44c4_s3_p8_0,&_44c4_s3_p8_1},
-      {&_44c4_s3_p9_0,&_44c4_s3_p9_1,&_44c4_s3_p9_2}},
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
-  },
-  /* mode 5; 160-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c5_short,&_huff_book__44c5_long},
-   { 
-     {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s0_p2_0},{0,0,&_44c5_s0_p3_0},
-      {0,0,&_44c5_s0_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s0_p6_0},
-      {&_44c5_s0_p7_0,&_44c5_s0_p7_1},{&_44c5_s0_p8_0,&_44c5_s0_p8_1},
-      {&_44c5_s0_p9_0,&_44c5_s0_p9_1,&_44c5_s0_p9_2}},
-     {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0},
-      {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s1_p6_0},
-      {&_44c5_s1_p7_0,&_44c5_s1_p7_1},{&_44c5_s1_p8_0,&_44c5_s1_p8_1},
-      {&_44c5_s1_p9_0,&_44c5_s1_p9_1,&_44c5_s1_p9_2}},
-     {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0},
-      {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s2_p6_0},
-      {&_44c5_s2_p7_0,&_44c5_s2_p7_1},{&_44c5_s2_p8_0,&_44c5_s2_p8_1},
-      {&_44c5_s2_p9_0,&_44c5_s2_p9_1,&_44c5_s2_p9_2}},
-     {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0},
-      {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s2_p6_0},
-      {&_44c5_s3_p7_0,&_44c5_s3_p7_1},{&_44c5_s3_p8_0,&_44c5_s3_p8_1},
-      {&_44c5_s3_p9_0,&_44c5_s3_p9_1,&_44c5_s3_p9_2}},
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
-  },
-  /* mode 6; 192-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c6_short,&_huff_book__44c6_long},
-   { 
-     {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s0_p2_0},{0,0,&_44c6_s0_p3_0},
-      {0,0,&_44c6_s0_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s0_p6_0},
-      {&_44c6_s0_p7_0,&_44c6_s0_p7_1},{&_44c6_s0_p8_0,&_44c6_s0_p8_1},
-      {&_44c6_s0_p9_0,&_44c6_s0_p9_1,&_44c6_s0_p9_2}},
-     {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0},
-      {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s1_p6_0},
-      {&_44c6_s1_p7_0,&_44c6_s1_p7_1},{&_44c6_s1_p8_0,&_44c6_s1_p8_1},
-      {&_44c6_s1_p9_0,&_44c6_s1_p9_1,&_44c6_s1_p9_2}},
-     {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0},
-      {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s2_p6_0},
-      {&_44c6_s2_p7_0,&_44c6_s2_p7_1},{&_44c6_s2_p8_0,&_44c6_s2_p8_1},
-      {&_44c6_s2_p9_0,&_44c6_s2_p9_1,&_44c6_s2_p9_2}},
-     {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0},
-      {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s2_p6_0},
-      {&_44c6_s3_p7_0,&_44c6_s3_p7_1},{&_44c6_s3_p8_0,&_44c6_s3_p8_1},
-      {&_44c6_s3_p9_0,&_44c6_s3_p9_1,&_44c6_s3_p9_2}},
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
-  },
-
-  /* mode 7; 224-ish */
-  {{&_residue_44_high, &_residue_44_high},  
-   {&_huff_book__44c7_short,&_huff_book__44c7_long},
-   { {{0},{&_44c7_s0_p1_0,&_44c7_s0_p1_1},
-      {&_44c7_s0_p2_0,&_44c7_s0_p2_1},
-      {0,0,&_44c7_s0_p3_0},{0,0,&_44c7_s0_p4_0},{0,0,&_44c7_s0_p5_0},
-      {&_44c7_s0_p6_0,&_44c7_s0_p6_1},
-      {&_44c7_s0_p7_0,&_44c7_s0_p7_1},
-      {&_44c7_s0_p8_0,&_44c7_s0_p8_1},
-      {&_44c7_s0_p9_0,&_44c7_s0_p9_1,&_44c7_s0_p9_2}}, 
-     {{0}}, /* 6dB  (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-
-  /* mode 8; 256-ish */
-  {{&_residue_44_high, &_residue_44_high},  
-   {&_huff_book__44c8_short,&_huff_book__44c8_long},
-   { {{0},{&_44c8_s0_p1_0,&_44c8_s0_p1_1},
-      {&_44c8_s0_p2_0,&_44c8_s0_p2_1},
-      {0,0,&_44c8_s0_p3_0},{0,0,&_44c8_s0_p4_0},{0,0,&_44c8_s0_p5_0},
-      {&_44c8_s0_p6_0,&_44c8_s0_p6_1},
-      {&_44c8_s0_p7_0,&_44c8_s0_p7_1},
-      {&_44c8_s0_p8_0,&_44c8_s0_p8_1},
-      {&_44c8_s0_p9_0,&_44c8_s0_p9_1,&_44c8_s0_p9_2}}, 
-     {{0}}, /* 6dB  (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  },
-  /* mode 9; 320-ish */
-  {{&_residue_44_high, &_residue_44_high},  
-   {&_huff_book__44c9_short,&_huff_book__44c9_long},
-   { {{0},{&_44c9_s0_p1_0,&_44c9_s0_p1_1},
-      {&_44c9_s0_p2_0,&_44c9_s0_p2_1},
-      {0,0,&_44c9_s0_p3_0},{0,0,&_44c9_s0_p4_0},{0,0,&_44c9_s0_p5_0},
-      {&_44c9_s0_p6_0,&_44c9_s0_p6_1},
-      {&_44c9_s0_p7_0,&_44c9_s0_p7_1},
-      {&_44c9_s0_p8_0,&_44c9_s0_p8_1},
-      {&_44c9_s0_p9_0,&_44c9_s0_p9_1,&_44c9_s0_p9_2}}, 
-     {{0}}, /* 6dB  (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
-  }
-
-};
-
-#include "books/uncoupled/_44u0_p1_0.vqh"
-#include "books/uncoupled/_44u0_p2_0.vqh"
-#include "books/uncoupled/_44u0_p3_0.vqh"
-#include "books/uncoupled/_44u0_p4_0.vqh"
-#include "books/uncoupled/_44u0_p4_1.vqh"
-#include "books/uncoupled/_44u0_p5_0.vqh"
-#include "books/uncoupled/_44u0_p6_0.vqh"
-#include "books/uncoupled/_44u0_p7_0.vqh"
-#include "books/uncoupled/_44u0_p7_1.vqh"
-#include "books/uncoupled/_44u0_p7_2.vqh"
-
-#include "books/uncoupled/_44u0_p0_r0.vqh"
-#include "books/uncoupled/_44u0_p1_r0.vqh"
-
-#include "books/uncoupled/_44u0_p0_r1.vqh"
-#include "books/uncoupled/_44u0_p1_r1.vqh"
-
-#include "books/uncoupled/_44u4_p1_0.vqh"
-#include "books/uncoupled/_44u4_p2_0.vqh"
-#include "books/uncoupled/_44u4_p3_0.vqh"
-#include "books/uncoupled/_44u4_p4_0.vqh"
-#include "books/uncoupled/_44u4_p5_0.vqh"
-#include "books/uncoupled/_44u4_p6_0.vqh"
-#include "books/uncoupled/_44u4_p7_0.vqh"
-#include "books/uncoupled/_44u4_p7_1.vqh"
-#include "books/uncoupled/_44u4_p8_0.vqh"
-#include "books/uncoupled/_44u4_p8_1.vqh"
-#include "books/uncoupled/_44u4_p9_0.vqh"
-#include "books/uncoupled/_44u4_p9_1.vqh"
-#include "books/uncoupled/_44u4_p9_2.vqh"
-
-#include "books/uncoupled/_44u4_p0_r0.vqh"
-#include "books/uncoupled/_44u4_p1_r0.vqh"
-
-#include "books/uncoupled/_44u4_p0_r1.vqh"
-#include "books/uncoupled/_44u4_p1_r1.vqh"
-
-#include "books/uncoupled/_44u7_p1_0.vqh"
-#include "books/uncoupled/_44u7_p2_0.vqh"
-#include "books/uncoupled/_44u7_p2_1.vqh"
-#include "books/uncoupled/_44u7_p3_0.vqh"
-#include "books/uncoupled/_44u7_p4_0.vqh"
-#include "books/uncoupled/_44u7_p5_0.vqh"
-#include "books/uncoupled/_44u7_p6_0.vqh"
-#include "books/uncoupled/_44u7_p7_0.vqh"
-#include "books/uncoupled/_44u7_p7_1.vqh"
-#include "books/uncoupled/_44u7_p8_0.vqh"
-#include "books/uncoupled/_44u7_p8_1.vqh"
-#include "books/uncoupled/_44u7_p9_0.vqh"
-#include "books/uncoupled/_44u7_p9_1.vqh"
-#include "books/uncoupled/_44u7_p9_2.vqh"
-
-#include "books/uncoupled/_44u7_p0_r0.vqh"
-#include "books/uncoupled/_44u7_p1_r0.vqh"
-
-#include "books/uncoupled/_44u7_p0_r1.vqh"
-#include "books/uncoupled/_44u7_p1_r1.vqh"
-
-
-static vorbis_residue_template _residue_template_44_uncoupled[11]={
-  /* mode 0; 40/c-ish */
-  {{&_residue_44_low_un, &_residue_44_low_un},  
-   {&_huff_book__44c0_short,&_huff_book__44c0_long},
-   { {{0},
-      {0,0,&_44u0_p1_0},
-      {0,0,&_44u0_p2_0},
-      {0,0,&_44u0_p3_0},
-      {&_44u0_p4_0,&_44u0_p4_1},
-      {0,0,&_44u0_p5_0},
-      {0,0,&_44u0_p6_0},
-      {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
+static static_bookblock _resbook_44s_0={
+  {
+    {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},{0,0,&_44c0_s_p3_0},
+    {0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},{0,0,&_44c0_s_p6_0},
+    {&_44c0_s_p7_0,&_44c0_s_p7_1},{&_44c0_s_p8_0,&_44c0_s_p8_1},
+    {&_44c0_s_p9_0,&_44c0_s_p9_1,&_44c0_s_p9_2}
+   }
+};
+static static_bookblock _resbook_44sm_0={
+  {
+    {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},{0,0,&_44c0_sm_p3_0},
+    {0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},{0,0,&_44c0_sm_p6_0},
+    {&_44c0_sm_p7_0,&_44c0_sm_p7_1},{&_44c0_sm_p8_0,&_44c0_sm_p8_1},
+    {&_44c0_sm_p9_0,&_44c0_sm_p9_1,&_44c0_sm_p9_2}
    }
-  },
-  /* mode 1; 50-ish */
-  {{&_residue_44_low_un, &_residue_44_low_un},  
-   {&_huff_book__44c1_short,&_huff_book__44c1_long},
-   { {{0},
-      {0,0,&_44u0_p1_0},
-      {0,0,&_44u0_p2_0},
-      {0,0,&_44u0_p3_0},
-      {&_44u0_p4_0,&_44u0_p4_1},
-      {0,0,&_44u0_p5_0},
-      {0,0,&_44u0_p6_0},
-      {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
+};
+static static_bookblock _resbook_44s_1={
+  {
+    {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},{0,0,&_44c1_s_p3_0},
+    {0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},{0,0,&_44c1_s_p6_0},
+    {&_44c1_s_p7_0,&_44c1_s_p7_1},{&_44c1_s_p8_0,&_44c1_s_p8_1},
+    {&_44c1_s_p9_0,&_44c1_s_p9_1,&_44c1_s_p9_2}
    }
-  },
-  /* mode 2; 60-ish */
-  {{&_residue_44_low_un, &_residue_44_low_un},  
-   {&_huff_book__44c2_short,&_huff_book__44c2_long},
-   { {{0},
-      {0,0,&_44u0_p1_0},
-      {0,0,&_44u0_p2_0},
-      {0,0,&_44u0_p3_0},
-      {&_44u0_p4_0,&_44u0_p4_1},
-      {0,0,&_44u0_p5_0},
-      {0,0,&_44u0_p6_0},
-      {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
+};
+static static_bookblock _resbook_44sm_1={
+  {
+    {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},{0,0,&_44c1_sm_p3_0},
+    {0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},{0,0,&_44c1_sm_p6_0},
+    {&_44c1_sm_p7_0,&_44c1_sm_p7_1},{&_44c1_sm_p8_0,&_44c1_sm_p8_1},
+    {&_44c1_sm_p9_0,&_44c1_sm_p9_1,&_44c1_sm_p9_2}
    }
-  },
-  /* mode 3; 70-ish */
-  {{&_residue_44_low_un, &_residue_44_low_un},  
-   {&_huff_book__44c3_short,&_huff_book__44c3_long},
-   { {{0},
-      {0,0,&_44u0_p1_0},
-      {0,0,&_44u0_p2_0},
-      {0,0,&_44u0_p3_0},
-      {&_44u0_p4_0,&_44u0_p4_1},
-      {0,0,&_44u0_p5_0},
-      {0,0,&_44u0_p6_0},
-      {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
+};
+static static_bookblock _resbook_44s_2={
+  {
+    {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
+    {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
+    {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1},
+    {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
    }
-  },
-  /* mode 4; 80-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c4_short,&_huff_book__44c4_long},
-   { {{0},
-      {0,0,&_44u4_p1_0},
-      {0,0,&_44u4_p2_0},
-      {0,0,&_44u4_p3_0},
-      {0,0,&_44u4_p4_0},
-      {0,0,&_44u4_p5_0},
-      {0,0,&_44u4_p6_0},
-      {&_44u4_p7_0,&_44u4_p7_1},
-      {&_44u4_p8_0,&_44u4_p8_1},
-      {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
+};
+static static_bookblock _resbook_44s_3={
+  {
+    {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
+    {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
+    {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1},
+    {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
    }
-  },
-  /* mode 5; 90-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c5_short,&_huff_book__44c5_long},
-   { {{0},
-      {0,0,&_44u4_p1_0},
-      {0,0,&_44u4_p2_0},
-      {0,0,&_44u4_p3_0},
-      {0,0,&_44u4_p4_0},
-      {0,0,&_44u4_p5_0},
-      {0,0,&_44u4_p6_0},
-      {&_44u4_p7_0,&_44u4_p7_1},
-      {&_44u4_p8_0,&_44u4_p8_1},
-      {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
+};
+static static_bookblock _resbook_44s_4={
+  {
+    {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
+    {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
+    {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1},
+    {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
    }
-  },
-  /* mode 6; 100-ish */
-  {{&_residue_44_mid, &_residue_44_mid},  
-   {&_huff_book__44c6_short,&_huff_book__44c6_long},
-   { {{0},
-      {0,0,&_44u4_p1_0},
-      {0,0,&_44u4_p2_0},
-      {0,0,&_44u4_p3_0},
-      {0,0,&_44u4_p4_0},
-      {0,0,&_44u4_p5_0},
-      {0,0,&_44u4_p6_0},
-      {&_44u4_p7_0,&_44u4_p7_1},
-      {&_44u4_p8_0,&_44u4_p8_1},
-      {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
+};
+static static_bookblock _resbook_44s_5={
+  {
+    {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
+    {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
+    {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1},
+    {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
    }
-  },
-  /* mode 7 */
-  {{&_residue_44_high_un, &_residue_44_high_un},  
-   {&_huff_book__44c7_short,&_huff_book__44c7_long},
-   { {{0},
-      {0,0,&_44u7_p1_0},
-      {&_44u7_p2_0,&_44u7_p2_1},
-      {0,0,&_44u7_p3_0},
-      {0,0,&_44u7_p4_0},
-      {0,0,&_44u7_p5_0},
-      {0,0,&_44u7_p6_0},
-      {&_44u7_p7_0,&_44u7_p7_1},
-      {&_44u7_p8_0,&_44u7_p8_1},
-      {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
+};
+static static_bookblock _resbook_44s_6={
+  {
+    {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
+    {0,0,&_44c6_s_p4_0},
+    {&_44c6_s_p5_0,&_44c6_s_p5_1},
+    {&_44c6_s_p6_0,&_44c6_s_p6_1},
+    {&_44c6_s_p7_0,&_44c6_s_p7_1},
+    {&_44c6_s_p8_0,&_44c6_s_p8_1},
+    {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
    }
-  },
-  /* mode 8 */
-  {{&_residue_44_high_un, &_residue_44_high_un},  
-   {&_huff_book__44c8_short,&_huff_book__44c8_long},
-   { {{0},
-      {0,0,&_44u7_p1_0},
-      {&_44u7_p2_0,&_44u7_p2_1},
-      {0,0,&_44u7_p3_0},
-      {0,0,&_44u7_p4_0},
-      {0,0,&_44u7_p5_0},
-      {0,0,&_44u7_p6_0},
-      {&_44u7_p7_0,&_44u7_p7_1},
-      {&_44u7_p8_0,&_44u7_p8_1},
-      {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
+};
+static static_bookblock _resbook_44s_7={
+  {
+    {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
+    {0,0,&_44c7_s_p4_0},
+    {&_44c7_s_p5_0,&_44c7_s_p5_1},
+    {&_44c7_s_p6_0,&_44c7_s_p6_1},
+    {&_44c7_s_p7_0,&_44c7_s_p7_1},
+    {&_44c7_s_p8_0,&_44c7_s_p8_1},
+    {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
    }
-  },
-  /* mode 9 */
-  {{&_residue_44_high_un, &_residue_44_high_un},  
-   {&_huff_book__44c9_short,&_huff_book__44c9_long},
-   { {{0},
-      {0,0,&_44u7_p1_0},
-      {&_44u7_p2_0,&_44u7_p2_1},
-      {0,0,&_44u7_p3_0},
-      {0,0,&_44u7_p4_0},
-      {0,0,&_44u7_p5_0},
-      {0,0,&_44u7_p6_0},
-      {&_44u7_p7_0,&_44u7_p7_1},
-      {&_44u7_p8_0,&_44u7_p8_1},
-      {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
-   },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
+};
+static static_bookblock _resbook_44s_8={
+  {
+    {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
+    {0,0,&_44c8_s_p4_0},
+    {&_44c8_s_p5_0,&_44c8_s_p5_1},
+    {&_44c8_s_p6_0,&_44c8_s_p6_1},
+    {&_44c8_s_p7_0,&_44c8_s_p7_1},
+    {&_44c8_s_p8_0,&_44c8_s_p8_1},
+    {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
    }
-  },
 };
-
+static static_bookblock _resbook_44s_9={
+  {
+    {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
+    {0,0,&_44c9_s_p4_0},
+    {&_44c9_s_p5_0,&_44c9_s_p5_1},
+    {&_44c9_s_p6_0,&_44c9_s_p6_1},
+    {&_44c9_s_p7_0,&_44c9_s_p7_1},
+    {&_44c9_s_p8_0,&_44c9_s_p8_1},
+    {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2}
+   }
+};
 
 
+static vorbis_residue_template _res_44s_0[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
+   &_resbook_44s_0,&_resbook_44sm_0},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
+   &_resbook_44s_0,&_resbook_44sm_0}
+};
+static vorbis_residue_template _res_44s_1[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
+   &_resbook_44s_1,&_resbook_44sm_1},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
+   &_resbook_44s_1,&_resbook_44sm_1}
+};
+static vorbis_residue_template _res_44s_2[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c2_s_short,&_huff_book__44c2_sm_short,
+   &_resbook_44s_2,&_resbook_44s_2},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c2_s_long,&_huff_book__44c2_sm_long,
+   &_resbook_44s_2,&_resbook_44s_2}
+};
+static vorbis_residue_template _res_44s_3[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c3_s_short,&_huff_book__44c3_sm_short,
+   &_resbook_44s_3,&_resbook_44s_3},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c3_s_long,&_huff_book__44c3_sm_long,
+   &_resbook_44s_3,&_resbook_44s_3}
+};
+static vorbis_residue_template _res_44s_4[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c4_s_short,&_huff_book__44c4_sm_short,
+   &_resbook_44s_4,&_resbook_44s_4},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c4_s_long,&_huff_book__44c4_sm_long,
+   &_resbook_44s_4,&_resbook_44s_4}
+};
+static vorbis_residue_template _res_44s_5[]={
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c5_s_short,&_huff_book__44c5_sm_short,
+   &_resbook_44s_5,&_resbook_44s_5},
+
+  {2,0,  &_residue_44_mid,
+   &_huff_book__44c5_s_long,&_huff_book__44c5_sm_long,
+   &_resbook_44s_5,&_resbook_44s_5}
+};
+static vorbis_residue_template _res_44s_6[]={
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c6_s_short,&_huff_book__44c6_sm_short,
+   &_resbook_44s_6,&_resbook_44s_6},
+
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c6_s_long,&_huff_book__44c6_sm_long,
+   &_resbook_44s_6,&_resbook_44s_6}
+};
+static vorbis_residue_template _res_44s_7[]={
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c7_s_short,&_huff_book__44c7_sm_short,
+   &_resbook_44s_7,&_resbook_44s_7},
+
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c7_s_long,&_huff_book__44c7_sm_long,
+   &_resbook_44s_7,&_resbook_44s_7}
+};
+static vorbis_residue_template _res_44s_8[]={
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c8_s_short,&_huff_book__44c8_sm_short,
+   &_resbook_44s_8,&_resbook_44s_8},
+
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c8_s_long,&_huff_book__44c8_sm_long,
+   &_resbook_44s_8,&_resbook_44s_8}
+};
+static vorbis_residue_template _res_44s_9[]={
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c9_s_short,&_huff_book__44c9_sm_short,
+   &_resbook_44s_9,&_resbook_44s_9},
+
+  {2,0,  &_residue_44_high,
+   &_huff_book__44c9_s_long,&_huff_book__44c9_sm_long,
+   &_resbook_44s_9,&_resbook_44s_9}
+};
 
 
+static vorbis_mapping_template _mapres_template_44_stereo[]={
+  { _map_nominal, _res_44s_0 }, /* 0 */
+  { _map_nominal, _res_44s_1 }, /* 1 */
+  { _map_nominal, _res_44s_2 }, /* 2 */
+  { _map_nominal, _res_44s_3 }, /* 3 */
+  { _map_nominal, _res_44s_4 }, /* 4 */
+  { _map_nominal, _res_44s_5 }, /* 5 */
+  { _map_nominal, _res_44s_6 }, /* 6 */
+  { _map_nominal, _res_44s_7 }, /* 7 */
+  { _map_nominal, _res_44s_8 }, /* 8 */
+  { _map_nominal, _res_44s_9 }, /* 9 */
+};

<p><p>1.2       +101 -0    vorbis/lib/modes/setup_44.h

<p><p><p>1.3       +62 -58    vorbis/vq/44c0.vqs

Index: 44c0.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c0.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c0.vqs	2001/12/19 01:10:28	1.2
+++ 44c0.vqs	2002/06/28 22:19:56	1.3
@@ -1,74 +1,78 @@
-cp 44c0_s0/resaux_short.vqd _44c0_short.vqd
-cp 44c0_s0/resaux_long.vqd _44c0_long.vqd
+cp 44c0_s/resaux_0.vqd _44c0_s_short.vqd
+cp 44c0_s/resaux_1.vqd _44c0_s_long.vqd
+cp 44c0_sm/resaux_0.vqd _44c0_sm_short.vqd
+cp 44c0_sm/resaux_1.vqd _44c0_sm_long.vqd
 
-
 GO
 
->_44c0s noninterleaved
-haux _44c0_short.vqd 0,12,2
+>_44c0s_s noninterleaved
+haux _44c0_s_short.vqd 0,16,2
 
->_44c0 noninterleaved
-haux _44c0_long.vqd 0,44,2
+>_44c0_s noninterleaved
+haux _44c0_s_long.vqd 0,64,2
         
 #iter 0
-
-#       0   1   2   4  26   1   4   +      
-#           0   0   0   0      
-#
-#       0   1   2   3   4   5   6   7
-#   1                   .           .
-#   2                   .           .
-#   4       .   .   .       .   .   .
-
-:_s0_p1_0 44c0_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p2_0 44c0_s0/res_part2_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p3_0 44c0_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s0_p4_0 44c0_s0/res_part4_pass0.vqd, 2, nonseq, 0 +- 7 14 21 28 35 42 49
-:_s0_p4_1 44c0_s0/res_part4_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 
-
-:_s0_p5_0 44c0_s0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p5_0 44c0_s1/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1
-
-:_s0_p6_0 44c0_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c0_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c0_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
 
-:_s0_p7_0 44c0_s0/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s0_p7_1 44c0_s0/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s0_p7_2 44c0_s0/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
-:_s1_p7_0 44c0_s1/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s1_p7_1 44c0_s1/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s1_p7_2 44c0_s1/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c0_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c0_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c0_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c0_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c0_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c0_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c0_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c0_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c0_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c0_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c0_s/res_part9_pass0.vqd, 4, nonseq, 0 +- 169 338
+:_p9_1 44c0_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
+:_p9_2 44c0_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
 
-:_s2_p7_0 44c0_s2/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s2_p7_1 44c0_s2/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s2_p7_2 44c0_s2/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
 
-:_s3_p7_0 44c0_s3/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s3_p7_1 44c0_s3/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s3_p7_2 44c0_s3/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
+>_44c0s_sm noninterleaved
+haux _44c0_sm_short.vqd 0,16,2
 
-#iter 1 (stereo 3(8.)->2 2(4.)->1 1(2.)->0)  shared for all 'low' modes
-
-:_s1_p5_s0 44cL_s1/res_part5_pass3.vqd, 2, nonseq, 0 +- 1 2
-:_s1_p6_s0 44cL_s1/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4
-:_s1_p7_s0 44cL_s1/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4
-
-:_s2_p6_s0 44cL_s2/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p7_s0 44cL_s2/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-
-:_s3_p7_s0 44cL_s3/res_part7_pass3.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
+>_44c0_sm noninterleaved
+haux _44c0_sm_long.vqd 0,64,2
+	
+#iter 0
 
-#iter 2 (residue backfill) shared for all 'low' modes
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
-:_s0_p0_r0 44cL_s0/res_part0_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
-:_s0_pN_r0 44cL_s0/res_partN_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
-:_s1_pS_r0 44cL_s1/res_partS_r0.vqd, 2, nonseq, 0 +- .333333333
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c0_sm/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c0_sm/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c0_sm/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c0_sm/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c0_sm/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c0_sm/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c0_sm/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c0_sm/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c0_sm/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c0_sm/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c4_sm/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p9_1 44c4_sm/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 
+:_p9_2 44c4_sm/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
 
-#iter 3 (residue backfill)
 
-:_s0_p0_r1 44cL_s0/res_part0_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
-:_s0_pN_r1 44cL_s0/res_partN_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
-:_s1_pS_r1 44cL_s1/res_partS_r1.vqd, 2, nonseq, 0 +- .111111111 
 

<p><p>1.3       +67 -43    vorbis/vq/44c1.vqs

Index: 44c1.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c1.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c1.vqs	2001/12/19 01:10:28	1.2
+++ 44c1.vqs	2002/06/28 22:19:56	1.3
@@ -1,51 +1,75 @@
-cp 44c1_s0/resaux_short.vqd _44c1_short.vqd
-cp 44c1_s0/resaux_long.vqd _44c1_long.vqd
+cp 44c1_s/resaux_0.vqd _44c1_s_short.vqd
+cp 44c1_s/resaux_1.vqd _44c1_s_long.vqd
+cp 44c1_sm/resaux_0.vqd _44c1_sm_short.vqd
+cp 44c1_sm/resaux_1.vqd _44c1_sm_long.vqd
 
-
 GO
+
+>_44c1s_s noninterleaved
+haux _44c1_s_short.vqd 0,16,2
 
->_44c1s noninterleaved
-haux _44c1_short.vqd 0,12,2
+>_44c1_s noninterleaved
+haux _44c1_s_long.vqd 0,64,2
+	
+#iter 0
 
->_44c1 noninterleaved
-haux _44c1_long.vqd 0,46,2
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c1_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c1_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c1_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c1_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c1_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c1_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c1_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c1_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c1_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c1_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c1_s/res_part9_pass0.vqd, 4, nonseq, 0 +- 169 338
+:_p9_1 44c1_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
+:_p9_2 44c1_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
+
+
+>_44c1s_sm noninterleaved
+haux _44c1_sm_short.vqd 0,16,2
+
+>_44c1_sm noninterleaved
+haux _44c1_sm_long.vqd 0,64,2
+	
 #iter 0
 
-#       0   1   2   4  26   1   4   +      
-#           0   0   0   0      
-#
-#       0   1   2   3   4   5   6   7
-#   1                   .           .
-#   2                   .           .
-#   4       .   .   .       .   .   .
-
-:_s0_p1_0 44c1_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p2_0 44c1_s0/res_part2_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p3_0 44c1_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s0_p4_0 44c1_s0/res_part4_pass0.vqd, 2, nonseq, 0 +- 7 14 21 28 35 42 49
-:_s0_p4_1 44c1_s0/res_part4_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 
-
-:_s0_p5_0 44c1_s0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p5_0 44c1_s1/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1
-
-:_s0_p6_0 44c1_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c1_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c1_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-
-:_s0_p7_0 44c1_s0/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s0_p7_1 44c1_s0/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s0_p7_2 44c1_s0/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s1_p7_0 44c1_s1/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s1_p7_1 44c1_s1/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s1_p7_2 44c1_s1/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s2_p7_0 44c1_s2/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s2_p7_1 44c1_s2/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s2_p7_2 44c1_s2/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s3_p7_0 44c1_s3/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s3_p7_1 44c1_s3/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s3_p7_2 44c1_s3/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c1_sm/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c1_sm/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c1_sm/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c1_sm/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c1_sm/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c1_sm/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c1_sm/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c1_sm/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c1_sm/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c1_sm/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c4_sm/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p9_1 44c4_sm/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 
+:_p9_2 44c4_sm/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8

<p><p>1.3       +41 -44    vorbis/vq/44c2.vqs

Index: 44c2.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c2.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c2.vqs	2001/12/19 01:10:28	1.2
+++ 44c2.vqs	2002/06/28 22:19:56	1.3
@@ -1,51 +1,48 @@
-cp 44c2_s0/resaux_short.vqd _44c2_short.vqd
-cp 44c2_s0/resaux_long.vqd _44c2_long.vqd
+cp 44c2_s/resaux_0.vqd _44c2_s_short.vqd
+cp 44c2_s/resaux_1.vqd _44c2_s_long.vqd
+cp 44c2_sm/resaux_0.vqd _44c2_sm_short.vqd
+cp 44c2_sm/resaux_1.vqd _44c2_sm_long.vqd
 
-
 GO
-
->_44c2s noninterleaved
-haux _44c2_short.vqd 0,12,2
 
->_44c2 noninterleaved
-haux _44c2_long.vqd 0,48,2
+>_44c2s_s noninterleaved
+haux _44c2_s_short.vqd 0,16,2
 
+>_44c2_s noninterleaved
+haux _44c2_s_long.vqd 0,64,2
+	
 #iter 0
 
-#       0   1   2   4  26   1   4   +      
-#           0   0   0   0      
-#
-#       0   1   2   3   4   5   6   7
-#   1                   .           .
-#   2                   .           .
-#   4       .   .   .       .   .   .
-
-:_s0_p1_0 44c2_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p2_0 44c2_s0/res_part2_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p3_0 44c2_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s0_p4_0 44c2_s0/res_part4_pass0.vqd, 2, nonseq, 0 +- 7 14 21 28 35 42 49
-:_s0_p4_1 44c2_s0/res_part4_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 
-
-:_s0_p5_0 44c2_s0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p5_0 44c2_s1/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1
-
-:_s0_p6_0 44c2_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c2_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c2_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-
-:_s0_p7_0 44c2_s0/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s0_p7_1 44c2_s0/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s0_p7_2 44c2_s0/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s1_p7_0 44c2_s1/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s1_p7_1 44c2_s1/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s1_p7_2 44c2_s1/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s2_p7_0 44c2_s2/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s2_p7_1 44c2_s2/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s2_p7_2 44c2_s2/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s3_p7_0 44c2_s3/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201	
-:_s3_p7_1 44c2_s3/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s3_p7_2 44c2_s3/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c2_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c2_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c2_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c2_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c2_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c2_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c2_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c2_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c2_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c2_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c4_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p9_1 44c4_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 
+:_p9_2 44c4_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+
+>_44c2s_sm noninterleaved
+haux _44c2_sm_short.vqd 0,16,2
+
+>_44c2_sm noninterleaved
+haux _44c2_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +41 -45    vorbis/vq/44c3.vqs

Index: 44c3.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c3.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c3.vqs	2001/12/19 01:10:28	1.2
+++ 44c3.vqs	2002/06/28 22:19:56	1.3
@@ -1,52 +1,48 @@
-cp 44c3_s0/resaux_short.vqd _44c3_short.vqd
-cp 44c3_s0/resaux_long.vqd _44c3_long.vqd
+cp 44c3_s/resaux_0.vqd _44c3_s_short.vqd
+cp 44c3_s/resaux_1.vqd _44c3_s_long.vqd
+cp 44c3_sm/resaux_0.vqd _44c3_sm_short.vqd
+cp 44c3_sm/resaux_1.vqd _44c3_sm_long.vqd
 
-
 GO
-
->_44c3s noninterleaved
-haux _44c3_short.vqd 0,14,2
 
->_44c3 noninterleaved
-haux _44c3_long.vqd 0,52,2
+>_44c3s_s noninterleaved
+haux _44c3_s_short.vqd 0,16,2
 
+>_44c3_s noninterleaved
+haux _44c3_s_long.vqd 0,64,2
+	
 #iter 0
-
-#       0   1   2   4  26   1   4   +      
-#           0   0   0   0      
-#
-#       0   1   2   3   4   5   6   7
-#   1                   .           .
-#   2                   .           .
-#   4       .   .   .       .   .   .
-
-:_s0_p1_0 44c3_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p2_0 44c3_s0/res_part2_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p3_0 44c3_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s0_p4_0 44c3_s0/res_part4_pass0.vqd, 2, nonseq, 0 +- 7 14 21 28 35 42 49
-:_s0_p4_1 44c3_s0/res_part4_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 
-
-:_s0_p5_0 44c3_s0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p5_0 44c3_s1/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1
-
-:_s0_p6_0 44c3_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c3_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c3_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-
-:_s0_p7_0 44c3_s0/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 268 335 402
-:_s0_p7_1 44c3_s0/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s0_p7_2 44c3_s0/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s1_p7_0 44c3_s1/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 268 335 402
-:_s1_p7_1 44c3_s1/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s1_p7_2 44c3_s1/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s2_p7_0 44c3_s2/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 268 335 402
-:_s2_p7_1 44c3_s2/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s2_p7_2 44c3_s2/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
-
-:_s3_p7_0 44c3_s3/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 268 335 402
-:_s3_p7_1 44c3_s3/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33
-:_s3_p7_2 44c3_s3/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 
 
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                               .   .   .
+# 2                               .   .   .
+# 4       .   .   .   .   .   .           .
+ 
+:_p1_0 44c3_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c3_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c3_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c3_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c3_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c3_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c3_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c3_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
+
+:_p8_0 44c3_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c3_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c4_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530
+:_p9_1 44c4_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 44c4_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+
+>_44c3s_sm noninterleaved
+haux _44c3_sm_short.vqd 0,16,2
+
+>_44c3_sm noninterleaved
+haux _44c3_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +28 -85    vorbis/vq/44c4.vqs

Index: 44c4.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c4.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c4.vqs	2001/12/19 01:10:28	1.2
+++ 44c4.vqs	2002/06/28 22:19:56	1.3
@@ -1,105 +1,48 @@
-cp 44c4_s0/resaux_short.vqd _44c4_short.vqd
-cp 44c4_s0/resaux_long.vqd _44c4_long.vqd
+cp 44c4_s/resaux_0.vqd _44c4_s_short.vqd
+cp 44c4_s/resaux_1.vqd _44c4_s_long.vqd
+cp 44c4_sm/resaux_0.vqd _44c4_sm_short.vqd
+cp 44c4_sm/resaux_1.vqd _44c4_sm_long.vqd
 
 GO
 
->_44c4s noninterleaved
-haux _44c4_short.vqd 0,16,2
+>_44c4s_s noninterleaved
+haux _44c4_s_short.vqd 0,16,2
 
->_44c4 noninterleaved
-haux _44c4_long.vqd 0,64,2
+>_44c4_s noninterleaved
+haux _44c4_s_long.vqd 0,64,2
         
 #iter 0
 
-#     0   1   1   2   2   4   4  16  42   +      
-#         0       0       0    
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
 #     0   1   2   3   4   5   6   7   8   9
 # 1                               .   .   .
 # 2                               .   .   .
 # 4       .   .   .   .   .   .           .
  
-:_s0_p1_0 44c4_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p1_0 44c4_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c4_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c4_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c4_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c4_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c4_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
-:_s0_p2_0 44c4_s0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p2_0 44c4_s1/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 
 
-:_s0_p3_0 44c4_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p7_0 44c4_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c4_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p4_0 44c4_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s1_p4_0 44c4_s1/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-
-:_s0_p5_0 44c4_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-
-:_s0_p6_0 44c4_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c4_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c4_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 
-
-:_s0_p7_0 44c4_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c4_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s1_p7_0 44c4_s1/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s1_p7_1 44c4_s1/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s2_p7_0 44c4_s2/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s2_p7_1 44c4_s2/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s3_p7_0 44c4_s3/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s3_p7_1 44c4_s3/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-
-:_s0_p8_0 44c4_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p8_1 44c4_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s1_p8_0 44c4_s1/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s1_p8_1 44c4_s1/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s2_p8_0 44c4_s2/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s2_p8_1 44c4_s2/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s3_p8_0 44c4_s3/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s3_p8_1 44c4_s3/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-
-:_s0_p9_0 44c4_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 169 338 507 676 845 1014
-:_s0_p9_1 44c4_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
-:_s0_p9_2 44c4_s0/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s1_p9_0 44c4_s1/res_part9_pass0.vqd, 2, nonseq, 0 +- 169 338 507 676 845 1014
-:_s1_p9_1 44c4_s1/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
-:_s1_p9_2 44c4_s1/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s2_p9_0 44c4_s2/res_part9_pass0.vqd, 2, nonseq, 0 +- 169 338 507 676 845 1014
-:_s2_p9_1 44c4_s2/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
-:_s2_p9_2 44c4_s2/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s3_p9_0 44c4_s3/res_part9_pass0.vqd, 2, nonseq, 0 +- 169 338 507 676 845 1014
-:_s3_p9_1 44c4_s3/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 
-:_s3_p9_2 44c4_s3/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
+:_p8_0 44c4_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c4_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
 
-#iter 1 (stereo 3(8.)->2 2(4.)->1 1(2.)->0)  shared for all 'mid' modes
+:_p9_0 44c4_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 315 630 945 1260 1575 1890
+:_p9_1 44c4_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 44c4_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
 
-#     0   1   1   2   2   4   4  16  42   +      
-#         0       0       0    
 
-#     0   1   2   3   4   5   6   7   8   9
-# 1                               .   .   .
-# 2                               .   .   .
-# 4       .   .   .   .   .   .           .
- 
-:_s1_p2_s0 44cM_s1/res_part2_pass3.vqd, 2, nonseq, 0 +- 1 2 
-:_s1_p4_s0 44cM_s1/res_part4_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 
-:_s1_p6_s0 44cM_s1/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 
-:_s1_p7_s0 44cM_s1/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 
-:_s1_p8_s0 44cM_s1/res_part8_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 
-:_s1_p9_s0 44cM_s1/res_part9_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 
-
-:_s2_p6_s0 44cM_s2/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p7_s0 44cM_s2/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p8_s0 44cM_s2/res_part8_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p9_s0 44cM_s2/res_part9_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
-
-:_s3_p9_s0 44cM_s3/res_part789_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
-
-#iter 2 (residue backfill) shared for all 'mid' modes
-
-:_s0_p0_r0 44cM_s0/res_part0_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
-:_s0_pN_r0 44cM_s0/res_partN_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
-:_s1_pS_r0 44cM_s1/res_partS_r0.vqd, 2, nonseq, 0 +- .333333333
-
-#iter 3 (residue backfill)
-
-:_s0_p0_r1 44cM_s0/res_part0_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
-:_s0_pN_r1 44cM_s0/res_partN_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
-:_s1_pS_r1 44cM_s1/res_partS_r1.vqd, 2, nonseq, 0 +- .111111111 
-
+>_44c4s_sm noninterleaved
+haux _44c4_sm_short.vqd 0,16,2
 
+>_44c4_sm noninterleaved
+haux _44c4_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +32 -51    vorbis/vq/44c5.vqs

Index: 44c5.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c5.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c5.vqs	2001/12/19 01:10:28	1.2
+++ 44c5.vqs	2002/06/28 22:19:56	1.3
@@ -1,67 +1,48 @@
-cp 44c5_s0/resaux_short.vqd _44c5_short.vqd
-cp 44c5_s0/resaux_long.vqd _44c5_long.vqd
+cp 44c5_s/resaux_0.vqd _44c5_s_short.vqd
+cp 44c5_s/resaux_1.vqd _44c5_s_long.vqd
+cp 44c5_sm/resaux_0.vqd _44c5_sm_short.vqd
+cp 44c5_sm/resaux_1.vqd _44c5_sm_long.vqd
 
 GO
 
->_44c5s noninterleaved
-haux _44c5_short.vqd 0,16,2
+>_44c5s_s noninterleaved
+haux _44c5_s_short.vqd 0,16,2
 
->_44c5 noninterleaved
-haux _44c5_long.vqd 0,64,2
+>_44c5_s noninterleaved
+haux _44c5_s_long.vqd 0,64,2
         
 #iter 0
 
-#     0   1   1   2   2   4   4  16  42   +      
-#         0       0       0    
+#     0   1   1   2   2   4   8  16  32   +      
+#         0  99   0  99   4   8  16  32   +
 
 #     0   1   2   3   4   5   6   7   8   9
 # 1                               .   .   .
 # 2                               .   .   .
 # 4       .   .   .   .   .   .           .
  
-:_s0_p1_0 44c5_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p1_0 44c5_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c5_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c5_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c5_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c5_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c5_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
-:_s0_p2_0 44c5_s0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p2_0 44c5_s1/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 
 
-:_s0_p3_0 44c5_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p7_0 44c5_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c5_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p4_0 44c5_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s1_p4_0 44c5_s1/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-
-:_s0_p5_0 44c5_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-
-:_s0_p6_0 44c5_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c5_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c5_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 
-
-:_s0_p7_0 44c5_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c5_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s1_p7_0 44c5_s1/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s1_p7_1 44c5_s1/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s2_p7_0 44c5_s2/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s2_p7_1 44c5_s2/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s3_p7_0 44c5_s3/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s3_p7_1 44c5_s3/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-
-:_s0_p8_0 44c5_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p8_1 44c5_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s1_p8_0 44c5_s1/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s1_p8_1 44c5_s1/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s2_p8_0 44c5_s2/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s2_p8_1 44c5_s2/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s3_p8_0 44c5_s3/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s3_p8_1 44c5_s3/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-
-:_s0_p9_0 44c5_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547
-:_s0_p9_1 44c5_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 
-:_s0_p9_2 44c5_s0/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s1_p9_0 44c5_s1/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547
-:_s1_p9_1 44c5_s1/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 
-:_s1_p9_2 44c5_s1/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s2_p9_0 44c5_s2/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547
-:_s2_p9_1 44c5_s2/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 
-:_s2_p9_2 44c5_s2/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
-:_s3_p9_0 44c5_s3/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547
-:_s3_p9_1 44c5_s3/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 
-:_s3_p9_2 44c5_s3/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
+:_p8_0 44c5_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c5_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+
+:_p9_0 44c5_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 357 714 1071 1428 1785 2142 2499
+:_p9_1 44c5_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147 168
+:_p9_2 44c5_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+
+>_44c5s_sm noninterleaved
+haux _44c5_sm_short.vqd 0,16,2
+
+>_44c5_sm noninterleaved
+haux _44c5_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +37 -55    vorbis/vq/44c6.vqs

Index: 44c6.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c6.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c6.vqs	2001/12/19 01:10:28	1.2
+++ 44c6.vqs	2002/06/28 22:19:56	1.3
@@ -1,67 +1,49 @@
-cp 44c6_s0/resaux_short.vqd _44c6_short.vqd
-cp 44c6_s0/resaux_long.vqd _44c6_long.vqd
+cp 44c6_s/resaux_0.vqd _44c6_s_short.vqd
+cp 44c6_s/resaux_1.vqd _44c6_s_long.vqd
+cp 44c6_sm/resaux_0.vqd _44c6_sm_short.vqd
+cp 44c6_sm/resaux_1.vqd _44c6_sm_long.vqd
 
 GO
 
->_44c6s noninterleaved
-haux _44c6_short.vqd 0,16,2
+>_44c6s_s noninterleaved
+haux _44c6_s_short.vqd 0,16,2
 
->_44c6 noninterleaved
-haux _44c6_long.vqd 0,64,2
+>_44c6_s noninterleaved
+haux _44c6_s_long.vqd 0,64,2
         
-#iter 0
 
-#     0   1   1   2   2   4   4  16  42   +      
-#         0       0       0    
+#     0   1   2   4   8  16  32  71 157   +      
+#         1   2   3   4   8  16  71 157   +
 
 #     0   1   2   3   4   5   6   7   8   9
-# 1                               .   .   .
-# 2                               .   .   .
-# 4       .   .   .   .   .   .           .
+# 1                       .   .   .   .   .
+# 2                       .   .   .   .   .
+# 4       .   .   .   .                   .
  
-:_s0_p1_0 44c6_s0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p1_0 44c6_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c6_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c6_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c6_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
-:_s0_p2_0 44c6_s0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s1_p2_0 44c6_s1/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 
+:_p5_0 44c6_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c6_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p3_0 44c6_s0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c6_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c6_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
 
-:_s0_p4_0 44c6_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s1_p4_0 44c6_s1/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-
-:_s0_p5_0 44c6_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-
-:_s0_p6_0 44c6_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s1_p6_0 44c6_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-:_s2_p6_0 44c6_s2/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 
-
-:_s0_p7_0 44c6_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c6_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s1_p7_0 44c6_s1/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s1_p7_1 44c6_s1/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s2_p7_0 44c6_s2/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s2_p7_1 44c6_s2/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-:_s3_p7_0 44c6_s3/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s3_p7_1 44c6_s3/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
-
-:_s0_p8_0 44c6_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p8_1 44c6_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s1_p8_0 44c6_s1/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s1_p8_1 44c6_s1/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s2_p8_0 44c6_s2/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s2_p8_1 44c6_s2/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-:_s3_p8_0 44c6_s3/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s3_p8_1 44c6_s3/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6
-
-:_s0_p9_0 44c6_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548
-:_s0_p9_1 44c6_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s0_p9_2 44c6_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
-:_s1_p9_0 44c6_s1/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548
-:_s1_p9_1 44c6_s1/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s1_p9_2 44c6_s1/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
-:_s2_p9_0 44c6_s2/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548
-:_s2_p9_1 44c6_s2/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s2_p9_2 44c6_s2/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
-:_s3_p9_0 44c6_s3/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548
-:_s3_p9_1 44c6_s3/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s3_p9_2 44c6_s3/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
+:_p7_0 44c6_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c6_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c6_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c6_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44c7_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185 3822
+:_p9_1 44c6_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
+:_p9_2 44c6_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
+
+>_44c6s_sm noninterleaved
+haux _44c6_sm_short.vqd 0,16,2
+
+>_44c6_sm noninterleaved
+haux _44c6_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +34 -42    vorbis/vq/44c7.vqs

Index: 44c7.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c7.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c7.vqs	2001/12/19 01:10:28	1.2
+++ 44c7.vqs	2002/06/28 22:19:56	1.3
@@ -1,57 +1,49 @@
-cp 44c7_s0/resaux_short.vqd _44c7_short.vqd
-cp 44c7_s0/resaux_long.vqd _44c7_long.vqd
+cp 44c7_s/resaux_0.vqd _44c7_s_short.vqd
+cp 44c7_s/resaux_1.vqd _44c7_s_long.vqd
+cp 44c7_sm/resaux_0.vqd _44c7_sm_short.vqd
+cp 44c7_sm/resaux_1.vqd _44c7_sm_long.vqd
 
 GO
 
->_44c7s noninterleaved
-haux _44c7_short.vqd 0,16,2
+>_44c7s_s noninterleaved
+haux _44c7_s_short.vqd 0,16,2
 
->_44c7 noninterleaved
-haux _44c7_long.vqd 0,64,2
+>_44c7_s noninterleaved
+haux _44c7_s_long.vqd 0,64,2
         
-#iter 0
 
-#     0   8  42   1   2   4   8  16  56   +      
-#         0   0   0 
-           
-#     0   1   2   3   4   5   6   7   8   9
-# 1       .   .               .   .   .   .
-# 2       .   .               .   .   .   .
-# 4               .   .   .               .
-
-
-:_s0_p1_0 44c7_s0/res_part1_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p1_1 44c7_s0/res_part1_pass1.vqd, 2, nonseq cull, 0 +- 1 
-
-:_s0_p2_0 44c7_s0/res_part2_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p2_1 44c7_s0/res_part2_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 
+#     0   1   2   4   8  16  32  71 157   +      
+#         1   2   3   4   8  16  71 157   +
 
-:_s0_p3_0 44c7_s0/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p4_0 44c7_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p5_0 44c7_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
-
-:_s0_p6_0 44c7_s0/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p6_1 44c7_s0/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 
-
-:_s0_p7_0 44c7_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c7_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
+#     0   1   2   3   4   5   6   7   8   9
+# 1                       .   .   .   .   .
+# 2                       .   .   .   .   .
+# 4       .   .   .   .                   .
  
-:_s0_p8_0 44c7_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 15 30 45 60 75 90 105
-:_s0_p8_1 44c7_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7
-
-:_s0_p9_0 44c7_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548
-:_s0_p9_1 44c7_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s0_p9_2 44c7_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
+:_p1_0 44c7_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c7_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c7_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c7_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
-#iter 1
+:_p5_0 44c7_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c7_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p0_r0 44cH_s0/res_part0_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
-:_s0_pN_r0 44cH_s0/res_partN_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667
+:_p6_0 44c7_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c7_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
 
-#iter 2
+:_p7_0 44c7_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c7_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
 
-:_s0_p0_r1 44cH_s0/res_part0_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
-:_s0_pN_r1 44cH_s0/res_partN_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222
+:_p8_0 44c7_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c7_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
 
+:_p9_0 44c7_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185 3822
+:_p9_1 44c7_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
+:_p9_2 44c7_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
 
+>_44c7s_sm noninterleaved
+haux _44c7_sm_short.vqd 0,16,2
 
+>_44c7_sm noninterleaved
+haux _44c7_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +35 -30    vorbis/vq/44c8.vqs

Index: 44c8.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c8.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c8.vqs	2001/12/19 01:10:28	1.2
+++ 44c8.vqs	2002/06/28 22:19:56	1.3
@@ -1,44 +1,49 @@
-cp 44c8_s0/resaux_short.vqd _44c8_short.vqd
-cp 44c8_s0/resaux_long.vqd _44c8_long.vqd
+cp 44c8_s/resaux_0.vqd _44c8_s_short.vqd
+cp 44c8_s/resaux_1.vqd _44c8_s_long.vqd
+cp 44c8_sm/resaux_0.vqd _44c8_sm_short.vqd
+cp 44c8_sm/resaux_1.vqd _44c8_sm_long.vqd
 
 GO
 
->_44c8s noninterleaved
-haux _44c8_short.vqd 0,16,2
+>_44c8s_s noninterleaved
+haux _44c8_s_short.vqd 0,16,2
 
->_44c8 noninterleaved
-haux _44c8_long.vqd 0,64,2
+>_44c8_s noninterleaved
+haux _44c8_s_long.vqd 0,64,2
         
-#iter 0
 
-#     0   8  42   1   2   4   8  16  56   +      
-#         0   0   0 
-           
+#     0   1   2   4   8  16  32  71 157   +      
+#         1   2   3   4   8  16  71 157   +
+
 #     0   1   2   3   4   5   6   7   8   9
-# 1       .   .               .   .   .   .
-# 2       .   .               .   .   .   .
-# 4               .   .   .               .
+# 1                       .   .   .   .   .
+# 2                       .   .   .   .   .
+# 4       .   .   .   .                   .
+ 
+:_p1_0 44c8_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c8_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c8_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c8_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
+:_p5_0 44c8_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c8_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p1_0 44c8_s0/res_part1_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p1_1 44c8_s0/res_part1_pass1.vqd, 2, nonseq cull, 0 +- 1 
+:_p6_0 44c8_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c8_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
 
-:_s0_p2_0 44c8_s0/res_part2_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p2_1 44c8_s0/res_part2_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 
+:_p7_0 44c8_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c8_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
 
-:_s0_p3_0 44c8_s0/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p4_0 44c8_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p5_0 44c8_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+:_p8_0 44c8_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c8_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
 
-:_s0_p6_0 44c8_s0/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p6_1 44c8_s0/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 
+:_p9_0 44c9_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517 7448 
+:_p9_1 44c9_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44c8_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
 
-:_s0_p7_0 44c8_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c8_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
- 
-:_s0_p8_0 44c8_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 15 30 45 60 75 90 105
-:_s0_p8_1 44c8_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7
+>_44c8s_sm noninterleaved
+haux _44c8_sm_short.vqd 0,16,2
 
-:_s0_p9_0 44c8_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185
-:_s0_p9_1 44c8_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
-:_s0_p9_2 44c8_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
+>_44c8_sm noninterleaved
+haux _44c8_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.3       +35 -30    vorbis/vq/44c9.vqs

Index: 44c9.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/44c9.vqs,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 44c9.vqs	2001/12/19 01:10:28	1.2
+++ 44c9.vqs	2002/06/28 22:19:56	1.3
@@ -1,44 +1,49 @@
-cp 44c9_s0/resaux_short.vqd _44c9_short.vqd
-cp 44c9_s0/resaux_long.vqd _44c9_long.vqd
+cp 44c9_s/resaux_0.vqd _44c9_s_short.vqd
+cp 44c9_s/resaux_1.vqd _44c9_s_long.vqd
+cp 44c9_sm/resaux_0.vqd _44c9_sm_short.vqd
+cp 44c9_sm/resaux_1.vqd _44c9_sm_long.vqd
 
 GO
 
->_44c9s noninterleaved
-haux _44c9_short.vqd 0,16,2
+>_44c9s_s noninterleaved
+haux _44c9_s_short.vqd 0,16,2
 
->_44c9 noninterleaved
-haux _44c9_long.vqd 0,64,2
+>_44c9_s noninterleaved
+haux _44c9_s_long.vqd 0,64,2
         
-#iter 0
 
-#     0   8  42   1   2   4   8  16  56   +      
-#         0   0   0 
-           
+#     0   1   2   4   8  16  32  71 157   +      
+#         1   2   3   4   8  16  71 157   +
+
 #     0   1   2   3   4   5   6   7   8   9
-# 1       .   .               .   .   .   .
-# 2       .   .               .   .   .   .
-# 4               .   .   .               .
+# 1                       .   .   .   .   .
+# 2                       .   .   .   .   .
+# 4       .   .   .   .                   .
+ 
+:_p1_0 44c9_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c9_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c9_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c9_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
 
+:_p5_0 44c9_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c9_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 
 
-:_s0_p1_0 44c9_s0/res_part1_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p1_1 44c9_s0/res_part1_pass1.vqd, 2, nonseq cull, 0 +- 1 
+:_p6_0 44c9_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c9_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
 
-:_s0_p2_0 44c9_s0/res_part2_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78
-:_s0_p2_1 44c9_s0/res_part2_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 
+:_p7_0 44c9_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c9_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
 
-:_s0_p3_0 44c9_s0/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
-:_s0_p4_0 44c9_s0/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
-:_s0_p5_0 44c9_s0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+:_p8_0 44c9_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c9_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
 
-:_s0_p6_0 44c9_s0/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 3 6 19 12 15
-:_s0_p6_1 44c9_s0/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 
+:_p9_0 44c9_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517 7448 8379
+:_p9_1 44c9_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44c9_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 
 
-:_s0_p7_0 44c9_s0/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
-:_s0_p7_1 44c9_s0/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 
- 
-:_s0_p8_0 44c9_s0/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 15 30 45 60 75 90 105
-:_s0_p8_1 44c9_s0/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7
+>_44c9s_sm noninterleaved
+haux _44c9_sm_short.vqd 0,16,2
 
-:_s0_p9_0 44c9_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 1863 3726 5589 7452 9315 11178 13041 14904 16767 18630 20493
-:_s0_p9_1 44c9_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 81 162 243 324 405 486 567 648 729 810 891
-:_s0_p9_2 44c9_s0/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
+>_44c9_sm noninterleaved
+haux _44c9_sm_long.vqd 0,64,2
+	
\ No newline at end of file

<p><p>1.5       +2 -17     vorbis/vq/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.am	2001/08/13 01:37:16	1.4
+++ Makefile.am	2002/06/28 22:19:56	1.5
@@ -4,26 +4,13 @@
 
 INCLUDES = -I../lib -I$(top_srcdir)/include @OGG_CFLAGS@
 
-EXTRA_PROGRAMS = lspvqtrain genericvqtrain residuevqtrain vqbuild\
-	vqcascade vqmetrics latticebuild latticepare latticehint\
-	latticetune huffbuild residuesplit distribution
+EXTRA_PROGRAMS = latticebuild latticepare latticehint\
+	latticetune huffbuild distribution
 CLEANFILES = $(EXTRA_PROGRAMS)
 
 LDFLAGS = -static
 LDADD = ../lib/libvorbis.la
 
-lspvqtrain_SOURCES = lspdata.c train.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h vqext.h
-genericvqtrain_SOURCES = genericdata.c train.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h vqext.h
-residuevqtrain_SOURCES = residuedata.c train.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h vqext.h
-vqbuild_SOURCES = build.c vqgen.c bookutil.c vqsplit.c\
-	vqgen.h bookutil.h vqext.h
-vqcascade_SOURCES = run.c cascade.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
-vqmetrics_SOURCES = run.c metrics.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
 latticebuild_SOURCES = latticebuild.c vqgen.c bookutil.c\
         vqgen.h bookutil.h
 latticepare_SOURCES = latticepare.c vqgen.c bookutil.c vqsplit.c\
@@ -33,8 +20,6 @@
 latticetune_SOURCES = latticetune.c vqgen.c bookutil.c\
         vqgen.h bookutil.h
 huffbuild_SOURCES = huffbuild.c vqgen.c bookutil.c\
-	vqgen.h bookutil.h
-residuesplit_SOURCES = residuesplit.c vqgen.c bookutil.c\
         vqgen.h bookutil.h
 distribution_SOURCES = distribution.c bookutil.c\
         bookutil.h

<p><p>1.27      +1 -22     vorbis/vq/bookutil.c

Index: bookutil.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/bookutil.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- bookutil.c	2001/12/20 01:00:39	1.26
+++ bookutil.c	2002/06/28 22:19:56	1.27
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: utility functions for loading .vqh and .vqd files
- last mod: $Id: bookutil.c,v 1.26 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id: bookutil.c,v 1.27 2002/06/28 22:19:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -534,26 +534,7 @@
   int i,j,k;
 
   /* save the book in C header form */
-  fprintf(out,
-  "/********************************************************************\n"
-  " *                                                                  *\n"
-  " * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *\n"
-  " * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *\n"
-  " * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *\n"
-  " * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *\n"
-  " *                                                                  *\n"
-  " * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *\n"
-  " * by the XIPHOPHORUS Company 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 \"codebook.h\"\n\n");
-
   /* first, the static vectors, then the book structure to tie it together. */
   /* quantlist */
   if(c->quantlist){
@@ -733,6 +714,4 @@
     fprintf(out,"\tNULL,\n");
 
   fprintf(out,"\t0\n};\n\n");
-
-  fprintf(out,"\n#endif\n");
 }

<p><p>1.13      +3 -24     vorbis/vq/huffbuild.c

Index: huffbuild.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/huffbuild.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- huffbuild.c	2001/12/20 01:00:39	1.12
+++ huffbuild.c	2002/06/28 22:19:56	1.13
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: hufftree builder
- last mod: $Id: huffbuild.c,v 1.12 2001/12/20 01:00:39 segher Exp $
+ last mod: $Id: huffbuild.c,v 1.13 2002/06/28 22:19:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -127,8 +127,8 @@
 
   {
     long vals=pow(maxval,subn);
-    long *hist=_ogg_malloc(vals*sizeof(long));
-    long *lengths=_ogg_malloc(vals*sizeof(long));
+    long *hist=_ogg_calloc(vals,sizeof(long));
+    long *lengths=_ogg_calloc(vals,sizeof(long));
     
     for(j=loval;j<vals;j++)hist[j]=guard;
     
@@ -160,26 +160,6 @@
       }
     }
     
-    fprintf(file,
-  "/********************************************************************\n"
-  " *                                                                  *\n"
-  " * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *\n"
-  " * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *\n"
-  " * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *\n"
-  " * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *\n"
-  " *                                                                  *\n"
-  " * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *\n"
-  " * by the XIPHOPHORUS Company http://www.xiph.org/                  *\n"
-  " *                                                                  *\n"
-  " ********************************************************************\n"
-  "\n"
-  " function: static codebook autogenerated by huff/huffbuld\n"
-  "\n"
-  " ********************************************************************/\n\n");
-
-    fprintf(file,"#ifndef _V_%s_VQH_\n#define _V_%s_VQH_\n",base,base);
-    fprintf(file,"#include \"codebook.h\"\n\n");
-    
     /* first, the static vectors, then the book structure to tie it together. */
     /* lengthlist */
     fprintf(file,"static long _huff_lengthlist_%s[] = {\n",base);
@@ -203,7 +183,6 @@
     fprintf(file,"\tNULL,\n");
     fprintf(file,"\t0\n};\n\n");
     
-    fprintf(file,"\n#endif\n");
     fclose(file);
     fprintf(stderr,"Done.                                \n\n");
   }

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



More information about the commits mailing list