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

j at svn.xiph.org j at svn.xiph.org
Sun Nov 5 05:45:39 PST 2006


Author: j
Date: 2006-11-05 05:45:29 -0800 (Sun, 05 Nov 2006)
New Revision: 12023

Added:
   branches/vorbis-aotuv/aoTuV_README.txt
   branches/vorbis-aotuv/examples/encoder_example_modified.c
Modified:
   branches/vorbis-aotuv/lib/info.c
   branches/vorbis-aotuv/lib/modes/psych_44.h
   branches/vorbis-aotuv/lib/modes/residue_44.h
   branches/vorbis-aotuv/lib/modes/residue_44u.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_X.h
Log:
- Beta1a
 The problem produced in q0 - q-1 is corrected. 
 Due to the above-mentioned problem, Slightly, q0 - q-2 is readjusted. 

- Beta1
  q1 - q5 are adjusted slightly. 
  q-2 - q0 is readjusted. 
  Arrangement of a source code. 



Added: branches/vorbis-aotuv/aoTuV_README.txt
===================================================================
--- branches/vorbis-aotuv/aoTuV_README.txt	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/aoTuV_README.txt	2006-11-05 13:45:29 UTC (rev 12023)
@@ -0,0 +1,19 @@
+"aoTuV" tunes up libvorbis 1.0.1 uniquely. 
+A license is taken as "BSD-style license" as well as original libvorbis. 
+
+
+# NOTICE #
+
+ On the frequency of 26kHz or more, q-2(nominal 40kbps/44.1-48kHz) can be used. 
+ A part of Nominal bitrate has changed. 
+ In the low bit rate (e.g. q-2), it is easy to clip. 
+
+
+
+aoTuV based on <Xiph.Org libvorbis 1.0.1>
+
+Copyright (c) 2002,2003 Xiph.Org Foundation
+Copyright (c) 2003,2004 Aoyumi
+
+
+AUTHOR : aoyumi <aoyumi at inter7.jp>
\ No newline at end of file

