{
int i, j, sum for (j = 0j <100j++) {
sum = 0
for (i = 0i <32i++)
sum += x[i+j] * h[i]
y[j] = sum >>15
}
}
2
void fir(short x[], short h[], short y[])
{
int i, j, sum0, sum1
short x0,x1,h0,h1 for (j = 0j <100j+=2) {
sum0 = 0
sum1 = 0
x0 = x[j]
for (i = 0i <32i+=2){
x1 = x[j+i+1]
h0 = h[i]
sum0 += x0 * h0
sum1 += x1 * h0
x0 = x[j+i+2]
h1 = h[i+1]
sum0 += x1 * h1
sum1 += x0 * h1
}
y[j] = sum0 >>15
y[j+1] = sum1 >>15
}
}
3
void fir(short x[], short h[], short y[])
{
int i, j, sum0, sum1
short x0,x1,x2,x3,x4,x5,x6,x7,h0,h1,h2,h3,h4,h5,h6,h7 for (j = 0j <100j+=2) {
sum0 = 0
sum1 = 0
x0 = x[j]
for (i = 0i <32i+=8){
x1 = x[j+i+1]
h0 = h[i]
sum0 += x0 * h0
sum1 += x1 * h0
x2 = x[j+i+2]
h1 = h[i+1]
sum0 += x1 * h1
sum1 += x2 * h1
x3 = x[j+i+3]
h2 = h[i+2]
sum0 += x2 * h2
sum1 += x3 * h2
x4 = x[j+i+4]
h3 = h[i+3]
sum0 += x3 * h3
sum1 += x4 * h3
x5 = x[j+i+5]
h4 = h[i+4]
sum0 += x4 * h4
sum1 += x5 * h4
x6 = x[j+i+6]
h5 = h[i+5]
sum0 += x5 * h5
sum1 += x6 * h5
x7 = x[j+i+7]
h6 = h[i+6]
sum0 += x6 * h6
sum1 += x7 * h6
x0 = x[j+i+8]
h7 = h[i+7]
sum0 += x7 * h7
sum1 += x0 * h7
}
y[j] = sum0 >>15
y[j+1] = sum1 >>15
}
}
float middle_filter(float middle_value [] , intcount){
float sample_value, data
int i, j
for (i=1 i for(j=count-1 j>=i,--j){
if(middle_value[j-1]=middle_value[j]{
data=middle_value[j-1]
middle_value[j-1]=middle_value[j]
middle_value[j]=data
}
}
sample_value=middle_value(count-1)/2]
return(sample_value)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)