diff options
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/general/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.cc | 85 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h | 83 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.i | 39 |
5 files changed, 0 insertions, 210 deletions
diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 1d1da247c..207d85c4c 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -286,7 +286,6 @@ set(gr_core_general_triple_threats gr_unpack_k_bits_bb gr_descrambler_bb gr_scrambler_bb - gr_probe_mpsk_snr_c gr_probe_density_b gr_annotator_alltoall gr_annotator_1to1 diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index bf8bc163f..f7759c614 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -125,7 +125,6 @@ #include <gr_decode_ccsds_27_fb.h> #include <gr_descrambler_bb.h> #include <gr_scrambler_bb.h> -#include <gr_probe_mpsk_snr_c.h> #include <gr_probe_density_b.h> #include <gr_rail_ff.h> #include <gr_stretch_ff.h> @@ -243,7 +242,6 @@ %include "gr_decode_ccsds_27_fb.i" %include "gr_descrambler_bb.i" %include "gr_scrambler_bb.i" -%include "gr_probe_mpsk_snr_c.i" %include "gr_probe_density_b.i" %include "gr_rail_ff.i" %include "gr_stretch_ff.i" diff --git a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.cc b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.cc deleted file mode 100644 index fed9ad66e..000000000 --- a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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_probe_mpsk_snr_c.h> -#include <gr_io_signature.h> - -gr_probe_mpsk_snr_c_sptr -gr_make_probe_mpsk_snr_c(double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_mpsk_snr_c(alpha)); -} - -gr_probe_mpsk_snr_c::gr_probe_mpsk_snr_c(double alpha) - : gr_sync_block ("probe_mpsk_snr_c", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - gr_make_io_signature(0, 0, 0)), - d_signal_mean(0.0), - d_noise_variance(0.0) -{ - set_alpha(alpha); -} - -gr_probe_mpsk_snr_c::~gr_probe_mpsk_snr_c() -{ -} - -int -gr_probe_mpsk_snr_c::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - - for (int i = 0; i < noutput_items; i++){ - // Update of signal mean estimate - double mag = abs(in[i]); - d_signal_mean = d_alpha*abs(in[i]) + d_beta*d_signal_mean; - - // Update noise variance estimate - double noise = mag-d_signal_mean; - double var = noise*noise; - d_noise_variance = d_alpha*var + d_beta*d_noise_variance; - } - - return noutput_items; -} - -double -gr_probe_mpsk_snr_c::snr() const -{ - if (d_noise_variance == 0.0) - return 0.0; - else - return 10*log10(d_signal_mean*d_signal_mean/d_noise_variance); -} - -void -gr_probe_mpsk_snr_c::set_alpha(double alpha) -{ - d_alpha = alpha; - d_beta = 1.0-alpha; -} diff --git a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h deleted file mode 100644 index 870e46701..000000000 --- a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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_PROBE_MPSK_SNR_C_H -#define INCLUDED_GR_PROBE_MPSK_SNR_C_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_probe_mpsk_snr_c; -typedef boost::shared_ptr<gr_probe_mpsk_snr_c> gr_probe_mpsk_snr_c_sptr; - -GR_CORE_API gr_probe_mpsk_snr_c_sptr -gr_make_probe_mpsk_snr_c(double alpha = 0.0001); - -/*! - * Compute the estimate SNR of an MPSK signal using the Squared Signal - * to Noise Variance (SNV) technique. - * - * This technique assumes an AWGN channel. - * - * \param alpha Mean and variance smoothing filter constant - * \ingroup sink_blk - * - * Compute the running average of the signal mean and noise variance. - * The estimated signal mean, noise variance, and SNR are available - * via accessors. - * - * This SNR estimator is inaccurate below about 7dB SNR. - * - */ -class GR_CORE_API gr_probe_mpsk_snr_c : public gr_sync_block -{ - double d_alpha; - double d_beta; - double d_signal_mean; - double d_noise_variance; - - // Factory function returning shared pointer of this class - friend GR_CORE_API gr_probe_mpsk_snr_c_sptr - gr_make_probe_mpsk_snr_c(double alpha); - - // Private constructor - gr_probe_mpsk_snr_c(double alpha); - -public: - ~gr_probe_mpsk_snr_c(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - // Return the estimated signal mean - double signal_mean() const { return d_signal_mean; } - - // Return the estimated noise variance - double noise_variance() const { return d_noise_variance; } - - // Return the estimated signal-to-noise ratio in decibels - double snr() const; - - void set_alpha(double alpha); -}; - -#endif /* INCLUDED_GR_PROBE_MPSK_SNR_C_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.i b/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.i deleted file mode 100644 index 37a86b23d..000000000 --- a/gnuradio-core/src/lib/general/gr_probe_mpsk_snr_c.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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,probe_mpsk_snr_c); - -gr_probe_mpsk_snr_c_sptr -gr_make_probe_mpsk_snr_c(double alpha = 0.0001); - -class gr_probe_mpsk_snr_c : public gr_sync_block -{ -private: - void gr_probe_mpsk_snr_c(double alpha); - -public: - double signal_mean(); - double noise_variance(); - double snr(); - - void set_alpha (double alpha); -}; |