Improve handling of change in GNU Radio 3.9 FFT API

Fix compilation of some optional blocks when linking against GR 3.9

Fix warning -Wembedded-directive: embedding a directive within macro arguments has undefined behavior
This commit is contained in:
Carles Fernandez 2021-01-15 13:39:26 +01:00
parent ede02f91df
commit 4fea48f603
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
38 changed files with 156 additions and 255 deletions

View File

@ -21,6 +21,10 @@ SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades <carles.fernandez@cttc
whether it is already installed or not.
- Fix building when using the Xcode generator, Xcode >= 12 and CMake >= 3.19.
### Improvements in Maintainability:
- Improved handling of change in GNU Radio 3.9 FFT API.
&nbsp;
## [GNSS-SDR v0.0.14](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.14)

View File

@ -123,7 +123,6 @@ if(ENABLE_FPGA)
PRIVATE
algorithms_libs
core_libs
Gnuradio::fft
Volk::volk
Volkgnsssdr::volkgnsssdr
)

View File

@ -19,8 +19,8 @@
#include "Galileo_E1.h"
#include "configuration_interface.h"
#include "galileo_e1_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
@ -92,8 +92,8 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
volk_gnsssdr::vector<gr_complex> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -19,11 +19,10 @@
#include "Galileo_E5a.h"
#include "configuration_interface.h"
#include "galileo_e5_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
@ -94,7 +93,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(
// compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -20,10 +20,10 @@
#include "Galileo_E5b.h"
#include "configuration_interface.h"
#include "galileo_e5_signal_replica.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
@ -93,8 +93,8 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration
// compute all the GALILEO E5b PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // Buffer for local code
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // Buffer for local code
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5B_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -21,12 +21,11 @@
#include "gps_l1_ca_pcps_acquisition_fpga.h"
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_sdr_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
@ -86,7 +85,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true);
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total);
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -20,13 +20,12 @@
#include "gps_l2_m_pcps_acquisition_fpga.h"
#include "GPS_L2C.h"
#include "configuration_interface.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
@ -86,7 +85,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -21,12 +21,11 @@
#include "gps_l5i_pcps_acquisition_fpga.h"
#include "GPS_L5.h"
#include "configuration_interface.h"
#include "gnss_sdr_fft.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_l5_signal_replica.h"
#include "uio_fpga.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
#include <volk_gnsssdr/volk_gnsssdr_alloc.h>
@ -90,7 +89,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
// compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32

View File

@ -81,8 +81,6 @@ target_link_libraries(acquisition_gr_blocks
)
target_include_directories(acquisition_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs
PRIVATE
${CMAKE_SOURCE_DIR}/src/core/receiver
)
@ -93,12 +91,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_FFT_USES_TEMPLATES)
target_compile_definitions(acquisition_gr_blocks
PUBLIC -DGNURADIO_FFT_USES_TEMPLATES=1
)
endif()
if(ENABLE_ARMA_NO_DEBUG)
target_compile_definitions(acquisition_gr_blocks
PUBLIC -DARMA_NO_BOUND_CHECKING=1

View File

@ -23,7 +23,6 @@
#include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -119,18 +118,9 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
}
}
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
// For dumping samples into a file
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
d_dump = dump;
d_dump_filename = dump_filename;

View File

@ -25,9 +25,9 @@
#define GNSS_SDR_GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <fstream>
#include <memory>
@ -204,13 +204,9 @@ private:
float estimate_input_power(gr_complex* in);
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<gr_complex> d_fft_code_I_A;
std::vector<gr_complex> d_fft_code_I_B;

View File

@ -17,7 +17,6 @@
#include "galileo_pcps_8ms_acquisition_cc.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -76,18 +75,8 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
d_fft_code_A = std::vector<gr_complex>(d_fft_size, lv_cmake(0.0F, 0.0F));
d_fft_code_B = std::vector<gr_complex>(d_fft_size, lv_cmake(0.0F, 0.0F));
d_magnitude = std::vector<float>(d_fft_size, 0.0F);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = dump;

