summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-24 14:22:17 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-24 14:22:17 -0500
commitf22f9ab1466b99e6f3e897f3867c2ccff4f5a2f5 (patch)
treed784619f7b38d2fd707004329c4f6dc9fb3bbf6e /gnuradio-core/src
parentf7590a9bc0ac83e889a1934322da40093409c409 (diff)
blocks: removed peak_detector2 and regenerate blocks from gnuradio-core.
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt2
-rw-r--r--gnuradio-core/src/lib/general/general.i4
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.h109
-rw-r--r--gnuradio-core/src/lib/general/gr_peak_detector2_fb.i45
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.cc90
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.h76
-rw-r--r--gnuradio-core/src/lib/general/gr_regenerate_bb.i38
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_regenerate.py90
9 files changed, 0 insertions, 561 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index de75dee7b8..581d57f8d8 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -163,10 +163,8 @@ set(gr_core_general_triple_threats
gr_null_sink
gr_null_source
gr_pa_2x2_phase_combiner
- gr_peak_detector2_fb
gr_prefs
gr_random_pdu
- gr_regenerate_bb
gr_remez
gr_skiphead
gr_stretch_ff
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 092582475d..64b2816327 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -44,7 +44,6 @@
#include <gr_transcendental.h>
#include <gr_vco_f.h>
#include <gr_threshold_ff.h>
-#include <gr_regenerate_bb.h>
#include <gr_pa_2x2_phase_combiner.h>
#include <gr_kludge_copy.h>
#include <gr_prefs.h>
@@ -55,7 +54,6 @@
#include <gr_pack_k_bits_bb.h>
#include <gr_feval.h>
#include <gr_bin_statistics_f.h>
-#include <gr_peak_detector2_fb.h>
#include <gr_stretch_ff.h>
#include <gr_copy.h>
#include <complex_vec_test.h>
@@ -90,7 +88,6 @@
%include "gr_transcendental.i"
%include "gr_vco_f.i"
%include "gr_threshold_ff.i"
-%include "gr_regenerate_bb.i"
%include "gr_pa_2x2_phase_combiner.i"
%include "gr_kludge_copy.i"
%include "gr_prefs.i"
@@ -101,7 +98,6 @@
%include "gr_pack_k_bits_bb.i"
%include "gr_feval.i"
%include "gr_bin_statistics_f.i"
-%include "gr_peak_detector2_fb.i"
%include "gr_stretch_ff.i"
%include "gr_copy.i"
%include "complex_vec_test.i"
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
deleted file mode 100644
index a4179a8c2a..0000000000
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,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 <gr_peak_detector2_fb.h>
-#include <gr_io_signature.h>
-#include <string.h>
-
-gr_peak_detector2_fb_sptr
-gr_make_peak_detector2_fb (float threshold_factor_rise,
- int look_ahead, float alpha)
-{
- return gnuradio::get_initial_sptr(new gr_peak_detector2_fb (threshold_factor_rise,
- look_ahead, alpha));
-}
-
-gr_peak_detector2_fb::gr_peak_detector2_fb (float threshold_factor_rise,
- int look_ahead, float alpha)
- : gr_sync_block ("peak_detector2_fb",
- gr_make_io_signature (1, 1, sizeof(float)),
- gr_make_io_signature2 (1, 2, sizeof(char), sizeof(float))),
- d_threshold_factor_rise(threshold_factor_rise),
- d_look_ahead(look_ahead), d_alpha(alpha), d_avg(0.0f), d_found(false)
-{
-}
-
-int
-gr_peak_detector2_fb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items) {
- float *iptr = (float *) input_items[0];
- char *optr = (char *) output_items[0];
-
- assert(noutput_items >= 2);
-
- memset(optr, 0, noutput_items*sizeof(char));
-
- for (int i = 0; i < noutput_items; i++) {
-
- if (!d_found) {
- // Have not yet detected presence of peak
- if (iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) {
- d_found = true;
- d_look_ahead_remaining = d_look_ahead;
- d_peak_val = -(float)INFINITY;
- }
- else {
- d_avg = d_alpha*iptr[i] + (1.0f - d_alpha)*d_avg;
- }
- }
- else {
- // Detected presence of peak
- if (iptr[i] > d_peak_val) {
- d_peak_val = iptr[i];
- d_peak_ind = i;
- }
- else if (d_look_ahead_remaining <= 0) {
- optr[d_peak_ind] = 1;
- d_found = false;
- d_avg = iptr[i];
- }
-
- // Have not yet located peak, loop and keep searching.
- d_look_ahead_remaining--;
- }
-
- // Every iteration of the loop, write debugging signal out if
- // connected:
- if (output_items.size() == 2) {
- float *sigout = (float *) output_items[1];
- sigout[i] = d_avg;
- }
- } // loop
-
- if (!d_found)
- return noutput_items;
-
- // else if detected presence, keep searching during the next call to work.
- int tmp = d_peak_ind;
- d_peak_ind = 1;
-
- return tmp - 1;
-}
-
-
diff --git a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
deleted file mode 100644
index 665a6b882c..0000000000
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 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_peak_detector2_FB_H
-#define INCLUDED_gr_peak_detector2_FB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-class gr_peak_detector2_fb;
-typedef boost::shared_ptr<gr_peak_detector2_fb> gr_peak_detector2_fb_sptr;
-
-GR_CORE_API gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
- int look_ahead = 1000,
- float alpha = 0.001);
-
-/*!
- * \brief Detect the peak of a signal
- * \ingroup level_blk
- *
- * If a peak is detected, this block outputs a 1,
- * or it outputs 0's. A separate debug output may be connected, to
- * view the internal EWMA described below.
- *
- * \param threshold_factor_rise The threshold factor determins when a peak
- * is present. An EWMA average of the signal is calculated and when the
- * value of the signal goes over threshold_factor_rise*average, we
- * call the peak.
- * \param look_ahead The look-ahead value is used when the threshold is
- * found to locate the peak within this range.
- * \param alpha The gain value of a single-pole moving average filter
- */
-
-class GR_CORE_API gr_peak_detector2_fb : public gr_sync_block
-{
- friend GR_CORE_API gr_peak_detector2_fb_sptr
- gr_make_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
-
- gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
-
-private:
- float d_threshold_factor_rise;
- int d_look_ahead;
- int d_look_ahead_remaining;
- int d_peak_ind;
- float d_peak_val;
- float d_alpha;
- float d_avg;
- bool d_found;
-
-public:
-
- /*! \brief Set the threshold factor value for the rise time
- * \param thr new threshold factor
- */
- void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
-
- /*! \brief Set the look-ahead factor
- * \param look new look-ahead factor
- */
- void set_look_ahead(int look) { d_look_ahead = look; }
-
- /*! \brief Set the running average alpha
- * \param alpha new alpha for running average
- */
- void set_alpha(int alpha) { d_alpha = alpha; }
-
- /*! \brief Get the threshold factor value for the rise time
- * \return threshold factor
- */
- float threshold_factor_rise() { return d_threshold_factor_rise; }
-
- /*! \brief Get the look-ahead factor value
- * \return look-ahead factor
- */
- int look_ahead() { return d_look_ahead; }
-
- /*! \brief Get the alpha value of the running average
- * \return alpha
- */
- float alpha() { return d_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/general/gr_peak_detector2_fb.i b/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i
deleted file mode 100644
index ec7227e690..0000000000
--- a/gnuradio-core/src/lib/general/gr_peak_detector2_fb.i
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 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,peak_detector2_fb)
-
- gr_peak_detector2_fb_sptr gr_make_peak_detector2_fb (float threshold_factor_rise = 7,
- int look_ahead = 1000,
- float alpha=0.001);
-
-class gr_peak_detector2_fb : public gr_sync_block
-{
-private:
- gr_peak_detector2_fb (float threshold_factor_rise, int look_ahead, float alpha);
-
-public:
- void set_threshold_factor_rise(float thr) { d_threshold_factor_rise = thr; }
- void set_look_ahead(int look) { d_look_ahead = look; }
- void set_alpha(int alpha) { d_avg_alpha = alpha; }
-
- float threshold_factor_rise() { return d_threshold_factor_rise; }
- int look_ahead() { return d_look_ahead; }
- float alpha() { return d_avg_alpha; }
-};
-
-
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc b/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
deleted file mode 100644
index c96cf247d0..0000000000
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007,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 <gr_regenerate_bb.h>
-#include <gr_io_signature.h>
-
-gr_regenerate_bb_sptr
-gr_make_regenerate_bb (int period, unsigned int max_regen)
-{
- return gnuradio::get_initial_sptr(new gr_regenerate_bb (period, max_regen));
-}
-
-gr_regenerate_bb::gr_regenerate_bb (int period, unsigned int max_regen)
- : gr_sync_block ("regenerate_bb",
- gr_make_io_signature (1, 1, sizeof (char)),
- gr_make_io_signature (1, 1, sizeof (char))),
- d_period(period),
- d_countdown(0),
- d_max_regen(max_regen),
- d_regen_count(max_regen)
-{
-}
-
-void gr_regenerate_bb::set_max_regen(unsigned int regen)
-{
- d_max_regen = regen;
- d_countdown = 0;
- d_regen_count = d_max_regen;
-}
-
-void gr_regenerate_bb::set_period(int period)
-{
- d_period = period;
- d_countdown = 0;
- d_regen_count = d_max_regen;
-}
-
-int
-gr_regenerate_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const char *iptr = (const char *) input_items[0];
- char *optr = (char *) output_items[0];
-
- for (int i = 0; i < noutput_items; i++){
- optr[i] = 0;
-
- if(d_regen_count < d_max_regen) {
- d_countdown--;
-
- if(d_countdown == 0) {
- optr[i] = 1;
- d_countdown = d_period;
- d_regen_count++;
- }
- }
-
- if(iptr[i] == 1) {
- d_countdown = d_period;
- optr[i] = 1;
- d_regen_count = 0;
- }
-
- }
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_regenerate_bb.h b/gnuradio-core/src/lib/general/gr_regenerate_bb.h
deleted file mode 100644
index e820db69e8..0000000000
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 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_REGENERATE_BB_H
-#define INCLUDED_GR_REGENERATE_BB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_block.h>
-
-class gr_regenerate_bb;
-typedef boost::shared_ptr<gr_regenerate_bb> gr_regenerate_bb_sptr;
-
-GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
-
-/*!
- * \brief Detect the peak of a signal and repeat every period samples
- * \ingroup level_blk
- *
- * If a peak is detected, this block outputs a 1 repeated every period samples
- * until reset by detection of another 1 on the input or stopped after max_regen
- * regenerations have occurred.
- *
- * Note that if max_regen=(-1)/ULONG_MAX then the regeneration will run forever.
- */
-class GR_CORE_API gr_regenerate_bb : public gr_sync_block
-{
- /*!
- * \brief Make a regenerate block
- * \param period The number of samples between regenerations
- * \param max_regen The maximum number of regenerations to perform; if set to
- * ULONG_MAX, it will regenerate continuously.
- */
- friend GR_CORE_API gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen);
-
- gr_regenerate_bb (int period, unsigned int max_regen);
-
- private:
- int d_period;
- int d_countdown;
- unsigned int d_max_regen;
- unsigned int d_regen_count;
-
- public:
- /*! \brief Reset the maximum regeneration count; this will reset the current regen.
- */
- void set_max_regen(unsigned int regen);
-
- /*! \brief Reset the period of regenerations; this will reset the current regen.
- */
- void set_period(int period);
-
- 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/general/gr_regenerate_bb.i b/gnuradio-core/src/lib/general/gr_regenerate_bb.i
deleted file mode 100644
index 064b0a2789..0000000000
--- a/gnuradio-core/src/lib/general/gr_regenerate_bb.i
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 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,regenerate_bb)
-
-gr_regenerate_bb_sptr gr_make_regenerate_bb (int period, unsigned int max_regen=500);
-
-class gr_regenerate_bb : public gr_sync_block
-{
- private:
- gr_regenerate_bb (int period, unsigned int max_regen);
-
-public:
- void set_max_regen(unsigned int regen);
-
- /*! \brief Reset the period of regenerations; this will reset the current regen.
- */
- void set_period(int period);
-};
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py b/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
deleted file mode 100755
index 5aca03b777..0000000000
--- a/gnuradio-core/src/python/gnuradio/gr/qa_regenerate.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,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.
-#
-
-from gnuradio import gr, gr_unittest
-import math
-
-class test_regenerate (gr_unittest.TestCase):
-
- def setUp (self):
- self.tb = gr.top_block ()
-
- def tearDown (self):
- self.tb = None
-
- def test_regen1 (self):
- tb = self.tb
-
- data = [0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-
- expected_result = (0, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
-
-
- src = gr.vector_source_b(data, False)
- regen = gr.regenerate_bb(5, 2)
- dst = gr.vector_sink_b()
-
- tb.connect (src, regen)
- tb.connect (regen, dst)
- tb.run ()
-
- dst_data = dst.data ()
-
- self.assertEqual (expected_result, dst_data)
-
- def test_regen2 (self):
- tb = self.tb
-
- data = 200*[0,]
- data[9] = 1
- data[99] = 1
-
- expected_result = 200*[0,]
- expected_result[9] = 1
- expected_result[19] = 1
- expected_result[29] = 1
- expected_result[39] = 1
-
- expected_result[99] = 1
- expected_result[109] = 1
- expected_result[119] = 1
- expected_result[129] = 1
-
- src = gr.vector_source_b(data, False)
- regen = gr.regenerate_bb(10, 3)
- dst = gr.vector_sink_b()
-
- tb.connect (src, regen)
- tb.connect (regen, dst)
- tb.run ()
-
- dst_data = dst.data ()
-
- self.assertEqual (tuple(expected_result), dst_data)
-
-
-if __name__ == '__main__':
- gr_unittest.run(test_regenerate, "test_regenerate.xml")