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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ec_sbf_int.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: Echo Canceller, fast subband algorithm
//
*/

#include <stdlib.h>
#include "ipps.h"
#include "ippsc.h"
#include "ec_api_int.h"
#include "ownec_int.h"

int ec_isbf_GetSubbandNum(isbfECState *state)
{
    return state->numSubbands;
}
/* init scratch memory buffer */
int ec_isbf_InitBuff(_isbfECState *state, char *buff) {
#if !defined (NO_SCRATCH_MEMORY_USED)
    if(NULL==state)
        return 1;
    if(NULL != buff)
       state->Mem.base = buff;
    else
       if (NULL == state->Mem.base)
          return 1;
    state->Mem.CurPtr = state->Mem.base;
    state->Mem.VecPtr = (int *)(state->Mem.base+EC_SCRATCH_MEMORY_SIZE);
#endif
    return 0;
}

/* Returns size of frame */
int ec_isbf_GetFrameSize(IppPCMFrequency freq, int taptime_ms, int *s)
{
    *s = SBF_FRAME_SIZE;
    return 0;
}

/* Returns size of buffer for state structure */
int ec_isbf_GetSize(IppPCMFrequency freq, int taptime_ms, int *s)
{
    int numSegments;
    int size = 0, csize;
    int sbsize, sbinitBufSize, sbbufSize;

    size += ALIGN(sizeof(_isbfECState));

    ippsSubbandProcessGetSize_16s(SBF_FFT_ORDER, SBF_WIN_LEN, &sbsize, &sbinitBufSize, &sbbufSize);

    size += ALIGN(sbsize);
    size += ALIGN(sbsize);
    size += ALIGN(sbsize);
    size += ALIGN(sbinitBufSize);
    size += ALIGN(sbbufSize);

    if (freq == IPP_PCM_FREQ_8000) {
        numSegments = (taptime_ms * 8 - 1) / SBF_FRAME_SIZE + 1;
    } else if (freq == IPP_PCM_FREQ_16000) {
        numSegments = (taptime_ms * 16 - 1) / SBF_FRAME_SIZE + 1;
    } else {
        return 1;
    }

    size += ALIGN(3 * numSegments * sizeof(Ipp32sc *));
    size += ALIGN(3 * numSegments * SBF_SUBBANDS * sizeof(Ipp32sc));

    ippsSubbandControllerGetSize_EC_16s(SBF_SUBBANDS, SBF_FRAME_SIZE, numSegments, freq, &sbsize);

    size += ALIGN(sbsize);

    ippsToneDetectGetStateSize_EC_16s(freq, &csize);
    size += ALIGN(csize * 2);

    *s = size;

    return 0;
}

/* Returns delay introduced to send-path */
int ec_isbf_GetSendPathDelay(int *delay)
{
    *delay = SBF_WIN_LEN - SBF_FRAME_SIZE;
    return 0;
}

