[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11531 - in gnuradio/branches/developers/n4hy/pfb_iir2
From: |
n4hy |
Subject: |
[Commit-gnuradio] r11531 - in gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src: lib/filter python/gnuradio/blks2impl |
Date: |
Mon, 3 Aug 2009 03:26:20 -0600 (MDT) |
Author: n4hy
Date: 2009-08-03 03:26:19 -0600 (Mon, 03 Aug 2009)
New Revision: 11531
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/Makefile.am
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/filter.i
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am
Log:
copying pfb code from Tom's branch to mine to hack in some new stuff
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/Makefile.am
2009-08-03 07:52:54 UTC (rev 11530)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/Makefile.am
2009-08-03 09:26:19 UTC (rev 11531)
@@ -203,6 +203,10 @@
ccomplex_dotprod_generic.cc \
float_dotprod_generic.c \
short_dotprod_generic.c
+ gr_pfb_channelizer_ccf.cc \
+ gr_pfb_decimator_ccf.cc \
+ gr_pfb_interpolator_ccf.cc \
+ gr_pfb_arb_resampler_ccf.cc
libfilter_qa_la_common_SOURCES = \
qa_filter.cc \
@@ -279,6 +283,10 @@
short_dotprod_generic.h \
short_dotprod_x86.h \
sse_debug.h
+ gr_pfb_channelizer_ccf.h \
+ gr_pfb_decimator_ccf.h \
+ gr_pfb_interpolator_ccf.h \
+ gr_pfb_arb_resampler_ccf.h
noinst_HEADERS = \
assembly.h \
@@ -330,6 +338,10 @@
gr_single_pole_iir_filter_ff.i \
gr_single_pole_iir_filter_cc.i \
gr_sos_iir_filter_ffd.i \
+ gr_pfb_channelizer_ccf.i \
+ gr_pfb_decimator_ccf.i \
+ gr_pfb_interpolator_ccf.i \
+ gr_pfb_arb_resampler_ccf.i \
$(GENERATED_I)
endif
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/filter.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/filter.i
2009-08-03 07:52:54 UTC (rev 11530)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/filter.i
2009-08-03 09:26:19 UTC (rev 11531)
@@ -32,6 +32,10 @@
#include <gr_fractional_interpolator_cc.h>
#include <gr_goertzel_fc.h>
#include <gr_cma_equalizer_cc.h>
+#include <gr_pfb_channelizer_ccf.h>
+#include <gr_pfb_decimator_ccf.h>
+#include <gr_pfb_interpolator_ccf.h>
+#include <gr_pfb_arb_resampler_ccf.h>
%}
%include "gr_iir_filter_ffd.i"
@@ -45,5 +49,12 @@
%include "gr_fractional_interpolator_cc.i"
%include "gr_goertzel_fc.i"
%include "gr_cma_equalizer_cc.i"
+%include "gr_pfb_channelizer_ccf.i"
+%include "gr_pfb_decimator_ccf.i"
+%include "gr_pfb_interpolator_ccf.i"
+%include "gr_pfb_arb_resampler_ccf.i"
+%include "gr_pfb_decimator_ccf.i"
+%include "gr_pfb_interpolator_ccf.i"
+%include "gr_pfb_arb_resampler_ccf.i"
%include "filter_generated.i"
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,159 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_pfb_arb_resampler_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+
+gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const
std::vector<float> &taps)
+{
+ return gr_pfb_arb_resampler_ccf_sptr (new gr_pfb_arb_resampler_ccf (rate,
taps));
+}
+
+
+gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float>
&taps)
+ : gr_block ("pfb_arb_resampler_ccf",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_updated (false)
+{
+ d_int_rate = 32;
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ d_acc = 0;
+ d_last_filter = 0;
+
+ d_filters = std::vector<gr_fir_ccf*>(d_int_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_int_rate);
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+}
+
+gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
+{
+ for(unsigned int i = 0; i < d_int_rate; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_arb_resampler_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ d_taps.resize(d_int_rate);
+
+ // Partition the filter
+ for(i = 0; i < d_int_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to
fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = taps[i + j*d_int_rate]; // add taps to channels in
reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_arb_resampler_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_int_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+}
+
+int
+gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, j = 0, count = 0;
+ gr_complex o0, o1;
+
+ j = d_last_filter;
+ while(i < noutput_items) {
+ // start j by wrapping around mod the number of channels
+
+ while(j < d_int_rate) {
+ // Take the current filter output
+ o0 = d_filters[j]->filter(&in[count]);
+
+ // Take the next filter output; wrap around to 0 if necessary
+ if(j+1 == d_int_rate)
+ o1 = d_filters[0]->filter(&in[count+1]);
+ else
+ o1 = d_filters[j]->filter(&in[count]);
+
+ out[i] = o0 + (o1 - o0)*d_flt_rate;
+ i++;
+
+ d_acc += d_dec_rate + d_flt_rate;
+ j = (int)floor(d_acc);
+ }
+ count++;
+ j = j % d_int_rate;
+ d_acc = d_acc - floor(d_acc);
+ }
+
+ d_last_filter = j;
+
+ consume_each(count);
+ return i;
+}
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_PFB_ARB_RESAMPLER_CCF_H
+#define INCLUDED_GR_PFB_ARB_RESAMPLER_CCF_H
+
+#include <gr_block.h>
+
+class gr_pfb_arb_resampler_ccf;
+typedef boost::shared_ptr<gr_pfb_arb_resampler_ccf>
gr_pfb_arb_resampler_ccf_sptr;
+gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const
std::vector<float> &taps);
+
+class gr_fir_ccf;
+
+/*!
+ * \brief FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class gr_pfb_arb_resampler_ccf : public gr_block
+{
+ private:
+ friend gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float
rate,
+ const
std::vector<float> &taps);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ unsigned int d_int_rate;
+ unsigned int d_dec_rate;
+ float d_flt_rate;
+ float d_acc;
+ unsigned int d_last_filter;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Construct a Polyphase filterbank for channelization with the given
+ * number of channels and taps
+ */
+ gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps);
+
+public:
+ ~gr_pfb_arb_resampler_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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,pfb_arb_resampler_ccf);
+
+gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
+ const
std::vector<float> &taps);
+
+class gr_pfb_arb_resampler_ccf : public gr_block
+{
+ private:
+ gr_pfb_arb_resampler_ccf (float rate,
+ const std::vector<float> &taps);
+
+ public:
+ ~gr_pfb_arb_resampler_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+};
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,128 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_pfb_channelizer_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+
+gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int
numchans,
+ const
std::vector<float> &taps)
+{
+ return gr_pfb_channelizer_ccf_sptr (new gr_pfb_channelizer_ccf (numchans,
taps));
+}
+
+
+gr_pfb_channelizer_ccf::gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps)
+ : gr_sync_block ("pfb_channelizer_ccf",
+ gr_make_io_signature (numchans, numchans,
sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, numchans*sizeof(gr_complex))),
+ d_updated (false)
+{
+ d_numchans = numchans;
+ d_filters = std::vector<gr_fir_ccf*>(d_numchans);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_numchans);
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the FFT to handle the output de-spinning of the channels
+ d_fft = new gri_fft_complex (d_numchans, false);
+}
+
+gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf ()
+{
+ for(unsigned int i = 0; i < d_numchans; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_channelizer_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_numchans);
+
+ // Create d_numchan vectors to store each channel's taps
+ std::vector< std::vector<float> > vtaps(d_numchans);
+
+ // Partition the filter
+ for(i = 0; i < d_numchans; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to
fill out
+ vtaps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ vtaps[i][j] = taps[i + j*d_numchans]; // add taps to channels in
reverse order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(vtaps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+int
+gr_pfb_channelizer_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ for(int i = 0; i < noutput_items; i++) {
+ // Move through filters from bottom to top
+ for(int j = d_numchans-1; j >= 0; j--) {
+ // Take in the items from the first input stream to d_numchans
+ in = (gr_complex*)input_items[d_numchans - 1 - j];
+
+ // Filter current input stream from bottom filter to top
+ d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]);
+ }
+
+ // despin through FFT
+ d_fft->execute();
+ memcpy(&out[d_numchans*i], d_fft->get_outbuf(),
d_numchans*sizeof(gr_complex));
+ }
+
+ return noutput_items;
+}
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_PFB_CHANNELIZER_CCF_H
+#define INCLUDED_GR_PFB_CHANNELIZER_CCF_H
+
+#include <gr_sync_block.h>
+
+class gr_pfb_channelizer_ccf;
+typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr;
+gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int
numchans,
+ const
std::vector<float> &taps);
+
+class gr_fir_ccf;
+class gri_fft_complex;
+
+/*!
+ * \brief FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class gr_pfb_channelizer_ccf : public gr_sync_block
+{
+ private:
+ friend gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int
numchans,
+ const
std::vector<float> &taps);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ gri_fft_complex *d_fft;
+ unsigned int d_numchans;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Construct a Polyphase filterbank for channelization with the given
+ * number of channels and taps
+ */
+ gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps);
+
+public:
+ ~gr_pfb_channelizer_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,38 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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,pfb_channelizer_ccf);
+
+gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
+ const
std::vector<float> &taps);
+
+class gr_pfb_channelizer_ccf : public gr_sync_block
+{
+ private:
+ gr_pfb_channelizer_ccf (unsigned int numchans,
+ const std::vector<float> &taps);
+
+ public:
+ ~gr_pfb_channelizer_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+};
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,152 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_pfb_decimator_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gri_fft.h>
+#include <gr_io_signature.h>
+#include <gr_expj.h>
+
+gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float>
&taps,
+ unsigned int channel)
+{
+ return gr_pfb_decimator_ccf_sptr (new gr_pfb_decimator_ccf (decim, taps,
channel));
+}
+
+
+gr_pfb_decimator_ccf::gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel)
+ : gr_sync_block ("pfb_decimator_ccf",
+ gr_make_io_signature (decim, decim, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex))),
+ d_updated (false)
+{
+ d_rate = decim;
+ d_filters = std::vector<gr_fir_ccf*>(d_rate);
+ d_chan = channel;
+ d_rotator = new gr_complex[d_rate];
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_rate);
+ for(unsigned int i = 0; i < d_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ d_rotator[i] = gr_expj(i*2*M_PI*d_chan/d_rate);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+
+ // Create the FFT to handle the output de-spinning of the channels
+ d_fft = new gri_fft_complex (d_rate, false);
+}
+
+gr_pfb_decimator_ccf::~gr_pfb_decimator_ccf ()
+{
+ for(unsigned int i = 0; i < d_rate; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_decimator_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ std::vector< std::vector<float> > vtaps(d_rate);
+
+ // Partition the filter
+ for(i = 0; i < d_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to
fill out
+ vtaps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ vtaps[i][j] = taps[i + j*d_rate]; // add taps to channels in reverse
order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(vtaps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+#define ROTATEFFT
+int
+gr_pfb_decimator_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in;
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i;
+ for(i = 0; i < noutput_items; i++) {
+ // Move through filters from bottom to top
+ out[i] = 0;
+ for(int j = d_rate-1; j >= 0; j--) {
+ // Take in the items from the first input stream to d_rate
+ in = (gr_complex*)input_items[d_rate - 1 - j];
+
+ // Filter current input stream from bottom filter to top
+ // The rotate them by expj(j*k*2pi/M) where M is the number of filters
+ // (the decimation rate) and k is the channel number to extract
+
+ // This is the real math that goes on; we abuse the FFT to do this
quickly
+ // for decimation rates > N where N is a small number (~5):
+ // out[i] +=
d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate);
+#ifdef ROTATEFFT
+ d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]);
+#else
+ out[i] += d_filters[j]->filter(&in[i])*d_rotator[i];
+#endif
+ }
+
+#ifdef ROTATEFFT
+ // Perform the FFT to do the complex multiply despinning for all channels
+ d_fft->execute();
+
+ // Select only the desired channel out
+ out[i] = d_fft->get_outbuf()[d_chan];
+#endif
+
+ }
+
+ return noutput_items;
+}
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_PFB_DECIMATOR_CCF_H
+#define INCLUDED_GR_PFB_DECIMATOR_CCF_H
+
+#include <gr_sync_block.h>
+
+class gr_pfb_decimator_ccf;
+typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr;
+gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float>
&taps,
+ unsigned int channel=0);
+
+class gr_fir_ccf;
+class gri_fft_complex;
+
+/*!
+ * \brief FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class gr_pfb_decimator_ccf : public gr_sync_block
+{
+ private:
+ friend gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int
decim,
+ const
std::vector<float> &taps,
+ unsigned int
channel);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ gri_fft_complex *d_fft;
+ unsigned int d_rate;
+ unsigned int d_chan;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+ gr_complex *d_rotator;
+
+ /*!
+ * Construct a Polyphase filterbank for channelization with the given
+ * number of channels and taps
+ */
+ gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+public:
+ ~gr_pfb_decimator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ //void set_channel (unsigned int channel);
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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,pfb_decimator_ccf);
+
+gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float>
&taps,
+ unsigned int channel);
+
+class gr_pfb_decimator_ccf : public gr_sync_block
+{
+ private:
+ gr_pfb_decimator_ccf (unsigned int decim,
+ const std::vector<float> &taps,
+ unsigned int channel);
+
+ public:
+ ~gr_pfb_decimator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ //void set_channel (unsigned int channel);
+};
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,134 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_pfb_interpolator_ccf.h>
+#include <gr_fir_ccf.h>
+#include <gr_fir_util.h>
+#include <gr_io_signature.h>
+
+gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int
interp,
+ const
std::vector<float> &taps)
+{
+ return gr_pfb_interpolator_ccf_sptr (new gr_pfb_interpolator_ccf (interp,
taps));
+}
+
+
+gr_pfb_interpolator_ccf::gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float>
&taps)
+ : gr_sync_interpolator ("pfb_interpolator_ccf",
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ gr_make_io_signature (1, 1, sizeof(gr_complex)),
+ interp),
+ d_updated (false)
+{
+ d_rate = interp;
+ d_filters = std::vector<gr_fir_ccf*>(d_rate);
+
+ // Create an FIR filter for each channel and zero out the taps
+ std::vector<float> vtaps(0, d_rate);
+ for(unsigned int i = 0; i < d_rate; i++) {
+ d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
+ }
+
+ // Now, actually set the filters' taps
+ set_taps(taps);
+}
+
+gr_pfb_interpolator_ccf::~gr_pfb_interpolator_ccf ()
+{
+ for(unsigned int i = 0; i < d_rate; i++) {
+ delete d_filters[i];
+ }
+}
+
+void
+gr_pfb_interpolator_ccf::set_taps (const std::vector<float> &taps)
+{
+ unsigned int i,j;
+
+ unsigned int ntaps = taps.size();
+ d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_rate);
+
+ // Create d_numchan vectors to store each channel's taps
+ //std::vector< std::vector<float> > vtaps(d_rate);
+ d_taps.resize(d_rate);
+
+ // Partition the filter
+ for(i = 0; i < d_rate; i++) {
+ // Each channel uses all d_taps_per_filter with 0's if not enough taps to
fill out
+ d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ d_taps[i][j] = taps[i + j*d_rate]; // add taps to channels in reverse
order
+ }
+
+ // Build a filter for each channel and add it's taps to it
+ d_filters[i]->set_taps(d_taps[i]);
+ }
+
+ // Set the history to ensure enough input items for each filter
+ set_history (d_taps_per_filter);
+
+ d_updated = true;
+}
+
+void
+gr_pfb_interpolator_ccf::print_taps()
+{
+ unsigned int i, j;
+ for(i = 0; i < d_rate; i++) {
+ printf("filter[%d]: [", i);
+ for(j = 0; j < d_taps_per_filter; j++) {
+ printf(" %.4e", d_taps[i][j]);
+ }
+ printf("]\n");
+ }
+}
+
+int
+gr_pfb_interpolator_ccf::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ if (d_updated) {
+ d_updated = false;
+ return 0; // history requirements may have changed.
+ }
+
+ int i = 0, count = 0;
+
+ while(i < noutput_items) {
+ for(int j = 0; j < d_rate; j++) {
+ out[i] = d_filters[j]->filter(&in[count]);
+ i++;
+ }
+ count++;
+ }
+
+ return i;
+}
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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_PFB_INTERPOLATOR_CCF_H
+#define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H
+
+#include <gr_sync_interpolator.h>
+
+class gr_pfb_interpolator_ccf;
+typedef boost::shared_ptr<gr_pfb_interpolator_ccf>
gr_pfb_interpolator_ccf_sptr;
+gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int
interp,
+ const
std::vector<float> &taps);
+
+class gr_fir_ccf;
+
+/*!
+ * \brief FIR filter with gr_complex input, gr_complex output and float taps
+ * \ingroup filter_blk
+ */
+class gr_pfb_interpolator_ccf : public gr_sync_interpolator
+{
+ private:
+ friend gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned
int interp,
+ const
std::vector<float> &taps);
+
+ std::vector<gr_fir_ccf*> d_filters;
+ std::vector< std::vector<float> > d_taps;
+ unsigned int d_rate;
+ unsigned int d_taps_per_filter;
+ bool d_updated;
+
+ /*!
+ * Construct a Polyphase filterbank for channelization with the given
+ * number of channels and taps
+ */
+ gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+public:
+ ~gr_pfb_interpolator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.i
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,39 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 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,pfb_interpolator_ccf);
+
+gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
+ const
std::vector<float> &taps);
+
+class gr_pfb_interpolator_ccf : public gr_sync_interpolator
+{
+ private:
+ gr_pfb_interpolator_ccf (unsigned int interp,
+ const std::vector<float> &taps);
+
+ public:
+ ~gr_pfb_interpolator_ccf ();
+
+ void set_taps (const std::vector<float> &taps);
+ void print_taps();
+};
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am
2009-08-03 07:52:54 UTC (rev 11530)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am
2009-08-03 09:26:19 UTC (rev 11531)
@@ -47,6 +47,10 @@
ofdm_sync_pn.py \
ofdm_sync_pnac.py \
ofdm_sync_ml.py \
+ pfb_arb_resampler.py \
+ pfb_channelizer.py \
+ pfb_decimator.py \
+ pfb_interpolator.py \
pkt.py \
psk.py \
qam.py \
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+#
+# Copyright 2009 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.
+#
+
+from gnuradio import gr
+
+class pfb_arb_resampler_ccf(gr.hier_block2):
+ '''
+
+ '''
+ def __init__(self, rate, taps):
+ gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
+ self._rate = rate
+ self._taps = taps
+
+ self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+
+
+
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_channelizer.py
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# Copyright 2009 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.
+#
+
+from gnuradio import gr
+
+class pfb_channelizer_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter channelizer (complex in, complex out,
floating-point taps)
+ This simplifies the interface by allowing a single input stream to connect
to this block.
+ It will then output a series of streams for each channel out.
+ '''
+ def __init__(self, numchans, taps):
+ gr.hier_block2.__init__(self, "pfb_channelizer_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(numchans, numchans,
gr.sizeof_gr_complex)) # Output signature
+
+ self._numchans = numchans
+ self._taps = taps
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._numchans)
+ self.pfb = gr.pfb_channelizer_ccf(self._numchans, self._taps)
+ self.v2s = gr.vector_to_streams(gr.sizeof_gr_complex, self._numchans)
+
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._numchans):
+ self.connect((self.s2ss,i), (self.pfb,i))
+
+ # Get independent streams from the filterbank and send them out
+ self.connect(self.pfb, self.v2s)
+
+ for i in xrange(self._numchans):
+ self.connect((self.v2s,i), (self,i))
+
+
+
+
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_decimator.py
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Copyright 2009 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.
+#
+
+from gnuradio import gr
+
+class pfb_decimator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter decimator (complex in, complex out, floating-point
taps)
+ This simplifies the interface by allowing a single input stream to connect
to this block.
+ It will then output a stream that is the decimated output stream.
+ '''
+ def __init__(self, decim, taps, channel=0):
+ gr.hier_block2.__init__(self, "pfb_decimator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
+ self._decim = decim
+ self._taps = taps
+ self._channel = channel
+
+ self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._decim)
+ self.pfb = gr.pfb_decimator_ccf(self._decim, self._taps, self._channel)
+
+ self.connect(self, self.s2ss)
+
+ for i in xrange(self._decim):
+ self.connect((self.s2ss,i), (self.pfb,i))
+
+ self.connect(self.pfb, self)
Added:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/python/gnuradio/blks2impl/pfb_interpolator.py
2009-08-03 09:26:19 UTC (rev 11531)
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright 2009 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.
+#
+
+from gnuradio import gr
+
+class pfb_interpolator_ccf(gr.hier_block2):
+ '''
+ Make a Polyphase Filter interpolator (complex in, complex out,
floating-point taps)
+ This interface is very simple, but the block is made here to keep it
consistent with
+ the other PFB filter implementations.
+ '''
+ def __init__(self, interp, taps):
+ gr.hier_block2.__init__(self, "pfb_interpolator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) #
Output signature
+
+ self._interp = interp
+ self._taps = taps
+
+ self.pfb = gr.pfb_interpolator_ccf(self._interp, self._taps)
+
+ self.connect(self, self.pfb)
+ self.connect(self.pfb, self)
+
+
+
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11531 - in gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src: lib/filter python/gnuradio/blks2impl,
n4hy <=