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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lpc.c

?? VC G.723
?? 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 4.1
    copyright (c) 1995, AudioCodes, DSP Group, France Telecom,
    Universite de Sherbrooke.  All rights reserved.
*/

#include <stdio.h>

#include "typedef.h"
#include "basop.h"
#include "cst_lbc.h"
#include "tab_lbc.h"
#include "lbccodec.h"
#include "coder.h"
#include "decod.h"
#include "util_lbc.h"
#include "lpc.h"


/*
**
** 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   Corr[LpcOrder] ;
   Word16   Err   ;
   Word16   Exp   ;

   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 
    */
   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 */
      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 ) ;

      Err = round( Acc1 ) ;

      /* 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] ) ;
         Corr[i-1] = round(Acc0) ;
         }


      /*
       * Apply the Levinson-Durbin algorithm to generate the LPC
       * coefficients
       */
      Durbin( &UnqLpc[k*LpcOrder], Corr, Err ) ;
      }

    /* 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 ;
}


/*
**
** 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 )
{
    int     i,j   ;

    Word16  Temp[LpcOrder] ;
    Word16  Pk ;

    Word32  Acc0,Acc1,Acc2 ;
    extern  CODSTATDEF  CodStat  ;

   /*
    * 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 )
         break ;

      Pk = div_l( Acc0, Err ) ;

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

      /*
       * Sine detector
       */
        if ( i == 1 ) {
        CodStat.SinDet <<= 1 ;
            if ( Pk > 0x799a )
                CodStat.SinDet ++ ;
        }

      /*
       * 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 ;


   /* 
    * Do for all elements in a subframe
    */
   for ( i = 0 ; i < SubFrLen ; i ++ ) {


      /* 
       * Synthesis filter 
       */
      for ( j = 0 ; j < LpcOrder ; j ++ )
         Acc0 = L_mac( Acc0, QntLpc[j], FirDl[j] ) ;
      Acc1 = L_shl( Acc0, (Word16) 2 ) ;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一卡二卡在线观看| 91亚洲精品久久久蜜桃网站| 欧美日韩另类国产亚洲欧美一级| 国产sm精品调教视频网站| 青青草精品视频| 激情欧美日韩一区二区| 国产一区二区三区观看| 国产成人精品影视| 91麻豆国产自产在线观看| av电影在线观看不卡| 在线亚洲免费视频| 制服丝袜亚洲网站| 中文字幕国产一区二区| 亚洲精品视频免费观看| 欧美aaaaaa午夜精品| 国产91色综合久久免费分享| 91啪亚洲精品| 久久婷婷色综合| 亚洲欧洲无码一区二区三区| 视频在线观看一区| 不卡电影免费在线播放一区| 色美美综合视频| 26uuu成人网一区二区三区| 亚洲精品五月天| 国产精品小仙女| 在线观看成人免费视频| 欧美激情一区在线观看| 免费在线观看日韩欧美| 一本到高清视频免费精品| 久久综合成人精品亚洲另类欧美| 亚洲综合在线视频| av一区二区三区黑人| 日韩精品一区二区三区四区 | 久久久精品黄色| 午夜av一区二区三区| 色老汉一区二区三区| 国产精品乱码妇女bbbb| 精品一区二区精品| 日韩视频永久免费| 免费在线观看视频一区| 4hu四虎永久在线影院成人| 亚洲免费看黄网站| 91国产成人在线| 一区二区在线观看视频| 精品视频免费在线| 一区二区三区资源| 欧美性三三影院| 美女一区二区视频| 精品国产人成亚洲区| 国产精品一二三区在线| 国产亚洲人成网站| 一本色道a无线码一区v| 亚洲精品成a人| 欧美成人性战久久| 亚洲综合久久久久| 蜜臀av国产精品久久久久| 日韩精品资源二区在线| 日本不卡一区二区三区| 日韩欧美一级在线播放| 成人精品在线视频观看| 天天色天天爱天天射综合| 精品国产乱码久久久久久免费 | 5566中文字幕一区二区电影| 久久99精品久久久久久久久久久久 | 欧美乱妇一区二区三区不卡视频| 老色鬼精品视频在线观看播放| 精品福利在线导航| 欧美伊人精品成人久久综合97 | 欧美无人高清视频在线观看| 老司机午夜精品| 亚洲自拍偷拍图区| 国产欧美久久久精品影院| 欧美日韩日本视频| 色综合天天综合网天天狠天天| 美腿丝袜亚洲一区| 日本欧美一区二区三区| 国产精品成人免费在线| 精品欧美乱码久久久久久1区2区| 91美女视频网站| zzijzzij亚洲日本少妇熟睡| 美女高潮久久久| 美腿丝袜一区二区三区| 日本不卡视频一二三区| 亚洲精品一二三| 亚洲免费资源在线播放| 中文字幕高清不卡| 日本一区二区三级电影在线观看 | 欧美aⅴ一区二区三区视频| 亚洲午夜精品久久久久久久久| 亚洲丝袜美腿综合| 亚洲欧洲日韩综合一区二区| 国产农村妇女毛片精品久久麻豆| 2020日本不卡一区二区视频| 日韩手机在线导航| 久久日韩粉嫩一区二区三区| 久久久夜色精品亚洲| 日韩美女久久久| 天堂va蜜桃一区二区三区漫画版| 亚洲高清免费观看高清完整版在线观看| 亚洲色图欧美偷拍| 免费精品99久久国产综合精品| 蜜臀精品一区二区三区在线观看 | 欧美一区二区三区视频免费播放| 欧美日韩卡一卡二| 狠狠久久亚洲欧美| 视频一区在线播放| 国产在线视频不卡二| 99视频热这里只有精品免费| 91福利视频网站| 精品国产免费视频| 亚洲精品五月天| 国产精品香蕉一区二区三区| 欧美在线视频不卡| 国产精品乱码久久久久久| 三级久久三级久久久| 粉嫩av一区二区三区粉嫩| 欧美日韩国产美女| 又紧又大又爽精品一区二区| 国产麻豆精品视频| 日韩一区二区三区视频| 夜夜夜精品看看| 99免费精品视频| 国产欧美在线观看一区| 久久国产精品免费| 日韩一区二区三区高清免费看看| 亚洲精品五月天| 91免费在线看| 亚洲综合在线五月| 欧美午夜理伦三级在线观看| 亚洲美女一区二区三区| 91在线看国产| 一区二区三区四区精品在线视频 | 欧美一区二区精品| 三级欧美韩日大片在线看| 91麻豆精品国产自产在线观看一区| 亚洲男人天堂av| 欧美在线观看18| 国内偷窥港台综合视频在线播放| 欧美三级蜜桃2在线观看| 午夜视频一区在线观看| 欧美一区二区三区视频免费 | 精品久久久久av影院| 国产做a爰片久久毛片| 国产精品乱码一区二三区小蝌蚪| 高清不卡一区二区在线| 又紧又大又爽精品一区二区| 欧美在线一二三四区| 国内精品自线一区二区三区视频| 欧美大片拔萝卜| 国产suv精品一区二区883| 国产精品高潮呻吟| 3d成人动漫网站| jlzzjlzz亚洲日本少妇| 天堂av在线一区| 中文字幕一区二区不卡| 91麻豆精品91久久久久久清纯| 国产一区二区三区免费看| 中文字幕视频一区| 久久精子c满五个校花| 欧美优质美女网站| www.性欧美| 国产尤物一区二区| 亚洲 欧美综合在线网络| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲成人综合网站| 一区二区不卡在线播放| 综合婷婷亚洲小说| 色老汉一区二区三区| 免费看日韩a级影片| 亚洲一区二区三区影院| 久久久青草青青国产亚洲免观| 欧美理论片在线| 欧美熟乱第一页| 91黄色免费版| 欧美午夜电影一区| 欧美三级视频在线观看| 欧洲精品一区二区| 宅男噜噜噜66一区二区66| 91官网在线免费观看| 欧美性色黄大片手机版| 欧美精品777| 精品久久久久久最新网址| 日韩欧美高清一区| 久久伊人蜜桃av一区二区| 久久综合精品国产一区二区三区| 日韩免费观看高清完整版| 精品对白一区国产伦| 国产精品麻豆网站| 亚洲成人中文在线| 久久99精品一区二区三区| 成人午夜av电影| 欧洲人成人精品| 久久精品亚洲精品国产欧美| 亚洲人成网站色在线观看| 亚洲 欧美综合在线网络| 狠狠狠色丁香婷婷综合久久五月| 国产激情91久久精品导航| 色综合久久综合| 精品少妇一区二区三区| 亚洲免费观看高清完整版在线观看 |