bw_lpc(k1, st->interp_qlpc, awk1, st->lpcSize); bw_lpc(k2, st->interp_qlpc, awk2, st->lpcSize); bw_lpc(k3, st->interp_qlpc, awk3, st->lpcSize);
bw_lpc(GAMMA_SCALING*k1, st->interp_qlpc, awk1, st->lpcSize); bw_lpc(GAMMA_SCALING*k2, st->interp_qlpc, awk2, st->lpcSize); bw_lpc(GAMMA_SCALING*k3, st->interp_qlpc, awk3, st->lpcSize);
static void nb_decode_lost(DecState *st, short *out, char *stack){   int i, sub;   spx_coef_t *awk1, *awk2, *awk3;   float pitch_gain, fact, gain_med;   fact = exp(-.04*st->count_lost*st->count_lost);   gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]);   if (gain_med < st->last_pitch_gain)      st->last_pitch_gain = gain_med;      pitch_gain = st->last_pitch_gain;   if (pitch_gain>.95)      pitch_gain=.95;   pitch_gain *= fact;   /* Shift all buffers by one frame */   speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));   speex_move(st->excBuf, st->excBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(spx_sig_t));   awk1=PUSH(stack, (st->lpcSize+1), spx_coef_t);   awk2=PUSH(stack, (st->lpcSize+1), spx_coef_t);   awk3=PUSH(stack, (st->lpcSize+1), spx_coef_t);   for (sub=0;sub<st->nbSubframes;sub++)   {      int offset;      spx_sig_t *sp, *exc;      /* Offset relative to start of frame */      offset = st->subframeSize*sub;      /* Original signal */      sp=st->frame+offset;      /* Excitation */      exc=st->exc+offset;      /* Excitation after post-filter*/      /* Calculate perceptually enhanced LPC filter */      if (st->lpc_enh_enabled)      {         float r=.9;                  float k1,k2,k3;         if (st->submodes[st->submodeID] != NULL)         {            k1=SUBMODE(lpc_enh_k1);            k2=SUBMODE(lpc_enh_k2);         } else {            k1=k2=.7;         }         k3=(1-(1-r*k1)/(1-r*k2))/r;         if (!st->lpc_enh_enabled)         {            k1=k2;            k3=0;         }         bw_lpc(k1, st->interp_qlpc, awk1, st->lpcSize);         bw_lpc(k2, st->interp_qlpc, awk2, st->lpcSize);         bw_lpc(k3, st->interp_qlpc, awk3, st->lpcSize);      }              /* Make up a plausible excitation */      /* THIS CAN BE IMPROVED */      /*if (pitch_gain>.95)        pitch_gain=.95;*/      {         float innov_gain=0;         for (i=0;i<st->frameSize;i++)            innov_gain += st->innov[i]*st->innov[i];         innov_gain=sqrt(innov_gain/st->frameSize);      for (i=0;i<st->subframeSize;i++)      {#if 0         exc[i] = pitch_gain * exc[i - st->last_pitch] + fact*sqrt(1-pitch_gain)*st->innov[i+offset];         /*Just so it give the same lost packets as with if 0*/         /*rand();*/#else         /*exc[i]=pitch_gain*exc[i-st->last_pitch] +  fact*st->innov[i+offset];*/         exc[i]=pitch_gain*exc[i-st->last_pitch] +          fact*sqrt(1-pitch_gain)*speex_rand(innov_gain);#endif      }      }      for (i=0;i<st->subframeSize;i++)         sp[i]=exc[i];            /* Signal synthesis */      if (st->lpc_enh_enabled)      {         filter_mem2(sp, awk2, awk1, sp, st->subframeSize, st->lpcSize,                      st->mem_sp+st->lpcSize);         filter_mem2(sp, awk3, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,                      st->mem_sp);      } else {         for (i=0;i<st->lpcSize;i++)            st->mem_sp[st->lpcSize+i] = 0;         iir_mem2(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize,                      st->mem_sp);      }         }   for (i=0;i<st->frameSize;i++)   {      spx_word32_t sig = PSHR(st->frame[i],SIG_SHIFT);      if (sig>32767)         sig = 32767;      if (sig<-32767)         sig = -32767;     out[i]=sig;   }      st->first = 0;   st->count_lost++;   st->pitch_gain_buf[st->pitch_gain_buf_idx++] = pitch_gain;   if (st->pitch_gain_buf_idx > 2) /* rollover */      st->pitch_gain_buf_idx = 0;}