From 38d548ba5090b193bb0681fccd7edd526e30a92e Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 18:03:36 +0200 Subject: [PATCH] Only specify outputs for the requested streams --- .../libs/ion_gnss_sdr_metadata_standard.cc | 34 ++++++++++++++++--- .../libs/ion_gnss_sdr_metadata_standard.h | 2 +- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc index c31ec3d1d..9466e798f 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc @@ -87,7 +87,7 @@ IONMetadataStdFileSource::IONMetadataStdFileSource( : gr::sync_block( "ion_metadata_standard_source", gr::io_signature::make(0, 0, 0), - make_output_signature(block)), + make_output_signature(block, stream_ids)), file_metadata_(file), block_metadata_(block) { @@ -149,7 +149,7 @@ void IONMetadataStdFileSource::read_chunk_pattern(gr_vector_void_star& output_it } } -gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block) +gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { int nstreams = 0; std::vector item_sizes{}; @@ -160,8 +160,34 @@ gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const Gns { for (const auto& stream : lump.Streams()) { - ++nstreams; - item_sizes.emplace_back(stream.RateFactor() * stream.Quantization()); + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + ++nstreams; + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (sample_bitsize <= 8) + { + item_sizes.push_back(1); + } + else if (sample_bitsize <= 16) + { + item_sizes.push_back(2); + } + else if (sample_bitsize <= 32) + { + item_sizes.push_back(4); + } + else if (sample_bitsize <= 64) + { + item_sizes.push_back(8); + } + else + { + // This shouldn't happen + item_sizes.push_back(1); + } + } } } } diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h index badf834c1..b97a84576 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h @@ -286,7 +286,7 @@ private: void read_chunk_pattern(gr_vector_void_star& output_items); private: - static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block); + static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); private: const GnssMetadata::File& file_metadata_;