From 8769e6e74d19beb53ff9ed194b03ca76d924da6b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Feb 2017 15:22:47 +0100 Subject: [PATCH] Fix building in Ubuntu 15.04 --- .../gnuradio_blocks/pulse_blanking_cc.cc | 21 +++++++++---------- .../gnuradio_blocks/pulse_blanking_cc.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc index 06b147cb3..f2ec0f198 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.cc @@ -28,14 +28,13 @@ * ------------------------------------------------------------------------- */ - #include "pulse_blanking_cc.h" - +#include +#include #include -#include #include #include -#include + pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa) { @@ -50,7 +49,7 @@ pulse_blanking_cc::pulse_blanking_cc(double Pfa) : gr::block("pulse_blanking_cc" { const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex); set_alignment(std::max(1, alignment_multiple)); - d_Pfa=Pfa; + d_Pfa = Pfa; } @@ -74,18 +73,18 @@ int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), var /= static_cast(noutput_items); // compute pulse blanking threshold (Paper Borio 2016) - float Th=sqrt(-2.0*var*log10(d_Pfa)); + float Th = sqrt(-2.0 * var * log10(d_Pfa)); //apply the pulse blanking //todo: write volk kernel to optimize the blanking memcpy(out,in, sizeof(gr_complex)*noutput_items); - for (int n=0;nTh) + for (int n = 0; n < noutput_items; n++) { - out[n]=gr_complex(0,0); + if (std::abs(out[n]) > Th) + { + out[n] = gr_complex(0,0); + } } - } consume_each(noutput_items); return noutput_items; } diff --git a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h index 3768af7d0..8e23d39ad 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h +++ b/src/algorithms/input_filter/gnuradio_blocks/pulse_blanking_cc.h @@ -47,7 +47,7 @@ pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa); class pulse_blanking_cc : public gr::block { private: - friend pulse_blanking_cc_sptr pulse_blanking_cc(double Pfa); + friend pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa); double d_Pfa; public: pulse_blanking_cc(double Pfa);