diff options
author | jcorgan | 2009-06-21 16:06:01 +0000 |
---|---|---|
committer | jcorgan | 2009-06-21 16:06:01 +0000 |
commit | 679ffc25379058f75642a66783f9f0688962feb1 (patch) | |
tree | c3d3721c9fcfe4e2aed5d4764f16cae379e36235 /gnuradio-core/src/lib | |
parent | 9c177f4194a3ed52ba6e94c66851a0f635c61fd5 (diff) | |
download | gnuradio-679ffc25379058f75642a66783f9f0688962feb1.tar.gz gnuradio-679ffc25379058f75642a66783f9f0688962feb1.tar.bz2 gnuradio-679ffc25379058f75642a66783f9f0688962feb1.zip |
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
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc | 18 |
1 files changed, 15 insertions, 3 deletions
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 |