Notes on filter design

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 characteristics for the non-experts.

Eric Blossom wrote on the GNU Radio discussion list : optfir uses the Remez / Parks-McClellan design method. gr.firdes.low_pass designs filters using the window method. It all depends on what you want. See any DSP book for details.

A complementary note by Firas 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.