~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/third_party/ilbc/StateConstructW.c

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
   /******************************************************************
3
 
 
4
 
       iLBC Speech Coder ANSI-C Source Code
5
 
 
6
 
       StateConstructW.c
7
 
 
8
 
       Copyright (C) The Internet Society (2004).
9
 
       All Rights Reserved.
10
 
 
11
 
   ******************************************************************/
12
 
 
13
 
   #include <math.h>
14
 
   #include <string.h>
15
 
 
16
 
   #include "iLBC_define.h"
17
 
   #include "constants.h"
18
 
   #include "filter.h"
19
 
 
20
 
   /*----------------------------------------------------------------*
21
 
    *  decoding of the start state
22
 
    *---------------------------------------------------------------*/
23
 
 
24
 
   void StateConstructW(
25
 
       int idxForMax,      /* (i) 6-bit index for the quantization of
26
 
                                  max amplitude */
27
 
       int *idxVec,    /* (i) vector of quantization indexes */
28
 
       float *syntDenum,   /* (i) synthesis filter denumerator */
29
 
 
30
 
 
31
 
 
32
 
 
33
 
 
34
 
       float *out,         /* (o) the decoded state vector */
35
 
       int len             /* (i) length of a state vector */
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
 
   }