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

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

?? dtx.c

?? GSM中半速率語音編解碼源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/***************************************************************************
 *
 *   File Name: dtx.c
 *
 *   Purpose:   DTX and comfort noise functions of the GSM half rate
 *              system
 *
 *   Reference: Recommendation GSM 06.41 (DTX)
 *              Recommendation GSM 06.22 (Comfort Noise)
 *
 *     Below is a listing of all the functions appearing in the file.
 *     The functions are arranged according to their purpose.  Under
 *     each heading, the ordering is hierarchical.
 *
 *     Evaluation of comfort noise parameters
 *       swComfortNoise()
 *         updateCNHist()
 *         avgGsHistQntz()
 *         gsQuant()
 *         avgCNHist()
 *         lpcCorrQntz()
 *         getPnBits()
 *
 *     Interpolation of comfort noise parameters
 *        rxInterpR0Lpc()
 *         linInterpSid()
 *
 **************************************************************************/

/*________________________________________________________________________
 |                                                                        |
 |                         Include Files                                  |
 |________________________________________________________________________|
*/

#include "typedefs.h"
#include "mathhalf.h"
#include "mathdp31.h"
#include "dtx.h"
#include "sp_dec.h"
#include "sp_rom.h"
#include "sp_frm.h"

/*________________________________________________________________________
 |                                                                        |
 |                            Defines                                     |
 |________________________________________________________________________|
*/

#define PN_XOR_REG (Longword)0x00000005L
#define PN_XOR_ADD (Longword)0x40000000L

#define OH_SHIFT 3                     /* shift corresponding to OVERHANG */

#define NP_AFLAT 4
#define LPC_VQ_SEG 3

#define ASHIFT 4
#define ASCALE 0x0800


/*________________________________________________________________________
 |                                                                        |
 |                        Global Variables                                |
 |________________________________________________________________________|
*/

Shortword swVadFrmCnt = 0;             /* Indicates the number of sequential
                                        * frames where VAD == 0 */

short int siUpdPointer = 0;
Shortword swNElapsed = 50;


Longword pL_GsHist[N_SUB * (OVERHANG - 1)];


/*________________________________________________________________________
 |                                                                        |
 |                     Other External Variables                           |
 |________________________________________________________________________|
*/

extern int iLimit;

extern Shortword swR0Dec,
       swOldR0Dec,
       swR0NewCN;

extern Shortword swCNR0,
       pswCNLpc[],
       pswCNGsp0Code[],
       pswCNVSCode1[],
       pswCNVSCode2[];

/*________________________________________________________________________
 |                                                                        |
 |                         DTX Rom Tables                                 |
 |________________________________________________________________________|
*/

/* interpolation curve for comfort noise (i*1/12) i=1..12 */
Shortword psrCNNewFactor[12] = {0x0aaa, 0x1554, 0x1ffe, 0x2aa8, 0x3552,
  0x3ffc, 0x4aa6, 0x5550, 0x5ffa, 0x6aa4,
0x754e, 0x7fff};


/* Values of GS for voicing state 0, all values shifted down by 2
   shifts */
LongwordRom ppLr_gsTable[4][32] =
{
  {
    0x000011ab, 0x000038d2, 0x0000773e, 0x000144ef,
    0x00035675, 0x000648c5, 0x000c3d65, 0x0017ae17,
    0x002a3dbb, 0x005238e7, 0x00695c1a, 0x00a60d45,
    0x00e4cc68, 0x01c3ba6a, 0x019e3c96, 0x02d1fbac,
    0x030453ec, 0x0549a998, 0x05190298, 0x08258920,
    0x08daff30, 0x0c3150e0, 0x0e45d850, 0x14c111a0,
    0x0ff7e1c0, 0x18a06860, 0x13810400, 0x1abc9ee0,
    0x28500940, 0x41f22800, 0x22fc5040, 0x2cd90180
  },

  {
    0x00003ede, 0x00021fc9, 0x0013f0c3, 0x003a7be2,
    0x007a6663, 0x00fe3773, 0x012fabf4, 0x02275cd0,
    0x01c0ef14, 0x02c0b1d8, 0x0350fc70, 0x05505078,
    0x04175f30, 0x052c1098, 0x08ed3310, 0x0a63b470,
    0x05417870, 0x08995ee0, 0x07bbe018, 0x0a19fa10,
    0x0b5818c0, 0x0fd96ea0, 0x0e5cad10, 0x13b40d40,
    0x12d45840, 0x14577320, 0x2b2e5e00, 0x333e9640,
    0x194c35c0, 0x1c30f8c0, 0x2d16db00, 0x2cc970ff
  },
  {
    0x002f18e7, 0x00a47be0, 0x01222efe, 0x01c42df8,
    0x024be794, 0x03424c40, 0x036950fc, 0x04973108,
    0x038405b4, 0x05d8c8f0, 0x05063e08, 0x070cdea0,
    0x05812be8, 0x06da5fc8, 0x088fcd60, 0x0a013cb0,
    0x0909a460, 0x09e6cf40, 0x0ee581d0, 0x0ec99f20,
    0x0b4e7470, 0x0c730e80, 0x0ff39d20, 0x105d0d80,
    0x158b0b00, 0x172babe0, 0x14576460, 0x181a6720,
    0x26126e80, 0x1f590180, 0x1fdaad60, 0x2e0e8000
  },
  {
    0x00c7f603, 0x01260cda, 0x01b3926a, 0x026d82bc,
    0x0228fba0, 0x036ec5b0, 0x034bf4cc, 0x043a55d0,
    0x044f9c20, 0x05c66f50, 0x0515f890, 0x06065300,
    0x0665dc00, 0x0802b630, 0x0737a1c0, 0x087294e0,
    0x09253fc0, 0x0a619760, 0x097bd060, 0x0a6d4e50,
    0x0d19e520, 0x0e15c420, 0x0c4e4eb0, 0x0e8880e0,
    0x11cdf480, 0x12c85800, 0x10f4c0a0, 0x13e51b00,
    0x189dbaa0, 0x18a6bb60, 0x22e31500, 0x21615240
  }
};

/*************************************************************************
 *
 *   FUNCTION NAME: swComfortNoise
 *
 *   PURPOSE:
 *
 *   This routine perform the following tasks:
 *     - generation of the speech flag (swSP)
 *     - averaging and encoding of the comfort noise parameters
 *     - randomization of the codebook indices
 *
 *
 *   INPUTS:
 *
 *   swVadFrmCnt (global) - swVadFlag=0 frame counter.
 *   If swVadFlag=1 then this counter is 0, the first frame with
 *   swVadFlag=0 will set this counter to 1, with each additional
 *   swVadFlag=0 frame the counter is incremented.
 *
 *   swVadFlag - voise activity flag. swVadFlag=0 frame with
 *   no voice activity, swVadFlag=0 frame with voice activity
 *
 *   L_UnqntzdR0 - unquantized R(0), 32 bit value, output of
 *   FLAT.
 *
 *   pL_UnqntzdCorr[NP+1] - unquantized correlation sequence,
 *   also an output of FLAT.
 *
 *
 *   OUTPUTS:
 *
 *   swCNR0 - global variable, the output quantized R0 index
 *
 *   pswCNLpc[3]  - global variable, the output quantized LPC to the
 *   transmitted in the SID frame
 *
 *   pswCNGsp0Code[N_SUB] - global variable, the output quantized GSP0 indices
 *
 *   pswCNVSCode1[N_SUB] - global variable, the output quantized codevector 1
 *   indices.
 *
 *   pswCNVSCode2[N_SUB] - global variable, the output quantized codevector 2
 *   indices.
 *
 *
 *   RETURN VALUE:
 *
 *   swSP - speech flag, swSP=1 speech frames are generated, swSP=0
 *   SID frames are generated.
 *
 *************************************************************************/

