[xiph-cvs] cvs commit: vorbis/lib/modes psych_44.h residue_44.h

Monty xiphmont at xiph.org
Tue May 7 16:47:24 PDT 2002



xiphmont    02/05/07 16:47:22

  Modified:    examples Tag: branch_monty_20020507 encoder_example.c
               lib      Tag: branch_monty_20020507 Makefile.am analysis.c
                        backends.h bitrate.c bitrate.h block.c codebook.c
                        codebook.h codec_internal.h floor0.c floor1.c
                        info.c mapping0.c masking.h mdct.c psy.c psy.h
                        registry.c registry.h res0.c scales.h sharedbook.c
                        vorbisenc.c
               lib/modes Tag: branch_monty_20020507 psych_44.h residue_44.h
  Log:
  The Grand Simplification
  
  Not fully turned on yet, but this has been a local copy for a long
  time and I no wanna lose it.

Revision  Changes    Path
No                   revision

<p>No                   revision

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

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

<p><p>No                   revision

<p>No                   revision

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

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- Makefile.am	2002/03/18 05:06:39	1.14
+++ Makefile.am	2002/05/07 23:47:12	1.14.2.1
@@ -9,7 +9,7 @@
 lib_LTLIBRARIES = libvorbis.la libvorbisfile.la libvorbisenc.la
 
 libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c \
-			lpc.c analysis.c synthesis.c psy.c info.c time0.c \
+			lpc.c analysis.c synthesis.c psy.c info.c \
                         floor1.c floor0.c\
                         res0.c mapping0.c registry.c codebook.c sharedbook.c\
                         lookup.c bitrate.c\

<p><p>1.51.2.1  +20 -9     vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.51
retrieving revision 1.51.2.1
diff -u -r1.51 -r1.51.2.1
--- analysis.c	2002/03/29 07:10:38	1.51
+++ analysis.c	2002/05/07 23:47:12	1.51.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.51 2002/03/29 07:10:38 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.51.2.1 2002/05/07 23:47:12 xiphmont Exp $
 
  ********************************************************************/
 
@@ -64,6 +64,11 @@
     return(ret);
 
   if(op){
+    if(vorbis_bitrate_managed(vb))
+      /* The app is using a bitmanaged mode... but not using the
+         bitrate management interface. */
+      return(OV_EINVAL);
+    
     op->packet=oggpack_get_buffer(&vb->opb);
     op->bytes=oggpack_bytes(&vb->opb);
     op->b_o_s=0;
@@ -91,17 +96,17 @@
         fprintf(of,"\n\n");
       else{
         if(bark)
-	  fprintf(of,"%g ",toBARK(22050.f*j/n));
+	  fprintf(of,"%f ",toBARK(22050.f*j/n));
         else
           if(off!=0)
-	    fprintf(of,"%g ",(double)(j+off)/44100.);
+	    fprintf(of,"%f ",(double)(j+off)/44100.);
           else
-	    fprintf(of,"%g ",(double)j);
+	    fprintf(of,"%f ",(double)j);
 
         if(dB){
-	  fprintf(of,"%g\n",todB(v+j));
+	  fprintf(of,"%f\n",todB(v+j));
         }else{
-	  fprintf(of,"%g\n",v[j]);
+	  fprintf(of,"%f\n",v[j]);
         }
       }
     }
@@ -110,10 +115,16 @@
 }
 
 void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){
-#ifdef ANALYSIS
-  if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB);
-#endif
+  if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,0);
 }
+
+
+
+
+
+
+
+
 
 
 

<p><p>1.12.6.1  +3 -31     vorbis/lib/backends.h

Index: backends.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/backends.h,v
retrieving revision 1.12
retrieving revision 1.12.6.1
diff -u -r1.12 -r1.12.6.1
--- backends.h	2001/12/20 01:00:26	1.12
+++ backends.h	2002/05/07 23:47:12	1.12.6.1
@@ -12,7 +12,7 @@
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.12 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: backends.h,v 1.12.6.1 2002/05/07 23:47:12 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,31 +26,6 @@
 #include "codec_internal.h"
 
 /* this would all be simpler/shorter with templates, but.... */
-/* Transform backend generic *************************************/
-
-/* only mdct right now.  Flesh it out more if we ever transcend mdct
-   in the transform domain */
-
-/* Time backend generic ******************************************/
-typedef struct{
-  void              (*pack)  (vorbis_info_time *,oggpack_buffer *);
-  vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *);
-  vorbis_look_time *(*look)  (vorbis_dsp_state *,vorbis_info_mode *,
-			      vorbis_info_time *);
-  vorbis_info_time *(*copy_info)(vorbis_info_time *);
-
-  void (*free_info) (vorbis_info_time *);
-  void (*free_look) (vorbis_look_time *);
-  int  (*forward)   (struct vorbis_block *,vorbis_look_time *,
-		     float *,float *);
-  int  (*inverse)   (struct vorbis_block *,vorbis_look_time *,
-		     float *,float *);
-} vorbis_func_time;
-
-typedef struct{
-  int dummy;
-} vorbis_info_time0;
-
 /* Floor backend generic *****************************************/
 typedef struct{
   void                   (*pack)  (vorbis_info_floor *,oggpack_buffer *);
@@ -60,10 +35,6 @@
   vorbis_info_floor     *(*copy_info)(vorbis_info_floor *);
   void (*free_info) (vorbis_info_floor *);
   void (*free_look) (vorbis_look_floor *);
-  int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
-		     float *, const float *, /* in */
-		     const float *, const float *, /* in */
-		     float *);                     /* out */
   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
                      void *buffer,float *);
@@ -85,6 +56,7 @@
 
 } vorbis_info_floor0;
 
+
 #define VIF_POSIT 63
 #define VIF_CLASS 16
 #define VIF_PARTS 31
@@ -130,7 +102,7 @@
   long **(*class)      (struct vorbis_block *,vorbis_look_residue *,
                         float **,int *,int);
   int  (*forward)      (struct vorbis_block *,vorbis_look_residue *,
-			float **,float **,int *,int,int,long **,ogg_uint32_t *);
+			float **,float **,int *,int,long **);
   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
                         float **,int *,int);
 } vorbis_func_residue;

<p><p>1.11.4.1  +122 -193  vorbis/lib/bitrate.c

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

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

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

<p><p>1.64.2.1  +2 -8      vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.64
retrieving revision 1.64.2.1
diff -u -r1.64 -r1.64.2.1
--- block.c	2002/03/29 07:34:09	1.64
+++ block.c	2002/05/07 23:47:12	1.64.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.64 2002/03/29 07:34:09 xiphmont Exp $
+ last mod: $Id: block.c,v 1.64.2.1 2002/05/07 23:47:12 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -94,8 +94,6 @@
       vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal));
     oggpack_writeinit(&vb->opb);
     vbi->ampmax=-9999;
-    vbi->packet_markers=_ogg_malloc(vorbis_bitrate_maxmarkers()*
-			       sizeof(*vbi->packet_markers));
   }
   
   return(0);
@@ -154,12 +152,8 @@
   _vorbis_block_ripcord(vb);
   if(vb->localstore)_ogg_free(vb->localstore);
 
-  if(vb->internal){
-    vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
-    if(vbi->packet_markers)_ogg_free(vbi->packet_markers);
-
+  if(vb->internal)
     _ogg_free(vb->internal);
-  }
 
   memset(vb,0,sizeof(*vb));
   return(0);

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

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.38
retrieving revision 1.38.4.1
diff -u -r1.38 -r1.38.4.1
--- codebook.c	2002/01/22 02:16:40	1.38
+++ codebook.c	2002/05/07 23:47:12	1.38.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.38 2002/01/22 02:16:40 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.38.4.1 2002/05/07 23:47:12 xiphmont Exp $
 
  ********************************************************************/
 
@@ -287,15 +287,6 @@
   int k,dim=book->dim;
   for(k=0;k<dim;k++)
     a[k]=(book->valuelist+best*dim)[k];
-  return(vorbis_book_encode(book,best,b));
-}
-
-/* res0 (multistage, interleave, lattice) */
-/* returns the number of bits and *modifies a* to the remainder value ********/
-int vorbis_book_encodevs(codebook *book,float *a,oggpack_buffer *b,
-			 int step,int addmul){
-
-  int best=vorbis_book_besterror(book,a,step,addmul);
   return(vorbis_book_encode(book,best,b));
 }
 

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

Index: codebook.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.h,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -u -r1.12 -r1.12.4.1
--- codebook.h	2002/01/21 20:51:28	1.12
+++ codebook.h	2002/05/07 23:47:13	1.12.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: codebook.h,v 1.12 2002/01/21 20:51:28 xiphmont Exp $
+ last mod: $Id: codebook.h,v 1.12.4.1 2002/05/07 23:47:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -143,8 +143,6 @@
 extern int vorbis_book_errorv(codebook *book, float *a);
 extern int vorbis_book_encodev(codebook *book, int best,float *a, 
                                oggpack_buffer *b);
-extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b,
-				int step,int stagetype);
 
 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
 extern long vorbis_book_decodevs_add(codebook *book, float *a, 

<p><p>1.14.4.1  +5 -13     vorbis/lib/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codec_internal.h,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -u -r1.14 -r1.14.4.1
--- codec_internal.h	2002/01/22 11:59:00	1.14
+++ codec_internal.h	2002/05/07 23:47:13	1.14.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.14 2002/01/22 11:59:00 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.14.4.1 2002/05/07 23:47:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,15 +26,16 @@
 #define BLOCKTYPE_TRANSITION 0 
 #define BLOCKTYPE_LONG       1
 
+#define PACKETBLOBS 15
+
 typedef struct vorbis_block_internal{
   float  **pcmdelay;  /* this is a pointer into local storage */ 
   float  ampmax;
   int    blocktype;
 
-  ogg_uint32_t *packet_markers;
+  ogg_uint32_t   packetblob_markers[PACKETBLOBS];
 } vorbis_block_internal;
 
-typedef void vorbis_look_time;
 typedef void vorbis_look_mapping;
 typedef void vorbis_look_floor;
 typedef void vorbis_look_residue;
@@ -48,7 +49,6 @@
   int mapping;
 } vorbis_info_mode;
 
-typedef void vorbis_info_time;
 typedef void vorbis_info_floor;
 typedef void vorbis_info_residue;
 typedef void vorbis_info_mapping;
@@ -101,10 +101,7 @@
   int short_block_p;
   int long_block_p;
   int impulse_block_p;
-
   int stereo_couple_p;
-  int stereo_backfill_p;
-  int residue_backfill_p;
 
   int    stereo_point_dB;
   double stereo_point_kHz[2];
@@ -140,7 +137,6 @@
 
   int        modes;
   int        maps;
-  int        times;
   int        floors;
   int        residues;
   int        books;
@@ -149,8 +145,6 @@
   vorbis_info_mode       *mode_param[64];
   int                     map_type[64];
   vorbis_info_mapping    *map_param[64];
-  int                     time_type[64];
-  vorbis_info_time       *time_param[64];
   int                     floor_type[64];
   vorbis_info_floor      *floor_param[64];
   int                     residue_type[64];
@@ -163,12 +157,10 @@
 
   bitrate_manager_info   bi;
   highlevel_encode_setup hi;
-
-  int    passlimit[32];     /* iteration limit per couple/quant pass */
-  int    coupling_passes;
 } codec_setup_info;
 
 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
 extern void _vp_global_free(vorbis_look_psy_global *look);
 
 #endif
+

<p><p>1.51.4.1  +3 -254    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.51
retrieving revision 1.51.4.1
diff -u -r1.51 -r1.51.4.1
--- floor0.c	2002/02/26 05:21:35	1.51
+++ floor0.c	2002/05/07 23:47:13	1.51.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.51 2002/02/26 05:21:35 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.51.4.1 2002/05/07 23:47:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -46,28 +46,6 @@
   long frames;
 } vorbis_look_floor0;
 
-/* infrastructure for finding fit */
-static long _f0_fit(codebook *book,
-		    float *orig,
-		    float *workfit,
-		    int cursor){
-  int dim=book->dim;
-  float norm,base=0.f;
-  int i,best=0;
-  float *lsp=workfit+cursor;
-
-  if(cursor)base=workfit[cursor-1];
-  norm=orig[cursor+dim-1]-base;
-
-  for(i=0;i<dim;i++)
-    lsp[i]=(orig[i+cursor]-base);
-  best=_best(book,lsp,1);
-
-  memcpy(lsp,book->valuelist+best*dim,dim*sizeof(*lsp));
-  for(i=0;i<dim;i++)
-    lsp[i]+=base;
-  return(best);
-}
 
 /***********************************************/
 
@@ -101,19 +79,6 @@
   }
 }
 
-static void floor0_pack (vorbis_info_floor *i,oggpack_buffer *opb){
-  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  int j;
-  oggpack_write(opb,info->order,8);
-  oggpack_write(opb,info->rate,16);
-  oggpack_write(opb,info->barkmap,16);
-  oggpack_write(opb,info->ampbits,6);
-  oggpack_write(opb,info->ampdB,8);
-  oggpack_write(opb,info->numbooks-1,4);
-  for(j=0;j<info->numbooks;j++)
-    oggpack_write(opb,info->books[j],8);
-}
-
 static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
   codec_setup_info     *ci=vi->codec_setup;
   int j;
@@ -193,222 +158,6 @@
   return look;
 }
 
-/* less efficient than the decode side (written for clarity).  We're
-   not bottlenecked here anyway */
-
-float _curve_to_lpc(float *curve,float *lpc,
-		     vorbis_look_floor0 *l){
-  /* map the input curve to a bark-scale curve for encoding */
-  
-  int mapped=l->ln;
-  float *work=alloca(sizeof(*work)*mapped);
-  int i,j,last=0;
-  int bark=0;
-  static int seq=0;
-
-  memset(work,0,sizeof(*work)*mapped);
-  
-  /* Only the decode side is behavior-specced; for now in the encoder,
-     we select the maximum value of each band as representative (this
-     helps make sure peaks don't go out of range.  In error terms,
-     selecting min would make more sense, but the codebook is trained
-     numerically, so we don't actually lose.  We'd still want to
-     use the original curve for error and noise estimation */
-  
-  for(i=0;i<l->n;i++){
-    bark=l->linearmap[i];
-    if(work[bark]<curve[i])work[bark]=curve[i];
-    if(bark>last+1){
-      /* If the bark scale is climbing rapidly, some bins may end up
-         going unused.  This isn't a waste actually; it keeps the
-         scale resolution even so that the LPC generator has an easy
-         time.  However, if we leave the bins empty we lose energy.
-         So, fill 'em in.  The decoder does not do anything with  he
-         unused bins, so we can fill them anyway we like to end up
-         with a better spectral curve */
-
-      /* we'll always have a bin zero, so we don't need to guard init */
-      long span=bark-last;
-      for(j=1;j<span;j++){
-	float del=(float)j/span;
-	work[j+last]=work[bark]*del+work[last]*(1.f-del);
-      }
-    }
-    last=bark;
-  }
-
-  /* If we're over-ranged to avoid edge effects, fill in the end of spectrum gap */
-  for(i=bark+1;i<mapped;i++)
-    work[i]=work[i-1];
-
-
-  /**********************/
-
-  for(i=0;i<l->n;i++)
-    curve[i]-=150;
-
-  _analysis_output("barkfloor",seq,work,bark,0,0);
-  _analysis_output("barkcurve",seq++,curve,l->n,1,0);
-
-  for(i=0;i<l->n;i++)
-    curve[i]+=150;
-
-  /**********************/
-  
-  return vorbis_lpc_from_curve(work,lpc,&(l->lpclook));
-}
-
-static int floor0_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  float *mdct, const float *logmdct,   /* in */
-			  const float *logmask, const float *logmax, /* in */
-			  float *codedflr){          /* out */
-  long j;
-  vorbis_look_floor0 *look=(vorbis_look_floor0 *)in;
-  vorbis_info_floor0 *info=look->vi;
-  float amp;
-  long val=0;
-  static int seq=0;
-
-#ifdef TRAIN_LSP
-  FILE *of;
-  FILE *ef;
-  char buffer[80];
-
-#if 1
-  sprintf(buffer,"lsp0coeff_%d.vqd",vb->mode);
-  of=fopen(buffer,"a");
-#endif
-#endif
-
-  seq++;
-
-
-  /* our floor comes in on a [-Inf...0] dB scale.  The curve has to be
-     positive, so we offset it. */
-
-  for(j=0;j<look->n;j++)
-    codedflr[j]=logmask[j]+info->ampdB;
-
-  /* use 'out' as temp storage */
-  /* Convert our floor to a set of lpc coefficients */ 
-  amp=sqrt(_curve_to_lpc(codedflr,codedflr,look));
-
-  /* amp is in the range (0. to ampdB].  Encode that range using
-     ampbits bits */
- 
-  {
-    long maxval=(1L<<info->ampbits)-1;
-    
-    val=rint(amp/info->ampdB*maxval);
-
-    if(val<0)val=0;           /* likely */
-    if(val>maxval)val=maxval; /* not bloody likely */
-
-    if(val>0)
-      amp=(float)val/maxval*info->ampdB;
-    else
-      amp=0;
-  }
-
-  if(val){
-    /* LSP <-> LPC is orthogonal and LSP quantizes more stably  */
-    _analysis_output("lpc",seq-1,codedflr,look->m,0,0);
-    if(vorbis_lpc_to_lsp(codedflr,codedflr,look->m))
-      val=0;
-
-  }
-
-  oggpack_write(&vb->opb,val,info->ampbits);
-  look->bits+=info->ampbits+1;
-  look->frames++;
-
-  if(val){
-    float *lspwork=alloca(look->m*sizeof(*lspwork));
-
-    /* the spec supports using one of a number of codebooks.  Right
-       now, encode using this lib supports only one */
-    codec_setup_info  *ci=vb->vd->vi->codec_setup;
-    codebook *b;
-    int booknum;
-
-    _analysis_output("lsp",seq-1,codedflr,look->m,0,0);
-
-    /* which codebook to use? We do it only by range right now. */
-    if(info->numbooks>1){
-      float last=0.;
-      for(j=0;j<look->m;j++){
-	float val=codedflr[j]-last;
-	if(val<info->lessthan || val>info->greaterthan)break;
-	last=codedflr[j];
-      }
-      if(j<look->m)
-	booknum=0;
-      else
-	booknum=1;
-    }else
-      booknum=0;
-
-    b=ci->fullbooks+info->books[booknum];
-    oggpack_write(&vb->opb,booknum,_ilog(info->numbooks));
-    look->bits+=_ilog(info->numbooks);
-
-#ifdef TRAIN_LSP
-    {
-      float last=0.f;
-      for(j=0;j<look->m;j++){
-	fprintf(of,"%.12g, ",codedflr[j]-last);
-	last=codedflr[j];
-      }
-    }
-    fprintf(of,"\n");
-    fclose(of);
-
-    sprintf(buffer,"lsp0ent_m%d_b%d.vqd",vb->mode,booknum);
-    ef=fopen(buffer,"a");
-
-#endif
-
-    /* code the spectral envelope, and keep track of the actual
-       quantized values; we don't want creeping error as each block is
-       nailed to the last quantized value of the previous block. */
-
-    for(j=0;j<look->m;j+=b->dim){
-      int entry=_f0_fit(b,codedflr,lspwork,j);
-      look->bits+=vorbis_book_encode(b,entry,&vb->opb);
-
-#ifdef TRAIN_LSP
-      fprintf(ef,"%d,\n",entry);
-#endif
-
-    }
-
-#ifdef TRAIN_LSP
-    fclose(ef);
-#endif
-
-    _analysis_output("lsp2",seq-1,lspwork,look->m,0,0);
-
-    /* take the coefficients back to a spectral envelope curve */
-    for(j=0;j<look->n;j++)
-      codedflr[j]=1.f;
-    vorbis_lsp_to_curve(codedflr,look->linearmap,look->n,look->ln,
-			lspwork,look->m,amp,(float)info->ampdB);
-
-    _analysis_output("barklsp",seq-1,codedflr,look->n,1,1);
-    _analysis_output("lsp3",seq-1,codedflr,look->n,0,1);
-
-    return(val);
-  }
-
-#ifdef TRAIN_LSP
-    fclose(of);
-#endif
-
-  memset(codedflr,0,sizeof(*codedflr)*look->n);
-  memset(mdct,0,sizeof(*mdct)*look->n);
-  return(val);
-}
-
 static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
