GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
direct_resampler_conditioner_cc.h
Go to the documentation of this file.
1 /*!
2  * \file direct_resampler_conditioner_cc.h
3  *
4  * \brief Nearest neighborhood resampler with
5  * gr_complex input and gr_complex output
6  * \author Luis Esteve, 2011. luis(at)epsilon-formacion.com
7  *
8  * This block takes in a signal stream and performs direct
9  * resampling.
10  * The theory behind this block can be found in Chapter 7.5 of
11  * the following book.
12  *
13  *
14  * -----------------------------------------------------------------------------
15  *
16  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
17  *
18  * GNSS-SDR is a software defined Global Navigation
19  * Satellite Systems receiver
20  *
21  * This file is part of GNSS-SDR.
22  *
23  * SPDX-License-Identifier: GPL-3.0-or-later
24  *
25  * -----------------------------------------------------------------------------
26  */
27 
28 #ifndef GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
29 #define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
30 
31 #include <gnuradio/block.h>
32 #include <cstdint>
33 #if GNURADIO_USES_STD_POINTERS
34 #include <memory>
35 #else
36 #include <boost/shared_ptr.hpp>
37 #endif
38 
40 
41 #if GNURADIO_USES_STD_POINTERS
42 using direct_resampler_conditioner_cc_sptr = std::shared_ptr<direct_resampler_conditioner_cc>;
43 #else
44 using direct_resampler_conditioner_cc_sptr = boost::shared_ptr<direct_resampler_conditioner_cc>;
45 #endif
46 
47 direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
48  double sample_freq_in,
49  double sample_freq_out);
50 
51 /*!
52  * \brief This class implements a direct resampler conditioner for complex data
53  *
54  * Direct resampling without interpolation
55  */
56 class direct_resampler_conditioner_cc : public gr::block
57 {
58 public:
60  inline unsigned int sample_freq_in() const
61  {
62  return d_sample_freq_in;
63  }
64 
65  inline unsigned int sample_freq_out() const
66  {
67  return d_sample_freq_out;
68  }
69 
70  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
71 
72  int general_work(int noutput_items, gr_vector_int &ninput_items,
73  gr_vector_const_void_star &input_items,
74  gr_vector_void_star &output_items);
75 
76 private:
77  friend direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
78  double sample_freq_in,
79  double sample_freq_out);
80 
82  double sample_freq_in,
83  double sample_freq_out);
84 
85  double d_sample_freq_in; // Sampling frequency of the input signal
86  double d_sample_freq_out; // Sampling frequency of the output signal
87  uint32_t d_phase;
88  uint32_t d_lphase;
89  uint32_t d_phase_step;
90 };
91 
92 #endif // GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
This class implements a direct resampler conditioner for complex data.