40 iLBCenc_inst->
mode = mode;
72 memset((*iLBCenc_inst).anaMem, 0,
78 memset((*iLBCenc_inst).lpc_buffer, 0,
80 memset((*iLBCenc_inst).hpimem, 0, 4*
sizeof(
float));
107 int n, k, meml_gotten, Nfor, Nback, i, pos;
112 unsigned char *pbytes;
113 int diff, start_pos, state_first;
115 int index, ulp, firstpart;
116 int subcount, subframe;
126 data, (*iLBCenc_inst).hpimem);
134 LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst);
139 for (n=0; n<iLBCenc_inst->
nsub; n++) {
153 index = (start-1)*
SUBL;
160 en1 += residual[index+i]*residual[index+i];
163 index = (start-1)*
SUBL+diff;
165 en2 += residual[index+i]*residual[index+i];
171 start_pos = (start-1)*
SUBL;
174 start_pos = (start-1)*
SUBL + diff;
197 decresidual+start_pos,
203 iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index,
219 extra_cb_index, extra_gain_index,
228 for (k=0; k<diff; k++) {
229 reverseResidual[k] = residual[(start+1)*
SUBL-1
236 for (k=0; k<meml_gotten; k++) {
237 mem[
CB_MEML-1-k] = decresidual[start_pos + k];
239 memset(mem, 0, (
CB_MEML-k)*
sizeof(
float));
244 iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index,
258 for (k=0; k<diff; k++) {
259 decresidual[start_pos-1-k] = reverseDecresidual[k];
274 Nfor = iLBCenc_inst->
nsub-start-1;
288 for (subframe=0; subframe<Nfor; subframe++) {
294 &residual[(start+1+subframe)*
SUBL],
297 &weightdenum[(start+1+subframe)*
299 weightState, subcount+1);
318 &decresidual[(start+1+subframe)*
SUBL],
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];
347 meml_gotten =
SUBL*(iLBCenc_inst->
nsub+1-start);
353 for (k=0; k<meml_gotten; k++) {
354 mem[
CB_MEML-1-k] = decresidual[(start-1)*
SUBL + k];
356 memset(mem, 0, (
CB_MEML-k)*
sizeof(
float));
361 for (subframe=0; subframe<Nback; subframe++) {
372 &reverseResidual[subframe*
SUBL],
375 &weightdenum[(start-2-subframe)*
377 weightState, subcount+1);
391 &reverseDecresidual[subframe*
SUBL],
401 for (i=0; i<
SUBL*Nback; i++) {
402 decresidual[
SUBL*Nback - i - 1] =
403 reverseDecresidual[i];
418 for (ulp=0; ulp<3; ulp++) {
427 packsplit(&lsf_i[k], &firstpart, &lsf_i[k],
432 dopack( &pbytes, firstpart,
443 dopack( &pbytes, firstpart,
446 packsplit(&state_first, &firstpart, &state_first,
451 dopack( &pbytes, firstpart,
454 packsplit(&idxForMax, &firstpart, &idxForMax,
459 dopack( &pbytes, firstpart,
463 packsplit(idxVec+k, &firstpart, idxVec+k,
468 dopack( &pbytes, firstpart,
486 dopack( &pbytes, firstpart,
492 packsplit(extra_gain_index+k, &firstpart,
498 dopack( &pbytes, firstpart,
505 for (i=0; i<iLBCenc_inst->
nasub; i++) {
513 dopack( &pbytes, firstpart,
519 for (i=0; i<iLBCenc_inst->
nasub; i++) {
532 dopack( &pbytes, firstpart,
541 dopack( &pbytes, 0, 1, &pos);
int FrameClassify(iLBC_Enc_Inst_t *iLBCenc_inst, float *residual)
void LPCencode(float *syntdenum, float *weightdenum, int *lsf_index, float *data, iLBC_Enc_Inst_t *iLBCenc_inst)
void StateConstructW(int idxForMax, int *idxVec, float *syntDenum, float *out, int len)
void StateSearchW(iLBC_Enc_Inst_t *iLBCenc_inst, float *residual, float *syntDenum, float *weightDenum, int *idxForMax, int *idxVec, int len, int state_first)
void anaFilter(float *In, float *a, int len, float *Out, float *mem)
const iLBC_ULP_Inst_t ULP_30msTbl
float lsfmeanTbl[LPC_FILTERORDER]
const iLBC_ULP_Inst_t ULP_20msTbl
void iCBConstruct(float *decvector, int *index, int *gain_index, float *mem, int lMem, int veclen, int nStages)
void index_conv_enc(int *index)
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)
#define STATE_SHORT_LEN_20MS
#define STATE_SHORT_LEN_30MS
void iLBC_encode(unsigned char *bytes, float *block, iLBC_Enc_Inst_t *iLBCenc_inst)
short initEncode(iLBC_Enc_Inst_t *iLBCenc_inst, int mode)
void dopack(unsigned char **bitstream, int index, int bitno, int *pos)
void packsplit(int *index, int *firstpart, int *rest, int bitno_firstpart, int bitno_total)
const iLBC_ULP_Inst_t * ULP_inst
float anaMem[LPC_FILTERORDER]
int scale_bits[ULP_CLASSES+2]
int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]
int lsf_bits[6][ULP_CLASSES+2]
int startfirst_bits[ULP_CLASSES+2]
int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]
int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]
int start_bits[ULP_CLASSES+2]
int state_bits[ULP_CLASSES+2]