GNU Radio 3.6.1 C++ API
defines.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  FILE........: defines.h
4  AUTHOR......: David Rowe
5  DATE CREATED: 23/4/93
6 
7  Defines and structures used throughout the codec.
8 
9 \*---------------------------------------------------------------------------*/
10 
11 /*
12  Copyright (C) 2009 David Rowe
13 
14  All rights reserved.
15 
16  This program is free software; you can redistribute it and/or modify
17  it under the terms of the GNU Lesser General Public License version 2.1, as
18  published by the Free Software Foundation. This program is
19  distributed in the hope that it will be useful, but WITHOUT ANY
20  WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
22  License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public License
25  along with this program; if not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 #ifndef __DEFINES__
29 #define __DEFINES__
30 
31 /*---------------------------------------------------------------------------*\
32 
33  DEFINES
34 
35 \*---------------------------------------------------------------------------*/
36 
37 /* General defines */
38 
39 #define N 80 /* number of samples per frame */
40 #define MAX_AMP 80 /* maximum number of harmonics */
41 #define PI 3.141592654 /* mathematical constant */
42 #define TWO_PI 6.283185307 /* mathematical constant */
43 #define FS 8000 /* sample rate in Hz */
44 #define MAX_STR 256 /* maximum string size */
45 
46 #define NW 279 /* analysis window size */
47 #define FFT_ENC 512 /* size of FFT used for encoder */
48 #define FFT_DEC 512 /* size of FFT used in decoder */
49 #define TW 40 /* Trapezoidal synthesis window overlap */
50 #define V_THRESH 6.0 /* voicing threshold in dB */
51 #define LPC_MAX 20 /* maximum LPC order */
52 #define LPC_ORD 10 /* phase modelling LPC order */
53 
54 /* Pitch estimation defines */
55 
56 #define M 320 /* pitch analysis frame size */
57 #define P_MIN 20 /* minimum pitch */
58 #define P_MAX 160 /* maximum pitch */
59 
60 /*---------------------------------------------------------------------------*\
61 
62  TYPEDEFS
63 
64 \*---------------------------------------------------------------------------*/
65 
66 /* Structure to hold model parameters for one frame */
67 
68 typedef struct {
69  float Wo; /* fundamental frequency estimate in radians */
70  int L; /* number of harmonics */
71  float A[MAX_AMP]; /* amplitiude of each harmonic */
72  float phi[MAX_AMP]; /* phase of each harmonic */
73  int voiced; /* non-zero if this frame is voiced */
74 } MODEL;
75 
76 /* describes each codebook */
77 
78 struct lsp_codebook {
79  int k; /* dimension of vector */
80  int log2m; /* number of bits in m */
81  int m; /* elements in codebook */
82  const float * cb; /* The elements */
83 };
84 extern const struct lsp_codebook lsp_cb[];
85 extern const struct lsp_codebook lsp_cbd[];
86 extern const struct lsp_codebook lsp_cbdvq[];
87 
88 #endif