[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11287 - gnuradio/branches/developers/trondeau/pfb/gnu
From: |
trondeau |
Subject: |
[Commit-gnuradio] r11287 - gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter |
Date: |
Thu, 25 Jun 2009 19:06:13 -0600 (MDT) |
Author: trondeau
Date: 2009-06-25 19:06:13 -0600 (Thu, 25 Jun 2009)
New Revision: 11287
Added:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
Removed:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.h
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.i
Modified:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/Makefile.am
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/filter.i
Log:
Changing the name of the PFB channelizer; better representation of its function
and to make room for more PFB classes.
Modified:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/Makefile.am
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/Makefile.am
2009-06-26 00:49:50 UTC (rev 11286)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/Makefile.am
2009-06-26 01:06:13 UTC (rev 11287)
@@ -191,7 +191,7 @@
ccomplex_dotprod_generic.cc \
float_dotprod_generic.c \
short_dotprod_generic.c \
- gr_pfb_filter_ccf.cc
+ gr_pfb_channelizer_ccf.cc
libfilter_qa_la_common_SOURCES = \
qa_filter.cc \
@@ -262,7 +262,7 @@
short_dotprod_generic.h \
short_dotprod_x86.h \
sse_debug.h \
- gr_pfb_filter_ccf.h
+ gr_pfb_channelizer_ccf.h
noinst_HEADERS = \
assembly.h \
@@ -311,7 +311,7 @@
gr_iir_filter_ffd.i \
gr_single_pole_iir_filter_ff.i \
gr_single_pole_iir_filter_cc.i \
- gr_pfb_filter_ccf.i \
+ gr_pfb_channelizer_ccf.i \
$(GENERATED_I)
endif
Modified:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
2009-06-26 00:49:50 UTC (rev 11286)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
2009-06-26 01:06:13 UTC (rev 11287)
@@ -37,7 +37,7 @@
self.head = gr.head(gr.sizeof_gr_complex, self._N)
self.s2ss = gr.stream_to_streams(gr.sizeof_gr_complex, self._M)
- self.pfb = gr.pfb_filter_ccf(self._M, self._taps)
+ self.pfb = gr.pfb_channelizer_ccf(self._M, self._taps)
self.v2s = gr.vector_to_streams(gr.sizeof_gr_complex, self._M)
self.snk_i = gr.vector_sink_c()
Modified:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/filter.i
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/filter.i
2009-06-26 00:49:50 UTC (rev 11286)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/filter.i
2009-06-26 01:06:13 UTC (rev 11287)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2005,2006,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2005,2006,2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -32,7 +32,7 @@
#include <gr_fractional_interpolator_cc.h>
#include <gr_goertzel_fc.h>
#include <gr_cma_equalizer_cc.h>
-#include <gr_pfb_filter_ccf.h>
+#include <gr_pfb_channelizer_ccf.h>
%}
%include "gr_iir_filter_ffd.i"
@@ -46,6 +46,6 @@
%include "gr_fractional_interpolator_cc.i"
%include "gr_goertzel_fc.i"
%include "gr_cma_equalizer_cc.i"
-%include "gr_pfb_filter_ccf.i"
+%include "gr_pfb_channelizer_ccf.i"
%include "filter_generated.i"
Copied:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
(from rev 11285,
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc)
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
(rev 0)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
2009-06-26 01:06:13 UTC (rev 11287)
@@ -0,0 +1,141 @@
+/* -*- 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_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::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.
+ }
+
+ //printf("noutput_items: %d\n", noutput_items);
+ //printf("ninput_items: %d\n", ninput_items[0]);
+
+ // FIXME: simple initial implementation
+ // yes, this will be optimized
+ int i = 0, count = 0;
+
+ // for(int i = 0; i < noutput_items; i++) {
+ while((i < noutput_items) && (count < ninput_items[0])) {
+ // 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));
+ i++;
+ count++;
+ }
+
+ //printf("count: %d\n", count);
+ consume_each(count);
+ return i;
+}
Property changes on:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.cc
___________________________________________________________________
Added: svn:mergeinfo
+
Copied:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
(from rev 11285,
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.h)
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
(rev 0)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
2009-06-26 01:06:13 UTC (rev 11287)
@@ -0,0 +1,71 @@
+/* -*- 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_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_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 general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
Property changes on:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.h
___________________________________________________________________
Added: svn:mergeinfo
+
Copied:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
(from rev 11275,
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.i)
===================================================================
---
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
(rev 0)
+++
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
2009-06-26 01:06:13 UTC (rev 11287)
@@ -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_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);
+};
Property changes on:
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_channelizer_ccf.i
___________________________________________________________________
Added: svn:mergeinfo
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11287 - gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter,
trondeau <=