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

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

?? encoder.cpp

?? G711語音壓縮源碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
            for (j = 0; j < i; j++)
//DotProd10                *lPnt++ = DotProd(FltBuf[i], FltBuf[j], SubFrLen);
                *lPnt++ = DotProd10(FltBuf[i], FltBuf[j], SubFrLen);
    }

    /* Test potential error */
    Lag1 = Olp - Pstep;
    Lag2 = Olp - Pstep + Hb - 1;

    off_filt = Test_Err(Lag1, Lag2);

    Bound[0] =  NbFilt085_min + (off_filt << 2);
    if (Bound[0] > NbFilt085)
        Bound[0] = NbFilt085;
    Bound[1] =  NbFilt170_min + (off_filt << 3);
    if (Bound[1] > NbFilt170)
        Bound[1] = NbFilt170;

    Max = (float)0.0;
    for (k=0; k < Hb; k++)
    {

        /*  Select Quantization table */
        l = 0;
        if (WrkRate == Rate63)
        {
            if ((Sfc & 1) == 0)
            {
                if (Olp-Pstep+k >= SubFrLen-2)
                    l = 1;
            }
            else
            {
                if (Olp >= SubFrLen-2)
                    l = 1;
            }
        }
        else
            l = 1;

        /*  Search for maximum */

        sPnt = AcbkGainTablePtr[l]+20;

        for (i=1; i < Bound[l]; i+=2)
        {
//DotProd20s            Acc0 = DotProd(&CorVct[k*20],sPnt,20);
            Acc0 = DotProd20s(&CorVct[k*20],sPnt);
            sPnt += 40;

            if (Acc0 > Max)
            {
                Max = Acc0;
                Gid = i;
                Lid = k;
            }
        }
    }

    /*  Modify Olp for even sub frames */

    if ((Sfc & 1) == 0)
    {
        Olp = Olp - Pstep + Lid;
        Lid = Pstep;
    }


    /*  Save Lag, Gain and Olp */

    (*Line).Sfs[Sfc].AcLg = Lid;
    (*Line).Sfs[Sfc].AcGn = Gid;
    (*Line).Olp[Sfc>>1] = Olp;

    /*  Decode the Acbk contribution and subtract it */

    Decod_Acbk(RezBuf, PrevExc, Olp, Lid, Gid);

    for (i=0; i < SubFrLen; i++)
    {
        Acc0 = Tv[i]-RezBuf[i];

        for (j=0; j < i; j++)
            Acc0 -= RezBuf[j]*ImpResp[i-j];

        Tv[i] = Acc0;
    }
}

/*
**
** Function:        Decod_Acbk()
**
** Description:     Computes the adaptive codebook contribution from the previous
**                  excitation vector.
**                  With the gain index, the closed loop pitch lag, the jitter
**                  which when added to this pitch lag gives the actual closed
**                  loop value, and after having selected the proper codebook,
**                  the pitch contribution is reconstructed using the previous
**                  excitation buffer.
**
** Links to text:   Sections 2.14, 2.18 & 3.4
**
** Arguments:
**
**  float  *Tv      Reconstructed excitation vector
**  float  *PrevExc Previous excitation vector
**  int    Olp      closed-loop pitch period
**  int    Lid      Jitter around pitch period
**  int    Gid      Gain vector index in 5- dimensional
**                      adaptive gain vector codebook
**
** Outputs:
**
**  float  *Tv      Reconstructed excitation vector
**
** Return value:    None
**
*/
void  CLanAudioEncoder::Decod_Acbk(float *Tv, float *PrevExc, int Olp, int Lid, int Gid)
{
    int      i;
    float    RezBuf[SubFrLen+ClPitchOrd-1];
    float   *sPnt;

    Get_Rez(RezBuf, PrevExc, (Olp + Lid) - Pstep);


    i = 0;
    if (WrkRate == Rate63)
    {
        if (Olp >= (SubFrLen-2))
            i++;
    }
    else
        i=1;

    sPnt = AcbkGainTablePtr[i] + Gid*20;

    /*  Compute output vector */

    for (i=0; i < SubFrLen; i++)
//DotProd5s        Tv[i] = DotProd(&RezBuf[i], sPnt, ClPitchOrd);
        Tv[i] = DotProd5s(&RezBuf[i], sPnt);
}

