|
libg722_1
0.0.1
|
00001 /* 00002 * broadvoice - a library for the BroadVoice 16 and 32 codecs 00003 * 00004 * broadvoice.h - The head guy amongst the headers 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2009 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 * $Id: broadvoice.h,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ 00025 */ 00026 00027 /*! \file */ 00028 00029 #if !defined(_BROADVOICE_PRIVATE_BROADVOICE_H_) 00030 #define _BROADVOICE_PRIVATE_BROADVOICE_H_ 00031 00032 typedef double Float; 00033 00034 #define LPCO 8 /* LPC Order */ 00035 #define HPO 2 /* Front end 150Hz high-pass filter order */ 00036 #define DFO 4 00037 00038 #define BV16_FRSZ 40 /* Frame size */ 00039 #define BV16_MAXPP 137 /* MAXimum Pitch Period */ 00040 #define BV16_PWSZ 120 /* Pitch analysis Window SiZe */ 00041 #define BV16_XQOFF (BV16_MAXPP + 1) /* xq() offset before current subframe */ 00042 #define BV16_XOFF (BV16_MAXPP + 1) /* Offset for x() frame */ 00043 #define BV16_LTMOFF (BV16_MAXPP + 1) /* Long-Term filter Memory OFFset */ 00044 #define BV16_LSPPORDER 8 /* LSP MA Predictor ORDER */ 00045 #define BV16_NSTORDER 8 /* Pole-zero NFC shaping filter */ 00046 #define BV16_LGPORDER 8 /* Log-Gain Predictor OODER */ 00047 #define BV16_DECF 4 /* DECimation Factor for coarse pitch period search */ 00048 #define BV16_XDOFF (BV16_LXD - BV16_FRSZD) 00049 00050 #define BV16_FRSZD (BV16_FRSZ/BV16_DECF) /* FRame SiZe in DECF:1 lowband domain */ 00051 #define BV16_PWSZD (BV16_PWSZ/BV16_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */ 00052 #define BV16_MAXPPD (BV16_MAXPP/BV16_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */ 00053 #define BV16_LXD (BV16_MAXPPD + 1 + BV16_PWSZD) 00054 00055 #define BV32_FRSZ 80 /* Frame size */ 00056 #define BV32_MAXPP 265 /* MAXimum Pitch Period */ 00057 #define BV32_PWSZ 240 /* Pitch analysis Window SiZe for 8kHz lowband */ 00058 #define BV32_XOFF (BV32_MAXPP + 1) /* offset for x() frame */ 00059 #define BV32_LTMOFF (BV32_MAXPP + 1) /* Long-Term filter Memory OFFset */ 00060 #define BV32_LSPPORDER 8 /* LSP MA Predictor ORDER */ 00061 #define BV32_PFO 1 /* Preemphasis filter order */ 00062 #define BV32_LGPORDER 16 /* Log-Gain Predictor OODER */ 00063 #define BV32_DECF 8 /* DECimation Factor for coarse pitch period search */ 00064 #define BV32_XDOFF (BV32_LXD - BV32_FRSZD) 00065 00066 #define BV32_FRSZD (BV32_FRSZ/BV32_DECF) /* FRame SiZe in DECF:1 lowband domain */ 00067 #define BV32_PWSZD (BV32_PWSZ/BV32_DECF) /* Pitch ana. Window SiZe in DECF:1 domain */ 00068 #define BV32_MAXPPD (BV32_MAXPP/BV32_DECF) /* MAX Pitch in DECF:1, if MAXPP!=4n, ceil() */ 00069 #define BV32_LXD (BV32_MAXPPD + 1 + BV32_PWSZD) 00070 00071 struct bv16_decode_state_s 00072 { 00073 Float stsym[LPCO]; 00074 Float ltsym[BV16_LTMOFF]; 00075 Float lsppm[LPCO*BV16_LSPPORDER]; 00076 Float lgpm[BV16_LGPORDER]; 00077 Float lsplast[LPCO]; 00078 Float prevlg[2]; 00079 Float lmax; /* level-adaptation */ 00080 Float lmin; 00081 Float lmean; 00082 Float x1; 00083 Float level; 00084 int16_t pp_last; 00085 int16_t ngfae; 00086 Float bq_last[3]; 00087 int16_t nggalgc; 00088 Float estl_alpha_min; 00089 int16_t cfecount; 00090 uint32_t idum; 00091 Float E; 00092 Float per; 00093 Float atplc[LPCO + 1]; 00094 Float ma_a; 00095 Float b_prv[2]; 00096 Float xq[BV16_XQOFF]; 00097 int pp_prv; 00098 }; 00099 00100 struct bv16_encode_state_s 00101 { 00102 Float x[BV16_XOFF]; /* 8kHz down-sampled signal memory */ 00103 Float xwd[BV16_XDOFF]; /* memory of DECF:1 decimated version of xw() */ 00104 Float dq[BV16_XOFF]; /* quantized short-term pred error */ 00105 Float dfm[DFO]; /* decimated xwd() filter memory */ 00106 Float stpem[LPCO]; /* ST Pred. Error filter memory */ 00107 Float stwpm[LPCO]; /* ST Weighting all-Pole Memory */ 00108 Float stsym[LPCO]; /* ST Synthesis filter Memory */ 00109 Float ltsym[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term synthesis filter memory */ 00110 Float ltnfm[BV16_MAXPP + 1 + BV16_FRSZ]; /* long-term noise feedback filter memory */ 00111 Float lsplast[LPCO]; 00112 Float lsppm[LPCO*BV16_LSPPORDER]; /* LSP Predictor Memory */ 00113 Float lgpm[BV16_LGPORDER]; 00114 Float hpfzm[HPO]; 00115 Float hpfpm[HPO]; 00116 Float prevlg[2]; 00117 Float lmax; /* level-adaptation */ 00118 Float lmin; 00119 Float lmean; 00120 Float x1; 00121 Float level; 00122 int cpplast; /* pitch period pf the previous frame */ 00123 Float old_A[LPCO + 1]; 00124 Float stnfz[BV16_NSTORDER]; 00125 Float stnfp[BV16_NSTORDER]; 00126 }; 00127 00128 struct bv32_decode_state_s 00129 { 00130 Float stsym[LPCO]; 00131 Float ltsym[BV32_LTMOFF]; 00132 Float lsppm[LPCO*BV32_LSPPORDER]; 00133 Float lgpm[BV32_LGPORDER]; 00134 Float lsplast[LPCO]; 00135 Float dezfm[BV32_PFO]; 00136 Float depfm[BV32_PFO]; 00137 int16_t cfecount; 00138 uint32_t idum; 00139 Float E; 00140 Float scplcg; 00141 Float per; 00142 Float atplc[LPCO + 1]; 00143 int16_t pp_last; 00144 Float prevlg[2]; 00145 Float lgq_last; 00146 Float bq_last[3]; 00147 Float lmax; /* level-adaptation */ 00148 Float lmin; 00149 Float lmean; 00150 Float x1; 00151 Float level; 00152 int16_t nclglim; 00153 int16_t lctimer; 00154 }; 00155 00156 struct bv32_encode_state_s 00157 { 00158 Float x[BV32_XOFF]; 00159 Float xwd[BV32_XDOFF]; /* Memory of DECF:1 decimated version of xw() */ 00160 Float dq[BV32_XOFF]; /* Quantized short-term pred error */ 00161 Float dfm[DFO]; /* Decimated xwd() filter memory */ 00162 Float stpem[LPCO]; /* ST Pred. Error filter memory, low-band */ 00163 Float stwpm[LPCO]; /* ST Weighting all-Pole Memory, low-band */ 00164 Float stnfm[LPCO]; /* ST Noise Feedback filter Memory, Lowband */ 00165 Float stsym[LPCO]; /* ST Synthesis filter Memory, Lowband */ 00166 Float ltsym[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term synthesis filter memory */ 00167 Float ltnfm[BV32_MAXPP + 1 + BV32_FRSZ]; /* Long-term noise feedback filter memory */ 00168 Float lsplast[LPCO]; 00169 Float lsppm[LPCO*BV32_LSPPORDER]; /* LSP Predictor Memory */ 00170 Float lgpm[BV32_LGPORDER]; 00171 Float hpfzm[HPO]; 00172 Float hpfpm[HPO]; 00173 Float prevlg[2]; 00174 Float lmax; /* level-adaptation */ 00175 Float lmin; 00176 Float lmean; 00177 Float x1; 00178 Float level; 00179 int cpplast; /* pitch period pf the previous frame */ 00180 Float allast[LPCO + 1]; 00181 }; 00182 00183 #endif 00184 /*- End of file ------------------------------------------------------------*/