summaryrefslogtreecommitdiff
path: root/gr-blocks/lib
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-07-29 15:24:16 -0400
committerTom Rondeau <tom@trondeau.com>2014-07-29 19:27:58 -0400
commit89f684339d1d75617badb5f8b19c5e0e8dc9b711 (patch)
tree81d171dc2ee039446df97c74d9440050fbecb894 /gr-blocks/lib
parentbf914b6ca9b64d12c510c92a3cc6f4762639c0f8 (diff)
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.
Diffstat (limited to 'gr-blocks/lib')
-rw-r--r--gr-blocks/lib/CMakeLists.txt10
-rw-r--r--gr-blocks/lib/float_to_complex_impl.cc15
-rw-r--r--gr-blocks/lib/min_XX_impl.cc.t80
-rw-r--r--gr-blocks/lib/min_XX_impl.h.t50
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.cc2
-rw-r--r--gr-blocks/lib/multiply_const_cc_impl.h2
-rw-r--r--gr-blocks/lib/multiply_const_vcc_impl.cc72
-rw-r--r--gr-blocks/lib/multiply_const_vcc_impl.h50
-rw-r--r--gr-blocks/lib/multiply_const_vff_impl.cc72
-rw-r--r--gr-blocks/lib/multiply_const_vff_impl.h50
-rw-r--r--gr-blocks/lib/sub_ff_impl.cc82
-rw-r--r--gr-blocks/lib/sub_ff_impl.h47
12 files changed, 519 insertions, 13 deletions
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index b3892ce64e..b2711c9e86 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -35,11 +35,12 @@ GR_EXPAND_X_CC_H_IMPL(blocks and_const_XX bb ss ii)
GR_EXPAND_X_CC_H_IMPL(blocks argmax_XX fs is ss)
GR_EXPAND_X_CC_H_IMPL(blocks divide_XX ss ii ff cc)
GR_EXPAND_X_CC_H_IMPL(blocks integrate_XX ss ii ff cc)
-GR_EXPAND_X_CC_H_IMPL(blocks max_XX ff ii ss)
+GR_EXPAND_X_CC_H_IMPL(blocks max_XX ss ii ff)
+GR_EXPAND_X_CC_H_IMPL(blocks min_XX ss ii ff)
GR_EXPAND_X_CC_H_IMPL(blocks moving_average_XX ss ii ff cc)
GR_EXPAND_X_CC_H_IMPL(blocks multiply_XX ss ii)
GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_XX ss ii)
-GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_vXX ss ii ff cc)
+GR_EXPAND_X_CC_H_IMPL(blocks multiply_const_vXX ss ii)
GR_EXPAND_X_CC_H_IMPL(blocks mute_XX ss ii ff cc)
GR_EXPAND_X_CC_H_IMPL(blocks not_XX bb ss ii)
GR_EXPAND_X_CC_H_IMPL(blocks or_XX bb ss ii)
@@ -47,7 +48,7 @@ GR_EXPAND_X_CC_H_IMPL(blocks peak_detector_XX fb ib sb)
GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_X b s i f c)
GR_EXPAND_X_CC_H_IMPL(blocks probe_signal_vX b s i f c)
GR_EXPAND_X_CC_H_IMPL(blocks sample_and_hold_XX bb ss ii ff)
-GR_EXPAND_X_CC_H_IMPL(blocks sub_XX ss ii ff cc)
+GR_EXPAND_X_CC_H_IMPL(blocks sub_XX ss ii cc)
GR_EXPAND_X_CC_H_IMPL(blocks tsb_vector_sink_X b s i f c)
GR_EXPAND_X_CC_H_IMPL(blocks xor_XX bb ss ii)
GR_EXPAND_X_CC_H_IMPL(blocks packed_to_unpacked_XX bb ss ii)
@@ -140,7 +141,9 @@ list(APPEND gr_blocks_sources
multiply_ff_impl.cc
multiply_conjugate_cc_impl.cc
multiply_const_cc_impl.cc
+ multiply_const_vcc_impl.cc
multiply_const_ff_impl.cc
+ multiply_const_vff_impl.cc
nlog10_ff_impl.cc
nop_impl.cc
null_sink_impl.cc
@@ -175,6 +178,7 @@ list(APPEND gr_blocks_sources
streams_to_stream_impl.cc
streams_to_vector_impl.cc
stretch_ff_impl.cc
+ sub_ff_impl.cc
tagged_file_sink_impl.cc
tagged_stream_to_pdu_impl.cc
tagged_stream_multiply_length_impl.cc
diff --git a/gr-blocks/lib/float_to_complex_impl.cc b/gr-blocks/lib/float_to_complex_impl.cc
index 236438daac..a2dd0d3bb8 100644
--- a/gr-blocks/lib/float_to_complex_impl.cc
+++ b/gr-blocks/lib/float_to_complex_impl.cc
@@ -31,15 +31,17 @@
namespace gr {
namespace blocks {
- float_to_complex::sptr float_to_complex::make(size_t vlen)
+ float_to_complex::sptr
+ float_to_complex::make(size_t vlen)
{
- return gnuradio::get_initial_sptr(new float_to_complex_impl(vlen));
+ return gnuradio::get_initial_sptr
+ (new float_to_complex_impl(vlen));
}
float_to_complex_impl::float_to_complex_impl(size_t vlen)
: sync_block("float_to_complex",
- io_signature::make (1, 2, sizeof(float)*vlen),
- io_signature::make (1, 1, sizeof(gr_complex)*vlen)),
+ io_signature::make(1, 2, sizeof(float)*vlen),
+ io_signature::make(1, 1, sizeof(gr_complex)*vlen)),
d_vlen(vlen)
{
const int alignment_multiple =
@@ -63,8 +65,9 @@ namespace gr {
break;
case 2:
- for (size_t j = 0; j < noutput_items*d_vlen; j++)
- out[j] = gr_complex (r[j], i[j]);
+ //for (size_t j = 0; j < noutput_items*d_vlen; j++)
+ // out[j] = gr_complex (r[j], i[j]);
+ volk_32f_x2_interleave_32fc(out, r, i, noutput_items*d_vlen);
break;
default:
diff --git a/gr-blocks/lib/min_XX_impl.cc.t b/gr-blocks/lib/min_XX_impl.cc.t
new file mode 100644
index 0000000000..d77dda208d
--- /dev/null
+++ b/gr-blocks/lib/min_XX_impl.cc.t
@@ -0,0 +1,80 @@
+/* -*- 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@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <@NAME_IMPL@.h>
+#include <gnuradio/io_signature.h>
+
+namespace gr {
+ namespace blocks {
+
+ @NAME@::sptr
+ @NAME@::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME_IMPL@(vlen));
+ }
+
+ @NAME_IMPL@::@NAME_IMPL@(size_t vlen)
+ : sync_block("@BASE_NAME@",
+ io_signature::make(1, -1, vlen*sizeof(@I_TYPE@)),
+ io_signature::make(1, 1, sizeof(@O_TYPE@))),
+ d_vlen(vlen)
+ {
+ }
+
+ @NAME_IMPL@::~@NAME_IMPL@()
+ {
+ }
+
+ int
+ @NAME_IMPL@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ @O_TYPE@ *optr = (@O_TYPE@ *)output_items[0];
+
+ int ninputs = input_items.size();
+
+ for(int i = 0; i < noutput_items; i++) {
+ @I_TYPE@ min = ((@I_TYPE@ *)input_items[0])[i*d_vlen];
+
+ for(int j = 0; j < (int)d_vlen; j++ ) {
+ for(int k = 0; k < ninputs; k++) {
+ if(((@I_TYPE@ *)input_items[k])[i*d_vlen + j] < min) {
+ min = ((@I_TYPE@*)input_items[k])[i*d_vlen + j];
+ }
+ }
+ }
+
+ *optr++ = (@O_TYPE@)min;
+ }
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/min_XX_impl.h.t b/gr-blocks/lib/min_XX_impl.h.t
new file mode 100644
index 0000000000..33be614a8a
--- /dev/null
+++ b/gr-blocks/lib/min_XX_impl.h.t
@@ -0,0 +1,50 @@
+/* -*- 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_IMPL@
+#define @GUARD_NAME_IMPL@
+
+#include <gnuradio/blocks/@NAME@.h>
+
+namespace gr {
+ namespace blocks {
+
+ class @NAME_IMPL@ : public @NAME@
+ {
+ private:
+ size_t d_vlen;
+
+ public:
+ @NAME_IMPL@(size_t vlen);
+ ~@NAME_IMPL@();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME_IMPL@ */
diff --git a/gr-blocks/lib/multiply_const_cc_impl.cc b/gr-blocks/lib/multiply_const_cc_impl.cc
index f6b8dc3d63..c082a1ddd8 100644
--- a/gr-blocks/lib/multiply_const_cc_impl.cc
+++ b/gr-blocks/lib/multiply_const_cc_impl.cc
@@ -20,8 +20,6 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/gr-blocks/lib/multiply_const_cc_impl.h b/gr-blocks/lib/multiply_const_cc_impl.h
index 29ba6dd14c..06f60b13dc 100644
--- a/gr-blocks/lib/multiply_const_cc_impl.h
+++ b/gr-blocks/lib/multiply_const_cc_impl.h
@@ -20,8 +20,6 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
-
#ifndef INCLUDED_MULTIPLY_CONST_CC_IMPL_H
#define INCLUDED_MULTIPLY_CONST_CC_IMPL_H
diff --git a/gr-blocks/lib/multiply_const_vcc_impl.cc b/gr-blocks/lib/multiply_const_vcc_impl.cc
new file mode 100644
index 0000000000..637f79eb12
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vcc_impl.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_const_vcc_impl.h>
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_const_vcc::sptr
+ multiply_const_vcc::make(std::vector<gr_complex> k)
+ {
+ return gnuradio::get_initial_sptr
+ (new multiply_const_vcc_impl(k));
+ }
+
+ multiply_const_vcc_impl::multiply_const_vcc_impl(std::vector<gr_complex> k)
+ : sync_block("multiply_const_vcc",
+ io_signature::make(1, 1, sizeof(gr_complex)*k.size()),
+ io_signature::make(1, 1, sizeof(gr_complex)*k.size())),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(gr_complex);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ multiply_const_vcc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ gr_complex *iptr = (gr_complex*)input_items[0];
+ gr_complex *optr = (gr_complex*)output_items[0];
+
+ int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(gr_complex);
+
+ for(int i = 0; i < noutput_items; i++) {
+ for(int j = 0; j < nitems_per_block; j++) {
+ *optr++ = *iptr++ * d_k[j];
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vcc_impl.h b/gr-blocks/lib/multiply_const_vcc_impl.h
new file mode 100644
index 0000000000..18886ed00e
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vcc_impl.h
@@ -0,0 +1,50 @@
+/* -*- 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_MULTIPLY_CONST_VCC_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_CONST_VCC_IMPL_H
+
+#include <gnuradio/blocks/multiply_const_vcc.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_const_vcc_impl : public multiply_const_vcc
+ {
+ private:
+ std::vector<gr_complex> d_k;
+
+ public:
+ multiply_const_vcc_impl(std::vector<gr_complex> k);
+
+ std::vector<gr_complex> k() const { return d_k; }
+ void set_k(std::vector<gr_complex> k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CONST_VCC_IMPL_H */
diff --git a/gr-blocks/lib/multiply_const_vff_impl.cc b/gr-blocks/lib/multiply_const_vff_impl.cc
new file mode 100644
index 0000000000..ab53ce3ce3
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vff_impl.cc
@@ -0,0 +1,72 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <multiply_const_vff_impl.h>
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ multiply_const_vff::sptr
+ multiply_const_vff::make(std::vector<float> k)
+ {
+ return gnuradio::get_initial_sptr
+ (new multiply_const_vff_impl(k));
+ }
+
+ multiply_const_vff_impl::multiply_const_vff_impl(std::vector<float> k)
+ : sync_block("multiply_const_vff",
+ io_signature::make(1, 1, sizeof(float)*k.size()),
+ io_signature::make(1, 1, sizeof(float)*k.size())),
+ d_k(k)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1,alignment_multiple));
+ }
+
+ int
+ multiply_const_vff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *iptr = (float*)input_items[0];
+ float *optr = (float*)output_items[0];
+
+ int nitems_per_block = output_signature()->sizeof_stream_item(0)/sizeof(float);
+
+ for(int i = 0; i < noutput_items; i++) {
+ for(int j = 0; j < nitems_per_block; j++) {
+ *optr++ = *iptr++ * d_k[j];
+ }
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/multiply_const_vff_impl.h b/gr-blocks/lib/multiply_const_vff_impl.h
new file mode 100644
index 0000000000..4fda2a831e
--- /dev/null
+++ b/gr-blocks/lib/multiply_const_vff_impl.h
@@ -0,0 +1,50 @@
+/* -*- 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_MULTIPLY_CONST_VFF_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_CONST_VFF_IMPL_H
+
+#include <gnuradio/blocks/multiply_const_vff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API multiply_const_vff_impl : public multiply_const_vff
+ {
+ private:
+ std::vector<float> d_k;
+
+ public:
+ multiply_const_vff_impl(std::vector<float> k);
+
+ std::vector<float> k() const { return d_k; }
+ void set_k(std::vector<float> k) { d_k = k; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_CONST_VFF_IMPL_H */
diff --git a/gr-blocks/lib/sub_ff_impl.cc b/gr-blocks/lib/sub_ff_impl.cc
new file mode 100644
index 0000000000..d3a0815ca7
--- /dev/null
+++ b/gr-blocks/lib/sub_ff_impl.cc
@@ -0,0 +1,82 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sub_ff_impl.h>
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+
+namespace gr {
+ namespace blocks {
+
+ sub_ff::sptr
+ sub_ff::make(size_t vlen)
+ {
+ return gnuradio::get_initial_sptr
+ (new sub_ff_impl(vlen));
+ }
+
+ sub_ff_impl::sub_ff_impl(size_t vlen)
+ : sync_block("@sub_ff",
+ io_signature::make(1, -1, sizeof(float)*vlen),
+ io_signature::make(1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen)
+ {
+ const int alignment_multiple =
+ volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+ }
+
+ int
+ sub_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ float *out = (float*)output_items[0];
+
+ int ninputs = input_items.size();
+ int noi = noutput_items*d_vlen;
+
+ //for(size_t i = 0; i < noutput_items*d_vlen; i++){
+ // @I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
+ // for (int j = 1; j < ninputs; j++)
+ // acc -= ((@I_TYPE@ *) input_items[j])[i];
+ //
+ // *optr++ = (@O_TYPE@) acc;
+ //}
+
+ const float *in = (const float*)input_items[0];
+ for(int i = 0; i < noi; i++)
+ out[i] = -in[i];
+ for(int i = 1; i < ninputs; i++) {
+ in = (const float*)input_items[i];
+ volk_32f_x2_subtract_32f(out, out, in, noi);
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
diff --git a/gr-blocks/lib/sub_ff_impl.h b/gr-blocks/lib/sub_ff_impl.h
new file mode 100644
index 0000000000..b4eff66ae6
--- /dev/null
+++ b/gr-blocks/lib/sub_ff_impl.h
@@ -0,0 +1,47 @@
+/* -*- 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_IMPL_H
+#define INCLUDED_BLOCKS_SUB_FF_IMPL_H
+
+#include <gnuradio/blocks/sub_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class BLOCKS_API sub_ff_impl : public sub_ff
+ {
+ private:
+ size_t d_vlen;
+
+ public:
+ sub_ff_impl(size_t vlen);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace blocks */
+} /* namespace gr */
+
+#endif /* INCLUDED_BLOCKS_SUB_FF_IMPL_H */