Added: branches/vorbis-aotuv/examples/encoder_example_modified.c
===================================================================
--- branches/vorbis-aotuv/examples/encoder_example_modified.c	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/examples/encoder_example_modified.c	2006-11-05 13:45:29 UTC (rev 12023)
@@ -0,0 +1,326 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+ * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: simple example encoder
+ last mod: $Id: encoder_example.c,v 1.50 2002/07/16 09:26:07 xiphmont Exp $
+
+ ********************************************************************
+  modified by AOYUMI
+   //-   delete
+   //+   add
+   //+~, //~+   add range
+   
+   support only stereo 16bit PCM .WAV file
+ ********************************************************************/
+
+/* takes a stereo 16bit 44.1kHz WAV file from stdin and encodes it into
+   a Vorbis bitstream */
+
+/* Note that this is POSIX, not ANSI, code */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h> //+
+#include <sys/stat.h> //+
+#include <math.h>
+#include <vorbis/vorbisenc.h>
+
+#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+#if defined(__MACOS__) && defined(__MWERKS__)
+#include <console.h>      /* CodeWarrior's Mac "command-line" support */
+#endif
+
+#define READ 1024
+#define DEF_Q 0  /* Default Quality Setting */  //+
+
+signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */
+
+//- int main(){
+  int main(int argc, char *argv[]){ //+
+  ogg_stream_state os; /* take physical pages, weld into a logical
+			  stream of packets */
+  ogg_page         og; /* one Ogg bitstream page.  Vorbis packets are inside */
+  ogg_packet       op; /* one raw packet of data for decode */
+  
+  vorbis_info      vi; /* struct that stores all the static vorbis bitstream
+			  settings */
+  vorbis_comment   vc; /* struct that stores all the user comments */
+
+  vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
+  vorbis_block     vb; /* local working space for packet->PCM decode */
+
+  int eos=0,ret;
+  int i, founddata;
+
+//+~
+  float qnum = DEF_Q;
+  int qx = 1;
+  if(argc < 2){
+	puts("usage: encoder_example -q4 filename.wav");
+	exit(1);
+  }
+  if( !strnicmp(argv[1], "-q", 2) ){
+	if( strlen(argv[1]) > 2 ){
+		qnum = atof(argv[1]+2);
+	}
+	if( !((qnum >= -2) && (qnum <= 10)) ) qnum = DEF_Q;
+	qx++;
+  }
+  FILE *FP;
+  if( !(FP = fopen(argv[qx], "rb")) ){
+	puts("source file not found");
+	exit(1);
+  }
+//~+
+
+#if defined(macintosh) && defined(__MWERKS__)
+  int argc = 0;
+  char **argv = NULL;
+  argc = ccommand(&argv); /* get a "command line" from the Mac user */
+                          /* this also lets the user set stdin and stdout */
+#endif
+
+  /* we cheat on the WAV header; we just bypass 44 bytes and never
+     verify that it matches 16bit/stereo/44.1kHz.  This is just an
+     example, after all. */
+
+#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
+  /* if we were reading/writing a file, it would also need to in
+     binary mode, eg, fopen("file.wav","wb"); */
+  /* Beware the evil ifdef. We avoid these where we can, but this one we 
+     cannot. Don't add any more, you'll probably go to hell if you do. */
+  _setmode( _fileno( stdin ), _O_BINARY );
+  _setmode( _fileno( stdout ), _O_BINARY );
+#endif
+
+
+  /* we cheat on the WAV header; we just bypass the header and never
+     verify that it matches 16bit/stereo/44.1kHz.  This is just an
+     example, after all. */
+
+  DWORD footer = 0; //+
+  DWORD sa_rate = 44100; //+
+  struct stat sbuf; //+
+  stat(argv[qx], &sbuf); //+
+
+  readbuffer[0] = '\0';
+//-  for (i=0, founddata=0; i<30 && ! feof(stdin) && ! ferror(stdin); i++)
+  for (i=0, founddata=0; i<30 && ! feof(FP) && ! ferror(FP); i++) //+
+  {
+//-    fread(readbuffer,1,2,stdin);
+    fread(readbuffer,1,2,FP); //+
+//+~
+    if ( ! memcmp(readbuffer, "fm", 2) ){
+       fread(readbuffer,1,10,FP); //+
+       fread(&sa_rate,1,4,FP); //+
+    }
+//~+
+//-    if ( ! strncmp((char*)readbuffer, "da", 2) )
+    if ( ! memcmp(readbuffer, "da", 2) ) //+
+    {
+      founddata = 1;
+//-      fread(readbuffer,1,6,stdin);
+      fread(readbuffer,1,6,FP); //+
+      memcpy(&footer, readbuffer+2, 4); //+
+      footer += ftell(FP); //+
+      break;
+    }
+  }
+  footer = sbuf.st_size - footer; //+
+  printf("\n%dHz\n", sa_rate); //+
+
+  /********** Encode setup ************/
+
+  vorbis_info_init(&vi);
+
+  /* choose an encoding mode.  A few possibilities commented out, one
+     actually used: */
+
+  /*********************************************************************
+   Encoding using a VBR quality mode.  The usable range is -.1
+   (lowest quality, smallest file) to 1. (highest quality, largest file).
+   Example quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR 
+  
+   ret = vorbis_encode_init_vbr(&vi,2,44100,.4);
+
+   ---------------------------------------------------------------------
+
+   Encoding using an average bitrate mode (ABR).
+   example: 44kHz stereo coupled, average 128kbps VBR 
+  
+   ret = vorbis_encode_init(&vi,2,44100,-1,128000,-1);
+
+   ---------------------------------------------------------------------
+
+   Encode using a qulity mode, but select that quality mode by asking for
+   an approximate bitrate.  This is not ABR, it is true VBR, but selected
+   using the bitrate interface, and then turning bitrate management off:
+
+   ret = ( vorbis_encode_setup_managed(&vi,2,44100,-1,128000,-1) ||
+           vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) ||
+           vorbis_encode_setup_init(&vi));
+
+   *********************************************************************/
+
+//-  ret=vorbis_encode_init_vbr(&vi,2,44100,.4);
+  ret=vorbis_encode_init_vbr(&vi,2,sa_rate, qnum/10); //+
+  /* do not continue if setup failed; this can happen if we ask for a
+     mode that libVorbis does not support (eg, too low a bitrate, etc,
+     will return 'OV_EIMPL') */
+
+//-  if(ret)exit(1);
+//+~
+  if(ret){
+	puts("encode init error");
+	exit(1);
+  }
+  char wfile[1024];
+  strcpy(wfile, argv[qx]);
+  strcat(wfile, ".ogg");
+  FILE *FP2;
+  if( !(FP2 = fopen(wfile, "wb")) ){
+	puts("file open error");
+	exit(1);
+  }
+  
+  printf("Quality %f\n Encoding...", qnum);
+//~+
+  /* add a comment */
+  vorbis_comment_init(&vc);
+  vorbis_comment_add_tag(&vc,"ENCODER","encoder_example.c");
+
+  /* set up the analysis state and auxiliary encoding storage */
+  vorbis_analysis_init(&vd,&vi);
+  vorbis_block_init(&vd,&vb);
+  
+  /* set up our packet->stream encoder */
+  /* pick a random serial number; that way we can more likely build
+     chained streams just by concatenation */
+  srand(time(NULL));
+  ogg_stream_init(&os,rand());
+
+  /* Vorbis streams begin with three headers; the initial header (with
+     most of the codec setup parameters) which is mandated by the Ogg
+     bitstream spec.  The second header holds any comment fields.  The
+     third header holds the bitstream codebook.  We merely need to
+     make the headers, then pass them to libvorbis one at a time;
+     libvorbis handles the additional Ogg bitstream constraints */
+
+  {
+    ogg_packet header;
+    ogg_packet header_comm;
+    ogg_packet header_code;
+
+    vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
+    ogg_stream_packetin(&os,&header); /* automatically placed in its own
+					 page */
+    ogg_stream_packetin(&os,&header_comm);
+    ogg_stream_packetin(&os,&header_code);
+
+	/* This ensures the actual
+	 * audio data will start on a new page, as per spec
+	 */
+	while(!eos){
+		int result=ogg_stream_flush(&os,&og);
+		if(result==0)break;
+//-		fwrite(og.header,1,og.header_len,stdout);
+		fwrite(og.header,1,og.header_len,FP2); //+
+//-		fwrite(og.body,1,og.body_len,stdout);
+		fwrite(og.body,1,og.body_len,FP2); //+
+	}
+
+  }
+
+  while(!eos){
+    long i;
+//-   long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */
+    long bytes=fread(readbuffer,1,READ*4,FP); /* stereo hardwired here */ //+
+    if(bytes < (READ*4)) bytes -= footer; //+
+    if(bytes < 0) bytes = 0; //+
+    if(bytes==0){
+     /* end of file.  this can be done implicitly in the mainline,
+        but it's easier to see here in non-clever fashion.
+        Tell the library we're at end of stream so that it can handle
+        the last frame and mark end of stream in the output properly */
+       vorbis_analysis_wrote(&vd,0);
+
+    }else{
+      /* data to encode */
+
+      /* expose the buffer to submit data */
+      float **buffer=vorbis_analysis_buffer(&vd,READ);
+      
+      /* uninterleave samples */
+      for(i=0;i<bytes/4;i++){
+	buffer[0][i]=((readbuffer[i*4+1]<<8)|
+		      (0x00ff&(int)readbuffer[i*4]))/32768.f;
+	buffer[1][i]=((readbuffer[i*4+3]<<8)|
+		      (0x00ff&(int)readbuffer[i*4+2]))/32768.f;
+      }
+
+      /* tell the library how much we actually submitted */
+      vorbis_analysis_wrote(&vd,i);
+    }
+
+    /* vorbis does some data preanalysis, then divvies up blocks for
+       more involved (potentially parallel) processing.  Get a single
+       block for encoding now */
+    while(vorbis_analysis_blockout(&vd,&vb)==1){
+
+      /* analysis, assume we want to use bitrate management */
+      vorbis_analysis(&vb,NULL);
+      vorbis_bitrate_addblock(&vb);
+
+      while(vorbis_bitrate_flushpacket(&vd,&op)){
+	
+	/* weld the packet into the bitstream */
+	ogg_stream_packetin(&os,&op);
+	
+	/* write out pages (if any) */
+	while(!eos){
+	  int result=ogg_stream_pageout(&os,&og);
+	  if(result==0)break;
+//-	  fwrite(og.header,1,og.header_len,stdout);
+	  fwrite(og.header,1,og.header_len,FP2); //+
+//-	  fwrite(og.body,1,og.body_len,stdout);
+	  fwrite(og.body,1,og.body_len,FP2); //+
+	  
+	  /* this could be set above, but for illustrative purposes, I do
+	     it here (to show that vorbis does know where the stream ends) */
+	  
+	  if(ogg_page_eos(&og))eos=1;
+	}
+      }
+    }
+  }
+
+  /* clean up and exit.  vorbis_info_clear() must be called last */
+  
+  ogg_stream_clear(&os);
+  vorbis_block_clear(&vb);
+  vorbis_dsp_clear(&vd);
+  vorbis_comment_clear(&vc);
+  vorbis_info_clear(&vi);
+  
+  /* ogg_page and ogg_packet structs always point to storage in
+     libvorbis.  They're never freed or manipulated directly */
+  fclose(FP); //+
+  fclose(FP2); //+
+  fprintf(stderr,"Done.\n");
+  return(0);
+}

