Asterisk - The Open Source Telephony Project  18.5.0
Functions
iLBC_encode.c File Reference
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "iLBC_define.h"
#include "LPCencode.h"
#include "FrameClassify.h"
#include "StateSearchW.h"
#include "StateConstructW.h"
#include "helpfun.h"
#include "constants.h"
#include "packing.h"
#include "iCBSearch.h"
#include "iCBConstruct.h"
#include "hpInput.h"
#include "anaFilter.h"
#include "syntFilter.h"
Include dependency graph for iLBC_encode.c:

Go to the source code of this file.

Functions

void iLBC_encode (unsigned char *bytes, float *block, iLBC_Enc_Inst_t *iLBCenc_inst)
 
short initEncode (iLBC_Enc_Inst_t *iLBCenc_inst, int mode)
 

Function Documentation

◆ iLBC_encode()

void iLBC_encode ( unsigned char *  bytes,
float *  block,
iLBC_Enc_Inst_t iLBCenc_inst 
)

Definition at line 89 of file iLBC_encode.c.

References anaFilter(), iLBC_Enc_Inst_t_::anaMem, iLBC_Enc_Inst_t_::blockl, BLOCKL_MAX, iLBC_ULP_Inst_t_::cb_gain, iLBC_ULP_Inst_t_::cb_index, CB_MEML, CB_NSTAGES, dopack(), iLBC_ULP_Inst_t_::extra_cb_gain, iLBC_ULP_Inst_t_::extra_cb_index, FrameClassify(), hpInput(), iCBConstruct(), iCBSearch(), index_conv_enc(), LPC_FILTERORDER, iLBC_Enc_Inst_t_::lpc_n, LPC_N_MAX, LPCencode(), iLBC_ULP_Inst_t_::lsf_bits, LSF_NSPLIT, memLfTbl, iLBC_Enc_Inst_t_::nasub, NASUB_MAX, iLBC_Enc_Inst_t_::nsub, NSUB_MAX, packsplit(), iLBC_ULP_Inst_t_::scale_bits, iLBC_ULP_Inst_t_::start_bits, iLBC_ULP_Inst_t_::startfirst_bits, iLBC_ULP_Inst_t_::state_bits, STATE_LEN, iLBC_Enc_Inst_t_::state_short_len, StateConstructW(), StateSearchW(), stMemLTbl, SUBL, and iLBC_Enc_Inst_t_::ULP_inst.

Referenced by encode(), and lintoilbc_frameout().