@@ -461,8 +210,8 @@
 
 /* export hooks */
 vorbis_func_floor floor0_exportbundle={
-  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_copy_info,&floor0_free_info,
-  &floor0_free_look,&floor0_forward,&floor0_inverse1,&floor0_inverse2
+  NULL,&floor0_unpack,&floor0_look,&floor0_copy_info,&floor0_free_info,
+  &floor0_free_look,&floor0_inverse1,&floor0_inverse2
 };
 
 

<p><p>1.20.4.1  +286 -249  vorbis/lib/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor1.c,v
retrieving revision 1.20
retrieving revision 1.20.4.1
diff -u -r1.20 -r1.20.4.1
--- floor1.c	2002/01/22 08:06:06	1.20
+++ floor1.c	2002/05/07 23:47:13	1.20.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.20 2002/01/22 08:06:06 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.20.4.1 2002/05/07 23:47:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -301,71 +301,71 @@
   return i;
 }
 
-static float FLOOR_fromdB_LOOKUP[256]={
-	1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
-	1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
-	1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
-	2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
-	2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
-	3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
-	4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
-	6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
-	7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
-	1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
-	1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
-	1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
-	2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
-	2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
-	3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
-	4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
-	5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
-	7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
-	9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
-	1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
-	1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
-	2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
-	2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
-	3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
-	4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
-	5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
-	7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
-	9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
-	0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
-	0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
-	0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
-	0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
-	0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
-	0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
-	0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
-	0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
-	0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
-	0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
-	0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
-	0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
-	0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
-	0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
-	0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
-	0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
-	0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
-	0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
-	0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
-	0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
-	0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
-	0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
-	0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
-	0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
-	0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
-	0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
-	0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
-	0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
-	0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
-	0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
-	0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
-	0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
-	0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
-	0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
-	0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
-	0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
+static float FLOOR1_fromdB_LOOKUP[256]={
+  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
+  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
+  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
+  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
+  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
+  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
+  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
+  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
+  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
+  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
+  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
+  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
+  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
+  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
+  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
+  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
+  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
+  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
+  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
+  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
+  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
+  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
+  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
+  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
+  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
+  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
+  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
+  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
+  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
+  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
+  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
+  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
+  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
+  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
+  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
+  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
+  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
+  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
+  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
+  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
+  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
+  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
+  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
+  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
+  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
+  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
+  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
+  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
+  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
+  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
+  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
+  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
+  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
+  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
+  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
+  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
+  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
+  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
+  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
+  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
+  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
+  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
+  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
+  0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
 };
 
 static void render_line(int x0,int x1,int y0,int y1,float *d){
@@ -380,7 +380,7 @@
 
   ady-=abs(base*adx);
 
-  d[x]*=FLOOR_fromdB_LOOKUP[y];
+  d[x]*=FLOOR1_fromdB_LOOKUP[y];
   while(++x<x1){
     err=err+ady;
     if(err>=adx){
@@ -389,11 +389,11 @@
     }else{
       y+=base;
     }
-    d[x]*=FLOOR_fromdB_LOOKUP[y];
+    d[x]*=FLOOR1_fromdB_LOOKUP[y];
   }
 }
 
-static void render_line0(int x0,int x1,int y0,int y1,float *d){
+static void render_line0(int x0,int x1,int y0,int y1,int *d){
   int dy=y1-y0;
   int adx=x1-x0;
   int ady=abs(dy);
@@ -405,7 +405,7 @@
 
   ady-=abs(base*adx);
 
-  d[x]=FLOOR_fromdB_LOOKUP[y];
+  d[x]=y;
   while(++x<x1){
     err=err+ady;
     if(err>=adx){
@@ -414,7 +414,7 @@
     }else{
       y+=base;
     }
-    d[x]=FLOOR_fromdB_LOOKUP[y];
+    d[x]=y;
   }
 }
 
@@ -485,7 +485,7 @@
     int quantized=vorbis_dBquant(flr+i);
     a->edgey1=quantized;
   }
-  return(a->n);
+  return(na);
 }
 
 /* returns < 0 on too few points to fit, >=0 (meansq error) on success */
@@ -622,13 +622,11 @@
   return (A[pos]+B[pos])>>1;
 }
 
-static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in,
-			  float *mdct, const float *logmdct,   /* in */
-			  const float *logmask, const float *logmax, /* in */
-			  float *codedflr){          /* out */
+int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+			  const float *logmdct,   /* in */
+			  const float *logmask){
   static int seq=0;
-  long i,j,k,l;
-  vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
+  long i,j;
   vorbis_info_floor1 *info=look->vi;
   long n=info->n;
   long posts=look->posts;
@@ -640,34 +638,26 @@
 
   int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */
   int hineighbor[VIF_POSIT+2]; 
+  int *output=NULL;
   int memo[VIF_POSIT+2];
-  codec_setup_info *ci=vb->vd->vi->codec_setup;
-  static_codebook **sbooks=ci->book_param;
-  codebook *books=NULL;
-  int writeflag=0;
-
-  if(vb->vd->backend_state){
-    books=ci->fullbooks;   
-    writeflag=1;
-  }
-
+  
   memset(fit_flag,0,sizeof(fit_flag));
   for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */
   for(i=0;i<posts;i++)hineighbor[i]=1; /* 1 for the implicit post at n */
   for(i=0;i<posts;i++)memo[i]=-1;      /* no neighbor yet */
-
+  
   /* Scan back from high edge to first 'used' frequency */
   for(;n>info->unusedmin_n;n--)
     if(logmdct[n-1]>-floor1_rangedB && 
        logmdct[n-1]+info->twofitatten>logmask[n-1])break;
-
+  
   /* quantize the relevant floor points and collect them into line fit
      structures (one per minimal division) at the same time */
   if(posts==0){
-    nonzero+=accumulate_fit(logmask,logmax,0,n,fits,n,info);
+    nonzero+=accumulate_fit(logmask,logmdct,0,n,fits,n,info);
   }else{
     for(i=0;i<posts-1;i++)
-      nonzero+=accumulate_fit(logmask,logmax,look->sorted_index[i],
+      nonzero+=accumulate_fit(logmask,logmdct,look->sorted_index[i],
                               look->sorted_index[i+1],fits+i,
                               n,info);
   }
@@ -768,7 +758,7 @@
                 hy0=fits[sortpos].edgey0;
                 break;
               }
-
+	      
               /* store new edge values */
               fit_valueB[ln]=ly0;
               if(ln==0 && ly0>=0)fit_valueA[ln]=ly0;
@@ -786,7 +776,7 @@
                 /* store new neighbor values */
                 for(j=sortpos-1;j>=0;j--)
                   if(hineighbor[j]==hn)
-		  hineighbor[j]=i;
+		    hineighbor[j]=i;
                   else
                     break;
                 for(j=sortpos+1;j<posts;j++)
@@ -803,48 +793,126 @@
         }
       }
     }
+    
+    output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
+
+    output[0]=post_Y(fit_valueA,fit_valueB,0);
+    output[1]=post_Y(fit_valueA,fit_valueB,1);
+    
+    /* fill in posts marked as not using a fit; we will zero
+       back out to 'unused' when encoding them so long as curve
+       interpolation doesn't force them into use */
+    for(i=2;i<posts;i++){
+      int ln=look->loneighbor[i-2];
+      int hn=look->hineighbor[i-2];
+      int x0=info->postlist[ln];
+      int x1=info->postlist[hn];
+      int y0=output[ln];
+      int y1=output[hn];
+      
+      int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
+	
+      if(fit_flag[i]){
+	int vx=post_Y(fit_valueA,fit_valueB,i);
+	if(predicted!=vx){
+	  output[i]=vx;
+	}else{
+	  output[i]= predicted|0x8000;
+	}
+      }else{
+	output[i]= predicted|0x8000;
+      }
+    }
+  }
+
+  return(output);
+  
+}
+		
+int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+			  int *A,int *B,
+			  int del){
+
+  long i;
+  long posts=look->posts;
+  int *output=NULL;
+  int dummy[VIF_POSIT+2];
+  
+  if(A || B){
+    if(!A || !B){
+      memset(dummy,0,sizeof(dummy));
+      if(!A)A=dummy;
+      if(!B)B=dummy;
+    }
+    output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
+    
+    for(i=0;i<posts;i++){
+      output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16;
+      if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000;
+    }
+  }
+
+  return(output);
+}
 
-    /* quantize values to multiplier spec */
-    switch(info->mult){
-    case 1: /* 1024 -> 256 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>2;
-      break;
-    case 2: /* 1024 -> 128 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>3;
-      break;
-    case 3: /* 1024 -> 86 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)/12;
-      break;
-    case 4: /* 1024 -> 64 */
-      for(i=0;i<posts;i++)
-	if(fit_flag[i])
-	  fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>4;
-      break;
+
+int floor1_encode(vorbis_block *vb,vorbis_look_floor1 *look,
+		  int *post,int *ilogmask){
+
+  long i,j;
+  vorbis_info_floor1 *info=look->vi;
+  long n=info->n;
+  long posts=look->posts;
+  codec_setup_info *ci=vb->vd->vi->codec_setup;
+  int out[VIF_POSIT+2];
+  static_codebook **sbooks=ci->book_param;
+  codebook *books=ci->fullbooks;
+  static long seq=0; 
+
+  /* quantize values to multiplier spec */
+  if(post){
+    for(i=0;i<posts;i++){
+      int val=post[i]&0x7fff;
+      switch(info->mult){
+      case 1: /* 1024 -> 256 */
+	val>>=2;
+	break;
+      case 2: /* 1024 -> 128 */
+	val>>=3;
+	break;
+      case 3: /* 1024 -> 86 */
+	val/=12;
+	break;
+      case 4: /* 1024 -> 64 */
+	val>>=4;
+	break;
+      }
+      post[i]=val | (post[i]&0x8000);
     }
 
+    out[0]=post[0];
+    out[1]=post[1];
+
     /* find prediction values for each post and subtract them */
     for(i=2;i<posts;i++){
-      int sp=look->reverse_index[i];
       int ln=look->loneighbor[i-2];
       int hn=look->hineighbor[i-2];
       int x0=info->postlist[ln];
       int x1=info->postlist[hn];
-      int y0=fit_valueA[ln];
-      int y1=fit_valueA[hn];
-	
+      int y0=post[ln];
+      int y1=post[hn];
+      
       int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
-	
-      if(fit_flag[i]){
+      
+      if((post[i]&0x8000) || (predicted==post[i])){
+	post[i]=predicted|0x8000; /* in case there was roundoff jitter
+				     in interpolation */
+	out[i]=0;
+      }else{
         int headroom=(look->quant_q-predicted<predicted?
                       look->quant_q-predicted:predicted);
         
-	int val=fit_valueA[i]-predicted;
+	int val=post[i]-predicted;
         
         /* at this point the 'deviation' value is in the range +/- max
            range, but the real, unique range can always be mapped to
@@ -862,163 +930,132 @@
             val= val+headroom;
           else
             val<<=1;
-	
-	fit_valueB[i]=val;
-	
-	/* unroll the neighbor arrays */
-	for(j=sp+1;j<posts;j++)
-	  if(loneighbor[j]==i)
-	    loneighbor[j]=loneighbor[sp];
-	  else
-	    break;
-	for(j=sp-1;j>=0;j--)
-	  if(hineighbor[j]==i)
-	    hineighbor[j]=hineighbor[sp];
-	  else
-	    break;
         
-      }else{
-	fit_valueA[i]=predicted;
-	fit_valueB[i]=0;
-      }
-      if(fit_valueB[i]==0)
-	fit_valueA[i]|=0x8000;
-      else{
-	fit_valueA[look->loneighbor[i-2]]&=0x7fff;
-	fit_valueA[look->hineighbor[i-2]]&=0x7fff;
+	out[i]=val;
+	post[ln]&=0x7fff;
+	post[hn]&=0x7fff;
       }
     }
-
+    
     /* we have everything we need. pack it out */
     /* mark nontrivial floor */
-    if(writeflag){
-      oggpack_write(&vb->opb,1,1);
+    oggpack_write(&vb->opb,1,1);
       
-      /* beginning/end post */
-      look->frames++;
-      look->postbits+=ilog(look->quant_q-1)*2;
-      oggpack_write(&vb->opb,fit_valueA[0],ilog(look->quant_q-1));
-      oggpack_write(&vb->opb,fit_valueA[1],ilog(look->quant_q-1));
+    /* beginning/end post */
+    look->frames++;
+    look->postbits+=ilog(look->quant_q-1)*2;
+    oggpack_write(&vb->opb,out[0],ilog(look->quant_q-1));
+    oggpack_write(&vb->opb,out[1],ilog(look->quant_q-1));
       
       
-      /* partition by partition */
-      for(i=0,j=2;i<info->partitions;i++){
-	int class=info->partitionclass[i];
-	int cdim=info->class_dim[class];
-	int csubbits=info->class_subs[class];
-	int csub=1<<csubbits;
-	int bookas[8]={0,0,0,0,0,0,0,0};
-	int cval=0;
-	int cshift=0;
-	
-	/* generate the partition's first stage cascade value */
-	if(csubbits){
-	  int maxval[8];
-	  for(k=0;k<csub;k++){
-	    int booknum=info->class_subbook[class][k];
-	    if(booknum<0){
-	      maxval[k]=1;
-	    }else{
-	      maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
-	    }
+    /* partition by partition */
+    for(i=0,j=2;i<info->partitions;i++){
+      int class=info->partitionclass[i];
+      int cdim=info->class_dim[class];
+      int csubbits=info->class_subs[class];
+      int csub=1<<csubbits;
+      int bookas[8]={0,0,0,0,0,0,0,0};
+      int cval=0;
+      int cshift=0;
+      int k,l;
+
+      /* generate the partition's first stage cascade value */
+      if(csubbits){
+	int maxval[8];
+	for(k=0;k<csub;k++){
+	  int booknum=info->class_subbook[class][k];
+	  if(booknum<0){
+	    maxval[k]=1;
+	  }else{
+	    maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
           }
-	  for(k=0;k<cdim;k++){
-	    for(l=0;l<csub;l++){
-	      int val=fit_valueB[j+k];
-	      if(val<maxval[l]){
-		bookas[k]=l;
-		break;
-	      }
+	}
+	for(k=0;k<cdim;k++){
+	  for(l=0;l<csub;l++){
+	    int val=out[j+k];
+	    if(val<maxval[l]){
+	      bookas[k]=l;
+	      break;
             }
-	    cval|= bookas[k]<<cshift;
-	    cshift+=csubbits;
           }
-	  /* write it */
-	  look->phrasebits+=
+	  cval|= bookas[k]<<cshift;
+	  cshift+=csubbits;
+	}
+	/* write it */
+	look->phrasebits+=
           vorbis_book_encode(books+info->class_book[class],cval,&vb->opb);
+	
+#ifdef TRAIN_FLOOR1
+	{
+	  FILE *of;
+	  char buffer[80];
+	  sprintf(buffer,"line_%dx%ld_class%d.vqd",
+		  vb->pcmend/2,posts-2,class);
+	  of=fopen(buffer,"a");
+	  fprintf(of,"%d\n",cval);
+	  fclose(of);
+	}
+#endif
+      }
+	
+      /* write post values */
+      for(k=0;k<cdim;k++){
+	int book=info->class_subbook[class][bookas[k]];
+	if(book>=0){
+	  /* hack to allow training with 'bad' books */
+	  if(out[j+k]<(books+book)->entries)
+	    look->postbits+=vorbis_book_encode(books+book,
+					       out[j+k],&vb->opb);
+	  /*else
+	    fprintf(stderr,"+!");*/
           
 #ifdef TRAIN_FLOOR1
           {
             FILE *of;
             char buffer[80];
-	    sprintf(buffer,"line_%dx%ld_class%d.vqd",
-		    vb->pcmend/2,posts-2,class);
+	    sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
+		    vb->pcmend/2,posts-2,class,bookas[k]);
             of=fopen(buffer,"a");
-	    fprintf(of,"%d\n",cval);
+	    fprintf(of,"%d\n",out[j+k]);
             fclose(of);
           }
 #endif
         }
-	
-	/* write post values */
-	for(k=0;k<cdim;k++){
-	  int book=info->class_subbook[class][bookas[k]];
-	  if(book>=0){
-	    /* hack to allow training with 'bad' books */
-	    if(fit_valueB[j+k]<(books+book)->entries)
-	      look->postbits+=vorbis_book_encode(books+book,
-						 fit_valueB[j+k],&vb->opb);
-	    /*else
-	      fprintf(stderr,"+!");*/
-
-#ifdef TRAIN_FLOOR1
-	    {
-	      FILE *of;
-	      char buffer[80];
-	      sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
-		      vb->pcmend/2,posts-2,class,bookas[k]);
-	      of=fopen(buffer,"a");
-	      fprintf(of,"%d\n",fit_valueB[j+k]);
-	      fclose(of);
-	    }
-#endif
-	  }
-	}
-	j+=cdim;
       }
+      j+=cdim;
     }
-
+    
     {
       /* generate quantized floor equivalent to what we'd unpack in decode */
-      int hx;
+      /* render the lines */
+      int hx=0;
       int lx=0;
-      int ly=fit_valueA[0]*info->mult;
-
-      for(j=1;j<posts;j++){
+      int ly=post[0]*info->mult;
+      for(j=1;j<look->posts;j++){
         int current=look->forward_index[j];
-	if(!(fit_valueA[current]&0x8000)){
-	  int hy=(fit_valueA[current]&0x7fff)*info->mult;
-	  hx=info->postlist[current];
-	  
-	  render_line0(lx,hx,ly,hy,codedflr);
+	int hy=post[current]&0x7fff;
+	if(hy==post[current]){
           
+	  hy*=info->mult;
+	  hx=info->postlist[current];
+	
+	  render_line0(lx,hx,ly,hy,ilogmask);
+	
           lx=hx;
           ly=hy;
         }
       }
-      for(j=lx;j<vb->pcmend/2;j++)codedflr[j]=codedflr[j-1]; /* be certain */
-
-      /* use it to create residue vector.  Eliminate mdct elements
-         that were below the error training attenuation relative to
-         the original mask.  This avoids portions of the floor fit
-         that were considered 'unused' in fitting from being used in
-         coding residue if the unfit values are significantly below
-         the original input mask */
-
-      for(j=0;j<n;j++)
-	if(logmdct[j]+info->twofitatten<logmask[j])
-	  mdct[j]=0.f;
-      for(j=n;j<vb->pcmend/2;j++)mdct[j]=0.f;
-
-    }    
-
+      for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */    
+      for(j=n;j<vb->pcmend/2;j++)ilogmask[j]=0;
+      seq++;
+      return(1);
+    }
   }else{
-    if(writeflag)oggpack_write(&vb->opb,0,1);
-    memset(codedflr,0,n*sizeof(*codedflr));
-    memset(mdct,0,n*sizeof(*mdct));
+    oggpack_write(&vb->opb,0,1);
+    memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask));
+    seq++;
+    return(0);
   }
-  seq++;
-  return(nonzero);
 }
 
 static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
@@ -1037,7 +1074,6 @@
     fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
 
     /* partition by partition */
-    /* partition by partition */
     for(i=0,j=2;i<info->partitions;i++){
       int class=info->partitionclass[i];
       int cdim=info->class_dim[class];
@@ -1082,7 +1118,7 @@
           if(hiroom>loroom){
             val = val-loroom;
           }else{
-	  val = -1-(val-hiroom);
+	    val = -1-(val-hiroom);
           }
         }else{
           if(val&1){
@@ -1137,7 +1173,7 @@
         ly=hy;
       }
     }
-    for(j=hx;j<n;j++)out[j]*=ly; /* be certain */    
+    for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */    
     return(1);
   }
   memset(out,0,sizeof(*out)*n);
@@ -1147,6 +1183,7 @@
 /* export hooks */
 vorbis_func_floor floor1_exportbundle={
   &floor1_pack,&floor1_unpack,&floor1_look,&floor1_copy_info,&floor1_free_info,
-  &floor1_free_look,&floor1_forward,&floor1_inverse1,&floor1_inverse2
+  &floor1_free_look,&floor1_inverse1,&floor1_inverse2
 };
+
 

<p><p>1.53.4.1  +15 -20    vorbis/lib/info.c

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

<p><p>1.49.2.1  +298 -225  vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -r1.49 -r1.49.2.1
--- mapping0.c	2002/04/06 03:07:25	1.49
+++ mapping0.c	2002/05/07 23:47:13	1.49.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.49 2002/04/06 03:07:25 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.49.2.1 2002/05/07 23:47:13 xiphmont Exp $
 
  ********************************************************************/
 
@@ -44,13 +44,11 @@
   vorbis_info_mode *mode;
   vorbis_info_mapping0 *map;
 
-  vorbis_look_time **time_look;
   vorbis_look_floor **floor_look;
 
   vorbis_look_residue **residue_look;
   vorbis_look_psy *psy_look[2];
 
-  vorbis_func_time **time_func;
   vorbis_func_floor **floor_func;
   vorbis_func_residue **residue_func;
 
@@ -81,7 +79,6 @@
     drft_clear(&l->fft_look);
 
     for(i=0;i<l->map->submaps;i++){
-      l->time_func[i]->free_look(l->time_look[i]);
       l->floor_func[i]->free_look(l->floor_look[i]);
       l->residue_func[i]->free_look(l->residue_look[i]);
     }
@@ -93,10 +90,8 @@
       _vp_psy_clear(l->psy_look[0]);
       _ogg_free(l->psy_look[0]);
     }
-    _ogg_free(l->time_func);
     _ogg_free(l->floor_func);
     _ogg_free(l->residue_func);
-    _ogg_free(l->time_look);
     _ogg_free(l->floor_look);
     _ogg_free(l->residue_look);
     memset(l,0,sizeof(*l));
@@ -113,23 +108,17 @@
   vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
   look->mode=vm;
   
-  look->time_look=_ogg_calloc(info->submaps,sizeof(*look->time_look));
   look->floor_look=_ogg_calloc(info->submaps,sizeof(*look->floor_look));
 
   look->residue_look=_ogg_calloc(info->submaps,sizeof(*look->residue_look));
 
-  look->time_func=_ogg_calloc(info->submaps,sizeof(*look->time_func));
   look->floor_func=_ogg_calloc(info->submaps,sizeof(*look->floor_func));
   look->residue_func=_ogg_calloc(info->submaps,sizeof(*look->residue_func));
   
   for(i=0;i<info->submaps;i++){
-    int timenum=info->timesubmap[i];
     int floornum=info->floorsubmap[i];
     int resnum=info->residuesubmap[i];
 
-    look->time_func[i]=_time_P[ci->time_type[timenum]];
-    look->time_look[i]=look->time_func[i]->
-      look(vd,vm,ci->time_param[timenum]);
     look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
     look->floor_look[i]=look->floor_func[i]->
       look(vd,vm,ci->floor_param[floornum]);
@@ -216,7 +205,7 @@
       oggpack_write(opb,info->chmuxlist[i],4);
   }
   for(i=0;i<info->submaps;i++){
-    oggpack_write(opb,info->timesubmap[i],8);
+    oggpack_write(opb,0,8); /* time submap unused */
     oggpack_write(opb,info->floorsubmap[i],8);
     oggpack_write(opb,info->residuesubmap[i],8);
   }
@@ -259,8 +248,7 @@
     }
   }
   for(i=0;i<info->submaps;i++){
-    info->timesubmap[i]=oggpack_read(opb,8);
-    if(info->timesubmap[i]>=ci->times)goto err_out;
+    oggpack_read(opb,8); /* time submap unused */
     info->floorsubmap[i]=oggpack_read(opb,8);
     if(info->floorsubmap[i]>=ci->floors)goto err_out;
     info->residuesubmap[i]=oggpack_read(opb,8);
@@ -287,32 +275,45 @@
 static ogg_int64_t total=0;
 extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off);
 
+extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look,
+		       const float *logmdct,   /* in */
+		       const float *logmask);
+extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look,
+				   int *A,int *B,
+				   int del);
+extern int floor1_encode(vorbis_block *vb,vorbis_look_floor *look,
+			 int *post,int *ilogmask);
+
+
 static int mapping0_forward(vorbis_block *vb,vorbis_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;
-  bitrate_manager_state *bm=&b->bms;
   vorbis_look_mapping0  *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0  *info=look->map;
-  vorbis_info_mode      *mode=look->mode;
+  /*vorbis_info_mode      *mode=look->mode;*/
   vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal;
   int                    n=vb->pcmend;
-  int i,j;
-  int   *nonzero=alloca(sizeof(*nonzero)*vi->channels);
-
-  float *work=_vorbis_block_alloc(vb,n*sizeof(*work));
+  int i,j,k;
 
+  int    *nonzero    = alloca(sizeof(*nonzero)*vi->channels);
+  float  **gmdct     = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
+  int    **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
+  int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
+  
   float global_ampmax=vbi->ampmax;
   float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
   int blocktype=vbi->blocktype;
+  long setup_bits=0;
+
 
   /* 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 
+     transition block (the weird 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)
@@ -324,35 +325,41 @@
 
     /* the following makes things clearer to *me* anyway */
     float *pcm     =vb->pcm[i]; 
-    float *fft     =work;
-    float *logfft  =pcm+n/2;
+    float *logfft  =pcm;
 
-    /*float *res     =pcm;
-    float *mdct    =pcm;
-    float *codedflr=pcm+n/2;
-    float *logmax  =work;
-    float *logmask =work+n/2;*/
+    gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
 
     scale_dB=todB(&scale);
-    /*_analysis_output_always("pcm",seq+i,pcm,n,0,0,total-n/2);*/
 
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output_always("pcmL",seq,pcm,n,0,0,total-n/2);
+      else
+	_analysis_output_always("pcmR",seq,pcm,n,0,0,total-n/2);
+#endif
+  
     /* window the PCM data */
     _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
-    memcpy(fft,pcm,sizeof(*fft)*n);
-    
-    /*_analysis_output_always("windowed",seq+i,pcm,n,0,0,total-n/2);*/
+
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output_always("windowedL",seq,pcm,n,0,0,total-n/2);
+      else
+	_analysis_output_always("windowedR",seq,pcm,n,0,0,total-n/2);
+#endif
 
     /* transform the PCM data */
     /* only MDCT right now.... */
-    mdct_forward(b->transform[vb->W][0],pcm,pcm);
+    mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]);
     
     /* FFT yields more accurate tonal estimation (not phase sensitive) */
