亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lpc.c

?? g723_src.c編碼算法的C程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
**
** File:    lpc.c
**
** Description: Functions that implement linear predictive coding 
**      (LPC) operations.  
**
** Functions:
**
**  Computing LPC coefficients:
**
**      Comp_Lpc()
**      Durbin()
**
**  Perceptual noise weighting:
**
**      Wght_Lpc()
**      Error_Wght()
**
**  Computing combined impulse response:
**
**      Comp_Ir()
**
**  Computing ringing response:
**
**      Sub_Ring()
**      Upd_Ring()
**
**  Synthesizing speech:
**
**      Synt()
**      Spf()
*/

/*
    ITU-T G.723 Speech Coder   ANSI-C Source Code     Version 5.00
    copyright (c) 1995, AudioCodes, DSP Group, France Telecom,
    Universite de Sherbrooke.  All rights reserved.
*/



/*
**
** Function:        Comp_Lpc()
**
** Description:     Computes the tenth-order LPC filters for an
**          entire frame.  For each subframe, a
**          Hamming-windowed block of 180 samples,
**          centered around the subframe, is used to
**          compute eleven autocorrelation coefficients.
**          The Levinson-Durbin algorithm then generates
**          the LPC coefficients.  This function requires
**          a look-ahead of one subframe, and hence
**          introduces a 7.5 ms encoding delay.
**
** Links to text:   Section 2.4
**
** Arguments:
**
**  Word16 *UnqLpc      Empty Buffer
**  Word16 PrevDat[]    Previous 2 subframes of samples (120 words)
**  Word16 DataBuff[]   Current frame of samples (240 words)
**
** Outputs:

**
**  Word16 UnqLpc[]     LPC coefficients for entire frame (40 words)
**
** Return value:    None
**
*/
void  Comp_Lpc( Word16 *UnqLpc, Word16 *PrevDat, Word16 *DataBuff )
{
    int   i,j,k ;

    Word16   Dpnt[Frame+LpcFrame-SubFrLen] ;
    Word16   Vect[LpcFrame] ;
    Word16   Acf_sf[LpcOrderP1*SubFrames];
    Word16   ShAcf_sf[SubFrames];
    Word16   Exp   ;
    Word16   *curAcf;
    Word16   Pk2;

    Word32   Acc0,Acc1   ;

    /*
     * Generate a buffer of 360 samples.  This consists of 120 samples
     * from the previous frame and 240 samples from the current frame.
     */
    for ( i = 0 ; i < LpcFrame-SubFrLen ; i ++ )
        Dpnt[i] = PrevDat[i] ;
    for ( i = 0 ; i < Frame ; i ++ )
        Dpnt[i+LpcFrame-SubFrLen] = DataBuff[i] ;


    /*
     * Repeat for all subframes
     */
    curAcf = Acf_sf;
    for ( k = 0 ; k < SubFrames ; k ++ ) {


        /*
        * Do windowing
        */

        /* Get block of 180 samples centered around current subframe */
        for ( i = 0 ; i < LpcFrame ; i ++ )
            Vect[i] = Dpnt[k*SubFrLen+i] ;

        /* Normalize */
        ShAcf_sf[k] = Vec_Norm( Vect, (Word16) LpcFrame ) ;

        /* Apply the Hamming window */
        for ( i = 0 ; i < LpcFrame ; i ++ )
            Vect[i] = mult_r(Vect[i], HammingWindowTable[i]) ;


        /*
        * Compute the autocorrelation coefficients
        */

        /* Compute the zeroth-order coefficient (energy) */
        Acc1 = (Word32) 0 ;
        for ( i = 0 ; i < LpcFrame ; i ++ ) {
            Acc0 = L_mult( Vect[i], Vect[i] ) ;
            Acc0 = L_shr( Acc0, (Word16) 1 ) ;
            Acc1 = L_add( Acc1, Acc0 ) ;
        }

        /* Apply a white noise correction factor of (1025/1024) */
        Acc0 = L_shr( Acc1, (Word16) RidgeFact ) ;
        Acc1 = L_add( Acc1, Acc0 ) ;

        /* Normalize the energy */
        Exp = norm_l( Acc1 ) ;
        Acc1 = L_shl( Acc1, Exp ) ;

        curAcf[0] = round( Acc1 ) ;
        if(curAcf[0] == 0) {
            for ( i = 1 ; i <= LpcOrder ; i ++ )
                curAcf[i] = 0;
            ShAcf_sf[k] = 40;
        }

        else {
            /* Compute the rest of the autocorrelation coefficients.
               Multiply them by a binomial coefficients lag window. */
            for ( i = 1 ; i <= LpcOrder ; i ++ ) {
                Acc1 = (Word32) 0 ;
                for ( j = i ; j < LpcFrame ; j ++ ) {
                    Acc0 = L_mult( Vect[j], Vect[j-i] ) ;
                    Acc0 = L_shr( Acc0, (Word16) 1 ) ;
                    Acc1 = L_add( Acc1, Acc0 ) ;
                }
                Acc0 = L_shl( Acc1, Exp ) ;
                Acc0 = L_mls( Acc0, BinomialWindowTable[i-1] ) ;
                curAcf[i] = round(Acc0) ;
            }
            /* Save Acf scaling factor */
            ShAcf_sf[k] = add(Exp, shl(ShAcf_sf[k], 1));
        }

        /*
         * Apply the Levinson-Durbin algorithm to generate the LPC
         * coefficients
        */
        Durbin( &UnqLpc[k*LpcOrder], &curAcf[1], curAcf[0], &Pk2 );
        CodStat.SinDet <<= 1;
        if ( Pk2 > 0x799a ) {
            CodStat.SinDet ++ ;
        }
        curAcf += LpcOrderP1;
    }

    /* Update sine detector */
    CodStat.SinDet &= 0x7fff ;

    j = CodStat.SinDet ;
    k = 0 ;
    for ( i = 0 ; i < 15 ; i ++ ) {
        k += j & 1 ;
        j >>= 1 ;
    }
    if ( k >= 14 )
        CodStat.SinDet |= 0x8000 ;

    /* Update CNG Acf memories */
    Update_Acf(Acf_sf, ShAcf_sf);

}


