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

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

?? lsp.c

?? VC G.723
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
**
** File:    lsp.c
**
** Description: Functions that implement line spectral pair 
**      (LSP) operations.  
**
** Functions:
**
**  Converting between linear predictive coding (LPC) coefficients
**  and LSP frequencies:
**
**      AtoLsp()
**      LsptoA()
**
**  Vector quantization (VQ) of LSP frequencies:
**
**      Lsp_Qnt()
**      Lsp_Svq()
**      Lsp_Inq()
**
**  Interpolation of LSP frequencies:
**
**      Lsp_Int()
*/

/*
    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 "lsp.h"


/*
**
** Function:            AtoLsp()
**
** Description:     Transforms 10 LPC coefficients to the 10
**          corresponding LSP frequencies for a subframe.
**          This transformation is done once per frame,
**          for subframe 3 only.  The transform algorithm
**          generates sum and difference polynomials from
**          the LPC coefficients.  It then evaluates the
**          sum and difference polynomials at uniform
**          intervals of pi/256 along the unit circle.
**          Intervals where a sign change occurs are
**          interpolated to find the zeros of the
**          polynomials, which are the LSP frequencies.
**
** Links to text:   Section 2.5
**
** Arguments:       
**
**  Word16 *LspVect     Empty Buffer
**  Word16 Lpc[]        Unquantized LPC coefficients (10 words)
**  Word16 PrevLsp[]    LSP frequencies from the previous frame (10 words)
**
** Outputs:
**
**  Word16 LspVect[]    LSP frequencies for the current frame (10 words)
**
** Return value:        None
**
**/
void AtoLsp( Word16 *LspVect, Word16 *Lpc, Word16 *PrevLsp )
{

   int   i,j,k ;

   Word32   Lpq[LpcOrder+2] ;
   Word16   Spq[LpcOrder+2] ;

   Word16   Exp   ;
   Word16   LspCnt ;

   Word32   PrevVal,CurrVal   ;
   Word32   Acc0,Acc1   ;


   /* 
    * Perform a bandwidth expansion on the LPC coefficients.  This
    * scales the poles of the LPC synthesis filter by a factor of
    * 0.994.
    */
   for ( i = 0 ; i < LpcOrder ; i ++ )
      LspVect[i] = mult_r( Lpc[i], BandExpTable[i] ) ;

   
   /*
    * Compute the sum and difference polynomials with the roots at z =
    * -1 (sum) or z = +1 (difference) removed.  Let these polynomials
    * be P(z) and Q(z) respectively, and let their coefficients be
    * {p_i} and {q_i}.  The coefficients are stored in the array Lpq[]
    * as follows: p_0, q_0, p_1, q_1, ..., p_5, q_5.  There is no need
    * to store the other coefficients because of symmetry.  
    */


  /* Set p_0 = q_0 = 1.  The LPC coefficients are already scaled by
     1/4.  P(z) and Q(z) are scaled by an additional scaling factor of
     1/16, for an overall factor of 1/64 = 0x02000000L. */
   Lpq[0] = Lpq[1] = (Word32) 0x02000000L ;

   /* This loop computes the coefficients of P(z) and Q(z).  The long
      division (to remove the real zeros) is done recursively. */
   for ( i = 0 ; i < LpcOrder/2 ; i ++ ) {

    /* P(z) */
      Acc0 = L_negate( Lpq[2*i+0] ) ;
      Acc1 = L_deposit_h( LspVect[i] ) ;
      Acc1 = L_shr( Acc1, (Word16) 4 ) ;
      Acc0 = L_sub( Acc0, Acc1 ) ;
      Acc1 = L_deposit_h( LspVect[LpcOrder-1-i] ) ;
      Acc1 = L_shr( Acc1, (Word16) 4 ) ;
      Acc0 = L_sub( Acc0, Acc1 ) ;
      Lpq[2*i+2] = Acc0 ;

    /* Q(z) */
      Acc0 = Lpq[2*i+1] ;
      Acc1 = L_deposit_h( LspVect[i] ) ;
      Acc1 = L_shr( Acc1, (Word16) 4 ) ;

      Acc0 = L_sub( Acc0, Acc1 ) ;
      Acc1 = L_deposit_h( LspVect[LpcOrder-1-i] ) ;
      Acc1 = L_shr( Acc1, (Word16) 4 ) ;
      Acc0 = L_add( Acc0, Acc1 ) ;
      Lpq[2*i+3] = Acc0 ;
      }

  /* Divide p_5 and q_5 by 2 for proper weighting during polynomial
     evaluation. */
   Lpq[LpcOrder+0] = L_shr( Lpq[LpcOrder+0], (Word16) 1 ) ;
   Lpq[LpcOrder+1] = L_shr( Lpq[LpcOrder+1], (Word16) 1 ) ;


  /*
   * Normalize the polynomial coefficients and convert to shorts 
   */

   /* Find the maximum */
   Acc1 = L_abs( Lpq[0] ) ;
   for ( i = 1 ; i < LpcOrder+2 ; i ++ ) {
      Acc0 = L_abs( Lpq[i] ) ;
      if ( Acc0 > Acc1 )
         Acc1 = Acc0 ;
      }

   /* Compute the normalization factor */
   Exp = norm_l( Acc1 ) ;


   /* Normalize and convert to shorts */
   for ( i = 0 ; i < LpcOrder+2 ; i ++ ) {
      Acc0 = L_shl( Lpq[i], Exp ) ;
      Spq[i] = round( Acc0 ) ;
      }


  /*
   * Initialize the search loop
   */  

  /* The variable k is a flag that indicates which polynomial (sum or
     difference) the algorithm is currently evaluating.  Start with
     the sum. */
   k = 0 ;

  /* Evaluate the sum polynomial at frequency zero */
   PrevVal = (Word32) 0 ;
   for ( j = 0 ; j <= LpcOrder/2 ; j ++ )
      PrevVal = L_mac( PrevVal, Spq[2*j], CosineTable[0] ) ;


  /* 
   * Search loop.  Evaluate P(z) and Q(z) at uniform intervals of
   * pi/256 along the unit circle.  Check for zero crossings.  The
   * zeros of P(w) and Q(w) alternate, so only one of them need by
   * evaluated at any given step.
   */
   LspCnt = (Word16) 0 ;
   for ( i = 1 ; i < CosineTableSize/2 ; i ++ ) {

     /* Evaluate the selected polynomial */
      CurrVal = (Word32) 0 ;
      for ( j = 0 ; j <= LpcOrder/2 ; j ++ )
         CurrVal = L_mac( CurrVal, Spq[LpcOrder-2*j+k],
CosineTable[i*j%CosineTableSize] ) ;

    /* Check for a sign change, indicating a zero crossing */
      if ( (CurrVal ^ PrevVal) < (Word32) 0 ) {

    /* Interpolate to find the bottom 7 bits of the 
       zero-crossing frequency */
         Acc0 = L_abs( CurrVal ) ;
         Acc1 = L_abs( PrevVal ) ;
         Acc0 = L_add( Acc0, Acc1 ) ;

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

         Acc1 = L_shr( Acc1, (Word16) 8 ) ;

         LspVect[LspCnt] = div_l( Acc1, extract_h( Acc0 ) ) ;

     /* Add the upper part of the zero-crossing frequency,
        i.e. bits 7-15 */
         Exp = shl( (Word16) (i-1), (Word16) 7 ) ;
         LspVect[LspCnt] = add( LspVect[LspCnt], Exp ) ;
         LspCnt ++ ;

         /* Check if all zeros have been found */
         if ( LspCnt == (Word16) LpcOrder )
            break ;

     /* Switch the pointer between sum and difference polynomials */
         k ^= 1 ;

     /* Evaluate the new polynomial at the current frequency */
         CurrVal = (Word32) 0 ;
         for ( j = 0 ; j <= LpcOrder/2 ; j ++ )
            CurrVal = L_mac( CurrVal, Spq[LpcOrder-2*j+k],
CosineTable[i*j%CosineTableSize] ) ;
         }

      /* Update the previous value */
      PrevVal = CurrVal ;
      }


   /*
    * Check if all 10 zeros were found.  If not, ignore the results of
    * the search and use the previous frame's LSP frequencies instead.
    */
   if ( LspCnt != (Word16) LpcOrder ) {
      for ( j = 0 ; j < LpcOrder ; j ++ )
         LspVect[j] = PrevLsp[j] ;
   }

    return ;
}


/*
**
** Function:            Lsp_Qnt()
**
** Description:     Vector quantizes the LSP frequencies.  The LSP
**          vector is divided into 3 sub-vectors, or
**          bands, of dimension 3, 3, and 4.  Each band is
**          quantized separately using a different VQ
**          table.  Each table has 256 entries, so the
**          quantization generates three indices of 8 bits
**          each.  (Only the LSP vector for subframe 3 is
**          quantized per frame.)
**
** Links to text:   Section 2.5
**
** Arguments:       
**
**  Word16 CurrLsp[]    Unquantized LSP frequencies for the current frame (10 words)
**  Word16 PrevLsp[]    LSP frequencies from the previous frame (10 words)
**
** Outputs:             Quantized LSP frequencies for the current frame (10 words)
**
** Return value:
**
**  Word32      Long word packed with the 3 VQ indices.  Band 0
**          corresponds to bits [23:16], band 1 corresponds
**          to bits [15:8], and band 2 corresponds to bits [7:0].
**          (Bit 0 is the least significant.)
**
*/
Word32   Lsp_Qnt( Word16 *CurrLsp, Word16 *PrevLsp )
{
   int   i ;

   Word16   Wvect[LpcOrder] ;

   Word16   Tmp0,Tmp1   ;
   Word16   Exp   ;


   /* 
    * Compute the VQ weighting vector.  The weights assign greater
    * precision to those frequencies that are closer together.  
    */

   /* Compute the end differences */
   Wvect[0] = sub( CurrLsp[1], CurrLsp[0] ) ;
   Wvect[LpcOrder-1] = sub( CurrLsp[LpcOrder-1], CurrLsp[LpcOrder-2] ) ;

   /* Compute the rest of the differences */
   for ( i = 1 ; i < LpcOrder-1 ; i ++ ) {
      Tmp0 = sub( CurrLsp[i+1], CurrLsp[i] ) ;
      Tmp1 = sub( CurrLsp[i], CurrLsp[i-1] ) ;
      if ( Tmp0 > Tmp1 )
         Wvect[i] = Tmp1 ;
      else
         Wvect[i] = Tmp0 ;
      }

   /* Invert the differences */
   Tmp0 = (Word16) 0x0020 ;
   for ( i = 0 ; i < LpcOrder ; i ++ ) {

      if ( Wvect[i] > Tmp0 )
         Wvect[i] = div_s( Tmp0, Wvect[i] ) ;
      else
         Wvect[i] = MAX_16 ;
      }

   /* Normalize the weight vector */
   Tmp0 = (Word16) 0 ;
   for ( i = 0 ; i < LpcOrder ; i ++ )
      if ( Wvect[i] > Tmp0 )
         Tmp0 = Wvect[i] ;

   Exp = norm_s( Tmp0 ) ;
   for ( i = 0 ; i < LpcOrder ; i ++ )
      Wvect[i] = shl( Wvect[i], Exp ) ;


   /*
    * Compute the VQ target vector.  This is the residual that remains
    * after subtracting both the DC and predicted
    * components.
    */

   /* Subtract the DC component from both the current and previous LSP
      vectors.  */
   for ( i = 0 ; i < LpcOrder ; i ++ ) {
      CurrLsp[i] = sub( CurrLsp[i], LspDcTable[i] ) ;
      PrevLsp[i] = sub( PrevLsp[i], LspDcTable[i] ) ;
      }

  /* Generate the prediction vector and subtract it.  Use a constant
     first-order predictor based on the previous (DC-free) LSP
     vector. */
   for ( i = 0 ; i < LpcOrder ; i ++ ) {
      Tmp0 = mult_r( PrevLsp[i], (Word16) LspPrd0 ) ;
      CurrLsp[i] = sub( CurrLsp[i], Tmp0 ) ;
      }

   /* Add the DC component back to the previous LSP vector.  This
      vector is needed in later routines. */
   for ( i = 0 ; i < LpcOrder ; i ++ )
      PrevLsp[i] = add( PrevLsp[i], LspDcTable[i] ) ;

   /* Do the vector quantization for all three bands */
   return Lsp_Svq( CurrLsp, Wvect ) ;
}


