Asterisk - The Open Source Telephony Project GIT-master-1f1c5bb
Functions
iCBConstruct.c File Reference
#include <math.h>
#include "iLBC_define.h"
#include "gainquant.h"
#include "getCBvec.h"
Include dependency graph for iCBConstruct.c:

Go to the source code of this file.

Functions

void iCBConstruct (float *decvector, int *index, int *gain_index, float *mem, int lMem, int veclen, int nStages)
 
void index_conv_dec (int *index)
 
void index_conv_enc (int *index)
 

Function Documentation

◆ iCBConstruct()

void iCBConstruct ( float *  decvector,
int *  index,
int *  gain_index,
float *  mem,
int  lMem,
int  veclen,
int  nStages 
)

Definition at line 66 of file iCBConstruct.c.

74 {
75 int j,k;
76
77
78
79
80
81 float gain[CB_NSTAGES];
82 float cbvec[SUBL];
83
84 /* gain de-quantization */
85
86 gain[0] = gaindequant(gain_index[0], 1.0, 32);
87 if (nStages > 1) {
88 gain[1] = gaindequant(gain_index[1],
89 (float)fabs(gain[0]), 16);
90 }
91 if (nStages > 2) {
92 gain[2] = gaindequant(gain_index[2],
93 (float)fabs(gain[1]), 8);
94 }
95
96 /* codebook vector construction and construction of
97 total vector */
98
99 getCBvec(cbvec, mem, index[0], lMem, veclen);
100 for (j=0;j<veclen;j++){
101 decvector[j] = gain[0]*cbvec[j];
102 }
103 if (nStages > 1) {
104 for (k=1; k<nStages; k++) {
105 getCBvec(cbvec, mem, index[k], lMem, veclen);
106 for (j=0;j<veclen;j++) {
107 decvector[j] += gain[k]*cbvec[j];
108 }
109 }
110 }
111 }
float gaindequant(int index, float maxIn, int cblen)
Definition: gainquant.c:83
void getCBvec(float *cbvec, float *mem, int index, int lMem, int cbveclen)
Definition: getCBvec.c:21
#define CB_NSTAGES
Definition: iLBC_define.h:56
#define SUBL
Definition: iLBC_define.h:33

References CB_NSTAGES, gaindequant(), getCBvec(), and SUBL.

Referenced by Decode(), and iLBC_encode().

◆ index_conv_dec()

void index_conv_dec ( int *  index)

Definition at line 45 of file iCBConstruct.c.

47 {
48 int k;
49
50 for (k=1; k<CB_NSTAGES; k++) {
51
52 if ((index[k]>=44)&&(index[k]<108)) {
53 index[k]+=64;
54 } else if ((index[k]>=108)&&(index[k]<128)) {
55 index[k]+=128;
56 } else {
57 /* ERROR */
58 }
59 }
60 }

References CB_NSTAGES.

Referenced by iLBC_decode().

◆ index_conv_enc()

void index_conv_enc ( int *  index)

Definition at line 28 of file iCBConstruct.c.

30 {
31 int k;
32
33 for (k=1; k<CB_NSTAGES; k++) {
34
35 if ((index[k]>=108)&&(index[k]<172)) {
36 index[k]-=64;
37 } else if (index[k]>=236) {
38 index[k]-=128;
39 } else {
40 /* ERROR */
41 }
42 }
43 }

References CB_NSTAGES.

Referenced by iLBC_encode().