diff options
author | Josh Blum | 2012-09-25 14:24:10 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-25 14:24:10 -0700 |
commit | 0387b43c9c6ea549db06dec3a9412126ad6e7ea1 (patch) | |
tree | 5bfa7f64e5040659826024c20d53e3e84345302f /lib | |
parent | 060a73191e0f234e69157199c47bdad33c0fa42a (diff) | |
download | sandhi-0387b43c9c6ea549db06dec3a9412126ad6e7ea1.tar.gz sandhi-0387b43c9c6ea549db06dec3a9412126ad6e7ea1.tar.bz2 sandhi-0387b43c9c6ea549db06dec3a9412126ad6e7ea1.zip |
still hate history, time dilation, this is better
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block.cpp | 1 | ||||
-rw-r--r-- | lib/block_task.cpp | 2 | ||||
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 35 |
3 files changed, 27 insertions, 11 deletions
diff --git a/lib/block.cpp b/lib/block.cpp index b50c49d..c11fb18 100644 --- a/lib/block.cpp +++ b/lib/block.cpp @@ -131,7 +131,6 @@ void Block::set_fixed_rate(const bool fixed_rate) void Block::set_relative_rate(double relative_rate) { (*this)->relative_rate = relative_rate; - this->set_fixed_rate(true); } double Block::relative_rate(void) const diff --git a/lib/block_task.cpp b/lib/block_task.cpp index 6329ab0..dda7dcc 100644 --- a/lib/block_task.cpp +++ b/lib/block_task.cpp @@ -107,7 +107,7 @@ void ElementImpl::handle_task(const tsbe::TaskInterface &task_iface) ASSERT(this->input_queues.ready(i)); bool potential_inline; - const SBuffer buff = this->input_queues.front(i, potential_inline); + const SBuffer buff = this->input_queues.front(i, this->enable_fixed_rate, potential_inline); void *mem = buff.get(); const size_t items = buff.length/this->input_items_sizes[i]; diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index c692e2b..f69ba62 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -43,7 +43,7 @@ struct InputBufferQueues ); //! Call to get an input buffer for work - SBuffer front(const size_t i, bool &potential_GRAS_FORCE_INLINE); + SBuffer front(const size_t i, const bool conserve_history, bool &potential_GRAS_FORCE_INLINE); //! Call when input bytes consumed by work void consume(const size_t i, const size_t bytes_consumed); @@ -196,7 +196,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::init( } -GRAS_FORCE_INLINE SBuffer InputBufferQueues::front(const size_t i, bool &potential_inline) +GRAS_FORCE_INLINE SBuffer InputBufferQueues::front(const size_t i, const bool conserve_history, bool &potential_inline) { //if (_queues[i].empty()) return BuffInfo(); @@ -209,7 +209,7 @@ GRAS_FORCE_INLINE SBuffer InputBufferQueues::front(const size_t i, bool &potenti //same buffer, different offset and length SBuffer buff = front; - buff.length -= _history_bytes[i]; + if (conserve_history) buff.length -= _history_bytes[i]; buff.length /= _multiple_bytes[i]; buff.length *= _multiple_bytes[i]; @@ -223,7 +223,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::__prepare(const size_t i) { //HERE(); //assumes that we are always pushing proper history buffs on front - ASSERT(_queues[i].front().length >= _history_bytes[i]); + //ASSERT(_queues[i].front().length >= _history_bytes[i]); while (_queues[i].front().length < _reserve_bytes[i]) { @@ -288,18 +288,35 @@ GRAS_FORCE_INLINE void InputBufferQueues::consume(const size_t i, const size_t b else if (_in_aux_buff[i] and _queues[i].front().offset >= 2*_history_bytes[i]) { - _in_aux_buff[i] = false; - const size_t residual = _queues[i].front().length; + const SBuffer buff = _queues[i].front(); _queues[i].pop_front(); - ASSERT(not _queues[i].empty()); - _queues[i].front().length += residual; - _queues[i].front().offset -= residual; + + if (_queues[i].empty()) + { + _queues[i].push_front(buff); + } + else + { + _in_aux_buff[i] = false; + const size_t residual = buff.length; + _queues[i].front().length += residual; + _queues[i].front().offset -= residual; + } } //update the number of bytes in this queue ASSERT(_enqueued_bytes[i] >= bytes_consumed); _enqueued_bytes[i] -= bytes_consumed; + + //we have consumed the history, change reqs + if (_enqueued_bytes[i] < _history_bytes[i]) + { + _history_bytes[i] = 0; + _reserve_bytes[i] = _multiple_bytes[i]; + } + __update(i); + } } //namespace gnuradio |