diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-18 18:23:31 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-18 18:23:31 -0400 |
commit | b2f5782865e7c406837414fe4617bce1ed8bca95 (patch) | |
tree | ac88b14a2567ea10cd1bf840678646bb8e0db397 | |
parent | 644459b0c55987792df3a7b884ace1d0250231f1 (diff) |
blocks: removed plateau from gr-analog; now in gr-blocks.
-rw-r--r-- | gr-analog/grc/analog_plateau_detector_fb.xml | 26 | ||||
-rw-r--r-- | gr-analog/include/analog/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-analog/include/analog/plateau_detector_fb.h | 71 | ||||
-rw-r--r-- | gr-analog/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gr-analog/lib/plateau_detector_fb_impl.cc | 82 | ||||
-rw-r--r-- | gr-analog/lib/plateau_detector_fb_impl.h | 50 | ||||
-rwxr-xr-x | gr-analog/python/qa_plateau_detector_fb.py | 47 | ||||
-rw-r--r-- | gr-analog/swig/analog_swig.i | 3 | ||||
-rwxr-xr-x | gr-blocks/python/qa_plateau_detector_fb.py | 4 | ||||
-rw-r--r-- | gr-digital/lib/ofdm_sync_sc_cfb_impl.cc | 4 |
10 files changed, 4 insertions, 285 deletions
diff --git a/gr-analog/grc/analog_plateau_detector_fb.xml b/gr-analog/grc/analog_plateau_detector_fb.xml deleted file mode 100644 index f14efc97f4..0000000000 --- a/gr-analog/grc/analog_plateau_detector_fb.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<block> - <name>Plateau Detector</name> - <key>analog_plateau_detector_fb</key> - <import>from gnuradio import analog</import> - <make>analog.plateau_detector_fb($max_len, $threshold)</make> - <param> - <name>Max. plateau length</name> - <key>max_len</key> - <type>int</type> - </param> - <param> - <name>Threshold</name> - <key>threshold</key> - <value>0.9</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>real</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/analog/CMakeLists.txt index 1cbbf988f3..9c752ee157 100644 --- a/gr-analog/include/analog/CMakeLists.txt +++ b/gr-analog/include/analog/CMakeLists.txt @@ -95,7 +95,6 @@ install(FILES fmdet_cf.h frequency_modulator_fc.h phase_modulator_fc.h - plateau_detector_fb.h pll_carriertracking_cc.h pll_freqdet_cf.h pll_refout_cc.h diff --git a/gr-analog/include/analog/plateau_detector_fb.h b/gr-analog/include/analog/plateau_detector_fb.h deleted file mode 100644 index 33629bd18b..0000000000 --- a/gr-analog/include/analog/plateau_detector_fb.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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_ANALOG_PLATEAU_DETECTOR_FB_H -#define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H - -#include <analog/api.h> -#include <gr_sync_block.h> - -namespace gr { - namespace analog { - - /*! - * \brief Detects a plateau and marks the middle. - * - * Detect a plateau of a-priori known height. Input is a stream of floats, - * the output is a stream of bytes. Whenever a plateau is detected, the - * middle of that plateau is marked with a '1' on the output stream (all - * other samples are left at zero). - * - * You can use this in a Schmidl & Cox synchronisation algorithm to interpret - * the output of the normalized correlator. Just pass the length of the cyclic - * prefix (in samples) as the max_len parameter). - * - * Unlike the peak detectors, you must the now the absolute height of the plateau. - * Whenever the amplitude exceeds the given threshold, it starts assuming the - * presence of a plateau. - * - * An implicit hysteresis is provided by the fact that after detecting one plateau, - * it waits at least max_len samples before the next plateau can be detected. - * - * \ingroup analog - * - */ - class ANALOG_API plateau_detector_fb : virtual public gr_sync_block - { - public: - typedef boost::shared_ptr<plateau_detector_fb> sptr; - - /*! - * \param max_len Maximum length of the plateau - * \param threshold Anything above this value is considered a plateau - */ - static sptr make(int max_len, float threshold=0.9); - }; - - } // namespace analog -} // namespace gr - -#endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H */ - diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 48fbb71b2f..c86ced6ac7 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -128,7 +128,6 @@ list(APPEND analog_sources fmdet_cf_impl.cc frequency_modulator_fc_impl.cc phase_modulator_fc_impl.cc - plateau_detector_fb_impl.cc pll_carriertracking_cc_impl.cc pll_freqdet_cf_impl.cc pll_refout_cc_impl.cc diff --git a/gr-analog/lib/plateau_detector_fb_impl.cc b/gr-analog/lib/plateau_detector_fb_impl.cc deleted file mode 100644 index 0d2890bc55..0000000000 --- a/gr-analog/lib/plateau_detector_fb_impl.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_io_signature.h> -#include "plateau_detector_fb_impl.h" - -namespace gr { - namespace analog { - -plateau_detector_fb::sptr -plateau_detector_fb::make(int max_len, float threshold) -{ - return gnuradio::get_initial_sptr (new plateau_detector_fb_impl(max_len, threshold)); -} - -plateau_detector_fb_impl::plateau_detector_fb_impl(int max_len, float threshold) - : gr_sync_block("plateau_detector_fb", - gr_make_io_signature(1, 1, sizeof (float)), - gr_make_io_signature(1, 1, sizeof (char))), - d_max_len(max_len), - d_threshold(threshold) -{} - -plateau_detector_fb_impl::~plateau_detector_fb_impl() -{ -} - -int -plateau_detector_fb_impl::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]; - unsigned char *out = (unsigned char *) output_items[0]; - int flank_start; - - memset((void *) out, 0x00, noutput_items); - int i; - for (i = 0; i < noutput_items; i++) { - if (in[i] >= d_threshold) { - if (noutput_items-i < 2*d_max_len) { // If we can't finish, come back later - break; - } - flank_start = i; - while (i < noutput_items && in[i] >= d_threshold) - i++; - if ((i - flank_start) > 1) { // 1 Sample is not a plateau - out[flank_start + (i-flank_start)/2] = 1; - i = std::min(i+d_max_len, noutput_items-1); - } - } - } - - return i; -} - - } /* namespace analog */ -} /* namespace gr */ - diff --git a/gr-analog/lib/plateau_detector_fb_impl.h b/gr-analog/lib/plateau_detector_fb_impl.h deleted file mode 100644 index daf1dd56d9..0000000000 --- a/gr-analog/lib/plateau_detector_fb_impl.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H -#define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H - -#include <analog/plateau_detector_fb.h> - -namespace gr { - namespace analog { - -class plateau_detector_fb_impl : public plateau_detector_fb -{ - private: - int d_max_len; - float d_threshold; - - public: - plateau_detector_fb_impl(int max_len, float threshold); - ~plateau_detector_fb_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - } // namespace analog -} // namespace gr - -#endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_IMPL_H */ - diff --git a/gr-analog/python/qa_plateau_detector_fb.py b/gr-analog/python/qa_plateau_detector_fb.py deleted file mode 100755 index 6f330440ef..0000000000 --- a/gr-analog/python/qa_plateau_detector_fb.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012,2013 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. -# - -from gnuradio import gr, gr_unittest -import analog_swig as analog -import blocks_swig as blocks - -class qa_plateau_detector_fb (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_001_t (self): - # | Spur spike 1 | Plateau | Spur spike 2 - test_signal = (0, 1, .2, .4, .6, .8, 1, 1, 1, 1, 1, .8, .6, .4, 1, 0) - expected_sig = (0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0) - # | Center of Plateau - sink = blocks.vector_sink_b() - self.tb.connect(blocks.vector_source_f(test_signal), analog.plateau_detector_fb(5), sink) - self.tb.run () - self.assertEqual(expected_sig, sink.data()) - - -if __name__ == '__main__': - gr_unittest.run(qa_plateau_detector_fb, "qa_plateau_detector_fb.xml") diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index 1f5ea85b55..e74a1a8d85 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -55,7 +55,6 @@ #include "analog/noise_source_f.h" #include "analog/noise_source_c.h" #include "analog/phase_modulator_fc.h" -#include "analog/plateau_detector_fb.h" #include "analog/pll_carriertracking_cc.h" #include "analog/pll_freqdet_cf.h" #include "analog/pll_refout_cc.h" @@ -97,7 +96,6 @@ %include "analog/noise_source_f.h" %include "analog/noise_source_c.h" %include "analog/phase_modulator_fc.h" -%include "analog/plateau_detector_fb.h" %include "analog/pll_carriertracking_cc.h" %include "analog/pll_freqdet_cf.h" %include "analog/pll_refout_cc.h" @@ -136,7 +134,6 @@ GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i); GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f); GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c); GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc); -GR_SWIG_BLOCK_MAGIC2(analog, plateau_detector_fb); GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc); GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf); GR_SWIG_BLOCK_MAGIC2(analog, pll_refout_cc); diff --git a/gr-blocks/python/qa_plateau_detector_fb.py b/gr-blocks/python/qa_plateau_detector_fb.py index e45fe028dd..2f4b643fe0 100755 --- a/gr-blocks/python/qa_plateau_detector_fb.py +++ b/gr-blocks/python/qa_plateau_detector_fb.py @@ -36,8 +36,8 @@ class qa_plateau_detector_fb (gr_unittest.TestCase): test_signal = (0, 1, .2, .4, .6, .8, 1, 1, 1, 1, 1, .8, .6, .4, 1, 0) expected_sig = (0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0) # | Center of Plateau - sink = gr.vector_sink_b() - self.tb.connect(gr.vector_source_f(test_signal), blocks.plateau_detector_fb(5), sink) + sink = blocks.vector_sink_b() + self.tb.connect(blocks.vector_source_f(test_signal), blocks.plateau_detector_fb(5), sink) self.tb.run () self.assertEqual(expected_sig, sink.data()) diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc index 26e791210f..822b9021e2 100644 --- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc +++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc @@ -27,7 +27,7 @@ #include <gr_io_signature.h> #include "ofdm_sync_sc_cfb_impl.h" -#include <analog/plateau_detector_fb.h> +#include <blocks/plateau_detector_fb.h> #include <blocks/complex_to_arg.h> #include <blocks/complex_to_mag_squared.h> #include <blocks/conjugate_cc.h> @@ -72,7 +72,7 @@ namespace gr { gr::blocks::complex_to_arg::sptr peak_to_angle(gr::blocks::complex_to_arg::make()); gr::blocks::sample_and_hold_ff::sptr sample_and_hold(gr::blocks::sample_and_hold_ff::make()); - gr::analog::plateau_detector_fb::sptr plateau_detector(gr::analog::plateau_detector_fb::make(cp_len)); + gr::blocks::plateau_detector_fb::sptr plateau_detector(gr::blocks::plateau_detector_fb::make(cp_len)); // Delay Path connect(self(), 0, delay, 0); |