From 4d576d8d00ca66214f6447d644ffc400530cb5c5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 15 Apr 2013 23:10:44 -0700 Subject: gras: make use of work buffer's vec call --- gnuradio-core/src/lib/runtime/gr_block.cc | 19 +++++++------------ gnuradio-core/src/lib/runtime/gr_block.h | 3 +-- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'gnuradio-core/src/lib/runtime') diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc index c243ff8d6..2848f34e8 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.cc +++ b/gnuradio-core/src/lib/runtime/gr_block.cc @@ -98,10 +98,9 @@ bool gr_block::stop(void) void gr_block::notify_topology(const size_t num_inputs, const size_t num_outputs) { + _num_outputs = num_outputs; _fcast_ninput_items.resize(num_inputs); _work_ninput_items.resize(num_inputs); - _work_input_items.resize(num_inputs); - _work_output_items.resize(num_outputs); this->check_topology(num_inputs, num_outputs); } @@ -127,8 +126,7 @@ void gr_block::work( for (size_t i = 0; i < num_inputs; i++) { _work_ninput_items[i] = input_items[i].size(); - _work_input_items[i] = input_items[i].get(); - _work_io_ptr_mask |= ptrdiff_t(_work_input_items[i]); + _work_io_ptr_mask |= ptrdiff_t(input_items.vec()[i]); if GRAS_UNLIKELY(_enable_fixed_rate and input_items[i].size() <= _input_history_items) { return this->mark_input_fail(i); @@ -143,8 +141,7 @@ void gr_block::work( num_output_items *= _output_multiple_items; for (size_t i = 0; i < num_outputs; i++) { - _work_output_items[i] = output_items[i].get(); - _work_io_ptr_mask |= ptrdiff_t(_work_output_items[i]); + _work_io_ptr_mask |= ptrdiff_t(output_items.vec()[i]); } //------------------------------------------------------------------ @@ -193,8 +190,8 @@ void gr_block::work( const int work_ret = this->general_work( work_noutput_items, _work_ninput_items, - _work_input_items, - _work_output_items + const_cast(input_items).vec(), + const_cast(output_items).vec() ); if GRAS_LIKELY(work_ret > 0) for (size_t i = 0; i < num_outputs; i++) @@ -212,13 +209,11 @@ static inline unsigned long long myullround(const double x) void gr_block::propagate_tags(const size_t which_input, const gras::TagIter &iter) { - const size_t num_outputs = _work_output_items.size(); - switch (_tag_prop_policy) { case TPP_DONT: break; //well that was ez case TPP_ALL_TO_ALL: - for (size_t out_i = 0; out_i < num_outputs; out_i++) + for (size_t out_i = 0; out_i < _num_outputs; out_i++) { BOOST_FOREACH(gras::Tag t, iter) { @@ -228,7 +223,7 @@ void gr_block::propagate_tags(const size_t which_input, const gras::TagIter &ite } break; case TPP_ONE_TO_ONE: - if (which_input < num_outputs) + if (which_input < _num_outputs) { BOOST_FOREACH(gras::Tag t, iter) { diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 44faa313a..9225e6910 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -351,8 +351,7 @@ struct GR_CORE_API gr_block : gras::Block gr_vector_int _work_ninput_items; gr_vector_int _fcast_ninput_items; - gr_vector_const_void_star _work_input_items; - gr_vector_void_star _work_output_items; + size_t _num_outputs; ptrdiff_t _work_io_ptr_mask; size_t _output_multiple_items; double _relative_rate; -- cgit