GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
freq_xlating_fir_filter.h
Go to the documentation of this file.
1 /*!
2  * \file freq_xlating_fir_filter.h
3  * \brief Adapts a gnuradio gr_freq_xlating_fir_filter designed with gr_remez
4  * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
5  *
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_FREQ_XLATING_FIR_FILTER_H
19 #define GNSS_SDR_FREQ_XLATING_FIR_FILTER_H
20 
22 #include "gnss_block_interface.h"
23 #include "short_x2_to_cshort.h"
24 #ifdef GR_GREATER_38
25 #include <gnuradio/filter/freq_xlating_fir_filter.h>
26 #else
27 #include <gnuradio/filter/freq_xlating_fir_filter_ccf.h>
28 #include <gnuradio/filter/freq_xlating_fir_filter_fcf.h>
29 #include <gnuradio/filter/freq_xlating_fir_filter_scf.h>
30 #endif
31 #include <gnuradio/blocks/char_to_short.h>
32 #include <gnuradio/blocks/complex_to_float.h>
33 #include <gnuradio/blocks/file_sink.h>
34 #include <gnuradio/blocks/float_to_short.h>
35 #include <string>
36 #include <vector>
37 
38 /** \addtogroup Input_Filter
39  * \{ */
40 /** \addtogroup Input_filter_adapters
41  * \{ */
42 
43 
45 
46 /*!
47  * \brief This class adapts a gnuradio gr_freq_xlating_fir_filter designed with pm_remez
48  *
49  * Construct a FIR filter with the given taps and a composite frequency
50  * translation that shifts intermediate_freq_ down to zero Hz. The frequency
51  * translation logically comes before the filtering operation.
52  *
53  * See Parks-McClellan FIR filter design, https://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm
54  * Calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response
55  * given a set of band edges, the desired response on those bands, and the weight given
56  * to the error in those bands.
57  */
59 {
60 public:
61  FreqXlatingFirFilter(const ConfigurationInterface* configuration,
62  std::string role, unsigned int in_streams,
63  unsigned int out_streams);
64 
65  ~FreqXlatingFirFilter() = default;
66 
67  inline std::string role() override
68  {
69  return role_;
70  }
71 
72  //! Returns "Freq_Xlating_Fir_Filter"
73  inline std::string implementation() override
74  {
75  return "Freq_Xlating_Fir_Filter";
76  }
77 
78  inline size_t item_size() override
79  {
80  return input_size_;
81  }
82 
83  void connect(gr::top_block_sptr top_block) override;
84  void disconnect(gr::top_block_sptr top_block) override;
85  gr::basic_block_sptr get_left_block() override;
86  gr::basic_block_sptr get_right_block() override;
87 
88 private:
89  gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_;
90  gr::filter::freq_xlating_fir_filter_fcf::sptr freq_xlating_fir_filter_fcf_;
91  gr::filter::freq_xlating_fir_filter_scf::sptr freq_xlating_fir_filter_scf_;
92  gr::blocks::complex_to_float::sptr complex_to_float_;
93  gr::blocks::char_to_short::sptr gr_char_to_short_;
94  gr::blocks::float_to_short::sptr float_to_short_1_;
95  gr::blocks::float_to_short::sptr float_to_short_2_;
96  short_x2_to_cshort_sptr short_x2_to_cshort_;
97  complex_float_to_complex_byte_sptr complex_to_complex_byte_;
98  gr::blocks::file_sink::sptr file_sink_;
99  std::vector<float> taps_;
100  std::string dump_filename_;
101  std::string input_item_type_;
102  std::string output_item_type_;
103  std::string taps_item_type_;
104  std::string role_;
105  size_t input_size_;
106  double intermediate_freq_;
107  double sampling_freq_;
108  int decimation_factor_;
109  unsigned int in_streams_;
110  unsigned int out_streams_;
111  bool dump_;
112 };
113 
114 
115 /** \} */
116 /** \} */
117 #endif // GNSS_SDR_FREQ_XLATING_FIR_FILTER_H
Adapts a gr_complex stream into a std::complex<signed char> stream.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
This abstract class represents an interface to GNSS blocks.
Adapts two short streams into a std::complex<short> stream.
std::string implementation() override
Returns "Freq_Xlating_Fir_Filter".
This class adapts a gnuradio gr_freq_xlating_fir_filter designed with pm_remez.