www.pudn.com > p_voice.rar > DEC_SID.C


/* 
   ITU-T G.729 Annex C+ - Reference C code for floating point 
                         implementation of G.729 Annex C+ 
                         (integration of Annexes B, D and E) 
                          Version 2.1 of October 1999 
*/ 
 
 
/* 
 File : DEC_SID.C 
*/ 
 
/* 
** 
** 
** Description:     Comfort noise generation 
**                  performed at the decoder part 
** 
*/ 
/**** Floatting point version ***/ 
 
#include  
#include  
#include  
#include "typedef.h" 
#include "ld8k.h" 
#include "tab_ld8k.h" 
#include "ld8cp.h" 
#include "tabld8cp.h" 
#include "vad.h" 
#include "dtx.h" 
#include "sid.h" 
#include "tab_dtx.h" 
 
static FLOAT cur_gain; 
static FLOAT lspSid[M]; 
static FLOAT sid_gain; 
 
/* 
** 
** Function:        init_dec_cng() 
** 
** Description:     Initialize dec_cng static variables 
** 
** 
*/ 
void init_dec_cng(void) 
{ 
    int i; 
     
    for (i=0; i 1) { 
            qua_Sidgain(&sid_sav, 0, &temp, &ind); 
            sid_gain = tab_Sidgain[ind]; 
        } 
         
    } 
     
    if(past_ftyp > 1) { 
        cur_gain = sid_gain; 
    } 
    else { 
        cur_gain *= A_GAIN0; 
        cur_gain += A_GAIN1 * sid_gain; 
    } 
     
    calc_exc_rand(cur_gain, exc, seed, FLAG_DEC); 
     
    /* Interpolate the Lsp vectors */ 
    int_qlpc(lsp_old, lspSid, A_t); 
    copy(lspSid, lsp_old, M); 
     
    return; 
} 
 
/*---------------------------------------------------------------------------* 
* Function  init_lsfq_noise                                                 * 
* ~~~~~~~~~~~~~~~~~~~~~~~~~                                                 * 
*                                                                           * 
* -> Initialization of variables for the lsf quantization in the SID        * 
*                                                                           * 
*---------------------------------------------------------------------------*/ 
void init_lsfq_noise(void) 
{ 
    int i, j; 
     
    /* initialize the noise_fg */ 
    for (i=0; i<4; i++) 
        copy(fg[0][i], noise_fg[0][i], M); 
     
    for (i=0; i<4; i++) 
        for (j=0; j