From 89f684339d1d75617badb5f8b19c5e0e8dc9b711 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <tom@trondeau.com>
Date: Tue, 29 Jul 2014 15:24:16 -0400
Subject: blocks: adding VOLK support for some functions.

* multipy_const_vcc and _vff
* sub_ff
* float_to_complex
* binary_slicer

Also adds a min_XX block to complement max_XX.
---
 gr-blocks/include/gnuradio/blocks/CMakeLists.txt   | 10 ++--
 gr-blocks/include/gnuradio/blocks/min_XX.h.t       | 57 ++++++++++++++++++++
 .../include/gnuradio/blocks/multiply_const_cc.h    |  2 -
 .../include/gnuradio/blocks/multiply_const_vcc.h   | 62 ++++++++++++++++++++++
 .../include/gnuradio/blocks/multiply_const_vff.h   | 62 ++++++++++++++++++++++
 gr-blocks/include/gnuradio/blocks/sub_ff.h         | 51 ++++++++++++++++++
 6 files changed, 239 insertions(+), 5 deletions(-)
 create mode 100644 gr-blocks/include/gnuradio/blocks/min_XX.h.t
 create mode 100644 gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h
 create mode 100644 gr-blocks/include/gnuradio/blocks/multiply_const_vff.h
 create mode 100644 gr-blocks/include/gnuradio/blocks/sub_ff.h

(limited to 'gr-blocks/include/gnuradio')

diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
index 96e86078f3..662f705901 100644
--- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
+++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
@@ -30,11 +30,12 @@ GR_EXPAND_X_H(blocks and_const_XX       bb ss ii)
 GR_EXPAND_X_H(blocks argmax_XX          fs is ss)
 GR_EXPAND_X_H(blocks divide_XX          ss ii ff cc)
 GR_EXPAND_X_H(blocks integrate_XX       ss ii ff cc)
-GR_EXPAND_X_H(blocks max_XX             ff ii ss)
+GR_EXPAND_X_H(blocks max_XX             ss ii ff)
+GR_EXPAND_X_H(blocks min_XX             ss ii ff)
 GR_EXPAND_X_H(blocks moving_average_XX  ss ii ff cc)
 GR_EXPAND_X_H(blocks multiply_XX        ss ii)
 GR_EXPAND_X_H(blocks multiply_const_XX  ss ii)
-GR_EXPAND_X_H(blocks multiply_const_vXX ss ii ff cc)
+GR_EXPAND_X_H(blocks multiply_const_vXX ss ii)
 GR_EXPAND_X_H(blocks multiply_matrix_XX ff cc)
 GR_EXPAND_X_H(blocks mute_XX            ss ii ff cc)
 GR_EXPAND_X_H(blocks not_XX             bb ss ii)
@@ -43,7 +44,7 @@ GR_EXPAND_X_H(blocks peak_detector_XX   fb ib sb)
 GR_EXPAND_X_H(blocks probe_signal_X     b s i f c)
 GR_EXPAND_X_H(blocks probe_signal_vX    b s i f c)
 GR_EXPAND_X_H(blocks sample_and_hold_XX bb ss ii ff)
-GR_EXPAND_X_H(blocks sub_XX             ss ii ff cc)
+GR_EXPAND_X_H(blocks sub_XX             ss ii cc)
 GR_EXPAND_X_H(blocks tsb_vector_sink_X  b s i f c)
 GR_EXPAND_X_H(blocks xor_XX             bb ss ii)
 GR_EXPAND_X_H(blocks packed_to_unpacked_XX bb ss ii)
