summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authorTom Rondeau2012-02-02 16:34:23 -0500
committerTom Rondeau2012-02-02 16:34:23 -0500
commitc6519775ac7d1e9098ca2fb20c09e15ae8e60a4a (patch)
tree513e1b0e6038d1c3227808c70f14a1c9d3a17d9c /gnuradio-core/src
parent070a6c9ce93c2f2043a0145e253cc55f801f9433 (diff)
downloadgnuradio-c6519775ac7d1e9098ca2fb20c09e15ae8e60a4a.tar.gz
gnuradio-c6519775ac7d1e9098ca2fb20c09e15ae8e60a4a.tar.bz2
gnuradio-c6519775ac7d1e9098ca2fb20c09e15ae8e60a4a.zip
sched: better working alignment handling.
Works with max_noutput_items and set_output_multiple.
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc53
1 files changed, 25 insertions, 28 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index 02bb4873c..11c6639b3 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -83,11 +83,6 @@ min_available_space (gr_block_detail *d, int output_multiple)
}
return 0;
}
- else if (n > output_multiple) {
- // adjust this or we often ask for too many,
- // causing a re-calc for fewer items.
- n = n-output_multiple;
- }
min_space = std::min (min_space, n);
}
return min_space;
@@ -316,7 +311,7 @@ gr_block_executor::run_one_iteration()
// only test this if we specifically set the output_multiple
if(m->output_multiple_set())
- reqd_noutput_items = round_up(reqd_noutput_items, m->output_multiple());
+ reqd_noutput_items = round_down(reqd_noutput_items, m->output_multiple());
if (reqd_noutput_items > 0 && reqd_noutput_items <= noutput_items)
noutput_items = reqd_noutput_items;
@@ -329,32 +324,34 @@ gr_block_executor::run_one_iteration()
// Check if we're still unaligned; use up items until we're
// aligned again. Otherwise, make sure we set the alignment
// requirement.
- if(m->is_unaligned()) {
- // When unaligned, don't just set noutput_items to the remaining
- // samples to meet alignment; this causes too much overhead in
- // requiring a premature call back here. Set the maximum amount
- // of samples to handle unalignment and get us back aligned.
- if(noutput_items >= m->unaligned()) {
- noutput_items = round_up(noutput_items, m->alignment()) \
- - (m->alignment() - m->unaligned());
- new_alignment = 0;
+ if(!m->output_multiple_set()) {
+ if(m->is_unaligned()) {
+ // When unaligned, don't just set noutput_items to the remaining
+ // samples to meet alignment; this causes too much overhead in
+ // requiring a premature call back here. Set the maximum amount
+ // of samples to handle unalignment and get us back aligned.
+ if(noutput_items >= m->unaligned()) {
+ noutput_items = round_up(noutput_items, m->alignment()) \
+ - (m->alignment() - m->unaligned());
+ new_alignment = 0;
+ }
+ else {
+ new_alignment = m->unaligned() - noutput_items;
+ }
+ }
+ else if(noutput_items < m->alignment()) {
+ // if we don't have enough for an aligned call, keep track of
+ // misalignment, set unaligned flag, and proceed.
+ new_alignment = m->alignment() - noutput_items;
+ m->set_unaligned(new_alignment);
+ m->set_is_unaligned(true);
}
else {
- new_alignment = m->unaligned() - noutput_items;
+ // enough to round down to the nearest alignment and process.
+ noutput_items = round_down(noutput_items, m->alignment());
+ m->set_is_unaligned(false);
}
}
- else if(noutput_items < m->alignment()) {
- // if we don't have enough for an aligned call, keep track of
- // misalignment, set unaligned flag, and proceed.
- new_alignment = m->alignment() - noutput_items;
- m->set_unaligned(new_alignment);
- m->set_is_unaligned(true);
- }
- else {
- // enough to round down to the nearest alignment and process.
- noutput_items = round_down(noutput_items, m->alignment());
- m->set_is_unaligned(false);
- }
// ask the block how much input they need to produce noutput_items
m->forecast (noutput_items, d_ninput_items_required);