-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmfcccpu.h
69 lines (62 loc) · 1.54 KB
/
mfcccpu.h
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
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _MFCCCPU_H_
#define _MFCCCPU_H_
#include "mfccbase.h"
#include "segmentercpu.h"
#include "normalizercpu.h"
#include "deltacpu.h"
#include <fftw3.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338
#endif
class MfccCpu : public MfccBase
{
private:
int m_buffer_size,
m_window_limit,
m_data_length,
m_window_size2;
float * m_data,
*m_mel_energies,
*m_mfcc,
*m_dct_matrix,
*m_filters,
*m_delta_in;
int * m_filter_beg;
fftwf_complex * m_fft;
fftwf_plan m_fft_plan;
SegmenterCPU segmenter;
NormalizerCPU normalizer,
normalizer_delta,
normalizer_acc;
DeltaCPU delta, delta_acc;
void refresh_filters();
void get_output(float * data_out, float * buff, int width, int height, int spitch, int dpitch);
public:
MfccCpu(int input_buffer_size,
int window_size,
int shift,
int num_banks,
float sample_rate,
float low_freq,
float high_freq,
int ceps_len,
bool want_c0,
float lift_coef,
Normalizer::norm_t norm = Normalizer::NORM_NONE,
dyn_t dyn = DYN_NONE,
int delta_l1 = 1,
int delta_l2 = 1,
bool norm_after_dyn = true);
~MfccCpu();
void set_window(const float * window);
void fft(int window_count);
void filter(int window_count);
void dct(int window_count);
void do_delta(int window_count, bool first_call, bool last_call);
void normalize(int window_count, bool use_last_stats);
int set_input(const short * data, int samples);
int flush();
void apply();
void get_output_data(float * data_out, int window_count);
};
#endif