2017-06-05 15:00:33 +00:00
|
|
|
/*!
|
|
|
|
* \file notch_cc.h
|
|
|
|
* \brief Implements a notch filter algorithm
|
|
|
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2017-06-05 15:00:33 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2017-06-05 15:00:33 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_NOTCH_H
|
|
|
|
#define GNSS_SDR_NOTCH_H
|
2017-06-05 15:00:33 +00:00
|
|
|
|
2017-06-19 13:51:57 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <gnuradio/block.h>
|
2017-10-18 10:30:42 +00:00
|
|
|
#include <gnuradio/fft/fft.h>
|
2018-08-13 23:32:06 +00:00
|
|
|
#include <cstdint>
|
2017-10-18 10:30:42 +00:00
|
|
|
#include <memory>
|
2017-06-05 15:00:33 +00:00
|
|
|
|
2017-06-19 13:51:57 +00:00
|
|
|
class Notch;
|
2017-06-05 15:00:33 +00:00
|
|
|
|
2019-02-11 12:02:18 +00:00
|
|
|
using notch_sptr = boost::shared_ptr<Notch>;
|
2017-06-19 13:51:57 +00:00
|
|
|
|
2019-07-02 15:24:54 +00:00
|
|
|
notch_sptr make_notch_filter(
|
|
|
|
float pfa,
|
|
|
|
float p_c_factor,
|
|
|
|
int32_t length_,
|
|
|
|
int32_t n_segments_est,
|
|
|
|
int32_t n_segments_reset);
|
2017-06-19 13:51:57 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This class implements a real-time software-defined multi state notch filter
|
|
|
|
*/
|
2017-06-20 16:13:52 +00:00
|
|
|
class Notch : public gr::block
|
2017-06-19 13:51:57 +00:00
|
|
|
{
|
2019-07-01 21:44:42 +00:00
|
|
|
public:
|
|
|
|
~Notch();
|
|
|
|
|
|
|
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
|
|
|
|
|
|
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
|
|
|
gr_vector_const_void_star &input_items,
|
|
|
|
gr_vector_void_star &output_items);
|
|
|
|
|
2017-06-19 13:51:57 +00:00
|
|
|
private:
|
2019-07-02 15:24:54 +00:00
|
|
|
friend notch_sptr make_notch_filter(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
|
|
|
|
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
|
2017-06-20 16:13:52 +00:00
|
|
|
float pfa;
|
|
|
|
float noise_pow_est;
|
|
|
|
float thres_;
|
2018-08-13 23:32:06 +00:00
|
|
|
int32_t length_;
|
|
|
|
int32_t n_deg_fred;
|
|
|
|
uint32_t n_segments;
|
|
|
|
uint32_t n_segments_est;
|
|
|
|
uint32_t n_segments_reset;
|
2017-06-20 16:13:52 +00:00
|
|
|
bool filter_state_;
|
2017-06-23 09:34:02 +00:00
|
|
|
gr_complex last_out;
|
2017-06-19 13:51:57 +00:00
|
|
|
gr_complex z_0;
|
2017-07-10 07:48:38 +00:00
|
|
|
gr_complex p_c_factor;
|
2018-03-03 01:03:39 +00:00
|
|
|
gr_complex *c_samples;
|
|
|
|
float *angle_;
|
|
|
|
float *power_spect;
|
2017-10-18 10:30:42 +00:00
|
|
|
std::unique_ptr<gr::fft::fft_complex> d_fft;
|
2017-06-19 13:51:57 +00:00
|
|
|
};
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_NOTCH_H
|