[xiph-cvs] cvs commit: vorbis/vq res_160c.vqs res_192c.vqs res_350c.vqs res_64c.vqs res_96Zc.vqs res_96c.vqs Makefile.am auxpartition.pl distribution.c latticehint.c make_residue_books.pl res_128c.vqs residuesplit.c

Monty xiphmont at xiph.org
Sun Aug 12 18:37:21 PDT 2001



xiphmont    01/08/12 18:37:19

  Modified:    .        configure.in
               doc      stereo.html
               examples chaining_example.c
               include/vorbis vorbisenc.h
               lib      analysis.c backends.h barkmel.c block.c codebook.c
                        codec_internal.h envelope.c floor0.c floor1.c
                        info.c mapping0.c os.h psy.c psy.h psytune.c
                        registry.c registry.h res0.c sharedbook.c
                        synthesis.c time0.c vorbisenc.c
               lib/modes mode_A.h mode_B.h mode_C.h mode_D.h mode_E.h
                        modes.h
               vq       Makefile.am auxpartition.pl distribution.c
                        latticehint.c make_residue_books.pl res_128c.vqs
                        residuesplit.c
  Added:       lib/books Makefile Makefile.in 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_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
                        res_Zc_1.vqh res_Zc_1024aux.vqh res_Zc_128aux.vqh
                        res_Zc_2.vqh res_Zc_3.vqh res_Zc_4.vqh res_Zc_5.vqh
                        res_Zc_6.vqh res_Zc_7.vqh res_Zc_8.vqh res_Zc_9.vqh
                        res_Zc_9a.vqh res_Zc_9b.vqh
               lib/modes maskadj_Z.h mode_44c_Z.h mode_Za.h mode_Zb.h
                        mode_Zc.h
               vq       res_160c.vqs res_192c.vqs res_350c.vqs res_64c.vqs
                        res_96Zc.vqs res_96c.vqs
  Removed:     lib/books res0_128_1024_1.vqh res0_128_1024_2.vqh
                        res0_128_1024_3.vqh res0_128_1024_4.vqh
                        res0_128_1024_5.vqh res0_128_1024_6.vqh
                        res0_128_1024_7.vqh res0_128_1024_8.vqh
                        res0_128_1024_9.vqh res0_128_1024aux.vqh
                        res0_128_128_1.vqh res0_128_128_2.vqh
                        res0_128_128_3.vqh res0_128_128_4.vqh
                        res0_128_128_5.vqh res0_128_128aux.vqh
                        res0_160_1024_1.vqh res0_160_1024_2.vqh
                        res0_160_1024_3.vqh res0_160_1024_4.vqh
                        res0_160_1024_5.vqh res0_160_1024_6.vqh
                        res0_160_1024_7.vqh res0_160_1024_8.vqh
                        res0_160_1024_9.vqh res0_160_1024aux.vqh
                        res0_160_128_1.vqh res0_160_128_2.vqh
                        res0_160_128_3.vqh res0_160_128_4.vqh
                        res0_160_128_5.vqh res0_160_128aux.vqh
                        res0_192_1024_1.vqh res0_192_1024_2.vqh
                        res0_192_1024_3.vqh res0_192_1024_4.vqh
                        res0_192_1024_5.vqh res0_192_1024_6.vqh
                        res0_192_1024_7.vqh res0_192_1024_8.vqh
                        res0_192_1024_9.vqh res0_192_1024aux.vqh
                        res0_192_128_1.vqh res0_192_128_2.vqh
                        res0_192_128_3.vqh res0_192_128_4.vqh
                        res0_192_128_5.vqh res0_192_128aux.vqh
                        res0_256_1024_1.vqh res0_256_1024_2.vqh
                        res0_256_1024_3.vqh res0_256_1024_4.vqh
                        res0_256_1024_5.vqh res0_256_1024_6.vqh
                        res0_256_1024_7.vqh res0_256_1024aux.vqh
                        res0_256_128_1.vqh res0_256_128_2.vqh
                        res0_256_128_3.vqh res0_256_128_4.vqh
                        res0_256_128_5.vqh res0_256_128aux.vqh
                        res0_350_1024_7.vqh res0_96_1024_1.vqh
                        res0_96_1024_2.vqh res0_96_1024_3.vqh
                        res0_96_1024_4.vqh res0_96_1024_5.vqh
                        res0_96_1024_6.vqh res0_96_1024_7.vqh
                        res0_96_1024_8.vqh res0_96_1024_9.vqh
                        res0_96_1024aux.vqh res0_96_128_1.vqh
                        res0_96_128_2.vqh res0_96_128_3.vqh
                        res0_96_128_4.vqh res0_96_128_5.vqh
                        res0_96_128aux.vqh
  Log:
  Bringing rc2 (minus the modes it needs) onto mainline.
  
  Monty

Revision  Changes    Path
1.41      +0 -1      vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- configure.in	2001/06/18 00:20:18	1.40
+++ configure.in	2001/08/13 01:36:54	1.41
@@ -171,7 +171,6 @@
 AC_CHECK_FUNCS(sqrtf)
 AC_CHECK_FUNCS(logf)
 AC_CHECK_FUNCS(expf)
-AC_CHECK_FUNCS(powf)
 AC_CHECK_FUNCS(acosf)
 AC_CHECK_FUNCS(atanf)
 AC_CHECK_FUNCS(frexpf)

1.3       +4 -0      vorbis/doc/stereo.html

Index: stereo.html
===================================================================
RCS file: /usr/local/cvsroot/vorbis/doc/stereo.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- stereo.html	2001/07/02 04:31:05	1.2
+++ stereo.html	2001/08/13 01:36:55	1.3
@@ -437,6 +437,10 @@
 <dt>aggressive eight phase stereo
 <dd>a mixed mode combining lossless stereo for frequencies to approximately 2 kHz (and for all strong pure tones) and eight phase stereo above<p>
 
+<dt>eight/four phase stero <dd>A mixed mode combining lossless stereo
+for bass, eight phase stereo for noisy content and lossless stereo for
+tones to approximately 4kHz and four phase stereo above 4kHz.<p>
+
 <dt>eight phase/point stero <dd>A mixed mode combining lossless stereo
 for bass, eight phase stereo for noisy content and lossless stereo for
 tones to approximately 4kHz and point stereo above 4kHz.<p>

1.10      +3 -1      vorbis/examples/chaining_example.c

Index: chaining_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/chaining_example.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- chaining_example.c	2001/02/26 03:50:38	1.9
+++ chaining_example.c	2001/08/13 01:36:55	1.10
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: illustrate simple use of chained bitstream and vorbisfile.a
- last mod: $Id: chaining_example.c,v 1.9 2001/02/26 03:50:38 xiphmont Exp $
+ last mod: $Id: chaining_example.c,v 1.10 2001/08/13 01:36:55 xiphmont Exp $
 
  ********************************************************************/
 
@@ -46,6 +46,8 @@
     printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
            vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
            ov_serialnumber(&ov,i));
+    printf("\t\theader length: %ld bytes\n",(long)
+	   (ov.dataoffsets[i]-ov.offsets[i]));
     printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));
     printf(" play time: %lds\n",(long)ov_time_total(&ov,i));
   }

1.5       +8 -1      vorbis/include/vorbis/vorbisenc.h

Index: vorbisenc.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/vorbisenc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- vorbisenc.h	2001/02/26 03:50:39	1.4
+++ vorbisenc.h	2001/08/13 01:36:56	1.5
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: vorbis encode-engine setup
- last mod: $Id: vorbisenc.h,v 1.4 2001/02/26 03:50:39 xiphmont Exp $
+ last mod: $Id: vorbisenc.h,v 1.5 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -32,6 +32,13 @@
                               long max_bitrate,
                               long nominal_bitrate,
                               long min_bitrate);
+
+extern int vorbis_encode_init_vbr(vorbis_info *vi,
+				  long channels,
+				  long rate,
+				  
+				  float /* quality level from 0. (lo) to 1. (hi) */
+				  );
 
 extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
 

1.46      +6 -3      vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- analysis.c	2001/08/07 13:04:41	1.45
+++ analysis.c	2001/08/13 01:36:56	1.46
@@ -7,11 +7,11 @@
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
-
+ *                                                                  *
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.45 2001/08/07 13:04:41 msmith Exp $
+ last mod: $Id: analysis.c,v 1.46 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -20,10 +20,13 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "scales.h"
 #include "os.h"
 
+int analysis_noisy=1;
+
 /* decides between modes, dispatches to the appropriate mapping. */
 int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
   vorbis_dsp_state     *vd=vb->vd;
@@ -108,7 +111,7 @@
 
 void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
 #ifdef ANALYSIS
-  _analysis_output_always(base,i,v,n,bark,dB);
+  if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB);
 #endif
 }
 

1.10      +12 -6     vorbis/lib/backends.h

Index: backends.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/backends.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- backends.h	2001/06/15 23:31:00	1.9
+++ backends.h	2001/08/13 01:36:56	1.10
@@ -12,7 +12,7 @@
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.9 2001/06/15 23:31:00 xiphmont Exp $
+ last mod: $Id: backends.h,v 1.10 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -61,9 +61,9 @@
   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 */
-		     const float *, const float *, /* in */
-		     float *, float *);            /* out */
+		     float *);                     /* out */
   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
                      void *buffer,float *);
@@ -114,6 +114,8 @@
   int   unusedminsize;
   int   unusedmin_n;
 
+  int   n;
+
 } vorbis_info_floor1;
 
 /* Residue backend generic *****************************************/
@@ -125,8 +127,10 @@
   vorbis_info_residue *(*copy_info)(vorbis_info_residue *);
   void (*free_info)    (vorbis_info_residue *);
   void (*free_look)    (vorbis_look_residue *);
-  int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
+  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 **);
   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
                         float **,int *,int);
 } vorbis_func_residue;
@@ -148,7 +152,7 @@
   float  ampmax[64];       /* book amp threshholds*/
   int    subgrp[64];       /* book heuristic subgroup size */
   int    blimit[64];       /* subgroup position limits */
-
+  int    passlimit[32];     /* iteration limit per couple/quant pass */
 } vorbis_info_residue0;
 
 /* Mapping backend generic *****************************************/
@@ -172,7 +176,9 @@
   int   timesubmap[16];    /* [mux] */
   int   floorsubmap[16];   /* [mux] submap to floors */
   int   residuesubmap[16]; /* [mux] submap to residue */
-  int   psysubmap[16];     /* [mux]; encode only */
+
+  int   psy[2]; /* by blocktype; impulse/padding for short,
+                   transition/normal for long */
 
   int   coupling_steps;
   int   coupling_mag[256];

1.8       +2 -2      vorbis/lib/barkmel.c

Index: barkmel.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/barkmel.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- barkmel.c	2001/06/15 21:15:39	1.7
+++ barkmel.c	2001/08/13 01:36:56	1.8
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: bark scale utility
- last mod: $Id: barkmel.c,v 1.7 2001/06/15 21:15:39 xiphmont Exp $
+ last mod: $Id: barkmel.c,v 1.8 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -54,7 +54,7 @@
   {
     float i;
     int j;
-    for(i=0.,j=0;i<28;i+=1.,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.));
     }

1.49      +11 -8     vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- block.c	2001/05/27 06:43:59	1.48
+++ block.c	2001/08/13 01:36:56	1.49
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.48 2001/05/27 06:43:59 xiphmont Exp $
+ last mod: $Id: block.c,v 1.49 2001/08/13 01:36:56 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -174,7 +174,6 @@
 
   v->vi=vi;
   b->modebits=ilog2(ci->modes);
-  b->ampmax=-9999;
 
   b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
   b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
@@ -263,11 +262,11 @@
 
   _vds_shared_init(v,vi,1);
   b=v->backend_state;
+  b->psy_g_look=_vp_global_look(vi);
 
   /* Initialize the envelope state storage */
   b->ve=_ogg_calloc(1,sizeof(envelope_lookup));
   _ve_envelope_init(b->ve,vi);
-
   return(0);
 }
 
@@ -307,6 +306,7 @@
         _ogg_free(b->transform[1][0]);
         _ogg_free(b->transform[1]);
       }
+      if(b->psy_g_look)_vp_global_free(b->psy_g_look);
       
     }
     
@@ -406,6 +406,7 @@
 int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
+  /*backend_lookup_state *b=v->backend_state;*/
 
   if(vals<=0){
     int order=32;
@@ -472,6 +473,8 @@
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
   backend_lookup_state *b=v->backend_state;
+  vorbis_look_psy_global *g=b->psy_g_look;
+  vorbis_info_psy_global *gi=ci->psy_g_param;
   long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext;
 
   /* check to see if we're started... */
@@ -542,9 +545,10 @@
     vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
 
     /* this tracks 'strongest peak' for later psychoacoustics */
-    if(vbi->ampmax>b->ampmax)b->ampmax=vbi->ampmax;
-    b->ampmax=_vp_ampmax_decay(b->ampmax,v);
-    vbi->ampmax=b->ampmax;
+    /* moved to the global psy state; clean this mess up */
+    if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax;
+    g->ampmax=_vp_ampmax_decay(g->ampmax,v);
+    vbi->ampmax=g->ampmax;
 
     vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
     vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
@@ -576,7 +580,7 @@
 
   /* advance storage vectors and clean up */
   {
-    int new_centerNext=ci->blocksizes[1]/2+ci->delaycache;
+    int new_centerNext=ci->blocksizes[1]/2+gi->delaycache;
     int movementW=centerNext-new_centerNext;
 
     if(movementW>0){
@@ -614,7 +618,6 @@
 }
 
 int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
-  codec_setup_info *ci=vi->codec_setup;
   _vds_shared_init(v,vi,0);
 
   v->pcm_returned=-1;

1.28      +2 -2      vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- codebook.c	2001/06/18 22:19:26	1.27
+++ codebook.c	2001/08/13 01:36:56	1.28
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.27 2001/06/18 22:19:26 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.28 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -424,7 +424,7 @@
     entry = vorbis_book_decode(book,b);
     if(entry==-1)return(-1);
     {
-      const float *t     = book->valuelist+entry*book->dim;
+      const float *t = book->valuelist+entry*book->dim;
       for (j=0;j<book->dim;j++){
         a[chptr++][i]+=t[j];
         if(chptr==ch){

1.9       +34 -43    vorbis/lib/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codec_internal.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- codec_internal.h	2001/03/26 23:27:43	1.8
+++ codec_internal.h	2001/08/13 01:36:56	1.9
@@ -10,7 +10,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.8 2001/03/26 23:27:43 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.9 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -19,8 +19,6 @@
 
 #include "envelope.h"
 #include "codebook.h"
-#include "psy.h"
-#include "bitbuffer.h"
 
 typedef struct vorbis_block_internal{
   float  **pcmdelay;  /* this is a pointer into local storage */ 
@@ -33,12 +31,28 @@
 typedef void vorbis_look_residue;
 typedef void vorbis_look_transform;
 
+/* mode ************************************************************/
+typedef struct {
+  int blockflag;
+  int windowtype;
+  int transformtype;
+  int mapping;
+} vorbis_info_mode;
+
+typedef void vorbis_info_time;
+typedef void vorbis_info_floor;
+typedef void vorbis_info_residue;
+typedef void vorbis_info_mapping;
+
+#include "psy.h"
+
 typedef struct backend_lookup_state {
   /* local lookup storage */
   envelope_lookup        *ve; /* envelope lookup */    
   float                 **window[2][2][2]; /* block, leadin, leadout, type */
   vorbis_look_transform **transform[2];    /* block, type */
   codebook               *fullbooks;
+  vorbis_look_psy_global *psy_g_look;
 
   /* backend lookups are tied to the mode, not the backend or naked mapping */
   int                     modebits;
@@ -51,24 +65,9 @@
   unsigned char *header;
   unsigned char *header1;
   unsigned char *header2;
-
-  float ampmax;
-
+  
 } backend_lookup_state;
 
-/* mode ************************************************************/
-typedef struct {
-  int blockflag;
-  int windowtype;
-  int transformtype;
-  int mapping;
-} vorbis_info_mode;
-
-typedef void vorbis_info_time;
-typedef void vorbis_info_floor;
-typedef void vorbis_info_residue;
-typedef void vorbis_info_mapping;
-
 /* vorbis_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,
    psychoacoustic settings, channel setup, options, codebook
@@ -83,7 +82,7 @@
   long blocksizes[2];
 
   /* modes are the primary means of supporting on-the-fly different
-     blocksizes, different channel mappings (LR or mid-side),
+     blocksizes, different channel mappings (LR or M/A),
      different residue backends, etc.  Each mode consists of a
      blocksize flag and a mapping (along with the mapping setup */
 
@@ -95,30 +94,22 @@
   int        books;
   int        psys;     /* encode only */
 
-  vorbis_info_mode    *mode_param[64];
-  int                  map_type[64];
-  vorbis_info_mapping *map_param[64];
-  int                  time_type[64];
-  vorbis_info_time    *time_param[64];
-  int                  floor_type[64];
-  vorbis_info_floor   *floor_param[64];
-  int                  residue_type[64];
-  vorbis_info_residue *residue_param[64];
-  static_codebook     *book_param[256];
-  vorbis_info_psy     *psy_param[64]; /* encode only */
-  
-  /* for block long/sort tuning; encode only */
-  int       envelopesa;
-  float     preecho_thresh[4];
-  float     postecho_thresh[4];
-  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;
+  vorbis_info_mode       *mode_param[64];
+  int                     map_type[64];
+  vorbis_info_mapping    *map_param[64];
+  int                     time_type[64];
+  vorbis_info_time       *time_param[64];
+  int                     floor_type[64];
+  vorbis_info_floor      *floor_param[64];
+  int                     residue_type[64];
+  vorbis_info_residue    *residue_param[64];
+  static_codebook        *book_param[256];
+  vorbis_info_psy        *psy_param[64]; /* encode only */
+  vorbis_info_psy_global *psy_g_param;
 
 } 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

1.37      +10 -10    vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- envelope.c	2001/05/27 06:43:59	1.36
+++ envelope.c	2001/08/13 01:36:56	1.37
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.36 2001/05/27 06:43:59 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.37 2001/08/13 01:36:56 xiphmont Exp $
 
  Preecho calculation.
 
@@ -82,11 +82,12 @@
 
 void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
   codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy_global *gi=ci->psy_g_param;
   int ch=vi->channels;
-  int window=ci->envelopesa;
+  int window=gi->envelopesa;
   int i;
   e->winlength=window;
-  e->minenergy=fromdB(ci->preecho_minenergy);
+  e->minenergy=fromdB(gi->preecho_minenergy);
   e->iir=_ogg_calloc(ch*4,sizeof(IIR_state));
   e->filtered=_ogg_calloc(ch*4,sizeof(float *));
   e->ch=ch;
@@ -132,8 +133,8 @@
      basing blocks on quantization noise that outweighs the signal
      itself (for low power signals) */
 
-  float min=ve->minenergy;
-  float A=min*min*n;
+  float minV=ve->minenergy;
+  float A=minV*minV*n;
   float B=A;
 
   for(i=0;i<n;i++){
@@ -150,10 +151,9 @@
 long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy_global *gi=ci->psy_g_param;
   envelope_lookup *ve=((backend_lookup_state *)(v->backend_state))->ve;
-  long i,j,k,l;
-  float *work=alloca(sizeof(float)*ve->winlength*2);
-  static int seq=0;
+  long i,j,k;
 
   /* make sure we have enough storage to match the PCM */
   if(v->pcm_storage>ve->storage){
@@ -210,8 +210,8 @@
         float *filtered=ve->filtered[i*4+k]+j;
         float m=_ve_deltai(ve,filtered-ve->winlength,filtered);
       
-	if(m>ci->preecho_thresh[k])return(0);
-	if(m<ci->postecho_thresh[k])return(0);
+	if(m>gi->preecho_thresh[k])return(0);
+	if(m<gi->postecho_thresh[k])return(0);
 
       }
     }

1.45      +14 -10    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- floor0.c	2001/06/18 09:07:31	1.44
+++ floor0.c	2001/08/13 01:36:56	1.45
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.44 2001/06/18 09:07:31 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.45 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -42,6 +42,8 @@
   lpc_lookup lpclook;
   float *lsp_look;
 
+  long bits;
+  long frames;
 } vorbis_look_floor0;
 
 /* infrastructure for finding fit */
@@ -86,6 +88,10 @@
 static void floor0_free_look(vorbis_look_floor *i){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   if(i){
+
+    /*fprintf(stderr,"floor 0 bit usage %f\n",
+      (float)look->bits/look->frames);*/
+
     if(look->linearmap)_ogg_free(look->linearmap);
     if(look->lsp_look)_ogg_free(look->lsp_look);
     lpc_clear(&look->lpclook);
@@ -252,9 +258,9 @@
 }
 
 static int floor0_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  const float *mdct, const float *logmdct,   /* in */
+			  float *mdct, const float *logmdct,   /* in */
                           const float *logmask, const float *logmax, /* in */
-			  float *residue, float *codedflr){          /* out */
+			  float *codedflr){          /* out */
   long j;
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)in;
   vorbis_info_floor0 *info=look->vi;
@@ -313,6 +319,8 @@
   }
 
   oggpack_write(&vb->opb,val,info->ampbits);
+  look->bits+=info->ampbits+1;
+  look->frames++;
 
   if(val){
     float *lspwork=alloca(look->m*sizeof(float));
@@ -342,7 +350,7 @@
 
     b=be->fullbooks+info->books[booknum];
     oggpack_write(&vb->opb,booknum,_ilog(info->numbooks));
-
+    look->bits+=_ilog(info->numbooks);
 
 #ifdef TRAIN_LSP
     {
@@ -366,7 +374,7 @@
 
     for(j=0;j<look->m;j+=b->dim){
       int entry=_f0_fit(b,codedflr,lspwork,j);
-      bits+=vorbis_book_encode(b,entry,&vb->opb);
+      look->bits+=vorbis_book_encode(b,entry,&vb->opb);
 
 #ifdef TRAIN_LSP
       fprintf(ef,"%d,\n",entry);
@@ -389,10 +397,6 @@
     _analysis_output("barklsp",seq-1,codedflr,look->n,1,1);
     _analysis_output("lsp3",seq-1,codedflr,look->n,0,1);
 
-    /* generate residue output */
-    for(j=0;j<look->n;j++)
-      residue[j]=mdct[j]/codedflr[j];
-    
     return(val);
   }
 
@@ -401,7 +405,7 @@
 #endif
 
   memset(codedflr,0,sizeof(float)*look->n);
-  memset(residue,0,sizeof(float)*look->n);
+  memset(mdct,0,sizeof(float)*look->n);
   return(val);
 }
 

1.11      +100 -88   vorbis/lib/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor1.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- floor1.c	2001/06/15 23:59:47	1.10
+++ floor1.c	2001/08/13 01:36:56	1.11
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.10 2001/06/15 23:59:47 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.11 2001/08/13 01:36:56 xiphmont Exp $
 
  ********************************************************************/
 
@@ -43,6 +43,9 @@
   int quant_q;
   vorbis_info_floor1 *vi;
 
+  long phrasebits;
+  long postbits;
+  long frames;
 } vorbis_look_floor1;
 
 typedef struct lsfit_acc{
@@ -80,6 +83,11 @@
 static void floor1_free_look(vorbis_look_floor *i){
   vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
   if(i){
+    /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
+	    (float)look->phrasebits/look->frames,
+	    (float)look->postbits/look->frames,
+	    (float)(look->postbits+look->phrasebits)/look->frames);*/
+
     memset(look,0,sizeof(vorbis_look_floor1));
     free(i);
   }
@@ -613,14 +621,14 @@
 }
 
 static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  const float *mdct, const float *logmdct,   /* in */
+			  float *mdct, const float *logmdct,   /* in */
                           const float *logmask, const float *logmax, /* in */
-			  float *residue, float *codedflr){          /* out */
+			  float *codedflr){          /* out */
   static int seq=0;
   long i,j,k,l;
   vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
   vorbis_info_floor1 *info=look->vi;
-  long n=look->n;
+  long n=info->n;
   long posts=look->posts;
   long nonzero=0;
   lsfit_acc fits[VIF_POSIT+1];
@@ -633,8 +641,14 @@
   int memo[VIF_POSIT+2];
   codec_setup_info *ci=vb->vd->vi->codec_setup;
   static_codebook **sbooks=ci->book_param;
-  codebook *books=((backend_lookup_state *)(vb->vd->backend_state))->
-    fullbooks;   
+  codebook *books=NULL;
+  int writeflag=0;
+
+  if(vb->vd->backend_state){
+    books=((backend_lookup_state *)(vb->vd->backend_state))->
+      fullbooks;   
+    writeflag=1;
+  }
 
   memset(fit_flag,0,sizeof(fit_flag));
   for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */
@@ -876,94 +890,93 @@
 
     /* we have everything we need. pack it out */
     /* mark nontrivial floor */
-    oggpack_write(&vb->opb,1,1);
-
-    /* beginning/end post */
-    oggpack_write(&vb->opb,fit_valueA[0],ilog(look->quant_q-1));
-    oggpack_write(&vb->opb,fit_valueA[1],ilog(look->quant_q-1));
-
-#ifdef TRAIN_FLOOR1
-    {
-      FILE *of;
-      char buffer[80];
-      sprintf(buffer,"line%d_full.vqd",vb->mode);
-      of=fopen(buffer,"a");
-      for(j=2;j<posts;j++)
-	fprintf(of,"%d\n",fit_valueB[j]);
-      fclose(of);
-    }
-#endif
-
-    
-    /* 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;
+    if(writeflag){
+      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));
+      
+      
+      /* 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;
+	    }
           }
-	}
-	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=fit_valueB[j+k];
+	      if(val<maxval[l]){
+		bookas[k]=l;
+		break;
+	      }
             }
+	    cval|= bookas[k]<<cshift;
+	    cshift+=csubbits;
           }
-	  cval|= bookas[k]<<cshift;
-	  cshift+=csubbits;
-	}
-	/* write it */
-	vorbis_book_encode(books+info->class_book[class],cval,&vb->opb);
-
-#ifdef TRAIN_FLOOR1
-	{
-	  FILE *of;
-	  char buffer[80];
-	  sprintf(buffer,"line%d_class%d.vqd",vb->mode,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){
-	  vorbis_book_encode(books+book,
-			     fit_valueB[j+k],&vb->opb);
-
+	  /* 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%d_%dsub%d.vqd",vb->mode,class,bookas[k]);
+	    sprintf(buffer,"line_%dx%d_class%d.vqd",
+		    vb->pcmend/2,posts-2,class);
             of=fopen(buffer,"a");
-	    fprintf(of,"%d\n",fit_valueB[j+k]);
+	    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(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%d_%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;
@@ -982,27 +995,26 @@
           ly=hy;
         }
       }
-      for(j=hx;j<look->n;j++)codedflr[j]=codedflr[j-1]; /* be certain */
+      for(j=lx;j<vb->pcmend/2;j++)codedflr[j]=codedflr[j-1]; /* be certain */
 
-      /* use it to create residue vector.  Eliminate residue elements
+      /* 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])
-	  residue[j]=0.f;
-	else
-	  residue[j]=mdct[j]/codedflr[j];
-      for(j=n;j<look->n;j++)residue[j]=0.f;
+	  mdct[j]=0.f;
+      for(j=n;j<vb->pcmend/2;j++)mdct[j]=0.f;
 
     }    
 
   }else{
-    oggpack_write(&vb->opb,0,1);
+    if(writeflag)oggpack_write(&vb->opb,0,1);
     memset(codedflr,0,n*sizeof(float));
-    memset(residue,0,n*sizeof(float));
+    memset(mdct,0,n*sizeof(float));
   }
   seq++;
   return(nonzero);

1.42      +2 -3      vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- info.c	2001/06/15 21:15:39	1.41
+++ info.c	2001/08/13 01:36:57	1.42
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.41 2001/06/15 21:15:39 xiphmont Exp $
+ last mod: $Id: info.c,v 1.42 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,7 +23,6 @@
 #include <ctype.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "backends.h"
 #include "codec_internal.h"
 #include "codebook.h"
 #include "registry.h"
@@ -408,7 +407,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiphophorus libVorbis I 20010615";
+  char temp[]="Xiphophorus libVorbis I 20010812";
 
   /* preamble */  
   oggpack_write(opb,0x03,8);

1.34      +242 -120  vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mapping0.c	2001/06/17 22:25:50	1.33
+++ mapping0.c	2001/08/13 01:36:57	1.34
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.33 2001/06/17 22:25:50 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.34 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -37,6 +37,8 @@
    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;
@@ -46,7 +48,7 @@
   vorbis_look_floor **floor_look;
 
   vorbis_look_residue **residue_look;
-  vorbis_look_psy *psy_look;
+  vorbis_look_psy *psy_look[2];
 
   vorbis_func_time **time_func;
   vorbis_func_floor **floor_func;
@@ -81,16 +83,21 @@
       l->time_func[i]->free_look(l->time_look[i]);
       l->floor_func[i]->free_look(l->floor_look[i]);
       l->residue_func[i]->free_look(l->residue_look[i]);
-      if(l->psy_look)_vp_psy_clear(l->psy_look+i);
     }
-
+    if(l->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);
-    if(l->psy_look)_ogg_free(l->psy_look);
     memset(l,0,sizeof(vorbis_look_mapping0));
     _ogg_free(l);
   }
@@ -109,7 +116,6 @@
   look->floor_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_floor *));
 
   look->residue_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_residue *));
