GNU Radio 3.6.5 C++ API

defines.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002 
00003   FILE........: defines.h
00004   AUTHOR......: David Rowe
00005   DATE CREATED: 23/4/93
00006 
00007   Defines and structures used throughout the codec.
00008 
00009 \*---------------------------------------------------------------------------*/
00010 
00011 /*
00012   Copyright (C) 2009 David Rowe
00013 
00014   All rights reserved.
00015 
00016   This program is free software; you can redistribute it and/or modify
00017   it under the terms of the GNU Lesser General Public License version 2.1, as
00018   published by the Free Software Foundation.  This program is
00019   distributed in the hope that it will be useful, but WITHOUT ANY
00020   WARRANTY; without even the implied warranty of MERCHANTABILITY or
00021   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
00022   License for more details.
00023 
00024   You should have received a copy of the GNU Lesser General Public License
00025   along with this program; if not, see <http://www.gnu.org/licenses/>.
00026 */
00027 
00028 #ifndef __DEFINES__
00029 #define __DEFINES__
00030 
00031 /*---------------------------------------------------------------------------*\
00032 
00033                                 DEFINES
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 /* General defines */
00038 
00039 #define N          80           /* number of samples per frame          */
00040 #define MAX_AMP    80           /* maximum number of harmonics          */
00041 #define PI         3.141592654  /* mathematical constant                */
00042 #define TWO_PI     6.283185307  /* mathematical constant                */
00043 #define FS         8000         /* sample rate in Hz                    */
00044 #define MAX_STR    256          /* maximum string size                  */
00045 
00046 #define NW         279          /* analysis window size                 */
00047 #define FFT_ENC    512          /* size of FFT used for encoder         */
00048 #define FFT_DEC    512          /* size of FFT used in decoder          */
00049 #define TW         40           /* Trapezoidal synthesis window overlap */
00050 #define V_THRESH   6.0          /* voicing threshold in dB              */
00051 #define LPC_MAX    20           /* maximum LPC order                    */
00052 #define LPC_ORD    10           /* phase modelling LPC order            */
00053 
00054 /* Pitch estimation defines */
00055 
00056 #define M        320            /* pitch analysis frame size            */
00057 #define P_MIN    20             /* minimum pitch                        */
00058 #define P_MAX    160            /* maximum pitch                        */
00059 
00060 /*---------------------------------------------------------------------------*\
00061 
00062                                 TYPEDEFS
00063 
00064 \*---------------------------------------------------------------------------*/
00065 
00066 /* Structure to hold model parameters for one frame */
00067 
00068 typedef struct {
00069   float Wo;             /* fundamental frequency estimate in radians  */
00070   int   L;              /* number of harmonics                        */
00071   float A[MAX_AMP];     /* amplitiude of each harmonic                */
00072   float phi[MAX_AMP];   /* phase of each harmonic                     */
00073   int   voiced;         /* non-zero if this frame is voiced           */
00074 } MODEL;
00075 
00076 /* describes each codebook  */
00077 
00078 struct lsp_codebook {
00079     int                 k;        /* dimension of vector        */
00080     int                 log2m;    /* number of bits in m        */
00081     int                 m;        /* elements in codebook       */
00082     const float *       cb;       /* The elements               */
00083 };
00084 extern const struct lsp_codebook lsp_cb[];
00085 extern const struct lsp_codebook lsp_cbd[];
00086 extern const struct lsp_codebook lsp_cbdvq[];
00087 
00088 #endif