Asterisk - The Open Source Telephony Project GIT-master-1f1c5bb
Functions
LPCencode.c File Reference
#include <string.h>
#include "iLBC_define.h"
#include "helpfun.h"
#include "lsf.h"
#include "constants.h"
Include dependency graph for LPCencode.c:

Go to the source code of this file.

Functions

void LPCencode (float *syntdenum, float *weightdenum, int *lsf_index, float *data, iLBC_Enc_Inst_t *iLBCenc_inst)
 
void LSFinterpolate2a_enc (float *a, float *lsf1, float *lsf2, float coef, long length)
 
void SimpleAnalysis (float *lsf, float *data, iLBC_Enc_Inst_t *iLBCenc_inst)
 
void SimpleInterpolateLSF (float *syntdenum, float *weightdenum, float *lsf, float *lsfdeq, float *lsfold, float *lsfdeqold, int length, iLBC_Enc_Inst_t *iLBCenc_inst)
 
void SimplelsfQ (float *lsfdeq, int *index, float *lsf, int lpc_n)
 

Function Documentation

◆ LPCencode()

void LPCencode ( float *  syntdenum,
float *  weightdenum,
int *  lsf_index,
float *  data,
iLBC_Enc_Inst_t iLBCenc_inst 
)

Definition at line 214 of file LPCencode.c.

224 {
225 float lsf[LPC_FILTERORDER * LPC_N_MAX];
226 float lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
227
228 SimpleAnalysis(lsf, data, iLBCenc_inst);
229 SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
230
231
232
233
234 LSF_check(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n);
235 SimpleInterpolateLSF(syntdenum, weightdenum,
236 lsf, lsfdeq, iLBCenc_inst->lsfold,
237 iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst);
238 }
void SimpleAnalysis(float *lsf, float *data, iLBC_Enc_Inst_t *iLBCenc_inst)
Definition: LPCencode.c:28
void SimplelsfQ(float *lsfdeq, int *index, float *lsf, int lpc_n)
Definition: LPCencode.c:190
void SimpleInterpolateLSF(float *syntdenum, float *weightdenum, float *lsf, float *lsfdeq, float *lsfold, float *lsfdeqold, int length, iLBC_Enc_Inst_t *iLBCenc_inst)
Definition: LPCencode.c:99
int LSF_check(float *lsf, int dim, int NoAn)
Definition: helpfun.c:272
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
#define LPC_N_MAX
Definition: iLBC_define.h:46
float lsfold[LPC_FILTERORDER]
Definition: iLBC_define.h:150
float lsfdeqold[LPC_FILTERORDER]
Definition: iLBC_define.h:151

References LPC_FILTERORDER, iLBC_Enc_Inst_t_::lpc_n, LPC_N_MAX, LSF_check(), iLBC_Enc_Inst_t_::lsfdeqold, iLBC_Enc_Inst_t_::lsfold, SimpleAnalysis(), SimpleInterpolateLSF(), and SimplelsfQ().

Referenced by iLBC_encode().

◆ LSFinterpolate2a_enc()

void LSFinterpolate2a_enc ( float *  a,
float *  lsf1,
float *  lsf2,
float  coef,
long  length 
)

Definition at line 81 of file LPCencode.c.

88 {
89 float lsftmp[LPC_FILTERORDER];
90
91 interpolate(lsftmp, lsf1, lsf2, coef, length);
92 lsf2a(a, lsftmp);
93 }
void interpolate(float *out, float *in1, float *in2, float coef, int length)
Definition: helpfun.c:114
void lsf2a(float *a_coef, float *freq)
Definition: lsf.c:170
static struct test_val a

References a, interpolate(), LPC_FILTERORDER, and lsf2a().

Referenced by SimpleInterpolateLSF().

◆ SimpleAnalysis()

void SimpleAnalysis ( float *  lsf,
float *  data,
iLBC_Enc_Inst_t iLBCenc_inst 
)

Definition at line 28 of file LPCencode.c.

33 {
34 int k, is;
35 float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1];
36 float lp2[LPC_FILTERORDER + 1];
37 float r[LPC_FILTERORDER + 1];
38
39 is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
40 memcpy(iLBCenc_inst->lpc_buffer+is,data,
41 iLBCenc_inst->blockl*sizeof(float));
42
43 /* No lookahead, last window is asymmetric */
44
45 for (k = 0; k < iLBCenc_inst->lpc_n; k++) {
46
47 is = LPC_LOOKBACK;
48
49 if (k < (iLBCenc_inst->lpc_n - 1)) {
50 window(temp, lpc_winTbl,
51 iLBCenc_inst->lpc_buffer, BLOCKL_MAX);
52 } else {
54 iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX);
55 }
56
59
60 levdurb(lp, temp, r, LPC_FILTERORDER);
62
63 a2lsf(lsf + k*LPC_FILTERORDER, lp2);
64 }
65 is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
66 memmove(iLBCenc_inst->lpc_buffer,
67 iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is,
68 is*sizeof(float));
69 }
float lpc_winTbl[BLOCKL_MAX]
Definition: constants.c:224
float lpc_asymwinTbl[BLOCKL_MAX]
Definition: constants.c:317
float lpc_lagwinTbl[LPC_FILTERORDER+1]
Definition: constants.c:406
char window[WINSIZE]
Definition: eagi_proxy.c:69
void autocorr(float *r, const float *x, int N, int order)
Definition: helpfun.c:22
void levdurb(float *a, float *k, float *r, int order)
Definition: helpfun.c:67
void bwexpand(float *out, float *in, float coef, int length)
Definition: helpfun.c:136
#define LPC_CHIRP_SYNTDENUM
Definition: iLBC_define.h:41
#define LPC_LOOKBACK
Definition: iLBC_define.h:43
#define BLOCKL_MAX
Definition: iLBC_define.h:21
void a2lsf(float *freq, float *a)
Definition: lsf.c:27
float lpc_buffer[LPC_LOOKBACK+BLOCKL_MAX]
Definition: iLBC_define.h:154

