diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-19 00:19:29 +0000 |
commit | f8247040e6231c4b3b5099ea3a526348b7941566 (patch) | |
tree | 0cc92ad6ebf6ae49a62f6e7ef8ec819121d63630 /trunk/codecs/ilbc/StateConstructW.c | |
parent | d88e56c61ce2042544c1a8a71c93b69ab2e6ffba (diff) |
Creating tag for the release of asterisk-1.6.0-beta1v1.6.0-beta1
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0-beta1@99163 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'trunk/codecs/ilbc/StateConstructW.c')
-rw-r--r-- | trunk/codecs/ilbc/StateConstructW.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/trunk/codecs/ilbc/StateConstructW.c b/trunk/codecs/ilbc/StateConstructW.c new file mode 100644 index 000000000..e48fe035d --- /dev/null +++ b/trunk/codecs/ilbc/StateConstructW.c @@ -0,0 +1,76 @@ + +/****************************************************************** + + + + iLBC Speech Coder ANSI-C Source Code + + StateConstructW.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + +******************************************************************/ + +#include <math.h> +#include <string.h> + +#include "iLBC_define.h" +#include "StateConstructW.h" +#include "constants.h" +#include "filter.h" + +/*----------------------------------------------------------------* + * decoding of the start state + *---------------------------------------------------------------*/ + +void StateConstructW( + int idxForMax, /* (i) 6-bit index for the quantization of + max amplitude */ + int *idxVec, /* (i) vector of quantization indexes */ + float *syntDenum, /* (i) synthesis filter denumerator */ + float *out, /* (o) the decoded state vector */ + int len /* (i) length of a state vector */ +){ + float maxVal, tmpbuf[LPC_FILTERORDER+2*STATE_LEN], *tmp, + numerator[LPC_FILTERORDER+1]; + float foutbuf[LPC_FILTERORDER+2*STATE_LEN], *fout; + int k,tmpi; + + /* decoding of the maximum value */ + + maxVal = state_frgqTbl[idxForMax]; + maxVal = (float)pow(10,maxVal)/(float)4.5; + + /* initialization of buffers and coefficients */ + + memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float)); + memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float)); + for (k=0; k<LPC_FILTERORDER; k++) { + numerator[k]=syntDenum[LPC_FILTERORDER-k]; + } + numerator[LPC_FILTERORDER]=syntDenum[0]; + tmp = &tmpbuf[LPC_FILTERORDER]; + fout = &foutbuf[LPC_FILTERORDER]; + + /* decoding of the sample values */ + + for (k=0; k<len; k++) { + tmpi = len-1-k; + /* maxVal = 1/scal */ + + + tmp[k] = maxVal*state_sq3Tbl[idxVec[tmpi]]; + } + + /* circular convolution with all-pass filter */ + + memset(tmp+len, 0, len*sizeof(float)); + ZeroPoleFilter(tmp, numerator, syntDenum, 2*len, + LPC_FILTERORDER, fout); + for (k=0;k<len;k++) { + out[k] = fout[len-1-k]+fout[2*len-1-k]; + } +} + + |