2 /******************************************************************
4 iLBC Speech Coder ANSI-C Source Code
12 ******************************************************************/
17 #include "iLBC_define.h"
18 #include "constants.h"
21 /*----------------------------------------------------------------*
22 * decoding of the start state
23 *---------------------------------------------------------------*/
26 int idxForMax
, /* (i) 6-bit index for the quantization of
28 int *idxVec
, /* (i) vector of quantization indexes */
29 float *syntDenum
, /* (i) synthesis filter denumerator */
30 float *out
, /* (o) the decoded state vector */
31 int len
/* (i) length of a state vector */
33 float maxVal
, tmpbuf
[LPC_FILTERORDER
+2*STATE_LEN
], *tmp
,
34 numerator
[LPC_FILTERORDER
+1];
35 float foutbuf
[LPC_FILTERORDER
+2*STATE_LEN
], *fout
;
38 /* decoding of the maximum value */
40 maxVal
= state_frgqTbl
[idxForMax
];
41 maxVal
= (float)pow(10,maxVal
)/(float)4.5;
43 /* initialization of buffers and coefficients */
45 memset(tmpbuf
, 0, LPC_FILTERORDER
*sizeof(float));
46 memset(foutbuf
, 0, LPC_FILTERORDER
*sizeof(float));
47 for (k
=0; k
<LPC_FILTERORDER
; k
++) {
48 numerator
[k
]=syntDenum
[LPC_FILTERORDER
-k
];
50 numerator
[LPC_FILTERORDER
]=syntDenum
[0];
51 tmp
= &tmpbuf
[LPC_FILTERORDER
];
55 fout
= &foutbuf
[LPC_FILTERORDER
];
57 /* decoding of the sample values */
59 for (k
=0; k
<len
; k
++) {
62 tmp
[k
] = maxVal
*state_sq3Tbl
[idxVec
[tmpi
]];
65 /* circular convolution with all-pass filter */
67 memset(tmp
+len
, 0, len
*sizeof(float));
68 ZeroPoleFilter(tmp
, numerator
, syntDenum
, 2*len
,
69 LPC_FILTERORDER
, fout
);
71 out
[k
] = fout
[len
-1-k
]+fout
[2*len
-1-k
];