diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2017-01-30 05:17:51 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2017-01-30 05:17:51 -0800 |
commit | 884eddf41e1f35606d563c128e4070f930a4d2ab (patch) | |
tree | 90847c0e89ac2224c878aa3a40d404e7e0818cf5 | |
parent | b19cc051bab29b2eeadce979f3c4cb0e58829042 (diff) | |
parent | 26a882e5ae12ee26ba9c2788ed27164896993f3d (diff) |
Merge remote-tracking branch 'bastibl/peak-detector-init' into maint
-rw-r--r-- | gr-blocks/lib/peak_detector2_fb_impl.cc | 3 | ||||
-rw-r--r-- | gr-blocks/lib/peak_detector_XX_impl.cc.t | 3 | ||||
-rw-r--r-- | gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc | 9 |
3 files changed, 9 insertions, 6 deletions
diff --git a/gr-blocks/lib/peak_detector2_fb_impl.cc b/gr-blocks/lib/peak_detector2_fb_impl.cc index dc13e66dbe..f361ea18bb 100644 --- a/gr-blocks/lib/peak_detector2_fb_impl.cc +++ b/gr-blocks/lib/peak_detector2_fb_impl.cc @@ -27,6 +27,7 @@ #include "peak_detector2_fb_impl.h" #include <gnuradio/io_signature.h> #include <string.h> +#include <limits> namespace gr { namespace blocks { @@ -109,7 +110,7 @@ namespace gr { sigout[i]=d_avg; if(iptr[i] > d_avg * (1.0f + d_threshold_factor_rise)) { d_found = true; - d_peak_val = -(float)INFINITY; + d_peak_val = std::numeric_limits<float>::min(); set_output_multiple(d_look_ahead); return i; } diff --git a/gr-blocks/lib/peak_detector_XX_impl.cc.t b/gr-blocks/lib/peak_detector_XX_impl.cc.t index 6846a02df0..3ad5f3c8fe 100644 --- a/gr-blocks/lib/peak_detector_XX_impl.cc.t +++ b/gr-blocks/lib/peak_detector_XX_impl.cc.t @@ -29,6 +29,7 @@ #include "@NAME_IMPL@.h" #include <gnuradio/io_signature.h> #include <string.h> +#include <limits> namespace gr { namespace blocks { @@ -70,7 +71,7 @@ namespace gr { memset(optr, 0, noutput_items*sizeof(char)); - @I_TYPE@ peak_val = -(@I_TYPE@)INFINITY; + @I_TYPE@ peak_val = std::numeric_limits<@I_TYPE@>::min(); int peak_ind = 0; unsigned char state = 0; int i = 0; diff --git a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc index 135d622eef..1a347d3d8d 100644 --- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc @@ -25,6 +25,7 @@ #include <gnuradio/io_signature.h> #include "dvbt_ofdm_sym_acquisition_impl.h" #include <complex> +#include <limits> #include <gnuradio/math.h> #include <gnuradio/expj.h> #include <volk/volk.h> @@ -37,8 +38,8 @@ namespace gr { { d_avg_alpha = alpha; d_threshold_factor_rise = threshold_factor_rise; - d_avg_max = - (float)INFINITY; - d_avg_min = (float)INFINITY; + d_avg_max = std::numeric_limits<float>::min(); + d_avg_min = std::numeric_limits<float>::max(); return (0); } @@ -54,7 +55,7 @@ namespace gr { peak_pos_length = 1; if (datain_length >= d_fft_length) { float min = datain[(peak_index + d_fft_length / 2) % d_fft_length]; - if (d_avg_min == (float)INFINITY) { + if (d_avg_min == std::numeric_limits<float>::max()) { d_avg_min = min; } else { @@ -62,7 +63,7 @@ namespace gr { } } - if (d_avg_max == -(float)INFINITY) { + if (d_avg_max == std::numeric_limits<float>::min()) { // Initialize d_avg_max with the first value. d_avg_max = datain[peak_index]; } |