diff options
author | Josh Blum | 2012-12-01 13:55:48 -0800 |
---|---|---|
committer | Josh Blum | 2012-12-01 13:55:48 -0800 |
commit | a1449c97eefa1635680ede98f61ab3538c56eb21 (patch) | |
tree | 64879533cb17caad2e6cab085a5fba0ef6abfe06 | |
parent | 999d15b5dca5de7c32ddb87469d5c78136473de7 (diff) | |
download | sandhi-a1449c97eefa1635680ede98f61ab3538c56eb21.tar.gz sandhi-a1449c97eefa1635680ede98f61ab3538c56eb21.tar.bz2 sandhi-a1449c97eefa1635680ede98f61ab3538c56eb21.zip |
changed lookahead to preload, thats all it is
m--------- | gnuradio | 0 | ||||
-rw-r--r-- | include/gras/block.hpp | 14 | ||||
-rw-r--r-- | lib/block.cpp | 2 | ||||
-rw-r--r-- | lib/block_allocator.cpp | 10 | ||||
-rw-r--r-- | lib/block_handlers.cpp | 1 | ||||
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 18 | ||||
-rw-r--r-- | lib/gras_impl/messages.hpp | 1 | ||||
-rw-r--r-- | lib/topology_handler.cpp | 4 |
8 files changed, 22 insertions, 28 deletions
diff --git a/gnuradio b/gnuradio -Subproject 6c619cf23423d771289a34dbe8aa8937a42fca8 +Subproject ead17717d94cd40b153a8748bf5a1f94b13969c diff --git a/include/gras/block.hpp b/include/gras/block.hpp index 68bd051..71da047 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -58,15 +58,19 @@ struct GRAS_API InputPortConfig bool inline_buffer; /*! - * Set the number of input buffer look-ahead items. - * When num look-ahead items are not consumed, - * they will be available for the next work call. - * This is used to implement sample memory for + * Preload the input queue with num preload items. + * All items preloaded into the buffer will be 0. + * This is used to implement zero-padding for * things like sliding dot products/FIR filters. * + * - Increasing the preload at runtime will + * inject more items into the input queue. + * - Decreasing the preload at runtime will + * consume random items from the input queue. + * * Default = 0. */ - size_t lookahead_items; + size_t preload_items; }; //! Configuration parameters for an output port diff --git a/lib/block.cpp b/lib/block.cpp index 945b1e9..878bd16 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -11,7 +11,7 @@ InputPortConfig::InputPortConfig(void) reserve_items = 1; maximum_items = 0; inline_buffer = false; - lookahead_items = 0; + preload_items = 0; } OutputPortConfig::OutputPortConfig(void) diff --git a/lib/block_allocator.cpp b/lib/block_allocator.cpp index 72d8150..64b3aed 100644 --- a/lib/block_allocator.cpp +++ b/lib/block_allocator.cpp @@ -10,7 +10,6 @@ using namespace gras; const size_t AT_LEAST_DEFAULT_ITEMS = 1 << 13; const size_t AHH_TOO_MANY_BYTES = 1 << 20; //TODO const size_t THIS_MANY_BUFFERS = 32; -const double EDGE_CASE_MITIGATION = 8.0; //edge case mitigation constant //TODO will need more complicated later @@ -39,15 +38,8 @@ static size_t recommend_length( min_bytes = std::max(min_bytes, hint.reserve_bytes); } - //step 2) N x super reserve to minimize history edge case + //step 2) N x super reserve of hard-coded mimimum items size_t Nmin_bytes = min_bytes; - BOOST_FOREACH(const OutputHintMessage &hint, hints) - { - while (hint.history_bytes*EDGE_CASE_MITIGATION > Nmin_bytes) - { - Nmin_bytes += min_bytes; - } - } while (hint_bytes > Nmin_bytes) { Nmin_bytes += min_bytes; diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index 3d66ec9..3eb39db 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -54,7 +54,6 @@ void BlockActor::handle_top_token( //TODO, schedule this message as a pre-allocation message //tell the upstream about the input requirements OutputHintMessage output_hints; - output_hints.history_bytes = this->input_configs[i].lookahead_items*this->input_items_sizes[i]; output_hints.reserve_bytes = this->input_configs[i].reserve_items*this->input_items_sizes[i]; output_hints.token = this->input_tokens[i]; this->post_upstream(i, output_hints); diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index a6b6ff8..e8b994b 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -169,7 +169,7 @@ struct InputBufferQueues std::vector<size_t> _reserve_bytes; std::vector<size_t> _maximum_bytes; std::vector<boost::circular_buffer<SBuffer> > _queues; - std::vector<size_t> _history_bytes; + std::vector<size_t> _preload_bytes; std::vector<boost::shared_ptr<BufferQueue> > _aux_queues; }; @@ -182,7 +182,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size) _reserve_bytes.resize(size, 1); _maximum_bytes.resize(size, MAX_AUX_BUFF_BYTES); _queues.resize(size, boost::circular_buffer<SBuffer>(MAX_QUEUE_SIZE)); - _history_bytes.resize(size, 0); + _preload_bytes.resize(size, 0); _aux_queues.resize(size); } @@ -190,7 +190,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::resize(const size_t size) inline void InputBufferQueues::update_config( const size_t i, const size_t item_size, - const size_t hist_bytes, + const size_t preload_bytes, const size_t reserve_bytes, const size_t maximum_bytes ) @@ -211,28 +211,28 @@ inline void InputBufferQueues::update_config( _aux_queues[i]->allocate_one(_maximum_bytes[i]); } - //there is history, so enqueue some initial history - if (hist_bytes > _history_bytes[i]) + //there is preload, so enqueue some initial preload + if (preload_bytes > _preload_bytes[i]) { SBuffer buff = _aux_queues[i]->front(); _aux_queues[i]->pop(); - const size_t delta = hist_bytes - _history_bytes[i]; + const size_t delta = preload_bytes - _preload_bytes[i]; std::memset(buff.get_actual_memory(), 0, delta); buff.offset = 0; buff.length = delta; this->push(i, buff); } - if (hist_bytes < _history_bytes[i]) + if (preload_bytes < _preload_bytes[i]) { - size_t delta = _history_bytes[i] - hist_bytes; + size_t delta = _preload_bytes[i] - preload_bytes; delta = std::min(delta, _enqueued_bytes[i]); //FIXME //TODO consume extra delta on push...? so we dont need std::min this->consume(i, delta); } - _history_bytes[i] = hist_bytes; + _preload_bytes[i] = preload_bytes; _reserve_bytes[i] = reserve_bytes; this->__update(i); } diff --git a/lib/gras_impl/messages.hpp b/lib/gras_impl/messages.hpp index bc6a2b8..eae3258 100644 --- a/lib/gras_impl/messages.hpp +++ b/lib/gras_impl/messages.hpp @@ -97,7 +97,6 @@ struct OutputCheckMessage struct OutputHintMessage { size_t index; - size_t history_bytes; size_t reserve_bytes; WeakToken token; }; diff --git a/lib/topology_handler.cpp b/lib/topology_handler.cpp index f434377..cf757d5 100644 --- a/lib/topology_handler.cpp +++ b/lib/topology_handler.cpp @@ -95,9 +95,9 @@ void BlockActor::handle_update_inputs( for (size_t i = 0; i < num_inputs; i++) { - const size_t hist_bytes = this->input_items_sizes[i]*this->input_configs[i].lookahead_items; + const size_t preload_bytes = this->input_items_sizes[i]*this->input_configs[i].preload_items; const size_t reserve_bytes = this->input_items_sizes[i]*this->input_configs[i].reserve_items; const size_t maximum_bytes = this->input_items_sizes[i]*this->input_configs[i].maximum_items; - this->input_queues.update_config(i, this->input_items_sizes[i], hist_bytes, reserve_bytes, maximum_bytes); + this->input_queues.update_config(i, this->input_items_sizes[i], preload_bytes, reserve_bytes, maximum_bytes); } } |