mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Merge branch 'next' into testing
This commit is contained in:
commit
0aa178b3ab
@ -29,6 +29,8 @@ include_directories(
|
|||||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||||
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
||||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||||
|
${GLOG_INCLUDE_DIRS}
|
||||||
|
${GFlags_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB INPUT_FILTER_GR_BLOCKS_HEADERS "*.h")
|
file(GLOB INPUT_FILTER_GR_BLOCKS_HEADERS "*.h")
|
||||||
@ -39,5 +41,7 @@ source_group(Headers FILES ${INPUT_FILTER_GR_BLOCKS_HEADERS})
|
|||||||
target_link_libraries(input_filter_gr_blocks ${GNURADIO_FILTER_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${LOG4CPP_LIBRARIES})
|
target_link_libraries(input_filter_gr_blocks ${GNURADIO_FILTER_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${LOG4CPP_LIBRARIES})
|
||||||
|
|
||||||
if(NOT VOLK_GNSSSDR_FOUND)
|
if(NOT VOLK_GNSSSDR_FOUND)
|
||||||
add_dependencies(input_filter_gr_blocks volk_gnsssdr_module)
|
add_dependencies(input_filter_gr_blocks volk_gnsssdr_module glog-${glog_RELEASE})
|
||||||
|
else(NOT VOLK_GNSSSDR_FOUND)
|
||||||
|
add_dependencies(input_filter_gr_blocks glog-${glog_RELEASE})
|
||||||
endif(NOT VOLK_GNSSSDR_FOUND)
|
endif(NOT VOLK_GNSSSDR_FOUND)
|
||||||
|
@ -48,6 +48,7 @@ notch_sptr make_notch_filter(float pfa, float p_c_factor,
|
|||||||
return notch_sptr(new Notch(pfa, p_c_factor, length_, n_segments_est, n_segments_reset));
|
return notch_sptr(new Notch(pfa, p_c_factor, length_, n_segments_est, n_segments_reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Notch::Notch(float pfa, float p_c_factor, int length_, int n_segments_est, int n_segments_reset) : gr::block("Notch",
|
Notch::Notch(float pfa, float p_c_factor, int length_, int n_segments_est, int n_segments_reset) : gr::block("Notch",
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
@ -73,6 +74,7 @@ Notch::Notch(float pfa, float p_c_factor, int length_, int n_segments_est, int n
|
|||||||
last_out = gr_complex(0,0);
|
last_out = gr_complex(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Notch::~Notch()
|
Notch::~Notch()
|
||||||
{
|
{
|
||||||
volk_free(c_samples);
|
volk_free(c_samples);
|
||||||
@ -95,8 +97,9 @@ int Notch::general_work(int noutput_items __attribute__((unused)), gr_vector_int
|
|||||||
float sig2dB = 0.0;
|
float sig2dB = 0.0;
|
||||||
float sig2lin = 0.0;
|
float sig2lin = 0.0;
|
||||||
lv_32fc_t dot_prod_;
|
lv_32fc_t dot_prod_;
|
||||||
gr_complex* in = (gr_complex *) input_items[0];
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
gr_complex* out = (gr_complex *) output_items[0];
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
|
|
||||||
in++;
|
in++;
|
||||||
arma::cx_fvec signal_segment;
|
arma::cx_fvec signal_segment;
|
||||||
arma::cx_fvec signal_segment_fft;
|
arma::cx_fvec signal_segment_fft;
|
||||||
@ -104,12 +107,12 @@ int Notch::general_work(int noutput_items __attribute__((unused)), gr_vector_int
|
|||||||
{
|
{
|
||||||
if((n_segments < n_segments_est) && (filter_state_ == false))
|
if((n_segments < n_segments_est) && (filter_state_ == false))
|
||||||
{
|
{
|
||||||
signal_segment = arma::cx_fvec(in, length_, false, false);
|
signal_segment = arma::cx_fvec(in, length_);
|
||||||
signal_segment_fft = arma::fft(signal_segment);
|
signal_segment_fft = arma::fft(signal_segment);
|
||||||
volk_32fc_s32f_power_spectrum_32f(power_spect, signal_segment_fft.memptr(), 1.0, length_);
|
volk_32fc_s32f_power_spectrum_32f(power_spect, signal_segment_fft.memptr(), 1.0, length_);
|
||||||
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
||||||
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / ((float) n_deg_fred);
|
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / (static_cast<float>(n_deg_fred) );
|
||||||
noise_pow_est = (((float) n_segments) * noise_pow_est + sig2lin) / ((float)(n_segments + 1));
|
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / (static_cast<float>(n_segments + 1));
|
||||||
memcpy(out, in, sizeof(gr_complex) * length_);
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -123,7 +126,7 @@ int Notch::general_work(int noutput_items __attribute__((unused)), gr_vector_int
|
|||||||
last_out = gr_complex(0,0);
|
last_out = gr_complex(0,0);
|
||||||
}
|
}
|
||||||
volk_32fc_x2_multiply_conjugate_32fc(c_samples, in, (in - 1), length_);
|
volk_32fc_x2_multiply_conjugate_32fc(c_samples, in, (in - 1), length_);
|
||||||
volk_32fc_s32f_atan2_32f(angle_, c_samples, ((float)1.0), length_);
|
volk_32fc_s32f_atan2_32f(angle_, c_samples, static_cast<float>(1.0), length_);
|
||||||
for(int aux = 0; aux < length_; aux++)
|
for(int aux = 0; aux < length_; aux++)
|
||||||
{
|
{
|
||||||
z_0 = std::exp(gr_complex(0,1) * (*(angle_ + aux)));
|
z_0 = std::exp(gr_complex(0,1) * (*(angle_ + aux)));
|
||||||
|
@ -47,6 +47,7 @@ notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int length_,
|
|||||||
return notch_lite_sptr(new NotchLite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff));
|
return notch_lite_sptr(new NotchLite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NotchLite::NotchLite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff) : gr::block("NotchLite",
|
NotchLite::NotchLite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff) : gr::block("NotchLite",
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
@ -78,21 +79,23 @@ NotchLite::NotchLite(float p_c_factor, float pfa, int length_, int n_segments_es
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NotchLite::~NotchLite()
|
NotchLite::~NotchLite()
|
||||||
{
|
{
|
||||||
volk_free(power_spect);
|
volk_free(power_spect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int NotchLite::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int index_out = 0;
|
int index_out = 0;
|
||||||
float sig2dB = 0.0;
|
float sig2dB = 0.0;
|
||||||
float sig2lin = 0.0;
|
float sig2lin = 0.0;
|
||||||
lv_32fc_t dot_prod_;
|
lv_32fc_t dot_prod_;
|
||||||
gr_complex* in = (gr_complex *) input_items[0];
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
gr_complex* out = (gr_complex *) output_items[0];
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
|
|
||||||
in++;
|
in++;
|
||||||
arma::cx_fvec signal_segment;
|
arma::cx_fvec signal_segment;
|
||||||
arma::cx_fvec signal_segment_fft;
|
arma::cx_fvec signal_segment_fft;
|
||||||
@ -100,12 +103,12 @@ int NotchLite::general_work(int noutput_items __attribute__((unused)), gr_vector
|
|||||||
{
|
{
|
||||||
if((n_segments < n_segments_est) && (filter_state_ == false))
|
if((n_segments < n_segments_est) && (filter_state_ == false))
|
||||||
{
|
{
|
||||||
signal_segment = arma::cx_fvec(in, length_, false, false);
|
signal_segment = arma::cx_fvec(in, length_);
|
||||||
signal_segment_fft = arma::fft(signal_segment);
|
signal_segment_fft = arma::fft(signal_segment);
|
||||||
volk_32fc_s32f_power_spectrum_32f(power_spect, signal_segment_fft.memptr(), 1.0, length_);
|
volk_32fc_s32f_power_spectrum_32f(power_spect, signal_segment_fft.memptr(), 1.0, length_);
|
||||||
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
||||||
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / ((float) n_deg_fred);
|
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / static_cast<float>(n_deg_fred);
|
||||||
noise_pow_est = (((float) n_segments) * noise_pow_est + sig2lin) / ((float)(n_segments + 1));
|
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / static_cast<float>(n_segments + 1);
|
||||||
memcpy(out, in, sizeof(gr_complex) * length_);
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -122,9 +125,9 @@ int NotchLite::general_work(int noutput_items __attribute__((unused)), gr_vector
|
|||||||
if(n_segments_coeff == 0)
|
if(n_segments_coeff == 0)
|
||||||
{
|
{
|
||||||
volk_32fc_x2_multiply_conjugate_32fc(&c_samples1, (in + 1), in, 1);
|
volk_32fc_x2_multiply_conjugate_32fc(&c_samples1, (in + 1), in, 1);
|
||||||
volk_32fc_s32f_atan2_32f(&angle1, &c_samples1, ((float)1.0), 1);
|
volk_32fc_s32f_atan2_32f(&angle1, &c_samples1, static_cast<float>(1.0), 1);
|
||||||
volk_32fc_x2_multiply_conjugate_32fc(&c_samples2, (in + length_ - 1), (in + length_ - 2), 1);
|
volk_32fc_x2_multiply_conjugate_32fc(&c_samples2, (in + length_ - 1), (in + length_ - 2), 1);
|
||||||
volk_32fc_s32f_atan2_32f(&angle2, &c_samples2, ((float)1.0), 1);
|
volk_32fc_s32f_atan2_32f(&angle2, &c_samples2, static_cast<float>(1.0), 1);
|
||||||
float angle_ = (angle1 + angle2) / 2.0;
|
float angle_ = (angle1 + angle2) / 2.0;
|
||||||
z_0 = std::exp(gr_complex(0,1) * angle_);
|
z_0 = std::exp(gr_complex(0,1) * angle_);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_,
|
|||||||
return pulse_blanking_cc_sptr(new pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset));
|
return pulse_blanking_cc_sptr(new pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset) : gr::block("pulse_blanking_cc",
|
pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset) : gr::block("pulse_blanking_cc",
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
@ -67,6 +68,7 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pulse_blanking_cc::~pulse_blanking_cc()
|
pulse_blanking_cc::~pulse_blanking_cc()
|
||||||
{
|
{
|
||||||
volk_free(zeros_);
|
volk_free(zeros_);
|
||||||
@ -83,8 +85,8 @@ void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_v
|
|||||||
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
gr_complex *in = (gr_complex *) input_items[0];
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
gr_complex *out = (gr_complex *) output_items[0];
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
float* magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
|
float* magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
|
||||||
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
|
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
|
||||||
int sample_index = 0;
|
int sample_index = 0;
|
||||||
@ -94,7 +96,7 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)),
|
|||||||
volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_);
|
volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_);
|
||||||
if((n_segments < n_segments_est) && (last_filtered == false))
|
if((n_segments < n_segments_est) && (last_filtered == false))
|
||||||
{
|
{
|
||||||
noise_power_estimation = (((float) n_segments) * noise_power_estimation + segment_energy / ((float)n_deg_fred)) / ((float)(n_segments + 1));
|
noise_power_estimation = ( static_cast<float>(n_segments) * noise_power_estimation + segment_energy / static_cast<float>(n_deg_fred) ) / static_cast<float>(n_segments + 1);
|
||||||
memcpy(out, in, sizeof(gr_complex) * length_);
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -192,7 +192,9 @@ install(FILES
|
|||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_prefs.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_prefs.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_complex.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_complex.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_common.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_common.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/saturation_arithmetic.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_avx_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_avx_intrinsics.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse_intrinsics.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse3_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse3_intrinsics.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h
|
||||||
${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr.h
|
${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr.h
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
# define __VOLK_ATTR_UNUSED __attribute__((unused))
|
# define __VOLK_ATTR_UNUSED __attribute__((unused))
|
||||||
# define __VOLK_ATTR_INLINE __attribute__((always_inline))
|
# define __VOLK_ATTR_INLINE __attribute__((always_inline))
|
||||||
# define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
|
# define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
|
||||||
|
# define __VOLK_ASM __asm__
|
||||||
|
# define __VOLK_VOLATILE __volatile__
|
||||||
# if __GNUC__ >= 4
|
# if __GNUC__ >= 4
|
||||||
# define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
|
# define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
|
||||||
# define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
|
# define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
|
||||||
@ -63,6 +65,8 @@
|
|||||||
# define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
|
# define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
|
||||||
# define __VOLK_ATTR_EXPORT __declspec(dllexport)
|
# define __VOLK_ATTR_EXPORT __declspec(dllexport)
|
||||||
# define __VOLK_ATTR_IMPORT __declspec(dllimport)
|
# define __VOLK_ATTR_IMPORT __declspec(dllimport)
|
||||||
|
# define __VOLK_ASM __asm
|
||||||
|
# define __VOLK_VOLATILE
|
||||||
#else
|
#else
|
||||||
# define __VOLK_ATTR_ALIGNED(x)
|
# define __VOLK_ATTR_ALIGNED(x)
|
||||||
# define __VOLK_ATTR_UNUSED
|
# define __VOLK_ATTR_UNUSED
|
||||||
@ -70,6 +74,8 @@
|
|||||||
# define __VOLK_ATTR_DEPRECATED
|
# define __VOLK_ATTR_DEPRECATED
|
||||||
# define __VOLK_ATTR_EXPORT
|
# define __VOLK_ATTR_EXPORT
|
||||||
# define __VOLK_ATTR_IMPORT
|
# define __VOLK_ATTR_IMPORT
|
||||||
|
# define __VOLK_ASM __asm__
|
||||||
|
# define __VOLK_VOLATILE __volatile__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -717,11 +717,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
|
|||||||
{
|
{
|
||||||
if(both_sigs[j].is_signed)
|
if(both_sigs[j].is_signed)
|
||||||
{
|
{
|
||||||
fail = icompare((int16_t *) test_data[generic_offset][j], (int16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
fail = icompare((int8_t *) test_data[generic_offset][j], (int8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fail = icompare((uint16_t *) test_data[generic_offset][j], (uint16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
fail = icompare((uint8_t *) test_data[generic_offset][j], (uint8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#ifndef GNSS_SDR_VOLK_QA_UTILS_H
|
#ifndef GNSS_SDR_VOLK_QA_UTILS_H
|
||||||
#define GNSS_SDR_VOLK_QA_UTILS_H
|
#define GNSS_SDR_VOLK_QA_UTILS_H
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define _DARWIN_C_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -42,7 +42,7 @@ struct VOLK_CPU volk_gnsssdr_cpu;
|
|||||||
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
||||||
static inline unsigned long long _xgetbv(unsigned int index){
|
static inline unsigned long long _xgetbv(unsigned int index){
|
||||||
unsigned int eax, edx;
|
unsigned int eax, edx;
|
||||||
__asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
|
__VOLK_ASM __VOLK_VOLATILE ("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
|
||||||
return ((unsigned long long)edx << 32) | eax;
|
return ((unsigned long long)edx << 32) | eax;
|
||||||
}
|
}
|
||||||
#define __xgetbv() _xgetbv(0)
|
#define __xgetbv() _xgetbv(0)
|
||||||
|
@ -137,13 +137,13 @@ bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int hybrid_observables_cc::general_work (int noutput_items,
|
int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused)),
|
||||||
gr_vector_int &ninput_items,
|
gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; // Get the input pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; // Get the output pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
int n_outputs = 0;
|
int n_outputs = 0;
|
||||||
int n_consume[d_nchannels];
|
int n_consume[d_nchannels];
|
||||||
double past_history_s = 100e-3;
|
double past_history_s = 100e-3;
|
||||||
@ -193,14 +193,13 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
std::map<int,Gnss_Synchro> gnss_synchro_map;
|
std::map<int,Gnss_Synchro> gnss_synchro_map;
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].front().Channel_ID,
|
||||||
d_gnss_synchro_history_queue[i].front().Channel_ID,
|
|
||||||
d_gnss_synchro_history_queue[i].front()));
|
d_gnss_synchro_history_queue[i].front()));
|
||||||
}
|
}
|
||||||
gnss_synchro_map_iter = min_element(gnss_synchro_map.begin(),
|
gnss_synchro_map_iter = min_element(gnss_synchro_map.begin(),
|
||||||
gnss_synchro_map.end(),
|
gnss_synchro_map.end(),
|
||||||
Hybrid_pairCompare_gnss_synchro_sample_counter);
|
Hybrid_pairCompare_gnss_synchro_sample_counter);
|
||||||
T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / (double)gnss_synchro_map_iter->second.fs;
|
T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms
|
T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms
|
||||||
T_rx_s += past_history_s; // increase T_rx to have a minimum past history to interpolate
|
T_rx_s += past_history_s; // increase T_rx to have a minimum past history to interpolate
|
||||||
}
|
}
|
||||||
@ -219,11 +218,11 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
{
|
{
|
||||||
if (gnss_synchro_deque_iter->Flag_valid_word == true)
|
if (gnss_synchro_deque_iter->Flag_valid_word == true)
|
||||||
{
|
{
|
||||||
double T_rx_channel = (double)gnss_synchro_deque_iter->Tracking_sample_counter / (double)gnss_synchro_deque_iter->fs;
|
double T_rx_channel = static_cast<double>(gnss_synchro_deque_iter->Tracking_sample_counter) / static_cast<double>(gnss_synchro_deque_iter->fs);
|
||||||
double delta_T_rx_s = T_rx_channel - T_rx_s;
|
double delta_T_rx_s = T_rx_channel - T_rx_s;
|
||||||
|
|
||||||
// check that T_rx difference is less than a threshold (the correlation interval)
|
// check that T_rx difference is less than a threshold (the correlation interval)
|
||||||
if (delta_T_rx_s * 1000.0 < (double)gnss_synchro_deque_iter->correlation_length_ms)
|
if (delta_T_rx_s * 1000.0 < static_cast<double>(gnss_synchro_deque_iter->correlation_length_ms))
|
||||||
{
|
{
|
||||||
// record the word structure in a map for pseudorange computation
|
// record the word structure in a map for pseudorange computation
|
||||||
// save the previous observable
|
// save the previous observable
|
||||||
@ -232,20 +231,18 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
{
|
{
|
||||||
if (d_gnss_synchro_history_queue[i].at(distance-1).Flag_valid_word)
|
if (d_gnss_synchro_history_queue[i].at(distance-1).Flag_valid_word)
|
||||||
{
|
{
|
||||||
double T_rx_channel_prev = (double)d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter / (double)gnss_synchro_deque_iter->fs;
|
double T_rx_channel_prev = static_cast<double>(d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter) / static_cast<double>(gnss_synchro_deque_iter->fs);
|
||||||
double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s;
|
double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s;
|
||||||
if (fabs(delta_T_rx_s_prev) < fabs(delta_T_rx_s))
|
if (fabs(delta_T_rx_s_prev) < fabs(delta_T_rx_s))
|
||||||
{
|
{
|
||||||
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].at(distance - 1).Channel_ID,
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
|
|
||||||
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
||||||
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
||||||
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].at(distance - 1).Channel_ID,
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
|
|
||||||
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,20 +271,20 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.begin(),
|
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.begin(),
|
||||||
realigned_gnss_synchro_map.end(),
|
realigned_gnss_synchro_map.end(),
|
||||||
Hybrid_pairCompare_gnss_synchro_d_TOW);
|
Hybrid_pairCompare_gnss_synchro_d_TOW);
|
||||||
double ref_fs_hz = (double)gnss_synchro_map_iter->second.fs;
|
double ref_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
|
|
||||||
// compute interpolated TOW value at T_rx_s
|
// compute interpolated TOW value at T_rx_s
|
||||||
int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID;
|
int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID;
|
||||||
Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key);
|
Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key);
|
||||||
double ref_adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / ref_fs_hz + adj_obs.Code_phase_samples / ref_fs_hz;
|
double ref_adj_T_rx_s = static_cast<double>(adj_obs.Tracking_sample_counter) / ref_fs_hz + adj_obs.Code_phase_samples / ref_fs_hz;
|
||||||
|
|
||||||
double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
||||||
double d_ref_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / ref_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / ref_fs_hz;
|
double d_ref_T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / ref_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / ref_fs_hz;
|
||||||
|
|
||||||
double selected_T_rx_s = T_rx_s;
|
double selected_T_rx_s = T_rx_s;
|
||||||
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
||||||
double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - ref_adj_T_rx_s)
|
double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s +
|
||||||
* (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s);
|
(selected_T_rx_s - ref_adj_T_rx_s) * (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s);
|
||||||
|
|
||||||
// Now compute RX time differences due to the PRN alignment in the correlators
|
// Now compute RX time differences due to the PRN alignment in the correlators
|
||||||
double traveltime_ms;
|
double traveltime_ms;
|
||||||
@ -297,16 +294,16 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
double channel_TOW_s;
|
double channel_TOW_s;
|
||||||
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.begin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.end(); gnss_synchro_map_iter++)
|
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.begin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.end(); gnss_synchro_map_iter++)
|
||||||
{
|
{
|
||||||
channel_fs_hz = (double)gnss_synchro_map_iter->second.fs;
|
channel_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
||||||
channel_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / channel_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / channel_fs_hz;
|
channel_T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / channel_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / channel_fs_hz;
|
||||||
// compute interpolated observation values
|
// compute interpolated observation values
|
||||||
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
||||||
// TOW at the selected receiver time T_rx_s
|
// TOW at the selected receiver time T_rx_s
|
||||||
int element_key = gnss_synchro_map_iter->second.Channel_ID;
|
int element_key = gnss_synchro_map_iter->second.Channel_ID;
|
||||||
adj_obs = adjacent_gnss_synchro_map.at(element_key);
|
adj_obs = adjacent_gnss_synchro_map.at(element_key);
|
||||||
|
|
||||||
double adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / channel_fs_hz + adj_obs.Code_phase_samples / channel_fs_hz;
|
double adj_T_rx_s = static_cast<double>(adj_obs.Tracking_sample_counter) / channel_fs_hz + adj_obs.Code_phase_samples / channel_fs_hz;
|
||||||
|
|
||||||
double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - adj_T_rx_s) * (channel_TOW_s - adj_obs.TOW_at_current_symbol_s) / (channel_T_rx_s - adj_T_rx_s);
|
double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - adj_T_rx_s) * (channel_TOW_s - adj_obs.TOW_at_current_symbol_s) / (channel_T_rx_s - adj_T_rx_s);
|
||||||
|
|
||||||
@ -338,19 +335,19 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
tmp_double = current_gnss_synchro[i].RX_time;
|
tmp_double = current_gnss_synchro[i].RX_time;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_s;
|
tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_s;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].Carrier_Doppler_hz;
|
tmp_double = current_gnss_synchro[i].Carrier_Doppler_hz;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].Carrier_phase_rads/GPS_TWO_PI;
|
tmp_double = current_gnss_synchro[i].Carrier_phase_rads/GPS_TWO_PI;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].Pseudorange_m;
|
tmp_double = current_gnss_synchro[i].Pseudorange_m;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].PRN;
|
tmp_double = current_gnss_synchro[i].PRN;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
tmp_double = current_gnss_synchro[i].Flag_valid_pseudorange;
|
tmp_double = current_gnss_synchro[i].Flag_valid_pseudorange;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure& e)
|
catch (const std::ifstream::failure& e)
|
||||||
@ -372,7 +369,7 @@ int hybrid_observables_cc::general_work (int noutput_items,
|
|||||||
// pop old elements from queue
|
// pop old elements from queue
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
while (d_gnss_synchro_history_queue[i].front().Tracking_sample_counter / (double)d_gnss_synchro_history_queue[i].front().fs < (T_rx_s - past_history_s))
|
while (static_cast<double>(d_gnss_synchro_history_queue[i].front().Tracking_sample_counter) / static_cast<double>(d_gnss_synchro_history_queue[i].front().fs) < (T_rx_s - past_history_s))
|
||||||
{
|
{
|
||||||
d_gnss_synchro_history_queue[i].pop_front();
|
d_gnss_synchro_history_queue[i].pop_front();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user