Index: mppenc/branches/r2d/common/mpcmath.h
===================================================================
--- mppenc/branches/r2d/common/mpcmath.h	(revision 73)
+++ mppenc/branches/r2d/common/mpcmath.h	(revision 74)
@@ -27,2 +27,33 @@
 #endif
 
+// fast but maybe more inaccurate, use if you need speed
+#if defined(__GNUC__) && !defined(__APPLE__)
+#  define SIN(x)      sinf ((float)(x))
+#  define COS(x)      cosf ((float)(x))
+#  define ATAN2(x,y)  atan2f ((float)(x), (float)(y))
+#  define SQRT(x)     sqrtf ((float)(x))
+#  define LOG(x)      logf ((float)(x))
+#  define LOG10(x)    log10f ((float)(x))
+#  define POW(x,y)    expf (logf(x) * (y))
+#  define POW10(x)    expf (M_LN10 * (x))
+#  define FLOOR(x)    floorf ((float)(x))
+#  define IFLOOR(x)   (int) floorf ((float)(x))
+#  define FABS(x)     fabsf ((float)(x))
+#else
+# define SIN(x)      (float) sin (x)
+# define COS(x)      (float) cos (x)
+# define ATAN2(x,y)  (float) atan2 (x, y)
+# define SQRT(x)     (float) sqrt (x)
+# define LOG(x)      (float) log (x)
+# define LOG10(x)    (float) log10 (x)
+# define POW(x,y)    (float) pow (x,y)
+# define POW10(x)    (float) pow (10., (x))
+# define FLOOR(x)    (float) floor (x)
+# define IFLOOR(x)   (int)   floor (x)
+# define FABS(x)     (float) fabs (x)
+#endif
+
+#define SQRTF(x)     SQRT (x)
+#define COSF(x)      COS (x)
+#define ATAN2F(x,y)  ATAN2 (x,y)
+#define IFLOORF(x)   IFLOOR (x)
Index: mppenc/branches/r2d/libmpcpsy/Makefile.am
===================================================================
--- mppenc/branches/r2d/libmpcpsy/Makefile.am	(revision 73)
+++ mppenc/branches/r2d/libmpcpsy/Makefile.am	(revision 74)
@@ -2,5 +2,4 @@
 METASOURCES = AUTO
 lib_LIBRARIES = libmpcpsy.a
