mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
fix some variables
This commit is contained in:
parent
dc8a0445d5
commit
f9115a7bc7
@ -24,7 +24,6 @@ int FeatureExtract::size()
|
|||||||
|
|
||||||
void FeatureExtract::insert(fftwf_plan plan, float *din, int len, int flag)
|
void FeatureExtract::insert(fftwf_plan plan, float *din, int len, int flag)
|
||||||
{
|
{
|
||||||
int fft_size = 512;
|
|
||||||
float* fft_input = (float *)fftwf_malloc(sizeof(float) * fft_size);
|
float* fft_input = (float *)fftwf_malloc(sizeof(float) * fft_size);
|
||||||
fftwf_complex* fft_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * fft_size);
|
fftwf_complex* fft_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * fft_size);
|
||||||
memset(fft_input, 0, sizeof(float) * fft_size);
|
memset(fft_input, 0, sizeof(float) * fft_size);
|
||||||
@ -33,18 +32,15 @@ void FeatureExtract::insert(fftwf_plan plan, float *din, int len, int flag)
|
|||||||
if (mode == 3)
|
if (mode == 3)
|
||||||
window = (const float *)&window_hamm_hex;
|
window = (const float *)&window_hamm_hex;
|
||||||
|
|
||||||
int window_size = 400;
|
|
||||||
int window_shift = 160;
|
|
||||||
|
|
||||||
speech.load(din, len);
|
speech.load(din, len);
|
||||||
int i, j;
|
int i, j;
|
||||||
float tmp_feature[80];
|
float tmp_feature[80];
|
||||||
if (mode == 0 || mode == 2 || mode == 3) {
|
if (mode == 0 || mode == 2 || mode == 3) {
|
||||||
int ll = (speech.size() - 400) / 160 + 1;
|
int ll = (speech.size() - window_size) / window_shift + 1;
|
||||||
fqueue.reinit(ll);
|
fqueue.reinit(ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= speech.size() - 400; i = i + window_shift) {
|
for (i = 0; i <= speech.size() - window_size; i = i + window_shift) {
|
||||||
float tmp_mean = 0;
|
float tmp_mean = 0;
|
||||||
for (j = 0; j < window_size; j++) {
|
for (j = 0; j < window_size; j++) {
|
||||||
tmp_mean += speech[i + j];
|
tmp_mean += speech[i + j];
|
||||||
|
|||||||
@ -14,6 +14,9 @@ class FeatureExtract {
|
|||||||
SpeechWrap speech;
|
SpeechWrap speech;
|
||||||
FeatureQueue fqueue;
|
FeatureQueue fqueue;
|
||||||
int mode;
|
int mode;
|
||||||
|
int fft_size = 512;
|
||||||
|
int window_size = 400;
|
||||||
|
int window_shift = 160;
|
||||||
|
|
||||||
//void fftw_init();
|
//void fftw_init();
|
||||||
void melspect(float *din, float *dout);
|
void melspect(float *din, float *dout);
|
||||||
|
|||||||
@ -18,7 +18,6 @@ ModelImp::ModelImp(const char* path,int nNumThread, bool quantize)
|
|||||||
cmvn_path = pathAppend(path, "am.mvn");
|
cmvn_path = pathAppend(path, "am.mvn");
|
||||||
config_path = pathAppend(path, "config.yaml");
|
config_path = pathAppend(path, "config.yaml");
|
||||||
|
|
||||||
int fft_size = 512;
|
|
||||||
fft_input = (float *)fftwf_malloc(sizeof(float) * fft_size);
|
fft_input = (float *)fftwf_malloc(sizeof(float) * fft_size);
|
||||||
fft_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * fft_size);
|
fft_out = (fftwf_complex *)fftwf_malloc(sizeof(fftwf_complex) * fft_size);
|
||||||
memset(fft_input, 0, sizeof(float) * fft_size);
|
memset(fft_input, 0, sizeof(float) * fft_size);
|
||||||
|
|||||||
@ -8,6 +8,7 @@ namespace paraformer {
|
|||||||
|
|
||||||
class ModelImp : public Model {
|
class ModelImp : public Model {
|
||||||
private:
|
private:
|
||||||
|
int fft_size=512;
|
||||||
float *fft_input;
|
float *fft_input;
|
||||||
fftwf_complex *fft_out;
|
fftwf_complex *fft_out;
|
||||||
fftwf_plan plan;
|
fftwf_plan plan;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user