-    drft_forward(&look->fft_look,fft);
-    fft[0]*=scale;
-    logfft[0]=todB(fft);
+    drft_forward(&look->fft_look,pcm);
+    logfft[0]=scale_dB+todB(pcm);
     local_ampmax[i]=logfft[0];
     for(j=1;j<n-1;j+=2){
-      float temp=fft[j]*fft[j]+fft[j+1]*fft[j+1];
+      float temp=pcm[j]*pcm[j]+pcm[j+1]*pcm[j+1];
       temp=logfft[(j+1)>>1]=scale_dB+.5f*todB(&temp);
       if(temp>local_ampmax[i])local_ampmax[i]=temp;
     }
@@ -360,215 +367,285 @@
     if(local_ampmax[i]>0.f)local_ampmax[i]=0.f;
     if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i];
 
-    /*_analysis_output("fft",seq+i,logfft,n/2,1,0);*/
+#if 0
+    if(vi->channels==2)
+      if(i==0)
+	_analysis_output_always("fftL",seq,logfft,n/2,1,0,0);
+      else
+	_analysis_output_always("fftR",seq,logfft,n/2,1,0,0);
+#endif
+
   }
 
-  for(i=0;i<vi->channels;i++){
-    int submap=info->chmuxlist[i];
+  {
+    float   *noise        = _vorbis_block_alloc(vb,n/2*sizeof(*noise));
+    float   *tone         = _vorbis_block_alloc(vb,n/2*sizeof(*tone));
 
-    /* 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;
+    for(i=0;i<vi->channels;i++){
+      int submap=info->chmuxlist[i];
+      
+      /* the following makes things clearer to *me* anyway */
+      float *mdct    =gmdct[i];
+      float *logfft  =vb->pcm[i];
+      
+      float *logmdct =logfft+n/2;
+      float *logmask =logfft;
 
-    float *logmdct =work;
-    float *logmax  =mdct+n/2;
-    float *logmask =work+n/2;
+      floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts));
+      memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
+      
+      for(j=0;j<n/2;j++)
+	logmdct[j]=todB(mdct+j);
 
-    /*
-    for(j=0;j<n/2;j+=2){
-      logmdct[j>>1]=FABS(mdct+j)+FABS(mdct+j+1);
-      logmdct[j>>1]=todB(logmdct+(j>>1));
-    }
-    _analysis_output_always("mdct2",seq+i,logmdct,n/4,1,0,total-n/2);*/
+#if 0
+      if(vi->channels==2)
+	if(i==0)
+	  _analysis_output_always("mdctL",seq,logmdct,n/2,1,0,0);
+	else
+	  _analysis_output_always("mdctR",seq,logmdct,n/2,1,0,0);
+#endif 
 
+      /* first step; noise masking.  Not only does 'noise masking'
+         give us curves from which we can decide how much resolution
+         to give noise parts of the spectrum, it also implicitly hands
+         us a tonality estimate (the larger the value in the
+         'noise_depth' vector, the more tonal that area is) */
+
+      _vp_noisemask(look->psy_look[blocktype],
+		    logmdct,
+		    noise); /* noise does not have by-frequency offset
+                               bias applied yet */
+#if 0
+      if(vi->channels==2)
+	if(i==0)
+	  _analysis_output_always("noiseL",seq,noise,n/2,1,0,0);
+	else
+	  _analysis_output_always("noiseR",seq,noise,n/2,1,0,0);
+#endif
 
-    for(j=0;j<n/2;j++)
-      logmdct[j]=todB(mdct+j);
-    //_analysis_output_always("mdct",seq+i,logmdct,n/2,0,0,0);
+      /* second step: 'all the other crap'; all the stuff that isn't
+         computed/fit for bitrate management goes in the second psy
+         vector.  This includes tone masking, peak limiting and ATH */
+
+      _vp_tonemask(look->psy_look[blocktype],
+		   logfft,
+		   tone,
+		   global_ampmax,
+		   local_ampmax[i]);
+
+#if 0
+      if(vi->channels==2)
+	if(i==0)
+	  _analysis_output_always("toneL",seq,tone,n/2,1,0,0);
+	else
+	  _analysis_output_always("toneR",seq,tone,n/2,1,0,0);
+#endif
 
+      /* third step; we offset the noise vectors, overlay tone
+	 masking.  We then do a floor1-specific line fit.  If we're
+	 performing bitrate management, the line fit is performed
+	 multiple times for up/down tweakage on demand. */
+      
+      _vp_offset_and_mix(look->psy_look[blocktype],
+			 noise,
+			 tone,
+			 1,
+			 logmask);
+
+#if 0
+      if(vi->channels==2)
+	if(i==0)
+	  _analysis_output_always("mask1L",seq,logmask,n/2,1,0,0);
+	else
+	  _analysis_output_always("mask1R",seq,logmask,n/2,1,0,0);
+#endif
 
-    /* perform psychoacoustics; do masking */
-    _vp_compute_mask(look->psy_look[blocktype],
-		     logfft, /* -> logmax */
-		     logmdct,
-		     logmask,
-		     global_ampmax,
-		     local_ampmax[i],
-		     bm->avgnoise);
-
-    /*_analysis_output("mask",seq+i,logmask,n/2,1,0);*/
-    /* perform floor encoding */
-    nonzero[i]=look->floor_func[submap]->
-      forward(vb,look->floor_look[submap],
-	      mdct,
-	      logmdct,
-	      logmask,
-	      logmax,
-
-	      codedflr);
-
-
-    _vp_remove_floor(look->psy_look[blocktype],
-		     mdct,
-		     codedflr,
-		     res);
-
-    /*for(j=0;j<n/2;j++)
-      if(fabs(res[j])>1200){
-	analysis_noisy=1;
-	fprintf(stderr,"%ld ",seq+i);
-	}*/
+      /* this algorithm is hardwired to floor 1 for now; abort out if
+         we're *not* floor1.  This won't happen unless someone has
+         broken the encode setup lib.  Guard it anyway. */
+      if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
+
+      floor_posts[i][PACKETBLOBS/2]=
+	floor1_fit(vb,look->floor_look[submap],
+		   logmdct,
+		   logmask);
+      
+      /* are we managing bitrate?  If so, perform two more fits for
+         later rate tweaking (fits represent hi/lo) */
+      if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
+	/* higher rate by way of lower noise curve */
+	_vp_offset_and_mix(look->psy_look[blocktype],
+			   noise,
+			   tone,
+			   2,
+			   logmask);
+
+#if 0
+	if(vi->channels==2)
+	  if(i==0)
+	    _analysis_output_always("mask2L",seq,logmask,n/2,1,0,0);
+	  else
+	    _analysis_output_always("mask2R",seq,logmask,n/2,1,0,0);
+#endif
 
-    /*_analysis_output("codedflr",seq+i,codedflr,n/2,1,1);*/
+	floor_posts[i][PACKETBLOBS-1]=
+	  floor1_fit(vb,look->floor_look[submap],
+		     logmdct,
+		     logmask);
       
-  }
+	/* lower rate by way of higher noise curve */
+	_vp_offset_and_mix(look->psy_look[blocktype],
+			   noise,
+			   tone,
+			   0,
+			   logmask);
+
+#if 0
+	if(vi->channels==2)
+	  if(i==0)
+	    _analysis_output_always("mask0L",seq,logmask,n/2,1,0,0);
+	  else
+	    _analysis_output_always("mask0R",seq,logmask,n/2,1,0,0);
+#endif
 
+	floor_posts[i][0]=
+	  floor1_fit(vb,look->floor_look[submap],
+		     logmdct,
+		     logmask);
+	
+	/* we also interpolate a range of intermediate curves for
+           intermediate rates */
+	for(k=1;k<PACKETBLOBS/2;k++)
+	  floor_posts[i][k]=
+	    floor1_interpolate_fit(vb,look->floor_look[submap],
+				   floor_posts[i][0],
+				   floor_posts[i][PACKETBLOBS/2],
+				   k*65536/(PACKETBLOBS/2));
+	for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
+	  floor_posts[i][k]=
+	    floor1_interpolate_fit(vb,look->floor_look[submap],
+				   floor_posts[i][PACKETBLOBS/2],
+				   floor_posts[i][PACKETBLOBS-1],
+				   (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
+      }
+    }
+  }
   vbi->ampmax=global_ampmax;
 
-  /* partition based prequantization and channel coupling */
-  /* Steps in prequant and coupling:
+  /* now save the bit cursor in the write buffer */
+  setup_bits=oggpack_bits(&vb->opb);
 
-     classify by |mag| across all pcm vectors 
-
-     down-couple/down-quantize from perfect residue ->  quantized vector 
-     
-     do{ 
-        encode quantized vector; add encoded values to 'so-far' vector
-        more? [not yet at bitrate/not yet at target]
-          yes{
-              down-couple/down-quantize from perfect-'so-far' -> 
-	        quantized vector; when subtracting coupling, 
-		account for +/- out-of-phase component
-          }no{  
-              break
-          }
-     }
-     done.
-
-     quantization in each iteration is done (after circular normalization 
-     in coupling) using a by-iteration quantization granule value.
+  /*
+    the next phases are performed once for vbr-only and PACKETBLOB
+    times for bitrate managed modes.
+    
+    1) reset write buffer
+    2) encode the floor for each channel, compute coded mask curve/res
+    3) normalize and couple.
+    4) encode residue
+    5) save packet bytes to the packetblob vector
+    
   */
