新人求救:语音信号预处理算法(去均值,预加重)的问题
#define SASR(x, by) ((x) >> (by))
#define SASL(x, by) ((x) << (by))
# define GSM_MULT_R(a, b) (SASR( ((longword)(a) * (longword)(b)), 15 ))
struct gsm_state {
gsmword dp0[ 280 ];
gsmword z1; /* preprocessing.c, Offset_com. */
longword L_z2; /* Offset_com. */
int mp; /* Preemphasis */
gsmword u[8]; /* short_term_aly_filter.c */
gsmword LARpp[2][8];/* */
gsmword j; /* */
gsmword ltp_cut; /* long_term.c, LTP crosscorr. */
gsmword nrp; /* 40 */ /* long_term.c, synthesis */
gsmword v[9]; /* short_term.c, synthesis */
gsmword msr; /* decoder.c, Postprocessing */
char fast; /* only used if FAST */
};
static void Gsm_Preprocess(struct gsm_state * S, short *s, gsmword *so)
{
gsmword z1 = S->z1;
longword L_z2 = S->L_z2;
gsmword mp = (gsmword)S->mp;
gsmword s1;
longword L_s2;
longword L_temp;
gsmword msp;
gsmword SO;
int k = 160;
while(k--)
{
SO = (gsmword)(SASL( SASR( *s, 3 ), 2 ));/*
s++;
s1 = (gsmword)(SO - z1);
z1 = SO;
L_s2 = s1;
L_s2 = SASL( L_s2, 15 );
L_z2 += L_s2;
L_temp = L_z2 + 16384;
msp = (gsmword)GSM_MULT_R( mp, -28672 );
mp = (gsmword)SASR( L_temp, 15 );
*so++ = (gsmword)(mp + msp);
}
S->z1 = z1;
S->L_z2 = L_z2;
S->mp = mp;
}
这是GSM语音压缩算法的预处理部分。处理的信号为:语音信号经PCM编码的160个样点。
我找的资料上为:先是滤除信号S0中的直流部分,产生一个无直流的信号Sof:
Sof(k)=S0(k)-S0(k-1)+32735*2的-15次方 * Sof(k)
然后将该去直流信号Sof(k)输入一阶预加重滤波器,获得160个用于分析短时分析滤波器系数的样点S(k),且
S(k) = Sof(k) - 28180 * 2-15 * Sof(k-1)
可是这段程序和我找的资料说明我看不出是一样的。请高手解释一下这段程序到底在做什么好吗?
比如说一开始信号就左移,右移。。