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

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

?? usc_ec.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 EC Sample
//
//  By downloading and installing this sample, 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.
//
//  Purpose: USC Echo Canceller
//
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined (WIN32) || defined _WIN32_WCE
#include <windows.h>
#endif
#include <ipps.h>
#include <ippsc.h>
#include <ippcore.h>

#include "ipps.h"
#include "ippsc.h"
#include "util.h"
#include "loadec.h"
#include "usc_ec.h"

#define USAGE                   1
#define FOPEN_FAIL              2
#define MEMORY_FAIL             3
#define UNKNOWN_FORMAT          4
#define LOAD_EC_FAIL            5
#define ERROR_INIT              6

static int PrepareInput(FILE* pFile, char* comment, Ipp8u** pBuff, FILE *fptrLog);
/* This object and functions are used to measure echo canceller speed */
typedef struct {
   Ipp64u p_start;
   Ipp64u p_end;
   double speed_in_mhz;
}MeasureIt;

Ipp64s diffclocks(Ipp64u s, Ipp64u e){
   if(s < e) return (e-s);
   return (IPP_MAX_64S-e+s);
}

double getUSec(Ipp64u s, Ipp64u e) {
   return diffclocks(s,e)/1000000.0;
}

void measure_start(MeasureIt *m)
{
   m->p_start = ippGetCpuClocks();
}
void measure_end(MeasureIt *m)
{
   m->p_end = ippGetCpuClocks();
}
static void measure_output(FILE *f_log, MeasureIt *m, double speech_sec)
{
    char pString[MAX_LEN_STRING];

    m->speed_in_mhz = getUSec(m->p_start,m->p_end)/speech_sec;
    sprintf(pString, "%4.2f MHz per channel\n", m->speed_in_mhz);
    OutputInfoString(1, f_log, (const char*)pString);
}

static int PostProcessPCMstream(char *pSrcDst, int len)
{
#if defined( _BIG_ENDIAN )
     ippsSwapBytes_16u_I((Ipp16u*)pSrcDst, len>>1);
#endif
    return 0;
}

static int PreProcessBitstream(char *pSrcDst, int len)
{
#if defined( _BIG_ENDIAN )
    ippsSwapBytes_16u_I((Ipp16u*)pSrcDst, len>>1);
#endif
    return 0;
}

#if defined( _WIN32_WCE )
#define WINCE_CMDLINE_SIZE 512
#define WINCE_EXENAME_SIZE 128
#define WINCE_NCMD_PARAMS   16
int parseCmndLine( char* exename, const char* cmndline, char* line, int linelen, char** argv, int argvlen ) {
   int i;
   char* token;
   char* seps = " ,";                     /* argement separators */
   int argc = 1;                          /* number of parameters */
   for (i=0; i<argvlen; i++) argv[i] = NULL;
   argv[0] = exename;                     /* the first standard argument */
   memset( line, 0, linelen );
   strncpy( line, cmndline, linelen-1 );
   token = strtok( line, seps );          /* the first true argument */
   while( token != NULL && argc <= argvlen ) {
      argv[argc++] = token;
      token = strtok( NULL, seps );
   }
   return argc;
}

