📄 extf_norm_1.cc
字号:
// file: extf_norm_1.cc//// this program calculates the snr of a signal using a probabilistic measure// // system include files//#include <string.h>// isip include files//#include "extract_feature.h"#include "extract_feature_constants.h"#include <signal_constants.h>// function: normalize_cc//// arguments://// float_8** vectors: (input/output) pointer to working data// int_4 num_frames: (input) number of frames// int_4 block: (input) indicate the utterance start//// return value: a logical_1 indicating status//// this function parses command line arguments//logical_1 Extract_feature::normalize_cc(float_8** vectors_a, int_4 num_frames_a, int_4 block_a) { static float_8 mean[39]; static int_4 frames; // if this is the first block received, do initialization // if (block_a == 0) { memset(mean,0, 39*sizeof(float_8)); frames = 0; } float_8 min_energy = max_energy_d - (EXTF_SIL_FLOOR*log(10))/10.0; // clamp energy to silence floor // for (int_4 i=0; i < num_frames_a; i++) { if (vectors_a[i][0] < min_energy) { vectors_a[i][0] = min_energy; } if (energy_norm_d == ISIP_TRUE) { vectors_a[i][0] = 1 - (max_energy_d - vectors_a[i][0]); } } // if cms is required // if (cepstral_mean_subtract_d == ISIP_TRUE) { // get the history sum of received data // for (int_4 j=1; j < vector_first_d; j++) { mean[j] *= frames; } // outerloop first helps locality of memory accesses // for (int_4 i=0; i < num_frames_a; i++) { for (int_4 j=1; j < vector_first_d; j++) { mean[j] += vectors_a[i][j]; } } // scale the means by the number of samples // frames += num_frames_a; // fprintf(stdout, "%d", (int)frames); for (int_4 j=1; j < vector_first_d; j++) { mean[j] /= (float_8)(frames); // fprintf(stdout, "mean[%d] = %f\n", (int)j, mean[j]); } // normalize the samples by the mean // for (int_4 i=0; i < num_frames_a; i++) { for (int_4 j=1; j < vector_first_d; j++) { vectors_a[i][j] -= mean[j]; } } } // return without error // return ISIP_TRUE; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -