[xiph-cvs] cvs commit: vorbis/lib/modes mode_A.h mode_AA.h mode_B.h mode_C.h mode_D.h mode_E.h

Monty xiphmont at xiph.org
Wed Dec 27 15:46:42 PST 2000



xiphmont    00/12/27 15:46:39

  Modified:    .        Tag: monty_branch_20001226 configure.in
                        libvorbis.spec
               debian   Tag: monty_branch_20001226 rules
               examples Tag: monty_branch_20001226 encoder_example.c
               include/vorbis Tag: monty_branch_20001226 codec.h
               lib      Tag: monty_branch_20001226 analysis.c backends.h
                        block.c codec_internal.h envelope.c floor0.c info.c
                        mapping0.c psy.c psy.h psytune.c scales.h
               lib/modes Tag: monty_branch_20001226 mode_A.h mode_AA.h
                        mode_B.h mode_C.h mode_D.h mode_E.h
  Log:
  Major work on psy.c
  some global optimization (less memory and lin->dB->lin conversions)
  median based noise curve
  FFT based tone masking
  
  *much* faster encode.
  
  We still have a bug where current tuning overflows codebooks on the
  100dB masking curves.  Hacked around for now.
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.31.2.1  +1 -1      vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -u -r1.31 -r1.31.2.1
--- configure.in	2000/11/18 05:02:34	1.31
+++ configure.in	2000/12/27 23:46:32	1.31.2.1
@@ -5,7 +5,7 @@
 dnl ------------------------------------------------
 
 AC_INIT(lib/mdct.c)
-AM_INIT_AUTOMAKE(libvorbis,1.0beta3)
+AM_INIT_AUTOMAKE(libvorbis,1.0prebeta4)
 
 dnl Library versioning
 

1.6.2.1   +1 -1      vorbis/libvorbis.spec

Index: libvorbis.spec
===================================================================
RCS file: /usr/local/cvsroot/vorbis/libvorbis.spec,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- libvorbis.spec	2000/11/18 02:25:19	1.6
+++ libvorbis.spec	2000/12/27 23:46:32	1.6.2.1
@@ -1,5 +1,5 @@
 %define name	libvorbis
-%define version	1.0beta3
+%define version	1.0prebeta4
 %define release 1
 
 Summary:	The Vorbis General Audio Compression Codec

No                   revision

No                   revision

1.10.2.1  +1 -1      vorbis/debian/rules

Index: rules
===================================================================
RCS file: /usr/local/cvsroot/vorbis/debian/rules,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- rules	2000/11/18 04:49:13	1.10
+++ rules	2000/12/27 23:46:33	1.10.2.1
@@ -58,7 +58,7 @@
 
         dh_movefiles
 
-	dh_installdocs debian/tmp/usr/share/doc/libvorbis-1.0beta3/*
+	dh_installdocs debian/tmp/usr/share/doc/libvorbis-1.0prebeta4/*
         dh_installexamples
         dh_installmanpages
         dh_installchangelogs 

No                   revision

No                   revision

1.17.2.1  +2 -2      vorbis/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- encoder_example.c	2000/12/21 21:04:37	1.17
+++ encoder_example.c	2000/12/27 23:46:33	1.17.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.17 2000/12/21 21:04:37 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.17.2.1 2000/12/27 23:46:33 xiphmont Exp $
 
  ********************************************************************/
 
@@ -80,7 +80,7 @@
   /* choose an encoding mode */
   /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
   vorbis_info_init(&vi);
-  vorbis_encode_init(&vi,2,44100, -1, 160000, -1);
+  vorbis_encode_init(&vi,2,44100, -1, 128000, -1);
 
   /* add a comment */
   vorbis_comment_init(&vc);

No                   revision

No                   revision

1.33.2.1  +2 -1      vorbis/include/vorbis/codec.h

Index: codec.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/codec.h,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -r1.33 -r1.33.2.1
--- codec.h	2000/11/06 00:06:55	1.33
+++ codec.h	2000/12/27 23:46:34	1.33.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.33 2000/11/06 00:06:55 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.33.2.1 2000/12/27 23:46:34 xiphmont Exp $
 
  ********************************************************************/
 
@@ -89,6 +89,7 @@
 typedef struct vorbis_block{
   /* necessary stream state for linking to the framing abstraction */
   float  **pcm;       /* this is a pointer into local storage */ 
+  float  **pcmdelay;  /* this is a pointer into local storage */ 
   oggpack_buffer opb;
   
   long  lW;

No                   revision

No                   revision

1.40.2.1  +3 -3      vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.40
retrieving revision 1.40.2.1
diff -u -r1.40 -r1.40.2.1
--- analysis.c	2000/12/21 21:04:38	1.40
+++ analysis.c	2000/12/27 23:46:34	1.40.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.40 2000/12/21 21:04:38 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.40.2.1 2000/12/27 23:46:34 xiphmont Exp $
 
  ********************************************************************/
 
@@ -55,9 +55,9 @@
   if(vb->W){
     oggpack_write(&vb->opb,vb->lW,1);
     oggpack_write(&vb->opb,vb->nW,1);
-    /*fprintf(stderr,"*");
+    fprintf(stderr,"*");
   }else{
-  fprintf(stderr,".");*/
+    fprintf(stderr,".");
   }
 
   if((ret=_mapping_P[type]->forward(vb,b->mode[mode])))

1.3.2.1   +2 -2      vorbis/lib/backends.h

Index: backends.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/backends.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- backends.h	2000/11/17 11:47:18	1.3
+++ backends.h	2000/12/27 23:46:34	1.3.2.1
@@ -13,7 +13,7 @@
 
  function: libvorbis backend and mapping structures; needed for 
            static mode headers
- last mod: $Id: backends.h,v 1.3 2000/11/17 11:47:18 xiphmont Exp $
+ last mod: $Id: backends.h,v 1.3.2.1 2000/12/27 23:46:34 xiphmont Exp $
 
  ********************************************************************/
 
@@ -62,7 +62,7 @@
   void (*free_info) (vorbis_info_floor *);
   void (*free_look) (vorbis_look_floor *);
   int  (*forward)   (struct vorbis_block *,vorbis_look_floor *,
-		     float *,float *,vorbis_bitbuffer *);
+		     float *,vorbis_bitbuffer *);
   float(*forward2)  (struct vorbis_block *,vorbis_look_floor *,
                      long,float, vorbis_bitbuffer *);
   int  (*inverse)   (struct vorbis_block *,vorbis_look_floor *,

1.42.2.1  +34 -22    vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.42
retrieving revision 1.42.2.1
diff -u -r1.42 -r1.42.2.1
--- block.c	2000/12/21 21:04:38	1.42
+++ block.c	2000/12/27 23:46:35	1.42.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.42 2000/12/21 21:04:38 xiphmont Exp $
+ last mod: $Id: block.c,v 1.42.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -533,9 +533,18 @@
   /* copy the vectors; this uses the local storage in vb */
   {
     vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
+    vb->pcmdelay=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
     for(i=0;i<vi->channels;i++){
+      vb->pcmdelay[i]=
+	_vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(float));
+      memcpy(vb->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(float));
+      vb->pcm[i]=vb->pcmdelay[i]+beginW;
+      
+      /* before we added the delay 
       vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
       memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(float));
+      */
+
     }
   }
   
@@ -553,33 +562,36 @@
 
   /* advance storage vectors and clean up */
   {
-    int new_centerNext=ci->blocksizes[1]/2;
+    int new_centerNext=ci->blocksizes[1]/2+ci->delaycache;
     int movementW=centerNext-new_centerNext;
-
-    _ve_envelope_shift(b->ve,movementW);
-    v->pcm_current-=movementW;
-
-    for(i=0;i<vi->channels;i++)
-      memmove(v->pcm[i],v->pcm[i]+movementW,
-	      v->pcm_current*sizeof(float));
-
-
-    v->lW=v->W;
-    v->W=v->nW;
-    v->centerW=new_centerNext;
 
-    v->sequence++;
+    if(movementW>0){
 
-    if(v->eofflag){
-      v->eofflag-=movementW;
-      /* do not add padding to end of stream! */
-      if(v->centerW>=v->eofflag){
-	v->granulepos+=movementW-(v->centerW-v->eofflag);
+      _ve_envelope_shift(b->ve,movementW);
+      v->pcm_current-=movementW;
+      
+      for(i=0;i<vi->channels;i++)
+	memmove(v->pcm[i],v->pcm[i]+movementW,
+		v->pcm_current*sizeof(float));
+      
+      
+      v->lW=v->W;
+      v->W=v->nW;
+      v->centerW=new_centerNext;
+      
+      v->sequence++;
+      
+      if(v->eofflag){
+	v->eofflag-=movementW;
+	/* do not add padding to end of stream! */
+	if(v->centerW>=v->eofflag){
+	  v->granulepos+=movementW-(v->centerW-v->eofflag);
+	}else{
+	  v->granulepos+=movementW;
+	}
       }else{
         v->granulepos+=movementW;
       }
-    }else{
-      v->granulepos+=movementW;
     }
   }
 

1.3.2.1   +7 -3      vorbis/lib/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codec_internal.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- codec_internal.h	2000/11/17 11:47:18	1.3
+++ codec_internal.h	2000/12/27 23:46:35	1.3.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.3 2000/11/17 11:47:18 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.3.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -103,10 +103,14 @@
   vorbis_info_psy     *psy_param[64]; /* encode only */
   
   /* for block long/sort tuning; encode only */
-  int        envelopesa;
+  int       envelopesa;
   float     preecho_thresh;
-  float     preecho_clamp;
+  float     postecho_thresh;
   float     preecho_minenergy;
+
+  /* delay caching... how many samples to keep around prior to our
+     current block to aid in analysis? */
+  int       delaycache;
 
 } codec_setup_info;
 

1.28.2.1  +39 -31    vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.28
retrieving revision 1.28.2.1
diff -u -r1.28 -r1.28.2.1
--- envelope.c	2000/12/21 21:04:39	1.28
+++ envelope.c	2000/12/27 23:46:35	1.28.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.28 2000/12/21 21:04:39 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.28.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  Preecho calculation.
 
@@ -111,52 +111,53 @@
   memset(e,0,sizeof(envelope_lookup));
 }
 
