Index: mppenc/branches/r2d/libmpcpsy/fft4g.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 64)
+++ mppenc/branches/r2d/libmpcpsy/fft4g.c	(revision 65)
@@ -18,5 +18,8 @@
  */
 
+#include <math.h>
+
 #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 64)
+++ mppenc/branches/r2d/libmpcpsy/fft_routines.c	(revision 65)
@@ -174,5 +174,5 @@
 // generates FFT lookup-tables
 void
-Init_FFT ( void )
+Init_FFT ( PsyModel* m )
 {
     int     n;
@@ -181,6 +181,6 @@
 
     // normalized hann functions
-    Window ( Hann_256 ,  256, KBD1 );
-    Window ( Hann_1024, 1024, KBD2 );
+    Window ( Hann_256 ,  256, m->KBD1 );
+    Window ( Hann_1024, 1024, m->KBD2 );
     scale = 0.25 / sqrt (2048.);
     for ( n = 0; n < 800; n++ )
Index: mppenc/branches/r2d/libmpcpsy/libmpcpsy.h
===================================================================
--- mppenc/branches/r2d/libmpcpsy/libmpcpsy.h	(revision 64)
+++ mppenc/branches/r2d/libmpcpsy/libmpcpsy.h	(revision 65)
@@ -42,8 +42,4 @@
 #define MS2SPAT3             0.125f
 #define MS2SPAT4             0.0625f
-
-
-#define KBD1	2.
-#define KBD2	-1.
 
 typedef struct {
@@ -96,7 +92,7 @@
 	float  Ltq_offset;                         // Offset for threshold in quiet
 	float  Ltq_max;                            // maximum level for threshold in quiet
-	float  TMN;
-	float  NMT;
-	float  TransDetect;
+	float        TMN;                        // Offset for purely sinusoid components
+	float        NMT;                        // Offset for purely noisy components
+	float        TransDetect;                // minimum slewrate for transient detection
 	unsigned int    EarModelFlag;
 	int    MinValChoice;
@@ -115,4 +111,7 @@
 	float         SNR_comp_R [32];             // SNR-compensation after SCF-combination and ANS-gain
 
+	float KBD1; // = 2.
+	float KBD2; // = -1.
+
 	// FIXME : remove this :
 	int            SCF_Index_L [32] [3];
@@ -121,17 +120,2 @@
 } PsyModel;
 
-
-// w_low for long               0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56
-const int   wl [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  13,  15,  17,  19,  21,  23,  25,  27,  29,  31,  33,  35,  38,  41,  44,  47,  50,  54,  58,  62,  67,  72,  78,  84,  91,  98, 106, 115, 124, 134, 145, 157, 170, 184, 199, 216, 234, 254, 276, 301, 329, 360, 396, 437, 485 };
-const int   wh [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  12,  14,  16,  18,  20,  22,  24,  26,  28,  30,  32,  34,  37,  40,  43,  46,  49,  53,  57,  61,  66,  71,  77,  83,  90,  97, 105, 114, 123, 133, 144, 156, 169, 183, 198, 215, 233, 253, 275, 300, 328, 359, 395, 436, 484, 511 };
-// Width:                       1    1    1    1    1    1    1    1    1    1    1    2    2    2    2    2    2    2    2    2    2    2    2    3    3    3    3    3    4    4    4    5    5    6    6    7    7    8    9    9   10   11   12   13   14   15   17   18   20   22   25   28   31   36   41   48   27
-
-// inverse partition-width for long
-const float iw [PART_LONG] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/4, 1.f/4, 1.f/4, 1.f/5, 1.f/5, 1.f/6, 1.f/6, 1.f/7, 1.f/7, 1.f/8, 1.f/9, 1.f/9, 1.f/10, 1.f/11, 1.f/12, 1.f/13, 1.f/14, 1.f/15, 1.f/17, 1.f/18, 1.f/20, 1.f/22, 1.f/25, 1.f/28, 1.f/31, 1.f/36, 1.f/41, 1.f/48, 1.f/27 };
-
-// w_low for short                    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17   18
-const int   wl_short [PART_SHORT] = { 0,  1,  2,  3,  4,  5,  6,  8, 10, 12, 15, 18, 23, 29, 36, 46, 59, 75,  99 };
-const int   wh_short [PART_SHORT] = { 0,  1,  2,  3,  5,  6,  7,  9, 12, 14, 18, 23, 29, 36, 46, 58, 75, 99, 127 };
-
-// inverse partition-width for short
-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 };
Index: mppenc/branches/r2d/libmpcpsy/psy.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/psy.c	(revision 64)
+++ mppenc/branches/r2d/libmpcpsy/psy.c	(revision 65)
@@ -58,4 +58,13 @@
 #include "fastmath.h"
 #include "datatypes.h"
