diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-02-03 15:36:58 +0100 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-02-03 15:36:58 +0100 |
commit | a35e10870bbb9a71b3ab66b1dc58135e08c9543e (patch) | |
tree | a9b1df0f4acc58c6615a15442495292827b8ca40 | |
parent | a212beb816781416d24d1c2b7ea31265ad702f33 (diff) | |
parent | 7365f030cdc690c00a0cd7d2dc418275495243e9 (diff) |
Merge branch 'maint'
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | README.building-boost | 14 | ||||
-rw-r--r-- | README.hacking | 16 | ||||
-rw-r--r-- | cmake/Modules/CodeCoverage.cmake | 4 | ||||
-rw-r--r-- | docs/doxygen/other/build_guide.dox.in | 12 | ||||
-rw-r--r-- | docs/doxygen/other/volk_guide.dox | 3 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/block.h | 16 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/fxpt.h | 5 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/thrift/README | 2 | ||||
-rw-r--r-- | gnuradio-runtime/lib/math/fxpt.cc | 1 | ||||
-rw-r--r-- | gnuradio-runtime/lib/math/random.cc | 12 | ||||
-rw-r--r-- | gr-analog/include/gnuradio/analog/agc.h | 4 | ||||
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/rotator.h | 7 | ||||
-rw-r--r-- | gr-digital/lib/kurtotic_equalizer_cc_impl.h | 37 | ||||
-rw-r--r-- | gr-qtgui/include/gnuradio/qtgui/form_menus.h | 4 | ||||
-rw-r--r-- | gr-utils/python/modtool/templates.py | 4 |
16 files changed, 85 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a832cf20ed..faa34324dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -410,7 +410,7 @@ endif() if(${CMAKE_BUILD_TYPE} STREQUAL "Coverage") include(CodeCoverage) - setup_target_for_coverage(coverage "ctest" coverage) + setup_target_for_coverage(coverage "ctest || exit 0" coverage) endif() diff --git a/README.building-boost b/README.building-boost index 3fbd5ff0af..e75ccda692 100644 --- a/README.building-boost +++ b/README.building-boost @@ -6,14 +6,20 @@ If running a distribution that requires boost 1.35 (or later) be built from scratch, these instructions explain how to do so, and in a way that allows it to peacefully coexist with earlier versions of boost. -There are two recommended methods: -Installing boost using the PyBOMBS utility, or building it from a source -tarball. +Notice that this is **not** the usual case. If you're using a Linux distribution +shipping a boost version prior to 1.35, you should very strongly consider just +updating to a more recent version. Even CentOS / RedHat 6.9 ship sufficiently +recent versions. Distributions older than that are generally considered to be +end-of-life. + +There are two recommended methods (aside from the far more recommended method of +upgrading your system): Installing boost using the PyBOMBS utility, or building +it from a source tarball. 1. Installing Boost using PyBOMBS --------------------------------- -Following http://gnuradio.org/redmine/projects/pybombs/wiki/Using you can +You can install a recent boost by downloading and executing the PyBOMBS utility: # go to a directory you have write access to diff --git a/README.hacking b/README.hacking index 2d0a1c395f..ca8efab388 100644 --- a/README.hacking +++ b/README.hacking @@ -1,6 +1,6 @@ # -*- Outline -*- # -# Copyright 2004,2007,2008,2009 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2009,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,6 +20,17 @@ # Boston, MA 02110-1301, USA. # +* Getting started with GNU Radio development. + +If you're new to developing software with GNU Radio, please refer to + +https://tutorials.gnuradio.org/ + +Heaving read this will be very helpful when you're diving into the GNU Radio +source code tree. + +* About this document + Random notes on coding conventions, some explanations about why things aren't done differently, etc, etc, @@ -112,7 +123,8 @@ you and later maintainers identify corner cases, regressions and other malfuncti of code. GNU Radio has integrated versatile, easy to use testing facilities. Please refer to -http://gnuradio.org/redmine/projects/gnuradio/wiki/Coding_guide_impl#Unit-testing + +https://wiki.gnuradio.org/index.php/Coding_guide_impl#Unit-testing * Standard command line options diff --git a/cmake/Modules/CodeCoverage.cmake b/cmake/Modules/CodeCoverage.cmake index a0b0ef5269..4e96e3b3f9 100644 --- a/cmake/Modules/CodeCoverage.cmake +++ b/cmake/Modules/CodeCoverage.cmake @@ -146,9 +146,9 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) # Capturing lcov counters and generating report COMMAND ${LCOV_PATH} --directory . --capture --output-file ${coverage_info} - COMMAND ${LCOV_PATH} --remove ${coverage_info} 'tests/*' '/usr/*' --output-file ${coverage_cleaned} + COMMAND ${LCOV_PATH} --remove ${coverage_info} 'tests/*' '/usr/*' 'swig/*' '*/swig/*' '*/qa_*' --output-file ${coverage_cleaned} COMMAND ${GENHTML_PATH} -o ${_outputname} ${coverage_cleaned} - COMMAND ${CMAKE_COMMAND} -E remove ${coverage_info} ${coverage_cleaned} + # Don't remove fragments so CI can upload them to codecov WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." diff --git a/docs/doxygen/other/build_guide.dox.in b/docs/doxygen/other/build_guide.dox.in index 92ef5dad24..8169cea9fc 100644 --- a/docs/doxygen/other/build_guide.dox.in +++ b/docs/doxygen/other/build_guide.dox.in @@ -20,7 +20,7 @@ binary installation process (the <b>apt-get</b> or \b apt system in Debian and Ubuntu, <b>yum</b> or \b dnf in RedHat and Fedora, etc.). GNU Radio tries to keep an up-to-date build guide for the majority of the supported operating systems on gnuradio.org -(http://gnuradio.org/redmine/projects/gnuradio/wiki/BuildGuide). +(https://wiki.gnuradio.org/index.php/BuildGuide). Not all dependencies are required for all components, and not all components are required for a given installation. The list of required @@ -39,6 +39,7 @@ first. Most recent systems have these packages available. \li boost (>= @GR_BOOST_MIN_VERSION@) http://www.boost.org/users/download/ \li cppunit (>= @GR_CPPUNIT_MIN_VERSION@) http://freedesktop.org/wiki/Software/cppunit/ \li mako (>= @GR_MAKO_MIN_VERSION@) http://www.makotemplates.org/download.html +\li log4cpp (>= 1.0) http://log4cpp.sourceforge.net/ A C/C++ compiler is also required. These are known to work: @@ -92,16 +93,12 @@ audio-osx and audio-windows to be either satisfied or built. \subsection dep_uhd uhd: The Ettus USRP Hardware Driver Interface \li uhd (>= 3.5.5) https://www.ettus.com/downloads -\subsection dep_gr_video_sdl gr-video-sdl: PAL and NTSC display +\subsection dep_gr_video_sdl gr-video-sdl: PAL and NTSC display (rarely used) \li SDL (>= 1.2.0) http://www.libsdl.org/download-1.2.php -\subsection dep_gr_comedi gr-comedi: Comedi hardware interface +\subsection dep_gr_comedi gr-comedi: Comedi hardware interface (only if you know what this is) \li comedilib (>= 0.8.1) http://www.comedi.org/ -\subsection dep_gr_log gr-log: Logging Tools (Optional) -\li log4cpp (>= 1.0) http://log4cpp.sourceforge.net/ - - <b>Optional</b> \ref page_ctrlport may use various backends to perform the RPC @@ -112,7 +109,6 @@ Currently, ControlPort only supports the Apache Thrift backend. \li thrift (>= 0.9.2) https://thrift.apache.org/ - \section build_gr_cmake Building GNU Radio GNU Radio is built using the CMake build system diff --git a/docs/doxygen/other/volk_guide.dox b/docs/doxygen/other/volk_guide.dox index e5a55c1719..1f8f128e4b 100644 --- a/docs/doxygen/other/volk_guide.dox +++ b/docs/doxygen/other/volk_guide.dox @@ -51,8 +51,7 @@ all else fails, VOLK can fall back on the generic proto-kernel, which will always work. See <a -href="http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk">VOLK on -gnuradio.org</a> for details on the VOLK naming scheme. +href="http://libvolk.org</a> for details on the VOLK naming scheme. \section volk_alignment Setting and Using Memory Alignment Information diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index eb547f3022..473b94c155 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -240,13 +240,19 @@ namespace gr { /*! * \brief Tell the scheduler \p how_many_items of input stream \p * which_input were consumed. - * This function should be called at the end of work() or general_work(), after all processing is finished. + * + * This function should be used in general_work() to tell the scheduler the + * number of input items processed. Calling consume() multiple times in the + * same general_work() call is safe. Every invocation of consume() updates + * the values returned by nitems_read(). */ void consume(int which_input, int how_many_items); /*! * \brief Tell the scheduler \p how_many_items were consumed on * each input stream. + * + * Also see notes on consume(). */ void consume_each(int how_many_items); @@ -254,8 +260,12 @@ namespace gr { * \brief Tell the scheduler \p how_many_items were produced on * output stream \p which_output. * - * If the block's general_work method calls produce, \p - * general_work must return WORK_CALLED_PRODUCE. + * This function should be used in general_work() to tell the scheduler the + * number of output items produced. If produce() is called in + * general_work(), general_work() must return \p WORK_CALLED_PRODUCE. + * Calling produce() multiple times in the same general_work() call is safe. + * Every invocation of produce() updates the values returned by + * nitems_written(). */ void produce(int which_output, int how_many_items); diff --git a/gnuradio-runtime/include/gnuradio/fxpt.h b/gnuradio-runtime/include/gnuradio/fxpt.h index ded32ed36e..61c7400d01 100644 --- a/gnuradio-runtime/include/gnuradio/fxpt.h +++ b/gnuradio-runtime/include/gnuradio/fxpt.h @@ -45,6 +45,7 @@ namespace gr { static const int NBITS = 10; static const float s_sine_table[1 << NBITS][2]; static const float PI; + static const float TAU; static const float TWO_TO_THE_31; public: @@ -52,8 +53,8 @@ namespace gr { float_to_fixed(float x) { // Fold x into -PI to PI. - int d = (int)floor(x/2/PI+0.5); - x -= d*2*PI; + int d = (int)std::floor(x/TAU+0.5); + x -= d*TAU; // And convert to an integer. return (int32_t) ((float) x * TWO_TO_THE_31 / PI); } diff --git a/gnuradio-runtime/lib/controlport/thrift/README b/gnuradio-runtime/lib/controlport/thrift/README index 5448e512f7..233dda9362 100644 --- a/gnuradio-runtime/lib/controlport/thrift/README +++ b/gnuradio-runtime/lib/controlport/thrift/README @@ -1,6 +1,6 @@ For info on ControlPort and Thrift, see the wiki page: -http://gnuradio.org/redmine/projects/gnuradio/wiki/ControlPort +https://wiki.gnuradio.org/index.php/ControlPort This readme is to address the patch file in the repo for Thrift. We believe that there is a bug in Thrift itself that occasionally causes diff --git a/gnuradio-runtime/lib/math/fxpt.cc b/gnuradio-runtime/lib/math/fxpt.cc index 23fdda1241..b40b082194 100644 --- a/gnuradio-runtime/lib/math/fxpt.cc +++ b/gnuradio-runtime/lib/math/fxpt.cc @@ -33,6 +33,7 @@ namespace gr { }; const float fxpt::PI = 3.14159265358979323846; + const float fxpt::TAU = 2.0 * 3.14159265358979323846; const float fxpt::TWO_TO_THE_31 = 2147483648.0; } /* namespace gr */ diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc index 59f2f22bd0..401ba89735 100644 --- a/gnuradio-runtime/lib/math/random.cc +++ b/gnuradio-runtime/lib/math/random.cc @@ -130,8 +130,8 @@ namespace gr { s = x*x+y*y; }while(s >= 1.0f || s == 0.0f); d_gauss_stored = true; - d_gauss_value = x*sqrt(-2.0*log(s)/s); - return y*sqrt(-2.0*log(s)/s); + d_gauss_value = x*sqrtf(-2.0*logf(s)/s); + return y*sqrtf(-2.0*logf(s)/s); } } @@ -139,8 +139,8 @@ namespace gr { random::laplacian() { float z = ran1()-0.5; - if(z>0) return -log(1-2*z); - else return log(1+2*z); + if(z>0) return -logf(1-2*z); + else return logf(1+2*z); } /* @@ -151,7 +151,7 @@ namespace gr { float random::impulse(float factor = 5) { - float z = -M_SQRT2 * log(ran1()); + float z = -M_SQRT2 * logf(ran1()); if(fabsf(z) <= factor) return 0.0; else @@ -167,7 +167,7 @@ namespace gr { float random::rayleigh() { - return sqrt(-2.0 * log(ran1())); + return sqrtf(-2.0 * logf(ran1())); } } /* namespace gr */ diff --git a/gr-analog/include/gnuradio/analog/agc.h b/gr-analog/include/gnuradio/analog/agc.h index 44896250d4..1e9759c454 100644 --- a/gr-analog/include/gnuradio/analog/agc.h +++ b/gr-analog/include/gnuradio/analog/agc.h @@ -25,7 +25,7 @@ #include <gnuradio/analog/api.h> #include <gnuradio/gr_complex.h> -#include <math.h> +#include <cmath> namespace gr { namespace analog { @@ -70,7 +70,7 @@ namespace gr { { gr_complex output = input * _gain; - _gain += _rate * (_reference - sqrt(output.real()*output.real() + + _gain += _rate * (_reference - std::sqrt(output.real()*output.real() + output.imag()*output.imag())); if(_max_gain > 0.0 && _gain > _max_gain) { _gain = _max_gain; diff --git a/gr-blocks/include/gnuradio/blocks/rotator.h b/gr-blocks/include/gnuradio/blocks/rotator.h index 66843fde07..978297716d 100644 --- a/gr-blocks/include/gnuradio/blocks/rotator.h +++ b/gr-blocks/include/gnuradio/blocks/rotator.h @@ -26,6 +26,7 @@ #include <gnuradio/blocks/api.h> #include <gnuradio/gr_complex.h> #include <volk/volk.h> +#include <cmath> namespace gr { namespace blocks { @@ -41,8 +42,8 @@ namespace gr { rotator() : d_phase(1), d_phase_incr(1), d_counter(0) { } - void set_phase(gr_complex phase) { d_phase = phase / abs(phase); } - void set_phase_incr(gr_complex incr) { d_phase_incr = incr / abs(incr); } + void set_phase(gr_complex phase) { d_phase = phase / std::abs(phase); } + void set_phase_incr(gr_complex incr) { d_phase_incr = incr / std::abs(incr); } gr_complex rotate(gr_complex in) { @@ -52,7 +53,7 @@ namespace gr { d_phase *= d_phase_incr; // incr our phase (complex mult == add phases) if((d_counter % 512) == 0) - d_phase /= abs(d_phase); // Normalize to ensure multiplication is rotation + d_phase /= std::abs(d_phase); // Normalize to ensure multiplication is rotation return z; } diff --git a/gr-digital/lib/kurtotic_equalizer_cc_impl.h b/gr-digital/lib/kurtotic_equalizer_cc_impl.h index 914eaea578..672624981e 100644 --- a/gr-digital/lib/kurtotic_equalizer_cc_impl.h +++ b/gr-digital/lib/kurtotic_equalizer_cc_impl.h @@ -27,6 +27,7 @@ #include <gnuradio/filter/fir_filter.h> #include <gnuradio/math.h> #include <stdexcept> +#include <complex> namespace gr { namespace digital { @@ -51,30 +52,30 @@ namespace gr { } protected: - virtual gr_complex error(const gr_complex &out) + virtual gr_complex error(const gr_complex &out) { // p = E[|z|^2] // q = E[z^2] // m = E[|z|^4] // u = E[kurtosis(z)] - float nrm = norm(out); - gr_complex cnj = conj(out); - float epsilon_f = 1e-12; - gr_complex epsilon_c = gr_complex(1e-12, 1e-12); - - d_p = (1-d_alpha_p)*d_p + (d_alpha_p)*nrm + epsilon_f; - d_q = (1-d_alpha_q)*d_q + (d_alpha_q)*out*out + epsilon_c; - d_m = (1-d_alpha_m)*d_m + (d_alpha_m)*nrm*nrm + epsilon_f; - d_u = d_m - 2.0f*(d_p*d_p) - d_q*d_q; - - gr_complex F = (1.0f / (d_p*d_p*d_p)) * - (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - conj(d_q)*out) - - abs(d_u)*cnj); - - float re = gr::clip(F.real(), 1.0); - float im = gr::clip(F.imag(), 1.0); - return gr_complex(re, im); + float nrm = std::norm(out); + gr_complex cnj = std::conj(out); + float epsilon_f = 1e-12; + gr_complex epsilon_c = gr_complex(1e-12, 1e-12); + + d_p = (1-d_alpha_p)*d_p + (d_alpha_p)*nrm + epsilon_f; + d_q = (1-d_alpha_q)*d_q + (d_alpha_q)*out*out + epsilon_c; + d_m = (1-d_alpha_m)*d_m + (d_alpha_m)*nrm*nrm + epsilon_f; + d_u = d_m - 2.0f*(d_p*d_p) - d_q*d_q; + + gr_complex F = (1.0f / (d_p*d_p*d_p)) * + (sign(d_u) * (nrm*cnj - 2.0f*d_p*cnj - std::conj(d_q)*out) - + std::abs(d_u)*cnj); + + float re = gr::clip(F.real(), 1.0); + float im = gr::clip(F.imag(), 1.0); + return gr_complex(re, im); } virtual void update_tap(gr_complex &tap, const gr_complex &in) diff --git a/gr-qtgui/include/gnuradio/qtgui/form_menus.h b/gr-qtgui/include/gnuradio/qtgui/form_menus.h index cb9b775e8b..5c77f825d8 100644 --- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h +++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h @@ -698,9 +698,9 @@ public: QAction * getActionFromSize(int size) { float ipt; - float which = logf(static_cast<float>(size))/logf(2.0) - 5; + float which = std::log(static_cast<float>(size))/std::log(2.0f) - 5; // If we're a predefined value - if(modff(which,&ipt) == 0) { + if(std::modf(which,&ipt) == 0) { if(which < d_act.size()-1) return d_act[static_cast<int>(which)]; else diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py index 2804224892..c88d3d7ea6 100644 --- a/gr-utils/python/modtool/templates.py +++ b/gr-utils/python/modtool/templates.py @@ -349,12 +349,12 @@ import numpy #if $blocktype == 'source' #set $inputsig = 'None' #else -#set $inputsig = '[<+numpy.float+>]' +#set $inputsig = '[<+numpy.float32+>]' #end if #if $blocktype == 'sink' #set $outputsig = 'None' #else -#set $outputsig = '[<+numpy.float+>]' +#set $outputsig = '[<+numpy.float32+>]' #end if #else #if $blocktype == 'source' |