示例#1
0
void Init_Coder_ld8a(void)
{

  /*----------------------------------------------------------------------*
  *      Initialize pointers to speech vector.                            *
  *                                                                       *
  *                                                                       *
  *   |--------------------|-------------|-------------|------------|     *
  *     previous speech           sf1           sf2         L_NEXT        *
  *                                                                       *
  *   <----------------  Total speech vector (L_TOTAL)   ----------->     *
  *   <----------------  LPC analysis window (L_WINDOW)  ----------->     *
  *   |                   <-- present frame (L_FRAME) -->                 *
  * old_speech            |              <-- new speech (L_FRAME) -->     *
  * p_window              |              |                                *
  *                     speech           |                                *
  *                             new_speech                                *
  *-----------------------------------------------------------------------*/

  new_speech = old_speech + L_TOTAL - L_FRAME;         /* New speech     */
  speech     = new_speech - L_NEXT;                    /* Present frame  */
  p_window   = old_speech + L_TOTAL - L_WINDOW;        /* For LPC window */

  /* Initialize static pointers */

  wsp    = old_wsp + PIT_MAX;
  exc    = old_exc + PIT_MAX + L_INTERPOL;

  /* Static vectors to zero */

  Set_zero(old_speech, L_TOTAL);
  Set_zero(old_exc, PIT_MAX+L_INTERPOL);
  Set_zero(old_wsp, PIT_MAX);
  Set_zero(mem_w,   M);
  Set_zero(mem_w0,  M);
  Set_zero(mem_zero, M);
  sharp = SHARPMIN;

  /* Initialize lsp_old_q[] */

  Copy(lsp_old, lsp_old_q, M);
  Lsp_encw_reset();
  Init_exc_err();

  /* For G.729B */
  /* Initialize VAD/DTX parameters */
  pastVad = 1;
  ppastVad = 1;
  seed = INIT_SEED;
  vad_init();
  Init_lsfq_noise();

  return;
}
示例#2
0
void Init_Coder_ld8g(Word16 dtx_enable)
{

    Word16 i;
  /*----------------------------------------------------------------------*
  *      Initialize pointers to speech vector.                            *
  *                                                                       *
  *                                                                       *
  *   |--------------------|-------------|-------------|------------|     *
  *     previous speech           sf1           sf2         L_NEXT        *
  *                                                                       *
  *   <----------------  Total speech vector (L_TOTAL)   ----------->     *
  *   <----------------  LPC analysis window (L_WINDOW)  ----------->     *
  *   |                   <-- present frame (L_FRAME) -->                 *
  * old_speech            |              <-- new speech (L_FRAME) -->     *
  * p_window              |              |                                *
  *                     speech           |                                *
  *                             new_speech                                *
  *-----------------------------------------------------------------------*/

    new_speech = old_speech + L_TOTAL - L_FRAME;         /* New speech     */
    speech     = new_speech - L_NEXT;                    /* Present frame  */
    p_window   = old_speech + L_TOTAL - L_WINDOW;        /* For LPC window */

    /* Initialize static pointers */
    wsp    = old_wsp + PIT_MAX;
    exc    = old_exc + PIT_MAX + L_INTERPOL;
    zero   = ai_zero + M_BWDP1;
    error  = mem_err + M_BWD;

    /* Static vectors to zero */
    Set_zero(old_speech, L_TOTAL);
    Set_zero(old_exc, PIT_MAX+L_INTERPOL);
    Set_zero(old_wsp, PIT_MAX);
    Set_zero(mem_syn, M_BWD);
    Set_zero(mem_w,   M_BWD);
    Set_zero(mem_w0,  M_BWD);
    Set_zero(mem_err, M_BWD);
    Set_zero(zero, L_SUBFR);
    sharp = SHARPMIN;

    /* Initialize lsp_old_q[] */
    Copy(lsp_old, lsp_old_q, M);

    Lsp_encw_resete(freq_prev);

	/* to tame the coder */
	Init_exc_err();			/* G.729 maintenance */
							/* before : for(i=0; i<4; i++) L_exc_err[i] = 0x00004000L;   /* Q14 */

    /* for the backward analysis */
    Set_zero(synth, L_ANA_BWD); /*Q14 */
    synth_ptr = synth + MEM_SYN_BWD;
    prev_lp_mode = 0;
    bwd_dominant = 0;              /* See file bwfw.c */
    C_int = 4506;       /* Filter interpolation parameter */
    glob_stat = 10000;  /* Mesure of global stationnarity Q8 */
    stat_bwd = 0;       /* Nbre of consecutive backward frames */
    val_stat_bwd = 0;   /* Value associated with stat_bwd */

    for(i=0; i<M_BWDP1; i++) rexp[i] = 0L;

    A_t_bwd_mem[0] = 4096;
    for (i=1; i<M_BWDP1; i++) A_t_bwd_mem[i] = 0;
    Set_zero(prev_filter, M_BWDP1);
    prev_filter[0] = 4096;

    Set_zero(old_A_bwd, M_BWDP1);
    old_A_bwd[0]=4096;
    Set_zero(old_rc_bwd, 2);

    Set_zero(old_A_fwd, MP1);
    old_A_fwd[0]=4096;
    Set_zero(old_rc_fwd, 2);

    /* For G.729B */
    /* Initialize VAD/DTX parameters */
    if(dtx_enable == 1) {
        pastVad = 1;
        ppastVad = 1;
        seed = INIT_SEED;
        vad_init();
        Init_lsfq_noise();
		Init_Cod_cng();		/* G.729 maintenance */
    }
    
    return;
}