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

📄 g729a_pre_proc.c

📁 DSP上优化的G.729A代码
💻 C
字号:
#include "../Common/typedef.h"
#include "../Include/G729A_basic_op.h"
#include "../Include/G729A_oper_32b.h"
#include "../Include/G729A_ld8a.h"
#include "../Include/G729A_tab_ld8a.h"

static Word16 G729Ay2_hi, G729Ay2_lo, G729Ay1_hi, G729Ay1_lo, G729Ax0, G729Ax1;

void G729AInit_Pre_Process(void)
{
	G729Ay2_hi = 0;
	G729Ay2_lo = 0;
	G729Ay1_hi = 0;
	G729Ay1_lo = 0;
	G729Ax0   = 0;
	G729Ax1   = 0;
}

void G729APre_Process(Word16 signal[], Word16 lg)          
{
	Word16 i, x2;
	Word32 L_tmp0, L_tmp1;
	Word32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9;
	
	for(i = 0; i < lg; i++)
	{
		x2 = G729Ax1;
		G729Ax1 = G729Ax0;
		G729Ax0 = signal[i];
		
		tmp0 = _smpy(G729Ay1_lo, 7807);
		tmp2 = _smpy(G729Ay1_hi, 7807);
		tmp1 = _smpy(G729Ay2_lo, -3733);
		tmp3 = _smpy(G729Ay2_hi, -3733);
		
		tmp0 = tmp0 >>16;
		tmp1 = tmp1 >>16;
		
	    L_tmp0 = _sadd(tmp2, tmp0);
		L_tmp1 = _sadd(tmp3, tmp1);
		
		tmp4 = _smpy(G729Ax0, 1899);
		tmp5 = _smpy(G729Ax1, -3798);
		tmp6 = _smpy(x2, 1899);
		
		L_tmp1 = _sadd(L_tmp1, tmp4);
		L_tmp0 = _sadd(L_tmp0, tmp5);
		L_tmp1 = _sadd(L_tmp1, tmp6);
		L_tmp0 = _sadd(L_tmp0, L_tmp1);
		
		L_tmp0 = _sshvl(L_tmp0, 3);
		
		tmp7 = _sadd(L_tmp0, (Word32)0x00008000L);
		
		tmp8 = _sshvr(L_tmp0, 1);
		tmp9 = _smpy(G729Ay1_hi, 16384);
		
		signal[i] = (Word16)(tmp7>>16);
		
		G729Ay2_hi = G729Ay1_hi;
		G729Ay2_lo = G729Ay1_lo;
	
		G729Ay1_hi = L_tmp0 >> 16;
		
	    G729Ay1_lo = (Word16)_ssub(tmp8, tmp9);
	}
	return;
}

⌨️ 快捷键说明

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