[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/06: blocks: deinterleaver will process m
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/06: blocks: deinterleaver will process more than one block at a time for significant speed improvements. |
Date: |
Wed, 24 Sep 2014 22:54:05 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 71299bf848d3185af73e36bcee0de7a649398b91
Author: Tom Rondeau <address@hidden>
Date: Tue Sep 23 18:00:41 2014 -0400
blocks: deinterleaver will process more than one block at a time for
significant speed improvements.
---
gr-blocks/lib/deinterleave_impl.cc | 36 +++++++++++++++++++++++++++++++-----
gr-blocks/lib/deinterleave_impl.h | 3 ++-
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/gr-blocks/lib/deinterleave_impl.cc
b/gr-blocks/lib/deinterleave_impl.cc
index c9d0e9a..9e18c35 100644
--- a/gr-blocks/lib/deinterleave_impl.cc
+++ b/gr-blocks/lib/deinterleave_impl.cc
@@ -41,13 +41,20 @@ namespace gr {
io_signature::make (1, io_signature::IO_INFINITE, itemsize)),
d_itemsize(itemsize), d_blocksize(blocksize), d_current_output(0)
{
+ d_size_bytes = d_itemsize * d_blocksize;
set_output_multiple(blocksize);
}
+ void
+ deinterleave_impl::forecast(int noutput_items, gr_vector_int
&ninput_items_required)
+ {
+ ninput_items_required[0] = noutput_items * d_noutputs;
+ }
+
bool
deinterleave_impl::check_topology(int ninputs, int noutputs)
{
- set_relative_rate((double)noutputs);
+ set_relative_rate(1.0/(double)noutputs);
d_noutputs = noutputs;
return true;
}
@@ -61,10 +68,29 @@ namespace gr {
const char *in = (const char*)input_items[0];
char **out = (char**)&output_items[0];
- memcpy(out[d_current_output], in, d_itemsize * d_blocksize);
- consume_each(d_blocksize);
- produce(d_current_output, d_blocksize);
- d_current_output = (d_current_output + 1) % d_noutputs;
+ int count = 0, totalcount = noutput_items*d_noutputs;
+ unsigned int skip = 0;
+ unsigned int acc = 0;
+ while(count < totalcount) {
+ memcpy(out[d_current_output]+skip*d_size_bytes, in, d_size_bytes);
+ in += d_size_bytes;
+ produce(d_current_output, d_blocksize);
+ d_current_output = (d_current_output + 1) % d_noutputs;
+
+ // accumulate times through the loop; increment skip after a
+ // full pass over the output streams.
+ // This is separate than d_current_output since we could be in
+ // the middle of a loop when we exit.
+ acc++;
+ if(acc >= d_noutputs) {
+ skip++;
+ acc = 0;
+ }
+
+ // Keep track of our loop counter
+ count+=d_blocksize;
+ }
+ consume_each(totalcount);
return WORK_CALLED_PRODUCE;
}
diff --git a/gr-blocks/lib/deinterleave_impl.h
b/gr-blocks/lib/deinterleave_impl.h
index 247ee3a..71a551a 100644
--- a/gr-blocks/lib/deinterleave_impl.h
+++ b/gr-blocks/lib/deinterleave_impl.h
@@ -35,11 +35,12 @@ namespace gr {
unsigned int d_blocksize;
unsigned int d_current_output;
unsigned int d_noutputs;
-
+ unsigned int d_size_bytes; // block size in bytes
public:
deinterleave_impl(size_t itemsize, unsigned int blocksize);
+ void forecast(int noutput_items, gr_vector_int &ninput_items_required);
bool check_topology(int ninputs, int noutputs);
int general_work(int noutput_items,
- [Commit-gnuradio] [gnuradio] branch master updated (fd0955f -> 84ca321), git, 2014/09/24
- [Commit-gnuradio] [gnuradio] 06/06: Merge branch 'maint', git, 2014/09/24
- [Commit-gnuradio] [gnuradio] 04/06: blocks: deinterleaver will process more than one block at a time for significant speed improvements.,
git <=
- [Commit-gnuradio] [gnuradio] 05/06: CID 1240027: runtime: clean up tag pruning using iter range, git, 2014/09/24
- [Commit-gnuradio] [gnuradio] 01/06: blocks: added example of how to construct and add a tag to a vector_source., git, 2014/09/24
- [Commit-gnuradio] [gnuradio] 03/06: fec: turning off some debug output., git, 2014/09/24
- [Commit-gnuradio] [gnuradio] 02/06: docs: fixed path stripping for binary dirs in doxygen manual., git, 2014/09/24