Modified: branches/vorbis-aotuv/lib/info.c
===================================================================
--- branches/vorbis-aotuv/lib/info.c	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/info.c	2006-11-05 13:45:29 UTC (rev 12023)
@@ -416,7 +416,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiph.Org libVorbis I 20030909";
+  char temp[]="AO; aoTuV b1a (based on Xiph.Org's 1.0.1)";
   int bytes = strlen(temp);
 
   /* preamble */  

Modified: branches/vorbis-aotuv/lib/modes/psych_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/psych_44.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/psych_44.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -69,6 +69,13 @@
      7, 8, 9,10,11,12,13, 14,     /* 23dB */
     15,16,17,17,17,18,18, 19,     /* 31dB */
     19,19,20,21,22,23,24, 25,     /* 39dB */
+/*  alt
+     0,1,2,3,4,5,6,6,
+     6,6,6,7,7,7,7,7,
+     7,8,9,10,11,12,13,14,
+     15,16,17,17,17,18,18,19,
+     19,19,20,21,22,23,24,25,
+*/
   }},
   /* mode A short */
   {{
@@ -77,6 +84,13 @@
     4, 4, 5, 5, 5, 6, 6,  6,     /* 23dB */
     7, 7, 7, 8, 8, 8, 9, 10,     /* 31dB */
     11,12,13,14,15,16,17, 18,     /* 39dB */
+/*  alt
+    0,1,2,3,4,5,5,5,
+    5,5,5,5,6,6,6,6,
+    6,6,6,6,6,6,6,6,
+    7,7,7,8,8,8,9,10,
+    11,12,13,14,15,16,17,18
+*/    
   }},
   /* sub-mode Z long */
   {{
@@ -101,142 +115,286 @@
     4, 4, 5, 5, 5, 6, 6,  6,     /* 23dB */
     7, 7, 7, 8, 8, 8, 9, 10,     /* 31dB */
     11,12,13,14,15,16,17, 18,     /* 39dB */
+/*  alt
+    0,1,2,3,4,5,5,5,
+    6,6,6,6,6,6,6,6,
+    6,6,6,6,6,7,7,7,
+    7,7,7,8,8,8,9,10,
+    11,12,13,14,15,16,17,18,
+*/
   }}
 };
 
 /* tonal masking curve level adjustments *************************/
+
+// low-mode added
+static vp_adjblock _vp_tonemask_adj_longblock_low[3]={
+  /* adjust for mode zero */
+   /* 63     125     250     500       1       2       4       8      16 */
+   {{ -3,-10,-13,-15,-10,-10,-10,-10,-10,-10,-10,  0,  0,  0,  0,  0,  0}}, /* 0(-2) */
+   {{ -3,-10,-13,-15,-12,-12,-11,-11,-11,-11,-11, -1, -1, -1, -1,  0,  0}}, /* 1(-1) */
+   {{ -3,-10,-13,-16,-15,-14,-13,-12,-12,-12,-11, -1, -2, -1, -1, -1,  0}}, /* 2(-0) */
+};
+static vp_adjblock _vp_tonemask_adj_otherblock_low[3]={
+  /* adjust for mode zero */
+   /* 63     125     250     500       1       2       4       8      16 */
+   {{  0, -7,-12,-15,-10,-10, -9, -9, -9, -9, -9,  1,  1,  1,  1,  1,  1}}, /* 0(-2) */
+   {{  0, -7,-12,-15,-11,-11,-10,-10,-10,-10,-10,  0,  0,  0,  0,  0,  0}}, /* 1(-1) */
+   {{  0, -7,-12,-16,-14,-13,-11,-11,-10,-10,-10,  0,  0,  0,  0,  0,  0}}, /* 2(-0) */
+};
+
 static vp_adjblock _vp_tonemask_adj_longblock[11]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