/*
**
** Function:        Durbin()
**
** Description:     Implements the Levinson-Durbin algorithm for a
**          subframe.  The Levinson-Durbin algorithm
**          recursively computes the minimum mean-squared
**          error (MMSE) linear prediction filter based on the
**          estimated autocorrelation coefficients.
**
** Links to text:   Section 2.4
**
** Arguments:       
**
**  Word16 *Lpc Empty buffer
**  Word16 Corr[]   First- through tenth-order autocorrelations (10 words)
**  Word16 Err  Zeroth-order autocorrelation, or energy
**
** Outputs:     
**
**  Word16 Lpc[]    LPC coefficients (10 words)
**
** Return value:    The error
**
*/
Word16  Durbin( Word16 *Lpc, Word16 *Corr, Word16 Err, Word16 *Pk2 )
{
    int   i,j   ;

    Word16   Temp[LpcOrder] ;
    Word16   Pk ;

    Word32   Acc0,Acc1,Acc2 ;

 /*
  * Initialize the LPC vector
  */
    for ( i = 0 ; i < LpcOrder ; i ++ )
        Lpc[i] = (Word16) 0 ;

 /*
  * Do the recursion.  At the ith step, the algorithm computes the
  * (i+1)th - order MMSE linear prediction filter.
  */
    for ( i = 0 ; i < LpcOrder ; i ++ ) {

/*
 * Compute the partial correlation (parcor) coefficient
 */

        /* Start parcor computation */
        Acc0 = L_deposit_h( Corr[i] ) ;
        Acc0 = L_shr( Acc0, (Word16) 2 ) ;
        for ( j = 0 ; j < i ; j ++ )
            Acc0 = L_msu( Acc0, Lpc[j], Corr[i-j-1] ) ;
        Acc0 = L_shl( Acc0, (Word16) 2 ) ;

        /* Save sign */
        Acc1 = Acc0 ;
        Acc0 = L_abs( Acc0 ) ;

        /* Finish parcor computation */
        Acc2 = L_deposit_h( Err ) ;
        if ( Acc0 >= Acc2 ) {
            *Pk2 = 32767;
            break ;
        }

        Pk = div_l( Acc0, Err ) ;

        if ( Acc1 >= 0 )
            Pk = negate(Pk) ;

 /*
  * Sine detector
  */
        if ( i == 1 ) *Pk2 = Pk;

 /*
  * Compute the ith LPC coefficient
  */
        Acc0 = L_deposit_h( negate(Pk) ) ;
        Acc0 = L_shr( Acc0, (Word16) 2 ) ;
        Lpc[i] = round( Acc0 ) ;

 /*
  * Update the prediction error
  */
        Acc1 = L_mls( Acc1, Pk ) ;
        Acc1 = L_add( Acc1, Acc2 ) ;
        Err = round( Acc1 ) ;

 /*
  * Compute the remaining LPC coefficients
  */
        for ( j = 0 ; j < i ; j ++ )
            Temp[j] = Lpc[j] ;

        for ( j = 0 ; j < i ; j ++ ) {
            Acc0 = L_deposit_h( Lpc[j] ) ;
            Acc0 = L_mac( Acc0, Pk, Temp[i-j-1] ) ;
            Lpc[j] = round( Acc0 ) ;
        }
    }

    return Err ;
}