/* acquire NLP gain coeff */
int ec_isbf_GetNLPGain(_isbfECState *state)
{
   return state->sgain;
}
/* Initializes state structure */
int ec_isbf_Init(_isbfECState *state, IppPCMFrequency freq, int taptime_ms)
{
    int i, numSegments, csize;
    int sbsize, sbinitBufSize, sbbufSize;

    Ipp8u *ptr = (Ipp8u *)state, *buf;

    ptr += ALIGN(sizeof(_isbfECState));

/* Initialize SubbandProcess structures */
    ippsSubbandProcessGetSize_16s(SBF_FFT_ORDER, SBF_WIN_LEN, &sbsize, &sbinitBufSize, &sbbufSize);

    state->state_syn = (IppsSubbandProcessState_16s *)ptr;
    ptr += ALIGN(sbsize);
    state->state_ana_rin = (IppsSubbandProcessState_16s *)ptr;
    ptr += ALIGN(sbsize);
    state->state_ana_sin = (IppsSubbandProcessState_16s *)ptr;
    ptr += ALIGN(sbsize);

    if (ippsSubbandProcessInit_16s(state->state_syn,     SBF_FFT_ORDER, SBF_FRAME_SIZE, SBF_WIN_LEN, 0, ptr) != ippStsOk)
        return 1;// zero state->pSigBuf[256]
    if (ippsSubbandProcessInit_16s(state->state_ana_rin, SBF_FFT_ORDER, SBF_FRAME_SIZE, SBF_WIN_LEN, 0, ptr) != ippStsOk)
        return 1;// zero state->pSigBuf[256]
    if (ippsSubbandProcessInit_16s(state->state_ana_sin, SBF_FFT_ORDER, SBF_FRAME_SIZE, SBF_WIN_LEN, 0, ptr) != ippStsOk)
        return 1;// zero state->pSigBuf[256]

    ptr += ALIGN(sbinitBufSize);

    state->FFTSize = SBF_FFT_LEN;
    state->numSubbands = SBF_SUBBANDS;
    state->frameSize = SBF_FRAME_SIZE;
    state->windowLen = SBF_WIN_LEN;
    state->pBuf = ptr;
    ptr += ALIGN(sbbufSize);

    if (freq == IPP_PCM_FREQ_8000) {
        numSegments = (taptime_ms * 8 - 1) / state->frameSize + 1;
    } else if (freq == IPP_PCM_FREQ_16000) {
        numSegments = (taptime_ms * 16 - 1) / state->frameSize + 1;
    } else {
        return 1;
    }
    state->numSegments = numSegments;

    /* receive-in subband history */
    state->ppRinSubbandHistory = (Ipp32sc **)ptr;
    ptr += ALIGN(3 * numSegments * sizeof(Ipp32sc *));
    /* adaptive coeffs */
    state->ppAdaptiveCoefs = state->ppRinSubbandHistory + numSegments;
    /* fixed coeffs */
    state->ppFixedCoefs = state->ppRinSubbandHistory + numSegments * 2;

    buf = ptr;
    ptr += ALIGN(3 * numSegments * SBF_SUBBANDS * sizeof(Ipp32sc));

    /* Zero coeffs buffer and history buffer */
    ippsZero_32sc((Ipp32sc *)buf, 3 * numSegments * SBF_SUBBANDS);

    /* Initialize receive-in subband history array */
    for (i = 0; i < numSegments; i++) {
        (state->ppRinSubbandHistory)[i] = (Ipp32sc *)buf + i * (state->numSubbands);
    }
    buf += numSegments * (state->numSubbands) * sizeof(Ipp32sc);

    /* Initialize adaptive coeffs array */
    for (i = 0; i < numSegments; i++) {
        (state->ppAdaptiveCoefs)[i] = (Ipp32sc *)buf + i * (state->numSubbands);
    }
    buf += numSegments * (state->numSubbands) * sizeof(Ipp32sc);

    /* Initialize fixed coeffs array */
    for (i = 0; i < numSegments; i++) {
        (state->ppFixedCoefs)[i] = (Ipp32sc *)buf + i * (state->numSubbands);
    }

    /* Initialize subband controller */
    state->controller = (IppsSubbandControllerState_EC_16s *)ptr;
    if (ippsSubbandControllerInit_EC_16s(state->controller, state->numSubbands, state->frameSize, numSegments, freq) != ippStsOk)
        return 1;

    ippsSubbandControllerGetSize_EC_16s(state->numSubbands, state->frameSize, numSegments, freq, &csize);

    ptr += ALIGN(csize);

    /* Initialize tone detection */
    ippsToneDetectGetStateSize_EC_16s(freq, &csize);
    state->tdr = (IppsToneDetectState_EC_16s *)ptr;
    ptr += csize;
    state->tds = (IppsToneDetectState_EC_16s *)ptr;
    ippsToneDetectInit_EC_16s(state->tdr, freq);
    ippsToneDetectInit_EC_16s(state->tds, freq);

    /* enable adaptation */
    state->mode = 1;

    state->r_in_pwr = 0;
    state->s_in_pwr = 0;
    state->td_coeff = COEF_ONE - COEF_ONE * 4 / state->frameSize / freq;
    state->td_thres = 500;
    state->td_resr = state->td_ress = 0;

    return 0;
}

/* Do operation or set mode */
int ec_isbf_ModeOp(_isbfECState *state, ECOpcode op)
{
    int i, j;

    switch (op) {
    case (EC_COEFFS_ZERO):      /* Zero coeffs of filters */
        {
            for (i = 0; i < state->numSegments; i++)
                for (j = 0; j < state->numSubbands; j++)
                    state->ppAdaptiveCoefs[i][j].re = state->ppAdaptiveCoefs[i][j].im =
                        state->ppFixedCoefs[i][j].re = state->ppFixedCoefs[i][j].im = 0;
        }
        break;
    case(EC_ADAPTATION_ENABLE): /* Enable adaptation */
    case(EC_ADAPTATION_ENABLE_LITE): /* Enable adaptation */
        if (!(state->mode & 1))
            ippsSubbandControllerReset_EC_16s(state->controller);
        state->mode |= 1;
        break;
    case(EC_ADAPTATION_DISABLE): /* Disable adaptation */
        state->mode &= ~1;
        break;
    case(EC_NLP_ENABLE):    /* Enable NLP */
        state->mode |= 2;
        break;
    case(EC_NLP_DISABLE):   /* Disable NLP */
        state->mode &= ~2;
        break;
    case(EC_TD_ENABLE):     /* Enable ToneDisabler */
        state->mode |= 4;
        break;
    case(EC_TD_DISABLE):    /* Disable ToneDisabler */
        state->mode &= ~4;
        break;
    default:
        break;
    }

    return 0;
}