-static float _ve_deltai(envelope_lookup *ve,
-		      float *pre,float *post){
-  long n2=ve->winlength*2;
+/* straight threshhold based until we find something that works better
+   and isn't patented */
+static float _ve_deltai(envelope_lookup *ve,float *pre,float *post){
   long n=ve->winlength;
 
-  float *workA=alloca(sizeof(float)*n2),A=0.f;
-  float *workB=alloca(sizeof(float)*n2),B=0.f;
   long i;
 
+  /* we want to have a 'minimum bar' for energy, else we're just
+     basing blocks on quantization noise that outweighs the signal
+     itself (for low power signals) */
+
+  float min=ve->minenergy;
+  float A=min*min*n;
+  float B=A;
+
   /*_analysis_output("A",granulepos,pre,n,0,0);
     _analysis_output("B",granulepos,post,n,0,0);*/
 
   for(i=0;i<n;i++){
-    workA[i]=pre[i]*ve->window[i];
-    workB[i]=post[i]*ve->window[i];
+    A+=pre[i]*pre[i];
+    B+=post[i]*post[i];
   }
+
+  A=todB(A);
+  B=todB(B);
 
-  /*_analysis_output("Awin",granulepos,workA,n,0,0);
-    _analysis_output("Bwin",granulepos,workB,n,0,0);*/
+  return(B-A);
+}
 
-  drft_forward(&ve->drft,workA);
-  drft_forward(&ve->drft,workB);
+static float _ve_ampi(envelope_lookup *ve,float *pre){
+  long n=ve->winlength;
 
+  long i;
+
   /* we want to have a 'minimum bar' for energy, else we're just
      basing blocks on quantization noise that outweighs the signal
      itself (for low power signals) */
-  {
-    float min=ve->minenergy;
-    for(i=0;i<n;i++){
-      if(fabs(workA[i])<min)workA[i]=min;
-      if(fabs(workB[i])<min)workB[i]=min;
-    }
-  }
 
-  /*_analysis_output("Afft",granulepos,workA,n,0,0);
-    _analysis_output("Bfft",granulepos,workB,n,0,0);*/
+  float min=ve->minenergy;
+  float A=min*min*n;
 
   for(i=0;i<n;i++){
-    A+=workA[i]*workA[i];
-    B+=workB[i]*workB[i];
+    A+=pre[i]*pre[i];
   }
 
   A=todB(A);
-  B=todB(B);
-
-  return(B-A);
+  return(A);
 }
 
 long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
@@ -164,7 +165,7 @@
   codec_setup_info *ci=vi->codec_setup;
   envelope_lookup *ve=((backend_lookup_state *)(v->backend_state))->ve;
   long i,j;
-  
+
   /* make sure we have enough storage to match the PCM */
   if(v->pcm_storage>ve->storage){
     ve->storage=v->pcm_storage;
@@ -194,7 +195,7 @@
     j=v->centerW+ci->blocksizes[1]/4-ci->blocksizes[0]/4;
   else
     j=v->centerW;
-
+  
   while(j+ve->winlength<=v->pcm_current){
     for(i=0;i<ve->ch;i++){
       float *filtered=ve->filtered[i]+j;
@@ -204,13 +205,20 @@
         /*granulepos++;*/
         return(0);
       }
+      if(m<ci->postecho_thresh){
+	/*granulepos++;*/
+	return(0);
+      }
       /*granulepos++;*/
     }
     
-    j+=ci->blocksizes[0]/2;
-    if(j>=searchpoint)return(1);
+    j+=min(ci->blocksizes[0],ve->winlength)/2;
+
+    if(j>=searchpoint){
+      return(1);
+    }
   }
-  
+ 
   return(-1);
 }
 

1.34.2.1  +24 -34    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.34
retrieving revision 1.34.2.1
diff -u -r1.34 -r1.34.2.1
--- floor0.c	2000/12/21 21:04:39	1.34
+++ floor0.c	2000/12/27 23:46:35	1.34.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.34 2000/12/21 21:04:39 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.34.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -238,12 +238,13 @@
 }
 
 /* generate the whole freq response curve of an LSP IIR filter */
+/* didn't need in->out seperation, modifies the flr[] vector; takes in
+   a dB scale floor, puts out linear */
 static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
-		    float *in,float *out,vorbis_bitbuffer *vbb){
+		    float *flr,vorbis_bitbuffer *vbb){
   long j;
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
-  float *work=alloca((look->ln+look->n)*sizeof(float));
   float amp;
   long bits=0;
   long val=0;
@@ -263,15 +264,15 @@
   ef=fopen(buffer,"a");
 #endif
 
-  /* our floor comes in on a linear scale; go to a [-Inf...0] dB
-     scale.  The curve has to be positive, so we offset it. */
+  /* 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++)
-    work[j]=todB(in[j])+info->ampdB;
+    flr[j]+=info->ampdB;
 
   /* use 'out' as temp storage */
   /* Convert our floor to a set of lpc coefficients */ 
-  amp=sqrt(_curve_to_lpc(work,out,look));
+  amp=sqrt(_curve_to_lpc(flr,flr,look));
 
   /* amp is in the range (0. to ampdB].  Encode that range using
      ampbits bits */
@@ -292,6 +293,7 @@
   }
 
   if(val){
+    float *lspwork=alloca(look->m*sizeof(float));
 
     /* the spec supports using one of a number of codebooks.  Right
        now, encode using this lib supports only one */
@@ -300,18 +302,17 @@
     bitbuf_write(vbb,0,_ilog(info->numbooks));
 
     /* LSP <-> LPC is orthogonal and LSP quantizes more stably  */
-    vorbis_lpc_to_lsp(out,out,look->m);
+    vorbis_lpc_to_lsp(flr,flr,look->m);
 
 #ifdef ANALYSIS
-    {
-      float *lspwork=alloca(look->m*sizeof(float));
-      memcpy(lspwork,out,look->m*sizeof(float));
-      vorbis_lsp_to_curve(work,look->linearmap,look->n,look->ln,
-			  lspwork,look->m,amp,info->ampdB);
-      _analysis_output("prefit",seq,work,look->n,0,1);
-
-    }
-
+#ifndef TRAIN_LSP
+    
+    memcpy(lspwork,flr,look->m*sizeof(float));
+    vorbis_lsp_to_curve(flr,look->linearmap,look->n,look->ln,
+			lspwork,look->m,amp,info->ampdB);
+    _analysis_output("prefit",seq,flr,look->n,0,1);
+    
+#endif
 #endif
 
 
@@ -320,8 +321,8 @@
     {
       float last=0.f;
       for(j=0;j<look->m;j++){
-	fprintf(of,"%.12g, ",out[j]-last);
-	last=out[j];
+	fprintf(of,"%.12g, ",flr[j]-last);
+	last=flr[j];
       }
     }
     fprintf(of,"\n");
@@ -334,7 +335,7 @@
        nailed to the last quantized value of the previous block. */
 
     for(j=0;j<look->m;j+=b->dim){
-      int entry=_f0_fit(b,out,work,j);
+      int entry=_f0_fit(b,flr,lspwork,j);
       bits+=vorbis_book_bufencode(b,entry,vbb);
 
 #ifdef TRAIN_LSP
@@ -343,28 +344,17 @@
 
     }
 
-#ifdef ANALYSIS
-    {
-      float last=0;
-      for(j=0;j<look->m;j++){
-	out[j]=work[j]-last;
-	last=work[j];
-      }
-    }
-	
-#endif
-
 #ifdef TRAIN_LSP
     fclose(ef);
 #endif
 
     /* take the coefficients back to a spectral envelope curve */
-    vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
-			work,look->m,amp,info->ampdB);
+    vorbis_lsp_to_curve(flr,look->linearmap,look->n,look->ln,
+			lspwork,look->m,amp,info->ampdB);
     return(val);
   }
 
-  memset(out,0,sizeof(float)*look->n);
+  memset(flr,0,sizeof(float)*look->n);
   seq++;
   return(val);
 }

1.33.2.1  +2 -2      vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -r1.33 -r1.33.2.1
--- info.c	2000/11/14 00:05:31	1.33
+++ info.c	2000/12/27 23:46:35	1.33.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.33 2000/11/14 00:05:31 xiphmont Exp $
+ last mod: $Id: info.c,v 1.33.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -409,7 +409,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiphophorus libVorbis I 20001031";
+  char temp[]="Xiphophorus libVorbis I 20001223";
 
   /* preamble */  
   oggpack_write(opb,0x03,8);

1.22.2.1  +108 -129  vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -u -r1.22 -r1.22.2.1
--- mapping0.c	2000/12/21 21:04:39	1.22
+++ mapping0.c	2000/12/27 23:46:35	1.22.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.22 2000/12/21 21:04:39 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.22.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -39,6 +39,7 @@
    parameters from other areas of the mode/mapping */
 
 typedef struct {
+  drft_lookup fft_look;
   vorbis_info_mode *mode;
   vorbis_info_mapping0 *map;
 
@@ -53,7 +54,6 @@
   vorbis_func_residue **residue_func;
 
   int ch;
-  float **decay;
   long lastframe; /* if a different mode is called, we need to 
                      invalidate decay */
 } vorbis_look_mapping0;
@@ -76,6 +76,8 @@
   int i;
   vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
   if(l){
+    drft_clear(&l->fft_look);
+
     for(i=0;i<l->map->submaps;i++){
       l->time_func[i]->free_look(l->time_look[i]);
       l->floor_func[i]->free_look(l->floor_look[i]);
@@ -83,13 +85,6 @@
       if(l->psy_look)_vp_psy_clear(l->psy_look+i);
     }
 
-    if(l->decay){
-      for(i=0;i<l->ch;i++){
-	if(l->decay[i])_ogg_free(l->decay[i]);
-      }
-      _ogg_free(l->decay);
-    }
-
     _ogg_free(l->time_func);
     _ogg_free(l->floor_func);
     _ogg_free(l->residue_func);
@@ -144,12 +139,8 @@
   }
 
   look->ch=vi->channels;
-  if(ci->psys){
-    look->decay=_ogg_calloc(vi->channels,sizeof(float *));
-    for(i=0;i<vi->channels;i++)
-      look->decay[i]=_ogg_calloc(ci->blocksizes[vm->blockflag]/2,sizeof(float));
-  }
 
+  if(vd->analysisp)drft_init(&look->fft_look,ci->blocksizes[vm->blockflag]);
   return(look);
 }
 
@@ -225,8 +216,9 @@
   float **pcmbundle=alloca(sizeof(float *)*vi->channels);
 
   int    *nonzero=alloca(sizeof(int)*vi->channels);
+
   float **floor=_vorbis_block_alloc(vb,vi->channels*sizeof(float *));
-  float **nonquant=_vorbis_block_alloc(vb,vi->channels*sizeof(float *));
+  float *additional=_vorbis_block_alloc(vb,n*sizeof(float));
 
   vorbis_bitbuffer      vbb_res;
   vorbis_bitbuffer      *vbb_flr=_vorbis_block_alloc(vb,
@@ -237,145 +229,132 @@
     bitbuf_init(vbb_flr+i,vb);
   bitbuf_init(&vbb_res,vb);
   
-  /* time domain pre-window: NONE IMPLEMENTED */
-
-  /* window the PCM data: takes PCM vector, vb; modifies PCM vector */
-
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
+    float scale=4.f/n;
+    int submap=info->chmuxlist[i];
+
+    /* window the PCM data */
     for(j=0;j<n;j++)
-      pcm[j]*=window[j];
-  }
+      additional[j]=pcm[j]*=window[j];
             
-  /* time-domain post-window: NONE IMPLEMENTED */
-
-  /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
-  /* only MDCT right now.... */
-  for(i=0;i<vi->channels;i++){
-    float *pcm=vb->pcm[i];
-    float *outq=nonquant[i]=_vorbis_block_alloc(vb,n*sizeof(float));
+    /* transform the PCM data */
+    /* only MDCT right now.... */
     mdct_forward(b->transform[vb->W][0],pcm,pcm);
+    
+    /* FFT yields more accurate tonal estimation (not phase sensitive) */
+    drft_forward(&look->fft_look,additional);
+    
+    additional[0]*=scale;
+    for(j=1;j<n-1;j+=2)
+      additional[(j+1)>>1]=scale*FAST_HYPOT(additional[j],additional[j+1]);
 
+    /* set up our masking data working vector, and stash unquantized
+       data for later */
     memcpy(pcm+n/2,pcm,n*sizeof(float)/2);
-    mdct_backward(b->transform[vb->W][0],pcm,outq);
-    for(j=0;j<n;j++)
-      outq[j]*=window[j];
-    
-  }
+    memcpy(additional+n/2,pcm,n*sizeof(float)/2);
 
