[xiph-commits] r16946 - in trunk/vorbis: . examples lib lib/modes

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Mar 3 08:12:40 PST 2010


Author: xiphmont
Date: 2010-03-03 08:12:40 -0800 (Wed, 03 Mar 2010)
New Revision: 16946

Modified:
   trunk/vorbis/configure.ac
   trunk/vorbis/examples/encoder_example.c
   trunk/vorbis/lib/info.c
   trunk/vorbis/lib/mapping0.c
   trunk/vorbis/lib/modes/psych_44.h
   trunk/vorbis/lib/psy.c
   trunk/vorbis/lib/psy.h
   trunk/vorbis/lib/res0.c
   trunk/vorbis/lib/vorbisenc.c
Log:
New noise norm, coupling and quant code necessary for depth>1 coupling.  Also substantially 
cleans up the old code for mono/stereo usage.



Modified: trunk/vorbis/configure.ac
===================================================================
--- trunk/vorbis/configure.ac	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/configure.ac	2010-03-03 16:12:40 UTC (rev 16946)
@@ -5,7 +5,7 @@
 dnl ------------------------------------------------
 
 
-AC_INIT([libvorbis],[1.2.3],[vorbis-dev at xiph.org])
+AC_INIT([libvorbis],[1.3.0],[vorbis-dev at xiph.org])
 
 AC_CONFIG_SRCDIR([lib/mdct.c])
 
@@ -25,7 +25,7 @@
 dnl - interfaces removed -> AGE = 0
 
 V_LIB_CURRENT=4
-V_LIB_REVISION=3
+V_LIB_REVISION=4
 V_LIB_AGE=4
 
 VF_LIB_CURRENT=6
@@ -33,7 +33,7 @@
 VF_LIB_AGE=3
 
 VE_LIB_CURRENT=2
-VE_LIB_REVISION=6
+VE_LIB_REVISION=7
 VE_LIB_AGE=0
 
 AC_SUBST(V_LIB_CURRENT)

Modified: trunk/vorbis/examples/encoder_example.c
===================================================================
--- trunk/vorbis/examples/encoder_example.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/examples/encoder_example.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -44,7 +44,7 @@
                           stream of packets */
   ogg_page         og; /* one Ogg bitstream page.  Vorbis packets are inside */
   ogg_packet       op; /* one raw packet of data for decode */
-  
+
   vorbis_info      vi; /* struct that stores all the static vorbis bitstream
                           settings */
   vorbis_comment   vc; /* struct that stores all the user comments */
@@ -69,7 +69,7 @@
 #ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
   /* if we were reading/writing a file, it would also need to in
      binary mode, eg, fopen("file.wav","wb"); */
-  /* Beware the evil ifdef. We avoid these where we can, but this one we 
+  /* Beware the evil ifdef. We avoid these where we can, but this one we
      cannot. Don't add any more, you'll probably go to hell if you do. */
   _setmode( _fileno( stdin ), _O_BINARY );
   _setmode( _fileno( stdout ), _O_BINARY );
@@ -84,16 +84,16 @@
   for (i=0, founddata=0; i<30 && ! feof(stdin) && ! ferror(stdin); i++)
   {
     fread(readbuffer,1,2,stdin);
-    
+
     if ( ! strncmp((char*)readbuffer, "da", 2) ){
       founddata = 1;
       fread(readbuffer,1,6,stdin);
       break;
     }
   }
-  
+
   /********** Encode setup ************/
-  
+
   vorbis_info_init(&vi);
 
   /* choose an encoding mode.  A few possibilities commented out, one
@@ -102,15 +102,15 @@
   /*********************************************************************
    Encoding using a VBR quality mode.  The usable range is -.1
    (lowest quality, smallest file) to 1. (highest quality, largest file).
-   Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR 
-  
+   Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR
+
    ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
 
    ---------------------------------------------------------------------
 
    Encoding using an average bitrate mode (ABR).
-   example: 44kHz stereo coupled, average 128kbps VBR 
-  
+   example: 44kHz stereo coupled, average 128kbps VBR
+
    ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
 
    ---------------------------------------------------------------------
@@ -140,7 +140,7 @@
   /* set up the analysis state and auxiliary encoding storage */
   vorbis_analysis_init(&vd,&vi);
   vorbis_block_init(&vd,&vb);
-  
+
   /* set up our packet->stream encoder */
   /* pick a random serial number; that way we can more likely build
      chained streams just by concatenation */
@@ -174,9 +174,9 @@
       fwrite(og.header,1,og.header_len,stdout);
       fwrite(og.body,1,og.body_len,stdout);
     }
-    
+
   }
