📄 gaecnrgs.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 "gaeci.h"
/*--------------------- local defs ----------------------------------------*/
#define _EN_CORR GAEC_DB(-3.5)
/*--------------------- public vars ---------------------------------------*/
/*--------------------- local vars ----------------------------------------*/
/*--------------------- local functions -----------------------------------*/
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void gaec_nrg_rcv
#else
void gaec_nrg_rcvC
#endif
/*-------------------------------------------------------------------------*/
(
GAEC_tDb *pDb,
GAEC_tSc *pSc
)
{
int band;
for (band = 0; band < GAEC_BANDS+1; band++)
{
S32 ac0 = 0;
int blk;
for (blk = 0; blk < GAEC_BLKS; blk++)
{
int iRcv = GAEC_ADF_SZ + blk - 1;
S16 x = pDb->psRcv[band*GAEC_RCV_SZ + iRcv];
ac0 += x * (S32)x;
if ((band != 0) && (band != GAEC_BANDS))
{
x = pDb->psRcv[(band+GAEC_BANDS)*GAEC_RCV_SZ + iRcv];
ac0 += x * (S32)x;
}
}
pSc->asRoutEn[band] = gaec_utl_en2log(ac0);
}
}
/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void gaec_nrg_blk
#else
void gaec_nrg_blkC
#endif
/*-------------------------------------------------------------------------*/
(
S16 *psFrom,
S16 *psTo
)
{
int band;
for (band = 0; band < GAEC_BANDS+1; band++)
{
S32 ac0 = 0;
int blk;
for (blk = 0; blk < GAEC_BLKS; blk++)
{
S16 x = psFrom[band*GAEC_BLKS+blk];
ac0 += x * (S32)x;
if ((band != 0) && (band != GAEC_BANDS))
{
x = psFrom[(band+GAEC_BANDS)*GAEC_BLKS+blk];
ac0 += x * (S32)x;
}
}
psTo[band] = gaec_utl_en2log(ac0);
}
}
/*-------------------------------------------------------------------------*/
#if !defined(_dsp)
void gaec_nrg_err
#else
void gaec_nrg_errC
#endif
/*-------------------------------------------------------------------------*/
(
S16 ppsErr[][GAEC_ERR_SZ],
S16 *psTo
)
{
int band;
for (band = 0; band < GAEC_BANDS+1; band++)
{
S32 slEn = 0;
int k;
for (k = 0; k < GAEC_ERR_SZ; k++)
{
S16 x = ppsErr[band][k];
slEn += x * (S32) x;
}
if ((band != 0) && (band != GAEC_BANDS))
{
for (k = 0; k < GAEC_ERR_SZ; k++)
{
S16 x = ppsErr[band+GAEC_BANDS][k];
slEn += x * (S32)x;
}
}
psTo[band] = gaec_utl_en2log(slEn) + _EN_CORR;
}
}
#if !defined(_dsp)
S16 _asErr0EnC [GAEC_BANDS+1];
/*-------------------------------------------------------------------------*/
void gaec_err0_energy
/*-------------------------------------------------------------------------*/
(
GAEC_tSc *pSc
)
{
int band;
for (band = 0; band < GAEC_BANDS+1; band++)
{
S32 ac0 = 0;
int blk;
for (blk = 0; blk < GAEC_BLKS; blk++)
{
int idx = GAEC_ERR_SZ - GAEC_BLKS + blk;
S16 x = pSc->aasErr0[band][idx];
ac0 += x * (S32)x;
if ((band != 0) && (band != GAEC_BANDS))
{
x = pSc->aasErr0[band+GAEC_BANDS][idx];
ac0 += x * (S32)x;
}
}
_asErr0EnC[band] = gaec_utl_en2log(ac0);
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -