st->window[i]=SIG_SCALING*(.54-.46*cos(M_PI*i/part1));
st->window[i]=(spx_word16_t)(SIG_SCALING*(.54-.46*cos(M_PI*i/part1)));
void *nb_encoder_init(SpeexMode *m){   EncState *st;   SpeexNBMode *mode;   int i;   mode=(SpeexNBMode *)m->mode;   st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(spx_sig_t));   if (!st)      return NULL;   st->stack = ((char*)st) + sizeof(EncState);      st->mode=m;   st->frameSize = mode->frameSize;   st->windowSize = st->frameSize*3/2;   st->nbSubframes=mode->frameSize/mode->subframeSize;   st->subframeSize=mode->subframeSize;   st->lpcSize = mode->lpcSize;   st->bufSize = mode->bufSize;   st->gamma1=mode->gamma1;   st->gamma2=mode->gamma2;   st->min_pitch=mode->pitchStart;   st->max_pitch=mode->pitchEnd;   st->lag_factor=mode->lag_factor;   st->lpc_floor = mode->lpc_floor;     st->submodes=mode->submodes;   st->submodeID=st->submodeSelect=mode->defaultSubmode;   st->bounded_pitch = 1;   st->encode_submode = 1;#ifdef EPIC_48K   st->lbr_48k=mode->lbr48k;#endif   /* Allocating input buffer */   st->inBuf = PUSH(st->stack, st->bufSize, spx_sig_t);   st->frame = st->inBuf + st->bufSize - st->windowSize;   /* Allocating excitation buffer */   st->excBuf = PUSH(st->stack, st->bufSize, spx_sig_t);   st->exc = st->excBuf + st->bufSize - st->windowSize;   st->swBuf = PUSH(st->stack, st->bufSize, spx_sig_t);   st->sw = st->swBuf + st->bufSize - st->windowSize;   st->exc2Buf = PUSH(st->stack, st->bufSize, spx_sig_t);   st->exc2 = st->exc2Buf + st->bufSize - st->windowSize;   st->innov = PUSH(st->stack, st->frameSize, spx_sig_t);   /* Asymmetric "pseudo-Hamming" window */   {      int part1, part2;      part1=st->frameSize - (st->subframeSize>>1);      part2=(st->frameSize>>1) + (st->subframeSize>>1);      st->window = PUSH(st->stack, st->windowSize, spx_word16_t);      for (i=0;i<part1;i++)         st->window[i]=SIG_SCALING*(.54-.46*cos(M_PI*i/part1));      for (i=0;i<part2;i++)         st->window[part1+i]=SIG_SCALING*(.54+.46*cos(M_PI*i/part2));   }   /* Create the window for autocorrelation (lag-windowing) */   st->lagWindow = PUSH(st->stack, st->lpcSize+1, float);   for (i=0;i<st->lpcSize+1;i++)      st->lagWindow[i]=exp(-.5*sqr(2*M_PI*st->lag_factor*i));   st->autocorr = PUSH(st->stack, st->lpcSize+1, spx_word16_t);   st->buf2 = PUSH(st->stack, st->windowSize, spx_sig_t);   st->lpc = PUSH(st->stack, st->lpcSize+1, spx_coef_t);   st->interp_lpc = PUSH(st->stack, st->lpcSize+1, spx_coef_t);   st->interp_qlpc = PUSH(st->stack, st->lpcSize+1, spx_coef_t);   st->bw_lpc1 = PUSH(st->stack, st->lpcSize+1, spx_coef_t);   st->bw_lpc2 = PUSH(st->stack, st->lpcSize+1, spx_coef_t);   st->lsp = PUSH(st->stack, st->lpcSize, float);   st->qlsp = PUSH(st->stack, st->lpcSize, float);   st->old_lsp = PUSH(st->stack, st->lpcSize, float);   st->old_qlsp = PUSH(st->stack, st->lpcSize, float);   st->interp_lsp = PUSH(st->stack, st->lpcSize, float);   st->interp_qlsp = PUSH(st->stack, st->lpcSize, float);   st->first = 1;   for (i=0;i<st->lpcSize;i++)   {      st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);   }   st->mem_sp = PUSH(st->stack, st->lpcSize, spx_mem_t);   st->mem_sw = PUSH(st->stack, st->lpcSize, spx_mem_t);   st->mem_sw_whole = PUSH(st->stack, st->lpcSize, spx_mem_t);   st->mem_exc = PUSH(st->stack, st->lpcSize, spx_mem_t);   st->pi_gain = PUSH(st->stack, st->nbSubframes, float);   st->pitch = PUSH(st->stack, st->nbSubframes, int);   st->vbr = PUSHS(st->stack, VBRState);   vbr_init(st->vbr);   st->vbr_quality = 8;   st->vbr_enabled = 0;   st->vad_enabled = 0;   st->dtx_enabled = 0;   st->abr_enabled = 0;   st->abr_drift = 0;   st->complexity=2;   st->sampling_rate=8000;   st->dtx_count=0;   return st;}