43 iLBCdec_inst->
mode = mode;
75 memset(iLBCdec_inst->
syntMem, 0,
88 iLBCdec_inst->
per = 0.0;
92 memset(iLBCdec_inst->
prevLpc+1,0,
95 iLBCdec_inst->
seed=777;
102 memset(iLBCdec_inst->
hpomem, 0, 4*
sizeof(
float));
111 return (iLBCdec_inst->
blockl);
138 int *extra_gain_index,
146 int k, meml_gotten, Nfor, Nback, i;
148 int subcount, subframe;
157 if (state_first == 1) {
158 start_pos = (start-1)*
SUBL;
160 start_pos = (start-1)*
SUBL + diff;
177 decresidual+start_pos,
192 for (k=0; k<diff; k++) {
193 reverseDecresidual[k] =
194 decresidual[(start+1)*
SUBL-1-
201 for (k=0; k<meml_gotten; k++){
202 mem[
CB_MEML-1-k] = decresidual[start_pos + k];
209 memset(mem, 0, (
CB_MEML-k)*
sizeof(
float));
219 for (k=0; k<diff; k++) {
220 decresidual[start_pos-1-k] = reverseDecresidual[k];
230 Nfor = iLBCdec_inst->
nsub-start-1;
242 for (subframe=0; subframe<Nfor; subframe++) {
248 gain_index+subcount*CB_NSTAGES,
250 memLfTbl[subcount], SUBL, CB_NSTAGES);
254 memmove(mem, mem+SUBL, (
CB_MEML-SUBL)*
sizeof(
float));
261 &decresidual[(start+1+subframe)*SUBL],
278 meml_gotten =
SUBL*(iLBCdec_inst->
nsub+1-start);
283 for (k=0; k<meml_gotten; k++) {
284 mem[
CB_MEML-1-k] = decresidual[(start-1)*
SUBL + k];
286 memset(mem, 0, (
CB_MEML-k)*
sizeof(
float));
290 for (subframe=0; subframe<Nback; subframe++) {
296 gain_index+subcount*CB_NSTAGES,
302 memmove(mem, mem+SUBL, (
CB_MEML-SUBL)*
sizeof(
float));
304 &reverseDecresidual[subframe*SUBL],
316 for (i=0; i<
SUBL*Nback; i++)
317 decresidual[
SUBL*Nback - i - 1] =
318 reverseDecresidual[i];
328 unsigned char *bytes,
338 int k, i, start, idxForMax, pos, lastpart, ulp;
348 unsigned char *pbytes;
381 extra_gain_index[k]=0;
383 for (i=0; i<iLBCdec_inst->
nasub; i++) {
385 cb_index[i*CB_NSTAGES+k]=0;
388 for (i=0; i<iLBCdec_inst->
nasub; i++) {
390 gain_index[i*CB_NSTAGES+k]=0;
396 for (ulp=0; ulp<3; ulp++) {
400 unpack( &pbytes, &lastpart,
408 unpack( &pbytes, &lastpart,
413 unpack( &pbytes, &lastpart,
423 unpack( &pbytes, &lastpart,
429 unpack( &pbytes, &lastpart,
438 unpack( &pbytes, &lastpart,
445 unpack( &pbytes, &lastpart,
454 for (i=0; i<iLBCdec_inst->
nasub; i++) {
456 unpack( &pbytes, &lastpart,
464 for (i=0; i<iLBCdec_inst->
nasub; i++) {
466 unpack( &pbytes, &lastpart,
481 unpack( &pbytes, &last_bit, 1, &pos);
486 if (iLBCdec_inst->
mode==20 && start>3)
488 if (iLBCdec_inst->
mode==30 && start>5)
503 iLBCdec_inst->
lpc_n);
507 Decode(iLBCdec_inst, decresidual, start, idxForMax,
508 idxVec, syntdenum, cb_index, gain_index,
509 extra_cb_index, extra_gain_index,
514 doThePLC(PLCresidual, PLClpc, 0, decresidual,
517 (*iLBCdec_inst).last_lag, iLBCdec_inst);
525 memcpy(decresidual, PLCresidual,
526 iLBCdec_inst->
blockl*
sizeof(
float));
545 doThePLC(PLCresidual, PLClpc, 1, zeros, one,
546 (*iLBCdec_inst).last_lag, iLBCdec_inst);
547 memcpy(decresidual, PLCresidual,
548 iLBCdec_inst->
blockl*
sizeof(
float));
551 for (i = 0; i < iLBCdec_inst->
nsub; i++) {
552 memcpy(syntdenum+(i*order_plus_one), PLClpc,
553 order_plus_one*
sizeof(
float));
566 if (iLBCdec_inst->
mode==20) {
578 for (i=1; i < iLBCdec_inst->
nsub; i++) {
583 }
else if (iLBCdec_inst->
mode==30) {
585 for (i=0; i < 2; i++) {
591 for (i=2; i < iLBCdec_inst->
nsub; i++) {
605 for (ilag=21; ilag<120; ilag++) {
619 memcpy(data, decresidual,
620 iLBCdec_inst->
blockl*
sizeof(
float));
621 for (i=0; i < iLBCdec_inst->
nsub; i++) {
637 decblock,iLBCdec_inst->
hpomem);
void unpack(unsigned char **bitstream, int *index, int bitno, int *pos)
const iLBC_ULP_Inst_t ULP_20msTbl
float prevResidual[NSUB_MAX *SUBL]
int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]
#define STATE_SHORT_LEN_20MS
void iLBC_decode(float *decblock, unsigned char *bytes, iLBC_Dec_Inst_t *iLBCdec_inst, int mode)
#define STATE_SHORT_LEN_30MS
void syntFilter(float *Out, float *a, int len, float *mem)
float lsfmeanTbl[LPC_FILTERORDER]
void iCBConstruct(float *decvector, int *index, int *gain_index, float *mem, int lMem, int veclen, int nStages)
const iLBC_ULP_Inst_t * ULP_inst
int LSF_check(float *lsf, int dim, int NoAn)
int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
const iLBC_ULP_Inst_t ULP_30msTbl
short initDecode(iLBC_Dec_Inst_t *iLBCdec_inst, int mode, int use_enhancer)
void StateConstructW(int idxForMax, int *idxVec, float *syntDenum, float *out, int len)
void SimplelsfDEQ(float *lsfdeq, int *index, int lpc_n)
float xCorrCoef(float *target, float *regressor, int subl)
int lsf_bits[6][ULP_CLASSES+2]
float enh_period[ENH_NBLOCKS_TOT]
int scale_bits[ULP_CLASSES+2]
int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
int state_bits[ULP_CLASSES+2]
void doThePLC(float *PLCresidual, float *PLClpc, int PLI, float *decresidual, float *lpc, int inlag, iLBC_Dec_Inst_t *iLBCdec_inst)
void packcombine(int *index, int rest, int bitno_rest)
int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]
void index_conv_dec(int *index)
int enhancerInterface(float *out, float *in, iLBC_Dec_Inst_t *iLBCdec_inst)
float old_syntdenum[(LPC_FILTERORDER+1) *NSUB_MAX]
void DecoderInterpolateLSF(float *syntdenum, float *weightdenum, float *lsfdeq, int length, iLBC_Dec_Inst_t *iLBCdec_inst)
float syntMem[LPC_FILTERORDER]
int startfirst_bits[ULP_CLASSES+2]
void hpOutput(float *In, int len, float *Out, float *mem)
float prevLpc[LPC_FILTERORDER+1]
void Decode(iLBC_Dec_Inst_t *iLBCdec_inst, float *decresidual, int start, int idxForMax, int *idxVec, float *syntdenum, int *cb_index, int *gain_index, int *extra_cb_index, int *extra_gain_index, int state_first)
int start_bits[ULP_CLASSES+2]