Index: /mppenc/branches/r2d/Makefile.am
===================================================================
--- /mppenc/branches/r2d/Makefile.am	(revision 70)
+++ /mppenc/branches/r2d/Makefile.am	(revision 71)
@@ -1,5 +1,2 @@
-# not a GNU package. You can remove this line, if
-# have all needed files, that a GNU package needs
-AUTOMAKE_OPTIONS = foreign 1.4
-
-SUBDIRS = src libmpcpsy libmpcenc
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = libmpcpsy libmpcenc src
Index: /mppenc/branches/r2d/Makefile.cvs
===================================================================
--- /mppenc/branches/r2d/Makefile.cvs	(revision 70)
+++ /mppenc/branches/r2d/Makefile.cvs	(revision 71)
@@ -2,7 +2,3 @@
 
 all:
-	aclocal
-	autoheader
-	automake
-	autoconf
-
+	autoreconf -vifs
Index: /mppenc/branches/r2d/configure.in
===================================================================
--- /mppenc/branches/r2d/configure.in	(revision 70)
+++ /mppenc/branches/r2d/configure.in	(revision 71)
@@ -8,3 +8,3 @@
 AM_PROG_LIBTOOL
 
-AC_OUTPUT(Makefile src/Makefile libmpcpsy/Makefile libmpcenc/Makefile)
+AC_OUTPUT(Makefile libmpcenc/Makefile libmpcpsy/Makefile src/Makefile)
Index: /mppenc/branches/r2d/libmpcenc/bitstream.c
===================================================================
--- /mppenc/branches/r2d/libmpcenc/bitstream.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcenc/bitstream.c	(revision 71)
@@ -17,4 +17,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#include <unistd.h>
 
 #include "libmpcenc.h"
@@ -62,5 +64,7 @@
     mpc_size_t           WrittenDwords = 0;
     const mpc_uint32_t*  p             = buffer;
+#if ENDIAN == HAVE_BIG_ENDIAN
     mpc_size_t           CC            = words32bit;
+#endif
 
 #if ENDIAN == HAVE_BIG_ENDIAN
@@ -72,5 +76,7 @@
         WrittenDwords = fwrite ( p, sizeof(*buffer), words32bit, fp );
         if ( WrittenDwords == 0 ) {
-            stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
+			// FIXME : move stderr_printf to common
+//             stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
+			sprintf(stderr, "\b\n WARNING: Disk full?, retry after 10 sec ...\a");
             sleep (10);
         }
Index: /mppenc/branches/r2d/libmpcenc/encode_sv7.c
===================================================================
--- /mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 71)
@@ -19,8 +19,10 @@
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "libmpcenc.h"
 
 void  WriteBits         ( mpc_encoder_t*, const mpc_uint32_t input, const unsigned int bits );
+void       Init_Huffman_Encoder_SV7   ( void );
 
 // huffsv7.c
@@ -93,5 +95,5 @@
 		case 37800: WriteBits ( e, 2, 2 ); break;
 		case 32000: WriteBits ( e, 3, 2 ); break;
-        default   : stderr_printf ( "Internal error\n");
+		default   : sprintf(stderr, "Internal error\n");// FIXME : stderr_printf ( "Internal error\n");
                     exit (1);
     }
Index: /mppenc/branches/r2d/libmpcenc/huffsv7.c
===================================================================
--- /mppenc/branches/r2d/libmpcenc/huffsv7.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcenc/huffsv7.c	(revision 71)
@@ -332,4 +332,10 @@
 #endif
 
+
+// FIXME : remove the functions from tools.c
+void Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, mpc_size_t len );
+void Resort_HuffTable ( Huffman_t* const Table, const mpc_size_t elements, mpc_int_t offset );
+void Make_LookupTable ( mpc_uint8_t* LUT, mpc_size_t LUT_len, const Huffman_t* const Table, const mpc_size_t elements );
+
 #define MAKE(d,s)     Make_HuffTable   ( (d), (s), sizeof(s)/sizeof(*(s)) )
 #define SORT(x,o)     Resort_HuffTable ( (x), sizeof(x)/sizeof(*(x)), -(Int)(o) )
Index: /mppenc/branches/r2d/libmpcenc/libmpcenc.h
===================================================================
--- /mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 70)
+++ /mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 71)
@@ -56,11 +56,11 @@
 // just the same struct as below, dup ?
 typedef struct {
+	mpc_uint16_t	Code;  // >= 14 bit
 	mpc_uint16_t	Length;  // >=  4 bit
-	mpc_uint16_t	Code;  // >= 14 bit
 } HuffSrc_t ;
 
 typedef struct {
+	mpc_uint16_t	Code;        // >= 14 bit
 	mpc_uint16_t	Length;      // >=  4 bit
-	mpc_uint16_t	Code;        // >= 14 bit
 } Huffman_t ;
 
