[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] gnuradio-core/src/lib/filter Makefile.am filter...
From: |
Johnathan Corgan |
Subject: |
[Commit-gnuradio] gnuradio-core/src/lib/filter Makefile.am filter... |
Date: |
Fri, 23 Jun 2006 21:11:33 +0000 |
CVSROOT: /sources/gnuradio
Module name: gnuradio-core
Changes by: Johnathan Corgan <jcorgan> 06/06/23 21:11:33
Modified files:
src/lib/filter : Makefile.am filter.i
Added files:
src/lib/filter : gr_goertzel_fc.cc gr_goertzel_fc.h
gr_goertzel_fc.i gri_goertzel.cc gri_goertzel.h
Log message:
Work in progress Goertzel filter implementation. DOES NOT YET WORK.
Off to Field Day...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/Makefile.am?cvsroot=gnuradio&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/filter.i?cvsroot=gnuradio&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/gr_goertzel_fc.cc?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/gr_goertzel_fc.h?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/gr_goertzel_fc.i?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/gri_goertzel.cc?cvsroot=gnuradio&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnuradio-core/src/lib/filter/gri_goertzel.h?cvsroot=gnuradio&rev=1.1
Patches:
Index: Makefile.am
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/filter/Makefile.am,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- Makefile.am 23 Feb 2006 21:26:29 -0000 1.32
+++ Makefile.am 23 Jun 2006 21:11:33 -0000 1.33
@@ -168,6 +168,7 @@
$(GENERATED_CC) \
gr_fft_filter_ccc.cc \
gr_fft_filter_fff.cc \
+ gr_goertzel_fc.cc \
gr_filter_delay_fc.cc \
gr_fractional_interpolator.cc \
gr_hilbert_fc.cc \
@@ -179,6 +180,7 @@
gr_single_zero_avg_filter_ff.cc \
gr_single_zero_rec_filter_ff.cc \
gr_single_pole_iir_filter_cc.cc \
+ gri_goertzel.cc \
gri_mmse_fir_interpolator.cc \
gri_mmse_fir_interpolator_cc.cc \
complex_dotprod_generic.cc \
@@ -226,6 +228,7 @@
gr_filter_delay_fc.h \
gr_fir_sysconfig_x86.h \
gr_fractional_interpolator.h \
+ gr_goertzel_fc.h \
gr_hilbert_fc.h \
gr_iir_filter_ffd.h \
gr_rotator.h \
@@ -241,6 +244,7 @@
gr_single_pole_iir_filter_cc.h \
gr_single_zero_avg.h \
gr_single_zero_rec.h \
+ gri_goertzel.h \
gri_iir.h \
gri_mmse_fir_interpolator.h \
gri_mmse_fir_interpolator_cc.h \
@@ -283,6 +287,7 @@
gr_fft_filter_ccc.i \
gr_fft_filter_fff.i \
gr_filter_delay_fc.i \
+ gr_goertzel_fc.i \
gr_hilbert_fc.i \
gr_iir_filter_ffd.i \
gr_single_pole_iir_filter_ff.i \
Index: filter.i
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/filter/filter.i,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- filter.i 23 Feb 2006 21:26:29 -0000 1.8
+++ filter.i 23 Jun 2006 21:11:33 -0000 1.9
@@ -28,6 +28,7 @@
#include <gr_filter_delay_fc.h>
#include <gr_fft_filter_ccc.h>
#include <gr_fft_filter_fff.h>
+#include <gr_goertzel_fc.h>
%}
%include "gr_iir_filter_ffd.i"
@@ -37,5 +38,6 @@
%include "gr_filter_delay_fc.i"
%include "gr_fft_filter_ccc.i"
%include "gr_fft_filter_fff.i"
+%include "gr_goertzel_fc.i"
%include "filter_generated.i"
Index: gr_goertzel_fc.cc
===================================================================
RCS file: gr_goertzel_fc.cc
diff -N gr_goertzel_fc.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gr_goertzel_fc.cc 23 Jun 2006 21:11:33 -0000 1.1
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_goertzel_fc.h>
+#include <gr_io_signature.h>
+
+// public constructor
+gr_goertzel_fc_sptr
+gr_make_goertzel_fc(int rate, int points, float freq)
+{
+ return gr_goertzel_fc_sptr (new gr_goertzel_fc(rate, points, freq));
+}
+
+gr_goertzel_fc::gr_goertzel_fc(int rate, int points, float freq)
+ : gr_sync_decimator("goertzel_fc",
+ gr_make_io_signature (1, 1, sizeof (float)),
+ gr_make_io_signature (1, 1, sizeof (gr_complex)),
+ points),
+ d_goertzel(rate, points, freq)
+{
+ d_points = points;
+}
+
+gr_goertzel_fc::~gr_goertzel_fc ()
+{
+}
+
+int gr_goertzel_fc::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ float *in = (float *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ printf("noutput_items=%d\n", noutput_items);
+
+ for (int i = 0; i < noutput_items; i++) {
+ *out++ = d_goertzel.dft(in);
+ in += sizeof(float)*d_points;
+ }
+
+ return noutput_items;
+}
Index: gr_goertzel_fc.h
===================================================================
RCS file: gr_goertzel_fc.h
diff -N gr_goertzel_fc.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gr_goertzel_fc.h 23 Jun 2006 21:11:33 -0000 1.1
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_GR_GOERTZEL_FC_H
+#define INCLUDED_GR_GOERTZEL_FC_H
+
+#include <gri_goertzel.h>
+#include <gr_sync_decimator.h>
+
+class gr_goertzel_fc;
+typedef boost::shared_ptr<gr_goertzel_fc> gr_goertzel_fc_sptr;
+
+// public constructor
+gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int points, float freq);
+
+/*!
+ * \brief Goertzel single-bin DFT calculation.
+ * \ingroup filter
+ */
+class gr_goertzel_fc : public gr_sync_decimator
+{
+ private:
+ friend gr_goertzel_fc_sptr gr_make_goertzel_fc (int rate, int points, float
freq);
+
+ gr_goertzel_fc(int rate, int points, float freq);
+ gri_goertzel d_goertzel;
+ int d_points;
+
+ public:
+ ~gr_goertzel_fc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_GOERTZEL_FC_H */
+
Index: gr_goertzel_fc.i
===================================================================
RCS file: gr_goertzel_fc.i
diff -N gr_goertzel_fc.i
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gr_goertzel_fc.i 23 Jun 2006 21:11:33 -0000 1.1
@@ -0,0 +1,32 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,goertzel_fc);
+
+gr_goertzel_fc_sptr gr_make_goertzel_fc(int rate, int points, float freq);
+
+class gr_goertzel_fc : public gr_sync_decimator
+{
+private:
+ gr_goertzel_fc ();
+};
+
Index: gri_goertzel.cc
===================================================================
RCS file: gri_goertzel.cc
diff -N gri_goertzel.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gri_goertzel.cc 23 Jun 2006 21:11:33 -0000 1.1
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cstdio>
+#include <cmath>
+
+#include <gri_goertzel.h>
+
+gri_goertzel::gri_goertzel(int rate, int points, float freq)
+{
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ float w = 2.0*M_PI*freq/rate;
+ d_wr = 2.0*std::cos(w);
+ d_wi = std::sin(w);
+
+ d_n = points;
+
+ printf("wr: %f wi: %f n: %i\n", d_wr, d_wi, d_n);
+}
+
+gr_complex gri_goertzel::dft(float *input)
+{
+ d_d1 = 0.0;
+ d_d2 = 0.0;
+
+ for(int i = 0; i < d_n; i++) {
+ float y = input[i] + d_wr*d_d1 - d_d2;
+ d_d2 = d_d1;
+ d_d1 = y;
+ }
+
+ return gr_complex((0.5*d_wr*d_d1-d_d2)/d_n, (d_wi*d_d1)/d_n);
+}
+
+gri_goertzel::~gri_goertzel()
+{
+}
Index: gri_goertzel.h
===================================================================
RCS file: gri_goertzel.h
diff -N gri_goertzel.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gri_goertzel.h 23 Jun 2006 21:11:33 -0000 1.1
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef INCLUDED_GRI_GOERTZEL_H
+#define INCLUDED_GRI_GOERTZEL_H
+
+#include <gr_types.h>
+
+/*!
+ * \brief implements Goertzel single-bin DFT calculation
+ */
+
+class gri_goertzel
+{
+public:
+ gri_goertzel(int rate, int points, float freq);
+ ~gri_goertzel();
+
+ gr_complex dft(float *input);
+
+private:
+ float d_d1;
+ float d_d2;
+ float d_wr;
+ float d_wi;
+ int d_n;
+};
+
+#endif /* INCLUDED_GRI_GOERTZEL_H */
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] gnuradio-core/src/lib/filter Makefile.am filter...,
Johnathan Corgan <=