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

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

?? 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 ) ;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区二区中文字幕| 久久婷婷综合激情| 亚洲一区在线免费观看| 欧美三级三级三级爽爽爽| 亚洲资源中文字幕| 欧美日韩成人综合在线一区二区| 亚洲超丰满肉感bbw| 91麻豆精品国产91久久久资源速度 | 91精品国产丝袜白色高跟鞋| 亚洲第一福利视频在线| 欧美一卡在线观看| 国产美女精品在线| 《视频一区视频二区| 日本韩国欧美在线| 日韩av一二三| 国产日韩欧美高清| 不卡在线观看av| 亚洲精品中文字幕在线观看| 欧美吞精做爰啪啪高潮| 久久成人综合网| 欧美激情综合五月色丁香| 欧美三区在线视频| 国产一区二区剧情av在线| 成人欧美一区二区三区| 欧美军同video69gay| 久久成人久久爱| 中文字幕日韩一区二区| 欧美色大人视频| 粉嫩一区二区三区在线看| 亚洲影院久久精品| 国产欧美一区视频| 在线电影一区二区三区| 不卡一区二区中文字幕| 婷婷中文字幕一区三区| 国产精品久久久久久久裸模| 欧美三级电影精品| 国产91精品一区二区麻豆网站| 亚洲黄色av一区| 久久久另类综合| 欧美猛男超大videosgay| 国产高清精品在线| 天天色天天爱天天射综合| 国产精品视频在线看| 91精品国产福利| 91热门视频在线观看| 国产又黄又大久久| 亚洲第一福利视频在线| 最近日韩中文字幕| 久久综合资源网| 欧美精品黑人性xxxx| 99re热这里只有精品视频| 久久99精品久久只有精品| 樱桃国产成人精品视频| 中文字幕高清一区| 久久色在线观看| 日韩欧美专区在线| 538prom精品视频线放| 欧美三级日韩三级国产三级| 成人高清av在线| 精品亚洲国产成人av制服丝袜| 天堂午夜影视日韩欧美一区二区| 亚洲免费观看视频| 日韩一区在线看| 国产人伦精品一区二区| 精品国产乱码久久久久久老虎 | 欧美中文字幕一区| 91网址在线看| jizz一区二区| av在线不卡观看免费观看| 国产.精品.日韩.另类.中文.在线.播放| 婷婷国产在线综合| 日韩经典一区二区| 日韩av电影免费观看高清完整版 | 综合精品久久久| 亚洲国产成人一区二区三区| 国产欧美一区二区精品婷婷| 久久亚洲精品小早川怜子| 欧美精品一区二区不卡 | 成人激情小说乱人伦| 国产一区不卡在线| 国产乱国产乱300精品| 国产一区二区在线电影| 国产一区二区三区四区五区入口| 久久99久国产精品黄毛片色诱| 日本强好片久久久久久aaa| 免费黄网站欧美| 久久精品国产99国产| 国产主播一区二区三区| 成人午夜免费电影| 91在线视频18| 欧美性大战久久久久久久蜜臀| 在线观看不卡视频| 日韩一区二区三区三四区视频在线观看 | 欧美日韩一级片网站| 欧美性极品少妇| 69堂国产成人免费视频| 精品99999| 亚洲国产精品av| 一级日本不卡的影视| 亚洲一区二区三区四区五区黄 | 在线播放/欧美激情| 精品乱人伦小说| 国产精品嫩草影院com| 一区二区视频免费在线观看| 亚洲一区二区三区不卡国产欧美| 午夜精品视频一区| 国产毛片精品视频| 97久久超碰国产精品电影| 欧美婷婷六月丁香综合色| 日韩精品专区在线影院观看| 国产精品久久久久久久浪潮网站| 亚洲自拍偷拍九九九| 狠狠色丁香婷婷综合久久片| 99久久久久久| 56国语精品自产拍在线观看| 国产人成亚洲第一网站在线播放| 亚洲精品国产第一综合99久久| 激情偷乱视频一区二区三区| 成人av一区二区三区| 欧美三区在线观看| 国产丝袜在线精品| 亚洲福利一二三区| 国产伦精品一区二区三区免费迷| 一本一道波多野结衣一区二区| 欧美丰满高潮xxxx喷水动漫| 国产日韩欧美制服另类| 一区二区三国产精华液| 国产成人精品网址| 欧美色中文字幕| 欧美高清一级片在线观看| 日韩精品久久久久久| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 美女在线观看视频一区二区| 成人精品gif动图一区| 欧美日韩一区二区三区在线| 久久蜜桃av一区精品变态类天堂| 亚洲午夜久久久久久久久电影院| 久久成人久久爱| 在线不卡一区二区| 日韩久久一区二区| 国产精品亚洲综合一区在线观看| 欧美日韩国产一级二级| 中文字幕制服丝袜成人av| 久久国产人妖系列| 欧美日本在线视频| 亚洲激情一二三区| 99久久国产综合精品色伊| 国产午夜精品一区二区三区嫩草| 日本中文在线一区| 欧美日韩免费视频| 一区二区高清免费观看影视大全| 夫妻av一区二区| 精品国产乱码久久久久久免费| 日韩二区三区四区| 欧美日韩国产精品成人| 亚洲欧美日韩成人高清在线一区| 国产不卡视频一区二区三区| 久久婷婷综合激情| 九色综合狠狠综合久久| 日韩你懂的在线播放| 亚洲成人动漫精品| 欧美日韩综合一区| 一区二区在线观看免费视频播放| 99re这里只有精品视频首页| 中文字幕免费不卡| 成人小视频在线| 国产精品嫩草影院com| av在线这里只有精品| 自拍av一区二区三区| 91天堂素人约啪| 亚洲欧美一区二区久久 | 国产高清在线精品| 久久久91精品国产一区二区精品 | 一本色道a无线码一区v| 亚洲婷婷综合色高清在线| 99在线视频精品| 亚洲日本在线天堂| 日本精品一级二级| 亚洲一区二区偷拍精品| 制服丝袜亚洲网站| 免费日本视频一区| 久久日一线二线三线suv| 国产一区二区毛片| 国产精品久久久久9999吃药| 成人午夜伦理影院| 亚洲综合在线电影| 欧美一级日韩不卡播放免费| 狠狠色狠狠色合久久伊人| 久久精品在这里| 91色综合久久久久婷婷| 亚洲国产精品视频| 日韩欧美黄色影院| a级高清视频欧美日韩| 亚洲一区视频在线| 亚洲精品在线观看网站| www.视频一区| 国产在线一区二区综合免费视频| 国产精品嫩草久久久久| 欧美军同video69gay| 国产麻豆欧美日韩一区|