@@ -122,7 +123,9 @@ install(FILES
     multiply_ff.h
     multiply_conjugate_cc.h
     multiply_const_cc.h
+    multiply_const_vcc.h
     multiply_const_ff.h
+    multiply_const_vff.h
     nlog10_ff.h
     nop.h
     null_sink.h
@@ -155,6 +158,7 @@ install(FILES
     streams_to_stream.h
     streams_to_vector.h
     stretch_ff.h
+    sub_ff.h
     tag_debug.h
     tag_gate.h
     tagged_file_sink.h
diff --git a/gr-blocks/include/gnuradio/blocks/min_XX.h.t b/gr-blocks/include/gnuradio/blocks/min_XX.h.t
new file mode 100644
index 0000000000..45c7357f02
--- /dev/null
+++ b/gr-blocks/include/gnuradio/blocks/min_XX.h.t
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 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.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <gnuradio/blocks/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+  namespace blocks {
+
+    /*!
+     * \brief Compares vectors from multiple streams and determines
+     * the minimum value from each vector over all streams.
+     * \ingroup math_operators_blk
+     *
+     * \details
+     * Data is passed in as a vector of length \p vlen from multiple
+     * input sources. It will look through these streams of \p vlen
+     * data items and the output stream will contain the minimum value
+     * in the vector.
+     */
+    class BLOCKS_API @NAME@ : virtual public sync_block
+    {
+    public:
+      // gr::blocks::@NAME@::sptr
+      typedef boost::shared_ptr<@NAME@> sptr;
+
+      static sptr make(size_t vlen);
+    };
+
+  } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h
index ff72572da9..3e8ed7c889 100644
--- a/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h
+++ b/gr-blocks/include/gnuradio/blocks/multiply_const_cc.h
@@ -20,8 +20,6 @@
  * Boston, MA 02110-1301, USA.
  */
 
-// @WARNING@
-
 #ifndef INCLUDED_MULTIPLY_CONST_CC_H
 #define INCLUDED_MULTIPLY_CONST_CC_H
 
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h b/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h
new file mode 100644
index 0000000000..78d2752751
--- /dev/null
+++ b/gr-blocks/include/gnuradio/blocks/multiply_const_vcc.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 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_MULTIPLY_CONST_VCC_H
+#define INCLUDED_MULTIPLY_CONST_VCC_H
+
+#include <gnuradio/blocks/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+  namespace blocks {
+
+    /*!
+     * \brief output = input * constant vector (element-wise)
+     * \ingroup math_operators_blk
+     */
+    class BLOCKS_API multiply_const_vcc : virtual public sync_block
+    {
+    public:
+      // gr::blocks::multiply_const_vcc::sptr
+      typedef boost::shared_ptr<multiply_const_vcc> sptr;
+
+      /*!
+       * \brief Create an instance of multiply_const_vcc
+       * \param k multiplicative constant vector
+       */
+      static sptr make(std::vector<gr_complex> k);
+
+      /*!
+       * \brief Return multiplicative constant vector
+       */
+      virtual std::vector<gr_complex> k() const = 0;
+
+      /*!
+       * \brief Set multiplicative constant vector
+       */
+      virtual void set_k(std::vector<gr_complex> k) = 0;
+    };
+
+  } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_VCC_H */
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h b/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h
new file mode 100644
index 0000000000..884088e288
--- /dev/null
+++ b/gr-blocks/include/gnuradio/blocks/multiply_const_vff.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 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_MULTIPLY_CONST_VFF_H
+#define INCLUDED_MULTIPLY_CONST_VFF_H
+
+#include <gnuradio/blocks/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+  namespace blocks {
+
+    /*!
+     * \brief output = input * constant vector (element-wise)
+     * \ingroup math_operators_blk
+     */
+    class BLOCKS_API multiply_const_vff : virtual public sync_block
+    {
+    public:
+      // gr::blocks::multiply_const_vff::sptr
+      typedef boost::shared_ptr<multiply_const_vff> sptr;
+
+      /*!
+       * \brief Create an instance of multiply_const_vff
+       * \param k multiplicative constant vector
+       */
+      static sptr make(std::vector<float> k);
+
+      /*!
+       * \brief Return multiplicative constant vector
+       */
+      virtual std::vector<float> k() const = 0;
+
+      /*!
+       * \brief Set multiplicative constant vector
+       */
+      virtual void set_k(std::vector<float> k) = 0;
+    };
+
+  } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_MULTIPLY_CONST_VFF_H */
diff --git a/gr-blocks/include/gnuradio/blocks/sub_ff.h b/gr-blocks/include/gnuradio/blocks/sub_ff.h
new file mode 100644
index 0000000000..3cc844f888
--- /dev/null
+++ b/gr-blocks/include/gnuradio/blocks/sub_ff.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 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_BLOCKS_SUB_FF_H
+#define INCLUDED_BLOCKS_SUB_FF_H
+
+#include <gnuradio/blocks/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+  namespace blocks {
+
+    /*!
+     * \brief output = input_0 -  input_1 - ...)
+     * \ingroup math_operators_blk
+     *
+     * \details
+     * Subtract across all input streams.
+     */
+    class BLOCKS_API sub_ff : virtual public sync_block
+    {
+    public:
+      // gr::blocks::sub_ff::sptr
+      typedef boost::shared_ptr<sub_ff> sptr;
+
+      static sptr make(size_t vlen=1);
+    };
+
+  } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_SUB_FF_H */
-- 
cgit v1.2.3