/*
**
** Function:           Calc_Exc_Rand()
**
** Description:        Computation of random excitation for inactive frames:
**                     Adaptive codebook entry selected randomly
**                     Higher rate innovation pattern selected randomly
**                     Computes innovation gain to match curGain
**
** Links to text:
**
** Arguments:
**
**  float   curGain    current average gain to match
**  float   *PrevExc   previous/current excitation (updated)
**  float   *DataExc   current frame excitation
**  short  *nRandom   random generator status (input/output)
**  LINEDEF *Line
**
** Outputs:
**
**  float   *PrevExc
**  float   *DataExc
**  short  *nRandom
**  LINEDEF *Line
**
** Return value:       None
**
*/
void CLanAudioEncoder::Calc_Exc_Rand(float curGain, float *PrevExc, float *DataExc,
                                      short *nRandom, LINEDEF *Line)
{
    int     i, i_subfr, iblk;
    short  temp16;
    short  j;
    short  TabPos[2*NbPulsBlk], *ptr_TabPos;
    float   TabSign[2*NbPulsBlk], *ptr_TabSign;
    short  *ptr1;
    float   *curExc;
    float   x1, x2, ener_ltp, inter_exc, delta, b0, c;
    short  tmp[SubFrLen/Sgrid];
    short  offset[SubFrames];

    /*
     * generate LTP codes
     */
    Line->Olp[0] = random_number(21, nRandom) + 123;
    Line->Olp[1] = random_number(21, nRandom) + 123;
    for (i_subfr=0; i_subfr<SubFrames; i_subfr++) {  /* in [1, NbFilt] */
        Line->Sfs[i_subfr].AcGn = random_number(NbFilt, nRandom) + (short)1;
    }
    Line->Sfs[0].AcLg = 1;
    Line->Sfs[1].AcLg = 0;
    Line->Sfs[2].AcLg = 1;
    Line->Sfs[3].AcLg = 3;


    /*
     * Random innovation :
     * Selection of the grids, signs and pulse positions
     */

    /* Signs and Grids */
    ptr_TabSign = TabSign;
    ptr1 = offset;
    for (iblk=0; iblk<SubFrames/2; iblk++) {
        temp16  = random_number((short) (1 << (NbPulsBlk+2)), nRandom);
        *ptr1++ = (short) (temp16 & 0x0001);
        temp16  >>= 1;
        *ptr1++ = (short) (SubFrLen + (temp16 & 0x0001));
        for (i=0; i<NbPulsBlk; i++) {
            temp16 >>= 1;
            *ptr_TabSign++= (float) 2. * (float)(temp16 & 0x0001) - (float) 1.;
        }
    }

    /* Positions */
    ptr_TabPos  = TabPos;
    for (i_subfr=0; i_subfr<SubFrames; i_subfr++) {

        for (i=0; i<(SubFrLen/Sgrid); i++)
            tmp[i] = (short) i;
        temp16 = (SubFrLen/Sgrid);
        for (i=0; i<Nb_puls[i_subfr]; i++) {
            j = random_number(temp16, nRandom);
            *ptr_TabPos++ = (short) (2 * tmp[(int)j] + offset[i_subfr]);
            temp16--;
            tmp[(int)j] = tmp[(int)temp16];
        }
    }

    /*
     * Compute fixed codebook gains
     */

    ptr_TabPos = TabPos;
    ptr_TabSign = TabSign;
    curExc = DataExc;
    i_subfr = 0;
    for (iblk=0; iblk<SubFrames/2; iblk++) {

        /* decode LTP only */
        Decod_Acbk(curExc, &PrevExc[0], Line->Olp[iblk],
                    Line->Sfs[i_subfr].AcLg, Line->Sfs[i_subfr].AcGn);
        Decod_Acbk(&curExc[SubFrLen], &PrevExc[SubFrLen], Line->Olp[iblk],
            Line->Sfs[i_subfr+1].AcLg, Line->Sfs[i_subfr+1].AcGn);

//        ener_ltp = DotProd(curExc, curExc, SubFrLenD);
        ener_ltp = DotProd10(curExc, curExc, SubFrLenD);

        inter_exc = (float) 0.;
        for (i=0; i<NbPulsBlk; i++) {
            inter_exc += curExc[(int)ptr_TabPos[i]] * ptr_TabSign[i];
        }

        c = (ener_ltp - curGain * curGain * (float)SubFrLenD) * InvNbPulsBlk;

        /*
         * Solve EQ(X) = X**2 + 2 b0 X + c
         */

        b0 = inter_exc * InvNbPulsBlk;
        delta = b0 * b0 - c;

        /* Case delta <= 0 */
        if (delta <= (float) 0.) {
            x1 = - b0;
        }

        /* Case delta > 0 */
        else {
            delta = (float) sqrt(delta);
            x1 = - b0 + delta;
            x2 = b0 + delta;
            if (fabs(x2) < fabs(x1))
                x1 = - x2;
        }

        /* Update DataExc */
        if (x1 > Gexc_Max)
            x1 = Gexc_Max;
        if (x1 < -Gexc_Max)
            x1 = -Gexc_Max;

        for (i=0; i<NbPulsBlk; i++) {
            j = *ptr_TabPos++;
            curExc[(int)j] += (x1 * (*ptr_TabSign++));
        }

        for (i=0; i<SubFrLenD; i++) {
            if (curExc[i] > (float) 32766.5)
                curExc[i] = (float) 32767.0;
            else if (curExc[i] < (float) -32767.5)
                curExc[i] = (float) -32768.0;
        }

        /* update PrevExc */
        for (i=SubFrLenD; i<PitchMax; i++)
            PrevExc[i-SubFrLenD] = PrevExc[i];
        for (i=0; i<SubFrLenD; i++)
            PrevExc[i+PitchMax-SubFrLenD] = curExc[i];

        curExc += SubFrLenD;
        i_subfr += 2;

    } /* end of loop on LTP blocks */

    return;
}

