OSDN Git Service

Change comment
[libbfin32/algorithm_fir.git] / algorithm_fir / fr32_fir.h
1 /**
2  * \defgroup libbfin32 32bit algorithm collection of Blackfin DSP
3  */
4
5 /**
6  * \defgroup 32bit filter algorithm implementation
7  * \ingroup libbfin32
8  */
9 /*@{*/
10
11 /**
12  * \file fr32_fir.h
13  * \date 2014/03/17
14  * \author takemasa
15  * \brief Basic FIR filter implementation
16  *
17  */
18
19 #ifndef FR32_FIR_H_
20 #define FR32_FIR_H_
21
22 #include <fract.h>
23
24 /**
25  * \brief FIR filter structure.
26  */
27 typedef struct
28 {
29         int taps;              ///< tap number of FIR filter. This have to be integer multiple of following parameter ratio, in case of decimator.
30         fract32 * coeff;        ///< pointer to the coefficient array.
31         fract32 * delayline;    ///< pointer to the internal delay line
32         fract32 * head;         ///< pointer to the current write head in the delayline.
33         int ratio;             ///< Interpolation / decimation ratio. effective only for the decimator and interpolator. Set to 1 for FIR filter.
34         int tapsByRatio;       ///< taps / ratio pre-calcuration.
35 }TFIR32;
36
37 /**
38  * \brief FIR initialization routine.
39  * \param filter TFIR32 struct. Filled by a set of parameter for fr32_fir etc, when returned.
40  * \param taps Number of taps for filter. Must be longer than 1. Must be integer multiple of ratio, for interpolator and decimator.
41  * \param coeff Coefficient array. The length have to be same or longer than taps.
42  * \param delayline Internal delay line array. The length have to be same or longer than taps. Will be zero filled by this function.
43  * \param ratio Interpolation / Decimation ratio. Must be 1 for the FIR filter.
44  * \details
45  * Set the structure "filter", for the filter processing. This initializer is shared among
46  * FIR filter, interpolator and decimator.
47  * This routine have to be called once before invoking fr32_fir(), fr32_interpolator(), fr32_decimator() function.
48  */
49
50 void fr32_fir_init( TFIR32 *filter, int taps, fract32 * coeff, fract32 * delayline, int ratio);
51
52
53 /**
54  * \brief FIR processing routing
55  * \param filter TFIR32 struct. Have to be initialized by fr32_fir_init().
56  * \param in input samples buffer
57  * \param out output sample buffer.
58  * \param count number of input and output samples.
59  * \details
60  * Finite Impulse Response filter. The variable given to filter parameter have to be initialized by fr32_fir_init() function,
61  * at least and once before invoking this funciton.
62  */
63
64 void fr32_fir(TFIR32 *filter, fract32 in[], fract32 out[], int count );
65
66 /**
67  * \brief Interpolator routing
68  * \param filter TFIR32 struct. Have to be initialized by fr32_fir_init().
69  * \param in input samples buffer
70  * \param out output sample buffer.
71  * \param count number of input samples. The number of output data in out array will be count * ratio.
72  * \details
73  * Interpolator. The variable given to filter parameter have to be initialized by fr32_fir_init() function,
74  * at least and once before invoking this function.
75  * The number of output samples are count * ratio. Where, ratio is defined by fr32_fir_init() function.
76  */
77
78 void fr32_interpolator(TFIR32 *filter, fract32 in[], fract32 out[], int count );
79
80 /**
81  * \brief Decimator routing
82  * \param filter TFIR32 struct. Have to be initialized by fr32_fir_init().
83  * \param in input samples buffer
84  * \param out output sample buffer.
85  * \param count number of input samples. The number of output data in out array will be count / ratio. Where ratio is specified by fr32_fir_init().
86  * \details
87  * Decimator. The variable given to filter parameter have to be initialized by fr32_fir_init() function, at least and once before invoking this funciton.
88  * The number of output samples are count / ratio. Where, ratio is defined by fr32_fir_init() function.
89  */
90
91 void fr32_decimator(TFIR32 *filter, fract32 in[], fract32 out[], int count );
92
93
94 #endif /* FR32_FIR_H_ */
95
96 /*@} */
97