95  {
96 
97  float data[BLOCKL_MAX];
98  float residual[BLOCKL_MAX], reverseResidual[BLOCKL_MAX];
99 
100  int start, idxForMax, idxVec[STATE_LEN];
101 
102 
103 
104 
105 
106  float reverseDecresidual[BLOCKL_MAX], mem[CB_MEML];
107  int n, k, meml_gotten, Nfor, Nback, i, pos;
108  int gain_index[CB_NSTAGES*NASUB_MAX],
109  extra_gain_index[CB_NSTAGES];
110  int cb_index[CB_NSTAGES*NASUB_MAX],extra_cb_index[CB_NSTAGES];
111  int lsf_i[LSF_NSPLIT*LPC_N_MAX];
112  unsigned char *pbytes;
113  int diff, start_pos, state_first;
114  float en1, en2;
115  int index, ulp, firstpart;
116  int subcount, subframe;
117  float weightState[LPC_FILTERORDER];
118  float syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
119  float weightdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
120  float decresidual[BLOCKL_MAX];
121 
122  /* high pass filtering of input signal if such is not done
123  prior to calling this function */
124 
125  hpInput(block, iLBCenc_inst->blockl,
126  data, (*iLBCenc_inst).hpimem);
127 
128  /* otherwise simply copy */
129 
130  /*memcpy(data,block,iLBCenc_inst->blockl*sizeof(float));*/
131 
132  /* LPC of hp filtered input data */
133 
134  LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst);
135 
136 
137  /* inverse filter to get residual */
138 
139  for (n=0; n<iLBCenc_inst->nsub; n++) {
140  anaFilter(&data[n*SUBL], &syntdenum[n*(LPC_FILTERORDER+1)],
141  SUBL, &residual[n*SUBL], iLBCenc_inst->anaMem);
142  }
143 
144  /* find state location */
145 
146  start = FrameClassify(iLBCenc_inst, residual);
147 
148  /* check if state should be in first or last part of the
149  two subframes */
150 
151  diff = STATE_LEN - iLBCenc_inst->state_short_len;
152  en1 = 0;
153  index = (start-1)*SUBL;
154 
155 
156 
157 
158 
159  for (i = 0; i < iLBCenc_inst->state_short_len; i++) {
160  en1 += residual[index+i]*residual[index+i];
161  }
162  en2 = 0;
163  index = (start-1)*SUBL+diff;
164  for (i = 0; i < iLBCenc_inst->state_short_len; i++) {
165  en2 += residual[index+i]*residual[index+i];
166  }
167 
168 
169  if (en1 > en2) {
170  state_first = 1;
171  start_pos = (start-1)*SUBL;
172  } else {
173  state_first = 0;
174  start_pos = (start-1)*SUBL + diff;
175  }
176 
177  /* scalar quantization of state */
178 
179  StateSearchW(iLBCenc_inst, &residual[start_pos],
180  &syntdenum[(start-1)*(LPC_FILTERORDER+1)],
181  &weightdenum[(start-1)*(LPC_FILTERORDER+1)], &idxForMax,
182  idxVec, iLBCenc_inst->state_short_len, state_first);
183 
184  StateConstructW(idxForMax, idxVec,
185  &syntdenum[(start-1)*(LPC_FILTERORDER+1)],
186  &decresidual[start_pos], iLBCenc_inst->state_short_len);
187 
188  /* predictive quantization in state */
189 
190  if (state_first) { /* put adaptive part in the end */
191 
192  /* setup memory */
193 
194  memset(mem, 0,
195  (CB_MEML-iLBCenc_inst->state_short_len)*sizeof(float));
196  memcpy(mem+CB_MEML-iLBCenc_inst->state_short_len,
197  decresidual+start_pos,
198  iLBCenc_inst->state_short_len*sizeof(float));
199  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
200 
201  /* encode sub-frames */
202 
203  iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index,
204  &residual[start_pos+iLBCenc_inst->state_short_len],
205  mem+CB_MEML-stMemLTbl,
206  stMemLTbl, diff, CB_NSTAGES,
207 
208 
209 
210 
211 
212  &weightdenum[start*(LPC_FILTERORDER+1)],
213  weightState, 0);
214 
215  /* construct decoded vector */
216 
217  iCBConstruct(
218  &decresidual[start_pos+iLBCenc_inst->state_short_len],
219  extra_cb_index, extra_gain_index,
220  mem+CB_MEML-stMemLTbl,
221  stMemLTbl, diff, CB_NSTAGES);
222 
223  }
224  else { /* put adaptive part in the beginning */
225 
226  /* create reversed vectors for prediction */
227 
228  for (k=0; k<diff; k++) {
229  reverseResidual[k] = residual[(start+1)*SUBL-1
230  -(k+iLBCenc_inst->state_short_len)];
231  }
232 
233  /* setup memory */
234 
235  meml_gotten = iLBCenc_inst->state_short_len;
236  for (k=0; k<meml_gotten; k++) {
237  mem[CB_MEML-1-k] = decresidual[start_pos + k];
238  }
239  memset(mem, 0, (CB_MEML-k)*sizeof(float));
240  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
241 
242  /* encode sub-frames */
243 
244  iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index,
245  reverseResidual, mem+CB_MEML-stMemLTbl, stMemLTbl,
246  diff, CB_NSTAGES,
247  &weightdenum[(start-1)*(LPC_FILTERORDER+1)],
248  weightState, 0);
249 
250  /* construct decoded vector */
251 
252  iCBConstruct(reverseDecresidual, extra_cb_index,
253  extra_gain_index, mem+CB_MEML-stMemLTbl, stMemLTbl,
254  diff, CB_NSTAGES);
255 
256  /* get decoded residual from reversed vector */
257 
258  for (k=0; k<diff; k++) {
259  decresidual[start_pos-1-k] = reverseDecresidual[k];
260 
261 
262 
263 
264 
265  }
266  }
267 
268  /* counter for predicted sub-frames */
269 
270  subcount=0;
271 
272  /* forward prediction of sub-frames */
273 
274  Nfor = iLBCenc_inst->nsub-start-1;
275 
276 
277  if ( Nfor > 0 ) {
278 
279  /* setup memory */
280 
281  memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float));
282  memcpy(mem+CB_MEML-STATE_LEN, decresidual+(start-1)*SUBL,
283  STATE_LEN*sizeof(float));
284  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
285 
286  /* loop over sub-frames to encode */
287 
288  for (subframe=0; subframe<Nfor; subframe++) {
289 
290  /* encode sub-frame */
291 
292  iCBSearch(iLBCenc_inst, cb_index+subcount*CB_NSTAGES,
293  gain_index+subcount*CB_NSTAGES,
294  &residual[(start+1+subframe)*SUBL],
295  mem+CB_MEML-memLfTbl[subcount],
296  memLfTbl[subcount], SUBL, CB_NSTAGES,
297  &weightdenum[(start+1+subframe)*
298  (LPC_FILTERORDER+1)],
299  weightState, subcount+1);
300 
301  /* construct decoded vector */
302 
303  iCBConstruct(&decresidual[(start+1+subframe)*SUBL],
304  cb_index+subcount*CB_NSTAGES,
305  gain_index+subcount*CB_NSTAGES,
306  mem+CB_MEML-memLfTbl[subcount],
307  memLfTbl[subcount], SUBL, CB_NSTAGES);
308 
309  /* update memory */
310 
311  memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
312  memcpy(mem+CB_MEML-SUBL,
313 
314 
315 
316 
317 
318  &decresidual[(start+1+subframe)*SUBL],
319  SUBL*sizeof(float));
320  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
321 
322  subcount++;
323  }
324  }
325 
326 
327  /* backward prediction of sub-frames */
328 
329  Nback = start-1;
330 
331 
332  if ( Nback > 0 ) {
333 
334  /* create reverse order vectors */
335 
336  for (n=0; n<Nback; n++) {
337  for (k=0; k<SUBL; k++) {
338  reverseResidual[n*SUBL+k] =
339  residual[(start-1)*SUBL-1-n*SUBL-k];
340  reverseDecresidual[n*SUBL+k] =
341  decresidual[(start-1)*SUBL-1-n*SUBL-k];
342  }
343  }
344 
345  /* setup memory */
346 
347  meml_gotten = SUBL*(iLBCenc_inst->nsub+1-start);
348 
349 
350  if ( meml_gotten > CB_MEML ) {
351  meml_gotten=CB_MEML;
352  }
353  for (k=0; k<meml_gotten; k++) {
354  mem[CB_MEML-1-k] = decresidual[(start-1)*SUBL + k];
355  }
356  memset(mem, 0, (CB_MEML-k)*sizeof(float));
357  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
358 
359  /* loop over sub-frames to encode */
360 
361  for (subframe=0; subframe<Nback; subframe++) {
362 
363  /* encode sub-frame */
364 
365  iCBSearch(iLBCenc_inst, cb_index+subcount*CB_NSTAGES,
366 
367 
368 
369 
370 
371  gain_index+subcount*CB_NSTAGES,
372  &reverseResidual[subframe*SUBL],
373  mem+CB_MEML-memLfTbl[subcount],
374  memLfTbl[subcount], SUBL, CB_NSTAGES,
375  &weightdenum[(start-2-subframe)*
376  (LPC_FILTERORDER+1)],
377  weightState, subcount+1);
378 
379  /* construct decoded vector */
380 
381  iCBConstruct(&reverseDecresidual[subframe*SUBL],
382  cb_index+subcount*CB_NSTAGES,
383  gain_index+subcount*CB_NSTAGES,
384  mem+CB_MEML-memLfTbl[subcount],
385  memLfTbl[subcount], SUBL, CB_NSTAGES);
386 
387  /* update memory */
388 
389  memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
390  memcpy(mem+CB_MEML-SUBL,
391  &reverseDecresidual[subframe*SUBL],
392  SUBL*sizeof(float));
393  memset(weightState, 0, LPC_FILTERORDER*sizeof(float));
394 
395  subcount++;
396 
397  }
398 
399  /* get decoded residual from reversed vector */
400 
401  for (i=0; i<SUBL*Nback; i++) {
402  decresidual[SUBL*Nback - i - 1] =
403  reverseDecresidual[i];
404  }
405  }
406  /* end encoding part */
407 
408  /* adjust index */
409  index_conv_enc(cb_index);
410 
411  /* pack bytes */
412 
413  pbytes=bytes;
414  pos=0;
415 
416  /* loop over the 3 ULP classes */
417 
418  for (ulp=0; ulp<3; ulp++) {
419 
420 
421 
422 
423 
424 
425  /* LSF */
426  for (k=0; k<LSF_NSPLIT*iLBCenc_inst->lpc_n; k++) {
427  packsplit(&lsf_i[k], &firstpart, &lsf_i[k],
428  iLBCenc_inst->ULP_inst->lsf_bits[k][ulp],
429  iLBCenc_inst->ULP_inst->lsf_bits[k][ulp]+
430  iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+1]+
431  iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+2]);
432  dopack( &pbytes, firstpart,
433  iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], &pos);
434  }
435 
436  /* Start block info */
437 
438  packsplit(&start, &firstpart, &start,
439  iLBCenc_inst->ULP_inst->start_bits[ulp],
440  iLBCenc_inst->ULP_inst->start_bits[ulp]+
441  iLBCenc_inst->ULP_inst->start_bits[ulp+1]+
442  iLBCenc_inst->ULP_inst->start_bits[ulp+2]);
443  dopack( &pbytes, firstpart,
444  iLBCenc_inst->ULP_inst->start_bits[ulp], &pos);
445 
446  packsplit(&state_first, &firstpart, &state_first,
447  iLBCenc_inst->ULP_inst->startfirst_bits[ulp],
448  iLBCenc_inst->ULP_inst->startfirst_bits[ulp]+
449  iLBCenc_inst->ULP_inst->startfirst_bits[ulp+1]+
450  iLBCenc_inst->ULP_inst->startfirst_bits[ulp+2]);
451  dopack( &pbytes, firstpart,
452  iLBCenc_inst->ULP_inst->startfirst_bits[ulp], &pos);
453 
454  packsplit(&idxForMax, &firstpart, &idxForMax,
455  iLBCenc_inst->ULP_inst->scale_bits[ulp],
456  iLBCenc_inst->ULP_inst->scale_bits[ulp]+
457  iLBCenc_inst->ULP_inst->scale_bits[ulp+1]+
458  iLBCenc_inst->ULP_inst->scale_bits[ulp+2]);
459  dopack( &pbytes, firstpart,
460  iLBCenc_inst->ULP_inst->scale_bits[ulp], &pos);
461 
462  for (k=0; k<iLBCenc_inst->state_short_len; k++) {
463  packsplit(idxVec+k, &firstpart, idxVec+k,
464  iLBCenc_inst->ULP_inst->state_bits[ulp],
465  iLBCenc_inst->ULP_inst->state_bits[ulp]+
466  iLBCenc_inst->ULP_inst->state_bits[ulp+1]+
467  iLBCenc_inst->ULP_inst->state_bits[ulp+2]);
468  dopack( &pbytes, firstpart,
469  iLBCenc_inst->ULP_inst->state_bits[ulp], &pos);
470  }
471 
472 
473 
474 
475 
476 
477  /* 23/22 (20ms/30ms) sample block */
478 
479  for (k=0;k<CB_NSTAGES;k++) {
480  packsplit(extra_cb_index+k, &firstpart,
481  extra_cb_index+k,
482  iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp],
483  iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp]+
484  iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+1]+
485  iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+2]);
486  dopack( &pbytes, firstpart,
487  iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp],
488  &pos);
489  }
490 
491  for (k=0;k<CB_NSTAGES;k++) {
492  packsplit(extra_gain_index+k, &firstpart,
493  extra_gain_index+k,
494  iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp],
495  iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp]+
496  iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+1]+
497  iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+2]);
498  dopack( &pbytes, firstpart,
499  iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp],
500  &pos);
501  }
502 
503  /* The two/four (20ms/30ms) 40 sample sub-blocks */
504 
505  for (i=0; i<iLBCenc_inst->nasub; i++) {
506  for (k=0; k<CB_NSTAGES; k++) {
507  packsplit(cb_index+i*CB_NSTAGES+k, &firstpart,
508  cb_index+i*CB_NSTAGES+k,
509  iLBCenc_inst->ULP_inst->cb_index[i][k][ulp],
510  iLBCenc_inst->ULP_inst->cb_index[i][k][ulp]+
511  iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+1]+
512  iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+2]);
513  dopack( &pbytes, firstpart,
514  iLBCenc_inst->ULP_inst->cb_index[i][k][ulp],
515  &pos);
516  }
517  }
518 
519  for (i=0; i<iLBCenc_inst->nasub; i++) {
520  for (k=0; k<CB_NSTAGES; k++) {
521  packsplit(gain_index+i*CB_NSTAGES+k, &firstpart,
522  gain_index+i*CB_NSTAGES+k,
523  iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp],
524  iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp]+
525 
526 
527 
528 
529 
530  iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+1]+
531  iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+2]);
532  dopack( &pbytes, firstpart,
533  iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp],
534  &pos);
535  }
536  }
537  }
538 
539  /* set the last bit to zero (otherwise the decoder
540  will treat it as a lost frame) */
541  dopack( &pbytes, 0, 1, &pos);
542  }
void LPCencode(float *syntdenum, float *weightdenum, int *lsf_index, float *data, iLBC_Enc_Inst_t *iLBCenc_inst)
Definition: LPCencode.c:214
#define LPC_N_MAX
Definition: iLBC_define.h:46
#define LSF_NSPLIT
Definition: iLBC_define.h:50
#define CB_MEML
Definition: iLBC_define.h:58
float anaMem[LPC_FILTERORDER]
Definition: iLBC_define.h:152
#define CB_NSTAGES
Definition: iLBC_define.h:56
int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:125
#define BLOCKL_MAX
Definition: iLBC_define.h:21
#define STATE_LEN
Definition: iLBC_define.h:34
void iCBSearch(iLBC_Enc_Inst_t *iLBCenc_inst, int *index, int *gain_index, float *intarget, float *mem, int lMem, int lTarget, int nStages, float *weightDenum, float *weightState, int block)
Definition: iCBSearch.c:26
void packsplit(int *index, int *firstpart, int *rest, int bitno_firstpart, int bitno_total)
Definition: packing.c:26
const iLBC_ULP_Inst_t * ULP_inst
Definition: iLBC_define.h:149
void iCBConstruct(float *decvector, int *index, int *gain_index, float *mem, int lMem, int veclen, int nStages)
Definition: iCBConstruct.c:66
int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:127
#define SUBL
Definition: iLBC_define.h:33
void StateConstructW(int idxForMax, int *idxVec, float *syntDenum, float *out, int len)
void hpInput(float *In, int len, float *Out, float *mem)
Definition: hpInput.c:23
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
void index_conv_enc(int *index)
Definition: iCBConstruct.c:28
int lsf_bits[6][ULP_CLASSES+2]
Definition: iLBC_define.h:120
int scale_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:123
int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:128
int state_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:124
int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]
Definition: iLBC_define.h:126
#define NSUB_MAX
Definition: iLBC_define.h:24
int memLfTbl[NASUB_MAX]
Definition: constants.c:138
void StateSearchW(iLBC_Enc_Inst_t *iLBCenc_inst, float *residual, float *syntDenum, float *weightDenum, int *idxForMax, int *idxVec, int len, int state_first)
Definition: StateSearchW.c:121
int startfirst_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:122
void anaFilter(float *In, float *a, int len, float *Out, float *mem)
Definition: anaFilter.c:20
#define NASUB_MAX
Definition: iLBC_define.h:32
int FrameClassify(iLBC_Enc_Inst_t *iLBCenc_inst, float *residual)
Definition: FrameClassify.c:19
void dopack(unsigned char **bitstream, int index, int bitno, int *pos)
Definition: packing.c:68
int stMemLTbl
Definition: constants.c:137
int start_bits[ULP_CLASSES+2]
Definition: iLBC_define.h:121