-libmpcpsy_a_SOURCES = ans.c cvd.c fastmath.c fft4g.c fft_routines.c psy.c\
-	psy_tab.c
-noinst_HEADERS = libmpcpsy.h fastmath.h
+libmpcpsy_a_SOURCES = ans.c cvd.c fft4g.c fft_routines.c psy.c psy_tab.c
+noinst_HEADERS = libmpcpsy.h
Index: mppenc/branches/r2d/libmpcpsy/fastmath.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/fastmath.c	(revision 73)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifdef FAST_MATH
-
-const float  tabatan2   [ 2*TABSTEP+1] [2];
-const float  tabcos     [26*TABSTEP+1] [2];
-const float  tabsqrt_ex [256];
-const float  tabsqrt_m  [   TABSTEP+1] [2];
-
-
-void   Init_FastMath ( void )
-{
-    int     i;
-    float   X;
-    float   Y;
-    double  xm;
-    double  x0;
-    double  xp;
-    double  x;
-    double  y;
-    float*  p;
-
-    p = (float*) tabatan2;
-    for ( i = -TABSTEP; i <= TABSTEP; i++ ) {
-        xm = atan ((i-0.5)/TABSTEP);
-        x0 = atan ((i+0.0)/TABSTEP);
-        xp = atan ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-
-    p = (float*) tabcos;
-    for ( i = -13*TABSTEP; i <= 13*TABSTEP; i++ ) {
-        xm = cos ((i-0.5)/TABSTEP);
-        x0 = cos ((i+0.0)/TABSTEP);
-        xp = cos ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-
-    p = (float*) tabsqrt_ex;
-    for ( i = 0; i < 255; i++ ) {
-        *(int*)&X = (i << 23);
-        *(int*)&Y = (i << 23) + (1<<23) - 1;
-        *p++ = sqrt(X);
-    }
-    *(int*)&X = (255 << 23) - 1;
-    *p++ = sqrt(X);
-
-    p = (float*) tabsqrt_m;
-    for ( i = 1*TABSTEP; i <= 2*TABSTEP; i++ ) {
-        xm = sqrt ((i-0.5)/TABSTEP);
-        x0 = sqrt ((i+0.0)/TABSTEP);
-        xp = sqrt ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-}
-
-#endif
Index: mppenc/branches/r2d/libmpcpsy/fastmath.h
===================================================================
--- mppenc/branches/r2d/libmpcpsy/fastmath.h	(revision 73)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-// fast but maybe more inaccurate, use if you need speed
-#if defined(__GNUC__) && !defined(__APPLE__)
-#  define SIN(x)      sinf ((float)(x))
-#  define COS(x)      cosf ((float)(x))
-#  define ATAN2(x,y)  atan2f ((float)(x), (float)(y))
-#  define SQRT(x)     sqrtf ((float)(x))
-#  define LOG(x)      logf ((float)(x))
-#  define LOG10(x)    log10f ((float)(x))
-#  define POW(x,y)    expf (logf(x) * (y))
-#  define POW10(x)    expf (M_LN10 * (x))
-#  define FLOOR(x)    floorf ((float)(x))
-#  define IFLOOR(x)   (int) floorf ((float)(x))
-#  define FABS(x)     fabsf ((float)(x))
-#else
-# define SIN(x)      (float) sin (x)
-# define COS(x)      (float) cos (x)
-# define ATAN2(x,y)  (float) atan2 (x, y)
-# define SQRT(x)     (float) sqrt (x)
-# define LOG(x)      (float) log (x)
-# define LOG10(x)    (float) log10 (x)
-# define POW(x,y)    (float) pow (x,y)
-# define POW10(x)    (float) pow (10., (x))
-# define FLOOR(x)    (float) floor (x)
-# define IFLOOR(x)   (int)   floor (x)
-# define FABS(x)     (float) fabs (x)
-#endif
-
-#define SQRTF(x)      SQRT (x)
-#ifdef FAST_MATH
-# define TABSTEP      64
-# define COSF(x)      my_cos ((float)(x))
-# define ATAN2F(x,y)  my_atan2 ((float)(x), (float)(y))
-# define IFLOORF(x)   my_ifloor ((float)(x))
-#else
-# undef  TABSTEP
-# define COSF(x)      COS (x)
-# define ATAN2F(x,y)  ATAN2 (x,y)
-# define IFLOORF(x)   IFLOOR (x)
-#endif
-
-#if 1
-# define ROUND32(x)   ( floattmp = (x) + (int)0x00FD8000L, *(int*)(&floattmp) - (int)0x4B7D8000L )
-#else
-# define ROUND32(x)   ( (int) floor ((x) + 0.5) )
-#endif
-
-#ifdef FAST_MATH
-
-static __inline float
-my_atan2 ( float x, float y )
-{
-    float  t;
-    int    i;
-    float  ret;
-    float  floattmp;
-
-    if ( (*(int*)&x & 0x7FFFFFFF) < (*(int*)&y & 0x7FFFFFFF) ) {
-        i   = ROUND32 (t = TABSTEP * (x / y));
-        ret = tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (t-i);
-        if ( *(int*)&y < 0 )
-           ret = (float)(ret - M_PI);
-    }
-    else if ( *(int*)&x < 0) {
-        i   = ROUND32 (t = TABSTEP * (y / x));
-        ret = - M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
-    }
-    else if ( *(int*)&x > 0) {
-        i   = ROUND32 (t = TABSTEP * (y / x));
-        ret = + M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
-    }
-    else {
-        ret = 0.;
-    }
-    return ret;
-}
-
-
-static __inline float
-my_cos ( float x )
-{
-    float  t;
-    int    i;
-    float  ret;
-    float  floattmp;
-
-    i   = ROUND32 (t = TABSTEP * x);
-    ret = tabcos [13*TABSTEP+i][0] + tabcos [13*TABSTEP+i][1] * (t-i);
-    return ret;
-}
-
-
-static __inline int
-my_ifloor ( float x )
-{
-    x = x + (0x0C00000L + 0.500000001);
-    return *(int*)&x - 1262485505;
-}
-
-
-static __inline float
-my_sqrt ( float x )
-{
-    float  ret;
-    int    i;
-    int    ex = *(int*)&x >> 23;                                // get the exponent
-    float  floattmp;
-
-    *(int*)&x = (*(int*)&x & 0x7FFFFF) | 0x42800000;            // delete the exponent
-    i    = ROUND32 (x);                                         // Integer-part of the mantissa  (round ????????????)
-    ret  = tabsqrt_m [i-TABSTEP][0] + tabsqrt_m [i-TABSTEP][1] * (x-i); // calculate value
-    ret *= tabsqrt_ex [ex];
-    return ret;
-}
-
-#endif
Index: mppenc/branches/r2d/libmpcpsy/fft4g.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 73)
+++ mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 74)
@@ -21,5 +21,4 @@
 
 #include "libmpcpsy.h"
-#include "fastmath.h"
 #include "mpcmath.h"
 
Index: mppenc/branches/r2d/libmpcpsy/fft_routines.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/fft_routines.c	(revision 73)
+++ mppenc/branches/r2d/libmpcpsy/fft_routines.c	(revision 74)
@@ -18,8 +18,9 @@
  */
 
-#include "libmpcpsy.h"
-
 #include <math.h>
 #include <string.h>
+
+#include "libmpcpsy.h"
+#include "mpcmath.h"
 
 #define CX0     -1.
@@ -277,6 +278,4 @@
 }
 