-  if(ci->psys)look->psy_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_psy));
 
   look->time_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_time *));
   look->floor_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_floor *));
@@ -130,10 +136,30 @@
     look->residue_look[i]=look->residue_func[i]->
       look(vd,vm,ci->residue_param[resnum]);
     
-    if(ci->psys && vd->analysisp){
-      int psynum=info->psysubmap[i];
-      _vp_psy_init(look->psy_look+i,ci->psy_param[psynum],
+  }
+  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(vorbis_look_psy));      
+      _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(vorbis_look_psy));      
+      _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(vorbis_look_psy));      
+      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);
+
     }
   }
 
@@ -259,6 +285,7 @@
 static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
   vorbis_dsp_state      *vd=vb->vd;
   vorbis_info           *vi=vd->vi;
+  codec_setup_info      *ci=vi->codec_setup;
   backend_lookup_state  *b=vb->vd->backend_state;
   vorbis_look_mapping0  *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0  *info=look->map;
@@ -267,30 +294,49 @@
   int                    n=vb->pcmend;
   int i,j;
   float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+  int   *nonzero=alloca(sizeof(int)*vi->channels);
 
-  float **pcmbundle=alloca(sizeof(float *)*vi->channels);
-  int    *zerobundle=alloca(sizeof(int)*vi->channels);
-
-  int    *nonzero=alloca(sizeof(int)*vi->channels);
-
   float *work=_vorbis_block_alloc(vb,n*sizeof(float));
-  float newmax=vbi->ampmax;
+
+  float global_ampmax=vbi->ampmax;
+  float *local_ampmax=alloca(sizeof(float)*vi->channels);
+  int 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)
+  */
+
+  if(vb->W){
+    if(!vb->lW || !vb->nW)
+      blocktype=BLOCKTYPE_TRANSITION;
+    else
+      blocktype=BLOCKTYPE_LONG;
+  }else{
+    /* right now we're missing the infrastructure to distingush the
+       two short types */
+    blocktype=BLOCKTYPE_IMPULSE;
+  }
 
   for(i=0;i<vi->channels;i++){
     float scale=4.f/n;
-    int submap=info->chmuxlist[i];
-    float ret;
 
     /* the following makes things clearer to *me* anyway */
     float *pcm     =vb->pcm[i]; 
+    float *fft     =work;
+    float *logfft  =pcm+n/2;
+
+    /*float *res     =pcm;
     float *mdct    =pcm;
-    float *logmdct =pcm+n/2;
-    float *res     =pcm;
     float *codedflr=pcm+n/2;
-    float *fft     =work;
-    float *logfft  =work;
     float *logmax  =work;
-    float *logmask =work+n/2;
+    float *logmask =work+n/2;*/
 
     /* window the PCM data */
     for(j=0;j<n;j++)
@@ -299,30 +345,52 @@
     /* transform the PCM data */
     /* only MDCT right now.... */
     mdct_forward(b->transform[vb->W][0],pcm,pcm);
-    for(j=0;j<n/2;j++)
-      logmdct[j]=todB(mdct+j);
     
     /* FFT yields more accurate tonal estimation (not phase sensitive) */
     drft_forward(&look->fft_look,fft);
     fft[0]*=scale;
-    fft[0]=todB(fft);
+    logfft[0]=todB(fft);
+    local_ampmax[i]=logfft[0];
     for(j=1;j<n-1;j+=2){
       float temp=scale*FAST_HYPOT(fft[j],fft[j+1]);
-      logfft[(j+1)>>1]=todB(&temp);
+      temp=logfft[(j+1)>>1]=todB(&temp);
+      if(temp>local_ampmax[i])local_ampmax[i]=temp;
     }
+    if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i];
+
+    _analysis_output("fft",seq+i,logfft,n/2,1,0);
+  }
 
-    _analysis_output("fft",seq,logfft,n/2,0,0);
-    _analysis_output("mdct",seq,logmdct,n/2,0,0);
+  for(i=0;i<vi->channels;i++){
+    int submap=info->chmuxlist[i];
+
+    /* 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++)
+      logmdct[j]=todB(mdct+j);
+    _analysis_output("mdct",seq+i,logmdct,n/2,1,0);
+
+
     /* perform psychoacoustics; do masking */
-    ret=_vp_compute_mask(look->psy_look+submap,
-			 logfft, /* -> logmax */
-			 logmdct,
-			 logmask,
-			 vbi->ampmax);
-    if(ret>newmax)newmax=ret;
+    _vp_compute_mask(look->psy_look[blocktype],
+		     b->psy_g_look,
+		     i,
+		     logfft, /* -> logmax */
+		     logmdct,
+		     logmask,
+		     global_ampmax,
+		     local_ampmax[i],
+		     ci->blocksizes[vb->lW]/2);
 
-    _analysis_output("mask",seq,logmask,n/2,0,0);
+    _analysis_output("mask",seq+i,logmask,n/2,1,0);
     
     /* perform floor encoding */
     nonzero[i]=look->floor_func[submap]->
@@ -331,103 +399,151 @@
               logmdct,
               logmask,
               logmax,
-	      res,
+
               codedflr);
 
-    /*for(j=0;j<n/2;j++)
-      if(fabs(vb->pcm[i][j]>200))
-      fprintf(stderr,"%ld ",seq);*/
-    
-    _analysis_output("res",seq-vi->channels+j,vb->pcm[i],n,0,0);
-    _analysis_output("codedflr",seq++,codedflr,n/2,0,1);
+
+    _analysis_output("mdct2",seq+i,mdct,n/2,1,1);
+    _vp_remove_floor(look->psy_look[blocktype],
+		     b->psy_g_look,
+		     logmdct,
+		     mdct,
+		     codedflr,
+		     res,
+		     local_ampmax[i]);
+
+    for(j=0;j<n/2;j++)
+      if(fabs(res[j])>1200){
+	analysis_noisy=1;
+	/*fprintf(stderr,"%ld ",seq+i);*/
+      }
+
+    _analysis_output("res",seq+i,res,n/2,1,0);
+    _analysis_output("codedflr",seq+i,codedflr,n/2,1,1);
       
   }
 
-  vbi->ampmax=newmax;
+  vbi->ampmax=global_ampmax;
 
-  /* channel coupling */
-  for(i=0;i<info->coupling_steps;i++){
-    if(nonzero[info->coupling_mag[i]] ||
-       nonzero[info->coupling_ang[i]]){
-      
-      float *pcmM=vb->pcm[info->coupling_mag[i]];
-      float *pcmA=vb->pcm[info->coupling_ang[i]];
-      
-    /*     +- 
-            B
-            |       A-B
-     -4 -3 -2 -1  0                    
-            |
-      3     |     1
-            |
-  -+  2-----+-----2----A ++  
-            |
-      1     |     3
-            |
-      0 -1 -2 -3 -4
-  B-A       |
-           --
+  /* partition based prequantization and channel coupling */
+  /* Steps in prequant and coupling:
+     
+     down-couple/down-quantize from perfect residue ->  quantized vector 
+     classify by this first 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.
+  */
+   
+  {
+    float  **pcm=vb->pcm;
+    float  **quantized=alloca(sizeof(float*)*vi->channels);
+    float  **sofar=alloca(sizeof(float*)*vi->channels);
+
+    long  ***classifications=alloca(sizeof(long**)*info->submaps);
+    float ***pcmbundle=alloca(sizeof(float **)*info->submaps);
+    float ***sobundle=alloca(sizeof(float **)*info->submaps);
+    int    **zerobundle=alloca(sizeof(int *)*info->submaps);
+    int     *chbundle=alloca(sizeof(int)*info->submaps);
+    int      chcounter=0;
+
+    /* play a little loose with this abstraction */
+    int   quant_passes=look->psy_look[blocktype]->vi->coupling_passes;
+    int   stopflag=0;
 
-    */
+    for(i=0;i<vi->channels;i++){
+      quantized[i]=pcm[i]+n/2;
+      sofar[i]=_vorbis_block_alloc(vb,n/2*sizeof(float));
+      memset(sofar[i],0,sizeof(float)*n/2);
+    }
+
+    pcmbundle[0]=alloca(sizeof(float *)*vi->channels);
+    sobundle[0]=alloca(sizeof(float *)*vi->channels);
+    zerobundle[0]=alloca(sizeof(int)*vi->channels);
+
+    /* initial down-quantized coupling */
+    _vp_quantize_couple(look->psy_look[blocktype],
+			info,
+			pcm,
+			sofar,
+			quantized,
+			nonzero,
+			0);
 
-      nonzero[info->coupling_mag[i]]=1; 
-      nonzero[info->coupling_ang[i]]=1; 
+    for(i=0;i<vi->channels;i++)
+      _analysis_output("quant",seq+i,quantized[i],n/2,1,0);
 
-      for(j=n/2-1;j>=0;j--){
-	float A=rint(pcmM[j]);
-	float B=rint(pcmA[j]);
-	float mag;
-	float ang;
-	
-	if(fabs(A)>fabs(B)){
-	  mag=A;
-	  if(A>0)
-	    ang=A-B;
+  
+    /* classify, by submap */
+
+    for(i=0;i<info->submaps;i++){
+      int ch_in_bundle=0;
+      pcmbundle[i]=pcmbundle[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
-	    ang=B-A;
-	}else{
-	  mag=B;
-	if(B>0)
-	  ang=A-B;
-	else
-	  ang=B-A;
+	    zerobundle[i][ch_in_bundle]=0;
+	  pcmbundle[i][ch_in_bundle]=quantized[j];
+	  sobundle[i][ch_in_bundle++]=sofar[j];
         }
-	
-	/*if(fabs(mag)<3.5f)
-	  ang=rint(ang/(mag*2.f))*mag*2.f;*/
-	
-	/*if(fabs(mag)<1.5)
-	ang=0;
-      
-	if(j>(n*3/16))
-	  ang=0;
-	
-	  if(ang>=fabs(mag*2))ang=-fabs(mag*2);*/
-	
-	pcmM[j]=mag;
-	pcmA[j]=ang;
       }
+      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]);
     }
-  }
-  
-  /* perform residue encoding with residue mapping; this is
-     multiplexed.  All the channels belonging to one submap are
-     encoded (values interleaved), then the next submap, etc */
-  
-  for(i=0;i<info->submaps;i++){
-    int ch_in_bundle=0;
-    for(j=0;j<vi->channels;j++){
-      if(info->chmuxlist[j]==i){
-	if(nonzero[j])
-	  zerobundle[ch_in_bundle]=1;
-	else
-	  zerobundle[ch_in_bundle]=0;
-	pcmbundle[ch_in_bundle++]=vb->pcm[j];
+
+    /* actual encoding loop */
+    for(i=0;!stopflag;){
+
+      /* 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],
+		  pcmbundle[j],sobundle[j],zerobundle[j],chbundle[j],
+		  i,classifications[j]);
+      i++;
+      
+      /* bitrate management decision hook; the following if() is where
+         we tell progressive encoding to halt, right now it just
+         avoids falling off the edge */
+      if(i>=quant_passes /* || yadda yadda */)stopflag=1;
+
+      if(!stopflag){
+	/* down-couple/down-quantize from perfect-'so-far' -> 
+	   new quantized vector */
+	_vp_quantize_couple(look->psy_look[blocktype],
+			    info,
+			    pcm,
+			    sofar,
+			    quantized,
+			    nonzero,
+			    i);
       }
+      /* steady as she goes */
     }
-    
-    look->residue_func[i]->forward(vb,look->residue_look[i],
-				   pcmbundle,zerobundle,ch_in_bundle);
+    seq+=vi->channels;
   }
   
   look->lastframe=vb->sequence;
@@ -535,7 +651,7 @@
   /* only MDCT right now.... */
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
-    _analysis_output("out",seq+i,pcm,n/2,0,1);
+    _analysis_output("out",seq+i,pcm,n/2,1,1);
     mdct_backward(b->transform[vb->W][0],pcm,pcm);
   }
 
@@ -560,6 +676,12 @@
 
 /* export hooks */
 vorbis_func_mapping mapping0_exportbundle={
-  &mapping0_pack,&mapping0_unpack,&mapping0_look,&mapping0_copy_info,
-  &mapping0_free_info,&mapping0_free_look,&mapping0_forward,&mapping0_inverse
+  &mapping0_pack,
+  &mapping0_unpack,
+  &mapping0_look,
+  &mapping0_copy_info,
+  &mapping0_free_info,
+  &mapping0_free_look,
+  &mapping0_forward,
+  &mapping0_inverse
 };

1.27      +1 -4      vorbis/lib/os.h

Index: os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- os.h	2001/06/04 05:50:10	1.26
+++ os.h	2001/08/13 01:36:57	1.27
@@ -13,7 +13,7 @@
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.26 2001/06/04 05:50:10 xiphmont Exp $
+ last mod: $Id: os.h,v 1.27 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -50,9 +50,6 @@
 #endif
 #ifdef HAVE_EXPF
 #  define exp expf
-#endif
-#ifdef HAVE_POWF
-#  define pow powf
 #endif
 #ifdef HAVE_ACOSF
 #  define acos acosf

1.50      +582 -259  vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- psy.c	2001/07/01 16:10:07	1.49
+++ psy.c	2001/08/13 01:36:57	1.50
@@ -7,11 +7,11 @@
  *                                                                  *
  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
-
+ *                                                                  *
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.49 2001/07/01 16:10:07 msmith Exp $
+ last mod: $Id: psy.c,v 1.50 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -34,8 +34,41 @@
 /* Why Bark scale for encoding but not masking computation? Because
    masking has a strong harmonic dependancy */
 
-/* the beginnings of real psychoacoustic infrastructure.  This is
-   still not tightly tuned */
+vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
+  int i,j;
+  codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy_global *gi=ci->psy_g_param;
+  vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(vorbis_look_psy_global));
+
+  int shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1;
+  look->decaylines=toOC(96000.f)*(1<<(shiftoc+1))+.5f; /* max sample
+							  rate of
+							  192000kHz
+							  for now */
+  look->decay=_ogg_calloc(vi->channels,sizeof(float *));
+  for(i=0;i<vi->channels;i++){
+    look->decay[i]=_ogg_calloc(look->decaylines,sizeof(float));
+    for(j=0;j<look->decaylines;j++)
+      look->decay[i][j]=-9999.;
+  }
+  look->channels=vi->channels;
+
+  look->ampmax=-9999.;
+  look->gi=gi;
+  return(look);
+}
+
+void _vp_global_free(vorbis_look_psy_global *look){
+  int i;
+  if(look->decay){
+    for(i=0;i<look->channels;i++)
+      _ogg_free(look->decay[i]);
+    _ogg_free(look->decay);
+  }
+  memset(look,0,sizeof(vorbis_look_psy_global));
+  _ogg_free(look);
+}
+
 void _vi_psy_free(vorbis_info_psy *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_psy));
@@ -91,6 +124,7 @@
     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){
@@ -166,11 +200,11 @@
   /* add fenceposts */
   for(j=0;j<P_LEVELS;j++){
 
-    for(i=0;i<EHMER_MAX;i++)
+    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>=0;i--)
+    for(i=EHMER_MAX-1;i>EHMER_OFFSET+1;i--)
       if(c[j][i+2]>-200.f)
         break;
     c[j][1]=i;
@@ -178,16 +212,17 @@
   }
 }
 
-void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
-  long i,j,lo=0,hi=0;
+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=0,hi=0;
   long maxoc;
   memset(p,0,sizeof(vorbis_look_psy));
 
 
-  p->eighth_octave_lines=vi->eighth_octave_lines;
-  p->shiftoc=rint(log(vi->eighth_octave_lines*8)/log(2))-1;
+  p->eighth_octave_lines=gi->eighth_octave_lines;
+  p->shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1;
 
-  p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-vi->eighth_octave_lines;
+  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;
 
@@ -197,9 +232,9 @@
   p->bark=_ogg_malloc(n*sizeof(unsigned long));
   p->vi=vi;
   p->n=n;
+  p->rate=rate;
 
   /* set up the lookups for a given blocksize and sample rate */
-  /* Vorbis max sample rate is currently limited by 26 Bark (54kHz) */
   if(vi->ath)
     set_curve(vi->ath, p->ath,n,rate);
   for(i=0;i<n;i++){
@@ -219,18 +254,15 @@
     p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
   p->tonecurves=_ogg_malloc(P_BANDS*sizeof(float **));
-  p->noisemedian=_ogg_malloc(n*sizeof(int));
+  p->noisethresh=_ogg_malloc(n*sizeof(float));
   p->noiseoffset=_ogg_malloc(n*sizeof(float));
-  p->peakatt=_ogg_malloc(P_BANDS*sizeof(float *));
-  for(i=0;i<P_BANDS;i++){
+  for(i=0;i<P_BANDS;i++)
     p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(float *));
-    p->peakatt[i]=_ogg_malloc(P_LEVELS*sizeof(float));
-  }
-
+  
   for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++){
+    for(j=0;j<P_LEVELS;j++)
       p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(float));
-    }
+  
 
   /* OK, yeah, this was a silly way to do it */
   memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
@@ -278,6 +310,14 @@
   memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
   memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
 
+  /* value limit the tonal masking curves; the peakatt not only
+     optionally specifies maximum dynamic depth, but also [always]
+     limits the masking curves to a minimum depth */
+  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){
@@ -290,17 +330,37 @@
 
   /* set up the final curves */
   for(i=0;i<P_BANDS;i++)
-    setup_curve(p->tonecurves[i],i,vi->toneatt[i]);
+    setup_curve(p->tonecurves[i],i,vi->toneatt->block[i]);
 
-  /* set up attenuation levels */
+  if(vi->curvelimitp){
+    /* value limit the tonal masking curves; the peakatt not only
+       optionally specifies maximum dynamic depth, but also [always]
+       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;
+      }
+  }
+
+  if(vi->peakattp) /* we limit 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];
+
+  /* but guarding is mandatory */
   for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++){
-      p->peakatt[i][j]=p->vi->peakatt[i][j];
-    }
+    for(j=0;j<P_LEVELS;j++)
+      if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->tone_maxatt)
+	  p->tonecurves[i][j][EHMER_OFFSET+2]=  vi->tone_maxatt;
 
   /* set up rolling noise median */
   for(i=0;i<n;i++){
-    float halfoc=toOC((i+.5)*rate/(2.*n))*2.+2.;
+    float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
     int inthalfoc;
     float del;
     
@@ -309,15 +369,53 @@
     inthalfoc=(int)halfoc;
     del=halfoc-inthalfoc;
 
-    p->noisemedian[i]=rint(
-      (p->vi->noisemedian[inthalfoc*2]*(1.-del) + 
-       p->vi->noisemedian[inthalfoc*2+2]*del)*1024.f);
+    p->noisethresh[i]=((p->vi->noisethresh[inthalfoc]*(1.-del) + 
+			p->vi->noisethresh[inthalfoc+1]*del))*2.f-1.f;
     p->noiseoffset[i]=
-      p->vi->noisemedian[inthalfoc*2+1]*(1.-del) + 
-      p->vi->noisemedian[inthalfoc*2+3]*del -
-      140.f;
+      p->vi->noiseoff[inthalfoc]*(1.-del) + 
+      p->vi->noiseoff[inthalfoc+1]*del;
   }
-  /*_analysis_output("mediancurve",0,p->noisemedian,n,0,0);*/
+
+  analysis_noisy=1;
+  _analysis_output("noiseoff",0,p->noiseoffset,n,1,0);
+  _analysis_output("noisethresh",0,p->noisethresh,n,1,0);
+
+  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);
+  analysis_noisy=1;
+
 }
 
 void _vp_psy_clear(vorbis_look_psy *p){
@@ -332,12 +430,9 @@
           _ogg_free(p->tonecurves[i][j]);
         }
         _ogg_free(p->tonecurves[i]);
-	_ogg_free(p->peakatt[i]);
       }
       _ogg_free(p->tonecurves);
-      _ogg_free(p->noisemedian);
       _ogg_free(p->noiseoffset);
-      _ogg_free(p->peakatt);
     }
     memset(p,0,sizeof(vorbis_look_psy));
   }
@@ -371,31 +466,11 @@
   }
 }
 
-static void seed_peak(float *seed,
-		      const float *att,
-		      float amp,
-		      int oc,
-		      int linesper,
-		      float dBoffset){
-  long seedptr;
-
-  int choice=(int)((amp+dBoffset)*.1f);
-  choice=max(choice,0);
-  choice=min(choice,P_LEVELS-1);
-  seedptr=oc-(linesper>>1);
-
-  amp+=att[choice];
-  if(seed[seedptr]<amp)seed[seedptr]=amp;
-
-}
-
 static void seed_loop(vorbis_look_psy *p,
                       const float ***curves,
-		      const float **att,
                       const float *f, 
                       const float *flr,
-		      float *minseed,
-		      float *maxseed,
+		      float *seed,
                       float specmax){
   vorbis_info_psy *vi=p->vi;
   long n=p->n,i;
@@ -403,51 +478,26 @@
 
   /* prime the working vector with peak values */
 
-  for(i=0;i<n;i++){
-      float max=f[i];
-      long oc=p->octave[i];
-      while(i+1<n && p->octave[i+1]==oc){
-	i++;
-	if(f[i]>max)max=f[i];
-      }
-
-      if(max>flr[i]){
-	oc=oc>>p->shiftoc;
-	if(oc>=P_BANDS)oc=P_BANDS-1;
-	if(oc<0)oc=0;
-	if(vi->tonemaskp)
-	  seed_curve(minseed,
-		     curves[oc],
-		     max,
-		     p->octave[i]-p->firstoc,
-		     p->total_octave_lines,
-		     p->eighth_octave_lines,
-		     dBoffset);
-	if(vi->peakattp)
-	  seed_peak(maxseed,
-		    att[oc],
-		    max,
-		    p->octave[i]-p->firstoc,
-		    p->eighth_octave_lines,
-		    dBoffset);
-      }
-  }
-}
-
-static void bound_loop(vorbis_look_psy *p,
-		       float *f, 
-		       float *seeds,
-		       float *flr,
-		       float att){
-  long n=p->n,i;
-
-  long off=(p->eighth_octave_lines>>1)+p->firstoc;
-  long *ocp=p->octave;
-
   for(i=0;i<n;i++){
-    long oc=ocp[i]-off;
-    float v=f[i]+att;
-    if(seeds[oc]<v)seeds[oc]=v;
+    float max=f[i];
+    long oc=p->octave[i];
+    while(i+1<n && p->octave[i+1]==oc){
+      i++;
+      if(f[i]>max)max=f[i];
+    }
+    
+    if(max+6.f>flr[i]){
+      oc=oc>>p->shiftoc;
+      if(oc>=P_BANDS)oc=P_BANDS-1;
+      if(oc<0)oc=0;
+      seed_curve(seed,
+		 curves[oc],
+		 max,
+		 p->octave[i]-p->firstoc,
+		 p->total_octave_lines,
+		 p->eighth_octave_lines,
+		 dBoffset);
+    }
   }
 }
 
@@ -508,247 +558,520 @@
 }
 
 /* bleaugh, this is more complicated than it needs to be */
-static void max_seeds(vorbis_look_psy *p,float *minseed,float *maxseed,
+static void max_seeds(vorbis_look_psy *p,
+		      vorbis_look_psy_global *g,
+		      int channel,
+		      float *seed,
                       float *flr){
   long   n=p->total_octave_lines;
   int    linesper=p->eighth_octave_lines;
   long   linpos=0;
   long   pos;
 
-  seed_chase(minseed,linesper,n); /* for masking */
-  seed_chase(maxseed,linesper,n); /* for peak att */
+  seed_chase(seed,linesper,n); /* for masking */
  
   pos=p->octave[0]-p->firstoc-(linesper>>1);
   while(linpos+1<p->n){
-    float min=minseed[pos];
-    float max=maxseed[pos];
+    float minV=seed[pos];
     long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc;
     while(pos+1<=end){
       pos++;
-      if((minseed[pos]>NEGINF && minseed[pos]<min) || min==NEGINF)
-	min=minseed[pos];
-      if(maxseed[pos]>max)max=maxseed[pos];
+      if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF)
+	minV=seed[pos];
     }
-    if(max<min)max=min;
     
     /* seed scale is log.  Floor is linear.  Map back to it */
     end=pos+p->firstoc;
     for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
-      if(flr[linpos]<max)flr[linpos]=max;
+      if(flr[linpos]<minV)flr[linpos]=minV;
   }
   
   {
-    float min=minseed[p->total_octave_lines-1];
-    float max=maxseed[p->total_octave_lines-1];
-    if(max<min)max=min;
+    float minV=seed[p->total_octave_lines-1];
     for(;linpos<p->n;linpos++)
-      if(flr[linpos]<max)flr[linpos]=max;
+      if(flr[linpos]<minV)flr[linpos]=minV;
   }
   
 }
 
