📄 leci.h
字号:
/*---------------------------------------------------------------------*
* *
* THIS IS AN UNPUBLISHED WORK CONTAINING CONFIDENTIAL AND PROPRIETARY *
* INFORMATION. IF PUBLICATION OCCURS, THE FOLLOWING NOTICE APPLIES: *
* "COPYRIGHT 2001 MICHAEL TSIROULNIKOV, ALL RIGHTS RESERVED" *
* *
*---------------------------------------------------------------------*/
#ifndef _leci_h
#define _leci_h
#include "stddefs.h"
#include "lec_miket.h"
/*--------------------- local defs ------------------------------------*/
#define Q15(x) ((S16)(32768.*x))
#define LEC_IO_FRAMES (2)
/* number of frames used by filter */
#define LEC_FRAMES (4)
/* there is a delay for a frame in each of RxIn/ TxOut devices.
1 frame is compensated by update of the delay line after adaptation */
#define LEC_HST_FRAMES (LEC_FRAMES + LEC_IO_FRAMES)
#define LEC_FLT_SZ (LEC_FRAMES*ILEC_FR_SZ)
#define LEC_FLT2_SZ ((LEC_FRAMES+1)*ILEC_FR_SZ)
#define LEC_HST_SZ (LEC_HST_FRAMES*ILEC_FR_SZ)
#define LEC_SECTION_SZ (4)
#define LEC_1DB (170)
#define LEC_DB(x) ((S16)(x*LEC_1DB))
#define LEC_SLACC_MAX (1L<<18)
#define LEC_NLP_PASS (1)
#define LEC_NLP_CLIP (2)
#define LEC_NLP_CLEAR (3)
#define LEC_VAD_ST_IDLE (0)
#define LEC_VAD_ST_PRE (1)
#define LEC_VAD_ST_ACTIVE (2)
#define LEC_VAD_ST_HANGOVER (3)
#define LEC_FLAG_TONE (0x0001)
#define LEC_FLAG_ADAPT (0x0002)
#define LEC_FLAG_HIRCV (0x0004)
#define LEC_FLAG_SINGULAR (0x0008)
#define LEC_FLAG_ERROVERIDE (0x0010)
#define LEC_FLAG_ERL_OK (0x0020)
typedef struct LEC_tVad
{
S32 slEnergy;
S16 sZc;
S16 sZcNoise;
S16 sEn;
S16 sEnNoise;
S16 sEnNoiseMax;
S16 sCrit;
S16 sState;
S16 sFiller0;
} LEC_tVad;
typedef struct {
S32 slAcc;
S16 sERL;
S16 sMSE;
S16 sShift;
S16 sNegShift;
S16 sErleAveraged;
U16 uConverged;
} LEC_tAdf;
typedef struct LEC_tDb
{
/* pointers */
S16 *psHst;
S16 *psTxF;
/* long word aligned data */
LEC_tAdf Adf1;
LEC_tAdf Adf2;
LEC_tVad VadErr;
S32 aslRk[6];
S32 aslRkSav[6];
S16 asAdf1[LEC_FLT2_SZ];
S16 asAdf2[LEC_FLT2_SZ];
S16 asLpSav[5];
/* tx analisys */
S16 asTxEn[7];
S16 sTxMaxCnt;
S16 sErlOkCnt;
/* sout data */
S16 sClipLevel;
S16 sErrAvrEn;
S16 sErrOverrideCnt;
S16 sRxNoiseLevel;
S16 sSeed;
S16 asRand[4];
/* dt */
S16 sDtCriteria;
/* flags */
S16 sToneCnt;
U16 uTone;
U16 uIsDT;
U16 uTest;
ILEC_tCfg Cfg;
LEC_MIKET_tStts Stts;
} LEC_tDb;
typedef struct LEC_tSc {
S16 *psRx;
S16 *psTx;
S32 aslRk [6];
S32 aslRkTx [6];
S32 aslG [6];
S32 slEn;
S16 asRk [6];
S16 asF [6];
S16 asK [6];
S16 asErr1 [ILEC_FR_SZ];
S16 asErr2 [ILEC_FR_SZ];
S16 asNormErr [ILEC_FR_SZ];
S16 asTmp [ILEC_FR_SZ*2];
S16 sStepSize;
S16 sStepCorr;
S16 sRxEn;
S16 sTxEn;
S16 sExpectedErrorEn;
S16 sAdaptThreshold;
S16 sClipThreshold;
S16 sErr1En;
S16 sErr2En;
S16 sErlEst;
S16 sErl;
S16 sErle;
S16 sERL;
S16 sMSE;
S16 sRxNoiseAtt;
S16 sJ0Tx;
S16 sJ0;
S16 sInvR0;
U16 uFlags;
U16 uNlpMode;
U16 uAdaptMode;
U16 uFltCpyMode;
} LEC_tSc;
/*--------------------- public vars- ----------------------------------*/
/*--------------------- local vars ------------------------------------*/
/*--------------------- local functions -------------------------------*/
/* c routines */
extern void lec_vad_init (LEC_tVad *pDb, S16 sEnNoise);
extern void lec_vad_process (LEC_tVad *pDb, S16 *psData);
extern void lec_analyse_tx (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_compare_adfs (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_convergence_control (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_update_flt (LEC_tDb *pDb, LEC_tSc *pSc);
/* to be asm, lecns.c */
extern void lec_dt_start (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_dt_end (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_double_talk_detector(LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_non_linear_processor(LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_adapt_fast (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_adapt_slow (LEC_tDb *pDb, LEC_tSc *pSc);
/* signal analysis routines from lecpa.s5x */
extern void lec_band_pass_rx (LEC_tDb *p, LEC_tSc *pSc);
extern S16 lec_durbin (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_normalise_rk (LEC_tDb *pDb, LEC_tSc *pSc, S16 sShift, S16 sAdd);
extern void lec_tx_moments (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_gs_moments (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_ts_moments (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_gs_filter (LEC_tDb *pDb, LEC_tSc *pSc);
extern void lec_lp_residual_error (LEC_tDb *pDb, LEC_tSc *pSc, const S16 *psCoeff);
/* adapt routines, lecaa.s5x */
extern void lec_cancel_pkt (LEC_tDb *pDb, LEC_tSc *pSc);
extern S16 lec_cancel (S16 *psHst, S16 *psFlt, S16 sRxIn);
extern S16 lec_cancel_shifted (S16 *psHst, S16 *psFlt, S16 sRxIn, S16 sShift);
extern S32 lec_get_xz (S16 *psX, S16 *pxZ);
extern S32 lec_get_xz_slow (S16 *psX, S16 *pxZ);
extern S32 lec_update_xz (S32 slEn, S16 *psX, S16 *pxZ);
extern void lec_shift_adf2 (LEC_tDb *pDb, LEC_tSc *pSc);
extern S16 lec_step_size (S32 slEn, S16 *psStepSize);
extern void lec_adapt_fast_high (LEC_tDb *pDb, LEC_tSc *pSc, S16 base, S16 sStep);
extern void lec_adapt_fast_low (LEC_tDb *pDb, LEC_tSc *pSc, S16 base, S16 sStep);
extern void lec_adapt_slow_high (LEC_tDb *pDb, LEC_tSc *pSc, S16 base, S16 sStep);
extern void lec_adapt_slow_low (LEC_tDb *pDb, LEC_tSc *pSc, S16 base, S16 sStep);
extern void lec_shift_err2 (LEC_tDb *pDb, LEC_tSc *pSc);
extern S16 lec_step_size_corr_slow (LEC_tDb *pDb, LEC_tSc *pSc, S16 base);
extern S16 lec_step_size_corr_fast2 (LEC_tDb *pDb, LEC_tSc *pSc, S16 base);
/* utilities, lecua.s5x */
extern void lec_avrg (S16 *psSav, S16 sNew, S16 sCoeff);
extern void lec_pkts_cpy (S16 *psTo, S16 *psFrom, S16 sPkts);
extern void lec_pkt_rand (S16 *psSeed, S16 *psData);
extern S32 lec_pkt_energy (S16 *psData);
extern S16 lec_en2log (S32 slEn);
extern S16 lec_exp (S16 sdB);
extern S16 lec_pkt_zc (S16 *psData);
extern S16 lec_pkt_peak (S16 *psData);
extern S16 lec_pkt_excess (S16 *pError, S16 ClipThreshold);
extern void lec_make_noise (S16 *pTo, S16 *pFrom, S16 Level);
extern void lec_central_clipping (S16 *pTo, S16 *pFrom, S16 Threshold);
extern void lec_rshift_adf (S16 *psAdf,S16 sShift);
/*--------------------- public functions -----------------------------*/
/*---------------------------------------------------------------------*/
#endif /* _leci_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -