commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 21/28: filter: initial commit of gr filter,


From: git
Subject: [Commit-gnuradio] [gnuradio] 21/28: filter: initial commit of gr filter, made fir decim block
Date: Mon, 15 Aug 2016 00:47:07 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

nwest pushed a commit to annotated tag gr_basic_work
in repository gnuradio.

commit c48bea2b579c9f17afa789eea9d778a3d1a66739
Author: Josh Blum <address@hidden>
Date:   Sun Nov 13 19:34:18 2011 -0800

    filter: initial commit of gr filter, made fir decim block
---
 CMakeLists.txt                                     |   9 +-
 gnuradio-core/src/lib/runtime/gr_sync_decimator.h  |   2 +-
 .../src/lib/runtime/gr_sync_interpolator.h         |   1 +
 gr-filter/CMakeLists.txt                           | 102 +++++++++++++++++++
 gr-filter/gnuradio-filter.pc.in                    |  11 ++
 gr-filter/grc/CMakeLists.txt                       |  29 ++++++
 gr-filter/grc/filter_block_tree.xml                |  35 +++++++
 gr-filter/grc/filter_decim_fir.xml                 |  44 ++++++++
 gr-filter/include/CMakeLists.txt                   |  28 ++++++
 gr-filter/include/gr_filter_api.h                  |  33 ++++++
 gr-filter/include/gr_filter_decim_fir.h            |  47 +++++++++
 gr-filter/lib/CMakeLists.txt                       |  47 +++++++++
 gr-filter/lib/gr_filter_decim_fir.cc               | 111 +++++++++++++++++++++
 gr-filter/python/CMakeLists.txt                    |  49 +++++++++
 gr-filter/python/__init__.py                       |  20 ++++
 gr-filter/swig/CMakeLists.txt                      |  47 +++++++++
 gr-filter/swig/filter_fir.i                        |  34 +++++++
 gr-filter/swig/filter_swig.i                       |  35 +++++++
 18 files changed, 680 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6b0c54..d1cb281 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,7 +63,8 @@ if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
 endif()
 
 if(CMAKE_COMPILER_IS_GNUCXX)
-    GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wsign-compare HAVE_SIGN_COMPARE)
+    GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wsign-compare 
HAVE_WARN_SIGN_COMPARE)
+    GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-Wall HAVE_WARN_ALL)
 endif(CMAKE_COMPILER_IS_GNUCXX)
 
 if(MSVC)