◆ initEncode()

short initEncode ( iLBC_Enc_Inst_t iLBCenc_inst,
int  mode 
)

Definition at line 35 of file iLBC_encode.c.

References iLBC_Enc_Inst_t_::blockl, BLOCKL_20MS, BLOCKL_30MS, BLOCKL_MAX, LPC_FILTERORDER, LPC_LOOKBACK, iLBC_Enc_Inst_t_::lpc_n, LPC_N_20MS, LPC_N_30MS, lsfmeanTbl, iLBC_Enc_Inst_t_::mode, iLBC_Enc_Inst_t_::nasub, NASUB_20MS, NASUB_30MS, iLBC_Enc_Inst_t_::no_of_bytes, NO_OF_BYTES_20MS, NO_OF_BYTES_30MS, iLBC_Enc_Inst_t_::no_of_words, NO_OF_WORDS_20MS, NO_OF_WORDS_30MS, iLBC_Enc_Inst_t_::nsub, NSUB_20MS, NSUB_30MS, iLBC_Enc_Inst_t_::state_short_len, STATE_SHORT_LEN_20MS, STATE_SHORT_LEN_30MS, ULP_20msTbl, ULP_30msTbl, and iLBC_Enc_Inst_t_::ULP_inst.

Referenced by lintoilbc_new(), and main().