/*
**
** Function:        Wght_Lpc()
**
** Description:     Computes the formant perceptual weighting
**          filter coefficients for a frame.  These
**          coefficients are geometrically scaled versions
**          of the unquantized LPC coefficients.
**
** Links to text:   Section 2.8  
**
** Arguments:       
**
**  Word16 *PerLpc      Empty Buffer
**  Word16 UnqLpc[]     Unquantized LPC coefficients (40 words)
**
** Outputs:     

**
**  Word16 PerLpc[]     Perceptual weighting filter coefficients
**              (80 words)
**
** Return value:    None
**
*/
void  Wght_Lpc( Word16 *PerLpc, Word16 *UnqLpc )
{
    int   i,j   ;


 /*
  * Do for all subframes
  */
    for ( i = 0 ; i < SubFrames ; i ++ ) {


 /*
  * Compute the jth FIR coefficient by multiplying the jth LPC
  * coefficient by (0.9)^j.
  */
        for ( j = 0 ; j < LpcOrder ; j ++ )
            PerLpc[j] = mult_r( UnqLpc[j], PerFiltZeroTable[j] ) ;
        PerLpc += LpcOrder ;


/*
 * Compute the jth IIR coefficient by multiplying the jth LPC
 * coefficient by (0.5)^j.
 */
        for ( j = 0 ; j < LpcOrder ; j ++ )
            PerLpc[j] = mult_r( UnqLpc[j], PerFiltPoleTable[j] ) ;
        PerLpc += LpcOrder ;
        UnqLpc += LpcOrder ;
    }
}

/*
**
** Function:        Error_Wght()
**
** Description:     Implements the formant perceptual weighting
**          filter for a frame. This filter effectively
**          deemphasizes the formant frequencies in the
**          error signal.
**
** Links to text:   Section 2.8
**
** Arguments:
**
**  Word16 Dpnt[]       Highpass filtered speech x[n] (240 words)
**  Word16 PerLpc[]     Filter coefficients (80 words)
**
** Inputs:
**
**  CodStat.WghtFirDl[] FIR filter memory from previous frame (10 words)
**  CodStat.WghtIirDl[] IIR filter memory from previous frame (10 words)

**
** Outputs:
**
**  Word16 Dpnt[]       Weighted speech f[n] (240 words)
**
** Return value:    None
**
*/
void  Error_Wght( Word16 *Dpnt, Word16 *PerLpc )
{
    int   i,j,k ;

    Word32   Acc0  ;


/*
 * Do for all subframes
 */
    for ( k = 0 ; k < SubFrames ; k ++ ) {

        for ( i = 0 ; i < SubFrLen ; i ++ ) {

/*
 * Do the FIR part
 */
            /* Filter */
            Acc0 = L_mult( *Dpnt, (Word16) 0x2000 ) ;
            for ( j = 0 ; j < LpcOrder ; j ++ )
                Acc0 = L_msu( Acc0, PerLpc[j], CodStat.WghtFirDl[j] ) ;

            /* Update memory */
            for ( j = LpcOrder-1 ; j > 0 ; j -- )
                CodStat.WghtFirDl[j] = CodStat.WghtFirDl[j-1] ;
            CodStat.WghtFirDl[0] = *Dpnt ;

 /*
  * Do the IIR part
  */

            /* Filter */
            for ( j = 0 ; j < LpcOrder ; j ++ )
                Acc0 = L_mac( Acc0, PerLpc[LpcOrder+j],
                                                    CodStat.WghtIirDl[j] ) ;
            for ( j = LpcOrder-1 ; j > 0 ; j -- )
                CodStat.WghtIirDl[j] = CodStat.WghtIirDl[j-1] ;
            Acc0 = L_shl( Acc0, (Word16) 2 ) ;

            /* Update memory */
            CodStat.WghtIirDl[0] = round( Acc0 ) ;
            *Dpnt ++ = CodStat.WghtIirDl[0] ;
        }
        PerLpc += 2*LpcOrder ;
    }
}

