Index: libmpc/branches/r2d/mpcenc/mpcenc.c
===================================================================
--- libmpc/branches/r2d/mpcenc/mpcenc.c	(revision 201)
+++ libmpc/branches/r2d/mpcenc/mpcenc.c	(revision 203)
@@ -534,6 +534,6 @@
 
         // Where is scf{R,L} [0...2] initialized ???
-        scfL = SCF_Index_L [Band];
-        scfR = SCF_Index_R [Band];
+        scfL = e->SCF_Index_L [Band];
+		scfR = e->SCF_Index_R [Band];
         if (tmp_L [0] > 0.) scfL [0] = IFLOORF (-12.6f * LOG10 (tmp_L [0]) + 57.8945021823f );
         if (tmp_L [1] > 0.) scfL [1] = IFLOORF (-12.6f * LOG10 (tmp_L [1]) + 57.8945021823f );
@@ -669,5 +669,5 @@
                 const int*              resR,
                 const SubbandFloatTyp*  subx,
-                SubbandQuantTyp*        subq )
+				mpc_quantizer*          subq )
 {
     static float  errorL [32] [36 + MAX_NS_ORDER];
@@ -1500,5 +1500,4 @@
     PCMDataTyp       Main;                      // contains PCM data for 1600 samples
     SubbandFloatTyp  X [32];                    // Subbandsamples as float()
-    SubbandQuantTyp  Q [32];                    // Subband samples after quantization
     wave_t           Wave;                      // contains WAV-files arguments
     mpc_uint64_t        AllSamplesRead   =    0;   // overall read Samples per channel
@@ -1518,6 +1517,6 @@
     // 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;
+	m.SCF_Index_L = (int*) e.SCF_Index_L;
+	m.SCF_Index_R = (int*) e.SCF_Index_R;
 
 	Init_Psychoakustik (&m);
@@ -1672,6 +1671,6 @@
         // you only get null samples at the output of the filterbank when the last frame contains zeroes
 
-        memset ( Res_L, 0, sizeof Res_L );
-        memset ( Res_R, 0, sizeof Res_R );
+		memset ( e.Res_L, 0, sizeof e.Res_L );
+		memset ( e.Res_R, 0, sizeof e.Res_R );
 
         if ( !Silence  ||  !OldSilence ) {
@@ -1681,19 +1680,19 @@
 				RaiseSMR (&m, m.Max_Band, &SMR );                            // Minimum-operation on SBRs (full bandwidth)
 			if ( m.MS_Channelmode > 0 )
-				MS_LR_Entscheidung ( m.Max_Band, MS_Flag, &SMR, X );      // Selection of M/S- or L/R-Coding
+				MS_LR_Entscheidung ( m.Max_Band, e.MS_Flag, &SMR, X );      // Selection of M/S- or L/R-Coding
 			SCF_Extraktion (&m, &e, m.Max_Band, X );                             // Extraction of the scalefactors and normalization of the subband samples
             TransientenCalc ( Transient, TransientL, TransientR );
 			if ( m.NS_Order > 0 ) {
-				NS_Analyse (&m, m.Max_Band, MS_Flag, SMR, Transient );                  // calculate possible ANS-Filter and the expected gain
+				NS_Analyse (&m, m.Max_Band, e.MS_Flag, SMR, Transient );                  // calculate possible ANS-Filter and the expected gain
             }
 
-            Allocate ( m.Max_Band, Res_L, X[0].L, SCF_Index_L[0], m.SNR_comp_L, SMR.L, Power_L, Transient , m.PNS );   // allocate bits for left + right channel
-			Allocate ( m.Max_Band, Res_R, X[0].R, SCF_Index_R[0], m.SNR_comp_R, SMR.R, Power_R, Transient , m.PNS );
-
-			Quantisierung (&m, m.Max_Band, Res_L, Res_R, X, Q );             // quantize samples
+			Allocate ( m.Max_Band, e.Res_L, X[0].L, e.SCF_Index_L[0], m.SNR_comp_L, SMR.L, Power_L, Transient , m.PNS );   // allocate bits for left + right channel
+			Allocate ( m.Max_Band, e.Res_R, X[0].R, e.SCF_Index_R[0], m.SNR_comp_R, SMR.R, Power_R, Transient , m.PNS );
+
+			Quantisierung (&m, m.Max_Band, e.Res_L, e.Res_R, X, e.Q );             // quantize samples
         }
 
         OldSilence      = Silence;
-        writeBitstream_SV8 ( &e, m.Max_Band, Q ); // write SV8-Bitstream
+        writeBitstream_SV8 ( &e, m.Max_Band); // write SV8-Bitstream
 
         if ( (int)(time (NULL) - T) >= 0 ) {                            // output
Index: libmpc/branches/r2d/mpcenc/mpcenc.h
===================================================================
--- libmpc/branches/r2d/mpcenc/mpcenc.h	(revision 201)
+++ libmpc/branches/r2d/mpcenc/mpcenc.h	(revision 203)
@@ -255,34 +255,4 @@
 void   NoiseInjectionComp ( void );
 
-
-// FIXME : no more globals
-// encode_sv7.c
-extern unsigned char  MS_Flag     [32];                  // subband-wise mid/side flag
-extern int            Res_L       [32];
-extern int            Res_R       [32];                  // resolution steps of the subbands
-extern int            SCF_Index_L [32] [3];
-extern int            SCF_Index_R [32] [3];              // Scalefactor-index for Bitstream
-
-// FIXME : put in lib header
-void         Init_SV8             ( mpc_encoder_t* );
-void writeStreamInfo ( mpc_encoder_t*e,
-					   const unsigned int  MaxBand,
-					   const unsigned int  MS_on,
-					   const unsigned int  SamplesCount,
-					   const unsigned int  SampleFreq,
-					   const unsigned int  ChannelCount);
-void writeEncoderInfo ( mpc_encoder_t * e,
-						const float profile,
-						const int PNS_on,
-						const int version_major,
-						const int version_minor,
-						const int version_implement,
-						const int version_build );
-void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC);
-void writeMagic (mpc_encoder_t * e);
-void writeBits (mpc_encoder_t * e, mpc_uint32_t input, unsigned int bits );
-void writeSeekTable (mpc_encoder_t * e);
-void writeBitstream_SV8 ( mpc_encoder_t*, int, const SubbandQuantTyp*);
-
 // keyboard.c
 int    WaitKey      ( void );
