diff options
author | ghostop14 <ghostop14@gmail.com> | 2020-02-14 11:47:37 -0500 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-02-15 14:25:57 +0100 |
commit | 504ab76d9e4fc3e9f497b9fd34f01c1bad346a5d (patch) | |
tree | c64edca089a87217e56d8840a38382d7e2b4ec56 /gr-analog/lib | |
parent | a56c3a7f4908133dc6ceb93ffd3b2f9e1dda8e0e (diff) |
gr-digital: Improve PLL Loops and Clock Recovery
These updates incorporate the same inlining of loop functions and
the newly pushed fast_cc_multiply function to ensure
consistent performance improvements across systems that do not
support the cx-limited-range compiler parameter (Macs and Windows).
Diffstat (limited to 'gr-analog/lib')
-rw-r--r-- | gr-analog/lib/pll_carriertracking_cc_impl.cc | 27 | ||||
-rw-r--r-- | gr-analog/lib/pll_carriertracking_cc_impl.h | 23 | ||||
-rw-r--r-- | gr-analog/lib/pll_freqdet_cf_impl.cc | 17 | ||||
-rw-r--r-- | gr-analog/lib/pll_freqdet_cf_impl.h | 21 | ||||
-rw-r--r-- | gr-analog/lib/pll_refout_cc_impl.cc | 18 | ||||
-rw-r--r-- | gr-analog/lib/pll_refout_cc_impl.h | 20 |
6 files changed, 58 insertions, 68 deletions
diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.cc b/gr-analog/lib/pll_carriertracking_cc_impl.cc index 81c04aa01b..f403cf3528 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.cc +++ b/gr-analog/lib/pll_carriertracking_cc_impl.cc @@ -14,7 +14,6 @@ #include "pll_carriertracking_cc_impl.h" #include <gnuradio/io_signature.h> -#include <gnuradio/math.h> #include <gnuradio/sincos.h> #include <cmath> @@ -44,29 +43,6 @@ pll_carriertracking_cc_impl::pll_carriertracking_cc_impl(float loop_bw, pll_carriertracking_cc_impl::~pll_carriertracking_cc_impl() {} -float pll_carriertracking_cc_impl::mod_2pi(float in) -{ - if (in > GR_M_PI) - return in - (2.0 * GR_M_PI); - else if (in < -GR_M_PI) - return in + (2.0 * GR_M_PI); - else - return in; -} - -float pll_carriertracking_cc_impl::phase_detector(gr_complex sample, float ref_phase) -{ - float sample_phase; - // sample_phase = atan2(sample.imag(),sample.real()); - sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); - return mod_2pi(sample_phase - ref_phase); -} - -bool pll_carriertracking_cc_impl::lock_detector(void) -{ - return (fabsf(d_locksig) > d_lock_threshold); -} - bool pll_carriertracking_cc_impl::squelch_enable(bool set_squelch) { return d_squelch_enable = set_squelch; @@ -89,7 +65,8 @@ int pll_carriertracking_cc_impl::work(int noutput_items, for (int i = 0; i < noutput_items; i++) { gr::sincosf(d_phase, &t_imag, &t_real); - optr[i] = iptr[i] * gr_complex(t_real, -t_imag); + + fast_cc_multiply(optr[i], iptr[i], gr_complex(t_real, -t_imag)); error = phase_detector(iptr[i], d_phase); diff --git a/gr-analog/lib/pll_carriertracking_cc_impl.h b/gr-analog/lib/pll_carriertracking_cc_impl.h index 3cb7146da9..82a2f1c21c 100644 --- a/gr-analog/lib/pll_carriertracking_cc_impl.h +++ b/gr-analog/lib/pll_carriertracking_cc_impl.h @@ -12,6 +12,7 @@ #define INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_IMPL_H #include <gnuradio/analog/pll_carriertracking_cc.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -22,14 +23,30 @@ private: float d_locksig, d_lock_threshold; bool d_squelch_enable; - float mod_2pi(float in); - float phase_detector(gr_complex sample, float ref_phase); + float mod_2pi(float in) + { + if (in > GR_M_PI) + return in - (2.0 * GR_M_PI); + else if (in < -GR_M_PI) + return in + (2.0 * GR_M_PI); + else + return in; + } + + float phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + // sample_phase = atan2(sample.imag(),sample.real()); + sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); + return mod_2pi(sample_phase - ref_phase); + } public: pll_carriertracking_cc_impl(float loop_bw, float max_freq, float min_freq); ~pll_carriertracking_cc_impl(); - bool lock_detector(void); + bool lock_detector(void) { return (fabsf(d_locksig) > d_lock_threshold); } + bool squelch_enable(bool); float set_lock_threshold(float); diff --git a/gr-analog/lib/pll_freqdet_cf_impl.cc b/gr-analog/lib/pll_freqdet_cf_impl.cc index f460441e92..baeecc7739 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.cc +++ b/gr-analog/lib/pll_freqdet_cf_impl.cc @@ -37,23 +37,6 @@ pll_freqdet_cf_impl::pll_freqdet_cf_impl(float loop_bw, float max_freq, float mi pll_freqdet_cf_impl::~pll_freqdet_cf_impl() {} -float pll_freqdet_cf_impl::mod_2pi(float in) -{ - if (in > GR_M_PI) - return in - (2.0 * GR_M_PI); - else if (in < -GR_M_PI) - return in + (2.0 * GR_M_PI); - else - return in; -} - -float pll_freqdet_cf_impl::phase_detector(gr_complex sample, float ref_phase) -{ - float sample_phase; - sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); - return mod_2pi(sample_phase - ref_phase); -} - int pll_freqdet_cf_impl::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) diff --git a/gr-analog/lib/pll_freqdet_cf_impl.h b/gr-analog/lib/pll_freqdet_cf_impl.h index de5c03192b..2110bcc720 100644 --- a/gr-analog/lib/pll_freqdet_cf_impl.h +++ b/gr-analog/lib/pll_freqdet_cf_impl.h @@ -12,6 +12,7 @@ #define INCLUDED_ANALOG_PLL_FREQDET_CF_IMPL_H #include <gnuradio/analog/pll_freqdet_cf.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -19,14 +20,28 @@ namespace analog { class pll_freqdet_cf_impl : public pll_freqdet_cf { private: - float phase_detector(gr_complex sample, float ref_phase); + float mod_2pi(float in) + { + if (in > GR_M_PI) + return in - (2.0 * GR_M_PI); + else if (in < -GR_M_PI) + return in + (2.0 * GR_M_PI); + else + return in; + } + + float phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); + return mod_2pi(sample_phase - ref_phase); + } + public: pll_freqdet_cf_impl(float loop_bw, float max_freq, float min_freq); ~pll_freqdet_cf_impl(); - float mod_2pi(float in); - void set_loop_bandwidth(float bw); void set_damping_factor(float df); void set_alpha(float alpha); diff --git a/gr-analog/lib/pll_refout_cc_impl.cc b/gr-analog/lib/pll_refout_cc_impl.cc index 067e650de5..9824d12178 100644 --- a/gr-analog/lib/pll_refout_cc_impl.cc +++ b/gr-analog/lib/pll_refout_cc_impl.cc @@ -14,7 +14,6 @@ #include "pll_refout_cc_impl.h" #include <gnuradio/io_signature.h> -#include <gnuradio/math.h> #include <gnuradio/sincos.h> #include <math.h> @@ -37,23 +36,6 @@ pll_refout_cc_impl::pll_refout_cc_impl(float loop_bw, float max_freq, float min_ pll_refout_cc_impl::~pll_refout_cc_impl() {} -float pll_refout_cc_impl::mod_2pi(float in) -{ - if (in > GR_M_PI) - return in - (2.0 * GR_M_PI); - else if (in < -GR_M_PI) - return in + (2.0 * GR_M_PI); - else - return in; -} - -float pll_refout_cc_impl::phase_detector(gr_complex sample, float ref_phase) -{ - float sample_phase; - sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); - return mod_2pi(sample_phase - ref_phase); -} - int pll_refout_cc_impl::work(int noutput_items, gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) diff --git a/gr-analog/lib/pll_refout_cc_impl.h b/gr-analog/lib/pll_refout_cc_impl.h index da9be48b16..dc8bf2dc9d 100644 --- a/gr-analog/lib/pll_refout_cc_impl.h +++ b/gr-analog/lib/pll_refout_cc_impl.h @@ -12,6 +12,7 @@ #define INCLUDED_ANALOG_PLL_REFOUT_CC_IMPL_H #include <gnuradio/analog/pll_refout_cc.h> +#include <gnuradio/math.h> namespace gr { namespace analog { @@ -19,8 +20,23 @@ namespace analog { class pll_refout_cc_impl : public pll_refout_cc { private: - float mod_2pi(float in); - float phase_detector(gr_complex sample, float ref_phase); + float mod_2pi(float in) + { + if (in > GR_M_PI) + return in - (2.0 * GR_M_PI); + else if (in < -GR_M_PI) + return in + (2.0 * GR_M_PI); + else + return in; + } + + float phase_detector(gr_complex sample, float ref_phase) + { + float sample_phase; + sample_phase = gr::fast_atan2f(sample.imag(), sample.real()); + return mod_2pi(sample_phase - ref_phase); + } + public: pll_refout_cc_impl(float loop_bw, float max_freq, float min_freq); |