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