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

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

?? utilgsmamr.c

?? G.711,G.723.1,G.726,G.729,GSM CODEC C/C++ code
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*/////////////////////////////////////////////////////////////////////////////
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2005 Intel Corporation. All Rights Reserved.
//
//     Intel(R) Integrated Performance Primitives
//     USC - Unified Speech Codec interface library
//
// By downloading and installing USC codec, you hereby agree that the
// accompanying Materials are being provided to you under the terms and
// conditions of the End User License Agreement for the Intel(R) Integrated
// Performance Primitives product previously accepted by you. Please refer
// to the file ipplic.htm located in the root directory of your Intel(R) IPP
// product installation for more information.
//
// A speech coding standards promoted by ITU, ETSI, 3GPP and other
// organizations. Implementations of these standards, or the standard enabled
// platforms may require licenses from various entities, including
// Intel Corporation.
//
//
// Purpose: GSMAMR speech codec: common utilities.
//
*/

#include "owngsmamr.h"

/****************************************************************************
 *  Function: ownVADPitchDetection_GSMAMR()
 ***************************************************************************/
void ownVADPitchDetection_GSMAMR(IppGSMAMRVad1State *st, short *pTimeVec,
                                 short *vLagCountOld, short *vLagOld)
{
   short lagcount, i;
   lagcount = 0;

   for (i = 0; i < 2; i++) {
      if(abs(*vLagOld - pTimeVec[i]) < LOW_THRESHOLD) lagcount++;
      *vLagOld = pTimeVec[i];
   }

   st->pitchFlag >>= 1;
   if (*vLagCountOld + lagcount >= NUM_THRESHOLD)
      st->pitchFlag = st->pitchFlag | 0x4000;

   *vLagCountOld = lagcount;
}

/***************************************************************************
 *   Function: ownUpdateLTPFlag_GSMAMR()
 *************************************************************************/
void ownUpdateLTPFlag_GSMAMR(IppSpchBitRate rate, int L_Rmax, int L_R0, Ipp16s *vFlagLTP)
{
    short thresh;
    short hi1;
    short lo1;
    int Ltmp;

    if ((rate == IPP_SPCHBR_4750) || (rate == IPP_SPCHBR_5150)) thresh = 18022;
    else if (rate == IPP_SPCHBR_10200) thresh = 19660;
    else thresh = 21299;

    hi1 = L_R0 >> 16;
    lo1 = (L_R0 >> 1) & 0x7fff;
    Ltmp = (hi1 * thresh +  ((lo1 * thresh) >> 15));
    if (L_Rmax > 2*Ltmp) *vFlagLTP = 1;
    else                 *vFlagLTP = 0;

    return;
    /* End of ownUpdateLTPFlag_GSMAMR() */
}

static __ALIGN32 CONST short TableLog2[33] = {
     0,  1455,  2866,  4236,  5568,  6863,  8124,  9352,
 10549, 11716, 12855, 13967, 15054, 16117, 17156, 18172,
 19167, 20142, 21097, 22033, 22951, 23852, 24735, 25603,
 26455, 27291, 28113, 28922, 29716, 30497, 31266, 32023,
 32767 };

 /*************************************************************************
 * Function:   ownLog2_GSMAMR_norm
 *************************************************************************/
void ownLog2_GSMAMR_norm(int inVal, short exp, short *expPart, short *fracPart)
{
  short idx, a, tmp;
  int outVal;

  if( inVal <= 0 ) {
    *expPart = 0;
    *fracPart = 0;
    return;
  }

  *expPart = 30 - exp;
  idx = inVal >> 25;
  a = (inVal >> 10) & 0x7fff;
  idx   -=  32;

  outVal = TableLog2[idx] << 16;
  tmp = TableLog2[idx] - TableLog2[idx+1];
  outVal -= 2 * tmp * a;

  *fracPart =  outVal >> 16;

  return;
  /* End of ownLog2_GSMAMR_norm() */
}
/*************************************************************************
 *  Function:  ownLog2_GSMAMR()
 *************************************************************************/
