aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@gmail.com>2018-11-02 11:50:14 +0100
committerPiotr Krysik <ptrkrysik@gmail.com>2018-11-02 11:50:14 +0100
commit89dc99016efb165bd2a494b6cfa958330158e80a (patch)
treedf1438c9e02c9f225862613b4eb9c3332245e76a
parentacd7d71db4fa4a307b7e8a4ccd75163ba0a096b5 (diff)
misc_utils/resampler: Add offsets of tags at the input
This change is done to make keeping track of sample counter at the input of the resampler easier from blocks connected to its output. Each tag leaving the resampler has accompanying "original_offset" tag with its offset before sample rate change. Change-Id: Iea8ca4a092029f774406dced8a97a17810f21f62
-rw-r--r--lib/misc_utils/controlled_fractional_resampler_cc_impl.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
index 82c5a04..cd1d777 100644
--- a/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
+++ b/lib/misc_utils/controlled_fractional_resampler_cc_impl.cc
@@ -110,13 +110,16 @@ namespace gr {
{
break;
} else {
- add_item_tag(0, produced_out_sum + nitems_written(0), i_tag->key, i_tag->value);
- set_resamp_ratio(pmt::to_double(i_tag->value));
+ set_resamp_ratio(pmt::to_double(i_tag->value));
+ tag_t original_offset_tag;
+ add_item_tag(0, produced_out_sum + nitems_written(0), pmt::mp("original_offset"), pmt::from_uint64(i_tag->offset));
+ add_item_tag(0, produced_out_sum + nitems_written(0), i_tag->key, i_tag->value);
}
} else {
uint64_t out_samples_to_tag = round(static_cast<double>(tag_offset_rel-processed_in_sum)/d_mu_inc);
if( (out_samples_to_tag + produced_out_sum) < noutput_items)
{
+ add_item_tag(0, produced_out_sum + out_samples_to_tag + nitems_written(0), pmt::mp("original_offset"), pmt::from_uint64(i_tag->offset));
add_item_tag(0, produced_out_sum + out_samples_to_tag + nitems_written(0), i_tag->key, i_tag->value);
}
}