39  {
40  iLBCenc_inst->mode = mode;
41  if (mode==30) {
42  iLBCenc_inst->blockl = BLOCKL_30MS;
43  iLBCenc_inst->nsub = NSUB_30MS;
44  iLBCenc_inst->nasub = NASUB_30MS;
45  iLBCenc_inst->lpc_n = LPC_N_30MS;
46  iLBCenc_inst->no_of_bytes = NO_OF_BYTES_30MS;
47  iLBCenc_inst->no_of_words = NO_OF_WORDS_30MS;
48 
49 
50 
51 
52 
54  /* ULP init */
55  iLBCenc_inst->ULP_inst=&ULP_30msTbl;
56  }
57  else if (mode==20) {
58  iLBCenc_inst->blockl = BLOCKL_20MS;
59  iLBCenc_inst->nsub = NSUB_20MS;
60  iLBCenc_inst->nasub = NASUB_20MS;
61  iLBCenc_inst->lpc_n = LPC_N_20MS;
62  iLBCenc_inst->no_of_bytes = NO_OF_BYTES_20MS;
63  iLBCenc_inst->no_of_words = NO_OF_WORDS_20MS;
65  /* ULP init */
66  iLBCenc_inst->ULP_inst=&ULP_20msTbl;
67  }
68  else {
69  exit(2);
70  }
71 
72  memset((*iLBCenc_inst).anaMem, 0,
73  LPC_FILTERORDER*sizeof(float));
74  memcpy((*iLBCenc_inst).lsfold, lsfmeanTbl,
75  LPC_FILTERORDER*sizeof(float));
76  memcpy((*iLBCenc_inst).lsfdeqold, lsfmeanTbl,
77  LPC_FILTERORDER*sizeof(float));
78  memset((*iLBCenc_inst).lpc_buffer, 0,
79  (LPC_LOOKBACK+BLOCKL_MAX)*sizeof(float));
80  memset((*iLBCenc_inst).hpimem, 0, 4*sizeof(float));
81 
82  return (iLBCenc_inst->no_of_bytes);
83  }
const iLBC_ULP_Inst_t ULP_20msTbl
Definition: constants.c:19
#define STATE_SHORT_LEN_20MS
Definition: iLBC_define.h:36
#define NSUB_30MS
Definition: iLBC_define.h:23
#define BLOCKL_MAX
Definition: iLBC_define.h:21
#define LPC_N_30MS
Definition: iLBC_define.h:45
#define STATE_SHORT_LEN_30MS
Definition: iLBC_define.h:35
#define NO_OF_BYTES_20MS
Definition: iLBC_define.h:100
#define LPC_N_20MS
Definition: iLBC_define.h:44
const iLBC_ULP_Inst_t * ULP_inst
Definition: iLBC_define.h:149
float lsfmeanTbl[LPC_FILTERORDER]
Definition: constants.c:210
#define NASUB_20MS
Definition: iLBC_define.h:25
#define NO_OF_WORDS_20MS
Definition: iLBC_define.h:102
const iLBC_ULP_Inst_t ULP_30msTbl
Definition: constants.c:44
#define NO_OF_WORDS_30MS
Definition: iLBC_define.h:103
#define NSUB_20MS
Definition: iLBC_define.h:22
#define LPC_FILTERORDER
Definition: iLBC_define.h:40
#define BLOCKL_20MS
Definition: iLBC_define.h:19
#define NASUB_30MS
Definition: iLBC_define.h:31
#define BLOCKL_30MS
Definition: iLBC_define.h:20
#define NO_OF_BYTES_30MS
Definition: iLBC_define.h:101
#define LPC_LOOKBACK
Definition: iLBC_define.h:43