+#include "minimax.h"
+
+
+extern const float  iw        [PART_LONG];      // inverse partition-width for long
+extern const float  iw_short  [PART_SHORT];     // inverse partition-width for short
+extern const int    wl        [PART_LONG];      // w_low  for long
+extern const int    wl_short  [PART_SHORT];     // w_low  for short
+extern const int    wh        [PART_LONG];      // w_high for long
+extern const int    wh_short  [PART_SHORT];     // w_high for short
 
 
Index: mppenc/branches/r2d/libmpcpsy/psy_tab.c
===================================================================
--- mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 64)
+++ mppenc/branches/r2d/libmpcpsy/psy_tab.c	(revision 65)
@@ -19,4 +19,6 @@
 
 #include "libmpcpsy.h"
+#include "minimax.h"
+#include "fastmath.h"
 
 #include <math.h>
@@ -28,4 +30,21 @@
  *  ATH is not good even if it's theoretically inaudible).
  */
+
+// FIXME : move this in a struct, to eliminate multiple declarations
+// w_low for long               0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56
+const int   wl [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  13,  15,  17,  19,  21,  23,  25,  27,  29,  31,  33,  35,  38,  41,  44,  47,  50,  54,  58,  62,  67,  72,  78,  84,  91,  98, 106, 115, 124, 134, 145, 157, 170, 184, 199, 216, 234, 254, 276, 301, 329, 360, 396, 437, 485 };
+const int   wh [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  12,  14,  16,  18,  20,  22,  24,  26,  28,  30,  32,  34,  37,  40,  43,  46,  49,  53,  57,  61,  66,  71,  77,  83,  90,  97, 105, 114, 123, 133, 144, 156, 169, 183, 198, 215, 233, 253, 275, 300, 328, 359, 395, 436, 484, 511 };
+// Width:                       1    1    1    1    1    1    1    1    1    1    1    2    2    2    2    2    2    2    2    2    2    2    2    3    3    3    3    3    4    4    4    5    5    6    6    7    7    8    9    9   10   11   12   13   14   15   17   18   20   22   25   28   31   36   41   48   27
+
+// inverse partition-width for long
+const float iw [PART_LONG] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/4, 1.f/4, 1.f/4, 1.f/5, 1.f/5, 1.f/6, 1.f/6, 1.f/7, 1.f/7, 1.f/8, 1.f/9, 1.f/9, 1.f/10, 1.f/11, 1.f/12, 1.f/13, 1.f/14, 1.f/15, 1.f/17, 1.f/18, 1.f/20, 1.f/22, 1.f/25, 1.f/28, 1.f/31, 1.f/36, 1.f/41, 1.f/48, 1.f/27 };
+
+// w_low for short                    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17   18
+const int   wl_short [PART_SHORT] = { 0,  1,  2,  3,  4,  5,  6,  8, 10, 12, 15, 18, 23, 29, 36, 46, 59, 75,  99 };
+const int   wh_short [PART_SHORT] = { 0,  1,  2,  3,  5,  6,  7,  9, 12, 14, 18, 23, 29, 36, 46, 58, 75, 99, 127 };
+
+// inverse partition-width for short
+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 };
+
 
 static float