-  {
-    for(i=0;i<vi->channels;i++){
-      float *pcm=vb->pcm[i];
-      float *decay=look->decay[i];
-      int submap=info->chmuxlist[i];
-      floor[i]=_vorbis_block_alloc(vb,n*sizeof(float)/2);
+    /* begin masking work */
+    floor[i]=_vorbis_block_alloc(vb,n*sizeof(float)/2);
 
-      /* if some other mode/mapping was called last frame, our decay
-         accumulator is out of date.  Clear it. */
-      if(look->lastframe+1 != vb->sequence)
-	memset(decay,0,n*sizeof(float)/2);
-
-      /* perform psychoacoustics; do masking */
-      _vp_compute_mask(look->psy_look+submap,pcm,floor[i],decay);
- 
-      _analysis_output("decay",seq,decay,n/2,0,1);
-      _analysis_output("mdct",seq,pcm,n/2,0,1);
-      _analysis_output("lmdct",seq,pcm,n/2,0,0);
-      _analysis_output("prefloor",seq,floor[i],n/2,0,1);
-
-      /* perform floor encoding */
-      nonzero[i]=look->floor_func[submap]->
-	forward(vb,look->floor_look[submap],floor[i],floor[i],vbb_flr+i);
+    _analysis_output("fft",seq,additional,n/2,0,1);
+    _analysis_output("mdct",seq,additional+n/2,n/2,0,1);
+    _analysis_output("lfft",seq,additional,n/2,0,0);
+    _analysis_output("lmdct",seq,additional+n/2,n/2,0,0);
 
-      _analysis_output("floor",seq,floor[i],n/2,0,1);
+    /* perform psychoacoustics; do masking */
+    _vp_compute_mask(look->psy_look+submap,additional,additional+n/2,
+		     floor[i],NULL);
 
-      /* apply the floor, do optional noise levelling */
-      _vp_apply_floor(look->psy_look+submap,pcm,floor[i]);
+    _analysis_output("prefloor",seq,floor[i],n/2,0,0);
+    
+    /* perform floor encoding */
+    nonzero[i]=look->floor_func[submap]->
+      forward(vb,look->floor_look[submap],floor[i],vbb_flr+i);
+
+    _analysis_output("floor",seq,floor[i],n/2,0,1);
+
+    /* apply the floor, do optional noise levelling */
+    _vp_apply_floor(look->psy_look+submap,pcm,floor[i]);
       
-      _analysis_output("res",seq++,pcm,n/2,0,0);
+    _analysis_output("res",seq++,pcm,n/2,0,0);
       
 #ifdef TRAIN_RES
-      if(nonzero[i]){
-	FILE *of;
-	char buffer[80];
-	int i;
-	
-	sprintf(buffer,"residue_%d.vqd",vb->mode);
-	of=fopen(buffer,"a");
-	for(i=0;i<n/2;i++)
-	  fprintf(of,"%.2f, ",pcm[i]);
-	fprintf(of,"\n");
-	fclose(of);
-      }
-#endif      
-
+    if(nonzero[i]){
+      FILE *of;
+      char buffer[80];
+      int i;
+      
+      sprintf(buffer,"residue_%d.vqd",vb->mode);
+      of=fopen(buffer,"a");
+      for(i=0;i<n/2;i++)
+	fprintf(of,"%.2f, ",pcm[i]);
+      fprintf(of,"\n");
+      fclose(of);
     }
+#endif      
     
-    /* perform residue encoding with residue mapping; this is
-       multiplexed.  All the channels belonging to one submap are
-       encoded (values interleaved), then the next submap, etc */
+  }
     
-    for(i=0;i<info->submaps;i++){
-      int ch_in_bundle=0;
-      for(j=0;j<vi->channels;j++){
-	if(info->chmuxlist[j]==i && nonzero[j]>0){
-	  pcmbundle[ch_in_bundle++]=vb->pcm[j];
-	}
+  /* perform residue encoding with residue mapping; this is
+     multiplexed.  All the channels belonging to one submap are
+     encoded (values interleaved), then the next submap, etc */
+  
+  for(i=0;i<info->submaps;i++){
+    int ch_in_bundle=0;
+    for(j=0;j<vi->channels;j++){
+      if(info->chmuxlist[j]==i && nonzero[j]>0){
+	pcmbundle[ch_in_bundle++]=vb->pcm[j];
       }
-      
-      look->residue_func[i]->forward(vb,look->residue_look[i],
-				     pcmbundle,ch_in_bundle,&vbb_res);
     }
+    
+    look->residue_func[i]->forward(vb,look->residue_look[i],
+				   pcmbundle,ch_in_bundle,&vbb_res);
+  }
+  
+  /* go back and compute the original MDCT inverse and our quantized
+     inverse; we'll want to give the floor mapping a shot at
+     massaging things before we write out the final version. */
+  
+  {
+    for(i=0;i<vi->channels;i++){
+      float *pcm=vb->pcm[i];
+      float *pcmori=vb->pcm[i]+n/2;
+      float *quant=floor[i];
+      float num=0.f,den=0.f;
+      int submap=info->chmuxlist[i];
+      
+      if(nonzero[i]){
 
-    /* go back and compute the original MDCT inverse and our quantized
-       inverse; we'll want to give the floor mapping a shot at
-       massaging things before we write out the final version. */
-
-    {
-      for(i=0;i<vi->channels;i++){
-	float *pcm=vb->pcm[i];
-	float *pcmori=vb->pcm[i]+n/2;
-	float *orig=nonquant[i];
-	float *quant=floor[i];
-	float num=0.f,den=0.f;
-	int submap=info->chmuxlist[i];
+	mdct_backward(b->transform[vb->W][0],pcm+n/2,additional);
+	for(j=0;j<n;j++)
+	  additional[j]*=window[j];
+
+	for(j=0;j<n/2;j++)
+	  pcm[j]=pcmori[j]-pcm[j]*quant[j];	
+	mdct_backward(b->transform[vb->W][0],pcm,pcm);
+	for(j=0;j<n;j++)
+	  pcm[j]*=window[j];
         
-	if(nonzero[i]){
-
-	  for(j=0;j<n/2;j++)
-	    pcm[j]=pcmori[j]-pcm[j]*quant[j];
-	  
-	  mdct_backward(b->transform[vb->W][0],pcm,pcm);
-	  for(j=0;j<n;j++)
-	    pcm[j]*=window[j];
-	  
-	  /* weighted compare twixt original and quantized mdct output */
-	  for(j=0;j<n;j++){
-	    den+=(pcm[j]*pcm[j]);
-	    num+=(orig[j]*orig[j]);
-	  }
-	  
-	  num=sqrt(num);
-	  den=sqrt(den);
-
+	/* weighted compare twixt original and quantized mdct output */
+	for(j=0;j<n;j++){
+	  den+=(pcm[j]*pcm[j]);
+	  num+=(additional[j]*additional[j]);
         }
-
-	num=look->floor_func[submap]->
-	  forward2(vb,look->floor_look[submap],
-		   nonzero[i],den==0.f?0.:num/den,vbb_flr+i);
-
-	/*for(j=0;j<n;j++)
-	  pcm[j]*=num;
-	_analysis_output("i_orig",seq,orig,n,0,0);
-	_analysis_output("i_quant",seq++,pcm,n,0,0);
-	*/
-
+	
+	num=sqrt(num);
+	den=sqrt(den);
+	
       }
+      
+      look->floor_func[submap]->
+	forward2(vb,look->floor_look[submap],
+		 nonzero[i],den==0.f?0.:num/den,vbb_flr+i);
+      
     }
-
-    bitbuf_pack(&vb->opb,&vbb_res);
-
   }
+
+  bitbuf_pack(&vb->opb,&vbb_res);
 
   look->lastframe=vb->sequence;
   return(0);

1.34.2.1  +297 -362  vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.34
retrieving revision 1.34.2.1
diff -u -r1.34 -r1.34.2.1
--- psy.c	2000/12/21 21:04:40	1.34
+++ psy.c	2000/12/27 23:46:35	1.34.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.34 2000/12/21 21:04:40 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.34.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -29,6 +29,8 @@
 #include "scales.h"
 #include "misc.h"
 
+#define NEGINF -9999.f
+
 /* Why Bark scale for encoding but not masking computation? Because
    masking has a strong harmonic dependancy */
 
@@ -47,7 +49,7 @@
   return(ret);
 }
 
-/* Set up decibel threshhold slopes on a Bark frequency scale */
+/* Set up decibel threshold slopes on a Bark frequency scale */
 /* ATH is the only bit left on a Bark scale.  No reason to change it
    right now */
 static void set_curve(float *ref,float *c,int n, float crate){
@@ -83,15 +85,6 @@
     c[i]+=att;
 }
 
-static void linear_curve(float *c){
-  int i;  
-  for(i=0;i<EHMER_MAX;i++)
-    if(c[i]<=-200.f)
-      c[i]=0.f;
-    else
-      c[i]=fromdB(c[i]);
-}
-
 static void interp_curve(float *c,float *c1,float *c2,float del){
   int i;
   for(i=0;i<EHMER_MAX;i++)
@@ -105,8 +98,8 @@
   float ath[EHMER_MAX];
   float tempc[P_LEVELS][EHMER_MAX];
 
-  memcpy(c[0],c[4],sizeof(float)*EHMER_MAX);
-  memcpy(c[2],c[4],sizeof(float)*EHMER_MAX);
+  memcpy(c[0]+2,c[4]+2,sizeof(float)*EHMER_MAX);
+  memcpy(c[2]+2,c[4]+2,sizeof(float)*EHMER_MAX);
 
   /* we add back in the ATH to avoid low level curves falling off to
      -infinity and unneccessarily cutting off high level curves in the
@@ -115,8 +108,8 @@
      mask too little than too much, so be pessimal. */
 
   for(i=0;i<EHMER_MAX;i++){
-    float oc_min=band*.5-1+(i-EHMER_OFFSET)*.125;
-    float oc_max=band*.5-1+(i-EHMER_OFFSET+1)*.125;
+    float oc_min=band*.5+(i-EHMER_OFFSET)*.125;
+    float oc_max=band*.5+(i-EHMER_OFFSET+1)*.125;
     float bark=toBARK(fromOC(oc_min));
     int ibark=floor(bark);
     float del=bark-ibark;
@@ -125,7 +118,7 @@
     if(ibark<26)
       ath_min=ATH_Bark_dB[ibark]*(1.f-del)+ATH_Bark_dB[ibark+1]*del;
     else
-      ath_min=200.f;
+      ath_min=ATH_Bark_dB[25];
 
     bark=toBARK(fromOC(oc_max));
     ibark=floor(bark);
@@ -134,7 +127,7 @@
     if(ibark<26)
       ath_max=ATH_Bark_dB[ibark]*(1.f-del)+ATH_Bark_dB[ibark+1]*del;
     else
-      ath_max=200.f;
+      ath_max=ATH_Bark_dB[25];
 
     ath[i]=min(ath_min,ath_max);
   }
@@ -142,16 +135,16 @@
   /* The c array is 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],c[i-1],c[i+1],.5);
+    interp_curve(c[i]+2,c[i-1]+2,c[i+1]+2,.5);
   }
 
   /* normalize curves so the driving amplitude is 0dB */
   /* make temp curves with the ATH overlayed */
   for(i=0;i<P_LEVELS;i++){
-    attenuate_curve(c[i],curveatt_dB[i]);
+    attenuate_curve(c[i]+2,curveatt_dB[i]);
     memcpy(tempc[i],ath,EHMER_MAX*sizeof(float));
     attenuate_curve(tempc[i],-i*10.f);
-    max_curve(tempc[i],c[i]);
+    max_curve(tempc[i],c[i]+2);
   }
 
   /* Now limit the louder curves.
@@ -166,18 +159,40 @@
 
   for(j=1;j<P_LEVELS;j++){
     min_curve(tempc[j],tempc[j-1]);
-    min_curve(c[j],tempc[j]);
+    min_curve(c[j]+2,tempc[j]);
   }
 
-  /* take things out of dB domain into linear amplitude */
-  for(i=0;i<P_LEVELS;i++)
-    linear_curve(c[i]);
+  /* add fenceposts */
+  for(j=0;j<P_LEVELS;j++){
 
+    for(i=0;i<EHMER_MAX;i++)
+      if(c[j][i+2]>-200.f){
+	c[j][0]=i;
+	break;
+      }
+
+    for(i=EHMER_MAX-1;i>=0;i--)
+      if(c[j][i+2]>-200.f){
+	c[j][1]=i;
+	break;
+      }
+
+  }
 }
 
 void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){
   long i,j;
+  long maxoc;
   memset(p,0,sizeof(vorbis_look_psy));
+
+
+  p->eighth_octave_lines=vi->eighth_octave_lines;
+  p->shiftoc=rint(log(vi->eighth_octave_lines*8)/log(2))-1;
+
+  p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-vi->eighth_octave_lines;
+  maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
+  p->total_octave_lines=maxoc-p->firstoc+1;
+
   p->ath=_ogg_malloc(n*sizeof(float));
   p->octave=_ogg_malloc(n*sizeof(int));
   p->bark=_ogg_malloc(n*sizeof(float));
@@ -185,95 +200,83 @@
   p->n=n;
 
   /* set up the lookups for a given blocksize and sample rate */
-  /* Vorbis max sample rate is limited by 26 Bark (54kHz) */
+  /* Vorbis max sample rate is currently limited by 26 Bark (54kHz) */
   set_curve(ATH_Bark_dB, p->ath,n,rate);
   for(i=0;i<n;i++)
-    p->ath[i]=fromdB(p->ath[i]);
-  for(i=0;i<n;i++)
     p->bark[i]=toBARK(rate/(2*n)*i); 
 
-  for(i=0;i<n;i++){
-    int oc=toOC((i+.5)*rate/(2.f*n))*2.f+2.f; /* half octaves, actually */
-    if(oc<0)oc=0;
-    if(oc>=P_BANDS)oc=P_BANDS-1;
-    p->octave[i]=oc;
-  }  
+  for(i=0;i<n;i++)
+    p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
   p->tonecurves=_ogg_malloc(P_BANDS*sizeof(float **));
-  p->noiseatt=_ogg_malloc(P_BANDS*sizeof(float **));
+  p->noisemedian=_ogg_malloc(n*sizeof(float *));
   p->peakatt=_ogg_malloc(P_BANDS*sizeof(float *));
   for(i=0;i<P_BANDS;i++){
     p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(float *));
-    p->noiseatt[i]=_ogg_malloc(P_LEVELS*sizeof(float));
     p->peakatt[i]=_ogg_malloc(P_LEVELS*sizeof(float));
   }
 
   for(i=0;i<P_BANDS;i++)
     for(j=0;j<P_LEVELS;j++){
-      p->tonecurves[i][j]=_ogg_malloc(EHMER_MAX*sizeof(float));
+      p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(float));
     }
 
   /* OK, yeah, this was a silly way to do it */
-  memcpy(p->tonecurves[0][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[2][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[4][4],tone_250_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][6],tone_250_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][8],tone_250_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][10],tone_250_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[6][4],tone_500_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][6],tone_500_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][8],tone_500_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][10],tone_500_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[8][4],tone_1000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][6],tone_1000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][8],tone_1000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][10],tone_1000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[10][4],tone_2000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][6],tone_2000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][8],tone_2000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][10],tone_2000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[12][4],tone_4000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][6],tone_4000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][8],tone_4000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][10],tone_4000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[14][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[16][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
+
+  memcpy(p->tonecurves[16][4]+2,tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[16][6]+2,tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
 
   /* interpolate curves between */
   for(i=1;i<P_BANDS;i+=2)
     for(j=4;j<P_LEVELS;j+=2){
-      memcpy(p->tonecurves[i][j],p->tonecurves[i-1][j],EHMER_MAX*sizeof(float));
+      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(float));
       /*interp_curve(p->tonecurves[i][j],
                    p->tonecurves[i-1][j],
                    p->tonecurves[i+1][j],.5);*/
-      min_curve(p->tonecurves[i][j],p->tonecurves[i+1][j]);
-      /*min_curve(p->tonecurves[i][j],p->tonecurves[i-1][j]);*/
+      min_curve(p->tonecurves[i][j]+2,p->tonecurves[i+1][j]+2);
     }
 
-  /*for(i=0;i<P_BANDS-1;i++)
-    for(j=4;j<P_LEVELS;j+=2)
-    min_curve(p->tonecurves[i][j],p->tonecurves[i+1][j]);*/
-
   /* set up the final curves */
   for(i=0;i<P_BANDS;i++)
     setup_curve(p->tonecurves[i],i,vi->toneatt[i]);
@@ -281,10 +284,25 @@
   /* set up attenuation levels */
   for(i=0;i<P_BANDS;i++)
     for(j=0;j<P_LEVELS;j++){
-      p->peakatt[i][j]=fromdB(p->vi->peakatt[i][j]);
-      p->noiseatt[i][j]=fromdB(p->vi->noiseatt[i][j]);
+      p->peakatt[i][j]=p->vi->peakatt[i][j];
     }
 
+  /* set up rolling noise median */
+  for(i=0;i<n;i++){
+    float halfoc=toOC((i+.5)*rate/(2.*n))*2.+2.;
+    int inthalfoc;
+    float del;
+    
+    if(halfoc<0)halfoc=0;
+    if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
+    inthalfoc=(int)halfoc;
+    del=halfoc-inthalfoc;
+
+    p->noisemedian[i]=
+      p->vi->noisemedian[inthalfoc]*(1.-del) + 
+      p->vi->noisemedian[inthalfoc+1]*del;
+  }
+  /*_analysis_output("mediancurve",0,p->noisemedian,n,0,0);*/
 }
 
 void _vp_psy_clear(vorbis_look_psy *p){
@@ -298,167 +316,112 @@
         for(j=0;j<P_LEVELS;j++){
           _ogg_free(p->tonecurves[i][j]);
         }
-	_ogg_free(p->noiseatt[i]);
         _ogg_free(p->tonecurves[i]);
         _ogg_free(p->peakatt[i]);
       }
       _ogg_free(p->tonecurves);
-      _ogg_free(p->noiseatt);
+      _ogg_free(p->noisemedian);
       _ogg_free(p->peakatt);
     }
     memset(p,0,sizeof(vorbis_look_psy));
   }
 }
 