-#include "fastmath.h"
-
 // input : Signal *x
 // output: energy spectrum *erg and phase spectrum *phs
Index: mppenc/branches/r2d/libmpcpsy/psy.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/psy.c	(revision 73)
+++ mppenc/branches/r2d/libmpcpsy/psy.c	(revision 74)
@@ -56,7 +56,7 @@
 
 #include "libmpcpsy.h"
-#include "fastmath.h"
 #include "datatypes.h"
 #include "minimax.h"
+#include "mpcmath.h"
 
 // psy_tab.c
@@ -1050,6 +1050,6 @@
     SMRTyp   SMR0;
     SMRTyp   SMR1;                                              // holds SMR's for first and second Analysis
-    int      isvoc_L;
-    int      isvoc_R;
+    int      isvoc_L = 0;
+    int      isvoc_R = 0;
     float    factorLTQ  = 1.f;                                  // Offset after variable LTQ
 
@@ -1110,5 +1110,5 @@
     PowSpec256 ( &data->L[432+SHORTFFT_OFFSET], F_256[3] );
     // calculate short Threshold
-    CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, pre_erg_L, TransientL );
+	CalcShortThreshold ( m, F_256, m->ShortThr, shortThr_L, pre_erg_L, TransientL );
 
     // calculate four short FFTs (right)
Index: mppenc/branches/r2d/libmpcpsy/psy_tab.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 73)
+++ mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 74)
@@ -18,9 +18,9 @@
  */
 
+#include <math.h>
+
 #include "libmpcpsy.h"
 #include "minimax.h"
-#include "fastmath.h"
-
-#include <math.h>
+#include "mpcmath.h"
 
 /*
Index: mppenc/branches/r2d/src/mppenc.c
===================================================================
--- mppenc/branches/r2d/src/mppenc.c	(revision 73)
+++ mppenc/branches/r2d/src/mppenc.c	(revision 74)
@@ -23,5 +23,7 @@
 #include <time.h>
 #include <errno.h>
+
 #include "mppenc.h"
+#include "mpcmath.h"
 
 /* G L O B A L  V A R I A B L E S */
@@ -365,7 +367,4 @@
  * (track-spanning cutting).
  */
-
-#include "fastmath.h"
-
 
 float  bump_exp   = 1.f;
@@ -1594,7 +1593,4 @@
 	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 ();
Index: mppenc/branches/r2d/src/mppenc.h
===================================================================
--- mppenc/branches/r2d/src/mppenc.h	(revision 73)
+++ mppenc/branches/r2d/src/mppenc.h	(revision 74)
@@ -23,5 +23,4 @@
 #ifdef _WIN32
 # define CVD_FASTLOG
-# define FAST_MATH
 #endif
 
@@ -65,12 +64,4 @@
 
 void   Init_FFT      ( PsyModel* );
-
-
-// fastmath.c
-void   Init_FastMath ( void );
-extern const float  tabatan2   [] [2];
-extern const float  tabcos     [] [2];
-extern const float  tabsqrt_ex [];
-extern const float  tabsqrt_m  [] [2];
 
 // FIXME : put in lib header