int WINAPI WinMain( HINSTANCE hinst, HINSTANCE xxx, LPWSTR lpCmdLine, int yyy )
{
   char line[WINCE_CMDLINE_SIZE];                     /* to copy command line */
   char* argvv[WINCE_NCMD_PARAMS];
   char** argv=argvv;

   wchar_t wexename[WINCE_EXENAME_SIZE];
   char exename[WINCE_EXENAME_SIZE];
   char cmdline[WINCE_CMDLINE_SIZE];

   /* simulate argc and argv parameters */
   int argc;
#else /*Other OS*/
int main(int argc, char *argv[])
{
#endif /*_WIN32_WCE*/
   CommandLineParams clParams;
   USC_EC_Params ecParams;
   USC_Status USCStatus;
   MeasureIt measure;
   FILE *fp_rin = NULL;
   FILE *fp_sin = NULL;
   FILE *fp_sout = NULL;
   FILE *f_log = NULL;
   FILE *f_csv = NULL;        /* csv File    */
   Ipp8u *in1_buff_cur, *in2_buff_cur, *out_buff_cur;
   Ipp8u *in1_buff=NULL, *in2_buff=NULL, *out_buff=NULL;

   int flen, in_len, lCallResult;
   int i, frameNum, tailNum;
   int usage=0, n_repeat=1;
   double fdelay=0;
   double speech_sec;
   int puttocsv = 0;
   int delay=0;
   char* appName=argv[0];
   char pString[MAX_LEN_STRING];
   const  IppLibraryVersion *ver = NULL;
#if defined( _WIN32_WCE )

   GetModuleFileName( hinst, wexename, WINCE_EXENAME_SIZE );
   sprintf( exename, "%ls", wexename );
   sprintf( cmdline, "%ls", lpCmdLine );
   argc = parseCmndLine( exename, cmdline, line, WINCE_CMDLINE_SIZE, argv, WINCE_NCMD_PARAMS );

#endif

   ippStaticInit();

   SetCommandLineByDefault(&clParams);
   strcpy(clParams.csvFileName, "ec_speed.csv");

   usage = ReadCommandLine(&clParams, argc, argv);
   if(clParams.puttolog == 1) {
     if((f_log = fopen(clParams.logFileName, "a")) == NULL) return FOPEN_FAIL;
   } else f_log = NULL;
   if(usage) {
      if(clParams.enumerate == 1) {
         EnumerateStaticLinkedEC(f_log);
         if(f_log) fclose(f_log);
         return 0;
      } else {
        PrintUsage((const char *)appName, f_log);
        return USAGE;
      }
   }

   lCallResult = LoadECByName((const char *)clParams.ECName, &ecParams, f_log);
   if(lCallResult < 0) {
      sprintf(pString, "Cannot find %s echo canceller.\n", clParams.ECName);
      OutputInfoString(1, f_log, (const char*)pString);
      if(f_log) fclose(f_log);
      return LOAD_EC_FAIL;
   }
   ecParams.pUSC_EC_Fxns->std.GetInfo((USC_Handle)NULL, &ecParams.pInfo);
   ecParams.objEC = NULL;
   ecParams.pBanks = NULL;
   ecParams.nBanks = 0;

   if((fp_rin = fopen(clParams.rinFileName,"rb")) == NULL)  {
      sprintf(pString, "echo canceller: File %s [s-in] could not be open.\n", clParams.rinFileName);
      OutputInfoString(1, f_log, (const char*)pString);
      if(f_log) fclose(f_log);
      return FOPEN_FAIL;
   }
   if((fp_sin = fopen(clParams.sinFileName,"rb")) == NULL) {
      sprintf(pString, "echo canceller: File %s [r-in] could not be open.\n", clParams.sinFileName);
      OutputInfoString(1, f_log, (const char*)pString);
      if(f_log) fclose(f_log);
      return FOPEN_FAIL;
   }
   if((fp_sout = fopen(clParams.soutFileName,"wb")) == NULL) {
      sprintf(pString, "echo canceller: File %s [s-out] could not be open.\n", clParams.soutFileName);
      OutputInfoString(1, f_log, (const char*)pString);
      if(f_log) fclose(f_log);
      return FOPEN_FAIL;
   }
   if(clParams.puttocsv) { /* open the csv file if any */
      if((f_csv = fopen(clParams.csvFileName, "a")) == NULL) {
         sprintf(pString, "\nFile %s could not be open.\n", clParams.csvFileName);
         OutputInfoString(1, f_log, (const char*)pString);
         if(f_log) fclose(f_log);
         return FOPEN_FAIL;
      }
   }
   OutputInfoString(0, f_log,"The Intel(R) echo canceller conformant to ITU G167 and G168,\n");
   ver = ippscGetLibVersion();
   sprintf(pString, "The Intel(R) IPPSC library used:  %d.%d.%d Build %d, name %s\n",
       ver->major,ver->minor,ver->majorBuild,ver->build,ver->Name);
   OutputInfoString(0, f_log, (const char*)pString);
   ver = ippsGetLibVersion();
   sprintf(pString, "The Intel(R) IPPSP library used:  %d.%d.%d Build %d, name %s\n",
       ver->major,ver->minor,ver->majorBuild,ver->build,ver->Name);
   OutputInfoString(0, f_log, (const char*)pString);
   sprintf(pString, " Input  rin file: %s\n", clParams.rinFileName);
   OutputInfoString(1, f_log, (const char*)pString);
   sprintf(pString, " Input  sin file: %s\n", clParams.sinFileName);
   OutputInfoString(1, f_log, (const char*)pString);
   sprintf(pString, " Output sout file: %s\n", clParams.soutFileName);
   OutputInfoString(1, f_log, (const char*)pString);

   switch(clParams.alg) {
     case 1: ecParams.pInfo.params.algType = EC_FULLBAND; break;
     case 2: ecParams.pInfo.params.algType = EC_SUBBAND; break;
     case 3: ecParams.pInfo.params.algType = EC_FASTSUBBAND; break;
     default: return UNKNOWN_FORMAT;
   }
   ecParams.pInfo.params.pcmType.sample_frequency = clParams.freq;
   ecParams.pInfo.params.pcmType.bitPerSample = 16;
   ecParams.pInfo.params.echotail = clParams.tail;
   ecParams.pInfo.params.modes.adapt = 1;
   ecParams.pInfo.params.modes.zeroCoeff = 1;///???
   ecParams.pInfo.params.modes.nlp = 0;
   ecParams.pInfo.params.modes.td = 1;
   ecParams.pInfo.params.modes.ah = clParams.ah_mode;


   ecParams.pUSC_EC_Fxns->std.NumAlloc((const USC_EC_Option *)&ecParams.pInfo.params, &ecParams.nBanks);
   if(!(ecParams.pBanks = (USC_MemBank*)ippsMalloc_8u(sizeof(USC_MemBank)*ecParams.nBanks))) {
      sprintf(pString, "\nLow memory: %d bytes not allocated\n", sizeof(USC_MemBank)*ecParams.nBanks);
      OutputInfoString(1, f_log, (const char*)pString);
      if(fp_rin) fclose(fp_rin);
      if(fp_sin) fclose(fp_sin);
      if(fp_sout) fclose(fp_sout);
      if(clParams.puttocsv) { if(f_csv) fclose(f_csv); }
      if(f_log) fclose(f_log);
      return MEMORY_FAIL;
   }
   ecParams.pUSC_EC_Fxns->std.MemAlloc((const USC_EC_Option *)&ecParams.pInfo.params, ecParams.pBanks);
   for(i=0;i<ecParams.nBanks;i++) {
     if(!(ecParams.pBanks[i].pMem = ippsMalloc_8u(ecParams.pBanks->nbytes))) {
       sprintf(pString, "\nLow memory: %d bytes not allocated\n", ecParams.pBanks->nbytes);
       OutputInfoString(1, f_log, (const char*)pString);
       if(ecParams.pBanks) ippsFree(ecParams.pBanks);
       if(fp_rin) fclose(fp_rin);
       if(fp_sin) fclose(fp_sin);
       if(fp_sout) fclose(fp_sout);
       if(clParams.puttocsv) { if(f_csv) fclose(f_csv); }
       if(f_log) fclose(f_log);
       return MEMORY_FAIL;
     }
   }

   flen = PrepareInput(fp_rin, " receive-in input ", &in1_buff, f_log);
   in_len = PrepareInput(fp_sin, " send-in input ", &in2_buff, f_log);

   if(ecParams.pInfo.params.pcmType.sample_frequency == 8000){ /* 8 KHz */
      delay = (int) (fdelay * 8000 * 2);
   }else{ /* 16 KHz */
      delay = (int) (fdelay * 16000 * 2);
   }
   flen -= delay;
   if(flen < 0)  flen = 0;
   if (flen < in_len)
       in_len = flen;

   if(!(out_buff=(Ipp8u*)ippsMalloc_8u(in_len))){ /* allocate output buffer */
      sprintf(pString, "\nNo memory for buffering of %d output bytes", in_len);
      OutputInfoString(1, f_log, (const char*)pString);
      if(f_log) fclose(f_log);
      return MEMORY_FAIL;
   }

   /* time stamp prior to threads creation, creation and running time may overlap. */
   measure_start(&measure);

   n_repeat = clParams.nRepeat;
   while(n_repeat--) {
      USCStatus = ecParams.pUSC_EC_Fxns->std.Init((const USC_EC_Option *)&ecParams.pInfo.params, ecParams.pBanks, &ecParams.objEC);
      if(USCStatus!=USC_NoError) {
        OutputInfoString(1, f_log,"\nCan not initialize the EC object!");
        if(ecParams.pBanks) ippsFree(ecParams.pBanks);
        if(fp_rin) fclose(fp_rin);
        if(fp_sin) fclose(fp_sin);
        if(fp_sout) fclose(fp_sout);
        if(clParams.puttocsv) { if(f_csv) fclose(f_csv); }
        if(f_log) fclose(f_log);
        return ERROR_INIT;
      }
      ecParams.pUSC_EC_Fxns->std.GetInfo(ecParams.objEC, (USC_EC_Info *)&ecParams.pInfo);
      frameNum = in_len/ecParams.pInfo.framesize;
      tailNum = (in_len/sizeof(short)) - (ecParams.pInfo.framesize/sizeof(short))*frameNum;

      out_buff_cur = out_buff;
      in1_buff_cur = in1_buff + delay; /* shift forward the rin at delay */
      in2_buff_cur = in2_buff;

      for (i = 0; i < frameNum; i++) {
          ecParams.pUSC_EC_Fxns->CancelEcho(ecParams.objEC, (Ipp16s *)in2_buff_cur, (Ipp16s *)in1_buff_cur, (Ipp16s *)out_buff_cur);

          in1_buff_cur += ecParams.pInfo.framesize;
          in2_buff_cur += ecParams.pInfo.framesize;
          out_buff_cur += ecParams.pInfo.framesize;
      }
      for (i = 0; i < tailNum; i++) {
          ippsZero_16s((Ipp16s *)out_buff_cur, tailNum);
      }
   }

   measure_end(&measure);

   if (PostProcessPCMstream(out_buff, in_len)) {
       sprintf(pString, "No memory for load of %d bytes convert from linear PCM to special pack value.",in_len);
       OutputInfoString(1, f_log, (const char*)pString);
       if(f_log) fclose(f_log);
       return MEMORY_FAIL;
   }
   /* Write output PCM to the output file */
   fwrite(out_buff, 1, in_len, fp_sout);

   for(i=0; i<ecParams.nBanks;i++){
     if(ecParams.pBanks[i].pMem) ippsFree(ecParams.pBanks[i].pMem);
     ecParams.pBanks[i].pMem = NULL;
   }
   if(ecParams.pBanks) { ippsFree(ecParams.pBanks); ecParams.pBanks = NULL; }
   ippsFree(out_buff);

   speech_sec = (in_len / 2 * clParams.nRepeat)/(double)ecParams.pInfo.params.pcmType.sample_frequency;
   measure_output(f_log, &measure, speech_sec);
   sprintf(pString, "Done %d samples of %d Hz PCM wave file (%g sec)\n",
       (in_len>>1) * clParams.nRepeat, ecParams.pInfo.params.pcmType.sample_frequency, speech_sec);
   OutputInfoString(1, f_log, (const char*)pString);

   if(clParams.puttocsv) {
       char* pFileName;
       if ((pFileName = strrchr(clParams.rinFileName, '/')) != NULL) {
           pFileName += 1;
       } else if ((pFileName = strrchr(clParams.rinFileName, '\\')) != NULL) {
           pFileName += 1;
       } else
           pFileName = clParams.rinFileName;
       fprintf(f_csv,"%s,%s,%d,%s,%4.2f,%4.2f \n",appName,"aec",
            ecParams.pInfo.params.pcmType.sample_frequency, pFileName, speech_sec, measure.speed_in_mhz);
       fclose(f_csv);
   }

   ippsFree(in1_buff);
   ippsFree(in2_buff);

   fclose(fp_rin);
   fclose(fp_sin);
   fclose(fp_sout);

   OutputInfoString(1, f_log,"Completed !\n");
   if(f_log) fclose(f_log);
   return 0;
}

int  PrepareInput(FILE* pFile, char* comment, Ipp8u** pBuff, FILE *fptrLog)
{
   char pString[MAX_LEN_STRING];
   int lenFile;
   Ipp8u *buff = NULL;
   fseek(pFile,0,SEEK_END);
   lenFile = ftell(pFile); /* size of file*/
   if(!(buff=ippsMalloc_8u(lenFile))){
      sprintf(pString, "\nNo memory to load %d bytes from %s file",lenFile,comment);
      OutputInfoString(1, fptrLog, (const char*)pString);
      return MEMORY_FAIL;
   }
//   rewind(pFile);
   fseek(pFile,0,SEEK_SET);

   lenFile = (int)fread(buff,1,lenFile,pFile);
   if (PreProcessBitstream(buff, lenFile)) {
       OutputInfoString(1, fptrLog,"\nUnknown format bitstream.\n");
       return UNKNOWN_FORMAT;
   }

   *pBuff = buff;
   return lenFile;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美一区二区视频| 日韩精品一二三四| 青青草成人在线观看| 国产黑丝在线一区二区三区| 欧美三级中文字幕在线观看| 久久蜜桃av一区精品变态类天堂| 亚洲一区中文日韩| 成人精品小蝌蚪| 精品国产青草久久久久福利| 亚洲一区视频在线观看视频| 国产成人夜色高潮福利影视| 7777精品伊人久久久大香线蕉完整版| 国产性天天综合网| 麻豆一区二区三区| 欧美视频一二三区| 亚洲精品国产一区二区精华液| 精品一区二区三区在线视频| 欧美色综合网站| 综合网在线视频| www.亚洲色图| 欧美精彩视频一区二区三区| 精一区二区三区| 欧美成人官网二区| 精品综合免费视频观看| 欧美一区日本一区韩国一区| 亚洲18色成人| 欧美三级电影在线看| 亚洲午夜精品在线| 欧美中文字幕一区| 婷婷开心激情综合| 制服.丝袜.亚洲.另类.中文| 午夜激情一区二区| 欧美一区二区精品| 激情综合网av| 欧美经典一区二区三区| 成人免费毛片片v| 亚洲欧洲日韩一区二区三区| 97精品超碰一区二区三区| 国产精品对白交换视频| 99国产精品视频免费观看| 一区二区在线观看视频| 欧美优质美女网站| 日韩在线a电影| 日韩女优av电影| 国产毛片一区二区| 日韩一区在线看| 欧美亚洲免费在线一区| 免费看黄色91| 欧美韩日一区二区三区四区| 色一情一伦一子一伦一区| 亚洲成精国产精品女| 精品剧情在线观看| 成人的网站免费观看| 一区二区不卡在线播放| 91精品视频网| 国产传媒欧美日韩成人| 有码一区二区三区| 日韩欧美色综合| 成人一级片在线观看| 亚洲综合丝袜美腿| 精品国产麻豆免费人成网站| www.欧美亚洲| 日日摸夜夜添夜夜添精品视频| 久久久久久久综合日本| 欧美午夜免费电影| 国产伦理精品不卡| 亚洲成人免费av| 久久久久久97三级| 欧美另类久久久品| 国产成人自拍在线| 午夜免费欧美电影| 国产精品国产三级国产专播品爱网 | 亚洲成人一区二区| 精品三级av在线| 色狠狠综合天天综合综合| 狠狠色狠狠色综合| 亚洲午夜私人影院| 国产精品初高中害羞小美女文| 欧美一二三四区在线| 成人美女在线观看| 精品系列免费在线观看| 洋洋av久久久久久久一区| 久久精品一二三| 8v天堂国产在线一区二区| 成人自拍视频在线| 国内精品久久久久影院一蜜桃| 一区二区激情视频| 国产精品伦一区| 精品国内片67194| 欧美另类高清zo欧美| 在线精品视频小说1| 不卡一区二区三区四区| 国产麻豆91精品| 激情五月婷婷综合网| 青娱乐精品在线视频| 亚洲国产精品视频| 伊人色综合久久天天| 最好看的中文字幕久久| 中文子幕无线码一区tr | 在线中文字幕不卡| 成人sese在线| 欧美日韩在线精品一区二区三区激情 | 一本久久a久久精品亚洲| 国产盗摄精品一区二区三区在线 | 一本久久综合亚洲鲁鲁五月天| 国产iv一区二区三区| 国产一二三精品| 国产一区中文字幕| 国产一区二区在线观看视频| 精品一区二区免费在线观看| 免费成人av资源网| 免费成人你懂的| 久久精品国产精品亚洲精品| 免费看欧美女人艹b| 老鸭窝一区二区久久精品| 奇米色一区二区| 奇米影视7777精品一区二区| 欧美aⅴ一区二区三区视频| 日本成人在线视频网站| 日韩中文字幕麻豆| 乱一区二区av| 国内精品国产成人国产三级粉色| 精品一区二区三区在线视频| 国产精品综合一区二区三区| 国产在线精品免费| 丁香五精品蜜臀久久久久99网站 | 看电影不卡的网站| 国产在线视频一区二区三区| 国产又黄又大久久| 国产成人综合网| a级高清视频欧美日韩| 欧美在线看片a免费观看| 欧美精品一二三四| xf在线a精品一区二区视频网站| 国产亚洲人成网站| 成人欧美一区二区三区小说| 亚洲综合色自拍一区| 免费成人你懂的| eeuss国产一区二区三区| 在线精品视频免费播放| 日韩一区二区三区免费看| 久久久久久久久一| 中文字幕在线观看不卡| 天堂成人免费av电影一区| 蜜桃精品视频在线| 国产一区二区在线观看视频| 91麻豆精品国产91久久久久| 精品毛片乱码1区2区3区| 亚洲欧美在线视频观看| 视频一区二区三区在线| 国产91丝袜在线播放| 欧美三级电影网站| 国产蜜臀av在线一区二区三区| 亚洲一区二区精品视频| 国产aⅴ综合色| 91精品在线观看入口| 亚洲视频综合在线| 精品午夜久久福利影院| 在线观看日韩高清av| 日韩一区二区三免费高清| 国产精品美女久久久久aⅴ| 日韩精品乱码免费| 色婷婷综合久久久中文一区二区| 欧美精三区欧美精三区| 国产精品家庭影院| 久久爱www久久做| 欧美在线观看你懂的| 欧美国产日本视频| 激情综合网最新| 欧美一区二区三区人| 一区二区三区高清不卡| 成人v精品蜜桃久久一区| 欧美变态tickle挠乳网站| 亚洲国产一区二区视频| av综合在线播放| 国产亚洲欧美一区在线观看| 蜜臀精品久久久久久蜜臀| 欧美日高清视频| 国产午夜一区二区三区| 麻豆国产精品一区二区三区| 欧美三级一区二区| 国产精品正在播放| 91精品国产综合久久久久久久 | 亚洲第一狼人社区| 99视频精品全部免费在线| 国产亚洲成年网址在线观看| 美女视频一区二区| 日韩一区二区免费在线观看| 亚洲成人激情av| 欧美亚洲国产bt| 亚洲日本一区二区三区| www.日本不卡| 亚洲三级理论片| 一本一道久久a久久精品综合蜜臀| 国产精品久久久久久久午夜片| 国产二区国产一区在线观看| 欧美国产亚洲另类动漫| 成人午夜av在线| 国产精品白丝在线| 日本高清成人免费播放|