Shortword swComfortNoise(Shortword swVadFlag,
                             Longword L_UnqntzdR0, Longword *pL_UnqntzdCorr)
{

/*________________________________________________________________________
 |                                                                        |
 |                        Static Variables                                |
 |________________________________________________________________________|
*/

  /* history of unquantized parameters */
  static Longword pL_R0Hist[OVERHANG];
  static Longword ppL_CorrHist[OVERHANG][NP + 1];

  /* quantized reference parameters */
  static Shortword swQntRefR0,
         swRefGsIndex;
  static int piRefVqCodewds[3];

  /* handling of short speech bursts */
  static Shortword swShortBurst;

  /* state value of random generator */
  static Longword L_TxPNSeed;

/*_________________________________________________________________________
 |                                                                         |
 |                            Automatic Variables                          |
 |_________________________________________________________________________|
*/

  Shortword swSP;
  Shortword pswFinalRc[NP];

  /* unquantized reference parameters */
  Longword L_RefR0;
  Longword pL_RefCorr[NP + 1];
  Longword L_RefGs;

  int    i;


/*_________________________________________________________________________
 |                                                                         |
 |                              Executable Code                            |
 |_________________________________________________________________________|
*/

  swSP = 1;

  /* VadFrmCnt will indicate the number of sequential frames where */
  /* swVadFlag == 0                                                */
  /* ------------------------------------------------------------- */

  if (swVadFlag)
    swVadFrmCnt = 0;                   /* Voice acitvity present */
  else
    swVadFrmCnt = add(swVadFrmCnt, 1); /* no voice activity */


  /* swNElapsed will indicate the number of frames that have elapsed */
  /* since the last SID frame with updated comfort noise parameters  */
  /* was generated                                                   */
  /* --------------------------------------------------------------- */

  swNElapsed = add(swNElapsed, 1);


  /* If no voice activity was detected.  */
  /* ----------------------------------- */

  if (swVadFrmCnt)
  {

    /* Short speech burst ? */
    /* -------------------- */

    if (swVadFrmCnt == 1)
    {
      if (sub(swNElapsed, 24) < 0)
        swShortBurst = 1;              /* short speech burst detected */
      else
        swShortBurst = 0;              /* long speech burst detected */
    }


    /* Update history, with this frames data */
    /* ------------------------------------- */

    updateCNHist(L_UnqntzdR0, pL_UnqntzdCorr,
                 pL_R0Hist, ppL_CorrHist);


    /* first SID frame */
    /* --------------- */

    if (((swShortBurst == 0) && (swVadFrmCnt == OVERHANG)) ||
        ((swShortBurst == 1) && (swVadFrmCnt == 1)))
    {

      /* init. random generator */
      /* ---------------------- */
      L_TxPNSeed = PN_INIT_SEED;


      /* average GS */
      /* ---------- */
      avgGsHistQntz(pL_GsHist, &L_RefGs);


      /* GS quantization */
      /* --------------- */
      swRefGsIndex = gsQuant(L_RefGs, 0);

    }


    /* No Overhang in case of short speech bursts,                */
    /* generate SID frames with repeated comfort noise parameters */
    /* ---------------------------------------------------------- */

    if ((swShortBurst == 1) && (swVadFrmCnt < OVERHANG))
    {

      /* generate a SID frame with repeated parameters */
      /* --------------------------------------------- */

      swSP = 0;


      /* repeat data: r0, LPC, GS */
      /* ------------------------ */

      swCNR0 = swQntRefR0;

      for (i = 0; i < 3; i++)
        pswCNLpc[i] = piRefVqCodewds[i];

      for (i = 0; i < N_SUB; i++)
        pswCNGsp0Code[i] = swRefGsIndex;

    }


    /* generate SID frames with updated comfort noise parameters */
    /* --------------------------------------------------------- */

    if (swVadFrmCnt >= OVERHANG)
    {

      /* A SID frame with updated parameters */
      /* ----------------------------------- */

      swSP = 0;
      swNElapsed = 0;


      /* average R0 and correlation values */
      /* --------------------------------- */

      avgCNHist(pL_R0Hist, ppL_CorrHist, &L_RefR0,
                pL_RefCorr);


      /* now quantize the averaged R(0) */
      /* ------------------------------ */

      swQntRefR0 = r0Quant(L_RefR0);


      /* Quantize the averaged correlation */
      /* --------------------------------- */

      lpcCorrQntz(pL_RefCorr,
                  pswFinalRc,
                  piRefVqCodewds);


      /* update frame data: r0, LPC */
      /* -------------------------- */

      swCNR0 = swQntRefR0;
      for (i = 0; i < 3; i++)
        pswCNLpc[i] = piRefVqCodewds[i];


      /* update subframe data (unvoiced mode): GSP0 */
      /* ------------------------------------------ */

      for (i = 0; i < N_SUB; i++)
        pswCNGsp0Code[i] = swRefGsIndex;

    }


    /* random codevectors */
    /* ------------------ */

    if (swSP == 0)
    {
      for (i = 0; i < N_SUB; i++)
      {
        pswCNVSCode1[i] = getPnBits(7, &L_TxPNSeed);
        pswCNVSCode2[i] = getPnBits(7, &L_TxPNSeed);
      }
    }


  }

  return (swSP);
}