-  
+
   while(!eos){
     long i;
     long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */
@@ -187,13 +187,13 @@
          Tell the library we're at end of stream so that it can handle
          the last frame and mark end of stream in the output properly */
       vorbis_analysis_wrote(&vd,0);
-      
+
     }else{
       /* data to encode */
 
       /* expose the buffer to submit data */
       float **buffer=vorbis_analysis_buffer(&vd,READ);
-      
+
       /* uninterleave samples */
       for(i=0;i<bytes/4;i++){
         buffer[0][i]=((readbuffer[i*4+1]<<8)|
@@ -201,7 +201,7 @@
         buffer[1][i]=((readbuffer[i*4+3]<<8)|
                       (0x00ff&(int)readbuffer[i*4+2]))/32768.f;
       }
-    
+
       /* tell the library how much we actually submitted */
       vorbis_analysis_wrote(&vd,i);
     }
@@ -216,20 +216,20 @@
       vorbis_bitrate_addblock(&vb);
 
       while(vorbis_bitrate_flushpacket(&vd,&op)){
-        
+
         /* weld the packet into the bitstream */
         ogg_stream_packetin(&os,&op);
-        
+
         /* write out pages (if any) */
         while(!eos){
           int result=ogg_stream_pageout(&os,&og);
           if(result==0)break;
           fwrite(og.header,1,og.header_len,stdout);
           fwrite(og.body,1,og.body_len,stdout);
-          
+
           /* this could be set above, but for illustrative purposes, I do
              it here (to show that vorbis does know where the stream ends) */
-          
+
           if(ogg_page_eos(&og))eos=1;
         }
       }
@@ -237,16 +237,16 @@
   }
 
   /* clean up and exit.  vorbis_info_clear() must be called last */
-  
+
   ogg_stream_clear(&os);
   vorbis_block_clear(&vb);
   vorbis_dsp_clear(&vd);
   vorbis_comment_clear(&vc);
   vorbis_info_clear(&vi);
-  
+
   /* ogg_page and ogg_packet structs always point to storage in
      libvorbis.  They're never freed or manipulated directly */
-  
+
   fprintf(stderr,"Done.\n");
   return(0);
 }

Modified: trunk/vorbis/lib/info.c
===================================================================
--- trunk/vorbis/lib/info.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/info.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -31,8 +31,8 @@
 #include "misc.h"
 #include "os.h"
 
-#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.3"
-#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20090709"
+#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.0pre"
+#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20100303pre (Everywhere)"
 
 /* helpers */
 static int ilog2(unsigned int v){

Modified: trunk/vorbis/lib/mapping0.c
===================================================================
--- trunk/vorbis/lib/mapping0.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/mapping0.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -600,37 +600,7 @@
   {
     int **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
     int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
-    int **sortindex=alloca(sizeof(*sortindex)*vi->channels);
-    float **mag_memo=NULL;
-    int **mag_sort=NULL;
 
-    if(info->coupling_steps){
-      mag_memo=_vp_quantize_couple_memo(vb,
-                                        &ci->psy_g_param,
-                                        psy_look,
-                                        info,
-                                        gmdct);
-
-      mag_sort=_vp_quantize_couple_sort(vb,
-                                        psy_look,
-                                        info,
-                                        mag_memo);
-
-      hf_reduction(&ci->psy_g_param,
-                   psy_look,
-                   info,
-                   mag_memo);
-    }
-
-    memset(sortindex,0,sizeof(*sortindex)*vi->channels);
-    if(psy_look->vi->normal_channel_p){
-      for(i=0;i<vi->channels;i++){
-        float *mdct    =gmdct[i];
-        sortindex[i]=alloca(sizeof(**sortindex)*n/2);
-        _vp_noise_normalize_sort(psy_look,mdct,sortindex[i]);
-      }
-    }
-
     for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
         k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
         k++){
@@ -650,9 +620,7 @@
       /* encode floor, compute masking curve, sep out residue */
       for(i=0;i<vi->channels;i++){
         int submap=info->chmuxlist[i];
-        float *mdct    =gmdct[i];
-        float *res     =vb->pcm[i];
-        int   *ilogmask=iwork[i];
+        int *ilogmask=iwork[i];
 
         nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
                                  floor_posts[i][k],
@@ -663,30 +631,10 @@
           sprintf(buf,"maskI%c%d",i?'R':'L',k);
           float work[n/2];
           for(j=0;j<n/2;j++)
-            work[j]=FLOOR1_fromdB_LOOKUP[iwork[j]];
+            work[j]=FLOOR1_fromdB_LOOKUP[iwork[i][j]];
           _analysis_output(buf,seq,work,n/2,1,1,0);
         }
 #endif
-        _vp_remove_floor(psy_look,
-                         mdct,
-                         ilogmask,
-                         res,
-                         ci->psy_g_param.sliding_lowpass[vb->W][k]);
-
-        _vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
-
-
-#if 0
-        {
-          char buf[80];
-          float work[n/2];
-          for(j=0;j<n/2;j++)
-            work[j]=FLOOR1_fromdB_LOOKUP[iwork[j]]*(res+n/2)[j];
-          sprintf(buf,"resI%c%d",i?'R':'L',k);
-          _analysis_output(buf,seq,work,n/2,1,1,0);
-
-        }
-#endif
       }
 
       /* our iteration is now based on masking curve, not prequant and
@@ -695,24 +643,26 @@
       /* quantize/couple */
       /* incomplete implementation that assumes the tree is all depth
          one, or no tree at all */
-      if(info->coupling_steps){
-        _vp_couple(k,
-                   &ci->psy_g_param,
-                   psy_look,
-                   info,
-                   vb->pcm,
-                   mag_memo,
-                   mag_sort,
-                   iwork,
-                   nonzero,
-                   ci->psy_g_param.sliding_lowpass[vb->W][k]);
+      _vp_couple_quantize_normalize(k,
+                                    &ci->psy_g_param,
+                                    psy_look,
+                                    info,
+                                    gmdct,
+                                    iwork,
+                                    nonzero,
+                                    ci->psy_g_param.sliding_lowpass[vb->W][k],
+                                    vi->channels);
+
+#if 0
+      for(i=0;i<vi->channels;i++){
+        char buf[80];
+        sprintf(buf,"resI%c%d",i?'R':'L',k);
+        float work[n/2];
+        for(j=0;j<n/2;j++)
+          work[j]=iwork[i][j];
+        _analysis_output(buf,seq,work,n/2,0,0,0);
       }
-      for(j=0;j<vi->channels;j++){
-        int *ires = iwork[j];
-        float *res = vb->pcm[j]+n/2;
-        for(i=0;i<n/2;i++)
-          ires[i] = (int)rint(res[i]);
-      }
+#endif
 
       /* classify and encode by submap */
       for(i=0;i<info->submaps;i++){

Modified: trunk/vorbis/lib/modes/psych_44.h
===================================================================
--- trunk/vorbis/lib/modes/psych_44.h	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/modes/psych_44.h	2010-03-03 16:12:40 UTC (rev 16946)
@@ -500,8 +500,8 @@
   1,          -0.f,           .5f, .5f,         0,0,0,
   /* noiseoffset*3, noisecompand, max_curve_dB */
   {{-1},{-1},{-1}},{-1},105.f,
-  /* noise normalization - channel_p, point_p, start, partition, thresh. */
-  0,0,-1,-1,0.,
+  /* noise normalization - noise_p, start, partition, thresh. */
+  0,-1,-1,0.,
 };
 
 /* ath ****************/

Modified: trunk/vorbis/lib/psy.c
===================================================================
--- trunk/vorbis/lib/psy.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/psy.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -696,92 +696,6 @@
   }
 }
 