Index: /mppenc/branches/r2d/libmpcenc/tools.c
===================================================================
--- /mppenc/branches/r2d/libmpcenc/tools.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcenc/tools.c	(revision 71)
@@ -40,9 +40,9 @@
 #if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
 
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
+mpc_size_t
+complete_read ( int fd, void* dest, mpc_size_t bytes )
+{
+    mpc_size_t  bytesread = 0;
+    mpc_size_t  ret;
 
     while ( bytes > 0 ) {
@@ -52,5 +52,5 @@
         ret = read ( fd, dest, bytes );
 #endif
-        if ( ret == 0  ||  ret == (size_t)-1 )
+        if ( ret == 0  ||  ret == (mpc_size_t)-1 )
             break;
         dest       = (void*)(((char*)dest) + ret);
@@ -75,5 +75,5 @@
 
 static void
-Change_Endian32 ( mpc_uint32_t* dst, size_t words32bit )
+Change_Endian32 ( mpc_uint32_t* dst, mpc_size_t words32bit )
 {
 
@@ -107,8 +107,8 @@
  */
 
-size_t
-Read_LittleEndians ( FILE* fp, mpc_uint32_t* dst, size_t words32bit )
-{
-    size_t  wordsread;
+mpc_size_t
+Read_LittleEndians ( FILE* fp, mpc_uint32_t* dst, mpc_size_t words32bit )
+{
+    mpc_size_t  wordsread;
     wordsread = READ ( fp, dst, words32bit * sizeof(*dst) ) / sizeof(*dst);
 
@@ -195,7 +195,7 @@
 
 void
-Requantize_MidSideStereo ( Int Stop_Band, const Bool_t* used_MS )
-{
-    Int    Band;  // 0...Stop_Band
+Requantize_MidSideStereo ( mpc_int_t Stop_Band, const mpc_bool_t* used_MS )
+{
+    mpc_int_t    Band;  // 0...Stop_Band
     Uint   k;     // 0...35
     Float  ML;
@@ -412,7 +412,7 @@
 
 void
-Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band )
-{
-    Int    Band;  // Start_Band...Stop_Band
+Requantize_IntensityStereo ( mpc_int_t Start_Band, mpc_int_t Stop_Band )
+{
+    mpc_int_t    Band;  // Start_Band...Stop_Band
     Uint   k;     // 0...35
     Float  ML;
@@ -479,7 +479,7 @@
 
 void
-Resort_HuffTable ( Huffman_t* const Table, const size_t elements, Int offset )
-{
-    size_t  i;
+Resort_HuffTable ( Huffman_t* const Table, const mpc_size_t elements, mpc_int_t offset )
+{
+    mpc_size_t  i;
 
     for ( i = 0; i < elements; i++ ) {
@@ -505,7 +505,7 @@
 
 void
-Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, size_t len )
-{
-    size_t  i;
+Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, mpc_size_t len )
+{
+    mpc_size_t  i;
 
     for ( i = 0; i < len; i++,src++,dst++ ) {
@@ -530,8 +530,8 @@
 
 void
-Make_LookupTable ( mpc_uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
-{
-    size_t    i;
-    size_t    idx  = elements;
+Make_LookupTable ( mpc_uint8_t* LUT, mpc_size_t LUT_len, const Huffman_t* const Table, const mpc_size_t elements )
+{
+    mpc_size_t    i;
+    mpc_size_t    idx  = elements;
     mpc_uint32_t  dval = (mpc_uint32_t)0x80000000L / LUT_len * 2;
     mpc_uint32_t  val  = dval - 1;
Index: /mppenc/branches/r2d/libmpcpsy/ans.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/ans.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/ans.c	(revision 71)
@@ -38,4 +38,8 @@
 static float  Sin_Tab    [16] [MAX_NS_ORDER + 1];
 
+float         ANSspec_L  [MAX_ANS_LINES];
+float         ANSspec_R  [MAX_ANS_LINES];       // L/R-masking thresholds for ANS
+float         ANSspec_M  [MAX_ANS_LINES];
+float         ANSspec_S  [MAX_ANS_LINES];       // M/S-masking thresholds for ANS
 
 void
@@ -284,10 +288,10 @@
     memset ( m->FIR_L,      0, sizeof m->FIR_L      );         // reset FIR
     memset ( m->NS_Order_L, 0, sizeof m->NS_Order_L );         // reset Flags
-	FindOptimalANS ( MaxBand, MSflag, m->ANSspec_L, m->ANSspec_M, m->NS_Order_L, m->SNR_comp_L, m->FIR_L, smr.L, smr.M, m->SCF_Index_L, Transient );
+	FindOptimalANS ( MaxBand, MSflag, ANSspec_L, ANSspec_M, m->NS_Order_L, m->SNR_comp_L, m->FIR_L, smr.L, smr.M, m->SCF_Index_L, Transient );
 
     // for R or S, respectively
 	memset ( m->FIR_R,      0, sizeof m->FIR_R      );         // reset FIR
 	memset ( m->NS_Order_R, 0, sizeof m->NS_Order_R );         // reset Flags
-	FindOptimalANS ( MaxBand, MSflag, m->ANSspec_R, m->ANSspec_S, m->NS_Order_R, m->SNR_comp_R, m->FIR_R, smr.R, smr.S, m->SCF_Index_R, Transient );
+	FindOptimalANS ( MaxBand, MSflag, ANSspec_R, ANSspec_S, m->NS_Order_R, m->SNR_comp_R, m->FIR_R, smr.R, smr.S, m->SCF_Index_R, Transient );
 
     return;
Index: /mppenc/branches/r2d/libmpcpsy/cvd.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/cvd.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/cvd.c	(revision 71)
@@ -23,4 +23,5 @@
 #include <string.h>
 
+void   Cepstrum2048  ( float* cep, const int );
 
 /* C O N S T A N T S */
Index: /mppenc/branches/r2d/libmpcpsy/fft4g.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 71)
@@ -32,5 +32,5 @@
 static __inline void  cft1st       ( const int n, float* a, float* w );                  //
 static __inline void  cftmdl_i386  ( const int n, const int l, float* a, float* w );     // 5648
-static __inline void  cftmdl_3DNow ( const int n, const int l, float* a, float* w );     // 4954
+// static __inline void  cftmdl_3DNow ( const int n, const int l, float* a, float* w );     // 4954
 
 #if 0
Index: /mppenc/branches/r2d/libmpcpsy/fft_routines.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/fft_routines.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/fft_routines.c	(revision 71)
@@ -82,4 +82,7 @@
 static float  Hann_1600 [1600];
 
+void   Generate_FFT_Tables ( const int, int*, float* );
+void   rdft                ( const int, float*, int*, float* );
+
 
 //////////////////////////////
@@ -170,5 +173,4 @@
 }
 
-
 /* F U N C T I O N S */
 // generates FFT lookup-tables
Index: /mppenc/branches/r2d/libmpcpsy/libmpcpsy.h
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/libmpcpsy.h	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/libmpcpsy.h	(revision 71)
@@ -64,30 +64,5 @@
 	unsigned int  MS_Channelmode;
 
-	float         a          [PART_LONG];
-	float         b          [PART_LONG];
-	float         c          [PART_LONG];
-	float         d          [PART_LONG];           // Integrations for tmpMask
-	float         T_L        [PART_LONG];
-	float         T_R        [PART_LONG];           // time-constants for tmpMask
-	float         pre_erg_L[2][PART_SHORT];
-	float         pre_erg_R[2][PART_SHORT];          // Preecho-control short
-	float         PreThr_L   [PART_LONG];
-	float         PreThr_R   [PART_LONG];           // for Pre-Echo-control L/R
-	float         tmp_Mask_L [PART_LONG];
-	float         tmp_Mask_R [PART_LONG];           // for Post-Masking L/R
-	int           Vocal_L    [MAX_CVD_LINE + 4];
-	int           Vocal_R    [MAX_CVD_LINE + 4];    // FFT-Line belongs to harmonic?
-
 	/* V A R I A B L E S */
-	float  MinVal   [PART_LONG];               // contains minimum tonality soffsets
-	float  Loudness [PART_LONG];               // weighting factors for loudness calculation
-	float  SPRD     [PART_LONG] [PART_LONG];   // tabulated spreading function
-	float  O_MAX;
-	float  O_MIN;
-	float  FAC1;
-	float  FAC2;                               // constants for offset calculation
-	float  partLtq  [PART_LONG];               // threshold in quiet (partitions)
-	float  invLtq   [PART_LONG];               // inverse threshold in quiet (partitions, long)
-	float  fftLtq   [512];                     // threshold in quiet (FFT)
 	float  Ltq_offset;                         // Offset for threshold in quiet
 	float  Ltq_max;                            // maximum level for threshold in quiet
@@ -104,8 +79,4 @@
 	float         FIR_L      [32] [MAX_NS_ORDER];
 	float         FIR_R      [32] [MAX_NS_ORDER];   // contains FIR-Filter for NoiseShaping
-	float         ANSspec_L  [MAX_ANS_LINES];
-	float         ANSspec_R  [MAX_ANS_LINES];       // L/R-masking thresholds for ANS
-	float         ANSspec_M  [MAX_ANS_LINES];
-	float         ANSspec_S  [MAX_ANS_LINES];       // M/S-masking thresholds for ANS
 	float         SNR_comp_L [32];
 	float         SNR_comp_R [32];             // SNR-compensation after SCF-combination and ANS-gain
@@ -115,6 +86,6 @@
 
 	// FIXME : remove this :
-	int            SCF_Index_L [32] [3];
-	int            SCF_Index_R [32] [3];              // Scalefactor-index for Bitstream
+	int * SCF_Index_L;
+	int * SCF_Index_R;              // Scalefactor-index for Bitstream
 
 } PsyModel;
Index: /mppenc/branches/r2d/libmpcpsy/psy.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/psy.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/psy.c	(revision 71)
@@ -60,5 +60,5 @@
 #include "minimax.h"
 
-
+// psy_tab.c
 extern const float  iw        [PART_LONG];      // inverse partition-width for long
 extern const float  iw_short  [PART_SHORT];     // inverse partition-width for short
@@ -67,5 +67,23 @@
 extern const int    wh        [PART_LONG];      // w_high for long
 extern const int    wh_short  [PART_SHORT];     // w_high for short
-
+extern float        MinVal   [PART_LONG];       // minimum quality that's adapted to the model, minval for long
+extern float  Loudness [PART_LONG];               // weighting factors for loudness calculation
+extern float  SPRD     [PART_LONG] [PART_LONG];   // tabulated spreading function
+extern float  O_MAX;
+extern float  O_MIN;
+extern float  FAC1;
+extern float  FAC2;                               // constants for offset calculation
+extern float  partLtq  [PART_LONG];               // threshold in quiet (partitions)
+extern float  invLtq   [PART_LONG];               // inverse threshold in quiet (partitions, long)
+extern float  fftLtq   [512];                     // threshold in quiet (FFT)
+
+// ans.c
+extern float         ANSspec_L [MAX_ANS_LINES];
+extern float         ANSspec_R [MAX_ANS_LINES];         // L/R-masking threshold for ANS
+extern float         ANSspec_M [MAX_ANS_LINES];
+extern float         ANSspec_S [MAX_ANS_LINES];         // M/S-masking threshold for ANS
+
+void   Init_Psychoakustiktabellen ( PsyModel* );
+int    CVD2048 ( PsyModel*, const float*, int* );
 
 // Antialiasing for calculation of the subband power
@@ -77,8 +95,22 @@
 /* V A R I A B L E S */
 
+static float         a          [PART_LONG];
+static float         b          [PART_LONG];
+static float         c          [PART_LONG];
+static float         d          [PART_LONG];           // Integrations for tmpMask
 static float  Xsave_L    [3 * 512];
 static float  Xsave_R    [3 * 512];             // FFT-Amplitudes L/R
 static float  Ysave_L    [3 * 512];
 static float  Ysave_R    [3 * 512];             // FFT-Phases L/R
+static float         T_L        [PART_LONG];
+static float         T_R        [PART_LONG];           // time-constants for tmpMask
+static float         pre_erg_L[2][PART_SHORT];
+static float         pre_erg_R[2][PART_SHORT];          // Preecho-control short
+static float         PreThr_L   [PART_LONG];
+static float         PreThr_R   [PART_LONG];           // for Pre-Echo-control L/R
+static float         tmp_Mask_L [PART_LONG];
+static float         tmp_Mask_R [PART_LONG];           // for Post-Masking L/R
+static int           Vocal_L    [MAX_CVD_LINE + 4];
+static int           Vocal_R    [MAX_CVD_LINE + 4];    // FFT-Line belongs to harmonic?
 
 /* F U N C T I O N S */
@@ -102,12 +134,12 @@
 	memset ( Ysave_L,   0, sizeof Ysave_L );
 	memset ( Ysave_R,   0, sizeof Ysave_R );
-	memset ( m->a,         0, sizeof m->a       );
-	memset ( m->b,         0, sizeof m->b       );
-	memset ( m->c,         0, sizeof m->c       );
-	memset ( m->d,         0, sizeof m->d       );
-	memset ( m->T_L,       0, sizeof m->T_L     );
-	memset ( m->T_R,       0, sizeof m->T_R     );
-	memset ( m->Vocal_L,   0, sizeof m->Vocal_L );
-	memset ( m->Vocal_R,   0, sizeof m->Vocal_R );
+	memset ( a,         0, sizeof a       );
+	memset ( b,         0, sizeof b       );
+	memset ( c,         0, sizeof c       );
+	memset ( d,         0, sizeof d       );
+	memset ( T_L,       0, sizeof T_L     );
+	memset ( T_R,       0, sizeof T_R     );
+	memset ( Vocal_L,   0, sizeof Vocal_L );
+	memset ( Vocal_R,   0, sizeof Vocal_R );
 
 	m->SampleFreq = 0.;
@@ -115,14 +147,19 @@
 	m->KBD1 = 2.;
 	m->KBD2 = -1.;
+	m->Ltq_offset = 0;
+	m->Ltq_max = 0;
+	m->EarModelFlag = 0;
 
     // generate FFT lookup-tables with largest FFT-size of 1024
 	Init_FFT (m);
 
+	Init_Psychoakustiktabellen (m);
+
     // setting pre-echo variables to Ltq
 	for ( i = 0; i < PART_LONG; i++ ) {
-		m->pre_erg_L  [0][i/3] = m->pre_erg_R  [0][i/3] =
-				m->pre_erg_L  [1][i/3] = m->pre_erg_R  [1][i/3] =
-				m->tmp_Mask_L [i]   = m->tmp_Mask_R [i]   =
-				m->PreThr_L   [i]   = m->PreThr_R   [i]   = m->partLtq [i];
+		pre_erg_L  [0][i/3] = pre_erg_R  [0][i/3] =
+				pre_erg_L  [1][i/3] = pre_erg_R  [1][i/3] =
+				tmp_Mask_L [i]   = tmp_Mask_R [i]   =
+				PreThr_L   [i]   = PreThr_R   [i]   = partLtq [i];
 	}
 
@@ -496,5 +533,5 @@
 // SPRD describes the spreading function as calculated in psy_tab.c
 static void
-SpreadingSignal ( PsyModel* m, const float* erg, const float* werg, float* res,
+SpreadingSignal ( const float* erg, const float* werg, float* res,
 				  float* wres )
 {
@@ -511,5 +548,5 @@
         start = maxi(k-5, 0);           // minimum affected partition
         stop  = mini(k+7, PART_LONG-1); // maximum affected partition
-        sprd  = m->SPRD[k] + start;         // load vector
+        sprd  = SPRD[k] + start;         // load vector
         e     = *erg;
         ew    = *werg;
@@ -527,5 +564,5 @@
 // output: masking threshold *erg after applying the tonality-offset
 static void
-ApplyTonalityOffset ( PsyModel* m, float* erg0, float* erg1, const float* werg0, const float* werg1 )
+ApplyTonalityOffset ( float* erg0, float* erg1, const float* werg0, const float* werg1 )
 {
     int    n;
@@ -537,14 +574,14 @@
     for ( n = 0; n < PART_LONG; n++ ) {
         quot = *werg0++ / *erg0;
-        if      (quot <= 0.05737540597f) Offset = m->O_MAX;
-        else if (quot <  0.5871011603f ) Offset = m->FAC1 * POW (quot, m->FAC2);
-        else                             Offset = m->O_MIN;
-        *erg0++ *= iw[n] * minf(m->MinVal[n], Offset);
+        if      (quot <= 0.05737540597f) Offset = O_MAX;
+        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
+        else                             Offset = O_MIN;
+        *erg0++ *= iw[n] * minf(MinVal[n], Offset);
 
         quot = *werg1++ / *erg1;
-        if      (quot <= 0.05737540597f) Offset = m->O_MAX;
-        else if (quot <  0.5871011603f ) Offset = m->FAC1 * POW (quot, m->FAC2);
-        else                             Offset = m->O_MIN;
-		*erg1++ *= iw[n] * minf(m->MinVal[n], Offset);
+        if      (quot <= 0.05737540597f) Offset = O_MAX;
+        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
+        else                             Offset = O_MIN;
+		*erg1++ *= iw[n] * minf(MinVal[n], Offset);
     }
 
@@ -558,5 +595,5 @@
 {
     static float  loud   = 0.f;
-	float*        weight = m->Loudness;
+	float*        weight = Loudness;
     float         sum    = 0.f;
     int           n;
@@ -579,5 +616,5 @@
 // output: tracked Integrations *a and *b, time constant *tau
 static void
-CalcTemporalThreshold ( PsyModel* m, float* a, float* b, float* tau, float* frqthr, float* tmpthr )
+CalcTemporalThreshold ( float* a, float* b, float* tau, float* frqthr, float* tmpthr )
 {
     int    n;
@@ -587,6 +624,6 @@
     for ( n = 0; n < PART_LONG; n++ ) {
         // following calculations relative to threshold in quiet
-        frqthr[n] *= m->invLtq[n];
-		tmpthr[n] *= m->invLtq[n];
+        frqthr[n] *= invLtq[n];
+		tmpthr[n] *= invLtq[n];
 
         // new post-masking 'tmp' via time constant tau, if old post-masking  > Ltq (=1)
@@ -601,5 +638,5 @@
 
         // use post-masking of (Re-Normalization)
-		tmpthr[n] = maxf (frqthr[n], tmp) * m->partLtq[n];
+		tmpthr[n] = maxf (frqthr[n], tmp) * partLtq[n];
     }
 
@@ -772,6 +809,5 @@
 // inline, because it's called 4x
 static void
-ApplyLtq ( PsyModel* m,
-		   float*        thr0,
+ApplyLtq ( float*        thr0,
            float*        thr1,
            const float*  partThr0,
@@ -794,5 +830,5 @@
 #else
             // Applies a much more gentle ATH rolloff + 6 dB more dynamic
-            ltq   = sqrt (ms * m->fftLtq [k]);
+            ltq   = sqrt (ms * fftLtq [k]);
             tmp   = sqrt (partThr0 [n]) + ltq;
             *thr0 = tmp * tmp;
@@ -1020,13 +1056,13 @@
     // 'ClearVocalDetection'-Process
     if ( m->CVD_used ) {
-        memset ( m->Vocal_L, 0, sizeof m->Vocal_L );
-        memset ( m->Vocal_R, 0, sizeof m->Vocal_R );
+        memset ( Vocal_L, 0, sizeof Vocal_L );
+        memset ( Vocal_R, 0, sizeof Vocal_R );
 
         // left channel
         PowSpec2048 ( &data->L[0], Xerg );
-        isvoc_L = CVD2048 ( Xerg, m->Vocal_L );
+        isvoc_L = CVD2048 ( m, Xerg, Vocal_L );
         // right channel
         PowSpec2048 ( &data->R[0], Xerg );
-        isvoc_R = CVD2048 ( Xerg, m->Vocal_R );
+        isvoc_R = CVD2048 ( m, Xerg, Vocal_R );
     }
 
@@ -1045,9 +1081,9 @@
     memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
     memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
-    CalcUnpred ( m, MaxLine, erg0, phs0, isvoc_L ? m->Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
+    CalcUnpred ( m, MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
     // right
     memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
     memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
-    CalcUnpred ( m, MaxLine, erg1, phs1, isvoc_R ? m->Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
+    CalcUnpred ( m, MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
 
     // calculation of the weighted acoustic pressures per each partition
@@ -1058,12 +1094,12 @@
     memset ( clow_L    , 0, sizeof clow_L );
     memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
-    SpreadingSignal ( m, Ls_L, cLs_L, sim_Mask_L, clow_L );
+    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
     // right
     memset ( clow_R    , 0, sizeof clow_R );
     memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
-    SpreadingSignal ( m, Ls_R, cLs_R, sim_Mask_R, clow_R );
+    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
 
     // Offset depending on tonality
-    ApplyTonalityOffset ( m, sim_Mask_L, sim_Mask_R, clow_L, clow_R );
+    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
 
     // handling of transient signals
@@ -1074,5 +1110,5 @@
     PowSpec256 ( &data->L[432+SHORTFFT_OFFSET], F_256[3] );
     // calculate short Threshold
-    CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, m->pre_erg_L, TransientL );
+    CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, pre_erg_L, TransientL );
 
     // calculate four short FFTs (right)
@@ -1082,5 +1118,5 @@
     PowSpec256 ( &data->R[432+SHORTFFT_OFFSET], F_256[3] );
     // calculate short Threshold
-    CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_R, m->pre_erg_R, TransientR );
+    CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_R, pre_erg_R, TransientR );
 
     // dynamic adjustment of the threshold in quiet to the loudness of the current sequence
@@ -1090,8 +1126,8 @@
     // utilization of the temporal post-masking
     if ( m->tmpMask_used ) {
-		CalcTemporalThreshold (m, m->a, m->b, m->T_L, sim_Mask_L, m->tmp_Mask_L );
-		CalcTemporalThreshold (m, m->c, m->d, m->T_R, sim_Mask_R, m->tmp_Mask_R );
-		memcpy ( sim_Mask_L, m->tmp_Mask_L, sizeof sim_Mask_L );
-		memcpy ( sim_Mask_R, m->tmp_Mask_R, sizeof sim_Mask_R );
+		CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
+		CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
+		memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
+		memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
     }
 
@@ -1111,8 +1147,8 @@
 
     // Pre-Echo control
-	PreechoControl ( PartThr_L, m->PreThr_L, sim_Mask_L, PartThr_R, m->PreThr_R, sim_Mask_R );
+	PreechoControl ( PartThr_L,PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
 
     // utilization of the threshold in quiet
-    ApplyLtq ( m, Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
+    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
 
     // Consideration of aliasing between the subbands (noise is smeared)
@@ -1140,5 +1176,5 @@
         // calculate masking thresholds for M/S
         CalcMSThreshold ( m, Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
-        ApplyLtq ( m, Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
+        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
 
         // Consideration of aliasing between the subbands (noise is smeared)
@@ -1153,8 +1189,8 @@
 
 	if ( m->NS_Order > 0 ) {       // providing the Noise Shaping thresholds
-		memcpy ( m->ANSspec_L, Thr_L, sizeof m->ANSspec_L );
-		memcpy ( m->ANSspec_R, Thr_R, sizeof m->ANSspec_R );
-		memcpy ( m->ANSspec_M, Thr_M, sizeof m->ANSspec_M );
-		memcpy ( m->ANSspec_S, Thr_S, sizeof m->ANSspec_S );
+		memcpy ( ANSspec_L, Thr_L, sizeof ANSspec_L );
+		memcpy ( ANSspec_R, Thr_R, sizeof ANSspec_R );
+		memcpy ( ANSspec_M, Thr_M, sizeof ANSspec_M );
+		memcpy ( ANSspec_S, Thr_S, sizeof ANSspec_S );
     }
     /***************************************************************************************/
@@ -1178,9 +1214,9 @@
     memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
     memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
-	CalcUnpred ( m, MaxLine, erg0, phs0, isvoc_L ? m->Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
+	CalcUnpred ( m, MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
     // right
     memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
     memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
-	CalcUnpred ( m, MaxLine, erg1, phs1, isvoc_R ? m->Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
+	CalcUnpred ( m, MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
 
     // calculation of the weighted acoustic pressure per each partition
@@ -1191,12 +1227,12 @@
     memset ( clow_L    , 0, sizeof clow_L );
     memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
-    SpreadingSignal ( m, Ls_L, cLs_L, sim_Mask_L, clow_L );
+    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
     // right
     memset ( clow_R    , 0, sizeof clow_R );
     memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
-    SpreadingSignal ( m, Ls_R, cLs_R, sim_Mask_R, clow_R );
+    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
 
     // Offset depending on tonality
-    ApplyTonalityOffset ( m, sim_Mask_L, sim_Mask_R, clow_L, clow_R );
+    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
 
     // Handling of transient signals
@@ -1207,5 +1243,5 @@
     PowSpec256 ( &data->L[1008+SHORTFFT_OFFSET], F_256[3] );
     // calculate short Threshold
-	CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, m->pre_erg_L, TransientL );
+	CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, pre_erg_L, TransientL );
 
     // calculate four short FFTs (right)
@@ -1215,5 +1251,5 @@
     PowSpec256 ( &data->R[1008+SHORTFFT_OFFSET], F_256[3] );
     // calculate short Threshold
-	CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_R, m->pre_erg_R, TransientR );
+	CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_R, pre_erg_R, TransientR );
 
     // dynamic adjustment of threshold in quiet to loudness of the current sequence
@@ -1223,8 +1259,8 @@
     // utilization of temporal post-masking
 	if (m->tmpMask_used) {
-		CalcTemporalThreshold ( m, m->a, m->b, m->T_L, sim_Mask_L, m->tmp_Mask_L );
-		CalcTemporalThreshold ( m, m->c, m->d, m->T_R, sim_Mask_R, m->tmp_Mask_R );
-		memcpy ( sim_Mask_L, m->tmp_Mask_L, sizeof sim_Mask_L );
-		memcpy ( sim_Mask_R, m->tmp_Mask_R, sizeof sim_Mask_R );
+		CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
+		CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
+		memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
+		memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
     }
 
@@ -1244,8 +1280,8 @@
 
     // Pre-Echo control
-	PreechoControl ( PartThr_L, m->PreThr_L, sim_Mask_L, PartThr_R, m->PreThr_R, sim_Mask_R );
+	PreechoControl ( PartThr_L, PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
 
     // utilization of threshold in quiet
-    ApplyLtq ( m, Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
+    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
 
     // Consideration of aliasing between the subbands (noise is smeared)
@@ -1273,5 +1309,5 @@
         // calculate masking thresholds for M/S
         CalcMSThreshold ( m, Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
-        ApplyLtq ( m, Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
+        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
 
         // Consideration of aliasing between the subbands (noise is smeared)
@@ -1289,8 +1325,8 @@
 	if ( m->NS_Order > 0 ) {
         for ( n = 0; n < MAX_ANS_LINES; n++ ) {                 // providing Noise Shaping thresholds
-			m->ANSspec_L [n] = minf ( m->ANSspec_L [n], Thr_L [n] );
-			m->ANSspec_R [n] = minf ( m->ANSspec_R [n], Thr_R [n] );
-			m->ANSspec_M [n] = minf ( m->ANSspec_M [n], Thr_M [n] );
-			m->ANSspec_S [n] = minf ( m->ANSspec_S [n], Thr_S [n] );
+			ANSspec_L [n] = minf ( ANSspec_L [n], Thr_L [n] );
+			ANSspec_R [n] = minf ( ANSspec_R [n], Thr_R [n] );
+			ANSspec_M [n] = minf ( ANSspec_M [n], Thr_M [n] );
+			ANSspec_S [n] = minf ( ANSspec_S [n], Thr_S [n] );
         }
     }
Index: /mppenc/branches/r2d/libmpcpsy/psy_tab.c
===================================================================
--- /mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 70)
+++ /mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 71)
@@ -47,4 +47,14 @@
 const float iw_short [PART_SHORT] = { 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/4, 1.f/6, 1.f/7, 1.f/8, 1.f/11, 1.f/13, 1.f/17, 1.f/25, 1.f/29 };
 
+float  MinVal   [PART_LONG];               // contains minimum tonality soffsets
+float  Loudness [PART_LONG];               // weighting factors for loudness calculation
+float  SPRD     [PART_LONG] [PART_LONG];   // tabulated spreading function
+float  O_MAX;
+float  O_MIN;
+float  FAC1;
+float  FAC2;                               // constants for offset calculation
+float  partLtq  [PART_LONG];               // threshold in quiet (partitions)
+float  invLtq   [PART_LONG];               // inverse threshold in quiet (partitions, long)
+float  fftLtq   [512];                     // threshold in quiet (FFT)
 
 static float
@@ -165,5 +175,5 @@
         tmp       = mind ( tmp, Ltq_max );              // Limit ATH
         tmp      += Ltq_offset - 23;                    // Add chosen Offset
-        m->fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp);     // conversion into power
+        fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp);     // conversion into power
     }
 
@@ -174,6 +184,6 @@
             erg = minf (erg, absLtq[k]);
 
-		m->partLtq[n] = erg;               // threshold in quiet
-		m->invLtq [n] = 1.f / m->partLtq[n];  // Inverse
+		partLtq[n] = erg;               // threshold in quiet
+		invLtq [n] = 1.f / partLtq[n];  // Inverse
     }
 }
@@ -219,5 +229,5 @@
         tmp          = LOG10 (midfreq) - 3.5f;                                  // dB(A)
         tmp          = -10 * tmp * tmp + 3 - midfreq/3000;
-		m->Loudness [n] = POW10 ( 0.1 * tmp );                                     // conversion into power
+		Loudness [n] = POW10 ( 0.1 * tmp );                                     // conversion into power
     }
 }
@@ -286,12 +296,12 @@
     for ( n = 0; n < PART_LONG; n++ ) {
 		tmp        = Bass ( (wl [n] + wh [n]) / 2048. * m->SampleFreq, m->TMN, m->NMT, bass );
-		m->MinVal [n] = POW10 ( -0.1 * tmp );                      // conversion into power
+		MinVal [n] = POW10 ( -0.1 * tmp );                      // conversion into power
     }
 
     // calculation of the constants for "tonality offset"
-	m->O_MAX = POW10 ( -0.1 * m->TMN );
-	m->O_MIN = POW10 ( -0.1 * m->NMT );
-	m->FAC1  = POW10 ( -0.1 * (m->NMT - (m->TMN - m->NMT) * 0.229) ) ;
-	m->FAC2  = (m->TMN - m->NMT) * (0.99011159 * 0.1);
+	O_MAX = POW10 ( -0.1 * m->TMN );
+	O_MIN = POW10 ( -0.1 * m->NMT );
+	FAC1  = POW10 ( -0.1 * (m->NMT - (m->TMN - m->NMT) * 0.229) ) ;
+	FAC2  = (m->TMN - m->NMT) * (0.99011159 * 0.1);
 }
 
@@ -333,5 +343,5 @@
 
             // calculate coefficient
-			m->SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) );  // [Source] [Target]
+			SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) );  // [Source] [Target]
         }
     }
@@ -341,7 +351,7 @@
         float  norm = 0.f;
         for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
-			norm += m->SPRD [j] [i];
+			norm += SPRD [j] [i];
         for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
-			m->SPRD [j] [i] /= norm;
+			SPRD [j] [i] /= norm;
     }
 }
Index: /mppenc/branches/r2d/mppenc.kdevelop
===================================================================
--- /mppenc/branches/r2d/mppenc.kdevelop	(revision 70)
+++ /mppenc/branches/r2d/mppenc.kdevelop	(revision 71)
@@ -3,5 +3,5 @@
   <general>
     <author>Nicolas Botti</author>
-    <email/>
+    <email></email>
     <version>0.1</version>
     <projectmanagement>KDevAutoProject</projectmanagement>
@@ -14,10 +14,10 @@
     <projectdirectory>.</projectdirectory>
     <absoluteprojectpath>false</absoluteprojectpath>
-    <description/>
+    <description></description>
   </general>
   <kdevautoproject>
     <general>
       <activetarget>src/mppenc</activetarget>
-      <useconfiguration>debug</useconfiguration>
+      <useconfiguration>default</useconfiguration>
     </general>
     <run>
@@ -29,5 +29,5 @@
       </runarguments>
       <customdirectory>/</customdirectory>
-      <programargs/>
+      <programargs></programargs>
       <autocompile>true</autocompile>
       <envvars/>
@@ -39,5 +39,15 @@
         <cxxcompiler>kdevgppoptions</cxxcompiler>
         <f77compiler>kdevg77options</f77compiler>
-        <cflags>-O2 -g0 </cflags>
+        <cflags>-O1 -fomit-frame-pointer -pipe -g0</cflags>
+        <envvars/>
+        <configargs/>
+        <topsourcedir/>
+        <cppflags>-DMPP_ENCODER=1 -DTRUE=1 -DFALSE=0</cppflags>
+        <ldflags/>
+        <ccompilerbinary/>
+        <cxxcompilerbinary/>
+        <f77compilerbinary/>
+        <cxxflags/>
+        <f77flags/>
       </optimized>
       <debug>
@@ -47,5 +57,5 @@
         <cxxcompiler>kdevgppoptions</cxxcompiler>
         <f77compiler>kdevg77options</f77compiler>
-        <cflags>-O0 -g3 -Wmissing-prototypes -Wmissing-prototypes</cflags>
+        <cflags>-O0 -Wall -g3</cflags>
         <envvars/>
         <topsourcedir/>
@@ -67,5 +77,5 @@
       <numberofjobs>1</numberofjobs>
       <dontact>false</dontact>
-      <makebin/>
+      <makebin></makebin>
       <prio>0</prio>
     </make>
@@ -174,5 +184,5 @@
     </codecompletion>
     <creategettersetter>
-      <prefixGet/>
+      <prefixGet></prefixGet>
       <prefixSet>set</prefixSet>
       <prefixVariable>m_,_</prefixVariable>
@@ -190,10 +200,10 @@
   <kdevdebugger>
     <general>
-      <programargs>--overwrite ~/seeking_bug.flac</programargs>
-      <gdbpath/>
+      <programargs>--overwrite ~/mdv-startup.wav</programargs>
+      <gdbpath></gdbpath>
       <dbgshell>libtool</dbgshell>
-      <configGdbScript/>
-      <runShellScript/>
-      <runGdbScript/>
+      <configGdbScript></configGdbScript>
+      <runShellScript></runShellScript>
+      <runGdbScript></runGdbScript>
       <breakonloadinglibs>true</breakonloadinglibs>
       <separatetty>false</separatetty>
Index: /mppenc/branches/r2d/src/mppdec.h
===================================================================
--- /mppenc/branches/r2d/src/mppdec.h	(revision 70)
+++ /mppenc/branches/r2d/src/mppdec.h	(revision 71)
@@ -1013,5 +1013,4 @@
 // huffsv7.c
 void       Init_Huffman_Decoder_SV7   ( void );
-void       Init_Huffman_Encoder_SV7   ( void );
 
 // huffsv46.c
Index: /mppenc/branches/r2d/src/mppenc.c
===================================================================
--- /mppenc/branches/r2d/src/mppenc.c	(revision 70)
+++ /mppenc/branches/r2d/src/mppenc.c	(revision 71)
@@ -683,5 +683,4 @@
                 memcpy ( errorL [Band], errorL[Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
             }
-        } else {
         }
 
@@ -694,5 +693,4 @@
                 memcpy ( errorR [Band], errorR [Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
             }
-        } else {
         }
     }
@@ -1035,5 +1033,5 @@
 			if ( 2 != sscanf ( argv[k], "%f,%f", &(m->KBD1), &(m->KBD2) ))
                 { stderr_printf ( "%s: missing two arguments", arg ); return -1; }
-            Init_FFT ();
+            Init_FFT (m);
         }
         else if ( 0 == strcmp ( arg, "fadein") ) {                                      // FadeInTime
@@ -1592,12 +1590,14 @@
 
     // initialize tables which must be initialized once and only once
+
+	m.SCF_Index_L = (int*) SCF_Index_L;
+	m.SCF_Index_R = (int*) SCF_Index_R;
+
 #ifdef FAST_MATH
     Init_FastMath ();                           // check if something has to be done for each file !!
 #endif
     Init_SV7 ();
+	Init_Skalenfaktoren ();
 	Init_Psychoakustik (&m);
-	SetQualityParams (&m, 5.0);
-    Init_Psychoakustiktabellen (&m);
-	Init_Skalenfaktoren ();
 	Init_FPU ();
 	Init_ANS ();
@@ -1746,4 +1746,5 @@
     WriteHeader_SV7 ( &e, m.Max_Band, MainQual, m.MS_Channelmode > 0, LastValidFrame, LastValidSamples, PNS > 0 ? 0x17 : 0x07, m.SampleFreq );
 
+
     // initialize timer
     ShowProgress (&m, 0, SamplesInWAVE, e.BufferedBits );
@@ -1849,9 +1850,4 @@
         memmove ( Main.S, Main.S + BLOCK, CENTER * sizeof(float) );
 
-		if ( AllSamplesRead + BLOCK > SamplesInWAVE )
-		{
-			int n = 0;
-		}
-
         // read samples
         CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
Index: /mppenc/branches/r2d/src/mppenc.h
===================================================================
--- /mppenc/branches/r2d/src/mppenc.h	(revision 70)
+++ /mppenc/branches/r2d/src/mppenc.h	(revision 71)
@@ -57,21 +57,4 @@
 } wave_t;
 
-// ans.c
-// extern unsigned int  NS_Order;                          // global Flag for Noise Shaping
-// extern unsigned int  NS_Order_L [32];
-// extern unsigned int  NS_Order_R [32];                   // order of the Adaptive Noiseshaping (0: off, 1...5: on)
-// extern float         FIR_L     [32] [MAX_NS_ORDER];
-// extern float         FIR_R     [32] [MAX_NS_ORDER];     // contains FIR-Filter for NoiseShaping
-// extern float         ANSspec_L [MAX_ANS_LINES];
-// extern float         ANSspec_R [MAX_ANS_LINES];         // L/R-masking threshold for ANS
-// extern float         ANSspec_M [MAX_ANS_LINES];
-// extern float         ANSspec_S [MAX_ANS_LINES];         // M/S-masking threshold for ANS
-
-
-// extern Uint32_t      Buffer [BUFFER_FULL];      // buffer for bitstream file (128 KB)
-// extern Uint32_t      dword;                     // 32 bit-Word for Bitstream-I/O
-// extern unsigned int  Zaehler;                   // position counter for processed bitstream word (32 bit)
-// extern UintMax_t     BufferedBits;              // counter for the number of written bits in the bitstream
-
 // FIXME : put in lib header
 void  FlushBitstream    ( FILE* fp, const mpc_uint32_t* buffer, size_t words32bit );
@@ -81,6 +64,5 @@
 void  GetBitstreamPos   ( mpc_encoder_t*, BitstreamPos* const pos );
 
-// cvd.c
-int    CVD2048 ( PsyModel*, const float*, int* );
+void   Init_FFT      ( PsyModel* );
 
 
@@ -91,9 +73,4 @@
 extern const float  tabsqrt_ex [];
 extern const float  tabsqrt_m  [] [2];
-
-
-// fft4g.c
-void   rdft                ( const int, float*, int*, float* );
-void   Generate_FFT_Tables ( const int, int*, float* );
 
 // FIXME : put in lib header
@@ -111,16 +88,4 @@
 void   Analyse_Init ( float Left, float Right, SubbandFloatTyp* out, const int MaxBand );
 void   Klemm ( void );
-
-// psy_tab.c
-extern float        fftLtq   [512];             // threshold in quiet (FFT)
-extern float        partLtq  [PART_LONG];       // threshold in quiet (Partitions)
-extern float        invLtq   [PART_LONG];       // inverse threshold in quiet (Partitions, long)
-extern float        Loudness [PART_LONG];       // weighting factors for calculation of loudness
-extern float        MinVal   [PART_LONG];       // minimum quality that's adapted to the model, minval for long
-extern float        SPRD     [PART_LONG] [PART_LONG]; // tabulated spreading function
-extern float        O_MAX;
-extern float        O_MIN;
-extern float        FAC1;
-extern float        FAC2;     // constants to calculate the used offset
 
 extern const float  Butfly    [7];              // Antialiasing to calculate the subband powers
