Skip to content

Commit

Permalink
digital/chunks_to_symbols: special case for the common single-dimensi…
Browse files Browse the repository at this point in the history
…on case

Signed-off-by: Marcus Müller <[email protected]>
  • Loading branch information
marcusmueller authored and mormj committed Jul 27, 2021
1 parent f6b3295 commit 592b0f4
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions gr-digital/lib/chunks_to_symbols_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 592b0f4

Please sign in to comment.