1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-05 23:10:34 +00:00

Reset sample value before writing new one

Sample values are ORed into the output buffer because they may need a few read/write operations depending on alignment.
So, if we don't set the value to 0 before doing this, all samples quickly become 0xFF after a few cycles of the output buffer.
This commit is contained in:
Victor Castillo 2024-08-16 15:51:24 +02:00
parent cd2614a4dc
commit 38a24f5250
No known key found for this signature in database
GPG Key ID: 8EF1FC8B7182F608
3 changed files with 5 additions and 3 deletions

View File

@ -62,7 +62,7 @@ IONGSMSFileSource::IONGSMSFileSource(
} }
output_stream_count_ = output_stream_offset; output_stream_count_ = output_stream_offset;
io_buffer_.resize(1024 * chunk_cycle_length_); io_buffer_.resize((16*1024 - 1) * chunk_cycle_length_);
} }
IONGSMSFileSource::~IONGSMSFileSource() IONGSMSFileSource::~IONGSMSFileSource()
@ -102,7 +102,7 @@ int IONGSMSFileSource::work(
} }
} }
std::cout << "produced: " << std::to_string(items_produced[0]) << std::endl; // std::cout << "produced: " << std::to_string(items_produced[0]) << " out of " << std::to_string(noutput_items) << std::endl;
for (int i = 0; i < items_produced.size(); ++i) for (int i = 0; i < items_produced.size(); ++i)
{ {
produce(i, items_produced[i]); produce(i, items_produced[i]);

View File

@ -189,6 +189,7 @@ void IONGSMSChunkData::write_n_samples(
sample += sample_count; sample += sample_count;
for (std::size_t i = 0; i < sample_count; ++i) for (std::size_t i = 0; i < sample_count; ++i)
{ {
*sample = 0;
ctx.shift_sample(sample_bitsize, sample); ctx.shift_sample(sample_bitsize, sample);
dump_sample(*sample); dump_sample(*sample);
decode_sample(sample_bitsize, sample, stream_encoding); decode_sample(sample_bitsize, sample, stream_encoding);
@ -200,6 +201,7 @@ void IONGSMSChunkData::write_n_samples(
auto* sample = static_cast<OT*>(out); auto* sample = static_cast<OT*>(out);
for (std::size_t i = 0; i < sample_count; ++i) for (std::size_t i = 0; i < sample_count; ++i)
{ {
*sample = 0;
ctx.shift_sample(sample_bitsize, sample); ctx.shift_sample(sample_bitsize, sample);
dump_sample(*sample); dump_sample(*sample);
decode_sample(sample_bitsize, sample, stream_encoding); decode_sample(sample_bitsize, sample, stream_encoding);

View File

@ -45,7 +45,7 @@ void IONGSMSMetadataHandler::load_metadata()
} }
catch (GnssMetadata::ApiException& e) catch (GnssMetadata::ApiException& e)
{ {
LOG(ERROR) << "API Exception while loadind XML metadata file: " << e.what(); LOG(ERROR) << "API Exception while loading XML metadata file: " << std::to_string(e.Error());
} }
catch (std::exception& e) catch (std::exception& e)
{ {