diff options
author | Tom Rondeau | 2012-06-10 19:33:52 -0400 |
---|---|---|
committer | Tom Rondeau | 2012-06-10 22:35:48 -0400 |
commit | 14532d8da0f40f2b58595bd7e217004bdbfc90e3 (patch) | |
tree | 5e52427340753129792bbe2b5984289376baf256 /gr-filter/include | |
parent | 511f351466e77fb49cc26d21fca3396f2213a44c (diff) | |
download | gnuradio-14532d8da0f40f2b58595bd7e217004bdbfc90e3.tar.gz gnuradio-14532d8da0f40f2b58595bd7e217004bdbfc90e3.tar.bz2 gnuradio-14532d8da0f40f2b58595bd7e217004bdbfc90e3.zip |
filter: adding ccf version for adaptive filter.
Diffstat (limited to 'gr-filter/include')
-rw-r--r-- | gr-filter/include/filter/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-filter/include/filter/adaptive_fir.h | 37 | ||||
-rw-r--r-- | gr-filter/include/filter/adaptive_fir_ccf.h | 53 |
3 files changed, 87 insertions, 4 deletions
diff --git a/gr-filter/include/filter/CMakeLists.txt b/gr-filter/include/filter/CMakeLists.txt index 98cd2161e..5b209873c 100644 --- a/gr-filter/include/filter/CMakeLists.txt +++ b/gr-filter/include/filter/CMakeLists.txt @@ -84,6 +84,7 @@ install(FILES polyphase_filterbank.h ${generated_includes} adaptive_fir_ccc.h + adaptive_fir_ccf.h dc_blocker_cc.h dc_blocker_ff.h filter_delay_fc.h diff --git a/gr-filter/include/filter/adaptive_fir.h b/gr-filter/include/filter/adaptive_fir.h index 7468e6a05..75a5f57db 100644 --- a/gr-filter/include/filter/adaptive_fir.h +++ b/gr-filter/include/filter/adaptive_fir.h @@ -33,11 +33,8 @@ namespace gr { class FILTER_API adaptive_fir_ccc { - private: - bool d_updated; - int d_decim; - protected: + int d_decim; unsigned int d_ntaps; gr_complex d_error; gr_complex *d_taps; @@ -62,6 +59,38 @@ namespace gr { void filterN(gr_complex *out, gr_complex *in, int nitems); }; + + /**************************************************************/ + + + class FILTER_API adaptive_fir_ccf + { + protected: + int d_decim; + unsigned int d_ntaps; + float d_error; + gr_complex *d_taps; + + // Override to calculate error signal per output + virtual float error(const gr_complex &out) = 0; + + // Override to calculate new weight from old, corresponding input + virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0; + + public: + adaptive_fir_ccf(int decimation, + const std::vector<float> &taps); + + void set_taps(const std::vector<float> &taps); + std::vector<float> taps() const; + + int decimation() const; + unsigned int ntaps() const; + + gr_complex filter(gr_complex *input); + void filterN(gr_complex *out, gr_complex *in, int nitems); + }; + } /* namespace kernel */ } /* namespace filter */ } /* namespace gr */ diff --git a/gr-filter/include/filter/adaptive_fir_ccf.h b/gr-filter/include/filter/adaptive_fir_ccf.h new file mode 100644 index 000000000..8eb01c877 --- /dev/null +++ b/gr-filter/include/filter/adaptive_fir_ccf.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2011,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. + */ + +#ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H +#define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H + +#include <filter/api.h> +#include <filter/adaptive_fir.h> +#include <gr_sync_decimator.h> + +namespace gr { + namespace filter { + + class FILTER_API adaptive_fir_ccf : virtual public gr_sync_decimator + { + public: + // gr::filter::adaptive_fir_ccf::sptr + typedef boost::shared_ptr<adaptive_fir_ccf> sptr; + + /*! + * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps + * \ingroup filter_blk + */ + static FILTER_API sptr make(const char *name, int decimation, + const std::vector<float> &taps); + + void set_taps(const std::vector<float> &taps); + std::vector<float> taps(); + }; + + } /* namespace filter */ +} /* namespace gr */ + +#endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H */ |