commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11254 - gnuradio/trunk/gnuradio-core/src/lib/general


From: jcorgan
Subject: [Commit-gnuradio] r11254 - gnuradio/trunk/gnuradio-core/src/lib/general
Date: Sun, 21 Jun 2009 10:06:01 -0600 (MDT)

Author: jcorgan
Date: 2009-06-21 10:06:01 -0600 (Sun, 21 Jun 2009)
New Revision: 11254

Modified:
   gnuradio/trunk/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
Log:
Fix QPSK phase error detector.  Applied patch from Ben Green, modified by Tom 
Rondeau.

Modified: gnuradio/trunk/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc
===================================================================
--- gnuradio/trunk/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc 
2009-06-21 07:29:28 UTC (rev 11253)
+++ gnuradio/trunk/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc 
2009-06-21 16:06:01 UTC (rev 11254)
@@ -123,9 +123,21 @@
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]