-  {{-15,-15,-15,-15,-10, -8, -4,-2, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 5, 0, 0, 0, 0, 0}}, /* 1 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
-  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
+   /* 63     125     250     500       1       2       4       8      16 */
+//  {{-15,-15,-15,-15,-10, -8, -4,-2, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
+   {{ -3,-10,-14,-16,-15,-14,-13,-12,-12,-12,-11, -1, -2, -1, -1, -1,  0}}, /* 0 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 5, 0, 0, 0, 0, 0}}, /* 1 *
+   {{ -3,-10,-14,-16,-16,-15,-14,-13,-13,-12,-11, -1, -2, -2, -1, -1,  0}}, /* 1 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
+   {{ -3,-10,-14,-16,-16,-16,-15,-14,-14,-13,-12, -2, -2, -2, -1, -1,  0}}, /* 2 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
+   {{ -3,-10,-14,-16,-16,-16,-16,-14,-14,-13,-13,-10, -2, -2, -1, -1,  0}}, /* 3 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
+   {{ -3,-10,-14,-16,-16,-16,-16,-14,-14,-14,-13,-11, -3, -2, -2, -1, -1}}, /* 4 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
+   {{ -3,-10,-14,-16,-16,-16,-16,-15,-14,-14,-14,-12, -3, -2, -2, -1, -1}}, /* 5 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
+   {{ -3,-10,-13,-16,-16,-16,-16,-15,-14,-14,-14,-14, -4, -2, -2, -2, -2}}, /* 6 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
+   {{ -3,-10,-13,-16,-16,-16,-16,-15,-14,-14,-14,-14, -4, -2, -2, -2, -2}}, /* 7 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
+   {{ -3,-10,-13,-16,-16,-16,-16,-15,-14,-14,-14,-14, -4, -2, -2, -2, -2}}, /* 8 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
+   {{ -3,-10,-13,-16,-16,-16,-16,-15,-14,-14,-14,-14, -4, -2, -2, -2, -2}}, /* 9 */
+//  {{-15,-15,-15,-15,-15,-12,-10,-8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
+   {{ -3,-10,-13,-16,-16,-16,-16,-15,-14,-14,-14,-14, -4, -2, -2, -2, -2}}, /* 10 */
+//   {{-3, -10, -13,-16, -16,-16, -16,-15, -14,-14, -14,-14,-4,-2,-2,-3,-2}}, /* 6-10 alt */
 };
 static vp_adjblock _vp_tonemask_adj_otherblock[11]={
   /* adjust for mode zero */
   /* 63     125     250     500       1     2     4     8    16 */
-  {{-20,-20,-20,-20,-14,-12,-10, -8, -4, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 5, 0, 0, 0, 0, 0}}, /* 1 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
-  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
+   /* 63     125     250     500       1       2       4       8      16 */
+//  {{-20,-20,-20,-20,-14,-12,-10, -8, -4, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
+   {{  0, -7,-12,-16,-14,-13,-11,-11,-10,-10,-10,  0,  0,  0,  0,  0,  0}}, /* 0 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 5, 0, 0, 0, 0, 0}}, /* 1 */
+   {{  0, -7,-12,-16,-16,-14,-12,-12,-12,-10,-10,  0,  0,  0,  0,  0,  0}}, /* 1 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */
+   {{  0, -7,-12,-16,-16,-15,-14,-13,-13,-11,-11,  0,  0,  0,  0,  0,  0}}, /* 2 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */
+   {{  0, -7,-12,-16,-16,-16,-15,-14,-14,-12,-12, -2,  0,  0,  0,  0,  0}}, /* 3 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */
+   {{  0, -7,-12,-16,-16,-16,-16,-14,-14,-13,-12, -7, -1,  1,  0,  0,  0}}, /* 4 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */
+   {{  0, -7,-12,-16,-16,-16,-16,-14,-14,-14,-13, -8, -1,  1,  0,  0,  0}}, /* 5 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */
+   {{  0, -7,-12,-16,-16,-16,-16,-15,-14,-14,-13,-10, -1,  1,  0,  0,  0}}, /* 6 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */
+   {{  0, -7,-12,-16,-16,-16,-16,-15,-14,-14,-13,-10, -1,  1,  0,  0,  0}}, /* 7 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */
+   {{  0, -7,-12,-16,-16,-16,-16,-15,-14,-14,-13,-10, -1,  1,  0,  0,  0}}, /* 8 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */
+   {{  0, -7,-12,-16,-16,-16,-16,-15,-14,-14,-13,-10, -1,  1,  0,  0,  0}}, /* 9 */
+//  {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */
+   {{  0, -7,-12,-16,-16,-16,-16,-15,-14,-14,-13,-10, -1,  1,  0,  0,  0}}, /* 10 */
+   //   {{0, -7, -12,-16, -16,-16, -16,-15, -14,-14,-13,-10,-2, 1,0,0,0}}, /* 6-10 alt*/
 };
 
