⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaecz.c

📁 TI公司DSP/tms320c55x/tms320c54x系列的声学回声消除代码
💻 C
字号:
/*-------------------------------------------------------------------------*
 *                                                                         *
 *   THIS IS AN UNPUBLISHED WORK CONTAINING CONFIDENTIAL AND PROPRIETARY   *
 *   INFORMATION.  IF PUBLICATION OCCURS, THE FOLLOWING NOTICE APPLIES:    *
 *      "COPYRIGHT 2002 MIKET DSP SOLUTIONS, ALL RIGHTS RESERVED"          *
 *                                                                         *
 *-------------------------------------------------------------------------*/
//#include <string.h>
#include "gaeci.h"

/*--------------------- local defs ----------------------------------------*/
/*--------------------- public vars ---------------------------------------*/
/*--------------------- local vars ----------------------------------------*/
/*--------------------- local functions -----------------------------------*/
/*-------------------------------------------------------------------------*/
void                        gaec_erle
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc,
S16 *psSnd
)
{
	// that is the Sin delayed 6.25 ms
    pSc->sSinEn  = gaec_utl_pkt_energy(pDb->asSbuf);
    pSc->sErrEn  = gaec_utl_pkt_energy(psSnd);
    pSc->sErle   = pSc->sSinEn - pSc->sErrEn;
	if (pSc->sErle < 0)
		pSc->sErle = 0;
}
/*-------------------------------------------------------------------------*/
void                        gaec_erle_sb
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb, 
GAEC_tSc *pSc
)
{
//    S16 sMaxEn;
//    S16 sAvrEn;
//    int sMaxBand; 
    int  band;

    for (band = 0; band < GAEC_BANDS+1; band++)
    {
        pSc->asErle[band] = pSc->asSinEn[band] - pSc->asErrEn[band];

        if (pSc->asErle[band] < 0)
            pSc->asErle[band] = 0;
    }
}
/*-------------------------------------------------------------------------*/
void                        gaec_erl
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc
)
{
	S16 sEn = (pDb->asRoutEnHst[GAEC_ADF_FRS-2] >> 1) +
			  (pDb->asRoutEnHst[GAEC_ADF_FRS-3] >> 1);
    pSc->sErl = sEn - pSc->sSinEn;
}
/*-------------------------------------------------------------------------*/
void                        gaec_erl_sb
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc
)
{
    int band;
    for (band = 0; band < GAEC_BANDS+1; band++)
    {
        // synchronization !!!! ... well, it is used for averging only...
        // so it is not so important
		S16 sEn = (pDb->aasRoutEnHst[band][GAEC_ADF_FRS-2] >> 1) +
				  (pDb->aasRoutEnHst[band][GAEC_ADF_FRS-3] >> 1);
        pSc->asErl [band] = sEn - pSc->asSinEn[band];
    }
}


#if (_DSK_VER)//!defined(_dsp)
#define _SHFT   (2)
S16 _asCnl[GAEC_FR_SZ];
S16 _sCnlEn;
/*-------------------------------------------------------------------------*/
void                        gaec_cnl_corr
/*-------------------------------------------------------------------------*/
(
S16 *psSnd
)
{
    static S32 slSav;
    int k;

    for (k = 0; k < GAEC_FR_SZ; k++)
    {
        S32 ac0 = psSnd[k];
        ac0 <<= 15;
        ac0 += slSav;
        ac0 -= (slSav >> _SHFT);
        slSav = ac0;

        ac0 += (1<<14);
        ac0 >>= 15;
        _asCnl[k] = (S16)ac0;
    }
    _sCnlEn = gaec_utl_pkt_energy(_asCnl);
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -