[xiph-commits] r12026 - in branches/vorbis-aotuv/lib: . modes

j at svn.xiph.org j at svn.xiph.org
Sun Nov 5 06:48:14 PST 2006


Author: j
Date: 2006-11-05 06:47:59 -0800 (Sun, 05 Nov 2006)
New Revision: 12026

Modified:
   branches/vorbis-aotuv/lib/block.c
   branches/vorbis-aotuv/lib/codec_internal.h
   branches/vorbis-aotuv/lib/info.c
   branches/vorbis-aotuv/lib/mapping0.c
   branches/vorbis-aotuv/lib/masking.h
   branches/vorbis-aotuv/lib/modes/psych_11.h
   branches/vorbis-aotuv/lib/modes/psych_16.h
   branches/vorbis-aotuv/lib/modes/psych_44.h
   branches/vorbis-aotuv/lib/modes/psych_8.h
   branches/vorbis-aotuv/lib/modes/residue_16.h
   branches/vorbis-aotuv/lib/modes/residue_44.h
   branches/vorbis-aotuv/lib/modes/residue_44u.h
   branches/vorbis-aotuv/lib/modes/residue_8.h
   branches/vorbis-aotuv/lib/modes/setup_11.h
   branches/vorbis-aotuv/lib/modes/setup_16.h
   branches/vorbis-aotuv/lib/modes/setup_22.h
   branches/vorbis-aotuv/lib/modes/setup_32.h
   branches/vorbis-aotuv/lib/modes/setup_44.h
   branches/vorbis-aotuv/lib/modes/setup_44u.h
   branches/vorbis-aotuv/lib/modes/setup_8.h
   branches/vorbis-aotuv/lib/modes/setup_X.h
   branches/vorbis-aotuv/lib/psy.c
   branches/vorbis-aotuv/lib/psy.h
Log:
- aoTuV Beta3
< <Since beta2 was adopted as official 1.1, beta3 uses 1.1 as a base. >>
#  bitrate management mode operates normally now. It not only became new, it offers new rate control. (changed part of Vorbis 1.1 by Monty) 

# Pre-echo was decreased in the mode of q0-q10. 
# Since some codes of beta2 were not working normally, correction and re-tuning were carried out. 
# In the mode below q3, the problem to which a part of sound becomes unstable is improved. (e.g. piano/strings)
# Distortion resulting from channel coupling was reduced. (e.g. brass/drumus/guitar)
# The q-2 new mode.



Modified: branches/vorbis-aotuv/lib/block.c
===================================================================
--- branches/vorbis-aotuv/lib/block.c	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/block.c	2006-11-05 14:47:59 UTC (rev 12026)
@@ -287,6 +287,10 @@
   b=v->backend_state;
   b->psy_g_look=_vp_global_look(vi);
 
+  /* added by aoyumi */
+  b->nblock = _ogg_calloc((128*vi->channels), sizeof(*b->nblock));
+  b->tblock = _ogg_calloc((128*vi->channels), sizeof(*b->tblock));
+
   /* Initialize the envelope state storage */
   b->ve=_ogg_calloc(1,sizeof(*b->ve));
   _ve_envelope_init(b->ve,vi);
@@ -344,6 +348,10 @@
 
       drft_clear(&b->fft_look[0]);
       drft_clear(&b->fft_look[1]);
+      
+      /* added by aoyumi */
+      if(b->nblock) _ogg_free(b->nblock);
+      if(b->tblock) _ogg_free(b->tblock);
 
     }
     

Modified: branches/vorbis-aotuv/lib/codec_internal.h
===================================================================
--- branches/vorbis-aotuv/lib/codec_internal.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/codec_internal.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -79,6 +79,14 @@
   bitrate_manager_state bms;
 
   ogg_int64_t sample_count;
+
+  /* encode only
+    added by aoyumi */
+  float *nblock; /* lW logmdct buffer */  
+  float *tblock; /* temporal masking buffer (impulse block) */
+  int lW_blocktype; /* last window block type */
+  int lW_modenumber; /* last window mode number (0=short, 1=long) */
+  int lW_no; /* the number of continuous window blocks (last window) */
 } private_state;
 
 /* codec_setup_info contains all the setup information specific to the

Modified: branches/vorbis-aotuv/lib/info.c
===================================================================
--- branches/vorbis-aotuv/lib/info.c	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/info.c	2006-11-05 14:47:59 UTC (rev 12026)
@@ -416,7 +416,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiph.Org libVorbis I 20040629";
+  char temp[]="AO; aoTuV b3 [20041120] (based on Xiph.Org's libVorbis)";
   int bytes = strlen(temp);
 
   /* preamble */  

Modified: branches/vorbis-aotuv/lib/mapping0.c
===================================================================
--- branches/vorbis-aotuv/lib/mapping0.c	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/mapping0.c	2006-11-05 14:47:59 UTC (rev 12026)
@@ -380,6 +380,9 @@
       
       float *logmdct =logfft+n/2;
       float *logmask =logfft;
+      
+      float *lastmdct = b->nblock+i*128;
+      float *tempmdct = b->tblock+i*128;
 
       vb->mode=modenumber;
 
@@ -467,7 +470,11 @@
 			   1,
 			   logmask,
 			   mdct,
-			   logmdct);
+			   logmdct,
+			   lastmdct, tempmdct,
+			   blocktype, modenumber,
+			   vb->nW,
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
 	
 #if 0
 	if(vi->channels==2){
@@ -510,7 +517,11 @@
 			   2,
 			   logmask,
 			   mdct,
-			   logmdct);
+			   logmdct,
+			   lastmdct, tempmdct,
+			   blocktype, modenumber,
+			   vb->nW,
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
 
 #if 0
 	if(vi->channels==2){
@@ -533,7 +544,11 @@
 			   0,
 			   logmask,
 			   mdct,
-			   logmdct);
+			   logmdct,
+			   lastmdct, tempmdct,
+			   blocktype, modenumber,
+			   vb->nW,
+			   b->lW_blocktype, b->lW_modenumber, b->lW_no);
 
 #if 0
 	if(vi->channels==2)
@@ -691,7 +706,9 @@
 		   mag_sort,
 		   ilogmaskch,
 		   nonzero,
-		   ci->psy_g_param.sliding_lowpass[vb->W][k]);
+		   ci->psy_g_param.sliding_lowpass[vb->W][k],
+		   blocktype, modenumber,
+		   b->lW_blocktype, b->lW_modenumber);
       }
       
       /* classify and encode by submap */
@@ -717,6 +734,11 @@
 		  couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
       }
       
+      /* set last-window type & number */
+      if((blocktype == b->lW_blocktype) && (modenumber == b->lW_modenumber)) b->lW_no++;
+      else b->lW_no = 1;
+      b->lW_blocktype = blocktype;
+      b->lW_modenumber = modenumber;
       /* ok, done encoding.  Next protopacket. */
     }
     

Modified: branches/vorbis-aotuv/lib/masking.h
===================================================================
--- branches/vorbis-aotuv/lib/masking.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/masking.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: masking curve data for psychoacoustics
- last mod: $Id: masking.h,v 1.24 2002/07/01 11:20:11 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -23,16 +23,29 @@
 
 #define MAX_ATH 88
 static float ATH[]={
-  /*15*/  -51, -52, -53, -54, -55, -56, -57, -58,  
+/* original ATH */
+  /*15*/  //-51, -52, -53, -54, -55, -56, -57, -58,  
+  /*31*/  //-59, -60, -61, -62, -63, -64, -65, -66,
+  /*63*/  //-67, -68, -69, -70, -71, -72, -73, -74, 
+  /*125*/ //-75, -76, -77, -78, -80, -81, -82, -83,
+  /*250*/ //-84, -85, -86, -87, -88, -88, -89, -89, 
+  /*500*/ //-90, -91, -91, -92, -93, -94, -95, -96,
+  /*1k*/  //-96, -97, -98, -98, -99, -99,-100,-100,
+  /*2k*/ //-101,-102,-103,-104,-106,-107,-107,-107,
+  /*4k*/ //-107,-105,-103,-102,-101, -99, -98, -96,
+  /*8k*/  //-95, -95, -96, -97, -96, -95, -93, -90,
+  /*16k*/ //-80, -70, -50, -40, -30, -30, -30, -30
+/* Aoyumi's ATH (fixed) */
+  /*15*/  -51, -52, -53, -54, -55, -56, -57, -58,
   /*31*/  -59, -60, -61, -62, -63, -64, -65, -66,
-  /*63*/  -67, -68, -69, -70, -71, -72, -73, -74, 
-  /*125*/ -75, -76, -77, -78, -80, -81, -82, -83,
-  /*250*/ -84, -85, -86, -87, -88, -88, -89, -89, 
-  /*500*/ -90, -91, -91, -92, -93, -94, -95, -96,
-  /*1k*/  -96, -97, -98, -98, -99, -99,-100,-100,
-  /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107,
-  /*4k*/ -107,-105,-103,-102,-101, -99, -98, -96,
-  /*8k*/  -95, -95, -96, -97, -96, -95, -93, -90,
+  /*63*/  -67, -68, -69, -70, -71, -73, -74, -75,
+  /*125*/ -77, -79, -81, -82, -83, -84, -85, -86,
+  /*250*/ -87, -88, -89, -90, -91, -91, -92, -92,
+  /*500*/ -93, -94, -95, -95, -96, -96, -96, -97,
+  /*1k*/  -97, -96, -96, -96, -97, -98, -99,-100,
+  /*2k*/ -101,-102,-103,-104,-106,-107,-107,-106,
+  /*4k*/ -104,-102,-101,-100,-100, -99, -98, -97,
+  /*8k*/  -96, -95, -96, -97, -96, -95, -93, -89,
   /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30
 };
 

Modified: branches/vorbis-aotuv/lib/modes/psych_11.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_11.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/psych_11.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -15,26 +15,32 @@
 
  ********************************************************************/
 
-static double _psy_lowpass_11[3]={4.5,5.5,30.,};
+static double _psy_lowpass_11[4]={4,4.5,5.5,30.,};
 
-static att3 _psy_tone_masteratt_11[3]={
-  {{ 30,  25,  12},  0,   0},  /* 0 */
-  {{ 30,  25,  12},  0,   0},  /* 0 */
-  {{ 20,   0, -14},  0,   0}, /* 0 */
+static att3 _psy_tone_masteratt_11[4]={
+  {{ 30,  25,  12},  0,   0},  /* -2 */
+  {{ 30,  25,  12},  0,   0},  /* -1 */
+  {{ 30,  25,  12},  0,   0},  /*  0 */
+  {{ 20,   0, -14},  0,   0},  /* 10 */
 };
 
-static vp_adjblock _vp_tonemask_adj_11[3]={
+static vp_adjblock _vp_tonemask_adj_11[4]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
-  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */
-  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 5, 0, 0,99,99,99}}, /* 1 */
-  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 2 */
+  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* -2 */
+  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* -1 */
+  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 5, 0, 0,99,99,99}}, /*  0 */
+  {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 10 */
 };
 
 
