/gr_rational_resampler_base_scc.cc
/gr_rational_resampler_base_scc.h
/gr_rational_resampler_base_scc.i
+/gri_fir_filter_with_buffer_ccc.cc
+/gri_fir_filter_with_buffer_ccc.h
+/gri_fir_filter_with_buffer_fcc.cc
+/gri_fir_filter_with_buffer_fcc.h
+/gri_fir_filter_with_buffer_fff.cc
+/gri_fir_filter_with_buffer_fff.h
+/gri_fir_filter_with_buffer_fsf.cc
+/gri_fir_filter_with_buffer_fsf.h
+/gri_fir_filter_with_buffer_scc.cc
+/gri_fir_filter_with_buffer_scc.h
/stamp-*
generate_gr_fir_sysconfig_generic.py \
generate_gr_fir_util.py \
generate_gr_freq_xlating_fir_filter_XXX.py \
+ generate_gri_fir_filter_with_buffer_XXX.py \
generate_utils.py \
gr_fir_XXX.cc.t \
gr_fir_XXX.h.t \
gr_rational_resampler_base_XXX.i.t \
gr_freq_xlating_fir_filter_XXX.cc.t \
gr_freq_xlating_fir_filter_XXX.h.t \
- gr_freq_xlating_fir_filter_XXX.i.t
+ gr_freq_xlating_fir_filter_XXX.i.t \
+ gri_fir_filter_with_buffer_XXX.cc.t \
+ gri_fir_filter_with_buffer_XXX.h.t \
+ gri_fir_filter_with_buffer_XXX.i.t
+
# Source built by Python into $(builddir)
BUILT_SOURCES = \
gr_rational_resampler_base_fcc.h \
gr_rational_resampler_base_fff.h \
gr_rational_resampler_base_fsf.h \
- gr_rational_resampler_base_scc.h
+ gr_rational_resampler_base_scc.h \
+ gri_fir_filter_with_buffer_ccc.h \
+ gri_fir_filter_with_buffer_ccf.h \
+ gri_fir_filter_with_buffer_fcc.h \
+ gri_fir_filter_with_buffer_fff.h \
+ gri_fir_filter_with_buffer_fsf.h \
+ gri_fir_filter_with_buffer_scc.h
+
GENERATED_I = \
gr_fir_filter_ccc.i \
gr_rational_resampler_base_fcc.cc \
gr_rational_resampler_base_fff.cc \
gr_rational_resampler_base_fsf.cc \
- gr_rational_resampler_base_scc.cc
+ gr_rational_resampler_base_scc.cc \
+ gri_fir_filter_with_buffer_ccc.cc \
+ gri_fir_filter_with_buffer_ccf.cc \
+ gri_fir_filter_with_buffer_fcc.cc \
+ gri_fir_filter_with_buffer_fff.cc \
+ gri_fir_filter_with_buffer_fsf.cc \
+ gri_fir_filter_with_buffer_scc.cc
import generate_gr_fir_sysconfig
import generate_gr_fir_util
import generate_gr_fir_XXX
+import generate_gri_fir_filter_with_buffer_XXX
def generate_all():
generate_gr_fir_XXX.generate()
generate_gr_fir_sysconfig_generic.generate()
generate_gr_fir_sysconfig.generate()
generate_gr_fir_util.generate()
+ generate_gri_fir_filter_with_buffer_XXX.generate()
output_glue('filter')
if __name__ == '__main__':
--- /dev/null
+#!/usr/bin/env python
+# -*- python -*-
+#
+# Copyright 2010 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.
+#
+
+import re
+from generate_utils import *
+
+roots = ['gri_fir_filter_with_buffer_XXX',]
+
+def code3_to_input_cast (code3):
+ if i_code (code3) == 's' and o_code (code3) == 'c':
+ return '(float)'
+ return ''
+
+def expand_h_cc (root, code3):
+ d = init_dict (root, code3)
+ expand_template (d, root + '.h.t')
+ expand_template (d, root + '.cc.t')
+
+def init_dict (root, code3):
+ name = re.sub ('X+', code3, root)
+ d = standard_dict (name, code3)
+ d['INPUT_CAST'] = code3_to_input_cast (code3)
+ return d
+
+
+def generate ():
+ for r in roots:
+ for s in fir_signatures:
+ expand_h_cc (r, s)
+
+
+if __name__ == '__main__':
+ generate ()
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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 <@NAME@.h>
+
+@NAME@::@NAME@(const std::vector<@TAP_TYPE@> &taps)
+{
+ d_buffer = NULL;
+ set_taps(taps);
+}
+
+@NAME@::~@NAME@()
+{
+ if(d_buffer != NULL)
+ free(d_buffer);
+}
+
+void
+@NAME@::set_taps (const std::vector<@TAP_TYPE@> &taps)
+{
+ d_taps = gr_reverse(taps);
+
+ if(d_buffer != NULL) {
+ free(d_buffer);
+ d_buffer = NULL;
+ }
+
+ // FIXME: memalign this to 16-byte boundaries for SIMD later
+ size_t t = sizeof(@I_TYPE@) * 2 * d_taps.size();
+ d_buffer = (@I_TYPE@*)malloc(t);
+ memset(d_buffer, 0x00, t);
+ d_idx = 0;
+}
+
+@O_TYPE@
+@NAME@::filter (@I_TYPE@ input)
+{
+ unsigned int i;
+
+ d_buffer[d_idx] = input;
+ d_buffer[d_idx+ntaps()] = input;
+
+ // using the later for the case when ntaps=0;
+ // profiling shows this doesn't make a difference
+ //d_idx = (d_idx + 1) % ntaps();
+ d_idx++;
+ if(d_idx >= ntaps())
+ d_idx = 0;
+
+ @O_TYPE@ out = 0;
+ for(i = 0; i < ntaps(); i++) {
+ out += @INPUT_CAST@ d_buffer[d_idx + i] * d_taps[i];
+ }
+ return out;
+}
+
+void
+@NAME@::filterN (@O_TYPE@ output[],
+ const @I_TYPE@ input[],
+ unsigned long n)
+{
+ for(unsigned long i = 0; i < n; i++) {
+ output[i] = filter(input[i]);
+ }
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 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: This file is automatically generated by generate_gri_fir_XXX.py
+ * Any changes made to this file will be overwritten.
+ */
+
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <vector>
+#include <gr_types.h>
+#include <gr_reverse.h>
+#include <string.h>
+#include <cstdio>
+
+/*!
+ * \brief FIR with internal buffer for @I_TYPE@ input,
+ @O_TYPE@ output and @TAP_TYPE@ taps
+ * \ingroup filter
+ *
+ */
+
+class @NAME@ {
+
+protected:
+ std::vector<@TAP_TYPE@> d_taps; // reversed taps
+ @I_TYPE@ *d_buffer;
+ unsigned int d_idx;
+
+public:
+
+ // CONSTRUCTORS
+
+ /*!
+ * \brief construct new FIR with given taps.
+ *
+ * Note that taps must be in forward order, e.g., coefficient 0 is
+ * stored in new_taps[0], coefficient 1 is stored in
+ * new_taps[1], etc.
+ */
+ @NAME@ (const std::vector<@TAP_TYPE@> &taps);
+
+ ~@NAME@ ();
+
+ // MANIPULATORS
+
+ /*!
+ * \brief compute a single output value.
+ *
+ * \p input must have ntaps() valid entries.
+ * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
+ *
+ * \returns the filtered input value.
+ */
+ @O_TYPE@ filter (@I_TYPE@ input);
+
+ /*!
+ * \brief compute an array of N output values.
+ *
+ * \p input must have (n - 1 + ntaps()) valid entries.
+ * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
+ */
+ void filterN (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n);
+
+ /*!
+ * \brief compute an array of N output values, decimating the input
+ *
+ * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
+ * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
+ * compute the output values.
+ */
+ void filterNdec (@O_TYPE@ output[], const @I_TYPE@ input[],
+ unsigned long n, unsigned decimate);
+
+ /*!
+ * \brief install \p new_taps as the current taps.
+ */
+ void set_taps (const std::vector<@TAP_TYPE@> &taps);
+
+ // ACCESSORS
+
+ /*!
+ * \return number of taps in filter.
+ */
+ unsigned ntaps () const { return d_taps.size (); }
+
+ /*!
+ * \return current taps
+ */
+ const std::vector<@TAP_TYPE@> get_taps () const
+ {
+ return gr_reverse(d_taps);
+ }
+};
+
+#endif /* @GUARD_NAME@ */
+++ /dev/null
-/* -*- c++ -*- */
-/*
- * Copyright 2010 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 <gri_fir_filter_with_buffer_ccf.h>
-
-gri_fir_filter_with_buffer_ccf::gri_fir_filter_with_buffer_ccf(const std::vector<float> &taps)
-{
- d_buffer = NULL;
- set_taps(taps);
-}
-
-gri_fir_filter_with_buffer_ccf::~gri_fir_filter_with_buffer_ccf()
-{
- if(d_buffer != NULL)
- free(d_buffer);
-}
-
-gr_complex
-gri_fir_filter_with_buffer_ccf::filter (gr_complex input)
-{
- unsigned int i;
-
- d_buffer[d_idx] = input;
- d_buffer[d_idx+ntaps()] = input;
-
- // using the later for the case when ntaps=0;
- // profiling shows this doesn't make a difference
- //d_idx = (d_idx + 1) % ntaps();
- d_idx++;
- if(d_idx >= ntaps())
- d_idx = 0;
-
- gr_complex out = gr_complex(0,0);
- for(i = 0; i < ntaps(); i++) {
- out += d_buffer[d_idx + i]*d_taps[i];
- }
- return out;
-}
-
-void
-gri_fir_filter_with_buffer_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]);
- }
-}
+++ /dev/null
-/* -*- c++ -*- */
-/*
- * Copyright 2010 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: This file is automatically generated by generate_gr_fir_XXX.py
- * Any changes made to this file will be overwritten.
- */
-
-
-#ifndef INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_H
-#define INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_H
-
-#include <vector>
-#include <gr_types.h>
-#include <gr_reverse.h>
-#include <string.h>
-#include <cstdio>
-
-/*!
- * \brief FIR with internal buffer for gr_complex input,
- gr_complex output and float taps
- * \ingroup filter
- *
- */
-
-class gri_fir_filter_with_buffer_ccf {
-
-protected:
- std::vector<float> d_taps; // reversed taps
- gr_complex *d_buffer;
- unsigned int d_idx;
-
-public:
-
- // CONSTRUCTORS
-
- /*!
- * \brief construct new FIR with given taps.
- *
- * Note that taps must be in forward order, e.g., coefficient 0 is
- * stored in new_taps[0], coefficient 1 is stored in
- * new_taps[1], etc.
- */
- gri_fir_filter_with_buffer_ccf (const std::vector<float> &taps);
-
- ~gri_fir_filter_with_buffer_ccf ();
-
- // MANIPULATORS
-
- /*!
- * \brief compute a single output value.
- *
- * \p input must have ntaps() valid entries.
- * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
- *
- * \returns the filtered input value.
- */
- gr_complex filter (gr_complex input);
-
- /*!
- * \brief compute an array of N output values.
- *
- * \p input must have (n - 1 + ntaps()) valid entries.
- * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
- */
- void filterN (gr_complex output[], const gr_complex input[],
- unsigned long n);
-
- /*!
- * \brief compute an array of N output values, decimating the input
- *
- * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
- * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
- * compute the output values.
- */
- void filterNdec (gr_complex output[], const gr_complex input[],
- unsigned long n, unsigned decimate);
-
- /*!
- * \brief install \p new_taps as the current taps.
- */
- void set_taps (const std::vector<float> &taps)
- {
- d_taps = gr_reverse(taps);
-
- if(d_buffer != NULL) {
- free(d_buffer);
- d_buffer = NULL;
- }
-
- // FIXME: memalign this to 16-byte boundaries for SIMD later
- size_t t = sizeof(gr_complex) * 2 * d_taps.size();
- d_buffer = (gr_complex*)malloc(t);
- memset(d_buffer, 0x00, t);
- d_idx = 0;
- }
-
- // ACCESSORS
-
- /*!
- * \return number of taps in filter.
- */
- unsigned ntaps () const { return d_taps.size (); }
-
- /*!
- * \return current taps
- */
- const std::vector<float> get_taps () const
- {
- return gr_reverse(d_taps);
- }
-};
-
-#endif /* INCLUDED_GR_GR_FIR_FILTER_WITH_BUFFER_CCF_H */