2017-08-21 11:08:33 +00:00
|
|
|
/*!
|
|
|
|
* \file notch_lite_cc.h
|
2018-03-25 17:47:28 +00:00
|
|
|
* \brief Implements a notch filter light algorithm
|
2017-08-21 11:08:33 +00:00
|
|
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2017-08-21 11:08:33 +00:00
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2017-08-21 11:08: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-08-21 11:08:33 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2017-08-21 11:08:33 +00:00
|
|
|
*/
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
#ifndef GNSS_SDR_NOTCH_LITE_CC_H
|
|
|
|
#define GNSS_SDR_NOTCH_LITE_CC_H
|
2017-08-21 11:08:33 +00:00
|
|
|
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
#else
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#endif
|
2017-08-21 11:08:33 +00:00
|
|
|
#include <gnuradio/block.h>
|
2017-10-18 10:30:42 +00:00
|
|
|
#include <gnuradio/fft/fft.h>
|
2020-06-25 09:58:01 +00:00
|
|
|
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
|
2018-08-13 23:32:06 +00:00
|
|
|
#include <cstdint>
|
2020-07-14 18:12:08 +00:00
|
|
|
#include <memory>
|
2017-08-21 11:08:33 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Input_Filter
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Input_filter_gnuradio_blocks
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2017-08-21 11:08:33 +00:00
|
|
|
class NotchLite;
|
|
|
|
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
2020-04-02 11:23:20 +00:00
|
|
|
using notch_lite_sptr = std::shared_ptr<NotchLite>;
|
2020-04-02 21:59:35 +00:00
|
|
|
#else
|
|
|
|
using notch_lite_sptr = boost::shared_ptr<NotchLite>;
|
|
|
|
#endif
|
2017-08-21 11:08:33 +00:00
|
|
|
|
2019-07-02 15:24:54 +00:00
|
|
|
notch_lite_sptr make_notch_filter_lite(
|
|
|
|
float p_c_factor,
|
|
|
|
float pfa,
|
2020-10-29 10:49:09 +00:00
|
|
|
int32_t length,
|
2019-07-02 15:24:54 +00:00
|
|
|
int32_t n_segments_est,
|
|
|
|
int32_t n_segments_reset,
|
|
|
|
int32_t n_segments_coeff);
|
2017-08-21 11:08:33 +00:00
|
|
|
|
|
|
|
/*!
|
2018-03-25 17:47:28 +00:00
|
|
|
* \brief This class implements a real-time software-defined multi state notch filter light version
|
2017-08-21 11:08:33 +00:00
|
|
|
*/
|
|
|
|
class NotchLite : public gr::block
|
|
|
|
{
|
2019-07-01 21:44:42 +00:00
|
|
|
public:
|
2020-06-25 09:58:01 +00:00
|
|
|
~NotchLite() = default;
|
2019-07-01 21:44:42 +00:00
|
|
|
|
|
|
|
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-08-21 11:08:33 +00:00
|
|
|
private:
|
2020-10-29 10:49:09 +00:00
|
|
|
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);
|
|
|
|
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);
|
|
|
|
std::unique_ptr<gr::fft::fft_complex> d_fft_;
|
|
|
|
volk_gnsssdr::vector<float> power_spect_;
|
|
|
|
gr_complex last_out_;
|
|
|
|
gr_complex z_0_;
|
|
|
|
gr_complex p_c_factor_;
|
|
|
|
gr_complex c_samples1_;
|
|
|
|
gr_complex c_samples2_;
|
|
|
|
float pfa_;
|
2020-06-25 09:58:01 +00:00
|
|
|
float thres_;
|
2020-10-29 10:49:09 +00:00
|
|
|
float noise_pow_est_;
|
|
|
|
float angle1_;
|
|
|
|
float angle2_;
|
2018-08-13 23:32:06 +00:00
|
|
|
int32_t length_;
|
2020-10-29 10:49:09 +00:00
|
|
|
int32_t n_segments_;
|
|
|
|
int32_t n_segments_est_;
|
|
|
|
int32_t n_segments_reset_;
|
|
|
|
int32_t n_segments_coeff_reset_;
|
|
|
|
int32_t n_segments_coeff_;
|
|
|
|
int32_t n_deg_fred_;
|
2017-08-22 11:21:28 +00:00
|
|
|
bool filter_state_;
|
2017-08-21 11:08:33 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
#endif // GNSS_SDR_NOTCH_LITE_CC_H
|