-static noise3 _psy_noisebias_trans_low[2]={
+// noise bias low-bitrate (impulse,padding,trans)
+ // q-2 added
+static noise3 _psy_noisebias_trans_low[3]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* 0 */
+//  {{{-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,  4,  8,  8, 15},
+//    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
+    /* 0(-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, -6, -2,  2,  2,  4,  8,  8, 15},
+    {-30,-30,-28,-28,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  5,  6, 12},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
   /* 1 */
+//  {{{-15,-15,-15,-15,-15,-10, -5,  0,  2,  2,  6,  6,  6,  8, 10, 12, 15},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  0,  0,  0,  2,  4,  10},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},
+    /* 1(-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,  5,  6, 12},
+    {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
+    /* 2(-0) */
   {{{-15,-15,-15,-15,-15,-10, -5,  0,  2,  2,  6,  6,  6,  8, 10, 12, 15},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2,  0,  0,  0,  2,  4,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},
 };
-static noise3 _psy_noisebias_long_low[2]={
+// noise bias low-bitrate (long)
+ // q-2 added
+static noise3 _psy_noisebias_long_low[3]={
     /*63     125     250     500      1k       2k      4k      8k     16k*/
   /* 0 */
+//  {{{-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}}},
+    /* 0(-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,  2,  4,  6,  15},
+    {-20,-20,-20,-20,-20,-20,-10, -2,  0,  1,  1,  1,  1,  3,  6,  8,  12},
     {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
   /* 1 */
+//  {{{-10,-10,-10,-10,-10,-10, -8, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
+//    {-20,-20,-20,-20,-20,-20,-20,-14, -8, -2,  0,  0,  0,  0,  2,  4,  10},
+//    {-20,-20,-20,-20,-20,-20,-20,-14, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
+    /* 1(-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,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
+    /* 2(-0) */
   {{{-10,-10,-10,-10,-10,-10, -8, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-20,-20,-20,-20,-20,-20,-20,-14, -8, -2,  0,  0,  0,  0,  2,  4,  10},
     {-20,-20,-20,-20,-20,-20,-20,-14, -6, -6, -6, -6, -6, -4, -4, -4, -2}}},
 };
 
+
+// noise bias (transition block)
 static noise3 _psy_noisebias_trans[11]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
+  /* 0 (1.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,-10, -4, -2, -2,  0,  0,  2,  4,  10},
+//    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -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,-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, -8, -4,  0,  0,  0,  0,  2,  3,  10},
     {-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,  2,  8},
-    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  1,   3},
+    {-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, -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,  9},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2, -1,  0,  2},
+    {-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, -1,  1,  6},
+    {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  0,  2},
     {-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, -1,  1,  5},
+    {-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},
+//    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
+//    {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
+    {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -3, -1,  0},
     {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
   /* 6 */
+//  {{{-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, -8, -6, -6, -6, -6, -4, -2,  1},
+//    {-34,-34,-34,-34,-30,-26,-24,-18,-17,-15,-15,-15,-15,-13,-13,-12, -8}}},
   {{{-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, -8, -6, -6, -6, -6, -4, -2,  1},
-    {-34,-34,-34,-34,-30,-26,-24,-18,-17,-15,-15,-15,-15,-13,-13,-12, -8}}},
+    {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -5, -2,  0},
+    {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},
   /* 7 */
-  {{{-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}}},
-  /* 8 */
-  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
+//  {{{-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,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},  // q8
     {-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}}},
-  /* 9 */
-  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
+  /* 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}}},
+  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},  // q9
     {-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}}},
+  /* 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}}},
+  {{{-30,-30,-30,-30,-30,-30,-30,-28,-20,-12,-10,-10,-10,-10,-10, -8, -6},
+    {-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}}},
   /* 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},
     {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
 };
 
+// noise bias (long block)
 static noise3 _psy_noisebias_long[11]={
     /*63     125     250     500      1k       2k      4k      8k     16k*/
+  /* 0 (1.0) */
+//  {{{-10,-10,-10,-10,-10,-10, -8,  2,  2,  2,  4,  4,  5,  5,  5,  8,  10},
+//    {-20,-20,-20,-20,-20,-20,-10, -6, -4, -2, -2, -2,  0,  0,  2,  4,  10},
+//    {-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,  4,  10},
+    {-20,-20,-20,-20,-20,-20,-20,-14, -6,  0,  0,  0,  0,  0,  2,  3,  10},
     {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},
+  /* 1 (1.0) */
+//  {{{-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, -8, -8, -8, -8, -8, -6, -6, -6, -4}}},
   /* 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},
-    {-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, -4, -2, -2, -2, -2,  0,  1,  3},
     {-20,-20,-20,-20,-20,-20,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},
   /* 2 */
+//  {{{-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, -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, -2, -2, -2, -2,  0,  2,  6},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2, -1,  0,  2},
     {-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, -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,  3,  3,  4,  4,  7},
+    {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1,  0,  2},
+    {-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, -1,  1,  5},
-    {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
+    {-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},
+//    {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
+//    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
   {{{-15,-15,-15,-15,-15,-15,-15,-10, -4,  1,  1,  1,  2,  3,  3,  4,  7},
-    {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
-    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
+    {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -3, -1,  0},
+    {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -8}}},
   /* 6 */
+//  {{{-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, -8, -6, -6, -6, -6, -4, -2,  1},
+//    {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12, -8}}},
   {{{-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, -8, -6, -6, -6, -6, -4, -2,  1},
-    {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12, -8}}},
+    {-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},
@@ -255,11 +413,15 @@
     {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
 };
 
+// noise bias (impulse block)
 static noise3 _psy_noisebias_impulse[11]={
   /*  63     125     250     500      1k      2k      4k      8k     16k*/
   /* 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}}},
   {{{-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,-26,-22,-20,-14, -6, -2,  0,  0,  0,  0,  2,  3,  10},
     {-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},
@@ -282,28 +444,40 @@
     {-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}}},
   /* 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}}},
+//  {{{-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}}},
+  {{{-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,-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}}},
   /* 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}}},
-  /* 8 */
-  {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1,  3,  3,  5, 10},
+//  {{{-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}}},
+  {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1,  3,  3,  5,  8}, // q8
     {-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}}},
+  /* 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}}},
+  {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  0}, // q9+
+    {-36,-36,-36,-36,-34,-32,-32,-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}}},
   /* 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,-22,-20,-20,-18},
+//    {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},
+  {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-16,-16,-16,-16,-16,-14,-12}, // q10
+    {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-26},
+    {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
   /* 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},
     {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
 };
 
-
+// noise bias (padding block)
 static noise3 _psy_noisebias_padding[11]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* 0 */
@@ -352,6 +526,7 @@
     {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}},
 };
 
