Asterisk - The Open Source Telephony Project GIT-master-f36a736
Functions
StateConstructW.c File Reference
#include <math.h>
#include <string.h>
#include "iLBC_define.h"
#include "constants.h"
#include "filter.h"
Include dependency graph for StateConstructW.c:

Go to the source code of this file.

Functions

void StateConstructW (int idxForMax, int *idxVec, float *syntDenum, float *out, int len)
 

Function Documentation

◆ StateConstructW()

void StateConstructW ( int  idxForMax,
int *  idxVec,
float *  syntDenum,
float *  out,
int  len 
)

Definition at line 24 of file StateConstructW.c.

36 {
37 float maxVal, tmpbuf[LPC_FILTERORDER+2*STATE_LEN], *tmp,
38 numerator[LPC_FILTERORDER+1];
39 float foutbuf[LPC_FILTERORDER+2*STATE_LEN], *fout;
40 int k,tmpi;
41
42 /* decoding of the maximum value */
43
44 maxVal = state_frgqTbl[idxForMax];
45 maxVal = (float)pow(10,maxVal)/(float)4.5;
46
47 /* initialization of buffers and coefficients */
48
49 memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float));
50 memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float));
51 for (k=0; k<LPC_FILTERORDER; k++) {
52 numerator[k]=syntDenum[LPC_FILTERORDER-k];
53 }
54 numerator[LPC_FILTERORDER]=syntDenum[0];
55 tmp = &tmpbuf[LPC_FILTERORDER];
56 fout = &foutbuf[LPC_FILTERORDER];
57
58 /* decoding of the sample values */
59
60 for (k=0; k<len; k++) {
61 tmpi = len-1-k;
62 /* maxVal = 1/scal */
63 tmp[k] = maxVal*state_sq3Tbl[idxVec[tmpi]];
64 }
65
66 /* circular convolution with all-pass filter */
67
68 memset(tmp+len, 0, len*sizeof(float));
69 ZeroPoleFilter(tmp, numerator, syntDenum, 2*len,
70 LPC_FILTERORDER, fout);
71 for (k=0;k<len;k++) {
72 out[k] = fout[len-1-k]+fout[2*len-1-k];
73 }
74 }
static int tmp()
Definition: bt_open.c:389
float state_sq3Tbl[8]
Definition: constants.c:97
float state_frgqTbl[64]
Definition: constants.c:108
void ZeroPoleFilter(float *In, float *ZeroCoef, float *PoleCoef, int lengthInOut, int orderCoef, float *Out)
Definition: filter.c:80
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define STATE_LEN
Definition: iLBC_define.h:34
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
FILE * out
Definition: utils/frame.c:33

References len(), LPC_FILTERORDER, out, state_frgqTbl, STATE_LEN, state_sq3Tbl, tmp(), and ZeroPoleFilter().

Referenced by Decode(), and iLBC_encode().