summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/general/CMakeLists.txt1
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.cc100
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.h85
-rw-r--r--gnuradio-core/src/lib/general/gr_tag_debug.i35
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t7
-rw-r--r--gnuradio-core/src/lib/io/gri_wavfile.cc136
-rw-r--r--gnuradio-core/src/lib/io/gri_wavfile.h27
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py43
-rw-r--r--gr-audio/lib/osx/audio_osx.h3
-rw-r--r--gr-filter/include/filter/adaptive_fir_ccc.h2
-rw-r--r--gr-filter/include/filter/adaptive_fir_ccf.h2
-rw-r--r--gr-filter/include/filter/channel_model.h2
-rw-r--r--gr-filter/include/filter/dc_blocker_cc.h2
-rw-r--r--gr-filter/include/filter/dc_blocker_ff.h2
-rw-r--r--gr-filter/include/filter/fft_filter_ccc.h2
-rw-r--r--gr-filter/include/filter/fft_filter_fff.h2
-rw-r--r--gr-filter/include/filter/filter_delay_fc.h2
-rw-r--r--gr-filter/include/filter/fir_filter_XXX.h.t2
-rw-r--r--gr-filter/include/filter/fir_filter_with_buffer.h3
-rw-r--r--gr-filter/include/filter/fractional_interpolator_cc.h2
-rw-r--r--gr-filter/include/filter/fractional_interpolator_ff.h2
-rw-r--r--gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t2
-rw-r--r--gr-filter/include/filter/hilbert_fc.h2
-rw-r--r--gr-filter/include/filter/iir_filter_ffd.h2
-rw-r--r--gr-filter/include/filter/interp_fir_filter_XXX.h.t2
-rw-r--r--gr-filter/include/filter/pfb_arb_resampler_ccf.h15
-rw-r--r--gr-filter/include/filter/pfb_arb_resampler_fff.h15
-rw-r--r--gr-filter/include/filter/pfb_channelizer_ccf.h2
-rw-r--r--gr-filter/include/filter/pfb_decimator_ccf.h2
-rw-r--r--gr-filter/include/filter/pfb_interpolator_ccf.h2
-rw-r--r--gr-filter/include/filter/pfb_synthesizer_ccf.h2
-rw-r--r--gr-filter/include/filter/rational_resampler_base_XXX.h.t2
-rw-r--r--gr-filter/include/filter/single_pole_iir_filter_cc.h2
-rw-r--r--gr-filter/include/filter/single_pole_iir_filter_ff.h2
-rw-r--r--gr-filter/lib/CMakeLists.txt3
-rw-r--r--gr-filter/lib/fir_filter_with_buffer.cc75
-rw-r--r--gr-filter/lib/pfb_arb_resampler_ccf_impl.cc41
-rw-r--r--gr-filter/lib/pfb_arb_resampler_ccf_impl.h3
-rw-r--r--gr-filter/lib/pfb_arb_resampler_fff_impl.cc21
-rw-r--r--gr-filter/lib/pfb_arb_resampler_fff_impl.h3
-rw-r--r--gr-filter/lib/qa_fir_filter_with_buffer.cc10
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_cc.cc9
-rw-r--r--gr-filter/lib/qa_mmse_fir_interpolator_ff.cc10
-rwxr-xr-xgr-filter/python/qa_fft_filter.py6
-rwxr-xr-xgr-filter/python/qa_pfb_channelizer.py18
-rw-r--r--grc/blocks/block_tree.xml1
-rw-r--r--grc/blocks/gr_tag_debug.xml82
-rw-r--r--gruel/src/include/gruel/CMakeLists.txt20
-rw-r--r--gruel/src/include/gruel/inet.h.in100
-rw-r--r--gruel/src/swig/CMakeLists.txt4
-rw-r--r--volk/include/volk/volk_32f_x2_dot_prod_32f_a.h2
-rw-r--r--volk/include/volk/volk_32f_x2_dot_prod_32f_u.h2
-rw-r--r--volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h4
-rw-r--r--volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h35
-rw-r--r--volk/lib/testqa.cc4
56 files changed, 605 insertions, 364 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt
index 399e07599..b671c963b 100644
--- a/gnuradio-core/src/lib/general/CMakeLists.txt
+++ b/gnuradio-core/src/lib/general/CMakeLists.txt
@@ -292,6 +292,7 @@ set(gr_core_general_triple_threats
gr_annotator_raw
gr_burst_tagger
gr_correlate_access_code_tag_bb
+ gr_tag_debug
)
foreach(file_tt ${gr_core_general_triple_threats})
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index fe2cbdb82..c0ce65527 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -141,6 +141,7 @@
#include <gr_correlate_access_code_tag_bb.h>
#include <gr_add_ff.h>
#include <gr_vector_map.h>
+#include <gr_tag_debug.h>
%}
%include "gri_control_loop.i"
@@ -262,3 +263,4 @@
%include "gr_correlate_access_code_tag_bb.i"
%include "gr_add_ff.i"
%include "gr_vector_map.i"
+%include "gr_tag_debug.i"
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.cc b/gnuradio-core/src/lib/general/gr_tag_debug.cc
new file mode 100644
index 000000000..c4031f438
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.cc
@@ -0,0 +1,100 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_tag_debug.h>
+#include <gr_io_signature.h>
+#include <iostream>
+#include <iomanip>
+
+gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name)
+{
+ return gnuradio::get_initial_sptr
+ (new gr_tag_debug(sizeof_stream_item, name));
+}
+
+gr_tag_debug::gr_tag_debug(size_t sizeof_stream_item, const std::string &name)
+ : gr_sync_block("tag_debug",
+ gr_make_io_signature(1, -1, sizeof_stream_item),
+ gr_make_io_signature(0, 0, 0)),
+ d_name(name), d_display(true)
+{
+}
+
+std::vector<gr_tag_t>
+gr_tag_debug::current_tags()
+{
+ gruel::scoped_lock l(d_mutex);
+ return d_tags;
+}
+
+void
+gr_tag_debug::set_display(bool d)
+{
+ gruel::scoped_lock l(d_mutex);
+ d_display = d;
+}
+
+int
+gr_tag_debug::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gruel::scoped_lock l(d_mutex);
+
+ if(d_display) {
+ std::cout << std::endl
+ << "----------------------------------------------------------------------";
+ std::cout << std::endl << "Tag Debug: " << d_name << std::endl;
+ }
+
+ uint64_t abs_N, end_N;
+ for(size_t i = 0; i < input_items.size(); i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ d_tags.clear();
+ get_tags_in_range(d_tags, i, abs_N, end_N);
+
+ if(d_display) {
+ std::cout << "Input Stream: " << i << std::endl;
+ for(d_tags_itr = d_tags.begin(); d_tags_itr != d_tags.end(); d_tags_itr++) {
+ std::cout << std::setw(10) << "Offset: " << d_tags_itr->offset
+ << std::setw(10) << "Source: " << pmt::pmt_symbol_to_string(d_tags_itr->srcid)
+ << std::setw(10) << "Key: " << pmt::pmt_symbol_to_string(d_tags_itr->key)
+ << std::setw(10) << "Value: ";
+ pmt::pmt_print(d_tags_itr->value);
+ }
+ }
+ }
+
+ if(d_display) {
+ std::cout << "----------------------------------------------------------------------";
+ std::cout << std::endl;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.h b/gnuradio-core/src/lib/general/gr_tag_debug.h
new file mode 100644
index 000000000..57578884a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.h
@@ -0,0 +1,85 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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_TAG_DEBUG_H
+#define INCLUDED_GR_TAG_DEBUG_H
+
+#include <gr_core_api.h>
+#include <gr_sync_block.h>
+#include <gruel/thread.h>
+#include <stddef.h>
+
+class gr_tag_debug;
+typedef boost::shared_ptr<gr_tag_debug> gr_tag_debug_sptr;
+
+GR_CORE_API gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+/*!
+ * \brief Bit bucket that prints out any tag received.
+ * \ingroup sink_blk
+ *
+ * This block collects all tags sent to it on all input ports and
+ * displays them to stdout in a formatted way. The \p name parameter
+ * is used to identify which debug sink generated the tag, so when
+ * connecting a block to this debug sink, an appropriate name is
+ * something that identifies the input block.
+ *
+ * This block otherwise acts as a NULL sink in that items from the
+ * input stream are ignored. It is designed to be able to attach to
+ * any block and watch all tags streaming out of that block for
+ * debugging purposes.
+ *
+ * The tags from the last call to this work function are stored and
+ * can be retrieved using the function 'current_tags'.
+ */
+class GR_CORE_API gr_tag_debug : public gr_sync_block
+{
+ private:
+ friend GR_CORE_API gr_tag_debug_sptr
+ gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+ gr_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+ std::string d_name;
+ std::vector<gr_tag_t> d_tags;
+ std::vector<gr_tag_t>::iterator d_tags_itr;
+ bool d_display;
+ gruel::mutex d_mutex;
+
+ public:
+ /*!
+ * \brief Returns a vector of gr_tag_t items as of the last call to
+ * work.
+ */
+ std::vector<gr_tag_t> current_tags();
+
+ /*!
+ * \brief Set the display of tags to stdout on/off.
+ */
+ void set_display(bool d);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_TAG_DEBUG_H */
diff --git a/gnuradio-core/src/lib/general/gr_tag_debug.i b/gnuradio-core/src/lib/general/gr_tag_debug.i
new file mode 100644
index 000000000..3af1bdcfe
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_tag_debug.i
@@ -0,0 +1,35 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2012 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,tag_debug)
+
+%include <gr_tags.i>
+
+gr_tag_debug_sptr
+gr_make_tag_debug(size_t sizeof_stream_item, const std::string &name);
+
+class gr_tag_debug : public gr_sync_block
+{
+public:
+ std::vector<gr_tag_t> current_tags();
+ void set_display(bool d);
+};
diff --git a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
index bdd0e810a..6959eac82 100644
--- a/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
@@ -29,6 +29,7 @@
#include <algorithm>
#include <gr_io_signature.h>
#include <stdexcept>
+#include <algorithm>
#include <gr_complex.h>
@@ -64,8 +65,7 @@ int
case GR_CONST_WAVE:
t = (gr_complex) d_ampl + d_offset;
- for (int i = 0; i < noutput_items; i++) // FIXME unroll
- optr[i] = t;
+ std::fill_n(optr, noutput_items, t);
break;
case GR_SIN_WAVE:
@@ -142,8 +142,7 @@ int
case GR_CONST_WAVE:
t = (@TYPE@) d_ampl + d_offset;
- for (int i = 0; i < noutput_items; i++) // FIXME unroll
- optr[i] = t;
+ std::fill_n(optr, noutput_items, t);
break;
case GR_SIN_WAVE:
diff --git a/gnuradio-core/src/lib/io/gri_wavfile.cc b/gnuradio-core/src/lib/io/gri_wavfile.cc
index e316a0825..277e6b7b0 100644
--- a/gnuradio-core/src/lib/io/gri_wavfile.cc
+++ b/gnuradio-core/src/lib/io/gri_wavfile.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,110 +27,45 @@
#include <gri_wavfile.h>
#include <cstring>
#include <stdint.h>
+#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN
# define VALID_COMPRESSION_TYPE 0x0001
-// WAV files are always little-endian, so we need some byte switching macros
-
-// FIXME: Use libgruel versions
-
-#ifdef WORDS_BIGENDIAN
-
-#ifdef HAVE_BYTESWAP_H
-#include <byteswap.h>
-#else
-#warning Using non-portable code (likely wrong other than ILP32).
-
-static inline short int
-bswap_16 (unsigned short int x)
-{
- return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
-}
-
-static inline unsigned int
-bswap_32 (unsigned int x)
-{
- return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
- | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
-}
-#endif // HAVE_BYTESWAP_H
-
-static inline uint32_t
-host_to_wav(uint32_t x)
-{
- return bswap_32(x);
-}
-
-static inline uint16_t
-host_to_wav(uint16_t x)
-{
- return bswap_16(x);
-}
-
-static inline int16_t
-host_to_wav(int16_t x)
-{
- return bswap_16(x);
-}
+// Basically, this is the opposite of htonx() and ntohx()
+// Define host to/from worknet (little endian) short and long
+#ifdef BOOST_BIG_ENDIAN
-static inline uint32_t
-wav_to_host(uint32_t x)
-{
- return bswap_32(x);
-}
+ static inline uint16_t __gri_wav_bs16(uint16_t x)
+ {
+ return (x>>8) | (x<<8);
+ }
-static inline uint16_t
-wav_to_host(uint16_t x)
-{
- return bswap_16(x);
-}
+ static inline uint32_t __gri_wav_bs32(uint32_t x)
+ {
+ return (uint32_t(__gri_wav_bs16(uint16_t(x&0xfffful)))<<16) | (__gri_wav_bs16(uint16_t(x>>16)));
+ }
-static inline int16_t
-wav_to_host(int16_t x)
-{
- return bswap_16(x);
-}
+ #define htowl(x) __gri_wav_bs32(x)
+ #define wtohl(x) __gri_wav_bs32(x)
+ #define htows(x) __gri_wav_bs16(x)
+ #define wtohs(x) __gri_wav_bs16(x)
#else
-static inline uint32_t
-host_to_wav(uint32_t x)
-{
- return x;
-}
-
-static inline uint16_t
-host_to_wav(uint16_t x)
-{
- return x;
-}
-
-static inline int16_t
-host_to_wav(int16_t x)
-{
- return x;
-}
-
-static inline uint32_t
-wav_to_host(uint32_t x)
-{
- return x;
-}
-
-static inline uint16_t
-wav_to_host(uint16_t x)
-{
- return x;
-}
-
-static inline int16_t
-wav_to_host(int16_t x)
-{
- return x;
-}
+ #define htowl(x) uint32_t(x)
+ #define wtohl(x) uint32_t(x)
+ #define htows(x) uint16_t(x)
+ #define wtohs(x) uint16_t(x)
-#endif // WORDS_BIGENDIAN
+#endif // BOOST_BIG_ENDIAN
+// WAV files are always little-endian, so we need some byte switching macros
+static inline uint32_t host_to_wav(uint32_t x) { return htowl(x); }
+static inline uint16_t host_to_wav(uint16_t x) { return htows(x); }
+static inline int16_t host_to_wav(int16_t x) { return htows(x); }
+static inline uint32_t wav_to_host(uint32_t x) { return wtohl(x); }
+static inline uint16_t wav_to_host(uint16_t x) { return wtohs(x); }
+static inline int16_t wav_to_host(int16_t x) { return wtohs(x); }
bool
gri_wavheader_parse(FILE *fp,
@@ -225,12 +160,15 @@ gri_wavheader_parse(FILE *fp,
short int
gri_wav_read_sample(FILE *fp, int bytes_per_sample)
{
- int16_t buf = 0;
- size_t fresult;
+ int16_t buf_16bit;
- fresult = fread(&buf, bytes_per_sample, 1, fp);
-
- return (short) wav_to_host(buf);
+ if(!fread(&buf_16bit, bytes_per_sample, 1, fp)) {
+ return 0;
+ }
+ if(bytes_per_sample == 1) {
+ return (short) buf_16bit;
+ }
+ return (short)wav_to_host(buf_16bit);
}
diff --git a/gnuradio-core/src/lib/io/gri_wavfile.h b/gnuradio-core/src/lib/io/gri_wavfile.h
index c757be26b..16280e34a 100644
--- a/gnuradio-core/src/lib/io/gri_wavfile.h
+++ b/gnuradio-core/src/lib/io/gri_wavfile.h
@@ -29,20 +29,15 @@
/*!
* \brief Read signal information from a given WAV file.
*
- * \p fp File pointer to an opened, empty file.
- * \p sample_rate Stores the sample rate [S/s]
- * \p nchans Number of channels
- * \p bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding to
- * 8 or 16 bit samples, respectively)
- * \p first_sample_pos Number of the first byte containing a sample. Use this
- * with fseek() to jump from the end of the file to the first sample
- * when in repeat mode.
- * \p samples_per_chan Number of samples per channel
- * \p normalize_fac The normalization factor with which you need to divide the
- * integer values of the samples to get them within [-1;1]
- * \p normalize_shift The value by which the sample values need to be shifted
- * after normalization (reason being, 8-bit WAV files store samples as
- * unsigned char and 16-bit as signed short int)
+ * \param[in] fp File pointer to an opened, empty file.
+ * \param[out] sample_rate Stores the sample rate [S/s]
+ * \param[out] nchans Number of channels
+ * \param[out] bytes_per_sample Bytes per sample, can either be 1 or 2 (corresponding o
+ * 8 or 16 bit samples, respectively)
+ * \param[out] first_sample_pos Number of the first byte containing a sample. Use this
+ * with fseek() to jump from the end of the file to the
+ * first sample when in repeat mode.
+ * \param[out] samples_per_chan Number of samples per channel
* \return True on a successful read, false if the file could not be read or is
* not a valid WAV file.
*/
@@ -94,8 +89,8 @@ gri_wav_write_sample(FILE *fp, short int sample, int bytes_per_sample);
* shouldn't happen), you need to fseek() to the end of the file (or
* whereever).
*
- * \p fp File pointer to an open WAV file with a blank header
- * \p byte_count Length of all samples written to the file in bytes.
+ * \param[in] fp File pointer to an open WAV file with a blank header
+ * \param[in] byte_count Length of all samples written to the file in bytes.
*/
bool
gri_wavheader_complete(FILE *fp, unsigned int byte_count);
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py b/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py
new file mode 100755
index 000000000..81babca04
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_tag_debug.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 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 gnuradio import gr, gr_unittest
+
+class test_tag_debug(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001(self):
+ # Just run some data through and make sure it doesn't puke.
+ src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+ src = gr.vector_source_i(src_data)
+ op = gr.tag_debug(gr.sizeof_int, "tag QA")
+ self.tb.connect(src, op)
+ self.tb.run()
+ x = op.current_tags()
+
+if __name__ == '__main__':
+ gr_unittest.run(test_tag_debug, "test_tag_debug.xml")
diff --git a/gr-audio/lib/osx/audio_osx.h b/gr-audio/lib/osx/audio_osx.h
index 0a98b71ef..8c9543d0d 100644
--- a/gr-audio/lib/osx/audio_osx.h
+++ b/gr-audio/lib/osx/audio_osx.h
@@ -51,7 +51,8 @@
fflush (stderr); \
}
-#ifdef WORDS_BIGENDIAN
+#include <boost/detail/endian.hpp> //BOOST_BIG_ENDIAN
+#ifdef BOOST_BIG_ENDIAN
#define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian
#else
#define GR_PCM_ENDIANNESS 0
diff --git a/gr-filter/include/filter/adaptive_fir_ccc.h b/gr-filter/include/filter/adaptive_fir_ccc.h
index 616a52f73..261259957 100644
--- a/gr-filter/include/filter/adaptive_fir_ccc.h
+++ b/gr-filter/include/filter/adaptive_fir_ccc.h
@@ -72,7 +72,7 @@ namespace gr {
* \param decimation (interger) decimation rate of the filter
* \param taps (complex) filter taps
*/
- static FILTER_API sptr make(const char *name, int decimation,
+ static sptr make(const char *name, int decimation,
const std::vector<gr_complex> &taps);
virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
diff --git a/gr-filter/include/filter/adaptive_fir_ccf.h b/gr-filter/include/filter/adaptive_fir_ccf.h
index 0c19611d5..0fd8d5746 100644
--- a/gr-filter/include/filter/adaptive_fir_ccf.h
+++ b/gr-filter/include/filter/adaptive_fir_ccf.h
@@ -68,7 +68,7 @@ namespace gr {
* \param decimation (interger) decimation rate of the filter
* \param taps (real) filter taps
*/
- static FILTER_API sptr make(const char *name, int decimation,
+ static sptr make(const char *name, int decimation,
const std::vector<float> &taps);
virtual void set_taps(const std::vector<float> &taps) = 0;
diff --git a/gr-filter/include/filter/channel_model.h b/gr-filter/include/filter/channel_model.h
index 44d7f1a64..2e808de8e 100644
--- a/gr-filter/include/filter/channel_model.h
+++ b/gr-filter/include/filter/channel_model.h
@@ -64,7 +64,7 @@ namespace gr {
* \param taps Taps of a FIR filter to emulate a multipath delay profile.
* \param noise_seed A random number generator seed for the noise source.
*/
- static FILTER_API sptr make(double noise_voltage=0.0,
+ static sptr make(double noise_voltage=0.0,
double frequency_offset=0.0,
double epsilon=1.0,
const std::vector<gr_complex> &taps=std::vector<gr_complex>(1,1),
diff --git a/gr-filter/include/filter/dc_blocker_cc.h b/gr-filter/include/filter/dc_blocker_cc.h
index b0a38ffcb..df4c815d6 100644
--- a/gr-filter/include/filter/dc_blocker_cc.h
+++ b/gr-filter/include/filter/dc_blocker_cc.h
@@ -65,7 +65,7 @@ namespace gr {
* \param D (int) the length of the delay line
* \param long_form (bool) whether to use long (true, default) or short form
*/
- static FILTER_API sptr make(int D, bool long_form);
+ static sptr make(int D, bool long_form);
virtual int group_delay() = 0;
};
diff --git a/gr-filter/include/filter/dc_blocker_ff.h b/gr-filter/include/filter/dc_blocker_ff.h
index 18c729768..6ab4d5a3d 100644
--- a/gr-filter/include/filter/dc_blocker_ff.h
+++ b/gr-filter/include/filter/dc_blocker_ff.h
@@ -65,7 +65,7 @@ namespace gr {
* \param D (int) the length of the delay line
* \param long_form (bool) whether to use long (true, default) or short form
*/
- static FILTER_API sptr make(int D, bool long_form=true);
+ static sptr make(int D, bool long_form=true);
virtual int group_delay() = 0;
};
diff --git a/gr-filter/include/filter/fft_filter_ccc.h b/gr-filter/include/filter/fft_filter_ccc.h
index c018629a9..acec93277 100644
--- a/gr-filter/include/filter/fft_filter_ccc.h
+++ b/gr-filter/include/filter/fft_filter_ccc.h
@@ -62,7 +62,7 @@ namespace gr {
* \param taps complex filter taps
* \param nthreads number of threads for the FFT to use
*/
- static FILTER_API sptr make(int decimation,
+ static sptr make(int decimation,
const std::vector<gr_complex> &taps,
int nthreads=1);
diff --git a/gr-filter/include/filter/fft_filter_fff.h b/gr-filter/include/filter/fft_filter_fff.h
index 78540666c..d8140325f 100644
--- a/gr-filter/include/filter/fft_filter_fff.h
+++ b/gr-filter/include/filter/fft_filter_fff.h
@@ -62,7 +62,7 @@ namespace gr {
* \param taps float filter taps
* \param nthreads number of threads for the FFT to use
*/
- static FILTER_API sptr make(int decimation,
+ static sptr make(int decimation,
const std::vector<float> &taps,
int nthreads=1);
diff --git a/gr-filter/include/filter/filter_delay_fc.h b/gr-filter/include/filter/filter_delay_fc.h
index 299a65519..8a84a6a0e 100644
--- a/gr-filter/include/filter/filter_delay_fc.h
+++ b/gr-filter/include/filter/filter_delay_fc.h
@@ -56,7 +56,7 @@ namespace gr {
* taps needs to be calculated before initializing this block.
*
*/
- static FILTER_API sptr make(const std::vector<float> &taps);
+ static sptr make(const std::vector<float> &taps);
};
} /* namespace filter */
diff --git a/gr-filter/include/filter/fir_filter_XXX.h.t b/gr-filter/include/filter/fir_filter_XXX.h.t
index fc768bcad..98e82f510 100644
--- a/gr-filter/include/filter/fir_filter_XXX.h.t
+++ b/gr-filter/include/filter/fir_filter_XXX.h.t
@@ -69,7 +69,7 @@ namespace gr {
* \param decimation set the integer decimation rate
* \param taps a vector/list of taps of type @TAP_TYPE@
*/
- static FILTER_API sptr make(int decimation,
+ static sptr make(int decimation,
const std::vector<@TAP_TYPE@> &taps);
virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
diff --git a/gr-filter/include/filter/fir_filter_with_buffer.h b/gr-filter/include/filter/fir_filter_with_buffer.h
index 8b5d9e064..007eae3fa 100644
--- a/gr-filter/include/filter/fir_filter_with_buffer.h
+++ b/gr-filter/include/filter/fir_filter_with_buffer.h
@@ -40,6 +40,7 @@ namespace gr {
private:
std::vector<float> d_taps;
unsigned int d_ntaps;
+ float *d_buffer_ptr;
float *d_buffer;
unsigned int d_idx;
float **d_aligned_taps;
@@ -136,6 +137,7 @@ namespace gr {
private:
std::vector<gr_complex> d_taps;
unsigned int d_ntaps;
+ gr_complex *d_buffer_ptr;
gr_complex *d_buffer;
unsigned int d_idx;
gr_complex **d_aligned_taps;
@@ -232,6 +234,7 @@ namespace gr {
private:
std::vector<float> d_taps;
unsigned int d_ntaps;
+ gr_complex *d_buffer_ptr;
gr_complex *d_buffer;
unsigned int d_idx;
float **d_aligned_taps;
diff --git a/gr-filter/include/filter/fractional_interpolator_cc.h b/gr-filter/include/filter/fractional_interpolator_cc.h
index 3f196c80f..bb0e18932 100644
--- a/gr-filter/include/filter/fractional_interpolator_cc.h
+++ b/gr-filter/include/filter/fractional_interpolator_cc.h
@@ -45,7 +45,7 @@ namespace gr {
* \param phase_shift The phase shift of the output signal to the input
* \param interp_ratio The interpolation ratio = input_rate / output_rate.
*/
- static FILTER_API sptr make(float phase_shift,
+ static sptr make(float phase_shift,
float interp_ratio);
virtual float mu() const = 0;
diff --git a/gr-filter/include/filter/fractional_interpolator_ff.h b/gr-filter/include/filter/fractional_interpolator_ff.h
index e05da847d..fc43c3457 100644
--- a/gr-filter/include/filter/fractional_interpolator_ff.h
+++ b/gr-filter/include/filter/fractional_interpolator_ff.h
@@ -45,7 +45,7 @@ namespace gr {
* \param phase_shift The phase shift of the output signal to the input
* \param interp_ratio The interpolation ratio = input_rate / output_rate.
*/
- static FILTER_API sptr make(float phase_shift,
+ static sptr make(float phase_shift,
float interp_ratio);
virtual float mu() const = 0;
diff --git a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t
index 8764c4f0d..88e15f823 100644
--- a/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t
+++ b/gr-filter/include/filter/freq_xlating_fir_filter_XXX.h.t
@@ -72,7 +72,7 @@ namespace gr {
* \param center_freq Center frequency of signal to down convert from (Hz)
* \param sampling_freq Sampling rate of signal (in Hz)
*/
- static FILTER_API sptr make(int decimation,
+ static sptr make(int decimation,
const std::vector<@TAP_TYPE@> &taps,
double center_freq,
double sampling_freq);
diff --git a/gr-filter/include/filter/hilbert_fc.h b/gr-filter/include/filter/hilbert_fc.h
index d29f8a726..de7cd82b6 100644
--- a/gr-filter/include/filter/hilbert_fc.h
+++ b/gr-filter/include/filter/hilbert_fc.h
@@ -44,7 +44,7 @@ namespace gr {
* imaginary output is hilbert filtered (90 degree phase shift)
* version of input.
*/
- static FILTER_API sptr make(unsigned int ntaps);
+ static sptr make(unsigned int ntaps);
};
} /* namespace filter */
diff --git a/gr-filter/include/filter/iir_filter_ffd.h b/gr-filter/include/filter/iir_filter_ffd.h
index c23286ddc..04dd1e776 100644
--- a/gr-filter/include/filter/iir_filter_ffd.h
+++ b/gr-filter/include/filter/iir_filter_ffd.h
@@ -69,7 +69,7 @@ namespace gr {
// gr::filter::iir_filter_ffd::sptr
typedef boost::shared_ptr<iir_filter_ffd> sptr;
- static FILTER_API sptr make(const std::vector<double> &fftaps,
+ static sptr make(const std::vector<double> &fftaps,
const std::vector<double> &fbtaps);
virtual void set_taps(const std::vector<double> &fftaps,
diff --git a/gr-filter/include/filter/interp_fir_filter_XXX.h.t b/gr-filter/include/filter/interp_fir_filter_XXX.h.t
index eaf215200..b66c9f643 100644
--- a/gr-filter/include/filter/interp_fir_filter_XXX.h.t
+++ b/gr-filter/include/filter/interp_fir_filter_XXX.h.t
@@ -68,7 +68,7 @@ namespace gr {
* \param interpolation set the integer interpolation rate
* \param taps a vector/list of taps of type @TAP_TYPE@
*/
- static FILTER_API sptr make(unsigned interpolation,
+ static sptr make(unsigned interpolation,
const std::vector<@TAP_TYPE@> &taps);
virtual void set_taps(const std::vector<@TAP_TYPE@> &taps) = 0;
diff --git a/gr-filter/include/filter/pfb_arb_resampler_ccf.h b/gr-filter/include/filter/pfb_arb_resampler_ccf.h
index cf5fa4a3b..a154e055a 100644
--- a/gr-filter/include/filter/pfb_arb_resampler_ccf.h
+++ b/gr-filter/include/filter/pfb_arb_resampler_ccf.h
@@ -110,7 +110,7 @@ namespace gr {
* related to quantization noise introduced during the resampling.
* Defaults to 32 filters.
*/
- static FILTER_API sptr make(float rate,
+ static sptr make(float rate,
const std::vector<float> &taps,
unsigned int filter_size=32);
/*!
@@ -129,7 +129,20 @@ namespace gr {
*/
virtual void print_taps() = 0;
+ /*!
+ * Sets the resampling rate of the block.
+ */
virtual void set_rate (float rate) = 0;
+
+ /*!
+ * Sets the current phase offset in radians (0 to 2pi).
+ */
+ virtual void set_phase(float ph) = 0;
+
+ /*!
+ * Gets the current phase of the resampler in radians (2 to 2pi).
+ */
+ virtual float phase() const = 0;
};
} /* namespace filter */
diff --git a/gr-filter/include/filter/pfb_arb_resampler_fff.h b/gr-filter/include/filter/pfb_arb_resampler_fff.h
index 2504c92ec..38dcc7132 100644
--- a/gr-filter/include/filter/pfb_arb_resampler_fff.h
+++ b/gr-filter/include/filter/pfb_arb_resampler_fff.h
@@ -110,7 +110,7 @@ namespace gr {
* related to quantization noise introduced during the resampling.
* Defaults to 32 filters.
*/
- static FILTER_API sptr make(float rate,
+ static sptr make(float rate,
const std::vector<float> &taps,
unsigned int filter_size=32);
@@ -130,7 +130,20 @@ namespace gr {
*/
virtual void print_taps() = 0;
+ /*!
+ * Sets the resampling rate of the block.
+ */
virtual void set_rate (float rate) = 0;
+
+ /*!
+ * Sets the current phase offset in radians (0 to 2pi).
+ */
+ virtual void set_phase(float ph) = 0;
+
+ /*!
+ * Gets the current phase of the resampler in radians (2 to 2pi).
+ */
+ virtual float phase() const = 0;
};
} /* namespace filter */
diff --git a/gr-filter/include/filter/pfb_channelizer_ccf.h b/gr-filter/include/filter/pfb_channelizer_ccf.h
index 7726809f2..2ff83b5e7 100644
--- a/gr-filter/include/filter/pfb_channelizer_ccf.h
+++ b/gr-filter/include/filter/pfb_channelizer_ccf.h
@@ -139,7 +139,7 @@ namespace gr {
* oversample ratio is 6000 Hz,
* or 6 times the normal 1000 Hz.
*/
- static FILTER_API sptr make(unsigned int numchans,
+ static sptr make(unsigned int numchans,
const std::vector<float> &taps,
float oversample_rate);
diff --git a/gr-filter/include/filter/pfb_decimator_ccf.h b/gr-filter/include/filter/pfb_decimator_ccf.h
index 9db11b88d..bf9d0d950 100644
--- a/gr-filter/include/filter/pfb_decimator_ccf.h
+++ b/gr-filter/include/filter/pfb_decimator_ccf.h
@@ -102,7 +102,7 @@ namespace gr {
* \param taps (vector/list of floats) The prototype filter to populate the filterbank.
* \param channel (unsigned integer) Selects the channel to return [default=0].
*/
- static FILTER_API sptr make(unsigned int decim,
+ static sptr make(unsigned int decim,
const std::vector<float> &taps,
unsigned int channel);
diff --git a/gr-filter/include/filter/pfb_interpolator_ccf.h b/gr-filter/include/filter/pfb_interpolator_ccf.h
index a31ca7129..df28ab64d 100644
--- a/gr-filter/include/filter/pfb_interpolator_ccf.h
+++ b/gr-filter/include/filter/pfb_interpolator_ccf.h
@@ -91,7 +91,7 @@ namespace gr {
* \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
* should be generated at the interpolated sampling rate.
*/
- static FILTER_API sptr make(unsigned int interp,
+ static sptr make(unsigned int interp,
const std::vector<float> &taps);
/*!
diff --git a/gr-filter/include/filter/pfb_synthesizer_ccf.h b/gr-filter/include/filter/pfb_synthesizer_ccf.h
index ec6fb49c2..faa16990c 100644
--- a/gr-filter/include/filter/pfb_synthesizer_ccf.h
+++ b/gr-filter/include/filter/pfb_synthesizer_ccf.h
@@ -54,7 +54,7 @@ namespace gr {
* populate the filterbank.
* \param twox (bool) use 2x oversampling or not (default is no)
*/
- static FILTER_API sptr make(unsigned int numchans,
+ static sptr make(unsigned int numchans,
const std::vector<float> &taps,
bool twox=false);
diff --git a/gr-filter/include/filter/rational_resampler_base_XXX.h.t b/gr-filter/include/filter/rational_resampler_base_XXX.h.t
index c37eb30a7..e47a16ec6 100644
--- a/gr-filter/include/filter/rational_resampler_base_XXX.h.t
+++ b/gr-filter/include/filter/rational_resampler_base_XXX.h.t
@@ -44,7 +44,7 @@ namespace gr {
// gr::filter::@BASE_NAME@::sptr
typedef boost::shared_ptr<@BASE_NAME@> sptr;
- static FILTER_API sptr make(unsigned interpolation,
+ static sptr make(unsigned interpolation,
unsigned decimation,
const std::vector<@TAP_TYPE@> &taps);
diff --git a/gr-filter/include/filter/single_pole_iir_filter_cc.h b/gr-filter/include/filter/single_pole_iir_filter_cc.h
index 37db7c65f..82febe8ec 100644
--- a/gr-filter/include/filter/single_pole_iir_filter_cc.h
+++ b/gr-filter/include/filter/single_pole_iir_filter_cc.h
@@ -67,7 +67,7 @@ namespace gr {
// gr::filter::single_pole_iir_filter_cc::sptr
typedef boost::shared_ptr<single_pole_iir_filter_cc> sptr;
- static FILTER_API sptr make(double alpha, unsigned int vlen=1);
+ static sptr make(double alpha, unsigned int vlen=1);
virtual void set_taps(double alpha) = 0;
};
diff --git a/gr-filter/include/filter/single_pole_iir_filter_ff.h b/gr-filter/include/filter/single_pole_iir_filter_ff.h
index 8abce94c9..d85688db8 100644
--- a/gr-filter/include/filter/single_pole_iir_filter_ff.h
+++ b/gr-filter/include/filter/single_pole_iir_filter_ff.h
@@ -67,7 +67,7 @@ namespace gr {
// gr::filter::single_pole_iir_filter_ff::sptr
typedef boost::shared_ptr<single_pole_iir_filter_ff> sptr;
- static FILTER_API sptr make(double alpha, unsigned int vlen=1);
+ static sptr make(double alpha, unsigned int vlen=1);
virtual void set_taps (double alpha) = 0;
};
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index a54cd7b1d..73d7d7bae 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -98,6 +98,7 @@ include_directories(
${GR_FFT_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${FFTW3F_INCLUDE_DIRS}
+ ${CPPUNIT_INCLUDE_DIRS}
)
link_directories(${FFT_LIBRARY_DIRS})
@@ -142,9 +143,9 @@ list(APPEND filter_sources
list(APPEND filter_libs
gnuradio-core
gnuradio-fft
+ volk
${Boost_LIBRARIES}
${FFTW3F_LIBRARIES}
- ${VOLK_LIBRARIES}
)
add_library(gnuradio-filter SHARED ${filter_sources})
diff --git a/gr-filter/lib/fir_filter_with_buffer.cc b/gr-filter/lib/fir_filter_with_buffer.cc
index 105214087..7a35a9225 100644
--- a/gr-filter/lib/fir_filter_with_buffer.cc
+++ b/gr-filter/lib/fir_filter_with_buffer.cc
@@ -40,7 +40,7 @@ namespace gr {
d_align = volk_get_alignment();
d_naligned = d_align / sizeof(float);
- d_buffer = NULL;
+ d_buffer_ptr = NULL;
d_aligned_taps = NULL;
set_taps(taps);
@@ -50,9 +50,9 @@ namespace gr {
fir_filter_with_buffer_fff::~fir_filter_with_buffer_fff()
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free aligned taps
@@ -71,9 +71,9 @@ namespace gr {
void
fir_filter_with_buffer_fff::set_taps(const std::vector<float> &taps)
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free the taps if already allocated
@@ -89,8 +89,15 @@ namespace gr {
d_taps = taps;
std::reverse(d_taps.begin(), d_taps.end());
- d_buffer = fft::malloc_float(2*d_ntaps);
- memset(d_buffer, 0, 2*d_ntaps*sizeof(float));
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_float(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(float));
+ d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
@@ -186,7 +193,7 @@ namespace gr {
d_align = volk_get_alignment();
d_naligned = d_align / sizeof(gr_complex);
- d_buffer = NULL;
+ d_buffer_ptr = NULL;
d_aligned_taps = NULL;
set_taps(taps);
@@ -196,9 +203,9 @@ namespace gr {
fir_filter_with_buffer_ccc::~fir_filter_with_buffer_ccc()
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free aligned taps
@@ -217,9 +224,9 @@ namespace gr {
void
fir_filter_with_buffer_ccc::set_taps(const std::vector<gr_complex> &taps)
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free the taps if already allocated
@@ -235,8 +242,15 @@ namespace gr {
d_taps = taps;
std::reverse(d_taps.begin(), d_taps.end());
- d_buffer = fft::malloc_complex(2*d_ntaps);
- memset(d_buffer, 0, 2*d_ntaps*sizeof(gr_complex));
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
+ d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
d_aligned_taps = (gr_complex**)malloc(d_naligned*sizeof(gr_complex**));
@@ -332,7 +346,7 @@ namespace gr {
d_align = volk_get_alignment();
d_naligned = d_align / sizeof(gr_complex);
- d_buffer = NULL;
+ d_buffer_ptr = NULL;
d_aligned_taps = NULL;
set_taps(taps);
@@ -342,9 +356,9 @@ namespace gr {
fir_filter_with_buffer_ccf::~fir_filter_with_buffer_ccf()
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free aligned taps
@@ -363,9 +377,9 @@ namespace gr {
void
fir_filter_with_buffer_ccf::set_taps(const std::vector<float> &taps)
{
- if(d_buffer != NULL) {
- fft::free(d_buffer);
- d_buffer = NULL;
+ if(d_buffer_ptr != NULL) {
+ fft::free(d_buffer_ptr);
+ d_buffer_ptr = NULL;
}
// Free the taps if already allocated
@@ -381,8 +395,15 @@ namespace gr {
d_taps = taps;
std::reverse(d_taps.begin(), d_taps.end());
- d_buffer = fft::malloc_complex(2*d_ntaps);
- memset(d_buffer, 0, 2*d_ntaps*sizeof(gr_complex));
+ // We allocate enough to be able to look back and forth
+ // d_naligned beyond the buffer boundaries and make sure these
+ // are zeroed out (or they may be nan, which will cause
+ // problems). We then set d_buffer to the position in the
+ // d_buffer_ptr such that we only touch the internally
+ // allocated space.
+ d_buffer_ptr = fft::malloc_complex(2*(d_ntaps + d_naligned));
+ memset(d_buffer_ptr, 0, 2*(d_ntaps + d_naligned)*sizeof(gr_complex));
+ d_buffer = d_buffer_ptr + d_naligned;
// Allocate aligned taps
d_aligned_taps = (float**)malloc(d_naligned*sizeof(float**));
diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc
index bb0906aa5..5480366de 100644
--- a/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc
+++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.cc
@@ -78,10 +78,8 @@ namespace gr {
}
// Now, actually set the filters' taps
- std::vector<float> dtaps;
- create_diff_taps(taps, dtaps);
- create_taps(taps, d_taps, d_filters);
- create_taps(dtaps, d_dtaps, d_diff_filters);
+ set_taps(taps);
+ d_updated = false;
}
pfb_arb_resampler_ccf_impl::~pfb_arb_resampler_ccf_impl()
@@ -122,11 +120,6 @@ namespace gr {
// Build a filter for each channel and add it's taps to it
ourfilter[i]->set_taps(ourtaps[d_int_rate-1-i]);
}
-
- // Set the history to ensure enough input items for each filter
- set_history (d_taps_per_filter + 1);
-
- d_updated = true;
}
void
@@ -148,6 +141,13 @@ namespace gr {
pfb_arb_resampler_ccf_impl::set_taps(const std::vector<float> &taps)
{
gruel::scoped_lock guard(d_mutex);
+
+ std::vector<float> dtaps;
+ create_diff_taps(taps, dtaps);
+ create_taps(taps, d_taps, d_filters);
+ create_taps(dtaps, d_dtaps, d_diff_filters);
+ set_history(d_taps_per_filter + 1);
+ d_updated = true;
}
std::vector<std::vector<float> >
@@ -172,17 +172,40 @@ namespace gr {
void
pfb_arb_resampler_ccf_impl::set_rate(float rate)
{
+ gruel::scoped_lock guard(d_mutex);
+
d_dec_rate = (unsigned int)floor(d_int_rate/rate);
d_flt_rate = (d_int_rate/rate) - d_dec_rate;
set_relative_rate(rate);
}
+ void
+ pfb_arb_resampler_ccf_impl::set_phase(float ph)
+ {
+ gruel::scoped_lock guard(d_mutex);
+ if((ph < 0) || (ph >= 2.0*M_PI)) {
+ throw std::runtime_error("pfb_arb_resampler_ccf: set_phase value out of bounds [0, 2pi).\n");
+ }
+
+ float ph_diff = 2.0*M_PI / (float)d_filters.size();
+ d_last_filter = static_cast<int>(ph / ph_diff);
+ }
+
+ float
+ pfb_arb_resampler_ccf_impl::phase() const
+ {
+ float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+ return d_last_filter * ph_diff;
+ }
+
int
pfb_arb_resampler_ccf_impl::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ gruel::scoped_lock guard(d_mutex);
+
gr_complex *in = (gr_complex*)input_items[0];
gr_complex *out = (gr_complex*)output_items[0];
diff --git a/gr-filter/lib/pfb_arb_resampler_ccf_impl.h b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h
index 8e7e993cb..891e601e0 100644
--- a/gr-filter/lib/pfb_arb_resampler_ccf_impl.h
+++ b/gr-filter/lib/pfb_arb_resampler_ccf_impl.h
@@ -74,6 +74,9 @@ namespace gr {
void print_taps();
void set_rate(float rate);
+ void set_phase(float ph);
+ float phase() const;
+
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.cc b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc
index 79c19655a..6aff374fd 100644
--- a/gr-filter/lib/pfb_arb_resampler_fff_impl.cc
+++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.cc
@@ -172,11 +172,32 @@ namespace gr {
void
pfb_arb_resampler_fff_impl::set_rate(float rate)
{
+ gruel::scoped_lock guard(d_mutex);
+
d_dec_rate = (unsigned int)floor(d_int_rate/rate);
d_flt_rate = (d_int_rate/rate) - d_dec_rate;
set_relative_rate(rate);
}
+ void
+ pfb_arb_resampler_fff_impl::set_phase(float ph)
+ {
+ gruel::scoped_lock guard(d_mutex);
+ if((ph < 0) || (ph >= 2.0*M_PI)) {
+ throw std::runtime_error("pfb_arb_resampler_ccf: set_phase value out of bounds [0, 2pi).\n");
+ }
+
+ float ph_diff = 2.0*M_PI / (float)d_filters.size();
+ d_last_filter = static_cast<int>(ph / ph_diff);
+ }
+
+ float
+ pfb_arb_resampler_fff_impl::phase() const
+ {
+ float ph_diff = 2.0*M_PI / static_cast<float>(d_filters.size());
+ return d_last_filter * ph_diff;
+ }
+
int
pfb_arb_resampler_fff_impl::general_work(int noutput_items,
gr_vector_int &ninput_items,
diff --git a/gr-filter/lib/pfb_arb_resampler_fff_impl.h b/gr-filter/lib/pfb_arb_resampler_fff_impl.h
index 54e01375a..588962711 100644
--- a/gr-filter/lib/pfb_arb_resampler_fff_impl.h
+++ b/gr-filter/lib/pfb_arb_resampler_fff_impl.h
@@ -73,6 +73,9 @@ namespace gr {
void print_taps();
void set_rate(float rate);
+ void set_phase(float ph);
+ float phase() const;
+
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
diff --git a/gr-filter/lib/qa_fir_filter_with_buffer.cc b/gr-filter/lib/qa_fir_filter_with_buffer.cc
index f8af9ea0b..6a1744b0a 100644
--- a/gr-filter/lib/qa_fir_filter_with_buffer.cc
+++ b/gr-filter/lib/qa_fir_filter_with_buffer.cc
@@ -39,8 +39,6 @@ namespace gr {
#define MAX_DATA (16383)
#define ERR_DELTA (1e-5)
-#define NELEM(x) (sizeof(x) / sizeof(x[0]))
-
static float
uniform()
{
@@ -58,8 +56,8 @@ namespace gr {
random_complex(gr_complex *buf, unsigned n)
{
for(unsigned i = 0; i < n; i++) {
- float re = rint(uniform () * MAX_DATA);
- float im = rint(uniform () * MAX_DATA);
+ float re = rint(uniform() * MAX_DATA);
+ float im = rint(uniform() * MAX_DATA);
buf[i] = gr_complex(re, im);
}
}
@@ -148,7 +146,7 @@ namespace gr {
new kernel::fir_filter_with_buffer_fff(f1_taps);
// zero the output, then do the filtering
- memset(actual_output, 0, sizeof(actual_output));
+ memset(actual_output, 0, OUTPUT_LEN*sizeof(o_type));
f1->filterNdec(actual_output, input, ol/decimate, decimate);
// check results
@@ -263,7 +261,7 @@ namespace gr {
new kernel::fir_filter_with_buffer_ccc(f1_taps);
// zero the output, then do the filtering
- memset(actual_output, 0, sizeof(actual_output));
+ memset(actual_output, 0, OUTPUT_LEN*sizeof(o_type));
f1->filterNdec(actual_output, input, ol/decimate, decimate);
// check results
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
index 5850cb86c..268b8801c 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_cc.cc
@@ -27,15 +27,15 @@
#include <cppunit/TestAssert.h>
#include <qa_mmse_fir_interpolator_cc.h>
#include <filter/mmse_fir_interpolator_cc.h>
+#include <fft/fft.h>
#include <cstdio>
#include <cmath>
#include <stdexcept>
+#include <stdint.h>
namespace gr {
namespace filter {
-#define NELEM(x) (sizeof(x) / sizeof(x[0]))
-
static float
test_fcn_sin(double index)
{
@@ -61,9 +61,9 @@ namespace gr {
qa_mmse_fir_interpolator_cc::t1()
{
static const unsigned N = 100;
- __GR_ATTR_ALIGNED(8) gr_complex input[N + 10];
+ gr_complex *input = fft::malloc_complex(N + 10);
- for(unsigned i = 0; i < NELEM(input); i++)
+ for(unsigned i = 0; i < N+10; i++)
input[i] = test_fcn((double) i);
mmse_fir_interpolator_cc intr;
@@ -78,6 +78,7 @@ namespace gr {
// printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
}
}
+ fft::free(input);
}
/*
diff --git a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
index 128b638b9..54387fd9b 100644
--- a/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
+++ b/gr-filter/lib/qa_mmse_fir_interpolator_ff.cc
@@ -27,14 +27,13 @@
#include <cppunit/TestAssert.h>
#include <qa_mmse_fir_interpolator_ff.h>
#include <filter/mmse_fir_interpolator_ff.h>
+#include <fft/fft.h>
#include <cstdio>
#include <cmath>
namespace gr {
namespace filter {
-#define NELEM(x) (sizeof(x) / sizeof(x[0]))
-
static float
test_fcn(double index)
{
@@ -45,10 +44,12 @@ namespace gr {
void
qa_mmse_fir_interpolator_ff::t1()
{
+ // use aligned malloc and make sure that everything in this
+ // buffer is properly initialized.
static const unsigned N = 100;
- float input[N + 10];
+ float *input = fft::malloc_float(N + 10);
- for(unsigned i = 0; i < NELEM(input); i++)
+ for(unsigned i = 0; i < N+10; i++)
input[i] = test_fcn((double) i);
mmse_fir_interpolator_ff intr;
@@ -63,6 +64,7 @@ namespace gr {
// printf ("%9.6f %9.6f %9.6f\n", expected, actual, expected - actual);
}
}
+ fft::free(input);
}
} /* namespace filter */
diff --git a/gr-filter/python/qa_fft_filter.py b/gr-filter/python/qa_fft_filter.py
index eaef3156d..cb5416373 100755
--- a/gr-filter/python/qa_fft_filter.py
+++ b/gr-filter/python/qa_fft_filter.py
@@ -28,14 +28,14 @@ import random
def make_random_complex_tuple(L):
result = []
for x in range(L):
- result.append(complex(random.uniform(-1000,1000),
- random.uniform(-1000,1000)))
+ result.append(complex(2*random.random()-1,
+ 2*random.random()-1))
return tuple(result)
def make_random_float_tuple(L):
result = []
for x in range(L):
- result.append(float(int(random.uniform(-1000,1000))))
+ result.append(float(int(2*random.random()-1)))
return tuple(result)
diff --git a/gr-filter/python/qa_pfb_channelizer.py b/gr-filter/python/qa_pfb_channelizer.py
index 33d2b2188..c0ed8327d 100755
--- a/gr-filter/python/qa_pfb_channelizer.py
+++ b/gr-filter/python/qa_pfb_channelizer.py
@@ -70,10 +70,10 @@ class test_pfb_channelizer(gr_unittest.TestCase):
# Adjusted phase rotations for data
p0 = 0
- p1 = 1.6335486
- p2 = -3.01609
- p3 = 3.01609
- p4 = -1.6335486
+ p1 = math.pi*0.51998885
+ p2 = -math.pi*0.96002233
+ p3 = math.pi*0.96002233
+ p4 = -math.pi*0.51998885
# Create known data as complex sinusoids at the different baseband freqs
# the different channel numbering is due to channelizer output order.
@@ -94,11 +94,11 @@ class test_pfb_channelizer(gr_unittest.TestCase):
dst3_data = snks[3].data()
dst4_data = snks[4].data()
- self.assertComplexTuplesAlmostEqual(expected0_data[-Ntest:], dst0_data[-Ntest:], 4)
- self.assertComplexTuplesAlmostEqual(expected1_data[-Ntest:], dst1_data[-Ntest:], 4)
- self.assertComplexTuplesAlmostEqual(expected2_data[-Ntest:], dst2_data[-Ntest:], 4)
- self.assertComplexTuplesAlmostEqual(expected3_data[-Ntest:], dst3_data[-Ntest:], 4)
- self.assertComplexTuplesAlmostEqual(expected4_data[-Ntest:], dst4_data[-Ntest:], 4)
+ self.assertComplexTuplesAlmostEqual(expected0_data[-Ntest:], dst0_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected1_data[-Ntest:], dst1_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected2_data[-Ntest:], dst2_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected3_data[-Ntest:], dst3_data[-Ntest:], 3)
+ self.assertComplexTuplesAlmostEqual(expected4_data[-Ntest:], dst4_data[-Ntest:], 3)
if __name__ == '__main__':
gr_unittest.run(test_pfb_channelizer, "test_pfb_channelizer.xml")
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
index 0b0b6854e..f94bd30bd 100644
--- a/grc/blocks/block_tree.xml
+++ b/grc/blocks/block_tree.xml
@@ -34,6 +34,7 @@
<block>gr_message_sink</block>
<block>pad_sink</block>
<block>virtual_sink</block>
+ <block>gr_tag_debug</block>
</cat>
<cat>
<name>Operators</name>
diff --git a/grc/blocks/gr_tag_debug.xml b/grc/blocks/gr_tag_debug.xml
new file mode 100644
index 000000000..4af7729be
--- /dev/null
+++ b/grc/blocks/gr_tag_debug.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## Tag Debug
+###################################################
+ -->
+<block>
+ <name>Tag Debug</name>
+ <key>gr_tag_debug</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.tag_debug($type.size*$vlen, $name)</make>
+ <callback>set_display($display)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Name</name>
+ <key>name</key>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Num Inputs</name>
+ <key>num_inputs</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <param>
+ <name>Display</name>
+ <key>display</key>
+ <value>True</value>
+ <type>bool</type>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ </param>
+ <check>$num_inputs &gt;= 1</check>
+ <check>$vlen &gt; 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ <nports>$num_inputs</nports>
+ </sink>
+</block>
diff --git a/gruel/src/include/gruel/CMakeLists.txt b/gruel/src/include/gruel/CMakeLists.txt
index 9818f1c09..d4c36eddb 100644
--- a/gruel/src/include/gruel/CMakeLists.txt
+++ b/gruel/src/include/gruel/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,30 +18,12 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Generate inet.h header file
-########################################################################
-include(TestBigEndian)
-enable_language(C)
-TEST_BIG_ENDIAN(GR_ARCH_BIGENDIAN)
-
-include(CheckIncludeFileCXX)
-CHECK_INCLUDE_FILE_CXX(byteswap.h GR_HAVE_BYTESWAP)
-CHECK_INCLUDE_FILE_CXX(arpa/inet.h GR_HAVE_ARPA_INET)
-CHECK_INCLUDE_FILE_CXX(netinet/in.h GR_HAVE_NETINET_IN)
-
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/inet.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/inet.h
-@ONLY)
-
-########################################################################
# Install the headers
########################################################################
install(FILES
api.h
attributes.h
high_res_timer.h
- ${CMAKE_CURRENT_BINARY_DIR}/inet.h
msg_accepter.h
msg_accepter_msgq.h
msg_queue.h
diff --git a/gruel/src/include/gruel/inet.h.in b/gruel/src/include/gruel/inet.h.in
deleted file mode 100644
index 74f14bd92..000000000
--- a/gruel/src/include/gruel/inet.h.in
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008, 2009 Free Software Foundation, Inc.
- *
- * This program 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 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef INCLUDED_INET_H
-#define INCLUDED_INET_H
-
-#include <gruel/api.h>
-#include <stdint.h>
-
-#if 1 /* missing htonll or ntohll */
-#if @GR_ARCH_BIGENDIAN@ /* GR_ARCH_BIGENDIAN */
-// Nothing to do...
-static inline uint64_t htonll(uint64_t x){ return x;}
-static inline uint64_t ntohll(uint64_t x){ return x;}
-#else
-#if @GR_HAVE_BYTESWAP@ /* GR_HAVE_BYTESWAP */
-#include <byteswap.h>
-#else
-
-static inline uint64_t
-bswap_64(uint64_t x)
-{
- return ((x & 0x00000000000000ffull) << 56) | ((x & 0x000000000000ff00ull) << 40) |
- ((x & 0x0000000000ff0000ull) << 24) | ((x & 0x00000000ff000000ull) << 8) |
- ((x & 0x000000ff00000000ull) >> 8) | ((x & 0x0000ff0000000000ull) >> 24) |
- ((x & 0x00ff000000000000ull) >> 40) | ((x & 0xff00000000000000ull) >> 56);
-}
-
-#endif /* GR_HAVE_BYTESWAP */
-
-static inline uint64_t htonll(uint64_t x){ return bswap_64(x);}
-static inline uint64_t ntohll(uint64_t x){ return bswap_64(x);}
-
-#endif /* GR_ARCH_BIGENDIAN */
-#endif /* missing htonll or ntohll */
-
-#if @GR_HAVE_ARPA_INET@ /* GR_HAVE_ARPA_INET */
-#include <arpa/inet.h>
-#elif @GR_HAVE_NETINET_IN@ /* GR_HAVE_NETINET_IN */
-#include <netinet/in.h>
-#else
-#include <stdint.h>
-
-#if @GR_ARCH_BIGENDIAN@ /* GR_ARCH_BIGENDIAN */
-// Nothing to do...
-static inline uint32_t htonl(uint32_t x){ return x; }
-static inline uint16_t htons(uint16_t x){ return x; }
-static inline uint32_t ntohl(uint32_t x){ return x; }
-static inline uint16_t ntohs(uint16_t x){ return x; }
-#else
-#if @GR_HAVE_BYTESWAP@ /* GR_HAVE_BYTESWAP */
-#include <byteswap.h>
-#else
-static inline uint16_t
-bswap_16 (uint16_t x)
-{
- return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
-}
-
-static inline uint32_t
-bswap_32 (uint32_t x)
-{
- return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
- | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
-}
-#endif /* GR_HAVE_BYTESWAP */
-
-static inline uint32_t htonl(uint32_t x){ return bswap_32(x); }
-static inline uint16_t htons(uint16_t x){ return bswap_16(x); }
-static inline uint32_t ntohl(uint32_t x){ return bswap_32(x); }
-static inline uint16_t ntohs(uint16_t x){ return bswap_16(x); }
-#endif /* GR_ARCH_BIGENDIAN */
-
-#endif /* !(GR_HAVE_NETINET_IN || GR_HAVE_ARPA_INET) */
-
-static inline uint8_t ntohx(uint8_t x){ return x; }
-static inline uint16_t ntohx(uint16_t x){ return ntohs(x); }
-static inline uint32_t ntohx(uint32_t x){ return ntohl(x); }
-static inline uint64_t ntohx(uint64_t x){ return ntohll(x);}
-static inline uint8_t htonx(uint8_t x){ return x; }
-static inline uint16_t htonx(uint16_t x){ return htons(x); }
-static inline uint32_t htonx(uint32_t x){ return htonl(x); }
-static inline uint64_t htonx(uint64_t x){ return htonll(x);}
-
-#endif /* INCLUDED_INET_H */
diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt
index f9d1758ec..a0f84c832 100644
--- a/gruel/src/swig/CMakeLists.txt
+++ b/gruel/src/swig/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,7 +23,7 @@
include(GrPython)
include(GrSwig)
-set(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS})
+set(GR_SWIG_INCLUDE_DIRS ${GRUEL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
set(GR_SWIG_LIBRARIES gruel)
set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i)
diff --git a/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h b/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h
index c26fd5e7c..067c33ad8 100644
--- a/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h
+++ b/volk/include/volk/volk_32f_x2_dot_prod_32f_a.h
@@ -226,6 +226,8 @@ static inline void volk_32f_x2_dot_prod_32f_a_sse4_1(float * result, const float
#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
static inline void volk_32f_x2_dot_prod_32f_a_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
unsigned int number = 0;
diff --git a/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h b/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h
index f9ae15094..ab33a2587 100644
--- a/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h
+++ b/volk/include/volk/volk_32f_x2_dot_prod_32f_u.h
@@ -229,6 +229,8 @@ static inline void volk_32f_x2_dot_prod_32f_u_sse4_1(float * result, const float
#ifdef LV_HAVE_AVX
+#include <immintrin.h>
+
static inline void volk_32f_x2_dot_prod_32f_u_avx( float* result, const float* input, const float* taps, unsigned int num_points) {
unsigned int number = 0;
diff --git a/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h
index 80c55e75f..05732b1ea 100644
--- a/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h
+++ b/volk/include/volk/volk_32fc_s32fc_x2_rotator_32fc_a.h
@@ -174,12 +174,10 @@ static inline void volk_32fc_s32fc_x2_rotator_32fc_a_avx(lv_32fc_t* outVector, c
printf("%f, %f\n", lv_creal(phase_Ptr[2]), lv_cimag(phase_Ptr[2]));
printf("%f, %f\n", lv_creal(phase_Ptr[3]), lv_cimag(phase_Ptr[3]));
printf("incr: %f, %f\n", lv_creal(incr), lv_cimag(incr));*/
- __m256 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p, negated, zeros;
+ __m256 aVal, phase_Val, inc_Val, yl, yh, tmp1, tmp2, z, ylp, yhp, tmp1p, tmp2p;
phase_Val = _mm256_loadu_ps((float*)phase_Ptr);
inc_Val = _mm256_set_ps(lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr),lv_cimag(incr), lv_creal(incr));
- zeros = _mm256_set1_ps(0.0);
- negated = _mm256_set1_ps(-1.0);
const unsigned int fourthPoints = num_points / 4;
diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h
index cb2ac4c67..caef3e6f0 100644
--- a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h
+++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h
@@ -18,40 +18,26 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_generic(lv_32fc_t* result, const
unsigned int n_2_ccomplex_blocks = num_bytes >> 4;
unsigned int isodd = (num_bytes >> 3) &1;
-
-
float sum0[2] = {0,0};
float sum1[2] = {0,0};
unsigned int i = 0;
-
for(i = 0; i < n_2_ccomplex_blocks; ++i) {
-
-
sum0[0] += in[0] * tp[0] - in[1] * tp[1];
sum0[1] += in[0] * tp[1] + in[1] * tp[0];
sum1[0] += in[2] * tp[2] - in[3] * tp[3];
sum1[1] += in[2] * tp[3] + in[3] * tp[2];
-
in += 4;
tp += 4;
-
}
-
res[0] = sum0[0] + sum1[0];
res[1] = sum0[1] + sum1[1];
-
-
for(i = 0; i < isodd; ++i) {
-
-
*result += input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1];
-
}
-
}
#endif /*LV_HAVE_GENERIC*/
@@ -177,14 +163,8 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse_64(lv_32fc_t* result, const
);
- int getem = num_bytes % 16;
-
-
- for(; getem > 0; getem -= 8) {
-
-
+ if(((num_bytes >> 3) & 1)) {
*result += (input[(num_bytes >> 3) - 1] * taps[(num_bytes >> 3) - 1]);
-
}
return;
@@ -363,7 +343,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse3(lv_32fc_t* result, const lv
dotProduct += ( dotProductVector[0] + dotProductVector[1] );
- if((num_bytes >> 2) != 0) {
+ if(((num_bytes >> 3) & 1) != 0) {
dotProduct += (*a) * (*b);
}
@@ -377,9 +357,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse3(lv_32fc_t* result, const lv
#include <smmintrin.h>
static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) {
- volk_32fc_x2_dot_prod_32fc_a_sse3(result, input, taps, num_bytes);
- // SSE3 version runs twice as fast as the SSE4.1 version, so turning off SSE4 version for now
- /*
+
__m128 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, real0, real1, im0, im1;
float *p_input, *p_taps;
__m64 *p_result;
@@ -442,11 +420,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const
}
-
-
-
- real1 = _mm_xor_ps(real1, (__m128)neg);
-
+ real1 = _mm_xor_ps(real1, bit128_p(&neg)->float_vec);
im0 = _mm_add_ps(im0, im1);
real0 = _mm_add_ps(real0, real1);
@@ -459,7 +433,6 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse4_1(lv_32fc_t* result, const
*result += input[i] * taps[i];
}
- */
}
#endif /*LV_HAVE_SSE4_1*/
diff --git a/volk/lib/testqa.cc b/volk/lib/testqa.cc
index 813e62217..d1eb1cacb 100644
--- a/volk/lib/testqa.cc
+++ b/volk/lib/testqa.cc
@@ -35,8 +35,8 @@ VOLK_RUN_TESTS(volk_32fc_deinterleave_64f_x2_a, 1e-4, 0, 20460, 1);
VOLK_RUN_TESTS(volk_32fc_s32f_deinterleave_real_16i_a, 0, 32768, 20460, 1);
VOLK_RUN_TESTS(volk_32fc_deinterleave_real_32f_a, 1e-4, 0, 20460, 1);
VOLK_RUN_TESTS(volk_32fc_deinterleave_real_64f_a, 1e-4, 0, 20460, 1);
-VOLK_RUN_TESTS(volk_32fc_x2_dot_prod_32fc_a, 1e-4, 0, 204600, 1);
-VOLK_RUN_TESTS(volk_32fc_32f_dot_prod_32fc_a, 1e-4, 0, 204600, 1);
+VOLK_RUN_TESTS(volk_32fc_x2_dot_prod_32fc_a, 1e-4, 0, 2046000, 1);
+VOLK_RUN_TESTS(volk_32fc_32f_dot_prod_32fc_a, 1e-4, 0, 2046000, 1);
VOLK_RUN_TESTS(volk_32fc_index_max_16u_a, 3, 0, 20460, 1);
VOLK_RUN_TESTS(volk_32fc_s32f_magnitude_16i_a, 1, 32768, 20460, 1);
VOLK_RUN_TESTS(volk_32fc_magnitude_32f_a, 1e-4, 0, 20460, 1);