GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
notch_lite_cc.h
Go to the documentation of this file.
1 /*!
2  * \file notch_lite_cc.h
3  * \brief Implements a notch filter light algorithm
4  * \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
9  *
10  * GNSS-SDR is a software defined Global Navigation
11  * Satellite Systems receiver
12  *
13  * This file is part of GNSS-SDR.
14  *
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_NOTCH_LITE_H
21 #define GNSS_SDR_NOTCH_LITE_H
22 
23 #if GNURADIO_USES_STD_POINTERS
24 #else
25 #include <boost/shared_ptr.hpp>
26 #endif
27 #include <gnuradio/block.h>
28 #include <gnuradio/fft/fft.h>
29 #include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
30 #include <cstdint>
31 #include <memory>
32 
33 class NotchLite;
34 
35 #if GNURADIO_USES_STD_POINTERS
36 using notch_lite_sptr = std::shared_ptr<NotchLite>;
37 #else
38 using notch_lite_sptr = boost::shared_ptr<NotchLite>;
39 #endif
40 
41 notch_lite_sptr make_notch_filter_lite(
42  float p_c_factor,
43  float pfa,
44  int32_t length_,
45  int32_t n_segments_est,
46  int32_t n_segments_reset,
47  int32_t n_segments_coeff);
48 
49 /*!
50  * \brief This class implements a real-time software-defined multi state notch filter light version
51  */
52 class NotchLite : public gr::block
53 {
54 public:
55  ~NotchLite() = default;
56 
57  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
58 
59  int general_work(int noutput_items, gr_vector_int &ninput_items,
60  gr_vector_const_void_star &input_items,
61  gr_vector_void_star &output_items);
62 
63 private:
64  friend notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
65  NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
66  std::unique_ptr<gr::fft::fft_complex> d_fft;
67  volk_gnsssdr::vector<float> power_spect;
68  gr_complex last_out;
69  gr_complex z_0;
70  gr_complex p_c_factor;
71  gr_complex c_samples1;
72  gr_complex c_samples2;
73  float pfa;
74  float thres_;
75  float noise_pow_est;
76  float angle1;
77  float angle2;
78  int32_t length_;
79  int32_t n_segments;
80  int32_t n_segments_est;
81  int32_t n_segments_reset;
82  int32_t n_segments_coeff_reset;
83  int32_t n_segments_coeff;
84  int32_t n_deg_fred;
85  bool filter_state_;
86 };
87 
88 #endif // GNSS_SDR_NOTCH_LITE_H
This class implements a real-time software-defined multi state notch filter light version...
Definition: notch_lite_cc.h:52