From a9f3f197618141f2c83917bbee3f11e7ca7eb2c9 Mon Sep 17 00:00:00 2001 From: Vladislav P Date: Sun, 7 Apr 2024 07:52:16 +0000 Subject: [PATCH] RDS: add a define to compare old and new RDS demodulators on GR3.8+ --- src/dsp/rx_rds.cpp | 20 ++++++++++++++------ src/dsp/rx_rds.h | 6 ++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/dsp/rx_rds.cpp b/src/dsp/rx_rds.cpp index 149fc0ae9..82c0fb978 100644 --- a/src/dsp/rx_rds.cpp +++ b/src/dsp/rx_rds.cpp @@ -240,7 +240,11 @@ rx_rds::rx_rds(double sample_rate, bool encorr) gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (char))), d_sample_rate(sample_rate) { +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS constexpr int decim1=10; +#else + constexpr int decim1=10; +#endif if (sample_rate < 128000.0) { throw std::invalid_argument("RDS sample rate not supported"); } @@ -260,7 +264,11 @@ rx_rds::rx_rds(double sample_rate, bool encorr) #endif int n_taps = 151*5; +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS + d_rrcf = gr::filter::firdes::root_raised_cosine(1, ((float)d_sample_rate*d_interpolation)/(d_decimation*decim1), 2375.0, 1.2, n_taps); +#else d_rrcf = gr::filter::firdes::root_raised_cosine(1, ((float)d_sample_rate*d_interpolation)/(d_decimation*decim1), 2375.0, 1.0, n_taps); +#endif // auto tmp_rrcf=gr::filter::firdes::root_raised_cosine(1, (d_sample_rate*float(d_interpolation))/float(d_decimation*decim1), 2375.0*0.5, 1, n_taps); // volk_32f_x2_add_32f(d_rrcf.data(),d_rrcf.data(),tmp_rrcf.data(),n_taps); d_rrcf_manchester = std::vector(n_taps-8); @@ -275,7 +283,7 @@ rx_rds::rx_rds(double sample_rate, bool encorr) //d_costas_loop->set_damping_factor(0.85); d_costas_loop->set_min_freq(-0.0003f*float(decim1)); d_costas_loop->set_max_freq(0.0003f*float(decim1)); -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS gr::digital::constellation_sptr p_c = soft_bpsk::make()->base(); d_bpf = gr::filter::fir_filter_ccf::make(1, d_rrcf); @@ -332,7 +340,7 @@ rx_rds::rx_rds(double sample_rate, bool encorr) connect(d_ddbb, 0, self(), 0); #else -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS d_det=dbpsk_det_cb::make(); connect(d_sync, 0, d_det, 0); connect(d_sync, 1, d_det, 1); @@ -432,7 +440,7 @@ rx_rds::~rx_rds () void rx_rds::trig() { -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS changed_value(C_RDS_CR_OMEGA, d_index, d_sync->omega()); changed_value(C_RDS_CR_MU, d_index, d_sync->mu()); changed_value(C_RDS_CL_FREQ, d_index, d_costas_loop->get_frequency()*1000.f); @@ -457,14 +465,14 @@ void rx_rds::update_fxff_taps() void rx_rds::set_omega_lim(float v) { -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS d_sync->set_omega_lim(d_omega_lim=v); #endif } void rx_rds::set_dll_bw(float v) { -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS d_sync->set_dllbw(v); #endif } @@ -476,7 +484,7 @@ void rx_rds::set_cl_bw(float v) float rx_rds::phase_snr() const { -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS return dynamic_cast(d_det.get())->snr(); #else return 0; diff --git a/src/dsp/rx_rds.h b/src/dsp/rx_rds.h index 007b93617..e0f99a02a 100644 --- a/src/dsp/rx_rds.h +++ b/src/dsp/rx_rds.h @@ -64,6 +64,8 @@ typedef boost::shared_ptr rx_rds_sptr; typedef std::shared_ptr rx_rds_sptr; #endif +#define NEW_RDS 1 + rx_rds_sptr make_rx_rds(double sample_ratee=240000.0, bool encorr=false); @@ -76,7 +78,7 @@ class rx_rds : public gr::hier_block2, public conf_notifier void set_index(int v) {d_index=v;} void set_agc_rate(float v) { } -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS void set_gain_mu(float v) {d_sync->set_gain_mu(d_gain_mu=v);} void set_gain_omega(float v) {d_sync->set_gain_omega(d_gain_omega=v);} #else @@ -107,7 +109,7 @@ class rx_rds : public gr::hier_block2, public conf_notifier std::vector d_rrcf; std::vector d_rrcf_manchester; rx_agc_cc_sptr d_agc; -#if GNURADIO_VERSION < 0x030800 +#if (GNURADIO_VERSION < 0x030800) || NEW_RDS clock_recovery_el_cc::sptr d_sync; gr::blocks::keep_one_in_n::sptr d_koin; #else