diff options
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/deinterleave.h | 6 | ||||
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/interleave.h | 6 | ||||
-rw-r--r-- | gr-blocks/lib/deinterleave_impl.cc | 27 | ||||
-rw-r--r-- | gr-blocks/lib/deinterleave_impl.h | 9 | ||||
-rw-r--r-- | gr-blocks/lib/interleave_impl.cc | 33 | ||||
-rw-r--r-- | gr-blocks/lib/interleave_impl.h | 8 |
6 files changed, 34 insertions, 55 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/deinterleave.h b/gr-blocks/include/gnuradio/blocks/deinterleave.h index 8e29873945..a3b5480089 100644 --- a/gr-blocks/include/gnuradio/blocks/deinterleave.h +++ b/gr-blocks/include/gnuradio/blocks/deinterleave.h @@ -67,12 +67,8 @@ namespace gr { * * \param itemsize stream itemsize * \param blocksize size of block to deinterleave - * \param set_rel_rate should the block set the relative_rate - * - changes tags locations and may not be appropriate - * for all circumstances. */ - static sptr make(size_t itemsize, unsigned int blocksize = 1, - bool set_rel_rate=true); + static sptr make(size_t itemsize, unsigned int blocksize = 1); }; } /* namespace blocks */ diff --git a/gr-blocks/include/gnuradio/blocks/interleave.h b/gr-blocks/include/gnuradio/blocks/interleave.h index 8e68ce97c0..7f7587d267 100644 --- a/gr-blocks/include/gnuradio/blocks/interleave.h +++ b/gr-blocks/include/gnuradio/blocks/interleave.h @@ -68,12 +68,8 @@ namespace gr { * * \param itemsize stream itemsize * \param blocksize size of block of samples to interleave - * \param set_rel_rate should the block set the relative_rate - * - changes tags locations and may not be appropriate - * for all circumstances. */ - static sptr make(size_t itemsize, unsigned int blocksize = 1, - bool set_rel_rate=true); + static sptr make(size_t itemsize, unsigned int blocksize = 1); }; } /* namespace blocks */ diff --git a/gr-blocks/lib/deinterleave_impl.cc b/gr-blocks/lib/deinterleave_impl.cc index 025e2b62c5..5e1cc5221d 100644 --- a/gr-blocks/lib/deinterleave_impl.cc +++ b/gr-blocks/lib/deinterleave_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012,2014 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -30,20 +30,16 @@ namespace gr { namespace blocks { - deinterleave::sptr deinterleave::make(size_t itemsize, unsigned int blocksize, - bool set_rel_rate) + deinterleave::sptr deinterleave::make(size_t itemsize, unsigned int blocksize) { - return gnuradio::get_initial_sptr - (new deinterleave_impl(itemsize, blocksize, set_rel_rate)); + return gnuradio::get_initial_sptr(new deinterleave_impl(itemsize, blocksize)); } - - deinterleave_impl::deinterleave_impl(size_t itemsize, unsigned int blocksize, - bool set_rel_rate) + + deinterleave_impl::deinterleave_impl(size_t itemsize, unsigned int blocksize) : block("deinterleave", io_signature::make (1, 1, itemsize), io_signature::make (1, io_signature::IO_INFINITE, itemsize)), - d_itemsize(itemsize), d_blocksize(blocksize), d_current_output(0), - d_set_rel_rate(set_rel_rate) + d_itemsize(itemsize), d_blocksize(blocksize), d_current_output(0) { set_output_multiple(blocksize); } @@ -51,12 +47,11 @@ namespace gr { bool deinterleave_impl::check_topology(int ninputs, int noutputs) { - if(d_set_rel_rate) - set_relative_rate(1.0/static_cast<double>(noutputs)); + set_relative_rate((double)noutputs); d_noutputs = noutputs; return true; } - + int deinterleave_impl::general_work(int noutput_items, gr_vector_int& ninput_items, @@ -65,14 +60,14 @@ namespace gr { { const char *in = (const char*)input_items[0]; char **out = (char**)&output_items[0]; - + memcpy(out[d_current_output], in, d_itemsize * d_blocksize); consume_each(d_blocksize); produce(d_current_output, d_blocksize); d_current_output = (d_current_output + 1) % d_noutputs; return WORK_CALLED_PRODUCE; } - - + + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/deinterleave_impl.h b/gr-blocks/lib/deinterleave_impl.h index 8ca61e5023..a7a9e0a8fa 100644 --- a/gr-blocks/lib/deinterleave_impl.h +++ b/gr-blocks/lib/deinterleave_impl.h @@ -30,16 +30,15 @@ namespace gr { class BLOCKS_API deinterleave_impl : public deinterleave { - + size_t d_itemsize; unsigned int d_blocksize; unsigned int d_current_output; unsigned int d_noutputs; - bool d_set_rel_rate; + public: - deinterleave_impl(size_t itemsize, unsigned int blocksize, - bool set_rel_rate=true); + deinterleave_impl(size_t itemsize, unsigned int blocksize); bool check_topology(int ninputs, int noutputs); @@ -52,6 +51,6 @@ namespace gr { } /* namespace blocks */ } /* namespace gr */ - + #endif /* INCLUDED_DEINTERLEAVE_IMPL_H */ diff --git a/gr-blocks/lib/interleave_impl.cc b/gr-blocks/lib/interleave_impl.cc index 5584eec601..22d6488f7a 100644 --- a/gr-blocks/lib/interleave_impl.cc +++ b/gr-blocks/lib/interleave_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012,2014 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -29,21 +29,17 @@ namespace gr { namespace blocks { - - interleave::sptr interleave::make(size_t itemsize, unsigned int blocksize, - bool set_rel_rate) + + interleave::sptr interleave::make(size_t itemsize, unsigned int blocksize) { - return gnuradio::get_initial_sptr - (new interleave_impl(itemsize, blocksize, set_rel_rate)); + return gnuradio::get_initial_sptr(new interleave_impl(itemsize, blocksize)); } - - interleave_impl::interleave_impl(size_t itemsize, unsigned int blocksize, - bool set_rel_rate) + + interleave_impl::interleave_impl(size_t itemsize, unsigned int blocksize) : block("interleave", io_signature::make (1, io_signature::IO_INFINITE, itemsize), io_signature::make (1, 1, itemsize)), - d_itemsize(itemsize), d_blocksize(blocksize), - d_set_rel_rate(set_rel_rate) + d_itemsize(itemsize), d_blocksize(blocksize) { set_fixed_rate(true); set_output_multiple(d_blocksize); @@ -52,14 +48,13 @@ namespace gr { bool interleave_impl::check_topology(int ninputs, int noutputs) { - if(d_set_rel_rate) - set_relative_rate(static_cast<double>(ninputs)); + set_relative_rate((double)ninputs); d_ninputs = ninputs; set_output_multiple(d_blocksize * d_ninputs); return true; } - - + + int interleave_impl::fixed_rate_ninput_to_noutput(int ninput) { @@ -71,7 +66,7 @@ namespace gr { { return (int) ((noutput / d_ninputs) + .5); } - + void interleave_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) @@ -90,7 +85,7 @@ namespace gr { size_t noutput_blocks = (size_t) ((noutput_items/d_blocksize) + .5); const char **in = (const char**)&input_items[0]; char *out = (char*)output_items[0]; - + for (unsigned int i = 0; i < noutput_blocks; i += d_ninputs) { for (unsigned int n = 0; n < d_ninputs; n++){ memcpy(out, in[n], d_itemsize * d_blocksize); @@ -103,7 +98,7 @@ namespace gr { } - - + + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/interleave_impl.h b/gr-blocks/lib/interleave_impl.h index a54dfe7e78..c74127fca5 100644 --- a/gr-blocks/lib/interleave_impl.h +++ b/gr-blocks/lib/interleave_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2012,2014 Free Software Foundation, Inc. + * Copyright 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -33,11 +33,9 @@ namespace gr { size_t d_itemsize; unsigned int d_blocksize; unsigned int d_ninputs; - bool d_set_rel_rate; public: - interleave_impl(size_t itemsize, unsigned int blocksize, - bool set_rel_rate=true); + interleave_impl(size_t itemsize, unsigned int blocksize); bool check_topology(int ninputs, int noutputs); @@ -60,6 +58,6 @@ namespace gr { } /* namespace blocks */ } /* namespace gr */ - + #endif /* INCLUDED_INTERLEAVE_IMPL_H */ |