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

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

?? uscg723.c

?? G.711,G.723.1,G.726,G.729,GSM CODEC C/C++ code
?? C
字號:
/*/////////////////////////////////////////////////////////////////////////////
//
//                  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: USC functions.
//
*/

#include "owng723.h"
#include "g723api.h"
#include <string.h>
#include <usc.h>

#define  G723_NUM_RATES  2

static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo);
static USC_Status NumAlloc(const USC_Option *options, int *nbanks);
static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks);
static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle);
static USC_Status Reinit(const USC_Modes *modes, USC_Handle handle );
static USC_Status Control(const USC_Modes *modes, USC_Handle handle );
static USC_Status Encode(USC_Handle handle, USC_PCMStream *in, USC_Bitstream *out);
static USC_Status Decode(USC_Handle handle, USC_Bitstream *in, USC_PCMStream *out);
static USC_Status GetOutStreamSize(const USC_Option *options, int bitrate, int nbytesSrc, int *nbytesDst);
static USC_Status SetFrameSize(const USC_Option *options, USC_Handle handle, int frameSize);

#define BITSTREAM_SIZE      24
#define G723_SPEECH_FRAME   240
#define G723_BITS_PER_SAMPLE   16
#define G723_UNTR_FRAMESIZE 1

typedef struct {
    int direction;
    int bitrate;
    int vad;
    int hpf;
    int pf;
    int reserved0; // for future extension
    int reserved1; // for future extension
    int reserved2; // for future extension
} G723_Handle_Header;

/* global usc vector table */
USCFUN USC_Fxns USC_G723_Fxns=
{
    {
        USC_Codec,
        GetInfo,
        NumAlloc,
        MemAlloc,
        Init,
        Reinit,
        Control
    },
    Encode,
    Decode,
    GetOutStreamSize,
    SetFrameSize

};

static USC_Option  params;  /* what is supported  */
static USC_PCMType pcmType; /* codec audio source */


static __ALIGN32 CONST short LostFrame[G723_SPEECH_FRAME]=
{
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};

static __ALIGN32 CONST USC_Rates pTblRates_G723[G723_NUM_RATES]={
    {6300},
    {5300}
};

static int CheckRate_G723(int rate_bps)
{
    int rate;

    switch(rate_bps) {
      case 6300:  rate = 0; break;
      case 5300:  rate = 1; break;
      default: rate = -1; break;
    }
    return rate;
}

static USC_Status GetInfo(USC_Handle handle, USC_CodecInfo *pInfo)
{
    G723_Handle_Header *g723_header;

    pInfo->name = "G723.1";
    pInfo->framesize = G723_SPEECH_FRAME*sizeof(short);
    if (handle == NULL) {
      pInfo->params.modes.bitrate = 6300;
      pInfo->params.direction = 0;
       pInfo->params.modes.vad = 1;
       pInfo->params.modes.hpf = 1;
       pInfo->params.modes.pf = 1;
    } else {
       g723_header = (G723_Handle_Header*)handle;
       pInfo->params.modes.bitrate = g723_header->bitrate;
      pInfo->params.direction = g723_header->direction;
      pInfo->params.modes.vad = g723_header->vad;
       pInfo->params.modes.hpf = g723_header->hpf;
       pInfo->params.modes.pf = g723_header->pf;
    }
     pInfo->params.modes.truncate = 0;
    pInfo->maxbitsize = BITSTREAM_SIZE*sizeof(short);
     pInfo->pcmType.sample_frequency = 8000;
    pInfo->pcmType.bitPerSample = G723_BITS_PER_SAMPLE;
    pInfo->params.law = 0;
    pInfo->nRates = G723_NUM_RATES;
     pInfo->pRateTbl = (const USC_Rates *)&pTblRates_G723;

    return USC_NoError;
}

static USC_Status NumAlloc(const USC_Option *options, int *nbanks)
{
   if(options==NULL) return USC_BadDataPointer;
   if(nbanks==NULL) return USC_BadDataPointer;
   *nbanks = 1;
   return USC_NoError;
}

