FeatureExtract.h 642 Bytes
Newer Older
mayong's avatar
mayong committed
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

#ifndef FEATUREEXTRACT_H
#define FEATUREEXTRACT_H

#include <fftw3.h>
#include <stdint.h>

#include "FeatureQueue.h"
#include "SpeechWrap.h"
#include "Tensor.h"

class FeatureExtract {
  private:
    SpeechWrap speech;
    FeatureQueue fqueue;
    int mode;

    float *fft_input;
    fftwf_complex *fft_out;
    fftwf_plan p;

    void fftw_init();
    void melspect(float *din, float *dout);
    void global_cmvn(float *din);

  public:
    FeatureExtract(int mode);
    ~FeatureExtract();
    int size();
    int status();
    void reset();
    void insert(float *din, int len, int flag);
    bool fetch(Tensor<float> *&dout);
};

#endif