-/* set to match vorbis_quantdblook.h */
-#define BINCOUNT 280
-#define LASTBIN  (BINCOUNT-1)
-
-static int psy_dBquant(const float *x){
-  int i= *x*2.f+279.5f;
-  if(i>279)return(279);
-  if(i<0)return(0);
-  return i;
-}
+static void bark_noise_pointmp(int n,const long *b,
+                               const float *f,
+                               float *noise,
+                               const int fixed){
+  long i,hi=0,lo=0,hif=0,lof=0;
+  double xa=0,xb=0;
+  double ya=0,yb=0;
+  double x2a=0,x2b=0;
+  double y2a=0,y2b=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]>>16;
+      for(;hi<bi;hi++){
+        double bin=(f[hi]<-140.f?0.:f[hi]+140.);
+        double nn= bin*bin;
+        na  += nn;
+        xa  += hi*nn;
+        ya  += bin*nn;
+        x2a += hi*hi*nn;
+        y2a += bin*bin*nn;
+        xya += hi*bin*nn;
+      }
+      bi=b[i]&0xffff;
+      for(;lo<bi;lo++){
+        double bin=(f[lo]<-140.f?0.:f[lo]+140.);
+        double nn= bin*bin;
+        na  -= nn;
+        xa  -= lo*nn;
+        ya  -= bin*nn;
+        x2a -= lo*lo*nn;
+        y2a -= bin*bin*nn;
+        xya -= lo*bin*nn;
+      }
+    }
 
+    if(hif<n && fixed>0){
+      int bi=i+fixed/2;
+      if(bi>n)bi=n;
+      for(;hif<bi;hif++){
+        double bin=(f[hif]<-140.f?0.:f[hif]+140.);
+        double nn= bin*bin;
+        nb  += nn;
+        xb  += hif*nn;
+        yb  += bin*nn;
+        x2b += hif*hif*nn;
+        y2b += bin*bin*nn;
+        xyb += hif*bin*nn;
+      }
+      bi=i-(fixed+1)/2;
+      if(bi<0)bi=0;
+      for(;lof<bi;lof++){
+        double bin=(f[lof]<-140.f?0.:f[lof]+140.);
+        double nn= bin*bin;
+        nb  -= nn;
+        xb  -= lof*nn;
+        yb  -= bin*nn;
+        x2b -= lof*lof*nn;
+        y2b -= bin*bin*nn;
+        xyb -= lof*bin*nn;
+      }
+    }
+
+    {    
+      double denom=1./(na*x2a-xa*xa);
+      double a=(ya*x2a-xya*xa)*denom;
+      double b=(na*xya-xa*ya)*denom;
+      double va=a+b*i;
+
+      if(fixed>0){
+        double denomf=1./(nb*x2b-xb*xb);
+        double af=(yb*x2b-xyb*xb)*denomf;
+        double bf=(nb*xyb-xb*yb)*denomf;
+        double vb=af+bf*i;
+        if(va>vb)va=vb;
+      }
 
-static void bark_noise_median(int n,const long *b,const float *f,
-			      float *noise,
-			      float lowidth,float hiwidth,
-			      int lomin,int himin,
-			      const int *thresh,const float *off,
-			      int fixed){
-  int i=0,lo=-1,hi=-1,fixedc=0;
-  int  median=LASTBIN>>1;
-
-  int barkradix[BINCOUNT];
-  int barkcountbelow=0;
-
-  int fixedradix[BINCOUNT];
-  int fixedcountbelow=0;
-
-  memset(barkradix,0,sizeof(barkradix));
-
-  if(fixed>0){
-    memset(fixedradix,0,sizeof(fixedradix));
-
-    /* bootstrap the fixed window case seperately */
-    for(i=0;i<(fixed>>1);i++){
-      int bin=psy_dBquant(f+i);
-      fixedradix[bin]++;
-      fixedc++;
-      if(bin<=median)
-	fixedcountbelow++;
+      noise[i]=va-140.f;
     }
   }
+}
+
+static void bark_noise_hybridmp(int n,const long *b,
+                               const float *f,
+                               float *noise,
+                               const int fixed){
+  long i,hi=0,lo=0,hif=0,lof=0;
+  double xa=0,xb=0;
+  double ya=0,yb=0;
+  double x2a=0,x2b=0;
+  double y2a=0,y2b=0;
+  double xya=0,xyb=0; 
+  double na=0,nb=0;
+  int first=-1,firstf=-1;
+  int last=0,lastf=0;
+  int rna=0,rnb=0;
 
   for(i=0;i<n;i++){
-    /* find new lo/hi */
-    int bi=b[i]>>16;
-    for(;hi<bi;hi++){
-      int bin=psy_dBquant(f+hi);
-      barkradix[bin]++;
-      if(bin<=median)
-	barkcountbelow++;
-    }
-    bi=b[i]&0xffff;
-    for(;lo<bi;lo++){
-      int bin=psy_dBquant(f+lo);
-      barkradix[bin]--;
-      if(bin<=median)
-	barkcountbelow--;
-    }
-
-    if(fixed>0){
-      bi=i+(fixed>>1);
-      if(bi<n){
-	int bin=psy_dBquant(f+bi);
-	fixedradix[bin]++;
-	fixedc++;
-	if(bin<=median)
-	  fixedcountbelow++;
+    if(hi<n){
+      /* find new lo/hi */
+      int bi=b[i]>>16;
+      for(;hi<bi;hi++){
+        double bin=f[hi];
+        if(bin>0.f){
+          double nn= bin*bin;
+          nn*=nn;
+          na  += nn;
+          xa  += hi*nn;
+          ya  += bin*nn;
+          x2a += hi*hi*nn;
+          y2a += bin*bin*nn;
+          xya += hi*bin*nn;
+          last=hi;
+          rna++;
+          if(first==-1)first=hi;
+        }
       }
-      
-      bi-=fixed;
-      if(bi>=0){
-	int bin=psy_dBquant(f+bi);
-	fixedradix[bin]--;
-	fixedc--;
-	if(bin<=median)
-	  fixedcountbelow--;
+      bi=b[i]&0xffff;
+      for(;lo<bi;lo++){
+        double bin=f[lo];
+        if(bin>0.f){
+          double nn= bin*bin;
+          nn*=nn;
+          na  -= nn;
+          xa  -= lo*nn;
+          ya  -= bin*nn;
+          x2a -= lo*lo*nn;
+          y2a -= bin*bin*nn;
+          xya -= lo*bin*nn;
+          rna--;
+        }
+        if(first<lo)first=-1;
+        if(last<lo){
+          first=-1;
+        }else{
+          for(first=lo;first<hi;first++)
+            if(f[first]>0.f)break;
+          if(first==hi)first=-1;
+        }
+      }
+    }
+
+    if(hif<n && fixed>0){
+      int bi=i+fixed/2;
+      if(bi>n)bi=n;
+
+      for(;hif<bi;hif++){
+        double bin=f[hif];
+        if(bin>0.f){
+          double nn= bin*bin;
+          nn*=nn;
+          nb  += nn;
+          xb  += hif*nn;
+          yb  += bin*nn;
+          x2b += hif*hif*nn;
+          y2b += bin*bin*nn;
+          xyb += hif*bin*nn;
+          lastf=hif;
+          rnb++;
+          if(firstf==-1)firstf=hif;
+        }
       }
+      bi=i-(fixed+1)/2;
+      if(bi<0)bi=0;
+      for(;lof<bi;lof++){
+        double bin=f[lof];
+        if(bin>0.f){
+          double nn= bin*bin;
+          nn*=nn;
+          nb  -= nn;
+          xb  -= lof*nn;
+          yb  -= bin*nn;
+          x2b -= lof*lof*nn;
+          y2b -= bin*bin*nn;
+          xyb -= lof*bin*nn;
+          rnb--;
+        }
+        if(firstf<lof)firstf=-1;
+        if(lastf<lof){
+          firstf=-1;
+        }else{
+          for(firstf=lof;firstf<hif;firstf++)
+            if(f[firstf]>0.f)break;
+          if(firstf==hif)firstf=-1;
+        }
+      }
     }
 
-    /* move the median if needed */
-    {
-      int bark_th = (thresh[i]*(hi-lo)+512)/1024;
+    {    
+      double va;
       
-      if(fixed>0){
-	int fixed_th = (thresh[i]*(fixedc)+512)/1024;
-	
-	while(bark_th>=barkcountbelow && 
-	      fixed_th>=fixedcountbelow /* && median<LASTBIN by rep invariant */
-	      ){
-	  median++;
-	  barkcountbelow+=barkradix[median];
-	  fixedcountbelow+=fixedradix[median];
-	}
-	
-	while(bark_th<barkcountbelow ||
-	      fixed_th<fixedcountbelow /* && median>=0 by rep invariant */
-	      ){
-	  barkcountbelow-=barkradix[median];
-	  fixedcountbelow-=fixedradix[median];
-	  median--;
-	}
+      if(rna>2 && (last-first)*3/2>hi-lo){
+        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;
       }else{
-	while(bark_th>=barkcountbelow){
-	  median++;
-	  barkcountbelow+=barkradix[median];
-	}
-	
-	while(bark_th<barkcountbelow){
-	  barkcountbelow-=barkradix[median];
-	  median--;
-	}
+	va=0.f;
+        if(na>.5)va=ya/na;
       }
-    }
+      if(va<0.)va=0.;
+
+      if(fixed>0){
+        double vb;
+
+        if(rnb>2 && (lastf-firstf)*3/2>hif-lof){
+          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;
+        }else{
+	  vb=0.f;
+	  if(nb>.5)vb=yb/nb;
+        }
+
+        if(vb<0.)vb=0.;
+        if(va>vb && vb>0.)va=vb;
+
+      }
 
-    noise[i]= (median+1)*.5f+off[i];
+      noise[i]=va;
+    }
   }
+}
 
+   
+void _vp_remove_floor(vorbis_look_psy *p,
+		      vorbis_look_psy_global *g,
+		      float *logmdct, 
+		      float *mdct,
+		      float *codedflr,
+		      float *residue,
+		      float local_specmax){ 
+  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;
 }
+  
 
-float _vp_compute_mask(vorbis_look_psy *p,
-		      float *fft, 
-		      float *mdct, 
-		      float *mask, 
-		      float specmax){
+void _vp_compute_mask(vorbis_look_psy *p,
+		       vorbis_look_psy_global *g,
+		       int channel,
+		       float *logfft, 
+		       float *logmdct, 
+		       float *logmask, 
+		       float global_specmax,
+		       float local_specmax,
+		       int lastsize){
   int i,n=p->n;
-  float localmax=NEGINF;
   static int seq=0;
 
-  float *minseed=alloca(sizeof(float)*p->total_octave_lines);
-  float *maxseed=alloca(sizeof(float)*p->total_octave_lines);
-  for(i=0;i<p->total_octave_lines;i++)minseed[i]=maxseed[i]=NEGINF;
+  float *seed=alloca(sizeof(float)*p->total_octave_lines);
+  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
 
-  /* Find the highest peak so we know the limits */
-  for(i=0;i<n;i++)
-    if(fft[i]>localmax)localmax=fft[i];
-  if(specmax<localmax)specmax=localmax;
-
   /* noise masking */
   if(p->vi->noisemaskp){
-    bark_noise_median(n,p->bark,mdct,mask,
-		      p->vi->noisewindowlo,
-		      p->vi->noisewindowhi,
-		      p->vi->noisewindowlomin,
-		      p->vi->noisewindowhimin,
-		      p->noisemedian,
-		      p->noiseoffset,
-		      p->vi->noisewindowfixed);
-    /* suppress any noise curve > specmax+p->vi->noisemaxsupp */
-    for(i=0;i<n;i++)
-      if(mask[i]>specmax+p->vi->noisemaxsupp)
-	mask[i]=specmax+p->vi->noisemaxsupp;
-    _analysis_output("noise",seq,mask,n,0,0);
+    float *work=alloca(n*sizeof(float));
+
+    bark_noise_pointmp(n,p->bark,logmdct,logmask,
+		       -1);
+
+    for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
+
+    _analysis_output("medianmdct",seq,work,n,1,0);
+    bark_noise_hybridmp(n,p->bark,work,logmask,
+			p->vi->noisewindowfixed);
+
+    for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
+
+    /* work[i] holds the median line (.5), logmask holds the upper
+       envelope line (1.) */
+
+    _analysis_output("median",seq,work,n,1,0);
+    _analysis_output("envelope",seq,logmask,n,1,0);
+
+    for(i=0;i<n;i++)logmask[i]= 
+		      work[i]+
+		      p->noisethresh[i]*logmask[i]+p->noiseoffset[i];
+
+    _analysis_output("noise",seq,logmask,n,1,0);
+
   }else{
-    for(i=0;i<n;i++)mask[i]=NEGINF;
+    for(i=0;i<n;i++)logmask[i]=NEGINF;
   }
 
   /* set the ATH (floating below localmax, not global max by a
      specified att) */
   if(p->vi->ath){
-    float att=localmax+p->vi->ath_adjatt;
+    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>mask[i])mask[i]=av;
+      if(av>logmask[i])logmask[i]=av;
     }
   }
 
-
   /* tone/peak masking */
-
-  /* XXX apply decay to the fft here */
+  seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax);
+  max_seeds(p,g,channel,seed,logmask);
 
-  seed_loop(p,
-	    (const float ***)p->tonecurves,
-	    (const float **)p->peakatt,fft,mask,minseed,maxseed,specmax);
-  bound_loop(p,mdct,maxseed,mask,p->vi->bound_att_dB);
-  max_seeds(p,minseed,maxseed,mask);
+  /* suppress any curve > p->vi->noisemaxsupp */
+  if(p->vi->noisemaxsupp<0.f)
+    for(i=0;i<n;i++)
+      if(logmask[i]>p->vi->noisemaxsupp)
+	logmask[i]=p->vi->noisemaxsupp;
+  
 
   /* 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(mdct[i]>=mask[i])break;
+  for(i=0;i<n;i++)if(logmdct[i]>=logmask[i])break;
   if(i==n)
-    for(i=0;i<n;i++)mask[i]=NEGINF;
+    for(i=0;i<n;i++)logmask[i]=NEGINF;
   else
-    for(i=0;i<n;i++)fft[i]=max(mdct[i],fft[i]);
+    for(i=0;i<n;i++)
+      logfft[i]=max(logmdct[i],logfft[i]);
+
   seq++;
 
-  return(specmax);
 }
 
 float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
   vorbis_info *vi=vd->vi;
   codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy_global *gi=ci->psy_g_param;
+
   int n=ci->blocksizes[vd->W]/2;
   float secs=(float)n/vi->rate;
 
-  amp+=secs*ci->ampmax_att_per_sec;
+  amp+=secs*gi->ampmax_att_per_sec;
   if(amp<-9999)amp=-9999;
   return(amp);
 }
 
+static void couple_lossless(float A, float B, float *mag, float *ang){
+  if(fabs(A)>fabs(B)){
+    *mag=A; *ang=(A>0.f?A-B:B-A);
+  }else{
+    *mag=B; *ang=(B>0.f?A-B:B-A);
+  }
+}
+
+static void couple_8phase(float A, float B, float *mag, float *ang){
+  if(fabs(A)>fabs(B)){
+    *mag=A; *ang=(A>0?A-B:B-A);
+  }else{
+    *mag=B; *ang=(B>0?A-B:B-A);
+  }
+
+  if(*mag!=0.f)
+    switch((int)(rint(*ang / *mag))){
+    case 0:
+      *ang=0;
+      break;
+    case 2:case -2:
+      *ang=-2*fabs(*mag);
+      break;
+    case 1:
+      *ang= *mag;
+      break;
+    case -1:
+      *ang= -*mag;
+      break;
+    }
+}
+
+static void couple_6phase(float A, float B, float *mag, float *ang){
+  if(fabs(A)>fabs(B)){
+    *mag=A; *ang=(A>0?A-B:B-A);
+  }else{
+    *mag=B; *ang=(B>0?A-B:B-A);
+  }
+
+  if(*mag!=0.f)
+    switch((int)(rint(*ang / *mag))){
+    case -2:case 2:
+      *mag=0;
+      /*fall*/
+    case 0:
+      *ang=0;
+      break;
+    case 1:
+      *ang= *mag;
+      break;
+    case -1:
+      *ang= -*mag;
+      break;
+    }
+}
+
+static void couple_point(float A, float B, float *mag, float *ang){
+  if(fabs(A)>fabs(B)){
+    *mag=A; *ang=(A>0?A-B:B-A);
+  }else{
+    *mag=B; *ang=(B>0?A-B:B-A);
+  }
 
+  if(*mag!=0.f)
+    switch((int)(rint(*ang / *mag))){
+    case -2:case 2:
+      *mag=0;
+      /* fall */
+    case 0:case 1: case -1:
+      *ang=0;
+      break;
+    }
+}
 
+void _vp_quantize_couple(vorbis_look_psy *p,
+			 vorbis_info_mapping0 *vi,
+			 float **pcm,
+			 float **sofar,
+			 float **quantized,
+			 int   *nonzero,
+			 int   passno){
+
+  int i,j,k,n=p->n;
+  vorbis_info_psy *info=p->vi;
+
+  /* perform any requested channel coupling */
+  for(i=0;i<vi->coupling_steps;i++){
+    float granulem=info->couple_pass[passno].granulem;
+    float igranulem=info->couple_pass[passno].igranulem;
+    
+    /* 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 *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]];
+
+      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;
+
+	for(;j<part->limit && j<p->n;j++){
+	  /* partition by partition; k is our by-location partition
+	     class counter */
+
+	  float Am=rint(pcmM[j]*igranulem)*granulem;
+	  float Bm=rint(pcmA[j]*igranulem)*granulem;
+	  float ang,mag,fmag=max(fabs(Am),fabs(Bm));
+	  
+	  if(fmag<part->amppost_point){
+	    couple_point(Am,Bm,&mag,&ang);
+	  }else{
+	    if(fmag<part->amppost_6phase){
+	      couple_6phase(Am,Bm,&mag,&ang);
+	    }else{ 
+	      if(fmag<part->amppost_8phase){
+		couple_8phase(Am,Bm,&mag,&ang);
+	      }else{
+		couple_lossless(Am,Bm,&mag,&ang);
+	      }
+	    }
+	  }
+	  fmag=rint(fmag);
+	  if(ang>fmag*1.9999f)ang=-fmag*2.f;
+	  
+	  qM[j]=mag-sofarM[j];
+	  qA[j]=ang-sofarA[j];
+	}
+      }
+    }
+  }
+}

1.22      +100 -16   vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- psy.h	2001/06/15 21:15:40	1.21
+++ psy.h	2001/08/13 01:36:57	1.22
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.21 2001/06/15 21:15:40 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.22 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -19,6 +19,14 @@
 #define _V_PSY_H_
 #include "smallft.h"
 
+#include "backends.h"
+
+#define BLOCKTYPE_IMPULSE    0
+#define BLOCKTYPE_PADDING    1
+#define BLOCKTYPE_TRANSITION 0 
+#define BLOCKTYPE_LONG       1
+
+
 #ifndef EHMER_MAX
 #define EHMER_MAX 56
 #endif
@@ -27,24 +35,49 @@
 #define MAX_BARK 27
 #define P_BANDS 17
 #define P_LEVELS 11
+
+typedef struct vp_couple{
+  int limit;        /* sample post */
+
+  float amppost_8phase;
+  float thresh_8phase;
+
+  float amppost_6phase;
+  float thresh_6phase;
+
+  float amppost_point;
+  float thresh_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;
+
 typedef struct vorbis_info_psy{
   float  *ath;
-  int    decayp;
 
   float  ath_adjatt;
   float  ath_maxatt;
 
-  int   eighth_octave_lines;
-
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
 
-  int tonemaskp;
-  float toneatt[P_BANDS][P_LEVELS];
+  float tone_masteratt;
+  float tone_maxatt;
+  vp_attenblock *toneatt;
 
   int peakattp;
-  float peakatt[P_BANDS][P_LEVELS];
+  int curvelimitp;
+  vp_attenblock *peakatt;
 
   int noisemaskp;
   float noisemaxsupp;
@@ -53,20 +86,49 @@
   int   noisewindowlomin;
   int   noisewindowhimin;
   int   noisewindowfixed;
-  float noisemedian[P_BANDS*2];
+  float noiseoff[P_BANDS];
+  float noisethresh[P_BANDS];
 
   float max_curve_dB;
-  float bound_att_dB;
 
+  int coupling_passes;
+  vp_couple_pass *couple_pass;
+
 } vorbis_info_psy;
 
+typedef struct{
+  float     decaydBpms;
+  int       eighth_octave_lines;
+
+  /* for block long/short tuning; encode only */
+  int       envelopesa;
+  float     preecho_thresh[4];
+  float     postecho_thresh[4];
+  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;
+} vorbis_info_psy_global;
+
+typedef struct {
+  float   ampmax;
+  float **decay;
+  int     decaylines;
+  int     channels;
+
+  vorbis_info_psy_global *gi;
+} vorbis_look_psy_global;
+
+
 typedef struct {
   int n;
   struct vorbis_info_psy *vi;
 
   float ***tonecurves;
-  float **peakatt;
-  int   *noisemedian;
+  float *noisethresh;
   float *noiseoffset;
 
   float *ath;
@@ -77,21 +139,43 @@
   long  shiftoc;
   int   eighth_octave_lines; /* power of two, please */
   int   total_octave_lines;  
-
+  long  rate; /* cache it */
 } vorbis_look_psy;
 
-extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
+extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
+			   vorbis_info_psy_global *gi,int n,long rate);
 extern void   _vp_psy_clear(vorbis_look_psy *p);
 extern void  *_vi_psy_dup(void *source);
 
 extern void   _vi_psy_free(vorbis_info_psy *i);
 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
 
-extern float  _vp_compute_mask(vorbis_look_psy *p,
+extern void _vp_remove_floor(vorbis_look_psy *p,
+			     vorbis_look_psy_global *g,
+			     float *logmdct, 
+			     float *mdct,
+			     float *codedflr,
+			     float *residue,
+			     float local_specmax);
+
+extern void   _vp_compute_mask(vorbis_look_psy *p,
+			       vorbis_look_psy_global *g,
+			       int channel,
                                float *fft, 
                                float *mdct, 
-			       float *mask,
-			       float prev_maxamp);
+			       float *mask, 
+			       float global_specmax,
+			       float local_specmax,
+			       int lastsize);
+
+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

1.16      +276 -125  vorbis/lib/psytune.c

Index: psytune.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psytune.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- psytune.c	2001/05/27 06:44:00	1.15
+++ psytune.c	2001/08/13 01:36:57	1.16
@@ -12,7 +12,7 @@
 
  function: simple utility that runs audio through the psychoacoustics
            without encoding
- last mod: $Id: psytune.c,v 1.15 2001/05/27 06:44:00 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.16 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "os.h"
 #include "psy.h"
 #include "mdct.h"
@@ -30,70 +31,100 @@
 #include "scales.h"
 #include "lpc.h"
 #include "lsp.h"
+#include "masking.h"
+#include "registry.h"
 
