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

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

?? lsp.c

?? 本源代碼包含了各種聲音
?? 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 5.00
    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} amd {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一区二区三区免费野_久草精品视频
免费成人深夜小野草| 欧美日韩国产一级| 国精品**一区二区三区在线蜜桃 | 亚洲成人777| 五月激情综合婷婷| 国产一区欧美一区| 成人久久视频在线观看| 欧美日韩久久久久久| 欧美精品一区二区三区高清aⅴ| 久久人人爽人人爽| 一区二区三区在线视频免费观看| 午夜精品福利一区二区蜜股av| 午夜av一区二区| 91精品国产91久久久久久最新毛片| 久久免费的精品国产v∧| 日韩欧美成人午夜| 一区二区在线观看不卡| 久久不见久久见免费视频1| 91丨porny丨中文| 久久精品在这里| 日韩在线卡一卡二| 欧美亚洲国产一区二区三区| 国产性色一区二区| 国产高清久久久久| 欧美xxxx老人做受| 久久成人av少妇免费| 欧美理论在线播放| 香蕉久久一区二区不卡无毒影院 | 一区二区三区资源| 成人av高清在线| 亚洲欧洲成人精品av97| 成人禁用看黄a在线| 亚洲国产精品黑人久久久| 国产一区不卡视频| 国产女主播一区| 不卡视频一二三四| 亚洲电影一区二区| 欧美一区二区三区四区视频| 免费成人性网站| 国产色婷婷亚洲99精品小说| 成人性色生活片| 日韩精品高清不卡| 国产欧美日韩三级| 欧美午夜精品久久久久久孕妇| 亚洲男帅同性gay1069| 欧美日韩国产首页| 国产精品一区在线观看你懂的| 国产精品美女久久久久久久| 欧美性受xxxx黑人xyx性爽| 久久99国产精品久久99| 亚洲一区二区在线观看视频| 日韩免费性生活视频播放| 91麻豆国产福利在线观看| 99久久精品免费看| 日韩一级免费一区| 免费成人结看片| 欧美国产精品专区| 欧美系列在线观看| 99精品久久99久久久久| 久久成人精品无人区| 秋霞电影一区二区| 亚洲制服丝袜在线| 亚洲免费av观看| 日韩在线卡一卡二| 亚洲午夜免费电影| 亚洲精品亚洲人成人网在线播放| 精品欧美黑人一区二区三区| 91精品婷婷国产综合久久| 色天使色偷偷av一区二区| caoporm超碰国产精品| 成人福利在线看| 成人午夜av在线| 一本久久a久久精品亚洲| 成人av在线网| 制服.丝袜.亚洲.中文.综合| 欧美日韩一区二区欧美激情| 4438x成人网最大色成网站| 日韩精品中文字幕一区| 久久久精品综合| 中文字幕一区二区三区四区不卡| 亚洲日本在线视频观看| 日本不卡高清视频| 成人福利视频网站| 欧美一区二区三区人| 国产拍欧美日韩视频二区| 亚洲精品免费在线观看| 免费xxxx性欧美18vr| 成人精品视频一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 91久久国产最好的精华液| 久久久激情视频| 日韩在线一区二区三区| 色综合av在线| 国产亚洲午夜高清国产拍精品| 亚洲精品乱码久久久久| 国产激情偷乱视频一区二区三区| 欧美三级三级三级| 日韩理论在线观看| 成人精品国产一区二区4080| 日韩区在线观看| 免费人成在线不卡| 欧美一级欧美一级在线播放| 一区二区三区在线免费播放| 成人一区二区视频| 中文字幕欧美一区| 成人精品免费网站| 国产精品网站一区| 91伊人久久大香线蕉| 亚洲青青青在线视频| 欧美在线色视频| 亚洲国产精品影院| 日韩你懂的在线观看| 免费人成网站在线观看欧美高清| 欧美一区二区视频在线观看2022 | 日本乱人伦一区| 日韩成人免费电影| 久久色在线观看| 成人一级片网址| 视频在线观看一区| 久久综合成人精品亚洲另类欧美| 国产高清不卡二三区| 中文字幕一区二区在线播放 | 欧美日韩一区在线| 国产高清视频一区| 婷婷综合在线观看| 国产精品美女www爽爽爽| 91精品免费观看| jlzzjlzz亚洲女人18| 日本女人一区二区三区| 亚洲欧美日韩国产成人精品影院| 欧美精品乱码久久久久久按摩 | 亚洲女人小视频在线观看| 欧美一区二区三区视频| 色婷婷av一区二区三区软件 | 亚洲高清视频中文字幕| 中文字幕第一区二区| 91视视频在线观看入口直接观看www | 制服.丝袜.亚洲.另类.中文| 91在线观看免费视频| 成人美女视频在线观看| 国产精品69毛片高清亚洲| 国产乱妇无码大片在线观看| 免费观看日韩av| 免费成人av资源网| 秋霞电影网一区二区| 久久97超碰国产精品超碰| 久久福利资源站| 国产成人综合网站| 成人国产精品免费观看| 在线观看视频一区二区| 欧美高清精品3d| 久久九九影视网| ...xxx性欧美| 日韩激情一区二区| 狠狠色综合日日| 91尤物视频在线观看| 色婷婷综合在线| 欧美伦理影视网| 国产日韩三级在线| 亚洲欧美激情在线| 久久99精品一区二区三区三区| 国产成人免费视频网站| 在线视频观看一区| 精品国一区二区三区| 中文字幕日本不卡| 日韩国产欧美在线播放| 亚洲国产精品麻豆| 国产高清亚洲一区| 欧美另类一区二区三区| 中文字幕+乱码+中文字幕一区| 亚洲最新视频在线观看| 成人污污视频在线观看| 欧美日韩成人综合天天影院| 亚洲欧洲av色图| 国产精品夜夜嗨| 欧美变态口味重另类| 亚洲午夜久久久久久久久电影网 | 欧美一区二区在线免费播放| 亚洲人成精品久久久久久| 国产高清精品久久久久| 精品乱人伦一区二区三区| 美女视频网站黄色亚洲| 91精品在线免费| 久久99久久久久| 久久久亚洲国产美女国产盗摄 | 91精品国产综合久久久久久| 亚洲最新在线观看| 欧美日韩在线综合| 日韩精品福利网| 久久亚洲私人国产精品va媚药| 麻豆精品久久久| 中文字幕不卡在线观看| av不卡在线观看| 亚洲国产视频一区| 日韩欧美一区二区视频| 极品美女销魂一区二区三区| 国产午夜精品一区二区三区视频| 福利视频网站一区二区三区| 亚洲人成人一区二区在线观看| 欧美日韩一区二区在线视频|