diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-05-16 12:17:25 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-05-17 17:45:16 -0400 |
commit | 0db24ffd533cc4b0e22f82c5d6a4713892bb5ef7 (patch) | |
tree | 8d5166be35b9f947825900a8d5ecf2055b0e6eb3 /gr-blocks/lib/unpack_k_bits_bb_impl.cc | |
parent | f23b3106cd2c73be3708c29dc85afb37298d4731 (diff) |
blocks: adds kernels for pack_k_bits and unpack_k_bits.
Diffstat (limited to 'gr-blocks/lib/unpack_k_bits_bb_impl.cc')
-rw-r--r-- | gr-blocks/lib/unpack_k_bits_bb_impl.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/gr-blocks/lib/unpack_k_bits_bb_impl.cc b/gr-blocks/lib/unpack_k_bits_bb_impl.cc index 70055f9381..caf3d059d6 100644 --- a/gr-blocks/lib/unpack_k_bits_bb_impl.cc +++ b/gr-blocks/lib/unpack_k_bits_bb_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2010,2013 Free Software Foundation, Inc. + * Copyright 2005,2010,2013-2014 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -41,17 +41,16 @@ namespace gr { unpack_k_bits_bb_impl::unpack_k_bits_bb_impl(unsigned k) : sync_interpolator("unpack_k_bits_bb", - io_signature::make(1, 1, sizeof(unsigned char)), - io_signature::make(1, 1, sizeof(unsigned char)), - k), - d_k(k) + io_signature::make(1, 1, sizeof(unsigned char)), + io_signature::make(1, 1, sizeof(unsigned char)), + k) { - if(d_k == 0) - throw std::out_of_range("interpolation must be > 0"); + d_unpack = new kernel::unpack_k_bits(k); } unpack_k_bits_bb_impl::~unpack_k_bits_bb_impl() { + delete d_unpack; } int @@ -61,15 +60,9 @@ namespace gr { { 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); + d_unpack->unpack(out, in, noutput_items/d_unpack->k()); + return noutput_items; } |