aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2021-07-16 21:23:19 +0200
committermormj <34754695+mormj@users.noreply.github.com>2021-07-27 11:21:52 -0400
commit592b0f4f37d59dc8a11b1fea75f6016f2118e15b (patch)
treec2a022656506595b7c0d75bea5750bd52348d79f
parentdigital/chunks to symbols: be less inefficient (diff)
downloadgnuradio-592b0f4f37d59dc8a11b1fea75f6016f2118e15b.tar.xz
gnuradio-592b0f4f37d59dc8a11b1fea75f6016f2118e15b.zip
digital/chunks_to_symbols: special case for the common single-dimension case
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
-rw-r--r--gr-digital/lib/chunks_to_symbols_impl.cc53
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 42a8217fb..0458cb71e 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;