summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorjcorgan2009-06-21 16:06:01 +0000
committerjcorgan2009-06-21 16:06:01 +0000
commit679ffc25379058f75642a66783f9f0688962feb1 (patch)
treec3d3721c9fcfe4e2aed5d4764f16cae379e36235 /gnuradio-core/src/lib
parent9c177f4194a3ed52ba6e94c66851a0f635c61fd5 (diff)
downloadgnuradio-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.cc18
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