GNU Radio 3.6.4.1 C++ API
quantise.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  FILE........: quantise.h
4  AUTHOR......: David Rowe
5  DATE CREATED: 31/5/92
6 
7  Quantisation functions for the sinusoidal coder.
8 
9 \*---------------------------------------------------------------------------*/
10 
11 /*
12  All rights reserved.
13 
14  This program is free software; you can redistribute it and/or modify
15  it under the terms of the GNU Lesser General Public License version 2.1, as
16  published by the Free Software Foundation. This program is
17  distributed in the hope that it will be useful, but WITHOUT ANY
18  WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
20  License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public License
23  along with this program; if not, see <http://www.gnu.org/licenses/>.
24 */
25 
26 #ifndef __QUANTISE__
27 #define __QUANTISE__
28 
29 #define WO_BITS 7
30 #define WO_LEVELS (1<<WO_BITS)
31 #define E_BITS 5
32 #define E_LEVELS (1<<E_BITS)
33 #define E_MIN_DB -10.0
34 #define E_MAX_DB 40.0
35 
36 void quantise_init();
37 float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order,
38  int lsp,float ak[]);
39 void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr,
40  int dump);
41 
42 int encode_Wo(float Wo);
43 float decode_Wo(int index);
44 
45 void encode_lsps(int indexes[], float lsp[], int order);
46 void decode_lsps(float lsp[], int indexes[], int order);
47 void lspd_quantise(float lsp[], float lsp_[], int order);
48 void lspdvq_quantise(float lsp[], float lsp_[], int order);
49 
50 int encode_energy(float e);
51 float decode_energy(int index);
52 
53 void encode_amplitudes(int lsp_indexes[],
54  int *energy_index,
55  MODEL *model,
56  float Sn[],
57  float w[]);
58 
59 float decode_amplitudes(MODEL *model,
60  float ak[],
61  int lsp_indexes[],
62  int energy_index,
63  float lsps[],
64  float *e);
65 
66 void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits);
67 int unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits);
68 
69 int lsp_bits(int i);
70 
71 void apply_lpc_correction(MODEL *model);
72 float speech_to_uq_lsps(float lsp[],
73  float ak[],
74  float Sn[],
75  float w[],
76  int order
77  );
78 void bw_expand_lsps(float lsp[],
79  int order
80  );
81 void decode_lsps(float lsp[], int indexes[], int order);
82 
83 #endif