diff options
Diffstat (limited to 'newamp1.h')
-rw-r--r-- | newamp1.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/newamp1.h b/newamp1.h new file mode 100644 index 0000000..7783abc --- /dev/null +++ b/newamp1.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | |||
3 | FILE........: newamp1.h | ||
4 | AUTHOR......: David Rowe | ||
5 | DATE CREATED: Jan 2017 | ||
6 | |||
7 | Quantisation functions for the sinusoidal coder, using "newamp1" | ||
8 | algorithm that resamples variable rate L [Am} to a fixed rate K then | ||
9 | VQs. | ||
10 | |||
11 | \*---------------------------------------------------------------------------*/ | ||
12 | |||
13 | /* | ||
14 | Copyright David Rowe 2017 | ||
15 | |||
16 | All rights reserved. | ||
17 | |||
18 | This program is free software; you can redistribute it and/or modify | ||
19 | it under the terms of the GNU Lesser General Public License version 2.1, as | ||
20 | published by the Free Software Foundation. This program is | ||
21 | distributed in the hope that it will be useful, but WITHOUT ANY | ||
22 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
23 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
24 | License for more details. | ||
25 | |||
26 | You should have received a copy of the GNU Lesser General Public License | ||
27 | along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
28 | */ | ||
29 | |||
30 | #ifndef __NEWAMP1__ | ||
31 | #define __NEWAMP1__ | ||
32 | |||
33 | #define NEWAMP1_N_INDEXES 4 /* Number of indexes to pack: vq1, vq2, energy, Wo */ | ||
34 | #define NEWAMP1_PHASE_NFFT 128 /* size of FFT used for phase synthesis */ | ||
35 | #define NEWAMP1_K 20 /* rate K vector length */ | ||
36 | |||
37 | #include "codec2_fft.h" | ||
38 | #include "comp.h" | ||
39 | |||
40 | void interp_para(float y[], float xp[], float yp[], int np, float x[], int n); | ||
41 | float ftomel(float fHz); | ||
42 | void mel_sample_freqs_kHz(float rate_K_sample_freqs_kHz[], int K, float mel_start, float mel_end); | ||
43 | void resample_const_rate_f(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K); | ||
44 | float rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim, int mbest_entries); | ||
45 | void post_filter_newamp1(float vec[], float sample_freq_kHz[], int K, float pf_gain); | ||
46 | void interp_Wo_v(float Wo_[], int L_[], int voicing_[], float Wo1, float Wo2, int voicing1, int voicing2); | ||
47 | void resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K); | ||
48 | void determine_phase(C2CONST *c2const, COMP H[], MODEL *model, int Nfft, codec2_fft_cfg fwd_cfg, codec2_fft_cfg inv_cfg); | ||
49 | void newamp1_model_to_indexes(C2CONST *c2const, | ||
50 | int indexes[], | ||
51 | MODEL *model, | ||
52 | float rate_K_vec[], | ||
53 | float rate_K_sample_freqs_kHz[], | ||
54 | int K, | ||
55 | float *mean, | ||
56 | float rate_K_vec_no_mean[], | ||
57 | float rate_K_vec_no_mean_[], | ||
58 | float *se); | ||
59 | void newamp1_indexes_to_rate_K_vec(float rate_K_vec_[], | ||
60 | float rate_K_vec_no_mean_[], | ||
61 | float rate_K_sample_freqs_kHz[], | ||
62 | int K, | ||
63 | float *mean_, | ||
64 | int indexes[], | ||
65 | float user_rate_K_vec_no_mean_[], | ||
66 | int post_filter_en); | ||
67 | void newamp1_interpolate(float interpolated_surface_[], float left_vec[], float right_vec[], int K); | ||
68 | |||
69 | void newamp1_indexes_to_model(C2CONST *c2const, | ||
70 | MODEL model_[], | ||
71 | COMP H[], | ||
72 | float interpolated_surface_[], | ||
73 | float prev_rate_K_vec_[], | ||
74 | float *Wo_left, | ||
75 | int *voicing_left, | ||
76 | float rate_K_sample_freqs_kHz[], | ||
77 | int K, | ||
78 | codec2_fft_cfg fwd_cfg, | ||
79 | codec2_fft_cfg inv_cfg, | ||
80 | int indexes[], | ||
81 | float user_rate_K_vec_no_mean_[], | ||
82 | int post_filter_en); | ||
83 | |||
84 | #endif | ||