View File

@ -19,9 +19,9 @@
#define GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <fstream>
#include <memory>
@ -190,13 +190,9 @@ private:
int32_t doppler_offset);
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<gr_complex> d_fft_code_A;
std::vector<gr_complex> d_fft_code_B;

View File

@ -24,7 +24,6 @@
#include "MATH_CONSTANTS.h" // for TWO_PI
#include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h"
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
@ -126,18 +125,8 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
d_tmp_buffer = volk_gnsssdr::vector<float>(d_fft_size);
d_fft_codes = volk_gnsssdr::vector<std::complex<float>>(d_fft_size);
d_input_signal = volk_gnsssdr::vector<std::complex<float>>(d_fft_size);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
d_gnss_synchro = nullptr;
d_worker_active = false;

View File

@ -44,10 +44,10 @@
#include "acq_conf.h"
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include <armadillo>
#include <glog/logging.h>
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#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
@ -240,14 +240,8 @@ private:
volk_gnsssdr::vector<std::complex<float>> d_data_buffer;
volk_gnsssdr::vector<lv_16sc_t> d_data_buffer_sc;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::weak_ptr<ChannelFsm> d_channel_fsm;
Acq_Conf d_acq_parameters;

View File

@ -19,7 +19,6 @@
#include "pcps_acquisition_fine_doppler_cc.h"
#include "GPS_L1_CA.h" // for GPS_L1_CA_CHIP_PERIOD_S
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gps_sdr_signal_replica.h"
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
@ -77,17 +76,8 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
d_fft_codes.reserve(d_fft_size);
d_magnitude.reserve(d_fft_size);
d_10_ms_buffer.reserve(50 * d_samples_per_ms);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = conf_.dump;
@ -383,11 +373,9 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
int signal_samples = prn_replicas * d_fft_size;
// int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
int fft_size_extended = signal_samples * zero_padding_factor;
#if GNURADIO_FFT_USES_TEMPLATES
auto fft_operator = std::make_unique<gr::fft::fft_complex_fwd>(fft_size_extended);
#else
auto fft_operator = std::make_unique<gr::fft::fft_complex>(fft_size_extended, true);
#endif
auto fft_operator = gnss_fft_fwd_make_unique(fft_size_extended);
// zero padding the entire vector
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));

View File

@ -41,10 +41,10 @@
#include "acq_conf.h"
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <armadillo>
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
@ -197,13 +197,8 @@ private:
bool start();
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
volk_gnsssdr::vector<volk_gnsssdr::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
volk_gnsssdr::vector<volk_gnsssdr::vector<float>> d_grid_data;

View File

@ -19,7 +19,6 @@
#include "pcps_assisted_acquisition_cc.h"
#include "MATH_CONSTANTS.h"
#include "concurrent_map.h"
#include "gnss_sdr_make_unique.h"
#include "gps_acq_assist.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
@ -69,17 +68,8 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
d_disable_assist = false;
d_fft_codes.reserve(d_fft_size);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = dump;

View File

@ -35,9 +35,9 @@
#define GNSS_SDR_PCPS_ASSISTED_ACQUISITION_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <fstream>
#include <memory>
@ -198,13 +198,8 @@ private:
void redefine_grid();
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
std::vector<std::vector<float>> d_grid_data;

View File

@ -22,7 +22,6 @@
#include "pcps_cccwsr_acquisition_cc.h"
#include "MATH_CONSTANTS.h" // TWO_PI
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -86,17 +85,9 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
d_correlation_minus.reserve(d_fft_size);
d_magnitude.reserve(d_fft_size);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;

View File

@ -24,9 +24,9 @@
#define GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <fstream>
#include <memory>
@ -183,13 +183,8 @@ private:
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<gr_complex> d_fft_code_data;

View File

@ -36,7 +36,6 @@
#include "pcps_opencl_acquisition_cc.h"
#include "MATH_CONSTANTS.h" // TWO_PI
#include "gnss_sdr_make_unique.h"
#include "opencl/fft_base_kernels.h"
#include "opencl/fft_internal.h"
#include <glog/logging.h>
@ -112,10 +111,10 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
if (d_opencl != 0)
{
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
}
// For dumping samples into a file

View File

@ -40,10 +40,10 @@
#define CL_SILENCE_DEPRECATION
#include "channel_fsm.h"
#include "gnss_block_interface.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include "opencl/fft_internal.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include "opencl/cl.hpp"
#include <cstdint>
@ -239,8 +239,8 @@ private:
std::weak_ptr<ChannelFsm> d_channel_fsm;
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<std::vector<gr_complex>> d_in_buffer;

View File

@ -16,7 +16,6 @@
#include "pcps_quicksync_acquisition_cc.h"
#include "MATH_CONSTANTS.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -95,17 +94,8 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
original form to perform later correlation in time domain*/
d_code = std::vector<gr_complex>(d_samples_per_code, lv_cmake(0.0F, 0.0F));
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = dump;

View File

@ -38,9 +38,9 @@
#define GNSS_SDR_PCPS_QUICKSYNC_ACQUISITION_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <algorithm>
#include <cassert>
@ -212,13 +212,8 @@ private:
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<gr_complex> d_code;

View File

@ -36,7 +36,6 @@
#include "pcps_tong_acquisition_cc.h"
#include "MATH_CONSTANTS.h" // for TWO_PI
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -102,17 +101,9 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
d_fft_codes.reserve(d_fft_size);
d_magnitude.reserve(d_fft_size);
#if GNURADIO_FFT_USES_TEMPLATES
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex_rev>(d_fft_size);
#else
// Direct FFT
d_fft_if = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
// Inverse FFT
d_ifft = std::make_unique<gr::fft::fft_complex>(d_fft_size, false);
#endif
d_fft_if = gnss_fft_fwd_make_unique(d_fft_size);
d_ifft = gnss_fft_rev_make_unique(d_fft_size);
// For dumping samples into a file
d_dump = dump;
d_dump_filename = dump_filename;

View File

@ -38,9 +38,9 @@
#define GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H
#include "channel_fsm.h"
#include "gnss_sdr_fft.h"
#include "gnss_synchro.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h>
#include <fstream>
#include <memory> // for weak_ptr
@ -199,14 +199,8 @@ private:
int32_t doppler_offset);
std::weak_ptr<ChannelFsm> d_channel_fsm;
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_if;
std::unique_ptr<gr::fft::fft_complex_rev> d_ifft;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_if;
std::unique_ptr<gr::fft::fft_complex> d_ifft;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_if;
std::unique_ptr<gnss_fft_complex_rev> d_ifft;
std::vector<std::vector<gr_complex>> d_grid_doppler_wipeoffs;
std::vector<std::vector<float>> d_grid_data;

View File

@ -43,8 +43,8 @@ target_link_libraries(input_filter_gr_blocks
Gnuradio::blocks
Gnuradio::filter
Volkgnsssdr::volkgnsssdr
PRIVATE
algorithms_libs
PRIVATE
Volk::volk
Log4cpp::log4cpp
)
@ -60,13 +60,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_FFT_USES_TEMPLATES)
target_compile_definitions(input_filter_gr_blocks
PUBLIC -DGNURADIO_FFT_USES_TEMPLATES=1
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(input_filter_gr_blocks

View File

@ -15,7 +15,6 @@
*/
#include "notch_cc.h"
#include "gnss_sdr_make_unique.h"
#include <boost/math/distributions/chi_squared.hpp>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -57,11 +56,7 @@ Notch::Notch(float pfa,
angle_ = volk_gnsssdr::vector<float>(length_);
power_spect_ = volk_gnsssdr::vector<float>(length_);
last_out_ = gr_complex(0.0, 0.0);
#if GNURADIO_FFT_USES_TEMPLATES
d_fft_ = std::make_unique<gr::fft::fft_complex_fwd>(length_);
#else
d_fft_ = std::make_unique<gr::fft::fft_complex>(length_, true);
#endif
d_fft_ = gnss_fft_fwd_make_unique(length_);
}

View File

@ -19,8 +19,8 @@
#define GNSS_SDR_NOTCH_CC_H
#include "gnss_block_interface.h"
#include "gnss_sdr_fft.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
#include <memory>
@ -57,11 +57,8 @@ public:
private:
friend notch_sptr make_notch_filter(float pfa, float p_c_factor, int32_t length, int32_t n_segments_est, int32_t n_segments_reset);
Notch(float pfa, float p_c_factor, int32_t length, int32_t n_segments_est, int32_t n_segments_reset);
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_;
volk_gnsssdr::vector<gr_complex> c_samples_;
volk_gnsssdr::vector<float> angle_;
volk_gnsssdr::vector<float> power_spect_;

View File

@ -16,7 +16,6 @@
*/
#include "notch_lite_cc.h"
#include "gnss_sdr_make_unique.h"
#include <boost/math/distributions/chi_squared.hpp>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -63,11 +62,7 @@ NotchLite::NotchLite(float p_c_factor,
angle1_ = 0.0;
angle2_ = 0.0;
power_spect_ = volk_gnsssdr::vector<float>(length_);
#if GNURADIO_FFT_USES_TEMPLATES
d_fft_ = std::make_unique<gr::fft::fft_complex_fwd>(length_);
#else
d_fft_ = std::make_unique<gr::fft::fft_complex>(length_, true);
#endif
d_fft_ = gnss_fft_fwd_make_unique(length_);
}

View File