static USC_Status MemAlloc(const USC_Option *options, USC_MemBank *pBanks)
{
   unsigned int nbytes;
   if(options==NULL) return USC_BadDataPointer;
   if(pBanks==NULL) return USC_BadDataPointer;
    pBanks->pMem = NULL;
    if (options->direction == 0) /* encode only */
    {
        apiG723Encoder_Alloc(&nbytes);
        pBanks->nbytes = nbytes+sizeof(G723_Handle_Header); /* include direction in handle */
    }
    else if (options->direction == 1) /* decode only */
    {
        apiG723Decoder_Alloc(&nbytes);
        pBanks->nbytes = nbytes+sizeof(G723_Handle_Header); /* include direction in handle */
    } else {
        return USC_NoOperation;
    }
    return USC_NoError;
}

static USC_Status Init(const USC_Option *options, const USC_MemBank *pBanks, USC_Handle *handle)
{
   int mode=0;
   int bitrate_idx;
   G723_Handle_Header *g723_header;

   if(options==NULL) return USC_BadDataPointer;
   if(pBanks==NULL) return USC_BadDataPointer;
   if(pBanks->pMem==NULL) return USC_NotInitialized;
   if(pBanks->nbytes<=0) return USC_NotInitialized;
   if(handle==NULL) return USC_InvalidHandler;

    *handle = (USC_Handle*)pBanks->pMem;
    g723_header = (G723_Handle_Header*)*handle;

     bitrate_idx = CheckRate_G723(options->modes.bitrate);
     if(bitrate_idx < 0) return USC_UnsupportedBitRate;
     g723_header->hpf = options->modes.hpf;
     g723_header->pf = options->modes.pf;
     g723_header->vad = options->modes.vad;
     g723_header->bitrate = options->modes.bitrate;
    g723_header->direction = options->direction;

    if (options->direction == 0) /* encode only */
    {
      G723Encoder_Obj *EncObj = (G723Encoder_Obj *)((char*)*handle + sizeof(G723_Handle_Header));
        if(options->modes.hpf) mode |= 2;
        if(options->modes.vad) mode |= 1;
        apiG723Encoder_Init(EncObj, mode);
    }
    else if (options->direction == 1) /* decode only */
    {
      G723Decoder_Obj *DecObj = (G723Decoder_Obj *)((char*)*handle + sizeof(G723_Handle_Header));
        if(options->modes.pf) mode = 1;
        apiG723Decoder_Init(DecObj, mode);
    } else {
      return USC_NoOperation;
    }
    return USC_NoError;
}

static USC_Status Reinit(const USC_Modes *modes, USC_Handle handle )
{
     int mode=0;
     int bitrate_idx;
    G723_Handle_Header *g723_header;

   if(modes==NULL) return USC_BadDataPointer;
   if(handle==NULL) return USC_InvalidHandler;

    g723_header = (G723_Handle_Header*)handle;

     bitrate_idx = CheckRate_G723(modes->bitrate);
     if(bitrate_idx < 0) return USC_UnsupportedBitRate;
     g723_header->hpf = modes->hpf;
     g723_header->pf = modes->pf;
     g723_header->vad = modes->vad;
     g723_header->bitrate = modes->bitrate;

    if (g723_header->direction == 0) /* encode only */
    {
      G723Encoder_Obj *EncObj = (G723Encoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));
        if(modes->hpf) mode |= 2;
        if(modes->vad) mode |= 1;
        apiG723Encoder_Init(EncObj, mode);
    }
    else if (g723_header->direction == 1) /* decode only */
    {
      G723Decoder_Obj *DecObj = (G723Decoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));
        if(modes->pf) mode = 1;
        apiG723Decoder_Init(DecObj, mode);
    } else {
        return USC_NoOperation;
    }
    return USC_NoError;
}

static USC_Status Control(const USC_Modes *modes, USC_Handle handle )
{
   int mode=0;
   G723_Handle_Header *g723_header;

   if(modes==NULL) return USC_BadDataPointer;
   if(handle==NULL) return USC_InvalidHandler;

   g723_header = (G723_Handle_Header*)handle;

   g723_header->hpf = modes->hpf;
   g723_header->pf = modes->pf;
   g723_header->vad = modes->vad;
   g723_header->bitrate = modes->bitrate;

   if (g723_header->direction == 0) { /* encode only */
      G723Encoder_Obj *EncObj = (G723Encoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));
      if(modes->hpf) mode |= 2;
      if(modes->vad) mode |= 1;
      apiG723Encoder_ControlMode(EncObj, mode);
   } else if (g723_header->direction == 1) {/* decode only */
      G723Decoder_Obj *DecObj = (G723Decoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));
      if(modes->pf) mode = 1;
      apiG723Decoder_ControlMode(DecObj, mode);
   }
   return USC_NoError;
}