+
 static noiseguard _psy_noiseguards_44[4]={
   {3,3,15},
   {3,3,15},
@@ -359,28 +534,43 @@
   {10,10,100},
 };
 
+
 static int _psy_tone_suppress[11]={
   -20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
 };
-
+// low-mode added
+static int _psy_tone_suppress_low[3]={
+  -20,-20,-20
+ };
 static int _psy_tone_0dB[11]={
   90,95,95,95,95,105,105,105,105,105,105,
 };
+// low-mode added
+static int _psy_tone_0dB_low[3]={
+  90,90,90
+};
 
 static int _psy_noise_suppress[11]={
  -20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
 };
+// low-mode added
+static int _psy_noise_suppress_low[3]={
+ -20,-20,-20
+};
 
 static vorbis_info_psy _psy_info_template={
+  // blockflag 
   -1,
+  // ath_adjatt, ath_maxatt
   -140.,-140.,
   /* tonemask att boost/decay,suppr,curves */
   {0.f,0.f,0.f},     0.,0.,    -40.f, {0.},  
   
   /*noisemaskp,supp, low/high window, low/hi guard, minimum */
-  1,          -0.f,         .5f, .5f,         0,0,0,
+  1,          -0.f,           .5f, .5f,         0,0,0,
+  // noiseoffset*3, noisecompand, max_curve_dB
   {{-1},{-1},{-1}},{-1},105.f,
-
+  // noise normalization - channel_p, point_p, start, partition, thresh.
   0,0,-1,-1,0.,
 };
 
@@ -389,7 +579,6 @@
 static int _psy_ath_floater[11]={
   -100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
 };
-
 static int _psy_ath_abs[11]={
   -130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
 };