void ownLog2_GSMAMR(int inVal, short *expPart, short *fracPart)
{
  short exp;

  exp = Norm_32s_I(&inVal);
  ownLog2_GSMAMR_norm (inVal, exp, expPart, fracPart);

  return;
  /* End of ownLog2_GSMAMR() */
}

/*************************************************************************
 *  Function:  ownPow2_GSMAMR
 *************************************************************************/
static __ALIGN32 CONST short TablePow2[33] = {
 16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066,
 19484, 19911, 20347, 20792, 21247, 21713, 22188, 22674,
 23170, 23678, 24196, 24726, 25268, 25821, 26386, 26964,
 27554, 28158, 28774, 29405, 30048, 30706, 31379, 32066,
 32767 };

int ownPow2_GSMAMR(short expPart, short fracPart)
{
  short exp, idx, a, tmp;
  int inVal, outVal, temp;

  exp = 30 - expPart;
  if (exp > 31) return 0;
  idx = fracPart >> 10;
  a   = (short)((fracPart << 5) & 0x7fff);

  inVal = TablePow2[idx] << 16;
  tmp = TablePow2[idx] - TablePow2[idx+1];
  inVal = inVal - 2*tmp*a;

  if (exp >= 31) outVal = (inVal < 0) ? -1 : 0;
  else           outVal = inVal >> exp;

  temp = 1 << (exp-1);
  if(inVal & temp) outVal++;

  return(outVal);
  /* End of ownPow2_GSMAMR() */
}

/* table[i] = sqrt((i+16)*2^-6) * 2^15, i.e. sqrt(x) scaled Q15 */
static __ALIGN32 CONST short TableSqrt[49] =
{
 16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644,
 20066, 20480, 20886, 21283, 21674, 22058, 22435, 22806,
 23170, 23530, 23884, 24232, 24576, 24915, 25249, 25580,
 25905, 26227, 26545, 26859, 27170, 27477, 27780, 28081,
 28378, 28672, 28963, 29251, 29537, 29819, 30099, 30377,
 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511,
 32767};

/********************************************************************************
 *  Function: ownSqrt_Exp_GSMAMR()
 ********************************************************************************/

int ownSqrt_Exp_GSMAMR (int inVal, short *exp)
{
    short idx, a, tmp;
    int outVal;

    if (inVal <= 0) { *exp = 0; return 0; }

    outVal = inVal;
    *exp = Norm_32s_I(&outVal) & 0xFFFE;
    inVal <<= *exp;

    idx = inVal >> 25;
    a = (inVal >> 10) & 0x7fff;

    idx -= 16;
    outVal = TableSqrt[idx] << 16;
    tmp = TableSqrt[idx] - TableSqrt[idx+1];
    outVal = outVal - 2*tmp*a;

    return (outVal);
    /* End of ownSqrt_Exp_GSMAMR() */
}

/*************************************************************************
 *  Function: Reorder_lsf()
 *************************************************************************/
void ownReorderLSFVec_GSMAMR(short *lsf, short minDistance, short len)
{
    int i;
    short lsf_min;

    lsf_min = minDistance;

    for (i = 0; i < len; i++)  {
        if(lsf[i] < lsf_min) lsf[i] = lsf_min;
        lsf_min = lsf[i] + minDistance;
    }
}
/*************************************************************************
 *  Function: ownGetMedianElements_GSMAMR()
 *************************************************************************/
