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

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

?? vad_exmp.c

?? Intel開發的IPP庫的應用實例
?? 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) 2002-2006 Intel Corporation. All Rights Reserved.
//
//  Intel(R) Integrated Performance Primitives Audio Processing
//  Sample for Windows*
//
//  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 ippEULA.rtf located in the root directory of your Intel(R) IPP
//  product installation for more information.
//
//  Description:
//  This source file contains the example dispatcher for an VAD example library.
//  It reads data from a 16khz,mono,16bit PCM binary file
//  and runs the voice activity detector on the data using API calls
//  to the VAD sample library. It writes two output files - one PCM binary file
//  and one ASCII file. The output PCM binary file has the same format and size
//  as the input file. It contains the unaltered input data between the beginning
//  and end points of an utterance as determined by the VAD algorithm and zeroed
//  sample values otherwise. The ASCII file contains a set of endpoints
//  (beginning and end) per utterance as determined by the VAD algorithm. Each
//  endpoint is further reported as a frame/sample number pair.
//
*/

/* headers */
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <ipps.h>
#include <ippsr.h>
#include "VAD.h"
#include "VADout.h"

/* Error checking macro */
#define ABORT -1
#define ASSERT_MSGBOX(cond, msg, title, exitcode)                    \
{                                                                    \
  if (!(cond))                                                       \
  {                                                                  \
    MessageBox(NULL, _T(msg), _T(title), MB_OK);                     \
    exit(exitcode);                                                  \
  }                                                                  \
}

/* defines */
/* input/output filenames */
#define INPUT_PCM_FN            "VADtest.pcm"         /* input PCM filename */
#define OUTPUT_PCM_FN           "VADtest_output.pcm"  /* output PCM filename */
#define OUTPUT_TEXT_FN          "VADtest_output.txt"  /* output ASCII filename. File contains frame/sample numbers of endpoints */

/* parameters */
const int SAMPLING_FREQUENCY_HZ = 16000;              /* sampling frequency of the input data in Hz */
#define DC_RMV_COEF             0.99f                 /* dc removal filter coefficient (0.99) */
#define WINDOW_LEN_MSEC         32                    /* length of a window/frame of speech in msec */
#define FRAME_SHIFT_MSEC        16                    /* frame shift in msec for overlapping frames */
#define MAX_OUTPUT_LATENCY_MSEC 400                   /* maximum latency of the output data. Also, implies size of output buffer */
#define CONV_FACTOR_SEC_MSEC    1000

/* conversion of lengths defined above from msec to samples */
#define WINDOW_LEN_SAMPS        WINDOW_LEN_MSEC * SAMPLING_FREQUENCY_HZ / CONV_FACTOR_SEC_MSEC
#define FRAME_SHIFT_SAMPS       FRAME_SHIFT_MSEC * SAMPLING_FREQUENCY_HZ / CONV_FACTOR_SEC_MSEC
#define OUT_BUF_SIZE_SAMPS      MAX_OUTPUT_LATENCY_MSEC * SAMPLING_FREQUENCY_HZ / CONV_FACTOR_SEC_MSEC