/*
**
** 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:
**
**  float  *UnqLpc      Empty Buffer
**  float  PrevDat[]    Previous 2 subframes of samples (120 words)
**  float  DataBuff[]   Current frame of samples (240 words)
**
** Outputs:
**
**
**  float  UnqLpc[]     LPC coefficients for entire frame (40 words)
**
** Return value:    None
**
*/
void  CLanAudioEncoder::Comp_Lpc(float *UnqLpc, float *PrevDat, float *DataBuff)
{
    int   i,j,k;

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

    /*
     * 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++)
    {
        /*  Apply the Hamming window */

        for (i = 0; i < LpcFrame; i++)
            Vect[i] = Dpnt[k*SubFrLen+i]*HammingWindowTable[i];

        /*  Compute the autocorrelation coefficients  */

//        curAcf[0] = DotProd(Vect, Vect, LpcFrame)/(LpcFrame*LpcFrame);
        curAcf[0] = DotProd10(Vect, Vect, LpcFrame)/(LpcFrame*LpcFrame);

        /*  Do Ridge regression  */

        curAcf[0] *= ((float)1025.0/(float)1024.0);
        if (curAcf[0] == (float)0.0) {
            for (i = 1; i <= LpcOrder; i++)
                curAcf[i] = (float) 0.0;
        }
        else {
            for (i = 1; i <= LpcOrder; i++)
                curAcf[i] = DotProd(Vect, &Vect[i], LpcFrame-i)
                            / (LpcFrame*LpcFrame) * BinomialWindowTable[i-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 > (float) 0.95) {
            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_Acf(Acf_sf);
}

/*
**
** 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:
**
**  float  Dpnt[]       Highpass filtered speech x[n] (240 words)
**  float  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:
**
**  float  Dpnt[]       Weighted speech f[n] (240 words)
**
** Return value:    None
**
*/
void  CLanAudioEncoder::Error_Wght(float *Dpnt, float *PerLpc)
{
    int  i,j,k;

    float Acc0;


    for (k=0; k < SubFrames; k++)
    {
        for (i=0; i < SubFrLen; i++)
        {
            /*  FIR part  */

//            Acc0 = *Dpnt - DotProd(PerLpc,CodStat.WghtFirDl,LpcOrder);
            Acc0 = *Dpnt - DotProd10s(PerLpc,CodStat.WghtFirDl);

            for (j=LpcOrder-1; j > 0; j --)
                CodStat.WghtFirDl[j] = CodStat.WghtFirDl[j-1];

            CodStat.WghtFirDl[0] = *Dpnt;

            /*  IIR part  */

//            Acc0 += DotProd(&PerLpc[LpcOrder],CodStat.WghtIirDl,LpcOrder);
            Acc0 += DotProd10s(&PerLpc[LpcOrder],CodStat.WghtIirDl);

            for (j = LpcOrder-1; j > 0; j --)
                CodStat.WghtIirDl[j] = CodStat.WghtIirDl[j-1];

            *Dpnt++ = CodStat.WghtIirDl[0] = Acc0;

        }
        PerLpc += 2*LpcOrder;
    }
}

/*
**
** Function:        Sub_Ring()
**
** Description:     Computes the zero-input response of the
**          combined formant perceptual weighting filter,
**          harmonic noise shaping filter, and synthesis
**          filter for a subframe.  Subtracts the
**          zero-input response from the harmonic noise
**          weighted speech vector to produce the target
**          speech vector.
**
** Links to text:   Section 2.13
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色香蕉久久蜜桃| 国产一区二区精品在线观看| 成人少妇影院yyyy| 一区二区三区欧美久久| 国产日韩欧美高清在线| 欧美日本在线观看| 成人av午夜电影| 免费成人av在线| 久久久无码精品亚洲日韩按摩| 美女视频一区在线观看| 精品少妇一区二区三区免费观看| 狠狠色丁香久久婷婷综合_中| 日韩欧美美女一区二区三区| 国产一区二区看久久| 国产女人18水真多18精品一级做 | 久久亚洲精品国产精品紫薇| 免费在线成人网| 日韩一本二本av| 自拍偷拍亚洲激情| 欧美视频在线不卡| 日韩高清国产一区在线| 日韩女同互慰一区二区| 成人午夜免费av| 中文字幕久久午夜不卡| 亚洲va国产va欧美va观看| 国产乱子伦视频一区二区三区| 国产精品久久久久天堂| 欧美精品第1页| 欧美高清视频在线高清观看mv色露露十八| 亚洲女与黑人做爰| 亚洲成人第一页| 亚洲成人黄色影院| 久久国产综合精品| 国产丶欧美丶日本不卡视频| 成人深夜福利app| 欧美乱熟臀69xxxxxx| 7777精品久久久大香线蕉| 成人免费不卡视频| 免费一级欧美片在线观看| 中文字幕av不卡| 精品国产sm最大网站免费看| 91精品国产综合久久精品麻豆| 欧美亚洲国产一卡| 欧美日韩国产影片| 宅男在线国产精品| 91欧美一区二区| 国产成人亚洲精品狼色在线| 91网址在线看| 老司机午夜精品| 亚洲一区二区三区四区在线| 欧美日韩视频在线一区二区| 国产精品一区三区| 日本视频免费一区| 91蜜桃网址入口| 国产一区二区精品久久91| 久久99精品一区二区三区| 精品一区二区国语对白| 久久99精品网久久| 欧日韩精品视频| 欧美大片在线观看一区二区| 亚洲一区二区三区视频在线| 国产精品一区二区91| 91精品国产综合久久福利| 亚洲一区二区三区激情| 色婷婷av一区二区三区gif | 欧美在线视频全部完| 色欧美片视频在线观看在线视频| 色噜噜狠狠一区二区三区果冻| 91精品国产乱码久久蜜臀| 久久综合99re88久久爱| 亚洲欧洲成人av每日更新| 亚洲精品日韩综合观看成人91| 国产欧美va欧美不卡在线| 91在线无精精品入口| 欧美男同性恋视频网站| 欧美tickling网站挠脚心| 国产精品视频麻豆| 亚洲成人免费av| 激情文学综合插| 91影视在线播放| 欧美一区二区日韩一区二区| 日本一区二区在线不卡| 亚洲精品成a人| 精品午夜一区二区三区在线观看| 成人黄页毛片网站| 欧美精品九九99久久| 国产女人水真多18毛片18精品视频| 一区二区三区日韩欧美精品| 激情小说欧美图片| 91农村精品一区二区在线| 欧美一个色资源| 亚洲欧美综合另类在线卡通| 美国一区二区三区在线播放| 99久久久久久| 日韩精品在线网站| 亚洲自拍偷拍欧美| 国产精品中文字幕日韩精品| 欧美日韩国产成人在线91| 中文字幕av一区二区三区高| 亚欧色一区w666天堂| 成人av电影免费观看| 欧美电影免费观看高清完整版在线观看 | 婷婷一区二区三区| 成人中文字幕在线| 日韩精品在线一区| 亚洲国产欧美日韩另类综合| 成人在线综合网| 欧美一级在线视频| 亚洲v日本v欧美v久久精品| 99国产一区二区三精品乱码| 久久久久久久综合日本| 五月天激情综合| 日本高清不卡视频| 国产精品久久久久9999吃药| 国产一区二区按摩在线观看| 91精品国产手机| 一区二区三区不卡视频| 99精品欧美一区二区三区综合在线| 精品国产1区2区3区| 青青草91视频| 欧美一区国产二区| 午夜精品一区二区三区电影天堂| 91视频免费观看| 国产精品三级av| 粉嫩蜜臀av国产精品网站| 精品国产乱子伦一区| 麻豆精品一区二区三区| 欧美一区二区福利在线| 亚洲成人精品在线观看| 欧美日韩一区二区三区高清| 亚洲综合色噜噜狠狠| 91福利在线观看| 一区二区在线观看免费视频播放| 91丨九色丨蝌蚪丨老版| 亚洲色图丝袜美腿| 91麻豆国产福利在线观看| 亚洲视频在线观看三级| 91在线观看成人| 亚洲狠狠丁香婷婷综合久久久| 92国产精品观看| 一级日本不卡的影视| 欧美日韩在线精品一区二区三区激情| 亚洲黄网站在线观看| 欧美视频在线播放| 日韩黄色小视频| 精品国产凹凸成av人网站| 国产激情一区二区三区| 亚洲国产精品ⅴa在线观看| 不卡av在线免费观看| 亚洲男人电影天堂| 在线一区二区三区四区五区| 亚洲一二三区在线观看| 制服丝袜一区二区三区| 看电影不卡的网站| 中文字幕欧美三区| 91小视频在线免费看| 亚洲成年人影院| 欧美成人一区二区三区| 国产精品亚洲人在线观看| 国产精品国产三级国产aⅴ原创| 91蝌蚪porny| 日本怡春院一区二区| 久久久精品免费免费| 91免费版在线| 日韩成人一级大片| 国产欧美一区二区三区鸳鸯浴 | 色婷婷综合五月| 五月天激情综合网| 久久免费偷拍视频| 91丨porny丨户外露出| 天堂在线亚洲视频| 久久九九国产精品| 欧美性大战xxxxx久久久| 精品亚洲欧美一区| 伊人夜夜躁av伊人久久| 精品国产免费人成在线观看| 99精品黄色片免费大全| 爽好多水快深点欧美视频| 国产日韩精品久久久| 欧美在线|欧美| 国产一区二区三区在线观看免费视频 | 国产午夜精品久久| 欧美亚洲自拍偷拍| 国产精品一区二区不卡| 亚洲高清中文字幕| 中文欧美字幕免费| 欧美性色欧美a在线播放| 狠狠色伊人亚洲综合成人| 亚洲伦理在线精品| 久久免费视频色| 欧美日韩一区二区在线观看| 国产91在线观看丝袜| 天堂av在线一区| 综合精品久久久| 久久久综合视频| 欧美剧情电影在线观看完整版免费励志电影 | 成人精品免费网站| 日本v片在线高清不卡在线观看| 亚洲色图在线看| 国产校园另类小说区|