summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
authorTom Rondeau2013-02-24 14:15:05 -0500
committerTom Rondeau2013-02-24 14:15:05 -0500
commitffcaa3436cc8e608cb51bad78ca669b90bd110f2 (patch)
tree2d5735e89e81c36568c1f5699ff80c5213d7ada9 /gr-blocks
parent96583a9009478242c51ecfd7bb4321ed3d90e3b8 (diff)
downloadgnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.tar.gz
gnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.tar.bz2
gnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.zip
blocks: converted peak_detector2 and regenerate to v3.7.
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.xml41
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.xml34
-rw-r--r--gr-blocks/include/blocks/CMakeLists.txt2
-rw-r--r--gr-blocks/include/blocks/peak_detector2_fb.h91
-rw-r--r--gr-blocks/include/blocks/regenerate_bb.h80
-rw-r--r--gr-blocks/lib/CMakeLists.txt2
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.cc118
-rw-r--r--gr-blocks/lib/peak_detector2_fb_impl.h64
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.cc103
-rw-r--r--gr-blocks/lib/regenerate_bb_impl.h57
-rw-r--r--gr-blocks/python/qa_peak_detector2.py58
-rwxr-xr-xgr-blocks/python/qa_regenerate.py90
-rw-r--r--gr-blocks/swig/blocks_swig.i6
13 files changed, 746 insertions, 0 deletions
diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.xml b/gr-blocks/grc/blocks_peak_detector2_fb.xml
new file mode 100644
index 000000000..584e7a1fb
--- /dev/null
+++ b/gr-blocks/grc/blocks_peak_detector2_fb.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Peak Detector2
+###################################################
+ -->
+<block>
+ <name>Peak Detector2</name>
+ <key>blocks_peak_detector2_fb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
+ <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
+ <callback>set_look_ahead($look_ahead)</callback>
+ <callback>set_alpha($alpha)</callback>
+ <param>
+ <name>TH Factor Rise</name>
+ <key>threshold_factor_rise</key>
+ <value>7</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Look Ahead</name>
+ <key>look_ahead</key>
+ <value>1000</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Alpha</name>
+ <key>alpha</key>
+ <value>0.001</value>
+ <type>real</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-blocks/grc/blocks_regenerate_bb.xml b/gr-blocks/grc/blocks_regenerate_bb.xml
new file mode 100644
index 000000000..6e6f46188
--- /dev/null
+++ b/gr-blocks/grc/blocks_regenerate_bb.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Regenerate Block:
+## char in/ char out
+###################################################
+ -->
+<block>
+ <name>Regenerate</name>
+ <key>blocks_regenerate_bb</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.regenerate_bb($period, $max_regen)</make>
+ <param>
+ <name>Period</name>
+ <key>period</key>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Max Regen Count</name>
+ <key>max_regen</key>
+ <value>500</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt
index a6608696a..cd2fea672 100644
--- a/gr-blocks/include/blocks/CMakeLists.txt
+++ b/gr-blocks/include/blocks/CMakeLists.txt
@@ -126,6 +126,8 @@ install(FILES
multiply_const_ff.h
nlog10_ff.h
patterned_interleaver.h
+ peak_detector2_fb.h
+ regenerate_bb.h
repeat.h
rms_cf.h
rms_ff.h
diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/blocks/peak_detector2_fb.h
new file mode 100644
index 000000000..71afc3287
--- /dev/null
+++ b/gr-blocks/include/blocks/peak_detector2_fb.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \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 BLOCKS_API peak_detector2_fb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::peak_detector2_fb::sptr
+ typedef boost::shared_ptr<peak_detector2_fb> sptr;
+
+ static sptr make(float threshold_factor_rise=7,
+ int look_ahead=1000, float alpha=0.001);
+
+ /*! \brief Set the threshold factor value for the rise time
+ * \param thr new threshold factor
+ */
+ virtual void set_threshold_factor_rise(float thr) = 0;
+
+ /*! \brief Set the look-ahead factor
+ * \param look new look-ahead factor
+ */
+ virtual void set_look_ahead(int look) = 0;
+
+ /*! \brief Set the running average alpha
+ * \param alpha new alpha for running average
+ */
+ virtual void set_alpha(int alpha) = 0;
+
+ /*! \brief Get the threshold factor value for the rise time
+ * \return threshold factor
+ */
+ virtual float threshold_factor_rise() = 0;
+
+ /*! \brief Get the look-ahead factor value
+ * \return look-ahead factor
+ */
+ virtual int look_ahead() = 0;
+
+ /*! \brief Get the alpha value of the running average
+ * \return alpha
+ */
+ virtual float alpha() = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */
diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/blocks/regenerate_bb.h
new file mode 100644
index 000000000..3063e70a7
--- /dev/null
+++ b/gr-blocks/include/blocks/regenerate_bb.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_H
+
+#include <blocks/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \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 BLOCKS_API regenerate_bb : virtual public gr_sync_block
+ {
+ public:
+ // gr::blocks::regenerate_bb::sptr
+ typedef boost::shared_ptr<regenerate_bb> sptr;
+
+ /*!
+ * \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.
+ */
+ static sptr make(int period, unsigned int max_regen=500);
+
+ /*! \brief Reset the maximum regeneration count; this will reset
+ the current regen.
+ */
+ virtual void set_max_regen(unsigned int regen) = 0;
+
+ /*! \brief Reset the period of regenerations; this will reset
+ the current regen.
+ */
+ virtual void set_period(int period) = 0;
+
+ /*! \brief return the maximum regeneration count.
+ */
+ virtual unsigned int max_regen() const = 0;
+
+ /*! \brief return the regeneration period.
+ */
+ virtual int period() const = 0;
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_H */
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 9b076f696..aa87d9c64 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -165,6 +165,8 @@ list(APPEND gr_blocks_sources
multiply_const_ff_impl.cc
nlog10_ff_impl.cc
patterned_interleaver_impl.cc
+ peak_detector2_fb_impl.cc
+ regenerate_bb_impl.cc
repeat_impl.cc
rms_cf_impl.cc
rms_ff_impl.cc
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc
new file mode 100644
index 000000000..0d375c3ba
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.cc
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "peak_detector2_fb_impl.h"
+#include <gr_io_signature.h>
+#include <string.h>
+
+namespace gr {
+ namespace blocks {
+
+ peak_detector2_fb::sptr
+ peak_detector2_fb::make(float threshold_factor_rise,
+ int look_ahead, float alpha)
+ {
+ return gnuradio::get_initial_sptr
+ (new peak_detector2_fb_impl(threshold_factor_rise,
+ look_ahead, alpha));
+ }
+
+ peak_detector2_fb_impl::peak_detector2_fb_impl(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)
+ {
+ }
+
+ peak_detector2_fb_impl::~peak_detector2_fb_impl()
+ {
+ }
+
+ int
+ peak_detector2_fb_impl::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.h b/gr-blocks/lib/peak_detector2_fb_impl.h
new file mode 100644
index 000000000..f03dd36a8
--- /dev/null
+++ b/gr-blocks/lib/peak_detector2_fb_impl.h
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+#define INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H
+
+#include <blocks/peak_detector2_fb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class peak_detector2_fb_impl : public peak_detector2_fb
+ {
+ 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:
+ peak_detector2_fb_impl(float threshold_factor_rise,
+ int look_ahead, float alpha);
+ ~peak_detector2_fb_impl();
+
+ 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_alpha = alpha; }
+
+ float threshold_factor_rise() { return d_threshold_factor_rise; }
+ int look_ahead() { return d_look_ahead; }
+ float alpha() { return d_alpha; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_IMPL_H */
diff --git a/gr-blocks/lib/regenerate_bb_impl.cc b/gr-blocks/lib/regenerate_bb_impl.cc
new file mode 100644
index 000000000..4472efb6d
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.cc
@@ -0,0 +1,103 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2010,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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "regenerate_bb_impl.h"
+#include <gr_io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ regenerate_bb::sptr
+ regenerate_bb::make(int period, unsigned int max_regen)
+ {
+ return gnuradio::get_initial_sptr
+ (new regenerate_bb_impl(period, max_regen));
+ }
+
+ regenerate_bb_impl::regenerate_bb_impl(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)
+ {
+ }
+
+ regenerate_bb_impl::~regenerate_bb_impl()
+ {
+ }
+
+ void
+ regenerate_bb_impl::set_max_regen(unsigned int regen)
+ {
+ d_max_regen = regen;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ void
+ regenerate_bb_impl::set_period(int period)
+ {
+ d_period = period;
+ d_countdown = 0;
+ d_regen_count = d_max_regen;
+ }
+
+ int
+ regenerate_bb_impl::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;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/regenerate_bb_impl.h b/gr-blocks/lib/regenerate_bb_impl.h
new file mode 100644
index 000000000..bcfa18391
--- /dev/null
+++ b/gr-blocks/lib/regenerate_bb_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,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.
+ */
+
+#ifndef INCLUDED_GR_REGENERATE_BB_H
+#define INCLUDED_GR_REGENERATE_BB_IMPL_H
+
+#include <blocks/regenerate_bb.h>
+
+namespace gr {
+ namespace blocks {
+
+ class regenerate_bb_impl : public regenerate_bb
+ {
+ private:
+ int d_period;
+ int d_countdown;
+ unsigned int d_max_regen;
+ unsigned int d_regen_count;
+
+ public:
+ regenerate_bb_impl(int period, unsigned int max_regen=500);
+ ~regenerate_bb_impl();
+
+ void set_max_regen(unsigned int regen);
+ void set_period(int period);
+
+ unsigned int max_regen() const { return d_max_regen; };
+ int period() const { return d_period; };
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_GR_REGENERATE_BB_IMPL_H */
diff --git a/gr-blocks/python/qa_peak_detector2.py b/gr-blocks/python/qa_peak_detector2.py
new file mode 100644
index 000000000..4b864e4d7
--- /dev/null
+++ b/gr-blocks/python/qa_peak_detector2.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,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 blocks_swig as blocks
+
+class test_peak_detector2(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, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
+
+ expected_result = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+
+ src = gr.vector_source_f(data, False)
+ regen = blocks.peak_detector2_fb()
+ dst = gr.vector_sink_b()
+
+ tb.connect(src, regen)
+ tb.connect(regen, dst)
+ tb.run()
+
+ dst_data = dst.data()
+ print dst_data
+
+ self.assertEqual(expected_result, dst_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_peak_detector2, "test_peak_detector2.xml")
diff --git a/gr-blocks/python/qa_regenerate.py b/gr-blocks/python/qa_regenerate.py
new file mode 100755
index 000000000..a57eeba2b
--- /dev/null
+++ b/gr-blocks/python/qa_regenerate.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+#
+# Copyright 2007,2010,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 blocks_swig as blocks
+
+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 = blocks.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 = blocks.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")
diff --git a/gr-blocks/swig/blocks_swig.i b/gr-blocks/swig/blocks_swig.i
index b229e5563..114142cbf 100644
--- a/gr-blocks/swig/blocks_swig.i
+++ b/gr-blocks/swig/blocks_swig.i
@@ -102,9 +102,11 @@
#include "blocks/packed_to_unpacked_bb.h"
#include "blocks/packed_to_unpacked_ss.h"
#include "blocks/packed_to_unpacked_ii.h"
+#include "blocks/peak_detector2_fb.h"
#include "blocks/or_bb.h"
#include "blocks/or_ss.h"
#include "blocks/or_ii.h"
+#include "blocks/regenerate_bb.h"
#include "blocks/repeat.h"
#include "blocks/rms_cf.h"
#include "blocks/rms_ff.h"
@@ -202,9 +204,11 @@
%include "blocks/packed_to_unpacked_bb.h"
%include "blocks/packed_to_unpacked_ss.h"
%include "blocks/packed_to_unpacked_ii.h"
+%include "blocks/peak_detector2_fb.h"
%include "blocks/or_bb.h"
%include "blocks/or_ss.h"
%include "blocks/or_ii.h"
+%include "blocks/regenerate_bb.h"
%include "blocks/repeat.h"
%include "blocks/rms_cf.h"
%include "blocks/rms_ff.h"
@@ -301,9 +305,11 @@ GR_SWIG_BLOCK_MAGIC2(blocks, patterned_interleaver);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, packed_to_unpacked_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, peak_detector2_fb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, or_ii);
+GR_SWIG_BLOCK_MAGIC2(blocks, regenerate_bb);
GR_SWIG_BLOCK_MAGIC2(blocks, repeat);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_cf);
GR_SWIG_BLOCK_MAGIC2(blocks, rms_ff);