References a2lsf(), autocorr(), iLBC_Enc_Inst_t_::blockl, BLOCKL_MAX, bwexpand(), levdurb(), lpc_asymwinTbl, iLBC_Enc_Inst_t_::lpc_buffer, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER, lpc_lagwinTbl, LPC_LOOKBACK, iLBC_Enc_Inst_t_::lpc_n, lpc_winTbl, and window.

Referenced by LPCencode().

◆ SimpleInterpolateLSF()

void SimpleInterpolateLSF ( float *  syntdenum,
float *  weightdenum,
float *  lsf,
float *  lsfdeq,
float *  lsfold,
float *  lsfdeqold,
int  length,
iLBC_Enc_Inst_t iLBCenc_inst 
)

Definition at line 99 of file LPCencode.c.

115 {
116 int i, pos, lp_length;
117 float lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2;
118
119 lsf2 = lsf + length;
120 lsfdeq2 = lsfdeq + length;
121 lp_length = length + 1;
122
123 if (iLBCenc_inst->mode==30) {
124 /* sub-frame 1: Interpolation between old and first
125
126
127
128
129
130 set of lsf coefficients */
131
132 LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
133 lsf_weightTbl_30ms[0], length);
134 memcpy(syntdenum,lp,lp_length*sizeof(float));
135 LSFinterpolate2a_enc(lp, lsfold, lsf,
136 lsf_weightTbl_30ms[0], length);
137 bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
138
139 /* sub-frame 2 to 6: Interpolation between first
140 and second set of lsf coefficients */
141
142 pos = lp_length;
143 for (i = 1; i < iLBCenc_inst->nsub; i++) {
144 LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2,
145 lsf_weightTbl_30ms[i], length);
146 memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
147
148 LSFinterpolate2a_enc(lp, lsf, lsf2,
149 lsf_weightTbl_30ms[i], length);
150 bwexpand(weightdenum + pos, lp,
151 LPC_CHIRP_WEIGHTDENUM, lp_length);
152 pos += lp_length;
153 }
154 }
155 else {
156 pos = 0;
157 for (i = 0; i < iLBCenc_inst->nsub; i++) {
158 LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
159 lsf_weightTbl_20ms[i], length);
160 memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
161 LSFinterpolate2a_enc(lp, lsfold, lsf,
162 lsf_weightTbl_20ms[i], length);
163 bwexpand(weightdenum+pos, lp,
164 LPC_CHIRP_WEIGHTDENUM, lp_length);
165 pos += lp_length;
166 }
167 }
168
169 /* update memory */
170
171 if (iLBCenc_inst->mode==30) {
172 memcpy(lsfold, lsf2, length*sizeof(float));
173 memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
174 }
175 else {
176 memcpy(lsfold, lsf, length*sizeof(float));
177 memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
178
179
180
181
182
183 }
184 }
void LSFinterpolate2a_enc(float *a, float *lsf1, float *lsf2, float coef, long length)
Definition: LPCencode.c:81
float lsf_weightTbl_20ms[4]
Definition: constants.c:220
float lsf_weightTbl_30ms[6]
Definition: constants.c:216
#define LPC_CHIRP_WEIGHTDENUM
Definition: iLBC_define.h:42

References bwexpand(), LPC_CHIRP_WEIGHTDENUM, LPC_FILTERORDER, lsf_weightTbl_20ms, lsf_weightTbl_30ms, LSFinterpolate2a_enc(), iLBC_Enc_Inst_t_::mode, and iLBC_Enc_Inst_t_::nsub.

Referenced by LPCencode().

◆ SimplelsfQ()

void SimplelsfQ ( float *  lsfdeq,
int *  index,
float *  lsf,
int  lpc_n 
)

Definition at line 190 of file LPCencode.c.

197 {
198 /* Quantize first LSF with memoryless split VQ */
199 SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT,
201
202 if (lpc_n==2) {
203 /* Quantize second LSF with memoryless split VQ */
204 SplitVQ(lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT,
207 }
208 }
int size_lsfCbTbl[LSF_NSPLIT]
Definition: constants.c:203
int dim_lsfCbTbl[LSF_NSPLIT]
Definition: constants.c:202
float lsfCbTbl[64 *3+128 *3+128 *4]
Definition: constants.c:413
void SplitVQ(float *qX, int *index, float *X, const float *CB, int nsplit, const int *dim, const int *cbsize)
Definition: helpfun.c:209
#define LSF_NSPLIT
Definition: iLBC_define.h:50

References dim_lsfCbTbl, LPC_FILTERORDER, LSF_NSPLIT, lsfCbTbl, size_lsfCbTbl, and SplitVQ().

Referenced by LPCencode().