aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-08-21 15:32:45 +0200
committerAndrej Rode <mail@andrejro.de>2018-08-25 20:21:23 +0200
commit7588f103b9e75eea56d241868d161d0f04f3fd79 (patch)
treefc9e81e128fbec1760110f758db48394954c1e9d
parentdigital: replace gengen with C++ templates (diff)
downloadgnuradio-7588f103b9e75eea56d241868d161d0f04f3fd79.tar.xz
gnuradio-7588f103b9e75eea56d241868d161d0f04f3fd79.zip
filter: replace gengen with C++ templates
-rw-r--r--docs/doxygen/CMakeLists.txt4
-rw-r--r--gr-digital/lib/cpmmod_bc_impl.h13
-rw-r--r--gr-digital/lib/modulate_vector.cc2
-rw-r--r--gr-digital/lib/ofdm_sync_sc_cfb_impl.cc3
-rw-r--r--gr-filter/include/gnuradio/filter/CMakeLists.txt17
-rw-r--r--gr-filter/include/gnuradio/filter/fir_filter.h234
-rw-r--r--gr-filter/include/gnuradio/filter/fir_filter_blk.h (renamed from gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t)40
-rw-r--r--gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h (renamed from gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t)40
-rw-r--r--gr-filter/include/gnuradio/filter/interp_fir_filter.h (renamed from gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t)38
-rw-r--r--gr-filter/include/gnuradio/filter/rational_resampler_base.h (renamed from gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t)32
-rw-r--r--gr-filter/lib/CMakeLists.txt19
-rw-r--r--gr-filter/lib/fir_filter.cc858
-rw-r--r--gr-filter/lib/fir_filter_XXX_impl.cc.t107
-rw-r--r--gr-filter/lib/fir_filter_blk_impl.cc115
-rw-r--r--gr-filter/lib/fir_filter_blk_impl.h (renamed from gr-filter/lib/fir_filter_XXX_impl.h.t)25
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_impl.cc (renamed from gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t)86
-rw-r--r--gr-filter/lib/freq_xlating_fir_filter_impl.h (renamed from gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t)32
-rw-r--r--gr-filter/lib/interp_fir_filter_XXX_impl.cc.t155
-rw-r--r--gr-filter/lib/interp_fir_filter_impl.cc167
-rw-r--r--gr-filter/lib/interp_fir_filter_impl.h (renamed from gr-filter/lib/interp_fir_filter_XXX_impl.h.t)31
-rw-r--r--gr-filter/lib/rational_resampler_base_XXX_impl.cc.t176
-rw-r--r--gr-filter/lib/rational_resampler_base_impl.cc188
-rw-r--r--gr-filter/lib/rational_resampler_base_impl.h (renamed from gr-filter/lib/rational_resampler_base_XXX_impl.h.t)31
-rw-r--r--gr-filter/swig/CMakeLists.txt1
-rw-r--r--gr-filter/swig/filter_swig.i104
25 files changed, 906 insertions, 1612 deletions
diff --git a/docs/doxygen/CMakeLists.txt b/docs/doxygen/CMakeLists.txt
index b0b3c0f46..019b01c30 100644
--- a/docs/doxygen/CMakeLists.txt
+++ b/docs/doxygen/CMakeLists.txt
@@ -45,10 +45,6 @@ if(ENABLE_GNURADIO_RUNTIME)
list(APPEND GENERATED_DEPS pmt_generated)
endif(ENABLE_GNURADIO_RUNTIME)
-if(ENABLE_GR_FILTER)
- list(APPEND GENERATED_DEPS filter_generated_includes)
-endif(ENABLE_GR_FILTER)
-
if(ENABLE_GR_TRELLIS)
list(APPEND GENERATED_DEPS trellis_generated_includes)
endif(ENABLE_GR_TRELLIS)
diff --git a/gr-digital/lib/cpmmod_bc_impl.h b/gr-digital/lib/cpmmod_bc_impl.h
index 3402e6e2b..f6385d0d3 100644
--- a/gr-digital/lib/cpmmod_bc_impl.h
+++ b/gr-digital/lib/cpmmod_bc_impl.h
@@ -1,19 +1,19 @@
/* -*- c++ -*- */
/*
* Copyright 2010,2012 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
- *
+ *
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
@@ -26,7 +26,7 @@
#include <gnuradio/digital/cpmmod_bc.h>
#include <gnuradio/blocks/char_to_float.h>
#include <gnuradio/analog/frequency_modulator_fc.h>
-#include <gnuradio/filter/interp_fir_filter_fff.h>
+#include <gnuradio/filter/interp_fir_filter.h>
namespace gr {
namespace digital {
@@ -45,7 +45,7 @@ namespace gr {
gr::blocks::char_to_float::sptr d_char_to_float;
gr::filter::interp_fir_filter_fff::sptr d_pulse_shaper;
analog::frequency_modulator_fc::sptr d_fm;
-
+
public:
cpmmod_bc_impl(const std::string &name,
analog::cpm::cpm_type type, float h,
@@ -65,4 +65,3 @@ namespace gr {
} /* namespace gr */
#endif /* INCLUDED_DIGITAL_CPMMOD_BC_IMPL_H */
-
diff --git a/gr-digital/lib/modulate_vector.cc b/gr-digital/lib/modulate_vector.cc
index 4ef6e804a..81964aa8e 100644
--- a/gr-digital/lib/modulate_vector.cc
+++ b/gr-digital/lib/modulate_vector.cc
@@ -42,7 +42,7 @@
#include <gnuradio/blocks/vector_source.h>
#include <gnuradio/blocks/vector_sink.h>
-#include <gnuradio/filter/fir_filter_ccf.h>
+#include <gnuradio/filter/fir_filter_blk.h>
#include <gnuradio/top_block.h>
#include <gnuradio/digital/modulate_vector.h>
diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
index 4c5bad14e..b928d94e9 100644
--- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
+++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
@@ -35,8 +35,7 @@
#include <gnuradio/blocks/divide.h>
#include <gnuradio/blocks/multiply.h>
#include <gnuradio/blocks/sample_and_hold.h>
-#include <gnuradio/filter/fir_filter_ccf.h>
-#include <gnuradio/filter/fir_filter_fff.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace digital {
diff --git a/gr-filter/include/gnuradio/filter/CMakeLists.txt b/gr-filter/include/gnuradio/filter/CMakeLists.txt
index 9338d9671..8f17b496b 100644
--- a/gr-filter/include/gnuradio/filter/CMakeLists.txt
+++ b/gr-filter/include/gnuradio/filter/CMakeLists.txt
@@ -18,23 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various headers
-#######################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_H(filter fir_filter_XXX ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_H(filter freq_xlating_fir_filter_XXX ccc ccf fcc fcf scf scc)
-GR_EXPAND_X_H(filter interp_fir_filter_XXX ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_H(filter rational_resampler_base_XXX ccc ccf fcc fff fsf scc)
-
-add_custom_target(filter_generated_includes DEPENDS
- ${generated_includes}
-)
-
-########################################################################
# Install header files
########################################################################
install(FILES
- ${generated_includes}
api.h
firdes.h
fir_filter.h
@@ -57,6 +43,7 @@ install(FILES
fft_filter_ccc.h
fft_filter_ccf.h
fft_filter_fff.h
+ freq_xlating_fir_filter.h
mmse_interpolator_cc.h
mmse_interpolator_ff.h
mmse_resampler_cc.h
@@ -75,8 +62,8 @@ install(FILES
pfb_decimator_ccf.h
pfb_interpolator_ccf.h
pfb_synthesizer_ccf.h
+ rational_resampler_base.h
single_pole_iir_filter_cc.h
single_pole_iir_filter_ff.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/filter
)
-
diff --git a/gr-filter/include/gnuradio/filter/fir_filter.h b/gr-filter/include/gnuradio/filter/fir_filter.h
index 99ca96c19..48562d368 100644
--- a/gr-filter/include/gnuradio/filter/fir_filter.h
+++ b/gr-filter/include/gnuradio/filter/fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,206 +23,46 @@
#ifndef INCLUDED_FILTER_FIR_FILTER_H
#define INCLUDED_FILTER_FIR_FILTER_H
+#include <cstdint>
#include <gnuradio/filter/api.h>
-#include <vector>
#include <gnuradio/gr_complex.h>
+#include <vector>
namespace gr {
- namespace filter {
- namespace kernel {
-
- class FILTER_API fir_filter_fff
- {
- public:
- fir_filter_fff(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_fff();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- float filter(const float input[]);
- void filterN(float output[],
- const float input[],
- unsigned long n);
- void filterNdec(float output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- float *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_ccf
- {
- public:
- fir_filter_ccf(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_ccf();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const gr_complex input[]);
- void filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_fcc
- {
- public:
- fir_filter_fcc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_fcc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const float input[]);
- void filterN(gr_complex output[],
- const float input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_ccc
- {
- public:
- fir_filter_ccc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_ccc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const gr_complex input[]);
- void filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_scc
- {
- public:
- fir_filter_scc(int decimation,
- const std::vector<gr_complex> &taps);
- ~fir_filter_scc();
-
- void set_taps(const std::vector<gr_complex> &taps);
- void update_tap(gr_complex t, unsigned int index);
- std::vector<gr_complex> taps() const;
- unsigned int ntaps() const;
-
- gr_complex filter(const short input[]);
- void filterN(gr_complex output[],
- const short input[],
- unsigned long n);
- void filterNdec(gr_complex output[],
- const short input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<gr_complex> d_taps;
- unsigned int d_ntaps;
- gr_complex **d_aligned_taps;
- gr_complex *d_output;
- int d_align;
- int d_naligned;
- };
-
- /**************************************************************/
-
- class FILTER_API fir_filter_fsf
- {
- public:
- fir_filter_fsf(int decimation,
- const std::vector<float> &taps);
- ~fir_filter_fsf();
-
- void set_taps(const std::vector<float> &taps);
- void update_tap(float t, unsigned int index);
- std::vector<float> taps() const;
- unsigned int ntaps() const;
-
- short filter(const float input[]);
- void filterN(short output[],
- const float input[],
- unsigned long n);
- void filterNdec(short output[],
- const float input[],
- unsigned long n,
- unsigned int decimate);
-
- protected:
- std::vector<float> d_taps;
- unsigned int d_ntaps;
- float **d_aligned_taps;
- short *d_output;
- int d_align;
- int d_naligned;
- };
-
- } /* namespace kernel */
- } /* namespace filter */
+namespace filter {
+namespace kernel {
+
+template <class IN_T, class OUT_T, class TAP_T>
+class FILTER_API fir_filter {
+ public:
+ fir_filter(int decimation, const std::vector<TAP_T>& taps);
+ ~fir_filter();
+
+ void set_taps(const std::vector<TAP_T>& taps);
+ void update_tap(TAP_T t, unsigned int index);
+ std::vector<TAP_T> taps() const;
+ unsigned int ntaps() const;
+
+ OUT_T filter(const IN_T input[]);
+ void filterN(OUT_T output[], const IN_T input[], unsigned long n);
+ void filterNdec(OUT_T output[], const IN_T input[], unsigned long n, unsigned int decimate);
+
+ protected:
+ std::vector<TAP_T> d_taps;
+ unsigned int d_ntaps;
+ TAP_T** d_aligned_taps;
+ OUT_T* d_output;
+ int d_align;
+ int d_naligned;
+};
+typedef fir_filter<float, float, float> fir_filter_fff;
+typedef fir_filter<gr_complex, gr_complex, float> fir_filter_ccf;
+typedef fir_filter<float, gr_complex, gr_complex> fir_filter_fcc;
+typedef fir_filter<gr_complex, gr_complex, gr_complex> fir_filter_ccc;
+typedef fir_filter<std::int16_t, gr_complex, gr_complex> fir_filter_scc;
+typedef fir_filter<float, std::int16_t, float> fir_filter_fsf;
+} /* namespace kernel */
+} /* namespace filter */
} /* namespace gr */
#endif /* INCLUDED_FILTER_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/fir_filter_blk.h
index 5e38653c6..be0ca50bb 100644
--- a/gr-filter/include/gnuradio/filter/fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/fir_filter_blk.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,23 +20,22 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FIR_FILTER_BLK_H
+#define FIR_FILTER_BLK_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_decimator.h>
+#include <cstdint>
namespace gr {
namespace filter {
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief FIR filter with IN_T input, OUT_T output, and TAP_T taps
* \ingroup filter_blk
*
* \details
- * The fir_filter_XXX blocks create finite impulse response
+ * The fir_filter_blk_XXX blocks create finite impulse response
* (FIR) filters that perform the convolution in the time
* domain:
*
@@ -48,34 +47,41 @@ namespace gr {
*
* The taps are a C++ vector (or Python list) of values of the
* type specified by the third letter in the block's suffix. For
- * this block, the value is of type @TAP_TYPE@. Taps can be
+ * this block, the value is of type TAP_T. Taps can be
* created using the firdes or optfir tools.
*
* These versions of the filter can also act as down-samplers
* (or decimators) by specifying an integer value for \p
* decimation.
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_decimator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API fir_filter_blk : virtual public sync_decimator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< fir_filter_blk<IN_T,OUT_T,TAP_T> > sptr;
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief FIR filter with IN_T input, OUT_T output, and TAP_T taps
*
* \param decimation set the integer decimation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
*/
static sptr make(int decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef fir_filter_blk<gr_complex, gr_complex, gr_complex> fir_filter_ccc;
+ typedef fir_filter_blk<gr_complex, gr_complex, float> fir_filter_ccf;
+ typedef fir_filter_blk<float, gr_complex, gr_complex> fir_filter_fcc;
+ typedef fir_filter_blk<float, float, float> fir_filter_fff;
+ typedef fir_filter_blk<float, std::int16_t, float> fir_filter_fsf;
+ typedef fir_filter_blk<std::int16_t, gr_complex, gr_complex> fir_filter_scc;
+
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FIR_FILTER_BLK_H */
diff --git a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h
index d8cb8f962..d06f5ed04 100644
--- a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2004,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,13 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FREQ_XLATING_FIR_FILTER_H
+#define FREQ_XLATING_FIR_FILTER_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_decimator.h>
@@ -37,7 +32,7 @@ namespace gr {
/*!
* \brief FIR filter combined with frequency translation with
- * @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * IN_T input, OUT_T output and TAP_T taps
*
* \ingroup channelizers_blk
*
@@ -59,15 +54,15 @@ namespace gr {
* Use the filter's group delay to determine when the
* transients after the change have settled down.
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_decimator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API freq_xlating_fir_filter : virtual public sync_decimator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< freq_xlating_fir_filter<IN_T,OUT_T,TAP_T> > sptr;
/*!
- * \brief FIR filter with @I_TYPE@ input, @O_TYPE@ output, and
- * @TAP_TYPE@ taps that also frequency translates a signal from
+ * \brief FIR filter with IN_T input, OUT_T output, and
+ * TAP_T taps that also frequency translates a signal from
* \p center_freq.
*
* Construct a FIR filter with the given taps and a composite
@@ -76,23 +71,30 @@ namespace gr {
* filtering operation.
*
* \param decimation set the integer decimation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
* \param center_freq Center frequency of signal to down convert from (Hz)
* \param sampling_freq Sampling rate of signal (in Hz)
*/
static sptr make(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq);
virtual void set_center_freq(double center_freq) = 0;
virtual double center_freq() const = 0;
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex> freq_xlating_fir_filter_ccc;
+ typedef freq_xlating_fir_filter<gr_complex, gr_complex, float> freq_xlating_fir_filter_ccf;
+ typedef freq_xlating_fir_filter<float, gr_complex, gr_complex> freq_xlating_fir_filter_fcc;
+ typedef freq_xlating_fir_filter<float, gr_complex, float> freq_xlating_fir_filter_fcf;
+ typedef freq_xlating_fir_filter<std::int16_t, gr_complex, float> freq_xlating_fir_filter_scf;
+ typedef freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex> freq_xlating_fir_filter_scc;
+
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FREQ_XLATING_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t b/gr-filter/include/gnuradio/filter/interp_fir_filter.h
index 5b0f3511b..abdc12ec2 100644
--- a/gr-filter/include/gnuradio/filter/interp_fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/interp_fir_filter.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,19 +20,18 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef INTERP_FIR_FILTER_H
+#define INTERP_FIR_FILTER_H
#include <gnuradio/filter/api.h>
#include <gnuradio/sync_interpolator.h>
+#include <cstdint>
namespace gr {
namespace filter {
/*!
- * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output and @TAP_TYPE@ taps
+ * \brief Interpolating FIR filter with IN_T input, OUT_T output and TAP_T taps
* \ingroup filter_blk
*
* \details
@@ -48,7 +47,7 @@ namespace gr {
*
* The taps are a C++ vector (or Python list) of values of the
* type specified by the third letter in the block's suffix. For
- * this block, the value is of type @TAP_TYPE@. Taps can be
+ * this block, the value is of type TAP_T. Taps can be
* created using the firdes or optfir tools.
*
* These versions of the filter can also act as up-samplers
@@ -56,26 +55,33 @@ namespace gr {
* interpolation.
*
*/
- class FILTER_API @BASE_NAME@ : virtual public sync_interpolator
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API interp_fir_filter : virtual public sync_interpolator
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ // gr::filter::interp_fir_filter::sptr
+ typedef boost::shared_ptr<interp_fir_filter> sptr;
/*!
- * \brief Interpolating FIR filter with @I_TYPE@ input, @O_TYPE@ output, and @TAP_TYPE@ taps
+ * \brief Interpolating FIR filter with IN_T input, OUT_T output, and TAP_T taps
*
* \param interpolation set the integer interpolation rate
- * \param taps a vector/list of taps of type @TAP_TYPE@
+ * \param taps a vector/list of taps of type TAP_T
*/
static sptr make(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef interp_fir_filter<gr_complex, gr_complex, gr_complex> interp_fir_filter_ccc;
+ typedef interp_fir_filter<gr_complex, gr_complex, float> interp_fir_filter_ccf;
+ typedef interp_fir_filter<float, gr_complex, gr_complex> interp_fir_filter_fcc;
+ typedef interp_fir_filter<float, float, float> interp_fir_filter_fff;
+ typedef interp_fir_filter<float, std::int16_t, float> interp_fir_filter_fsf;
+ typedef interp_fir_filter<std::int16_t, gr_complex, gr_complex> interp_fir_filter_scc;
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* INTERP_FIR_FILTER_H */
diff --git a/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t b/gr-filter/include/gnuradio/filter/rational_resampler_base.h
index d5f837980..97974c6c1 100644
--- a/gr-filter/include/gnuradio/filter/rational_resampler_base_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/rational_resampler_base.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012 Free Software Foundation, Inc.
+ * Copyright 2005,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,10 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RATIONAL_RESAMPLER_BASE_H
+#define RATIONAL_RESAMPLER_BASE_H
#include <gnuradio/filter/api.h>
#include <gnuradio/block.h>
@@ -33,8 +31,8 @@ namespace gr {
namespace filter {
/*!
- * \brief Rational Resampling Polyphase FIR filter with @I_TYPE@
- * input, @O_TYPE@ output and @TAP_TYPE@ taps.
+ * \brief Rational Resampling Polyphase FIR filter with IN_T
+ * input, OUT_T output and TAP_T taps.
* \ingroup resamplers_blk
*
* Make a rational resampling FIR filter. If the input signal is
@@ -68,11 +66,11 @@ namespace gr {
* narrower of the required anti-image postfilter or anti-alias
* prefilter.
*/
- class FILTER_API @NAME@ : virtual public block
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API rational_resampler_base : virtual public block
{
public:
- // gr::filter::@BASE_NAME@::sptr
- typedef boost::shared_ptr<@BASE_NAME@> sptr;
+ typedef boost::shared_ptr< rational_resampler_base<IN_T,OUT_T,TAP_T> > sptr;
/*!
* Make a rational resampling FIR filter.
@@ -83,16 +81,22 @@ namespace gr {
*/
static sptr make(unsigned interpolation,
unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ const std::vector<TAP_T> &taps);
virtual unsigned interpolation() const = 0;
virtual unsigned decimation() const = 0;
- virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
- virtual std::vector<@TAP_TYPE@> taps() const = 0;
+ virtual void set_taps(const std::vector<TAP_T> &taps) = 0;
+ virtual std::vector<TAP_T> taps() const = 0;
};
+ typedef rational_resampler_base<gr_complex, gr_complex, gr_complex> rational_resampler_base_ccc;
+ typedef rational_resampler_base<gr_complex, gr_complex, float> rational_resampler_base_ccf;
+ typedef rational_resampler_base<float, gr_complex, gr_complex> rational_resampler_base_fcc;
+ typedef rational_resampler_base<float, float, float> rational_resampler_base_fff;
+ typedef rational_resampler_base<float, std::int16_t, float> rational_resampler_base_fsf;
+ typedef rational_resampler_base<std::int16_t, gr_complex, gr_complex> rational_resampler_base_scc;
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RATIONAL_RESAMPLER_BASE_H */
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index 8bd723686..5bb7b5d1f 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014,2017 Free Software Foundation, Inc.
+# Copyright (C) 2012-2014,2017-2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,15 +18,6 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Invoke macro to generate various sources and headers
-########################################################################
-include(GrMiscUtils)
-GR_EXPAND_X_CC_H(filter fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_CC_H(filter freq_xlating_fir_filter_XXX_impl ccc ccf fcc fcf scf scc)
-GR_EXPAND_X_CC_H(filter interp_fir_filter_XXX_impl ccc ccf fcc fff fsf scc)
-GR_EXPAND_X_CC_H(filter rational_resampler_base_XXX_impl ccc ccf fcc fff fsf scc)
-
-########################################################################
# Setup the include and linker paths
########################################################################
include_directories(
@@ -53,17 +44,19 @@ endif(ENABLE_GR_CTRLPORT)
########################################################################
list(APPEND filter_sources
fir_filter.cc
+ fir_filter_blk_impl.cc
fir_filter_with_buffer.cc
fft_filter.cc
firdes.cc
+ freq_xlating_fir_filter_impl.cc
iir_filter.cc
+ interp_fir_filter_impl.cc
mmse_fir_interpolator_cc.cc
mmse_fir_interpolator_ff.cc
mmse_interp_differentiator_cc.cc
mmse_interp_differentiator_ff.cc
pm_remez.cc
polyphase_filterbank.cc
- ${generated_sources}
dc_blocker_cc_impl.cc
dc_blocker_ff_impl.cc
filter_delay_fc_impl.cc
@@ -90,6 +83,7 @@ list(APPEND filter_sources
pfb_decimator_ccf_impl.cc
pfb_interpolator_ccf_impl.cc
pfb_synthesizer_ccf_impl.cc
+ rational_resampler_base_impl.cc
single_pole_iir_filter_cc_impl.cc
single_pole_iir_filter_ff_impl.cc
)
@@ -121,7 +115,7 @@ add_library(gnuradio-filter SHARED ${filter_sources})
target_link_libraries(gnuradio-filter ${filter_libs})
GR_LIBRARY_FOO(gnuradio-filter)
add_dependencies(gnuradio-filter
- filter_generated_includes filter_generated_swigs
+ filter_generated_swigs
gnuradio-runtime gnuradio-fft)
if(ENABLE_STATIC_LIBS)
@@ -139,7 +133,6 @@ if(ENABLE_STATIC_LIBS)
add_library(gnuradio-filter_static STATIC ${filter_sources})
add_dependencies(gnuradio-filter_static
- filter_generated_includes
gnuradio-runtime_static gnuradio-fft_static)
if(NOT WIN32)
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
index 895c77807..b85e97225 100644
--- a/gr-filter/lib/fir_filter.cc
+++ b/gr-filter/lib/fir_filter.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,703 +20,169 @@
* Boston, MA 02110-1301, USA.
*/
-#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/fft/fft.h>
-#include <volk/volk.h>
#include <cstdio>
#include <cstring>
+#include <gnuradio/fft/fft.h>
+#include <gnuradio/filter/fir_filter.h>
+#include <volk/volk.h>
namespace gr {
- namespace filter {
- namespace kernel {
-
- fir_filter_fff::fir_filter_fff(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (float*)volk_malloc(1*sizeof(float), d_align);
- }
-
- fir_filter_fff::~fir_filter_fff()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fff::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps!= NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fff::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_fff::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fff::ntaps() const
- {
- return d_ntaps;
- }
-
- float
- fir_filter_fff::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32f_x2_dot_prod_32f_a(d_output, ar,
- d_aligned_taps[al],
- d_ntaps+al);
- return *d_output;
- }
-
- void
- fir_filter_fff::filterN(float output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++) {
- output[i] = filter(&input[i]);
- }
- }
-
- void
- fir_filter_fff::filterNdec(float output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++) {
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_ccf::fir_filter_ccf(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_ccf::~fir_filter_ccf()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_ccf::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_ccf::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_ccf::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_ccf::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_ccf::filter(const gr_complex input[])
- {
- const gr_complex *ar = (gr_complex *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_32f_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_ccf::filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_ccf::filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
-
- /**************************************************************/
-
-
- fir_filter_fcc::fir_filter_fcc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_fcc::~fir_filter_fcc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fcc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fcc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
-
- std::vector<gr_complex>
- fir_filter_fcc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fcc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_fcc::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_32f_dot_prod_32fc_a(d_output,
- d_aligned_taps[al],
- ar,
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_fcc::filterN(gr_complex output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_fcc::filterNdec(gr_complex output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_ccc::fir_filter_ccc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(gr_complex));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_ccc::~fir_filter_ccc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_ccc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_ccc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<gr_complex>
- fir_filter_ccc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_ccc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_ccc::filter(const gr_complex input[])
- {
- const gr_complex *ar = (gr_complex *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32fc_x2_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
- return *d_output;
- }
-
- void
- fir_filter_ccc::filterN(gr_complex output[],
- const gr_complex input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_ccc::filterNdec(gr_complex output[],
- const gr_complex input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_scc::fir_filter_scc(int decimation,
- const std::vector<gr_complex> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(short));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (gr_complex*)volk_malloc(1*sizeof(gr_complex), d_align);
- }
-
- fir_filter_scc::~fir_filter_scc()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_scc::set_taps(const std::vector<gr_complex> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (gr_complex*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(gr_complex), d_align);
- memset(d_aligned_taps[i], 0, sizeof(gr_complex)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_scc::update_tap(gr_complex t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<gr_complex>
- fir_filter_scc::taps() const
- {
- std::vector<gr_complex> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_scc::ntaps() const
- {
- return d_ntaps;
- }
-
- gr_complex
- fir_filter_scc::filter(const short input[])
- {
- const short *ar = (short *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_16i_32fc_dot_prod_32fc_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
-
- return *d_output;
- }
-
- void
- fir_filter_scc::filterN(gr_complex output[],
- const short input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
-
- void
- fir_filter_scc::filterNdec(gr_complex output[],
- const short input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- /**************************************************************/
-
- fir_filter_fsf::fir_filter_fsf(int decimation,
- const std::vector<float> &taps)
- {
- d_align = volk_get_alignment();
- d_naligned = std::max((size_t)1, d_align / sizeof(float));
-
- d_aligned_taps = NULL;
- set_taps(taps);
-
- // Make sure the output sample is always aligned, too.
- d_output = (short*)volk_malloc(1*sizeof(short), d_align);
- }
-
- fir_filter_fsf::~fir_filter_fsf()
- {
- // Free all aligned taps
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- // Free output sample
- volk_free(d_output);
- }
-
- void
- fir_filter_fsf::set_taps(const std::vector<float> &taps)
- {
- // Free the taps if already allocated
- if(d_aligned_taps != NULL) {
- for(int i = 0; i < d_naligned; i++) {
- volk_free(d_aligned_taps[i]);
- }
- ::free(d_aligned_taps);
- d_aligned_taps = NULL;
- }
-
- d_ntaps = (int)taps.size();
- d_taps = taps;
- std::reverse(d_taps.begin(), d_taps.end());
-
- // Make a set of taps at all possible arch alignments
- d_aligned_taps = (float**)malloc(d_naligned*sizeof(float*));
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i] = (float*)volk_malloc((d_ntaps+d_naligned-1)*sizeof(float), d_align);
- memset(d_aligned_taps[i], 0, sizeof(float)*(d_ntaps+d_naligned-1));
- for(unsigned int j = 0; j < d_ntaps; j++)
- d_aligned_taps[i][i+j] = d_taps[j];
- }
- }
-
- void
- fir_filter_fsf::update_tap(float t, unsigned int index)
- {
- d_taps[index] = t;
- for(int i = 0; i < d_naligned; i++) {
- d_aligned_taps[i][i+index] = t;
- }
- }
-
- std::vector<float>
- fir_filter_fsf::taps() const
- {
- std::vector<float> t = d_taps;
- std::reverse(t.begin(), t.end());
- return t;
- }
-
- unsigned int
- fir_filter_fsf::ntaps() const
- {
- return d_ntaps;
- }
-
- short
- fir_filter_fsf::filter(const float input[])
- {
- const float *ar = (float *)((size_t) input & ~(d_align-1));
- unsigned al = input - ar;
-
- volk_32f_x2_dot_prod_16i_a(d_output, ar,
- d_aligned_taps[al],
- (d_ntaps+al));
-
- return *d_output;
- }
-
- void
- fir_filter_fsf::filterN(short output[],
- const float input[],
- unsigned long n)
- {
- for(unsigned long i = 0; i < n; i++)
- output[i] = filter(&input[i]);
- }
-
- void
- fir_filter_fsf::filterNdec(short output[],
- const float input[],
- unsigned long n,
- unsigned int decimate)
- {
- unsigned long j = 0;
- for(unsigned long i = 0; i < n; i++){
- output[i] = filter(&input[j]);
- j += decimate;
- }
- }
-
- } /* namespace kernel */
- } /* namespace filter */
+namespace filter {
+namespace kernel {
+
+template <class IN_T, class OUT_T, class TAP_T>
+fir_filter<IN_T, OUT_T, TAP_T>::fir_filter(int decimation, const std::vector<TAP_T>& taps) {
+ d_align = volk_get_alignment();
+ d_naligned = std::max((size_t)1, d_align / sizeof(IN_T));
+
+ d_aligned_taps = NULL;
+ set_taps(taps);
+
+ // Make sure the output sample is always aligned, too.
+ d_output = (OUT_T*)volk_malloc(1 * sizeof(OUT_T), d_align);
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+fir_filter<IN_T, OUT_T, TAP_T>::~fir_filter() {
+ // Free all aligned taps
+ if (d_aligned_taps != NULL) {
+ for (int i = 0; i < d_naligned; i++) {
+ volk_free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ // Free output sample
+ volk_free(d_output);
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::set_taps(const std::vector<TAP_T>& taps) {
+ // Free the taps if already allocated
+ if (d_aligned_taps != NULL) {
+ for (int i = 0; i < d_naligned; i++) {
+ volk_free(d_aligned_taps[i]);
+ }
+ ::free(d_aligned_taps);
+ d_aligned_taps = NULL;
+ }
+
+ d_ntaps = (int)taps.size();
+ d_taps = taps;
+ std::reverse(d_taps.begin(), d_taps.end());
+
+ // Make a set of taps at all possible arch alignments
+ d_aligned_taps = (TAP_T**)malloc(d_naligned * sizeof(TAP_T*));
+ for (int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i] =
+ (TAP_T*)volk_malloc((d_ntaps + d_naligned - 1) * sizeof(TAP_T), d_align);
+ memset(d_aligned_taps[i], 0, sizeof(TAP_T) * (d_ntaps + d_naligned - 1));
+ for (unsigned int j = 0; j < d_ntaps; j++)
+ d_aligned_taps[i][i + j] = d_taps[j];
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::update_tap(TAP_T t, unsigned int index) {
+ d_taps[index] = t;
+ for (int i = 0; i < d_naligned; i++) {
+ d_aligned_taps[i][i + index] = t;
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+std::vector<TAP_T> fir_filter<IN_T, OUT_T, TAP_T>::taps() const {
+ std::vector<TAP_T> t = d_taps;
+ std::reverse(t.begin(), t.end());
+ return t;
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+unsigned int fir_filter<IN_T, OUT_T, TAP_T>::ntaps() const {
+ return d_ntaps;
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T, OUT_T, TAP_T>::filterN(OUT_T output[], const IN_T input[], unsigned long n) {
+ for (unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[i]);
+ }
+}
+
+template <class IN_T, class OUT_T, class TAP_T>
+void fir_filter<IN_T,OUT_T,TAP_T>::filterNdec(OUT_T output[],
+ const IN_T input[],
+ unsigned long n,
+ unsigned int decimate) {
+ unsigned long j = 0;
+ for (unsigned long i = 0; i < n; i++) {
+ output[i] = filter(&input[j]);
+ j += decimate;
+ }
+}
+
+template <>
+float fir_filter<float, float, float>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_32f_a(d_output, ar, d_aligned_taps[al], d_ntaps + al);
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<gr_complex, gr_complex, float>::filter(const gr_complex input[]) {
+ const gr_complex* ar = (gr_complex*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<float, gr_complex, gr_complex>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_32f_dot_prod_32fc_a(d_output, d_aligned_taps[al], ar, (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<gr_complex, gr_complex, gr_complex>::filter(const gr_complex input[]) {
+ const gr_complex* ar = (gr_complex*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32fc_x2_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+ return *d_output;
+}
+
+template <>
+gr_complex fir_filter<std::int16_t, gr_complex, gr_complex>::filter(const std::int16_t input[]) {
+ const std::int16_t* ar = (std::int16_t*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_16i_32fc_dot_prod_32fc_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+
+ return *d_output;
+}
+
+template <>
+short fir_filter<float, std::int16_t, float>::filter(const float input[]) {
+ const float* ar = (float*)((size_t)input & ~(d_align - 1));
+ unsigned al = input - ar;
+
+ volk_32f_x2_dot_prod_16i_a(d_output, ar, d_aligned_taps[al], (d_ntaps + al));
+
+ return *d_output;
+}
+ template class fir_filter<float, float, float>;
+ template class fir_filter<gr_complex, gr_complex, float>;
+ template class fir_filter<float, gr_complex, gr_complex>;
+ template class fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class fir_filter<std::int16_t, gr_complex, gr_complex>;
+ template class fir_filter<float, std::int16_t, float>;
+} /* namespace kernel */
+} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/fir_filter_XXX_impl.cc.t b/gr-filter/lib/fir_filter_XXX_impl.cc.t
deleted file mode 100644
index 4a112a218..000000000
--- a/gr-filter/lib/fir_filter_XXX_impl.cc.t
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int decimation, const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
- (decimation, taps));
- }
-
-
- @IMPL_NAME@::@IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps)
- : sync_decimator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
- decimation)
- {
- d_fir = new kernel::@BASE_NAME@(decimation, taps);
- d_updated = false;
- set_history(d_fir->ntaps());
-
- const int alignment_multiple =
- volk_get_alignment() / sizeof(float);
- set_alignment(std::max(1, alignment_multiple));
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- delete d_fir;
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- gr::thread::scoped_lock l(d_setlock);
- d_fir->set_taps(taps);
- d_updated = true;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_fir->taps();
- }
-
- int
- @IMPL_NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- gr::thread::scoped_lock l(d_setlock);
-
- const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
-
- if (d_updated) {
- set_history(d_fir->ntaps());
- d_updated = false;
- return 0; // history requirements may have changed.
- }
-
- if (decimation() == 1) {
- d_fir->filterN(out, in, noutput_items);
- }
- else {
- d_fir->filterNdec(out, in, noutput_items,
- decimation());
- }
-
- return noutput_items;
- }
-
- } /* namespace filter */
-} /* namespace gr */
-
diff --git a/gr-filter/lib/fir_filter_blk_impl.cc b/gr-filter/lib/fir_filter_blk_impl.cc
new file mode 100644
index 000000000..2ffa62e59
--- /dev/null
+++ b/gr-filter/lib/fir_filter_blk_impl.cc
@@ -0,0 +1,115 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "fir_filter_blk_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename fir_filter_blk<IN_T,OUT_T,TAP_T>::sptr
+ fir_filter_blk<IN_T,OUT_T,TAP_T>::make(int decimation, const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr(new fir_filter_blk_impl<IN_T,OUT_T,TAP_T>
+ (decimation, taps));
+ }
+
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::fir_filter_blk_impl(int decimation, const std::vector<TAP_T> &taps)
+ : sync_decimator("fir_filter_blk<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
+ decimation)
+ {
+ d_fir = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(decimation, taps);
+ d_updated = false;
+ this->set_history(d_fir->ntaps());
+
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ this->set_alignment(std::max(1, alignment_multiple));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::~fir_filter_blk_impl()
+ {
+ delete d_fir;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ gr::thread::scoped_lock l(this->d_setlock);
+ d_fir->set_taps(taps);
+ d_updated = true;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_fir->taps();
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ fir_filter_blk_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr::thread::scoped_lock l(this->d_setlock);
+
+ const IN_T *in = (const IN_T*)input_items[0];
+ OUT_T *out = (OUT_T*)output_items[0];
+
+ if (d_updated) {
+ this->set_history(d_fir->ntaps());
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ if (this->decimation() == 1) {
+ d_fir->filterN(out, in, noutput_items);
+ }
+ else {
+ d_fir->filterNdec(out, in, noutput_items,
+ this->decimation());
+ }
+
+ return noutput_items;
+ }
+ template class fir_filter_blk<gr_complex, gr_complex, gr_complex>;
+ template class fir_filter_blk<gr_complex, gr_complex, float>;
+ template class fir_filter_blk<float, gr_complex, gr_complex>;
+ template class fir_filter_blk<float, float, float>;
+ template class fir_filter_blk<float, std::int16_t, float>;
+ template class fir_filter_blk<std::int16_t, gr_complex, gr_complex>;
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fir_filter_XXX_impl.h.t b/gr-filter/lib/fir_filter_blk_impl.h
index 3678d82ac..03faaebf2 100644
--- a/gr-filter/lib/fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/fir_filter_blk_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,30 +20,29 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FIR_FILTER_BLK_IMPL_H
+#define FIR_FILTER_BLK_IMPL_H
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/fir_filter_blk.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API fir_filter_blk_impl : public fir_filter_blk<IN_T, OUT_T, TAP_T>
{
private:
- kernel::@BASE_NAME@ *d_fir;
+ kernel::fir_filter<IN_T, OUT_T, TAP_T> *d_fir;
bool d_updated;
public:
- @IMPL_NAME@(int decimation, const std::vector<@TAP_TYPE@> &taps);
+ fir_filter_blk_impl(int decimation, const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~fir_filter_blk_impl();
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -53,4 +52,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FIR_FILTER_BLK_IMPL_H */
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_impl.cc
index fc6ede2bb..5a858c3d1 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_impl.cc
@@ -20,16 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include "@IMPL_NAME@.h"
+#include "freq_xlating_fir_filter_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/math.h>
#include <volk/volk.h>
@@ -37,49 +32,53 @@
namespace gr {
namespace filter {
- @BASE_NAME@::sptr
- @BASE_NAME@::make(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>::sptr
+ freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>::make(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq)
{
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
+ return gnuradio::get_initial_sptr(new freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>
(decimation, taps,
center_freq,
sampling_freq));
}
- @IMPL_NAME@::@IMPL_NAME@(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ template <class IN_T, class OUT_T, class TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::freq_xlating_fir_filter_impl(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq)
- : sync_decimator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
+ : sync_decimator("freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
decimation),
d_proto_taps(taps), d_center_freq(center_freq),
d_sampling_freq(sampling_freq),
d_updated(false)
{
std::vector<gr_complex> dummy_taps;
- d_composite_fir = new kernel::@CFIR_TYPE@(decimation, dummy_taps);
+ d_composite_fir = new kernel::fir_filter<IN_T,OUT_T,gr_complex>(decimation, dummy_taps);
- set_history(d_proto_taps.size());
- build_composite_fir();
+ this->set_history(this->d_proto_taps.size());
+ this->build_composite_fir();
- message_port_register_in(pmt::mp("freq"));
- set_msg_handler(pmt::mp("freq"),
- boost::bind(&@IMPL_NAME@::handle_set_center_freq,
+ this->message_port_register_in(pmt::mp("freq"));
+ this->set_msg_handler(pmt::mp("freq"),
+ boost::bind(&freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::handle_set_center_freq,
this, _1));
}
- @IMPL_NAME@::~@IMPL_NAME@()
+ template <class IN_T, class OUT_T, class TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::~freq_xlating_fir_filter_impl()
{
delete d_composite_fir;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::build_composite_fir()
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::build_composite_fir()
{
std::vector<gr_complex> ctaps(d_proto_taps.size());
@@ -97,37 +96,42 @@ namespace gr {
}
d_composite_fir->set_taps(ctaps);
- d_r.set_phase_incr(exp(gr_complex(0, -fwT0 * decimation())));
+ d_r.set_phase_incr(exp(gr_complex(0, -fwT0 * this->decimation())));
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::set_center_freq(double center_freq)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_center_freq(double center_freq)
{
d_center_freq = center_freq;
d_updated = true;
}
+ template <class IN_T, class OUT_T, class TAP_T>
double
- @IMPL_NAME@::center_freq() const
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::center_freq() const
{
return d_center_freq;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
{
d_proto_taps = taps;
d_updated = true;
}
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::taps() const
{
return d_proto_taps;
}
+ template <class IN_T, class OUT_T, class TAP_T>
void
- @IMPL_NAME@::handle_set_center_freq(pmt::pmt_t msg)
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::handle_set_center_freq(pmt::pmt_t msg)
{
if(pmt::is_dict(msg) && pmt::dict_has_key(msg, pmt::intern("freq")) ) {
pmt::pmt_t x = pmt::dict_ref(msg, pmt::intern("freq"), pmt::PMT_NIL );
@@ -144,35 +148,43 @@ namespace gr {
}
}
+ template <class IN_T, class OUT_T, class TAP_T>
int
- @IMPL_NAME@::work(int noutput_items,
+ freq_xlating_fir_filter_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
- @I_TYPE@ *in = (@I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
+ IN_T *in = (IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
// rebuild composite FIR if the center freq has changed
if(d_updated) {
- set_history(d_proto_taps.size());
+ this->set_history(d_proto_taps.size());
build_composite_fir();
d_updated = false;
// Tell downstream items where the frequency change was applied
- add_item_tag(0, nitems_written(0),
+ this->add_item_tag(0, this->nitems_written(0),
pmt::intern("freq"), pmt::from_double(d_center_freq),
- alias_pmt());
+ this->alias_pmt());
return 0; // history requirements may have changed.
}
unsigned j = 0;
for (int i = 0; i < noutput_items; i++){
out[i] = d_r.rotate(d_composite_fir->filter(&in[j]));
- j += decimation();
+ j += this->decimation();
}
return noutput_items;
}
+ template class freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class freq_xlating_fir_filter<gr_complex, gr_complex, float>;
+ template class freq_xlating_fir_filter<float, gr_complex, gr_complex>;
+ template class freq_xlating_fir_filter<float, gr_complex, float>;
+ template class freq_xlating_fir_filter<std::int16_t, gr_complex, float>;
+ template class freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex>;
+
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t b/gr-filter/lib/freq_xlating_fir_filter_impl.h
index bd7aced6f..176b57f93 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2004,2012 Free Software Foundation, Inc.
+ * Copyright 2002,2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,27 +20,23 @@
* Boston, MA 02110-1301, USA.
*/
-/*
- * WARNING: This file is automatically generated by cmake.
- * Any changes made to this file will be overwritten.
- */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef FREQ_XLATING_FIR_FILTER_IMPL_H
+#define FREQ_XLATING_FIR_FILTER_IMPL_H
#include <gnuradio/filter/api.h>
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/freq_xlating_fir_filter.h>
#include <gnuradio/blocks/rotator.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API freq_xlating_fir_filter_impl : public freq_xlating_fir_filter<IN_T,OUT_T,TAP_T>
{
protected:
- std::vector<@TAP_TYPE@> d_proto_taps;
- kernel::@CFIR_TYPE@ *d_composite_fir;
+ std::vector<TAP_T> d_proto_taps;
+ kernel::fir_filter<IN_T, OUT_T, gr_complex> *d_composite_fir;
blocks::rotator d_r;
double d_center_freq;
double d_sampling_freq;
@@ -49,17 +45,17 @@ namespace gr {
virtual void build_composite_fir();
public:
- @IMPL_NAME@(int decimation,
- const std::vector<@TAP_TYPE@> &taps,
+ freq_xlating_fir_filter_impl(int decimation,
+ const std::vector<TAP_T> &taps,
double center_freq,
double sampling_freq);
- virtual ~@IMPL_NAME@();
+ virtual ~freq_xlating_fir_filter_impl();
void set_center_freq(double center_freq);
double center_freq() const;
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
void handle_set_center_freq(pmt::pmt_t msg);
@@ -71,4 +67,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* FREQ_XLATING_FIR_FILTER_IMPL_H */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t b/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
deleted file mode 100644
index 507322b21..000000000
--- a/gr-filter/lib/interp_fir_filter_XXX_impl.cc.t
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include <stdexcept>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr(new @IMPL_NAME@
- (interpolation, taps));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps)
- : sync_interpolator("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@)),
- interpolation),
- d_updated(false), d_firs(interpolation)
- {
- if(interpolation == 0) {
- throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0\n");
- }
-
- if(taps.size() == 0) {
- throw std::runtime_error("@IMPL_NAME@: no filter taps provided.\n");
- }
-
- std::vector<@TAP_TYPE@> dummy_taps;
-
- for(unsigned i = 0; i < interpolation; i++) {
- d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
- }
-
- set_taps(taps);
- install_taps(d_new_taps);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- for(unsigned i = 0; i < interpolation(); i++) {
- delete d_firs[i];
- }
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- d_new_taps = taps;
- d_updated = true;
-
- // round up length to a multiple of the interpolation factor
- int n = taps.size() % interpolation();
- if(n > 0) {
- n = interpolation() - n;
- while(n-- > 0) {
- d_new_taps.insert(d_new_taps.end(), 0);
- }
- }
-
- if(d_new_taps.size() % interpolation() != 0) {
- throw std::runtime_error("@IMPL_NAME@: error setting interpolator taps.\n");
- }
- }
-
- void
- @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- unsigned nfilters = interpolation();
- int nt = taps.size() / nfilters;
-
- std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
-
- for(unsigned n = 0; n < nfilters; n++) {
- xtaps[n].resize (nt);
- }
-
- for(size_t i = 0; i < taps.size(); i++) {
- xtaps[i % nfilters][i / nfilters] = taps[i];
- }
-
- for(unsigned n = 0; n < nfilters; n++) {
- d_firs[n]->set_taps (xtaps[n]);
- }
-
- set_history(nt);
- d_updated = false;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_new_taps;
- }
-
- int
- @NAME@::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
-
- if(d_updated) {
- install_taps(d_new_taps);
- return 0; // history requirements may have changed.
- }
-
- int nfilters = interpolation();
- int ni = noutput_items / interpolation();
-
- for(int i = 0; i < ni; i++) {
- for(int nf = 0; nf < nfilters; nf++) {
- out[nf] = d_firs[nf]->filter(&in[i]);
- }
- out += nfilters;
- }
-
- return noutput_items;
- }
-
- } /* namespace filter */
-} /* namespace gr */
diff --git a/gr-filter/lib/interp_fir_filter_impl.cc b/gr-filter/lib/interp_fir_filter_impl.cc
new file mode 100644
index 000000000..a7020ce65
--- /dev/null
+++ b/gr-filter/lib/interp_fir_filter_impl.cc
@@ -0,0 +1,167 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "interp_fir_filter_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename interp_fir_filter<IN_T,OUT_T,TAP_T>::sptr
+ interp_fir_filter<IN_T,OUT_T,TAP_T>::make(unsigned interpolation,
+ const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr(new interp_fir_filter_impl<IN_T,OUT_T,TAP_T>
+ (interpolation, taps));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::interp_fir_filter_impl(unsigned interpolation,
+ const std::vector<TAP_T> &taps)
+ : sync_interpolator("interp_fir_filter<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T)),
+ interpolation),
+ d_updated(false), d_firs(interpolation)
+ {
+ if(interpolation == 0) {
+ throw std::out_of_range("interp_fir_filter_impl: interpolation must be > 0\n");
+ }
+
+ if(taps.size() == 0) {
+ throw std::runtime_error("interp_fir_filter_impl: no filter taps provided.\n");
+ }
+
+ std::vector<TAP_T> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::~interp_fir_filter_impl()
+ {
+ for(unsigned i = 0; i < this->interpolation(); i++) {
+ delete d_firs[i];
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % this->interpolation();
+ if(n > 0) {
+ n = this->interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.end(), 0);
+ }
+ }
+
+ if(d_new_taps.size() % this->interpolation() != 0) {
+ throw std::runtime_error("interp_fir_filter_impl: error setting interpolator taps.\n");
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::install_taps(const std::vector<TAP_T> &taps)
+ {
+ unsigned nfilters = this->interpolation();
+ int nt = taps.size() / nfilters;
+
+ std::vector< std::vector <TAP_T> > xtaps(nfilters);
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ xtaps[n].resize (nt);
+ }
+
+ for(size_t i = 0; i < taps.size(); i++) {
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+ }
+
+ for(unsigned n = 0; n < nfilters; n++) {
+ d_firs[n]->set_taps (xtaps[n]);
+ }
+
+ this->set_history(nt);
+ d_updated = false;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_new_taps;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ interp_fir_filter_impl<IN_T,OUT_T,TAP_T>::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const IN_T *in = (const IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirements may have changed.
+ }
+
+ int nfilters = this->interpolation();
+ int ni = noutput_items / this->interpolation();
+
+ for(int i = 0; i < ni; i++) {
+ for(int nf = 0; nf < nfilters; nf++) {
+ out[nf] = d_firs[nf]->filter(&in[i]);
+ }
+ out += nfilters;
+ }
+
+ return noutput_items;
+ }
+ template class interp_fir_filter<gr_complex, gr_complex, gr_complex>;
+ template class interp_fir_filter<gr_complex, gr_complex, float>;
+ template class interp_fir_filter<float, gr_complex, gr_complex>;
+ template class interp_fir_filter<float, float, float>;
+ template class interp_fir_filter<float, std::int16_t, float>;
+ template class interp_fir_filter<std::int16_t, gr_complex, gr_complex>;
+
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t b/gr-filter/lib/interp_fir_filter_impl.h
index 0e39de613..0ebcc19ed 100644
--- a/gr-filter/lib/interp_fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/interp_fir_filter_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2012 Free Software Foundation, Inc.
+ * Copyright 2004,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,36 +20,35 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef INTERP_FIR_FILTER_IMPL_H
+#define INTERP_FIR_FILTER_IMPL_H
#include <gnuradio/filter/api.h>
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/interp_fir_filter.h>
#include <vector>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API interp_fir_filter_impl : public interp_fir_filter<IN_T,OUT_T,TAP_T>
{
private:
bool d_updated;
- std::vector<kernel::@FIR_TYPE@ *> d_firs;
- std::vector<@TAP_TYPE@> d_new_taps;
+ std::vector< kernel::fir_filter<IN_T,OUT_T,TAP_T> *> d_firs;
+ std::vector<TAP_T> d_new_taps;
- void install_taps(const std::vector<@TAP_TYPE@> &taps);
+ void install_taps(const std::vector<TAP_T> &taps);
public:
- @IMPL_NAME@(unsigned interpolation,
- const std::vector<@TAP_TYPE@> &taps);
+ interp_fir_filter_impl(unsigned interpolation,
+ const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~interp_fir_filter_impl();
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
int work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -59,4 +58,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* INTERP_FIR_FILTER_IMPL_H */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t b/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
deleted file mode 100644
index 0b74e6096..000000000
--- a/gr-filter/lib/rational_resampler_base_XXX_impl.cc.t
+++ /dev/null
@@ -1,176 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2012 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-/* @WARNING@ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "@IMPL_NAME@.h"
-#include <gnuradio/io_signature.h>
-#include <volk/volk.h>
-#include <stdexcept>
-
-namespace gr {
- namespace filter {
-
- @BASE_NAME@::sptr
- @BASE_NAME@::make(unsigned interpolation,
- unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps)
- {
- return gnuradio::get_initial_sptr
- (new @IMPL_NAME@(interpolation, decimation, taps));
- }
-
- @IMPL_NAME@::@IMPL_NAME@(unsigned interpolation,
- unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps)
- : block("@BASE_NAME@",
- io_signature::make(1, 1, sizeof(@I_TYPE@)),
- io_signature::make(1, 1, sizeof(@O_TYPE@))),
- d_history(1),
- d_interpolation(interpolation),
- d_decimation(decimation),
- d_ctr(0),
- d_firs(interpolation),
- d_updated(false)
- {
- if(interpolation == 0)
- throw std::out_of_range("@IMPL_NAME@: interpolation must be > 0");
- if(decimation == 0)
- throw std::out_of_range("@IMPL_NAME@: decimation must be > 0");
-
- set_relative_rate(1.0 * interpolation / decimation);
- set_output_multiple(1);
-
- std::vector<@TAP_TYPE@> dummy_taps;
-
- for(unsigned i = 0; i < interpolation; i++) {
- d_firs[i] = new kernel::@FIR_TYPE@(1, dummy_taps);
- }
-
- set_taps(taps);
- install_taps(d_new_taps);
- }
-
- @IMPL_NAME@::~@IMPL_NAME@()
- {
- int interp = interpolation();
- for(int i = 0; i < interp; i++) {
- delete d_firs[i];
- }
- }
-
- void
- @IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- d_new_taps = taps;
- d_updated = true;
-
- // round up length to a multiple of the interpolation factor
- int n = taps.size() % interpolation();
- if(n > 0) {
- n = interpolation() - n;
- while(n-- > 0) {
- d_new_taps.insert(d_new_taps.end(), 0);
- }
- }
-
- assert(d_new_taps.size() % interpolation() == 0);
- }
-
- void
- @IMPL_NAME@::install_taps(const std::vector<@TAP_TYPE@> &taps)
- {
- int nfilters = interpolation();
- int nt = taps.size() / nfilters;
-
- assert(nt * nfilters == (int) taps.size());
-
- std::vector< std::vector <@TAP_TYPE@> > xtaps(nfilters);
-
- for(int n = 0; n < nfilters; n++)
- xtaps[n].resize (nt);
-
- for(int i = 0; i < (int)taps.size(); i++)
- xtaps[i % nfilters][i / nfilters] = taps[i];
-
- for(int n = 0; n < nfilters; n++)
- d_firs[n]->set_taps(xtaps[n]);
-
- set_history(nt);
- d_updated = false;
- }
-
- std::vector<@TAP_TYPE@>
- @IMPL_NAME@::taps() const
- {
- return d_new_taps;
- }
-
- void
- @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
- {
- int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * \
- decimation() / interpolation()) + history() - 1);
- unsigned ninputs = ninput_items_required.size();
- for(unsigned i = 0; i < ninputs; i++)
- ninput_items_required[i] = nreqd;
- }
-
- int
- @IMPL_NAME@::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
- {
- const @I_TYPE@ *in = (const @I_TYPE@ *)input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *)output_items[0];
-
- if(d_updated) {
- install_taps(d_new_taps);
- return 0; // history requirement may have increased.
- }
-
- unsigned int ctr = d_ctr;
- int count = 0;
-
- int i = 0;
- while((i < noutput_items) && (count < ninput_items[0])) {
- out[i++] = d_firs[ctr]->filter(in);
- ctr += decimation();
- while(ctr >= interpolation()) {
- ctr -= interpolation();
- in++;
- count++;
- }
- }
-
- d_ctr = ctr;
- consume_each(count);
- return i;
- }
-
- } /* namespace filter */
-} /* namespace gr */
diff --git a/gr-filter/lib/rational_resampler_base_impl.cc b/gr-filter/lib/rational_resampler_base_impl.cc
new file mode 100644
index 000000000..133f62e3f
--- /dev/null
+++ b/gr-filter/lib/rational_resampler_base_impl.cc
@@ -0,0 +1,188 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012,2018 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "rational_resampler_base_impl.h"
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include <stdexcept>
+
+namespace gr {
+ namespace filter {
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ typename rational_resampler_base<IN_T,OUT_T,TAP_T>::sptr
+ rational_resampler_base<IN_T,OUT_T,TAP_T>::make(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<TAP_T> &taps)
+ {
+ return gnuradio::get_initial_sptr
+ (new rational_resampler_base_impl<IN_T,OUT_T,TAP_T>(interpolation, decimation, taps));
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::rational_resampler_base_impl(unsigned interpolation,
+ unsigned decimation,
+ const std::vector<TAP_T> &taps)
+ : block("rational_resampler_base<IN_T,OUT_T,TAP_T>",
+ io_signature::make(1, 1, sizeof(IN_T)),
+ io_signature::make(1, 1, sizeof(OUT_T))),
+ d_history(1),
+ d_interpolation(interpolation),
+ d_decimation(decimation),
+ d_ctr(0),
+ d_firs(interpolation),
+ d_updated(false)
+ {
+ if(interpolation == 0)
+ throw std::out_of_range("rational_resampler_base_impl<IN_T,OUT_T,TAP_T>: interpolation must be > 0");
+ if(decimation == 0)
+ throw std::out_of_range("rational_resampler_base_impl<IN_T,OUT_T,TAP_T>: decimation must be > 0");
+
+ this->set_relative_rate(1.0 * interpolation / decimation);
+ this->set_output_multiple(1);
+
+ std::vector<TAP_T> dummy_taps;
+
+ for(unsigned i = 0; i < interpolation; i++) {
+ d_firs[i] = new kernel::fir_filter<IN_T,OUT_T,TAP_T>(1, dummy_taps);
+ }
+
+ set_taps(taps);
+ install_taps(d_new_taps);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::~rational_resampler_base_impl()
+ {
+ int interp = this->interpolation();
+ for(int i = 0; i < interp; i++) {
+ delete d_firs[i];
+ }
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::set_taps(const std::vector<TAP_T> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+
+ // round up length to a multiple of the interpolation factor
+ int n = taps.size() % this->interpolation();
+ if(n > 0) {
+ n = this->interpolation() - n;
+ while(n-- > 0) {
+ d_new_taps.insert(d_new_taps.end(), 0);
+ }
+ }
+
+ assert(d_new_taps.size() % this->interpolation() == 0);
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::install_taps(const std::vector<TAP_T> &taps)
+ {
+ int nfilters = this->interpolation();
+ int nt = taps.size() / nfilters;
+
+ assert(nt * nfilters == (int) taps.size());
+
+ std::vector< std::vector <TAP_T> > xtaps(nfilters);
+
+ for(int n = 0; n < nfilters; n++)
+ xtaps[n].resize (nt);
+
+ for(int i = 0; i < (int)taps.size(); i++)
+ xtaps[i % nfilters][i / nfilters] = taps[i];
+
+ for(int n = 0; n < nfilters; n++)
+ d_firs[n]->set_taps(xtaps[n]);
+
+ set_history(nt);
+ d_updated = false;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ std::vector<TAP_T>
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::taps() const
+ {
+ return d_new_taps;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ void
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ int nreqd = std::max((unsigned)1, (int)((double) (noutput_items+1) * \
+ this->decimation() / this->interpolation()) + history() - 1);
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned i = 0; i < ninputs; i++)
+ ninput_items_required[i] = nreqd;
+ }
+
+ template <class IN_T, class OUT_T, class TAP_T>
+ int
+ rational_resampler_base_impl<IN_T,OUT_T,TAP_T>::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const IN_T *in = (const IN_T *)input_items[0];
+ OUT_T *out = (OUT_T *)output_items[0];
+
+ if(d_updated) {
+ install_taps(d_new_taps);
+ return 0; // history requirement may have increased.
+ }
+
+ unsigned int ctr = d_ctr;
+ int count = 0;
+
+ int i = 0;
+ while((i < noutput_items) && (count < ninput_items[0])) {
+ out[i++] = d_firs[ctr]->filter(in);
+ ctr += this->decimation();
+ while(ctr >= this->interpolation()) {
+ ctr -= this->interpolation();
+ in++;
+ count++;
+ }
+ }
+
+ d_ctr = ctr;
+ this->consume_each(count);
+ return i;
+ }
+ template class rational_resampler_base<gr_complex, gr_complex, gr_complex>;
+ template class rational_resampler_base<gr_complex, gr_complex, float>;
+ template class rational_resampler_base<float, gr_complex, gr_complex>;
+ template class rational_resampler_base<float, float, float>;
+ template class rational_resampler_base<float, std::int16_t, float>;
+ template class rational_resampler_base<std::int16_t, gr_complex, gr_complex>;
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t b/gr-filter/lib/rational_resampler_base_impl.h
index debd05909..a42d1b0fd 100644
--- a/gr-filter/lib/rational_resampler_base_XXX_impl.h.t
+++ b/gr-filter/lib/rational_resampler_base_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2012 Free Software Foundation, Inc.
+ * Copyright 2005,2012,2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,35 +20,34 @@
* Boston, MA 02110-1301, USA.
*/
-/* @WARNING@ */
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
+#ifndef RATIONAL_RESAMPLER_IMPL_BASE_H
+#define RATIONAL_RESAMPLER_IMPL_BASE_H
#include <gnuradio/filter/fir_filter.h>
-#include <gnuradio/filter/@BASE_NAME@.h>
+#include <gnuradio/filter/rational_resampler_base.h>
namespace gr {
namespace filter {
- class FILTER_API @IMPL_NAME@ : public @BASE_NAME@
+ template <class IN_T, class OUT_T, class TAP_T>
+ class FILTER_API rational_resampler_base_impl : public rational_resampler_base<IN_T,OUT_T,TAP_T>
{
private:
unsigned d_history;
unsigned d_interpolation;
unsigned d_decimation;
unsigned d_ctr;
- std::vector<@TAP_TYPE@> d_new_taps;
- std::vector<kernel::@FIR_TYPE@ *> d_firs;
+ std::vector<TAP_T> d_new_taps;
+ std::vector<kernel::fir_filter<IN_T,OUT_T,TAP_T> *> d_firs;
bool d_updated;
- void install_taps(const std::vector<@TAP_TYPE@> &taps);
+ void install_taps(const std::vector<TAP_T> &taps);
public:
- @IMPL_NAME@(unsigned interpolation, unsigned decimation,
- const std::vector<@TAP_TYPE@> &taps);
+ rational_resampler_base_impl(unsigned interpolation, unsigned decimation,
+ const std::vector<TAP_T> &taps);
- ~@IMPL_NAME@();
+ ~rational_resampler_base_impl();
unsigned history() const { return d_history; }
void set_history(unsigned history) { d_history = history; }
@@ -56,8 +55,8 @@ namespace gr {
unsigned interpolation() const { return d_interpolation; }
unsigned decimation() const { return d_decimation; }
- void set_taps(const std::vector<@TAP_TYPE@> &taps);
- std::vector<@TAP_TYPE@> taps() const;
+ void set_taps(const std::vector<TAP_T> &taps);
+ std::vector<TAP_T> taps() const;
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
@@ -69,4 +68,4 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-#endif /* @GUARD_NAME@ */
+#endif /* RATIONAL_RESAMPLER_IMPL_BASE_H */
diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt
index ee8389ddd..230873906 100644
--- a/gr-filter/swig/CMakeLists.txt
+++ b/gr-filter/swig/CMakeLists.txt
@@ -42,7 +42,6 @@ set(GR_SWIG_DOC_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../include/gnuradio/filter
)
set(GR_SWIG_DOCS_TARGET_DEPS runtime_swig_swig_doc)
-set(GR_SWIG_TARGET_DEPS filter_generated_includes)
set(GR_SWIG_LIBRARIES gnuradio-filter gnuradio-fft)
GR_SWIG_MAKE(filter_swig filter_swig.i)
diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i
index db0ad0fd9..939f03820 100644
--- a/gr-filter/swig/filter_swig.i
+++ b/gr-filter/swig/filter_swig.i
@@ -34,12 +34,7 @@
#include "gnuradio/filter/dc_blocker_ff.h"
#include "gnuradio/filter/filter_delay_fc.h"
#include "gnuradio/filter/filterbank_vcvcf.h"
-#include "gnuradio/filter/fir_filter_ccc.h"
-#include "gnuradio/filter/fir_filter_ccf.h"
-#include "gnuradio/filter/fir_filter_fcc.h"
-#include "gnuradio/filter/fir_filter_fff.h"
-#include "gnuradio/filter/fir_filter_fsf.h"
-#include "gnuradio/filter/fir_filter_scc.h"
+#include "gnuradio/filter/fir_filter_blk.h"
#include "gnuradio/filter/fft_filter_ccc.h"
#include "gnuradio/filter/fft_filter_ccf.h"
#include "gnuradio/filter/fft_filter_fff.h"
@@ -47,24 +42,14 @@
#include "gnuradio/filter/mmse_interpolator_ff.h"
#include "gnuradio/filter/mmse_resampler_cc.h"
#include "gnuradio/filter/mmse_resampler_ff.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_ccc.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_ccf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_fcc.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_fcf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_scf.h"
-#include "gnuradio/filter/freq_xlating_fir_filter_scc.h"
+#include "gnuradio/filter/freq_xlating_fir_filter.h"
#include "gnuradio/filter/hilbert_fc.h"
#include "gnuradio/filter/iir_filter_ffd.h"
#include "gnuradio/filter/iir_filter_ccc.h"
#include "gnuradio/filter/iir_filter_ccf.h"
#include "gnuradio/filter/iir_filter_ccd.h"
#include "gnuradio/filter/iir_filter_ccz.h"
-#include "gnuradio/filter/interp_fir_filter_ccc.h"
-#include "gnuradio/filter/interp_fir_filter_ccf.h"
-#include "gnuradio/filter/interp_fir_filter_fcc.h"
-#include "gnuradio/filter/interp_fir_filter_fff.h"
-#include "gnuradio/filter/interp_fir_filter_fsf.h"
-#include "gnuradio/filter/interp_fir_filter_scc.h"
+#include "gnuradio/filter/interp_fir_filter.h"
#include "gnuradio/filter/pfb_arb_resampler_ccf.h"
#include "gnuradio/filter/pfb_arb_resampler_ccc.h"
#include "gnuradio/filter/pfb_arb_resampler_fff.h"
@@ -72,12 +57,7 @@
#include "gnuradio/filter/pfb_decimator_ccf.h"
#include "gnuradio/filter/pfb_interpolator_ccf.h"
#include "gnuradio/filter/pfb_synthesizer_ccf.h"
-#include "gnuradio/filter/rational_resampler_base_ccc.h"
-#include "gnuradio/filter/rational_resampler_base_ccf.h"
-#include "gnuradio/filter/rational_resampler_base_fcc.h"
-#include "gnuradio/filter/rational_resampler_base_fff.h"
-#include "gnuradio/filter/rational_resampler_base_fsf.h"
-#include "gnuradio/filter/rational_resampler_base_scc.h"
+#include "gnuradio/filter/rational_resampler_base.h"
#include "gnuradio/filter/single_pole_iir_filter_cc.h"
#include "gnuradio/filter/single_pole_iir_filter_ff.h"
%}
@@ -88,12 +68,7 @@
%include "gnuradio/filter/dc_blocker_ff.h"
%include "gnuradio/filter/filter_delay_fc.h"
%include "gnuradio/filter/filterbank_vcvcf.h"
-%include "gnuradio/filter/fir_filter_ccc.h"
-%include "gnuradio/filter/fir_filter_ccf.h"
-%include "gnuradio/filter/fir_filter_fcc.h"
-%include "gnuradio/filter/fir_filter_fff.h"
-%include "gnuradio/filter/fir_filter_fsf.h"
-%include "gnuradio/filter/fir_filter_scc.h"
+%include "gnuradio/filter/fir_filter_blk.h"
%include "gnuradio/filter/fft_filter_ccc.h"
%include "gnuradio/filter/fft_filter_ccf.h"
%include "gnuradio/filter/fft_filter_fff.h"
@@ -101,24 +76,14 @@
%include "gnuradio/filter/mmse_interpolator_ff.h"
%include "gnuradio/filter/mmse_resampler_cc.h"
%include "gnuradio/filter/mmse_resampler_ff.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_ccc.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_ccf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_fcc.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_fcf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_scf.h"
-%include "gnuradio/filter/freq_xlating_fir_filter_scc.h"
+%include "gnuradio/filter/freq_xlating_fir_filter.h"
%include "gnuradio/filter/hilbert_fc.h"
%include "gnuradio/filter/iir_filter_ffd.h"
%include "gnuradio/filter/iir_filter_ccc.h"
%include "gnuradio/filter/iir_filter_ccf.h"
%include "gnuradio/filter/iir_filter_ccd.h"
%include "gnuradio/filter/iir_filter_ccz.h"
-%include "gnuradio/filter/interp_fir_filter_ccc.h"
-%include "gnuradio/filter/interp_fir_filter_ccf.h"
-%include "gnuradio/filter/interp_fir_filter_fcc.h"
-%include "gnuradio/filter/interp_fir_filter_fff.h"
-%include "gnuradio/filter/interp_fir_filter_fsf.h"
-%include "gnuradio/filter/interp_fir_filter_scc.h"
+%include "gnuradio/filter/interp_fir_filter.h"
%include "gnuradio/filter/pfb_arb_resampler_ccf.h"
%include "gnuradio/filter/pfb_arb_resampler_ccc.h"
%include "gnuradio/filter/pfb_arb_resampler_fff.h"
@@ -126,12 +91,7 @@
%include "gnuradio/filter/pfb_decimator_ccf.h"
%include "gnuradio/filter/pfb_interpolator_ccf.h"
%include "gnuradio/filter/pfb_synthesizer_ccf.h"
-%include "gnuradio/filter/rational_resampler_base_ccc.h"
-%include "gnuradio/filter/rational_resampler_base_ccf.h"
-%include "gnuradio/filter/rational_resampler_base_fcc.h"
-%include "gnuradio/filter/rational_resampler_base_fff.h"
-%include "gnuradio/filter/rational_resampler_base_fsf.h"
-%include "gnuradio/filter/rational_resampler_base_scc.h"
+%include "gnuradio/filter/rational_resampler_base.h"
%include "gnuradio/filter/single_pole_iir_filter_cc.h"
%include "gnuradio/filter/single_pole_iir_filter_ff.h"
@@ -139,12 +99,12 @@ GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_cc);
GR_SWIG_BLOCK_MAGIC2(filter, dc_blocker_ff);
GR_SWIG_BLOCK_MAGIC2(filter, filter_delay_fc);
GR_SWIG_BLOCK_MAGIC2(filter, filterbank_vcvcf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_ccc, fir_filter_blk<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_ccf, fir_filter_blk<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fcc, fir_filter_blk<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fff, fir_filter_blk<float, float, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_fsf, fir_filter_blk<float, std::int16_t, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, fir_filter_scc, fir_filter_blk<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_fff);
@@ -152,24 +112,24 @@ GR_SWIG_BLOCK_MAGIC2(filter, mmse_interpolator_cc);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_interpolator_ff);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_resampler_cc);
GR_SWIG_BLOCK_MAGIC2(filter, mmse_resampler_ff);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_fcf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scf);
-GR_SWIG_BLOCK_MAGIC2(filter, freq_xlating_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_ccc, freq_xlating_fir_filter<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_ccf, freq_xlating_fir_filter<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_fcc, freq_xlating_fir_filter<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_fcf, freq_xlating_fir_filter<float, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_scf, freq_xlating_fir_filter<std::int16_t, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, freq_xlating_fir_filter_scc, freq_xlating_fir_filter<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, hilbert_fc);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ffd);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccd);
GR_SWIG_BLOCK_MAGIC2(filter, iir_filter_ccz);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, interp_fir_filter_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_ccc, interp_fir_filter<gr_complex, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_ccf, interp_fir_filter<gr_complex, gr_complex, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fcc, interp_fir_filter<float, gr_complex, gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fff, interp_fir_filter<float, float, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_fsf, interp_fir_filter<float, std::int16_t, float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, interp_fir_filter_scc, interp_fir_filter<std::int16_t, gr_complex, gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_arb_resampler_fff);
@@ -177,11 +137,11 @@ GR_SWIG_BLOCK_MAGIC2(filter, pfb_channelizer_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_decimator_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_interpolator_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, pfb_synthesizer_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccc);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_ccf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fcc);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fff);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_fsf);
-GR_SWIG_BLOCK_MAGIC2(filter, rational_resampler_base_scc);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_ccc, rational_resampler_base<gr_complex,gr_complex,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_ccf, rational_resampler_base<gr_complex,gr_complex,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fcc, rational_resampler_base<float,gr_complex,gr_complex>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fff, rational_resampler_base<float,float,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_fsf, rational_resampler_base<float,std::int16_t,float>);
+GR_SWIG_BLOCK_MAGIC2_TMPL(filter, rational_resampler_base_scc, rational_resampler_base<std::int16_t,gr_complex,gr_complex>);
GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_cc);
GR_SWIG_BLOCK_MAGIC2(filter, single_pole_iir_filter_ff);