commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8263 - in gnuradio/branches/releases/3.1/gnuradio-cor


From: jcorgan
Subject: [Commit-gnuradio] r8263 - in gnuradio/branches/releases/3.1/gnuradio-core/src: lib/general python/gnuradio/gr
Date: Wed, 23 Apr 2008 23:57:21 -0600 (MDT)

Author: jcorgan
Date: 2008-04-23 23:57:21 -0600 (Wed, 23 Apr 2008)
New Revision: 8263

Added:
   gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.cc
   gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.h
   gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.i
   
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
Modified:
   gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/Makefile.am
   gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/general.i
Log:
Applied changeset r8186 on trunk to release branch.

Modified: 
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/Makefile.am
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/Makefile.am    
2008-04-24 05:54:23 UTC (rev 8262)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/Makefile.am    
2008-04-24 05:57:21 UTC (rev 8263)
@@ -116,6 +116,7 @@
        gr_random.cc                    \
        gr_regenerate_bb.cc             \
        gr_remez.cc                     \
+       gr_repeat.cc                    \
        gr_reverse.cc                   \
        gr_rms_cf.cc                    \
        gr_rms_ff.cc                    \
@@ -249,6 +250,7 @@
        gr_random.h                     \
        gr_regenerate_bb.h              \
        gr_remez.h                      \
+       gr_repeat.h                     \
        gr_reverse.h                    \
        gr_rms_cf.h                     \
        gr_rms_ff.h                     \
@@ -384,6 +386,7 @@
        gr_remez.i                      \
        gr_rms_cf.i                     \
        gr_rms_ff.i                     \
+       gr_repeat.i                     \
        gr_short_to_float.i             \
        gr_simple_correlator.i          \
        gr_simple_framer.i              \

Modified: gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/general.i
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/general.i      
2008-04-24 05:54:23 UTC (rev 8262)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/general.i      
2008-04-24 05:57:21 UTC (rev 8263)
@@ -119,6 +119,7 @@
 #include <gr_glfsr_source_b.h>
 #include <gr_glfsr_source_f.h>
 #include <gr_peak_detector2_fb.h>
+#include <gr_repeat.h>
 %}
 
 %include "gr_nop.i"
@@ -218,3 +219,4 @@
 %include "gr_glfsr_source_b.i"
 %include "gr_glfsr_source_f.i"
 %include "gr_peak_detector2_fb.i"
+%include "gr_repeat.i"

Copied: 
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.cc (from 
rev 8186, gnuradio/trunk/gnuradio-core/src/lib/general/gr_repeat.cc)
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.cc   
                        (rev 0)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.cc   
2008-04-24 05:57:21 UTC (rev 8263)
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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_repeat.h>
+#include <gr_io_signature.h>
+
+gr_repeat_sptr 
+gr_make_repeat(size_t itemsize, int interp)
+{
+  return gr_repeat_sptr(new gr_repeat(itemsize, interp));
+}
+
+gr_repeat::gr_repeat(size_t itemsize, int interp)  
+  : gr_sync_interpolator("extend",
+                        gr_make_io_signature(1, 1, itemsize),
+                        gr_make_io_signature(1, 1, itemsize),
+                        interp),
+    d_interp(interp),
+    d_itemsize(itemsize)
+{
+}
+
+gr_repeat::~gr_repeat()
+{
+}
+
+int 
+gr_repeat::work(int noutput_items,
+                 gr_vector_const_void_star &input_items,
+                 gr_vector_void_star &output_items)
+{
+  const char *in = (const char *) input_items[0];
+  char *out = (char *)output_items[0];
+
+  for (int i = 0; i < noutput_items/d_interp; i++) {
+    for (int j = 0; j < d_interp; j++) {
+      memcpy(out, in, d_itemsize);
+      out += d_itemsize;
+    }
+
+    i += d_itemsize;
+  }
+
+  return noutput_items;
+}

Copied: 
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.h (from 
rev 8186, gnuradio/trunk/gnuradio-core/src/lib/general/gr_repeat.h)
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.h    
                        (rev 0)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.h    
2008-04-24 05:57:21 UTC (rev 8263)
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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_REPEAT_H
+#define INCLUDED_GR_REPEAT_H
+
+#include <gr_sync_interpolator.h>
+
+class gr_repeat;
+
+typedef boost::shared_ptr<gr_repeat> gr_repeat_sptr;
+
+gr_repeat_sptr gr_make_repeat(size_t itemsize, int decim);
+
+/*!
+ * \brief Repeat a sample 'interp' times in output stream
+ * \ingroup converter
+ */
+
+class gr_repeat : public gr_sync_interpolator
+{
+private:
+  friend gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp);
+                                                    
+  gr_repeat(size_t itemsize, int interp);
+
+  int d_interp;
+  int d_itemsize;
+
+ public:
+  ~gr_repeat();
+
+  int work(int noutput_items,
+          gr_vector_const_void_star &input_items,
+          gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_REPEAT_H */

Copied: 
gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.i (from 
rev 8186, gnuradio/trunk/gnuradio-core/src/lib/general/gr_repeat.i)
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.i    
                        (rev 0)
+++ gnuradio/branches/releases/3.1/gnuradio-core/src/lib/general/gr_repeat.i    
2008-04-24 05:57:21 UTC (rev 8263)
@@ -0,0 +1,11 @@
+/* -*- c++ -*- */
+
+GR_SWIG_BLOCK_MAGIC(gr,repeat);
+
+gr_repeat_sptr gr_make_repeat(size_t itemsize, int interp);
+
+class gr_repeat : public gr_sync_interpolator
+{
+private:
+  gr_repeat();
+};

Copied: 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
 (from rev 8186, 
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py)
===================================================================
--- 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
                            (rev 0)
+++ 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/gr/qa_repeat.py
    2008-04-24 05:57:21 UTC (rev 8263)
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 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_repeat (gr_unittest.TestCase):
+
+    def setUp (self):
+        self.tb = gr.top_block ()
+
+    def tearDown (self):
+        self.tb = None
+
+    def test_001_float(self):
+       src_data = [1.0, 2.0, 3.0]
+       dst_data = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0]
+       src = gr.vector_source_f(src_data)
+       rpt = gr.repeat(gr.sizeof_float, 3)
+       dst = gr.vector_sink_f()
+       self.tb.connect(src, rpt, dst)
+       self.tb.run()
+       self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)      
+
+if __name__ == '__main__':
+    gr_unittest.main ()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]