static int getBitstreamSize(char *pBitstream)
{
    short  Info,size ;

    Info = pBitstream[0] & (char)0x3 ;
    /* Check frame type and rate informations */
     size=24;
    switch (Info) {
        case 0x0002 : {   /* SID frame */
            size=4;
            break;
        }
        case 0x0003 : {  /* untransmitted silence frame */
            size=1;
            break;
        }
        case 0x0001 : {   /* active frame, low rate */
            size=20;
            break;
        }
        default : {  /* active frame, high rate */
            break;
        }
    }

    return size;
}

static USC_Status Encode(USC_Handle handle, USC_PCMStream *in, USC_Bitstream *out)
{
    G723_Handle_Header *g723_header;
     int bitrate_idx;
    G723Encoder_Obj *EncObj;

    if(in==NULL) return USC_BadDataPointer;
    if(in->nbytes<G723_SPEECH_FRAME*sizeof(short)) return USC_NoOperation;

    g723_header = (G723_Handle_Header*)handle;

     bitrate_idx = CheckRate_G723(in->bitrate);
     if(bitrate_idx < 0) return USC_UnsupportedBitRate;
     g723_header->bitrate = in->bitrate;
    EncObj = (G723Encoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));

    if(apiG723Encode(EncObj,(const short*)in->pBuffer,bitrate_idx,out->pBuffer) != APIG723_StsNoErr){
       return USC_NoOperation;
    }
     out->frametype = 0;
     out->nbytes = getBitstreamSize(out->pBuffer);
     out->bitrate = in->bitrate;

     in->nbytes = G723_SPEECH_FRAME*sizeof(short);

    return USC_NoError;
}

static USC_Status Decode(USC_Handle handle, USC_Bitstream *in, USC_PCMStream *out)
{
    G723_Handle_Header *g723_header;
    G723Decoder_Obj *DecObj;
     int bitrate_idx;

    if(out==NULL) return USC_BadDataPointer;
    if(handle==NULL) return USC_InvalidHandler;

    g723_header = (G723_Handle_Header*)handle;
    DecObj = (G723Decoder_Obj *)((char*)handle + sizeof(G723_Handle_Header));

    if(in == NULL) {
       /* Lost frame */
       if(apiG723Decode(DecObj,(const char*)LostFrame,1,(short*)out->pBuffer) != APIG723_StsNoErr){
        return USC_NoOperation;
      }
      out->bitrate = g723_header->bitrate;
    } else {
       bitrate_idx = CheckRate_G723(in->bitrate);
       if(bitrate_idx < 0) return USC_UnsupportedBitRate;
       g723_header->bitrate = in->bitrate;
       in->nbytes = getBitstreamSize(in->pBuffer);
       if(apiG723Decode(DecObj,(const char*)in->pBuffer,in->frametype,(short*)out->pBuffer) != APIG723_StsNoErr){
        return USC_NoOperation;
      }
      out->bitrate = in->bitrate;
    }
    out->nbytes = G723_SPEECH_FRAME*sizeof(short);

    return USC_NoError;
}

static __ALIGN32 CONST int pFrameSize_G723[G723_NUM_RATES]={
    24,
    20
};

