Index: mppenc/branches/r2d/libmpcpsy/ans.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/ans.c	(revision 67)
+++ 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 67)
+++ 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 67)
+++ 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 67)
+++ 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 67)
+++ 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 67)
+++ 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 67)
+++ 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;
     }
 }