-static const float FLOOR1_fromdB_INV_LOOKUP[256]={
-  0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
-  7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
-  5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
-  4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
-  3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
-  2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
-  2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
-  1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
-  1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
-  973377.F, 913981.F, 858210.F, 805842.F,
-  756669.F, 710497.F, 667142.F, 626433.F,
-  588208.F, 552316.F, 518613.F, 486967.F,
-  457252.F, 429351.F, 403152.F, 378551.F,
-  355452.F, 333762.F, 313396.F, 294273.F,
-  276316.F, 259455.F, 243623.F, 228757.F,
-  214798.F, 201691.F, 189384.F, 177828.F,
-  166977.F, 156788.F, 147221.F, 138237.F,
-  129802.F, 121881.F, 114444.F, 107461.F,
-  100903.F, 94746.3F, 88964.9F, 83536.2F,
-  78438.8F, 73652.5F, 69158.2F, 64938.1F,
-  60975.6F, 57254.9F, 53761.2F, 50480.6F,
-  47400.3F, 44507.9F, 41792.0F, 39241.9F,
-  36847.3F, 34598.9F, 32487.7F, 30505.3F,
-  28643.8F, 26896.0F, 25254.8F, 23713.7F,
-  22266.7F, 20908.0F, 19632.2F, 18434.2F,
-  17309.4F, 16253.1F, 15261.4F, 14330.1F,
-  13455.7F, 12634.6F, 11863.7F, 11139.7F,
-  10460.0F, 9821.72F, 9222.39F, 8659.64F,
-  8131.23F, 7635.06F, 7169.17F, 6731.70F,
-  6320.93F, 5935.23F, 5573.06F, 5232.99F,
-  4913.67F, 4613.84F, 4332.30F, 4067.94F,
-  3819.72F, 3586.64F, 3367.78F, 3162.28F,
-  2969.31F, 2788.13F, 2617.99F, 2458.24F,
-  2308.24F, 2167.39F, 2035.14F, 1910.95F,
-  1794.35F, 1684.85F, 1582.04F, 1485.51F,
-  1394.86F, 1309.75F, 1229.83F, 1154.78F,
-  1084.32F, 1018.15F, 956.024F, 897.687F,
-  842.910F, 791.475F, 743.179F, 697.830F,
-  655.249F, 615.265F, 577.722F, 542.469F,
-  509.367F, 478.286F, 449.101F, 421.696F,
-  395.964F, 371.803F, 349.115F, 327.812F,
-  307.809F, 289.026F, 271.390F, 254.830F,
-  239.280F, 224.679F, 210.969F, 198.096F,
-  186.008F, 174.658F, 164.000F, 153.993F,
-  144.596F, 135.773F, 127.488F, 119.708F,
-  112.404F, 105.545F, 99.1046F, 93.0572F,
-  87.3788F, 82.0469F, 77.0404F, 72.3394F,
-  67.9252F, 63.7804F, 59.8885F, 56.2341F,
-  52.8027F, 49.5807F, 46.5553F, 43.7144F,
-  41.0470F, 38.5423F, 36.1904F, 33.9821F,
-  31.9085F, 29.9614F, 28.1332F, 26.4165F,
-  24.8045F, 23.2910F, 21.8697F, 20.5352F,
-  19.2822F, 18.1056F, 17.0008F, 15.9634F,
-  14.9893F, 14.0746F, 13.2158F, 12.4094F,
-  11.6522F, 10.9411F, 10.2735F, 9.64662F,
-  9.05798F, 8.50526F, 7.98626F, 7.49894F,
-  7.04135F, 6.61169F, 6.20824F, 5.82941F,
-  5.47370F, 5.13970F, 4.82607F, 4.53158F,
-  4.25507F, 3.99542F, 3.75162F, 3.52269F,
-  3.30774F, 3.10590F, 2.91638F, 2.73842F,
-  2.57132F, 2.41442F, 2.26709F, 2.12875F,
-  1.99885F, 1.87688F, 1.76236F, 1.65482F,
-  1.55384F, 1.45902F, 1.36999F, 1.28640F,
-  1.20790F, 1.13419F, 1.06499F, 1.F
-};
-
-void _vp_remove_floor(vorbis_look_psy *p,
-                      float *mdct,
-                      int *codedflr,
-                      float *residue,
-                      int sliding_lowpass){
-
-  int i,n=p->n;
-
-  if(sliding_lowpass>n)sliding_lowpass=n;
-
-  for(i=0;i<sliding_lowpass;i++){
-    residue[i]=
-      mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
-  }
-
-  for(;i<n;i++)
-    residue[i]=0.;
-}
-
 void _vp_noisemask(vorbis_look_psy *p,
                    float *logmdct,
                    float *logmask){
@@ -926,302 +840,339 @@
   return(amp);
 }
 
