libg722_1  0.1.0
broadvoice/private/broadvoice.h
Go to the documentation of this file.
1 /*
2  * broadvoice - a library for the BroadVoice 16 and 32 codecs
3  *
4  * broadvoice.h - The head guy amongst the headers
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2009 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  * $Id: broadvoice.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $
25  */
26 
27 /*! \file */
28 
29 #if !defined(_BROADVOICE_PRIVATE_BROADVOICE_H_)
30 #define _BROADVOICE_PRIVATE_BROADVOICE_H_
31 
32 typedef double Float;
33 
34 #define LPCO 8 /* LPC Order */
35 #define HPO 2 /* Front end 150Hz high-pass filter order */
36 #define DFO 4
37 
38 #define BV16_FRSZ 40 /* Frame size */
39 #define BV16_MAXPP 137 /* MAXimum Pitch Period */
40 #define BV16_PWSZ 120 /* Pitch analysis Window SiZe */
41 #define BV16_XQOFF (BV16_MAXPP + 1) /* xq() offset before current subframe */
42 #define BV16_XOFF (BV16_MAXPP + 1) /* Offset for x() frame */
43 #define BV16_LTMOFF (BV16_MAXPP + 1) /* Long-Term filter Memory OFFset */
44 #define BV16_LSPPORDER 8 /* LSP MA Predictor ORDER */
45 #define BV16_NSTORDER 8 /* Pole-zero NFC shaping filter */
46 #define BV16_LGPORDER 8 /* Log-Gain Predictor OODER */
47 #define BV16_DECF 4 /* DECimation Factor for coarse pitch period search */
48 #define BV16_XDOFF (BV16_LXD - BV16_FRSZD)
49 
50 #define BV16_FRSZD (BV16_FRSZ/BV16_DECF) /* FRame SiZe in DECF:1 lowband domain */
51 #define BV16_PWSZD (BV16_PWSZ/BV16_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
52 #define BV16_MAXPPD (BV16_MAXPP/BV16_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
53 #define BV16_LXD (BV16_MAXPPD + 1 + BV16_PWSZD)
54 
55 #define BV32_FRSZ 80 /* Frame size */
56 #define BV32_MAXPP 265 /* MAXimum Pitch Period */
57 #define BV32_PWSZ 240 /* Pitch analysis Window SiZe for 8kHz lowband */
58 #define BV32_XOFF (BV32_MAXPP + 1) /* offset for x() frame */
59 #define BV32_LTMOFF (BV32_MAXPP + 1) /* Long-Term filter Memory OFFset */
60 #define BV32_LSPPORDER 8 /* LSP MA Predictor ORDER */
61 #define BV32_PFO 1 /* Preemphasis filter order */
62 #define BV32_LGPORDER 16 /* Log-Gain Predictor OODER */
63 #define BV32_DECF 8 /* DECimation Factor for coarse pitch period search */
64 #define BV32_XDOFF (BV32_LXD - BV32_FRSZD)
65 
66 #define BV32_FRSZD (BV32_FRSZ/BV32_DECF) /* FRame SiZe in DECF:1 lowband domain */
67 #define BV32_PWSZD (BV32_PWSZ/BV32_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */
68 #define BV32_MAXPPD (BV32_MAXPP/BV32_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */
69 #define BV32_LXD (BV32_MAXPPD + 1 + BV32_PWSZD)
70 
72 {
73  Float stsym[LPCO];
74  Float ltsym[BV16_LTMOFF];
75  Float lsppm[LPCO*BV16_LSPPORDER];
76  Float lgpm[BV16_LGPORDER];
77  Float lsplast[LPCO];
78  Float prevlg[2];
79  Float lmax; /* level-adaptation */
80  Float lmin;
81  Float lmean;
82  Float x1;
83  Float level;
84  int16_t pp_last;
85  int16_t ngfae;
86  Float bq_last[3];
87  int16_t nggalgc;
88  Float estl_alpha_min;
89  int16_t cfecount;
90  uint32_t idum;
91  Float E;
92  Float per;
93  Float atplc[LPCO + 1];
94  Float ma_a;
95  Float b_prv[2];
96  Float xq[BV16_XQOFF];
97  int pp_prv;
98 };
99 
101 {
102  Float x[BV16_XOFF]; /* 8kHz down-sampled signal memory */
103  Float xwd[BV16_XDOFF]; /* memory of DECF:1 decimated version of xw() */
104  Float dq[BV16_XOFF]; /* quantized short-term pred error */
105  Float dfm[DFO]; /* decimated xwd() filter memory */
106  Float stpem[LPCO]; /* ST Pred. Error filter memory */
107  Float stwpm[LPCO]; /* ST Weighting all-Pole Memory */
108  Float stsym[LPCO]; /* ST Synthesis filter Memory */
109  Float ltsym[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term synthesis filter memory */
110  Float ltnfm[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term noise feedback filter memory */
111  Float lsplast[LPCO];
112  Float lsppm[LPCO*BV16_LSPPORDER]; /* LSP Predictor Memory */
113  Float lgpm[BV16_LGPORDER];
114  Float hpfzm[HPO];
115  Float hpfpm[HPO];
116  Float prevlg[2];
117  Float lmax; /* level-adaptation */
118  Float lmin;
119  Float lmean;
120  Float x1;
121  Float level;
122  int cpplast; /* pitch period pf the previous frame */
123  Float old_A[LPCO + 1];
124  Float stnfz[BV16_NSTORDER];
125  Float stnfp[BV16_NSTORDER];
126 };
127 
129 {
130  Float stsym[LPCO];
131  Float ltsym[BV32_LTMOFF];
132  Float lsppm[LPCO*BV32_LSPPORDER];
133  Float lgpm[BV32_LGPORDER];
134  Float lsplast[LPCO];
135  Float dezfm[BV32_PFO];
136  Float depfm[BV32_PFO];
137  int16_t cfecount;
138  uint32_t idum;
139  Float E;
140  Float scplcg;
141  Float per;
142  Float atplc[LPCO + 1];
143  int16_t pp_last;
144  Float prevlg[2];
145  Float lgq_last;
146  Float bq_last[3];
147  Float lmax; /* level-adaptation */
148  Float lmin;
149  Float lmean;
150  Float x1;
151  Float level;
152  int16_t nclglim;
153  int16_t lctimer;
154 };
155 
157 {
158  Float x[BV32_XOFF];
159  Float xwd[BV32_XDOFF]; /* Memory of DECF:1 decimated version of xw() */
160  Float dq[BV32_XOFF]; /* Quantized short-term pred error */
161  Float dfm[DFO]; /* Decimated xwd() filter memory */
162  Float stpem[LPCO]; /* ST Pred. Error filter memory, low-band */
163  Float stwpm[LPCO]; /* ST Weighting all-Pole Memory, low-band */
164  Float stnfm[LPCO]; /* ST Noise Feedback filter Memory, Lowband */
165  Float stsym[LPCO]; /* ST Synthesis filter Memory, Lowband */
166  Float ltsym[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term synthesis filter memory */
167  Float ltnfm[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term noise feedback filter memory */
168  Float lsplast[LPCO];
169  Float lsppm[LPCO*BV32_LSPPORDER]; /* LSP Predictor Memory */
170  Float lgpm[BV32_LGPORDER];
171  Float hpfzm[HPO];
172  Float hpfpm[HPO];
173  Float prevlg[2];
174  Float lmax; /* level-adaptation */
175  Float lmin;
176  Float lmean;
177  Float x1;
178  Float level;
179  int cpplast; /* pitch period pf the previous frame */
180  Float allast[LPCO + 1];
181 };
182 
183 #endif
184 /*- End of file ------------------------------------------------------------*/
Definition: broadvoice/private/broadvoice.h:100
Definition: broadvoice/private/broadvoice.h:71
Definition: broadvoice/private/broadvoice.h:156
Definition: broadvoice/private/broadvoice.h:128