mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-23 11:37:40 +00:00
Make use of std::span when available
This commit is contained in:
@@ -106,6 +106,12 @@ if(GNURADIO_USES_STD_POINTERS)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(has_span)
|
||||
target_compile_definitions(acquisition_adapters
|
||||
PRIVATE -DHAS_STD_SPAN=1
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_FPGA)
|
||||
target_link_libraries(acquisition_adapters
|
||||
PRIVATE
|
||||
|
@@ -30,6 +30,13 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
|
||||
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -140,7 +147,7 @@ void BeidouB1iPcpsAcquisition::set_local_code()
|
||||
|
||||
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -27,6 +27,13 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
@@ -137,7 +144,7 @@ void BeidouB3iPcpsAcquisition::set_local_code()
|
||||
|
||||
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -208,7 +214,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
|
||||
galileo_e1_code_gen_complex_sampled(code, Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -28,6 +28,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -182,7 +188,7 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
}
|
||||
}
|
||||
|
||||
gsl::span<gr_complex> code__span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code__span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code__span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -242,7 +248,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
|
||||
galileo_e1_code_gen_complex_sampled(code, Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -211,7 +217,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
|
||||
galileo_e1_code_gen_complex_sampled(code, Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -33,6 +33,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -226,8 +232,8 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
|
||||
}
|
||||
// WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1)
|
||||
// is generated, and modulated in the 'block'.
|
||||
gsl::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_);
|
||||
gsl::span<gr_complex> codeI_span(codeI_.data(), vector_length_);
|
||||
std::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_);
|
||||
std::span<gr_complex> codeI_span(codeI_.data(), vector_length_);
|
||||
if (Zero_padding == 0) // if no zero_padding
|
||||
{
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
@@ -166,7 +172,7 @@ void GalileoE5aPcpsAcquisition::set_local_code()
|
||||
{
|
||||
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -29,6 +29,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -142,7 +148,7 @@ void GlonassL1CaPcpsAcquisition::set_local_code()
|
||||
|
||||
glonass_l1_ca_code_gen_complex_sampled(code, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -28,6 +28,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -141,7 +147,7 @@ void GlonassL2CaPcpsAcquisition::set_local_code()
|
||||
|
||||
glonass_l2_ca_code_gen_complex_sampled(code, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -29,9 +29,15 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gsl/gsl>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -157,7 +163,7 @@ void GpsL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.fs_in, 0);
|
||||
}
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -59,7 +59,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
||||
// --- Find number of samples per spreading code -------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
code_ = std::make_shared<std::complex<float>>(vector_length_);
|
||||
code_.reserve(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -138,7 +138,7 @@ void GpsL1CaPcpsAssistedAcquisition::init()
|
||||
void GpsL1CaPcpsAssistedAcquisition::set_local_code()
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_.get());
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_assisted_acquisition_cc.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -150,7 +149,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::shared_ptr<std::complex<float>> code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -198,7 +204,7 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code()
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -28,6 +28,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -224,7 +230,7 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -27,6 +27,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -186,7 +192,7 @@ void GpsL1CaPcpsTongAcquisition::set_local_code()
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -29,6 +29,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -156,7 +162,7 @@ void GpsL2MPcpsAcquisition::set_local_code()
|
||||
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
|
||||
}
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -29,6 +29,12 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
ConfigurationInterface* configuration,
|
||||
@@ -158,7 +164,7 @@ void GpsL5iPcpsAcquisition::set_local_code()
|
||||
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
|
||||
}
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
std::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
std::copy_n(code.data(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
|
@@ -93,6 +93,12 @@ if(ENABLE_ARMA_NO_DEBUG)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(has_span)
|
||||
target_compile_definitions(acquisition_gr_blocks
|
||||
PRIVATE -DHAS_STD_SPAN=1
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_OPENCL)
|
||||
target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
|
||||
target_include_directories(acquisition_gr_blocks
|
||||
|
@@ -252,7 +252,7 @@ bool pcps_acquisition::is_fdma()
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq)
|
||||
void pcps_acquisition::update_local_carrier(std::span<gr_complex> carrier_vector, float freq)
|
||||
{
|
||||
float phase_step_rad;
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
@@ -264,7 +264,7 @@ void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector
|
||||
phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
|
||||
}
|
||||
std::array<float, 1> _phase{};
|
||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.length());
|
||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.size());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -54,7 +54,6 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <gnuradio/thread/thread.h> // for scoped_lock
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <gsl/gsl> // for Guidelines Support Library
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
||||
#include <complex>
|
||||
@@ -62,6 +61,14 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#if HAS_STD_SPAN
|
||||
#include <span>
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
using std::span = gsl::span;
|
||||
#endif
|
||||
|
||||
#if GNURADIO_USES_STD_POINTERS
|
||||
#else
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -255,7 +262,7 @@ private:
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
arma::fmat narrow_grid_;
|
||||
void update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq);
|
||||
void update_local_carrier(std::span<gr_complex> carrier_vector, float freq);
|
||||
void update_grid_doppler_wipeoffs();
|
||||
void update_grid_doppler_wipeoffs_step2();
|
||||
void acquisition_core(uint64_t samp_count);
|
||||
|
Reference in New Issue
Block a user