libg722_1  0.1.0
bvcommon.h
1 /*
2  * broadvoice - a library for the BroadVoice 16 and 32 codecs
3  *
4  * bvcommon.h -
5  *
6  * Adapted by Steve Underwood <steveu@coppice.org> from code which is
7  * Copyright 2000-2009 Broadcom Corporation
8  *
9  * All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 2.1,
13  * as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  * $Id: bvcommon.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
25  */
26 
27 #include "typedef.h"
28 
29 #ifndef BVCOMMON_H
30 #define BVCOMMON_H
31 
32 /* Function Prototypes */
33 
34 void apfilter(const Float *a, /* (i) a[m+1] prediction coefficients (m=10) */
35  int m, /* (i) LPC order */
36  Float *x, /* (i) input signal */
37  Float *y, /* (o) output signal */
38  int lg, /* (i) size of filtering */
39  Float *mem, /* (i/o) input memory */
40  int16_t update); /* (i) flag for memory update */
41 
42 void azfilter(const Float *a, /* (i) prediction coefficients */
43  int m, /* (i) LPC order */
44  Float *x, /* (i) input signal vector */
45  Float *y, /* (o) output signal vector */
46  int lg, /* (i) size of filtering */
47  Float *mem, /* (i/o) filter memory before filtering */
48  int16_t update); /* (i) flag for memory update */
49 
50 void Autocor(Float *r, /* (o) : Autocorrelations */
51  Float *x, /* (i) : Input signal */
52  const Float *window, /* (i) : LPC Analysis window */
53  int l_window, /* (i) : window length */
54  int m); /* (i) : LPC order */
55 
56 void Levinson(Float *r, /* (i): autocorrelation coefficients */
57  Float *a, /* (o): LPC coefficients */
58  Float *old_a, /* (i/o): LPC coefficients of previous frame */
59  int m); /* (i): LPC order */
60 
61 void a2lsp(Float pc[], /* (i) input the np+1 predictor coeff. */
62  Float lsp[], /* (o) line spectral pairs */
63  Float old_lsp[]); /* (i/o) old lsp[] (in case not found 10 roots) */
64 
65 void lsp2a(Float *lsp, /* (i) LSP vector */
66  Float *a); /* (o) LPC coefficients */
67 
68 void stblz_lsp(Float *lsp, int order);
69 
70 int stblchck(Float *x, int vdim);
71 
72 /* LPC to LSP Conversion */
73 extern Float grid[];
74 
75 /* LPC bandwidth expansion */
76 extern Float bwel[];
77 
78 /* LPC WEIGHTING FILTER */
79 extern Float STWAL[];
80 
81 /* ----- Basic Codec Parameters ----- */
82 #define LPCO 8 /* LPC Order */
83 #define Ngrd 60 /* LPC to LSP Conversion */
84 
85 #define LSPMIN 0.00150 /* minimum LSP frequency, 6/12 Hz for BV16/BV32 */
86 #define LSPMAX 0.99775 /* maximum LSP frequency, 3991/7982 Hz for BV16/BV32 */
87 #define DLSPMIN 0.01250 /* minimum LSP spacing, 50/100 Hz for BV16/BV32 */
88 #define STBLDIM 3 /* dimension of stability enforcement */
89 
90 #endif /* BVCOMMON_H */