-static void compute_decay_fixed(vorbis_look_psy *p,float *f, float *decay, int n){
-  /* handle decay */
+/* octave/(8*eighth_octave_lines) x scale and dB y scale */
+static void seed_curve(float *seed,
+		      float **curves,
+		      float amp,
+		      int oc,int n,int linesper,float dBoffset){
   int i;
-  float decscale=fromdB(p->vi->decay_coeff*n); 
-  float attscale=1.f/fromdB(p->vi->attack_coeff); 
+  long seedptr;
+  float *posts,*curve;
 
-  for(i=10;i<n;i++){
-    float pre=decay[i];
-    if(decay[i]){
-      float val=decay[i]*decscale;
-      float att=fabs(f[i]/val);
+  int choice=(int)((amp+dBoffset)*.1f);
+  choice=max(choice,0);
+  choice=min(choice,8);
+  posts=curves[choice];
+  curve=posts+2;
+  seedptr=oc+(posts[0]-16)*linesper-(linesper>>1);
 
-      if(att>attscale)
-	decay[i]=fabs(f[i]/attscale);
-      else
-	decay[i]=val;
-    }else{
-      decay[i]=fabs(f[i]/attscale);
+  for(i=posts[0];i<posts[1];i++){
+    if(seedptr>0){
+      float lin=amp+curve[i];
+      if(seed[seedptr]<lin)seed[seedptr]=lin;
     }
-    if(pre>f[i])f[i]=pre;
+    seedptr+=linesper;
+    if(seedptr>=n)break;
   }
 }
-
-static long _eights[EHMER_MAX+1]={
-  981,1069,1166,1272,
-  1387,1512,1649,1798,
-  1961,2139,2332,2543,
-  2774,3025,3298,3597,
-  3922,4277,4664,5087,
-  5547,6049,6597,7194,
-  7845,8555,9329,10173,
-  11094,12098,13193,14387,
-  15689,17109,18658,20347,
-  22188,24196,26386,28774,
-  31379,34219,37316,40693,
-  44376,48393,52772,57549,
-  62757,68437,74631,81386,
-  88752,96785,105545,115097,
-  125515};
 
-static int seed_curve(float *flr,
-		      float **curves,
-		       float amp,float specmax,
-		       int x,int n,float specatt,
-		       int maxEH){
-  int i;
-  float *curve;
+static void seed_peak(float *seed,
+		      float *att,
+		      float amp,
+		      int oc,
+		      int linesper,
+		      float dBoffset){
+  long seedptr;
 
-  /* make this attenuation adjustable */
-  int choice=(int)((todB(amp)-specmax+specatt)/10.f+.5f);
+  int choice=(int)((amp+dBoffset)*.1f);
   choice=max(choice,0);
   choice=min(choice,P_LEVELS-1);
+  seedptr=oc-(linesper>>1);
 
-  for(i=maxEH;i>=0;i--)
-    if(((x*_eights[i])>>12)<n)break;
-  maxEH=i;
-  curve=curves[choice];
-
-  for(;i>=0;i--)
-    if(curve[i]>0.f)break;
-  
-  for(;i>=0;i--){
-    float lin=curve[i];
-    if(lin>0.){
-      float *fp=flr+((x*_eights[i])>>12);
-      lin*=amp;	
-      if(*fp<lin)*fp=lin;
-    }else break;
-  }    
-  return(maxEH);
-}
+  amp+=att[choice];
+  if(seed[seedptr]<amp)seed[seedptr]=amp;
 
-static void seed_peak(float *flr,
-		      float *att,
-		      float amp,float specmax,
-		      int x,int n,float specatt){
-  int prevx=(x*_eights[16])>>12;
-
-  /* make this attenuation adjustable */
-  int choice=rint((todB(amp)-specmax+specatt)/10.f+.5f);
-  if(choice<0)choice=0;
-  if(choice>=P_LEVELS)choice=P_LEVELS-1;
-
-  if(prevx<n){
-    float lin=att[choice];
-    if(lin){
-      lin*=amp;	
-      if(flr[prevx]<lin)flr[prevx]=lin;
-    }
-  }
 }
 
-static void seed_generic(vorbis_look_psy *p,
-			 float ***curves,
-			 float *f, 
-			 float *flr,
-			 float *seeds,
-			 float specmax){
+static void seed_loop(vorbis_look_psy *p,
+		      float ***curves,
+		      float **att,
+		      float *f, 
+		      float *flr,
+		      float *seeds,
+		      float specmax){
   vorbis_info_psy *vi=p->vi;
   long n=p->n,i;
-  int maxEH=EHMER_MAX-1;
+  float dBoffset=vi->max_curve_dB-specmax;
 
   /* prime the working vector with peak values */
-  /* Use the 125 Hz curve up to 125 Hz and 8kHz curve after 8kHz. */
-  for(i=0;i<n;i++)
-    if(f[i]>flr[i])
-      maxEH=seed_curve(seeds,curves[p->octave[i]],
-		       f[i],specmax,i,n,vi->max_curve_dB,maxEH);
-}
-
-static void seed_att(vorbis_look_psy *p,
-		     float **att,
-		     float *f, 
-		     float *flr,
-		     float specmax){
-  vorbis_info_psy *vi=p->vi;
-  long n=p->n,i;
-  
-  for(i=0;i<n;i++)
-    if(f[i]>flr[i])
-      seed_peak(flr,att[p->octave[i]],f[i],
-		specmax,i,n,vi->max_curve_dB);
-}
 
-static void seed_point(vorbis_look_psy *p,
-		     float **att,
-		     float *f, 
-		     float *flr,
-		     float specmax){
-  vorbis_info_psy *vi=p->vi;
-  long n=p->n,i;
-  
   for(i=0;i<n;i++){
-    /* make this attenuation adjustable */
-    int choice=rint((todB(f[i])-specmax+vi->max_curve_dB)/10.+.5);
-    float lin;
-    if(choice<0)choice=0;
-    if(choice>=P_LEVELS)choice=P_LEVELS-1;
-    lin=att[p->octave[i]][choice]*f[i];
-    if(flr[i]<lin)flr[i]=lin;
+      float max=f[i];
+      int oc=p->octave[i];
+      while(i+1<n && p->octave[i+1]==oc){
+	i++;
+	if(f[i]>max)max=f[i];
+      }
+
+      if(max>flr[i]){
+	oc=oc>>p->shiftoc;
+	if(oc>=P_BANDS)oc=P_BANDS-1;
+	if(oc<0)oc=0;
+	if(vi->tonemaskp)
+	  seed_curve(seeds,
+		     curves[oc],
+		     max,
+		     p->octave[i]-p->firstoc,
+		     p->total_octave_lines,
+		     p->eighth_octave_lines,
+		     dBoffset);
+	if(vi->peakattp)
+	  seed_peak(seeds,
+		    att[oc],
+		    max,
+		    p->octave[i]-p->firstoc,
+		    p->eighth_octave_lines,
+		    dBoffset);
+      }
   }
 }
 
 /* bleaugh, this is more complicated than it needs to be */
 static void max_seeds(vorbis_look_psy *p,float *seeds,float *flr){
-  long n=p->n,i,j;
-  long *posstack=alloca(n*sizeof(long));
+  long   n=p->total_octave_lines,i;
+  int    linesper=p->eighth_octave_lines;
+  long  *posstack=alloca(n*sizeof(long));
   float *ampstack=alloca(n*sizeof(float));
-  long stack=0;
+  long   stack=0;
 
   for(i=0;i<n;i++){
     if(stack<2){
@@ -471,9 +434,9 @@
           ampstack[stack++]=seeds[i];
           break;
         }else{
-	  if(i<posstack[stack-1]*1.0905077080f){
-	    if(stack>1 && ampstack[stack-1]<ampstack[stack-2] &&
-	       i<posstack[stack-2]*1.0905077080f){
+	  if(i<posstack[stack-1]+linesper){
+	    if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] &&
+	       i<posstack[stack-2]+linesper){
               /* we completely overlap, making stack-1 irrelevant.  pop it */
               stack--;
               continue;
@@ -492,207 +455,179 @@
      'em straight through */
   {
     long pos=0;
+    long linpos=0;
     for(i=0;i<stack;i++){
       long endpos;
       if(i<stack-1 && ampstack[i+1]>ampstack[i]){
         endpos=posstack[i+1];
       }else{
-	endpos=posstack[i]*1.0905077080f+1.f; /* +1 is important, else bin 0 is
-                                       discarded in short frames */
+	endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is
+					  discarded in short frames */
       }
       if(endpos>n)endpos=n;
-      for(j=pos;j<endpos;j++)
-	if(flr[j]<ampstack[i])
-	  flr[j]=ampstack[i];
-      pos=endpos;
+      for(;pos<endpos;pos++)
+	seeds[pos]=ampstack[i];
     }
+
+    pos=0;
+    while(linpos+1<p->n){
+      float min=seeds[pos];
+      long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc;
+      while(pos+1<=end){
+	pos++;
+	if((seeds[pos]>NEGINF && seeds[pos]<min) || min==NEGINF)min=seeds[pos];
+      }
+
+      /* seed scale is log.  Floor is linear.  Map back to it */
+      end=pos+p->firstoc;
+      for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
+	if(flr[linpos]<min)flr[linpos]=min;
+    }
+    {
+      float v=seeds[p->total_octave_lines-1];
+      for(;linpos<p->n;linpos++)
+	if(flr[linpos]<v)flr[linpos]=v;
+    }
   }   
 
   /* there.  Linear time.  I now remember this was on a problem set I
      had in Grad Skool... I didn't solve it at the time ;-) */
 }
 
-static void bark_noise(long n,float *b,float *f,float *noise){
-  long i=1,lo=0,hi=2;
-  float acc=0.f,val,del=0.f;
-
-  float *norm=alloca(n*sizeof(float));
-
-  memset(noise,0,n*sizeof(float));
-  memset(norm,0,n*sizeof(float));
-
-  while(hi<n){
-    val=todB_nn(f[i]*f[i])+400.f;
-    del=1.f/(i-lo);
-    noise[lo]+=val*del;
-    noise[i]-=val*del;
-    norm[lo]+=del;
-    norm[i]-=del;
- 
-    del=1.f/(hi-i);
-    noise[i]-=val*del;
-    noise[hi]+=val*del;
-    norm[hi]+=del;
-    norm[i]-=del;
-    
+#define BIN(x) ((int)((x)*-4.))
+#define BINdB(x) ((x)*-.25)
+static void bark_noise_median(long n,float *b,float *f,float *noise,
+			      float lowidth,float hiwidth,
+			      int lomin,int himin,
+			      float *thresh){
+  long i=0,lo=0,hi=0;
+  long *radix=alloca(200*4*sizeof(long)); /* quarter-dB bins */
+
+  long countabove=0;
+  long median=200*4-1;
+  long countbelow=0;
 
-    i++;
-    for(;hi<n && b[hi]-.3<b[i];hi++);
-    for(;lo<i-1 && b[lo]+.3<b[i];lo++);
-    if(i==hi)hi++;
-  }
-
-  {
-    long ilo=i-lo;
-    long hii=hi-i;
+  memset(radix,0,200*4*sizeof(long));
 
-    for(;i<n;i++){
-      val=todB_nn(f[i]*f[i])+400.f;
-      del=1.f/(hii);
-      noise[i]-=val*del;
-      norm[i]-=del;
-     
-      del=1.f/(ilo);
-      noise[i-ilo]+=val*del;
-      noise[i]-=val*del;      
-      norm[i-ilo]+=del;
-      norm[i]-=del;      
-    }
-    for(i=1,lo=n-ilo;lo<n;lo++,i++){
-      val=todB_nn(f[n-i]*f[n-i])+400.f;
-      del=1.f/ilo;
-      noise[lo]+=val*del;
-      norm[lo]+=del;
+  for(i=0;i<n;i++){
+    /* find new lo/hi */
+    for(;hi<n && (b[hi]<=b[i]+hiwidth || hi<i+himin);hi++){
+      int bin=BIN(f[hi]);
+      if(bin>=200*4)bin=200*4-1;
+      radix[bin]++;
+      if(bin<median)
+	countabove++;
+      else
+	countbelow++;
     }
-  }
-
+    for(;lo<i && b[lo]+lowidth<=b[i] && lo+lomin<i;lo++){
+      int bin=BIN(f[lo]);
+      if(bin>=200*4)bin=200*4-1;
+      radix[bin]--;
+      if(bin<median)
+	countabove--;
+      else
+	countbelow--;
+    }
 
-  acc=0;
-  val=0;
+    /* move the median if needed */
+    if(countabove+countbelow){
 
-  for(i=0;i<n;i++){
-    val+=norm[i];
-    norm[i]=val;
-    acc+=noise[i];
-    noise[i]=acc;
-  }
+      while(thresh[i]>countbelow/(float)(countabove+countbelow) && median>0){
+	median--;
+	countabove-=radix[median];
+	countbelow+=radix[median];
+      }
 
-  val=0;
-  acc=0;
-  for(i=0;i<n;i++){
-    val+=norm[i];
-    acc+=noise[i];
-    if(val==0){
-      noise[i]=0.f;
-      norm[i]=0;
-    }else{
-      float v=acc/val-400;
-      noise[i]=sqrt(fromdB(v));
+      while(thresh[i]<(countbelow-radix[median])/
+	    (float)(countabove+countbelow) && median+1<200*4){
+	countabove+=radix[median];
+	countbelow-=radix[median];
+	median++;
+      }
     }
+    
+    noise[i]=BINdB(median);
   }
+
 }
 
-void _vp_compute_mask(vorbis_look_psy *p,float *f, 
+void _vp_compute_mask(vorbis_look_psy *p,
+		      float *fft, 
+		      float *mdct, 
                       float *flr, 
                       float *decay){
-  float *smooth=alloca(sizeof(float)*p->n);
   int i,n=p->n;
-  float specmax=0.f;
+  float specmax=NEGINF;
   static int seq=0;
 
-  float *seed=alloca(sizeof(float)*p->n);
-  float *seed2=alloca(sizeof(float)*p->n);
+  float *seed=alloca(sizeof(float)*p->total_octave_lines);
+  for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
 
-  _analysis_output("mdct",seq,f,n,1,1);
-  memset(flr,0,n*sizeof(float));
-
-  /* noise masking */
-  if(p->vi->noisemaskp){
-    memset(seed,0,n*sizeof(float));
-    bark_noise(n,p->bark,f,seed);
-    seed_point(p,p->noiseatt,seed,flr,specmax);
-
+  /* go to dB scale. Also find the highest peak so we know the limits */
+  for(i=0;i<n;i++){
+    fft[i]=todB(fft[i]);
+    if(fft[i]>specmax)specmax=fft[i];
   }
-
-  /* smooth the data is that's called for ********************************/
-  for(i=0;i<n;i++)smooth[i]=fabs(f[i]);
-  if(p->vi->smoothp){
-    /* compute power^.5 of three neighboring bins to smooth for peaks
-       that get split twixt bins/peaks that nail the bin.  This evens
-       out treatment as we're not doing additive masking any longer. */
-    float acc=smooth[0]*smooth[0]+smooth[1]*smooth[1];
-    float prev=smooth[0];
-
-    smooth[0]=sqrt(acc);
-    for(i=1;i<n-1;i++){
-      float this=smooth[i];
-      acc+=smooth[i+1]*smooth[i+1];
-      if(acc<0)acc=0; /* it can happen due to finite precision */
-      smooth[i]=sqrt(acc);
-      acc-=prev*prev;
-      prev=this;
-    }
-    if(acc<0)acc=0; /* in case it happens on the final iteration */
-    smooth[n-1]=sqrt(acc);
+  for(i=0;i<n;i++){
+    mdct[i]=todB(mdct[i]);
   }
 
-  _analysis_output("smooth",seq,smooth,n,1,1);
+  _analysis_output("mdct",seq,mdct,n,0,0);
+  _analysis_output("fft",seq,fft,n,0,0);
 
-  /* find the highest peak so we know the limits *************************/
-  for(i=0;i<n;i++){
-    if(smooth[i]>specmax)specmax=smooth[i];
+  /* noise masking */
+  if(p->vi->noisemaskp){
+    bark_noise_median(n,p->bark,mdct,flr,
+		      p->vi->noisewindowlo,
+		      p->vi->noisewindowhi,
+		      p->vi->noisewindowlomin,
+		      p->vi->noisewindowhimin,
+		      p->noisemedian);
+    /* suppress any noise curve > specmax+p->vi->noisemaxsupp */
+    for(i=0;i<n;i++)
+      if(flr[i]>specmax+p->vi->noisemaxsupp)
+	flr[i]=specmax+p->vi->noisemaxsupp;
+    _analysis_output("noise",seq,flr,n,0,0);
+  }else{
+    for(i=0;i<n;i++)flr[i]=NEGINF;
   }
-  specmax=todB(specmax);
 
   /* set the ATH (floating below specmax by a specified att) */
   if(p->vi->athp){
     float att=specmax+p->vi->ath_adjatt;
     if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
-    att=fromdB(att);
 
     for(i=0;i<n;i++){
-      float av=p->ath[i]*att;
+      float av=p->ath[i]+att;
       if(av>flr[i])flr[i]=av;
     }
   }
-
-  _analysis_output("ath",seq,flr,n,1,1);
 
-  /* peak attenuation ******/
-  if(p->vi->peakattp){
-    memset(seed,0,n*sizeof(float));
-    seed_att(p,p->peakatt,smooth,seed,specmax);
-    max_seeds(p,seed,flr);
-  }
+  _analysis_output("ath",seq,flr,n,0,0);
 
-  /* tone masking */
-  if(p->vi->tonemaskp){
-    memset(seed,0,n*sizeof(float));
-    memset(seed2,0,n*sizeof(float));
+  /* tone/peak masking */
 
-    seed_generic(p,p->tonecurves,smooth,flr,seed2,specmax);
-    max_seeds(p,seed2,seed2);
+  /* XXX apply decay to the fft here */
 
-    for(i=0;i<n;i++)if(seed2[i]<flr[i])seed2[i]=flr[i];
-    for(i=0;i<n;i++)if(seed2[i]<decay[i])seed2[i]=decay[i];
+  seed_loop(p,p->tonecurves,p->peakatt,fft,flr,seed,specmax);
+  _analysis_output("seed",seq,seed,p->total_octave_lines,0,0);
+  max_seeds(p,seed,flr);
 
-    seed_generic(p,p->tonecurves,smooth,seed2,seed,specmax);
-    max_seeds(p,seed,seed);
-    
-    if(p->vi->decayp)
-      compute_decay_fixed(p,seed,decay,n);
-    
-    for(i=0;i<n;i++)if(flr[i]<seed[i])flr[i]=seed[i];
-    
+  /* treat the near-DC offset bin[s] special care */
+  {
+    float v=mdct[0]+p->vi->nearDCdB;
+    for(i=0;i<p->vi->nearDCp;i++)
+      if(flr[i]>v)flr[i]=v;
   }
 
-  _analysis_output("final",seq,flr,n,1,1);
+  _analysis_output("final",seq,flr,n,0,0);
 
   /* 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(2.f*f[i]>flr[i] || -2.f*f[i]>flr[i])break;
-  if(i==n)memset(flr,0,sizeof(float)*n);
+  for(i=0;i<n;i++)if(mdct[i]>=flr[i])break;
+  if(i==n)for(i=0;i<n;i++)flr[i]=NEGINF;
 
   seq++;
 }

1.16.2.1  +23 -10    vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- psy.h	2000/11/06 00:07:02	1.16
+++ psy.h	2000/12/27 23:46:35	1.16.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.16 2000/11/06 00:07:02 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.16.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -31,18 +31,19 @@
 typedef struct vorbis_info_psy{
   int    athp;
   int    decayp;
-  int    smoothp;
 
-  int    noisecullp;
-  float noisecull_barkwidth;
+  float  ath_adjatt;
+  float  ath_maxatt;
 
-  float ath_adjatt;
-  float ath_maxatt;
+  int   eighth_octave_lines;
 
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
 
+  int   nearDCp;
+  float nearDCdB;
+
   int tonemaskp;
   float toneatt[P_BANDS][P_LEVELS];
 
@@ -50,7 +51,12 @@
   float peakatt[P_BANDS][P_LEVELS];
 
   int noisemaskp;
-  float noiseatt[P_BANDS][P_LEVELS];
+  float noisemaxsupp;
+  float noisewindowlo;
+  float noisewindowhi;
+  int   noisewindowlomin;
+  int   noisewindowhimin;
+  float noisemedian[P_BANDS];
 
   float max_curve_dB;
 
@@ -65,12 +71,17 @@
 
   float ***tonecurves;
   float **peakatt;
-  float **noiseatt;
+  float *noisemedian;
 
   float *ath;
-  int    *octave;
+  long  *octave;             /* in n.ocshift format */
   float *bark;
 
+  long  firstoc;
+  long  shiftoc;
+  int   eighth_octave_lines; /* power of two, please */
+  int   total_octave_lines;  
+
 } vorbis_look_psy;
 
 extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
@@ -80,7 +91,9 @@
 extern void   _vi_psy_free(vorbis_info_psy *i);
 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
 
-extern void   _vp_compute_mask(vorbis_look_psy *p,float *f, 
+extern void   _vp_compute_mask(vorbis_look_psy *p,
+			       float *fft, 
+			       float *mdct, 
                                float *floor,
                                float *decay);
 extern void _vp_apply_floor(vorbis_look_psy *p,float *f,float *flr);

1.11.2.1  +91 -58    vorbis/lib/psytune.c

Index: psytune.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psytune.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- psytune.c	2000/12/21 21:04:40	1.11
+++ psytune.c	2000/12/27 23:46:35	1.11.2.1
@@ -13,7 +13,7 @@
 
  function: simple utility that runs audio through the psychoacoustics
            without encoding
- last mod: $Id: psytune.c,v 1.11 2000/12/21 21:04:40 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.11.2.1 2000/12/27 23:46:35 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,6 +26,7 @@
 #include "os.h"
 #include "psy.h"
 #include "mdct.h"
+#include "smallft.h"
 #include "window.h"
 #include "scales.h"
 #include "lpc.h"
@@ -34,17 +35,20 @@
 static vorbis_info_psy _psy_set0={
   1,/*athp*/
   0,/*decayp*/
-  1,/*smoothp*/
-  0,.2,
 
-  -100.,
-  -140.,
+  -100.f,
+  -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+
+  2,
+  -40.f, /* nearDCdB */
 
-   0,/* tonemaskp */
+   1,/* tonemaskp */
   /*  0   10   20   30   40   50   60   70   80   90   100 */
   {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
@@ -65,52 +69,56 @@
    {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/
   },
 
-  1,/* peakattp */
-  {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
-   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
-   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
-   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/
+  0,/* peakattp */
+  {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*63*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*88*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*125*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*175*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*250*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*350*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-28.,-28.,-28.,-28.}, /*500*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*700*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*1000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*1400*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*2000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*2400*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-28.}, /*4000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*5600*/
    { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
    { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
    { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
   },
 
 
-  0,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/
-   {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/
-   {  6.,  6.,  6.,  2.,  2.,  2.,  2.,   2.,   2.,   1.,   0.}, /*700*/
-
-   {  6.,  6.,  6.,  5.,  5.,  5.,  5.,   5.,   5.,   4.,   3.}, /*1000*/
-   {  6.,  6.,  6.,  5.,  5.,  5.,  5.,   5.,   5.,   4.,   3.}, /*1400*/
-   {  6.,  6.,  6.,  5.,  5.,  5.,  5.,   5.,   5.,   4.,   3.}, /*2000*/
-   {  6.,  6.,  6.,  5.,  5.,  5.,  5.,   5.,   5.,   4.,   3.}, /*2800*/
-   {  6.,  6.,  6.,  5.,  5.,  5.,  5.,   5.,   5.,   4.,   3.}, /*4000*/
-   { 10., 10., 10., 10., 10., 10.,  8.,   8.,   6.,   6.,   6.}, /*5600*/
-   { 10., 10., 10., 10., 10., 10.,  8.,   8.,   8.,   8.,   8.}, /*8000*/
-   { 10., 10., 10., 10., 10., 10., 10.,  10.,  10.,  10.,  10.}, /*11500*/
-   { 10., 10., 10., 10., 10., 10., 10.,  10.,  10.,  10.,  10.}, /*16000*/
+  1,/*noisemaskp */
+  -40.f,  /* suppress any noise curve over maxspec+n */
+  .5f,   /* low window */
+  .5f,   /* high window */
+  25,
+  25,
+  {.000f, /*63*/
+   .000f, /*88*/
+   .000f, /*125*/
+   .000f, /*175*/
+   .000f, /*250*/
+   .000f, /*350*/
+   .000f, /*500*/
+   .500f, /*700*/
+   .500f, /*1000*/
+   .500f, /*1400*/
+   .500f, /*2000*/
+   .500f, /*2800*/
+   .700f, /*4000*/
+   .800f, /*5600*/
+   .850f, /*8000*/
+   .850f, /*11500*/
+   .900f, /*16000*/
   },
  
-  100.,
+  105.f,  /* even decade + 5 is important; saves an rint() later in a
+            tight loop) */
 
-  -0., -.004   /* attack/decay control */
+  -0.f, -.004f   /* attack/decay control */
 };
 
 static int noisy=0;
@@ -182,9 +190,10 @@
   int order=32;
   int map=256;
 
-  float *pcm[2],*out[2],*window,*decay[2],*lpc,*floor,*mask;
+  float *pcm[2],*out[2],*window,*lpc,*flr,*mask;
   signed char *buffer,*buffer2;
   mdct_lookup m_look;
+  drft_lookup f_look;
   vorbis_look_psy p_look;
   long i,j,k;
 
@@ -236,20 +245,19 @@
   pcm[1]=_ogg_malloc(framesize*sizeof(float));
   out[0]=_ogg_calloc(framesize/2,sizeof(float));
   out[1]=_ogg_calloc(framesize/2,sizeof(float));
-  decay[0]=_ogg_calloc(framesize/2,sizeof(float));
-  decay[1]=_ogg_calloc(framesize/2,sizeof(float));
-  floor=_ogg_malloc(framesize*sizeof(float));
+  flr=_ogg_malloc(framesize*sizeof(float));
   lpc=_ogg_malloc(order*sizeof(float));
   buffer=_ogg_malloc(framesize*4);
   buffer2=buffer+framesize*2;
   window=_vorbis_window(0,framesize,framesize/2,framesize/2);
   mdct_init(&m_look,framesize);
+  drft_init(&f_look,framesize);
   _vp_psy_init(&p_look,&_psy_set0,framesize/2,44100);
   floorinit(&floorlook,framesize/2,order,map);
 
   for(i=0;i<P_BANDS;i++)
     for(j=0;j<P_LEVELS;j++)
-      analysis("Ptonecurve",i*100+j,p_look.tonecurves[i][j],EHMER_MAX,0,1);
+      analysis("Ptonecurve",i*100+j,p_look.tonecurves[i][j],EHMER_MAX,0,0);
 
   /* we cheat on the WAV header; we just bypass 44 bytes and never
      verify that it matches 16bit/stereo/44.1kHz. */
@@ -281,26 +289,51 @@
         float amp;
 
         analysis("pre",frameno,pcm[i],framesize,0,0);
+	memcpy(mask,pcm[i],sizeof(float)*framesize);
         
         /* do the psychacoustics */
         for(j=0;j<framesize;j++)
-	  pcm[i][j]*=window[j];
+	  mask[j]=pcm[i][j]*=window[j];
+	
+	drft_forward(&f_look,mask);
 
-	memcpy(mask,pcm[i],sizeof(float)*framesize);
+	mask[0]/=(framesize/4.);
+	for(j=1;j<framesize-1;j+=2)
+	  mask[(j+1)>>1]=4*hypot(mask[j],mask[j+1])/framesize;
 
         mdct_forward(&m_look,pcm[i],pcm[i]);
+	memcpy(mask+framesize/2,pcm[i],sizeof(float)*framesize/2);
+	analysis("mdct",frameno,pcm[i],framesize/2,0,1);
+	analysis("fft",frameno,mask,framesize/2,0,1);
 
-	analysis("mdct",frameno,pcm[i],framesize/2,1,1);
+	_vp_compute_mask(&p_look,mask,mask+framesize/2,flr,NULL);
 
-	_vp_compute_mask(&p_look,pcm[i],floor,decay[i]);
+	analysis("floor",frameno,flr,framesize/2,0,0);
+
+	for(j=0;j<framesize/2;j++)
+	  flr[j]=fromdB(flr[j]);
         
-	analysis("floor",frameno,floor,framesize/2,1,1);
-	analysis("decay",frameno,decay[i],framesize/2,1,1);
+
+	/*for(j=0;j<framesize/2;){
+	  float energy=0.;
+	  float acc=0.;
+	  float *v=pcm[i]+j;
+	  int flag=0;
+	  for(k=0;k<32;k++){
+	    energy+=v[k]*v[k];
+	    if(fabs(v[k]/flr[j+k])>.5)acc+=v[k]*v[k];
+	  }
+	  if(acc*2<energy){
+	    if(acc>0.)fprintf(stderr,"culling\n");
+	    for(k=0;k<32;k++)v[k]=0;
+	  }
+	  j+=k;
+	  }*/
 
-	_vp_apply_floor(&p_look,pcm[i],floor);
+	_vp_apply_floor(&p_look,pcm[i],flr);
 
 
-	analysis("quant",frameno,pcm[i],framesize/2,1,1);
+	analysis("quant",frameno,pcm[i],framesize/2,0,0);
 
         /* re-add floor */
         for(j=0;j<framesize/2;j++){
@@ -309,13 +342,13 @@
           if(val){
             nonz++;
             acc+=log(fabs(val)*2.f+1.f)/log(2);
-	    pcm[i][j]=val*floor[j];
+	    pcm[i][j]=val*flr[j];
           }else{
             pcm[i][j]=0.f;
           }
         }
         
-	analysis("final",frameno,pcm[i],framesize/2,1,1);
+	analysis("final",frameno,pcm[i],framesize/2,0,1);
 
         /* take it back to time */
         mdct_backward(&m_look,pcm[i],pcm[i]);

1.9.2.1   +7 -8      vorbis/lib/scales.h

Index: scales.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/scales.h,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -r1.9 -r1.9.2.1
--- scales.h	2000/12/21 21:04:41	1.9
+++ scales.h	2000/12/27 23:46:36	1.9.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h,v 1.9 2000/12/21 21:04:41 xiphmont Exp $
+ last mod: $Id: scales.h,v 1.9.2.1 2000/12/27 23:46:36 xiphmont Exp $
 
  ********************************************************************/
 
@@ -23,11 +23,10 @@
 
 /* 20log10(x) */
 #define DYNAMIC_RANGE_dB 200.f
-#define todB(x)   ((x)==0?-9e20f:log(fabs(x))*8.6858896f)
+#define todB(x)   ((x)==0?-400.f:log((x)*(x))*4.34294480f)
 #define todB_nn(x)   ((x)==0.f?-400.f:log(x)*8.6858896f)
 #define fromdB(x) (exp((x)*.11512925f))
 
-
 /* The bark scale equations are approximations, since the original
    table was somewhat hand rolled.  The below are chosen to have the
    best possible fit to the rolled tables, thus their somewhat odd
@@ -37,16 +36,16 @@
 
    all f in Hz, z in Bark */
 
-#define toBARK(f)   (13.1f*atan(.00074f*(f))+2.24f*atan((f)*(f)*1.85e-8f)+1e-4f*(f))
+#define toBARK(n)   (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
 #define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
-#define toMEL(f)    (log(1.f+(f)*.001f)*1442.695f)
+#define toMEL(n)    (log(1.f+(n)*.001f)*1442.695f)
 #define fromMEL(m)  (1000.f*exp((m)/1442.695f)-1000.f)
 
-/* Frequency to octave.  We arbitrarily declare 125.0 Hz to be octave
+/* Frequency to octave.  We arbitrarily declare 63.5 Hz to be octave
    0.0 */
 
-#define toOC(f)     (log(f)*1.442695f-6.965784f)
-#define fromOC(o)   (exp(((o)+6.965784f)*.693147f))
+#define toOC(n)     (log(n)*1.442695f-5.965784f)
+#define fromOC(o)   (exp(((o)+5.965784f)*.693147f))
 
 #endif
 

No                   revision

No                   revision

1.7.2.1   +139 -47   vorbis/lib/modes/mode_A.h

Index: mode_A.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_A.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- mode_A.h	2000/12/21 21:04:47	1.7
+++ mode_A.h	2000/12/27 23:46:38	1.7.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_A.h,v 1.7 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_A.h,v 1.7.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -45,19 +45,110 @@
 #include "books/res0_128_1024_8.vqh"
 #include "books/res0_128_1024_9.vqh"
 
+
+static vorbis_info_psy _psy_set_A0={
+  1,/*athp*/
+  1,/*decayp*/
+
+  -100.,
+  -140.,
+
+  8,
+
+  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
+  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
+  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+
+  2,     /* nearDCp */
+  -40.f, /* nearDCdB */
+
+  1,/* tonemaskp */
+  /*  0   10   20   30   40   50   60   70   80   90   100 */
+  {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
+   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
+   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
+   {-30.,-30.,-35.,-37.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
+   {-20.,-25.,-30.,-35.,-35.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
+   {-20.,-25.,-30.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/
+   {-20.,-24.,-26.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/
+  },
+
+  1,/* peakattp */
+  {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*63*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*88*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-28.,-28.,-28.}, /*125*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*175*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*250*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-18.,-28.,-28.,-28.}, /*350*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-28.,-28.,-28.,-28.}, /*500*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*700*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*1000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*1400*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*2000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*2400*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*4000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*5600*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
+   { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
+   { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
+  },
+
+  1,/*noisemaskp */
+  -40.f, /* noisemaxsupp */
+  .5,    /* low window */
+  .5,    /* high window */
+  5,
+  5,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .600, /*1000*/
+   .600, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .750, /*4000*/
+   .850, /*5600*/
+   .900, /*8000*/
+   .900, /*11500*/
+   .950, /*16000*/
+  },
+ 
+  100.,
+
+  -0., -.004   /* attack/decay control */
+};
+
 static vorbis_info_psy _psy_set_A={
   1,/*athp*/
   1,/*decayp*/
-  1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
 
+  1,     /* nearDCp */
+  -40.f, /* nearDCdB */  
+
   1,/* tonemaskp */
   /*  0   10   20   30   40   50   60   70   80   90   100 */
   {{-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*63*/
@@ -80,53 +171,54 @@
   },
 
   1,/* peakattp */
-  {{-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-28.f,-28.f,-28.f}, /*63*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-28.f,-28.f,-28.f}, /*88*/
-   {-14.f,-16.f,-18.f,-19.f,-20.f,-21.f,-22.f,-22.f,-28.f,-28.f,-28.f}, /*125*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-18.f,-28.f,-28.f,-28.f}, /*175*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-18.f,-28.f,-28.f,-28.f}, /*250*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-18.f,-28.f,-28.f,-28.f}, /*350*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-28.f,-28.f,-28.f,-28.f}, /*500*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*700*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*1000*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*1400*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*2000*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*2400*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*4000*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-18.f,-20.f}, /*5600*/
-   { -7.f, -8.f, -9.f,-10.f,-10.f,-11.f,-12.f,-13.f,-15.f,-16.f,-17.f}, /*8000*/
-   { -6.f, -7.f, -9.f, -9.f, -9.f, -9.f,-10.f,-11.f,-12.f,-13.f,-14.f}, /*11500*/
-   { -6.f, -6.f, -9.f, -9.f, -9.f, -9.f, -9.f, -9.f,-10.f,-11.f,-12.f}, /*16000*/
+  {{-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f},
+   {-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f,-30.f}},
+
+  1,     /* noisemaskp */
+  -40.f, /* noisemaxsupp */
+  .5,    /* low window */
+  .5,    /* high window */
+  25,
+  25,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .600, /*1000*/
+   .600, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .750, /*4000*/
+   .850, /*5600*/
+   .900, /*8000*/
+   .900, /*11500*/
+   .950, /*16000*/
   },
-
-  1,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*63*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*88*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*125*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*175*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*250*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*350*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*500*/
-   {  6.f,  6.f,  6.f,  2.f,  2.f,  2.f,  2.f,   2.f,   2.f,   1.f,   0.f}, /*700*/
-
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*1000*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*1400*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*2000*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*2800*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*4000*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  8.f,   8.f,   6.f,   6.f,   6.f}, /*5600*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  8.f,   8.f,   8.f,   8.f,   8.f}, /*8000*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  10.f,  10.f,  10.f,  10.f}, /*11500*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  10.f,  10.f,  10.f,  10.f}, /*16000*/
-  },
  
   100.f,
 
   -0.f, -.004f   /* attack/decay control */
 };
 
-
 /* with GNUisms, this could be short and readable. Oh well */
 static vorbis_info_time0 _time_set0A={0};
 static vorbis_info_floor0 _floor_set0A={12, 44100,  64, 12,150, 1, {0} };
@@ -152,7 +244,7 @@
                                             {99,99,99,99,99,99,99,99,99}};
 
 static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {0}};
+static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {1}};
 static vorbis_info_mode _mode_set0A={0,0,0,0};
 static vorbis_info_mode _mode_set1A={1,0,0,1};
 
@@ -162,7 +254,7 @@
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   18,   1,
+  2,          2,    1,     2,       2,   18,   2,
   /* modes */
   {&_mode_set0A,&_mode_set1A},
   /* maps */
@@ -198,9 +290,9 @@
 
   },
   /* psy */
-  {&_psy_set_A},
+  {&_psy_set_A0,&_psy_set_A},
   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
-  256, 32.f, 6.f, -96.f
+  256, 32.f, -32.f, -96.f
 };
 
 #define PREDEF_INFO_MAX 0

1.3.2.1   +111 -24   vorbis/lib/modes/mode_AA.h

Index: mode_AA.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_AA.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- mode_AA.h	2000/12/21 21:04:47	1.3
+++ mode_AA.h	2000/12/27 23:46:38	1.3.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_AA.h,v 1.3 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_AA.h,v 1.3.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -44,15 +44,100 @@
 #include "books/res0_96_1024_6.vqh"
 #include "books/res0_96_1024_7.vqh"
 
+static vorbis_info_psy _psy_set_AA0={
+  1,/*athp*/
+  1,/*decayp*/
+  1,/*smoothp*/
+
+  -100.,
+  -140.,
+
+  8,
+
+  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
+  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
+  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+
+  1,/* tonemaskp */
+  /*  0   10   20   30   40   50   60   70   80   90   100 */
+  {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/
+   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/
+   {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/
+   {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/
+   {-30.,-30.,-35.,-37.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/
+   {-20.,-25.,-30.,-35.,-35.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/
+   {-20.,-25.,-30.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/
+   {-20.,-24.,-26.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/
+  },
+
+  1,/* peakattp */
+  {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/
+   {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*175*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*250*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*350*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*500*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*700*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*1000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*1400*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*2000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*2800*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*4000*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*5600*/
+   { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/
+   { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/
+   { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/
+  },
+
+  1,/*noisemaskp */
+  .5, /* low window */
+  .5, /* high window */
+  15,
+  15,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .500, /*1000*/
+   .500, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .500, /*4000*/
+   .500, /*5600*/
+   .650, /*8000*/
+   .650, /*11500*/
+   .600, /*16000*/
+  },
+ 
+   95.,
+
+  -0., -.004   /* attack/decay control */
+};
+
 static vorbis_info_psy _psy_set_AA={
   1,/*athp*/
   1,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -99,25 +184,27 @@
   },
 
   1,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*63*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*88*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*125*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*175*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*250*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*350*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*500*/
-   {  6.f,  6.f,  6.f,  2.f,  2.f,  2.f,  2.f,   2.f,   2.f,   1.f,   0.f}, /*700*/
-
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*1000*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*1400*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*2000*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*2800*/
-   {  6.f,  6.f,  6.f,  5.f,  5.f,  5.f,  5.f,   5.f,   5.f,   4.f,   3.f}, /*4000*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  8.f,   8.f,   6.f,   6.f,   6.f}, /*5600*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  8.f,   8.f,   8.f,   8.f,   8.f}, /*8000*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  10.f,  10.f,  10.f,  10.f}, /*11500*/
-   { 10.f, 10.f, 10.f, 10.f, 10.f, 10.f, 10.f,  10.f,  10.f,  10.f,  10.f}, /*16000*/
+  .5, /* low window */
+  .5, /* high window */
+  25,
+  25,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .500, /*1000*/
+   .500, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .700, /*4000*/
+   .800, /*5600*/
+   .850, /*8000*/
+   .850, /*11500*/
+   .900, /*16000*/
   },
  
    95.f,
@@ -151,7 +238,7 @@
                                             {99,99,99,99,99,99,99}};
 
 static vorbis_info_mapping0 _mapping_set0AA={1, {0,0}, {0}, {0}, {0}, {0}};
-static vorbis_info_mapping0 _mapping_set1AA={1, {0,0}, {0}, {1}, {1}, {0}};
+static vorbis_info_mapping0 _mapping_set1AA={1, {0,0}, {0}, {1}, {1}, {1}};
 static vorbis_info_mode _mode_set0AA={0,0,0,0};
 static vorbis_info_mode _mode_set1AA={1,0,0,1};
 
@@ -161,7 +248,7 @@
   /* smallblock, largeblock */
   {256, 2048}, 
   /* modes,maps,times,floors,residues,books,psys */
-  2,          2,    1,     2,       2,   16,   1,
+  2,          2,    1,     2,       2,   16,   2,
   /* modes */
   {&_mode_set0AA,&_mode_set1AA},
   /* maps */
@@ -195,7 +282,7 @@
 
   },
   /* psy */
-  {&_psy_set_AA},
+  {&_psy_set_AA0,&_psy_set_AA},
   /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */
   256, 32.f, 6.f, -96.f
 };

1.6.2.1   +24 -21    vorbis/lib/modes/mode_B.h

Index: mode_B.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_B.h,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- mode_B.h	2000/12/21 21:04:47	1.6
+++ mode_B.h	2000/12/27 23:46:38	1.6.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_B.h,v 1.6 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_B.h,v 1.6.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -49,11 +49,12 @@
   1,/*athp*/
   1,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -100,25 +101,27 @@
   },
 
   1,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*63*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*88*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*125*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*175*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*250*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*350*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*500*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*700*/
-
-   {  4.f,  4.f,  4.f,  4.f,  4.f,  2.f,  1.f,   0.f,  -1.f,  -2.f,  -3.f}, /*1000*/
-   {  4.f,  4.f,  4.f,  4.f,  4.f,  2.f,  1.f,   0.f,   0.f,  -2.f,  -3.f}, /*1400*/
-   {  4.f,  4.f,  4.f,  4.f,  2.f,  2.f,  1.f,   0.f,   0.f,  -2.f,  -3.f}, /*2000*/
-   {  4.f,  4.f,  4.f,  4.f,  2.f,  2.f,  1.f,   0.f,   0.f,  -2.f,  -3.f}, /*2800*/
-   {  4.f,  4.f,  4.f,  4.f,  4.f,  4.f,  2.f,   0.f,   0.f,   0.f,   0.f}, /*4000*/
-   {  4.f,  4.f,  4.f,  4.f,  4.f,  4.f,  2.f,   2.f,   2.f,   2.f,   2.f}, /*5600*/
-   {  6.f,  6.f,  6.f,  6.f,  4.f,  4.f,  4.f,   4.f,   4.f,   2.f,   2.f}, /*8000*/
-   {  8.f,  8.f,  8.f,  8.f,  6.f,  6.f,  6.f,   6.f,   6.f,   4.f,   4.f}, /*11500*/
-   {  8.f,  8.f,  8.f,  8.f,  8.f,  8.f,  8.f,   6.f,   6.f,   6.f,   4.f}, /*16000*/
+  .5, /* low window */
+  .5, /* high window */
+  25,
+  25,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .500, /*1000*/
+   .500, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .700, /*4000*/
+   .800, /*5600*/
+   .850, /*8000*/
+   .850, /*11500*/
+   .900, /*16000*/
   },
  
   110.f,

1.6.2.1   +48 -43    vorbis/lib/modes/mode_C.h

Index: mode_C.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_C.h,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- mode_C.h	2000/12/21 21:04:47	1.6
+++ mode_C.h	2000/12/27 23:46:38	1.6.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_C.h,v 1.6 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_C.h,v 1.6.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -45,11 +45,12 @@
   1,/*athp*/
   0,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -96,25 +97,27 @@
   },
 
   1,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*63*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*88*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*125*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*175*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*250*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*350*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*500*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*700*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*1000*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*1400*/
-
-   {  0.f, -4.f, -4.f, -4.f, -6.f, -6.f, -6.f,  -6.f,  -6.f,  -6.f,  -6.f}, /*2000*/
-   {  0.f, -3.f, -4.f, -4.f, -4.f, -5.f, -6.f,  -6.f,  -6.f,  -6.f,  -6.f}, /*2800*/
-   {  0.f, -2.f, -2.f, -2.f, -2.f, -2.f, -2.f,  -2.f,  -4.f,  -4.f,  -4.f}, /*4000*/
-   {  0.f, -0.f, -0.f, -0.f, -0.f, -2.f, -2.f,  -2.f,  -2.f,  -2.f,  -2.f}, /*5600*/
-   {  0.f,  0.f,  0.f,  0.f,  0.f,  0.f,  0.f,   0.f,   0.f,  -2.f,  -4.f}, /*8000*/
-   {  2.f,  2.f,  2.f,  2.f,  2.f,  2.f,  0.f,   0.f,   0.f,   0.f,   0.f}, /*11500*/
-   {  2.f,  2.f,  2.f,  2.f,  2.f,  4.f,  4.f,   4.f,   4.f,   4.f,   4.f}, /*16000*/
+  .5, /* low window */
+  .5, /* high window */
+  25,
+  25,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .500, /*1000*/
+   .500, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .700, /*4000*/
+   .800, /*5600*/
+   .850, /*8000*/
+   .850, /*11500*/
+   .900, /*16000*/
   },
  
   100.f,
@@ -126,11 +129,12 @@
   1,/*athp*/
   0,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -177,27 +181,28 @@
   },
 
   1,/*noisemaskp */
-  /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*63*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*88*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*125*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*175*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*250*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*350*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*500*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*700*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*1000*/
-   {-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-99.f,-199.f,-199.f,-199.f,-199.f}, /*1400*/
-
-   {  0.f, -4.f, -4.f, -4.f, -6.f, -6.f, -6.f,  -6.f,  -6.f,  -6.f,  -6.f}, /*2000*/
-   {  0.f, -3.f, -4.f, -4.f, -4.f, -5.f, -6.f,  -6.f,  -6.f,  -6.f,  -6.f}, /*2800*/
-   {  0.f, -2.f, -2.f, -2.f, -2.f, -2.f, -2.f,  -2.f,  -4.f,  -4.f,  -4.f}, /*4000*/
-   {  0.f, -0.f, -0.f, -0.f, -0.f, -2.f, -2.f,  -2.f,  -2.f,  -2.f,  -2.f}, /*5600*/
-   {  0.f,  0.f,  0.f,  0.f,  0.f,  0.f,  0.f,   0.f,   0.f,  -2.f,  -4.f}, /*8000*/
-   {  2.f,  2.f,  2.f,  2.f,  2.f,  2.f,  0.f,   0.f,   0.f,   0.f,   0.f}, /*11500*/
-   {  2.f,  2.f,  2.f,  2.f,  2.f,  4.f,  4.f,   4.f,   4.f,   4.f,   4.f}, /*16000*/
+  .5, /* low window */
+  .5, /* high window */
+  25,
+  25,
+  {.000, /*63*/
+   .000, /*88*/
+   .000, /*125*/
+   .000, /*175*/
+   .000, /*250*/
+   .000, /*350*/
+   .000, /*500*/
+   .500, /*700*/
+   .500, /*1000*/
+   .500, /*1400*/
+   .500, /*2000*/
+   .500, /*2800*/
+   .700, /*4000*/
+   .800, /*5600*/
+   .850, /*8000*/
+   .850, /*11500*/
+   .900, /*16000*/
   },
- 
   110.f,
 
   -6.f, -.006f   /* attack/decay control */
@@ -225,7 +230,7 @@
                                             {5,5,5,5,5},
                                             {99,99,99,99,99}};
 
-static vorbis_info_mapping0 _mapping_set0C={1, {0,0}, {0}, {0}, {0}, {1}};
+static vorbis_info_mapping0 _mapping_set0C={1, {0,0}, {0}, {0}, {0}, {0}};
 static vorbis_info_mapping0 _mapping_set1C={1, {0,0}, {0}, {1}, {1}, {1}};
 static vorbis_info_mode _mode_set0C={0,0,0,0};
 static vorbis_info_mode _mode_set1C={1,0,0,1};

1.7.2.1   +15 -5     vorbis/lib/modes/mode_D.h

Index: mode_D.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_D.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- mode_D.h	2000/12/21 21:04:47	1.7
+++ mode_D.h	2000/12/27 23:46:38	1.7.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_D.h,v 1.7 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_D.h,v 1.7.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -47,11 +47,12 @@
   1,/*athp*/
   0,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -82,7 +83,11 @@
 
   0,/*noisemaskp */
   /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{0}},
+  .5,
+  .5,
+  25,
+  25,
+  {0},
  
   110.f,
 
@@ -92,11 +97,12 @@
   1,/*athp*/
   0,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -100.f,
   -140.f,
 
+  8,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -144,7 +150,11 @@
 
   0,/*noisemaskp */
   /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{0}},
+  .5,
+  .5,
+  25,
+  25,
+  {0},
  
   110.f,
 

1.4.2.1   +8 -3      vorbis/lib/modes/mode_E.h

Index: mode_E.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_E.h,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- mode_E.h	2000/12/21 21:04:47	1.4
+++ mode_E.h	2000/12/27 23:46:38	1.4.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: predefined encoding modes
- last mod: $Id: mode_E.h,v 1.4 2000/12/21 21:04:47 xiphmont Exp $
+ last mod: $Id: mode_E.h,v 1.4.2.1 2000/12/27 23:46:38 xiphmont Exp $
 
  ********************************************************************/
 
@@ -47,11 +47,12 @@
   1,/*athp*/
   0,/*decayp*/
   1,/*smoothp*/
-  0,.1f,
 
   -140.f,
   -180.f,
 
+  16,
+
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
@@ -82,7 +83,11 @@
 
   0,/*noisemaskp */
   /*  0   10   20   30   40   50   60    70    80    90   100 */
-  {{0}},
+  .5,
+  .5,
+  25,
+  25,
+  {0},
  
   110.f,
 

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