]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - tiesr-gforge/tiesr-gforge.git/commitdiff
[#1348] Merge changes that fix FFT normalization from cm_mods branch to trunk.
authorlnetsch <lnetsch@localhost>
Thu, 21 Apr 2011 20:38:41 +0000 (20:38 +0000)
committerlnetsch <lnetsch@localhost>
Thu, 21 Apr 2011 20:38:41 +0000 (20:38 +0000)
TIesrEngine/src/mfcc_f.cpp
TIesrEngine/src/noise_sub.cpp
TIesrEngine/src/noise_sub.h
TIesrEngine/src/uttdet.cpp
TIesrEngine/src/winlen.h

index 271e03ad0568c8e906afaca9faab043fc5b791f1..7d22a7282968c8c958e5158bbde00c5bf9e380a7 100755 (executable)
@@ -586,7 +586,9 @@ ss_power_spectrum_to_mfcc(const short *power_spectrum,
      (norm2 - 2) - 2 * (8 - norm0 - norm1) + 1 - 16 + 14 (x1,x2) = 
      2 * norm1 + 2 * norm0 + norm2 - 19 */
 
-  compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 + var_norm->norm2 - 19;
+  /* compensate = 2 * var_norm->norm0 + 2 * var_norm->norm1 + var_norm->norm2 - 19; */
+  compensate = 2*(var_norm->norm0 + var_norm->norm1 - WINDOW_PWR ) +
+          var_norm->norm2 - 3;
 
   for (i = 0; i < n_filter; i++) 
     log_mel_energy[i] = log_polyfit( mel_energy[i], compensate);
index 5f5989818b68d1e8663fa30cfa2577156ec20c8b..9e04f5e7671c697aa38c100ef59b2b1b99583e34 100755 (executable)
@@ -438,7 +438,7 @@ ss_mfcc_a_window(short *sig, short *mfcc, short *log_mel_energy,
 
   for (is=((WINDOW_LEN>>1) - 1);is>=0;is--) ps_psd[is] = power_spectrum[is]; 
 
-  norm = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+  norm = ( var_norm->norm0 + var_norm->norm1 - WINDOW_PWR ) * 2 + ( var_norm->norm2 - 2 ) - 15;
 
   /* in-place spectral subtraction */
   ss_noise_subs(ps_psd, norm, p_ss_crtl->s_noise_floor, p_ss_crtl->snr, 
index c763fdbf14e0be01424e2d6a407431b3d053f47a..d78a49bfb0f1050d79b8e8bd3000f8e98656fb94 100755 (executable)
@@ -27,6 +27,7 @@
 #define NOISE_SUB_H
 
 #include "tiesr_config.h"
+#include "winlen.h"
 
 #define SS_NUM_FRM_FOR_NOISE_DET 9
 
index efc32d53eb840b009a93a6a6ef8195dbd6873553..b6a916e4a9ba151bf8c393c46163db3010055448 100755 (executable)
@@ -388,7 +388,7 @@ compute_uttdet(short *power_spectrum, short cnt, short frm_cnt, short *mfcc,
   short arg_max;
 
   /* fixed-point MFCC front end power spectrum need this much compensation */
-  norm3 = ( var_norm->norm0 + var_norm->norm1 - 8 ) * 2 + ( var_norm->norm2 - 2 ) - 15;
+  norm3 = ( var_norm->norm0 + var_norm->norm1 - WINDOW_PWR ) * 2 + ( var_norm->norm2 - 2 ) - 15;
 
   /* in-place spectral subtraction */
   noise_subs(power_spectrum, norm3, gv->ps_noisy_smoothed, gv->noise_floor, 
index 7e2a4f23ccec48a636a65638d3dc0d43bf3dbe3a..d429299e2e198315ec54b2ad9f417432eee3a7bb 100644 (file)
 #define WINDOW_LEN 256
 // #define WINDOW_LEN 512
 
+#if WINDOW_LEN == 256
+#define WINDOW_PWR 8
+#elif WINDOW_LEN == 512
+#define WINDOW_PWR 9
+#endif
 
 /* Number of samples in a frame of data that user must copy to buffer */