与dsp有关的算法整理.docVIP

  • 6
  • 0
  • 约7.98千字
  • 约 11页
  • 2018-03-16 发布于河南
  • 举报
与dsp有关的算法整理

1卷积: #include stdio.h #include volume.h /* Global declarations */ int inp1_buffer[BUFSIZE]; int inp2_buffer[BUFSIZE]; /* processing data buffers */ int out1_buffer[BUFSIZE]; int out2_buffer[BUFSIZE]; int out3_buffer[BUFSIZE]; int out4_buffer[BUFSIZE*2]; int size = BUFSIZE; int ain = MINGAIN; int zhy=0; int sk=64; /*sk代表所开的bufsize的大小,需修改它.输入文件sine.dat为32点,sine11.dat, sin22.dat,sin33.dat,sin44.dat为64点的输入波形.*/ /* volume control variable */ unsigned int processingload = 1; /* processing routine //load value */ /* Functions */ extern void load(unsigned int loadValue); static int processing1(int *output1, int *output2); static int processing2(int *output2, int *output3); static int processing3(int *input1,int *output2,int *output4); static int processing4(int *input2, int *output1); static void dataIO1(void); static void dataIO2(void); /* * ======== main ======== */ void main() { int *input1 = inp1_buffer[0]; int *input2 = inp2_buffer[0]; int *output1 = out1_buffer[0]; int *output2 = out2_buffer[0]; int *output3 = out3_buffer[0]; int *output4 = out4_buffer[0]; puts(volume example started\n); /* loop forever */ while(TRUE) { /* * Read input data using a probe-point connected to a host file. * Write output data to a graph connected through a probe-point. */ dataIO1(); dataIO2(); /* apply gain */ processing4(input2,output1); processing1(output1, output2); processing2(output2, output3); processing3(input1,output2,output4) ; } } /* * ======== processing ======== * * FUNCTION: apply signal processing transform to input signal. * * PARAMETERS: address of input and output buffers. * * RETURN VALUE: TRUE. */ static int processing4(int *input2,int *output1) { int m=sk; for(;m=0;m--) { *output1++ = *input2++ * ain; } for(;(size-m)0;m++) {output1[m]

文档评论(0)

1亿VIP精品文档

相关文档