/* Tone Disabler */
static int ec_isbf_ToneDisabler(_isbfECState *state, Ipp16s *r_in, Ipp16s *s_in)
{
    int resr, ress;
    int i;
    Ipp64s r_in_pwr = 0, s_in_pwr = 0;

/* Detect 2100 Hz with periodical phase reversal */
    ippsToneDetect_EC_16s(r_in, state->frameSize, &resr, state->tdr);
    ippsToneDetect_EC_16s(s_in, state->frameSize, &ress, state->tds);

/* Update receive-in signal and send-in signal powers */
    for (i = 0; i < state->frameSize; i++) {
        r_in_pwr += r_in[i] * r_in[i];
        s_in_pwr += s_in[i] * s_in[i];
    }

    ADDWEIGHTED_INT(state->r_in_pwr, r_in_pwr, state->td_coeff);
    ADDWEIGHTED_INT(state->s_in_pwr, s_in_pwr, state->td_coeff);

    if (state->td_ress || state->td_resr) {
       if ((!state->td_resr || state->r_in_pwr < state->td_thres) &&
            (!state->td_ress || state->s_in_pwr < state->td_thres))
        {
/* Restore previous mode */
            state->td_resr = state->td_ress = 0;
            if (state->td_mode & 1)
                ec_isbf_ModeOp(state, EC_ADAPTATION_ENABLE);
            if (state->td_mode & 2)
                ec_isbf_ModeOp(state, EC_NLP_ENABLE);
        }
    } else if (resr || ress) {
/* Zero coeffs, disable adaptation and NLP */
        if (resr) state->td_resr = 1;
        if (ress) state->td_ress = 1;

        state->td_mode = state->mode;
        ec_isbf_ModeOp(state, EC_COEFFS_ZERO);
        ec_isbf_ModeOp(state, EC_ADAPTATION_DISABLE);
        ec_isbf_ModeOp(state, EC_NLP_DISABLE);
    }

    return 0;
}

