GNU Radio 3.6.5.1 C++ API
digital_ofdm_cyclic_prefixer.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004-2006,2011 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
24 #define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
25 
26 #include <digital_api.h>
27 #include <gr_tagged_stream_block.h>
28 
31 
32 /*!
33  * \param input_size FFT length (i.e. length of the OFDM symbols)
34  * \param output_size FFT length + cyclic prefix length (in samples)
35  * \param rolloff_len Length of the rolloff flank in samples
36  * \param len_tag_key For framed processing the key of the length tag
37  */
39 digital_make_ofdm_cyclic_prefixer (size_t input_size,
40  size_t output_size,
41  int rolloff_len=0,
42  const std::string &len_tag_key="");
43 
44 
45 /*!
46  * \brief Adds a cyclic prefix and performs pulse shaping on OFDM symbols.
47  * \ingroup ofdm_blk
48  *
49  * Input: OFDM symbols (in the time domain, i.e. after the IFFT). Optionally,
50  * entire frames can be processed. In this case, \p len_tag_key must be
51  * specified which holds the key of the tag that denotes how
52  * many OFDM symbols are in a frame.
53  * Output: A stream of (scalar) complex symbols, which include the cyclic prefix
54  * and the pulse shaping.
55  * Note: If complete frames are processed, and \p rolloff_len is greater
56  * than zero, the final OFDM symbol is followed by the delay line of
57  * the pulse shaping.
58  *
59  * The pulse shape is a raised cosine in the time domain.
60  */
62 {
64  digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size, int rolloff_len, const std::string &len_tag_key);
65 
66 
67  protected:
68  digital_ofdm_cyclic_prefixer (size_t input_size, size_t output_size, int rolloff_len, const std::string &len_tag_key);
69 
70  //! Return the number of complex samples from the number of OFDM symbols (includes rolloff)
71  int calculate_output_stream_length(const gr_vector_int &ninput_items);
72 
73  public:
74  int work(int noutput_items,
75  gr_vector_int &ninput_items,
76  gr_vector_const_void_star &input_items,
77  gr_vector_void_star &output_items);
78 
79  private:
80  size_t d_fft_len;
81  //! FFT length + CP length in samples
82  size_t d_output_size;
83  //! Length of the cyclic prefix in samples
84  int d_cp_size;
85  //! Length of pulse rolloff in samples
86  int d_rolloff_len;
87  //! Buffers the up-flank (at the beginning of the cyclic prefix)
88  std::vector<float> d_up_flank;
89  //! Buffers the down-flank (which trails the symbol)
90  std::vector<float> d_down_flank;
91  std::vector<gr_complex> d_delay_line; // We do this explicitly to avoid outputting zeroes (i.e. no history!)
92 };
93 
94 #endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H */
95