-   
-  {
-    float  **pcm=vb->pcm;
-    float  **quantized=alloca(sizeof(*quantized)*vi->channels);
-    float  **sofar=alloca(sizeof(*sofar)*vi->channels);
-
-    long  ***classifications=alloca(sizeof(*classifications)*info->submaps);
-    float ***qbundle=alloca(sizeof(*qbundle)*info->submaps);
-    float ***pcmbundle=alloca(sizeof(*pcmbundle)*info->submaps);
-    float ***sobundle=alloca(sizeof(*sobundle)*info->submaps);
-    int    **zerobundle=alloca(sizeof(*zerobundle)*info->submaps);
-    int     *chbundle=alloca(sizeof(*chbundle)*info->submaps);
-    int      chcounter=0;
 
-    /* play a little loose with this abstraction */
-    int   quant_passes=ci->coupling_passes;
+  /* iterate over the many masking curve fits we've created */
 
-    for(i=0;i<vi->channels;i++){
-      quantized[i]=_vorbis_block_alloc(vb,n*sizeof(*sofar[i]));
-      sofar[i]=quantized[i]+n/2;
-      memset(sofar[i],0,sizeof(*sofar[i])*n/2);
-    }
-
-    qbundle[0]=alloca(sizeof(*qbundle[0])*vi->channels);
-    pcmbundle[0]=alloca(sizeof(*pcmbundle[0])*vi->channels);
-    sobundle[0]=alloca(sizeof(*sobundle[0])*vi->channels);
-    zerobundle[0]=alloca(sizeof(*zerobundle[0])*vi->channels);
-
-    /* initial down-quantized coupling */
+  {
+    float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels);
+    float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
+    int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
+
+    float **mag_memo=
+      _vp_quantize_couple_memo(vb,
+			       look->psy_look[blocktype],
+			       info,
+			       gmdct);    
     
-    if(info->coupling_steps==0){
-      /* this assumes all or nothing coupling right now.  it should pass
-	 through any channels left uncoupled, but it doesn't do that now */
+    for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
+	k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
+	k++){
+
+      /* Abuse the bitpacker abstraction slightly by storing multiple
+         packets in one packbuffer. */      
+      if(vorbis_bitrate_managed(vb) && k){
+	oggpack_writecopy(&vb->opb,
+			  oggpack_get_buffer(&vb->opb),
+			  setup_bits);
+      }
+
+      /* encode floor, compute masking curve, sep out residue */
       for(i=0;i<vi->channels;i++){
-	float *lpcm=pcm[i];
-	float *lqua=quantized[i];
-	for(j=0;j<n/2;j++)
-	  lqua[j]=lpcm[j];
+	int submap=info->chmuxlist[i];
+	float *mdct    =gmdct[i];
+	float *res     =vb->pcm[i];
+	int   *ilogmask=ilogmaskch[i]=
+	  _vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
+      
+	nonzero[i]=floor1_encode(vb,look->floor_look[submap],
+				 floor_posts[i][k],
+				 ilogmask);
+#if 0
+	{
+	  char buf[80];
+	  sprintf(buf,"maskI%d",k);
+	  _analysis_output_always(buf,seq+i,mask,n/2,1,1,0);
+	}
+#endif
+	_vp_remove_floor(look->psy_look[blocktype],
+			 mdct,
+			 ilogmask,
+			 res);
+
+#if 0
+	{
+	  char buf[80];
+	  sprintf(buf,"resI%d",k);
+	  _analysis_output_always(buf,seq+i,res,n/2,1,1,0);
+	}
+#endif
       }
-    }else{
+      
+      /* our iteration is now based on masking curve, not prequant and
+	 coupling.  Only one prequant/coupling step */
+      
+      /* quantize/couple */
       _vp_quantize_couple(look->psy_look[blocktype],
                           info,
-			  pcm,
-			  sofar,
-			  quantized,
-			  nonzero,
-			  0);
-    }
-
-    /* classify, by submap */
-
-    for(i=0;i<info->submaps;i++){
-      int ch_in_bundle=0;
-      qbundle[i]=qbundle[0]+chcounter;
-      sobundle[i]=sobundle[0]+chcounter;
-      zerobundle[i]=zerobundle[0]+chcounter;
-
-      for(j=0;j<vi->channels;j++){
-	if(info->chmuxlist[j]==i){
-	  if(nonzero[j])
-	    zerobundle[i][ch_in_bundle]=1;
-	  else
-	    zerobundle[i][ch_in_bundle]=0;
-	  qbundle[i][ch_in_bundle]=quantized[j];
-	  pcmbundle[i][ch_in_bundle]=pcm[j];
-	  sobundle[i][ch_in_bundle++]=sofar[j];
+			  vb->pcm,
+			  mag_memo,
+			  ilogmaskch,
+			  nonzero
+			  );
+      
+      /* classify and encode by submap */
+      for(i=0;i<info->submaps;i++){
+	int ch_in_bundle=0;
+	long **classifications;
+
+	for(j=0;j<vi->channels;j++){
+	  if(info->chmuxlist[j]==i){
+	    zerobundle[ch_in_bundle]=0;
+	    if(nonzero[j])zerobundle[ch_in_bundle]=1;
+	    res_bundle[ch_in_bundle]=vb->pcm[j];
+	    couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
+	  }
         }
-      }
-      chbundle[i]=ch_in_bundle;
-      chcounter+=ch_in_bundle;
-
-      classifications[i]=look->residue_func[i]->
-	class(vb,look->residue_look[i],pcmbundle[i],zerobundle[i],chbundle[i]);
-    }
-
-    /* actual encoding loop; we pack all the iterations to collect
-       management data */
-
-    for(i=0;i<quant_passes;){
-
-      /* perform residue encoding of this pass's quantized residue
-         vector, according residue mapping */
-    
-      for(j=0;j<info->submaps;j++){
-	look->residue_func[j]->
-	  forward(vb,look->residue_look[j],
-		  qbundle[j],sobundle[j],zerobundle[j],chbundle[j],
-		  i,classifications[j],vbi->packet_markers);
         
-      }
-      i++;
+	classifications=look->residue_func[i]->
+	  class(vb,look->residue_look[i],
+		res_bundle,zerobundle,ch_in_bundle);
         
-      if(i<quant_passes){
-	/* down-couple/down-quantize from perfect-'so-far' -> 
-	 new quantized vector */
-	if(info->coupling_steps==0){
-	  /* this assumes all or nothing coupling right now.  it should pass
-	     through any channels left uncoupled, but it doesn't do that now */
-	  int k;
-	  for(k=0;k<vi->channels;k++){
-	    float *lpcm=pcm[k];
-	    float *lsof=sofar[k];
-	    float *lqua=quantized[k];
-	    for(j=0;j<n/2;j++)
-	      lqua[j]=lpcm[j]-lsof[j];
-	  }
-	}else{
-
-	  _vp_quantize_couple(look->psy_look[blocktype],
-			      info,
-			      pcm,
-			      sofar,
-			      quantized,
-			      nonzero,
-			      i);
-	}
+	look->residue_func[i]->
+	  forward(vb,look->residue_look[i],
+		  couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
       }
+      
+      /* ok, done encoding.  Mark this protopacket and prepare next. */
+      oggpack_writealign(&vb->opb);
+      vbi->packetblob_markers[k]=oggpack_bytes(&vb->opb);
+      
     }
-    seq+=vi->channels;
+    
+    seq++;
   } 
 
   total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4;
@@ -583,7 +660,7 @@
   backend_lookup_state *b=vd->backend_state;
   vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0 *info=look->map;
-  vorbis_info_mode     *mode=look->mode;
+  /*vorbis_info_mode     *mode=look->mode;*/
   int                   i,j;
   long                  n=vb->pcmend=ci->blocksizes[vb->W];
 
@@ -593,11 +670,6 @@
   int   *nonzero  =alloca(sizeof(*nonzero)*vi->channels);
   void **floormemo=alloca(sizeof(*floormemo)*vi->channels);
   
-  /* time domain information decode (note that applying the
-     information would have to happen later; we'll probably add a
-     function entry to the harness for that later */
-  /* NOT IMPLEMENTED */
-
   /* recover the spectral envelope; store it in the PCM vector for now */
   for(i=0;i<vi->channels;i++){
     int submap=info->chmuxlist[i];
@@ -670,6 +742,7 @@
     int submap=info->chmuxlist[i];
     look->floor_func[submap]->
       inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
+    //_analysis_output_always("out",seq++,pcm,n/2,1,1,0);
   }
 
   /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */

<p><p>1.21.6.1  +150 -169  vorbis/lib/masking.h

Index: masking.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/masking.h,v
retrieving revision 1.21
retrieving revision 1.21.6.1
diff -u -r1.21 -r1.21.6.1
--- masking.h	2001/12/22 09:40:39	1.21
+++ masking.h	2002/05/07 23:47:14	1.21.6.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: masking curve data for psychoacoustics
- last mod: $Id: masking.h,v 1.21 2001/12/22 09:40:39 xiphmont Exp $
+ last mod: $Id: masking.h,v 1.21.6.1 2002/05/07 23:47:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -35,184 +35,165 @@
 #define EHMER_OFFSET 16
 #define EHMER_MAX 56
 
-static float tone_125_40dB_SL[EHMER_MAX]={
-  20,  20,  20,  20,  20,  20,  20,  20,   20, 20, 20, 20, 20, 20, 20, 20,  
-  20,  18,  16,  14,  12,  11,   9,   7,    5,  3,  2,  0, -2, -4, -6, -8,
- -10, -12, -14, -16, -18, -20, -900, -900,  -900,-900,-900,-900,-900,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_125_60dB_SL[EHMER_MAX]={
-  40,  40,  40,  40,  40,  40,  40,  40,   40, 40, 40, 40, 40, 40, 40, 40,  
-  40,  38,  36,  34,  32,  31,  29,  27,   25, 23, 22, 20, 18, 16, 14, 12,
-  10,   8,   6,   4,   2,   0,  -3,  -5,   -8,-10,-14,-17,-20,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_125_80dB_SL[EHMER_MAX]={
-  60,  60,  60,  60,  60,  60,  60,  60,   60, 60, 60, 60, 60, 60, 60, 60,  
-  60,  58,  56,  54,  52,  51,  49,  47,   45, 43, 42, 40, 38, 36, 34, 32,
-  30,  28,  26,  24,  22,  20,  17,  15,   12, 10,  6,  3,  0, -4, -8,-12,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_125_100dB_SL[EHMER_MAX]={
-  78,  78,  78,  78,  78,  78,  78,  78,   78, 78, 78, 78, 78, 78, 78, 78,  
-  78,  77,  75,  74,  73,  72,  71,  70,   69, 68, 67, 65, 64, 63, 62, 60,
-  58,  57,  55,  54,  52,  50,  48,  46,   44, 42, 40, 38, 36, 34, 31, 29,  
-  27,  24,  22,  20,  18,  15,  13,  11};
-
-static float tone_250_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,   -19, -13,  -7,  -1,   4,   9,  15,  20,
-  22,  23,  22,  19,  18,  18,  16,  13,     9,   7,   3,   1,  -1,  -3,  -6,  -8,
- -10, -13, -16, -19,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_250_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,   -5,  1,  7, 13, 19, 25, 30, 33,  
-  36,  39,  38,  37,  38,  39,  39,  40,   38, 36, 35, 34, 33, 31, 29, 28,
-  28,  28,  25,  20,  14,  10,   5,   0,   -5,-10,-15,-20,-900,-900,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_250_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,   10, 17, 24, 30, 37, 41, 48, 49,  
-  50,  53,  54,  53,  53,  54,  55,  57,   57, 57, 58, 59, 60, 58, 57, 58,
-  59,  58,  57,  54,  52,  50,  49,  47,   46, 47, 46, 44, 43, 42, 41, 40,  
-  38,  32,  27,  22,  17,  11,   6,   0};
+static float tone_125[4][EHMER_MAX]={
+  {  20,  20,  20,  20,  20,  20,  20,  20,   20, 20, 20, 20, 20, 20, 20, 20,  
+     20,  18,  16,  14,  12,  11,   9,   7,    5,  3,  2,  0, -2, -4, -6, -8,
+    -10, -12, -14, -16, -18, -20, -23, -26,  -30,-900,-900,-900,-900,-900,-900,-900,  
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {  40,  40,  40,  40,  40,  40,  40,  40,   40, 40, 40, 40, 40, 40, 40, 40,  
+     40,  38,  36,  34,  32,  31,  29,  27,   25, 23, 22, 20, 18, 16, 14, 12,
+     10,   8,   6,   4,   2,   0,  -3,  -5,   -8,-10,-14,-17,-20,-24,-28,-900,  
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {  60,  60,  60,  60,  60,  60,  60,  60,   60, 60, 60, 60, 60, 60, 60, 60,  
+     60,  58,  56,  54,  52,  51,  49,  47,   45, 43, 42, 40, 38, 36, 34, 32,
+     30,  28,  26,  24,  22,  20,  17,  15,   12, 10,  6,  3,  0, -4, -8,-12,  
+    -16, -20, -25, -30, -35, -40,-900,-900},
+  {  78,  78,  78,  78,  78,  78,  78,  78,   78, 78, 78, 78, 78, 78, 78, 78,  
+     78,  77,  75,  74,  73,  72,  71,  70,   69, 68, 67, 65, 64, 63, 62, 60,
+     58,  57,  55,  54,  52,  50,  48,  46,   44, 42, 40, 38, 36, 34, 31, 29,  
+     27,  24,  22,  20,  18,  15,  13,  11}
+};
+
+static float tone_250[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,   -19, -13,  -7,  -1,   4,   9,  15,  20,
+     22,  23,  22,  19,  18,  18,  16,  13,     9,   7,   3,   1,  -1,  -3,  -6,  -8,
+    -10, -13, -16, -19,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900, -10,   -5,  1,  7, 13, 19, 25, 30, 33,  
+     36,  39,  38,  37,  38,  39,  39,  40,   37, 36, 35, 34, 33, 31, 29, 28,
+     28,  25,  24,  18,  12,   5,  -7, -15,  -25,-35,-45,-55,-65,-900,-900,-900,  
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900, -10,   10, 17, 24, 30, 37, 41, 48, 49,  
+     50,  53,  54,  53,  53,  54,  55,  57,   57, 57, 58, 59, 60, 58, 57, 58,
+     59,  58,  57,  54,  52,  50,  49,  47,   46, 47, 46, 44, 43, 42, 41, 40,  
+     38,  32,  27,  22,  17,  11,   6,   0},
 /* no data, just interpolated from 80 */
-static float tone_250_100dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,   15, 25, 34, 40, 50, 56, 60, 70,  
-  70,  73,  74,  73,  73,  74,  75,  77,   77, 77, 78, 79, 80, 78, 77, 78,
-  79,  78,  77,  74,  72,  70,  69,  67,   66, 67, 66, 64, 63, 62, 61, 60,  
-  58,  52,  47,  42,  37,  31,  26,  20};
-
-static float tone_500_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900, -20, -14,  -8,  -2,   4,  10,  17,
-  23,  16,  12,   9,   6,   3,   0,  -3,    -7, -10, -13, -16, -20,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_500_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,   -18, -12,  -6,   0,   6,  13,  20,  30,
-  39,  34,  31,  29,  29,  27,  24,  21,    18,  16,  13,   8,   6,   3,   1,  -1,
-  -5,  -2,  -5,  -8, -12, -15, -18,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_500_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900, -900,-16,-10,  0, 10, 20, 32, 43,  
-  53,  52,  52,  50,  49,  50,  52,  55,   55, 54, 51, 49, 46, 44, 44, 42,
-  38,  34,  32,  29,  29,  28,  25,  23,   20, 16, 10,  7,  4,  2, -1, -4,  
-  -7, -10, -15, -20,-900,-900,-900,-900};
-static float tone_500_100dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,   -7,  2, 10, 19, 27, 35, 55, 56,  
-  62,  61,  60,  58,  57,  57,  59,  63,   65, 66, 62, 60, 57, 57, 58, 58,
-  57,  56,  56,  56,  57,  57,  56,  57,   57, 54, 47, 41, 37, 28, 21, 16,  
-  10,   3,  -3,  -8, -13, -18,-900,-900};
-
-static float tone_1000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900, -20, -10,  0,   9,  20,
-  27,  20,  13,  14,  13,   5,  -1,  -6,   -11, -20,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_1000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-13,-3,  7,  17,  25,  37,
-  42,  33,  25,  25,  23,  18,  13,   9,     4, -1, -7,-13,-18, -23, -28, -33,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_1000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-14, -4,  6, 16, 27, 33, 50,  
-  59,  57,  47,  41,  40,  43,  47,  48,    47, 42, 39, 37, 37, 36, 35, 32,
-  30,  27,  21,  15,   5,  -2, -10, -18,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_1000_100dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-10,  0, 10, 23, 33, 45, 60,  
-  70,  72,  55,  49,  43,  40,  44,  54,    59, 58, 49, 43, 52, 57, 57, 58,
-  58,  54,  49,  47,  42,  39,  33,  28,    20, 15,  5,  0, -5,-15,-900,-900,  
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_2000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   5,  12,  20,
-  24,  14,   8,   0,  -5,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_2000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   8,  19,  31,
-  38,  30,  15,  15,  15,  13,   8,   5,    -2,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_2000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   2,  10,  22,  38,
-  52,  51,  40,  30,  28,  30,  33,  37,    37,  35,  31,  26,  20,  15,  10,   5,
-   0,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_2000_100dB_SL[EHMER_MAX]={  
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   6,  20,  40,  55,
-  66,  60,  53,  40,  35,  31,  34,  42,    58,  48,  43,  45,  52,  57,  50,  42,
-  45,  45,  35,  25,  20,  11,   2,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_4000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   2,   4,  18,
-  24,  10,   5,   0,  -5,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_4000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   2,   4,  20,
-  38,  30,  22,  15,  10,   5,   0, -10,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_4000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   0,   4,  10,  35,
-  51,  49,  35,  35,  36,  36,  36,  31,    25,  20,  10,   0,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-
-static float tone_4000_100dB_SL[EHMER_MAX]={
--900,  -5,   1,   3,   5,   8,  10,  12,    14,  20,  26,  28,  32,  36,  41,  51,
-  61,  59,  45,  45,  48,  48,  40,  25,    40,  30,  18,   5,  0, -900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
+  {-900,-900,-900,-900,-900,-900,-900, -10,   15, 25, 34, 40, 50, 56, 60, 70,  
+     70,  73,  74,  73,  73,  74,  75,  77,   77, 77, 78, 79, 80, 78, 77, 78,
+     79,  78,  77,  74,  72,  70,  69,  67,   66, 67, 66, 64, 63, 62, 61, 60,  
+     58,  52,  47,  42,  37,  31,  26,  20},
+};
+
+static float tone_500[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900, -20, -14,  -8,  -2,   4,  10,  17,
+     23,  16,  12,   9,   6,   3,   0,  -3,    -7, -10, -13, -16, -20,-25,-30,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,   -18, -12,  -6,   0,   6,  13,  20,  30,
+     39,  34,  31,  29,  29,  27,  24,  21,    18,  16,  13,   8,   6,   3,   1,  -1,
+     -5,  -2,  -5,  -8, -12, -15, -18, -25,   -30, -35, -40, -45,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900, -900,-16,-10,  0, 10, 20, 32, 43,  
+     53,  52,  52,  50,  49,  50,  52,  55,   55, 54, 51, 49, 46, 44, 44, 42,
+     38,  34,  32,  29,  29,  28,  25,  23,   20, 16, 10,  7,  4,  2, -1, -4,  
+     -7, -10, -15, -20, -25, -30,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900, -10,   -7,  2, 10, 19, 27, 35, 55, 56,  
+     62,  61,  60,  58,  57,  57,  59,  63,   65, 66, 62, 60, 57, 57, 58, 58,
+     57,  56,  56,  56,  57,  57,  56,  57,   57, 54, 47, 41, 37, 28, 21, 16,  
+     10,   3,  -3,  -8, -13, -18, -22,-900}
+};
+
+static float tone_1000[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900, -20, -10,  0,   9,  20,
+     27,  20,  13,  14,  13,   5,  -1,  -6,   -11, -20, -30,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-13,-3,  7,  17,  25,  37,
+     42,  33,  25,  25,  23,  18,  13,   9,     4, -1, -7,-13,-18, -23, -28, -33,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900, -14, -4,  6, 16, 27, 33, 50,  
+     59,  57,  47,  41,  40,  43,  47,  48,    47,  42, 39, 37, 37, 36, 35, 32,
+     30,  27,  21,  15,   5,  -2, -10, -18,   -26, -32,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-10,  0, 10, 23, 33, 45, 60,  
+     70,  72,  55,  49,  43,  40,  44,  54,    59, 58, 49, 43, 52, 57, 57, 58,
+     58,  54,  49,  47,  42,  39,  33,  28,    20, 15,  5,  0, -5,-15,-25,-900,  
+   -900,-900,-900,-900,-900,-900,-900,-900}
+};
+
+static float tone_2000[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   5,  12,  20,
+     24,  14,   8,   0,  -5, -15, -25, -35,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   8,  19,  31,
+     38,  30,  15,  15,  15,  13,   8,   5,    -2, -10, -20, -30, -40, -50,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   2,  10,  22,  38,
+     52,  51,  40,  30,  28,  30,  33,  37,    37,  35,  31,  26,  20,  15,  10,   5,
+      0,  -5, -10, -20, -30, -40, -50,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   6,  20,  40,  55,
+     66,  60,  53,  40,  35,  31,  34,  42,    58,  48,  43,  45,  52,  57,  50,  42,
+     45,  45,  35,  25,  20,  11,   2,  -8,   -18,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900}
+};
+
+static float tone_4000[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,   2,   4,  18,
+     24,  10,   5,   0,  -5, -12, -20, -30,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,  -2,   2,   4,  20,
+     38,  30,  22,  15,  10,   5,   0, -10,   -15, -25, -35,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,   0,   4,  10,  35,
+     51,  49,  35,  35,  36,  36,  36,  31,    25,  20,  10,   0, -10, -20,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,  -5,   1,   3,   5,   8,  10,  12,    14,  20,  26,  28,  32,  36,  41,  51,
+     61,  59,  45,  45,  48,  48,  40,  25,    40,  30,  18,   5,  0,  -10, -20,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900}
+};
 
 
 /* here the data collected by ehmer is clearly suspect as I have
    several samples that provide counterexamples.  the data below is
    derated from Ehmers original numbers */
 