/* Process one frame */
int ec_isbf_ProcessFrame(_isbfECState *state, Ipp16s *rin, Ipp16s *sin, Ipp16s *sout)
{
    int numSegments = state->numSegments;

    LOCAL_ALIGN_ARRAY(32,Ipp32sc,sin_sub,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY(32,Ipp32sc,fira_err,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY(32,Ipp32sc,firf_err,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY(32,Ipp32sc,fira_out,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY(32,Ipp32sc,firf_out,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY(32,Ipp32s_EC_Sfs,pStepSize,SBF_SUBBANDS,state);

    Ipp32sc* pSegment; /* Pointer to segment of input history */
    int iSegment;

    /* Tone Disabler */
    if (TD_ENABLED)
        ec_isbf_ToneDisabler(state, rin, sin);
    /* update receive-in subband history buffer */
    pSegment = state->ppRinSubbandHistory[state->numSegments-1];
    for(iSegment = state->numSegments-1; iSegment > 0; iSegment--)
    {
      state->ppRinSubbandHistory[iSegment] = state->ppRinSubbandHistory[iSegment-1];
    }
    state->ppRinSubbandHistory[0] = pSegment;

    /* do subband analysis */
    ippsSubbandAnalysis_16s32sc_Sfs(rin, state->ppRinSubbandHistory[0], state->state_ana_rin, 0, state->pBuf);
    ippsSubbandAnalysis_16s32sc_Sfs(sin, sin_sub, state->state_ana_sin, 0, state->pBuf);

    if (ADAPTATION_ENABLED) {
        /* update subband controller */
        ippsSubbandControllerUpdate_EC_16s(rin, sin, (const Ipp32sc **)(state->ppRinSubbandHistory),
            sin_sub, pStepSize, state->controller);

        /* do filtering with adaptive coeffs */
        ippsFIRSubband_EC_32sc_Sfs(state->ppRinSubbandHistory, state->ppAdaptiveCoefs, fira_out,
            numSegments, state->numSubbands, F_SF);

        /* do filtering with fixed coeffs */
        ippsFIRSubband_EC_32sc_Sfs(state->ppRinSubbandHistory, state->ppFixedCoefs, firf_out,
            numSegments, state->numSubbands, F_SF);

        /* Get adaptive filter error */
        ippsSub_32sc_Sfs(fira_out, sin_sub, fira_err, SBF_SUBBANDS, 0);
        /* Get fixed filter error */
        ippsSub_32sc_Sfs(firf_out, sin_sub, firf_err, SBF_SUBBANDS, 0);

        /* Update adaptive coeffs */
        ippsFIRSubbandCoeffUpdate_EC_32sc_I(pStepSize, (const Ipp32sc **)(state->ppRinSubbandHistory), fira_err,
            state->ppAdaptiveCoefs, numSegments, state->numSubbands, F_SF);

        /* Apply subband controller */
        ippsSubbandController_EC_16s(fira_err, firf_err, state->ppAdaptiveCoefs, state->ppFixedCoefs,
            &state->sgain, state->controller);

        /* do subband synthesis */
        ippsSubbandSynthesis_32sc16s_Sfs(firf_err, sout, state->state_syn, 0, state->pBuf);

        /* Apply NLP coeff */
        if (NLP_ENABLED)
            ippsMulC_16s_ISfs(state->sgain, sout, SBF_FRAME_SIZE, 15);
    } else {
        /* do filtering with fixed coeffs */
        ippsFIRSubband_EC_32sc_Sfs(state->ppRinSubbandHistory, state->ppFixedCoefs, firf_out,
            numSegments, state->numSubbands, F_SF);

        /* Get fixed filter error */
        ippsSub_32sc_Sfs(firf_out, sin_sub, firf_err, SBF_SUBBANDS, 0);

        /* do subband synthesis */
        ippsSubbandSynthesis_32sc16s_Sfs(firf_err, sout, state->state_syn, 0, state->pBuf);
    }

    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32s_EC_Sfs,pStepSize,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32sc,firf_out,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32sc,fira_out,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32sc,firf_err,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32sc,fira_err,SBF_SUBBANDS,state);
    LOCAL_ALIGN_ARRAY_FREE(32,Ipp32sc,sin_sub,SBF_SUBBANDS,state);

    return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99国内精品久久| 99视频超级精品| 欧美视频第二页| 久久久久久久精| 全部av―极品视觉盛宴亚洲| 91片黄在线观看| 国产亚洲精品精华液| 日韩成人午夜电影| 欧美性大战久久久久久久| 欧美国产激情一区二区三区蜜月| 日韩影院免费视频| 在线观看欧美日本| 中文字幕在线观看不卡| 狠狠色狠狠色合久久伊人| 91精品国产一区二区三区香蕉| 成人免费一区二区三区视频 | 国产精品久久一级| 奇米影视在线99精品| 欧美色老头old∨ideo| 亚洲人亚洲人成电影网站色| 高清视频一区二区| 久久伊99综合婷婷久久伊| 麻豆精品视频在线观看| 欧美日韩久久久| 一区二区三区四区高清精品免费观看| 风间由美性色一区二区三区| 久久中文娱乐网| 精久久久久久久久久久| 日韩精品资源二区在线| 美腿丝袜一区二区三区| 日韩一区二区视频在线观看| 五月天精品一区二区三区| 欧美日韩成人综合天天影院 | 国产精品美女久久久久久 | 亚洲午夜免费电影| 色婷婷国产精品久久包臀| 中文字幕精品—区二区四季| 国产福利91精品一区| 久久日韩精品一区二区五区| 国产综合久久久久影院| 久久午夜羞羞影院免费观看| 国内精品自线一区二区三区视频| 日韩精品中文字幕一区二区三区 | 亚洲地区一二三色| 欧美日本一区二区三区四区| 亚洲v中文字幕| 337p亚洲精品色噜噜噜| 日本中文字幕一区| 精品少妇一区二区三区日产乱码| 麻豆精品视频在线观看免费 | 91福利在线看| 亚洲午夜精品网| 欧美高清性hdvideosex| 青椒成人免费视频| 精品精品国产高清一毛片一天堂| 精品一区二区免费在线观看| 久久久久久久久蜜桃| 成人黄色在线看| 亚洲老司机在线| 精品视频色一区| 奇米影视7777精品一区二区| 2024国产精品| 国产suv一区二区三区88区| 国产精品电影一区二区| 欧美午夜片在线观看| 视频一区二区中文字幕| xnxx国产精品| 成人h动漫精品一区二| 一区二区三区四区在线播放| 欧美男人的天堂一二区| 久久精品国产精品亚洲红杏| 中文字幕二三区不卡| 在线观看区一区二| 久久99热狠狠色一区二区| 国产清纯在线一区二区www| 色香蕉成人二区免费| 亚洲成人精品一区二区| 久久一日本道色综合| 一本色道亚洲精品aⅴ| 日韩电影在线观看一区| 国产婷婷色一区二区三区在线| 色综合久久99| 久久99久久99精品免视看婷婷| 国产精品萝li| 在线播放国产精品二区一二区四区 | 久久人人97超碰com| 91麻豆精东视频| 麻豆国产精品一区二区三区 | 91精品国产欧美一区二区成人| 国产精品亚洲成人| 亚洲综合另类小说| 精品国产91洋老外米糕| 一本到高清视频免费精品| 麻豆精品一区二区三区| 亚洲少妇30p| 欧美一级专区免费大片| 成人国产精品免费观看| 青青草国产成人99久久| 国产精品美女久久久久久久久| 6080午夜不卡| 92精品国产成人观看免费| 青青草97国产精品免费观看无弹窗版| 国产精品久久夜| 欧美电视剧免费观看| 欧美综合视频在线观看| 国内成人免费视频| 一区二区三区不卡视频在线观看| 欧美va在线播放| 欧美亚一区二区| 成人污污视频在线观看| 奇米精品一区二区三区四区 | 欧美成人三级电影在线| 91高清视频免费看| 国产91精品一区二区| 青青草97国产精品免费观看无弹窗版| 综合av第一页| 国产丝袜欧美中文另类| 日韩一区二区三区免费看 | 色就色 综合激情| 丰满少妇在线播放bd日韩电影| 青青草97国产精品免费观看| 亚洲激情五月婷婷| 国产精品福利一区| 久久精品视频网| 日韩免费观看2025年上映的电影| 欧美在线你懂的| 94色蜜桃网一区二区三区| 国产91清纯白嫩初高中在线观看| 麻豆国产一区二区| 日韩精品午夜视频| 亚洲色图欧洲色图| 国产精品免费视频一区| 国产亚洲女人久久久久毛片| 欧美大片一区二区三区| 欧美精品电影在线播放| 欧美性一二三区| 99久久精品久久久久久清纯| 国产xxx精品视频大全| 激情综合色丁香一区二区| 青青国产91久久久久久| 视频一区中文字幕国产| 亚洲一区二区三区在线| 亚洲黄色小视频| 亚洲免费av在线| 亚洲欧美电影一区二区| 成人免费一区二区三区在线观看 | 欧美一级高清片在线观看| 欧美色综合久久| 欧美亚洲综合网| 日本久久电影网| 91精品福利在线| 色婷婷av一区二区三区软件| 91麻豆国产自产在线观看| 99久久精品国产麻豆演员表| 不卡一区二区在线| 91在线看国产| 91免费观看在线| 91久久精品网| 欧美亚洲动漫精品| 欧美精品 国产精品| 6080午夜不卡| 日韩一卡二卡三卡国产欧美| 91精品国产高清一区二区三区 | 久久久精品一品道一区| 国产三级久久久| 国产精品美女久久久久久久| 亚洲同性gay激情无套| **欧美大码日韩| 一区二区三区在线高清| 性做久久久久久久免费看| 蜜臀av在线播放一区二区三区| 蜜桃视频免费观看一区| 国产永久精品大片wwwapp| 粉嫩一区二区三区在线看| 99久久精品免费看| 欧美性极品少妇| 日韩小视频在线观看专区| 久久久综合网站| 亚洲欧美在线另类| 亚洲国产精品精华液网站| 美女视频黄 久久| 国产精品123| 91视频.com| 欧美高清视频www夜色资源网| 91精品国产美女浴室洗澡无遮挡| 精品女同一区二区| 中文字幕高清一区| 一区二区三区在线不卡| 日本不卡一二三| 国产大陆精品国产| 在线观看91精品国产入口| 日韩亚洲欧美成人一区| 中国av一区二区三区| 亚洲综合在线五月| 久久丁香综合五月国产三级网站| 成人性色生活片| 欧美另类变人与禽xxxxx| 精品国产三级电影在线观看| 国产精品欧美久久久久无广告 | 日韩电影免费在线看|