/********************************************************************************
// Name:                WinMain
// Description:         This is the entry-point function for the VAD example, it reads
//                      data from an input mono wave file, handles overlapping of frames,
//                      marshalls the data into calls to a VAD example API
//                      which calls the Intel(R) IPP functions. It also calls functions to write data and
//                      endpoint frame/sample number to output files.
//
// Input Arguments:     None of the arguments are used by the example code.  Refer
//                      to the WinMain description in the Microsoft Visual Studio
//                      online help for complete details.
********************************************************************************/

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR  lpCmdLine,int nShowCmd)
{
    FILE*              pInputPCMFile;         /* file pointer to input PCM file */
    FILE*              pOutputPCMFile;        /* file pointer to output PCM file */
    FILE*              pOutputTextFile;       /* file pointer to output ASCII file */
    int                cSampsRead;            /* actual number of samples read from input file */
    Ipp16s*            pReadBuf;              /* buffer to hold read input data */
    Ipp32f*            pReadBuf32f;           /* buffer to hold read input data */
    int                cWinSamps;             /* window/frame size in samples */
    int                cFrameShiftSamps;      /* frame shift in samples for overlapping frames */
    int                cReuseSamps;           /* number of samples from previous frame to be reused for next frame */
    VADStateStruct32f* pState;                /* pointer to the internal VAD state structure */
    int                cStateBytes;           /* size in bytes of the VAD state */
    VADDecisionState   curDecisionState;      /* the decision state of VAD for the current frame */
    VADDecisionState   prevDecisionState;     /* decision state of VAD from previous frames */
    int                decisionFrameNum;      /* the frame number of the endpoint determined by VAD */
    int                decisionSampNum;       /* the sample number of the endpoint deteremined by VAD */
    CircBufStruct16s   outBuf;                /* circular buffer containing data to be written to the output */
    int                outBufSzSamps;         /* size of the output circular buffer in samples */
    Ipp32f             prevInputSample;       /* previous input sample for DC removal filter */
    Ipp32f             prevOutputSample;      /* previous output sample for DC removal filter */

    /* open input and output files */
    pInputPCMFile   = fopen(INPUT_PCM_FN,  "rb");
    ASSERT_MSGBOX(NULL!=pInputPCMFile, "VAD example. Cannot open input file!\n", "Error", ABORT);

    pOutputPCMFile  = fopen(OUTPUT_PCM_FN, "wb");
    ASSERT_MSGBOX(NULL!=pOutputPCMFile, "VAD example. Cannot open output file!\n", "Error", ABORT);

    pOutputTextFile = fopen(OUTPUT_TEXT_FN,"wt");
    ASSERT_MSGBOX(NULL!=pOutputTextFile, "VAD example. Cannot open output file!\n", "Error", ABORT);

    /* compute size in samples for a frame , frame shift and output buffer */
    cWinSamps        = WINDOW_LEN_SAMPS;
    cFrameShiftSamps = FRAME_SHIFT_SAMPS;
    cReuseSamps      = cWinSamps - cFrameShiftSamps;
    outBufSzSamps    = OUT_BUF_SIZE_SAMPS;

    /* compute the size in bytes required for the VAD Internal State */
    VAD_GetStateSizeBytes(cWinSamps, &cStateBytes);

    /* allocate memory for local buffers & VAD state */
    pReadBuf = (Ipp16s *) malloc(cWinSamps*sizeof(Ipp16s));
    ASSERT_MSGBOX(NULL!=pReadBuf, "VAD example. Cannot allocate memory!\n", "Error", ABORT);

    pReadBuf32f = (Ipp32f *) malloc(cWinSamps*sizeof(Ipp32f));
    ASSERT_MSGBOX(NULL!=pReadBuf, "VAD example. Cannot allocate memory!\n", "Error", ABORT);

    outBuf.pBuf = (Ipp16s *) malloc (outBufSzSamps * sizeof(Ipp16s));
    ASSERT_MSGBOX(NULL!=outBuf.pBuf, "VAD example. Cannot allocate memory!\n", "Error", ABORT);

    pState = (VADStateStruct32f *) malloc(cStateBytes);
    ASSERT_MSGBOX(NULL!=pState, "VAD example. Cannot allocate memory!\n", "Error", ABORT);

    /* Initializations - output circular structure, VAD state and VAD decision states */
    OUT_Init(outBufSzSamps, &outBuf);
    VAD_Init(pState, FRAME_SHIFT_MSEC, cWinSamps, SAMPLING_FREQUENCY_HZ);

    curDecisionState = NODECISION;
    prevDecisionState = INACTIVE;

    /* read one frame and one lookahead frame */
    cSampsRead = fread(pReadBuf, sizeof(Ipp16s), cWinSamps, pInputPCMFile);
    ippsConvert_16s32f(pReadBuf,pReadBuf32f,cWinSamps);

    /* copy data to the output buffer */
    OUT_AppendSamples(pReadBuf32f,cSampsRead,&outBuf);

    /* remove DC */
    prevInputSample = 0.0;
    ippsCompensateOffset_32f_I(pReadBuf32f, cSampsRead, &prevInputSample, 0, DC_RMV_COEF);
    prevOutputSample = pReadBuf32f[cSampsRead-1];

    /* Main Loop. Process each frame of input data until input file exhausted. */
    while(cSampsRead >= cFrameShiftSamps)
    {
        /* perform VAD */
        VAD_ProcessFrame(pState, pReadBuf32f, cWinSamps, &curDecisionState, &decisionFrameNum);

        ippsConvert_32f16s_Sfs(pReadBuf32f,pReadBuf,cWinSamps,ippRndNear,0);


        /* write data to the output files based on the outcome of VAD */
        decisionSampNum = decisionFrameNum * cFrameShiftSamps;
        OUT_ConditionalFlushBuffer(&outBuf, decisionSampNum, curDecisionState, &prevDecisionState, cFrameShiftSamps, pOutputPCMFile);
        OUT_WriteEndPoints(decisionFrameNum, decisionSampNum, curDecisionState, pOutputTextFile);

        /* save the samples to be re-used from the recently processed frame and read another (lookahead) frame shift of data. */
        ippsCopy_16s(pReadBuf+cFrameShiftSamps,pReadBuf,cReuseSamps);
        cSampsRead = fread(pReadBuf+cReuseSamps, sizeof(Ipp16s), cFrameShiftSamps, pInputPCMFile);
        ippsConvert_16s32f(pReadBuf,pReadBuf32f,cWinSamps);

        /* copy data to the output buffer */
        OUT_AppendSamples(pReadBuf32f+cReuseSamps,cSampsRead,&outBuf);

        /* remove DC */
        ippsCompensateOffset_32f_I(pReadBuf32f+cReuseSamps, cSampsRead, &prevInputSample, prevOutputSample, DC_RMV_COEF);
        prevOutputSample = pReadBuf32f[cReuseSamps+cSampsRead-1];
    }

    /*
    // End of file processing
    */

    /* check to see if VAD was in the process of determining teh edn of an utterance */
    VAD_ProcessEndOfInput(pState,&curDecisionState, &decisionFrameNum);

    /* write data to the output files based on the outcome of VAD */
    decisionSampNum = decisionFrameNum * cFrameShiftSamps;
    OUT_ConditionalFlushBuffer(&outBuf, decisionSampNum, curDecisionState, &prevDecisionState,0, pOutputPCMFile);
    OUT_WriteEndPoints(decisionFrameNum,decisionSampNum,curDecisionState, pOutputTextFile);

    /* close input/ouput file pointers */
    fclose(pInputPCMFile);
    fclose(pOutputPCMFile);
    fclose(pOutputTextFile);

    /* free allocated memory */
    free(pReadBuf);
    free(pReadBuf32f);
    free(outBuf.pBuf);
    free(pState);

//    ASSERT_MSGBOX(0, "Finished executing VAD example\n", "Success", 0);
}