-static void couple_lossless(float A, float B,
-                            float *qA, float *qB){
-  int test1=fabs(*qA)>fabs(*qB);
-  test1-= fabs(*qA)<fabs(*qB);
+static float FLOOR1_fromdB_LOOKUP[256]={
+  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
+  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
+  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
+  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
+  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
+  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
+  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
+  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
+  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
+  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
+  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
+  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
+  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
+  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
+  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
+  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
+  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
+  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
+  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
+  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
+  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
+  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
+  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
+  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
+  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
+  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
+  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
+  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
+  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
+  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
+  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
+  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
+  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
+  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
+  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
+  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
+  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
+  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
+  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
+  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
+  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
+  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
+  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
+  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
+  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
+  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
+  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
+  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
+  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
+  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
+  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
+  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
+  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
+  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
+  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
+  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
+  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
+  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
+  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
+  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
+  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
+  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
+  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
+  0.82788260F, 0.88168307F, 0.9389798F, 1.F,
+};
 
-  //if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
-  if(test1==1){
-    *qB=(*qA>0.f?*qA-*qB:*qB-*qA);
-  }else{
-    float temp=*qB;
-    *qB=(*qB>0.f?*qA-*qB:*qB-*qA);
-    *qA=temp;
-  }
+/* this is for per-channel noise normalization */
+static int apsort(const void *a, const void *b){
+  float f1=**(float**)a;
+  float f2=**(float**)b;
+  return (f1<f2)-(f1>f2);
+}
 
-  if(*qB>fabs(*qA)*1.9999f){
-    *qB= -fabs(*qA)*2.f;
-    *qA= -*qA;
+static void flag_lossless(int limit, float prepoint, float postpoint, float *mdct,
+                         float *floor, int *flag, int i, int jn){
+  int j;
+  for(j=0;j<jn;j++){
+    float point = j>=limit-i ? postpoint : prepoint;
+    float r = fabs(mdct[j])/floor[j];
+    if(r<point)
+      flag[j]=0;
+    else
+      flag[j]=1;
   }
 }
 
-static const float hypot_lookup[32]={
-  -0.009935, -0.011245, -0.012726, -0.014397,
-  -0.016282, -0.018407, -0.020800, -0.023494,
-  -0.026522, -0.029923, -0.033737, -0.038010,
-  -0.042787, -0.048121, -0.054064, -0.060671,
-  -0.068000, -0.076109, -0.085054, -0.094892,
-  -0.105675, -0.117451, -0.130260, -0.144134,
-  -0.159093, -0.175146, -0.192286, -0.210490,
-  -0.229718, -0.249913, -0.271001, -0.292893};
+/* Overload/Side effect: On input, the *q vector holds either the
+   quantized energy (for elements with the flag set) or the absolute
+   values of the *r vector (for elements with flag unset).  On output,
+   *q holds the quantized energy for all elements */
+static float noise_normalize(vorbis_look_psy *p, int limit, float *r, float *q, float *f, int *flags, float acc, int i, int n, int *out){
 
-static void precomputed_couple_point(float premag,
-                                     int floorA,int floorB,
-                                     float *mag, float *ang){
+  vorbis_info_psy *vi=p->vi;
+  float **sort = alloca(n*sizeof(*sort));
+  int j,count=0;
+  int start = (vi->normal_p ? vi->normal_start-i : n);
+  if(start>n)start=n;
 
-  int test=(floorA>floorB)-1;
-  int offset=31-abs(floorA-floorB);
-  float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
+  /* still responsible for populating *out where noise norm not in
+     effect.  There's no need to [re]populate *q in these areas */
+  for(j=0;j<start;j++){
+    if(!flags || !flags[j]){ /* lossless coupling already quantized.
+                                Don't touch; requantizing based on
+                                energy would be incorrect. */
+      float ve = q[j]/f[j];
+      if(r[j]<0)
+        out[j] = -rint(sqrt(ve));
+      else
+        out[j] = rint(sqrt(ve));
+    }
+  }
 
-  floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
+  /* sort magnitudes for noise norm portion of partition */
+  for(;j<n;j++){
+    if(!flags || !flags[j]){ /* can't noise norm elements that have
+                                already been loslessly coupled; we can
+                                only account for their energy error */
+      float ve = q[j]/f[j];
+      /* Despite all the new, more capable coupling code, for now we
+         implement noise norm as it has been up to this point. Only
+         consider promotions to unit magnitude from 0.  In addition
+         the only energy error counted is quantizations to zero. */
+      /* also-- the original point code only applied noise norm at > pointlimit */
+      if(ve<.25f && (!flags || j>=limit-i)){
+        acc += ve;
+        sort[count++]=q+j; /* q is fabs(r) for unflagged element */
+      }else{
+        /* For now: no acc adjustment for nonzero quantization.  populate *out and q as this value is final. */
+        if(r[j]<0)
+          out[j] = -rint(sqrt(ve));
+        else
+          out[j] = rint(sqrt(ve));
+        q[j] = out[j]*out[j]*f[j];
+      }
+    }/* else{
+        again, no energy adjustment for error in nonzero quant-- for now
+        }*/
+  }
 
-  *mag=premag*floormag;
-  *ang=0.f;
-}
-
-/* just like below, this is currently set up to only do
-   single-step-depth coupling.  Otherwise, we'd have to do more
-   copying (which will be inevitable later) */
-
-/* doing the real circular magnitude calculation is audibly superior
-   to (A+B)/sqrt(2) */
-static float dipole_hypot(float a, float b){
-  if(a>0.){
-    if(b>0.)return sqrt(a*a+b*b);
-    if(a>-b)return sqrt(a*a-b*b);
-    return -sqrt(b*b-a*a);
+  if(count){
+    /* noise norm to do */
+    qsort(sort,count,sizeof(*sort),apsort);
+    for(j=0;j<count;j++){
+      int k=sort[j]-q;
+      if(acc>=vi->normal_thresh){
+        out[k]=unitnorm(r[k]);
+        acc-=1.f;
+        q[k]=f[k];
+      }else{
+        out[k]=0;
+        q[k]=0.f;
+      }
+    }
   }
-  if(b<0.)return -sqrt(a*a+b*b);
-  if(-a>b)return -sqrt(a*a-b*b);
-  return sqrt(b*b-a*a);
+
+  return acc;
 }
-static float round_hypot(float a, float b){
-  if(a>0.){
-    if(b>0.)return sqrt(a*a+b*b);
-    if(a>-b)return sqrt(a*a+b*b);
-    return -sqrt(b*b+a*a);
-  }
-  if(b<0.)return -sqrt(a*a+b*b);
-  if(-a>b)return -sqrt(a*a+b*b);
-  return sqrt(b*b+a*a);
-}
 
-/* revert to round hypot for now */
-float **_vp_quantize_couple_memo(vorbis_block *vb,
-                                 vorbis_info_psy_global *g,
-                                 vorbis_look_psy *p,
-                                 vorbis_info_mapping0 *vi,
-                                 float **mdct){
+/* Noise normalization, quantization and coupling are not wholly
+   seperable processes in depth>1 coupling. */
+void _vp_couple_quantize_normalize(int blobno,
+                                   vorbis_info_psy_global *g,
+                                   vorbis_look_psy *p,
+                                   vorbis_info_mapping0 *vi,
+                                   float **mdct,
+                                   int   **iwork,
+                                   int    *nonzero,
+                                   int     sliding_lowpass,
+                                   int     ch){
 
-  int i,j,n=p->n;
-  float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
-  int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
+  int i;
+  int n = p->n;
+  int partition=(p->vi->normal_p ? p->vi->normal_partition : 16);
+  int limit = g->coupling_pointlimit[p->vi->blockflag][blobno];
+  float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
+  float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
+  float de=0.1*p->m_val; /* a blend of the AoTuV M2 and M3 code here and below */
 
-  for(i=0;i<vi->coupling_steps;i++){
-    float *mdctM=mdct[vi->coupling_mag[i]];
-    float *mdctA=mdct[vi->coupling_ang[i]];
-    ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
-    for(j=0;j<limit;j++)
-      ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]);
-    for(;j<n;j++)
-      ret[i][j]=round_hypot(mdctM[j],mdctA[j]);
-  }
+  /* mdct is our raw mdct output, floor not removed. */
+  /* inout passes in the ifloor, passes back quantized result */
 
-  return(ret);
-}
+  /* unquantized energy (negative indicates amplitude has negative sign) */
+  float **raw = alloca(ch*sizeof(*raw));
 
-/* this is for per-channel noise normalization */
-static int apsort(const void *a, const void *b){
-  float f1=fabs(**(float**)a);
-  float f2=fabs(**(float**)b);
-  return (f1<f2)-(f1>f2);
-}
+  /* dual pupose; quantized energy (if flag set), othersize fabs(raw) */
+  float **quant = alloca(ch*sizeof(*quant));
 
-int **_vp_quantize_couple_sort(vorbis_block *vb,
-                               vorbis_look_psy *p,
-                               vorbis_info_mapping0 *vi,
-                               float **mags){
+  /* floor energy */
+  float **floor = alloca(ch*sizeof(*floor));
 
+  /* flags indicating raw/quantized status of elements in raw vector */
+  int   **flag  = alloca(ch*sizeof(*flag));
 
-  if(p->vi->normal_point_p){
-    int i,j,k,n=p->n;
-    int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
-    int partition=p->vi->normal_partition;
-    float **work=alloca(sizeof(*work)*partition);
+  /* non-zero flag working vector */
+  int    *nz    = alloca(ch*sizeof(*nz));
 
-    for(i=0;i<vi->coupling_steps;i++){
-      ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+  /* energy surplus/defecit tracking */
+  float  *acc   = alloca((ch+vi->coupling_steps)*sizeof(*acc));
 
-      for(j=0;j<n;j+=partition){
-        for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
-        qsort(work,partition,sizeof(*work),apsort);
-        for(k=0;k<partition;k++)ret[i][k+j]=work[k]-mags[i];
-      }
-    }
-    return(ret);
-  }
-  return(NULL);
-}
+  /* The threshold of a stereo is changed with the size of n */
+  if(n > 1000)
+    postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
 
-void _vp_noise_normalize_sort(vorbis_look_psy *p,
-                              float *magnitudes,int *sortedindex){
-  int i,j,n=p->n;
-  vorbis_info_psy *vi=p->vi;
-  int partition=vi->normal_partition;
-  float **work=alloca(sizeof(*work)*partition);
-  int start=vi->normal_start;
+  raw[0]   = alloca(ch*partition*sizeof(**raw));
+  quant[0] = alloca(ch*partition*sizeof(**quant));
+  floor[0] = alloca(ch*partition*sizeof(**floor));
+  flag[0]  = alloca(ch*partition*sizeof(**flag));
 
-  for(j=start;j<n;j+=partition){
-    if(j+partition>n)partition=n-j;
-    for(i=0;i<partition;i++)work[i]=magnitudes+i+j;
-    qsort(work,partition,sizeof(*work),apsort);
-    for(i=0;i<partition;i++){
-      sortedindex[i+j-start]=work[i]-magnitudes;
-    }
+  for(i=1;i<ch;i++){
+    raw[i]   = &raw[0][partition*i];
+    quant[i] = &quant[0][partition*i];
+    floor[i] = &floor[0][partition*i];
+    flag[i]  = &flag[0][partition*i];
   }
-}
+  for(i=0;i<ch+vi->coupling_steps;i++)
+    acc[i]=0.f;
 
-void _vp_noise_normalize(vorbis_look_psy *p,
-                         float *in,float *out,int *sortedindex){
-  int flag=0,i,j=0,n=p->n;
-  vorbis_info_psy *vi=p->vi;
-  int partition=vi->normal_partition;
-  int start=vi->normal_start;
+  for(i=0;i<n;i+=partition){
+    int k,j,jn = partition > n-i ? n-i : partition;
+    int step,track = 0;
 
-  if(start>n)start=n;
+    memcpy(nz,nonzero,sizeof(nz));
 
-  if(vi->normal_channel_p){
-    for(;j<start;j++)
-      out[j]=rint(in[j]);
+    /* prefill */
+    memset(flag[0],0,ch*partition*sizeof(**flag));
+    for(k=0;k<ch;k++){
+      int *iout = &iwork[k][i];
+      if(nz[k]){
 
-    for(;j+partition<=n;j+=partition){
-      float acc=0.;
-      int k;
+        for(j=0;j<jn;j++)
+          floor[k][j] = FLOOR1_fromdB_LOOKUP[iout[j]];
 
-      for(i=j;i<j+partition;i++)
-        acc+=in[i]*in[i];
+        flag_lossless(limit,prepoint,postpoint,&mdct[k][i],floor[k],flag[k],i,jn);
 
-      for(i=0;i<partition;i++){
-        k=sortedindex[i+j-start];
+        for(j=0;j<jn;j++){
+          quant[k][j] = raw[k][j] = mdct[k][i+j]*mdct[k][i+j];
+          if(mdct[k][i+j]<0) raw[k][j]*=-1.f;
+          floor[k][j]*=floor[k][j];
+        }
 
-        if(in[k]*in[k]>=.25f){
-          out[k]=rint(in[k]);
-          acc-=in[k]*in[k];
-          flag=1;
-        }else{
-          if(acc<vi->normal_thresh)break;
-          out[k]=unitnorm(in[k]);
-          acc-=1.;
+        acc[track]=noise_normalize(p,limit,raw[k],quant[k],floor[k],NULL,acc[track],i,jn,iout);
+
+      }else{
+        for(j=0;j<jn;j++){
+          floor[k][j] = 0.f;
+          raw[k][j] = 0.f;
+          quant[k][j] = 0.f;
+          flag[k][j] = 0;
+          iout[j]=0;
         }
+        acc[track]=0.f;
       }
-
-      for(;i<partition;i++){
-        k=sortedindex[i+j-start];
-        out[k]=0.;
-      }
+      track++;
     }
-  }
 
-  for(;j<n;j++)
-    out[j]=rint(in[j]);
+    /* coupling */
+    for(step=0;step<vi->coupling_steps;step++){
+      int Mi = vi->coupling_mag[step];
+      int Ai = vi->coupling_ang[step];
+      int *iM = &iwork[Mi][i];
+      int *iA = &iwork[Ai][i];
+      float *reM = raw[Mi];
+      float *reA = raw[Ai];
+      float *qeM = quant[Mi];
+      float *qeA = quant[Ai];
+      float *floorM = floor[Mi];
+      float *floorA = floor[Ai];
+      int *fM = flag[Mi];
+      int *fA = flag[Ai];
 
-}
+      if(nz[Mi] || nz[Ai]){
+        nz[Mi] = nz[Ai] = 1;
 
-void _vp_couple(int blobno,
-                vorbis_info_psy_global *g,
-                vorbis_look_psy *p,
-                vorbis_info_mapping0 *vi,
-                float **res,
-                float **mag_memo,
-                int   **mag_sort,
-                int   **ifloor,
-                int   *nonzero,
-                int  sliding_lowpass){
+        for(j=0;j<jn;j++){
 
-  int i,j,k,n=p->n;
+          if(j<sliding_lowpass-i){
+            if(fM[j] || fA[j]){
+              /* lossless coupling */
 
-  /* perform any requested channel coupling */
-  /* point stereo can only be used in a first stage (in this encoder)
-     because of the dependency on floor lookups */
-  for(i=0;i<vi->coupling_steps;i++){
+              reM[j] = fabs(reM[j])+fabs(reA[j]);
+              qeM[j] = qeM[j]+qeA[j];
+              fM[j]=fA[j]=1;
 
-    /* once we're doing multistage coupling in which a channel goes
-       through more than one coupling step, the floor vector
-       magnitudes will also have to be recalculated an propogated
-       along with PCM.  Right now, we're not (that will wait until 5.1
-       most likely), so the code isn't here yet. The memory management
-       here is all assuming single depth couplings anyway. */
+              /* couple iM/iA */
+              {
+                int A = iM[j];
+                int B = iA[j];
 
-    /* make sure coupling a zero and a nonzero channel results in two
-       nonzero channels. */
-    if(nonzero[vi->coupling_mag[i]] ||
-       nonzero[vi->coupling_ang[i]]){
+                iA[j]=(A>abs(B)||B>abs(A) ? A-B : B-A);
+                if(abs(B)>abs(A))iM[j]=B;
 
-      float *rM=res[vi->coupling_mag[i]];
-      float *rA=res[vi->coupling_ang[i]];
-      float *qM=rM+n;
-      float *qA=rA+n;
-      int *floorM=ifloor[vi->coupling_mag[i]];
-      int *floorA=ifloor[vi->coupling_ang[i]];
-      float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
-      float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
-      int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
-      int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
+                /* collapse two equivalent tuples to one */
+                if(abs(iM[j])*2==iA[j]){
+                  iA[j]= -iA[j];
+                  iM[j]= -iM[j];
+                }
+              }
 
-      nonzero[vi->coupling_mag[i]]=1;
-      nonzero[vi->coupling_ang[i]]=1;
+            }else{
+              /* lossy (point) coupling */
 
-       /* The threshold of a stereo is changed with the size of n */
-       if(n > 1000)
-         postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
+              if(j<limit-i){
+                /* dipole */
+                reM[j] += reA[j];
+                qeM[j] = fabs(reM[j]);
+              }else{
+                /* AoTuV */
+                /** @ M2 **
+                    The boost problem by the combination of noise normalization and point stereo is eased.
+                    However, this is a temporary patch.
+                    by Aoyumi @ 2004/04/18
+                */
+                float derate = (1.0 - de*((float)(j-limit+i) / (float)(n-limit)));
 
-      for(j=0;j<p->n;j+=partition){
-        float acc=0.f;
-
-        for(k=0;k<partition;k++){
-          int l=k+j;
-
-          if(l<sliding_lowpass){
-            if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
-               (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
-
-              precomputed_couple_point(mag_memo[i][l],
-                                       floorM[l],floorA[l],
-                                       qM+l,qA+l);
-
-              if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
-            }else{
-              couple_lossless(rM[l],rA[l],qM+l,qA+l);
+                /* elliptical */
+                if(reM[j]+reA[j]<0){
+                  reM[j] = - (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate);
+                }else{
+                  reM[j] =   (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate);
+                }
+              }
+              reA[j]=qeA[j]=0.f;
+              fA[j]=1;
+              iA[j]=0;
             }
-          }else{
-            qM[l]=0.;
-            qA[l]=0.;
           }
+          floorM[j]=floorA[j]=floorM[j]+floorA[j];
         }
-
-        if(p->vi->normal_point_p){
-          for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
-            int l=mag_sort[i][j+k];
-            if(l<sliding_lowpass && l>=limit && rint(qM[l])==0.f){
-              qM[l]=unitnorm(qM[l]);
-              acc-=1.f;
-            }
-          }
-        }
+        /* normalize the resulting mag vector */
+        acc[track]=noise_normalize(p,limit,raw[Mi],quant[Mi],floor[Mi],flag[Mi],acc[track],i,jn,iM);
+        track++;
       }
     }
   }
 }
-
-/* AoTuV */
-/** @ M2 **
-   The boost problem by the combination of noise normalization and point stereo is eased.
-   However, this is a temporary patch.
-   by Aoyumi @ 2004/04/18
-*/
-
-void hf_reduction(vorbis_info_psy_global *g,
-                      vorbis_look_psy *p,
-                      vorbis_info_mapping0 *vi,
-                      float **mdct){
-
-  int i,j,n=p->n, de=0.3*p->m_val;
-  int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
-
-  for(i=0; i<vi->coupling_steps; i++){
-    /* for(j=start; j<limit; j++){} // ???*/
-    for(j=limit; j<n; j++)
-      mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
-  }
-}

Modified: trunk/vorbis/lib/psy.h
===================================================================
--- trunk/vorbis/lib/psy.h	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/psy.h	2010-03-03 16:12:40 UTC (rev 16946)
@@ -57,8 +57,7 @@
 
   float max_curve_dB;
 
-  int normal_channel_p;
-  int normal_point_p;
+  int normal_p;
   int normal_start;
   int normal_partition;
   double normal_thresh;
@@ -122,12 +121,6 @@
 extern void   _vi_psy_free(vorbis_info_psy *i);
 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
 
-extern void _vp_remove_floor(vorbis_look_psy *p,
-                             float *mdct,
-                             int *icodedflr,
-                             float *residue,
-                             int sliding_lowpass);
-
 extern void _vp_noisemask(vorbis_look_psy *p,
                           float *logmdct,
                           float *logmask);
@@ -148,38 +141,14 @@
 
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
-extern float **_vp_quantize_couple_memo(vorbis_block *vb,
-                                        vorbis_info_psy_global *g,
-                                        vorbis_look_psy *p,
-                                        vorbis_info_mapping0 *vi,
-                                        float **mdct);
+extern void _vp_couple_quantize_normalize(int blobno,
+                                          vorbis_info_psy_global *g,
+                                          vorbis_look_psy *p,
+                                          vorbis_info_mapping0 *vi,
+                                          float **mdct,
+                                          int   **iwork,
+                                          int    *nonzero,
+                                          int     sliding_lowpass,
+                                          int     ch);
 
-extern void _vp_couple(int blobno,
-                       vorbis_info_psy_global *g,
-                       vorbis_look_psy *p,
-                       vorbis_info_mapping0 *vi,
-                       float **res,
-                       float **mag_memo,
-                       int   **mag_sort,
-                       int   **ifloor,
-                       int   *nonzero,
-                       int   sliding_lowpass);
-
-extern void _vp_noise_normalize(vorbis_look_psy *p,
-                                float *in,float *out,int *sortedindex);
-
-extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
-                                     float *magnitudes,int *sortedindex);
-
-extern int **_vp_quantize_couple_sort(vorbis_block *vb,
-                                      vorbis_look_psy *p,
-                                      vorbis_info_mapping0 *vi,
-                                      float **mags);
-
-extern void hf_reduction(vorbis_info_psy_global *g,
-                         vorbis_look_psy *p,
-                         vorbis_info_mapping0 *vi,
-                         float **mdct);
-
-
 #endif

Modified: trunk/vorbis/lib/res0.c
===================================================================
--- trunk/vorbis/lib/res0.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/res0.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -5,7 +5,7 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
@@ -718,7 +718,7 @@
 
 int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
                  int **in,int *nonzero,int ch, long **partword){
-  int i,j,used=0,n=vb->pcmend/2;
+  int i,used=0;
   for(i=0;i<ch;i++)
     if(nonzero[i])
       in[used++]=in[i];

Modified: trunk/vorbis/lib/vorbisenc.c
===================================================================
--- trunk/vorbis/lib/vorbisenc.c	2010-03-03 15:16:00 UTC (rev 16945)
+++ trunk/vorbis/lib/vorbisenc.c	2010-03-03 16:12:40 UTC (rev 16946)
@@ -331,8 +331,7 @@
   p->blockflag=block>>1;
 
   if(hi->noise_normalize_p){
-    p->normal_channel_p=1;
-    p->normal_point_p=1;
+    p->normal_p=1;
     p->normal_start=nn_start[is];
     p->normal_partition=nn_partition[is];
     p->normal_thresh=nn_thresh[is];



More information about the commits mailing list