summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2012-09-19 05:05:16 -0700
committerJosh Blum2012-09-19 05:05:16 -0700
commitf8b41cfacd40b5fe6ce9807598b6163837026b59 (patch)
tree26f500d79d904e281a70546137d87dd308dc1a53
parent62ad9b0cd23c5ea744f572fe78cb5290ae2d07d3 (diff)
downloadsandhi-f8b41cfacd40b5fe6ce9807598b6163837026b59.tar.gz
sandhi-f8b41cfacd40b5fe6ce9807598b6163837026b59.tar.bz2
sandhi-f8b41cfacd40b5fe6ce9807598b6163837026b59.zip
nop for default forecast, always call
-rw-r--r--lib/block.cpp14
-rw-r--r--lib/block_handlers.cpp2
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp16
3 files changed, 16 insertions, 16 deletions
diff --git a/lib/block.cpp b/lib/block.cpp
index d5e2399..c391c05 100644
--- a/lib/block.cpp
+++ b/lib/block.cpp
@@ -220,17 +220,9 @@ void Block::get_tags_in_range(
}
}
-void Block::forecast(
- int noutput_items,
- std::vector<int> &ninput_items_required
-){
- if (not (*this)->enable_fixed_rate) return;
- for (size_t i = 0; i < ninput_items_required.size(); i++)
- {
- ninput_items_required[i] =
- (*this)->input_history_items[i] +
- myulround((noutput_items/(*this)->relative_rate));
- }
+void Block::forecast(int, std::vector<int> &)
+{
+ //NOP
}
bool Block::start(void)
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp
index a069387..6db4ca3 100644
--- a/lib/block_handlers.cpp
+++ b/lib/block_handlers.cpp
@@ -177,7 +177,7 @@ void ElementImpl::topology_update(const tsbe::TaskInterface &task_iface)
this->produce_items.resize(num_outputs, 0);
this->input_queues.resize(num_inputs);
this->output_queues.resize(num_outputs);
- this->forecast_enable = not this->enable_fixed_rate;
+ this->forecast_enable = true;
this->input_tokens.resize(num_inputs);
this->output_tokens.resize(num_outputs);
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index c4e105c..218a93d 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -158,6 +158,7 @@ inline void InputBufferQueues::init(
_aux_queues[i] = boost::shared_ptr<BufferQueue>(new BufferQueue());
//determine byte sizes for buffers and dealing with history
+ const size_t old_history = _history_bytes[i];
_history_bytes[i] = input_item_sizes[i]*input_history_items[i];
//calculate the input multiple aka reserve size
@@ -182,20 +183,27 @@ inline void InputBufferQueues::init(
_aux_queues[i]->allocate_one(num_bytes);
//there is history, so enqueue some initial history
- if (_history_bytes[i] != 0 and _enqueued_bytes[i] < _history_bytes[i])
+ if (_history_bytes[i] > old_history)
{
SBuffer buff = _aux_queues[i]->front();
_aux_queues[i]->pop();
- const size_t hist_bytes = _history_bytes[i];
- std::memset(buff.get_actual_memory(), 0, hist_bytes);
+ const size_t delta = _history_bytes[i] - old_history;
+ std::memset(buff.get_actual_memory(), 0, delta);
buff.offset = 0;
- buff.length = hist_bytes;
+ buff.length = delta;
this->push(i, buff);
//_queues[i].push_front(buff);
//_in_hist_buff[i] = true;
}
+ if (_history_bytes[i] < old_history)
+ {
+ size_t delta = old_history - _history_bytes[i];
+ delta = std::min(delta, _enqueued_bytes[i]); //FIXME
+ //TODO consume extra delta on push...? so we dont need std::min
+ this->consume(i, delta);
+ }
}
}