summaryrefslogtreecommitdiff
path: root/gr-blocks
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-05-02 12:48:34 -0400
committerTom Rondeau <tom@trondeau.com>2014-05-17 17:45:14 -0400
commit4c2cb19a23a0b608617330bba80dd19cbb0c37dc (patch)
tree13045f35312e64677a1a95029bb715158b6223eb /gr-blocks
parentdd62061699a53e535f57a0ce0587bf1485db734f (diff)
fec: changed puncture block for easier to use API.
Added documentation; added QA code.
Diffstat (limited to 'gr-blocks')
-rw-r--r--gr-blocks/grc/blocks_deinterleave.xml128
-rw-r--r--gr-blocks/grc/blocks_interleave.xml128
-rw-r--r--gr-blocks/include/gnuradio/blocks/deinterleave.h28
-rw-r--r--gr-blocks/include/gnuradio/blocks/interleave.h27
-rwxr-xr-xgr-blocks/python/blocks/qa_interleave.py43
5 files changed, 201 insertions, 153 deletions
diff --git a/gr-blocks/grc/blocks_deinterleave.xml b/gr-blocks/grc/blocks_deinterleave.xml
index 6af6d3c17a..4ada49dc38 100644
--- a/gr-blocks/grc/blocks_deinterleave.xml
+++ b/gr-blocks/grc/blocks_deinterleave.xml
@@ -5,70 +5,70 @@
###################################################
-->
<block>
- <name>Deinterleave</name>
- <key>blocks_deinterleave</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.deinterleave($type.size*$vlen, $blocksize)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
+ <name>Deinterleave</name>
+ <key>blocks_deinterleave</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.deinterleave($type.size*$vlen, $blocksize)</make>
<param>
- <name>Block Size</name>
- <key>blocksize</key>
- <value>1</value>
- <type>int</type>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Block Size</name>
+ <key>blocksize</key>
+ <value>1</value>
+ <type>int</type>
<hide>part</hide>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </source>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </source>
</block>
diff --git a/gr-blocks/grc/blocks_interleave.xml b/gr-blocks/grc/blocks_interleave.xml
index 675693bf19..69fb15e2cf 100644
--- a/gr-blocks/grc/blocks_interleave.xml
+++ b/gr-blocks/grc/blocks_interleave.xml
@@ -5,70 +5,70 @@
###################################################
-->
<block>
- <name>Interleave</name>
- <key>blocks_interleave</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.interleave($type.size*$vlen, $blocksize)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
+ <name>Interleave</name>
+ <key>blocks_interleave</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.interleave($type.size*$vlen, $blocksize)</make>
<param>
- <name>Block Size</name>
- <key>blocksize</key>
- <value>1</value>
- <type>int</type>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Streams</name>
+ <key>num_streams</key>
+ <value>2</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Block Size</name>
+ <key>blocksize</key>
+ <value>1</value>
+ <type>int</type>
<hide>part</hide>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$num_streams &gt; 0</check>
+ <check>$vlen &gt;= 1</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_streams</nports>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
</block>
diff --git a/gr-blocks/include/gnuradio/blocks/deinterleave.h b/gr-blocks/include/gnuradio/blocks/deinterleave.h
index a79649fd73..a3b5480089 100644
--- a/gr-blocks/include/gnuradio/blocks/deinterleave.h
+++ b/gr-blocks/include/gnuradio/blocks/deinterleave.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -30,8 +30,31 @@ namespace gr {
namespace blocks {
/*!
- * \brief deinterleave a single input into N outputs
+ * \brief deinterleave an input block of samples into N outputs.
* \ingroup stream_operators_blk
+ *
+ * \details
+ * This block deinterleaves blocks of samples. For each output
+ * connection, the input stream will be deinterleaved successively
+ * to the output connections. By default, the block deinterleaves
+ * a single input to each output unless blocksize is given in the
+ * constructor.
+ *
+ * \code
+ * blocksize = 1
+ * connections = 2
+ * input = [a, b, c, d, e, f, g, h]
+ * output[0] = [a, c, e, g]
+ * output[1] = [b, d, f, h]
+ * \endcode
+ *
+ * \code
+ * blocksize = 2
+ * connections = 2
+ * input = [a, b, c, d, e, f, g, h]
+ * output[0] = [a, b, e, f]
+ * output[1] = [c, d, g, h]
+ * \endcode
*/
class BLOCKS_API deinterleave : virtual public block
{
@@ -43,6 +66,7 @@ namespace gr {
* Make a deinterleave block.
*
* \param itemsize stream itemsize
+ * \param blocksize size of block to deinterleave
*/
static sptr make(size_t itemsize, unsigned int blocksize = 1);
};
diff --git a/gr-blocks/include/gnuradio/blocks/interleave.h b/gr-blocks/include/gnuradio/blocks/interleave.h
index 811c3e3a29..7f7587d267 100644
--- a/gr-blocks/include/gnuradio/blocks/interleave.h
+++ b/gr-blocks/include/gnuradio/blocks/interleave.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2012 Free Software Foundation, Inc.
+ * Copyright 2012,2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -32,6 +32,30 @@ namespace gr {
/*!
* \brief interleave N inputs into a single output
* \ingroup stream_operators_blk
+ *
+ * \details
+ *
+ * This block interleaves blocks of samples. For each input
+ * connection, the samples are interleaved successively to the
+ * output connection. By default, the block interleaves a single
+ * sample from eahc input to the output unless blocksize is given
+ * in the constructor.
+ *
+ * \code
+ * blocksize = 1
+ * connections = 2
+ * input[0] = [a, c, e, g]
+ * input[1] = [b, d, f, h]
+ * output = [a, b, c, d, e, f, g, h]
+ * \endcode
+ *
+ * \code
+ * blocksize = 2
+ * connections = 2
+ * input[0] = [a, b, e, f]
+ * input[1] = [c, d, g, h]
+ * output = [a, b, c, d, e, f, g, h]
+ * \endcode
*/
class BLOCKS_API interleave : virtual public block
{
@@ -43,6 +67,7 @@ namespace gr {
* Make a stream interleave block.
*
* \param itemsize stream itemsize
+ * \param blocksize size of block of samples to interleave
*/
static sptr make(size_t itemsize, unsigned int blocksize = 1);
};
diff --git a/gr-blocks/python/blocks/qa_interleave.py b/gr-blocks/python/blocks/qa_interleave.py
index d2a04cc91c..526e4a4e6f 100755
--- a/gr-blocks/python/blocks/qa_interleave.py
+++ b/gr-blocks/python/blocks/qa_interleave.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
+# Copyright 2004,2007,2010,2012-2014 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -50,17 +50,17 @@ class test_interleave (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual (expected_result, result_data)
def test_int_002 (self):
- blksize = 4;
- lenx = 64;
- plusup_big = lambda a: a + (blksize * 4);
- plusup_little = lambda a: a + blksize;
- a_vec = range(0,blksize);
+ blksize = 4
+ lenx = 64
+ plusup_big = lambda a: a + (blksize * 4)
+ plusup_little = lambda a: a + blksize
+ a_vec = range(0,blksize)
for i in range(0,(lenx/(4 * blksize)) - 1):
- a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:]);
-
- b_vec = map(plusup_little, a_vec);
- c_vec = map(plusup_little, b_vec);
- d_vec = map(plusup_little, c_vec);
+ a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:])
+
+ b_vec = map(plusup_little, a_vec)
+ c_vec = map(plusup_little, b_vec)
+ d_vec = map(plusup_little, c_vec)
src0 = blocks.vector_source_f (a_vec)
src1 = blocks.vector_source_f (b_vec)
@@ -107,8 +107,8 @@ class test_interleave (gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual (expected_result3, dst3.data ())
def test_deint_002 (self):
- blksize = 4;
- lenx = 64;
+ blksize = 4
+ lenx = 64
src = blocks.vector_source_f (range (lenx))
op = blocks.deinterleave (gr.sizeof_float, blksize)
dst0 = blocks.vector_sink_f ()
@@ -123,15 +123,15 @@ class test_interleave (gr_unittest.TestCase):
self.tb.connect ((op, 3), dst3)
self.tb.run ()
- plusup_big = lambda a: a + (blksize * 4);
- plusup_little = lambda a: a + blksize;
- a_vec = range(0,blksize);
+ plusup_big = lambda a: a + (blksize * 4)
+ plusup_little = lambda a: a + blksize
+ a_vec = range(0,blksize)
for i in range(0,(lenx/(4 * blksize)) - 1):
- a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:]);
-
- b_vec = map(plusup_little, a_vec);
- c_vec = map(plusup_little, b_vec);
- d_vec = map(plusup_little, c_vec);
+ a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:])
+
+ b_vec = map(plusup_little, a_vec)
+ c_vec = map(plusup_little, b_vec)
+ d_vec = map(plusup_little, c_vec)
expected_result0 = tuple (a_vec)
expected_result1 = tuple (b_vec)
@@ -145,4 +145,3 @@ class test_interleave (gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_interleave, "test_interleave.xml")
-