1 /*---------------------------------------------------------------------------*\
2 
3   FILE........: newamp2.h
4   AUTHOR......: Thomas Kurin and Stefan Erhardt
5   INSTITUTE...:	Institute for Electronics Engineering, University of Erlangen-Nuremberg
6   DATE CREATED: July 2018
7   BASED ON....:	"newamp1.h" by David Rowe
8 
9   Quantisation functions for the sinusoidal coder, using "newamp1"
10   algorithm that resamples variable rate L [Am} to a fixed rate K then
11   VQs.
12 
13 \*---------------------------------------------------------------------------*/
14 
15 /*
16   Copyright Thomas Kurin and Stefan Erhardt 2018
17 
18   All rights reserved.
19 
20   This program is free software; you can redistribute it and/or modify
21   it under the terms of the GNU Lesser General Public License version 2.1, as
22   published by the Free Software Foundation.  This program is
23   distributed in the hope that it will be useful, but WITHOUT ANY
24   WARRANTY; without even the implied warranty of MERCHANTABILITY or
25   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
26   License for more details.
27 
28   You should have received a copy of the GNU Lesser General Public License
29   along with this program; if not, see <http://www.gnu.org/licenses/>.
30 */
31 
32 #ifndef __NEWAMP2__
33 #define __NEWAMP2__
34 
35 #define NEWAMP2_N_INDEXES    4  /* Number of indexes to pack: vq1, vq2, energy, Wo */
36 #define NEWAMP2_PHASE_NFFT 128  /* size of FFT used for phase synthesis            */
37 #define NEWAMP2_K           29  /* rate K vector length							   */
38 #define NEWAMP2_16K_K       40  /* rate K vector length	for 16k Mode			   */
39 
40 #include "codec2_fft.h"
41 #include "comp.h"
42 
43 void n2_mel_sample_freqs_kHz(float rate_K_sample_freqs_kHz[], int K);
44 void n2_resample_const_rate_f(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K);
45 void n2_rate_K_mbest_encode(int *indexes, float *x, float *xq, int ndim);
46 void n2_resample_rate_L(C2CONST *c2const, MODEL *model, float rate_K_vec[], float rate_K_sample_freqs_kHz[], int K,int plosive_flag);
47 void n2_post_filter_newamp2(float vec[], float sample_freq_kHz[], int K, float pf_gain);
48 void newamp2_interpolate(float interpolated_surface_[], float left_vec[], float right_vec[], int K,int plosive_flag);
49 void newamp2_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                               int	 plosiv
59                               );
60 void newamp2_indexes_to_rate_K_vec(float  rate_K_vec_[],
61                                    float  rate_K_vec_no_mean_[],
62                                    float  rate_K_sample_freqs_kHz[],
63                                    int    K,
64                                    float *mean_,
65                                    int    indexes[],
66                                    float  pf_gain);
67 void newamp2_16k_indexes_to_rate_K_vec(float  rate_K_vec_[],
68                                    float  rate_K_vec_no_mean_[],
69                                    float  rate_K_sample_freqs_kHz[],
70                                    int    K,
71                                    float *mean_,
72                                    int    indexes[],
73                                    float  pf_gain);
74 void newamp2_indexes_to_model(C2CONST *c2const,
75                               MODEL  model_[],
76                               COMP   H[],
77                               float  interpolated_surface_[],
78                               float  prev_rate_K_vec_[],
79                               float  *Wo_left,
80                               int    *voicing_left,
81                               float  rate_K_sample_freqs_kHz[],
82                               int    K,
83                               codec2_fft_cfg fwd_cfg,
84                               codec2_fft_cfg inv_cfg,
85                               int    indexes[],
86                               float  pf_gain,
87                               int flag16k);
88 
89 #endif
90