/* EOF */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久草av在线| 欧美无乱码久久久免费午夜一区| 91啪在线观看| 欧美日韩国产在线观看| 国产三级欧美三级日产三级99 | 蜜臀av一级做a爰片久久| 国产九九视频一区二区三区| 欧美美女一区二区在线观看| 国产欧美精品区一区二区三区| 日本不卡的三区四区五区| 91麻豆国产香蕉久久精品| 精品精品国产高清a毛片牛牛| 亚洲欧美一区二区三区极速播放| 狠狠狠色丁香婷婷综合久久五月| 欧美在线视频全部完| 国产精品久久久久久久浪潮网站| 久久国产人妖系列| 欧美二区乱c少妇| 亚洲成人精品影院| 99国产一区二区三精品乱码| 欧美国产1区2区| 国产91丝袜在线播放| 久久久久久久网| 国产美女视频一区| 久久蜜桃一区二区| 国产精品自拍网站| 久久久久久久国产精品影院| 精品在线亚洲视频| 精品国产伦一区二区三区观看体验| 日韩精品一二区| 欧美一区二区三区白人| 日韩国产高清在线| 在线成人免费视频| 久草精品在线观看| 国产欧美日韩综合| 99久久99久久精品国产片果冻| 国产精品久久久久婷婷| 91在线免费看| 一级中文字幕一区二区| 欧美亚洲动漫精品| 日本在线不卡视频一二三区| 337p亚洲精品色噜噜狠狠| 蜜桃视频一区二区三区在线观看 | 精品少妇一区二区三区免费观看| 麻豆91在线看| 337p粉嫩大胆色噜噜噜噜亚洲| 黄色资源网久久资源365| 久久综合资源网| 99精品一区二区| 日韩精品亚洲专区| 精品国产91亚洲一区二区三区婷婷| 国产一区在线观看麻豆| 国产精品久久二区二区| 欧美三级电影一区| 麻豆精品视频在线观看免费 | 夜夜夜精品看看| 在线成人午夜影院| 国产99久久久国产精品| 亚洲黄色免费网站| 日韩欧美的一区| aa级大片欧美| 美女视频免费一区| 国产精品理伦片| 欧美日韩综合一区| 国产成人亚洲综合a∨婷婷 | 国产亚洲一区二区三区四区| 96av麻豆蜜桃一区二区| 捆绑紧缚一区二区三区视频 | av不卡免费电影| 秋霞国产午夜精品免费视频 | 精品少妇一区二区三区在线视频| 国产成人av影院| 天使萌一区二区三区免费观看| 精品国产电影一区二区| 色婷婷av一区| 精品一区二区三区免费毛片爱| 椎名由奈av一区二区三区| 69堂国产成人免费视频| 成人av免费观看| 免费成人美女在线观看| 亚洲精品视频免费观看| 久久久另类综合| 欧美日韩国产美| 91麻豆成人久久精品二区三区| 美女网站视频久久| 一个色综合av| 国产精品理伦片| 欧美电影免费观看高清完整版| 91丨porny丨国产| 国产一区二区视频在线| 日产精品久久久久久久性色| 亚洲黄网站在线观看| 欧美经典一区二区| 亚洲精品一区二区三区在线观看| 欧美日韩日日摸| 欧洲精品在线观看| 成人激情综合网站| 精品一区二区三区在线观看国产| 亚洲第一福利一区| 欧美国产国产综合| 日本一区免费视频| 国产婷婷一区二区| 久久久精品蜜桃| 精品蜜桃在线看| 久久综合国产精品| 精品嫩草影院久久| 精品伦理精品一区| 精品日韩99亚洲| 欧美成人性福生活免费看| 欧美一区二区免费视频| 91超碰这里只有精品国产| 欧美在线|欧美| 欧美三级午夜理伦三级中视频| 色琪琪一区二区三区亚洲区| 色综合久久综合网97色综合| 93久久精品日日躁夜夜躁欧美| k8久久久一区二区三区| av电影在线不卡| 91免费精品国自产拍在线不卡| 成人黄色777网| 99国产精品久| 欧美色图免费看| 91精品国产综合久久精品app| 91精品中文字幕一区二区三区| 在线不卡的av| 精品精品国产高清一毛片一天堂| 久久天堂av综合合色蜜桃网| 中文字幕精品三区| 亚洲另类色综合网站| 午夜免费久久看| 精品亚洲porn| 福利91精品一区二区三区| 成人毛片视频在线观看| 欧美优质美女网站| 69av一区二区三区| 久久久精品免费网站| 亚洲人午夜精品天堂一二香蕉| 夜夜嗨av一区二区三区网页| 天天色图综合网| 国产综合色产在线精品| 国产精品1区二区.| 色综合一个色综合亚洲| 制服丝袜亚洲色图| 国产亚洲欧美激情| 亚洲亚洲精品在线观看| 久久99久久久久| 91欧美激情一区二区三区成人| 91精品在线免费观看| 亚洲国产岛国毛片在线| 婷婷开心激情综合| 粉嫩欧美一区二区三区高清影视| 色视频欧美一区二区三区| 精品久久久网站| 亚洲主播在线观看| 国产成人午夜高潮毛片| 欧美日韩一区 二区 三区 久久精品 | av男人天堂一区| 欧美一区二区视频在线观看| 国产农村妇女精品| 日韩影院免费视频| 色综合久久久久综合99| 精品日韩欧美一区二区| 一区二区三区国产| 国产剧情在线观看一区二区| 欧美日韩一区二区三区不卡| 亚洲欧美综合另类在线卡通| 免费看欧美女人艹b| 色狠狠综合天天综合综合| 久久综合久久鬼色中文字| 亚洲国产成人av网| 91在线免费视频观看| 国产欧美一区二区精品久导航| 青娱乐精品视频| 欧美亚洲日本一区| 成人免费一区二区三区视频| 久久国产三级精品| 777久久久精品| 亚洲成人激情社区| 色综合中文字幕| |精品福利一区二区三区| 精品无人码麻豆乱码1区2区| 欧美日韩国产大片| 亚洲丰满少妇videoshd| 91在线看国产| 国产精品电影院| 国产99久久久国产精品潘金| 日韩亚洲欧美综合| 日本怡春院一区二区| 欧美片在线播放| 亚洲va在线va天堂| 欧美日韩国产综合一区二区三区| 亚洲欧美日韩久久| 色婷婷狠狠综合| 一区二区三区久久久| 色综合天天综合| 亚洲一区二区黄色| 欧美午夜电影网| 亚洲bt欧美bt精品777| 欧美色国产精品| 日韩经典中文字幕一区|