short ownGetMedianElements_GSMAMR (short *pPastGainVal, short num)
{
    short i, j, idx = 0;
    short max;
    short medianIndex;
    short tmp[MAX_MED_SIZE];
    short tmp2[MAX_MED_SIZE];

    ippsCopy_16s(pPastGainVal, tmp2, num);

    for (i = 0; i < num; i++) {
        max = -32767;
        for (j = 0; j < num; j++)  {
            if (tmp2[j] >= max) {
                max = tmp2[j];
                idx = j;
            }
        }
        tmp2[idx] = -32768;
        tmp[i] = idx;
    }
    medianIndex = tmp[num >> 1];

    return (pPastGainVal[medianIndex]);
}
/**************************************************************************
*  Proc: ownCtrlDetectBackgroundNoise_GSMAMR()  -
***************************************************************************/
short ownCtrlDetectBackgroundNoise_GSMAMR (short excitation[], short excEnergy, short exEnergyHist[],
                                           short vVoiceHangover, short prevBFI, short carefulFlag)
{
   short exp;
   short testEnergy, scaleFactor, avgEnergy, prevEnergy;
   int t0;

   avgEnergy = ownGetMedianElements_GSMAMR(exEnergyHist, 9);
   prevEnergy = (exEnergyHist[7] + exEnergyHist[8]) >> 1;

   if( exEnergyHist[8] < prevEnergy) prevEnergy = exEnergyHist[8];

   if( excEnergy < avgEnergy && excEnergy > 5) {
      testEnergy = prevEnergy << 2;

      if( vVoiceHangover < 7 || prevBFI != 0 ) testEnergy -= prevEnergy;
      if( avgEnergy > testEnergy) avgEnergy = testEnergy;

      exp = 0;
      for(; excEnergy < 0x4000; exp++) excEnergy <<= 1;
      excEnergy = (16383<<15)/excEnergy;
      t0 = avgEnergy * excEnergy;
      t0 >>= 19 - exp;
      if(t0 > 32767)  t0 = 32767;
      scaleFactor = (short)t0;

      if((carefulFlag != 0) && (scaleFactor > 3072))  scaleFactor = 3072;

      ippsMulC_16s_ISfs(scaleFactor, excitation, SUBFR_SIZE_GSMAMR, 10);
   }

   return 0;
}
/*************************************************************************
 *  Function: ownComputeCodebookGain_GSMAMR
 *************************************************************************/
short ownComputeCodebookGain_GSMAMR (short *pTargetVec, short *pFltVec)
{
    short i;
    short xy, yy, exp_xy, exp_yy, gain;
    IPP_ALIGNED_ARRAY(16, short, pFltVecScale, SUBFR_SIZE_GSMAMR);
    int s;

    ippsRShiftC_16s(pFltVec, 1, pFltVecScale, SUBFR_SIZE_GSMAMR);
    ippsDotProd_16s32s_Sfs(pTargetVec, pFltVecScale, SUBFR_SIZE_GSMAMR, &s, 0);

    if(s == 0) s = 1;
    s <<= 1;
    exp_xy = Norm_32s_I(&s);
    xy = (short)(s >> 16);
    if(xy <= 0) return ((short) 0);

    ippsDotProd_16s32s_Sfs(pFltVecScale, pFltVecScale, SUBFR_SIZE_GSMAMR, &s, -1);

    exp_yy = Norm_32s_I(&s);
    yy = (short)(s >> 16);
    xy >>= 1;
    gain = (yy > 0)? (xy<<15)/yy : IPP_MAX_16S;

    i = exp_xy + 5;
    i -= exp_yy;
    gain = (gain >> i) << 1;

    return (gain);
}
/*************************************************************************
 *  Function: ownGainAdaptAlpha_GSMAMR
 *************************************************************************/
