summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-27 10:51:56 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-27 10:51:56 -0500
commit7388cc248d523d55e74ebfd4e434cc9d82001949 (patch)
treea16e9386a35df508fbb96eb11c152d27b925d9b2 /gnuradio-core/src
parentdf24ead4ae562a6616d987663efa620008415c9c (diff)
blocks: removing (un)pack_k_bits 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_pack_k_bits_bb.cc69
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i34
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc70
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i34
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py67
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py57
10 files changed, 0 insertions, 449 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index d38d478e7d..b844cf302c 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -170,8 +170,6 @@ set(gr_core_general_triple_threats
gr_test
gr_vco_f
gr_vector_map
- gr_unpack_k_bits_bb
- gr_pack_k_bits_bb
gr_annotator_alltoall
gr_annotator_1to1
gr_annotator_raw
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 1769c1e832..ff4c95631b 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -47,8 +47,6 @@
#include <gr_constants.h>
#include <gr_test_types.h>
#include <gr_test.h>
-#include <gr_unpack_k_bits_bb.h>
-#include <gr_pack_k_bits_bb.h>
#include <gr_feval.h>
#include <gr_bin_statistics_f.h>
#include <gr_copy.h>
@@ -87,8 +85,6 @@
%include "gr_constants.i"
%include "gr_test_types.h"
%include "gr_test.i"
-%include "gr_unpack_k_bits_bb.i"
-%include "gr_pack_k_bits_bb.i"
%include "gr_feval.i"
%include "gr_bin_statistics_f.i"
%include "gr_copy.i"
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
deleted file mode 100644
index 0ea0c9e388..0000000000
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.cc
+++ /dev/null
@@ -1,69 +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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_pack_k_bits_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-
-gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb(unsigned k)
-{
- return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb(k));
-}
-
-
-gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k)
- : gr_sync_decimator("pack_k_bits_bb",
- gr_make_io_signature (1, 1, sizeof(unsigned char)),
- gr_make_io_signature (1, 1, sizeof(unsigned char)),
- k),
- d_k (k)
-{
- if (d_k == 0)
- throw std::out_of_range("interpolation must be > 0");
-}
-
-gr_pack_k_bits_bb::~gr_pack_k_bits_bb()
-{
-}
-
-int
-gr_pack_k_bits_bb::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *)input_items[0];
- unsigned char *out = (unsigned char *)output_items[0];
-
- for(int i = 0; i < noutput_items; i++) {
- out[i] = 0x00;
- for(unsigned int j = 0; j < d_k; j++) {
- out[i] |= (0x01 & in[i*d_k+j])<<(d_k-j-1);
- }
- }
-
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
deleted file mode 100644
index 8e1508c78b..0000000000
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.h
+++ /dev/null
@@ -1,56 +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_GR_PACK_K_BITS_BB_H
-#define INCLUDED_GR_PACK_K_BITS_BB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_decimator.h>
-
-class gr_pack_k_bits_bb;
-typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr;
-GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
-
-class gr_pack_k_bits_bb;
-
-/*!
- * \brief Converts a stream of bytes with 1 bit in the LSB to a byte with k relevent bits.
- * \ingroup converter_blk
- */
-class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator
-{
- private:
- friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k);
-
- gr_pack_k_bits_bb (unsigned k);
-
- unsigned d_k; // number of relevent bits to pack from k input bytes
-
- public:
- ~gr_pack_k_bits_bb ();
-
- 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_pack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i
deleted file mode 100644
index 6ae2095ec7..0000000000
--- a/gnuradio-core/src/lib/general/gr_pack_k_bits_bb.i
+++ /dev/null
@@ -1,34 +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.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,pack_k_bits_bb)
-
-gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (int k) throw(std::exception);
-
-class gr_pack_k_bits_bb : public gr_sync_decimator
-{
- private:
- gr_pack_k_bits_bb (int k);
-
- public:
- ~gr_pack_k_bits_bb ();
-};
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
deleted file mode 100644
index 00b88e9724..0000000000
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005,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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_unpack_k_bits_bb.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <iostream>
-
-gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k)
-{
- return gnuradio::get_initial_sptr(new gr_unpack_k_bits_bb (k));
-}
-
-
-gr_unpack_k_bits_bb::gr_unpack_k_bits_bb (unsigned k)
- : gr_sync_interpolator ("unpack_k_bits_bb",
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- gr_make_io_signature (1, 1, sizeof (unsigned char)),
- k),
- d_k (k)
-{
- if (d_k == 0)
- throw std::out_of_range ("interpolation must be > 0");
-}
-
-gr_unpack_k_bits_bb::~gr_unpack_k_bits_bb ()
-{
-}
-
-int
-gr_unpack_k_bits_bb::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const unsigned char *in = (const unsigned char *) input_items[0];
- unsigned char *out = (unsigned char *) output_items[0];
-
- int n = 0;
- for (unsigned int i = 0; i < noutput_items/d_k; i++){
- unsigned int t = in[i];
- for (int j = d_k - 1; j >= 0; j--)
- out[n++] = (t >> j) & 0x01;
- }
-
- assert(n == noutput_items);
- return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h
deleted file mode 100644
index c3ea28d3fa..0000000000
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 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_UNPACK_K_BITS_BB_H
-#define INCLUDED_GR_UNPACK_K_BITS_BB_H
-
-#include <gr_core_api.h>
-#include <gr_sync_interpolator.h>
-
-class gr_unpack_k_bits_bb;
-typedef boost::shared_ptr<gr_unpack_k_bits_bb> gr_unpack_k_bits_bb_sptr;
-GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
-
-class gr_unpack_k_bits_bb;
-
-/*!
- * \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB.
- * \ingroup converter_blk
- */
-class GR_CORE_API gr_unpack_k_bits_bb : public gr_sync_interpolator
-{
- private:
- friend GR_CORE_API gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (unsigned k);
-
- gr_unpack_k_bits_bb (unsigned k);
-
- unsigned d_k; // number of relevent bits to unpack into k output bytes
-
- public:
- ~gr_unpack_k_bits_bb ();
-
- 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_unpack_k_bits_bb.i b/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
deleted file mode 100644
index de0f4b33e7..0000000000
--- a/gnuradio-core/src/lib/general/gr_unpack_k_bits_bb.i
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 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,unpack_k_bits_bb)
-
-gr_unpack_k_bits_bb_sptr gr_make_unpack_k_bits_bb (int k) throw(std::exception);
-
-class gr_unpack_k_bits_bb : public gr_sync_interpolator
-{
- private:
- gr_unpack_k_bits_bb (int k);
-
- public:
- ~gr_unpack_k_bits_bb ();
-};
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py
deleted file mode 100755
index 25fc5e9fcc..0000000000
--- a/gnuradio-core/src/python/gnuradio/gr/qa_pack_k_bits.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,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 random
-
-class test_pack(gr_unittest.TestCase):
-
- def setUp(self):
- self.tb = gr.top_block ()
-
- def tearDown(self):
- self.tb = None
-
- def test_001(self):
- src_data = (1,0,1,1,0,1,1,0)
- expected_results = (1,0,1,1,0,1,1,0)
- src = gr.vector_source_b(src_data,False)
- op = gr.pack_k_bits_bb(1)
- dst = gr.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
- self.assertEqual(expected_results, dst.data())
-
- def test_002(self):
- src_data = (1,0,1,1,0,0,0,1)
- expected_results = ( 2, 3, 0, 1)
- src = gr.vector_source_b(src_data,False)
- op = gr.pack_k_bits_bb(2)
- dst = gr.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
- #self.assertEqual(expected_results, dst.data())
- self.assertEqual(expected_results, dst.data())
-
- def test_003(self):
- src_data = expected_results = map(lambda x: random.randint(0,3), range(10));
- src = gr.vector_source_b( src_data );
- pack = gr.pack_k_bits_bb(2);
- unpack = gr.unpack_k_bits_bb(2);
- snk = gr.vector_sink_b();
- self.tb.connect(src,unpack,pack,snk);
- self.tb.run()
- self.assertEqual(list(expected_results), list(snk.data()));
-
-if __name__ == '__main__':
- gr_unittest.run(test_pack, "test_pack.xml")
-
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py b/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
deleted file mode 100755
index bb4e7733d4..0000000000
--- a/gnuradio-core/src/python/gnuradio/gr/qa_unpack_k_bits.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,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 random
-
-class test_unpack(gr_unittest.TestCase):
-
- def setUp(self):
- self.tb = gr.top_block ()
-
- def tearDown(self):
- self.tb = None
-
- def test_001(self):
- src_data = (1,0,1,1,0,1,1,0)
- expected_results = (1,0,1,1,0,1,1,0)
- src = gr.vector_source_b(src_data,False)
- op = gr.unpack_k_bits_bb(1)
- dst = gr.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
- self.assertEqual(expected_results, dst.data())
-
- def test_002(self):
- src_data = ( 2, 3, 0, 1)
- expected_results = (1,0,1,1,0,0,0,1)
- src = gr.vector_source_b(src_data,False)
- op = gr.unpack_k_bits_bb(2)
- dst = gr.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
- self.assertEqual(expected_results, dst.data())
-
-
-if __name__ == '__main__':
- gr_unittest.run(test_unpack, "test_unpack.xml")
-