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

📄 lecua.s55

📁 The line echo canceller (LEC) is designed to provide the maximum attainable transparent voice qualit
💻 S55
字号:
*-------------------------------------------------------------------------*
*                                                                         *
*   THIS IS AN UNPUBLISHED WORK CONTAINING CONFIDENTIAL AND PROPRIETARY   *
*   INFORMATION.  IF PUBLICATION OCCURS, THE FOLLOWING NOTICE APPLIES:    *
*      "COPYRIGHT 2001 MICHAEL TSIROULNIKOV, ALL RIGHTS RESERVED"         *
*                                                                         *
*-------------------------------------------------------------------------*/
	.mmregs
    .cpl_on
    .arms_on
	.include	"leci.h55"
	.text

;-------------------------------------------------------------------------
	.global				_lec_dummyu1
	.sym _lec_dummyu1, _lec_dummyu1, 32, 2, 0
;-------------------------------------------------------------------------
_lec_dummyu1
	return
	.if 0
;-------------------------------------------------------------------------
	.global				_lec_avrg
	.sym _lec_avrg, _lec_avrg, 32, 2, 0
;-------------------------------------------------------------------------
_lec_avrg
;	S16 *psVal	= xar0
;	S16	sNew	= t0
;	S16 sCoeff	= t1
;
	bit(ST1, #ST1_FRCT) = #1;
	|| ac0 = t0;
	ac0 = ac0 << #16;
	|| ac1 = *ar0 << #16;
	ac0 = ac0 - (*ar0 << #16); ac0 = (new - old)
	ac1 = ac1 + (ac0 * t1); ac1 = old + (new-old)*k;
	*ar0 = HI(rnd(ac1)); 
	|| bit(ST1, #ST1_FRCT) = #0;
	return
;-------------------------------------------------------------------------
	.global				_lec_pkts_cpy
	.sym _lec_pkts_cpy, _lec_pkts_cpy, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkts_cpy
;	S16 *psTo		= xar0
;	S16 *psFrom		= xar1
;	S16 uPktsToCopy	= t0
;
	t0 = t0 - #1;
	brc0 = t0;
	localrepeat {
		repeat (#(ILEC_FR_SZ-1))
			*ar0+ = *ar1+
	}
	return
	.endif
;-------------------------------------------------------------------------
	.global				_lec_pkt_rand
	.sym _lec_pkt_rand, _lec_pkt_rand, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkt_rand
;	S16 *psTo	= xar0
;	S16 *psSeed = xar1
;
MULT    .set   31821
INC     .set   13849
;
	t0 = #MULT;
	ac1 = #INC;
	brc0 = #(ILEC_FR_SZ-1);
	localrepeat {
		ac0 = ac1 + (t0 * *ar1);
		*ar1 = ac0;
		|| *ar0+ = ac0;
	}
	return;
;-------------------------------------------------------------------------
	.global				_lec_pkt_energy
	.sym _lec_pkt_energy, _lec_pkt_energy, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkt_energy
;	S16 *psData = xar0
;
;	return S32 En
;
	ac0 = *ar0+ * *ar0+;
	|| repeat (#(ILEC_FR_SZ/2-2))
		ac0 = ac0 + (*ar0+ * *ar0+);
	ac1 = *ar0+ * *ar0+;
	|| repeat (#(ILEC_FR_SZ/2-2))
		ac1 = ac1 + (*ar0+ * *ar0+);
	ac0 = ac0 << #-2;
	ac0 = ac0 + (ac1 << #-2);
	return
;-------------------------------------------------------------------------
	.global				_lec_en2log
	.sym _lec_en2log, _lec_en2log, 32, 2, 0
;-------------------------------------------------------------------------
_lec_en2log
;	S32 slEn 	= ac0
;	S16 sCorr	= t0
; 	returns t0
    ac0 = ac0 + #1;
    ac0 = mant (ac0), t1 = -exp(ac0);
    ac0 = ac0 << #-21;
    ac0 = ac0 + #0x780;
    ac0 = ac0 + t0;
    ac0 = ac0 + (t1*#512);
    t0 = ac0;
    return

;-------------------------------------------------------------------------
	.global				_lec_exp
	.sym _lec_exp, _lec_exp, 32, 2, 0
;-------------------------------------------------------------------------
_lec_exp
;	S16 slog = t0
;	returns S16 sExp in t0
;
	sp = sp + #-1;
	ac0 = t0;
	ac1 = ac0 << #-10;
	ac0 = ac0 << #2;
	ac0 = ac0 & #4095;
	*sp(0) = ac0;
	ac0 = *sp(0) * *sp(0);
	ac0 = ac0 << #-13;
	ac0 = ac0 + *sp(0);
	ac0 = ac0 << #16
	ac0 = ac0 * #21845;
	ac0 = ac0 << #-15;
	t0 = ac1;
	ac0 = ac0 + #4096;
	ac0 = ac0 << t0;
	t0 = ac0;
	sp = sp + #1;
	return
	
;-------------------------------------------------------------------------
	.global				_lec_pkt_zc
	.sym _lec_pkt_zc, _lec_pkt_zc, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkt_zc
;	S16 *psIn = xar0
;	returns t0 
	brc0 = #(ILEC_FR_SZ-2);
	ac0 = #0;
	|| localrepeat {
		ac1 = uns(*ar0+);
		ac1 = ac1 ^ *ar0;
		ac0 = ac0 + (ac1 << #-15);
	}
	ac0 = ac0 << #16;
	ac0 = ac0 * #170;
	t0 = ac0;
	return;
;-------------------------------------------------------------------------
	.global				_lec_pkt_peak
	.sym _lec_pkt_peak, _lec_pkt_peak, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkt_peak
;	S16 *psIn = xar0
;	returns t0
    brc0 = #(ILEC_FR_SZ-1)
    t0 = #0
	|| localrepeat {
		t1 = *ar0+;
		t1 = |t1|;
		t0 = max(t1, t0);
	}
	return
;-------------------------------------------------------------------------
	.global				_lec_pkt_excess
	.sym _lec_pkt_excess, _lec_pkt_excess, 32, 2, 0
;-------------------------------------------------------------------------
_lec_pkt_excess
;	S16 *psIn	= xar0
;	S16 ClipThr	= t0
;	returns t0
;
    brc0 = #(ILEC_FR_SZ-1);
	t1 = #0;
	|| localrepeat {
		ac0 = *ar0+;
		ac0 = |ac0|;
		ac0 = ac0 - t0;
		if (ac0 > #0) execute (D_unit) 
			|| t1 = t1 + #1;
	}
	t0 = t1;
	return;
	
;-------------------------------------------------------------------------
	.global				_lec_make_noise
	.sym _lec_make_noise, _lec_make_noise, 32, 2, 0
;-------------------------------------------------------------------------
	.sect	".leca"
_asNoiseCoeff
 	.word 12000,   9000,    6000,    3000,    5000
	.text
	
_lec_make_noise
;	S16 *psTo		= xar0
;	S16 *psFrom		= xar1
;	S16 sNoiseLevel	= t0
;
	push(t2)
	|| bit(ST1, #ST1_FRCT) = #1;
    .arms_off
	bit(ST2, #ST2_ARMS) = #0;
	xar2 = mar(*ar1(#1));
	xcdp = #_asNoiseCoeff;
	brc0 = #(ILEC_FR_SZ/2-1);
	t2 = t0;
	|| t1 = #(3-5);
	t0 = #(1-5);
	|| localrepeat {
		ac0 = *ar1+ * coef(*cdp+),
		ac1 = *ar2+ * coef(*cdp+);
		|| repeat (#(5-3))
			ac0 = ac0 + (*ar1+ * coef(*cdp+)),
			ac1 = ac1 + (*ar2+ * coef(*cdp+));
		ac0 = ac0 + (*(ar1+t1) * coef(*(cdp+t0))),
		ac1 = ac1 + (*(ar2+t1) * coef(*(cdp+t0)));
		ac0 = rnd(ac0 * t2);
		ac1 = rnd(ac1 * t2); 
		*ar0+ = pair(HI(ac0));
	}
    .arms_on
	bit(ST2, #ST2_ARMS) = #1;
	bit(ST1, #ST1_FRCT) = #0;
	|| t2 = pop();
	return;
	
;-------------------------------------------------------------------------
	.global				_lec_central_clipping
	.sym _lec_central_clipping, _lec_central_clipping, 32, 2, 0
;-------------------------------------------------------------------------
_lec_central_clipping
;	S16 *pTo		= xar0
;	S16 *pFrom		= xar1
;	S16 Threshold	= t0
;
	brc0 = #(ILEC_FR_SZ-1);
	localrepeat {
		TC1 = bit(*ar1, #15);
		ac0 = *ar1+;
		ac0 = |ac0|;
		ac0 = ac0 - t0;
		if (ac0 < #0) execute(D_unit) 
			|| ac0 = #0;
		if (TC1) execute(D_unit)
			|| ac0 = -ac0;
		ac0 = ac0 + *ar0;
		*ar0+ = ac0;
	}
	return;
		
;-------------------------------------------------------------------------
	.global				_lec_dummyu2
	.sym _lec_dummyu2, _lec_dummyu2, 32, 2, 0
;-------------------------------------------------------------------------
_lec_dummyu2
	return

⌨️ 快捷键说明

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