@ -19,8 +19,8 @@
#define GNSS_SDR_NOTCH_LITE_CC_H
#include "gnss_block_interface.h"
#include "gnss_sdr_fft.h"
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
#include <memory>
@ -58,11 +58,8 @@ public:
private:
friend notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
NotchLite(float p_c_factor, float pfa, int32_t length, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
#if GNURADIO_FFT_USES_TEMPLATES
std::unique_ptr<gr::fft::fft_complex_fwd> d_fft_;
#else
std::unique_ptr<gr::fft::fft_complex> d_fft_;
#endif
std::unique_ptr<gnss_fft_complex_fwd> d_fft_;
volk_gnsssdr::vector<float> power_spect_;
gr_complex last_out_;
gr_complex z_0_;

View File

@ -53,6 +53,7 @@ set(GNSS_SPLIBS_HEADERS
conjugate_ic.h
cshort_to_float_x2.h
gnss_sdr_create_directory.h
gnss_sdr_fft.h
gnss_sdr_make_unique.h
gnss_circular_deque.h
geofunctions.h
@ -108,6 +109,7 @@ target_link_libraries(algorithms_libs
Boost::headers
Gnuradio::runtime
Gnuradio::blocks
Gnuradio::fft
PRIVATE
core_system_parameters
Volk::volk
@ -128,6 +130,12 @@ if(has_span)
)
endif()
if(GNURADIO_FFT_USES_TEMPLATES)
target_compile_definitions(algorithms_libs
PUBLIC -DGNURADIO_FFT_USES_TEMPLATES=1
)
endif()
if(ENABLE_OPENCL)
target_link_libraries(algorithms_libs PUBLIC OpenCL::OpenCL)
target_include_directories(algorithms_libs PUBLIC

View File

@ -0,0 +1,63 @@
/*!
* \file gnss_sdr_fft.h
* \brief Helper file for FFT interface
* \author Carles Fernandez Prades, 2021. cfernandez(at)cttc.es
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GNSS_SDR_FFT_H
#define GNSS_SDR_GNSS_SDR_FFT_H
#include "gnss_sdr_make_unique.h"
#include <gnuradio/fft/fft.h>
#if GNURADIO_FFT_USES_TEMPLATES
using gnss_fft_complex_fwd = gr::fft::fft_complex_fwd;
using gnss_fft_complex_rev = gr::fft::fft_complex_rev;
template <typename T>
using gnss_fft_fwd_unique_ptr = std::unique_ptr<T>;
template <typename... Args>
gnss_fft_fwd_unique_ptr<gr::fft::fft_complex_fwd> gnss_fft_fwd_make_unique(Args&&... args)
{
return std::make_unique<gr::fft::fft_complex_fwd>(std::forward<Args>(args)...);
}
template <typename T>
using gnss_fft_rev_unique_ptr = std::unique_ptr<T>;
template <typename... Args>
gnss_fft_rev_unique_ptr<gr::fft::fft_complex_rev> gnss_fft_rev_make_unique(Args&&... args)
{
return std::make_unique<gr::fft::fft_complex_rev>(std::forward<Args>(args)...);
}
#else
using gnss_fft_complex_fwd = gr::fft::fft_complex;
using gnss_fft_complex_rev = gr::fft::fft_complex;
template <typename T>
using gnss_fft_fwd_unique_ptr = std::unique_ptr<T>;
template <typename... Args>
gnss_fft_fwd_unique_ptr<gr::fft::fft_complex> gnss_fft_fwd_make_unique(Args&&... args)
{
return std::make_unique<gr::fft::fft_complex>(std::forward<Args>(args)..., true);
}
template <typename T>
using gnss_fft_rev_unique_ptr = std::unique_ptr<T>;
template <typename... Args>
gnss_fft_rev_unique_ptr<gr::fft::fft_complex> gnss_fft_rev_make_unique(Args&&... args)
{
return std::make_unique<gr::fft::fft_complex>(std::forward<Args>(args)..., false);
}
#endif
#endif // GNSS_SDR_GNSS_SDR_FFT_H

View File

@ -500,7 +500,7 @@ static void buffer_dump()
}
else
{
fprintf(stderr, " %ld\n", DynamicBuffer.length);
fprintf(stderr, " %lu\n", DynamicBuffer.length);
}
}

View File

@ -533,11 +533,6 @@ if(ENABLE_UNIT_TESTING)
PRIVATE -DGNURADIO_USES_STD_POINTERS=1
)
endif()
if(GNURADIO_FFT_USES_TEMPLATES)
target_compile_definitions(run_tests
PUBLIC -DGNURADIO_FFT_USES_TEMPLATES=1
)
endif()
if(ENABLE_UNIT_TESTING_EXTRA)
target_link_libraries(run_tests PRIVATE Gpstk::gpstk)
if(GPSTK_OLDER_THAN_8)

View File

@ -15,10 +15,9 @@
* -----------------------------------------------------------------------------
*/
#include "gnss_sdr_make_unique.h"
#include "gnss_sdr_fft.h"
#include "gnuplot_i.h"
#include "test_flags.h"
#include <gnuradio/fft/fft.h>
#include <algorithm>
#include <chrono>
#include <functional>
@ -71,11 +70,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
EXPECT_NO_THROW(
for (it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it) {
d_fft_size = *it;
#if GNURADIO_FFT_USES_TEMPLATES
auto d_fft = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
#else
auto d_fft = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
#endif
auto d_fft = gnss_fft_fwd_make_unique(d_fft_size);
std::generate_n(d_fft->get_inbuf(), d_fft_size, gen);
start = std::chrono::system_clock::now();

View File

@ -16,9 +16,8 @@
* -----------------------------------------------------------------------------
*/
#include "gnss_sdr_make_unique.h"
#include "gnss_sdr_fft.h"
#include <armadillo>
#include <gnuradio/fft/fft.h>
#include <chrono>
#include <memory>
@ -36,11 +35,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
for (unsigned int fft_size
: fft_sizes) {
d_fft_size = fft_size;
#if GNURADIO_FFT_USES_TEMPLATES
auto d_gr_fft = std::make_unique<gr::fft::fft_complex_fwd>(d_fft_size);
#else
auto d_gr_fft = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
#endif
auto d_gr_fft = gnss_fft_fwd_make_unique(d_fft_size);
arma::arma_rng::set_seed_random();
arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn();
arma::cx_fvec d_arma_fft_result(d_fft_size);