Skip to content
This repository
Browse code

removed decim fir, nice demo, but gr-filter is more useful

  • Loading branch information...
commit 90cc6b6f056621d5dd49c7387394f39d1d05fc5f 1 parent bec0ec5
Josh Blum authored
1  grc/CMakeLists.txt
@@ -37,7 +37,6 @@ list(APPEND grc_sources
37 37 extras_delay.xml
38 38 extras_multiply_const.xml
39 39 extras_noise_source.xml
40   - extras_decim_fir.xml
41 40 extras_blob_to_socket.xml
42 41 extras_blob_to_stream.xml
43 42 extras_socket_to_blob.xml
1  grc/extras_block_tree.xml
@@ -49,7 +49,6 @@
49 49 <block>extras_packet_framer</block>
50 50 <block>extras_packet_deframer</block>
51 51 <block>extras_uhd_amsg_source</block>
52   - <block>extras_decim_fir</block>
53 52 <block>extras_pmt_rpc</block>
54 53 <block>extras_msg_many_to_one</block>
55 54 </cat>
46 grc/extras_decim_fir.xml
... ... @@ -1,46 +0,0 @@
1   -<?xml version="1.0"?>
2   -<!--
3   -###################################################
4   -##Decimating FIR Filter
5   -###################################################
6   - -->
7   -<block>
8   - <name>Extras: Decimating FIR Filter</name>
9   - <key>extras_decim_fir</key>
10   - <import>import gnuradio.extras as gr_extras</import>
11   - <import>from gnuradio.gr import firdes</import>
12   - <make>gr_extras.decim_fir_$(type)($taps, $decim)</make>
13   - <callback>set_taps($taps)</callback>
14   - <param>
15   - <name>Type</name>
16   - <key>type</key>
17   - <type>enum</type>
18   - <option>
19   - <name>FC32 IO, FC32 Taps</name>
20   - <key>fc32_fc32_fc32</key>
21   - </option>
22   - <option>
23   - <name>F32 IO, F32 Taps</name>
24   - <key>f32_f32_f32</key>
25   - </option>
26   - </param>
27   - <param>
28   - <name>Decimation</name>
29   - <key>decim</key>
30   - <value>1</value>
31   - <type>int</type>
32   - </param>
33   - <param>
34   - <name>Taps</name>
35   - <key>taps</key>
36   - <type>complex_vector</type>
37   - </param>
38   - <sink>
39   - <name>in</name>
40   - <type>$(str($type).split('_')[0])</type>
41   - </sink>
42   - <source>
43   - <name>out</name>
44   - <type>$(str($type).split('_')[2])</type>
45   - </source>
46   -</block>
1  include/gnuradio/extras/CMakeLists.txt
@@ -39,7 +39,6 @@ list(APPEND include_sources
39 39 signal_source.h
40 40 subtract.h
41 41 stream_selector.h
42   - decim_fir.h
43 42 blob_to_filedes.h
44 43 blob_to_socket.h
45 44 blob_to_stream.h
59 include/gnuradio/extras/decim_fir.h
... ... @@ -1,59 +0,0 @@
1   -/*
2   - * Copyright 2011-2012 Free Software Foundation, Inc.
3   - *
4   - * This file is part of GNU Radio
5   - *
6   - * GNU Radio is free software; you can redistribute it and/or modify
7   - * it under the terms of the GNU General Public License as published by
8   - * the Free Software Foundation; either version 3, or (at your option)
9   - * any later version.
10   - *
11   - * GNU Radio is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU General Public License
17   - * along with GNU Radio; see the file COPYING. If not, write to
18   - * the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Boston, MA 02110-1301, USA.
20   - */
21   -
22   -#ifndef INCLUDED_GR_EXTRAS_DECIM_FIR_H
23   -#define INCLUDED_GR_EXTRAS_DECIM_FIR_H
24   -
25   -#include <gnuradio/extras/api.h>
26   -#include <gnuradio/block.h>
27   -#include <vector>
28   -#include <complex>
29   -
30   -namespace gnuradio{ namespace extras{
31   -
32   -class GR_EXTRAS_API decim_fir : virtual public block{
33   -public:
34   - typedef boost::shared_ptr<decim_fir> sptr;
35   - typedef std::vector<std::complex<float> > taps_type;
36   -
37   - //! Make a new FIR filter complex float input, taps, output type
38   - static sptr make_fc32_fc32_fc32(
39   - const taps_type &taps,
40   - const size_t decim = 1
41   - );
42   -
43   - //! Make a new FIR filter float input, taps, output type
44   - static sptr make_f32_f32_f32(
45   - const taps_type &taps,
46   - const size_t decim = 1
47   - );
48   -
49   - //! Set the taps for this FIR filter
50   - virtual void set_taps(const taps_type &taps) = 0;
51   -
52   - //! Get the taps set on this FIR filter
53   - virtual taps_type get_taps(void) = 0;
54   -
55   -};
56   -
57   -}}
58   -
59   -#endif /* INCLUDED_GR_EXTRAS_DECIM_FIR_H */
3  include/gnuradio/extras/socket_msg.h
@@ -36,6 +36,9 @@ class GR_EXTRAS_API socket_msg : virtual public gr_hier_block2{
36 36 *
37 37 * The TCP socket will listen on addr/port, and accept the first connection.
38 38 *
  39 + * Run the flowgraph and type "netcat addr port" into the terminal
  40 + * to get a quick instant messenger interface into the flow graph.
  41 + *
39 42 * \param proto the protocol "TCP" only for now
40 43 * \param addr the resolvable interface address of the socket
41 44 * \param port the resolvable interface port of the socket
1  lib/CMakeLists.txt
@@ -46,7 +46,6 @@ list(APPEND gr_extras_sources
46 46 subtract.cc
47 47 stream_selector.cc
48 48 block_gateway.cc
49   - decim_fir.cc
50 49 pmt_ext_blob.cc
51 50 pmt_ext_mgr.cc
52 51 blob_to_filedes.cc
158 lib/decim_fir.cc
... ... @@ -1,158 +0,0 @@
1   -/*
2   - * Copyright 2011-2012 Free Software Foundation, Inc.
3   - *
4   - * This file is part of GNU Radio
5   - *
6   - * GNU Radio is free software; you can redistribute it and/or modify
7   - * it under the terms of the GNU General Public License as published by
8   - * the Free Software Foundation; either version 3, or (at your option)
9   - * any later version.
10   - *
11   - * GNU Radio is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU General Public License
17   - * along with GNU Radio; see the file COPYING. If not, write to
18   - * the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Boston, MA 02110-1301, USA.
20   - */
21   -
22   -#include <gnuradio/extras/decim_fir.h>
23   -#include <gr_io_signature.h>
24   -#include <gruel/thread.h>
25   -#include <algorithm>
26   -#include <stdexcept>
27   -#include <volk/volk.h>
28   -#include <iostream>
29   -
30   -using namespace gnuradio::extras;
31   -
32   -/***********************************************************************
33   - * FIR filter FC32 implementation
34   - **********************************************************************/
35   -struct decim_fir_fc32_work{
36   - int operator()(
37   - const gnuradio::block::InputItems &input_items,
38   - const gnuradio::block::OutputItems &output_items,
39   - const void *taps_ptr,
40   - const size_t num_taps,
41   - const size_t decim
42   - ){
43   - typedef std::complex<float> type;
44   - type *out = output_items[0].cast<type *>();
45   - const type *in = input_items[0].cast<const type *>();
46   - const type *taps = reinterpret_cast<const type *>(taps_ptr);
47   -
48   - for (size_t i = 0; i < output_items[0].size(); i++){
49   - volk_32fc_x2_dot_prod_32fc_u(out+i, in, taps, num_taps);
50   - in += decim;
51   - }
52   -
53   - return output_items[0].size();
54   - }
55   -};
56   -
57   -/***********************************************************************
58   - * FIR filter F32 implementation
59   - **********************************************************************/
60   -struct decim_fir_f32_work{
61   - int operator()(
62   - const gnuradio::block::InputItems &input_items,
63   - const gnuradio::block::OutputItems &output_items,
64   - const void *taps_ptr,
65   - const size_t num_taps,
66   - const size_t decim
67   - ){
68   - typedef float type;
69   - type *out = output_items[0].cast<type *>();
70   - const type *in = input_items[0].cast<const type *>();
71   - const type *taps = reinterpret_cast<const type *>(taps_ptr);
72   -
73   - for (size_t i = 0; i < output_items[0].size(); i++){
74   - volk_32f_x2_dot_prod_32f_u(out+i, in, taps, num_taps);
75   - in += decim;
76   - }
77   -
78   - return output_items[0].size();
79   - }
80   -};
81   -
82   -/***********************************************************************
83   - * FIR filter generic implementation
84   - **********************************************************************/
85   -template <typename intype, typename tapstype, typename outtype, typename WorkType>
86   -class generic_decim_fir : public decim_fir{
87   -public:
88   -
89   - generic_decim_fir(const size_t decim):
90   - block(
91   - "FIR filter",
92   - gr_make_io_signature (1, 1, sizeof(intype)),
93   - gr_make_io_signature (1, 1, sizeof(outtype))
94   - )
95   - {
96   - this->set_relative_rate(1.0/decim);
97   - }
98   -
99   - int work(
100   - const InputItems &input_items,
101   - const OutputItems &output_items
102   - ){
103   - gruel::scoped_lock lock(_taps_mutex);
104   - _volk_work(
105   - input_items, output_items,
106   - &_converted_taps.front(),
107   - this->history(),
108   - size_t(1.0/this->relative_rate())
109   - );
110   - return output_items[0].size();
111   - }
112   -
113   - void set_taps(const taps_type &taps){
114   - gruel::scoped_lock lock(_taps_mutex);
115   -
116   - //copy the new taps in and update history
117   - _converted_taps.resize(taps.size());
118   - _original_taps.resize(taps.size());
119   - for (size_t i = 0; i < taps.size(); i++){
120   - _converted_taps[i] = tapstype(taps[i].real());
121   - _original_taps[i] = taps[i];
122   - }
123   - std::reverse(_converted_taps.begin(), _converted_taps.end());
124   - this->set_history(_converted_taps.size());
125   - }
126   -
127   - taps_type get_taps(void){
128   - gruel::scoped_lock lock(_taps_mutex);
129   - return _original_taps;
130   - }
131   -
132   -private:
133   - gruel::mutex _taps_mutex;
134   - std::vector<tapstype> _converted_taps;
135   - taps_type _original_taps;
136   - WorkType _volk_work;
137   -};
138   -
139   -/***********************************************************************
140   - * FIR filter factory function
141   - **********************************************************************/
142   -decim_fir::sptr decim_fir::make_fc32_fc32_fc32(
143   - const taps_type &taps, const size_t decim
144   -){
145   - decim_fir::sptr b = gnuradio::get_initial_sptr(new generic_decim_fir
146   - <std::complex<float>, std::complex<float>, std::complex<float>, decim_fir_fc32_work >(decim));
147   - b->set_taps(taps);
148   - return b;
149   -}
150   -
151   -decim_fir::sptr decim_fir::make_f32_f32_f32(
152   - const taps_type &taps, const size_t decim
153   -){
154   - decim_fir::sptr b = gnuradio::get_initial_sptr(new generic_decim_fir
155   - <float, float, float, decim_fir_f32_work>(decim));
156   - b->set_taps(taps);
157   - return b;
158   -}
1  swig/CMakeLists.txt
@@ -90,7 +90,6 @@ list(APPEND swig_sources
90 90 extras_ops.i
91 91 extras_stream_selector.i
92 92 extras_block_gateway.i
93   - extras_fir.i
94 93 extras_pmt.i
95 94 extras_blobs.i
96 95 ${CMAKE_CURRENT_BINARY_DIR}/extras_swig_doc.i
38 swig/extras_fir.i
... ... @@ -1,38 +0,0 @@
1   -/*
2   - * Copyright 2011-2012 Free Software Foundation, Inc.
3   - *
4   - * This file is part of GNU Radio
5   - *
6   - * GNU Radio is free software; you can redistribute it and/or modify
7   - * it under the terms of the GNU General Public License as published by
8   - * the Free Software Foundation; either version 3, or (at your option)
9   - * any later version.
10   - *
11   - * GNU Radio is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU General Public License
17   - * along with GNU Radio; see the file COPYING. If not, write to
18   - * the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Boston, MA 02110-1301, USA.
20   - */
21   -
22   -////////////////////////////////////////////////////////////////////////
23   -// block headers
24   -////////////////////////////////////////////////////////////////////////
25   -%{
26   -#include <gnuradio/extras/decim_fir.h>
27   -%}
28   -
29   -%include <gnuradio/extras/decim_fir.h>
30   -
31   -////////////////////////////////////////////////////////////////////////
32   -// block magic
33   -////////////////////////////////////////////////////////////////////////
34   -using namespace gnuradio::extras;
35   -
36   -GR_EXTRAS_SWIG_BLOCK_FACTORY_DECL(decim_fir)
37   -GR_EXTRAS_SWIG_BLOCK_FACTORY2(decim_fir, fc32_fc32_fc32)
38   -GR_EXTRAS_SWIG_BLOCK_FACTORY2(decim_fir, f32_f32_f32)
1  swig/extras_swig.i
@@ -48,7 +48,6 @@ namespace std {
48 48 %include <extras_ops.i>
49 49 %include <extras_delay.i>
50 50 %include <extras_sources.i>
51   -%include <extras_fir.i>
52 51 %include <extras_stream_selector.i>
53 52 %include <extras_blobs.i>
54 53 %include <extras_block_gateway.i>

0 comments on commit 90cc6b6

Please sign in to comment.
Something went wrong with that request. Please try again.