GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2012 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 00023 00024 #ifndef INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H 00025 #define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H 00026 00027 #include <analog/api.h> 00028 #include <gr_sync_block.h> 00029 00030 namespace gr { 00031 namespace analog { 00032 00033 /*! 00034 * \brief Detects a plateau and marks the middle. 00035 * 00036 * \details 00037 * Detect a plateau of a-priori known height. Input is a stream of floats, 00038 * the output is a stream of bytes. Whenever a plateau is detected, the 00039 * middle of that plateau is marked with a '1' on the output stream (all 00040 * other samples are left at zero). 00041 * 00042 * You can use this in a Schmidl & Cox synchronisation algorithm to interpret 00043 * the output of the normalized correlator. Just pass the length of the cyclic 00044 * prefix (in samples) as the max_len parameter). 00045 * 00046 * Unlike the peak detectors, you must the now the absolute height of the plateau. 00047 * Whenever the amplitude exceeds the given threshold, it starts assuming the 00048 * presence of a plateau. 00049 * 00050 * An implicit hysteresis is provided by the fact that after detecting one plateau, 00051 * it waits at least max_len samples before the next plateau can be detected. 00052 */ 00053 class ANALOG_API plateau_detector_fb : virtual public gr_sync_block 00054 { 00055 public: 00056 typedef boost::shared_ptr<plateau_detector_fb> sptr; 00057 00058 /*! 00059 * \param max_len Maximum length of the plateau 00060 * \param threshold Anything above this value is considered a plateau 00061 */ 00062 static sptr make(int max_len, float threshold=0.9); 00063 }; 00064 00065 } // namespace analog 00066 } // namespace gr 00067 00068 #endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H */ 00069