static USC_Status GetOutStreamSize(const USC_Option *options, int bitrate, int nbytesSrc, int *nbytesDst)
{
   int bitrate_idx;
   int nBlocks, nSamples;

   if(options==NULL) return USC_BadDataPointer;
   if(nbytesDst==NULL) return USC_BadDataPointer;
   if(nbytesSrc <= 0) return USC_NoOperation;

   bitrate_idx = CheckRate_G723(bitrate);
    if(bitrate_idx < 0) return USC_UnsupportedBitRate;

   if(options->direction==0) { /*Encode: src - PCMStream, dst - bitstream*/
      if(options->modes.vad>1) return USC_UnsupportedVADType;

      nSamples = nbytesSrc / (G723_BITS_PER_SAMPLE >> 3);
      nBlocks = nSamples / G723_SPEECH_FRAME;

      if (0 == nBlocks) return USC_NoOperation;

      if (0 != nSamples % G723_SPEECH_FRAME) {
         /* Add another block to hold the last compressed fragment*/
         nBlocks++;
      }

      *nbytesDst = nBlocks * pFrameSize_G723[bitrate_idx];
   } else if(options->direction==1) {/*Decode: src - bitstream, dst - PCMStream*/
      if(options->modes.vad==0) { /*VAD off*/
         nBlocks = nbytesSrc / pFrameSize_G723[bitrate_idx];
      } else if(options->modes.vad==1) { /*VAD on*/
         nBlocks = nbytesSrc / G723_UNTR_FRAMESIZE;
      } else return USC_UnsupportedVADType;

      if (0 == nBlocks) return USC_NoOperation;

      nSamples = nBlocks * G723_SPEECH_FRAME;
      *nbytesDst = nSamples * (G723_BITS_PER_SAMPLE >> 3);
   } else if(options->direction==2) {/* Both: src - PCMStream, dst - PCMStream*/
      nSamples = nbytesSrc / (G723_BITS_PER_SAMPLE >> 3);
      nBlocks = nSamples / G723_SPEECH_FRAME;

      if (0 == nBlocks) return USC_NoOperation;

      if (0 != nSamples % G723_SPEECH_FRAME) {
         /* Add another block to hold the last compressed fragment*/
         nBlocks++;
      }
      *nbytesDst = nBlocks * G723_SPEECH_FRAME * (G723_BITS_PER_SAMPLE >> 3);
   } else return USC_NoOperation;
   return USC_NoError;
}

