2 /******************************************************************
6 iLBC Speech Coder ANSI-C Source Code
10 Copyright (C) The Internet Society (2004).
13 ******************************************************************/
18 #include "iLBC_define.h"
19 #include "StateConstructW.h"
20 #include "constants.h"
23 /*----------------------------------------------------------------*
24 * decoding of the start state
25 *---------------------------------------------------------------*/
28 int idxForMax
, /* (i) 6-bit index for the quantization of
30 int *idxVec
, /* (i) vector of quantization indexes */
31 float *syntDenum
, /* (i) synthesis filter denumerator */
32 float *out
, /* (o) the decoded state vector */
33 int len
/* (i) length of a state vector */
35 float maxVal
, tmpbuf
[LPC_FILTERORDER
+2*STATE_LEN
], *tmp
,
36 numerator
[LPC_FILTERORDER
+1];
37 float foutbuf
[LPC_FILTERORDER
+2*STATE_LEN
], *fout
;
40 /* decoding of the maximum value */
42 maxVal
= state_frgqTbl
[idxForMax
];
43 maxVal
= (float)pow(10,maxVal
)/(float)4.5;
45 /* initialization of buffers and coefficients */
47 memset(tmpbuf
, 0, LPC_FILTERORDER
*sizeof(float));
48 memset(foutbuf
, 0, LPC_FILTERORDER
*sizeof(float));
49 for (k
=0; k
<LPC_FILTERORDER
; k
++) {
50 numerator
[k
]=syntDenum
[LPC_FILTERORDER
-k
];
52 numerator
[LPC_FILTERORDER
]=syntDenum
[0];
53 tmp
= &tmpbuf
[LPC_FILTERORDER
];
54 fout
= &foutbuf
[LPC_FILTERORDER
];
56 /* decoding of the sample values */
58 for (k
=0; k
<len
; k
++) {
63 tmp
[k
] = maxVal
*state_sq3Tbl
[idxVec
[tmpi
]];
66 /* circular convolution with all-pass filter */
68 memset(tmp
+len
, 0, len
*sizeof(float));
69 ZeroPoleFilter(tmp
, numerator
, syntDenum
, 2*len
,
70 LPC_FILTERORDER
, fout
);
72 out
[k
] = fout
[len
-1-k
]+fout
[2*len
-1-k
];