From 679ffc25379058f75642a66783f9f0688962feb1 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sun, 21 Jun 2009 16:06:01 +0000 Subject: Fix QPSK phase error detector. Applied patch from Ben Green, modified by Tom Rondeau. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11254 221aa14e-8319-0410-a670-987f0aec2ac5 --- gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gnuradio-core/src/lib/general') diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc index cdb5bdc0e..49bbb8d36 100644 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc +++ b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc @@ -123,9 +123,21 @@ gr_mpsk_receiver_cc::forecast(int noutput_items, gr_vector_int &ninput_items_req float gr_mpsk_receiver_cc::phase_error_detector_qpsk(gr_complex sample) const { - float phase_error = -((sample.real()>0 ? 1.0 : -1.0) * sample.imag() - - (sample.imag()>0 ? 1.0 : -1.0) * sample.real()); - return -phase_error; + float phase_error = 0; + if(fabsf(sample.real()) > fabsf(sample.imag())) { + if(sample.real() > 0) + phase_error = -sample.imag(); + else + phase_error = sample.imag(); + } + else { + if(sample.imag() > 0) + phase_error = sample.real(); + else + phase_error = -sample.real(); + } + + return phase_error; } float -- cgit