diff options
author | Jason Uher <jason.uher@jhuapl.edu> | 2021-07-11 21:56:15 +0000 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-07-19 07:29:04 -0400 |
commit | 6529fb50840529f9f3a664d27ff5a8cf45f76ef4 (patch) | |
tree | edfb8281789ee3860d8000ce23939dd20d55b72a /gr-blocks/lib | |
parent | 2b51d137e78f1e66b607652fd8bb24ca18f1c44c (diff) |
digital: pack_k_bits propagate tags correctly
fixes #1111
Signed-off-by: Jason Uher <jason.uher@jhuapl.edu>
Diffstat (limited to 'gr-blocks/lib')
-rw-r--r-- | gr-blocks/lib/pack_k_bits_bb_impl.cc | 16 | ||||
-rw-r--r-- | gr-blocks/lib/pack_k_bits_bb_impl.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.cc b/gr-blocks/lib/pack_k_bits_bb_impl.cc index adae0172bb..dc6bb4fe7c 100644 --- a/gr-blocks/lib/pack_k_bits_bb_impl.cc +++ b/gr-blocks/lib/pack_k_bits_bb_impl.cc @@ -31,6 +31,8 @@ pack_k_bits_bb_impl::pack_k_bits_bb_impl(unsigned k) k), d_pack(k) { + d_k = k; + set_tag_propagation_policy(TPP_CUSTOM); } int pack_k_bits_bb_impl::work(int noutput_items, @@ -40,8 +42,22 @@ int pack_k_bits_bb_impl::work(int noutput_items, const unsigned char* in = (const unsigned char*)input_items[0]; unsigned char* out = (unsigned char*)output_items[0]; + std::vector<tag_t> wintags; // Temp variable to store tags for prop + + // GR_LOG_DEBUG(d_logger, boost::format("Packing Outputs")); d_pack.pack(out, in, noutput_items); + // Propagate tags + get_tags_in_range(wintags, 0, nitems_read(0), nitems_read(0) + (noutput_items * d_k)); + + // GR_LOG_DEBUG(d_logger, boost::format("Propagating tags")); + std::vector<tag_t>::iterator t; + for (t = wintags.begin(); t != wintags.end(); t++) { + tag_t new_tag = *t; + new_tag.offset = std::floor((double)new_tag.offset / d_k); + add_item_tag(0, new_tag); + } + return noutput_items; } diff --git a/gr-blocks/lib/pack_k_bits_bb_impl.h b/gr-blocks/lib/pack_k_bits_bb_impl.h index 7e2bd5a8d4..f79a3888c4 100644 --- a/gr-blocks/lib/pack_k_bits_bb_impl.h +++ b/gr-blocks/lib/pack_k_bits_bb_impl.h @@ -22,6 +22,8 @@ class pack_k_bits_bb_impl : public pack_k_bits_bb private: const kernel::pack_k_bits d_pack; + unsigned d_k; + public: pack_k_bits_bb_impl(unsigned k); |