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

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

?? owng723.c

?? G.711,G.723.1,G.726,G.729,GSM CODEC C/C++ code
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*/////////////////////////////////////////////////////////////////////////////
//
//                  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: G.723.1 speech codec: internal functions and tables.
//
*/

#include <stdlib.h>
#include <stdio.h>

#include "owng723.h"

typedef enum {
   G723_Rate63Frame = 0,
   G723_Rate53Frame,
   G723_SIDFrame,
   G723_UntransmittedFrame
}G723_Info_Bit;

static int  ExtractBits( const char **pBitStrm, int *currBitstrmOffset, int numParamBits )
{
    int     i ;
    int  unpackedParam = 0 ;

    for ( i = 0 ; i < numParamBits ; i ++ ){
        int  lTemp;
        lTemp = ((*pBitStrm)[(i + *currBitstrmOffset)>>3] >> ((i + *currBitstrmOffset) & 0x7)) & 1;
        unpackedParam +=  lTemp << i ;
    }

    *pBitStrm += (numParamBits + *currBitstrmOffset)>>3;
    *currBitstrmOffset = (numParamBits + *currBitstrmOffset) & 0x7;

    return unpackedParam ;
}

void GetParamFromBitstream( const char *pSrcBitStream, ParamStream_G723 *Params)
{
   int   i;
   int  lTmp ;
   short  InfoBit;
   short Bound_AcGn;
   const char **pBitStream = &pSrcBitStream;
   int nBit = 0;

   /* Extract the frame type and rate info */
   InfoBit = ExtractBits(pBitStream, &nBit, 2);
   if ( InfoBit == G723_UntransmittedFrame ) {
      Params->FrameType = G723_UntransmittedFrm; Params->lLSPIdx = 0;
      return;
   }
   if ( InfoBit == G723_SIDFrame ) { /* SID frame*/
      Params->lLSPIdx = ExtractBits(pBitStream, &nBit, 24);/* LspId */
      Params->sAmpIndex[0] = ExtractBits(pBitStream, &nBit, 6); /* Gain */
      Params->FrameType = G723_SIDFrm; return;
   }
   if ( InfoBit == G723_Rate53Frame ) {
      Params->FrameType = G723_ActiveFrm;
      Params->currRate = G723_Rate53;
      Params->lLSPIdx = ExtractBits(pBitStream, &nBit, 24);/* LspId */
      Params->PitchLag[0] = ExtractBits(pBitStream, &nBit, 7);
      Params->AdCdbkLag[1] = ExtractBits(pBitStream, &nBit, 2);
      Params->PitchLag[1] = ExtractBits(pBitStream, &nBit, 7);
      Params->AdCdbkLag[3] = ExtractBits(pBitStream, &nBit, 2);

      Params->AdCdbkLag[0] = Params->AdCdbkLag[2] = 1;

      Params->AdCdbkGain[0] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[1] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[2] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[3] = ExtractBits(pBitStream, &nBit, 12);

      Params->sGrid[0] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[1] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[2] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[3] = ExtractBits(pBitStream, &nBit, 1);

      Params->sPosition[0] = ExtractBits(pBitStream, &nBit, 12);
      Params->sPosition[1] = ExtractBits(pBitStream, &nBit, 12);
      Params->sPosition[2] = ExtractBits(pBitStream, &nBit, 12);
      Params->sPosition[3] = ExtractBits(pBitStream, &nBit, 12);

      Params->sAmplitude[0] = ExtractBits(pBitStream, &nBit, 4);
      Params->sAmplitude[1] = ExtractBits(pBitStream, &nBit, 4);
      Params->sAmplitude[2] = ExtractBits(pBitStream, &nBit, 4);
      Params->sAmplitude[3] = ExtractBits(pBitStream, &nBit, 4);
      /* Frame erasure concealment and parameters scaling*/
      if( Params->PitchLag[0] <= 123) {
        Params->PitchLag[0] += G723_MIN_PITCH ;
      } else {
        Params->isBadFrame = 1; /* transmission error */
        return;
      }
      if( Params->PitchLag[1] <= 123) {
        Params->PitchLag[1] += G723_MIN_PITCH ;
      } else {
        Params->isBadFrame = 1; /* transmission error */
        return;
      }

      for ( i = 0 ; i < 4 ; i ++ ) {
         Params->sTrainDirac[i] = 0 ;
         Bound_AcGn = AdCdbkSizeLowRate;
         lTmp = Params->AdCdbkGain[i];
         Params->AdCdbkGain[i] = (short)(lTmp/N_GAINS) ;
         if(Params->AdCdbkGain[i] < Bound_AcGn ) {
            Params->sAmpIndex[i] = (short)(lTmp % N_GAINS) ;
         } else {
            Params->isBadFrame = 1; /* transmission error */
            return ;
         }
      }
      return;
   }
   if (InfoBit == G723_Rate63Frame) {
      Params->FrameType = G723_ActiveFrm;
      Params->currRate = G723_Rate63;
      Params->lLSPIdx = ExtractBits(pBitStream, &nBit, 24);/* LspId */

      Params->PitchLag[0] = ExtractBits(pBitStream, &nBit, 7);
      Params->AdCdbkLag[1] = ExtractBits(pBitStream, &nBit, 2);
      Params->PitchLag[1] = ExtractBits(pBitStream, &nBit, 7);
      Params->AdCdbkLag[3] = ExtractBits(pBitStream, &nBit, 2);

      Params->AdCdbkLag[0] = Params->AdCdbkLag[2] = 1;

      Params->AdCdbkGain[0] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[1] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[2] = ExtractBits(pBitStream, &nBit, 12);
      Params->AdCdbkGain[3] = ExtractBits(pBitStream, &nBit, 12);

      Params->sGrid[0] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[1] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[2] = ExtractBits(pBitStream, &nBit, 1);
      Params->sGrid[3] = ExtractBits(pBitStream, &nBit, 1);

      ExtractBits(pBitStream, &nBit, 1);/* Skip the reserved bit for align pack*/

      lTmp = ExtractBits(pBitStream, &nBit, 13); /*Exract the position,s MSB*/
                                         /* lTmp = 810*x0 + 90*x1 + 9*x2 + x3*/
      Params->sPosition[0] = lTmp / 810;
      lTmp -= Params->sPosition[0]*810;       /* lTmp =          90*x1 + 9*x2 + x3*/
      Params->sPosition[1] = lTmp / 90;
      lTmp -= Params->sPosition[1]*90;        /* lTmp =                  9*x2 + x3*/
      Params->sPosition[2] = lTmp / 9;
      Params->sPosition[3] = lTmp - (Params->sPosition[2]*9);

      /* Extract all the pulse positions */
      Params->sPosition[0] = ( Params->sPosition[0] << 16 ) + ExtractBits(pBitStream, &nBit, 16) ;
      Params->sPosition[1] = ( Params->sPosition[1] << 14 ) + ExtractBits(pBitStream, &nBit, 14) ;
      Params->sPosition[2] = ( Params->sPosition[2] << 16 ) + ExtractBits(pBitStream, &nBit, 16) ;
      Params->sPosition[3] = ( Params->sPosition[3] << 14 ) + ExtractBits(pBitStream, &nBit, 14) ;

      /* Extract pulse amplitudes */
      Params->sAmplitude[0] = ExtractBits(pBitStream, &nBit, 6);
      Params->sAmplitude[1] = ExtractBits(pBitStream, &nBit, 5);
      Params->sAmplitude[2] = ExtractBits(pBitStream, &nBit, 6);
      Params->sAmplitude[3] = ExtractBits(pBitStream, &nBit, 5);

      /* Frame erasure concealment and parameters scaling*/

      if( Params->PitchLag[0] <= 123) {
        Params->PitchLag[0] += G723_MIN_PITCH ;
      } else {
        Params->isBadFrame = 1; /* transmission error */
        return;
      }
      if( Params->PitchLag[1] <= 123) {
        Params->PitchLag[1] += G723_MIN_PITCH ;
      } else {
        Params->isBadFrame = 1; /* transmission error */
        return;
      }
      for ( i = 0 ; i < 4 ; i ++ ) {
         lTmp = Params->AdCdbkGain[i];
         Params->sTrainDirac[i] = 0 ;
         Bound_AcGn = AdCdbkSizeLowRate ;
         if (Params->PitchLag[i>>1] < (G723_SBFR_LEN-2)) {
            Params->sTrainDirac[i] = (short)(lTmp >> 11) ;
            lTmp &= 0x7ff ;
            Bound_AcGn = AdCdbkSizeHighRate ;
         }
         Params->AdCdbkGain[i] = (short)(lTmp/N_GAINS) ;
         if(Params->AdCdbkGain[i] < Bound_AcGn ) {
            Params->sAmpIndex[i] = (short)(lTmp % N_GAINS) ;
         } else {
            Params->isBadFrame = 1; /* transmission error */
            return ;
         }
      }
      return;
   }
   return;
}

