Asterisk - The Open Source Telephony Project  18.5.0
Functions
LPCdecode.c File Reference
#include <math.h>
#include <string.h>
#include "helpfun.h"
#include "lsf.h"
#include "iLBC_define.h"
#include "constants.h"
Include dependency graph for LPCdecode.c:

Go to the source code of this file.

Functions

void DecoderInterpolateLSF (float *syntdenum, float *weightdenum, float *lsfdeq, int length, iLBC_Dec_Inst_t *iLBCdec_inst)
 
void LSFinterpolate2a_dec (float *a, float *lsf1, float *lsf2, float coef, int length)
 
void SimplelsfDEQ (float *lsfdeq, int *index, int lpc_n)
 

Function Documentation

◆ DecoderInterpolateLSF()

void DecoderInterpolateLSF ( float *  syntdenum,
float *  weightdenum,
float *  lsfdeq,
int  length,
iLBC_Dec_Inst_t iLBCdec_inst 
)

Definition at line 89 of file LPCdecode.c.

References bwexpand(), LPC_CHIRP_WEIGHTDENUM, LPC_FILTERORDER, lsf_weightTbl_20ms, lsf_weightTbl_30ms, iLBC_Dec_Inst_t_::lsfdeqold, LSFinterpolate2a_dec(), iLBC_Dec_Inst_t_::mode, and iLBC_Dec_Inst_t_::nsub.

Referenced by iLBC_decode().

97  {
98  int i, pos, lp_length;
99  float lp[LPC_FILTERORDER + 1], *lsfdeq2;
100 
101 
102 
103 
104 
105 
106  lsfdeq2 = lsfdeq + length;
107  lp_length = length + 1;
108 
109  if (iLBCdec_inst->mode==30) {
110  /* sub-frame 1: Interpolation between old and first */
111 
112  LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
113  lsf_weightTbl_30ms[0], length);
114  memcpy(syntdenum,lp,lp_length*sizeof(float));
115  bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM,
116  lp_length);
117 
118  /* sub-frames 2 to 6: interpolation between first
119  and last LSF */
120 
121  pos = lp_length;
122  for (i = 1; i < 6; i++) {
123  LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2,
124  lsf_weightTbl_30ms[i], length);
125  memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
126  bwexpand(weightdenum + pos, lp,
127  LPC_CHIRP_WEIGHTDENUM, lp_length);
128  pos += lp_length;
129  }
130  }
131  else {
132  pos = 0;
133  for (i = 0; i < iLBCdec_inst->nsub; i++) {
134  LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold,
135  lsfdeq, lsf_weightTbl_20ms[i], length);
136  memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
137  bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM,
138  lp_length);
139  pos += lp_length;
140  }
141  }
142 
143  /* update memory */
144 
145  if (iLBCdec_inst->mode==30)
146  memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2,
147  length*sizeof(float));
148  else
149  memcpy(iLBCdec_inst->lsfdeqold, lsfdeq,
150  length*sizeof(float));
151 
152  }
float lsfdeqold[LPC_FILTERORDER]
Definition: iLBC_define.h:190
#define LPC_CHIRP_WEIGHTDENUM
Definition: iLBC_define.h:42
void bwexpand(float *out, float *in, float coef, int length)
Definition: helpfun.c:136
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
float lsf_weightTbl_20ms[4]
Definition: constants.c:220
float lsf_weightTbl_30ms[6]
Definition: constants.c:216
void LSFinterpolate2a_dec(float *a, float *lsf1, float *lsf2, float coef, int length)
Definition: LPCdecode.c:25

◆ LSFinterpolate2a_dec()

void LSFinterpolate2a_dec ( float *  a,
float *  lsf1,
float *  lsf2,
float  coef,
int  length 
)

Definition at line 25 of file LPCdecode.c.

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

Referenced by DecoderInterpolateLSF().

31  {
32  float lsftmp[LPC_FILTERORDER];
33 
34  interpolate(lsftmp, lsf1, lsf2, coef, length);
35  lsf2a(a, lsftmp);
36  }
void interpolate(float *out, float *in1, float *in2, float coef, int length)
Definition: helpfun.c:114
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
void lsf2a(float *a_coef, float *freq)
Definition: lsf.c:170
static struct test_val a

◆ SimplelsfDEQ()

void SimplelsfDEQ ( float *  lsfdeq,
int *  index,
int  lpc_n 
)

Definition at line 42 of file LPCdecode.c.

References dim_lsfCbTbl, LPC_FILTERORDER, LSF_NSPLIT, lsfCbTbl, and size_lsfCbTbl.

Referenced by iLBC_decode().

46  {
47  int i, j, pos, cb_pos;
48 
49 
50 
51 
52 
53  /* decode first LSF */
54 
55  pos = 0;
56  cb_pos = 0;
57  for (i = 0; i < LSF_NSPLIT; i++) {
58  for (j = 0; j < dim_lsfCbTbl[i]; j++) {
59  lsfdeq[pos + j] = lsfCbTbl[cb_pos +
60  (long)(index[i])*dim_lsfCbTbl[i] + j];
61  }
62  pos += dim_lsfCbTbl[i];
63  cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
64  }
65 
66  if (lpc_n>1) {
67 
68  /* decode last LSF */
69 
70  pos = 0;
71  cb_pos = 0;
72  for (i = 0; i < LSF_NSPLIT; i++) {
73  for (j = 0; j < dim_lsfCbTbl[i]; j++) {
74  lsfdeq[LPC_FILTERORDER + pos + j] =
75  lsfCbTbl[cb_pos +
76  (long)(index[LSF_NSPLIT + i])*
77  dim_lsfCbTbl[i] + j];
78  }
79  pos += dim_lsfCbTbl[i];
80  cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
81  }
82  }
83  }
float lsfCbTbl[64 *3+128 *3+128 *4]
Definition: constants.c:413
#define LSF_NSPLIT
Definition: iLBC_define.h:50
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
int dim_lsfCbTbl[LSF_NSPLIT]
Definition: constants.c:202
int size_lsfCbTbl[LSF_NSPLIT]
Definition: constants.c:203