From 57b3fa45b564fc596eca80c02f0dd235c63887e9 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Tue, 26 Feb 2008 17:44:08 +0000 Subject: [PATCH] Reverted changeset r1631 on trunk (cruft). git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7834 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/filter/Makefile.am | 18 +-- .../src/lib/filter/gr_single_pole_avg.h | 111 ------------------ .../filter/gr_single_pole_avg_filter_ff.cc | 81 ------------- .../lib/filter/gr_single_pole_avg_filter_ff.h | 76 ------------ .../lib/filter/gr_single_pole_avg_filter_ff.i | 34 ------ .../src/lib/filter/gr_single_pole_rec.h | 110 ----------------- .../filter/gr_single_pole_rec_filter_ff.cc | 81 ------------- .../lib/filter/gr_single_pole_rec_filter_ff.h | 76 ------------ .../lib/filter/gr_single_pole_rec_filter_ff.i | 34 ------ .../src/lib/filter/gr_single_zero_avg.h | 110 ----------------- .../filter/gr_single_zero_avg_filter_ff.cc | 81 ------------- .../lib/filter/gr_single_zero_avg_filter_ff.h | 76 ------------ .../lib/filter/gr_single_zero_avg_filter_ff.i | 34 ------ .../src/lib/filter/gr_single_zero_rec.h | 110 ----------------- .../filter/gr_single_zero_rec_filter_ff.cc | 81 ------------- .../lib/filter/gr_single_zero_rec_filter_ff.h | 76 ------------ .../lib/filter/gr_single_zero_rec_filter_ff.i | 34 ------ 17 files changed, 1 insertion(+), 1222 deletions(-) delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_avg.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.cc delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.i delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_rec.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.cc delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.i delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_avg.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.cc delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.i delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_rec.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.cc delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.h delete mode 100644 gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.i diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 93834d74..709ad603 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -176,10 +176,6 @@ libfilter_la_common_SOURCES = \ gr_iir_filter_ffd.cc \ gr_sincos.c \ gr_single_pole_iir_filter_ff.cc \ - gr_single_pole_avg_filter_ff.cc \ - gr_single_pole_rec_filter_ff.cc \ - gr_single_zero_avg_filter_ff.cc \ - gr_single_zero_rec_filter_ff.cc \ gr_single_pole_iir_filter_cc.cc \ gri_goertzel.cc \ gri_mmse_fir_interpolator.cc \ @@ -238,17 +234,9 @@ grinclude_HEADERS = \ gr_iir_filter_ffd.h \ gr_rotator.h \ gr_sincos.h \ - gr_single_pole_avg.h \ - gr_single_pole_rec.h \ gr_single_pole_iir.h \ gr_single_pole_iir_filter_ff.h \ - gr_single_pole_avg_filter_ff.h \ - gr_single_pole_rec_filter_ff.h \ - gr_single_zero_avg_filter_ff.h \ - gr_single_zero_rec_filter_ff.h \ - gr_single_pole_iir_filter_cc.h \ - gr_single_zero_avg.h \ - gr_single_zero_rec.h \ + gr_single_pole_iir_filter_cc.h \ gri_goertzel.h \ gri_iir.h \ gri_mmse_fir_interpolator.h \ @@ -301,10 +289,6 @@ swiginclude_HEADERS = \ gr_hilbert_fc.i \ gr_iir_filter_ffd.i \ gr_single_pole_iir_filter_ff.i \ - gr_single_pole_avg_filter_ff.i \ - gr_single_pole_rec_filter_ff.i \ - gr_single_zero_avg_filter_ff.i \ - gr_single_zero_rec_filter_ff.i \ gr_single_pole_iir_filter_cc.i \ $(GENERATED_I) diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_avg.h b/gnuradio-core/src/lib/filter/gr_single_pole_avg.h deleted file mode 100644 index 91324fc5..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_avg.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ -#ifndef _GR_SINGLE_POLE_AVG_H_ -#define _GR_SINGLE_POLE_AVG_H_ - -#include - -/*! - * \brief class template for single pole moving average filter - * \ingroup filter - */ -template -class gr_single_pole_avg { -public: - /*! - * \brief construct new single pole moving average filter with given alpha - * - * computes y(i) = alpha * x(i) - (1-alpha) * y(i-1) - */ - gr_single_pole_avg (tap_type alpha = 1.0) - { - d_prev_input = 0; - set_taps (alpha); - } - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have n valid entries. - */ - void filterN (o_type output[], const i_type input[], unsigned long n); - - /*! - * \brief install \p alpha as the current taps. - */ - void set_taps (tap_type alpha) - { - if (alpha < 0 || alpha > 1) - throw std::out_of_range ("Alpha must be in [0, 1]\n"); - - d_alpha = alpha; - d_one_minus_alpha = 1.0 - alpha; - } - - //! reset state to zero - void reset () - { - d_prev_input = 0; - } - - tap_type prev_input () { return d_prev_input; } - -protected: - tap_type d_alpha; - tap_type d_one_minus_alpha; - tap_type d_prev_input; -}; - - -// -// general case. We may want to specialize this -// -template -o_type -gr_single_pole_avg::filter (const i_type input) -{ - tap_type output; - - output = d_alpha * input - d_one_minus_alpha * d_prev_input; - d_prev_input = input; - - return (o_type) output; -} - - -template -void -gr_single_pole_avg::filterN (o_type output[], - const i_type input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (input[i]); -} - - -#endif /* _GR_SINGLE_POLE_AVG_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.cc deleted file mode 100644 index ee1f3ade..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 -#include -#include - - -gr_single_pole_avg_filter_ff_sptr -gr_make_single_pole_avg_filter_ff (double alpha, unsigned int vlen) -{ - return gr_single_pole_avg_filter_ff_sptr(new gr_single_pole_avg_filter_ff(alpha, vlen)); -} - -gr_single_pole_avg_filter_ff::gr_single_pole_avg_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_avg_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_rec(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_avg_filter_ff::~gr_single_pole_avg_filter_ff () -{ - // nop -} - -void -gr_single_pole_avg_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_rec[i].set_taps(alpha); -} - -int -gr_single_pole_avg_filter_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_rec[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_rec[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.h deleted file mode 100644 index dddc0d8a..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H -#define INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H - -#include -#include -#include - -class gr_single_pole_avg_filter_ff; -typedef boost::shared_ptr gr_single_pole_avg_filter_ff_sptr; - -gr_single_pole_avg_filter_ff_sptr -gr_make_single_pole_avg_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole moving average filter with float input, float output - * \ingroup filter - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f] - - * with the corresponding rational system function - - \f[ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class gr_single_pole_avg_filter_ff : public gr_sync_block -{ - private: - friend gr_single_pole_avg_filter_ff_sptr - gr_make_single_pole_avg_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector > d_rec; - - gr_single_pole_avg_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_avg_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.i deleted file mode 100644 index 6edec23d..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_avg_filter_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_pole_avg_filter_ff); - -gr_single_pole_avg_filter_ff_sptr -gr_make_single_pole_avg_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_pole_avg_filter_ff : public gr_sync_block -{ - public: - ~gr_single_pole_avg_filter_ff (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_rec.h b/gnuradio-core/src/lib/filter/gr_single_pole_rec.h deleted file mode 100644 index 62204861..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_rec.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ -#ifndef _GR_SINGLE_POLE_REC_H_ -#define _GR_SINGLE_POLE_REC_H_ - -#include - -/*! - * \brief class template for single pole recursive filter - */ -template -class gr_single_pole_rec { -public: - /*! - * \brief construct new single pole IIR with given alpha - * - * computes y(i) = alpha * x(i) - (1-alpha) * y(i-1) - */ - gr_single_pole_rec (tap_type alpha = 1.0) - { - d_prev_output = 0; - set_taps (alpha); - } - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have n valid entries. - */ - void filterN (o_type output[], const i_type input[], unsigned long n); - - /*! - * \brief install \p alpha as the current taps. - */ - void set_taps (tap_type alpha) - { - if (alpha < 0 || alpha > 1) - throw std::out_of_range ("Alpha must be in [0, 1]\n"); - - d_alpha = alpha; - d_one_minus_alpha = 1.0 - alpha; - } - - //! reset state to pole - void reset () - { - d_prev_output = 0; - } - - tap_type prev_output () { return d_prev_output; } - -protected: - tap_type d_alpha; - tap_type d_one_minus_alpha; - tap_type d_prev_output; -}; - - -// -// general case. We may want to specialize this -// -template -o_type -gr_single_pole_rec::filter (const i_type input) -{ - tap_type output; - - output = d_alpha * input + d_one_minus_alpha * d_prev_output; - d_prev_output = output; - - return (o_type) output; -} - - -template -void -gr_single_pole_rec::filterN (o_type output[], - const i_type input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (input[i]); -} - - -#endif /* _GR_SINGLE_POLE_REC_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.cc deleted file mode 100644 index 683bafb2..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 -#include -#include - - -gr_single_pole_rec_filter_ff_sptr -gr_make_single_pole_rec_filter_ff (double alpha, unsigned int vlen) -{ - return gr_single_pole_rec_filter_ff_sptr(new gr_single_pole_rec_filter_ff(alpha, vlen)); -} - -gr_single_pole_rec_filter_ff::gr_single_pole_rec_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_pole_rec_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_rec(vlen) -{ - set_taps(alpha); -} - -gr_single_pole_rec_filter_ff::~gr_single_pole_rec_filter_ff () -{ - // nop -} - -void -gr_single_pole_rec_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_rec[i].set_taps(alpha); -} - -int -gr_single_pole_rec_filter_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_rec[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_rec[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.h deleted file mode 100644 index 66ef237c..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H -#define INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H - -#include -#include -#include - -class gr_single_pole_rec_filter_ff; -typedef boost::shared_ptr gr_single_pole_rec_filter_ff_sptr; - -gr_single_pole_rec_filter_ff_sptr -gr_make_single_pole_rec_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single pole recursive filter with float input, float output - * \ingroup filter - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f] - - * with the corresponding rational system function - - \f[ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class gr_single_pole_rec_filter_ff : public gr_sync_block -{ - private: - friend gr_single_pole_rec_filter_ff_sptr - gr_make_single_pole_rec_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector > d_rec; - - gr_single_pole_rec_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_pole_rec_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.i deleted file mode 100644 index 90213b9d..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_pole_rec_filter_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_pole_rec_filter_ff); - -gr_single_pole_rec_filter_ff_sptr -gr_make_single_pole_rec_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_pole_rec_filter_ff : public gr_sync_block -{ - public: - ~gr_single_pole_rec_filter_ff (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_avg.h b/gnuradio-core/src/lib/filter/gr_single_zero_avg.h deleted file mode 100644 index 2c49c1e2..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_avg.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ -#ifndef _GR_SINGLE_ZERO_AVG_H_ -#define _GR_SINGLE_ZERO_AVG_H_ - -#include - -/*! - * \brief class template for single zero moving average filter - */ -template -class gr_single_zero_avg { -public: - /*! - * \brief construct new single zero moving average filter with given alpha - * - * computes y(i) = alpha * x(i) + (1-alpha) * y(i-1) - */ - gr_single_zero_avg (tap_type alpha = 1.0) - { - d_prev_input = 0; - set_taps (alpha); - } - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have n valid entries. - */ - void filterN (o_type output[], const i_type input[], unsigned long n); - - /*! - * \brief install \p alpha as the current taps. - */ - void set_taps (tap_type alpha) - { - if (alpha < 0 || alpha > 1) - throw std::out_of_range ("Alpha must be in [0, 1]\n"); - - d_alpha = alpha; - d_one_minus_alpha = 1.0 - alpha; - } - - //! reset state to zero - void reset () - { - d_prev_input = 0; - } - - tap_type prev_input () { return d_prev_input; } - -protected: - tap_type d_alpha; - tap_type d_one_minus_alpha; - tap_type d_prev_input; -}; - - -// -// general case. We may want to specialize this -// -template -o_type -gr_single_zero_avg::filter (const i_type input) -{ - tap_type output; - - output = d_alpha * input + d_one_minus_alpha * d_prev_input; - d_prev_input = input; - - return (o_type) output; -} - - -template -void -gr_single_zero_avg::filterN (o_type output[], - const i_type input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (input[i]); -} - - -#endif /* _GR_SINGLE_ZERO_AVG_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.cc deleted file mode 100644 index cd07d55b..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 -#include -#include - - -gr_single_zero_avg_filter_ff_sptr -gr_make_single_zero_avg_filter_ff (double alpha, unsigned int vlen) -{ - return gr_single_zero_avg_filter_ff_sptr(new gr_single_zero_avg_filter_ff(alpha, vlen)); -} - -gr_single_zero_avg_filter_ff::gr_single_zero_avg_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_zero_avg_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_rec(vlen) -{ - set_taps(alpha); -} - -gr_single_zero_avg_filter_ff::~gr_single_zero_avg_filter_ff () -{ - // nop -} - -void -gr_single_zero_avg_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_rec[i].set_taps(alpha); -} - -int -gr_single_zero_avg_filter_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_rec[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_rec[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.h deleted file mode 100644 index 14e1ef7c..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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. - */ - -#ifndef INCLUDED_GR_SINGLE_ZERO_REC_FILTER_FF_H -#define INCLUDED_GR_SINGLE_ZERO_REC_FILTER_FF_H - -#include -#include -#include - -class gr_single_zero_avg_filter_ff; -typedef boost::shared_ptr gr_single_zero_avg_filter_ff_sptr; - -gr_single_zero_avg_filter_ff_sptr -gr_make_single_zero_avg_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single zero moving average filter with float input, float output - * \ingroup filter - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - (1-alpha) y[n-1] = alpha x[n] - \f] - - * with the corresponding rational system function - - \f[ - H(z) = \frac{alpha}{1 - (1-alpha) z^{-1}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class gr_single_zero_avg_filter_ff : public gr_sync_block -{ - private: - friend gr_single_zero_avg_filter_ff_sptr - gr_make_single_zero_avg_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector > d_rec; - - gr_single_zero_avg_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_zero_avg_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.i deleted file mode 100644 index 4715249e..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_avg_filter_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_zero_avg_filter_ff); - -gr_single_zero_avg_filter_ff_sptr -gr_make_single_zero_avg_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_zero_avg_filter_ff : public gr_sync_block -{ - public: - ~gr_single_zero_avg_filter_ff (); - - void set_taps (double alpha); -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_rec.h b/gnuradio-core/src/lib/filter/gr_single_zero_rec.h deleted file mode 100644 index 461ef5fa..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_rec.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2002 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. - */ -#ifndef _GR_SINGLE_ZERO_REC_H_ -#define _GR_SINGLE_ZERO_REC_H_ - -#include - -/*! - * \brief class template for single zero recursive filter - */ -template -class gr_single_zero_rec { -public: - /*! - * \brief construct new single zero IIR with given alpha - * - * computes y(i) = alpha * x(i) - (1-alpha) * y(i-1) - */ - gr_single_zero_rec (tap_type alpha = 1.0) - { - d_prev_output = 0; - set_taps (alpha); - } - - /*! - * \brief compute a single output value. - * \returns the filtered input value. - */ - o_type filter (const i_type input); - - /*! - * \brief compute an array of N output values. - * \p input must have n valid entries. - */ - void filterN (o_type output[], const i_type input[], unsigned long n); - - /*! - * \brief install \p alpha as the current taps. - */ - void set_taps (tap_type alpha) - { - if (alpha < 0 || alpha > 1) - throw std::out_of_range ("Alpha must be in [0, 1]\n"); - - d_alpha = alpha; - d_one_minus_alpha = 1.0 - alpha; - } - - //! reset state to zero - void reset () - { - d_prev_output = 0; - } - - tap_type prev_output () { return d_prev_output; } - -protected: - tap_type d_alpha; - tap_type d_one_minus_alpha; - tap_type d_prev_output; -}; - - -// -// general case. We may want to specialize this -// -template -o_type -gr_single_zero_rec::filter (const i_type input) -{ - tap_type output; - - output = d_alpha * input - d_one_minus_alpha * d_prev_output; - d_prev_output = output; - - return (o_type) output; -} - - -template -void -gr_single_zero_rec::filterN (o_type output[], - const i_type input[], - unsigned long n) -{ - for (unsigned i = 0; i < n; i++) - output[i] = filter (input[i]); -} - - -#endif /* _GR_SINGLE_ZERO_REC_H_ */ diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.cc b/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.cc deleted file mode 100644 index 57c4d53d..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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 -#include -#include - - -gr_single_zero_rec_filter_ff_sptr -gr_make_single_zero_rec_filter_ff (double alpha, unsigned int vlen) -{ - return gr_single_zero_rec_filter_ff_sptr(new gr_single_zero_rec_filter_ff(alpha, vlen)); -} - -gr_single_zero_rec_filter_ff::gr_single_zero_rec_filter_ff ( - double alpha, unsigned int vlen) - : gr_sync_block ("single_zero_rec_filter_ff", - gr_make_io_signature (1, 1, sizeof (float) * vlen), - gr_make_io_signature (1, 1, sizeof (float) * vlen)), - d_vlen(vlen), d_rec(vlen) -{ - set_taps(alpha); -} - -gr_single_zero_rec_filter_ff::~gr_single_zero_rec_filter_ff () -{ - // nop -} - -void -gr_single_zero_rec_filter_ff::set_taps (double alpha) -{ - for (unsigned int i = 0; i < d_vlen; i++) - d_rec[i].set_taps(alpha); -} - -int -gr_single_zero_rec_filter_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - unsigned int vlen = d_vlen; - - if (d_vlen == 1){ - for (int i = 0; i < noutput_items; i++) - out[i] = d_rec[0].filter (in[i]); - } - else { - for (int i = 0; i < noutput_items; i++){ - for (unsigned int j = 0; j < vlen; j++){ - *out++ = d_rec[j].filter (*in++); - } - } - } - return noutput_items; -}; diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.h b/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.h deleted file mode 100644 index 989d9409..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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. - */ - -#ifndef INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H -#define INCLUDED_GR_SINGLE_POLE_REC_FILTER_FF_H - -#include -#include -#include - -class gr_single_zero_rec_filter_ff; -typedef boost::shared_ptr gr_single_zero_rec_filter_ff_sptr; - -gr_single_zero_rec_filter_ff_sptr -gr_make_single_zero_rec_filter_ff (double alpha, unsigned int vlen=1); - -/*! - * \brief single zero recursive filter with float input, float output - * \ingroup filter - * - * The input and output satisfy a difference equation of the form - - \f[ - y[n] - (1-alpha) y[n-1] = -alpha x[n] - \f] - - * with the corresponding system function - - \f[ - H(z) = {alpha - (1-alpha) z^{-1}} - \f] - - * Note that some texts define the system function with a + in the denominator. - * If you're using that convention, you'll need to negate the feedback tap. - */ -class gr_single_zero_rec_filter_ff : public gr_sync_block -{ - private: - friend gr_single_zero_rec_filter_ff_sptr - gr_make_single_zero_rec_filter_ff (double alpha, unsigned int vlen); - - unsigned int d_vlen; - std::vector > d_rec; - - gr_single_zero_rec_filter_ff (double alpha, unsigned int vlen); - - public: - ~gr_single_zero_rec_filter_ff (); - - void set_taps (double alpha); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.i b/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.i deleted file mode 100644 index 1aa896c4..00000000 --- a/gnuradio-core/src/lib/filter/gr_single_zero_rec_filter_ff.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,single_zero_rec_filter_ff); - -gr_single_zero_rec_filter_ff_sptr -gr_make_single_zero_rec_filter_ff (double alpha, unsigned int vlen=1); - -class gr_single_zero_rec_filter_ff : public gr_sync_block -{ - public: - ~gr_single_zero_rec_filter_ff (); - - void set_taps (double alpha); -}; -- 2.30.2