discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Simple FIR Filter


From: Douglas Geiger
Subject: Re: [Discuss-gnuradio] Simple FIR Filter
Date: Tue, 15 Sep 2015 11:14:07 -0400

Rich,
 If you look in gr-filter/lib/fir_filter.cc you'll see all the filter kernel implementations. Since it looks like you're only interested in floats (and therefore, I assume real - not complex - signals and taps), if you look at fir_filter_fff::filter(const float input[]) you can see that it really is just a wrapper for the volk_32f_x2_dot_prod_32f kernel from VOLK. Note that this call is the inner kernel, which gets called either by filterN (for the non-decimating case) or filterNdec (for the decimating case) inside the work(...) function by the corresponding block (i.e. fir_filter_fff_impl.cc for the all-floats case). If you are interested in complex signals/taps, fir_filter.cc has all the other variants as well, but you'll notice that pretty much all the filter(...) calls are just wrappers for VOLK functions (e.g. volk_32fc_x2_dot_prod_32fc for the all complex float case). All the rest of the code relating to the FIR filters has to do with setup and things like updating taps, so if all you need is a simple dot product function for implementing your own FIR filter, I highly recommend looking through the VOLK documentation. Note that if you have lots of taps, it becomes desirable at some point to move into the Fourier domain, and do a simple element-wise multiply rather than a time domain convolution. I'll leave walking through fft_filter.cc as an exercise for the reader...

 Regards,
  Doug

On Mon, Sep 14, 2015 at 1:24 AM, Richard Bell <address@hidden> wrote:
Hi all,

I'm not sure how to implement a simple FIR filter within C++ code that does not act directly on the OOT blocks input array. I would appreciate it if someone would demonstrate a simple example of how to use fir_filter_fff assuming the following:

float[N] my_input_array = {N float values};   <---- This is not the OOT modules input port array
float[M] taps = {my taps};
float[N+M-1] my_output_array = {N+M-1 float values}; <---- This is not the OOT modules output port

What is the code that will convolve my_input_array with taps and store it in my_output_array using gnuradio builtins? I've tried this myself but can't get it to work. I'm not interested in writing my own convolution code when gnuradio has optimized implementations.

Thanks,
Rich

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




--
Doug Geiger
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]