-static float tone_8000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
-  26,  21,  14,   5,   0,  0,   0,    0,    20,  35,  55,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70, 70,  70,   70,  -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,  5,   12,  30,
-  43,  34,  22,  15,  10,   5,   0,   0,    20,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
-  63,  50,  35,  35,  36,  36,  36,  31,    40,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
- -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_8000_100dB_SL[EHMER_MAX]={
- -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
-  70,  50,  30,  30,  30,  30,  30,  32,    43,  55,  70,  70,  70,  70,  70,  70,
-  70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
+static float tone_8000[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
+     26,  21,  14,   5,   0,  0,   0,    0,    20,  35,  55,  70,  70,  70,  70,  70,
+     70,  70,  70,  70,  70, 70,  70,   70,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   5,  12,  30,
+     43,  34,  22,  15,  10,   5,   0,   0,    20,  55,  70,  70,  70,  70,  70,  70,
+     70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
+     63,  50,  35,  35,  36,  36,  36,  31,    40,  55,  70,  70,  70,  70,  70,  70,
+     70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  { -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
+     70,  50,  30,  30,  30,  30,  30,  32,    43,  55,  70,  70,  70,  70,  70,  70,
+     70,  70,  70,  70,  70,  70,  70,  70,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900}
+};
 
 /* a complete guess, but reasonably conservative and borne out by some
    empirical testing */
 
-static float tone_16000_40dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
-  26,  35,  55,  70,  70,  70,  70,  70,   70,  70,  70,  70,  70, 70,  70,  70, 
--900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900,
--900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_60dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,  5,   12,  30,
-  43,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_80dB_SL[EHMER_MAX]={
--900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
-  63,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
- -900,-900,-900,-900,-900,-900,-900,-900};
-static float tone_16000_100dB_SL[EHMER_MAX]={
- -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
-  70,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
--900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
-  -900,-900,-900,-900,-900,-900,-900,-900};
+static float tone_16000[4][EHMER_MAX]={
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   3,  10,  18,
+     26,  35,  55,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70, 
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900, -10,   5,  12,  30,
+     43,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  {-900,-900,-900,-900,-900,-900,-900, -10,    -1,   2,   6,  10,  13,  19,  25,  35,
+     63,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900},
+  { -18, -12,  -7,  -3,   0,   2,   5,   8,    10,  14,  18,  20,  20,  22,  40,  40,
+     70,  55,  70,  70,  70,  70,  70,  70,    70,  70,  70,  70,  70,  70,  70,  70,
+   -900,-900,-900,-900,-900,-900,-900,-900,  -900,-900,-900,-900,-900,-900,-900,-900,
+   -900,-900,-900,-900,-900,-900,-900,-900}
+};
 
 #endif

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

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.29
retrieving revision 1.29.4.1
diff -u -r1.29 -r1.29.4.1
--- mdct.c	2002/01/22 08:06:07	1.29
+++ mdct.c	2002/05/07 23:47:14	1.29.4.1
@@ -12,7 +12,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.29 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.29.4.1 2002/05/07 23:47:14 xiphmont Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -96,11 +96,6 @@
   REG_TYPE r1   = x[6] - x[2];
   REG_TYPE r2   = x[4] + x[0];
   REG_TYPE r3   = x[4] - x[0];
-
-           r0   = x[6] + x[2];
-	   r1   = x[6] - x[2];
-	   r2   = x[4] + x[0];
-	   r3   = x[4] - x[0];
 
            x[6] = r0   + r2;
            x[4] = r0   - r2;

<p><p>1.67.2.1  +436 -293  vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.67
retrieving revision 1.67.2.1
diff -u -r1.67 -r1.67.2.1
--- psy.c	2002/03/24 21:04:01	1.67
+++ psy.c	2002/05/07 23:47:14	1.67.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.67 2002/03/24 21:04:01 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.67.2.1 2002/05/07 23:47:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -109,13 +109,20 @@
     c[i]+=att;
 }
 