void ownGainAdaptAlpha_GSMAMR(short *vOnSetQntGain, short *vPrevAdaptOut, short *vPrevGainZero,
                              short *a_LTPHistoryGain, short ltpg, short gainCode, short *alpha)
{
    short adapt;
    short result;
    short filt;
    short tmp, i;
    int temp;

    if (ltpg <= LTP_GAIN_LOG10_1) adapt = 0;
    else if (ltpg <= LTP_GAIN_LOG10_2) adapt = 1;
    else adapt = 2;

    tmp = gainCode >> 1;
    if (gainCode & 1) tmp++;

    if (tmp > *vPrevGainZero && gainCode > 200) *vOnSetQntGain = 8;
    else if (*vOnSetQntGain != 0) *vOnSetQntGain -= 1;

    if ((*vOnSetQntGain != 0) && (adapt < 2)) adapt += 1;

    a_LTPHistoryGain[0] = ltpg;
    filt = ownGetMedianElements_GSMAMR(a_LTPHistoryGain, 5);

    if(adapt == 0) {
       if (filt > 5443)   result = 0;
       else if (filt < 0)  result = 16384;
       else {
           temp = (24660 * filt)>>13;
           result = 16384 - temp;
       }
    } else result = 0;

    if (*vPrevAdaptOut == 0) result >>= 1;
    *alpha = result;

    *vPrevAdaptOut = result;
    *vPrevGainZero = gainCode;

    for (i = NUM_MEM_LTPG-1; i > 0; i--)
        a_LTPHistoryGain[i] = a_LTPHistoryGain[i-1];

}
/**************************************************************************
*  Function: ownCBGainAverage_GSMAMR()
**************************************************************************/
short ownCBGainAverage_GSMAMR(short *a_GainHistory, short *vHgAverageVar, short *vHgAverageCount,
                              IppSpchBitRate rate, short gainCode, short *lsp, short *lspAver,
                              short badFrame, short vPrevBadFr, short potDegBadFrame, short vPrevDegBadFr,
                              short vBackgroundNoise, short vVoiceHangover)
{
   short i;
   short cbGainMix, diff, bgMix, cbGainMean;
   int L_sum;
   short tmp[LP_ORDER_SIZE], tmp1, tmp2, shift1, shift2, shift;

   cbGainMix = gainCode;
   for (i = 0; i < (CBGAIN_HIST_SIZE-1); i++)
      a_GainHistory[i] = a_GainHistory[i+1];

   a_GainHistory[CBGAIN_HIST_SIZE-1] = gainCode;

   for (i = 0; i < LP_ORDER_SIZE; i++) {
      tmp1 = abs(lspAver[i] - lsp[i]);
      shift1 = Exp_16s(tmp1) - 1;
      tmp1 <<= shift1;
      shift2 = Exp_16s(lspAver[i]);
      tmp2 = lspAver[i] << shift2;
      tmp[i] = (tmp2>0)? (tmp1<<15)/tmp2 : IPP_MAX_16S;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产91久久来源| 国产精品天美传媒| 日韩成人av影视| 日韩视频免费观看高清完整版在线观看| 亚洲国产日韩一级| 欧美一级一区二区| 国产精品亚洲成人| 亚洲精品一卡二卡| 欧美一区二区在线免费观看| 久久99精品久久久久久动态图 | 极品少妇xxxx偷拍精品少妇| 久久这里只有精品首页| 成人av电影免费在线播放| 亚洲美女精品一区| 欧美高清hd18日本| 国产麻豆午夜三级精品| 一区二区在线看| 精品久久99ma| 成人av在线资源网站| 午夜精品久久久久| 久久精品网站免费观看| 91女人视频在线观看| 免费观看一级特黄欧美大片| 中文欧美字幕免费| 欧美高清视频在线高清观看mv色露露十八| 麻豆精品视频在线观看| 一区免费观看视频| 欧美一级日韩免费不卡| 成人av网站在线观看| 午夜影视日本亚洲欧洲精品| 久久精品欧美一区二区三区不卡 | 欧美在线色视频| 精油按摩中文字幕久久| 一区二区三区在线视频播放| 欧美精品一区二区久久婷婷| 色狠狠av一区二区三区| 国产一区久久久| 亚洲国产cao| 国产精品天天摸av网| 欧美一区二区在线看| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 极品尤物av久久免费看| 一级特黄大欧美久久久| 国产人成亚洲第一网站在线播放| 欧美无乱码久久久免费午夜一区 | 色吧成人激情小说| 国产一区二区三区四区五区入口| 一个色在线综合| 国产精品欧美久久久久一区二区| 日韩一区二区免费在线电影| 色综合天天综合| 国产成人av自拍| 麻豆精品视频在线观看| 亚洲18女电影在线观看| 亚洲欧美综合在线精品| 国产三区在线成人av| 日韩一区二区电影在线| 欧美性受极品xxxx喷水| 色哟哟国产精品| av爱爱亚洲一区| 粉嫩av一区二区三区在线播放| 免费观看成人av| 亚洲成人资源在线| 亚洲国产一区二区视频| 一区二区三区在线不卡| 亚洲激情中文1区| 一区二区中文视频| 亚洲视频你懂的| 亚洲欧美自拍偷拍色图| 国产精品欧美一区喷水| 国产精品福利一区二区| 中文字幕日韩一区| 亚洲人午夜精品天堂一二香蕉| 久久精品欧美日韩精品| 国产精品人成在线观看免费| 国产三级精品视频| 中文欧美字幕免费| 自拍偷自拍亚洲精品播放| 中文字幕日本不卡| 午夜a成v人精品| 亚洲一级电影视频| 午夜成人免费视频| 日本成人中文字幕| 久久97超碰色| 成人免费视频视频| av中文字幕不卡| 色国产精品一区在线观看| 欧美视频精品在线| 91精品国产综合久久蜜臀| 精品国产一区久久| 欧美激情一区二区| 亚洲美腿欧美偷拍| 亚洲123区在线观看| 久久国产欧美日韩精品| 国产毛片精品一区| 99久久99久久久精品齐齐| 在线观看日韩毛片| 5858s免费视频成人| 国产亚洲一区二区三区在线观看| 中文字幕 久热精品 视频在线| 日韩美女精品在线| 青青草一区二区三区| 国产精品1024| 在线观看亚洲精品| 精品毛片乱码1区2区3区| 欧美高清在线一区| 亚洲午夜精品网| 韩国三级在线一区| 91国在线观看| 欧美xfplay| 亚洲日本丝袜连裤袜办公室| 蜜桃av噜噜一区| 91啪亚洲精品| 久久在线免费观看| 亚洲与欧洲av电影| 激情偷乱视频一区二区三区| 色综合色狠狠综合色| 欧美成人高清电影在线| 国产精品久久久久天堂| 日韩精品一级中文字幕精品视频免费观看| 精品亚洲成a人在线观看| 日本高清无吗v一区| 欧美精品一区二区三区高清aⅴ| 亚洲精品老司机| 国产高清不卡一区二区| 欧美一区二区成人| 亚洲黄一区二区三区| 国产一区二区三区四区在线观看 | 成人一区二区三区视频在线观看| 欧美最猛黑人xxxxx猛交| 国产亚洲婷婷免费| 日韩黄色免费网站| 在线亚洲一区观看| 日本一区二区三区在线观看| 日韩 欧美一区二区三区| 国产成人欧美日韩在线电影| 欧美一区二区福利视频| 亚洲国产综合在线| 91小视频免费看| 日本一区二区三区久久久久久久久不| 午夜视频一区二区| 欧洲av一区二区嗯嗯嗯啊| 欧美极品少妇xxxxⅹ高跟鞋| 麻豆成人综合网| 777午夜精品免费视频| 一区二区三区加勒比av| 97久久精品人人澡人人爽| 国产农村妇女精品| 国产原创一区二区| 欧美一二三区在线| 五月开心婷婷久久| 欧美日韩国产三级| 亚洲自拍偷拍av| 91国偷自产一区二区使用方法| 国产精品久久久久久久久免费樱桃| 精品一区二区三区在线观看 | 国产盗摄视频一区二区三区| 91精品国产欧美一区二区18| 亚洲一区二区欧美日韩 | 日韩精品免费专区| 欧美午夜电影网| 亚洲成在人线在线播放| 欧美日韩亚洲综合| 视频一区中文字幕| 欧美日本在线看| 日韩电影在线免费| 日韩欧美另类在线| 精品在线播放午夜| 久久久高清一区二区三区| 国产精品一区专区| 久久精品视频免费| 国产91精品一区二区| 国产精品欧美精品| 91麻豆高清视频| 一区二区免费在线| 欧美日本精品一区二区三区| 日韩制服丝袜av| ww亚洲ww在线观看国产| 国产自产视频一区二区三区| 日本一区二区视频在线| 91老师片黄在线观看| 亚洲成a人片在线观看中文| 欧美日韩国产片| 极品少妇xxxx偷拍精品少妇| 久久精品一区蜜桃臀影院| a4yy欧美一区二区三区| 亚洲自拍偷拍图区| 精品国产欧美一区二区| 成人午夜av影视| 亚洲一区二区三区三| 欧美成人免费网站| 丁香另类激情小说| 亚洲国产毛片aaaaa无费看| 日韩一级在线观看| 国产91精品精华液一区二区三区| 亚洲免费av高清| 欧美一级专区免费大片| av网站一区二区三区| 亚洲一区影音先锋| 亚洲精品一区二区三区精华液 |