-static noise3 _psy_noisebias_11[3]={
+static noise3 _psy_noisebias_11[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4, 10, 10, 12, 12, 12, 99, 99, 99},
+    {-12,-12,-12,-12,-10,-10, -5,  0,  2,  4,  4,  5,  5, 10, 99, 99, 99},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
+
+  {{{-10,-10,-10,-10, -5, -5, -5,  0,  4, 10, 10, 12, 12, 12, 99, 99, 99},
     {-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  4,  5,  5, 10, 99, 99, 99},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
 
@@ -47,5 +53,5 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
 };
 
-static double _noise_thresh_11[3]={ .3,.5,.5 };
+static double _noise_thresh_11[4]={ .3,.3,.5,.5 };
 

Modified: branches/vorbis-aotuv/lib/modes/psych_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_16.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/psych_16.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,12 +11,12 @@
  ********************************************************************
 
  function: 16kHz settings 
- last mod: $Id: psych_16.h,v 1.3 2003/09/02 06:05:47 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_16[4]={
+static adj_stereo _psy_stereo_modes_16[5]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
   {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
@@ -24,6 +24,10 @@
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   {  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  4,  4},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
    {  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  4,  4,  4,  4,  4},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   {{  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
@@ -36,28 +40,34 @@
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
 };
 
-static double _psy_lowpass_16[4]={6.5,8,30.,99.};
+static double _psy_lowpass_16[5]={6.,6.5,8,30.,99.};
 
-static att3 _psy_tone_masteratt_16[4]={
-  {{ 30,  25,  12},  0,   0},  /* 0 */
-  {{ 25,  22,  12},  0,   0},  /* 0 */
-  {{ 20,  12,   0},  0,   0},  /* 0 */
-  {{ 15,   0, -14},  0,   0}, /* 0 */
+static att3 _psy_tone_masteratt_16[5]={
+  {{ 30,  25,  12},  0,   0},  /* -2 */
+  {{ 30,  25,  12},  0,   0},  /* -1 */
+  {{ 25,  22,  12},  0,   0},  /* 0.5 */
+  {{ 20,  12,   0},  0,   0},  /*  5 */
+  {{ 15,   0, -14},  0,   0},  /* 10 */
 };
 
-static vp_adjblock _vp_tonemask_adj_16[4]={
+static vp_adjblock _vp_tonemask_adj_16[5]={
   /* adjust for mode zero */
   /* 63     125     250     500       1     2     4     8    16 */
-  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
-  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 1 */
-  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
-  {{-30,-30,-30,-30,-30,-26,-20,-10, -5, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
+  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* -2 */
+  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* -1 */
+  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0.5 */
+  {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0, 0, 0, 0, 0, 0, 0}}, /*  5 */
+  {{-30,-30,-30,-30,-30,-26,-20,-10, -5, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
 };
 
 
-static noise3 _psy_noisebias_16_short[4]={
+static noise3 _psy_noisebias_16_short[5]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
+    {-12,-12,-12,-12,-12, -7, -4, -2,  3,  3,  4,  5,  5,  6,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
+
+  {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
     {-15,-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  5,  5,  6,  8,  8, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
 
@@ -74,9 +84,13 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static noise3 _psy_noisebias_16_impulse[4]={
+static noise3 _psy_noisebias_16_impulse[5]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
+    {-12,-12,-12,-12,-12, -7, -4, -2,  3,  3,  4,  5,  5,  6,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
+
+  {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
     {-15,-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  5,  5,  6,  8,  8, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
 
@@ -93,9 +107,13 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static noise3 _psy_noisebias_16[4]={
+static noise3 _psy_noisebias_16[5]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4,  6,  8,  8, 10, 10, 10, 14, 20},
+    {-10,-10,-10,-10,-10, -5, -2, -2,  3,  3,  3,  4,  5,  6,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
+
+  {{{-10,-10,-10,-10, -5, -5, -5,  0,  4,  6,  8,  8, 10, 10, 10, 14, 20},
     {-10,-10,-10,-10,-10, -5, -2, -2,  0,  0,  0,  4,  5,  6,  8,  8, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}},
 
@@ -112,17 +130,17 @@
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static double _noise_thresh_16[4]={ .3,.5,.5,.5 };
+static double _noise_thresh_16[5]={ .3,.3,.5,.5,.5 };
 
-static int _noise_start_16[3]={ 256,256,9999 };
-static int _noise_part_16[4]={ 8,8,8,8 };
+static int _noise_start_16[4]={ 256,256,256,9999 };
+static int _noise_part_16[5]={ 8,8,8,8,8 };
 
-static int _psy_ath_floater_16[4]={
-  -100,-100,-100,-105,
+static int _psy_ath_floater_16[5]={
+  -100,-100,-100,-100,-105,
 };
 
-static int _psy_ath_abs_16[4]={
-  -130,-130,-130,-140,
+static int _psy_ath_abs_16[5]={
+  -130,-130,-130,-130,-140,
 };
 
 

Modified: branches/vorbis-aotuv/lib/modes/psych_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_44.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/psych_44.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -18,9 +18,24 @@
 
 /* preecho trigger settings *****************************************/
 
-static vorbis_info_psy_global _psy_global_44[5]={
-
+static vorbis_info_psy_global _psy_global_44[6]={
+/*
+  { lines per eighth octave,
+   { pre-echo thresh.}, 
+   { post-echo thresh.}, stretch penalty, pre-echo minimum energy,
+   ampmax att 1/sec,
+   {coupling point(kHz)},{{coupling point limit0},{coupling point limit1}},
+     {coupling pre-point amp},{coupling post-point amp},{{sliding lowpass0},{sliding lowpass1}}
+  },
+*/
+/* q-2 */
   {8,   /* lines per eighth octave */
+   {24.f,14.f,14.f,14.f,14.f,14.f,14.f}, 
+   {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 2,-75.f,
+   -6.f,
+   {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
+  },
+  {8,   /* lines per eighth octave */
    {20.f,14.f,12.f,12.f,12.f,12.f,12.f}, 
    {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 2,-75.f,
    -6.f,
@@ -39,14 +54,16 @@
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
-   {10.f,8.f,8.f,8.f,8.f,8.f,8.f}, 
+//   {10.f,8.f,8.f,8.f,8.f,8.f,8.f}, 
+   {10.f,8.f,8.f,6.f,6.f,6.f,7.f},
    {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-80.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
    {10.f,6.f,6.f,6.f,6.f,6.f,6.f}, 
-   {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f,
+//   {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f,
+   {-15.f,-14.f,-10.f,-10.f,-10.f,-11.f,-12.f}, 0,-85.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
@@ -56,10 +73,15 @@
 static compandblock _psy_compand_44[6]={
   /* sub-mode Z short */
   {{
-    0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
-    8, 9,10,11,12,13,14, 15,     /* 15dB */
-    16,17,18,19,20,21,22, 23,     /* 23dB */
-    24,25,26,27,28,29,30, 31,     /* 31dB */
+//    0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+//    8, 9,10,11,12,13,14, 15,     /* 15dB */
+//    16,17,18,19,20,21,22, 23,     /* 23dB */
+//    24,25,26,27,28,29,30, 31,     /* 31dB */
+//    32,33,34,35,36,37,38, 39,     /* 39dB */
+     0, 1, 2, 3, 4, 5, 6,  6,     /* 7dB */
+     7, 7, 7, 7, 6, 6, 6,  7,     /* 15dB */
+     7, 8, 9,10,11,13,15, 17,     /* 23dB */
+    20,23,26,27,28,29,30, 31,     /* 31dB */
     32,33,34,35,36,37,38, 39,     /* 39dB */
   }},
   /* mode_Z nominal short */
@@ -80,10 +102,15 @@
   }},
   /* sub-mode Z long */
   {{
+//     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+//     8, 9,10,11,12,13,14, 15,     /* 15dB */
+//    16,17,18,19,20,21,22, 23,     /* 23dB */
+//    24,25,26,27,28,29,30, 31,     /* 31dB */
+//    32,33,34,35,36,37,38, 39,     /* 39dB */
      0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
-     8, 9,10,11,12,13,14, 15,     /* 15dB */
-    16,17,18,19,20,21,22, 23,     /* 23dB */
-    24,25,26,27,28,29,30, 31,     /* 31dB */
+     8, 9,10,11,12,12,13, 13,     /* 15dB */
+    13,14,14,14,15,15,15, 17,     /* 23dB */
+    20,23,26,27,28,29,30, 31,     /* 31dB */
     32,33,34,35,36,37,38, 39,     /* 39dB */
   }},
   /* mode_Z nominal long */
@@ -106,126 +133,136 @@
 
 /* tonal masking curve level adjustments *************************/
 
-static vp_adjblock _vp_tonemask_adj_longblock[12]={
-
+static vp_adjblock _vp_tonemask_adj_longblock[13]={
    /* 63     125     250     500       1       2       4       8      16 */
 
-   {{ -3, -8,-13,-15,-10,-10,-10,-10,-10,-10,-10,  0,  0,  0,  0,  0,  0}}, /* -1 */
+   {{ -3, -9,-12,-12,-10,-10,-10,-10,-10,-10,-10, -1,  0,  0,  1,  1,  1}}, /* -2(addition) */
 
+   {{ -3, -9,-12,-12,-11,-11,-11,-11,-11,-11,-10, -1, -1,  0,  0,  0,  0}}, /* -1 */
+
 /* {{-15,-15,-15,-15,-10, -8, -4, -2,  0,  0,  0, 10,  0,  0,  0,  0,  0}},    0 */
-   {{ -4,-10,-14,-16,-15,-14,-13,-12,-12,-12,-11, -1, -1, -1, -1, -1,  0}}, /* 0 */
+   {{ -5,-11,-14,-15,-15,-14,-14,-14,-13,-12,-10, -2, -2, -1, -1,  0,  0}}, /* 0 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  5,  0,  0,  0,  0,  0}},    1 */
-   {{ -6,-12,-14,-16,-15,-15,-14,-13,-13,-12,-12, -2, -2, -1, -1, -1,  0}}, /* 1 */
+   {{ -6,-12,-15,-16,-16,-15,-14,-14,-13,-12,-10, -2, -2, -1, -1,  0,  0}}, /* 1 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    2 */
-   {{-12,-13,-14,-16,-16,-16,-15,-14,-13,-12,-12, -6, -3, -1, -1, -1,  0}}, /* 2 */
-
+   {{-12,-13,-15,-16,-16,-15,-15,-14,-14,-12,-12, -5, -4, -2, -1,  0,  0}}, /* 2 */
+   
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    3 */
-   {{-15,-15,-15,-16,-16,-16,-16,-14,-13,-13,-13,-10, -4, -2, -1, -1,  0}}, /* 3 */
+   {{-15,-15,-16,-16,-16,-15,-15,-14,-14,-13,-13,-12, -7  -2, -1, -1 , 0}}, /* 3 */
 
-/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}}, *//* 4 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7  -3, -1, -1 , 0}}, /* 4 */
+/* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    4 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -1, -1 , 0}}, /* 4 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    5 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7  -3, -1, -1 , 0}}, /* 5 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -1 , 0}}, /* 5 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    6 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -8, -4, -2, -2,  0}}, /* 6 */
-
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 6 */
+   
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    7 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 7 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 7 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    8 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 8 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 8 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    9 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 9 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 9 */
 
 /* {{-15,-15,-15,-15,-15,-12,-10, -8,  0,  0,  0,  0,  0,  0,  0,  0,  0}},    10 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 10 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 10 */
 };
 
-static vp_adjblock _vp_tonemask_adj_otherblock[12]={
+static vp_adjblock _vp_tonemask_adj_otherblock[13]={
    /* 63     125     250     500       1       2       4       8      16 */
 
-   {{ -3, -8,-13,-15,-10,-10, -9, -9, -9, -9, -9,  1,  1,  1,  1,  1,  1}}, /* -1 */
+   {{ -3, -9,-12,-12,-10,-10,-10,-10,-10,-10,-10, -1,  0,  0,  1,  1,  1}}, /* -2(addition) */
 
+   {{ -3, -9,-12,-12,-11,-11,-11,-11,-11,-11,-10, -1, -1,  0,  0,  0,  0}}, /* -1 */
+
 /* {{-20,-20,-20,-20,-14,-12,-10, -8, -4,  0,  0, 10,  0,  0,  0,  0,  0}},    0 */
-   {{ -4,-10,-14,-16,-14,-13,-12,-12,-11,-11,-10,  0,  0,  0,  0,  0,  0}}, /* 0 */
+   {{ -5,-11,-14,-15,-15,-15,-14,-14,-13,-12,-10, -2, -2, -1, -1,  0,  0}}, /* 0 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  5,  0,  0,  0,  0,  0}},    1 */
-   {{ -6,-12,-14,-16,-15,-15,-14,-13,-13,-12,-12, -2, -2, -1,  0,  0,  0}}, /* 1 */
+   {{ -6,-12,-15,-16,-16,-15,-14,-14,-13,-12,-10, -2, -2, -1, -1,  0,  0}}, /* 1 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    2 */
-   {{-12,-13,-14,-16,-16,-16,-15,-14,-13,-12,-12, -5, -2, -1,  0,  0,  0}}, /* 2 */
+   {{-12,-13,-15,-16,-16,-15,-15,-14,-14,-12,-12, -5, -4, -2, -1,  0,  0}}, /* 2 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    3 */
-   {{-15,-15,-15,-16,-16,-16,-16,-14,-13,-13,-13,-10, -4, -2,  0,  0,  0}}, /* 3 */
+   {{-15,-15,-16,-16,-16,-15,-15,-14,-14,-13,-13,-12, -7  -2, -1, -1 , 0}}, /* 3 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    4 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7  -3, -1, -1 , 0}}, /* 4 */
-
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13, -9  -3, -1, -1 , 0}}, /* 4 */
+   
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    5 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7  -3, -1, -1 , 0}}, /* 5 */
-
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -1, -1 , 0}}, /* 5 */
+   
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    6 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -8, -4, -2, -2,  0}}, /* 6 */
-
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 6 */
+   
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    7 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 7 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 7 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    8 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 8 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 8 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    9 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 9 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 9 */
 
 /* {{-20,-20,-20,-20,-20,-18,-16,-14,-10,  0,  0,  0,  0,  0,  0,  0,  0}},    10 */
-   {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 10 */
+   {{-16,-16,-16,-16,-16,-16,-16,-15,-15,-14,-14,-13,-10  -4, -2, -2 , 0}}, /* 10 */
 };
 
 /* noise bias (transition block) */
-static noise3 _psy_noisebias_trans[12]={
+static noise3 _psy_noisebias_trans[13]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
-  /* -1 */
+  /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-26,-26,-26,-26,-22,-16,-12, -4, -2,  0,  1,  1,  5,  6,  7,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
+  /* -1 
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-30,-30,-30,-30,-26,-20,-16, -8, -6, -4, -2,  0,  2,  3,  6,  6, 14},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 0 
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  4,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},*/
-  {{{-15,-15,-15,-15,-15,-12, -6, -4,  0,  2,  4,  4,  5,  5,  5,  8,  10},
-    {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  3,   6},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},
+  {{{-15,-15,-15,-15,-15,-12, -6, -4,  0,  2,  4,  4,  5,  5,  5,  8, 10},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  4,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 1 
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},*/
-  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  1,   4},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6,  -4}}},
+  {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8, 10},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  1,  4},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},
   /* 2 
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, */
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -2, -1,  0,  3},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -2, -2, -1,  1,  3},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -7, -4}}},
   /* 3 
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  2},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  3},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
   /* 4 
   {{{-20,-20,-20,-20,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  5},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-20,-20,-20,-20,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2, -1,  1},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  1},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
   /* 5 
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
@@ -245,23 +282,32 @@
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-24,-18,-14,-12,-10, -8, -8, -8, -6, -4,  0},
     {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},*/
+//  {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
+//    {-32,-32,-32,-32,-28,-24,-24,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
+//    {-34,-34,-34,-34,-30,-26,-26,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-32,-32,-32,-32,-28,-24,-24,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
-    {-34,-34,-34,-34,-30,-26,-26,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
+    {-32,-32,-32,-32,-28,-24,-24,-18,-14,-12,-10, -8, -8, -8, -7, -4, -1},
+    {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},
   /* 8 
   {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
     {-36,-36,-36,-36,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
     {-36,-36,-36,-36,-34,-30,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},*/
-  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7}, 
-    {-36,-36,-36,-36,-30,-30,-30,-24,-20,-16,-16,-16,-16,-14,-12,-10, -7},
-    {-36,-36,-36,-36,-34,-30,-28,-26,-24,-30,-30,-30,-30,-30,-30,-24,-20}}},
+//  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7}, 
+//    {-36,-36,-36,-36,-30,-30,-30,-24,-20,-16,-16,-16,-16,-14,-12,-10, -7},
+//    {-36,-36,-36,-36,-34,-30,-28,-26,-24,-30,-30,-30,-30,-30,-30,-24,-20}}},
+  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+    {-36,-36,-36,-36,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -9, -6, -3},
+    {-36,-36,-36,-36,-34,-30,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
   /* 9 
   {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
     {-36,-36,-36,-36,-34,-32,-32,-28,-20,-16,-16,-16,-16,-14,-12,-10, -7},
     {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},*/
+//  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
+//    {-38,-38,-38,-38,-36,-34,-34,-30,-24,-20,-20,-20,-20,-18,-16,-12,-10},
+//    {-40,-40,-40,-40,-40,-40,-40,-38,-35,-35,-35,-35,-35,-35,-35,-35,-30}}},
   {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
-    {-38,-38,-38,-38,-36,-34,-34,-30,-24,-20,-20,-20,-20,-18,-16,-12,-10},
-    {-40,-40,-40,-40,-40,-40,-40,-38,-35,-35,-35,-35,-35,-35,-35,-35,-30}}},
+    {-36,-36,-36,-36,-34,-32,-32,-28,-20,-16,-16,-16,-16,-14,-13,-10, -7},
+    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
   /* 10 */
   {{{-30,-30,-30,-30,-30,-30,-30,-28,-20,-14,-14,-14,-14,-14,-14,-12,-10},
     {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-20},
@@ -269,25 +315,31 @@
 };
 
 /*  noise bias (long block) */
-static noise3 _psy_noisebias_long[12]={
-  /*63     125     250     500      1k       2k      4k      8k     16k*/
-  /* -1 */
+static noise3 _psy_noisebias_long[13]={
+  /*  63     125     250     500      1k       2k      4k      8k     16k*/
+  /* -2(addition mode) */
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  2,  6,  6,  6,  6, 10, 10, 12,  20},
+    {-20,-20,-20,-20,-20,-20,-10, -2,  2,  2,  2,  1,  5,  6,  7,  8,  15},
+    {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
+  /* -1 
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  0,  6,  6,  6,  6, 10, 10, 12,  20},
     {-20,-20,-20,-20,-20,-20,-10, -2,  0,  0,  0,  0,  0,  2,  4,  6,  15},
+    {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},*/
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  0,  6,  6,  6,  6, 10, 10, 12,  20},
+    {-20,-20,-20,-20,-20,-20,-10, -2,  0,  0,  0,  0,  0,  1,  3,  5,  13},
     {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
-
   /* 0 */
   /*  {{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8,  10},
       {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  0,  2,  4,  10},
       {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},*/
-  {{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8,  10},
-    {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  0,  2,  3,  6},
+  {{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8, 10},
+    {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  0,  2,  4,  6},
     {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 1 */
   /*  {{{-10,-10,-10,-10,-10,-10, -8, -4,  0,  2,  4,  4,  5,  5,  5,  8,  10},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  8},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},*/
-  {{{-10,-10,-10,-10,-10,-10, -8, -4,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+  {{{-10,-10,-10,-10,-10,-10, -8, -4,  0,  2,  4,  4,  5,  5,  5,  8, 10},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2,  0,  1,  4},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},
   /* 2 */
@@ -295,21 +347,21 @@
       {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-10,-10,-10,-10,-10,-10,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
-    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -2, -1,  0,  3},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -2, -2, -1,  1,  3},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
   /* 3 */
   /*  {{{-10,-10,-10,-10,-10,-10,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  6},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-10,-10,-10,-10,-10,-10,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
-    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  2},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  3},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -5}}},
   /* 4 */
   /*  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  5},
       {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2, -1,  1},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  1},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -7}}},
   /* 5 */
   /*  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
@@ -326,16 +378,25 @@
     {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -6, -6, -6, -6, -5, -2,  0},
     {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12,-10}}},
   /* 7 */
+//  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
+//    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-10, -8, -8, -8, -8, -6, -4,  0},
+//    {-26,-26,-26,-26,-26,-26,-26,-22,-20,-19,-19,-19,-19,-18,-17,-16,-12}}},
   {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-10, -8, -8, -8, -8, -6, -4,  0},
+    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-10, -8, -8, -8, -8, -7, -4, -1},
     {-26,-26,-26,-26,-26,-26,-26,-22,-20,-19,-19,-19,-19,-18,-17,-16,-12}}},
   /* 8 */
+//  {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  0,  0,  0,  0,  1,  2,  3,  7},
+//    {-26,-26,-26,-26,-26,-26,-26,-20,-16,-12,-10,-10,-10,-10, -8, -6, -2},
+//    {-28,-28,-28,-28,-28,-28,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
   {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  0,  0,  0,  0,  1,  2,  3,  7},
-    {-26,-26,-26,-26,-26,-26,-26,-20,-16,-12,-10,-10,-10,-10, -8, -6, -2},
+    {-26,-26,-26,-26,-26,-26,-26,-20,-16,-12,-10,-10,-10,-10, -9, -6, -3},
     {-28,-28,-28,-28,-28,-28,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
   /* 9 */
+//  {{{-22,-22,-22,-22,-22,-22,-22,-18,-14, -8, -4, -4, -4, -4, -4, -2,  2},
+//    {-26,-26,-26,-26,-26,-26,-26,-22,-18,-16,-16,-16,-16,-14,-12,-10, -7},
+//    {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
   {{{-22,-22,-22,-22,-22,-22,-22,-18,-14, -8, -4, -4, -4, -4, -4, -2,  2},
-    {-26,-26,-26,-26,-26,-26,-26,-22,-18,-16,-16,-16,-16,-14,-12,-10, -7},
+    {-26,-26,-26,-26,-26,-26,-26,-22,-18,-16,-16,-16,-16,-14,-13,-10, -7},
     {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
   /* 10 */
   {{{-24,-24,-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-14,-14,-14,-12,-10},
@@ -344,19 +405,25 @@
 };
 
 /* noise bias (impulse block) */
-static noise3 _psy_noisebias_impulse[12]={
+static noise3 _psy_noisebias_impulse[13]={
   /*  63     125     250     500      1k      2k      4k      8k     16k*/
-  /* -1 */
+  /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-26,-26,-26,-26,-22,-16,-12, -4, -2,  0,  0,  1,  6,  7,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
+  /* -1 
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-30,-30,-30,-30,-26,-20,-16, -8, -6, -4, -2,  0,  2,  3,  6,  6, 14},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
-
-  /* 0 */
-  /*  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  4,  8,  8,  8, 10, 12, 14, 20},
-      {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  4,  10},
-      {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
+  /* 0 
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  4,  8,  8,  8, 10, 12, 14, 20},
-    {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  3,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  4, 10},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  4,  8,  8,  8, 10, 12, 14, 20},
+    {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  4,  6},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 1 */
   {{{-12,-12,-12,-12,-12, -8, -6, -4,  0,  4,  4,  4,  4, 10, 12, 14, 20},
@@ -375,37 +442,43 @@
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2,  0},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}},
   /* 5 */
+//  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
+//    {-32,-32,-32,-32,-28,-24,-22,-16,-10, -6, -8, -8, -6, -6, -6, -4, -2},
+//    {-34,-34,-34,-34,-30,-26,-24,-18,-14,-12,-12,-12,-12,-12,-10, -9, -5}}},
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
-    {-32,-32,-32,-32,-28,-24,-22,-16,-10, -6, -8, -8, -6, -6, -6, -4, -2},
+    {-32,-32,-32,-32,-28,-24,-22,-16,-10, -6, -8, -8, -6, -6, -5, -5, -2},
     {-34,-34,-34,-34,-30,-26,-24,-18,-14,-12,-12,-12,-12,-12,-10, -9, -5}}},
   /* 6 
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
-      {-34,-34,-34,-34,-30,-30,-24,-20,-12,-12,-14,-14,-10, -9, -8, -6, -4},
-      {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},*/
+    {-34,-34,-34,-34,-30,-30,-24,-20,-12,-12,-14,-14,-10, -9, -8, -6, -4},
+    {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},*/
+//  {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
+//    {-34,-34,-34,-34,-30,-30,-30,-24,-16,-16,-16,-16,-16,-16,-14,-14,-12},
+//    {-36,-36,-36,-36,-36,-34,-28,-24,-20,-20,-20,-20,-20,-20,-20,-18,-16}}},
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
-    {-34,-34,-34,-34,-30,-30,-30,-24,-16,-16,-16,-16,-16,-16,-14,-14,-12},
-    {-36,-36,-36,-36,-36,-34,-28,-24,-20,-20,-20,-20,-20,-20,-20,-18,-16}}},
+    {-34,-34,-34,-34,-30,-30,-24,-20,-12,-12,-14,-14,-10, -9, -8, -8, -4},
+    {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},
   /* 7 */
-  /*  {{{-22,-22,-22,-22,-22,-20,-14,-10, -6,  0,  0,  0,  0,  4,  4,  6, 11},
-      {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10,-10},
-      {-34,-34,-34,-34,-32,-32,-30,-24,-20,-19,-19,-19,-19,-19,-17,-16,-12}}},*/
   {{{-22,-22,-22,-22,-22,-20,-14,-10, -6,  0,  0,  0,  0,  4,  4,  6, 11},
-    {-34,-34,-34,-34,-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-24,-22},
-    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}},
+    {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10,-10},
+    {-34,-34,-34,-34,-32,-32,-30,-24,-20,-19,-19,-19,-19,-19,-17,-16,-12}}},
+//  {{{-22,-22,-22,-22,-22,-20,-14,-10, -6,  0,  0,  0,  0,  4,  4,  6, 11},
+//    {-34,-34,-34,-34,-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-24,-22},
+//    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}},
   /* 8 */
-  /*  {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1,  3,  3,  5, 10},
-      {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
-      {-36,-36,-36,-36,-36,-34,-28,-24,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},*/
   {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1,  3,  3,  5, 10},
-    {-34,-34,-34,-34,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-24},
-    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}},
+    {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14},
+    {-36,-36,-36,-36,-36,-34,-28,-24,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
+//  {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1,  3,  3,  5, 10},
+//    {-34,-34,-34,-34,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-24},
+//    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}},
   /* 9 */
-  /*  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
-      {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-22,-20,-20,-18},
-      {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},*/
   {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
-    {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26},
+    {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-22,-20,-20,-18},
     {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
+//  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
+//    {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26},
+//    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
   /* 10 */
   {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-16,-16,-16,-16,-16,-14,-12},
     {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-26},
@@ -413,14 +486,19 @@
 };
 
 /* noise bias (padding block) */
-static noise3 _psy_noisebias_padding[12]={
+static noise3 _psy_noisebias_padding[13]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
-  
-  /* -1 */
+  /* -2(addition mode) */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-26,-26,-26,-26,-22,-16,-12, -4, -2, -1,  0,  2,  7,  8,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
+  /* -1 
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
-    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
-
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/
+  {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
+    {-30,-30,-30,-30,-26,-20,-16, -8, -6, -4, -2,  2,  4,  6,  8,  8, 15},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -4, -4, -4, -4, -4, -2,  0,  2}}},
   /* 0 */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  2,  3,  6,  6,  8, 10},
@@ -430,11 +508,8 @@
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -6, -4, -2,  0}}},
   /* 2 */
-  /*  {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  8, 10, 10, 16},
-      {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
-      {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},*/
   {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  8, 10, 10, 16},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1,  0,  0,  2,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4,  0,  0,  0,  2,  2,  4,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},
   /* 3 */
   {{{-14,-14,-14,-14,-14,-10, -8, -6, -2,  2,  2,  2,  2,  6,  8,  8, 14},
@@ -478,14 +553,17 @@
   {10,10,100},
 };
 
-static int _psy_tone_suppress[12]={
-  -20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
+static int _psy_tone_suppress[13]={
+//  -20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
+  -20,-20,-20,-20,-20,-20,-24,-30,-40,-40,-42,-45,-45,
 };
-static int _psy_tone_0dB[12]={
-  90,90,95,95,95,95,105,105,105,105,105,105,
+static int _psy_tone_0dB[13]={
+//  90,90,95,95,95,95,105,105,105,105,105,105,
+   90,90,90,95,95,95,95,105,105,105,105,105,105,
 };
-static int _psy_noise_suppress[12]={
-  -20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
+static int _psy_noise_suppress[13]={
+//  -20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
+  -20,-20,-20,-24,-24,-24,-24,-30,-40,-40,-42,-45,-45,
 };
 
 static vorbis_info_psy _psy_info_template={
@@ -506,11 +584,13 @@
 
 /* ath ****************/
 
-static int _psy_ath_floater[12]={
-  -100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
+static int _psy_ath_floater[13]={
+//  -100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
+  -100,-100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
 };
-static int _psy_ath_abs[12]={
-  -130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
+static int _psy_ath_abs[13]={
+//  -130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
+  -130,-130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
 };
 
 /* stereo setup.  These don't map directly to quality level, there's
@@ -522,14 +602,22 @@
 /* various stereo possibilities */
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_44[12]={
+static adj_stereo _psy_stereo_modes_44[13]={
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         -2(addition mode)  */
+  {{  4,  4,  4,  4,  4,  4,  4,  4,  3,  2,  1,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  5,  4,  3},
+   {  1,  2,  2,  2,  2,  3,  3,  4,  4,  4,  5,  6,  7,  8,  8},
+   { 10,10.5, 11,11.5, 12,12.5, 13, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         -1  */
-  {{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
+/*{{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
    {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  5,  4,  3},
    {  1,  2,  3,  4,  4,  4,  4,  4,  4,  5,  6,  7,  8,  8,  8},
+   { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},*/
+  {{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  8,  7,  7,  6,  6,  6,  6,  6,  5,  4,  3},
+   {  1,  2,  3,  4,  4,  4,  4,  4,  4,  5,  6,  7,  8,  8,  8},
    { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},
-
-/*    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         0  */
+ /*   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         0  */
 /*{{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
    {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  5,  4,  3},
    {  1,  2,  3,  4,  5,  5,  6,  6,  6,  6,  6,  7,  8,  8,  8},
@@ -538,20 +626,20 @@
    {  8,  8,  8,  8,  6,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3},
    {  1,  2,  3,  4,  4,  5,  6,  6,  6,  6,  6,  8,  8,  8,  8},
    { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},
-
-
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         1  */
-  {{  3,  3,  3,  3,  3,  3,  3,  3,  2,  1,  0,  0,  0,  0,  0},
+/*{{  3,  3,  3,  3,  3,  3,  3,  3,  2,  1,  0,  0,  0,  0,  0},
    {  8,  8,  8,  8,  6,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3},
    {  1,  2,  3,  4,  4,  5,  6,  6,  6,  6,  6,  8,  8,  8,  8},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
+  {{  3,  3,  3,  3,  3,  3,  3,  3,  2,  1,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  6,  6,  5,  4,  4,  4,  4,  4,  4,  3,  3},
+   {  1,  2,  3,  4,  4,  5,  6,  6,  6,  6,  6,  8,  8,  8,  8},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-
-
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         2  */
-  /*  {{  3,  3,  3,  3,  3,  3,  2,  2,  2,  1,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3,  2,  1},
-      {  3,  4,  4,  4,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
+/*{{  3,  3,  3,  3,  3,  3,  2,  2,  2,  1,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3,  2,  1},
+   {  3,  4,  4,  4,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
   {{  3,  3,  3,  3,  3,  3,  3,  2,  1,  1,  0,  0,  0,  0,  0},
    {  8,  8,  6,  6,  5,  5,  4,  4,  4,  4,  4,  4,  3,  2,  1},
    {  3,  4,  4,  5,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
@@ -567,37 +655,37 @@
    {  6,  6,  6,  8,  8,  8,  8,  8,  8,  8, 10, 10, 10, 10, 10},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         5  */
-  /*  {{  2,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0},
-      {  6,  6,  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
+/*{{  2,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0},
+   {  6,  6,  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  2,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0},
    {  6,  7,  8,  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
-  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         6  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
+/*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         6  */
+/*{{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  3,  3,  3,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8,  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         7  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
+/*{{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  3,  3,  3,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         8  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
+/*{{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
+   {  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
@@ -615,14 +703,17 @@
 };
 
 /* tone master attenuation by base quality mode and bitrate tweak */
-static att3 _psy_tone_masteratt_44[12]={
+static att3 _psy_tone_masteratt_44[13]={
+  {{ 36,  22,  10},  0,    0}, /* -2 */
   {{ 35,  21,   9},  0,    0}, /* -1 */
-  {{ 30,  20,   8}, -2, 1.25}, /* 0 */
+//  {{ 30,  20,   8}, -2, 1.25}, /* 0 */
+  {{ 30,  20,   8},  -1,    0}, /* 0 */
   /*  {{ 25,  14,   4},  0,    0}, *//* 1 */
   {{ 25,  12,   2},  0,    0}, /* 1 */
-  /*  {{ 20,  10,  -2},  0,    0}, *//* 2 */
-  {{ 20,   9,  -3},  0,    0}, /* 2 */
-  {{ 20,   9,  -4},  0,    0}, /* 3 */
+//  {{ 20,  10,  -2},  0,    0}, /* 2 */
+  {{ 22,  11,   0},  0,    0}, /* 2 */
+//  {{ 20,   9,  -4},  0,    0}, /* 3 */
+  {{ 21,  11,  -2},  0,    0}, /* 3 */
   {{ 20,   9,  -4},  0,    0}, /* 4 */
   {{ 20,   6,  -6},  0,    0}, /* 5 */
   {{ 20,   3, -10},  0,    0}, /* 6 */
@@ -633,34 +724,48 @@
 };
 
 /* lowpass by mode **************/
-static double _psy_lowpass_44[12]={
+static double _psy_lowpass_44[13]={
   /*  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */
-  13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
+//  13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
+  13.1,14.8,15.1,15.8,16.5,17.2,18.6,20.1,48.,999.,999.,999.,999.
 };
 
 /* noise normalization **********/
 
-static int _noise_start_short_44[11]={
+static int _noise_start_short_44[12]={
   /*  16,16,16,16,32,32,9999,9999,9999,9999 */
-  32,16,16,16,32,9999,9999,9999,9999,9999,9999
+//  32,16,16,16,32,9999,9999,9999,9999,9999,9999
+  32,32,16,16,32,64,9999,9999,9999,9999,9999,9999
 };
-static int _noise_start_long_44[11]={
+static int _noise_start_long_44[12]={
   /*  128,128,128,256,512,512,9999,9999,9999,9999 */
-  256,128,128,256,512,9999,9999,9999,9999,9999,9999
+//  256,128,128,256,512,9999,9999,9999,9999,9999,9999
+  256,256,128,128,256,512,9999,9999,9999,9999,9999,9999
 };
 
-static int _noise_part_short_44[11]={
-    8,8,8,8,8,8,8,8,8,8,8
+static int _noise_part_short_44[12]={
+//    8,8,8,8,8,8,8,8,8,8,8
+    8,8,8,8,8,8,8,8,8,8,8,8
 };
-static int _noise_part_long_44[11]={
-    32,32,32,32,32,32,32,32,32,32,32
+static int _noise_part_long_44[12]={
+//    32,32,32,32,32,32,32,32,32,32,32
+    32,32,32,32,32,32,32,32,32,32,32,32
 };
 
-static double _noise_thresh_44[11]={
+static double _noise_thresh_44[12]={
   /*  .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */
-   .2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
+//   .2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
+   .2,.2,.2,.2,.4,.8,9999.,9999.,9999.,9999.,9999.,9999.,
 };
 
 static double _noise_thresh_5only[2]={
  .5,.5,
 };
+
+/* 32kHz only */
+static int _noise_start_short_32[12]={
+  40,40,16,16,40,80,9999,9999,9999,9999,9999,9999
+};
+static int _noise_start_long_32[12]={
+  320,320,128,128,320,640,9999,9999,9999,9999,9999,9999
+};

Modified: branches/vorbis-aotuv/lib/modes/psych_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_8.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/psych_8.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,27 +11,33 @@
  ********************************************************************
 
  function: 8kHz psychoacoustic settings 
- last mod: $Id: psych_8.h,v 1.3 2003/09/02 06:05:47 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
-static att3 _psy_tone_masteratt_8[3]={
-  {{ 32,  25,  12},  0,   0},  /* 0 */
-  {{ 30,  25,  12},  0,   0},  /* 0 */
-  {{ 20,   0, -14},  0,   0}, /* 0 */
+static att3 _psy_tone_masteratt_8[4]={
+  {{ 32,  25,  12},  0,   0},  /* -2 */
+  {{ 32,  25,  12},  0,   0},  /* -1 */
+  {{ 30,  25,  12},  0,   0},  /*  0 */
+  {{ 20,   0, -14},  0,   0},  /* 10 */
 };
 
-static vp_adjblock _vp_tonemask_adj_8[3]={
+static vp_adjblock _vp_tonemask_adj_8[4]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
-  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
-  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
-  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 1 */
+  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 5, 5,99,99,99}}, /* -2 */
+  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* -1 */
+  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /*  0 */
+  {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 10 */
 };
 
 
-static noise3 _psy_noisebias_8[3]={
+static noise3 _psy_noisebias_8[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
+  {{{-10,-10,-10,-10, -5, -5, -5,  2,  4,  8,  8,  8, 10, 10, 99, 99, 99},
+    {-10,-10,-10,-10, -5, -4, -4,  2,  3,  4,  4,  4,  7,  8, 99, 99, 99},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
+
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4,  8,  8,  8, 10, 10, 99, 99, 99},
     {-10,-10,-10,-10, -5, -5, -5,  0,  0,  4,  4,  4,  4,  4, 99, 99, 99},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}},
@@ -46,7 +52,7 @@
 };
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_8[3]={
+static adj_stereo _psy_stereo_modes_8[4]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
   {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
@@ -56,21 +62,33 @@
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
    {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
+  {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
+   {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
+   {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},
+   { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   {{  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
    {  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
 };
 
-static noiseguard _psy_noiseguards_8[2]={
+static noiseguard _psy_noiseguards_8[3]={
   {10,10,-1},
   {10,10,-1},
+  {10,10,-1},
 };
 
-static compandblock _psy_compand_8[2]={
+static compandblock _psy_compand_8[3]={
   {{
      0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
      8, 8, 9, 9,10,10,11, 11,     /* 15dB */
+    12,12,13,13,14,14,15, 16,     /* 23dB */
+    17,18,19,20,21,22,23, 24,     /* 31dB */
+    25,26,27,28,29,30,31, 32,     /* 39dB */
+  }},
+  {{
+     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
+     8, 8, 9, 9,10,10,11, 11,     /* 15dB */
     12,12,13,13,14,14,15, 15,     /* 23dB */
     16,16,17,17,17,18,18, 19,     /* 31dB */
     19,19,20,21,22,23,24, 25,     /* 39dB */
@@ -84,19 +102,19 @@
   }},
 };
 
-static double _psy_lowpass_8[3]={3.,4.,4.};
-static int _noise_start_8[2]={
-  64,64,
+static double _psy_lowpass_8[4]={2.6,3.,4.,4.};
+static int _noise_start_8[3]={
+  64,64,64,
 };
-static int _noise_part_8[2]={
-  8,8,
+static int _noise_part_8[3]={
+  8,8,8,
 };
 
-static int _psy_ath_floater_8[3]={
-  -100,-100,-105,
+static int _psy_ath_floater_8[4]={
+  -100,-100,-100,-105,
 };
 
-static int _psy_ath_abs_8[3]={
-  -130,-130,-140,
+static int _psy_ath_abs_8[4]={
+  -130,-130,-130,-140,
 };
 

Modified: branches/vorbis-aotuv/lib/modes/residue_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_16.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/residue_16.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates 16/22kHz
- last mod: $Id: residue_16.h,v 1.3 2002/07/11 10:27:55 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -84,7 +84,8 @@
    &_resbook_16s_2,&_resbook_16s_2}
 };
 
-static vorbis_mapping_template _mapres_template_16_stereo[3]={
+static vorbis_mapping_template _mapres_template_16_stereo[4]={
+  { _map_nominal, _res_16s_0 }, /* -1 */
   { _map_nominal, _res_16s_0 }, /* 0 */
   { _map_nominal, _res_16s_1 }, /* 1 */
   { _map_nominal, _res_16s_2 }, /* 2 */
@@ -156,7 +157,8 @@
 };
 
 
-static vorbis_mapping_template _mapres_template_16_uncoupled[3]={
+static vorbis_mapping_template _mapres_template_16_uncoupled[4]={
+  { _map_nominal_u, _res_16u_0 }, /* -1 */
   { _map_nominal_u, _res_16u_0 }, /* 0 */
   { _map_nominal_u, _res_16u_1 }, /* 1 */
   { _map_nominal_u, _res_16u_2 }, /* 2 */

Modified: branches/vorbis-aotuv/lib/modes/residue_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/residue_44.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -278,6 +278,7 @@
 };
 
 static vorbis_mapping_template _mapres_template_44_stereo[]={
+  { _map_nominal, _res_44s_n1 }, /* -2 */
   { _map_nominal, _res_44s_n1 }, /* -1 */
   { _map_nominal, _res_44s_0 }, /* 0 */
   { _map_nominal, _res_44s_1 }, /* 1 */

Modified: branches/vorbis-aotuv/lib/modes/residue_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44u.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/residue_44u.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -304,6 +304,7 @@
 };
 
 static vorbis_mapping_template _mapres_template_44_uncoupled[]={
+  { _map_nominal_u, _res_44u_n1 }, /* -2 */
   { _map_nominal_u, _res_44u_n1 }, /* -1 */
   { _map_nominal_u, _res_44u_0 }, /* 0 */
   { _map_nominal_u, _res_44u_1 }, /* 1 */

Modified: branches/vorbis-aotuv/lib/modes/residue_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_8.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/residue_8.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates 8/11kHz
- last mod: $Id: residue_8.h,v 1.2 2002/07/11 06:41:04 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
@@ -48,7 +48,8 @@
    &_resbook_8s_1,&_resbook_8s_1},
 };
 
-static vorbis_mapping_template _mapres_template_8_stereo[2]={
+static vorbis_mapping_template _mapres_template_8_stereo[3]={
+  { _map_nominal, _res_8s_0 }, /* -1 */
   { _map_nominal, _res_8s_0 }, /* 0 */
   { _map_nominal, _res_8s_1 }, /* 1 */
 };
@@ -91,7 +92,8 @@
    &_resbook_8u_1,&_resbook_8u_1},
 };
 
-static vorbis_mapping_template _mapres_template_8_uncoupled[2]={
+static vorbis_mapping_template _mapres_template_8_uncoupled[3]={
+  { _map_nominal_u, _res_8u_0 }, /* -1 */
   { _map_nominal_u, _res_8u_0 }, /* 0 */
   { _map_nominal_u, _res_8u_1 }, /* 1 */
 };

Modified: branches/vorbis-aotuv/lib/modes/setup_11.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_11.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_11.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -17,28 +17,31 @@
 
 #include "psych_11.h"
 
-static int blocksize_11[2]={
-  512,512
+static int blocksize_11[3]={
+  512,512,512
 };
 
-static int _floor_mapping_11[2]={
-  6,6,
+static int _floor_mapping_11[3]={
+  6,6,6
 };
 
-static double rate_mapping_11[3]={
-  8000.,13000.,44000.,
+static double rate_mapping_11[4]={
+//  8000.,13000.,44000.,
+  8000.,10000.,13000.,44000.,
 };
 
-static double rate_mapping_11_uncoupled[3]={
-  12000.,20000.,50000.,
+static double rate_mapping_11_uncoupled[4]={
+//  12000.,20000.,50000.,
+  14000.,16000.,20000.,50000.,
 };
 
-static double quality_mapping_11[3]={
-  -.1,.0,1.
+static double quality_mapping_11[4]={
+  -.2,-.1,.0,1.
 };
 
 ve_setup_data_template ve_setup_11_stereo={
-  2,
+//  2,
+  3,
   rate_mapping_11,
   quality_mapping_11,
   2,
@@ -89,7 +92,8 @@
 };
 
 ve_setup_data_template ve_setup_11_uncoupled={
-  2,
+//  2,
+  3,
   rate_mapping_11_uncoupled,
   quality_mapping_11,
   -1,

Modified: branches/vorbis-aotuv/lib/modes/setup_16.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_16.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_16.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,43 +11,47 @@
  ********************************************************************
 
  function: 16kHz settings 
- last mod: $Id: setup_16.h,v 1.5 2002/10/11 11:14:42 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
 #include "psych_16.h"
 #include "residue_16.h"
 
-static int blocksize_16_short[3]={
-  1024,512,512
+static int blocksize_16_short[4]={
+  1024,1024,512,512
 };
-static int blocksize_16_long[3]={
-  1024,1024,1024
+static int blocksize_16_long[4]={
+  1024,1024,1024,1024
 };
 
-static int _floor_mapping_16_short[3]={
-  9,3,3
+static int _floor_mapping_16_short[4]={
+  9,9,3,3
 };
-static int _floor_mapping_16[3]={
-  9,9,9
+static int _floor_mapping_16[4]={
+  9,9,9,9
 };
 
-static double rate_mapping_16[4]={
-  12000.,20000.,44000.,86000.
+static double rate_mapping_16[5]={
+//  12000.,20000.,44000.,86000.
+  10000.,12000.,20000.,44000.,86000.
 };
 
-static double rate_mapping_16_uncoupled[4]={
-  16000.,28000.,64000.,100000.
+static double rate_mapping_16_uncoupled[5]={
+//  16000.,28000.,64000.,100000.
+  16000.,18000.,28000.,64000.,100000.
 };
 
-static double _global_mapping_16[4]={ 1., 2., 3., 4. };
+static double _global_mapping_16[5]={ 2., 2., 3., 4., 5. };
 
-static double quality_mapping_16[4]={ -.1,.05,.5,1. };
+static double quality_mapping_16[5]={ -.2,-.1,.05,.5,1. };
 
-static double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
+//static double _psy_compand_16_mapping[5]={ 0., 0., .8, 1., 1.};
+static double _psy_compand_16_mapping[5]={ 0., 1., 1.8, 2., 2.};
 
 ve_setup_data_template ve_setup_16_stereo={
-  3,
+//  3,
+  4,
   rate_mapping_16,
   quality_mapping_16,
   2,
@@ -98,7 +102,8 @@
 };
 
 ve_setup_data_template ve_setup_16_uncoupled={
-  3,
+//  3,
+  4,
   rate_mapping_16_uncoupled,
   quality_mapping_16,
   -1,

Modified: branches/vorbis-aotuv/lib/modes/setup_22.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_22.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_22.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -11,22 +11,25 @@
  ********************************************************************
 
  function: 22kHz settings 
- last mod: $Id: setup_22.h,v 1.3 2002/07/11 10:02:29 xiphmont Exp $
+ last mod: $Id$
 
  ********************************************************************/
 
-static double rate_mapping_22[4]={
-  15000.,20000.,44000.,86000.
+static double rate_mapping_22[5]={
+//  15000.,20000.,44000.,86000.
+  14000.,16000.,20000.,44000.,86000.
 };
 
-static double rate_mapping_22_uncoupled[4]={
-  16000.,28000.,50000.,90000.
+static double rate_mapping_22_uncoupled[5]={
+//  16000.,28000.,50000.,90000.
+  22000.,24000.,28000.,50000.,90000.
 };
 
-static double _psy_lowpass_22[4]={9.5,11.,30.,99.};
+static double _psy_lowpass_22[5]={8.5,9.5,11.,30.,99.};
 
 ve_setup_data_template ve_setup_22_stereo={
-  3,
+//  3,
+  4,
   rate_mapping_22,
   quality_mapping_16,
   2,
@@ -77,7 +80,8 @@
 };
 
 ve_setup_data_template ve_setup_22_uncoupled={
-  3,
+//  3,
+  4,
   rate_mapping_22_uncoupled,
   quality_mapping_16,
   -1,

Modified: branches/vorbis-aotuv/lib/modes/setup_32.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_32.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_32.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -15,22 +15,26 @@
 
  ********************************************************************/
 
-static double rate_mapping_32[12]={
-  18000.,28000.,35000.,45000.,56000.,60000.,
+static double rate_mapping_32[13]={
+//  18000.,28000.,35000.,45000.,56000.,60000.,
+  14000.,20000.,28000.,35000.,45000.,56000.,60000.,
   75000.,90000.,100000.,115000.,150000.,190000.,
 };
 
-static double rate_mapping_32_un[12]={
-  30000.,42000.,52000.,64000.,72000.,78000.,
+static double rate_mapping_32_un[13]={
+//  30000.,42000.,52000.,64000.,72000.,78000.,
+  24000.,32000.,42000.,52000.,64000.,72000.,78000.,
   86000.,92000.,110000.,120000.,140000.,190000.,
 };
 
-static double _psy_lowpass_32[12]={
-  12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
+static double _psy_lowpass_32[13]={
+//  12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
+  11.9,12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
 };
 
 ve_setup_data_template ve_setup_32_stereo={
-  11,
+//  11,
+  12,
   rate_mapping_32,
   quality_mapping_44,
   2,
@@ -59,7 +63,7 @@
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
 
-  {_noise_start_short_44,_noise_start_long_44},
+  {_noise_start_short_32,_noise_start_long_32},
   {_noise_part_short_44,_noise_part_long_44},
   _noise_thresh_44,
 
@@ -81,7 +85,8 @@
 };
 
 ve_setup_data_template ve_setup_32_uncoupled={
-  11,
+//  11,
+  12,
   rate_mapping_32_un,
   quality_mapping_44,
   -1,
@@ -110,7 +115,7 @@
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
 
-  {_noise_start_short_44,_noise_start_long_44},
+  {_noise_start_short_32,_noise_start_long_32},
   {_noise_part_short_44,_noise_part_long_44},
   _noise_thresh_44,
 

Modified: branches/vorbis-aotuv/lib/modes/setup_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_44.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -19,43 +19,47 @@
 #include "modes/residue_44.h"
 #include "modes/psych_44.h"
 
-static double rate_mapping_44_stereo[12]={
-  22500.,32000.,40000.,48000.,56000.,64000.,
+static double rate_mapping_44_stereo[13]={
+//  22500.,32000.,40000.,48000.,56000.,64000.,
+  16000.,24000.,32000.,40000.,48000.,56000.,64000.,
   80000.,96000.,112000.,128000.,160000.,250001.
 };
 
-static double quality_mapping_44[12]={
-  -.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
+static double quality_mapping_44[13]={
+  -.2,-.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
 };
 
-static int blocksize_short_44[11]={
-  512,256,256,256,256,256,256,256,256,256,256
+static int blocksize_short_44[12]={
+  512,512,256,256,256,256,256,256,256,256,256,256
 };
-static int blocksize_long_44[11]={
-  4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
+static int blocksize_long_44[12]={
+  4096,4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
 };
 
-static double _psy_compand_short_mapping[12]={
-  0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
+static double _psy_compand_short_mapping[13]={
+  0., 1., 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
 };
-static double _psy_compand_long_mapping[12]={
-  3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
+static double _psy_compand_long_mapping[13]={
+  3., 4., 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
 };
 
-static double _global_mapping_44[12]={
+static double _global_mapping_44[13]={
   /* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
- 0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
+// 0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
+  0., 1., 2., 2., 2.5, 3., 3., 3.7, 3.9, 4.0, 4.0, 5., 5. // low
+//  0., 1., 2., 2., 2.5, 3., 3.2, 4.0, 4.0, 4.0, 4.5, 5., 5. // high
 };
 
-static int _floor_short_mapping_44[11]={
-  1,0,0,2,2,4,5,5,5,5,5
+static int _floor_short_mapping_44[12]={
+  1,1,0,0,2,2,4,5,5,5,5,5
 };
-static int _floor_long_mapping_44[11]={
-  8,7,7,7,7,7,7,7,7,7,7
+static int _floor_long_mapping_44[12]={
+  8,8,7,7,7,7,7,7,7,7,7,7
 };
 
 ve_setup_data_template ve_setup_44_stereo={
-  11,
+//  11,
+  12,
   rate_mapping_44_stereo,
   quality_mapping_44,
   2,

Modified: branches/vorbis-aotuv/lib/modes/setup_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44u.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_44u.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -17,13 +17,15 @@
 
 #include "modes/residue_44u.h"
 
-static double rate_mapping_44_un[12]={
-  32000.,48000.,60000.,70000.,80000.,86000.,
+static double rate_mapping_44_un[13]={
+//  32000.,48000.,60000.,70000.,80000.,86000.,
+  26000.,32000.,48000.,60000.,70000.,80000.,86000.,
   96000.,110000.,120000.,140000.,160000.,240001.
 };
 
 ve_setup_data_template ve_setup_44_uncoupled={
-  11,
+//  11,
+  12,
   rate_mapping_44_un,
   quality_mapping_44,
   -1,

Modified: branches/vorbis-aotuv/lib/modes/setup_8.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_8.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_8.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -18,32 +18,37 @@
 #include "psych_8.h"
 #include "residue_8.h"
 
-static int blocksize_8[2]={
-  512,512
+static int blocksize_8[3]={
+  512,512,512
 };
 
-static int _floor_mapping_8[2]={
-  6,6,
+static int _floor_mapping_8[3]={
+  6,6,6
 };
 
-static double rate_mapping_8[3]={
-  6000.,9000.,32000.,
+static double rate_mapping_8[4]={
+//  6000.,9000.,32000.,
+  5000.,6000.,9000.,32000.,
 };
 
-static double rate_mapping_8_uncoupled[3]={
-  8000.,14000.,42000.,
+static double rate_mapping_8_uncoupled[4]={
+//  8000.,14000.,42000.,
+  8000.,10000.,14000.,42000.,
 };
 
-static double quality_mapping_8[3]={
-  -.1,.0,1.
+static double quality_mapping_8[4]={
+  -.2,-.1,.0,1.
 };
 
-static double _psy_compand_8_mapping[3]={ 0., 1., 1.};
+//static double _psy_compand_8_mapping[3]={ 0., 1., 1.};
+static double _psy_compand_8_mapping[4]={ 0., 1., 2., 2.};
 
-static double _global_mapping_8[3]={ 1., 2., 3. };
+//static double _global_mapping_8[3]={ 1., 2., 3. };
+static double _global_mapping_8[4]={ 2., 2., 3., 4. };
 
 ve_setup_data_template ve_setup_8_stereo={
-  2,
+//  2,
+  3,
   rate_mapping_8,
   quality_mapping_8,
   2,
@@ -94,7 +99,8 @@
 };
 
 ve_setup_data_template ve_setup_8_uncoupled={
-  2,
+//  2,
+  3,
   rate_mapping_8_uncoupled,
   quality_mapping_8,
   -1,

Modified: branches/vorbis-aotuv/lib/modes/setup_X.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_X.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/modes/setup_X.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -15,13 +15,14 @@
 
  ********************************************************************/
 
-static double rate_mapping_X[12]={
-  -1.,-1.,-1.,-1.,-1.,-1.,
+static double rate_mapping_X[13]={
+  -1.,-1.,-1.,-1.,-1.,-1.,-1.
   -1.,-1.,-1.,-1.,-1.,-1.
 };
 
 ve_setup_data_template ve_setup_X_stereo={
-  11,
+//  11,
+  12,
   rate_mapping_X,
   quality_mapping_44,
   2,
@@ -72,7 +73,8 @@
 };
 
 ve_setup_data_template ve_setup_X_uncoupled={
-  11,
+//  11,
+  12,
   rate_mapping_X,
   quality_mapping_44,
   -1,
@@ -123,7 +125,8 @@
 };
 
 ve_setup_data_template ve_setup_XX_stereo={
-  2,
+//  2,
+  3,
   rate_mapping_X,
   quality_mapping_8,
   2,
@@ -174,7 +177,8 @@
 };
 
 ve_setup_data_template ve_setup_XX_uncoupled={
-  2,
+//  2,
+  3,
   rate_mapping_X,
   quality_mapping_8,
   -1,

Modified: branches/vorbis-aotuv/lib/psy.c
===================================================================
--- branches/vorbis-aotuv/lib/psy.c	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/psy.c	2006-11-05 14:47:59 UTC (rev 12026)
@@ -31,7 +31,22 @@
 
 #define NEGINF -9999.f
 static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
-static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
+static double stereo_threshholds_long[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
+static double stereo_threshholds_trans_post[]={0.0, 0.0, 0.1, 0.1, 0.2, 0.2, 0.3, 0.5, 9e10};
+static double stereo_threshholds_trans_pre[]={0.0, .5, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 9e10};
+static int m3n32[] = {21,13,10,4};
+static int m3n44[] = {15,9,7,3};
+static int m3n48[] = {14,8,6,3};
+static int temp_bfn[128] = {
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,
+12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,
+16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,
+20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,
+24,24,24,24,25,25,25,24,23,22,21,20,19,18,17,16,
+15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
+};
 
 vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
   codec_setup_info *ci=vi->codec_setup;
@@ -284,12 +299,19 @@
   p->n=n;
   p->rate=rate;
 
-  /* AoTuV HF weighting */
-  p->m_val = 1.;
+  /* AoTuV HF weighting etc. */
   if(rate < 26000) p->m_val = 0;
-  else if(rate < 38000) p->m_val = .94;   /* 32kHz */
-  else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
-  
+  else if(rate < 38000){   /* 32kHz */
+  	p->m_val = .94;
+  	for(i=0; i<4; i++) p->m3n[i] = m3n32[i];
+  }else if(rate > 46000){  /* 48kHz */
+  	p->m_val = 1.275;
+  	for(i=0; i<4; i++) p->m3n[i] = m3n48[i];
+  }else{                   /* 44.1kHz */
+  	p->m_val = 1.;
+  	for(i=0; i<4; i++) p->m3n[i] = m3n44[i];
+  }
+
   /* set up the lookups for a given blocksize and sample rate */
 
   for(i=0,j=0;i<MAX_ATH-1;i++){
@@ -854,19 +876,119 @@
 			int offset_select,
 			float *logmask,
 			float *mdct,
-			float *logmdct){
-  int i,n=p->n;
-  float de, coeffi, cx;/* AoTuV */
+			float *logmdct,
+			float *lastmdct, float *tempmdct,
+			int blocktype, int modenumber,
+			int nW_modenumber,
+			int lW_blocktype, int lW_modenumber, int lW_no){
+
+  int i,j,n=p->n;
+  int it_sw, *m3n, nquarter=n/4; /* aoTuV for M3&M4 */
+  double ace=0; /* aoTuV for M4 */
+  float de, coeffi, cx; /* aoTuV for M1 */
+  float noise_rate, noise_rate_low, noise_center, rate_mod; /* aoTuV for M3 */
   float toneatt=p->vi->tone_masteratt[offset_select];
 
   cx = p->m_val;
+  m3n = p->m3n;
   
+  /** @ M3 PRE **/
+  if((n == 128) && !modenumber && !blocktype){
+  	if(!lW_blocktype && !lW_modenumber){ /* last window "short" - type "impulse" */
+  		if(lW_no < 8){
+  			/* impulse - @impulse case1 */
+  			noise_rate = 0.8-(float)(lW_no-1)/17;
+  			noise_center = (float)(lW_no*3);
+  		}else{
+  			/* impulse - @impulse case2 */
+  			noise_rate = 0.4;
+  			noise_center = 25;
+  		}
+  		if(offset_select == 1){
+  			for(i=0; i<128; i++) tempmdct[i] -= 5;
+  		}
+  	}else{ /* non_impulse - @Short(impulse) case */
+  		noise_rate = 0.95;
+  		noise_center = 0;
+  		if(offset_select == 1){
+  			for(i=0; i<128; i++) tempmdct[i] = lastmdct[i] - 5;
+  		}
+  	}
+  	noise_rate_low = noise_rate*0.6;
+  	it_sw = 1;
+  }else{
+  	it_sw = 0;
+  }
+  
+  /** @ M3&M4 PRE **/
+  if(cx < 0.5){
+  	it_sw = 0;     /* for M3 */
+  	nquarter = 0;  /* for M4 */
+  }else{
+    /*  calculation of the correction value of noise masking (longblock).
+        the magic number should change with psych_44.h's "_psy_compand_44" values
+        and setup_44.h's "_psy_compand_long_mapping" value.     for M4  */
+  	if(modenumber && blocktype && (p->vi->noisecompand[12] > 7.8)){
+  		for(i=nquarter; i<n; i++) ace += logmdct[i];
+  		ace = (float)(n/ace*1000+13);
+  		if(ace < 0) ace = 0;
+  		else ace *= ace*((p->vi->noisecompand[12]-7.8)/4.2); /* range of q-1~q2.99... */
+  	}else nquarter = 0;
+  }
+  
   for(i=0;i<n;i++){
     float val= noise[i]+p->noiseoffset[offset_select][i];
+    float tval= tone[i]+toneatt;
     if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
-    logmask[i]=max(val,tone[i]+toneatt);
+    
+    /* AoTuV */
+    /** @ M4 MAIN **
+    When the energy of a high frequency is small, the noise level of a low frequency is lowered. 
+    This is the measure against complaints of a solo musical instrument. 
+    by Aoyumi @ 2004/09/18
+    */
+    if(i < nquarter){
+		if(logmdct[i] > -120) val -= (float)ace;
+	}
+	
+    /* AoTuV */
+    /** @ M3 MAIN **
+    Dynamic impulse block noise control. (#3)
+    48/44.1/32kHz only.
+    by Aoyumi @ 2004/08/30
+    */
+    if(it_sw){
+    	for(j=1; j<=temp_bfn[i]; j++){
+    		float tempbuf = logmdct[i]-(75/temp_bfn[i]*j)-5;
+			if( (tempmdct[i+j] < tempbuf) && (tempmdct[i+j] < (logmdct[i+j]-5)) )
+			 tempmdct[i+j] = logmdct[i+j] - 5;
+		}
+		
+    	if(val > tval){
+    		if( logmdct[i] > (tempmdct[i]+noise_center) ){
+    			tempmdct[i] = logmdct[i];
+    			if(logmdct[i] < lastmdct[i]) rate_mod = noise_rate;
+    			else rate_mod = noise_rate_low;
+				
+				if(i > m3n[1]){
+						if((val-tval) > 30) val = val - ((val-tval-30)/10+30)*rate_mod;
+						else val = val - (val-tval)*rate_mod;
+				}else if(i > m3n[2]){
+						if((val-tval) > 20) val = val - ((val-tval-20)/10+20)*rate_mod;
+						else val = val - (val-tval)*rate_mod;
+				}else if(i > m3n[3]){
+						if((val-tval) > 10) val = val - ((val-tval-10)/10+10)*rate_mod*0.5;
+						else val = val - (val-tval)*rate_mod*0.5;
+				}else{
+					if((val-tval) > 10) val = val - ((val-tval-10)/10+10)*rate_mod*0.3;
+					else val = val - (val-tval)*rate_mod*0.3;
+				}
+			}
+   		}
+   	}
+   	
+    logmask[i]=max(val,tval);
 
-
     /* AoTuV */
     /** @ M1 **
 	The following codes improve a noise problem.  
@@ -904,6 +1026,24 @@
       
     }
   }
+  
+  /** @ M3 SET lastmdct **/
+  if(offset_select == 1){
+	if(n == 1024){
+		if(!nW_modenumber){
+			for(i=0; i<128; i++){
+				lastmdct[i] = logmdct[i*8];
+				for(j=1; j<8; j++){
+					if(lastmdct[i] > logmdct[i*8+j]){
+						lastmdct[i] = logmdct[i*8+j];
+					}
+				}
+			}
+		}
+	}else if(n == 128){
+		for(i=0; i<128; i++) lastmdct[i] = logmdct[i];
+	}
+  }
 }
 
 float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
@@ -1021,13 +1161,131 @@
   return (f1<f2)-(f1>f2);
 }
 
+/*** optimization of sort (for 8 or 32 element) ***/
+#ifdef OPT_SORT
+#define C(o,a,b)\
+  (fabs(data[o+a])>=fabs(data[o+b]))
+#define O(o,a,b,c,d)\
+  {n[o]=o+a;n[o+1]=o+b;n[o+2]=o+c;n[o+3]=o+d;}
+#define SORT4(o)\
+  if(C(o,2,3))if(C(o,0,1))if(C(o,0,2))if(C(o,1,2))O(o,0,1,2,3)\
+        else if(C(o,1,3))O(o,0,2,1,3)\
+          else O(o,0,2,3,1)\
+      else if(C(o,0,3))if(C(o,1,3))O(o,2,0,1,3)\
+          else O(o,2,0,3,1)\
+        else O(o,2,3,0,1)\
+    else if(C(o,1,2))if(C(o,0,2))O(o,1,0,2,3)\
+        else if(C(o,0,3))O(o,1,2,0,3)\
+          else O(o,1,2,3,0)\
+      else if(C(o,1,3))if(C(o,0,3))O(o,2,1,0,3)\
+          else O(o,2,1,3,0)\
+        else O(o,2,3,1,0)\
+  else if(C(o,0,1))if(C(o,0,3))if(C(o,1,3))O(o,0,1,3,2)\
+        else if(C(o,1,2))O(o,0,3,1,2)\
+          else O(o,0,3,2,1)\
+      else if(C(o,0,2))if(C(o,1,2))O(o,3,0,1,2)\
+          else O(o,3,0,2,1)\
+        else O(o,3,2,0,1)\
+    else if(C(o,1,3))if(C(o,0,3))O(o,1,0,3,2)\
+        else if(C(o,0,2))O(o,1,3,0,2)\
+          else O(o,1,3,2,0)\
+      else if(C(o,1,2))if(C(o,0,2))O(o,3,1,0,2)\
+          else O(o,3,1,2,0)\
+        else O(o,3,2,1,0)
+
+static void sortindex_fix8(int *index,
+                           float *data,
+                           int offset){
+  int i,j,k,n[8];
+  index+=offset;
+  data+=offset;
+  SORT4(0)
+  SORT4(4)
+  j=0;k=4;
+  for(i=0;i<8;i++)
+    index[i]=n[(k>=8)||(j<4)&&C(0,n[j],n[k])?j++:k++]+offset;
+}
+
+static void sortindex_fix32(int *index,
+                            float *data,
+                            int offset){
+  int i,j,k,n[32];
+  for(i=0;i<32;i+=8)
+    sortindex_fix8(index,data,offset+i);
+  index+=offset;
+  for(i=j=0,k=8;i<16;i++)
+    n[i]=index[(k>=16)||(j<8)&&C(0,index[j],index[k])?j++:k++];
+  for(i=j=16,k=24;i<32;i++)
+    n[i]=index[(k>=32)||(j<24)&&C(0,index[j],index[k])?j++:k++];
+  for(i=j=0,k=16;i<32;i++)
+    index[i]=n[(k>=32)||(j<16)&&C(0,n[j],n[k])?j++:k++];
+}
+
+static void sortindex_shellsort(int *index,
+                                float *data,
+                                int offset,
+                                int count){
+  int gap,pos,left,right,i,j;
+  index+=offset;
+  for(i=0;i<count;i++)index[i]=i+offset;
+  gap=1;
+  while (gap<=count)gap=gap*3+1;
+  gap/=3;
+  if(gap>=4)gap/=3;
+  while(gap>0){
+    for(pos=gap;pos<count;pos++){
+      for(left=pos-gap;left>=0;left-=gap){
+        i=index[left];j=index[left+gap];
+        if(!C(0,i,j)){
+          index[left]=j;
+          index[left+gap]=i;
+        }else break;
+      }
+    }
+    gap/=3;
+  }
+}
+
+static void sortindex(int *index,
+                      float *data,
+                      int offset,
+                      int count){
+  if(count==8)sortindex_fix8(index,data,offset);
+  else if(count==32)sortindex_fix32(index,data,offset);
+  else sortindex_shellsort(index,data,offset,count);
+}
+
+#undef C
+#undef O
+#undef SORT4
+
+#endif
+/*** OPT_SORT End ***/
+
+
 int **_vp_quantize_couple_sort(vorbis_block *vb,
 			       vorbis_look_psy *p,
 			       vorbis_info_mapping0 *vi,
 			       float **mags){
 
-
+#ifdef OPT_SORT
   if(p->vi->normal_point_p){
+    int i,j,n=p->n;
+    int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
+    int partition=p->vi->normal_partition;
+    
+    for(i=0;i<vi->coupling_steps;i++){
+      ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
+      
+      for(j=0;j<n;j+=partition){
+      sortindex(ret[i],mags[i],j,partition);
+      }
+    }
+    return(ret);
+  }
+  return(NULL);
+#else
+  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;
@@ -1045,10 +1303,22 @@
     return(ret);
   }
   return(NULL);
+#endif
 }
 
 void _vp_noise_normalize_sort(vorbis_look_psy *p,
 			      float *magnitudes,int *sortedindex){
+#ifdef OPT_SORT
+  int j,n=p->n;
+  vorbis_info_psy *vi=p->vi;
+  int partition=vi->normal_partition;
+  int start=vi->normal_start;
+
+  for(j=start;j<n;j+=partition){
+    if(j+partition>n)partition=n-j;
+    sortindex(sortedindex-start,magnitudes,j,partition);
+  }
+#else
   int i,j,n=p->n;
   vorbis_info_psy *vi=p->vi;
   int partition=vi->normal_partition;
@@ -1063,6 +1333,7 @@
       sortedindex[i+j-start]=work[i]-magnitudes;
     }
   }
+#endif
 }
 
 void _vp_noise_normalize(vorbis_look_psy *p,
@@ -1120,7 +1391,9 @@
 		int   **mag_sort,
 		int   **ifloor,
 		int   *nonzero,
-		int  sliding_lowpass){
+		int  sliding_lowpass,
+		int blocktype, int modenumber,
+		int lW_blocktype, int lW_modenumber){
 
   int i,j,k,n=p->n;
 
@@ -1157,10 +1430,21 @@
       nonzero[vi->coupling_mag[i]]=1; 
       nonzero[vi->coupling_ang[i]]=1; 
 
-       /* The threshold of a stereo is changed with the size of n */
-       if(n > 1000)
-         postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]]; 
- 
+       if(p->m_val > 0.5){
+       	/* The threshold of a stereo is changed in specific conditions. */
+       	if(modenumber){
+       		postpoint=stereo_threshholds_long[g->coupling_postpointamp[blobno]]; 
+       		/* impuse/transition - [transition]
+       			this is needed in order to solve the problem on which some are conspicuous. */
+       		if(!blocktype && modenumber){
+       			if((!lW_blocktype && !lW_modenumber) || (!lW_blocktype && lW_modenumber)){
+        			postpoint=stereo_threshholds_trans_post[g->coupling_postpointamp[blobno]]; 
+        			prepoint=stereo_threshholds_trans_pre[g->coupling_prepointamp[blobno]]; 
+        		}
+        	}
+       	}
+       }
+       
       for(j=0;j<p->n;j+=partition){
 	float acc=0.f;
 
@@ -1176,7 +1460,8 @@
 				       floorM[l],floorA[l],
 				       qM+l,qA+l);
 
-	      if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
+	      //if(rint(qM[l])==0.f)acc+=qM[l]*qM[l]; /* ? */
+	      if( (rint(qM[l])==0.f) && (l>=limit) )acc+=qM[l]*qM[l];
 	    }else{
 	      couple_lossless(rM[l],rA[l],qM+l,qA+l);
 	    }
@@ -1203,22 +1488,27 @@
 /* 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
+   However, this is a temporary patch. (#2 fixed)
+   by Aoyumi @ 2004/10/24
 */
 
 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];
-  int start=p->vi->normal_start;
+  int i,j,n=p->n,start;
+  int p_limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
+  int n_start=p->vi->normal_start;
+  float de=0.1;
   
+  if(p->m_val < 0.5) return;
+  if(p->m_val < 0.999) de *= p->m_val; /* 32kHz */
+  
+  if(p_limit > n_start) start = p_limit;
+  else start = n_start;
+  
   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)));
+    for(j=start; j<n; j++) 
+      mdct[i][j] *= (1.0 - de*((float)(j-start) / (float)(n-start)));
   }
 }

Modified: branches/vorbis-aotuv/lib/psy.h
===================================================================
--- branches/vorbis-aotuv/lib/psy.h	2006-11-05 14:40:48 UTC (rev 12025)
+++ branches/vorbis-aotuv/lib/psy.h	2006-11-05 14:47:59 UTC (rev 12026)
@@ -15,6 +15,8 @@
 
  ********************************************************************/
 
+#define OPT_SORT
+
 #ifndef _V_PSY_H_
 #define _V_PSY_H_
 #include "smallft.h"
@@ -110,6 +112,7 @@
   int   total_octave_lines;  
   long  rate; /* cache it */
 
+  int m3n[4]; /* number for M3 */
   float m_val; /* Masking compensation value */
 
 } vorbis_look_psy;
@@ -144,7 +147,11 @@
 			       int offset_select,
 			       float *logmask,
 			       float *mdct,
-			       float *logmdct);
+			       float *logmdct,
+			       float *lastmdct, float *tempmdct,
+			       int blocktype, int modenumber,
+			       int nW_modenumber,
+			       int lW_blocktype, int lW_modenumber, int lW_no);
 
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
@@ -163,7 +170,9 @@
 		       int   **mag_sort,
 		       int   **ifloor,
 		       int   *nonzero,
-		       int   sliding_lowpass);
+		       int   sliding_lowpass,
+		       int blocktype, int modenumber,
+		       int lW_blocktype, int lW_modenumber);
 
 extern void _vp_noise_normalize(vorbis_look_psy *p,
 				float *in,float *out,int *sortedindex);



More information about the commits mailing list