-static void interp_curve(float *c,float *c1,float *c2,float del){
-  int i;
-  for(i=0;i<EHMER_MAX;i++)
-    c[i]=c2[i]*del+c1[i]*(1.f-del);
+extern int analysis_noisy;
+
+static void odd_decade_level_interpolate(float **c){
+  int i,j;
+
+  for(i=1;i<P_LEVELS;i+=2)
+    for(j=0;j<EHMER_MAX;j++)
+      if(c[i-1][j+2]>-200 || c[i+1][j+2]>-200){
+	c[i][j+2]=(c[i-1][j+2]+c[i+1][j+2])/2;
+      }else{
+	c[i][j+2]=-900;
+      }
 }
 
-extern int analysis_noisy;
 static void setup_curve(float **c,
                         int band,
                         float *curveatt_dB){
@@ -124,9 +131,6 @@
   float tempc[P_LEVELS][EHMER_MAX];
   float *ATH=ATH_Bark_dB_lspconservative; /* just for limiting here */
 
-  memcpy(c[0]+2,c[4]+2,sizeof(*c[0])*EHMER_MAX);
-  memcpy(c[2]+2,c[4]+2,sizeof(*c[2])*EHMER_MAX);
-
   /* we add back in the ATH to avoid low level curves falling off to
      -infinity and unnecessarily cutting off high level curves in the
      curve limiting (last step).  But again, remember... a half-band's
@@ -158,12 +162,6 @@
     ath[i]=min(ath_min,ath_max);
   }
 
-  /* The c array comes in as dB curves at 20 40 60 80 100 dB.
-     interpolate intermediate dB curves */
-  for(i=1;i<P_LEVELS;i+=2){
-    interp_curve(c[i]+2,c[i-1]+2,c[i+1]+2,.5);
-  }
-
   /* normalize curves so the driving amplitude is 0dB */
   /* make temp curves with the ATH overlayed */
   for(i=0;i<P_LEVELS;i++){
@@ -172,7 +170,7 @@
     attenuate_curve(tempc[i],-i*10.f);
     max_curve(tempc[i],c[i]+2);
   }
-
+  
   /* Now limit the louder curves.
 
      the idea is this: We don't know what the playback attenuation
@@ -201,6 +199,7 @@
     c[j][1]=i;
 
   }
+
 }
 
 void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
@@ -245,8 +244,6 @@
     p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
   p->tonecurves=_ogg_malloc(P_BANDS*sizeof(*p->tonecurves));
-  p->noisethresh=_ogg_malloc(n*sizeof(*p->noisethresh));
-  p->noiseoffset=_ogg_malloc(n*sizeof(*p->noiseoffset));
   for(i=0;i<P_BANDS;i++)
     p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(*p->tonecurves[i]));
   
@@ -255,71 +252,84 @@
       p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(*p->tonecurves[i][j]));
   
 
-  /* OK, yeah, this was a silly way to do it */
-  memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[0][4])*EHMER_MAX);
-  memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[0][6])*EHMER_MAX);
-  memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[0][8])*EHMER_MAX);
-  memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[0][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[2][4])*EHMER_MAX);
-  memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[2][6])*EHMER_MAX);
-  memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[2][8])*EHMER_MAX);
-  memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[2][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(*p->tonecurves[4][4])*EHMER_MAX);
-  memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(*p->tonecurves[4][6])*EHMER_MAX);
-  memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(*p->tonecurves[4][8])*EHMER_MAX);
-  memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(*p->tonecurves[4][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(*p->tonecurves[6][4])*EHMER_MAX);
-  memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(*p->tonecurves[6][6])*EHMER_MAX);
-  memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(*p->tonecurves[6][8])*EHMER_MAX);
-  memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(*p->tonecurves[6][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(*p->tonecurves[8][4])*EHMER_MAX);
-  memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(*p->tonecurves[8][6])*EHMER_MAX);
-  memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(*p->tonecurves[8][8])*EHMER_MAX);
-  memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(*p->tonecurves[8][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(*p->tonecurves[10][4])*EHMER_MAX);
-  memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(*p->tonecurves[10][6])*EHMER_MAX);
-  memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(*p->tonecurves[10][8])*EHMER_MAX);
-  memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(*p->tonecurves[10][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(*p->tonecurves[12][4])*EHMER_MAX);
-  memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(*p->tonecurves[12][6])*EHMER_MAX);
-  memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(*p->tonecurves[12][8])*EHMER_MAX);
-  memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(*p->tonecurves[12][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[14][4])*EHMER_MAX);
-  memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[14][6])*EHMER_MAX);
-  memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[14][8])*EHMER_MAX);
-  memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[14][10])*EHMER_MAX);
-
-  memcpy(p->tonecurves[16][4]+2,tone_16000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX);
-  memcpy(p->tonecurves[16][6]+2,tone_16000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX);
-  memcpy(p->tonecurves[16][8]+2,tone_16000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX);
-  memcpy(p->tonecurves[16][10]+2,tone_16000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[0][i]+2,tone_125[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[2][i]+2,tone_125[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[4][i]+2,tone_250[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[6][i]+2,tone_500[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[8][i]+2,tone_1000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[10][i]+2,tone_2000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[12][i]+2,tone_4000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[14][i]+2,tone_8000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
+  for(i=0;i<P_LEVELS;i+=2)
+    memcpy(p->tonecurves[16][i]+2,tone_16000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX);
 
   for(i=0;i<P_BANDS;i+=2)
-    for(j=4;j<P_LEVELS;j+=2)
+    for(j=0;j<P_LEVELS;j+=2)
       for(k=2;k<EHMER_MAX+2;k++)
         p->tonecurves[i][j][k]+=vi->tone_masteratt;
 
+  for(i=0;i<P_BANDS;i+=2)
+    odd_decade_level_interpolate(p->tonecurves[i]);
+
   /* interpolate curves between */
   for(i=1;i<P_BANDS;i+=2)
-    for(j=4;j<P_LEVELS;j+=2){
-      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(*p->tonecurves[i][j]));
+    for(j=0;j<P_LEVELS;j++){
+      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(***p->tonecurves));
       /*interp_curve(p->tonecurves[i][j],
                    p->tonecurves[i-1][j],
                    p->tonecurves[i+1][j],.5);*/
       min_curve(p->tonecurves[i][j]+2,p->tonecurves[i+1][j]+2);
     }
 
+  analysis_noisy=0;
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_1.4kHz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_2.8kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
+  for(i=0;i<P_LEVELS;i++)
+    _analysis_output("precurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
+
   /* set up the final curves */
   for(i=0;i<P_BANDS;i++)
     setup_curve(p->tonecurves[i],i,vi->toneatt.block[i]);
 
+  analysis_noisy=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++)
@@ -485,8 +495,13 @@
     _analysis_output("fcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0);
   for(i=0;i<P_LEVELS;i++)
     _analysis_output("fcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0);
+  analysis_noisy=0;
 
   /* set up rolling noise median */
+  p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
+  for(i=0;i<P_NOISECURVES;i++)
+    p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
+  
   for(i=0;i<n;i++){
     float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
     int inthalfoc;
@@ -496,14 +511,18 @@
     if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
     inthalfoc=(int)halfoc;
     del=halfoc-inthalfoc;
-    p->noiseoffset[i]=
-      p->vi->noiseoff[inthalfoc]*(1.-del) + 
-      p->vi->noiseoff[inthalfoc+1]*del;
+    
+    for(j=0;j<P_NOISECURVES;j++)
+      p->noiseoffset[j][i]=
+	p->vi->noiseoff[j][inthalfoc]*(1.-del) + 
+	p->vi->noiseoff[j][inthalfoc+1]*del;
+    
   }
 
-  analysis_noisy=1;
-  _analysis_output("noiseoff",0,p->noiseoffset,n,1,0);
-  _analysis_output("noisethresh",0,p->noisethresh,n,1,0);
+  analysis_noisy=0;
+  //_analysis_output_always("noiseoff0",n,p->noiseoffset[0],n,1,0,0);
+  //_analysis_output_always("noiseoff1",n,p->noiseoffset[1],n,1,0,0);
+  //_analysis_output_always("noiseoff2",n,p->noiseoffset[2],n,1,0,0);
   analysis_noisy=1;
 
 }
@@ -524,7 +543,6 @@
       _ogg_free(p->tonecurves);
     }
     _ogg_free(p->noiseoffset);
-    _ogg_free(p->noisethresh);
     memset(p,0,sizeof(*p));
   }
 }
@@ -685,191 +703,279 @@
 }
 
 static void bark_noise_hybridmp(int n,const long *b,
-				const float *f,
-				float *noise,
-				const float offset,
-				const int fixed){
-  long i,hi=b[0]>>16,lo=b[0]>>16,hif=0,lof=0;
-  double xa=0,xb=0;
-  double ya=0,yb=0;
-  double x2a=0,x2b=0;
-  double xya=0,xyb=0; 
-  double na=0,nb=0;
-
-  for(i=0;i<n;i++){
-    if(hi<n){
-      /* find new lo/hi */
-      int bi=b[i]&0xffffL;
-      for(;hi<bi;hi++){
-	int ii=(hi<0?-hi:hi);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	na  += nn;
-	xa  += hi*nn;
-	ya  += bin*nn;
-	x2a += hi*hi*nn;
-	xya += hi*bin*nn;
-      }
-      bi=b[i]>>16;
-      for(;lo<bi;lo++){
-	int ii=(lo<0?-lo:lo);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	na  -= nn;
-	xa  -= lo*nn;
-	ya  -= bin*nn;
-	x2a -= lo*lo*nn;
-	xya -= lo*bin*nn;
-      }
-    }
-
-    if(hif<n && fixed>0){
-      int bi=i+fixed/2;
-      if(bi>n)bi=n;
-
-      for(;hif<bi;hif++){
-	int ii=(hif<0?-hif:hif);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	nb  += nn;
-	xb  += hif*nn;
-	yb  += bin*nn;
-	x2b += hif*hif*nn;
-	xyb += hif*bin*nn;
-      }
-      bi=i-(fixed+1)/2;
-      for(;lof<bi;lof++){
-	int ii=(lof<0?-lof:lof);
-        double bin=(f[ii]<-offset?1.:f[ii]+offset);
-	double nn= bin*bin;
-	nb  -= nn;
-	xb  -= lof*nn;
-	yb  -= bin*nn;
-	x2b -= lof*lof*nn;
-	xyb -= lof*bin*nn;
-      }
-    }
-
-    {    
-      double va=0.f;
-      
-      if(na>2){
-        double denom=1./(na*x2a-xa*xa);
-        double a=(ya*x2a-xya*xa)*denom;
-        double b=(na*xya-xa*ya)*denom;
-        va=a+b*i;
-      }
-      if(va<0.)va=0.;
-
-      if(fixed>0){
-        double vb=0.f;
-
-        if(nb>2){
-          double denomf=1./(nb*x2b-xb*xb);
-          double af=(yb*x2b-xyb*xb)*denomf;
-          double bf=(nb*xyb-xb*yb)*denomf;
-          vb=af+bf*i;
-        }
-        if(vb<0.)vb=0.;
-        if(va>vb && vb>0.)va=vb;
+                                const float *f,
+                                float *noise,
+                                const float offset,
+                                const int fixed){
+  
+  float *N=alloca((n+1)*sizeof(*N));
+  float *X=alloca((n+1)*sizeof(*N));
+  float *XX=alloca((n+1)*sizeof(*N));
+  float *Y=alloca((n+1)*sizeof(*N));
+  float *XY=alloca((n+1)*sizeof(*N));
 
-      }
+  float tN, tX, tXX, tY, tXY;
+  float fi;
+  int i;
+  
+  tN = tX = tXX = tY = tXY = 0.f;
+  for (i = 0, fi = 0.f; i < n; i++, fi += 1.f) {
+    float w, x, y;
+    
+    x = fi;
+    y = f[i] + offset;
+    if (y < 1.f) y = 1.f;
+    w = y * y;
+    N[i] = tN;
+    X[i] = tX;
+    XX[i] = tXX;
+    Y[i] = tY;
+    XY[i] = tXY;
+    tN += w;
+    tX += w * x;
+    tXX += w * x * x;
+    tY += w * y;
+    tXY += w * x * y;
+  }
+  N[i] = tN;
+  X[i] = tX;
+  XX[i] = tXX;
+  Y[i] = tY;
+  XY[i] = tXY;
+  
+  for (i = 0, fi = 0.f;; i++, fi += 1.f) {
+    int lo, hi;
+    float R, A, B, D;
+    
+    lo = b[i] >> 16;
+    if( lo>=0 ) break;
+    hi = b[i] & 0xffff;
+    
+    tN = N[hi] + N[-lo];
+    tX = X[hi] - X[-lo];
+    tXX = XX[hi] + XX[-lo];
+    tY = Y[hi] + Y[-lo];    
+    tXY = XY[hi] - XY[-lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    if (R < 0.f)
+      R = 0.f;
+    
+    noise[i] = R - offset;
+  }
 
-      noise[i]=va-offset;
-    }
+  for ( ; i < n; i++, fi += 1.f) {
+    int lo, hi;
+    float R, A, B, D;
+    
+    lo = b[i] >> 16;
+    hi = b[i] & 0xffff;
+    
+    tN = N[hi] - N[lo];
+    tX = X[hi] - X[lo];
+    tXX = XX[hi] - XX[lo];
+    tY = Y[hi] - Y[lo];
+    tXY = XY[hi] - XY[lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    if (R < 0.f) R = 0.f;
+    
+    noise[i] = R - offset;
   }
+  
+  if (fixed <= 0) return;
+  
+  for (i = 0, fi = 0.f; i < (fixed + 1) / 2; i++, fi += 1.f) {
+    int lo, hi;
+    float R, A, B, D;
+    
+    hi = i + fixed / 2;
+    lo = hi - fixed;
+    
+    tN = N[hi] + N[-lo];
+    tX = X[hi] - X[-lo];
+    tXX = XX[hi] + XX[-lo];
+    tY = Y[hi] + Y[-lo];
+    tXY = XY[hi] - XY[-lo];
+    
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
+  }
+  for ( ; i < n; i++, fi += 1.f) {
+    int lo, hi;
+    float R, A, B, D;
+    
+    hi = i + fixed / 2;
+    lo = hi - fixed;
+    
+    tN = N[hi] - N[lo];
+    tX = X[hi] - X[lo];
+    tXX = XX[hi] - XX[lo];
+    tY = Y[hi] - Y[lo];
+    tXY = XY[hi] - XY[lo];
+    
+    A = tY * tXX - tX * tXY;
+    B = tN * tXY - tX * tY;
+    D = tN * tXX - tX * tX;
+    R = (A + fi * B) / D;
+    
+    if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;
+  }
 }
+
+static float FLOOR1_fromdB_INV_LOOKUP[256]={
+  0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, 
+  7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, 
+  5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, 
+  4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F, 
+  3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F, 
+  2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F, 
+  2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F, 
+  1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F, 
+  1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F, 
+  973377.F, 913981.F, 858210.F, 805842.F, 
+  756669.F, 710497.F, 667142.F, 626433.F, 
+  588208.F, 552316.F, 518613.F, 486967.F, 
+  457252.F, 429351.F, 403152.F, 378551.F, 
+  355452.F, 333762.F, 313396.F, 294273.F, 
+  276316.F, 259455.F, 243623.F, 228757.F, 
+  214798.F, 201691.F, 189384.F, 177828.F, 
+  166977.F, 156788.F, 147221.F, 138237.F, 
+  129802.F, 121881.F, 114444.F, 107461.F, 
+  100903.F, 94746.3F, 88964.9F, 83536.2F, 
+  78438.8F, 73652.5F, 69158.2F, 64938.1F, 
+  60975.6F, 57254.9F, 53761.2F, 50480.6F, 
+  47400.3F, 44507.9F, 41792.0F, 39241.9F, 
+  36847.3F, 34598.9F, 32487.7F, 30505.3F, 
+  28643.8F, 26896.0F, 25254.8F, 23713.7F, 
+  22266.7F, 20908.0F, 19632.2F, 18434.2F, 
+  17309.4F, 16253.1F, 15261.4F, 14330.1F, 
+  13455.7F, 12634.6F, 11863.7F, 11139.7F, 
+  10460.0F, 9821.72F, 9222.39F, 8659.64F, 
+  8131.23F, 7635.06F, 7169.17F, 6731.70F, 
+  6320.93F, 5935.23F, 5573.06F, 5232.99F, 
+  4913.67F, 4613.84F, 4332.30F, 4067.94F, 
+  3819.72F, 3586.64F, 3367.78F, 3162.28F, 
+  2969.31F, 2788.13F, 2617.99F, 2458.24F, 
+  2308.24F, 2167.39F, 2035.14F, 1910.95F, 
+  1794.35F, 1684.85F, 1582.04F, 1485.51F, 
+  1394.86F, 1309.75F, 1229.83F, 1154.78F, 
+  1084.32F, 1018.15F, 956.024F, 897.687F, 
+  842.910F, 791.475F, 743.179F, 697.830F, 
+  655.249F, 615.265F, 577.722F, 542.469F, 
+  509.367F, 478.286F, 449.101F, 421.696F, 
+  395.964F, 371.803F, 349.115F, 327.812F, 
+  307.809F, 289.026F, 271.390F, 254.830F, 
+  239.280F, 224.679F, 210.969F, 198.096F, 
+  186.008F, 174.658F, 164.000F, 153.993F, 
+  144.596F, 135.773F, 127.488F, 119.708F, 
+  112.404F, 105.545F, 99.1046F, 93.0572F, 
+  87.3788F, 82.0469F, 77.0404F, 72.3394F, 
+  67.9252F, 63.7804F, 59.8885F, 56.2341F, 
+  52.8027F, 49.5807F, 46.5553F, 43.7144F, 
+  41.0470F, 38.5423F, 36.1904F, 33.9821F, 
+  31.9085F, 29.9614F, 28.1332F, 26.4165F, 
+  24.8045F, 23.2910F, 21.8697F, 20.5352F, 
+  19.2822F, 18.1056F, 17.0008F, 15.9634F, 
+  14.9893F, 14.0746F, 13.2158F, 12.4094F, 
+  11.6522F, 10.9411F, 10.2735F, 9.64662F, 
+  9.05798F, 8.50526F, 7.98626F, 7.49894F, 
+  7.04135F, 6.61169F, 6.20824F, 5.82941F, 
+  5.47370F, 5.13970F, 4.82607F, 4.53158F, 
+  4.25507F, 3.99542F, 3.75162F, 3.52269F, 
+  3.30774F, 3.10590F, 2.91638F, 2.73842F, 
+  2.57132F, 2.41442F, 2.26709F, 2.12875F, 
+  1.99885F, 1.87688F, 1.76236F, 1.65482F, 
+  1.55384F, 1.45902F, 1.36999F, 1.28640F, 
+  1.20790F, 1.13419F, 1.06499F, 1.F
+};
 
-   
 void _vp_remove_floor(vorbis_look_psy *p,
                       float *mdct,
-		      float *codedflr,
+		      int *codedflr,
                       float *residue){ 
   int i,n=p->n;
   
   for(i=0;i<n;i++)
-    if(mdct[i]!=0.f)
-      residue[i]=mdct[i]/codedflr[i];
-    else
-      residue[i]=0.f;
+      residue[i]=mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
 }
-  
 
-void _vp_compute_mask(vorbis_look_psy *p,
-		      float *logfft, 
-		      float *logmdct, 
-		      float *logmask, 
-		      float global_specmax,
-		      float local_specmax,
-		      float bitrate_noise_offset){
-  int i,n=p->n;
-  static int seq=0;
+void _vp_noisemask(vorbis_look_psy *p,
+		   float *logmdct, 
+		   float *logmask){
 
-  float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
-  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
-
-  /* noise masking */
-  if(p->vi->noisemaskp){
-    float *work=alloca(n*sizeof(*work));
-
-    bark_noise_hybridmp(n,p->bark,logmdct,logmask,
-			140.,-1);
-
-    for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
+  int i,n=p->n;
+  float *work=alloca(n*sizeof(*work));
+  
+  bark_noise_hybridmp(n,p->bark,logmdct,logmask,
+		      140.,-1);
 
-    bark_noise_hybridmp(n,p->bark,work,logmask,0.,
-			p->vi->noisewindowfixed);
+  for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
 
-    for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
+  bark_noise_hybridmp(n,p->bark,work,logmask,0.,
+		      p->vi->noisewindowfixed);
 
-    /* work[i] holds the median line (.5), logmask holds the upper
-       envelope line (1.) */
-    _analysis_output("noisemedian",seq,work,n,1,0);
+  for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
 
-    for(i=0;i<n;i++)logmask[i]+=work[i];
-    _analysis_output("noiseenvelope",seq,logmask,n,1,0);
-    for(i=0;i<n;i++)logmask[i]-=work[i];
+  /* work[i] holds the median line (.5), logmask holds the upper
+     envelope line (1.) */
+  
+  for(i=0;i<n;i++){
+    int dB=logmask[i]+.5;
+    if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
+    logmask[i]= work[i]+p->vi->noisecompand[dB];
+  }
+}
 
-    for(i=0;i<n;i++){
-      int dB=logmask[i]+.5;
-      if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
-      logmask[i]= work[i]+p->vi->noisecompand[dB]+p->noiseoffset[i]+bitrate_noise_offset;
-      if(logmask[i]>p->vi->noisemaxsupp)logmask[i]=p->vi->noisemaxsupp;
-    }
-    _analysis_output("noise",seq,logmask,n,1,0);
+void _vp_tonemask(vorbis_look_psy *p,
+		  float *logfft,
+		  float *logmask,
+		  float global_specmax,
+		  float local_specmax){
 
-  }else{
-    for(i=0;i<n;i++)logmask[i]=NEGINF;
-  }
+  int i,n=p->n;
 
+  float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
+  float att=local_specmax+p->vi->ath_adjatt;
+  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
+  
   /* set the ATH (floating below localmax, not global max by a
      specified att) */
-  if(p->vi->ath){
-    float att=local_specmax+p->vi->ath_adjatt;
-    if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
-
-    for(i=0;i<n;i++){
-      float av=p->ath[i]+att;
-      if(av>logmask[i])logmask[i]=av;
-    }
-  }
+  if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
+  
+  for(i=0;i<n;i++)
+    logmask[i]=p->ath[i]+att;
 
   /* tone masking */
   seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax);
   max_seeds(p,seed,logmask);
 
-  /* doing this here is clean, but we need to find a faster way to do
-     it than to just tack it on */
+}
 
-  for(i=0;i<n;i++)if(logmdct[i]>=logmask[i])break;
-  if(i==n)
-    for(i=0;i<n;i++)logmask[i]=NEGINF;
-  else
-    for(i=0;i<n;i++)
-      logfft[i]=max(logmdct[i],logfft[i]);
 
-  seq++;
+void _vp_offset_and_mix(vorbis_look_psy *p,
+			float *noise,
+			float *tone,
+			int offset_select,
+			float *logmask){
+  int i,n=p->n;
 
+  for(i=0;i<n;i++){
+    logmask[i]= noise[i]+p->noiseoffset[offset_select][i];
+    if(logmask[i]>p->vi->noisemaxsupp)logmask[i]=p->vi->noisemaxsupp;
+    logmask[i]=max(logmask[i],tone[i]);
+  }
 }
 
 float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
@@ -886,43 +992,66 @@
 }
 
 static void couple_lossless(float A, float B, 
-			    float granule,float igranule,
-			    float *mag, float *ang,
-			    int flip_p){
-
-  if(fabs(A)>fabs(B)){
-    A=rint(A*igranule)*granule; /* must be done *after* the comparison */
-    B=rint(B*igranule)*granule;
+			    float *mag, float *ang){
   
+  if(fabs(A)>fabs(B)){
+    A=rint(A);B=rint(B);
     *mag=A; *ang=(A>0.f?A-B:B-A);
   }else{
-    A=rint(A*igranule)*granule;
-    B=rint(B*igranule)*granule;
-  
+    A=rint(A);B=rint(B);  
     *mag=B; *ang=(B>0.f?A-B:B-A);
   }
 
-  if(flip_p && *ang>fabs(*mag)*1.9999f){
+  if(*ang>fabs(*mag)*1.9999f){
     *ang= -fabs(*mag)*2.f;
     *mag= -*mag;
   }
 }
 
+static float hypot_lookup[32]={
+  -0.009935, -0.011245, -0.012726, -0.014397, 
+  -0.016282, -0.018407, -0.020800, -0.023494, 
+  -0.026522, -0.029923, -0.033737, -0.038010, 
+  -0.042787, -0.048121, -0.054064, -0.060671, 
+  -0.068000, -0.076109, -0.085054, -0.094892, 
+  -0.105675, -0.117451, -0.130260, -0.144134, 
+  -0.159093, -0.175146, -0.192286, -0.210490, 
+  -0.229718, -0.249913, -0.271001, -0.292893};
+
+/* floorA and B are the pre-lookup logscale integers from floor1 decode */
+static void precomputed_couple_point(float premag,
+				     float A, float B,
+				     int floorA,int floorB,
+				     float *mag, float *ang){
+  
+  int test=(floorA>floorB)-1;
+  int offset=31-abs(floorA-floorB);
+  float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
+  
+  floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
+  if(fabs(A)>fabs(B)){
+    premag*=unitnorm(A);
+  }else{
+    premag*=unitnorm(B);
+  }
+  *mag=premag*floormag;
+  *ang=0.f;
+}
+
+#if 0
 static void couple_point(float A, float B, float fA, float fB, 
                          float granule,float igranule,
                          float fmag, float *mag, float *ang){
 
-  float origmag=FAST_HYPOT(A*fA,B*fB),corr;
-
   if(fmag!=0.f){
+    float corr=FAST_HYPOT(A*fA,B*fB)/FAST_HYPOT(fA,fB);
     
     if(fabs(A)>fabs(B)){
       *mag=A;
     }else{
       *mag=B;
     }
-    
-    corr=origmag/FAST_HYPOT(fA,fB);
+
     *mag=unitnorm(*mag)*floor(corr*igranule+.5f)*granule; 
     *ang=0.f;
 
@@ -931,75 +1060,89 @@
     *ang=0.f;
   }    
 }
+#endif
 
+/* just like below, this is currently set up to only do
+   single-step-depth coupling.  Otherwise, we'd have to do more
+   copying (which will be inevitable later) */
+float **_vp_quantize_couple_memo(vorbis_block *vb,
+				 vorbis_look_psy *p,
+				 vorbis_info_mapping0 *vi,
+				 float **mdct){
+  
+  int i,j,n=p->n;
+  vorbis_info_psy *info=p->vi;
+  float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+  
+  for(i=0;i<vi->coupling_steps;i++){
+    float point=info->couple_pass.amppost_point;
+    int limit=info->couple_pass.limit;
+    ret[i]=0;
+    if(point>0){
+      float *mdctM=mdct[vi->coupling_mag[i]];
+      float *mdctA=mdct[vi->coupling_ang[i]];
+      ret[i]=_vorbis_block_alloc(vb,(n-limit)*sizeof(**ret));
+      for(j=limit;j<n;j++)
+	ret[i][j-limit]=FAST_HYPOT(mdctM[j],mdctA[j]);
+    }
+  }
+  return(ret);
+}
+
 void _vp_quantize_couple(vorbis_look_psy *p,
                          vorbis_info_mapping0 *vi,
-			 float **pcm,
-			 float **sofar,
-			 float **quantized,
-			 int   *nonzero,
-			 int   passno){
+			 float **res,
+			 float **mag_memo,
+			 int   **ifloor,
+			 int   *nonzero){
 
-  int i,j,k,n=p->n;
+  int i,j,n=p->n;
   vorbis_info_psy *info=p->vi;
 
   /* perform any requested channel coupling */
+  /* point stereo can only be used in a first stage (in this encoder)
+     because of the dependency on floor lookups */
   for(i=0;i<vi->coupling_steps;i++){
-    float granulem=info->couple_pass[passno].granulem;
-    float igranulem=info->couple_pass[passno].igranulem;
 
+    /* once we're doing multistage coupling in which a channel goes
+       through more than one coupling step, the floor vector
+       magnitudes will also have to be recalculated an propogated
+       along with PCM.  Right now, we're not (that will wait until 5.1
+       most likely), so the code isn't here yet. The memory management
+       here is all assuming single depth couplings anyway. */
+
     /* make sure coupling a zero and a nonzero channel results in two
        nonzero channels. */
     if(nonzero[vi->coupling_mag[i]] ||
        nonzero[vi->coupling_ang[i]]){
-      
-      float *pcmM=pcm[vi->coupling_mag[i]];
-      float *pcmA=pcm[vi->coupling_ang[i]];
-      float *floorM=pcm[vi->coupling_mag[i]]+n;
-      float *floorA=pcm[vi->coupling_ang[i]]+n;
-      float *sofarM=sofar[vi->coupling_mag[i]];
-      float *sofarA=sofar[vi->coupling_ang[i]];
-      float *qM=quantized[vi->coupling_mag[i]];
-      float *qA=quantized[vi->coupling_ang[i]];
+     
 
+      float *resM=res[vi->coupling_mag[i]];
+      float *resA=res[vi->coupling_ang[i]];
+      int *floorM=ifloor[vi->coupling_mag[i]];
+      int *floorA=ifloor[vi->coupling_ang[i]];
+      float *outM=res[vi->coupling_mag[i]]+n;
+      float *outA=res[vi->coupling_ang[i]]+n;
+      int limit=info->couple_pass.limit;
+      float point=info->couple_pass.amppost_point;
+ 
       nonzero[vi->coupling_mag[i]]=1; 
       nonzero[vi->coupling_ang[i]]=1; 
 
-      for(j=0,k=0;j<n;k++){
-	vp_couple *part=info->couple_pass[passno].couple_pass+k;
-	float rqlimit=part->outofphase_requant_limit;
-	int flip_p=part->outofphase_redundant_flip_p;
-    
-	for(;j<part->limit && j<p->n;j++){
-	  /* partition by partition; k is our by-location partition
-	     class counter */
-	  float ang,mag,fmag=max(fabs(pcmM[j]),fabs(pcmA[j]));
-
-	  if(fmag<part->amppost_point){
-	    couple_point(pcmM[j],pcmA[j],floorM[j],floorA[j],
-			 granulem,igranulem,fmag,&mag,&ang);
-
-	  }else{
-	    couple_lossless(pcmM[j],pcmA[j],
-			    granulem,igranulem,&mag,&ang,flip_p);
-	  }
+      for(j=0;j<limit;j++){
 
-	  /* executive decision time: when requantizing and recoupling
-	     residue in order to progressively encode at finer
-	     resolution, an out of phase component that originally
-	     quntized to 2*mag can flip flop magnitude/angle if it
-	     requantizes to not-quite out of phase.  If that happens,
-	     we opt not to fill in additional resolution (in order to
-	     simplify the iterative codebook design and
-	     efficiency). */
-
-	  qM[j]=mag-sofarM[j];
-	  qA[j]=ang-sofarA[j];
-	 
-	  if(qA[j]<-rqlimit || qA[j]>rqlimit){
-	    qM[j]=0.f;
-	    qA[j]=0.f;
-	  }
+	couple_lossless(resM[j],resA[j],outM+j,outA+j);
+      }
+
+      for(;j<p->n;j++){
+
+	if(fabs(resM[j])<point && fabs(resA[j])<point){
+	  precomputed_couple_point(mag_memo[i][j-limit],resM[j],resA[j],
+				   floorM[j],floorA[j],
+				   outM+j,outA+j);
+	  
+	}else{
+	  couple_lossless(resM[j],resA[j],outM+j,outA+j);
         }
       }
     }

<p><p>1.28.2.1  +48 -32    vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -r1.28 -r1.28.2.1
--- psy.h	2002/03/29 07:10:39	1.28
+++ psy.h	2002/05/07 23:47:14	1.28.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.28 2002/03/29 07:10:39 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.28.2.1 2002/05/07 23:47:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -30,24 +30,17 @@
 #define MAX_BARK 27
 #define P_BANDS 17
 #define P_LEVELS 11
+#define P_NOISECURVES 3
 
 typedef struct vp_couple{
-  int limit;        /* sample post */
-
-  int outofphase_redundant_flip_p;
-  float outofphase_requant_limit;
+  float granulem;
+  float igranulem;
 
+  int limit;        /* sample post */
   float amppost_point;
   
 } vp_couple;
 
-typedef struct vp_couple_pass{  
-  float granulem;
-  float igranulem;
-
-  vp_couple couple_pass[8];
-} vp_couple_pass;
-
 typedef struct vp_attenblock{
   float block[P_BANDS][P_LEVELS];
 } vp_attenblock;
@@ -75,12 +68,12 @@
   int   noisewindowlomin;
   int   noisewindowhimin;
   int   noisewindowfixed;
-  float noiseoff[P_BANDS];
+  float noiseoff[P_NOISECURVES][P_BANDS];
   float noisecompand[NOISE_COMPAND_LEVELS];
 
   float max_curve_dB;
 
-  vp_couple_pass couple_pass[8];
+  vp_couple couple_pass;
 
 } vorbis_info_psy;
 
@@ -113,8 +106,7 @@
   struct vorbis_info_psy *vi;
 
   float ***tonecurves;
-  float *noisethresh;
-  float *noiseoffset;
+  float **noiseoffset;
 
   float *ath;
   long  *octave;             /* in n.ocshift format */
@@ -137,27 +129,51 @@
 
 extern void _vp_remove_floor(vorbis_look_psy *p,
                              float *mdct,
-			     float *codedflr,
+			     int *icodedflr,
                              float *residue);
-
-extern void   _vp_compute_mask(vorbis_look_psy *p,
-			       float *fft, 
-			       float *mdct, 
-			       float *mask, 
-			       float global_specmax,
-			       float local_specmax,
-			       float bitrate_noise_offset);
 
-extern void _vp_quantize_couple(vorbis_look_psy *p,
-			 vorbis_info_mapping0 *vi,
-			 float **pcm,
-			 float **sofar,
-			 float **quantized,
-			 int   *nonzero,
-			 int   passno);
+extern void _vp_noisemask(vorbis_look_psy *p,
+			  float *logmdct, 
+			  float *logmask);
+
+extern void _vp_tonemask(vorbis_look_psy *p,
+			 float *logfft,
+			 float *logmask,
+			 float global_specmax,
+			 float local_specmax);
+
+extern void _vp_offset_and_mix(vorbis_look_psy *p,
+			       float *noise,
+			       float *tone,
+			       int offset_select,
+			       float *logmask);
 
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
+extern float **_vp_quantize_couple_memo(vorbis_block *vb,
+					vorbis_look_psy *p,
+					vorbis_info_mapping0 *vi,
+					float **mdct);
+
+extern void _vp_quantize_couple(vorbis_look_psy *p,
+				vorbis_info_mapping0 *vi,
+				float **res,
+				float **mag_memo,
+				int   **ifloor,
+				int   *nonzero);
+
 #endif
+
+
+
+
+
+
+
+
+
+
+
+
 
 

<p><p>1.13.6.1  +1 -6      vorbis/lib/registry.c

Index: registry.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.c,v
retrieving revision 1.13
retrieving revision 1.13.6.1
diff -u -r1.13 -r1.13.6.1
--- registry.c	2001/12/20 01:00:29	1.13
+++ registry.c	2002/05/07 23:47:14	1.13.6.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c,v 1.13 2001/12/20 01:00:29 segher Exp $
+ last mod: $Id: registry.c,v 1.13.6.1 2002/05/07 23:47:14 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,17 +25,12 @@
 /* seems like major overkill now; the backend numbers will grow into
    the infrastructure soon enough */
 
-extern vorbis_func_time      time0_exportbundle;
 extern vorbis_func_floor     floor0_exportbundle;
 extern vorbis_func_floor     floor1_exportbundle;
 extern vorbis_func_residue   residue0_exportbundle;
 extern vorbis_func_residue   residue1_exportbundle;
 extern vorbis_func_residue   residue2_exportbundle;
 extern vorbis_func_mapping   mapping0_exportbundle;
-
-vorbis_func_time      *_time_P[]={
-  &time0_exportbundle,
-};
 
 vorbis_func_floor     *_floor_P[]={
   &floor0_exportbundle,

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

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

<p><p>1.45.4.1  +105 -143  vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.45
retrieving revision 1.45.4.1
diff -u -r1.45 -r1.45.4.1
--- res0.c	2002/01/22 08:06:07	1.45
+++ res0.c	2002/05/07 23:47:15	1.45.4.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.45 2002/01/22 08:06:07 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.45.4.1 2002/05/07 23:47:15 xiphmont Exp $
 
  ********************************************************************/
 
@@ -52,8 +52,6 @@
   long      phrasebits;
   long      frames;
 
-  int       qoffsets[BITTRACK_DIVISOR+1];
-
 #ifdef TRAIN_RES
   long      *training_data[8][64];
   float      training_max[8][64];
@@ -287,114 +285,86 @@
     }
   }
 
-  {
-    int samples_per_partition=info->grouping;
-    int n=info->end-info->begin,i;
-    int partvals=n/samples_per_partition;
-
-    for(i=0;i<BITTRACK_DIVISOR;i++)
-      look->qoffsets[i]=partvals*(i+1)/BITTRACK_DIVISOR;
-
-    look->qoffsets[i]=9999999;
-  }
-
   return(look);
 }
 
-
-#if 0
-/* does not guard against invalid settings; eg, a subn of 16 and a
-   subgroup request of 32.  Max subn of 128 */
-static int _interleaved_testhack(float *vec,int n,vorbis_look_residue0 *look,
-				 int auxparts,int auxpartnum){
-  vorbis_info_residue0 *info=look->info;
-  int i,j=0;
-  float max,localmax=0.f;
-  float temp[128];
-  float entropy[8];
-
-  /* setup */
-  for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
-
-  /* handle case subgrp==1 outside */
-  for(i=0;i<n;i++)
-    if(temp[i]>localmax)localmax=temp[i];
-  max=localmax;
-
-  for(i=0;i<n;i++)temp[i]=rint(temp[i]);
-  
-  while(1){
-    entropy[j]=localmax;
-    n>>=1;
-    if(!n)break;
-    j++;
-
-    for(i=0;i<n;i++){
-      temp[i]+=temp[i+n];
-    }
-    localmax=0.f;
-    for(i=0;i<n;i++)
-      if(temp[i]>localmax)localmax=temp[i];
-  }
-
-  for(i=0;i<auxparts-1;i++)
-    if(auxpartnum<info->blimit[i] &&
-       entropy[info->subgrp[i]]<=info->entmax[i] &&
-       max<=info->ampmax[i])
-      break;
-
-  return(i);
-}
-#endif
-
-
 static int _testhack(float *vec,int n,vorbis_look_residue0 *look,
                      int auxparts,int auxpartnum){
   vorbis_info_residue0 *info=look->info;
   int i;
   float max=0.f;
-  float temp[128];
-  float entropy=0.f;
 
   /* setup */
-  for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
-
   for(i=0;i<n;i++)
-    if(temp[i]>max)max=temp[i];
+    if(fabs(vec[i])>max)max=fabs(vec[i]);
 
-  for(i=0;i<n;i++)temp[i]=rint(temp[i]);
-
-  for(i=0;i<n;i++)
-    entropy+=temp[i];
-
   for(i=0;i<auxparts-1;i++)
     if(auxpartnum<info->blimit[i] &&
-       entropy<=info->entmax[i] &&
        max<=info->ampmax[i])
       break;
 
   return(i);
 }
-
-static int _interleaved_encodepart(oggpack_buffer *opb,float *vec, int n,
-				   codebook *book,long *acc){
-  int i,bits=0;
-  int dim=book->dim;
-  int step=n/dim;
 
-  for(i=0;i<step;i++){
-    int entry=vorbis_book_besterror(book,vec+i,step,0);
-
-#ifdef TRAIN_RES
-    acc[entry]++;
-#endif
+/* break an abstraction and copy some code for performance purposes */
+static int local_book_besterror(codebook *book,float *a){
+  int dim=book->dim,i,k,o;
+  int best=0;
+  encode_aux_threshmatch *tt=book->c->thresh_tree;
+
+  /* find the quant val of each scalar */
+  for(k=0,o=dim;k<dim;++k){
+    float val=a[--o];
+    i=tt->threshvals>>1;
+
+    if(val<tt->quantthresh[i]){      
+      if(val<tt->quantthresh[i-1]){
+	for(--i;i>0;--i)
+	  if(val>=tt->quantthresh[i-1])
+	    break;
+      }
+    }else{
+      
+      for(++i;i<tt->threshvals-1;++i)
+	if(val<tt->quantthresh[i])break;
+      
+    }
+    
+    best=(best*tt->quantvals)+tt->quantmap[i];
+  }
+  /* regular lattices are easy :-) */
+  
+  if(book->c->lengthlist[best]<=0){
+    const static_codebook *c=book->c;
+    int i,j;
+    float bestf=0.f;
+    float *e=book->valuelist;
+    best=-1;
+    for(i=0;i<book->entries;i++){
+      if(c->lengthlist[i]>0){
+	float this=0.f;
+	for(j=0;j<dim;j++){
+	  float val=(e[j]-a[j]);
+	  this+=val*val;
+	}
+	if(best==-1 || this<bestf){
+	  bestf=this;
+	  best=i;
+	}
+      }
+      e++;
+    }
+  }
 
-    bits+=vorbis_book_encode(book,entry,opb);
+  {
+    float *ptr=book->valuelist+best*dim;
+    for(i=0;i<dim;i++)
+      *a++ -= *ptr++;
   }
 
-  return(bits);
+  return(best);
 }
- 
+
 static int _encodepart(oggpack_buffer *opb,float *vec, int n,
                        codebook *book,long *acc){
   int i,bits=0;
@@ -402,7 +372,7 @@
   int step=n/dim;
 
   for(i=0;i<step;i++){
-    int entry=vorbis_book_besterror(book,vec+i*dim,1,0);
+    int entry=local_book_besterror(book,vec+i*dim);
 
 #ifdef TRAIN_RES
     acc[entry]++;
@@ -528,10 +498,9 @@
 
 static int _01forward(vorbis_block *vb,vorbis_look_residue *vl,
                       float **in,int ch,
-		      int pass,long **partword,
+		      long **partword,
                       int (*encode)(oggpack_buffer *,float *,int,
-				    codebook *,long *),
-		      ogg_uint32_t *stats){
+				    codebook *,long *)){
   long i,j,k,s;
   vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
   vorbis_info_residue0 *info=look->info;
@@ -567,10 +536,7 @@
      residual words for that partition word.  Then write the next
      partition channel words... */
 
-  for(s=(pass==0?0:ci->passlimit[pass-1]);s<ci->passlimit[pass];s++){
-    int bin=0;
-    ogg_uint32_t *qptr=NULL;
-    if(stats)qptr=stats+s*BITTRACK_DIVISOR;
+  for(s=0;s<look->stages;s++){
 
     for(i=0;i<partvals;){
 
@@ -599,9 +565,6 @@
       for(k=0;k<partitions_per_word && i<partvals;k++,i++){
         long offset=i*samples_per_partition+info->begin;
         
-	if(qptr)while(i>=look->qoffsets[bin])
-	  qptr[bin++]=oggpack_bits(&vb->opb);
-
         for(j=0;j<ch;j++){
           if(s==0)resvals[partword[j][i]]+=samples_per_partition;
           if(info->secondstages[partword[j][i]]&(1<<s)){
@@ -633,8 +596,6 @@
           }
         }
       }
-      if(qptr)while(i>=look->qoffsets[bin])
-	qptr[bin++]=oggpack_bits(&vb->opb);
     }
   }
 
@@ -710,6 +671,7 @@
   return(0);
 }
 
+#if 0
 /* residue 0 and 1 are just slight variants of one another. 0 is
    interleaved, 1 is not */
 long **res0_class(vorbis_block *vb,vorbis_look_residue *vl,
@@ -728,33 +690,34 @@
 
 int res0_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass, long **partword,ogg_uint32_t *stats){
+		 long **partword){
   /* we encode only the nonzero parts of a bundle */
   int i,j,used=0,n=vb->pcmend/2;
   for(i=0;i<ch;i++)
     if(nonzero[i]){
-      for(j=0;j<n;j++)
-	out[i][j]+=in[i][j];
+      if(out)
+	for(j=0;j<n;j++)
+	  out[i][j]+=in[i][j];
       in[used++]=in[i];
     }
   if(used){
-    int ret=_01forward(vb,vl,in,used,pass,partword,
-		      _interleaved_encodepart,stats);
-    used=0;
-    for(i=0;i<ch;i++)
-      if(nonzero[i]){
-	for(j=0;j<n;j++)
-	  out[i][j]-=in[used][j];
-	used++;
-      }
+    int ret=_01forward(vb,vl,in,used,partword,
+		      _interleaved_encodepart);
+    if(out){
+      used=0;
+      for(i=0;i<ch;i++)
+	if(nonzero[i]){
+	  for(j=0;j<n;j++)
+	    out[i][j]-=in[used][j];
+	  used++;
+	}
+    }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
+#endif
 
 int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,int *nonzero,int ch){
@@ -770,29 +733,29 @@
 
 int res1_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass, long **partword, ogg_uint32_t *stats){
+		 long **partword){
   int i,j,used=0,n=vb->pcmend/2;
   for(i=0;i<ch;i++)
     if(nonzero[i]){
-      for(j=0;j<n;j++)
-	out[i][j]+=in[i][j];
+      if(out)
+	for(j=0;j<n;j++)
+	  out[i][j]+=in[i][j];
       in[used++]=in[i];
     }
 
   if(used){
-    int ret=_01forward(vb,vl,in,used,pass,partword,_encodepart,stats);
-    used=0;
-    for(i=0;i<ch;i++)
-      if(nonzero[i]){
-	for(j=0;j<n;j++)
-	  out[i][j]-=in[used][j];
-	used++;
-      }
+    int ret=_01forward(vb,vl,in,used,partword,_encodepart);
+    if(out){
+      used=0;
+      for(i=0;i<ch;i++)
+	if(nonzero[i]){
+	  for(j=0;j<n;j++)
+	    out[i][j]-=in[used][j];
+	  used++;
+	}
+    }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
@@ -838,7 +801,7 @@
 
 int res2_forward(vorbis_block *vb,vorbis_look_residue *vl,
                  float **in,float **out,int *nonzero,int ch,
-		 int pass,long **partword,ogg_uint32_t *stats){
+		 long **partword){
   long i,j,k,n=vb->pcmend/2,used=0;
 
   /* don't duplicate the code; use a working vector hack for now and
@@ -853,20 +816,19 @@
   }
   
   if(used){
-    int ret=_01forward(vb,vl,&work,1,pass,partword,_encodepart,stats);
+    int ret=_01forward(vb,vl,&work,1,partword,_encodepart);
     /* update the sofar vector */
-    for(i=0;i<ch;i++){
-      float *pcm=in[i];
-      float *sofar=out[i];
-      for(j=0,k=i;j<n;j++,k+=ch)
-	sofar[j]+=pcm[j]-work[k];
-
+    if(out){
+      for(i=0;i<ch;i++){
+	float *pcm=in[i];
+	float *sofar=out[i];
+	for(j=0,k=i;j<n;j++,k+=ch)
+	  sofar[j]+=pcm[j]-work[k];
+	
+      }
     }
     return(ret);
   }else{
-    for(i=0;i<vorbis_bitrate_maxmarkers();i++)
-      stats[i]=oggpack_bits(&vb->opb);
-
     return(0);
   }
 }
@@ -923,14 +885,14 @@
 
 
 vorbis_func_residue residue0_exportbundle={
-  &res0_pack,
+  NULL,
   &res0_unpack,
   &res0_look,
   &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
-  &res0_class,
-  &res0_forward,
+  NULL,
+  NULL,
   &res0_inverse
 };
 

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

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

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

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

<p><p>1.39.2.1  +19 -121   vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.39
retrieving revision 1.39.2.1
diff -u -r1.39 -r1.39.2.1
--- vorbisenc.c	2002/03/24 21:04:01	1.39
+++ vorbisenc.c	2002/05/07 23:47:15	1.39.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.39 2002/03/24 21:04:01 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.39.2.1 2002/05/07 23:47:15 xiphmont Exp $
 
  ********************************************************************/
 
@@ -37,8 +37,6 @@
   vorbis_info_residue0 *res[2];
   static_codebook *book_aux[2];
   static_codebook *books_base[5][10][3];
-  static_codebook *books_stereo_backfill[5][10];
-  static_codebook *books_residue_backfill[5][10][2];
 } vorbis_residue_template;
 
 static double stereo_threshholds[]={0.0, 2.5, 4.5, 8.5, 16.5};
@@ -52,7 +50,6 @@
 #include "modes/floor_44.h"
 
 /* a few static coder conventions */
-static vorbis_info_time0 _time_dummy={0};
 static vorbis_info_mode _mode_set_short={0,0,0,0};
 static vorbis_info_mode _mode_set_long={1,0,0,1};
 
@@ -75,12 +72,6 @@
     ci->blocksizes[0]=small;
     ci->blocksizes[1]=large;
 
-    /* time mapping hooks are unused in vorbis I */
-    ci->times=1;
-    ci->time_type[0]=0;
-    ci->time_param[0]=_ogg_calloc(1,sizeof(_time_dummy));
-    memcpy(ci->time_param[0],&_time_dummy,sizeof(_time_dummy));
-
     /* by convention, two modes: one for short, one for long blocks.
        short block mode uses mapping sero, long block uses mapping 1 */
     ci->modes=2;
@@ -315,8 +306,9 @@
 
 static int vorbis_encode_noisebias_setup(vorbis_info *vi,double q,int block,
                                          double *suppress,
-					 int in[][17],int guard[33]){
-  int i,iq=q*10;
+					 int in[][P_NOISECURVES][17],
+					 int guard[33]){
+  int i,iq=q*10,j;
   double dq;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
@@ -332,9 +324,11 @@
   p->noisewindowlomin=guard[iq*3];
   p->noisewindowhimin=guard[iq*3+1];
   p->noisewindowfixed=guard[iq*3+2];
-  
-  for(i=0;i<P_BANDS;i++)
-    p->noiseoff[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq;
+
+  for(j=0;j<P_NOISECURVES;j++)
+    for(i=0;i<P_BANDS;i++)
+      p->noiseoff[j][i]=in[iq][j][i]*(1.-dq)+in[iq+1][j][i]*dq;
+
   return(0);
 }
 
@@ -385,8 +379,6 @@
 
 static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block,
                                        int coupled_p,
-				       int stereo_backfill_p,
-				       int residue_backfill_p,
                                        vorbis_residue_template *in,
                                        int point_dB,
                                        double point_kHz){
@@ -395,8 +387,6 @@
   int n,k;
   int partition_position=0;
   int res_position=0;
-  int iterations=1;
-  int amplitude_select=0;
 
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_residue0 *r;
@@ -445,82 +435,19 @@
       if(in[iq].books_base[point_dB][i][k])
         r->secondstages[i]|=(1<<k);
   
-  ci->passlimit[0]=3;
-    
   if(coupled_p){
     vorbis_info_mapping0 *map=ci->map_param[block];
-
+    
     map->coupling_steps=1;
     map->coupling_mag[0]=0;
     map->coupling_ang[0]=1;
 
-    psy->couple_pass[0].granulem=1.;
-    psy->couple_pass[0].igranulem=1.;
-
-    psy->couple_pass[0].couple_pass[0].limit=res_position;
-    psy->couple_pass[0].couple_pass[0].outofphase_redundant_flip_p=1;
-    psy->couple_pass[0].couple_pass[0].outofphase_requant_limit=9e10;
-    psy->couple_pass[0].couple_pass[0].amppost_point=0;
-    psy->couple_pass[0].couple_pass[1].limit=9999;
-    psy->couple_pass[0].couple_pass[1].outofphase_redundant_flip_p=1;
-    psy->couple_pass[0].couple_pass[1].outofphase_requant_limit=9e10;
-    psy->couple_pass[0].couple_pass[1].amppost_point=
-      stereo_threshholds[point_dB];
-    amplitude_select=point_dB;
-
-    if(stereo_backfill_p && amplitude_select){
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[1].couple_pass[1].amppost_point=stereo_threshholds[amplitude_select-1];
-      ci->passlimit[1]=4;
-      for(i=0;i<r->partitions;i++)
-	if(in[iq].books_stereo_backfill[amplitude_select][i])
-	  r->secondstages[i]|=8;
-      amplitude_select=amplitude_select-1;
-      iterations++;
-    }
-    
-    if(residue_backfill_p){
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[iterations].granulem=.333333333;
-      psy->couple_pass[iterations].igranulem=3.;
-      psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=1.;
-      psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=1.;
-      for(i=0;i<r->partitions;i++)
-	if(in[iq].books_residue_backfill[amplitude_select][i][0])
-	  r->secondstages[i]|=(1<<(iterations+2));
-      ci->passlimit[iterations]=ci->passlimit[iterations-1]+1;
-      iterations++;
-      
-      memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
-	     sizeof(*psy->couple_pass));
-      psy->couple_pass[iterations].granulem=.1111111111;
-      psy->couple_pass[iterations].igranulem=9.;
-      psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=.3;
-      psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=.3;
-      for(i=0;i<r->partitions;i++)
-	if(in[iq].books_residue_backfill[amplitude_select][i][1])
-	  r->secondstages[i]|=(1<<(iterations+2));
-      ci->passlimit[iterations]=ci->passlimit[iterations-1]+1;
-      iterations++;
-    }
-    ci->coupling_passes=iterations;
+    psy->couple_pass.granulem=1.;
+    psy->couple_pass.igranulem=1.;
 
-  }else{
+    psy->couple_pass.limit=res_position;
+    psy->couple_pass.amppost_point= stereo_threshholds[point_dB];
 
-    if(residue_backfill_p){
-      for(i=0;i<r->partitions;i++){
-	if(in[iq].books_residue_backfill[0][i][0])
-	  r->secondstages[i]|=8;
-	if(in[iq].books_residue_backfill[0][i][1])
-	  r->secondstages[i]|=16;
-      }
-      ci->passlimit[1]=4;
-      ci->passlimit[2]=5;
-      ci->coupling_passes=3;
-    }else
-      ci->coupling_passes=1;
   }
   
   memcpy(&ci->psy_param[block*2+1]->couple_pass,
@@ -540,21 +467,6 @@
           ci->book_param[bookid]=in[iq].books_base[point_dB][i][k];
         }
       }
-      if(coupled_p && stereo_backfill_p && point_dB &&
-	 in[iq].books_stereo_backfill[point_dB][i]){
-	int bookid=book_dup_or_new(ci,in[iq].books_stereo_backfill[point_dB][i]);
-	r->booklist[booklist++]=bookid;
-	ci->book_param[bookid]=in[iq].books_stereo_backfill[point_dB][i];
-      }
-      if(residue_backfill_p){
-	for(k=0;k<2;k++){
-	  if(in[iq].books_residue_backfill[amplitude_select][i][k]){
-	    int bookid=book_dup_or_new(ci,in[iq].books_residue_backfill[amplitude_select][i][k]);
-	    r->booklist[booklist++]=bookid;
-	    ci->book_param[bookid]=in[iq].books_residue_backfill[amplitude_select][i][k];
-	  }
-	}
-      }
     }
   }
 
@@ -616,7 +528,7 @@
 
   ret|=vorbis_encode_floor_setup(vi,hi->base_quality_short,0,
                                 _floor_44_128_books,_floor_44_128,
-				0,1,1,2,2,2,2,2,2,2,2);
+				0,1,1,2,0,2,2,2,2,2,2);
   ret|=vorbis_encode_floor_setup(vi,hi->base_quality_long,1,
                                 _floor_44_1024_books,_floor_44_1024,
                                 0,0,0,0,0,0,0,0,0,0,0);
@@ -706,16 +618,12 @@
     
     ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
                                     1, /* coupled */
-				    hi->stereo_backfill_p,
-				    hi->residue_backfill_p, 
                                     _residue_template_44_stereo,
                                     hi->stereo_point_dB,
                                     hi->stereo_point_kHz[0]);
       
     ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
                                     1, /* coupled */
-				    hi->stereo_backfill_p,
-				    hi->residue_backfill_p, 
                                     _residue_template_44_stereo,
                                     hi->stereo_point_dB,
                                     hi->stereo_point_kHz[1]);
@@ -725,8 +633,6 @@
        coupling */
     ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
                                     0, /* uncoupled */
-				    0,
-				    hi->residue_backfill_p, 
                                     _residue_template_44_uncoupled,
                                     0,
                                     hi->stereo_point_kHz[0]); /* just
@@ -735,8 +641,6 @@
       
     ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
                                     0, /* uncoupled */
-				    0,
-				    hi->residue_backfill_p, 
                                     _residue_template_44_uncoupled,
                                     0,
                                     hi->stereo_point_kHz[1]); /* just
@@ -857,14 +761,13 @@
   hi->amplitude_track_dBpersec=-6.;
 
   hi->stereo_couple_p=1; /* only relevant if a two channel input */
-  hi->stereo_backfill_p=0;
-  hi->residue_backfill_p=0;
 
   /* set the ATH floaters */
   hi->ath_floating_dB=_psy_ath_floater[iq]*(1.-dq)+_psy_ath_floater[iq+1]*dq;
   hi->ath_absolute_dB=_psy_ath_abs[iq]*(1.-dq)+_psy_ath_abs[iq+1]*dq;
 
   /* set stereo dB and Hz */
+  /*iq=0;dq=0;*/
   hi->stereo_point_dB=_psy_stereo_point_dB_44[iq];
   hi->stereo_point_kHz[0]=_psy_stereo_point_kHz_44[0][iq]*(1.-dq)+
     _psy_stereo_point_kHz_44[0][iq+1]*dq;
@@ -947,10 +850,7 @@
     codec_setup_info *ci=vi->codec_setup;
     highlevel_encode_setup *hi=&ci->hi;
 
-    /* backfills */
-    hi->stereo_backfill_p=1;
-    hi->residue_backfill_p=1;
-
+#if 0
     /* no impulse blocks */
     hi->impulse_block_p=0;
     /* de-rate stereo */
@@ -971,7 +871,8 @@
     hi->blocktype[3].noise_bias_quality-=.05;
     if(hi->blocktype[3].noise_bias_quality<0.)
       hi->blocktype[3].noise_bias_quality=0.;
-   
+#endif
+
     /* initialize management.  Currently hardcoded for 44, but so is above. */
     memcpy(&ci->bi,&_bm_44_default,sizeof(ci->bi));
     ci->bi.queue_hardmin=min_bitrate;
@@ -979,9 +880,6 @@
     
     ci->bi.queue_avgmin=tnominal;
     ci->bi.queue_avgmax=tnominal;
-
-    /* adjust management */
-    ci->bi.avgfloat_noise_maxval=_bm_max_noise_offset[(int)approx_vbr];
 
   }
   vi->bitrate_nominal = nominal_bitrate;

<p><p>No                   revision

<p>No                   revision

<p>1.15.2.1  +137 -50   vorbis/lib/modes/psych_44.h

Index: psych_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/psych_44.h,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- psych_44.h	2002/04/08 21:12:38	1.15
+++ psych_44.h	2002/05/07 23:47:21	1.15.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.15 2002/04/08 21:12:38 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.15.2.1 2002/05/07 23:47:21 xiphmont Exp $
 
  ********************************************************************/
 
@@ -498,55 +498,148 @@
   }}
 };
 
