diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bc1fb280f..5206c6d31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,11 +48,10 @@ jobs: rm /usr/local/bin/pydoc3 || true rm /usr/local/bin/python3 || true rm /usr/local/bin/python3-config || true - rm /usr/local/bin/2to3-3.11 || true - rm /usr/local/bin/idle3.11 || true - rm /usr/local/bin/pydoc3.11 || true - rm /usr/local/bin/python3.11 || true - rm /usr/local/bin/python3.11-config || true + rm /usr/local/bin/2to3-3.1* || true + rm /usr/local/bin/idle3.1* || true + rm /usr/local/bin/pydoc3.1* || true + rm /usr/local/bin/python3.1* || true brew install ninja hdf5 automake armadillo lapack \ gflags glog gnuradio log4cpp openssl pugixml protobuf pip3 install mako @@ -77,11 +76,10 @@ jobs: rm /usr/local/bin/pydoc3 || true rm /usr/local/bin/python3 || true rm /usr/local/bin/python3-config || true - rm /usr/local/bin/2to3-3.11 || true - rm /usr/local/bin/idle3.11 || true - rm /usr/local/bin/pydoc3.11 || true - rm /usr/local/bin/python3.11 || true - rm /usr/local/bin/python3.11-config || true + rm /usr/local/bin/2to3-3.1* || true + rm /usr/local/bin/idle3.1* || true + rm /usr/local/bin/pydoc3.1* || true + rm /usr/local/bin/python3.1* || true brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog \ gnuradio log4cpp openssl pugixml protobuf pip3 install mako @@ -125,11 +123,10 @@ jobs: rm /usr/local/bin/pydoc3 || true rm /usr/local/bin/python3 || true rm /usr/local/bin/python3-config || true - rm /usr/local/bin/2to3-3.11 || true - rm /usr/local/bin/idle3.11 || true - rm /usr/local/bin/pydoc3.11 || true - rm /usr/local/bin/python3.11 || true - rm /usr/local/bin/python3.11-config || true + rm /usr/local/bin/2to3-3.1* || true + rm /usr/local/bin/idle3.1* || true + rm /usr/local/bin/pydoc3.1* || true + rm /usr/local/bin/python3.1* || true brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio \ log4cpp openssl pugixml protobuf pip3 install mako diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a297f0ae..ab0c1bc3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.27) +cmake_minimum_required(VERSION 2.8.12...3.28) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 648aa380a..ca209027e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -46,6 +46,10 @@ All notable changes to GNSS-SDR will be documented in this file. - `volk_gnsssdr`: fix syntax for Python 3.12 without breaking backward compatibility with Python 2.7. - Fixed linking against latest GNU Radio version. +- Make use of new API if linking against VOLK >= 3.1. +- Fixed undefined behaviour in `volk_gnsssdr` arising from incompatibility + between complex numbers in C and C++. +- Now build system paths are not leaked when cross-compiling. ### Improvements in Repeatability: diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index 9ecdf6cdb..fdeb3981e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -101,6 +101,14 @@ if(ENABLE_OPENCL) ) endif() +if(VOLK_VERSION) + if(VOLK_VERSION VERSION_GREATER 3.0.99) + target_compile_definitions(acquisition_gr_blocks + PRIVATE -DVOLK_EQUAL_OR_GREATER_31=1 + ) + endif() +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(acquisition_gr_blocks diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 98861361b..7851aff79 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -184,10 +184,16 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_local_code(std::complex 1) { // DATA CODE B: First replica is inverted (0,1,1) +#if VOLK_EQUAL_OR_GREATER_31 + auto minus_one = gr_complex(-1, 0); + volk_32fc_s32fc_multiply2_32fc(&(d_fft_if->get_inbuf())[0], + &codeI[0], &minus_one, + d_samples_per_code); +#else volk_32fc_s32fc_multiply_32fc(&(d_fft_if->get_inbuf())[0], &codeI[0], gr_complex(-1, 0), d_samples_per_code); - +#endif d_fft_if->execute(); // We need the FFT of local code // Conjugate the local code @@ -196,9 +202,16 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_local_code(std::complexget_inbuf())[0], + &codeQ[0], &minus_one, + d_samples_per_code); +#else volk_32fc_s32fc_multiply_32fc(&(d_fft_if->get_inbuf())[0], &codeQ[0], gr_complex(-1, 0), d_samples_per_code); +#endif d_fft_if->execute(); // We need the FFT of local code // Conjugate the local code diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index 17d697fed..7dad27c45 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -124,10 +124,16 @@ void galileo_pcps_8ms_acquisition_cc::set_local_code(std::complex *code) volk_32fc_conjugate_32fc(d_fft_code_A.data(), d_fft_if->get_outbuf(), d_fft_size); // code B: two replicas of a primary code; the second replica is inverted. +#if VOLK_EQUAL_OR_GREATER_31 + auto minus_one = gr_complex(-1, 0); + volk_32fc_s32fc_multiply2_32fc(&(d_fft_if->get_inbuf())[d_samples_per_code], + &code[d_samples_per_code], &minus_one, + d_samples_per_code); +#else volk_32fc_s32fc_multiply_32fc(&(d_fft_if->get_inbuf())[d_samples_per_code], &code[d_samples_per_code], gr_complex(-1, 0), d_samples_per_code); - +#endif d_fft_if->execute(); // We need the FFT of local code // Conjugate the local code diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 89594968b..a65a33172 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.27) +cmake_minimum_required(VERSION 2.8.12...3.28) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_rotatorpuppet_16ic.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_rotatorpuppet_16ic.h index 75bcdb87e..a7d26e9b5 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_rotatorpuppet_16ic.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_rotatorpuppet_16ic.h @@ -37,7 +37,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_generic(lv_16sc_t* outVe phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_GENERIC */ @@ -53,7 +53,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_generic_reload(lv_16sc_t phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_GENERIC */ @@ -69,7 +69,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_a_sse3(lv_16sc_t* outVec phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_SSE3 */ @@ -85,7 +85,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_a_sse3_reload(lv_16sc_t* phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_SSE3 */ @@ -101,7 +101,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_u_sse3(lv_16sc_t* outVec phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_SSE3 */ @@ -117,7 +117,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_u_sse3_reload(lv_16sc_t* phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_SSE3 */ @@ -133,7 +133,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_neon(lv_16sc_t* outVecto phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_NEON */ @@ -149,7 +149,7 @@ static inline void volk_gnsssdr_16ic_rotatorpuppet_16ic_neon_reload(lv_16sc_t* o phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), -sin(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; phase_inc[0] = lv_cmake(cos(phase_step_rad), -sin(phase_step_rad)); - volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(outVector, inVector, phase_inc[0], phase, num_points); + volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(outVector, inVector, &phase_inc[0], phase, num_points); } #endif /* LV_HAVE_NEON */ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_s32fc_x2_rotator_16ic.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_s32fc_x2_rotator_16ic.h index 81e5bd7aa..1d6d0ac05 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_s32fc_x2_rotator_16ic.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_16ic_s32fc_x2_rotator_16ic.h @@ -27,7 +27,7 @@ * * Dispatcher Prototype * \code - * void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points); + * void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points); * \endcode * * \b Inputs @@ -51,7 +51,7 @@ #ifdef LV_HAVE_GENERIC -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { unsigned int i = 0; lv_16sc_t tmp16; @@ -61,7 +61,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(lv_16sc_t* ou tmp16 = *inVector++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *outVector++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; // Regenerate phase if (i % 512 == 0) { @@ -81,7 +81,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic(lv_16sc_t* ou #ifdef LV_HAVE_GENERIC -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { unsigned int ROTATOR_RELOAD = 512; unsigned int n = 0; @@ -95,7 +95,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(lv_16s tmp16 = *inVector++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *outVector++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } // Regenerate phase // printf("Phase before regeneration %i: %f,%f Modulus: %f\n", n,lv_creal(*phase),lv_cimag(*phase), cabsf(*phase)); @@ -111,7 +111,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(lv_16s tmp16 = *inVector++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *outVector++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -121,7 +121,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_generic_reload(lv_16s #ifdef LV_HAVE_SSE3 #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { const unsigned int sse_iters = num_points / 4; unsigned int number; @@ -129,13 +129,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(lv_16sc_t* out __m128i c1, c2, result; __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_inc[2]; - two_phase_inc[0] = phase_inc * phase_inc; - two_phase_inc[1] = phase_inc * phase_inc; + two_phase_inc[0] = *phase_inc * *phase_inc; + two_phase_inc[1] = *phase_inc * *phase_inc; two_phase_inc_reg = _mm_load_ps((float*)two_phase_inc); __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_acc[2]; two_phase_acc[0] = (*phase); - two_phase_acc[1] = (*phase) * phase_inc; + two_phase_acc[1] = (*phase) * *phase_inc; two_phase_acc_reg = _mm_load_ps((float*)two_phase_acc); const lv_16sc_t* _in = inVector; @@ -213,7 +213,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(lv_16sc_t* out tmp16 = *_in++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -223,7 +223,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3(lv_16sc_t* out #ifdef LV_HAVE_SSE3 #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { const unsigned int sse_iters = num_points / 4; const unsigned int ROTATOR_RELOAD = 512; @@ -233,13 +233,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(lv_16sc __m128i c1, c2, result; __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_inc[2]; - two_phase_inc[0] = phase_inc * phase_inc; - two_phase_inc[1] = phase_inc * phase_inc; + two_phase_inc[0] = *phase_inc * *phase_inc; + two_phase_inc[1] = *phase_inc * *phase_inc; two_phase_inc_reg = _mm_load_ps((float*)two_phase_inc); __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_acc[2]; two_phase_acc[0] = (*phase); - two_phase_acc[1] = (*phase) * phase_inc; + two_phase_acc[1] = (*phase) * *phase_inc; two_phase_acc_reg = _mm_load_ps((float*)two_phase_acc); const lv_16sc_t* _in = inVector; @@ -367,7 +367,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(lv_16sc tmp16 = *_in++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -377,7 +377,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_a_sse3_reload(lv_16sc #ifdef LV_HAVE_SSE3 #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { const unsigned int sse_iters = num_points / 4; unsigned int number; @@ -385,13 +385,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(lv_16sc_t* out __m128i c1, c2, result; __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_inc[2]; - two_phase_inc[0] = phase_inc * phase_inc; - two_phase_inc[1] = phase_inc * phase_inc; + two_phase_inc[0] = *phase_inc * *phase_inc; + two_phase_inc[1] = *phase_inc * *phase_inc; two_phase_inc_reg = _mm_load_ps((float*)two_phase_inc); __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_acc[2]; two_phase_acc[0] = (*phase); - two_phase_acc[1] = (*phase) * phase_inc; + two_phase_acc[1] = (*phase) * *phase_inc; two_phase_acc_reg = _mm_load_ps((float*)two_phase_acc); const lv_16sc_t* _in = inVector; @@ -470,7 +470,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(lv_16sc_t* out tmp16 = *_in++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -480,7 +480,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3(lv_16sc_t* out #ifdef LV_HAVE_SSE3 #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { const unsigned int sse_iters = num_points / 4; unsigned int ROTATOR_RELOAD = 512; @@ -490,13 +490,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(lv_16sc __m128i c1, c2, result; __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_inc[2]; - two_phase_inc[0] = phase_inc * phase_inc; - two_phase_inc[1] = phase_inc * phase_inc; + two_phase_inc[0] = *phase_inc * *phase_inc; + two_phase_inc[1] = *phase_inc * *phase_inc; two_phase_inc_reg = _mm_load_ps((float*)two_phase_inc); __VOLK_ATTR_ALIGNED(16) lv_32fc_t two_phase_acc[2]; two_phase_acc[0] = (*phase); - two_phase_acc[1] = (*phase) * phase_inc; + two_phase_acc[1] = (*phase) * *phase_inc; two_phase_acc_reg = _mm_load_ps((float*)two_phase_acc); const lv_16sc_t* _in = inVector; @@ -624,7 +624,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(lv_16sc tmp16 = *_in++; tmp32 = lv_cmake((float)lv_creal(tmp16), (float)lv_cimag(tmp16)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32)), (int16_t)rintf(lv_cimag(tmp32))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -634,7 +634,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_u_sse3_reload(lv_16sc #ifdef LV_HAVE_NEON #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { unsigned int i = 0; const unsigned int neon_iters = num_points / 4; @@ -642,13 +642,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVe lv_32fc_t tmp32_; float arg_phase0 = cargf(*phase); - float arg_phase_inc = cargf(phase_inc); + float arg_phase_inc = cargf(*phase_inc); float phase_est = 0.0; const lv_16sc_t* _in = inVector; lv_16sc_t* _out = outVector; - lv_32fc_t ___phase4 = phase_inc * phase_inc * phase_inc * phase_inc; + lv_32fc_t ___phase4 = *phase_inc * *phase_inc * *phase_inc * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t __phase4_real[4] = {lv_creal(___phase4), lv_creal(___phase4), lv_creal(___phase4), lv_creal(___phase4)}; __VOLK_ATTR_ALIGNED(16) @@ -657,9 +657,9 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVe float32x4_t _phase4_real = vld1q_f32(__phase4_real); float32x4_t _phase4_imag = vld1q_f32(__phase4_imag); - lv_32fc_t phase2 = (lv_32fc_t)(*phase) * phase_inc; - lv_32fc_t phase3 = phase2 * phase_inc; - lv_32fc_t phase4 = phase3 * phase_inc; + lv_32fc_t phase2 = (lv_32fc_t)(*phase) * *phase_inc; + lv_32fc_t phase3 = phase2 * *phase_inc; + lv_32fc_t phase4 = phase3 * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t __phase_real[4] = {lv_creal((*phase)), lv_creal(phase2), lv_creal(phase3), lv_creal(phase4)}; @@ -737,9 +737,9 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVe // printf("Estimated phase: %f\n\n", cos(phase_est)); *phase = lv_cmake(cos(phase_est), sin(phase_est)); - phase2 = (lv_32fc_t)(*phase) * phase_inc; - phase3 = phase2 * phase_inc; - phase4 = phase3 * phase_inc; + phase2 = (lv_32fc_t)(*phase) * *phase_inc; + phase3 = phase2 * *phase_inc; + phase4 = phase3 * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t ____phase_real[4] = {lv_creal((*phase)), lv_creal(phase2), lv_creal(phase3), lv_creal(phase4)}; @@ -760,7 +760,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVe tmp16_ = *_in++; tmp32_ = lv_cmake((float32_t)lv_creal(tmp16_), (float32_t)lv_cimag(tmp16_)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32_)), (int16_t)rintf(lv_cimag(tmp32_))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } @@ -770,7 +770,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon(lv_16sc_t* outVe #ifdef LV_HAVE_NEON #include -static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t phase_inc, lv_32fc_t* phase, unsigned int num_points) +static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t* outVector, const lv_16sc_t* inVector, const lv_32fc_t* phase_inc, lv_32fc_t* phase, unsigned int num_points) { unsigned int i = 0; const unsigned int neon_iters = num_points / 4; @@ -782,13 +782,13 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t lv_32fc_t tmp32_; float arg_phase0 = cargf(*phase); - float arg_phase_inc = cargf(phase_inc); + float arg_phase_inc = cargf(*phase_inc); float phase_est = 0.0; const lv_16sc_t* _in = inVector; lv_16sc_t* _out = outVector; - lv_32fc_t ___phase4 = phase_inc * phase_inc * phase_inc * phase_inc; + lv_32fc_t ___phase4 = *phase_inc * *phase_inc * *phase_inc * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t __phase4_real[4] = {lv_creal(___phase4), lv_creal(___phase4), lv_creal(___phase4), lv_creal(___phase4)}; __VOLK_ATTR_ALIGNED(16) @@ -797,9 +797,9 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t float32x4_t _phase4_real = vld1q_f32(__phase4_real); float32x4_t _phase4_imag = vld1q_f32(__phase4_imag); - lv_32fc_t phase2 = (lv_32fc_t)(*phase) * phase_inc; - lv_32fc_t phase3 = phase2 * phase_inc; - lv_32fc_t phase4 = phase3 * phase_inc; + lv_32fc_t phase2 = (lv_32fc_t)(*phase) * *phase_inc; + lv_32fc_t phase3 = phase2 * *phase_inc; + lv_32fc_t phase4 = phase3 * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t __phase_real[4] = {lv_creal((*phase)), lv_creal(phase2), lv_creal(phase3), lv_creal(phase4)}; @@ -877,9 +877,9 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t phase_est = arg_phase0 + (n + 1) * ROTATOR_RELOAD * 4 * arg_phase_inc; // printf("Estimated phase: %f\n\n", cos(phase_est)); *phase = lv_cmake(cos(phase_est), sin(phase_est)); - phase2 = (lv_32fc_t)(*phase) * phase_inc; - phase3 = phase2 * phase_inc; - phase4 = phase3 * phase_inc; + phase2 = (lv_32fc_t)(*phase) * *phase_inc; + phase3 = phase2 * *phase_inc; + phase4 = phase3 * *phase_inc; __VOLK_ATTR_ALIGNED(16) float32_t ____phase_real[4] = {lv_creal((*phase)), lv_creal(phase2), lv_creal(phase3), lv_creal(phase4)}; @@ -954,7 +954,7 @@ static inline void volk_gnsssdr_16ic_s32fc_x2_rotator_16ic_neon_reload(lv_16sc_t tmp16_ = *_in++; tmp32_ = lv_cmake((float32_t)lv_creal(tmp16_), (float32_t)lv_cimag(tmp16_)) * (*phase); *_out++ = lv_cmake((int16_t)rintf(lv_creal(tmp32_)), (int16_t)rintf(lv_cimag(tmp32_))); - (*phase) *= phase_inc; + (*phase) *= *phase_inc; } } diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index f22441f69..8bfd62614 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -372,14 +372,18 @@ if(MSVC) set(cmake_c_compiler_version "Microsoft Visual Studio 14.0") endif() else() - execute_process(COMMAND ${CMAKE_C_COMPILER} --version - OUTPUT_VARIABLE cmake_c_compiler_version - ) + if(NOT CMAKE_CROSSCOMPILING) + execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE cmake_c_compiler_version + ) + endif() endif() if(NOT GRCBTU) set(GRCBTU "") endif() -set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FLAGS}\n${CMAKE_CXX_COMPILER}:::${CMAKE_CXX_FLAGS_${GRCBTU}} ${CMAKE_CXX_FLAGS}\n") +if(NOT CMAKE_CROSSCOMPILING) + set(COMPILER_INFO "${CMAKE_C_COMPILER}:::${CMAKE_C_FLAGS_${GRCBTU}} ${CMAKE_C_FLAGS}\n${CMAKE_CXX_COMPILER}:::${CMAKE_CXX_FLAGS_${GRCBTU}} ${CMAKE_CXX_FLAGS}\n") +endif() foreach(machine_name ${available_machines}) # generate machine source @@ -396,7 +400,9 @@ foreach(machine_name ${available_machines}) if(NOT (CMAKE_GENERATOR STREQUAL Xcode)) message(STATUS "BUILD INFO ::: ${machine_name} ::: ${COMPILER_NAME} ::: ${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}") endif() - set(COMPILER_INFO "${COMPILER_INFO}${machine_name}:::${COMPILER_NAME}:::${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}\n") + if(NOT CMAKE_CROSSCOMPILING) + set(COMPILER_INFO "${COMPILER_INFO}${machine_name}:::${COMPILER_NAME}:::${CMAKE_C_FLAGS_${CBTU}} ${CMAKE_C_FLAGS} ${${machine_name}_flags}\n") + endif() if(${machine_name}_flags AND NOT MSVC) set_source_files_properties(${machine_source} PROPERTIES COMPILE_FLAGS "${${machine_name}_flags}") endif() @@ -407,11 +413,15 @@ foreach(machine_name ${available_machines}) endforeach() # Convert to a C string to compile and display properly -string(STRIP "${cmake_c_compiler_version}" cmake_c_compiler_version) -string(STRIP ${COMPILER_INFO} COMPILER_INFO) -message(STATUS "Compiler Version: ${cmake_c_compiler_version}") -string(REPLACE "\n" " \\n" cmake_c_compiler_version ${cmake_c_compiler_version}) -string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO}) +if(NOT CMAKE_CROSSCOMPILING) + string(STRIP "${cmake_c_compiler_version}" cmake_c_compiler_version) + string(REPLACE "\n" " \\n" cmake_c_compiler_version ${cmake_c_compiler_version}) + message(STATUS "Compiler Version: ${cmake_c_compiler_version}") + string(STRIP ${COMPILER_INFO} COMPILER_INFO) + string(REPLACE "\n" " \\n" COMPILER_INFO ${COMPILER_INFO}) +else() + set(cmake_c_compiler_version "") +endif() ######################################################################## @@ -481,8 +491,12 @@ endif() message(STATUS "Loading version ${VERSION} into constants...") # double escape for windows backslash path separators -string(REPLACE "\\" "\\\\" prefix "${prefix}") -string(REPLACE "${CMAKE_SOURCE_DIR}" "$BUILD_DIR" COMPILER_INFO "${COMPILER_INFO}") +if(NOT CMAKE_CROSSCOMPILING) + string(REPLACE "\\" "\\\\" prefix "${prefix}") + string(REPLACE "${CMAKE_SOURCE_DIR}" "$BUILD_DIR" COMPILER_INFO "${COMPILER_INFO}") +else() + set(prefix "") +endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/constants.c.in diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index c4aeb1a5e..9c961cee0 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -483,12 +483,12 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) int print_max_errs = 10; for (unsigned int i = 0; i < vlen; i++) { - if (((unsigned int)abs(int(((t *)(in1))[i]) - int(((t *)(in2))[i]))) > tol) + if (((uint64_t)abs(int64_t(((t *)(in1))[i]) - int64_t(((t *)(in2))[i]))) > tol) { fail = true; if (print_max_errs-- > 0) { - std::cout << "offset " << i << " in1: " << static_cast(t(((t *)(in1))[i])) << " in2: " << static_cast(t(((t *)(in2))[i])); + std::cout << "offset " << i << " in1: " << static_cast(t(((t *)(in1))[i])) << " in2: " << static_cast(t(((t *)(in2))[i])); std::cout << " tolerance was: " << tol << '\n'; } }