static short* Parm2Bits( int param, short *pBitStrm, int ParamBitNum )
{
   int i;
   for ( i = 0 ; i < ParamBitNum ; i ++ ) {
      *pBitStrm ++ = (short) (param & 0x1);
      param >>= 1;
   }

   return pBitStrm;
}
void    SetParam2Bitstream(G723Encoder_Obj* encoderObj, ParamStream_G723 *Params, char *pDstBitStream)
{
    int     i;
    short *pBitStream;
    int  MSBs;

    LOCAL_ARRAY(short, Bits,192,encoderObj);

    pBitStream = Bits;

    switch (Params->FrameType) {

    case 0 :  /* untransmitted */
       pDstBitStream[0] = 0;
       pBitStream = Parm2Bits( G723_UntransmittedFrame, pBitStream, 2 );
       for ( i = 0 ; i < 2 ; i ++ )
         pDstBitStream[i>>3] ^= Bits[i] << (i & 0x7);

       LOCAL_ARRAY_FREE(short, Bits,192,encoderObj);
       return;
    case 2 :  /* SID */
       ippsZero_8u(pDstBitStream, 4);
       pBitStream = Parm2Bits( G723_SIDFrame, pBitStream, 2 );

       pBitStream = Parm2Bits( Params->lLSPIdx, pBitStream, 24 ); /* 24 bit lLSPIdx */
       pBitStream = Parm2Bits( Params->sAmpIndex[0], pBitStream, 6 );/* Do Sid frame gain */

       for ( i = 0 ; i < 32 ; i ++ )
          pDstBitStream[i>>3] ^= Bits[i] << (i & 0x7) ;

       LOCAL_ARRAY_FREE(short, Bits,192,encoderObj);
       return;
    default :
       if ( Params->currRate == G723_Rate63 ){
            ippsZero_8u(pDstBitStream, 24);
            pBitStream = Parm2Bits( G723_Rate63Frame, pBitStream, 2 );

            pBitStream = Parm2Bits( Params->lLSPIdx, pBitStream, 24 ) ; /* 24 bit LspId */
            pBitStream = Parm2Bits( Params->PitchLag[0] -  G723_MIN_PITCH, pBitStream, 7 ) ; /* Adaptive codebook lags */
            pBitStream = Parm2Bits( Params->AdCdbkLag[1], pBitStream, 2 ) ;
            pBitStream = Parm2Bits( Params->PitchLag[1] -  G723_MIN_PITCH, pBitStream, 7 ) ;
            pBitStream = Parm2Bits( Params->AdCdbkLag[3], pBitStream, 2 ) ;

            /* Write gains indexes of 12 bit */
            for ( i = 0 ; i < 4 ; i ++ ) {
               pBitStream = Parm2Bits( Params->AdCdbkGain[i]*N_GAINS + Params->sAmpIndex[i] + (Params->sTrainDirac[i] << 11), pBitStream, 12 ) ;
            }

            for ( i = 0 ; i < 4 ; i ++ )
               *pBitStream ++ = Params->sGrid[i] ; /* Write all the Grid indices */

            *pBitStream ++ = 0 ; /* reserved bit */
            /* Write 13 bit combined position index, pack 4 MSB from each pulse position. */
            MSBs = (Params->sPosition[0] >> 16) * 810 + ( Params->sPosition[1] >> 14)*90 +
                   (Params->sPosition[2] >> 16) * 9 + ( Params->sPosition[3] >> 14 );
            pBitStream = Parm2Bits(MSBs, pBitStream, 13);

            /* Write all the pulse positions */
            pBitStream = Parm2Bits(Params->sPosition[0] & 0xffff, pBitStream, 16);
            pBitStream = Parm2Bits(Params->sPosition[1] & 0x3fff, pBitStream, 14);
            pBitStream = Parm2Bits(Params->sPosition[2] & 0xffff, pBitStream, 16);
            pBitStream = Parm2Bits(Params->sPosition[3] & 0x3fff, pBitStream, 14);

            /* Write pulse amplitudes */
            pBitStream = Parm2Bits(Params->sAmplitude[0], pBitStream, 6);
            pBitStream = Parm2Bits(Params->sAmplitude[1] , pBitStream, 5);
            pBitStream = Parm2Bits(Params->sAmplitude[2], pBitStream, 6);
            pBitStream = Parm2Bits(Params->sAmplitude[3], pBitStream, 5);

            for ( i = 0 ; i < 192 ; i ++ )
               pDstBitStream[i>>3] ^= Bits[i] << (i & 0x7);
       }else{
            ippsZero_8u(pDstBitStream, 20);
            pBitStream = Parm2Bits( G723_Rate53Frame, pBitStream, 2 );

            pBitStream = Parm2Bits( Params->lLSPIdx, pBitStream, 24 ) ; /* 24 bit lLSPIdx */
            pBitStream = Parm2Bits( Params->PitchLag[0] -  G723_MIN_PITCH, pBitStream, 7 ) ; /* Adaptive codebook lags */
            pBitStream = Parm2Bits( Params->AdCdbkLag[1], pBitStream, 2 ) ;
            pBitStream = Parm2Bits( Params->PitchLag[1] -  G723_MIN_PITCH, pBitStream, 7 ) ;
            pBitStream = Parm2Bits( Params->AdCdbkLag[3], pBitStream, 2 ) ;

            /* Write gains indexes of 12 bit */
            for ( i = 0 ; i < 4 ; i ++ )
               pBitStream = Parm2Bits( Params->AdCdbkGain[i]*N_GAINS + Params->sAmpIndex[i], pBitStream, 12 );

            for ( i = 0 ; i < 4 ; i ++ )
               *pBitStream ++ = Params->sGrid[i] ; /* Write all the Grid indices */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色哟哟精品一区| 91在线精品一区二区| 欧美日韩国产综合草草| 亚洲精品视频一区二区| 色婷婷一区二区| 一区2区3区在线看| 56国语精品自产拍在线观看| 三级欧美韩日大片在线看| 欧美一区二区成人6969| 韩国精品免费视频| 国产精品视频免费| 色婷婷综合视频在线观看| 亚洲www啪成人一区二区麻豆| 欧美日韩电影在线| 美女看a上一区| 中文字幕免费不卡| 欧美一a一片一级一片| 日欧美一区二区| 精品久久久久久久久久久院品网| 成人夜色视频网站在线观看| 亚洲一区国产视频| 精品国产百合女同互慰| 国产91丝袜在线播放0| 亚洲欧美日韩国产中文在线| 欧美日韩色综合| 国产伦精品一区二区三区免费| 日韩毛片在线免费观看| 成人永久aaa| 在线视频观看一区| 一区二区三区久久| 久久99九九99精品| 在线视频一区二区三| 久久久亚洲欧洲日产国码αv| 亚洲私人影院在线观看| 激情图区综合网| 91精品国产综合久久国产大片 | 麻豆免费看一区二区三区| 欧美日韩亚洲综合一区| 国产在线乱码一区二区三区| 亚洲免费观看高清完整版在线观看熊| 91精品国产欧美一区二区成人| 国产一区二区伦理片| 亚洲一二三级电影| 欧美激情综合在线| 精品毛片乱码1区2区3区| 97超碰欧美中文字幕| 国产资源在线一区| 亚洲va韩国va欧美va精品| 国产精品毛片高清在线完整版| 欧美一二三四区在线| 91小宝寻花一区二区三区| 精品一区二区三区免费视频| 亚洲国产视频网站| 久久久久9999亚洲精品| 日韩欧美一区二区久久婷婷| 91在线看国产| 成人av午夜电影| 国产91色综合久久免费分享| 久久疯狂做爰流白浆xx| 琪琪一区二区三区| 午夜一区二区三区视频| 亚洲精品乱码久久久久久| 国产精品久久久久久久第一福利| 欧美成人一区二区三区在线观看| 欧美午夜精品一区二区三区| 91网站最新网址| 成人高清视频免费观看| 国产精品自拍毛片| 国产一区二区主播在线| 九一九一国产精品| 久久99久久99小草精品免视看| 欧美aaaaaa午夜精品| 秋霞电影网一区二区| 午夜久久久久久| 亚洲午夜成aⅴ人片| 亚洲日本电影在线| 亚洲精品美国一| 亚洲综合激情另类小说区| 亚洲综合在线第一页| 亚洲国产精品一区二区尤物区| 亚洲一级在线观看| 日韩一区精品字幕| 免费看欧美美女黄的网站| 日本亚洲三级在线| 免费成人你懂的| 国产一区二区三区久久悠悠色av| 国产麻豆欧美日韩一区| 丁香婷婷综合色啪| 99国产欧美另类久久久精品| 色婷婷av一区二区三区gif| 日本高清不卡视频| 欧美三区在线观看| 日韩欧美国产电影| 欧美激情综合在线| 亚洲精品视频一区| 亚洲成a人片在线观看中文| 日韩成人午夜精品| 国产成人免费在线观看不卡| 91原创在线视频| 欧美精品色一区二区三区| 精品剧情v国产在线观看在线| 久久亚洲影视婷婷| 中文字幕一区二区三区视频| 一区二区三区成人| 日韩高清一级片| 国产精品88av| 色婷婷久久一区二区三区麻豆| 欧美日韩www| 久久久影院官网| 亚洲精品亚洲人成人网在线播放| 无吗不卡中文字幕| 国产福利一区二区三区视频在线 | 狠狠v欧美v日韩v亚洲ⅴ| 国v精品久久久网| 欧美亚洲动漫精品| 精品国产三级电影在线观看| 国产精品美女久久久久aⅴ | 中文字幕一区在线| 午夜欧美一区二区三区在线播放| 国产在线播放一区二区三区| 色菇凉天天综合网| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲精选视频免费看| 久久 天天综合| 日本高清成人免费播放| 26uuu成人网一区二区三区| 亚洲女同一区二区| 国产精品一区一区三区| 欧美在线一区二区| 日本一区二区三区电影| 免费av网站大全久久| 91小宝寻花一区二区三区| 337p日本欧洲亚洲大胆精品| 五月天丁香久久| 91免费在线看| 欧美经典一区二区三区| 日韩va亚洲va欧美va久久| www.欧美色图| 久久综合视频网| 午夜激情久久久| 日本韩国欧美国产| 1024国产精品| 国产综合久久久久久鬼色| 7777精品伊人久久久大香线蕉最新版| 国产精品国产自产拍高清av王其| 青青草成人在线观看| 欧美日韩一区二区在线观看视频 | 精品国产精品一区二区夜夜嗨| 一区二区三区高清不卡| 波多野结衣欧美| 精品国产91久久久久久久妲己 | 亚洲一区在线视频观看| av一本久道久久综合久久鬼色| 精品国产乱码久久久久久夜甘婷婷| 亚洲成人资源网| 色综合激情五月| 亚洲视频你懂的| caoporen国产精品视频| 中文字幕不卡在线观看| 国产乱码一区二区三区| 精品国产亚洲在线| 麻豆国产欧美一区二区三区| 91麻豆精品国产91久久久使用方法| 亚洲精品高清在线观看| 色婷婷久久一区二区三区麻豆| 中文字幕一区二区三区视频| 成人av电影在线| 国产精品久久久久久久久免费相片 | 制服丝袜在线91| 午夜精品福利在线| 欧美精品日韩一本| 日韩av中文字幕一区二区| 欧美日韩国产美| 美女视频黄久久| 欧美videossexotv100| 久久66热re国产| 久久久久九九视频| 成人一道本在线| 亚洲欧美日韩中文字幕一区二区三区| 91丨porny丨蝌蚪视频| 一区二区三区在线免费播放| 91国偷自产一区二区三区成为亚洲经典 | 一级做a爱片久久| 欧美精品第1页| 成人高清视频免费观看| 午夜精品久久久久久不卡8050| 7777精品伊人久久久大香线蕉完整版| 亚洲男人天堂av网| 日韩一区二区免费在线观看| 中文字幕制服丝袜一区二区三区 | 亚洲精品乱码久久久久| 国产成人av资源| 欧美不卡一区二区三区| 日本成人在线一区| 6080yy午夜一二三区久久| 亚洲18女电影在线观看| 精品视频在线视频| 亚洲一区二区不卡免费| 欧美色窝79yyyycom| 亚洲午夜久久久久久久久电影院|