-static int _psy_noisebias_long[11][17]={
+static int _psy_noisebias_long[11][P_NOISECURVES][17]={
   /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2,  1,  1,  2,  2,  4},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1,  0,  0,  2},
-
-  {-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2,  0},
-  {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4},
-  {-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-
-  {-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
-  {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+  /* 0 */
+  {{-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10},
+   {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10},
+   {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10}},
+  /* 1 */
+  {{-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2,  1,  1,  2,  2,  4},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2,  1,  1,  2,  2,  4},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2,  1,  1,  2,  2,  4}},
+  /* 2 */
+  {{-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2}},
+  /* 3 */
+  {{-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1,  0,  1,  2}},
+  /* 4 */
+  {{-20,-20,-18,-18,-18,-16,-14, -8, -6, -2,  0,  2,  3,  3,  4,  4, 10},
+   {-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1,  0,  0,  2},
+   {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30}},
+  /* 5 */
+  {{-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2,  0},
+   {-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2,  0},
+   {-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2,  0}},
+  /* 6 */
+  {{-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4},
+   {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4},
+   {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -8, -8, -7, -7, -6, -6, -4}},
+  /* 7 */
+  {{-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-16,-16,-14,-12,-10,-10, -8}},
+  /* 8 */
+  {{-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
+   {-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
+   {-24,-24,-24,-24,-24,-24,-24,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10}},
+  /* 9 */
+  {{-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
+   {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
+   {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24}},
+  /* 10 */
+  {{-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46}},
 };
 
-static int _psy_noisebias_impulse[11][17]={
+static int _psy_noisebias_impulse[11][P_NOISECURVES][17]={
   /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
-  {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2},
-  {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2},
-
-  {-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-  {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
-
-  {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16},
-  {-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50},
+  /* 0 */
+  {{-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6},
+   {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6},
+   {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6}},
+  /* 1 */
+  {{-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -2, -2, -2,  2}},
+  /* 2 */
+  {{-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0}},
+  /* 3 */
+  {{-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2},
+   {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2},
+   {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2}},
+  /* 4 */
+  {{-20,-20,-20,-20,-20,-18,-14,-10,-10, -2,  2,  2,  2,  2,  2,  3,  6},
+   {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2},
+   {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16}},
+  /* 5 */
+  {{-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4},
+   {-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4},
+   {-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4}},
+  /* 6 */
+  {{-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8}},
+  /* 7 */
+  {{-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
+   {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
+   {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14}},
+  /* 8 */
+  {{-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16},
+   {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16},
+   {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16}},
+  /* 9 */
+  {{-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30},
+   {-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30},
+   {-40,-40,-40,-40,-40,-40,-40,-40,-40,-36,-36,-36,-36,-36,-36,-30,-30}},
+  /* 10 */
+  {{-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50}},
 };
 
-static int _psy_noisebias_other[11][17]={
+static int _psy_noisebias_other[11][P_NOISECURVES][17]={
   /*63     125     250     500      1k       2k      4k      8k     16k*/
-  {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10},
-  {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2,  1,  1,  2,  2,  4},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1,  0,  1,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1,  0,  1,  2},
-  {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1,  0,  0,  2},
-
-  {-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2,  0},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4},
-  {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
-
-  {-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
-  {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
-  {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+  /* 0 */
+  {{-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10},
+   {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10},
+   {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10}},
+  /* 1 */
+  {{-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2,  1,  1,  2,  2,  4},
+   {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2,  1,  1,  2,  2,  4},
+   {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2,  1,  1,  2,  2,  4}},
+  /* 2 */
+  {{-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1,  0,  1,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1,  0,  1,  2}},
+  /* 3 */
+  {{-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1,  0,  1,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1,  0,  1,  2},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1,  0,  1,  2}},
+  /* 4 */
+  {{-20,-20,-20,-20,-20,-18,-14,-10, -6, -2,  2,  2,  3,  3,  4,  4, 10},
+   {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1,  0,  0,  2},
+   {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24}},
+  /* 5 */
+  {{-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2,  0},
+   {-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2,  0},
+   {-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2,  0}},
+  /* 6 */
+  {{-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -8, -8, -7, -7, -6, -6, -4}},
+  /* 7 */
+  {{-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8},
+   {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10, -8}},
+  /* 8 */
+  {{-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
+   {-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10},
+   {-34,-34,-34,-34,-30,-30,-30,-20,-20,-20,-20,-20,-16,-16,-14,-14,-10}},
+  /* 9 */
+  {{-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
+   {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24},
+   {-40,-40,-40,-40,-40,-40,-40,-30,-30,-30,-30,-30,-30,-24,-24,-24,-24}},
+  /* 10 */
+  {{-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46},
+   {-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-46}},
 };
 
 static int _psy_noiseguards_short[33]={
@@ -607,7 +700,7 @@
     
     /*noisemaskp,supp, low/high window, low/hi guard, minimum */
     1,          -0.f,         .5f, .5f,         0,0,0,
-    {-1},{-1},105.f,{{-1,-1,{{-1,-1,-1,-1}}}}
+    {{-1},{-1},{-1}},{-1},105.f,{-1,-1,-1,-1}
 };
 
 /* ath ****************/
@@ -648,10 +741,4 @@
 /* lowpass **************/
 static double _psy_lowpass_44[11]={
   15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
-};
-
-/* management noise offset */
-
-static double _bm_max_noise_offset[11]={
-  1.,2.,3.,3.,4.,4.,4.,4.,4.,4.,4.
 };

<p><p>1.11.6.1  +3 -608    vorbis/lib/modes/residue_44.h

Index: residue_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/residue_44.h,v
retrieving revision 1.11
retrieving revision 1.11.6.1
diff -u -r1.11 -r1.11.6.1
--- residue_44.h	2001/12/23 11:53:54	1.11
+++ residue_44.h	2002/05/07 23:47:21	1.11.6.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates for 32/44.1/48kHz
- last mod: $Id: residue_44.h,v 1.11 2001/12/23 11:53:54 xiphmont Exp $
+ last mod: $Id: residue_44.h,v 1.11.6.1 2002/05/07 23:47:21 xiphmont Exp $
 
  ********************************************************************/
 
@@ -20,14 +20,11 @@
 
 static bitrate_manager_info _bm_44_default={
   /* progressive coding and bitrate controls */
-  4.,.0,
+  4.,.5,
   2.,       0,           0,  
             0,           0,
            
-  4.0,2.3, -9999,              .02, 
-
-  3.2,5.0,
-  0.,0.
+  -9999,              9999, 
 };
 
 /***** residue backends *********************************************/
@@ -145,20 +142,6 @@
 #include "books/coupled/_44c0_s3_p7_1.vqh"
 #include "books/coupled/_44c0_s3_p7_2.vqh"
 
-#include "books/coupled/_44c0_s1_p5_s0.vqh"
-#include "books/coupled/_44c0_s1_p6_s0.vqh"
-#include "books/coupled/_44c0_s1_p7_s0.vqh"
-#include "books/coupled/_44c0_s2_p6_s0.vqh"
-#include "books/coupled/_44c0_s2_p7_s0.vqh"
-#include "books/coupled/_44c0_s3_p7_s0.vqh"
-
-#include "books/coupled/_44c0_s0_p0_r0.vqh"
-#include "books/coupled/_44c0_s0_pN_r0.vqh"
-#include "books/coupled/_44c0_s1_pS_r0.vqh"
-#include "books/coupled/_44c0_s0_p0_r1.vqh"
-#include "books/coupled/_44c0_s0_pN_r1.vqh"
-#include "books/coupled/_44c0_s1_pS_r1.vqh"
-
 #include "books/coupled/_44c1_short.vqh"
 #include "books/coupled/_44c1_long.vqh"
 
@@ -280,27 +263,6 @@
 #include "books/coupled/_44c4_s3_p9_1.vqh"
 #include "books/coupled/_44c4_s3_p9_2.vqh"
 
-#include "books/coupled/_44c4_s1_p2_s0.vqh"
-#include "books/coupled/_44c4_s1_p4_s0.vqh"
-#include "books/coupled/_44c4_s1_p6_s0.vqh"
-#include "books/coupled/_44c4_s1_p7_s0.vqh"
-#include "books/coupled/_44c4_s1_p8_s0.vqh"
-#include "books/coupled/_44c4_s1_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s2_p6_s0.vqh"
-#include "books/coupled/_44c4_s2_p7_s0.vqh"
-#include "books/coupled/_44c4_s2_p8_s0.vqh"
-#include "books/coupled/_44c4_s2_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s3_p9_s0.vqh"
-
-#include "books/coupled/_44c4_s0_p0_r0.vqh"
-#include "books/coupled/_44c4_s0_p0_r1.vqh"
-#include "books/coupled/_44c4_s0_pN_r0.vqh"
-#include "books/coupled/_44c4_s0_pN_r1.vqh"
-#include "books/coupled/_44c4_s1_pS_r0.vqh"
-#include "books/coupled/_44c4_s1_pS_r1.vqh"
-
 #include "books/coupled/_44c5_short.vqh"
 #include "books/coupled/_44c5_long.vqh"
 
@@ -405,11 +367,6 @@
 #include "books/coupled/_44c7_s0_p9_1.vqh"
 #include "books/coupled/_44c7_s0_p9_2.vqh"
 
-#include "books/coupled/_44c7_s0_p0_r0.vqh"
-#include "books/coupled/_44c7_s0_p0_r1.vqh"
-#include "books/coupled/_44c7_s0_pN_r0.vqh"
-#include "books/coupled/_44c7_s0_pN_r1.vqh"
-
 #include "books/coupled/_44c8_short.vqh"
 #include "books/coupled/_44c8_long.vqh"
 
@@ -472,47 +429,6 @@
       {&_44c0_s3_p7_0,&_44c0_s3_p7_1,&_44c0_s3_p7_2}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
   /* mode 1; 80-ish */
   {{&_residue_44_low, &_residue_44_low},  
@@ -532,47 +448,6 @@
       {&_44c1_s3_p7_0,&_44c1_s3_p7_1,&_44c1_s3_p7_2}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
   /* mode 2; 96-ish */
   {{&_residue_44_low, &_residue_44_low},  
@@ -592,47 +467,6 @@
       {&_44c2_s3_p7_0,&_44c2_s3_p7_1,&_44c2_s3_p7_2}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
   /* mode 3; 112-ish */
   {{&_residue_44_low, &_residue_44_low},  
@@ -652,47 +486,6 @@
       {&_44c3_s3_p7_0,&_44c3_s3_p7_1,&_44c3_s3_p7_2}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */
-     {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */
-     {0},
-   },
-   { 
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-      {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */
-     {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1},
-       {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
 
   /* mode 4; 128-ish */
@@ -717,67 +510,6 @@
       {&_44c4_s3_p9_0,&_44c4_s3_p9_1,&_44c4_s3_p9_2}},
      {{0}}, /* 24dB (16.5) stereo */
    },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
   },
   /* mode 5; 160-ish */
   {{&_residue_44_mid, &_residue_44_mid},  
@@ -801,67 +533,6 @@
       {&_44c5_s3_p9_0,&_44c5_s3_p9_1,&_44c5_s3_p9_2}},
      {{0}}, /* 24dB (16.5) stereo */
    },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
   },
   /* mode 6; 192-ish */
   {{&_residue_44_mid, &_residue_44_mid},  
@@ -885,67 +556,6 @@
       {&_44c6_s3_p9_0,&_44c6_s3_p9_1,&_44c6_s3_p9_2}},
      {{0}}, /* 24dB (16.5) stereo */
    },
-
-   { {0}, /* lossless stereo */
-     {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0,
-      &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */
-     {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0,
-      &_44c4_s2_p9_s0}, /* (4.5) stereo */
-     {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */
-     {0},
-   },
-   {
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */
-     {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1},
-      {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */
-   },
   },
 
   /* mode 7; 224-ish */
@@ -963,34 +573,6 @@
      {{0}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
 
   /* mode 8; 256-ish */
@@ -1008,34 +590,6 @@
      {{0}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   },
   /* mode 9; 320-ish */
   {{&_residue_44_high, &_residue_44_high},  
@@ -1052,34 +606,6 @@
      {{0}}, /* 18dB (8.5) stereo */
      {{0}}, /* 24dB (16.5) stereo */
    },
-   { {0}, /* lossless stereo */
-     {0}, /* 6dB (2.5) stereo */
-     {0}, /* 12dB (4.5) stereo */
-     {0}, /* 18dB (8.5) stereo */
-     {0},
-     /*{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},*/ /* 24dB (16.5) stereo */
-   },
-   { 
-     {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1},
-      {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */
-     {{0}}, /* 6dB (2.5) stereo */
-     {{0}}, /* 12dB (4.5) stereo */
-     {{0}}, /* 18dB (8.5) stereo */
-     /*{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1},
-      {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1},
-      {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1},
-      {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1},
-      {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}},*/ /* 18dB (8.5) stereo */
-     {{0}}, /* 24dB (16.5) stereo */
-   },
   }
 
 };
@@ -1095,12 +621,6 @@
 #include "books/uncoupled/_44u0_p7_1.vqh"
 #include "books/uncoupled/_44u0_p7_2.vqh"
 
-#include "books/uncoupled/_44u0_p0_r0.vqh"
-#include "books/uncoupled/_44u0_p1_r0.vqh"
-
-#include "books/uncoupled/_44u0_p0_r1.vqh"
-#include "books/uncoupled/_44u0_p1_r1.vqh"
-
 #include "books/uncoupled/_44u4_p1_0.vqh"
 #include "books/uncoupled/_44u4_p2_0.vqh"
 #include "books/uncoupled/_44u4_p3_0.vqh"
@@ -1115,12 +635,6 @@
 #include "books/uncoupled/_44u4_p9_1.vqh"
 #include "books/uncoupled/_44u4_p9_2.vqh"
 
-#include "books/uncoupled/_44u4_p0_r0.vqh"
-#include "books/uncoupled/_44u4_p1_r0.vqh"
-
-#include "books/uncoupled/_44u4_p0_r1.vqh"
-#include "books/uncoupled/_44u4_p1_r1.vqh"
-
 #include "books/uncoupled/_44u7_p1_0.vqh"
 #include "books/uncoupled/_44u7_p2_0.vqh"
 #include "books/uncoupled/_44u7_p2_1.vqh"
@@ -1136,13 +650,6 @@
 #include "books/uncoupled/_44u7_p9_1.vqh"
 #include "books/uncoupled/_44u7_p9_2.vqh"
 
-#include "books/uncoupled/_44u7_p0_r0.vqh"
-#include "books/uncoupled/_44u7_p1_r0.vqh"
-
-#include "books/uncoupled/_44u7_p0_r1.vqh"
-#include "books/uncoupled/_44u7_p1_r1.vqh"
-
-
 static vorbis_residue_template _residue_template_44_uncoupled[11]={
   /* mode 0; 40/c-ish */
   {{&_residue_44_low_un, &_residue_44_low_un},  
@@ -1156,16 +663,6 @@
       {0,0,&_44u0_p6_0},
       {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
-   }
   },
   /* mode 1; 50-ish */
   {{&_residue_44_low_un, &_residue_44_low_un},  
@@ -1179,16 +676,6 @@
       {0,0,&_44u0_p6_0},
       {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
-   }
   },
   /* mode 2; 60-ish */
   {{&_residue_44_low_un, &_residue_44_low_un},  
@@ -1202,16 +689,6 @@
       {0,0,&_44u0_p6_0},
       {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
-   }
   },
   /* mode 3; 70-ish */
   {{&_residue_44_low_un, &_residue_44_low_un},  
@@ -1225,16 +702,6 @@
       {0,0,&_44u0_p6_0},
       {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u0_p0_r0,&_44u0_p0_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1},
-      {&_44u0_p1_r0,&_44u0_p1_r1}},
-   }
   },
   /* mode 4; 80-ish */
   {{&_residue_44_mid, &_residue_44_mid},  
@@ -1250,18 +717,6 @@
       {&_44u4_p8_0,&_44u4_p8_1},
       {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
-   }
   },
   /* mode 5; 90-ish */
   {{&_residue_44_mid, &_residue_44_mid},  
@@ -1277,18 +732,6 @@
       {&_44u4_p8_0,&_44u4_p8_1},
       {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
-   }
   },
   /* mode 6; 100-ish */
   {{&_residue_44_mid, &_residue_44_mid},  
@@ -1304,18 +747,6 @@
       {&_44u4_p8_0,&_44u4_p8_1},
       {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u4_p0_r0,&_44u4_p0_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1},
-      {&_44u4_p1_r0,&_44u4_p1_r1}},
-   }
   },
   /* mode 7 */
   {{&_residue_44_high_un, &_residue_44_high_un},  
@@ -1331,18 +762,6 @@
       {&_44u7_p8_0,&_44u7_p8_1},
       {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
-   }
   },
   /* mode 8 */
   {{&_residue_44_high_un, &_residue_44_high_un},  
@@ -1358,18 +777,6 @@
       {&_44u7_p8_0,&_44u7_p8_1},
       {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
-   }
   },
   /* mode 9 */
   {{&_residue_44_high_un, &_residue_44_high_un},  
@@ -1385,18 +792,6 @@
       {&_44u7_p8_0,&_44u7_p8_1},
       {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}},
    },
-   { {0} }, /* no stereo backfill in uncoupled modes */
-   { {{&_44u7_p0_r0,&_44u7_p0_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1},
-      {&_44u7_p1_r0,&_44u7_p1_r1}},
-   }
   },
 };
 

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



More information about the commits mailing list