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

📄 gaecfbs.c

📁 TI公司DSP/tms320c55x/tms320c54x系列的声学回声消除代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* band 19 */
  +122,   -126,    +91,    -44,     +5,    +10,   -107,   +267, 
  -472,   +569,   -633,   +547,   -369,   +162,    -21,    +40, 
  -394,  +1079,  -2047,  +2945,  -3825,  +4211,  -3922,  +2858, 
 -1099,  -1190,  +3709,  -6075,  +7923,  -8982,  +8982,  -7923, 
 +6075,  -3709,  +1190,  +1099,  -2858,  +3922,  -4211,  +3825, 
 -2945,  +2047,  -1079,   +394,    -40,    +21,   -162,   +369, 
  -547,   +633,   -569,   +472,   -267,   +107,    -10,     -5, 
   +44,    -91,   +126,   -122, 
};

/*--------------------- local functions -----------------------------------*/
/*-------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void                        gaec_fb_snd_analysis
#else
void                        gaec_fb_snd_analysisC
#endif
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc, 
S16 *psIn
)
{
// asTmp use: GAEC_FBS_SZ/2
    int k, band, blk;
    S16 *psFrom = &(pDb->asSbuf[0]);
    S16 *psTo   = &(pSc->aasSin[0][0]);
    S32 ac0;

// shift old data
	for (k = 0; k < GAEC_SBUF_SZ-GAEC_FR_SZ; k++) 
    {
        pDb->asSbuf[k] = pDb->asSbuf[k + GAEC_FR_SZ];
    }
// add new data
	for (k = 0; k < GAEC_FR_SZ; k++) 
    {
        pDb->asSbuf[GAEC_SBUF_SZ-GAEC_FR_SZ+k] = psIn[k];
    }
// analysis + decimaition
//	blk = 0;
    for (blk = 0; blk < GAEC_BLKS; blk++)
    {
        // symmetric filters
        for (k = 0; k < GAEC_FBS_SZ/2; k++)
        {
            pSc->u.asTmp[k] = psFrom[k] + psFrom[GAEC_FBS_SZ-1-k];
        }
	    for (band = 0; band < GAEC_BANDS; band++)
	    {
            ac0 = 0;
		    for(k = 0; k < GAEC_FBS_SZ/2; k++)
		    {
			    ac0 += pSc->u.asTmp[k] * (S32)GAEC_aasFBS[band][k];
		    }
		    *psTo = _Srnd(ac0, 0);
            psTo   += GAEC_BLKS;
        }
        // asymmetric filters
        for (k = 0; k < GAEC_FBS_SZ/2; k++)
        {
            pSc->u.asTmp[k] = psFrom[k] - psFrom[GAEC_FBS_SZ-1-k];
        }
	    for (band = GAEC_BANDS; band < 2*GAEC_BANDS; band++)
	    {
            ac0 = 0;
		    for(k = 0; k < GAEC_FBS_SZ/2; k++)
		    {
			    ac0 += pSc->u.asTmp[k] * (S32)GAEC_aasFBS[band][k];
		    }
		    *psTo = _Srnd(ac0, 0);
            psTo   += GAEC_BLKS;
        }
        psTo -= GAEC_BLKS*(2*GAEC_BANDS)-1;
        psFrom += GAEC_BLK_SZ;
#if 0    
#endif    

    }
}

/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void                        gaec_fb_rcv_analysis
#else
void                        gaec_fb_rcv_analysisC
#endif
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc
)
{
    // asTmp use: GAEC_FBR_SZ/2
    int k, band, blk;
    S16 *psFrom;
    S16 *psTo;
    S32 ac0;

// analysis + decimaition
    for (blk = 0; blk < GAEC_BLKS; blk++)
    {
        psFrom = &(pDb->asRbuf[GAEC_BLK_SZ * blk]);
        psTo   = &(pDb->psRcv[GAEC_RCV_SZ - GAEC_BLKS + blk]);

        // symmetric filters
        for (k = 0; k < GAEC_FBR_SZ/2;k++)
        {
            pSc->u.asTmp[k] = psFrom[k]+psFrom[GAEC_FBR_SZ-1-k];
        }
        for (band = 0; band < GAEC_BANDS; band++)
        {
            ac0 = 0;
		    for(k = 0; k < GAEC_FBR_SZ/2; k++)
		    {
			    ac0 += pSc->u.asTmp[k] * (S32) GAEC_aasFBR[band][k];
		    }
            *psTo = _Srnd(ac0,0);
            psTo += GAEC_RCV_SZ;
        }
        // asymmetric filters
        for (k = 0; k < GAEC_FBR_SZ/2;k++)
        {
            pSc->u.asTmp[k] = psFrom[k]-psFrom[GAEC_FBR_SZ-1-k];
        }
        for (band = GAEC_BANDS; band < 2*GAEC_BANDS; band++)
        {
            ac0 = 0;
		    for(k = 0; k < GAEC_FBR_SZ/2; k++)
		    {
			    ac0 += pSc->u.asTmp[k] * (S32) GAEC_aasFBR[band][k];
		    }
            *psTo = _Srnd(ac0,0);
            psTo += GAEC_RCV_SZ;
        }
    }
}


/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void                        gaec_fb_synthesis
#else
void                        gaec_fb_synthesisC
#endif
/*-------------------------------------------------------------------------*/
(
S16 ppsErr[][GAEC_ERR_SZ],
S16 *psSout
)
{
    int blk;

    for (blk = 0; blk < GAEC_BLKS; blk++)
    {
        int k;
        // blk_sz must be even
	    for (k = 0; k < GAEC_BLK_SZ/2; k++)
	    {
		    S32 ac0 = 0;
            S32 ac1 = 0;
            int band;
		    for (band = 0; band < 2*GAEC_BANDS; band++)
		    {
			    int i0 = GAEC_FBZ_SZ - GAEC_BLK_SZ + k*2+0;
			    int i1 = GAEC_FBZ_SZ - GAEC_BLK_SZ + k*2+1;
                int n;
			    for(n = 0; n < GAEC_LFCTR; n++)
			    {
				    ac0 += ppsErr[band][n+blk] * (S32)(GAEC_aasFBZ[band][i0]);
				    ac1 += ppsErr[band][n+blk] * (S32)(GAEC_aasFBZ[band][i1]);
				    i0 -= GAEC_BLK_SZ;
				    i1 -= GAEC_BLK_SZ;
			    }
		    }
            psSout[k*2+0 + blk * GAEC_BLK_SZ] = _Srnd(ac0,0);// * (GAEC_BANDS/2));
            psSout[k*2+1 + blk * GAEC_BLK_SZ] = _Srnd(ac1,0);
	    }
    }
}

⌨️ 快捷键说明

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