1 /* -*- c++ -*- */
2 /*
3 * Copyright 2005,2010,2013-2014 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23 #if HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include "unpack_k_bits_bb_impl.h"
28 #include <gnuradio/io_signature.h>
29 #include <iostream>
30 #include <stdexcept>
31
32 namespace gr {
33 namespace blocks {
34
make(unsigned k)35 unpack_k_bits_bb::sptr unpack_k_bits_bb::make(unsigned k)
36 {
37 return gnuradio::get_initial_sptr(new unpack_k_bits_bb_impl(k));
38 }
39
unpack_k_bits_bb_impl(unsigned k)40 unpack_k_bits_bb_impl::unpack_k_bits_bb_impl(unsigned k)
41 : sync_interpolator("unpack_k_bits_bb",
42 io_signature::make(1, 1, sizeof(unsigned char)),
43 io_signature::make(1, 1, sizeof(unsigned char)),
44 k)
45 {
46 d_unpack = new kernel::unpack_k_bits(k);
47 }
48
~unpack_k_bits_bb_impl()49 unpack_k_bits_bb_impl::~unpack_k_bits_bb_impl() { delete d_unpack; }
50
work(int noutput_items,gr_vector_const_void_star & input_items,gr_vector_void_star & output_items)51 int unpack_k_bits_bb_impl::work(int noutput_items,
52 gr_vector_const_void_star& input_items,
53 gr_vector_void_star& output_items)
54 {
55 const unsigned char* in = (const unsigned char*)input_items[0];
56 unsigned char* out = (unsigned char*)output_items[0];
57
58 d_unpack->unpack(out, in, noutput_items / d_unpack->k());
59
60 return noutput_items;
61 }
62
63 } /* namespace blocks */
64 } /* namespace gr */
65