GNU Radio 3.3.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2008 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 #ifndef INCLUDED_GR_PROBE_MPSK_SNR_C_H 00023 #define INCLUDED_GR_PROBE_MPSK_SNR_C_H 00024 00025 #include <gr_sync_block.h> 00026 00027 class gr_probe_mpsk_snr_c; 00028 typedef boost::shared_ptr<gr_probe_mpsk_snr_c> gr_probe_mpsk_snr_c_sptr; 00029 00030 gr_probe_mpsk_snr_c_sptr 00031 gr_make_probe_mpsk_snr_c(double alpha = 0.0001); 00032 00033 /*! 00034 * Compute the estimate SNR of an MPSK signal using the Squared Signal 00035 * to Noise Variance (SNV) technique. 00036 * 00037 * This technique assumes an AWGN channel. 00038 * 00039 * \param alpha Mean and variance smoothing filter constant 00040 * \ingroup sink_blk 00041 * 00042 * Compute the running average of the signal mean and noise variance. 00043 * The estimated signal mean, noise variance, and SNR are available 00044 * via accessors. 00045 * 00046 * This SNR estimator is inaccurate below about 7dB SNR. 00047 * 00048 */ 00049 class gr_probe_mpsk_snr_c : public gr_sync_block 00050 { 00051 double d_alpha; 00052 double d_beta; 00053 double d_signal_mean; 00054 double d_noise_variance; 00055 00056 // Factory function returning shared pointer of this class 00057 friend gr_probe_mpsk_snr_c_sptr 00058 gr_make_probe_mpsk_snr_c(double alpha); 00059 00060 // Private constructor 00061 gr_probe_mpsk_snr_c(double alpha); 00062 00063 public: 00064 ~gr_probe_mpsk_snr_c(); 00065 00066 int work (int noutput_items, 00067 gr_vector_const_void_star &input_items, 00068 gr_vector_void_star &output_items); 00069 00070 // Return the estimated signal mean 00071 double signal_mean() const { return d_signal_mean; } 00072 00073 // Return the estimated noise variance 00074 double noise_variance() const { return d_noise_variance; } 00075 00076 // Return the estimated signal-to-noise ratio in decibels 00077 double snr() const; 00078 00079 void set_alpha(double alpha); 00080 }; 00081 00082 #endif /* INCLUDED_GR_PROBE_MPSK_SNR_C_H */