/*
**
** Function:            Lsp_Svq()
**
** Description:     Performs the search of the VQ tables to find
**          the optimum LSP indices for all three bands.
**          For each band, the search finds the index which 
**          minimizes the weighted squared error between 
**          the table entry and the target.
**
** Links to text:   Section 2.5
**
** Arguments:       
**
**  Word16 Tv[]     VQ target vector (10 words)
**  Word16 Wvect[]      VQ weight vector (10 words)
**
** Outputs:         None
**
** Return value:    
**
**  Word32      Long word packed with the 3 VQ indices.  Band 0
**          corresponds to bits [23:16], band 1 corresponds
**          to bits [15:8], and band 2 corresponds to bits [7:0].
**              
*/
Word32   Lsp_Svq( Word16 *Tv, Word16 *Wvect )
{
   int   i,j,k ;

   Word32   Rez,Indx    ;
   Word32   Acc0,Acc1   ;

   Word16   Tmp[LpcOrder] ;
   Word16  *LspQntPnt  ;


   /* 
    * Initialize the return value
    */
   Rez = (Word32) 0 ;


   /* 
    * Quantize each band separately
    */
   for ( k = 0 ; k < LspQntBands ; k ++ ) {


      /* 
       * Search over the entire VQ table to find the index that
       * minimizes the error.  
       */

      /* Initialize the search */
      Acc1 = (Word32) -1 ;
      Indx = (Word32) 0 ;
      LspQntPnt = BandQntTable[k] ;

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

         /* Generate the metric, which is the negative error with the
            constant component removed. */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品午夜电影| 在线视频你懂得一区| 久久毛片高清国产| 国产福利一区在线| 欧美激情一区二区三区蜜桃视频 | 午夜精品一区二区三区免费视频| 91官网在线观看| 日韩国产高清影视| 精品日韩一区二区三区| 国产精品系列在线观看| 亚洲欧美日韩久久精品| 欧美色欧美亚洲另类二区| 日韩成人午夜精品| 国产婷婷一区二区| 色屁屁一区二区| 日本 国产 欧美色综合| 久久久99精品免费观看不卡| av电影在线观看一区| 一区二区国产视频| 欧美一区二区三区在线观看视频| 韩日av一区二区| 亚洲免费观看在线视频| 欧美一区二区观看视频| 处破女av一区二区| 亚洲成人一二三| 久久久久国产精品麻豆| 在线免费视频一区二区| 久久成人麻豆午夜电影| 成人欧美一区二区三区视频网页 | 91视视频在线观看入口直接观看www | 欧美一区二区视频网站| 国产盗摄视频一区二区三区| 一区二区三区 在线观看视频| 欧美videos中文字幕| 91麻豆精品在线观看| 久久福利视频一区二区| 一区二区三区不卡在线观看| 欧美精品一区二区三区视频| 日本久久电影网| 国产一区二区美女诱惑| 亚洲高清三级视频| 国产精品久久久久毛片软件| 欧美一区二区三区爱爱| 日本高清不卡aⅴ免费网站| 国产一区二区三区视频在线播放| 一区二区三区四区不卡在线| 久久天天做天天爱综合色| 在线观看免费成人| 成人美女视频在线观看| 国模套图日韩精品一区二区| 亚洲成av人综合在线观看| 国产精品久久久久久久久免费相片| 日韩女优av电影| 欧美日韩在线亚洲一区蜜芽| 成人久久久精品乱码一区二区三区 | 日日噜噜夜夜狠狠视频欧美人| 欧美国产激情一区二区三区蜜月| 91精品国产综合久久精品app| 一本一本大道香蕉久在线精品| 国产精品伊人色| 免费在线看一区| 亚洲一区二区三区四区五区中文| 国产精品久久99| 国产欧美一二三区| 久久久午夜精品| 日韩免费高清视频| 欧美一区二区三区日韩视频| 欧美午夜在线一二页| 色哦色哦哦色天天综合| 懂色av一区二区在线播放| 狠狠色综合播放一区二区| 日本美女视频一区二区| 亚洲777理论| 亚洲一二三区不卡| 亚洲二区视频在线| 亚洲123区在线观看| 亚洲一区在线观看免费观看电影高清 | 亚洲另类中文字| 亚洲欧美精品午睡沙发| 亚洲女同一区二区| 亚洲一区二区三区四区五区黄| 亚洲一区免费在线观看| 午夜av一区二区三区| 亚洲va中文字幕| 肉色丝袜一区二区| 麻豆视频一区二区| 国产一区二区调教| 国产精品一二三四五| 国产精品系列在线播放| 成人久久18免费网站麻豆| 91色|porny| 欧美三电影在线| 日韩视频免费观看高清完整版| 欧美草草影院在线视频| 国产网红主播福利一区二区| ...av二区三区久久精品| 一区二区三区精品视频| 日韩电影在线免费看| 蜜臀av性久久久久av蜜臀妖精| 久久99国产精品麻豆| 成人网男人的天堂| 欧美亚洲尤物久久| 日韩免费观看高清完整版在线观看| 国产欧美日韩另类视频免费观看| 中文字幕一区在线| 日韩中文字幕区一区有砖一区| 激情成人午夜视频| 色悠久久久久综合欧美99| 欧美日韩一区二区在线观看视频| 日韩一区和二区| 亚洲国产精品高清| 亚洲高清免费在线| 国产激情精品久久久第一区二区| 91片黄在线观看| 日韩视频免费观看高清完整版| 国产精品久久久久毛片软件| 午夜电影久久久| 成人黄色777网| 在线播放一区二区三区| 欧美国产一区二区| 日韩av电影免费观看高清完整版在线观看| 韩国欧美一区二区| 欧美视频一区二区三区四区 | 777a∨成人精品桃花网| 国产人成亚洲第一网站在线播放| 亚洲激情av在线| 国产一区二区不卡在线| 欧美性猛交xxxx乱大交退制版| 久久九九影视网| 日韩专区中文字幕一区二区| 99久久婷婷国产综合精品电影| 欧美大白屁股肥臀xxxxxx| 亚洲欧美色图小说| 丁香亚洲综合激情啪啪综合| 6080yy午夜一二三区久久| 日韩美女视频一区二区| 国产精品资源站在线| 3atv一区二区三区| 亚洲综合久久久久| eeuss影院一区二区三区| 日韩三级伦理片妻子的秘密按摩| 亚洲欧美另类久久久精品2019| 国产成人精品影院| 精品乱人伦一区二区三区| 亚洲一区二区在线观看视频| caoporn国产精品| 久久精品夜色噜噜亚洲aⅴ| 男人的天堂久久精品| 精品视频色一区| 一区二区三区在线观看欧美| 丁香婷婷综合激情五月色| www亚洲一区| 麻豆免费精品视频| 日韩一区二区电影在线| 免费亚洲电影在线| 欧美一区二区三区色| 丝袜亚洲另类丝袜在线| 欧美日本国产一区| 亚洲午夜私人影院| 在线亚洲一区观看| 亚洲综合区在线| 欧美日韩中文字幕一区二区| 亚洲小说欧美激情另类| 在线日韩一区二区| 亚洲综合清纯丝袜自拍| 欧美三级中文字幕在线观看| 一区二区三区在线观看网站| 色88888久久久久久影院按摩 | 成人国产精品视频| 中文一区二区在线观看| 夫妻av一区二区| 中文字幕亚洲精品在线观看| 99视频一区二区| 亚洲免费看黄网站| 欧美日韩亚洲另类| 午夜一区二区三区视频| 欧美精品久久99久久在免费线| 亚洲一区二区三区四区在线| 在线视频亚洲一区| 日本中文字幕一区二区有限公司| 日韩欧美国产综合一区 | 久久av中文字幕片| 精品国产伦理网| 国产99精品视频| 亚洲欧美日韩人成在线播放| 欧美性videosxxxxx| 日产国产高清一区二区三区| 26uuu国产在线精品一区二区| 成人精品视频网站| 亚洲人成人一区二区在线观看| 在线看一区二区| 免费观看一级欧美片| 国产清纯美女被跳蛋高潮一区二区久久w | 色香蕉久久蜜桃| 亚洲第一在线综合网站| 精品久久久三级丝袜| 国产一区二区美女诱惑| 亚洲精品伦理在线| 日韩一区二区在线看片| 成人毛片视频在线观看|