/*************************************************************************
 *
 *   FUNCTION NAME:  updateCNHist
 *
 *   PURPOSE:
 *
 *     Add current frame's unquantized R(0) and LPC information to the
 *     comfort noise history, so that it will be available for
 *     averaging.
 *
 *   INPUTS:
 *
 *     Unquantized values from the coder:
 *
 *
 *     L_UnqntzdR0 - unquantized frame energy R(0), an output of FLAT
 *
 *     pL_UnqntzdCorr[NP+1] - unquantized correlation coefficient
 *     array.  Also an output of FLAT.
 *
 *     siUpdPointer (global) - A modulo counter which counts up from
 *     0 to OVERHANG-1.
 *
 *   OUTPUTS:
 *
 *     pL_R0History[OVERHANG] - history of the OVERHANG frames worth of
 *     R(0).
 *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美国产三级| 亚洲精品欧美二区三区中文字幕| 91视频在线观看免费| 粉嫩欧美一区二区三区高清影视| 久久91精品久久久久久秒播| 日本亚洲欧美天堂免费| 免费成人在线视频观看| 久草在线在线精品观看| 国产在线精品免费| 国产成人精品影院| 不卡免费追剧大全电视剧网站| 成人精品亚洲人成在线| 99久久婷婷国产综合精品电影 | 国产成人av自拍| 国产精品888| 不卡的av中国片| 精品久久免费看| 国产亚洲精品免费| 亚洲精品免费视频| 美日韩一区二区三区| 国产一二精品视频| 一道本成人在线| 欧美丰满少妇xxxbbb| 久久伊99综合婷婷久久伊| 国产精品久久久久久久久久久免费看 | 欧美日韩在线观看一区二区| 3atv一区二区三区| 国产视频一区二区在线| 一区二区理论电影在线观看| 爽爽淫人综合网网站| 国产成人精品免费在线| 欧美日韩在线观看一区二区| 久久久亚洲国产美女国产盗摄| 综合久久久久综合| 国产在线国偷精品免费看| 波多野结衣精品在线| 91精品久久久久久久久99蜜臂| 2020日本不卡一区二区视频| 亚洲欧美色一区| 麻豆91在线播放免费| 在线观看国产精品网站| 精品国产免费一区二区三区四区| 专区另类欧美日韩| 久久99久久久欧美国产| 欧洲亚洲精品在线| 中文字幕的久久| 另类小说视频一区二区| 日本韩国精品一区二区在线观看| 精品国免费一区二区三区| 亚洲一区二区影院| av资源网一区| 精品国产免费人成在线观看| 性做久久久久久免费观看| 99综合影院在线| 久久天天做天天爱综合色| 午夜婷婷国产麻豆精品| 91免费观看国产| 久久精品男人天堂av| 看电影不卡的网站| 91精品国产综合久久香蕉麻豆| 国产精品久久国产精麻豆99网站 | 亚洲国产激情av| 久久精品999| 欧美丰满少妇xxxxx高潮对白| 亚洲黄网站在线观看| 成人av电影在线观看| 国产免费成人在线视频| 六月丁香综合在线视频| 91精品国产综合久久福利| 亚洲成人资源网| 欧美久久久久久久久中文字幕| 亚洲激情图片小说视频| 色婷婷激情综合| 亚洲美女屁股眼交3| 99精品视频在线观看| 日韩理论片中文av| 色悠悠久久综合| 亚洲欧美日本韩国| 91福利国产精品| 亚洲一区二区综合| 欧美一区二区三区视频| 免费不卡在线视频| 久久九九久久九九| 成人国产一区二区三区精品| 国产精品色噜噜| 一道本成人在线| 三级不卡在线观看| 欧美成人精品1314www| 国产一区高清在线| 国产精品视频免费看| 在线观看日韩av先锋影音电影院| 亚洲电影第三页| 日韩欧美视频一区| 国产成人夜色高潮福利影视| 136国产福利精品导航| 色国产精品一区在线观看| 日韩国产精品久久久| 日韩精品资源二区在线| 国产成人在线视频播放| 一区二区三区欧美日韩| 日韩午夜中文字幕| 国产成人免费网站| 亚洲成在线观看| 国产亚洲福利社区一区| 色婷婷久久久综合中文字幕 | 一区二区三区视频在线看| 在线综合视频播放| 国产91富婆露脸刺激对白| 亚洲一区视频在线观看视频| 精品国产乱码久久久久久老虎| 国模冰冰炮一区二区| 樱花影视一区二区| 久久在线观看免费| 欧美日韩综合在线免费观看| 国产一区二区三区免费| 亚洲综合色视频| 国产日韩精品一区二区浪潮av| 欧美视频日韩视频在线观看| 国产一区二区成人久久免费影院| 亚洲免费在线电影| 国产亚洲欧美一级| 欧美日韩第一区日日骚| 成人免费高清在线| 欧美aⅴ一区二区三区视频| 亚洲欧洲日韩在线| 久久精品在线观看| 日韩一区二区三区四区| 色综合一个色综合| 国产传媒一区在线| 久久精品99国产国产精| 亚洲午夜视频在线观看| 1024成人网| 中文字幕精品一区二区精品绿巨人| 日韩三级在线观看| 欧美肥胖老妇做爰| 91视频在线看| 99re这里只有精品视频首页| 国产激情91久久精品导航| 国产91精品久久久久久久网曝门| 久久精品国产网站| 日韩av网站在线观看| 亚洲香肠在线观看| 亚洲最新视频在线观看| 亚洲精品国产第一综合99久久| 综合激情网...| 国产日本一区二区| 国产清纯白嫩初高生在线观看91 | 国产精品嫩草影院com| 欧美xingq一区二区| 欧美成人三级在线| 精品日韩av一区二区| 精品日韩99亚洲| 亚洲精品在线一区二区| 久久亚洲一区二区三区明星换脸 | 国产精品夫妻自拍| 国产欧美va欧美不卡在线| 日韩欧美国产综合在线一区二区三区| 欧美又粗又大又爽| 欧美视频在线一区二区三区 | 国产三级精品在线| 久久这里只有精品首页| 久久精品亚洲乱码伦伦中文| 日本va欧美va瓶| 久久99精品久久久久婷婷| 国产精品亚洲人在线观看| 国产精品亚洲专一区二区三区| 国产成人综合网| 91网址在线看| 欧美日韩中文国产| 亚洲精品一区在线观看| 久久亚洲欧美国产精品乐播| 欧美国产丝袜视频| 亚洲精品老司机| 欧美a一区二区| 成人性色生活片| 欧美色网站导航| 日韩一级免费一区| 国产欧美日韩三级| 亚洲精品成人精品456| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产盗摄一区二区| 欧美视频精品在线观看| 久久一留热品黄| 自拍偷拍国产亚洲| 日本免费在线视频不卡一不卡二| 国产乱对白刺激视频不卡| 97se亚洲国产综合自在线| 制服丝袜日韩国产| 中文字幕制服丝袜成人av| 国产成人av福利| 欧洲一区二区三区在线| 久久九九全国免费| 石原莉奈一区二区三区在线观看| 国产精品正在播放| 欧美欧美欧美欧美首页| 国产精品久久久久aaaa樱花 | 亚洲成av人片| 国产精品一区二区男女羞羞无遮挡| 欧洲一区二区三区免费视频| 久久久www免费人成精品|