-static vorbis_info_psy _psy_set0={
-  1,/*athp*/
-  1,/*decayp*/
+static vorbis_info_psy_global _psy_set0G={
+  0,   /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+
+  0.,
+  0.,
+};
+
+static vp_part _vp_part0[]={
+  {    1,9e10f, 9e10f,       1.f,9999.f},
+  { 9999,  .75f, 9e10f,       .5f,9999.f},
+  //{ 9999, 1.5f, 9e10f,       .5f,9999.f},
+  {   18,9e10f, 9e10f,       .5f,  30.f},
+  { 9999,9e10f, 9e10f,       .5f,  30.f}
+};
 
+static vp_couple _vp_couple0[]={
+  {    1,  {9e10f,9e10f,0}, {   0.f,   0.f,0}, {   0.f, 0.f,0}, {0.f,0.f,0}},
+  {   18,  {9e10f,9e10f,0}, {   0.f,   0.f,0}, {   0.f, 0.f,0}, {0.f,0.f,0}},
+  { 9999,  {9e10f,9e10f,0}, {   0.f, 9e10f,0}, {   0.f,22.f,1}, {0.f,0.f,0}}
+};
+
+static vorbis_info_psy _psy_set0={
+  ATH_Bark_dB_lineaggressive,
+  
   -100.f,
   -140.f,
-
-  8,
+  6.f, /* floor master att */
 
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
+   1,  /* tonemaskp */
+  0.f, /* tone master att */
   /*  0   10   20   30   40   50   60   70   80   90   100 */
   {
    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
    {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
 
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+   {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
    {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
 
+   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+
    {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
-   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
+   {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
+   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
 
   },
 
   1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*125*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-24.f,-24.f,-24.f},/*175*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-24.f,-24.f,-24.f},/*250*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-24.f,-24.f},/*350*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-24.f,-24.f},/*500*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*700*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1000*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1400*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2000*/
-   {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2400*/
-   {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*4000*/
-   {-10.f,-10.f,-10.f,-12.f,-12.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*5600*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*8000*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*11500*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-12.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*16000*/
+  {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*63*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*88*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*125*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*175*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*250*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*350*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*500*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*700*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1000*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1400*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2000*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2800*/
+   {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*4000*/
+   {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*5600*/
+   {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*8000*/
+   {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*11500*/
+   {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*16000*/
   },
 
   1,/*noisemaskp */
-  -24.f,  /* suppress any noise curve over maxspec+n */
+  -10.f,  /* suppress any noise curve over maxspec+n */
   .5f,   /* low window */
   .5f,   /* high window */
-  25,
+  10,
+  10,
   25,
   {.000f, 0.f, /*63*/
    .000f, 0.f, /*88*/
@@ -102,25 +133,65 @@
    .000f, 0.f, /*250*/
    .000f, 0.f, /*350*/
    .000f, 0.f, /*500*/
-   .200f, 0.f, /*700*/
-   .300f, 0.f, /*1000*/
-   .400f, 0.f, /*1400*/
-   .400f, 0.f, /*2000*/
-   .400f, 0.f, /*2800*/
-   .700f, 0.f, /*4000*/
-   .850f, 0.f, /*5600*/
-   .900f, 0.f, /*8000*/
+   .000f, 0.f, /*700*/
+   .000f, 0.f, /*1000*/
+   .300f, 0.f, /*1400*/
+   .300f, 0.f, /*2000*/
+   .300f, 0.f, /*2800*/
+   .500f, 0.f, /*4000*/
+   .700f, 0.f, /*5600*/
+   .850f, 0.f, /*8000*/
    .900f, 0.f, /*11500*/
    .900f, 1.f, /*16000*/
   },
  
   95.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -28.,
+  -44.,
 
+  32,
+  _vp_part0,_vp_couple0
 };
 
-static int noisy=1;
+static vorbis_info_floor1 _floor_set0={1,
+					{0},
+					
+					{32},
+					{0},
+					{0},
+					{{-1}},
+
+					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
+					 },
+					
+					60,30,400,
+					20,8,1,18.,
+					20,600,
+					960};
+
+
+static vorbis_info_mapping0 mapping_info={1,{0,1},{0},{0},{0},0, 1, {0},{1}};
+static codec_setup_info codec_setup0={ {0,0}, 
+				       1,1,1,1,1,0,1,	
+				       {NULL},
+				       {0},{&mapping_info},
+				       {0},{NULL},
+				       {1},{&_floor_set0},
+				       {2},{NULL},
+				       {NULL},
+				       {&_psy_set0},
+				       &_psy_set0G};
+				       
+static int noisy=0;
 void analysis(char *base,int i,float *v,int n,int bark,int dB){
   if(noisy){
     int j;
@@ -139,7 +210,7 @@
           fprintf(of,"%g ",(float)j);
       
         if(dB){
-	  fprintf(of,"%g\n",todB(fabs(v+j)));
+	  fprintf(of,"%g\n",todB(v+j));
         }else{
           fprintf(of,"%g\n",v[j]);
         }
@@ -159,18 +230,19 @@
   float acc=0.f;
   float tot=0.f;
   float ampmax=-9999,newmax;
+  float local_ampmax[2];
 
   int framesize=2048;
-  int order=30;
-  int map=256;
-  float ampmax_att_per_sec=-10.;
+  float ampmax_att_per_sec=-6.;
 
-  float *pcm[2],*out[2],*window,*lpc,*flr,*mask;
+  float *pcm[2],*out[2],*window,*flr[2],*mask[2],*work[2];
   signed char *buffer,*buffer2;
   mdct_lookup m_look;
   drft_lookup f_look;
-  drft_lookup f_look2;
   vorbis_look_psy p_look;
+  vorbis_look_psy_global *pg_look;
+  vorbis_look_floor *floor_look;
+  vorbis_info vi;
   long i,j,k;
 
   int ath=0;
@@ -183,47 +255,36 @@
       if(argv[0][1]=='v'){
         noisy=0;
       }
-      if(argv[0][1]=='o'){
-	order=atoi(argv[0]+2);
-      }
-      if(argv[0][1]=='m'){
-	map=atoi(argv[0]+2);
-      }
     }else
       if(*argv[0]=='+'){
         /* option */
         if(argv[0][1]=='v'){
           noisy=1;
         }
-	if(argv[0][1]=='o'){
-	  order=atoi(argv[0]+2);
-	}
-	if(argv[0][1]=='m'){
-	  map=atoi(argv[0]+2);
-	}
       }else
         framesize=atoi(argv[0]);
     argv++;
   }
   
-  mask=_ogg_malloc(framesize*sizeof(float));
+  vi.channels=2;
+  vi.codec_setup=&codec_setup0;
+
   pcm[0]=_ogg_malloc(framesize*sizeof(float));
   pcm[1]=_ogg_malloc(framesize*sizeof(float));
   out[0]=_ogg_calloc(framesize/2,sizeof(float));
   out[1]=_ogg_calloc(framesize/2,sizeof(float));
-  flr=_ogg_malloc(framesize*sizeof(float));
-  lpc=_ogg_malloc(order*sizeof(float));
+  work[0]=_ogg_calloc(framesize,sizeof(float));
+  work[1]=_ogg_calloc(framesize,sizeof(float));
+  flr[0]=_ogg_calloc(framesize/2,sizeof(float));
+  flr[1]=_ogg_calloc(framesize/2,sizeof(float));
   buffer=_ogg_malloc(framesize*4);
   buffer2=buffer+framesize*2;
   window=_vorbis_window(0,framesize,framesize/2,framesize/2);
   mdct_init(&m_look,framesize);
   drft_init(&f_look,framesize);
-  drft_init(&f_look2,framesize/2);
-  _vp_psy_init(&p_look,&_psy_set0,framesize/2,44100);
-
-  for(i=0;i<P_BANDS;i++)
-    for(j=0;j<P_LEVELS;j++)
-      analysis("Ptonecurve",i*100+j,p_look.tonecurves[i][j],EHMER_MAX,0,0);
+  _vp_psy_init(&p_look,&_psy_set0,&_psy_set0G,framesize/2,44100);
+  pg_look=_vp_global_look(&vi);
+  floor_look=_floor_P[1]->look(NULL,NULL,&_floor_set0);
 
   /* we cheat on the WAV header; we just bypass 44 bytes and never
      verify that it matches 16bit/stereo/44.1kHz. */
@@ -242,6 +303,7 @@
       memset(buffer2+bytes,0,framesize*2-bytes);
     
     if(bytes!=0){
+      int nonzero[2];
 
       /* uninterleave samples */
       for(i=0;i<framesize;i++){
@@ -257,93 +319,181 @@
         ampmax+=secs*ampmax_att_per_sec;
         if(ampmax<-9999)ampmax=-9999;
       }
-      newmax=ampmax;
 
       for(i=0;i<2;i++){
-	float amp;
+	float scale=4.f/framesize;
+	float *fft=work[i];
+	float *mdct=pcm[i];
+	float *logmdct=mdct+framesize/2;
 
-	analysis("pre",frameno,pcm[i],framesize,0,0);
-	memcpy(mask,pcm[i],sizeof(float)*framesize);
+	analysis("pre",frameno+i,pcm[i],framesize,0,0);
         
-	/* do the psychacoustics */
+	/* fft and mdct transforms  */
         for(j=0;j<framesize;j++)
-	  mask[j]=pcm[i][j]*=window[j];
+	  fft[j]=pcm[i][j]*=window[j];
         
-	drft_forward(&f_look,mask);
+	drft_forward(&f_look,fft);
 
-	mask[0]/=(framesize/4.);
-	for(j=1;j<framesize-1;j+=2)
-	  mask[(j+1)>>1]=4*hypot(mask[j],mask[j+1])/framesize;
-
-	mdct_forward(&m_look,pcm[i],pcm[i]);
-	memcpy(mask+framesize/2,pcm[i],sizeof(float)*framesize/2);
-	analysis("mdct",frameno,pcm[i],framesize/2,0,1);
-	analysis("fft",frameno,mask,framesize/2,0,1);
-
-	{
-	  float ret;
-	  ret=_vp_compute_mask(&p_look,mask,mask+framesize/2,flr,NULL,ampmax);
-	  if(ret>newmax)newmax=ret;
+	local_ampmax[i]=-9999.f;
+	fft[0]*=scale;
+	fft[0]=todB(fft);
+	for(j=1;j<framesize-1;j+=2){
+	  float temp=scale*FAST_HYPOT(fft[j],fft[j+1]);
+	  temp=fft[(j+1)>>1]=todB(&temp);
+	  if(temp>local_ampmax[i])local_ampmax[i]=temp;
         }
+	if(local_ampmax[i]>ampmax)ampmax=local_ampmax[i];
+	
+	mdct_forward(&m_look,pcm[i],mdct);
+	for(j=0;j<framesize/2;j++)
+	  logmdct[j]=todB(mdct+j);
 
-	analysis("mask",frameno,flr,framesize/2,0,0);
+	analysis("mdct",frameno+i,logmdct,framesize/2,1,0);
+	analysis("fft",frameno+i,fft,framesize/2,1,0);
+      }
 
-	mask[framesize-1]=0.;
-	mask[0]=0.;
-	for(j=1;j<framesize-1;j+=2){
-	  mask[j]=todB(pcm[i]+((j+1)>>1));
-	  mask[j+1]=0;
+      for(i=0;i<2;i++){
+	float amp;
+	float *fft=work[i];
+	float *logmax=fft;
+	float *mdct=pcm[i];
+	float *logmdct=mdct+framesize/2;
+	float *mask=fft+framesize/2;
+
+	/* floor psychoacoustics */
+	_vp_compute_mask(&p_look,
+			 pg_look,
+			 i,
+			 fft,
+			 logmdct,
+			 mask,
+			 ampmax,
+			 local_ampmax[i],
+			 framesize/2);
+
+	analysis("mask",frameno+i,mask,framesize/2,1,0);
+
+	{
+	  vorbis_block vb;
+	  vorbis_dsp_state vd;
+	  memset(&vd,0,sizeof(vd));
+	  vd.vi=&vi;
+	  vb.vd=&vd;
+	  vb.pcmend=framesize;
+
+	  /* floor quantization/application */
+	  nonzero[i]=_floor_P[1]->forward(&vb,floor_look,
+					  mdct,
+					  logmdct,
+					  mask,
+					  logmax,
+					  
+					  flr[i]);
         }
 
-	analysis("lfft",frameno,mask,framesize,0,0);
-	drft_backward(&f_look,mask);
+	_vp_remove_floor(&p_look,
+			 pg_look,
+			 logmdct,
+			 mdct,
+			 flr[i],
+			 pcm[i],
+			 local_ampmax[i]);
+
+	for(j=0;j<framesize/2;j++)
+	  if(fabs(pcm[i][j])>1500)
+	    fprintf(stderr,"%ld ",frameno+i);
+	
+	analysis("res",frameno+i,pcm[i],framesize/2,1,0);
+	analysis("codedflr",frameno+i,flr[i],framesize/2,1,1);
+      }
 
-	analysis("cep",frameno,mask,framesize,0,0);
-	analysis("logcep",frameno,mask,framesize,0,1);
+      /* residue prequantization */
+      _vp_partition_prequant(&p_look,
+			     &vi,
+			     pcm,
+			     nonzero);
         
+      for(i=0;i<2;i++)
+	analysis("quant",frameno+i,pcm[i],framesize/2,1,0);
 
+      /* channel coupling / stereo quantization */
 
-	/*for(j=0;j<framesize/2;j++){
-	  float val=fromdB(flr[j]);
-	  int p=rint(pcm[i][j]/val);
-	  pcm[i][j]=p*val;
-	  }*/
-
-	/*for(j=0;j<framesize/2;j++){
-	  float val=todB(pcm[i]+j);
-	  if(val+6.<flr[j])
-	    pcm[i][j]=0.;
-	    }*/
+      _vp_couple(&p_look,
+		 &mapping_info,
+		 pcm,
+		 nonzero);
+  
+      for(i=0;i<2;i++)
+	analysis("coupled",frameno+i,pcm[i],framesize/2,1,0);
 
+      /* decoupling */
+      for(i=mapping_info.coupling_steps-1;i>=0;i--){
+	float *pcmM=pcm[mapping_info.coupling_mag[i]];
+	float *pcmA=pcm[mapping_info.coupling_ang[i]];
+	
         for(j=0;j<framesize/2;j++){
-	  float val=rint(todB(pcm[i]+j)/6);
-	  if(pcm[i][j]>0)
-	    pcm[i][j]=fromdB(val*6);
+	  float mag=pcmM[j];
+	  float ang=pcmA[j];
+	  
+	  if(mag>0)
+	    if(ang>0){
+	      pcmM[j]=mag;
+	      pcmA[j]=mag-ang;
+	    }else{
+	      pcmA[j]=mag;
+	      pcmM[j]=mag+ang;
+	    }
           else
-	    pcm[i][j]=-fromdB(val*6);
+	    if(ang>0){
+	      pcmM[j]=mag;
+	      pcmA[j]=mag+ang;
+	    }else{
+	      pcmA[j]=mag;
+	      pcmM[j]=mag-ang;
+	    }
         }
+      }
+    
+      for(i=0;i<2;i++)
+	analysis("decoupled",frameno+i,pcm[i],framesize/2,1,0);
+
+      for(i=0;i<2;i++){
+	float amp;
 
+	for(j=0;j<framesize/2;j++)
+	  pcm[i][j]*=flr[i][j];
 
-	analysis("final",frameno,pcm[i],framesize/2,0,1);
+	analysis("final",frameno+i,pcm[i],framesize/2,1,1);
 
         /* take it back to time */
         mdct_backward(&m_look,pcm[i],pcm[i]);
+
         for(j=0;j<framesize/2;j++)
           out[i][j]+=pcm[i][j]*window[j];
+
+	analysis("out",frameno+i,out[i],framesize/2,0,0);
+
 
-	frameno++;
       }
-      ampmax=newmax;
            
       /* write data.  Use the part of buffer we're about to shift out */
       for(i=0;i<2;i++){
         char  *ptr=buffer+i*2;
         float *mono=out[i];
+	int flag=0;
         for(j=0;j<framesize/2;j++){
           int val=mono[j]*32767.;
           /* might as well guard against clipping */
-	  if(val>32767)val=32767;
-	  if(val<-32768)val=-32768;
+	  if(val>32767){
+	    if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i);
+	    flag=1;
+	    val=32767;
+	  }
+	  if(val<-32768){
+	    if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i);
+	    flag=1;
+	    val=-32768;
+	  }
           ptr[0]=val&0xff;
           ptr[1]=(val>>8)&0xff;
           ptr+=4;
@@ -358,6 +508,7 @@
         for(j=0,k=framesize/2;j<framesize/2;j++,k++)
           out[i][j]=pcm[i][k]*window[k];
       }
+      frameno+=2;
     }else
       eos=1;
   }

1.9       +2 -1      vorbis/lib/registry.c

Index: registry.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- registry.c	2001/06/15 21:15:40	1.8
+++ registry.c	2001/08/13 01:36:57	1.9
@@ -11,11 +11,12 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.8 2001/06/15 21:15:40 xiphmont Exp $
+ last mod: $Id: registry.c,v 1.9 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "misc.h"
 

1.8       +1 -3      vorbis/lib/registry.h

Index: registry.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- registry.h	2001/06/15 21:15:40	1.7
+++ registry.h	2001/08/13 01:36:57	1.8
@@ -11,14 +11,12 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.7 2001/06/15 21:15:40 xiphmont Exp $
+ last mod: $Id: registry.h,v 1.8 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
 #ifndef _V_REG_H_
 #define _V_REG_H_
-
-#include "backends.h"
 
 #define VI_TRANSFORMB 1
 #define VI_WINDOWB 1

1.33      +271 -92   vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- res0.c	2001/06/15 23:31:00	1.32
+++ res0.c	2001/08/13 01:36:57	1.33
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.32 2001/06/15 23:31:00 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.33 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -45,11 +45,9 @@
   int         partvals;
   int       **decodemap;
 
-  /*long      resbits[32][32];
-  long      resbitsflat;
-  long      resvals[32];
+  long      postbits;
   long      phrasebits;
-  long      frames;*/
+  long      frames;
 
 } vorbis_look_residue0;
 
@@ -68,13 +66,19 @@
 }
 
 void res0_free_look(vorbis_look_residue *i){
-  int j,k;
+  int j;
   if(i){
 
     vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
-    vorbis_info_residue0 *info=look->info;
 
-    /*fprintf(stderr,
+    /*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);*/
+
+    /*vorbis_info_residue0 *info=look->info;
+
+    fprintf(stderr,
             "%ld frames encoded in %ld phrasebits and %ld residue bits "
             "(%g/frame) \n",look->frames,look->phrasebits,
             look->resbitsflat,
@@ -281,37 +285,25 @@
 static int _testhack(float *vec,int n,vorbis_look_residue0 *look,
                      int auxparts,int auxpartnum){
   vorbis_info_residue0 *info=look->info;
-  int i,j=0;
-  float max,localmax=0.f;
+  int i;
+  float max=0.f;
   float temp[128];
-  float entropy[8];
+  float entropy=0.f;
 
   /* 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;
+    if(temp[i]>max)max=temp[i];
 
   for(i=0;i<n;i++)temp[i]=rint(temp[i]);
-  
-  while(n){
-    entropy[j]=localmax;
-    n>>=1;
-    j++;
-    if(!n)break;
-    for(i=0;i<n;i++){
-      temp[i]=temp[i*2]+temp[i*2+1];
-    }
-    localmax=0.f;
-    for(i=0;i<n;i++)
-      if(temp[i]>localmax)localmax=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->subgrp[i]]<=info->entmax[i] &&
+       entropy<=info->entmax[i] &&
        max<=info->ampmax[i])
       break;
 
@@ -374,13 +366,118 @@
   return(bits);
 }
 
+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;
+  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+  vorbis_info_residue0 *info=look->info;
+
+  /* move all this setup out later */
+  int samples_per_partition=info->grouping;
+  int possible_partitions=info->partitions;
+  int n=info->end-info->begin;
+
+  int partvals=n/samples_per_partition;
+  long **partword=_vorbis_block_alloc(vb,ch*sizeof(long *));
+
+  /* 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 */
+ 
+  for(i=0;i<ch;i++){
+    partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(long));
+    memset(partword[i],0,n/samples_per_partition*sizeof(long));
+  }
+
+  for(i=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);
+  
+  }
+
+#ifdef TRAIN_RES
+  {
+    FILE *of;
+    char buffer[80];
+  
+    for(i=0;i<ch;i++){
+      sprintf(buffer,"resaux_%d.vqd",vb->mode);
+      of=fopen(buffer,"a");
+      for(j=0;j<partvals;j++)
+	fprintf(of,"%ld, ",partword[i][j]);
+      fprintf(of,"\n");
+      fclose(of);
+    }
+  }
+#endif
+  look->frames++;
+
+  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)){
+  long i,j,k,l;
+  vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
+  vorbis_info_residue0 *info=look->info;
+
+  /* move all this setup out later */
+  int samples_per_partition=info->grouping;
+  int possible_partitions=info->partitions;
+  int n=info->end-info->begin;
+
+  int partvals=n/samples_per_partition;
+  long **partword=_vorbis_block_alloc(vb,sizeof(long *));
+  float *work=alloca(sizeof(float)*samples_per_partition);
+  
+  partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(long));
+  memset(partword[0],0,n*ch/samples_per_partition*sizeof(long));
+
+  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);
+  }  
+
+#ifdef TRAIN_RES
+  {
+    FILE *of;
+    char buffer[80];
+  
+    sprintf(buffer,"resaux_%d.vqd",vb->mode);
+    of=fopen(buffer,"a");
+    for(i=0;i<partvals;i++)
+      fprintf(of,"%ld, ",partword[0][i]);
+    fprintf(of,"\n");
+    fclose(of);
+  }
+#endif
+  look->frames++;
+
+  return(partword);
+}
+
 static int _01forward(vorbis_block *vb,vorbis_look_residue *vl,
                       float **in,int ch,
-		      int (*classify)(float *,int,vorbis_look_residue0 *,
-				      int,int),
+		      int pass,long **partword,
                       int (*encode)(oggpack_buffer *,float *,int,
                                     codebook *,vorbis_look_residue0 *)){
-  long i,j,k,l,s;
+  long i,j,k,s;
   vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
   vorbis_info_residue0 *info=look->info;
 
@@ -391,8 +488,8 @@
   int n=info->end-info->begin;
 
   int partvals=n/samples_per_partition;
-  int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-  long **partword=_vorbis_block_alloc(vb,ch*sizeof(long *));
+  long resbits[128];
+  long resvals[128];
 
 #ifdef TRAIN_RES
   FILE *of;
@@ -400,77 +497,80 @@
   int m;
   
   for(i=0;i<ch;i++){
-    sprintf(buffer,"residue_%d.vqd",vb->mode);
+    sprintf(buffer,"residue_%d#%d.vqd",vb->mode,pass);
     of=fopen(buffer,"a");
     for(m=0;m<info->end;m++)
       fprintf(of,"%.2f, ",in[i][m]);
     fprintf(of,"\n");
     fclose(of);
   }
- 
 #endif      
-
-  partvals=partwords*partitions_per_word;
 
-  /* we find the patition type for each partition of each
-     channel.  We'll go back and do the interleaved encoding in a
-     bit.  For now, clarity */
- 
-  for(i=0;i<ch;i++){
-    partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(long));
-    memset(partword[i],0,n/samples_per_partition*sizeof(long));
-  }
-
-  for(i=info->begin,l=0;i<info->end;i+=samples_per_partition,l++){
-    for(j=0;j<ch;j++)
-      /* do the partition decision based on the 'entropy'
-         int the block */
-      partword[j][l]=
-	classify(in[j]+i,samples_per_partition,look,possible_partitions,l);
+  memset(resbits,0,sizeof(resbits));
+  memset(resvals,0,sizeof(resvals));
   
-  }
-
   /* we code the partition words for each channel, then the residual
      words for a partition per channel until we've written all the
      residual words for that partition word.  Then write the next
      partition channel words... */
 
-  /*look->frames++;*/
-  for(s=0;s<look->stages;s++){
-    for(i=info->begin,l=0;i<info->end;){
+  for(s=(pass==0?0:info->passlimit[pass-1]);s<info->passlimit[pass];s++){
+    for(i=0;i<partvals;){
       
       /* first we encode a partition codeword for each channel */
       if(s==0){
         for(j=0;j<ch;j++){
-	  long val=partword[j][l];
+	  long val=partword[j][i];
           long ret;
-	  for(k=1;k<partitions_per_word;k++)
-	    val= val*possible_partitions+partword[j][l+k];
-	  ret=vorbis_book_encode(look->phrasebook,val,&vb->opb);
-	  /*look->phrasebits+=ret;*/
+	  for(k=1;k<partitions_per_word;k++){
+	    val*=possible_partitions;
+	    if(i+k<partvals)
+	      val+=partword[j][i+k];
+	  }	
+
+	  /* training hack */
+	  if(val<look->phrasebook->entries)
+	    ret=vorbis_book_encode(look->phrasebook,val,&vb->opb);
+	  /*else
+	    fprintf(stderr,"!");*/
+	  
+	  look->phrasebits+=ret;
+	
         }
       }
       
       /* now we encode interleaved residual values for the partitions */
-      for(k=0;k<partitions_per_word;k++,l++,i+=samples_per_partition){
+      for(k=0;k<partitions_per_word && i<partvals;k++,i++){
+	long offset=i*samples_per_partition+info->begin;
         
         for(j=0;j<ch;j++){
-	  /*if(s==0)look->resvals[partword[j][l]]++;*/
-	  if(info->secondstages[partword[j][l]]&(1<<s)){
-	    codebook *statebook=look->partbooks[partword[j][l]][s];
+	  if(s==0)resvals[partword[j][i]]+=samples_per_partition;
+	  if(info->secondstages[partword[j][i]]&(1<<s)){
+	    codebook *statebook=look->partbooks[partword[j][i]][s];
             if(statebook){
-	      int ret=encode(&vb->opb,in[j]+i,samples_per_partition,
+	      int ret=encode(&vb->opb,in[j]+offset,samples_per_partition,
                              statebook,look);
-	      /*look->resbits[partword[j][l]][s]+=ret;
-		look->resbitsflat+=ret;*/
-
+	      look->postbits+=ret;
+	      resbits[partword[j][i]]+=ret;
             }
           }
         }
       }
     }
   }
-  
+
+  /*{
+    long total=0;
+    long totalbits=0;
+    fprintf(stderr,"%d :: ",vb->mode);
+    for(k=0;k<possible_partitions;k++){
+      fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]);
+      total+=resvals[k];
+      totalbits+=resbits[k];
+    }
+
+    fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
+    }*/
   return(0);
 }
 
@@ -488,18 +588,19 @@
   int samples_per_partition=info->grouping;
   int partitions_per_word=look->phrasebook->dim;
   int n=info->end-info->begin;
-
+  
   int partvals=n/samples_per_partition;
   int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
   int ***partword=alloca(ch*sizeof(int **));
-  partvals=partwords*partitions_per_word;
 
   for(j=0;j<ch;j++)
     partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(int *));
 
   for(s=0;s<look->stages;s++){
-    for(i=info->begin,l=0;i<info->end;l++){
 
+    /* each loop decodes on partition codeword containing 
+       partitions_pre_word partitions */
+    for(i=0,l=0;i<partvals;l++){
       if(s==0){
         /* fetch the partition word for each channel */
         for(j=0;j<ch;j++){
@@ -511,12 +612,13 @@
       }
       
       /* now we decode residual values for the partitions */
-      for(k=0;k<partitions_per_word;k++,i+=samples_per_partition)
+      for(k=0;k<partitions_per_word && i<partvals;k++,i++)
         for(j=0;j<ch;j++){
+	  long offset=info->begin+i*samples_per_partition;
           if(info->secondstages[partword[j][l][k]]&(1<<s)){
             codebook *stagebook=look->partbooks[partword[j][l][k]][s];
             if(stagebook){
-	      if(decodepart(stagebook,in[j]+i,&vb->opb,
+	      if(decodepart(stagebook,in[j]+offset,&vb->opb,
                             samples_per_partition)==-1)goto eopbreak;
             }
           }
@@ -531,19 +633,45 @@
 
 /* residue 0 and 1 are just slight variants of one another. 0 is
    interleaved, 1 is not */
-int res0_forward(vorbis_block *vb,vorbis_look_residue *vl,
-	    float **in,int *nonzero,int ch){
+long **res0_class(vorbis_block *vb,vorbis_look_residue *vl,
+		  float **in,int *nonzero,int ch){
   /* we encode only the nonzero parts of a bundle */
   int i,used=0;
   for(i=0;i<ch;i++)
     if(nonzero[i])
       in[used++]=in[i];
   if(used)
-    return(_01forward(vb,vl,in,used,_interleaved_testhack,_interleaved_encodepart));
+    return(_01class(vb,vl,in,used,_interleaved_testhack));
   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){
+  /* 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];
+      in[used++]=in[i];
+    }
+  if(used){
+    int ret=_01forward(vb,vl,in,used,pass,partword,
+		      _interleaved_encodepart);
+    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
+    return(0);
+}
+
 int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,int *nonzero,int ch){
   int i,used=0;
@@ -557,13 +685,38 @@
 }
 
 int res1_forward(vorbis_block *vb,vorbis_look_residue *vl,
-		 float **in,int *nonzero,int ch){
+		 float **in,float **out,int *nonzero,int ch,
+		 int pass, 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];
+      in[used++]=in[i];
+    }
+
+  if(used){
+    int ret=_01forward(vb,vl,in,used,pass,partword,_encodepart);
+    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
+    return(0);
+}
+
+long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
+		  float **in,int *nonzero,int ch){
   int i,used=0;
   for(i=0;i<ch;i++)
     if(nonzero[i])
       in[used++]=in[i];
   if(used)
-    return(_01forward(vb,vl,in,used,_testhack,_encodepart));
+    return(_01class(vb,vl,in,used,_testhack));
   else
     return(0);
 }
@@ -580,25 +733,49 @@
     return(0);
 }
 
+long **res2_class(vorbis_block *vb,vorbis_look_residue *vl,
+		  float **in,int *nonzero,int ch){
+  int i,used=0;
+  for(i=0;i<ch;i++)
+    if(nonzero[i])
+      in[used++]=in[i];
+  if(used)
+    return(_2class(vb,vl,in,used,_testhack));
+  else
+    return(0);
+}
+
 /* res2 is slightly more different; all the channels are interleaved
    into a single vector and encoded. */
+
 int res2_forward(vorbis_block *vb,vorbis_look_residue *vl,
-	    float **in,int *nonzero,int ch){
+		 float **in,float **out,int *nonzero,int ch,
+		 int pass,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
      reshape ourselves into a single channel res1 */
+  /* ugly; reallocs for each coupling pass :-( */
   float *work=_vorbis_block_alloc(vb,ch*n*sizeof(float));
   for(i=0;i<ch;i++){
-    float *pcm=vb->pcm[i];
+    float *pcm=in[i];
     if(nonzero[i])used++;
     for(j=0,k=i;j<n;j++,k+=ch)
       work[k]=pcm[j];
   }
   
-  if(used)
-    return(_01forward(vb,vl,&work,1,_testhack,_encodepart));
-  else
+  if(used){
+    int ret=_01forward(vb,vl,&work,1,pass,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];
+    }
+
+    return(ret);
+  }else
     return(0);
 }
 
@@ -617,14 +794,12 @@
   int partvals=n/samples_per_partition;
   int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
   int **partword=_vorbis_block_alloc(vb,partwords*sizeof(int *));
-  int used;
-  partvals=partwords*partitions_per_word;
 
   for(i=0;i<ch;i++)if(nonzero[i])break;
   if(i==ch)return(0); /* no nonzero vectors */
 
   for(s=0;s<look->stages;s++){
-    for(i=info->begin,l=0;i<info->end;l++){
+    for(i=0,l=0;i<partvals;l++){
 
       if(s==0){
         /* fetch the partition word */
@@ -635,12 +810,13 @@
       }
 
       /* now we decode residual values for the partitions */
-      for(k=0;k<partitions_per_word;k++,i+=samples_per_partition)
+      for(k=0;k<partitions_per_word && i<partvals;k++,i++)
         if(info->secondstages[partword[l][k]]&(1<<s)){
           codebook *stagebook=look->partbooks[partword[l][k]][s];
-
+	  
           if(stagebook){
-	    if(vorbis_book_decodevv_add(stagebook,in,i,ch,
+	    if(vorbis_book_decodevv_add(stagebook,in,
+					i*samples_per_partition+info->begin,ch,
                                         &vb->opb,samples_per_partition)==-1)
               goto eopbreak;
           }
@@ -661,6 +837,7 @@
   &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
+  &res0_class,
   &res0_forward,
   &res0_inverse
 };
@@ -672,6 +849,7 @@
   &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
+  &res1_class,
   &res1_forward,
   &res1_inverse
 };
@@ -683,6 +861,7 @@
   &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
+  &res2_class,
   &res2_forward,
   &res2_inverse
 };

1.17      +2 -2      vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- sharedbook.c	2001/02/26 03:50:43	1.16
+++ sharedbook.c	2001/08/13 01:36:57	1.17
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.16 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.17 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
@@ -396,7 +396,7 @@
     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
+	 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;

1.23      +3 -2      vorbis/lib/synthesis.c

Index: synthesis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/synthesis.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- synthesis.c	2001/05/27 06:44:01	1.22
+++ synthesis.c	2001/08/13 01:36:57	1.23
@@ -11,13 +11,14 @@
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.22 2001/05/27 06:44:01 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.23 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
 #include <stdio.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "misc.h"
 #include "os.h"
@@ -75,7 +76,7 @@
 long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
   codec_setup_info     *ci=vi->codec_setup;
   oggpack_buffer       opb;
-  int                  type,mode,i;
+  int                  mode;
  
   oggpack_readinit(&opb,op->packet,op->bytes);
 

1.10      +2 -1      vorbis/lib/time0.c

Index: time0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/time0.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- time0.c	2001/02/26 03:50:43	1.9
+++ time0.c	2001/08/13 01:36:57	1.10
@@ -11,13 +11,14 @@
  ********************************************************************
 
  function: time backend 0 (dummy)
- last mod: $Id: time0.c,v 1.9 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: time0.c,v 1.10 2001/08/13 01:36:57 xiphmont Exp $
 
  ********************************************************************/
 
 #include <stdlib.h>
 #include <string.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "misc.h"
 

1.8       +20 -5     vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vorbisenc.c	2001/05/27 06:44:01	1.7
+++ vorbisenc.c	2001/08/13 01:36:58	1.8
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.7 2001/05/27 06:44:01 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.8 2001/08/13 01:36:58 xiphmont Exp $
 
  ********************************************************************/
 
@@ -83,12 +83,22 @@
 
 }
 
-/* right now, this just encapsultes the old modes behind the interface
-   we'll be using from here on out.  After beta 3, the new bitrate
-   tracking/modding/tuning engine will lurk inside */
 /* encoders will need to use vorbis_info_init beforehand and call
    vorbis_info clear when all done */
 
+int vorbis_encode_init_vbr(vorbis_info *vi,
+			   long channels,
+			   long rate,
+			   
+			   float base_quality /* 0. to 1. */
+			   ){
+
+
+
+
+}
+
+
 int vorbis_encode_init(vorbis_info *vi,
                        long channels,
                        long rate,
@@ -114,8 +124,12 @@
 
   /* copy a mode into our allocated storage */
   bpch=nominal_bitrate/channels;
+
+  mode=&info_44c_Z;
+
+#if 0
   if(bpch<60000){
-    /* mode A */
+    /* mode AA */
     mode=&info_AA;
   }else if(bpch<75000){
     /* mode A */
@@ -133,6 +147,7 @@
     /* mode E */
     mode=&info_E;
   }
+#endif
 
   /* now we have to deepcopy */
   codec_setup_partialcopy(ci,mode);

1.2       +202 -0    vorbis/lib/books/Makefile

1.2       +202 -0    vorbis/lib/books/Makefile.in

1.2       +37 -0     vorbis/lib/books/line_1024x31_0sub0.vqh

1.2       +40 -0     vorbis/lib/books/line_1024x31_0sub1.vqh

1.2       +37 -0     vorbis/lib/books/line_1024x31_1sub0.vqh

1.2       +40 -0     vorbis/lib/books/line_1024x31_1sub1.vqh

1.2       +37 -0     vorbis/lib/books/line_1024x31_2sub1.vqh

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

1.2       +40 -0     vorbis/lib/books/line_1024x31_2sub3.vqh

1.2       +37 -0     vorbis/lib/books/line_1024x31_3sub1.vqh

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

1.2       +40 -0     vorbis/lib/books/line_1024x31_3sub3.vqh

1.2       +37 -0     vorbis/lib/books/line_1024x31_class0.vqh

1.2       +37 -0     vorbis/lib/books/line_1024x31_class1.vqh

1.2       +40 -0     vorbis/lib/books/line_1024x31_class2.vqh

1.2       +40 -0     vorbis/lib/books/line_1024x31_class3.vqh

1.2       +40 -0     vorbis/lib/books/line_128x7_0sub0.vqh

1.2       +37 -0     vorbis/lib/books/line_128x7_1sub1.vqh

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

1.2       +40 -0     vorbis/lib/books/line_128x7_1sub3.vqh

1.2       +37 -0     vorbis/lib/books/line_128x7_2sub1.vqh

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

1.2       +40 -0     vorbis/lib/books/line_128x7_2sub3.vqh

1.2       +40 -0     vorbis/lib/books/line_128x7_class1.vqh

1.2       +40 -0     vorbis/lib/books/line_128x7_class2.vqh

1.2       +94 -0     vorbis/lib/books/res_Zc_1.vqh

1.2       +43 -0     vorbis/lib/books/res_Zc_1024aux.vqh

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

1.2       +300 -0    vorbis/lib/books/res_Zc_2.vqh

1.2       +248 -0    vorbis/lib/books/res_Zc_3.vqh

1.2       +89 -0     vorbis/lib/books/res_Zc_4.vqh

1.2       +89 -0     vorbis/lib/books/res_Zc_5.vqh

1.2       +129 -0    vorbis/lib/books/res_Zc_6.vqh

1.2       +119 -0    vorbis/lib/books/res_Zc_7.vqh

1.2       +1234 -0   vorbis/lib/books/res_Zc_8.vqh

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

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

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

1.17      +312 -217  vorbis/lib/modes/mode_A.h

Index: mode_A.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_A.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- mode_A.h	2001/06/18 09:07:32	1.16
+++ mode_A.h	2001/08/13 01:37:13	1.17
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_A.h,v 1.16 2001/06/18 09:07:32 xiphmont Exp $
+ last mod: $Id: mode_A.h,v 1.17 2001/08/13 01:37:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,20 +22,35 @@
 #include "vorbis/codec.h"
 #include "backends.h"
 
-#include "books/lsp12_0.vqh"
-#include "books/lsp30_0.vqh"
-#include "books/lsp12_1.vqh"
-#include "books/lsp30_1.vqh"
+#include "books/line0_class1.vqh"
+#include "books/line0_class2.vqh"
+#include "books/line1_class0.vqh"
+#include "books/line1_class1.vqh"
+#include "books/line1_class2.vqh"
+#include "books/line1_class3.vqh"
+
+#include "books/line0_0sub0.vqh"
+#include "books/line0_1sub1.vqh"
+#include "books/line0_1sub2.vqh"
+#include "books/line0_1sub3.vqh"
+#include "books/line0_2sub1.vqh"
+#include "books/line0_2sub2.vqh"
+#include "books/line0_2sub3.vqh"
+
+#include "books/line1_0sub0.vqh"
+#include "books/line1_0sub1.vqh"
+#include "books/line1_1sub0.vqh"
+#include "books/line1_1sub1.vqh"
+#include "books/line1_2sub1.vqh"
+#include "books/line1_2sub2.vqh"
+#include "books/line1_2sub3.vqh"
+#include "books/line1_3sub1.vqh"
+#include "books/line1_3sub2.vqh"
+#include "books/line1_3sub3.vqh"
 
 #include "books/res0_128_128aux.vqh"
 #include "books/res0_128_1024aux.vqh"
 
-#include "books/res0_128_128_1.vqh"
-#include "books/res0_128_128_2.vqh"
-#include "books/res0_128_128_3.vqh"
-#include "books/res0_128_128_4.vqh"
-#include "books/res0_128_128_5.vqh"
-
 #include "books/res0_128_1024_1.vqh"
 #include "books/res0_128_1024_2.vqh"
 #include "books/res0_128_1024_3.vqh"
@@ -43,218 +58,284 @@
 #include "books/res0_128_1024_5.vqh"
 #include "books/res0_128_1024_6.vqh"
 #include "books/res0_128_1024_7.vqh"
+#include "books/res0_128_1024_7a.vqh"
 #include "books/res0_128_1024_8.vqh"
+#include "books/res0_128_1024_8a.vqh"
 #include "books/res0_128_1024_9.vqh"
+#include "books/res0_128_1024_9a.vqh"
+#include "books/res0_128_1024_9b.vqh"
+
+
+static vorbis_info_psy_global _psy_set_AG={
+  0, /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+};
+
+static struct vp_couple_pass _psy_passA0[]={
+  {1.f,1.f,
+    {{24,    0,0,       0,0,      0,0},
+     {64,    0,0,   12.5f,12,     0,0},
+     {9999,  0,0,   12.5f,12,  2.5f,0}}
+  },
+};
 
+static vp_couple_pass _psy_passA[]={
+  {1.f,1.f,
+    {{288,   0,0,       0,0,      0,0},
+     {512,   0,0,   12.5f,12,     0,0},
+     {9999,  0,0,   12.5f,12,  2.5f,0}}
+  }
+};
+
+static vp_attenblock _vp_tonemask_consbass_A={
+  {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
+  
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
+}};
+
+static vp_attenblock _vp_tonemask_A={
+
+  {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
+  
+  
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  
+  {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
+}};
+
+static vp_attenblock _vp_peakatt_A={
+  {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*63*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*88*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*125*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*175*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*250*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*350*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*500*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-26.f,-32.f,-40.f},/*700*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-22.f,-32.f,-40.f},/*1000*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*1400*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*2000*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*2400*/
+  {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-32.f,-40.f},/*4000*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*5600*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*8000*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-22.f,-32.f,-40.f},/*11500*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-20.f,-32.f,-40.f},/*16000*/
+}};
 
 static vorbis_info_psy _psy_set_A0={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.,
   -140.,
 
-  8,
+  /* tonemaskp */
+  0.f, -40.f,&_vp_tonemask_consbass_A,
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
-
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
-  },
-
-  1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-22.f,-22.f,-22.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-22.f,-22.f,-22.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-22.f,-22.f,-22.f},/*125*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-22.f,-22.f},/*175*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-22.f,-22.f},/*250*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-22.f,-22.f},/*350*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-22.f,-22.f},/*500*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-22.f,-22.f,-22.f},/*700*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-20.f,-22.f,-22.f,-22.f},/*1000*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-22.f,-22.f},/*1400*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-22.f,-22.f},/*2000*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-22.f,-22.f},/*2400*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-22.f,-22.f},/*4000*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-22.f,-22.f},/*5600*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-22.f,-22.f},/*8000*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-22.f,-22.f,-22.f},/*11500*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-20.f,-21.f,-22.f},/*16000*/
-  },
+  /* peakattp */
+  1, &_vp_peakatt_A,
 
   1,/*noisemaskp */
-  -10.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  5,
-  5,
-  10,
-  {.000f, 0.f,/*63*/
-   .000f, 0.f,/*88*/
-   .000f, 0.f,/*125*/
-   .000f, 0.f,/*175*/
-   .000f, 0.f,/*250*/
-   .000f, 0.f,/*350*/
-   .000f, 0.f,/*500*/
-   .300f, 0.f,/*700*/
-   .500f, 0.f,/*1000*/
-   .500f, 0.f,/*1400*/
-   .500f, 0.f,/*2000*/
-   .500f, 0.f,/*2800*/
-   .600f, 0.f,/*4000*/
-   .700f, 0.f,/*5600*/
-   .850f, 0.f,/*8000*/
-   .900f, 0.f,/*11500*/
-   .900f, 0.f,/*16000*/
-  },
- 
+  -30.f,     /* suppress any noise curve over maxspec+n */
+  .6f, .6f,   /* low/high window */
+  5, 5, 10,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-20,-10,  0,  0,  0,  0,  0,  1,  1,  2,  3},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.8f,.9f,.9f,.9f},
+
   95.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -22.,
-
+  1,
+  _psy_passA0
 };
 
 static vorbis_info_psy _psy_set_A={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.f,
   -140.f,
 
-  8,
+  /* tonemask */
+  0.f,-40.f,&_vp_tonemask_consbass_A,
+  /* peakattp */
+  1,  &_vp_peakatt_A,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,   0,  0,  0,  0},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.75f,.8f,.8f,.85f},
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
-
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
-
-   {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
-   {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
+  95.f,  /* even decade + 5 is important; saves an rint() later in a
+            tight loop) */
+  1,_psy_passA
+};
 
-  },
+static vorbis_info_psy _psy_set_AT={
+  ATH_Bark_dB_lineaggressive,
 
-  1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-24.f,-24.f,-24.f},/*125*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-24.f,-24.f,-24.f},/*175*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-24.f,-24.f,-24.f},/*250*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-24.f,-24.f},/*350*/
-   {-10.f,-10.f,-10.f,-10.f,-16.f,-16.f,-18.f,-20.f,-22.f,-24.f,-24.f},/*500*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*700*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1000*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*1400*/
-   {-10.f,-10.f,-10.f,-10.f,-14.f,-14.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2000*/
-   {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*2400*/
-   {-10.f,-10.f,-10.f,-12.f,-16.f,-16.f,-16.f,-20.f,-22.f,-24.f,-24.f},/*4000*/
-   {-10.f,-10.f,-10.f,-12.f,-12.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*5600*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*8000*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-14.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*11500*/
-   {-10.f,-10.f,-10.f,-10.f,-10.f,-12.f,-16.f,-18.f,-22.f,-24.f,-24.f},/*16000*/
-  },
+  -100.f,
+  -140.f,
 
-  1,/*noisemaskp */
-  -24.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  25,
-  25,
-  50,
-  {.000f, 0.f, /*63*/
-   .000f, 0.f, /*88*/
-   .000f, 0.f, /*125*/
-   .000f, 0.f, /*175*/
-   .000f, 0.f, /*250*/
-   .000f, 0.f, /*350*/
-   .000f, 0.f, /*500*/
-   .200f, 0.f, /*700*/
-   .300f, 0.f, /*1000*/
-   .400f, 0.f, /*1400*/
-   .400f, 0.f, /*2000*/
-   .400f, 0.f, /*2800*/
-   .700f, 0.f, /*4000*/
-   .850f, 0.f, /*5600*/
-   .900f, 0.f, /*8000*/
-   .900f, 0.f, /*11500*/
-   .900f, 1.f, /*16000*/
-  },
- 
-  95.f,  /* even decade + 5 is important; saves an rint() later in a
-            tight loop) */
-  -28.,
+  /* tonemask */
+  0.f,-40.f,&_vp_tonemask_consbass_A,
+  /* peakattp */
+  1,  &_vp_peakatt_A,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-30,-20,  0,  0,  0,  0,  0,   0,  0,  0,  0},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.7f,.75f,.8f,.8f,.85f},
 
+  95.f,  /* even decade + 5 is important; saves an rint() later in a
+  1,_psy_passA
 };
 
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0A={0};
-static vorbis_info_floor0 _floor_set0A={12, 44100,  64, 10,130, 2, {0,1},
-                                        0.199f, .285f};
-static vorbis_info_floor0 _floor_set1A={30, 44100, 256, 12,150, 2, {2,3}, 
-                                        .082f, .126f};
-static vorbis_info_residue0 _residue_set0A={0,96,16,6,4,
-					    {0,1,1,1,1,1},
-					    {6,7,8,9,10},
-					    
-					    {0,99999,9999,9999,9999},
-					    {999.f,1.5f,3.5f,15.5f,26.5f},
-					    {4,4,4,4,4},
-					    {99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1A={0, 960, 32,10,5,
-					    {0,1,1,1,1,1,1,1,1,1},
-					    {11,12,13,14,15,16,17,18,19},
-					   
-					    {0,8,9999,16,9999,
-					     24,9999,9999,9999},
-					    {999.f,1.5f,1.5f,2.5f,2.5f,
-					     6.5f,6.5f,12.5f,22.5f},
-					    {5,5,5,5,5,5,5,5,5},
-					    {99,99,99,99,99,99,99,99,99}};
-
-static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0},
-					    0,{0},{0}};
-static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {1},
-					    0,{0},{0}};
+
+static vorbis_info_floor1 _floor_set0A={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}},
+
+                                        4,
+
+                                        {0,128,  
+
+					 6,17,30,58,
+					 
+					 2,1,4, 11,8,14, 23,20,26,
+					 41,35,48, 84,69,103},
+
+                                        60,30,500,
+                                        999,999,1,18.,
+                                        8,70,
+                                        96};
+
+static vorbis_info_floor1 _floor_set1A={10,
+					{0,1,2,2,2,2,2, 3,3,3},
+					
+					{3,4,3,3},
+					{1,1,2,2},
+					{9,10,11,12},
+					{{13,14},
+					 {15,16},
+					 {-1,17,18,19},
+					 {-1,20,21,22},
+					},
+
+					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
+					 },
+					
+					60,30,300,
+					20,8,1,18.,
+					20,600,
+					768};
+
+static vorbis_info_residue0 _residue_set0A={0,192,8,10,23,
+					    {0,1,1,1,1,1,1,3,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36,37},
+					    {9999,9999,9999,9999,9999,9999,
+					     9999,9999,9999,9999},
+					    {.5f,
+					     1.5f,1.5f,
+					     2.5f,2.5f,2.5f,
+					     4.5f,17.5f,80.5f},
+					    {0},
+					    {99,16,99,6,16,99,99,99,99,99},
+					    {3}};
+
+static vorbis_info_residue0 _residue_set1A={0,1536, 32,10,24,
+					    {0,1,1,1,1,1,1,3,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36,37},
+					    {9999,9999,9999,9999,9999,9999,
+					     9999,9999,9999,9999},
+					    {.5f,
+					     1.5f,1.5f,
+					     2.5f,2.5f,2.5f,
+					     4.5f,17.5f,80.f},
+					    {0},
+					    {99,32,99,18,32,99,99,99,99,99},
+					    {3}};
+
+static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0,0},
+                                            1,{0},{1}};
+static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {1,2},
+                                            1,{0},{1}};
 static vorbis_info_mode _mode_set0A={0,0,0,0};
 static vorbis_info_mode _mode_set1A={1,0,0,1};
 
@@ -264,7 +345,7 @@
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   20,   2,
+  2,          2,    1,     2,       2,   38,   3,
   /* modes */
   {&_mode_set0A,&_mode_set1A},
   /* maps */
@@ -272,24 +353,42 @@
   /* times */
   {0,0},{&_time_set0A},
   /* floors */
-  {0,0},{&_floor_set0A,&_floor_set1A},
+  {1,1},{&_floor_set0A,&_floor_set1A},
   /* residue */
-  {0,0},{&_residue_set0A,&_residue_set1A},
+  {2,2},{&_residue_set0A,&_residue_set1A},
   /* books */
-  {&_vq_book_lsp12_0,       /* 0 */
-   &_vq_book_lsp12_1,       /* 1 */
-   &_vq_book_lsp30_0,      /* 2 */
-   &_vq_book_lsp30_1,      /* 3 */
+    
+  {  
+   &_huff_book_line0_class1,
+   &_huff_book_line0_class2, /* 1 */
+   
+   &_huff_book_line0_0sub0,  /* 2 */
+   &_huff_book_line0_1sub1,  /* 3 */
+   &_huff_book_line0_1sub2,
+   &_huff_book_line0_1sub3,  /* 5 */
+   &_huff_book_line0_2sub1,
+   &_huff_book_line0_2sub2,  /* 7 */
+   &_huff_book_line0_2sub3, 
+
+   &_huff_book_line1_class0,
+   &_huff_book_line1_class1, /* 10 */
+   &_huff_book_line1_class2,
+   &_huff_book_line1_class3, /* 12 */
+
+   &_huff_book_line1_0sub0,
+   &_huff_book_line1_0sub1, /* 14 */
+   &_huff_book_line1_1sub0, 
+   &_huff_book_line1_1sub1,
+   &_huff_book_line1_2sub1,  
+   &_huff_book_line1_2sub2, /* 18 */
+   &_huff_book_line1_2sub3, 
+   &_huff_book_line1_3sub1,
+   &_huff_book_line1_3sub2,
+   &_huff_book_line1_3sub3, /* 22 */
 
-   &_huff_book_res0_128_128aux,
+   &_huff_book_res0_128_128aux, 
    &_huff_book_res0_128_1024aux,
 
-   &_vq_book_res0_128_128_1,
-   &_vq_book_res0_128_128_2,
-   &_vq_book_res0_128_128_3,
-   &_vq_book_res0_128_128_4,
-   &_vq_book_res0_128_128_5,
-
    &_vq_book_res0_128_1024_1,
    &_vq_book_res0_128_1024_2,
    &_vq_book_res0_128_1024_3,
@@ -297,21 +396,17 @@
    &_vq_book_res0_128_1024_5,
    &_vq_book_res0_128_1024_6,
    &_vq_book_res0_128_1024_7,
+   &_vq_book_res0_128_1024_7a,
    &_vq_book_res0_128_1024_8,
+   &_vq_book_res0_128_1024_8a,
    &_vq_book_res0_128_1024_9,
+   &_vq_book_res0_128_1024_9a,
+   &_vq_book_res0_128_1024_9b,
 
   },
   /* psy */
-  {&_psy_set_A0,&_psy_set_A},
-
-  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
-
-  -10., 
-
-  0,
+  {&_psy_set_A0,&_psy_set_AT,&_psy_set_A},
+  &_psy_set_AG
 };
-
-#define PREDEF_INFO_MAX 0
 
 #endif

1.16      +348 -238  vorbis/lib/modes/mode_B.h

Index: mode_B.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_B.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mode_B.h	2001/06/18 09:07:32	1.15
+++ mode_B.h	2001/08/13 01:37:13	1.16
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_B.h,v 1.15 2001/06/18 09:07:32 xiphmont Exp $
+ last mod: $Id: mode_B.h,v 1.16 2001/08/13 01:37:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,236 +22,332 @@
 #include "vorbis/codec.h"
 #include "backends.h"
 
-#include "books/lsp12_0.vqh"
-#include "books/lsp30_0.vqh"
-#include "books/lsp12_1.vqh"
-#include "books/lsp30_1.vqh"
-
-#include "books/res0_160_128aux.vqh"
-#include "books/res0_160_1024aux.vqh"
-
-#include "books/res0_160_128_1.vqh"
-#include "books/res0_160_128_2.vqh"
-#include "books/res0_160_128_3.vqh"
-#include "books/res0_160_128_4.vqh"
-#include "books/res0_160_128_5.vqh"
-
-#include "books/res0_160_1024_1.vqh"
-#include "books/res0_160_1024_2.vqh"
-#include "books/res0_160_1024_3.vqh"
-#include "books/res0_160_1024_4.vqh"
-#include "books/res0_160_1024_5.vqh"
-#include "books/res0_160_1024_6.vqh"
-#include "books/res0_160_1024_7.vqh"
-#include "books/res0_160_1024_8.vqh"
-#include "books/res0_160_1024_9.vqh"
+#include "books/line0_class1.vqh"
+#include "books/line0_class2.vqh"
+#include "books/line1_class0.vqh"
+#include "books/line1_class1.vqh"
+#include "books/line1_class2.vqh"
+#include "books/line1_class3.vqh"
+
+#include "books/line0_0sub0.vqh"
+#include "books/line0_1sub1.vqh"
+#include "books/line0_1sub2.vqh"
+#include "books/line0_1sub3.vqh"
+#include "books/line0_2sub1.vqh"
+#include "books/line0_2sub2.vqh"
+#include "books/line0_2sub3.vqh"
+
+#include "books/line1_0sub0.vqh"
+#include "books/line1_0sub1.vqh"
+#include "books/line1_1sub0.vqh"
+#include "books/line1_1sub1.vqh"
+#include "books/line1_2sub1.vqh"
+#include "books/line1_2sub2.vqh"
+#include "books/line1_2sub3.vqh"
+#include "books/line1_3sub1.vqh"
+#include "books/line1_3sub2.vqh"
+#include "books/line1_3sub3.vqh"
+
+#include "books/res0_128_128aux.vqh"
+#include "books/res0_128_1024aux.vqh"
+
+#include "books/res0_128_1024_1.vqh"
+#include "books/res0_128_1024_2.vqh"
+#include "books/res0_128_1024_3.vqh"
+#include "books/res0_128_1024_4.vqh"
+#include "books/res0_128_1024_5.vqh"
+#include "books/res0_128_1024_6.vqh"
+#include "books/res0_128_1024_7.vqh"
+#include "books/res0_128_1024_7a.vqh"
+#include "books/res0_128_1024_8.vqh"
+#include "books/res0_128_1024_8a.vqh"
+#include "books/res0_128_1024_9.vqh"
+#include "books/res0_128_1024_9a.vqh"
+#include "books/res0_128_1024_9b.vqh"
+
+
+static vorbis_info_psy_global _psy_set_BG={
+  0, /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+};
 
+static struct vp_couple_pass _psy_passB0[]={
+  {1.f,1.f,
+    {{24,     0,0,       0,0,      0,0},
+     {64,    4.5,0,      0,12,      0,0},
+     {9999,  7.5,0,     4.5,12,   1.5,0}}
+  },
+};
+
+static vp_couple_pass _psy_passB[]={
+  {1.f,1.f,
+    {{288,   0,0,       0,0,      0,0},
+     {512,  4.5,0,      0,12,     0,0},
+     {9999, 7.5,0,     4.5,12,  1.5,0}}
+  }
+};
 
+static vp_attenblock _vp_tonemask_consbass_B={
+  {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
+  
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
+}};
+
+static vp_attenblock _vp_tonemask_B={
+
+  {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
+  
+  
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  
+  {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
+}};
+
+
+static vp_attenblock _vp_peakatt_B={
+  {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*63*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*88*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*125*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*175*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*250*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*350*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*500*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*700*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*1000*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*1400*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*2000*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*2800*/
+  {-10.f,-10.f,-10.f,-10.f,-18.f,-20.f,-20.f,-22.f,-24.f,-32.f,-40.f},/*4000*/
+  {-10.f,-10.f,-10.f,-10.f,-12.f,-14.f,-16.f,-18.f,-22.f,-32.f,-40.f},/*5600*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*8000*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-22.f,-32.f,-40.f},/*11500*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-20.f,-32.f,-40.f},/*16000*/
+}};
+
 static vorbis_info_psy _psy_set_B0={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.,
   -140.,
 
-  8,
+  /* tonemaskp */
+  -3.f, -40.f, &_vp_tonemask_consbass_B,
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
-
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
-   {-30.,-35.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
-   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
-  },
+  /* peakattp */
+  1, &_vp_peakatt_B,
 
-  1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*175*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*250*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*350*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*500*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*700*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-24.f,-24.f,-24.f,-24.f},/*1000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*1400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*4000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-12.f,-20.f,-24.f,-24.f,-24.f},/*5600*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*8000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*11500*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f},/*16000*/
-  },
+  /*noisemaskp */
+  1,-10.f,     /* suppress any noise curve over maxspec+n */
+  .6f, .6f,   /* low/high window */
+  5, 5, 10,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-20,-10,  0,  0,  0,  0,  0,  1,  1,  2,  3},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.6f,.75f,.85f,.85f,.85f},
 
-  1,/*noisemaskp */
-  -10.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  5,
-  5,
-  10,
-  {.000f, 0.f,/*63*/
-   .000f, 0.f,/*88*/
-   .000f, 0.f,/*125*/
-   .000f, 0.f,/*175*/
-   .000f, 0.f,/*250*/
-   .000f, 0.f,/*350*/
-   .000f, 0.f,/*500*/
-   .300f, 0.f,/*700*/
-   .500f, 0.f,/*1000*/
-   .500f, 0.f,/*1400*/
-   .500f, 0.f,/*2000*/
-   .500f, 0.f,/*2800*/
-   .600f, 0.f,/*4000*/
-   .700f, 0.f,/*5600*/
-   .800f, 0.f,/*8000*/
-   .800f, 0.f,/*11500*/
-   .800f, 0.f,/*16000*/
-  },
- 
-   95.f,  /* even decade + 5 is important; saves an rint() later in a
+  105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -26.,
+  1,
+  _psy_passB0
 };
 
 static vorbis_info_psy _psy_set_B={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.f,
   -140.f,
 
-  8,
+  /* tonemask */
+  -3.f,-40.f,&_vp_tonemask_consbass_B,
+  /* peakattp */
+  1,  &_vp_peakatt_B,
+
+  /*noisemaskp */
+  1,  -10.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {  0,  0,  0,  0,  0,  0,  0,  0, -6, -6, -6, -6,  0,   0,  0,  0,  0},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.6f,.7f,.75f,.8f},
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
-
-   {-35.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-35.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
-   {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
+  105.f,  /* even decade + 5 is important; saves an rint() later in a
+            tight loop) */
+  1,_psy_passB
+};
 
-  },
+static vorbis_info_psy _psy_set_BT={
+  ATH_Bark_dB_lineaggressive,
 
-  1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*125*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*175*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*250*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*350*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-26.f,-26.f,-26.f},/*500*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*700*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-24.f,-26.f,-26.f,-26.f},/*1000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*1400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*2000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*2400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-26.f,-26.f,-26.f},/*4000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-12.f,-20.f,-26.f,-26.f,-26.f},/*5600*/
-   {-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-22.f,-24.f,-26.f},/*8000*/
-   {-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-20.f,-22.f,-24.f,-26.f},/*11500*/
-   {-10.f,-10.f,-10.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-26.f},/*16000*/
-  },
+  -100.f,
+  -140.f,
 
-  1,/*noisemaskp */
-  -28.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  25,
-  25,
-  40,
-  {.000f, 0.f, /*63*/
-   .000f, 0.f, /*88*/
-   .000f, 0.f, /*125*/
-   .000f, 0.f, /*175*/
-   .000f, 0.f, /*250*/
-   .000f, 0.f, /*350*/
-   .000f, 0.f, /*500*/
-   .000f, 0.f, /*700*/
-   .200f, 0.f, /*1000*/
-   .300f, 0.f, /*1400*/
-   .300f, 0.f, /*2000*/
-   .300f, 0.f, /*2800*/
-   .700f, 0.f, /*4000*/
-   .700f, 0.f, /*5600*/
-   .750f, 0.f, /*8000*/
-   .750f, 0.f, /*11500*/
-   .800f, 0.f, /*16000*/
-  },
- 
+  /* tonemask */
+  -3.f,-40.f,&_vp_tonemask_consbass_B,
+  /* peakattp */
+  1,  &_vp_peakatt_B,
+
+  /*noisemaskp */
+  1,  -10.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-30,-20, -6, -6, -6, -6,  0,   0,  0,  0,  0},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.6f,.7f,.75f,.8f},
+
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -30.,
-
+  1,_psy_passB
 };
 
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0B={0};
-static vorbis_info_floor0 _floor_set0B={12, 44100,  64, 10,130, 2, {0,1},
-                                        0.199f, .285f};
-static vorbis_info_floor0 _floor_set1B={30, 44100, 256, 12,150, 2, {2,3}, 
-                                        .082f, .126f};
-static vorbis_info_residue0 _residue_set0B={0,96,16,6,4,
-					    {0,1,1,1,1,1},
-					    {6,7,8,9,10},
-					    
-					    {0,99999,9999,9999,9999},
-					    {999.f,1.5f,3.5f,15.5f,26.5f},
-					    {4,4,4,4,4},
-					    {99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1B={0, 960, 32,10,5,
-					    {0,1,1,1,1,1,1,1,1,1},
-					    {11,12,13,14,15,16,17,18,19},
-					   
-					    {0,8,9999,16,9999,
-					     24,9999,9999,9999},
-					    {999.f,1.5f,1.5f,2.5f,2.5f,
-					     6.5f,6.5f,12.5f,22.5f},
-					    {5,5,5,5,5,5,5,5,5},
-					    {99,99,99,99,99,99,99,99,99}};
 
-static vorbis_info_mapping0 _mapping_set0B={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1B={1, {0,0}, {0}, {1}, {1}, {1}};
+static vorbis_info_floor1 _floor_set0B={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}},
+
+                                        4,
+
+                                        {0,128,  
+
+					 6,17,30,58,
+					 
+					 2,1,4, 11,8,14, 23,20,26,
+					 41,35,48, 84,69,103},
+
+                                        60,30,500,
+                                        999,999,1,18.,
+                                        8,70,
+                                        112};
+
+static vorbis_info_floor1 _floor_set1B={10,
+					{0,1,2,2,2,2,2, 3,3,3},
+					
+					{3,4,3,3},
+					{1,1,2,2},
+					{9,10,11,12},
+					{{13,14},
+					 {15,16},
+					 {-1,17,18,19},
+					 {-1,20,21,22},
+					},
+
+					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
+					 },
+					
+					60,30,300,
+					20,8,1,18.,
+					20,600,
+					896};
+
+static vorbis_info_residue0 _residue_set0B={0,224,16,10,23,
+					    {0,1,1,1,1,1,1,3,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36,37},
+					    {9999,
+					     7,9999,9999,
+					     11,9999,
+					     9999,9999,9999,9999},
+					    {.5f,
+					     1.5f,1.5f,1.5f,
+					     2.5f,2.5f,
+					     4.5f,16.5f,84.5f},
+					    {0},
+					    {99,
+					     8,8,99,
+					     99,99,
+					     99,99,99,99},
+					    {3}};
+
+static vorbis_info_residue0 _residue_set1B={0,1792, 32,10,24,
+					    {0,1,1,1,1,1,1,3,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36,37},
+					    {9999,
+					     10,9999,9999,
+					     20,9999,
+					     9999,9999,9999,9999},
+					    {.5f,
+					     1.5f,1.5f,1.5f,
+					     2.5f,2.5f,
+					     4.5f,16.5f,84.f},
+					    {0},
+					    {99,
+					     32,32,99,
+					     99,99,
+					     99,99,99,99},
+					    {3}};
+
+static vorbis_info_mapping0 _mapping_set0B={1, {0,0}, {0}, {0}, {0}, {0,0},
+                                            1,{0},{1}};
+static vorbis_info_mapping0 _mapping_set1B={1, {0,0}, {0}, {1}, {1}, {1,2},
+                                            1,{0},{1}};
 static vorbis_info_mode _mode_set0B={0,0,0,0};
 static vorbis_info_mode _mode_set1B={1,0,0,1};
 
@@ -261,7 +357,7 @@
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   20,   2,
+  2,          2,    1,     2,       2,   38,   3,
   /* modes */
   {&_mode_set0B,&_mode_set1B},
   /* maps */
@@ -269,46 +365,60 @@
   /* times */
   {0,0},{&_time_set0B},
   /* floors */
-  {0,0},{&_floor_set0B,&_floor_set1B},
+  {1,1},{&_floor_set0B,&_floor_set1B},
   /* residue */
-  {0,0},{&_residue_set0B,&_residue_set1B},
+  {2,2},{&_residue_set0B,&_residue_set1B},
   /* books */
-  {&_vq_book_lsp12_0,       /* 0 */
-   &_vq_book_lsp12_1,       /* 1 */
-   &_vq_book_lsp30_0,      /* 2 */
-   &_vq_book_lsp30_1,      /* 3 */
-
-   &_huff_book_res0_160_128aux,
-   &_huff_book_res0_160_1024aux,
-
-   &_vq_book_res0_160_128_1,
-   &_vq_book_res0_160_128_2,
-   &_vq_book_res0_160_128_3,
-   &_vq_book_res0_160_128_4,
-   &_vq_book_res0_160_128_5,
-
-   &_vq_book_res0_160_1024_1,
-   &_vq_book_res0_160_1024_2,
-   &_vq_book_res0_160_1024_3,
-   &_vq_book_res0_160_1024_4,
-   &_vq_book_res0_160_1024_5,
-   &_vq_book_res0_160_1024_6,
-   &_vq_book_res0_160_1024_7,
-   &_vq_book_res0_160_1024_8,
-   &_vq_book_res0_160_1024_9,
+    
+  {  
+   &_huff_book_line0_class1,
+   &_huff_book_line0_class2, /* 1 */
+   
+   &_huff_book_line0_0sub0,  /* 2 */
+   &_huff_book_line0_1sub1,  /* 3 */
+   &_huff_book_line0_1sub2,
+   &_huff_book_line0_1sub3,  /* 5 */
+   &_huff_book_line0_2sub1,
+   &_huff_book_line0_2sub2,  /* 7 */
+   &_huff_book_line0_2sub3, 
+
+   &_huff_book_line1_class0,
+   &_huff_book_line1_class1, /* 10 */
+   &_huff_book_line1_class2,
+   &_huff_book_line1_class3, /* 12 */
+
+   &_huff_book_line1_0sub0,
+   &_huff_book_line1_0sub1, /* 14 */
+   &_huff_book_line1_1sub0, 
+   &_huff_book_line1_1sub1,
+   &_huff_book_line1_2sub1,  
+   &_huff_book_line1_2sub2, /* 18 */
+   &_huff_book_line1_2sub3, 
+   &_huff_book_line1_3sub1,
+   &_huff_book_line1_3sub2,
+   &_huff_book_line1_3sub3, /* 22 */
+
+   &_huff_book_res0_128_128aux, 
+   &_huff_book_res0_128_1024aux,
+
+   &_vq_book_res0_128_1024_1,
+   &_vq_book_res0_128_1024_2,
+   &_vq_book_res0_128_1024_3,
+   &_vq_book_res0_128_1024_4,
+   &_vq_book_res0_128_1024_5,
+   &_vq_book_res0_128_1024_6,
+   &_vq_book_res0_128_1024_7,
+   &_vq_book_res0_128_1024_7a,
+   &_vq_book_res0_128_1024_8,
+   &_vq_book_res0_128_1024_8a,
+   &_vq_book_res0_128_1024_9,
+   &_vq_book_res0_128_1024_9a,
+   &_vq_book_res0_128_1024_9b,
 
   },
   /* psy */
-  {&_psy_set_B0,&_psy_set_B},
-
-  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
-  
-  -10., 
-
-  0,
+  {&_psy_set_B0,&_psy_set_BT,&_psy_set_B},
+  &_psy_set_BG
 };
-
-#define PREDEF_INFO_MAX 0
 
 #endif

1.15      +355 -237  vorbis/lib/modes/mode_C.h

Index: mode_C.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_C.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mode_C.h	2001/06/18 09:07:32	1.14
+++ mode_C.h	2001/08/13 01:37:14	1.15
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_C.h,v 1.14 2001/06/18 09:07:32 xiphmont Exp $
+ last mod: $Id: mode_C.h,v 1.15 2001/08/13 01:37:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,236 +22,341 @@
 #include "vorbis/codec.h"
 #include "backends.h"
 
-#include "books/lsp12_0.vqh"
-#include "books/lsp30_0.vqh"
-#include "books/lsp12_1.vqh"
-#include "books/lsp30_1.vqh"
-
-#include "books/res0_192_128aux.vqh"
-#include "books/res0_192_1024aux.vqh"
-
-#include "books/res0_192_128_1.vqh"
-#include "books/res0_192_128_2.vqh"
-#include "books/res0_192_128_3.vqh"
-#include "books/res0_192_128_4.vqh"
-#include "books/res0_192_128_5.vqh"
-
-#include "books/res0_192_1024_1.vqh"
-#include "books/res0_192_1024_2.vqh"
-#include "books/res0_192_1024_3.vqh"
-#include "books/res0_192_1024_4.vqh"
-#include "books/res0_192_1024_5.vqh"
-#include "books/res0_192_1024_6.vqh"
-#include "books/res0_192_1024_7.vqh"
-#include "books/res0_192_1024_8.vqh"
-#include "books/res0_192_1024_9.vqh"
+#include "books/line0_class1.vqh"
+#include "books/line0_class2.vqh"
+#include "books/line1_class0.vqh"
+#include "books/line1_class1.vqh"
+#include "books/line1_class2.vqh"
+#include "books/line1_class3.vqh"
+
+#include "books/line0_0sub0.vqh"
+#include "books/line0_1sub1.vqh"
+#include "books/line0_1sub2.vqh"
+#include "books/line0_1sub3.vqh"
+#include "books/line0_2sub1.vqh"
+#include "books/line0_2sub2.vqh"
+#include "books/line0_2sub3.vqh"
+
+#include "books/line1_0sub0.vqh"
+#include "books/line1_0sub1.vqh"
+#include "books/line1_1sub0.vqh"
+#include "books/line1_1sub1.vqh"
+#include "books/line1_2sub1.vqh"
+#include "books/line1_2sub2.vqh"
+#include "books/line1_2sub3.vqh"
+#include "books/line1_3sub1.vqh"
+#include "books/line1_3sub2.vqh"
+#include "books/line1_3sub3.vqh"
+
+#include "books/res0_128_128aux.vqh"
+#include "books/res0_128_1024aux.vqh"
+
+#include "books/res0_128_1024_1.vqh"
+#include "books/res0_128_1024_2.vqh"
+#include "books/res0_128_1024_3.vqh"
+#include "books/res0_128_1024_4.vqh"
+#include "books/res0_128_1024_5.vqh"
+#include "books/res0_128_1024_6.vqh"
+#include "books/res0_128_1024_7.vqh"
+#include "books/res0_128_1024_8.vqh"
+#include "books/res0_128_1024_8a.vqh"
+#include "books/res0_128_1024_9.vqh"
+#include "books/res0_128_1024_9a.vqh"
+#include "books/res0_128_1024_9b.vqh"
+
+
+static vorbis_info_psy_global _psy_set_CG={
+  0, /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+};
+
+static struct vp_couple_pass _psy_passC0[]={
+  {1.f,1.f,
+    {{24,      0,0,       0,0,      0,0},
+     {9999,  4.5,0,      0,12,      0,0}}
+  },
+};
+
+static vp_couple_pass _psy_passC[]={
+  {1.f,1.f,
+    {{512,   0,0,       0,0,      0,0},
+     {9999, 4.5,0,     0,12,  0,0}}
+  }
+};
 
+static vp_attenblock _vp_tonemask_consbass_C={
+  {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
+  
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-35.f,-45.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-90.f,-100.f}, /*16000*/
+}};
+
+static vp_attenblock _vp_tonemask_C={
+
+  {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
+  
+  
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  
+  {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
+  {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/
+  {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/
+}};
+
+
+static vp_attenblock _vp_peakatt_C={
+  {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*63*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*88*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*125*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*175*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*250*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*350*/
+  {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-32.f,-32.f,-32.f,-32.f,-40.f},/*500*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*700*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*1000*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*1400*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*2000*/
+  {-10.f,-10.f,-10.f,-14.f,-20.f,-20.f,-20.f,-24.f,-26.f,-32.f,-40.f},/*2800*/
+  {-10.f,-10.f,-10.f,-10.f,-18.f,-20.f,-20.f,-22.f,-24.f,-32.f,-40.f},/*4000*/
+  {-10.f,-10.f,-10.f,-10.f,-12.f,-14.f,-16.f,-18.f,-22.f,-32.f,-40.f},/*5600*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-12.f,-13.f,-22.f,-32.f,-40.f},/*8000*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-11.f,-22.f,-32.f,-40.f},/*11500*/
+  {-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-10.f,-20.f,-32.f,-40.f},/*16000*/
+}};
 
 static vorbis_info_psy _psy_set_C0={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.,
   -140.,
 
-  8,
+  /* tonemask */
+  -3.f, -45.f, &_vp_tonemask_consbass_C,
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
-
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
-  },
+  /* peakattp */
+  0, &_vp_peakatt_C,
 
-  1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-24.f,-24.f,-24.f,-24.f,-24.f},/*125*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*175*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*250*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*350*/
-   {-14.f,-14.f,-14.f,-14.f,-16.f,-16.f,-20.f,-24.f,-24.f,-24.f,-24.f},/*500*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*700*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-24.f,-24.f,-24.f,-24.f},/*1000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*1400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*2400*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-16.f,-18.f,-24.f,-24.f,-24.f,-24.f},/*4000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-12.f,-20.f,-24.f,-24.f,-24.f},/*5600*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*8000*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f,-24.f},/*11500*/
-   {-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-14.f,-20.f,-24.f,-24.f},/*16000*/
-  },
+  /*noisemaskp */
+  1,-30.f,     /* suppress any noise curve over maxspec+n */
+  .6f, .6f,   /* low/high window */
+  5, 5, 10,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-20,-10,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.6f,.7f,.8f,.8f},
 
-  1,/*noisemaskp */
-  -20.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  5,
-  5,
-  10,
-  {.000f, 0.f,/*63*/
-   .000f, 0.f,/*88*/
-   .000f, 0.f,/*125*/
-   .000f, 0.f,/*175*/
-   .000f, 0.f,/*250*/
-   .000f, 0.f,/*350*/
-   .000f, 0.f,/*500*/
-   .200f, 0.f,/*700*/
-   .300f, 0.f,/*1000*/
-   .300f, 0.f,/*1400*/
-   .300f, 0.f,/*2000*/
-   .300f, 0.f,/*2800*/
-   .500f, 0.f,/*4000*/
-   .600f, 0.f,/*5600*/
-   .700f, 0.f,/*8000*/
-   .700f, 0.f,/*11500*/
-   .700f, 1.f,/*16000*/
-  },
- 
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -26.,
+  1,
+  _psy_passC0
 };
 
 static vorbis_info_psy _psy_set_C={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineaggressive,
 
   -100.f,
   -140.f,
 
-  8,
+  /* tonemask */
+  -6.f,-45.f,&_vp_tonemask_consbass_C,
+  /* peakattp */
+  0,  &_vp_peakatt_C,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {  0,  0,  0,  0,  0,  0,  0,  0, -6, -6, -6, -6,  0,   0,  0,  0,  0},
+  {.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.5f,.6f,.7f,.7f},
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
+  105.f,  /* even decade + 5 is important; saves an rint() later in a
+            tight loop) */
+  1,_psy_passC
+};
 
-  },
+static vorbis_info_psy _psy_set_CT={
+  ATH_Bark_dB_lineaggressive,
 
-  1,
-  {{-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
-   {-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*175*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*250*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*350*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-24.f,-28.f,-28.f,-28.f},/*500*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*700*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1000*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1400*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2000*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2800*/
-   {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*4000*/
-   {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*5600*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*8000*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*11500*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*16000*/
-  },
+  -100.f,
+  -140.f,
 
-  1,/*noisemaskp */
-  -28.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  25,
-  25,
-  40,
-  {.000f, 0.f, /*63*/
-   .000f, 0.f, /*88*/
-   .000f, 0.f, /*125*/
-   .000f, 0.f, /*175*/
-   .000f, 0.f, /*250*/
-   .000f, 0.f, /*350*/
-   .000f, 0.f, /*500*/
-   .000f, 0.f, /*700*/
-   .200f, 0.f, /*1000*/
-   .300f, 0.f, /*1400*/
-   .300f, 0.f, /*2000*/
-   .300f, 0.f, /*2800*/
-   .300f, 0.f, /*4000*/
-   .400f, 0.f, /*5600*/
-   .600f, 0.f, /*8000*/
-   .600f, 0.f, /*11500*/
-   .650f, 0.f, /*16000*/
-  },
- 
+  /* tonemask */
+  -6.f,-45.f,&_vp_tonemask_consbass_C,
+  /* peakattp */
+  0,  &_vp_peakatt_C,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-30,-20, -6, -6, -6, -6,  0,   0,  0,  0,  0},
+  {.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.5f,.6f,.7f,.7f},
+
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -32.,
-
+  1,_psy_passC
 };
 
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0C={0};
-static vorbis_info_floor0 _floor_set0C={12, 44100,  64, 10,130, 2, {0,1},
-                                        0.199f, .285f};
-static vorbis_info_floor0 _floor_set1C={30, 44100, 256, 12,150, 2, {2,3}, 
-                                        .082f, .126f};
-static vorbis_info_residue0 _residue_set0C={0,128,16,6,4,
-					    {0,1,1,1,1,1},
-					    {6,7,8,9,10},
-					    
-					    {0,99999,9999,9999,9999},
-					    {999.f,1.5f,3.5f,15.5f,26.5f},
-					    {4,4,4,4,4},
-					    {99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1C={0, 960, 32,10,5,
-					    {0,1,1,1,1,1,1,1,1,1},
-					    {11,12,13,14,15,16,17,18,19},
-					   
-					    {0,8,9999,16,9999,
-					     24,9999,9999,9999},
-					    {999.f,1.5f,1.5f,2.5f,2.5f,
-					     6.5f,6.5f,14.5f,30.f},
-					    {5,5,5,5,5,5,5,5,5},
-					    {99,99,99,99,99,99,99,99,99}};
 
-static vorbis_info_mapping0 _mapping_set0C={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1C={1, {0,0}, {0}, {1}, {1}, {1}};
+static vorbis_info_floor1 _floor_set0C={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}},
+
+                                        4,
+
+                                        {0,128,  
+
+					 6,17,30,58,
+					 
+					 2,1,4, 11,8,14, 23,20,26,
+					 41,35,48, 84,69,103},
+
+                                        60,30,500,
+                                        999,999,1,18.,
+                                        8,70,
+                                        128};
+
+static vorbis_info_floor1 _floor_set1C={10,
+					{0,1,2,2,2,2,2, 3,3,3},
+					
+					{3,4,3,3},
+					{1,1,2,2},
+					{9,10,11,12},
+					{{13,14},
+					 {15,16},
+					 {-1,17,18,19},
+					 {-1,20,21,22},
+					},
+
+					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
+					 },
+					
+					60,30,300,
+					20,8,1,18.,
+					20,600,
+					1024};
+
+static vorbis_info_residue0 _residue_set0C={0,256,16,10,23,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36},
+					    {9999,
+					     9999,
+					     12,9999,
+					     18,9999,
+					     28,9999,
+					     9999,9999},
+					    {.5f,
+					     1.5f,
+					     2.5f,2.5f,
+					     4.5f,4.5,
+					     16.5f,16.5,
+					     84.5f},
+					    {0},
+					    {99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_residue0 _residue_set1C={0,2048, 32,10,24,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,
+					     32,33,
+					     34,35,36},
+					    {9999,
+					     9999,
+					     22,9999,
+					     34,9999,
+					     64,999,
+					     9999,9999},
+					    {.5f,
+					     1.5f,
+					     2.5f,2.5f,
+					     4.5f,4.5,
+					     16.5f,16.5,
+					     84.f},
+					    {0},
+					    {99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_mapping0 _mapping_set0C={1, {0,0}, {0}, {0}, {0}, {0,0},
+                                            1,{0},{1}};
+static vorbis_info_mapping0 _mapping_set1C={1, {0,0}, {0}, {1}, {1}, {1,2},
+                                            1,{0},{1}};
 static vorbis_info_mode _mode_set0C={0,0,0,0};
 static vorbis_info_mode _mode_set1C={1,0,0,1};
 
@@ -261,7 +366,7 @@
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   20,   2,
+  2,          2,    1,     2,       2,   37,   3,
   /* modes */
   {&_mode_set0C,&_mode_set1C},
   /* maps */
@@ -269,46 +374,59 @@
   /* times */
   {0,0},{&_time_set0C},
   /* floors */
-  {0,0},{&_floor_set0C,&_floor_set1C},
+  {1,1},{&_floor_set0C,&_floor_set1C},
   /* residue */
-  {0,0},{&_residue_set0C,&_residue_set1C},
+  {2,2},{&_residue_set0C,&_residue_set1C},
   /* books */
-  {&_vq_book_lsp12_0,       /* 0 */
-   &_vq_book_lsp12_1,       /* 1 */
-   &_vq_book_lsp30_0,      /* 2 */
-   &_vq_book_lsp30_1,      /* 3 */
-
-   &_huff_book_res0_192_128aux,
-   &_huff_book_res0_192_1024aux,
-
-   &_vq_book_res0_192_128_1,
-   &_vq_book_res0_192_128_2,
-   &_vq_book_res0_192_128_3,
-   &_vq_book_res0_192_128_4,
-   &_vq_book_res0_192_128_5,
-
-   &_vq_book_res0_192_1024_1,
-   &_vq_book_res0_192_1024_2,
-   &_vq_book_res0_192_1024_3,
-   &_vq_book_res0_192_1024_4,
-   &_vq_book_res0_192_1024_5,
-   &_vq_book_res0_192_1024_6,
-   &_vq_book_res0_192_1024_7,
-   &_vq_book_res0_192_1024_8,
-   &_vq_book_res0_192_1024_9,
+    
+  {  
+   &_huff_book_line0_class1,
+   &_huff_book_line0_class2, /* 1 */
+   
+   &_huff_book_line0_0sub0,  /* 2 */
+   &_huff_book_line0_1sub1,  /* 3 */
+   &_huff_book_line0_1sub2,
+   &_huff_book_line0_1sub3,  /* 5 */
+   &_huff_book_line0_2sub1,
+   &_huff_book_line0_2sub2,  /* 7 */
+   &_huff_book_line0_2sub3, 
+
+   &_huff_book_line1_class0,
+   &_huff_book_line1_class1, /* 10 */
+   &_huff_book_line1_class2,
+   &_huff_book_line1_class3, /* 12 */
+
+   &_huff_book_line1_0sub0,
+   &_huff_book_line1_0sub1, /* 14 */
+   &_huff_book_line1_1sub0, 
+   &_huff_book_line1_1sub1,
+   &_huff_book_line1_2sub1,  
+   &_huff_book_line1_2sub2, /* 18 */
+   &_huff_book_line1_2sub3, 
+   &_huff_book_line1_3sub1,
+   &_huff_book_line1_3sub2,
+   &_huff_book_line1_3sub3, /* 22 */
+
+   &_huff_book_res0_128_128aux, 
+   &_huff_book_res0_128_1024aux,
+
+   &_vq_book_res0_128_1024_1,
+   &_vq_book_res0_128_1024_2,
+   &_vq_book_res0_128_1024_3,
+   &_vq_book_res0_128_1024_4,
+   &_vq_book_res0_128_1024_5,
+   &_vq_book_res0_128_1024_6,
+   &_vq_book_res0_128_1024_7,
+   &_vq_book_res0_128_1024_8,
+   &_vq_book_res0_128_1024_8a,
+   &_vq_book_res0_128_1024_9,
+   &_vq_book_res0_128_1024_9a,
+   &_vq_book_res0_128_1024_9b,
 
   },
   /* psy */
-  {&_psy_set_C0,&_psy_set_C},
-
-  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
-  
-  -10., 
-
-  0,
+  {&_psy_set_C0,&_psy_set_CT,&_psy_set_C},
+  &_psy_set_CG
 };
-
-#define PREDEF_INFO_MAX 0
 
 #endif

1.16      +353 -234  vorbis/lib/modes/mode_D.h

Index: mode_D.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_D.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mode_D.h	2001/06/18 09:07:32	1.15
+++ mode_D.h	2001/08/13 01:37:14	1.16
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_D.h,v 1.15 2001/06/18 09:07:32 xiphmont Exp $
+ last mod: $Id: mode_D.h,v 1.16 2001/08/13 01:37:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,244 +22,348 @@
 #include "vorbis/codec.h"
 #include "backends.h"
 
-#include "books/lsp12_0.vqh"
-#include "books/lsp30_0.vqh"
-#include "books/lsp12_1.vqh"
-#include "books/lsp30_1.vqh"
-
-#include "books/res0_256_128aux.vqh"
-#include "books/res0_256_1024aux.vqh"
-
-#include "books/res0_256_128_1.vqh"
-#include "books/res0_256_128_2.vqh"
-#include "books/res0_256_128_3.vqh"
-#include "books/res0_256_128_4.vqh"
-#include "books/res0_256_128_5.vqh"
-
-#include "books/res0_256_1024_1.vqh"
-#include "books/res0_256_1024_2.vqh"
-#include "books/res0_256_1024_3.vqh"
-#include "books/res0_256_1024_4.vqh"
-#include "books/res0_256_1024_5.vqh"
-#include "books/res0_256_1024_6.vqh"
-#include "books/res0_256_1024_7.vqh"
+#include "books/line0_class1.vqh"
+#include "books/line0_class2.vqh"
+#include "books/line1_class0.vqh"
+#include "books/line1_class1.vqh"
+#include "books/line1_class2.vqh"
+#include "books/line1_class3.vqh"
+
+#include "books/line0_0sub0.vqh"
+#include "books/line0_1sub1.vqh"
+#include "books/line0_1sub2.vqh"
+#include "books/line0_1sub3.vqh"
+#include "books/line0_2sub1.vqh"
+#include "books/line0_2sub2.vqh"
+#include "books/line0_2sub3.vqh"
+
+#include "books/line1_0sub0.vqh"
+#include "books/line1_0sub1.vqh"
+#include "books/line1_1sub0.vqh"
+#include "books/line1_1sub1.vqh"
+#include "books/line1_2sub1.vqh"
+#include "books/line1_2sub2.vqh"
+#include "books/line1_2sub3.vqh"
+#include "books/line1_3sub1.vqh"
+#include "books/line1_3sub2.vqh"
+#include "books/line1_3sub3.vqh"
+
+#include "books/res0_128_128aux.vqh"
+#include "books/res0_128_1024aux.vqh"
+
+#include "books/res0_128_1024_1.vqh"
+#include "books/res0_128_1024_2.vqh"
+#include "books/res0_128_1024_3.vqh"
+#include "books/res0_128_1024_4.vqh"
+#include "books/res0_128_1024_5.vqh"
+#include "books/res0_128_1024_6.vqh"
+#include "books/res0_128_1024_7.vqh"
+#include "books/res0_128_1024_8.vqh"
+#include "books/res0_128_1024_8a.vqh"
+#include "books/res0_128_1024_9.vqh"
+#include "books/res0_128_1024_9a.vqh"
+#include "books/res0_128_1024_9b.vqh"
+
+
+static vorbis_info_psy_global _psy_set_DG={
+  0, /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+};
+
+static struct vp_couple_pass _psy_passD[]={
+  {1.f,1.f,
+   {{9999,  0,0,      0,0,      0,0}}
+  },
+};
+
+static vp_attenblock _vp_tonemask_consbass_D={
+  {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
+  
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+  {-35.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
+  
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*8000*/
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+}};
+
+static vp_attenblock _vp_tonemask_D={
+
+  {{-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*88*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*125*/
+  
+  
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
+  {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
+  {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
+
+  
+  {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/  
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*8000*/
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+}};
+
 
+static vp_attenblock _vp_peakatt_D={
+  {
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*63*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*88*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*125*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*170*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*250*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*350*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*500*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*700*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*1000*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*1400*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*2000*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*2800*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*4000*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*5600*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*8000*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*11500*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*1600*/
+  }};
 
 static vorbis_info_psy _psy_set_D0={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineconservative,
 
   -100.,
   -140.,
 
-  8,
+  /* tonemaskp */
+  -6.f, -45.f,&_vp_tonemask_consbass_D,
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+  /* peakattp */
+  0, &_vp_peakatt_D,
 
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
-
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
-   {-35.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
-  },
+  /*noisemaskp */
+  1,-30.f,     /* suppress any noise curve over maxspec+n */
+  .6f, .6f,   /* low/high window */
+  5, 5, 10,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-20,-10,  0,  0,  0,  0,  0,  0,  0,  0,  1},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.4f,.4f,.5f,.5f,.6f,.7f,.7f},
 
-  1,/* peakattp */
-  {{-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*63*/
-   {-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*88*/
-   {-16.f,-20.f,-20.f,-22.f,-22.f,-22.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*125*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*175*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*250*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*350*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*500*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*700*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f,-26.f},/*1000*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2000*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2000*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*2600*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-26.f,-26.f,-26.f,-26.f},/*4000*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*5600*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*8000*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f,-26.f},/*11500*/
-   {-16.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-26.f,-26.f},/*16000*/
-  },
-
-  1,/*noisemaskp */
-  -20.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  5,
-  5,
-  10,
-  {.000f, 0.f,/*63*/
-   .000f, 0.f,/*88*/
-   .000f, 0.f,/*125*/
-   .000f, 0.f,/*175*/
-   .000f, 0.f,/*250*/
-   .000f, 0.f,/*350*/
-   .000f, 0.f,/*500*/
-   .100f, 0.f,/*700*/
-   .100f, 0.f,/*1000*/
-   .100f, 0.f,/*1400*/
-   .100f, 0.f,/*2000*/
-   .100f, 0.f,/*2800*/
-   .200f, 0.f,/*4000*/
-   .300f, 0.f,/*5600*/
-   .400f, 0.f,/*8000*/
-   .400f, 0.f,/*11500*/
-   .400f, 0.f,/*16000*/
-  },
- 
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -28.,
+  1,
+  _psy_passD
 };
 
 static vorbis_info_psy _psy_set_D={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineconservative,
 
   -100.f,
   -140.f,
 
-  8,
+  /* tonemask */
+  -6.f,-45.f,&_vp_tonemask_consbass_D,
+  /* peakattp */
+  0,  &_vp_peakatt_D,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {  0,  0,  0,  0,  0,  0,  0, -3,-10,-10,-12,-12, -6, -3, -2, -1, -0},
+  {.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.4f,.5f,.6f,.7f,.7f},
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/
-
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*11500*/
-   {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*16000*/
+  105.f,  /* even decade + 5 is important; saves an rint() later in a
+            tight loop) */
+  1,_psy_passD
+};
 
-  },
+static vorbis_info_psy _psy_set_DT={
+  ATH_Bark_dB_lineconservative,
 
-  1,
-  {{-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
-   {-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*175*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*250*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*350*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-28.f,-24.f,-28.f,-28.f,-28.f},/*500*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*700*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1000*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*1400*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2000*/
-   {-20.f,-20.f,-20.f,-20.f,-24.f,-24.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*2800*/
-   {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-24.f,-24.f,-28.f,-28.f,-28.f},/*4000*/
-   {-20.f,-20.f,-20.f,-20.f,-22.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*5600*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*8000*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*11500*/
-   {-20.f,-20.f,-20.f,-20.f,-20.f,-20.f,-22.f,-24.f,-28.f,-28.f,-28.f},/*16000*/
-  },
+  -100.f,
+  -140.f,
 
-  1,/*noisemaskp */
-  -28.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  25,
-  25,
-  40,
-  {.000f, 0.f, /*63*/
-   .000f, 0.f, /*88*/
-   .000f, 0.f, /*125*/
-   .000f, 0.f, /*175*/
-   .000f, 0.f, /*250*/
-   .000f, 0.f, /*350*/
-   .000f, 0.f, /*500*/
-   .000f, 0.f, /*700*/
-   .000f, 0.f, /*1000*/
-   .000f, 0.f, /*1400*/
-   .000f, 0.f, /*2000*/
-   .000f, 0.f, /*2800*/
-   .050f, 0.f, /*4000*/
-   .100f, 0.f, /*5600*/
-   .100f, 0.f, /*8000*/
-   .120f, 0.f, /*11500*/
-   .150f, 0.f, /*16000*/
-  },
- 
+  /* tonemask */
+  -6.f,-45.f,&_vp_tonemask_consbass_D,
+  /* peakattp */
+  0,  &_vp_peakatt_D,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-30,-20,-10,-12,-16,-16, -10, -6, -6, -6, -6},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.4f,.4f,.4f,.4f,.4f,.5f,.5f,.6f},
+
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -32.,
-
+  1,_psy_passD
 };
 
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0D={0};
-static vorbis_info_floor0 _floor_set0D={12, 44100,  64, 10,130, 2, {0,1},
-                                        0.199f, .285f};
-static vorbis_info_floor0 _floor_set1D={30, 44100, 256, 12,150, 2, {2,3}, 
-                                        .082f, .126f};
-static vorbis_info_residue0 _residue_set0D={0,128,16,6,4,
-					    {0,1,1,1,1,1},
-					    {6,7,8,9,10},
-					    
-					    {0,99999,9999,9999,9999},
-					    {999.f,1.5f,2.5f,6.5f,40.5f},
-					    {4,4,4,4,4},
-					    {99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1D={0,1024, 32,8,5,
-					    {0,1,1,1,1,1,1,1,1,1},
-					    {11,12,13,14,15,16,17,18,19},
-					   
-					    {0,9999,9999,60,9999,
+/*static vorbis_info_floor0 _floor_set0B={9, 44100,  64, 10,130, 2, {0,1},
+  0.246f, .387f};*/
+/*static vorbis_info_floor0 _floor_set1B={30, 44100, 256, 12,150, 2, {2,3}, 
+  .082f, .126f};*/
+
+static vorbis_info_floor1 _floor_set0D={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}},
+
+                                        4,
+
+                                        {0,128,  
+
+					 6,17,30,58,
+					 
+					 2,1,4, 11,8,14, 23,20,26,
+					 41,35,48, 84,69,103},
+
+                                        60,30,500,
+                                        999,999,1,18.,
+                                        8,70,
+                                        128};
+
+static vorbis_info_floor1 _floor_set1D={10,
+					{0,1,2,2,2,2,2, 3,3,3},
+					
+					{3,4,3,3},
+					{1,1,2,2},
+					{9,10,11,12},
+					{{13,14},
+					 {15,16},
+					 {-1,17,18,19},
+					 {-1,20,21,22},
+					},
+
+					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
+					 },
+					
+					60,30,300,
+					20,8,1,18.,
+					20,600,
+					1024};
+
+static vorbis_info_residue0 _residue_set0D={0,256,16,10,23,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36},
+					    {9999,
+					     9999,
+					     12,9999,
+					     18,9999,
+					     28,9999,
                                              9999,9999},
-					    {999.f,2.5f,4.5f,10.5f,10.5f,
-					     20.5f,40.f},
-					    {5,5,5,5,5,5,5},
-					    {99,99,99,99,99,99,99,99,99}};
-
-static vorbis_info_mapping0 _mapping_set0D={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1D={1, {0,0}, {0}, {1}, {1}, {1}};
+					    {.5f,
+					     1.5f,
+					     2.5f,2.5f,
+					     4.5f,4.5,
+					     16.5f,16.5,
+					     84.5f},
+					    {0},
+					    {99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_residue0 _residue_set1D={0,2048, 32,10,24,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,
+					     32,33,
+					     34,35,36},
+					    {9999,
+					     9999,
+					     22,9999,
+					     34,9999,
+					     64,999,
+					     9999,9999},
+					    {.5f,
+					     1.5f,
+					     2.5f,2.5f,
+					     4.5f,4.5,
+					     16.5f,16.5,
+					     84.f},
+					    {0},
+					    {99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_mapping0 _mapping_set0D={1, {0,0}, {0}, {0}, {0}, {0,0},
+                                            1,{0},{1}};
+static vorbis_info_mapping0 _mapping_set1D={1, {0,0}, {0}, {1}, {1}, {1,2},
+                                            1,{0},{1}};
 static vorbis_info_mode _mode_set0D={0,0,0,0};
 static vorbis_info_mode _mode_set1D={1,0,0,1};
 
-/* CD quality stereo, no channel coupling */
+/* CD quality stereo, losslesschannel coupling */
 codec_setup_info info_D={
 
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   18,   2,
+  2,          2,    1,     2,       2,   37,   3,
   /* modes */
   {&_mode_set0D,&_mode_set1D},
   /* maps */
@@ -267,44 +371,59 @@
   /* times */
   {0,0},{&_time_set0D},
   /* floors */
-  {0,0},{&_floor_set0D,&_floor_set1D},
+  {1,1},{&_floor_set0D,&_floor_set1D},
   /* residue */
-  {0,0},{&_residue_set0D,&_residue_set1D},
+  {2,2},{&_residue_set0D,&_residue_set1D},
   /* books */
-  {&_vq_book_lsp12_0,       /* 0 */
-   &_vq_book_lsp12_1,       /* 1 */
-   &_vq_book_lsp30_0,      /* 2 */
-   &_vq_book_lsp30_1,      /* 3 */
-
-   &_huff_book_res0_256_128aux,
-   &_huff_book_res0_256_1024aux,
-
-   &_vq_book_res0_256_128_1,
-   &_vq_book_res0_256_128_2,
-   &_vq_book_res0_256_128_3,
-   &_vq_book_res0_256_128_4,
-   &_vq_book_res0_256_128_5,
-
-   &_vq_book_res0_256_1024_1,
-   &_vq_book_res0_256_1024_2,
-   &_vq_book_res0_256_1024_3,
-   &_vq_book_res0_256_1024_4,
-   &_vq_book_res0_256_1024_5,
-   &_vq_book_res0_256_1024_6,
-   &_vq_book_res0_256_1024_7,
+    
+  {  
+   &_huff_book_line0_class1,
+   &_huff_book_line0_class2, /* 1 */
+   
+   &_huff_book_line0_0sub0,  /* 2 */
+   &_huff_book_line0_1sub1,  /* 3 */
+   &_huff_book_line0_1sub2,
+   &_huff_book_line0_1sub3,  /* 5 */
+   &_huff_book_line0_2sub1,
+   &_huff_book_line0_2sub2,  /* 7 */
+   &_huff_book_line0_2sub3, 
+
+   &_huff_book_line1_class0,
+   &_huff_book_line1_class1, /* 10 */
+   &_huff_book_line1_class2,
+   &_huff_book_line1_class3, /* 12 */
+
+   &_huff_book_line1_0sub0,
+   &_huff_book_line1_0sub1, /* 14 */
+   &_huff_book_line1_1sub0, 
+   &_huff_book_line1_1sub1,
+   &_huff_book_line1_2sub1,  
+   &_huff_book_line1_2sub2, /* 18 */
+   &_huff_book_line1_2sub3, 
+   &_huff_book_line1_3sub1,
+   &_huff_book_line1_3sub2,
+   &_huff_book_line1_3sub3, /* 22 */
+
+   &_huff_book_res0_128_128aux, 
+   &_huff_book_res0_128_1024aux,
+
+   &_vq_book_res0_128_1024_1,
+   &_vq_book_res0_128_1024_2,
+   &_vq_book_res0_128_1024_3,
+   &_vq_book_res0_128_1024_4,
+   &_vq_book_res0_128_1024_5,
+   &_vq_book_res0_128_1024_6,
+   &_vq_book_res0_128_1024_7,
+   &_vq_book_res0_128_1024_8,
+   &_vq_book_res0_128_1024_8a,
+   &_vq_book_res0_128_1024_9,
+   &_vq_book_res0_128_1024_9a,
+   &_vq_book_res0_128_1024_9b,
 
   },
   /* psy */
-  {&_psy_set_D0,&_psy_set_D},
-
-  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, {26.f,26.f,26.f,30.f}, {-36.f,-36.f,-36.f,-36.f}, -90.f,
-  
-  -10., 
-
-  0,
+  {&_psy_set_D0,&_psy_set_DT,&_psy_set_D},
+  &_psy_set_DG
 };
-
-#define PREDEF_INFO_MAX 0
 
 #endif

1.15      +312 -204  vorbis/lib/modes/mode_E.h

Index: mode_E.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_E.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mode_E.h	2001/06/18 09:07:32	1.14
+++ mode_E.h	2001/08/13 01:37:14	1.15
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_E.h,v 1.14 2001/06/18 09:07:32 xiphmont Exp $
+ last mod: $Id: mode_E.h,v 1.15 2001/08/13 01:37:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,210 +22,303 @@
 #include "vorbis/codec.h"
 #include "backends.h"
 
-#include "books/lsp12_0.vqh"
-#include "books/lsp30_0.vqh"
-#include "books/lsp12_1.vqh"
-#include "books/lsp30_1.vqh"
-
-#include "books/res0_256_128aux.vqh"
-#include "books/res0_256_1024aux.vqh"
-
-#include "books/res0_256_128_1.vqh"
-#include "books/res0_256_128_2.vqh"
-#include "books/res0_256_128_3.vqh"
-#include "books/res0_256_128_4.vqh"
-#include "books/res0_256_128_5.vqh"
-
-#include "books/res0_256_1024_1.vqh"
-#include "books/res0_256_1024_2.vqh"
-#include "books/res0_256_1024_3.vqh"
-#include "books/res0_256_1024_4.vqh"
-#include "books/res0_256_1024_5.vqh"
-#include "books/res0_256_1024_6.vqh"
-#include "books/res0_350_1024_7.vqh"
+#include "books/line0_class1.vqh"
+#include "books/line0_class2.vqh"
+#include "books/line1_class0.vqh"
+#include "books/line1_class1.vqh"
+#include "books/line1_class2.vqh"
+#include "books/line1_class3.vqh"
+
+#include "books/line0_0sub0.vqh"
+#include "books/line0_1sub1.vqh"
+#include "books/line0_1sub2.vqh"
+#include "books/line0_1sub3.vqh"
+#include "books/line0_2sub1.vqh"
+#include "books/line0_2sub2.vqh"
+#include "books/line0_2sub3.vqh"
+
+#include "books/line1_0sub0.vqh"
+#include "books/line1_0sub1.vqh"
+#include "books/line1_1sub0.vqh"
+#include "books/line1_1sub1.vqh"
+#include "books/line1_2sub1.vqh"
+#include "books/line1_2sub2.vqh"
+#include "books/line1_2sub3.vqh"
+#include "books/line1_3sub1.vqh"
+#include "books/line1_3sub2.vqh"
+#include "books/line1_3sub3.vqh"
+
+#include "books/res0_128_128aux.vqh"
+#include "books/res0_128_1024aux.vqh"
+
+#include "books/res0_128_1024_1.vqh"
+#include "books/res0_128_1024_2.vqh"
+#include "books/res0_128_1024_3.vqh"
+#include "books/res0_128_1024_4.vqh"
+#include "books/res0_128_1024_5.vqh"
+#include "books/res0_128_1024_6.vqh"
+#include "books/res0_128_1024_7.vqh"
+#include "books/res0_128_1024_8.vqh"
+#include "books/res0_128_1024_8a.vqh"
+#include "books/res0_128_1024_9.vqh"
+#include "books/res0_128_1024_9a.vqh"
+#include "books/res0_128_1024_9b.vqh"
+
+
+static vorbis_info_psy_global _psy_set_EG={
+  0, /* decaydBpms */
+  8,   /* lines per eighth octave */
+  
+  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
+  256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f,
+  -6.f, 
+  
+  0,
+};
+
+static struct vp_couple_pass _psy_passE[]={
+  {1.f,1.f,
+   {{9999,  0,0,      0,0,      0,0}}
+  },
+};
 
+static vp_attenblock _vp_tonemask_E={
+  {{-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*63*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*88*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*125*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*175*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*250*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*350*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*500*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*700*/
+
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, /*1k*/
+  {-40.f,-40.f,-40.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f,-115.f}, 
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*2k*/
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*4k*/
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*8000*/
+  
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, /*8000*/
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+  {-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f,-9e9f}, 
+}};
+
+static vp_attenblock _vp_peakatt_E={
+  {
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*63*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*125*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*250*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*500*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*1k*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*2k*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*4k*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*8k*/
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},
+    {-14.f,-20.f,-24.f,-26.f,-32.f,-34.f,-36.f,-38.f,-40.f,-40.f,-40.f},/*16k*/
+  }};
 
 static vorbis_info_psy _psy_set_E0={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineconservative,
 
-  -100.,
+  -110.,
   -140.,
-
-  8,
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+  /* tonemaskp */
+  -6.f, -50.f, &_vp_tonemask_E,
 
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*63*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*88*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*125*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*175*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*250*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*350*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*500*/
-   {-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.}, /*700*/
-
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
-   {-40.,-45.,-45.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2000*/
-   {-40.,-45.,-45.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2800*/
-   {-40.,-45.,-45.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*4000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/
-   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
-  },
+  /* peakattp */
+  0, &_vp_peakatt_E,
 
-  1,/* peakattp */
-  {{-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*63*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*88*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*125*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*175*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*250*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*350*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*500*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*700*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*1000*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*1400*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*2000*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*2600*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*4000*/
-   {-20.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*5600*/
-   {-20.f,-22.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*8000*/
-   {-20.f,-22.f,-22.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*11500*/
-   {-16.f,-20.f,-22.f,-22.f,-24.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f},/*16000*/
-  },
+  /*noisemaskp */
+  1,-30.f,     /* suppress any noise curve over maxspec+n */
+  .6f, .6f,   /* low/high window */
+  5, 5, 10,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-20,-10,-10,-10,-10,-10,-6,-6,-6,-6,-6},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.4f,.4f,.5f,.5f,.5f,.5f,.6f},
 
-  0,/*noisemaskp */
-  -20.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  5,
-  5,
-  10,
-  {0.f},
- 
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -28.,
+  1,
+  _psy_passE
 };
 
 static vorbis_info_psy _psy_set_E={
-  ATH_Bark_dB_lspconservative,
-  1,/*decayp*/
+  ATH_Bark_dB_lineconservative,
 
-  -100.f,
+  -110.f,
   -140.f,
 
-  8,
+  /* tonemask */
+  -6.f,-50.f,&_vp_tonemask_E,
+  /* peakattp */
+  0,  &_vp_peakatt_E,
+
+  /*noisemaskp */
+  1,  -30.f,     /* suppress any noise curve over maxspec+n */
+      .4f,.4f,   /* low/high window */
+      10,10,100,
+
+  /*63     125     250     500      1k      2k      4k       8k     16k*/
+  {-30,-30,-30,-30,-30,-30,-30,-20,-10,-12,-16,-16, -10, -6, -6, -6, -6},
+  {.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.5f,.4f,.4f,.4f,.4f,.4f,.5f,.5f,.6f},
 
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-   1,/* tonemaskp */
-  /*  0   10   20   30   40   50   60   70   80   90   100 */
-  {
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/
-   {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/
-
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*175*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*250*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*350*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*500*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*700*/
-
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*1000*/
-   {-40.f,-45.f,-50.f,-50.f,-50.f,-60.f,-70.f,-80.f,-90.f,-99.f,-110.f}, /*1400*/
-   {-40.f,-45.f,-50.f,-50.f,-50.f,-60.f,-70.f,-80.f,-90.f,-99.f,-110.f}, /*2000*/
-   {-40.f,-45.f,-50.f,-50.f,-50.f,-60.f,-70.f,-80.f,-90.f,-99.f,-110.f}, /*2800*/
-   {-40.f,-45.f,-50.f,-50.f,-50.f,-60.f,-70.f,-80.f,-90.f,-99.f,-110.f}, /*4000*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*5600*/
-
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*8000*/
-   {-40.f,-45.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*11500*/
-   {-40.f,-40.f,-45.f,-45.f,-45.f,-55.f,-65.f,-75.f,-85.f,-95.f,-105.f}, /*16000*/
-
-  },
-
-  1,
-  {{-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*63*/
-   {-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*88*/
-   {-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*125*/
-   {-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*175*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*250*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*350*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*500*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*700*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*1000*/
-   {-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*1400*/
-   {-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*2000*/
-   {-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*2800*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f,-28.f},/*4000*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f},/*5600*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f},/*8000*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f},/*11500*/
-   {-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-26.f,-28.f,-28.f,-28.f,-28.f},/*16000*/
-  },
-
-  0,/*noisemaskp */
-  -28.f,  /* suppress any noise curve over maxspec+n */
-  .5f,   /* low window */
-  .5f,   /* high window */
-  25,
-  25,
-  40,
-  {0.f},
- 
   105.f,  /* even decade + 5 is important; saves an rint() later in a
             tight loop) */
-  -32.,
-
+  1,_psy_passE
 };
 
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0E={0};
-static vorbis_info_floor0 _floor_set0E={12, 44100,  64, 10,130, 2, {0,1},
-                                        0.199f, .285f};
-static vorbis_info_floor0 _floor_set1E={30, 44100, 256, 12,150, 2, {2,3}, 
-                                        .082f, .126f};
-static vorbis_info_residue0 _residue_set0E={0,128,16,6,4,
-					    {0,1,1,1,1,1},
-					    {6,7,8,9,10},
-					    
-					    {0,99999,9999,9999,9999},
-					    {999.f,1.5f,2.5f,6.5f,40.5f},
-					    {4,4,4,4,4},
-					    {99,99,99,99,99}};
-
-static vorbis_info_residue0 _residue_set1E={0,1024, 32,8,5,
-					    {0,1,1,1,1,1,1,1,1,1},
-					    {11,12,13,14,15,16,17,18,19},
-					   
-					    {0,9999,9999,60,9999,
+/*static vorbis_info_floor0 _floor_set0B={9, 44100,  64, 10,130, 2, {0,1},
+  0.246f, .387f};*/
+/*static vorbis_info_floor0 _floor_set1B={30, 44100, 256, 12,150, 2, {2,3}, 
+  .082f, .126f};*/
+
+static vorbis_info_floor1 _floor_set0E={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}},
+
+                                        4,
+
+                                        {0,128,  
+
+					 6,17,30,58,
+					 
+					 2,1,4, 11,8,14, 23,20,26,
+					 41,35,48, 84,69,103},
+
+                                        60,30,500,
+                                        999,999,1,18.,
+                                        8,70,
+                                        128};
+
+static vorbis_info_floor1 _floor_set1E={10,
+					{0,1,2,2,2,2,2, 3,3,3},
+					
+					{3,4,3,3},
+					{1,1,2,2},
+					{9,10,11,12},
+					{{13,14},
+					 {15,16},
+					 {-1,17,18,19},
+					 {-1,20,21,22},
+					},
+
+					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
+					 },
+					
+					60,30,300,
+					20,8,1,18.,
+					20,600,
+					1024};
+
+static vorbis_info_residue0 _residue_set0E={0,256,16,10,23,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,32,
+					     33,34,
+					     35,36},
+					    {9999,
+					     9999,
+					     9999,
+					     9999,
+					     40,9999,
+					     58,9999,
                                              9999,9999},
-					    {999.f,2.5f,4.5f,10.5f,10.5f,
-					     20.5f,40.f},
-					    {5,5,5,5,5,5,5},
-					    {99,99,99,99,99,99,99,99,99}};
-
-static vorbis_info_mapping0 _mapping_set0E={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1E={1, {0,0}, {0}, {1}, {1}, {1}};
+					    {.5f,
+					     1.5f,
+					     2.5f,
+					     4.5f,
+					     7.5f,7.5f,
+					     16.5f,16.5,
+					     84.5f},
+					    {0},
+					    {99,
+					     99,
+					     99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_residue0 _residue_set1E={0,2048, 32,10,24,
+					    {0,1,1,1,1,1,1,1,3,7},
+					    {25,
+					     26,
+					     27,
+					     28,
+					     29,
+					     30,
+					     31,
+					     32,33,
+					     34,35,36},
+					    {9999,
+					     9999,
+					     9999,
+					     9999,
+					     70,9999,
+					     110,9999,
+					     9999,9999},
+					    {.5f,
+					     1.5f,
+					     2.5f,
+					     4.5f,
+					     7.5,7.5,
+					     16.5f,16.5,
+					     84.f},
+					    {0},
+					    {99,
+					     99,
+					     99,
+					     99,
+					     99,99,
+					     99,99,
+					     99,99},
+					    {3}};
+
+static vorbis_info_mapping0 _mapping_set0E={1, {0,0}, {0}, {0}, {0}, {0,0},
+                                            1,{0},{1}};
+static vorbis_info_mapping0 _mapping_set1E={1, {0,0}, {0}, {1}, {1}, {1,1},
+                                            1,{0},{1}};
 static vorbis_info_mode _mode_set0E={0,0,0,0};
 static vorbis_info_mode _mode_set1E={1,0,0,1};
 
-/* CD quality stereo, no channel coupling */
+/* CD quality stereo, losslesschannel coupling */
 codec_setup_info info_E={
 
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   18,   2,
+  2,          2,    1,     2,       2,   37,   2,
   /* modes */
   {&_mode_set0E,&_mode_set1E},
   /* maps */
@@ -233,44 +326,59 @@
   /* times */
   {0,0},{&_time_set0E},
   /* floors */
-  {0,0},{&_floor_set0E,&_floor_set1E},
+  {1,1},{&_floor_set0E,&_floor_set1E},
   /* residue */
-  {0,0},{&_residue_set0E,&_residue_set1E},
+  {2,2},{&_residue_set0E,&_residue_set1E},
   /* books */
-  {&_vq_book_lsp12_0,       /* 0 */
-   &_vq_book_lsp12_1,       /* 1 */
-   &_vq_book_lsp30_0,      /* 2 */
-   &_vq_book_lsp30_1,      /* 3 */
-
-   &_huff_book_res0_256_128aux,
-   &_huff_book_res0_256_1024aux,
-
-   &_vq_book_res0_256_128_1,
-   &_vq_book_res0_256_128_2,
-   &_vq_book_res0_256_128_3,
-   &_vq_book_res0_256_128_4,
-   &_vq_book_res0_256_128_5,
-
-   &_vq_book_res0_256_1024_1,
-   &_vq_book_res0_256_1024_2,
-   &_vq_book_res0_256_1024_3,
-   &_vq_book_res0_256_1024_4,
-   &_vq_book_res0_256_1024_5,
-   &_vq_book_res0_256_1024_6,
-   &_vq_book_res0_350_1024_7,
+    
+  {  
+   &_huff_book_line0_class1,
+   &_huff_book_line0_class2, /* 1 */
+   
+   &_huff_book_line0_0sub0,  /* 2 */
+   &_huff_book_line0_1sub1,  /* 3 */
+   &_huff_book_line0_1sub2,
+   &_huff_book_line0_1sub3,  /* 5 */
+   &_huff_book_line0_2sub1,
+   &_huff_book_line0_2sub2,  /* 7 */
+   &_huff_book_line0_2sub3, 
+
+   &_huff_book_line1_class0,
+   &_huff_book_line1_class1, /* 10 */
+   &_huff_book_line1_class2,
+   &_huff_book_line1_class3, /* 12 */
+
+   &_huff_book_line1_0sub0,
+   &_huff_book_line1_0sub1, /* 14 */
+   &_huff_book_line1_1sub0, 
+   &_huff_book_line1_1sub1,
+   &_huff_book_line1_2sub1,  
+   &_huff_book_line1_2sub2, /* 18 */
+   &_huff_book_line1_2sub3, 
+   &_huff_book_line1_3sub1,
+   &_huff_book_line1_3sub2,
+   &_huff_book_line1_3sub3, /* 22 */
+
+   &_huff_book_res0_128_128aux, 
+   &_huff_book_res0_128_1024aux,
+
+   &_vq_book_res0_128_1024_1,
+   &_vq_book_res0_128_1024_2,
+   &_vq_book_res0_128_1024_3,
+   &_vq_book_res0_128_1024_4,
+   &_vq_book_res0_128_1024_5,
+   &_vq_book_res0_128_1024_6,
+   &_vq_book_res0_128_1024_7,
+   &_vq_book_res0_128_1024_8,
+   &_vq_book_res0_128_1024_8a,
+   &_vq_book_res0_128_1024_9,
+   &_vq_book_res0_128_1024_9a,
+   &_vq_book_res0_128_1024_9b,
 
   },
   /* psy */
   {&_psy_set_E0,&_psy_set_E},
-
-  /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, {26.f,26.f,26.f,30.f}, {-36.f,-36.f,-36.f,-36.f}, -90.f,
-  
-  -10., 
-
-  0,
+  &_psy_set_EG
 };
-
-#define PREDEF_INFO_MAX 0
 
 #endif

1.9       +2 -7      vorbis/lib/modes/modes.h

Index: modes.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/modes.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- modes.h	2001/06/15 21:15:43	1.8
+++ modes.h	2001/08/13 01:37:14	1.9
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: modes.h,v 1.8 2001/06/15 21:15:43 xiphmont Exp $
+ last mod: $Id: modes.h,v 1.9 2001/08/13 01:37:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -19,11 +19,6 @@
 #define _V_MODES_H_
 
 #include "masking.h"
-#include "modes/mode_AA.h"
-#include "modes/mode_A.h"
-#include "modes/mode_B.h"
-#include "modes/mode_C.h"
-#include "modes/mode_D.h"
-#include "modes/mode_E.h"
+#include "modes/mode_44c_Z.h"
 
 #endif

1.2       +94 -0     vorbis/lib/modes/maskadj_Z.h

1.2       +315 -0    vorbis/lib/modes/mode_44c_Z.h

1.2       +406 -0    vorbis/lib/modes/mode_Za.h

1.2       +410 -0    vorbis/lib/modes/mode_Zb.h

1.2       +451 -0    vorbis/lib/modes/mode_Zc.h

1.4       +1 -1      vorbis/vq/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.am	2001/01/22 01:38:51	1.3
+++ Makefile.am	2001/08/13 01:37:16	1.4
@@ -48,4 +48,4 @@
         $(MAKE) vq CFLAGS="@PROFILE@"
 
 vq: 
-	$(MAKE) $(EXTRA_PROGRAMS) 
\ No newline at end of file
+	$(MAKE) $(EXTRA_PROGRAMS) 

1.4       +1 -1      vorbis/vq/auxpartition.pl

Index: auxpartition.pl
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/auxpartition.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- auxpartition.pl	2000/07/12 09:36:17	1.3
+++ auxpartition.pl	2001/08/13 01:37:16	1.4
@@ -30,7 +30,7 @@
     @nums = split(/,/);
     my$cols=$#nums;
     for($i=0;$i<$cols;$i++){
-	print $nums[$i].", ";
+	print 0+$nums[$i].", ";
     }
     if($bands>1){
         $_=<TWO>;

1.7       +4 -4      vorbis/vq/distribution.c

Index: distribution.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/distribution.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- distribution.c	2001/06/15 21:15:43	1.6
+++ distribution.c	2001/08/13 01:37:16	1.7
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: utility for finding the distribution in a data set
- last mod: $Id: distribution.c,v 1.6 2001/06/15 21:15:43 xiphmont Exp $
+ last mod: $Id: distribution.c,v 1.7 2001/08/13 01:37:16 xiphmont Exp $
 
  ********************************************************************/
 
@@ -107,14 +107,14 @@
         for(j=0;j<b->entries;j++){
           if(c->lengthlist[j]){
             int indexdiv=1;
-	    printf("%4ld: ",j);
+	    printf("%4d: ",j);
             for(k=0;k<b->dim;k++){	
               int index= (j/indexdiv)%bins;
               printf("%+3.1f,", c->quantlist[index]*_float32_unpack(c->q_delta)+
                      _float32_unpack(c->q_min));
               indexdiv*=bins;
             }
-	    printf("\t|",(1<<(base-c->lengthlist[j])));
+	    printf("\t|");
             for(k=0;k<base-c->lengthlist[j];k++)printf("*");
             printf("\n");
           }
@@ -194,7 +194,7 @@
     printf("Minimum scalar value: %f\n",min);
     printf("Maximum scalar value: %f\n",max);
     
-    printf("\n counting hits into %d bins...\n",bins+1);
+    printf("\n counting hits into %ld bins...\n",bins+1);
     countarray=calloc(bins+1,sizeof(long));
     
     rewind(in);

1.10      +25 -12    vorbis/vq/latticehint.c

Index: latticehint.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticehint.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- latticehint.c	2001/05/27 06:44:07	1.9
+++ latticehint.c	2001/08/13 01:37:17	1.10
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: utility main for building thresh/pigeonhole encode hints
- last mod: $Id: latticehint.c,v 1.9 2001/05/27 06:44:07 xiphmont Exp $
+ last mod: $Id: latticehint.c,v 1.10 2001/08/13 01:37:17 xiphmont Exp $
 
  ********************************************************************/
 
@@ -40,7 +40,7 @@
      to the threshhold hint 
 
    command line:
-   latticehint book.vqh
+   latticehint book.vqh [threshlist]
 
    latticehint produces book.vqh on stdout */
 
@@ -123,15 +123,14 @@
   float min,del;
   char *name;
   long i,j;
-  long dB=0;
+  float *suggestions;
+  int suggcount=0;
 
   if(argv[1]==NULL){
     fprintf(stderr,"Need a lattice book on the command line.\n");
     exit(1);
   }
 
-  if(argv[2])dB=1;
-
   {
     char *ptr;
     char *filename=strdup(argv[1]);
@@ -168,6 +167,19 @@
 
     fprintf(stderr,"Adding threshold hint to %s...\n",name);
 
+    /* partial/complete suggestions */
+    if(argv[2]){
+      char *ptr=strdup(argv[2]);
+      suggestions=alloca(sizeof(float)*quantvals);
+			 
+      for(suggcount=0;ptr && suggcount<quantvals;suggcount++){
+	char *ptr2=strchr(ptr,',');
+	if(ptr2)*ptr2++='\0';
+	suggestions[suggcount]=atof(ptr);
+	ptr=ptr2;
+      }
+    }
+
     /* simplest possible threshold hint only */
     t->quantthresh=_ogg_calloc(quantvals-1,sizeof(float));
     t->quantmap=_ogg_calloc(quantvals,sizeof(int));
@@ -183,13 +195,14 @@
     for(i=0;i<quantvals-1;i++){
       float v1=*(quantsort[i])*del+min;
       float v2=*(quantsort[i+1])*del+min;
-      if(dB){
-	if(fabs(v1)<.01)v1=(v1+v2)*.5;
-	if(fabs(v2)<.01)v2=(v1+v2)*.5;
-	t->quantthresh[i]=fromdB((todB(&v1)+todB(&v2))*.5);
-	if(v1<0 || v2<0)t->quantthresh[i]*=-1;
-
-      }else{
+      
+      for(j=0;j<suggcount;j++)
+	if(v1<suggestions[j] && suggestions[j]<v2){
+	  t->quantthresh[i]=suggestions[j];
+	  break;
+	}
+      
+      if(j==suggcount){
         t->quantthresh[i]=(v1+v2)*.5;
       }
     }

1.5       +45 -11    vorbis/vq/make_residue_books.pl

Index: make_residue_books.pl
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/make_residue_books.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- make_residue_books.pl	2001/06/15 21:15:43	1.4
+++ make_residue_books.pl	2001/08/13 01:37:17	1.5
@@ -10,11 +10,10 @@
 # haux res0_96_128aux.vqd 0,4,2
 # :1 res0_128_128_1.vqd, 4, nonseq cull, 0 +- 1
 # +1a, 4, nonseq, 0 +- .25 .5
-# :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1 2
-# :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1 3 5
-# :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1 3 5 8 11
+# :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1(.7) 2
+# :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1(.7) 3 5
+# :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1(.7) 3 5 8 11
 # :5 res0_128_128_5.vqd, 1, nonseq, 0 +- 1 3 5 8 11 14 17 20 24 28 31 35 39 
-# +1a, 4, nonseq, 0 +- .5 1
 
 
 die "Could not open $ARGV[0]: $!" unless open (F,$ARGV[0]);
@@ -22,7 +21,7 @@
 $goflag=0;
 while($line=<F>){
 
-    print "\n#### $line\n\n";
+    print "#### $line";
     if($line=~m/^GO/){
         $goflag=1;
         next;
@@ -31,7 +30,7 @@
     if($goflag==0){
         if($line=~m/\S+/ && !($line=~m/^\#/) ){
             my $command=$line;
-	    print ">>> $command\n";
+	    print ">>> $command";
             die "Couldn't shell command.\n\tcommand:$command\n" 
                 if syst($command);
         }
@@ -50,7 +49,8 @@
     if($line=~m/^h(.*)/){
         # build a huffman book (no mapping) 
         my($name,$datafile,$arg)=split(' ',$1);
-	my $command="huffbuild $datafile $arg > $globalname$name.vqh";
+ 
+	my $command="huffbuild $datafile $arg";
         print ">>> $command\n";
         die "Couldn't build huffbook.\n\tcommand:$command\n" 
             if syst($command);
@@ -64,15 +64,32 @@
         # build value list
         my$plusminus="+";
         my$list;
+	my$thlist;
         my$count=0;
         foreach my$val (split(' ',$vals)){
             if($val=~/\-?\+?\d+/){
+		my$th;
+
+		# got an explicit threshhint?
+		if($val=~/([0-9\.]+)\(([^\)]+)/){
+		    $val=$1;
+		    $th=$2;
+		}
+
                 if($plusminus=~/-/){
                     $list.="-$val ";
+		    if(defined($th)){
+			$thlist.="," if(defined($thlist));
+			$thlist.="-$th";
+		    }
                     $count++;
                 }
                 if($plusminus=~/\+/){
                     $list.="$val ";
+		    if(defined($th)){
+			$thlist.="," if(defined($thlist));
+			$thlist.="$th";
+		    }
                     $count++;
                 }
             }else{
@@ -94,7 +111,7 @@
         die "Couldn't build latticebook.\n\tcommand:$command\n" 
             if syst($command);
 
-	my $command="latticehint $globalname$name.vqh > temp$$.vqh";
+	my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
         print ">>> $command\n";
         die "Couldn't pre-hint latticebook.\n\tcommand:$command\n" 
             if syst($command);
@@ -117,7 +134,7 @@
                 if syst($command);
         }
 
-	my $command="latticehint $globalname$name.vqh > temp$$.vqh";
+	my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
         print ">>> $command\n";
         die "Couldn't post-hint latticebook.\n\tcommand:$command\n" 
             if syst($command);
@@ -154,15 +171,32 @@
         # build value list
         my$plusminus="+";
         my$list;
+	my$thlist;
         my$count=0;
         foreach my$val (split(' ',$vals)){
             if($val=~/\-?\+?\d+/){
+		my$th;
+
+		# got an explicit threshhint?
+		if($val=~/([0-9\.]+)\(([^\)]+)/){
+		    $val=$1;
+		    $th=$2;
+		}
+
                 if($plusminus=~/-/){
                     $list.="-$val ";
+		    if(defined($th)){
+			$thlist.="," if(defined($thlist));
+			$thlist.="-$th";
+		    }
                     $count++;
                 }
                 if($plusminus=~/\+/){
                     $list.="$val ";
+		    if(defined($th)){
+			$thlist.="," if(defined($thlist));
+			$thlist.="$th";
+		    }
                     $count++;
                 }
             }else{
@@ -184,7 +218,7 @@
         die "Couldn't build latticebook.\n\tcommand:$command\n" 
             if syst($command);
 
-	my $command="latticehint $globalname$name.vqh > temp$$.vqh";
+	my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
         print ">>> $command\n";
         die "Couldn't pre-hint latticebook.\n\tcommand:$command\n" 
             if syst($command);
@@ -207,7 +241,7 @@
                 if syst($command);
         }
 
-	my $command="latticehint $globalname$name.vqh > temp$$.vqh";
+	my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
         print ">>> $command\n";
         die "Couldn't post-hint latticebook.\n\tcommand:$command\n" 
             if syst($command);

1.2       +27 -26    vorbis/vq/res_128c.vqs

Index: res_128c.vqs
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/res_128c.vqs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- res_128c.vqs	2001/07/08 08:46:26	1.1
+++ res_128c.vqs	2001/08/13 01:37:17	1.2
@@ -1,13 +1,13 @@
 huffbuild line0_class1.vqd 0-64
 huffbuild line0_class2.vqd 0-64
 
-huffbuild line0_0sub0.vqd 0-128
-huffbuild line0_1sub1.vqd 1-18
-huffbuild line0_1sub2.vqd 18-50
-huffbuild line0_1sub3.vqd 50-128
-huffbuild line0_2sub1.vqd 1-18
-huffbuild line0_2sub2.vqd 18-50
-huffbuild line0_2sub3.vqd 50-128
+huffbuild line0_0sub0.vqd 0-64
+huffbuild line0_1sub1.vqd 1-9
+huffbuild line0_1sub2.vqd 9-25
+huffbuild line0_1sub3.vqd 25-64
+huffbuild line0_2sub1.vqd 1-9
+huffbuild line0_2sub2.vqd 9-25
+huffbuild line0_2sub3.vqd 25-64
 
 huffbuild line1_class0.vqd 0-8
 huffbuild line1_class1.vqd 0-16
@@ -27,33 +27,34 @@
 huffbuild line1_3sub2.vqd 18-50
 huffbuild line1_3sub3.vqd 50-128
 
-residuesplit residue_0.vqd 0,192,12 res0_128_128 ,.7, ,7.5,4 3,1.5, ,1.5, 4,2.5, ,2.5, 8,7.5, ,7.5, ,22.5,
+residuesplit residue_0#0.vqd 0,192,8 res0_128_128 ,.7,    ,1.5,16 ,1.5 ,2.5,6 ,2.5,16 ,2.5 ,4.5 ,17.5 ,80.5 
 
-residuesplit residue_1.vqd 0,1408,32 res0_128_1024 ,.7, ,7.5,12 5,1.5, ,1.5, 10,2.5, ,2.5,  20,7.5, ,7.5, ,22.5,
+residuesplit residue_1#0.vqd 0,1536,32 res0_128_1024 ,.7, ,1.5,32 ,1.5 ,2.5,18 ,2.5,32 ,2.5 ,4.5 ,17.5 ,80.5
 
-
 GO
 
 >res0_128_128 noninterleaved
-haux res0_128_128aux.vqd 0,16,2
+haux res0_128_128aux.vqd 0,24,2
 
 >res0_128_1024 noninterleaved
-haux res0_128_1024aux.vqd 0,44,2
+haux res0_128_1024aux.vqd 0,48,2
+
+:_1 res0_128_1024_1.vqd, 4, nonseq cull, 0 +- 1
+:_2 res0_128_1024_2.vqd, 4, nonseq cull, 0 +- 1
+:_3 res0_128_1024_3.vqd, 4, nonseq cull, 0 +- 1 2
+:_4 res0_128_1024_4.vqd, 4, nonseq cull, 0 +- 1 2
+:_5 res0_128_1024_5.vqd, 4, nonseq cull, 0 +- 1 2
+:_6 res0_128_1024_6.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_7 res0_128_1024_7.vqd, 2, nonseq cull, 0 +- 5 10 15 
++_7a, 4, nonseq cull, 0 +- 1 2
+
+:_8 res0_128_1024_8.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78 
++_8a, 2, nonseq cull, 0 +- 1 2 3 4 5 6 
+
+:_9 res0_128_1024_9.vqd, 2, nonseq, 0 +- 169 338
++_9a, 2, nonseq, 0 +- 13 26 39 52 65 78 
++_9b, 2, nonseq, 0 +- 1 2 3 4 5 6
 
-:_1 res0_128_1024_1.vqd, 2, nonseq cull, 0 +- 1(.7) 2 3 4 5 6 7
-:_2 res0_128_1024_2.vqd, 4, nonseq cull, 0 +- 1(.7)
-:_3 res0_128_1024_3.vqd, 4, nonseq cull, 0 +- 1(.7)
-:_4 res0_128_1024_4.vqd, 4, nonseq cull, 0 +- 1(.7) 2
-:_5 res0_128_1024_5.vqd, 4, nonseq cull, 0 +- 1(.7) 2
-:_6 res0_128_1024_6.vqd, 4, nonseq cull, 0 +- 3 6
-+_6a, 4, nonseq cull, 0 +- 1
-:_7 res0_128_1024_7.vqd, 4, nonseq cull, 0 +- 3 6
-+_7a, 4, nonseq cull , 0 +- 1 
-:_8 res0_128_1024_8.vqd, 2, nonseq cull, 0 +- 5 10 15 20
-+_8a, 2, nonseq, 0 +- 1 2
-:_9 res0_128_1024_9.vqd, 2, nonseq, 0 +- 27 54 81 108 135 162
-+_9a, 2, nonseq, 0 +- 3 6 9 12
-+_9b, 4, nonseq, 0 +- 1
 
 
 

1.11      +32 -26    vorbis/vq/residuesplit.c

Index: residuesplit.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/residuesplit.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- residuesplit.c	2001/02/26 03:51:12	1.10
+++ residuesplit.c	2001/08/13 01:37:17	1.11
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0 partitioner/classifier
- last mod: $Id: residuesplit.c,v 1.10 2001/02/26 03:51:12 xiphmont Exp $
+ last mod: $Id: residuesplit.c,v 1.11 2001/08/13 01:37:17 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,10 +23,11 @@
 
 /* does not guard against invalid settings; eg, a subn of 16 and a
    subgroup request of 32.  Max subn of 128 */
-static void _testhack(float *vec,int n,float *entropy){
+static float _testhack(float *vec,int n){
   int i,j=0;
   float max=0.f;
   float temp[128];
+  float entropy=0.;
 
   /* setup */
   for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
@@ -37,7 +38,11 @@
 
   for(i=0;i<n;i++)temp[i]=rint(temp[i]);
 
-  while(1){
+  for(i=0;i<n;i++)
+    entropy+=temp[i];
+  return entropy;
+
+  /*while(1){
     entropy[j]=max;
     n>>=1;
     j++;
@@ -49,7 +54,7 @@
     max=0.f;
     for(i=0;i<n;i++)
       if(temp[i]>max)max=temp[i];
-  }
+      }*/
 }
 
 static FILE *of;
@@ -60,20 +65,22 @@
    will need to change in the future when we get real multichannel
    mappings */
 int quantaux(float *res,int n,float *ebound,float *mbound,int *subgrp,int parts, int subn){
-  long i,j;
-  float entropy[8];
+  long i,j,part=0;
   int aux;
 
-  for(i=0;i<=n-subn;i+=subn){
+  for(i=0;i<=n-subn;i+=subn,part++){
     float max=0.f;
+    float lentropy=0.f;
 
-    _testhack(res+i,subn,entropy);
+    lentropy=_testhack(res+i,subn);
+
     for(j=0;j<subn;j++)
       if(fabs(res[i+j])>max)max=fabs(res[i+j]);
 
     for(j=0;j<parts-1;j++)
-      if(entropy[subgrp[j]]<=ebound[j] &&
-	 max<=mbound[j])
+      if(lentropy<=ebound[j] &&
+	 max<=mbound[j] &&
+	 part<subgrp[j])
         break;
     aux=j;
     
@@ -121,9 +128,9 @@
           "                          number of scalars in a group\n"
           "         ent is the maximum entropy value allowed for membership in a group\n"
           "         peak is the maximum amplitude value allowed for membership in a group\n"
-	  "         subn is the maximum entropy value allowed for membership in a group\n"
+	  "         subn is the maximum subpartiton number allowed in the group\n"
                    
-	  "eg: residuesplit mask.vqd floor.vqd 0,1024,16 res 0,.5,16 3,1.5,8 \n"
+	  "eg: residuesplit mask.vqd floor.vqd 0,1024,16 res 0,.5,2 3,1.5,4 \n"
           "produces resaux.vqd and res_0...n.vqd\n\n");
   exit(1);
 }
@@ -166,6 +173,7 @@
   
   for(i=0;i<parts-1;i++){
     char *pos=strchr(argv[4+i],',');
+    subgrp[i]=0;
     if(*argv[4+i]==',')
       ebound[i]=1e50f;
     else
@@ -173,25 +181,23 @@
 
     if(!pos){
       mbound[i]=1e50f;
-      subgrp[i]=_ilog(subn)-1;
-     }else{
-       if(*(pos+1)==',')
-	 mbound[i]=1e50f;
-       else
-	 mbound[i]=atof(pos+1);
-       pos=strchr(pos+1,',');
+    }else{
+      if(*(pos+1)==',')
+	mbound[i]=1e50f;
+      else
+	mbound[i]=atof(pos+1);
+      pos=strchr(pos+1,',');
+      
+       if(pos)
+	 subgrp[i]=atoi(pos+1);
        
-       if(!pos){
-	 subgrp[i]=_ilog(subn)-1;
-       }else{
-	 subgrp[i]=_ilog(atoi(pos+1))-1;
-       }
-     }
+    }
+    if(subgrp[i]<=0)subgrp[i]=99999;
   }
 
   ebound[i]=1e50f;
   mbound[i]=1e50f;
-  subgrp[i]=_ilog(subn)-1;
+  subgrp[i]=9999999;
 
   res=fopen(argv[1],"r");
   if(!res){

1.2       +64 -0     vorbis/vq/res_160c.vqs

1.2       +63 -0     vorbis/vq/res_192c.vqs

1.2       +63 -0     vorbis/vq/res_350c.vqs

1.2       +61 -0     vorbis/vq/res_64c.vqs

1.2       +42 -0     vorbis/vq/res_96Zc.vqs

1.2       +56 -0     vorbis/vq/res_96c.vqs

--- >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