From 8e5f4bc89af1682b258ecb1bc46b04d24ea3addd Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 26 Feb 2011 14:48:34 -0800 Subject: use boost::math::trunc in gr_frequency_modulator_fc.cc this replaces the need for a conditional trunc implementation in config.h --- gnuradio-core/src/lib/general/gr_frequency_modulator_fc.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gnuradio-core') 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 #include #include +#include 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); } -- cgit From 239c5860be82936e00cfec16a4e1f06f1a004c59 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 26 Feb 2011 14:49:53 -0800 Subject: use boost::math::iround in gr_histo_sink_f.cc and gr_wavfile_sink.cc this provides a round implementation on platforms w/o c99 standard --- gnuradio-core/src/lib/io/gr_histo_sink_f.cc | 5 +++-- gnuradio-core/src/lib/io/gr_wavfile_sink.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gnuradio-core') 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 #include +#include 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_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 #include #include +#include // 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); } -- cgit From aedfa8ec254f1def125167a77a50bb0eec4ab00c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Jan 2011 12:23:58 -0800 Subject: gr_flowgraph.cc explicit include of Added explicit include of , which was implicitly included by . Affects platforms where vector does not automatically pull in iterator. --- gnuradio-core/src/lib/runtime/gr_flowgraph.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core') 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 #include #include +#include #define GR_FLOWGRAPH_DEBUG 0 -- cgit From e73c25fb9226029f0e50052b1ffacedb3a78622b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Jan 2011 00:34:28 -0800 Subject: gruel thread simplification: Removed get_new_timeout from thread.h (usrp2_vrt carryover) Basically it was created because of a misunderstanding of the time types; and its only ever called once. This also removes thread.cc Call posix_time::milliseconds in usrp2 control.cc. Notice that it passes a time_duration rather than a ptime (aka system time). Added #include to gr_buffer.h. It turns out that boost posix_time.hpp implicitly included the deque header which was missing from gr_buffer.h Replaced the include for thread.hpp with only the includes for the boost thread types mentioned in gruel/thread.h. Also, making use of the scoped_lock typedef that comes with boost thread locks. boost 3.5 safe. --- gnuradio-core/src/lib/runtime/gr_buffer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnuradio-core') 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 #include #include +#include class gr_vmcircbuf; -- cgit From 7e2bd5adbf9828e6ca671ff5a176bff7ab48c557 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 12:52:02 -0800 Subject: uhd: fix generation typo on uhd grc blocks io direction --- gnuradio-core/src/lib/general/gr_keep_one_in_n.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gnuradio-core') diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index 85495e277..e38240a3f 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2010 Free Software Foundation, Inc. + * Copyright 2004 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,16 +31,15 @@ gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n) { - return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n)); + return gr_keep_one_in_n_sptr (new gr_keep_one_in_n (item_size, n)); } gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) : gr_block ("keep_one_in_n", gr_make_io_signature (1, 1, item_size), gr_make_io_signature (1, 1, item_size)), - d_count(n) + d_n (n), d_count(n) { - set_n(n); } void @@ -51,8 +50,6 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; - - set_relative_rate(1.0 / (float)n); } int -- cgit From 8eeba059728257812924ed5b70b9e1e97d98886f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 16:08:36 -0800 Subject: reverted accidental change to keep 1 in n block --- gnuradio-core/src/lib/general/gr_keep_one_in_n.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gnuradio-core') diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc index e38240a3f..85495e277 100644 --- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc +++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004 Free Software Foundation, Inc. + * Copyright 2004,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -31,15 +31,16 @@ gr_keep_one_in_n_sptr gr_make_keep_one_in_n (size_t item_size, int n) { - return gr_keep_one_in_n_sptr (new gr_keep_one_in_n (item_size, n)); + return gnuradio::get_initial_sptr(new gr_keep_one_in_n (item_size, n)); } gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n) : gr_block ("keep_one_in_n", gr_make_io_signature (1, 1, item_size), gr_make_io_signature (1, 1, item_size)), - d_n (n), d_count(n) + d_count(n) { + set_n(n); } void @@ -50,6 +51,8 @@ gr_keep_one_in_n::set_n(int n) d_n = n; d_count = n; + + set_relative_rate(1.0 / (float)n); } int -- cgit From a83d1cf1518827e8b5398bcecef1c8216808ee7c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 9 Mar 2011 14:31:44 -0800 Subject: audio: make prefs look like old audio, removed old audio.py --- gnuradio-core/src/python/gnuradio/Makefile.am | 3 +- gnuradio-core/src/python/gnuradio/audio.py | 88 --------------------------- 2 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 gnuradio-core/src/python/gnuradio/audio.py (limited to 'gnuradio-core') 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__() -- cgit From 6673be777cd5395ae867e67db8c95aa09066617a Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Sat, 12 Mar 2011 15:47:40 -0800 Subject: Added/updated ignore files. --- gnuradio-core/src/guile/.gitignore | 1 + 1 file changed, 1 insertion(+) (limited to 'gnuradio-core') 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 -- cgit From bf9c13870fa9766b68dbfeda9307c4a0aa5e2963 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 14 Mar 2011 11:23:19 -0700 Subject: created gruel/attributes.h to house compiler specific attribute macros replaced instances of __attribute__ with __GR_ATTR from attributes.h what else has compiler specific attributes? volk - volk is stand-alone, needs its own attributes.h gcell - not touching that, probably gcc only anyways usrp2 firmware - does not matter to host build --- gnuradio-core/src/lib/bug_work_around_6.cc | 4 ++-- gnuradio-core/src/lib/filter/qa_gr_rotator.cc | 7 ++++++- gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator_cc.cc | 7 ++++++- gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.h | 3 ++- gnuradio-core/src/lib/missing/bug_work_around_8.cc | 3 ++- 5 files changed, 18 insertions(+), 6 deletions(-) (limited to 'gnuradio-core') 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 +static int gr_bug_work_around_6 __GR_ATTR_UNUSED; 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 +#endif + +#include #include #include #include @@ -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_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 +#endif + +#include #include #include #include @@ -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/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 #include #include #include @@ -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/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 +static int gr_bug_work_around_8 __GR_ATTR_UNUSED; -- cgit From 34313eace681a82e230c38a8cd26c0001ee823ea Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 22 Mar 2011 09:34:53 -0700 Subject: audio: moved audio docs to gr-audio and fix comments --- gnuradio-core/gnuradio-core.conf | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gnuradio-core') diff --git a/gnuradio-core/gnuradio-core.conf b/gnuradio-core/gnuradio-core.conf index d64f58401..178b288e8 100644 --- a/gnuradio-core/gnuradio-core.conf +++ b/gnuradio-core/gnuradio-core.conf @@ -5,15 +5,3 @@ [DEFAULT] verbose = False - - -[audio] - -# specify which audio module to load, or use "auto" to have the system -# select one. Valid choices depend on your OS and which modules -# you've installed, but typically include: auto, audio_alsa, -# audio_oss, audio_portaudio, audio_jack, audio_osx, audio_windows - -audio_module = auto - - -- cgit From 64dac6a1f62fb8484e879f0d20ee60bc02da179c Mon Sep 17 00:00:00 2001 From: Don Ward Date: Fri, 25 Mar 2011 11:53:04 -0400 Subject: Fixing missing include files and various other patches for Windows build issues. --- gnuradio-core/src/lib/filter/qa_gri_fir_filter_with_buffer_ccc.cc | 7 ++++--- gnuradio-core/src/lib/io/gr_tagged_file_sink.cc | 1 - gnuradio-core/src/lib/io/gr_tagged_file_sink.h | 1 + gnuradio-core/src/lib/io/gr_wavfile_source.cc | 1 - gnuradio-core/src/lib/io/gr_wavfile_source.h | 1 + gnuradio-core/src/lib/runtime/gr_error_handler.cc | 1 - gnuradio-core/src/lib/runtime/gr_error_handler.h | 1 + gnuradio-core/src/tests/benchmark_dotprod_ccc.cc | 8 +++++--- gnuradio-core/src/tests/benchmark_dotprod_ccf.cc | 8 +++++--- 9 files changed, 17 insertions(+), 12 deletions(-) (limited to 'gnuradio-core') 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/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 #include -#include #include #include #include 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 +#include // for FILE class gr_tagged_file_sink; typedef boost::shared_ptr gr_tagged_file_sink_sptr; 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 #include #include -#include #include #include #include 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 +#include // for FILE class gr_wavfile_source; typedef boost::shared_ptr gr_wavfile_source_sptr; 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 #include #include -#include #ifdef HAVE_IO_H #include 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 #include +#include // for FILE /*! * \brief abstract error handler 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 -- cgit From a111deb45559296d6eadded9226df68af21c0477 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 16 Mar 2011 14:51:58 -0700 Subject: runtime: changes to block headers to allow pure virtual sub-classes (interfaces) --- gnuradio-core/src/lib/runtime/gr_basic_block.h | 2 ++ gnuradio-core/src/lib/runtime/gr_block.h | 2 +- gnuradio-core/src/lib/runtime/gr_sync_block.h | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'gnuradio-core') 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_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); -- cgit From 3ff8f7a5545592a9dac201a27d18bfdae4cdcb7b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 16 Mar 2011 15:36:36 -0700 Subject: throttle: cleanup conditional code and reimplement with boost posix time This greatly cleans up gr_throttle and moves the implementation into the .cc file. The implementation uses boost's posix time library so it will work on all systems. Also added set_sample_rate() method and support for callback in grc. --- gnuradio-core/src/lib/general/gr_throttle.cc | 136 +++++++++++---------------- gnuradio-core/src/lib/general/gr_throttle.h | 33 ++----- gnuradio-core/src/lib/general/gr_throttle.i | 13 ++- 3 files changed, 67 insertions(+), 115 deletions(-) (limited to 'gnuradio-core') 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 #include -#include -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#if !defined(HAVE_NANOSLEEP) && defined(HAVE_SSLEEP) -#include -#endif - +#include +#include -#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 -#ifdef HAVE_SYS_TIME_H -#include -#endif - -class gr_throttle; -typedef boost::shared_ptr 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 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_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 -- cgit From eca5501969aa6175562b7e70b350cf3e6ddec603 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 4 Apr 2011 08:12:21 -0400 Subject: pfb: fixed documentation for PFB-based clock sync. --- gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnuradio-core') 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) The filter taps. * \param filter_size (uint) The number of filters in the filterbank (default = 32). -- cgit From e36dc98e5f5aa82b146007c0379b6e55eca40578 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 7 Apr 2011 11:09:51 -0400 Subject: core: adding a type converter - int -> float. --- gnuradio-core/src/lib/general/Makefile.am | 2 + gnuradio-core/src/lib/general/general.i | 2 + gnuradio-core/src/lib/general/gr_int_to_float.cc | 59 ++++++++++++++++++++++++ gnuradio-core/src/lib/general/gr_int_to_float.h | 51 ++++++++++++++++++++ gnuradio-core/src/lib/general/gr_int_to_float.i | 30 ++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.cc create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.h create mode 100644 gnuradio-core/src/lib/general/gr_int_to_float.i (limited to 'gnuradio-core') diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3ceea7a6d..c36e7d7e7 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 \ 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 #include #include +#include #include #include #include @@ -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_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc new file mode 100644 index 000000000..c60157e34 --- /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 +#include + +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 + +class gr_int_to_float; +typedef boost::shared_ptr 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 (); +}; -- cgit From 82c41716e7ad1642266fefa819b60e674142e79b Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 7 Apr 2011 16:40:54 -0400 Subject: core: adding QA code for int_to_float block. --- gnuradio-core/src/lib/general/gr_int_to_float.cc | 10 ++--- gnuradio-core/src/python/gnuradio/gr/Makefile.am | 1 + .../src/python/gnuradio/gr/qa_int_to_float.py | 49 ++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) create mode 100755 gnuradio-core/src/python/gnuradio/gr/qa_int_to_float.py (limited to 'gnuradio-core') diff --git a/gnuradio-core/src/lib/general/gr_int_to_float.cc b/gnuradio-core/src/lib/general/gr_int_to_float.cc index c60157e34..b5a19e5c0 100644 --- a/gnuradio-core/src/lib/general/gr_int_to_float.cc +++ b/gnuradio-core/src/lib/general/gr_int_to_float.cc @@ -42,15 +42,15 @@ gr_int_to_float::gr_int_to_float () int gr_int_to_float::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_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; intaps()); + (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, -- cgit