summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authormatt2008-07-24 06:08:01 +0000
committermatt2008-07-24 06:08:01 +0000
commit01668d67403cd1ee9a5626c931ad95c35c9cc5f7 (patch)
treefad35e0f0478ee73b0809c82f5150d198e2ca924 /gnuradio-core/src
parente9ef818c8afd0e32e9033522acf2e713fffa01a5 (diff)
downloadgnuradio-01668d67403cd1ee9a5626c931ad95c35c9cc5f7.tar.gz
gnuradio-01668d67403cd1ee9a5626c931ad95c35c9cc5f7.tar.bz2
gnuradio-01668d67403cd1ee9a5626c931ad95c35c9cc5f7.zip
first cut at iq imbalance compensation
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8993 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am3
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.cc61
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.h54
-rw-r--r--gnuradio-core/src/lib/general/gr_iqcomp_cc.i36
4 files changed, 154 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index 05ea84e12..c449a39b7 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -87,6 +87,7 @@ libgeneral_la_SOURCES = \
gr_head.cc \
gr_interleave.cc \
gr_interleaved_short_to_complex.cc \
+ gr_iqcomp_cc.cc \
gr_keep_one_in_n.cc \
gr_kludge_copy.cc \
gr_lfsr_32k_source_s.cc \
@@ -233,6 +234,7 @@ grinclude_HEADERS = \
gr_head.h \
gr_interleave.h \
gr_interleaved_short_to_complex.h \
+ gr_iqcomp_cc.h \
gr_keep_one_in_n.h \
gr_kludge_copy.h \
gr_lfsr_32k_source_s.h \
@@ -387,6 +389,7 @@ swiginclude_HEADERS = \
gr_head.i \
gr_interleave.i \
gr_interleaved_short_to_complex.i \
+ gr_iqcomp_cc.i \
gr_keep_one_in_n.i \
gr_kludge_copy.i \
gr_lfsr_32k_source_s.i \
diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc
new file mode 100644
index 000000000..19b81392e
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_iqcomp_cc.h>
+#include <gr_io_signature.h>
+
+gr_iqcomp_cc_sptr
+gr_make_iqcomp_cc (float mu)
+{
+ return gr_iqcomp_cc_sptr (new gr_iqcomp_cc (mu));
+}
+
+gr_iqcomp_cc::gr_iqcomp_cc (float mu)
+ : gr_sync_block ("iqcomp_cc",
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex))),
+ d_mu (mu)
+{
+ float d_wi=0.0, d_wq=0.0;
+}
+
+int
+gr_iqcomp_cc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const gr_complex *iptr = (gr_complex *) input_items[0];
+ gr_complex *optr = (gr_complex *) output_items[0];
+
+ for(int i = 0 ; i < noutput_items ; i++) {
+ float i_out = iptr[i].real() - iptr[i].imag() * d_wq;
+ float q_out = iptr[i].imag() - iptr[i].real() * d_wi;
+ d_wi += d_mu * q_out * iptr[i].real();
+ d_wq += d_mu * i_out * iptr[i].imag();
+ }
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h
new file mode 100644
index 000000000..77be5085d
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_GR_IQCOMP_CC_H
+#define INCLUDED_GR_IQCOMP_CC_H
+
+#include <gr_sync_block.h>
+
+class gr_iqcomp_cc;
+typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr;
+
+gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+/*!
+ * \brief
+ * \ingroup
+ */
+class gr_iqcomp_cc : public gr_sync_block
+{
+ friend gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+ float d_mu, d_wi, d_wq;
+ gr_iqcomp_cc (float mu);
+
+ public:
+ float mu () const { return d_mu; }
+ void set_mu (float mu) { d_mu = mu; }
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.i b/gnuradio-core/src/lib/general/gr_iqcomp_cc.i
new file mode 100644
index 000000000..91710ad28
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_iqcomp_cc.i
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+GR_SWIG_BLOCK_MAGIC(gr,iqcomp_cc)
+
+gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu);
+
+class gr_iqcomp_cc : public gr_sync_block
+{
+ private:
+ gr_iqcomp_cc (float mu);
+
+ public:
+ float mu () const { return d_mu; }
+ void set_mu (float mu) { d_mu = mu; }
+};