@@ -403,13 +592,29 @@
 /* various stereo possibilities */
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_44_low[2]={
-  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         0  */
+// q-2 added
+static adj_stereo _psy_stereo_modes_44_low[3]={
+//  /*  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,  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(-2)  */
+  {{  4,  4,  4,  4,  4,  4,  4,  4,  3,  2,  1,  0,  0,  0,  0},
+   {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  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},
+//   {  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},
+//   { 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(-1)  */
   {{  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}},
-  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         1  */
+   { 11,11.5, 12,12.5, 13,13.5, 14, 99, 99, 99, 99, 99, 99, 99, 99}},
+  /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         2(<-1) */
   {{  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},
@@ -443,24 +648,40 @@
    {  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},
+   {  7,  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,  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},
+   {  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},
+   {  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},
+   {  8, 10, 10, 12, 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         9  */
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
@@ -475,10 +696,13 @@
 };
 
 /* tone master attenuation by base quality mode and bitrate tweak */
-
-static att3 _psy_tone_masteratt_44_low[2]={
-  {{ 34,  20,   8},  0, 1.25}, /* 0 */
-  {{ 34,  20,   8}, -2, 1.25}, /* 1 */
+// q-2 added
+static att3 _psy_tone_masteratt_44_low[3]={
+//  {{ 34,  20,   8},  0, 1.25}, /* 0 */
+//  {{ 34,  20,   8}, -2, 1.25}, /* 1 */
+  {{ 35,  21,   9},  0, 1.25}, /* 0 */
+  {{ 34,  20,   8},  0, 1.25}, /* 1 */
+  {{ 34,  20,   8}, -2, 1.25}, /* 2 */
 };
 static att3 _psy_tone_masteratt_44[11]={
   {{ 30,  20,   8}, -2, 1.25}, /* 0 */
@@ -495,38 +719,51 @@
 };
 
 /* lowpass by mode **************/
-static double _psy_lowpass_44_low[2]={
-  15.1,15.1,
+// q-2 added
+static double _psy_lowpass_44_low[3]={
+//  15.1,15.1,
+  13.1, 14.2, 15.1
 };
 static double _psy_lowpass_44[11]={
-  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
+//  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
+  15.1,15.8,16.5,17.1,18.5,20.1,48.,999.,999.,999.,999.
 };
 
 /* noise normalization **********/
 
 static int _noise_start_short_44[10]={
-  16,16,16,16,32,32,9999,9999,9999,9999
+//  16,16,16,16,32,32,9999,9999,9999,9999
+  16,16,16,32,9999,9999,9999,9999,9999,9999
 };
 static int _noise_start_long_44[10]={
-  128,128,128,256,512,512,9999,9999,9999,9999
+//  128,128,128,256,512,512,9999,9999,9999,9999
+  128,128,256,512,9999,9999,9999,9999,9999,9999
 };
+
 static int _noise_part_short_44[10]={
-  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[10]={
-  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[10]={
-  .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999.,
+//  .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999.,
+   .2,.2,.4,.5,9999.,9999.,9999.,9999.,9999.,9999.,
 };
-static double _noise_thresh_44_2[2]={
-  .5,.5,
+// 2 >> 3
+static double _noise_thresh_44_2[3]={
+ .5,.5,.5,
 };
+// low-mode added
+static double _noise_thresh_44_low[3]={
+ .2,.2,.2,
+};
 
-
-static int _noise_start_short_44_low[2]={
-  32,32
+// q-2 added
+static int _noise_start_short_44_low[3]={
+  32,32,32
 };
-static int _noise_start_long_44_low[2]={
-  256,256
+static int _noise_start_long_44_low[3]={
+  256,256,256
 };

Modified: branches/vorbis-aotuv/lib/modes/residue_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/residue_44.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -252,3 +252,9 @@
   { _map_nominal, _res_44s_8 }, /* 8 */
   { _map_nominal, _res_44s_9 }, /* 9 */
 };
+
+// low-mode added
+static vorbis_mapping_template _mapres_template_44_stereo_low[]={
+  { _map_nominal, _res_44s_0 }, /* 0(-2) */
+  { _map_nominal, _res_44s_0 }, /* 1(-1) */
+};

Modified: branches/vorbis-aotuv/lib/modes/residue_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/residue_44u.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/residue_44u.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -294,3 +294,9 @@
   { _map_nominal_u, _res_44u_8 }, /* 8 */
   { _map_nominal_u, _res_44u_9 }, /* 9 */
 };
+
+// low-mode added
+static vorbis_mapping_template _mapres_template_44_uncoupled_low[]={
+  { _map_nominal_u, _res_44u_0 }, /* 0(-2) */
+  { _map_nominal_u, _res_44u_0 }, /* 1(-1) */
+};

Modified: branches/vorbis-aotuv/lib/modes/setup_32.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_32.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/setup_32.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -25,16 +25,19 @@
   86000.,92000.,110000.,120000.,140000.,190000.,
 };
 
-static double rate_mapping_32_low[2]={
-  20000.,28000.
+static double rate_mapping_32_low[3]={
+//  20000.,28000.
+  18000.,22000.,28000.
 };
 
-static double rate_mapping_32_un_low[2]={
-  24000.,42000.,
+static double rate_mapping_32_un_low[3]={
+//  24000.,42000.,
+  30000.,32000.,42000.
 };
 
-static double _psy_lowpass_32_low[2]={
-  13.,13.,
+static double _psy_lowpass_32_low[3]={
+//  13.,13.,
+  12.,12.5,13.
 };
 static double _psy_lowpass_32[11]={
   13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
@@ -143,7 +146,8 @@
 };
 
 ve_setup_data_template ve_setup_32_stereo_low={
-  1,
+//  1,
+  2,
   rate_mapping_32_low,
   quality_mapping_44_stereo_low,
   2,
@@ -154,27 +158,36 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
-  _vp_tonemask_adj_otherblock,
-  _vp_tonemask_adj_longblock,
-  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_longblock,
+//  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock_low,
+  _vp_tonemask_adj_longblock_low,
+  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
-  _noise_thresh_44,
+//  _noise_thresh_44,
+   _noise_thresh_44_low,
 
   _psy_ath_floater,
   _psy_ath_abs,
@@ -190,12 +203,14 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_stereo
+//  _mapres_template_44_stereo
+  _mapres_template_44_stereo_low
 };
 
 
 ve_setup_data_template ve_setup_32_uncoupled_low={
-  1,
+//  1,
+  2,
   rate_mapping_32_un_low,
   quality_mapping_44_stereo_low,
   -1,
@@ -206,23 +221,31 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
-  _vp_tonemask_adj_otherblock,
-  _vp_tonemask_adj_longblock,
-  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_longblock,
+//  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock_low,
+  _vp_tonemask_adj_longblock_low,
+  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
@@ -242,5 +265,6 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_uncoupled
+//  _mapres_template_44_uncoupled
+  _mapres_template_44_uncoupled_low
 };

Modified: branches/vorbis-aotuv/lib/modes/setup_44.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/setup_44.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -19,26 +19,34 @@
 #include "modes/residue_44.h"
 #include "modes/psych_44.h"
 
-static double rate_mapping_44_stereo_low[2]={
-  22500.,32000.
+// nominal bitrate (per ch.)
+ // q-2 , q-1 , q-0
+static double rate_mapping_44_stereo_low[3]={
+//  22500.,32000.
+  20000.,24000.,32000.
 };
-
+ // q0`q10
 static double rate_mapping_44_stereo[11]={
   32000.,40000.,48000.,56000.,64000.,
   80000.,96000.,112000.,128000.,160000.,250001.
 };
-static double quality_mapping_44_stereo_low[2]={
-  -.1,.0,
+
+
+static double quality_mapping_44_stereo_low[3]={
+//  -.1,.0,
+  -.2,-.1,.0,
 };
 static double quality_mapping_44[11]={
   .0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
 };
 
-static int blocksize_short_44_low[1]={
-  512
+
+// q-2 added
+static int blocksize_short_44_low[2]={
+  512,512
 };
-static int blocksize_long_44_low[1]={
-  4096
+static int blocksize_long_44_low[2]={
+  4096,4096
 };
 
 static int blocksize_short_44[10]={
@@ -47,24 +55,41 @@
 static int blocksize_long_44[10]={
   2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
 };
+
+// noise compand level
 static double _psy_compand_short_mapping[11]={
   1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
 };
 static double _psy_compand_long_mapping[11]={
   4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
 };
+// low-mode added
+static double _psy_compand_short_mapping_low[3]={
+  0.5, 1., 1.
+};
+static double _psy_compand_long_mapping_low[3]={
+  3.5, 4., 4.
+};
+
+// precho mapping (_psy_global)
 static double _global_mapping_44[11]={
-  1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4.
+// 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4.
+ 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
 };
-static double _global_mapping_44_low[2]={
-  0., 1.,
+static double _global_mapping_44_low[3]={
+//  0., 1.,
+  0., 0., 1.,
 };
-static int _floor_short_mapping_44_low[1]={
-  1,
+
+// The floor number defined by floor_all.h 
+// q-2 added
+static int _floor_short_mapping_44_low[2]={
+  1,1
 };
-static int _floor_long_mapping_44_low[1]={
-  8
+static int _floor_long_mapping_44_low[2]={
+  8,8
 };
+
 static int _floor_short_mapping_44[10]={
   0,0,2,2,4,5,5,5,5,5
 };
@@ -72,6 +97,7 @@
   7,7,7,7,7,7,7,7,7,7
 };
 
+// definition
 ve_setup_data_template ve_setup_44_stereo={
   10,
   rate_mapping_44_stereo,
@@ -124,7 +150,8 @@
 };
 
 ve_setup_data_template ve_setup_44_stereo_low={
-  1,
+//  1,
+  2,
   rate_mapping_44_stereo_low,
   quality_mapping_44_stereo_low,
   2,
@@ -135,27 +162,36 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
-  _vp_tonemask_adj_otherblock,
-  _vp_tonemask_adj_longblock,
-  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_longblock,
+//  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock_low,
+  _vp_tonemask_adj_longblock_low,
+  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
-  _noise_thresh_44,
+//  _noise_thresh_44,
+   _noise_thresh_44_low,
 
   _psy_ath_floater,
   _psy_ath_abs,
@@ -171,6 +207,7 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_stereo
+//  _mapres_template_44_stereo
+  _mapres_template_44_stereo_low
 };
 

Modified: branches/vorbis-aotuv/lib/modes/setup_44u.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_44u.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/setup_44u.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -22,8 +22,9 @@
   96000.,110000.,120000.,140000.,160000.,240001.
 };
 
-static double rate_mapping_44_un_low[2]={
-  32000.,48000.
+static double rate_mapping_44_un_low[3]={
+//  32000.,48000.
+  32000.,36000.,48000.
 };
 
 ve_setup_data_template ve_setup_44_uncoupled={
@@ -78,7 +79,8 @@
 };
 
 ve_setup_data_template ve_setup_44_uncoupled_low={
-  1,
+//  1,
+  2,
   rate_mapping_44_un_low,
   quality_mapping_44_stereo_low,
   -1,
@@ -89,27 +91,36 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
-  _vp_tonemask_adj_otherblock,
-  _vp_tonemask_adj_longblock,
-  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_longblock,
+//  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock_low,
+  _vp_tonemask_adj_longblock_low,
+  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
-  _noise_thresh_44_2,
+//  _noise_thresh_44,
+   _noise_thresh_44_low,
 
   _psy_ath_floater,
   _psy_ath_abs,
@@ -125,5 +136,6 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_uncoupled
+//  _mapres_template_44_uncoupled
+  _mapres_template_44_uncoupled_low
 };

Modified: branches/vorbis-aotuv/lib/modes/setup_X.h
===================================================================
--- branches/vorbis-aotuv/lib/modes/setup_X.h	2006-11-05 13:41:58 UTC (rev 12022)
+++ branches/vorbis-aotuv/lib/modes/setup_X.h	2006-11-05 13:45:29 UTC (rev 12023)
@@ -123,7 +123,8 @@
 };
 
 ve_setup_data_template ve_setup_X_stereo_low={
-  1,
+//  1,
+  2,
   rate_mapping_X,
   quality_mapping_44_stereo_low,
   2,
@@ -134,27 +135,36 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
   _vp_tonemask_adj_otherblock,
   _vp_tonemask_adj_longblock,
   _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock_low,
+//  _vp_tonemask_adj_longblock_low,
+//  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
-  _noise_thresh_44,
+//  _noise_thresh_44,
+   _noise_thresh_44_low,
 
   _psy_ath_floater,
   _psy_ath_abs,
@@ -163,6 +173,7 @@
 
   _psy_global_44,
   _global_mapping_44,
+// (not _global_mapping_44_low)
   _psy_stereo_modes_44_low,
 
   _floor_books,
@@ -170,12 +181,14 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_stereo
+//  _mapres_template_44_stereo
+  _mapres_template_44_stereo_low
 };
 
 
 ve_setup_data_template ve_setup_X_uncoupled_low={
-  1,
+//  1,
+  2,
   rate_mapping_X,
   quality_mapping_44_stereo_low,
   -1,
@@ -186,23 +199,31 @@
   blocksize_long_44_low,
 
   _psy_tone_masteratt_44_low,
-  _psy_tone_0dB,
-  _psy_tone_suppress,
+//  _psy_tone_0dB,
+  _psy_tone_0dB_low,
+//  _psy_tone_suppress,
+  _psy_tone_suppress_low,
 
-  _vp_tonemask_adj_otherblock,
-  _vp_tonemask_adj_longblock,
-  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_otherblock,
+//  _vp_tonemask_adj_longblock,
+//  _vp_tonemask_adj_otherblock,
+  _vp_tonemask_adj_otherblock_low,
+  _vp_tonemask_adj_longblock_low,
+  _vp_tonemask_adj_otherblock_low,
 
   _psy_noiseguards_44,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_trans_low,
   _psy_noisebias_long_low,
-  _psy_noise_suppress,
+//  _psy_noise_suppress,
+  _psy_noise_suppress_low,
   
   _psy_compand_44,
-  _psy_compand_short_mapping,
-  _psy_compand_long_mapping,
+//  _psy_compand_short_mapping,
+  _psy_compand_short_mapping_low,
+//  _psy_compand_long_mapping,
+  _psy_compand_long_mapping_low,
 
   {_noise_start_short_44_low,_noise_start_long_44_low},
   {_noise_part_short_44,_noise_part_long_44},
@@ -215,6 +236,7 @@
 
   _psy_global_44,
   _global_mapping_44,
+// (not _global_mapping_44_low)
   NULL,
 
   _floor_books,
@@ -222,7 +244,8 @@
   _floor_short_mapping_44_low,
   _floor_long_mapping_44_low,
 
-  _mapres_template_44_uncoupled
+//  _mapres_template_44_uncoupled
+  _mapres_template_44_uncoupled_low
 };
 
 ve_setup_data_template ve_setup_XX_stereo={



More information about the commits mailing list