summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/guile/.gitignore1
-rw-r--r--gnuradio-core/src/lib/bug_work_around_6.cc4
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h4
-rw-r--r--gnuradio-core/src/lib/filter/qa_gr_rotator.cc7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc7
-rw-r--r--gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc7
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am3
-rw-r--r--gnuradio-core/src/lib/general/general.i2
-rw-r--r--gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc6
-rw-r--r--gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.cc59
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.h51
-rw-r--r--gnuradio-core/src/lib/general/gr_int_to_float.i30
-rw-r--r--gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h3
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.cc136
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.h33
-rw-r--r--gnuradio-core/src/lib/general/gr_throttle.i13
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.cc5
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc1
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.h1
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_sink.cc5
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.cc1
-rw-r--r--gnuradio-core/src/lib/io/gr_wavfile_source.h1
-rw-r--r--gnuradio-core/src/lib/missing/bug_work_around_8.cc3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_basic_block.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.cc1
-rw-r--r--gnuradio-core/src/lib/runtime/gr_error_handler.h1
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flowgraph.cc3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_sync_block.h2
-rw-r--r--gnuradio-core/src/python/gnuradio/Makefile.am3
-rw-r--r--gnuradio-core/src/python/gnuradio/audio.py88
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/Makefile.am1
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py49
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccc.cc8
-rw-r--r--gnuradio-core/src/tests/benchmark_dotprod_ccf.cc8
37 files changed, 320 insertions, 239 deletions
diff --git a/gnuradio-core/src/guile/.gitignore b/gnuradio-core/src/guile/.gitignore
index 82a29a907..ea2593923 100644
--- a/gnuradio-core/src/guile/.gitignore
+++ b/gnuradio-core/src/guile/.gitignore
@@ -2,3 +2,4 @@
/Makefile.in
/run_guile_tests
/guile.log
+/gr-run-waveform-script
diff --git a/gnuradio-core/src/lib/bug_work_around_6.cc b/gnuradio-core/src/lib/bug_work_around_6.cc
index b829360fc..f8012af0d 100644
--- a/gnuradio-core/src/lib/bug_work_around_6.cc
+++ b/gnuradio-core/src/lib/bug_work_around_6.cc
@@ -1,3 +1,3 @@
// if libgrio has no sources, it doesn't get built correctly
-
-static int gr_bug_work_around_6 __attribute__((unused));
+#include <gruel/attributes.h>
+static int gr_bug_work_around_6 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
index 4e6ef5fc4..684ac85ce 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
+++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h
@@ -84,7 +84,7 @@ class gr_fir_ccf;
* the block constructor, we just ask for "gain," which is d_alpha while d_beta is
* equal to (gain^2)/4.
*
- * The clock sync block needs to know the number of samples per second (sps), because it
+ * The clock sync block needs to know the number of samples per symbol (sps), because it
* only returns a single point representing the sample. The sps can be any positive real
* number and does not need to be an integer. The filter taps must also be specified. The
* taps are generated by first conceiving of the prototype filter that would be the signal's
@@ -115,7 +115,7 @@ class gr_pfb_clock_sync_ccf : public gr_block
private:
/*!
* Build the polyphase filterbank timing synchronizer.
- * \param sps (double) The number of samples per second in the incoming signal
+ * \param sps (double) The number of samples per symbol in the incoming signal
* \param gain (float) The alpha gain of the control loop; beta = (gain^2)/4 by default.
* \param taps (vector<int>) The filter taps.
* \param filter_size (uint) The number of filters in the filterbank (default = 32).
diff --git a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
index ce71a3d88..ef41127fd 100644
--- a/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
+++ b/gnuradio-core/src/lib/filter/qa_gr_rotator.cc
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/attributes.h>
#include <cppunit/TestAssert.h>
#include <qa_gr_rotator.h>
#include <gr_rotator.h>
@@ -29,7 +34,7 @@
// error vector magnitude
-__attribute__((unused)) static float
+__GR_ATTR_UNUSED static float
error_vector_mag(gr_complex a, gr_complex b)
{
return abs(a-b);
diff --git a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
index e87d93ebf..ca76c8eb8 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc
@@ -42,6 +42,7 @@ typedef gr_complex acc_type;
using std::vector;
+#define MAX_DATA (32767)
#define ERR_DELTA (1e-5)
#define NELEM(x) (sizeof (x) / sizeof (x[0]))
@@ -56,8 +57,8 @@ static void
random_complex (gr_complex *buf, unsigned n)
{
for (unsigned i = 0; i < n; i++){
- float re = rint (uniform () * 32767);
- float im = rint (uniform () * 32767);
+ float re = rint (uniform () * MAX_DATA);
+ float im = rint (uniform () * MAX_DATA);
buf[i] = gr_complex (re, im);
}
}
@@ -151,7 +152,7 @@ qa_gri_fir_filter_with_buffer_ccc::test_decimate(unsigned int decimate)
for (int o = 0; o < (int)(ol/decimate); o++){
CPPUNIT_ASSERT_COMPLEXES_EQUAL(expected_output[o], actual_output[o],
- abs (expected_output[o]) * ERR_DELTA);
+ sqrt((float)n)*0.25*MAX_DATA*MAX_DATA * ERR_DELTA);
}
delete f1;
}
diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
index 3c379ea25..2fc97a78a 100644
--- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
+++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc
@@ -20,6 +20,11 @@
* Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gruel/attributes.h>
#include <cppunit/TestAssert.h>
#include <qa_gri_mmse_fir_interpolator_cc.h>
#include <gri_mmse_fir_interpolator_cc.h>
@@ -55,7 +60,7 @@ void
qa_gri_mmse_fir_interpolator_cc::t1()
{
static const unsigned N = 100;
- gr_complex input[N + 10] __attribute__ ((aligned (8)));
+ __GR_ATTR_ALIGNED(8) gr_complex input[N + 10];
for (unsigned i = 0; i < NELEM(input); i++)
input[i] = test_fcn ((double) i);
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index 3ceea7a6d..2a7a4b025 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -139,6 +139,7 @@ libgeneral_la_SOURCES = \
gr_rms_cf.cc \
gr_rms_ff.cc \
gr_short_to_float.cc \
+ gr_int_to_float.cc \
gr_simple_correlator.cc \
gr_simple_framer.cc \
gr_simple_squelch_cc.cc \
@@ -301,6 +302,7 @@ grinclude_HEADERS = \
gr_rms_cf.h \
gr_rms_ff.h \
gr_short_to_float.h \
+ gr_int_to_float.h \
gr_simple_correlator.h \
gr_simple_framer.h \
gr_simple_framer_sync.h \
@@ -418,6 +420,7 @@ swiginclude_HEADERS = \
gr_glfsr_source_b.i \
gr_glfsr_source_f.i \
gr_head.i \
+ gr_int_to_float.i \
gr_interleave.i \
gr_interleaved_short_to_complex.i \
gr_iqcomp_cc.i \
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index fb9c4c0f2..e8a18ab19 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -42,6 +42,7 @@
#include <gr_float_to_char.h>
#include <gr_float_to_uchar.h>
#include <gr_short_to_float.h>
+#include <gr_int_to_float.h>
#include <gr_char_to_float.h>
#include <gr_uchar_to_float.h>
#include <gr_frequency_modulator_fc.h>
@@ -167,6 +168,7 @@
%include "gr_float_to_char.i"
%include "gr_float_to_uchar.i"
%include "gr_short_to_float.i"
+%include "gr_int_to_float.i"
%include "gr_char_to_float.i"
%include "gr_uchar_to_float.i"
%include "gr_frequency_modulator_fc.i"
diff --git a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
index 23bbf821f..7c20f7fd9 100644
--- a/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
+++ b/gnuradio-core/src/lib/general/gr_clock_recovery_mm_cc.cc
@@ -33,7 +33,7 @@
// Public constructor
-
+static const int FUDGE = 16;
gr_clock_recovery_mm_cc_sptr
gr_make_clock_recovery_mm_cc(float omega, float gain_omega, float mu, float gain_mu,
@@ -78,7 +78,7 @@ gr_clock_recovery_mm_cc::forecast(int noutput_items, gr_vector_int &ninput_items
unsigned ninputs = ninput_items_required.size();
for (unsigned i=0; i < ninputs; i++)
ninput_items_required[i] =
- (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
+ (int) ceil((noutput_items * d_omega) + d_interp->ntaps()) + FUDGE;
}
gr_complex
@@ -111,8 +111,6 @@ gr_clock_recovery_mm_cc::slicer_45deg (gr_complex sample)
algorithm," Electronics Letters, Vol. 31, no. 13, 22 June 1995, pp. 1032 - 1033.
*/
-static const int FUDGE = 16;
-
int
gr_clock_recovery_mm_cc::general_work (int noutput_items,
gr_vector_int &ninput_items,
diff --git a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
index 0f6f0d719..bff22be25 100644
--- a/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
+++ b/gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <gr_sincos.h>
#include <math.h>
+#include <boost/math/special_functions/trunc.hpp>
gr_frequency_modulator_fc_sptr gr_make_frequency_modulator_fc (double sensitivity)
@@ -62,7 +63,7 @@ gr_frequency_modulator_fc::work (int noutput_items,
// to avoid loss of precision in the addition above.
if (fabs (d_phase) > 16 * M_PI){
- double ii = trunc (d_phase / (2 * M_PI));
+ double ii = boost::math::trunc (d_phase / (2 * M_PI));
d_phase = d_phase - (ii * 2 * M_PI);
}
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc
new file mode 100644
index 000000000..b5a19e5c0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_int_to_float.h>
+#include <gr_io_signature.h>
+
+gr_int_to_float_sptr
+gr_make_int_to_float ()
+{
+ return gnuradio::get_initial_sptr(new gr_int_to_float ());
+}
+
+gr_int_to_float::gr_int_to_float ()
+ : gr_sync_block ("gr_int_to_float",
+ gr_make_io_signature (1, 1, sizeof (int32_t)),
+ gr_make_io_signature (1, 1, sizeof (float)))
+{
+}
+
+int
+gr_int_to_float::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const int32_t *in = (const int32_t *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ for(int i=0; i < noutput_items; i++) {
+ out[i] = (float)in[i];
+ }
+
+ return noutput_items;
+}
+
+
+
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.h b/gnuradio-core/src/lib/general/gr_int_to_float.h
new file mode 100644
index 000000000..cf1223be5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_INT_TO_FLOAT_H
+#define INCLUDED_GR_INT_TO_FLOAT_H
+
+#include <gr_sync_block.h>
+
+class gr_int_to_float;
+typedef boost::shared_ptr<gr_int_to_float> gr_int_to_float_sptr;
+
+gr_int_to_float_sptr
+gr_make_int_to_float ();
+
+/*!
+ * \brief Convert stream of short to a stream of float
+ * \ingroup converter_blk
+ */
+
+class gr_int_to_float : public gr_sync_block
+{
+ friend gr_int_to_float_sptr gr_make_int_to_float ();
+ gr_int_to_float ();
+
+ public:
+ virtual int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_INT_TO_FLOAT_H */
diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.i b/gnuradio-core/src/lib/general/gr_int_to_float.i
new file mode 100644
index 000000000..8cb9e35b5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_int_to_float.i
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,int_to_float)
+
+gr_int_to_float_sptr gr_make_int_to_float ();
+
+class gr_int_to_float : public gr_sync_block
+{
+ gr_int_to_float ();
+};
diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
index 024d74ada..f17b68aa0 100644
--- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
+++ b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h
@@ -23,6 +23,7 @@
#ifndef INCLUDED_GR_MPSK_RECEIVER_CC_H
#define INCLUDED_GR_MPSK_RECEIVER_CC_H
+#include <gruel/attributes.h>
#include <gr_block.h>
#include <gr_complex.h>
#include <fstream>
@@ -299,7 +300,7 @@ protected:
static const unsigned int DLLEN = 8;
//! delay line plus some length for overflow protection
- gr_complex d_dl[2*DLLEN] __attribute__ ((aligned(8)));
+ __GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
//! index to delay line
unsigned int d_dl_idx;
diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc
index 3189e01c0..a24b1da8c 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.cc
+++ b/gnuradio-core/src/lib/general/gr_throttle.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,92 +26,64 @@
#include <gr_throttle.h>
#include <gr_io_signature.h>
-#include <errno.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#if !defined(HAVE_NANOSLEEP) && defined(HAVE_SSLEEP)
-#include <windows.h>
-#endif
-
+#include <cstring>
+#include <boost/thread/thread.hpp>
-#ifdef HAVE_NANOSLEEP
-void
-gr_nanosleep(struct timespec *ts)
-{
- struct timespec *req = ts;
- struct timespec rem;
- int r = nanosleep(req, &rem);
- while (r < 0 && errno == EINTR){
- req = &rem;
- r = nanosleep(req, &rem);
- }
- if (r < 0)
- perror ("gr_nanosleep");
-}
-#endif
-
-gr_throttle_sptr
-gr_make_throttle(size_t itemsize, double samples_per_sec)
-{
- return gnuradio::get_initial_sptr(new gr_throttle(itemsize, samples_per_sec));
-}
+class gr_throttle_impl : public gr_throttle{
+public:
+ gr_throttle_impl(size_t itemsize):
+ gr_sync_block("throttle",
+ gr_make_io_signature(1, 1, itemsize),
+ gr_make_io_signature(1, 1, itemsize)),
+ d_itemsize(itemsize)
+ {
+ /* NOP */
+ }
-gr_throttle::gr_throttle(size_t itemsize, double samples_per_sec)
- : gr_sync_block("throttle",
- gr_make_io_signature(1, 1, itemsize),
- gr_make_io_signature(1, 1, itemsize)),
- d_itemsize(itemsize), d_samples_per_sec(samples_per_sec),
- d_total_samples(0)
-{
-#ifdef HAVE_GETTIMEOFDAY
- gettimeofday(&d_start, 0);
-#endif
-}
+ void set_sample_rate(double rate){
+ //changing the sample rate performs a reset of state params
+ d_start = boost::get_system_time();
+ d_total_samples = 0;
+ d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second();
+ d_samps_per_us = rate/1e6;
+ }
-gr_throttle::~gr_throttle()
-{
-}
+ int work (
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //calculate the expected number of samples to have passed through
+ boost::system_time now = boost::get_system_time();
+ boost::int64_t ticks = (now - d_start).ticks();
+ uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks);
-int
-gr_throttle::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const char *in = (const char *) input_items[0];
- char *out = (char *) output_items[0];
+ //if the expected samples was less, we need to throttle back
+ if (d_total_samples > expected_samps){
+ boost::this_thread::sleep(boost::posix_time::microseconds(
+ long((d_total_samples - expected_samps)/d_samps_per_us)
+ ));
+ }
-#if defined(HAVE_GETTIMEOFDAY)
- //
- // If our average sample rate exceeds our target sample rate,
- // delay long enough to reduce to our target rate.
- //
- struct timeval now;
- gettimeofday(&now, 0);
- long t_usec = now.tv_usec - d_start.tv_usec;
- long t_sec = now.tv_sec - d_start.tv_sec;
- double t = (double)t_sec + (double)t_usec * 1e-6;
- if (t < 1e-6) // avoid unlikely divide by zero
- t = 1e-6;
+ //copy all samples output[i] <= input[i]
+ const char *in = (const char *) input_items[0];
+ char *out = (char *) output_items[0];
+ std::memcpy(out, in, noutput_items * d_itemsize);
+ d_total_samples += noutput_items;
+ return noutput_items;
+ }
- double actual_samples_per_sec = d_total_samples / t;
- if (actual_samples_per_sec > d_samples_per_sec){ // need to delay
- double delay = d_total_samples / d_samples_per_sec - t;
-#ifdef HAVE_NANOSLEEP
- struct timespec ts;
- ts.tv_sec = (time_t)floor(delay);
- ts.tv_nsec = (long)((delay - floor(delay)) * 1e9);
- gr_nanosleep(&ts);
-#elif HAVE_SSLEEP
- Sleep( (DWORD)(delay*1000) );
-#endif
- }
-#endif
+private:
+ boost::system_time d_start;
+ size_t d_itemsize;
+ uint64_t d_total_samples;
+ double d_samps_per_tick, d_samps_per_us;
+};
- memcpy(out, in, noutput_items * d_itemsize);
- d_total_samples += noutput_items;
- return noutput_items;
+gr_throttle::sptr
+gr_make_throttle(size_t itemsize, double samples_per_sec)
+{
+ gr_throttle::sptr throttle(new gr_throttle_impl(itemsize));
+ throttle->set_sample_rate(samples_per_sec);
+ return throttle;
}
diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h
index a1c9773c9..a82821f77 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.h
+++ b/gnuradio-core/src/lib/general/gr_throttle.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,15 +23,6 @@
#define INCLUDED_GR_THROTTLE_H
#include <gr_sync_block.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-class gr_throttle;
-typedef boost::shared_ptr<gr_throttle> gr_throttle_sptr;
-
-
-gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
/*!
* \brief throttle flow of samples such that the average rate does not exceed samples_per_sec.
@@ -44,25 +35,15 @@ gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
* controlling the rate of samples. That should be controlled by a
* source or sink tied to sample clock. E.g., a USRP or audio card.
*/
-class gr_throttle : public gr_sync_block
+class gr_throttle : virtual public gr_sync_block
{
- friend gr_throttle_sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
- size_t d_itemsize;
- double d_samples_per_sec;
- double d_total_samples;
-#ifdef HAVE_SYS_TIME_H
- struct timeval d_start;
-#endif
-
- gr_throttle(size_t itemsize, double samples_per_sec);
-
public:
- ~gr_throttle();
+ typedef boost::shared_ptr<gr_throttle> sptr;
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ //! Sets the sample rate in samples per second
+ virtual void set_sample_rate(double rate) = 0;
};
-
+
+gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec);
#endif /* INCLUDED_GR_THROTTLE_H */
diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i
index 21f7703ef..0b1ec165f 100644
--- a/gnuradio-core/src/lib/general/gr_throttle.i
+++ b/gnuradio-core/src/lib/general/gr_throttle.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,11 +20,10 @@
* Boston, MA 02110-1301, USA.
*/
-GR_SWIG_BLOCK_MAGIC(gr,throttle);
+%{
+#include <gr_throttle.h>
+%}
-gr_throttle_sptr gr_make_throttle (size_t itemsize, double samples_per_sec);
+GR_SWIG_BLOCK_MAGIC(gr,throttle);
-class gr_throttle : public gr_sync_block
-{
- gr_throttle (size_t itemsize, double samples_per_sec);
-};
+%include <gr_throttle.h>
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
index a37189c24..fc0c12ce6 100644
--- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009,2010 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include <gr_histo_sink_f.h>
#include <gr_io_signature.h>
+#include <boost/math/special_functions/round.hpp>
static float get_clean_num(float num){
if (num == 0) return 0;
@@ -101,7 +102,7 @@ gr_histo_sink_f::send_frame(void){
int index;
float bin_width = (maximum - minimum)/(d_num_bins-1);
for (unsigned int i = 0; i < d_sample_count; i++){
- index = round((d_samps[i] - minimum)/bin_width);
+ index = boost::math::iround((d_samps[i] - minimum)/bin_width);
/* ensure the index range in case a small floating point error is involed */
if (index < 0) index = 0;
if (index >= (int)d_num_bins) index = d_num_bins-1;
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
index c76ede542..154611c32 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -26,7 +26,6 @@
#include <gr_tagged_file_sink.h>
#include <gr_io_signature.h>
-#include <cstdio>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
index 956340f8d..2e0a5c63a 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
@@ -24,6 +24,7 @@
#define INCLUDED_GR_TAGGED_FILE_SINK_H
#include <gr_sync_block.h>
+#include <cstdio> // for FILE
class gr_tagged_file_sink;
typedef boost::shared_ptr<gr_tagged_file_sink> gr_tagged_file_sink_sptr;
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
index b60a6e3ab..a96aadc72 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,6 +33,7 @@
#include <cmath>
#include <fcntl.h>
#include <gruel/thread.h>
+#include <boost/math/special_functions/round.hpp>
// win32 (mingw/msvc) specific
#ifdef HAVE_IO_H
@@ -224,7 +225,7 @@ gr_wavfile_sink::convert_to_short(float sample)
sample = d_min_sample_val;
}
- return (short int) roundf(sample);
+ return (short int) boost::math::iround(sample);
}
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.cc b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
index d00dd3028..136e52611 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_source.cc
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.cc
@@ -27,7 +27,6 @@
#include <gr_wavfile_source.h>
#include <gr_io_signature.h>
#include <gri_wavfile.h>
-#include <cstdio>
#include <sys/types.h>
#include <fcntl.h>
#include <stdexcept>
diff --git a/gnuradio-core/src/lib/io/gr_wavfile_source.h b/gnuradio-core/src/lib/io/gr_wavfile_source.h
index 0c663f0a0..e434a6b4c 100644
--- a/gnuradio-core/src/lib/io/gr_wavfile_source.h
+++ b/gnuradio-core/src/lib/io/gr_wavfile_source.h
@@ -24,6 +24,7 @@
#define INCLUDED_GR_WAVFILE_SOURCE_H
#include <gr_sync_block.h>
+#include <cstdio> // for FILE
class gr_wavfile_source;
typedef boost::shared_ptr<gr_wavfile_source> gr_wavfile_source_sptr;
diff --git a/gnuradio-core/src/lib/missing/bug_work_around_8.cc b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
index b2cbdb3d9..5e431a210 100644
--- a/gnuradio-core/src/lib/missing/bug_work_around_8.cc
+++ b/gnuradio-core/src/lib/missing/bug_work_around_8.cc
@@ -1,2 +1,3 @@
// if libmisc has no sources, it doesn't get built correctly
-static int gr_bug_work_around_8 __attribute__((unused));
+#include <gruel/attributes.h>
+static int gr_bug_work_around_8 __GR_ATTR_UNUSED;
diff --git a/gnuradio-core/src/lib/runtime/gr_basic_block.h b/gnuradio-core/src/lib/runtime/gr_basic_block.h
index ce7a1aa1d..3b0cd51dd 100644
--- a/gnuradio-core/src/lib/runtime/gr_basic_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_basic_block.h
@@ -73,6 +73,8 @@ protected:
long d_unique_id;
vcolor d_color;
+ gr_basic_block(void){} //allows pure virtual interface sub-classes
+
//! Protected constructor prevents instantiation by non-derived classes
gr_basic_block(const std::string &name,
gr_io_signature_sptr input_signature,
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index ad7fa9555..fc22f9ea8 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -236,7 +236,7 @@ class gr_block : public gr_basic_block {
tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
protected:
-
+ gr_block (void){} //allows pure virtual interface sub-classes
gr_block (const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index aa26f1e09..e5725d386 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,7 @@
#include <boost/weak_ptr.hpp>
#include <gruel/thread.h>
#include <gruel/pmt.h>
+#include <deque>
class gr_vmcircbuf;
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.cc b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
index 6dbb0a5d2..4b4cdacef 100644
--- a/gnuradio-core/src/lib/runtime/gr_error_handler.cc
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.cc
@@ -48,7 +48,6 @@
#include <assert.h>
#include <stdexcept>
#include <unistd.h>
-#include <stdio.h>
#ifdef HAVE_IO_H
#include <io.h>
diff --git a/gnuradio-core/src/lib/runtime/gr_error_handler.h b/gnuradio-core/src/lib/runtime/gr_error_handler.h
index 530a2c23c..aedb6f41f 100644
--- a/gnuradio-core/src/lib/runtime/gr_error_handler.h
+++ b/gnuradio-core/src/lib/runtime/gr_error_handler.h
@@ -45,6 +45,7 @@
#include <stdarg.h>
#include <string>
+#include <cstdio> // for FILE
/*!
* \brief abstract error handler
diff --git a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
index 27f6257cc..0d3bbb011 100644
--- a/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
+++ b/gnuradio-core/src/lib/runtime/gr_flowgraph.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,6 +28,7 @@
#include <gr_io_signature.h>
#include <stdexcept>
#include <sstream>
+#include <iterator>
#define GR_FLOWGRAPH_DEBUG 0
diff --git a/gnuradio-core/src/lib/runtime/gr_sync_block.h b/gnuradio-core/src/lib/runtime/gr_sync_block.h
index 3a5d89d19..c5a6a50f1 100644
--- a/gnuradio-core/src/lib/runtime/gr_sync_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_sync_block.h
@@ -34,7 +34,7 @@
class gr_sync_block : public gr_block
{
protected:
-
+ gr_sync_block (void){} //allows pure virtual interface sub-classes
gr_sync_block (const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature);
diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am
index a3f3518de..eff35e95c 100644
--- a/gnuradio-core/src/python/gnuradio/Makefile.am
+++ b/gnuradio-core/src/python/gnuradio/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2004,2007,2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2004-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -26,7 +26,6 @@ SUBDIRS = gr gru gruimpl blks2 blks2impl vocoder
grpython_PYTHON = \
__init__.py \
- audio.py \
eng_notation.py \
eng_option.py \
modulation_utils.py \
diff --git a/gnuradio-core/src/python/gnuradio/audio.py b/gnuradio-core/src/python/gnuradio/audio.py
deleted file mode 100644
index f6e921f0e..000000000
--- a/gnuradio-core/src/python/gnuradio/audio.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# Copyright 2004,2006 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.
-#
-
-"""
-This is the 'generic' audio or soundcard interface.
-
-The behavior of this module is controlled by the [audio] audio_module
-configuration parameter. If it is 'auto' we attempt to import modules
-from the known_modules list, using the first one imported successfully.
-
-If [audio] audio_module is not 'auto', we assume it's the name of
-an audio module and attempt to import it.
-"""
-
-__all__ = ['source', 'sink']
-
-from gnuradio import gr
-import sys
-
-source = None
-sink = None
-
-
-known_modules = (
- 'audio_alsa', 'audio_oss', 'audio_osx', 'audio_jack', 'audio_portaudio', 'audio_windows')
-
-
-def try_import(name):
- """
- Build a blob of code and try to execute it.
- If it succeeds we will have set the globals source and sink
- as side effects.
-
- returns True or False
- """
- global source, sink
- full_name = "gnuradio." + name
- code = """
-import %s
-source = %s.source
-sink = %s.sink
-""" % (full_name, full_name, full_name)
- try:
- exec code in globals()
- return True
- except ImportError:
- return False
-
-
-def __init__ ():
- p = gr.prefs() # get preferences (config file) object
- verbose = p.get_bool('audio', 'verbose', False)
- module = p.get_string('audio', 'audio_module', 'auto')
-
- if module == 'auto': # search our list for the first one that we can import
- for m in known_modules:
- if try_import(m):
- if verbose: sys.stderr.write('audio: using %s\n' % (m,))
- return
- raise ImportError, 'Unable to locate an audio module.'
-
- else: # use the one the user specified
- if try_import(module):
- if verbose: sys.stderr.write('audio: using %s\n' % (module,))
- else:
- msg = 'Failed to import user-specified audio module %s' % (module,)
- if verbose: sys.stderr.write('audio: %s\n' % (msg,))
- raise ImportError, msg
-
-__init__()
diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am
index b8da9cf48..f1b4ba2b1 100644
--- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am
+++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am
@@ -71,6 +71,7 @@ noinst_PYTHON = \
qa_hier_block2.py \
qa_hilbert.py \
qa_iir.py \
+ qa_int_to_float.py \
qa_interleave.py \
qa_interp_fir_filter.py \
qa_kludge_copy.py \
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py b/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py
new file mode 100755
index 000000000..edfc26409
--- /dev/null
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+
+class test_int_to_float (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001(self):
+
+ src_data = (0, 1, 2, 3, 4, 5, -1, -2, -3, -4, -5)
+ expected_result = [float(s) for s in src_data]
+ src = gr.vector_source_i(src_data)
+ op = gr.int_to_float()
+ dst = gr.vector_sink_f()
+
+ self.tb.connect(src, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+
+ self.assertFloatTuplesAlmostEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_int_to_float, "test_int_to_float.xml")
+
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
index 5d53a9f89..8ef26a40d 100644
--- a/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc
@@ -56,7 +56,8 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
{
int i;
gr_complex coeffs[NTAPS];
- gr_complex input[BLOCK_SIZE + NTAPS];
+ //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned
+ gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
#ifdef HAVE_SYS_RESOURCE_H
@@ -86,7 +87,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
exit (1);
}
#else
- clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ clock_start= (double) clock() / CLOCKS_PER_SEC;
#endif
// do the actual work
@@ -116,7 +117,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
double total = user + sys;
#else
- clock_end = (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ clock_end = (double) clock() / CLOCKS_PER_SEC;
double total = clock_end - clock_start;
#endif
@@ -126,6 +127,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
delete f;
+ delete [] input;
}
static void
diff --git a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
index 60855ec94..ed3c49165 100644
--- a/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
+++ b/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc
@@ -56,7 +56,8 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
{
int i;
float coeffs[NTAPS];
- gr_complex input[BLOCK_SIZE + NTAPS];
+ //gr_complex input[BLOCK_SIZE + NTAPS]; // not always 16-bit aligned
+ gr_complex *input = new gr_complex[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
#ifdef HAVE_SYS_RESOURCE_H
@@ -86,7 +87,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
exit (1);
}
#else
- clock_start= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ clock_start= (double) clock() / CLOCKS_PER_SEC;
#endif
// do the actual work
@@ -118,7 +119,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
double total = user + sys;
#else
- clock_end= (double) clock() * (1000000. / CLOCKS_PER_SEC);
+ clock_end= (double) clock() / CLOCKS_PER_SEC;
double total = clock_end - clock_start;
#endif
@@ -128,6 +129,7 @@ benchmark (fir_maker_t filter_maker, const char *implementation_name)
implementation_name, NTAPS, (double) TOTAL_TEST_SIZE, total, macs / total);
delete f;
+ delete [] input;
}
static void