@@ -197,15 +198,17 @@ install(
 
 
 ########################################################################
-# Add subdirectories
+# Add subdirectories (in order of deps)
 ########################################################################
 add_subdirectory(gruel)
 add_subdirectory(gnuradio-core)
 add_subdirectory(grc)
 
+add_subdirectory(gr-basic)
+add_subdirectory(gr-filter)
+
 add_subdirectory(gr-atsc)
 add_subdirectory(gr-audio)
-add_subdirectory(gr-basic)
 add_subdirectory(gr-comedi)
 add_subdirectory(gr-digital)
 add_subdirectory(gr-noaa)
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h 
b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h
index b2ed3c4..7228d36 100644
--- a/gnuradio-core/src/lib/runtime/gr_sync_decimator.h
+++ b/gnuradio-core/src/lib/runtime/gr_sync_decimator.h
@@ -38,7 +38,7 @@ class GR_CORE_API gr_sync_decimator : public gr_sync_block
   unsigned     d_decimation;
 
  protected:
-
+  gr_sync_decimator (void){} //allows pure virtual interface sub-classes
   gr_sync_decimator (const std::string &name,
                     gr_io_signature_sptr input_signature,
                     gr_io_signature_sptr output_signature,
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h 
b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h
index d65b3da..c332a52 100644
--- a/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h
+++ b/gnuradio-core/src/lib/runtime/gr_sync_interpolator.h
@@ -38,6 +38,7 @@ class GR_CORE_API gr_sync_interpolator : public gr_sync_block
   unsigned     d_interpolation;
 
  protected:
+  gr_sync_interpolator (void){} //allows pure virtual interface sub-classes
   gr_sync_interpolator (const std::string &name,
                        gr_io_signature_sptr input_signature,
                        gr_io_signature_sptr output_signature,
diff --git a/gr-filter/CMakeLists.txt b/gr-filter/CMakeLists.txt
new file mode 100644
index 0000000..1061bb9
--- /dev/null
+++ b/gr-filter/CMakeLists.txt
@@ -0,0 +1,102 @@
+# Copyright 2011 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.
+
+########################################################################
+# Setup dependencies
+########################################################################
+include(GrBoost)
+
+########################################################################
+# Register component
+########################################################################
+include(GrComponent)
+GR_REGISTER_COMPONENT("gr-filter" ENABLE_GR_FILTER
+    Boost_FOUND
+    ENABLE_GR_CORE
+)
+
+GR_SET_GLOBAL(GR_FILTER_INCLUDE_DIRS
+    ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+
+########################################################################
+# Begin conditional configuration
+########################################################################
+if(ENABLE_GR_FILTER)
+
+########################################################################
+# Setup CPack components
+########################################################################
+include(GrPackage)
+CPACK_SET(CPACK_COMPONENT_GROUP_FILTER_DESCRIPTION "GNU Radio Filter Blocks")
+
+CPACK_COMPONENT("filter_runtime"
+    GROUP        "Filter"
+    DISPLAY_NAME "Runtime"
+    DESCRIPTION  "Dynamic link libraries"
+    DEPENDS      "core_runtime"
+)
+
+CPACK_COMPONENT("filter_devel"
+    GROUP        "Filter"
+    DISPLAY_NAME "Development"
+    DESCRIPTION  "C++ headers, package config, import libraries"
+    DEPENDS      "core_devel"
+)
+
+CPACK_COMPONENT("filter_python"
+    GROUP        "Filter"
+    DISPLAY_NAME "Python"
+    DESCRIPTION  "Python modules for runtime"
+    DEPENDS      "core_python;filter_runtime"
+)
+
+CPACK_COMPONENT("filter_swig"
+    GROUP        "Filter"
+    DISPLAY_NAME "SWIG"
+    DESCRIPTION  "SWIG development .i files"
+    DEPENDS      "core_swig;filter_python;filter_devel"
+)
+
+########################################################################
+# Add subdirectories
+########################################################################
+add_subdirectory(include)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+    add_subdirectory(swig)
+    add_subdirectory(python)
+    add_subdirectory(grc)
+endif(ENABLE_PYTHON)
+
+########################################################################
+# Create Pkg Config File
+########################################################################
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-filter.pc.in
+    ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.pc
address@hidden)
+
+install(
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-filter.pc
+    DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
+    COMPONENT "filter_devel"
+)
+
+endif(ENABLE_GR_FILTER)
diff --git a/gr-filter/gnuradio-filter.pc.in b/gr-filter/gnuradio-filter.pc.in
new file mode 100644
index 0000000..7a8bfbf
--- /dev/null
+++ b/gr-filter/gnuradio-filter.pc.in
@@ -0,0 +1,11 @@
address@hidden@
address@hidden@
address@hidden@
address@hidden@
+
+Name: gnuradio-basic
+Description: GNU Radio filter blocks
+Requires: gnuradio-core
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-filter
+Cflags: -I${includedir}
diff --git a/gr-filter/grc/CMakeLists.txt b/gr-filter/grc/CMakeLists.txt
new file mode 100644
index 0000000..260cb43
--- /dev/null
+++ b/gr-filter/grc/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Copyright 2011 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.
+
+########################################################################
+# Install GRC xml files
+########################################################################
+file(GLOB xml_files ${CMAKE_CURRENT_SOURCE_DIR}/*.xml)
+
+install(FILES
+    ${xml_files}
+    DESTINATION ${GRC_BLOCKS_DIR}
+    COMPONENT "filter_python"
+)
diff --git a/gr-filter/grc/filter_block_tree.xml 
b/gr-filter/grc/filter_block_tree.xml
new file mode 100644
index 0000000..eed7172
--- /dev/null
+++ b/gr-filter/grc/filter_block_tree.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2011 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.
+-->
+
+<!--
+###################################################
+##Block Tree for GR Filter blocks.
+###################################################
+ -->
+<cat>
+    <name></name> <!-- Blank for Root Name -->
+    <cat>
+        <name>Filter</name>
+        <block>filter_decim_fir</block>
+    </cat>
+</cat>
diff --git a/gr-filter/grc/filter_decim_fir.xml 
b/gr-filter/grc/filter_decim_fir.xml
new file mode 100644
index 0000000..8154027
--- /dev/null
+++ b/gr-filter/grc/filter_decim_fir.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Decimating FIR Filter
+###################################################
+ -->
+<block>
+    <name>Decimating FIR Filter</name>
+    <key>filter_decim_fir</key>
+    <import>from gnuradio import filter</import>
+    <import>from gnuradio.gr import firdes</import>
+    <make>filter.decim_fir(filter.$type, $decim)
+self.$(id).set_taps($taps)</make>
+    <callback>set_taps($taps)</callback>
+    <param>
+        <name>Type</name>
+        <key>type</key>
+        <type>enum</type>
+        <option>
+            <name>FC32 IO, FC32 Taps</name>
+            <key>FILTER_FC32_IO_FC32_TAPS</key>
+            <opt>input:fc32</opt><opt>output:fc32</opt>
+        </option>
+    </param>
+    <param>
+        <name>Decimation</name>
+        <key>decim</key>
+        <value>1</value>
+        <type>int</type>
+    </param>
+    <param>
+        <name>Taps</name>
+        <key>taps</key>
+        <type>complex_vector</type>
+    </param>
+    <sink>
+        <name>in</name>
+        <type>$type.input</type>
+    </sink>
+    <source>
+        <name>out</name>
+        <type>$type.output</type>
+    </source>
+</block>
diff --git a/gr-filter/include/CMakeLists.txt b/gr-filter/include/CMakeLists.txt
new file mode 100644
index 0000000..3f6ac87
--- /dev/null
+++ b/gr-filter/include/CMakeLists.txt
@@ -0,0 +1,28 @@
+# Copyright 2011 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.
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+    gr_filter_api.h
+    gr_filter_decim_fir.h
+    DESTINATION ${GR_INCLUDE_DIR}/gnuradio
+    COMPONENT "filter_devel"
+)
diff --git a/gr-filter/include/gr_filter_api.h 
b/gr-filter/include/gr_filter_api.h
new file mode 100644
index 0000000..40843f5
--- /dev/null
+++ b/gr-filter/include/gr_filter_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 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_FILTER_API_H
+#define INCLUDED_GR_FILTER_API_H
+
+#include <gruel/attributes.h>
+
+#ifdef gnuradio_filter_EXPORTS
+#  define GR_FILTER_API __GR_ATTR_EXPORT
+#else
+#  define GR_FILTER_API __GR_ATTR_IMPORT
+#endif
+
+#endif /* INCLUDED_GR_FILTER_API_H */
diff --git a/gr-filter/include/gr_filter_decim_fir.h 
b/gr-filter/include/gr_filter_decim_fir.h
new file mode 100644
index 0000000..fe087e7
--- /dev/null
+++ b/gr-filter/include/gr_filter_decim_fir.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2011 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_FILTER_DECIM_FIR_H
+#define INCLUDED_GR_FILTER_DECIM_FIR_H
+
+#include <gr_filter_api.h>
+#include <gr_sync_decimator.h>
+#include <complex>
+
+//TODO move this to common include
+enum filter_type{
+    FILTER_FC32_IO_FC32_TAPS,
+    FILTER_F32_IO_F32_TAPS,
+};
+
+class GR_FILTER_API gr_filter_decim_fir : virtual public gr_sync_decimator{
+public:
+    typedef boost::shared_ptr<gr_filter_decim_fir> sptr;
+
+    //! Make a new FIR filter given data type
+    static sptr make(filter_type type, const size_t decim = 1);
+
+    //! Set the taps for this FIR filter
+    virtual void set_taps(const std::vector<std::complex<double> > &taps) = 0;
+
+};
+
+#endif /* INCLUDED_GR_FILTER_DECIM_FIR_H */
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
new file mode 100644
index 0000000..97f0eb4
--- /dev/null
+++ b/gr-filter/lib/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright 2011 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.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+    ${GNURADIO_CORE_INCLUDE_DIRS}
+    ${GR_FILTER_INCLUDE_DIRS}
+)
+
+include_directories(${Boost_INCLUDE_DIRS})
+include_directories(${VOLK_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND gr_filter_sources
+    gr_filter_decim_fir.cc
+)
+
+list(APPEND filter_libs
+    gnuradio-core
+    ${Boost_LIBRARIES}
+    volk
+)
+
+add_library(gnuradio-filter SHARED ${gr_filter_sources})
+target_link_libraries(gnuradio-filter ${filter_libs})
+GR_LIBRARY_FOO(gnuradio-filter RUNTIME_COMPONENT "filter_runtime" 
DEVEL_COMPONENT "filter_devel")
diff --git a/gr-filter/lib/gr_filter_decim_fir.cc 
b/gr-filter/lib/gr_filter_decim_fir.cc
new file mode 100644
index 0000000..9023a0d
--- /dev/null
+++ b/gr-filter/lib/gr_filter_decim_fir.cc
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2011 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.
+ */
+
+
+#define LV_HAVE_GENERIC
+#include <volk/volk_32fc_x2_dot_prod_32fc_a.h>
+
+#include <gr_filter_decim_fir.h>
+#include <gr_io_signature.h>
+#include <gruel/thread.h>
+#include <algorithm>
+#include <stdexcept>
+#include <volk/volk.h>
+#include <iostream>
+#include <boost/shared_array.hpp>
+
+/***********************************************************************
+ * FIR filter FC32 implementation
+ **********************************************************************/
+class gr_filter_decim_fir_fc32 : public gr_filter_decim_fir{
+public:
+    typedef std::complex<float> type;
+
+    gr_filter_decim_fir_fc32(const size_t decim):
+        gr_sync_decimator(
+            "FIR filter FC32",
+            gr_make_io_signature (1, 1, sizeof(type)),
+            gr_make_io_signature (1, 1, sizeof(type)),
+            decim
+        )
+    {
+        const int alignment_multiple = volk_get_alignment() / sizeof(type);
+        set_output_multiple(std::max(16, alignment_multiple));
+    }
+
+    int work(
+        int noutput_items,
+        gr_vector_const_void_star &input_items,
+        gr_vector_void_star &output_items
+    ){
+        gruel::scoped_lock lock(_taps_mutex);
+        type *out = reinterpret_cast<type *>(output_items[0]);
+        const type *in = reinterpret_cast<const type *>(input_items[0]);
+        const size_t num_bytes = this->history() * sizeof(type);
+
+        for (size_t i = 0; i < size_t(noutput_items); i++){
+            volk_32fc_x2_conjugate_dot_prod_32fc_a(out, in, _taps, num_bytes);
+            out++;
+            in += this->decimation();
+        }
+
+        return noutput_items;
+    }
+
+    void set_taps(const std::vector<std::complex<double> > &taps_){
+        gruel::scoped_lock lock(_taps_mutex);
+
+        //copy the new taps in and update history
+        std::vector<type> taps(taps_.size());
+        for (size_t i = 0; i < taps.size(); i++){
+            taps[i] = type(taps_[i]);
+        }
+        if (taps.size() % 2 == 1){ //pad to 2x multiple because volk
+            taps.push_back(0.0);
+        }
+        std::reverse(taps.begin(), taps.end());
+        this->set_history(taps.size());
+
+        //copy taps in aligned memory
+        //TODO the blob work can easily allocate managed aligned memory (so 
use that when its merged)
+        const size_t num_bytes = this->history() * sizeof(type);
+        const size_t align_pad = volk_get_alignment() - 1;
+        _taps_mem = boost::shared_array<char>(new char[num_bytes + align_pad]);
+        _taps = reinterpret_cast<type *>(size_t(_taps_mem.get() + align_pad) & 
~align_pad);
+        std::memcpy(_taps, &taps.front(), num_bytes);
+    }
+
+private:
+    gruel::mutex _taps_mutex;
+    boost::shared_array<char> _taps_mem;
+    type *_taps;
+};
+
+/***********************************************************************
+ * FIR filter factory function
+ **********************************************************************/
+gr_filter_decim_fir::sptr gr_filter_decim_fir::make(filter_type type, const 
size_t decim){
+    switch(type){
+    case FILTER_FC32_IO_FC32_TAPS: return sptr(new 
gr_filter_decim_fir_fc32(decim));
+    case FILTER_F32_IO_F32_TAPS://TODO
+    default: throw std::invalid_argument("make FIR filter got unknown type");
+    }
+}
diff --git a/gr-filter/python/CMakeLists.txt b/gr-filter/python/CMakeLists.txt
new file mode 100644
index 0000000..f637b82
--- /dev/null
+++ b/gr-filter/python/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Copyright 2011 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.
+
+########################################################################
+# Setup python install
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+    FILES
+    __init__.py
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/filter
+    COMPONENT "filter_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+    get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+    set(GR_TEST_PYTHON_DIRS
+        ${CMAKE_BINARY_DIR}/gnuradio-core/src/python
+        ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig
+        ${CMAKE_BINARY_DIR}/gr-filter/python
+        ${CMAKE_BINARY_DIR}/gr-filter/swig
+    )
+    set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-filter)
+    GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} 
${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-filter/python/__init__.py b/gr-filter/python/__init__.py
new file mode 100644
index 0000000..3f92d74
--- /dev/null
+++ b/gr-filter/python/__init__.py
@@ -0,0 +1,20 @@
+# Copyright 2011 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 filter_swig import *
diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt
new file mode 100644
index 0000000..088648d
--- /dev/null
+++ b/gr-filter/swig/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Copyright 2011 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.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+    ${GR_FILTER_INCLUDE_DIRS}
+    ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_LIBRARIES gnuradio-filter)
+
+GR_SWIG_MAKE(filter_swig filter_swig.i)
+
+GR_SWIG_INSTALL(
+    TARGETS filter_swig
+    DESTINATION ${GR_PYTHON_DIR}/gnuradio/filter
+    COMPONENT "filter_python"
+)
+
+install(
+    FILES
+    filter_swig.i
+    filter_fir.i
+    DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+    COMPONENT "filter_swig"
+)
diff --git a/gr-filter/swig/filter_fir.i b/gr-filter/swig/filter_fir.i
new file mode 100644
index 0000000..7b11542
--- /dev/null
+++ b/gr-filter/swig/filter_fir.i
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2011 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.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// block headers
+////////////////////////////////////////////////////////////////////////
+%{
+#include <gr_filter_decim_fir.h>
+%}
+
+%include <gr_filter_decim_fir.h>
+
+////////////////////////////////////////////////////////////////////////
+// block magic
+////////////////////////////////////////////////////////////////////////
+GR_SWIG_BLOCK_MAGIC2(gr_filter,decim_fir)
diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i
new file mode 100644
index 0000000..f8f0ddc
--- /dev/null
+++ b/gr-filter/swig/filter_swig.i
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 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.
+ */
+
+#define GR_FILTER_API
+
+%ignore gr_sync_block;
+%ignore gr_sync_decimator;
+
+////////////////////////////////////////////////////////////////////////
+// standard includes
+////////////////////////////////////////////////////////////////////////
+%include <gnuradio.i>
+
+////////////////////////////////////////////////////////////////////////
+// block includes
+////////////////////////////////////////////////////////////////////////
+%include <filter_fir.i>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]