Notes on filter design

From MyLabWiki
Revision as of 15:50, 1 November 2010 by Alex (Talk | contribs)

Jump to: navigation, search

GNU Radio contains two packages that can be used to create filters, firdes and optfir. This page tries to document some of the similarities and differences for the non-experts.

Eric Blossom wrote on the GNU Radio discussion list[1]:

optfir uses the Remez / Parks-McClellan design method[2]. gr.firdes.low_pass designs filters using the window method[3]. It all depends on what you want. See any DSP book for details.

A complementary note by Firas[4] says that

The frequency response for the same filter order is much better in the case of optfir filter design. Inversely, for the same filter response, filter order is much less in the case of optfir which means lower CPU loading. It is best to design with optfir, but convergence problem is its disadvantage.

Firdes is implemented in C++ (see gnuradio-core/src/lib/general/gr_firdes.cc and .h) and can therefore be used in both C++ and Python (INSTALL_DIR/lib/python2.6/site-packages/gnutadio/gr/gnuradio_swig_py_general.py::firdes) applications, while optfir is written in Python (see gnuradio-core/src/python/gnuradio/optfir.py).

Another significant difference is the available filter types provided by both packages. In v3.3.1git-92-gdd74b98a we have:

optfir:

  • low_pass
  • high_pass
  • band_pass and complex_band_pass
  • band_reject

firdes:

  • low_pass (two variants)
  • high_pass (two variants)
  • band_pass and complex_band_pass (two variants)
  • band_reject (two variants)
  • hilbert
  • root_raised_cosine
  • gaussian

The "two variants" for firdes filters refers to two different API interfaces, one of which allows supplying the attenuation.

References

  1. http://www.mail-archive.com/discuss-gnuradio@gnu.org/msg03325.html
  2. Wikipedia: Parks-McClellan filter design algorithm
  3. Wikipedia: Finite impulse response: Window design method
  4. https://sdrblog.wordpress.com/2009/02/23/optfir-vs-grfirdes/