diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2021-07-16 21:23:19 +0200 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-07-27 11:21:52 -0400 |
commit | 592b0f4f37d59dc8a11b1fea75f6016f2118e15b (patch) | |
tree | c2a022656506595b7c0d75bea5750bd52348d79f /gr-digital/lib | |
parent | f6b3295ae29e3ee3c2c8fc3c6738ee4561ca194b (diff) |
digital/chunks_to_symbols: special case for the common single-dimension case
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
Diffstat (limited to 'gr-digital/lib')
-rw-r--r-- | gr-digital/lib/chunks_to_symbols_impl.cc | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/gr-digital/lib/chunks_to_symbols_impl.cc b/gr-digital/lib/chunks_to_symbols_impl.cc index 42a8217fba..0458cb71ed 100644 --- a/gr-digital/lib/chunks_to_symbols_impl.cc +++ b/gr-digital/lib/chunks_to_symbols_impl.cc @@ -106,27 +106,50 @@ int chunks_to_symbols_impl<IN_T, OUT_T>::work(int noutput_items, // per tag: all the samples leading up to this tag can be handled straightforward // with the current settings - for (const auto& tag : tags) { - for (; in_count < tag.offset; ++in_count) { - auto key = static_cast<unsigned int>(*in) * d_D; - for (unsigned int idx = 0; idx < d_D; ++idx) { - *out = d_symbol_table[key + idx]; + if (d_D == 1) { + for (const auto& tag : tags) { + for (; in_count < tag.offset; ++in_count) { + auto key = static_cast<unsigned int>(*in); + *out = d_symbol_table[key]; ++out; + ++in; + } + if (tag.key == symbol_table_key) { + handle_set_symbol_table(tag.value); } - ++in; - } - if (tag.key == symbol_table_key) { - handle_set_symbol_table(tag.value); } - } - // after the last tag, continue working on the remaining items - for (; in < reinterpret_cast<const IN_T*>(input_items[m]) + noutput_items; ++in) { - auto key = static_cast<unsigned int>(*in) * d_D; - for (unsigned int idx = 0; idx < d_D; ++idx) { - *out = d_symbol_table[key + idx]; + // after the last tag, continue working on the remaining items + for (; in < reinterpret_cast<const IN_T*>(input_items[m]) + noutput_items; + ++in) { + auto key = static_cast<unsigned int>(*in); + *out = d_symbol_table[key]; ++out; } + } else { // the multi-dimensional case + for (const auto& tag : tags) { + for (; in_count < tag.offset; ++in_count) { + auto key = static_cast<unsigned int>(*in) * d_D; + for (unsigned int idx = 0; idx < d_D; ++idx) { + *out = d_symbol_table[key + idx]; + ++out; + } + ++in; + } + if (tag.key == symbol_table_key) { + handle_set_symbol_table(tag.value); + } + } + + // after the last tag, continue working on the remaining items + for (; in < reinterpret_cast<const IN_T*>(input_items[m]) + noutput_items; + ++in) { + auto key = static_cast<unsigned int>(*in) * d_D; + for (unsigned int idx = 0; idx < d_D; ++idx) { + *out = d_symbol_table[key + idx]; + ++out; + } + } } } return noutput_items; |