USC_Status SetFrameSize(const USC_Option *options, USC_Handle handle, int frameSize)
{
   if(options==NULL) return USC_BadDataPointer;
   if(handle==NULL) return USC_InvalidHandler;

   return USC_NoError;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品视频在线免费观看| 91精品国产综合久久久久久漫画| 精品人伦一区二区色婷婷| 日韩国产欧美在线观看| 日韩视频在线你懂得| 蜜桃av噜噜一区| www国产成人免费观看视频 深夜成人网| 日韩成人av影视| 久久久国际精品| 成人av免费在线播放| 亚洲伊人伊色伊影伊综合网| 欧美三级韩国三级日本三斤| 精品一区精品二区高清| 亚洲精品国产高清久久伦理二区| 欧美亚洲自拍偷拍| 成人午夜免费电影| 亚洲黄一区二区三区| 日韩精品专区在线影院重磅| 成人av第一页| 欧美久久一区二区| 色天天综合色天天久久| 日韩精品欧美精品| 国产精品久久久久9999吃药| 欧美疯狂性受xxxxx喷水图片| 国产999精品久久| 久久精品国产亚洲高清剧情介绍 | 在线观看日韩av先锋影音电影院| 裸体在线国模精品偷拍| 夜夜爽夜夜爽精品视频| 久久久国产一区二区三区四区小说 | 久久众筹精品私拍模特| 7777精品伊人久久久大香线蕉| av福利精品导航| 国产老女人精品毛片久久| 免费观看在线色综合| 亚洲国产aⅴ成人精品无吗| 中文字幕在线观看不卡| 久久精品夜夜夜夜久久| 精品福利在线导航| 欧美va亚洲va香蕉在线| 91精品国产综合久久久久久| 欧美日韩视频专区在线播放| 欧美日韩午夜精品| 日韩欧美一级二级三级久久久| 欧美网站一区二区| 欧美日韩1234| 精品久久久久久久人人人人传媒| 欧美一区二区三区四区久久 | 日韩精品一区二区三区四区| 久久综合给合久久狠狠狠97色69| 精品日韩在线观看| 日本一区二区三区国色天香| 亚洲色图一区二区| 日韩在线观看一区二区| 国产一区欧美一区| 色系网站成人免费| 欧美成人三级电影在线| 亚洲欧洲日韩av| 蜜桃久久久久久久| 成人免费三级在线| 欧美疯狂做受xxxx富婆| 精品午夜久久福利影院| 日韩一区和二区| 91精品国产综合久久香蕉的特点| 精品处破学生在线二十三| 国产精品午夜在线| 香蕉久久一区二区不卡无毒影院 | 黄色精品一二区| 成人黄色777网| 欧美一区二区三区在线看| 蜜臀99久久精品久久久久久软件| 色综合婷婷久久| 精品播放一区二区| 亚洲国产另类av| www.亚洲在线| 国产亚洲一区字幕| 国内精品国产成人国产三级粉色| 欧美少妇bbb| 亚洲一区二区三区在线播放| 99国产精品久| 国产精品入口麻豆九色| 大美女一区二区三区| 精品国精品自拍自在线| 日本午夜精品一区二区三区电影| 成人美女在线视频| 久久精品免费在线观看| 国产一区在线精品| 精品成人佐山爱一区二区| 捆绑变态av一区二区三区| 欧美一卡2卡三卡4卡5免费| 日日摸夜夜添夜夜添国产精品| 777久久久精品| 久久99国产精品免费网站| 久久欧美一区二区| 成人午夜又粗又硬又大| 国产精品理论片在线观看| 色综合一个色综合| 性做久久久久久久久| 日韩欧美一级二级三级久久久| 国产一区三区三区| 亚洲视频在线观看一区| 91久久人澡人人添人人爽欧美| 一区二区三区四区在线播放| 欧美精品v国产精品v日韩精品 | 美腿丝袜在线亚洲一区| 精品三级在线看| 成人理论电影网| 午夜久久久久久久久| 久久久久99精品国产片| 99久久亚洲一区二区三区青草| 亚洲夂夂婷婷色拍ww47| 欧美tk丨vk视频| 色偷偷88欧美精品久久久| 六月婷婷色综合| 亚洲午夜激情网页| 中文乱码免费一区二区| 在线播放日韩导航| 99久久精品免费看| 九九精品一区二区| 视频精品一区二区| 最新国产精品久久精品| 精品国产伦理网| 这里只有精品免费| 欧美三级三级三级| 色综合色综合色综合| 高清不卡在线观看av| 激情久久五月天| 日韩在线观看一区二区| 一级女性全黄久久生活片免费| 欧美极品美女视频| 国产精品女主播在线观看| 26uuu另类欧美亚洲曰本| 91精品在线免费观看| 7777精品伊人久久久大香线蕉完整版| 成人app网站| 91免费在线看| 色欧美日韩亚洲| 色综合久久中文字幕| 91精品办公室少妇高潮对白| 96av麻豆蜜桃一区二区| 不卡av免费在线观看| 99精品视频免费在线观看| 丁香六月综合激情| 91色.com| 欧美精品一级二级| 日韩精品一区二区三区三区免费| 久久久久久久精| 亚洲精品国产一区二区精华液| 一区二区三区成人在线视频| 一区二区三区四区国产精品| 亚洲国产精品一区二区久久 | 国产视频不卡一区| 亚洲视频中文字幕| 日日夜夜免费精品| 国产精品99久久久久久似苏梦涵 | 国产成a人亚洲精品| 欧美亚洲国产一区二区三区| 欧美电影免费观看高清完整版在 | 欧美老年两性高潮| 久久久久久久网| 亚洲精品中文在线观看| 狠狠色2019综合网| 一本久久精品一区二区| 日韩欧美高清在线| 亚洲精品成人悠悠色影视| 久久精品99国产国产精| 在线看一区二区| 国产网站一区二区三区| 亚洲高清视频的网址| 成人app下载| 久久久蜜桃精品| 亚洲超碰精品一区二区| 成人美女视频在线观看| 日韩精品在线看片z| 手机精品视频在线观看| 95精品视频在线| 成人免费在线观看入口| 国产一区二区在线观看免费| 91精品国产综合久久精品app| 亚洲欧洲www| av在线播放不卡| 中文字幕亚洲区| 丁香天五香天堂综合| 久久久久久久久久久久久女国产乱| 免费在线观看一区| 日韩一卡二卡三卡四卡| 欧美aaaaa成人免费观看视频| 欧美色欧美亚洲另类二区| 一区二区在线观看视频| 在线免费观看成人短视频| 亚洲小说欧美激情另类| 欧美在线观看一区二区| 亚洲韩国一区二区三区| 欧美日韩一区国产| 蜜桃91丨九色丨蝌蚪91桃色| 久久婷婷一区二区三区| 成人激情小说乱人伦| 一区二区三区中文字幕在线观看| 91久久精品国产91性色tv| 日韩福利电影在线|