/*
**
** Function:        Comp_Ir()
**
** Description:     Computes the combined impulse response of the
**          formant perceptual weighting filter, harmonic
**          noise shaping filter, and synthesis filter for
**          a subframe.
**
** Links to text:   Section 2.12
**
** Arguments:
**
**  Word16 *ImpResp     Empty Buffer
**  Word16 QntLpc[]     Quantized LPC coefficients (10 words)
**  Word16 PerLpc[]     Perceptual filter coefficients (20 words)
**  PWDEF Pw        Harmonic noise shaping filter parameters
**
** Outputs:
**
**  Word16 ImpResp[]    Combined impulse response (60 words)
**
** Return value:    None
**
*/
void  Comp_Ir( Word16 *ImpResp, Word16 *QntLpc, Word16 *PerLpc, PWDEF Pw )
{
    int   i,j   ;

    Word16   FirDl[LpcOrder] ;
    Word16   IirDl[LpcOrder] ;
    Word16   Temp[PitchMax+SubFrLen] ;

    Word32   Acc0,Acc1 ;


 /*
  * Clear all memory.  Impulse response calculation requires
  * an all-zero initial state.
  */

    /* Perceptual weighting filter */
    for ( i = 0 ; i < LpcOrder ; i ++ )
        FirDl[i] = IirDl[i] = (Word16) 0 ;

    /* Harmonic noise shaping filter */
    for ( i = 0 ; i < PitchMax+SubFrLen ; i ++ )
        Temp[i] = (Word16) 0 ;


 /*
  * Input a single impulse
  */
    Acc0 = (Word32) 0x04000000L ;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本道色综合久久| 欧美性欧美巨大黑白大战| 亚洲午夜免费视频| 最新日韩av在线| 国产精品久久久久久久久免费丝袜 | 欧美性受xxxx黑人xyx性爽| 99精品国产91久久久久久| a亚洲天堂av| 欧美性xxxxx极品少妇| 欧美日韩国产综合视频在线观看| 欧美午夜精品理论片a级按摩| 欧美日韩免费视频| 欧美一区二区播放| 久久久蜜桃精品| 国产精品成人在线观看| 亚洲夂夂婷婷色拍ww47| 亚洲成av人片一区二区| 美国毛片一区二区| 国产99久久精品| 欧洲亚洲精品在线| 日韩视频免费观看高清完整版| 久久人人爽爽爽人久久久| 中文字幕巨乱亚洲| 午夜精品爽啪视频| 精品一区二区三区视频| 成人一二三区视频| 欧美色视频一区| 精品国产sm最大网站免费看| 国产人伦精品一区二区| 亚洲精品高清视频在线观看| 蓝色福利精品导航| 99re热这里只有精品视频| 91精品国产综合久久精品| 国产精品三级电影| 亚洲网友自拍偷拍| 丰满白嫩尤物一区二区| 色婷婷久久综合| 精品国产制服丝袜高跟| 亚洲男人电影天堂| 国产美女视频一区| 欧美日韩高清一区二区三区| 综合久久国产九一剧情麻豆| 免费高清在线一区| 91成人在线免费观看| 久久麻豆一区二区| 五月天一区二区| 99久久婷婷国产| 久久综合九色综合欧美就去吻| 亚洲精品国产a| 成人av在线播放网站| 日韩一区二区三区三四区视频在线观看 | 国产日产欧美一区二区视频| 亚洲国产精品影院| 91色乱码一区二区三区| 久久久www免费人成精品| 日本欧洲一区二区| 91丝袜美腿高跟国产极品老师 | 91日韩一区二区三区| 日韩精品一区二区三区蜜臀| 亚洲自拍与偷拍| 色天天综合色天天久久| 中文字幕中文乱码欧美一区二区 | 亚洲综合一区二区| av成人免费在线| 国产精品夫妻自拍| 成人av动漫网站| 久久精品人人做| 国产成人在线免费观看| 亚洲精品在线一区二区| 麻豆极品一区二区三区| 日韩无一区二区| 日本va欧美va精品发布| 666欧美在线视频| 美国毛片一区二区三区| 精品少妇一区二区三区日产乱码| 免费成人深夜小野草| 日韩一区二区三区在线| 激情综合网av| 国产午夜精品理论片a级大结局| 黑人精品欧美一区二区蜜桃| 欧美成人一区二区三区片免费| 奇米影视一区二区三区小说| 精品日韩av一区二区| 久久精品国产**网站演员| 欧美变态口味重另类| 经典三级视频一区| 中国色在线观看另类| 99久久99久久综合| 一区二区三区日韩欧美精品| 欧美日韩亚洲综合一区二区三区 | 精品国产91久久久久久久妲己 | 欧美一区二区免费| 另类小说视频一区二区| 国产亚洲美州欧州综合国| 91视频在线观看| 午夜精品福利一区二区三区av| 欧美一卡2卡3卡4卡| 国产在线精品视频| 亚洲日本免费电影| 91精品国产欧美一区二区成人| 久久疯狂做爰流白浆xx| 中文字幕免费不卡| 欧美精品第1页| 国产99久久久久| 亚洲h精品动漫在线观看| 久久综合狠狠综合久久综合88 | 欧美极品少妇xxxxⅹ高跟鞋 | 男人的j进女人的j一区| 国产精品私人自拍| 欧美精品色一区二区三区| 韩国v欧美v日本v亚洲v| 亚洲女爱视频在线| 精品不卡在线视频| 日本电影亚洲天堂一区| 国产在线不卡一卡二卡三卡四卡| 亚洲黄色小视频| 久久久91精品国产一区二区精品| 在线影院国内精品| 国产电影一区在线| 免费视频最近日韩| 亚洲一区二区三区中文字幕| 国产午夜精品理论片a级大结局| 欧美男男青年gay1069videost | 国产激情偷乱视频一区二区三区| 亚洲国产另类精品专区| 中文字幕乱码亚洲精品一区| 日韩欧美精品三级| 欧美日韩一区二区在线观看| 99国产精品99久久久久久| 久久99国产精品尤物| 亚洲1区2区3区视频| 中文字幕五月欧美| 亚洲国产精品成人综合色在线婷婷 | 欧美三级资源在线| voyeur盗摄精品| 国产精品中文字幕日韩精品| 丝袜美腿亚洲色图| 有码一区二区三区| 亚洲图片你懂的| 亚洲欧美在线观看| 中文字幕欧美日韩一区| 国产日韩av一区| 久久精品人人做人人综合| 久久众筹精品私拍模特| 久久综合九色欧美综合狠狠 | 亚洲另类色综合网站| 亚洲色图色小说| 亚洲精品久久久蜜桃| 国产精品久久久久久久浪潮网站| 国产三级欧美三级日产三级99| 欧美草草影院在线视频| 精品入口麻豆88视频| 久久天堂av综合合色蜜桃网| 国产校园另类小说区| 国产精品免费视频观看| 中文av一区特黄| 亚洲免费av高清| 亚洲最新视频在线播放| 日韩成人精品在线| 老汉av免费一区二区三区| 黑人精品欧美一区二区蜜桃| 国产精品888| eeuss鲁片一区二区三区 | 麻豆91精品91久久久的内涵| 裸体在线国模精品偷拍| 韩国三级在线一区| 国产精品一色哟哟哟| 成人免费的视频| 欧美综合一区二区| 7878成人国产在线观看| 精品福利在线导航| 中文字幕一区二区三区在线观看| 亚洲欧美激情插| 亚洲成av人在线观看| 九九九久久久精品| 成人黄页毛片网站| 欧美久久久久久蜜桃| 亚洲精品一区二区三区香蕉| 国产精品久久夜| 亚洲大片一区二区三区| 国产麻豆午夜三级精品| 色综合久久久久| 日韩一区二区三区在线观看| 中文字幕欧美日韩一区| 午夜精品国产更新| 国产九色精品成人porny| 色综合久久久久久久久| 日韩欧美国产一区二区在线播放| 中文在线资源观看网站视频免费不卡| 一区二区三区日韩欧美| 理论片日本一区| 欧美亚洲禁片免费| 国产欧美日韩激情| 视频一区二区三区入口| 不卡视频在线观看| 欧美成人福利视频| 悠悠色在线精品| 成人av在线看| 日韩午夜激情电影| 亚洲国产裸拍裸体视频在线观看乱了 |