예제 #1
0
/*************************************************************************
*
*  Function:   lpc_init
*
**************************************************************************
*/
int lpc_init (lpcState **state)
{
  lpcState* s;
 
  if (state == (lpcState **) NULL){
      fprintf(stderr, "lpc_init: invalid parameter\n");
      return -1;
  }
  *state = NULL;
 
  /* allocate memory */
  if ((s= (lpcState *) malloc(sizeof(lpcState))) == NULL){
      fprintf(stderr, "lpc_init: can not malloc state structure\n");
      return -1;
  }
  
  s->levinsonSt = NULL;
  
  /* Init sub states */
  if (Levinson_init(&s->levinsonSt)) {
     lpc_exit(&s);
     return -1;
  }


  lpc_reset(s);
  *state = s;
  
  return 0;
}
예제 #2
0
파일: lpc.c 프로젝트: 2831942318/siphon
/*************************************************************************
*
*  Function:   lpc_init
*
**************************************************************************
*/
int lpc_init (lpcState *state)
{
  if (state == (lpcState *) NULL){
      fprintf(stderr, "lpc_init: invalid parameter\n");
      return -1;
  }

  /* Init sub states */
  if (Levinson_init(&state->levinsonSt)) {
     lpc_reset(state);
     return -1;
  }


  lpc_reset(state);

  return 0;
}
예제 #3
0
/*
**************************************************************************
*
*  Function    : cod_amr_reset
*  Purpose     : Resets state memory
*
**************************************************************************
*/
int cod_amr_reset (cod_amrState *st)
{
   Word16 i;
    
   if (st == (cod_amrState *) NULL){
      fprintf(stderr, "cod_amr_reset: invalid parameter\n");
      return -1;
   }
  
   /*-----------------------------------------------------------------------*
    *          Initialize pointers to speech vector.                        *
    *-----------------------------------------------------------------------*/
      
   st->new_speech = st->old_speech + L_TOTAL - L_FRAME;   /* New speech     */
   
   st->speech = st->new_speech - L_NEXT;                  /* Present frame  */
   
   st->p_window = st->old_speech + L_TOTAL - L_WINDOW;    /* For LPC window */
   st->p_window_12k2 = st->p_window - L_NEXT; /* EFR LPC window: no lookahead */
   
   /* Initialize static pointers */
   
   st->wsp = st->old_wsp + PIT_MAX;
   st->exc = st->old_exc + PIT_MAX + L_INTERPOL;
   st->zero = st->ai_zero + MP1;
   st->error = st->mem_err + M;
   st->h1 = &st->hvec[L_SUBFR];
   
   /* Static vectors to zero */
   
   Set_zero(st->old_speech, L_TOTAL);
   Set_zero(st->old_exc,    PIT_MAX + L_INTERPOL);
   Set_zero(st->old_wsp,    PIT_MAX);
   Set_zero(st->mem_syn,    M);
   Set_zero(st->mem_w,      M);
   Set_zero(st->mem_w0,     M);
   Set_zero(st->mem_err,    M);
   Set_zero(st->zero,       L_SUBFR);
   Set_zero(st->hvec,       L_SUBFR);    /* set to zero "h1[-L_SUBFR..-1]" */

   /* OL LTP states */
   for (i = 0; i < 5; i++)
   {
      st->old_lags[i] = 40; 
   }
   
   /* Reset lpc states */
   lpc_reset(st->lpcSt);
   
   /* Reset lsp states */
   lsp_reset(st->lspSt);
    
   /* Reset clLtp states */
   cl_ltp_reset(st->clLtpSt);
   
   gainQuant_reset(st->gainQuantSt);

   p_ol_wgh_reset(st->pitchOLWghtSt);

   ton_stab_reset(st->tonStabSt);   

#ifndef VAD2
   vad1_reset(st->vadSt);
#else
   vad2_reset(st->vadSt);
#endif 
   
   dtx_enc_reset(st->dtx_encSt);

   st->sharp = SHARPMIN;
   
   return 0;
}