fir.c

来自「基于visual dsp++开发环境」· C语言 代码 · 共 38 行

C
38
字号
/*	fir.c
 *
 *	Example of the FIR routine from the Blackfin DSP library.
 *	Use fir_data.m to generate input data.
 *
 *  The default input data file is a sum of two sinusoids
 *  The default coefficients implement a LPF that filters out one of the sine terms
 *
 *	See the C/C++ Compiler and Library Manual for more info on the DSP routines
 *
 */

#include <fract.h>
#include <filter.h>

#define VEC_SIZE 256	// length of the input vector
#define NUM_TAPS 8	// number of filter coefficients

fract16 in[VEC_SIZE] = {
#include "in.dat"
};

fract16 coefs[NUM_TAPS] = {
#include "coefs.dat"
};

fract16 delay[NUM_TAPS];

fract16 out[VEC_SIZE + NUM_TAPS - 1];

fir_state_fr16 state;	// declare filter state

int main()
{
	fir_init(state, coefs, delay, NUM_TAPS, 1);	// initialize filter state  
	fir_fr16(in, out, VEC_SIZE, &state);	// apply the filter to the data
}

⌨️ 快捷键说明

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