On Mon, Jun 8, 2009 at 2:11 PM, Ben Green <bengr...@iastate.edu> wrote:

> In gr_mpsk_receiver_cc.cc, the qpsk-optimized function for calculating
> phase error makes guesses about the constellation point based on
> constellation ( 1 + 1j), (-1 + 1j), (-1 -1j), and (1 - 1j). However, the
> rest of the receiver assumes a constellation of (1 + 0j), (0 + 1j), (-1 +
> 0j), and (0 - 1j). Currently the BER is terrible for qpsk demod, and with
> much noise at all it fails completely. This patch fixes the function so that
> it is consistent with the rest of the block, and works much better now.
>
>
>
I apologize for file type issues, here is the patch in plaintext:

--- gr_mpsk_receiver_cc.cc    2009-05-29 11:15:17.000000000 -0500
+++ gr_mpsk_receiver_cc.cc    2009-06-08 13:18:37.478473275 -0500
@@ -124,8 +124,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());
+
+  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;
 }
_______________________________________________
Patch-gnuradio mailing list
Patch-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/patch-gnuradio

Reply via email to