GNU Radio 3.6.5 C++ API

digital_ofdm_cyclic_prefixer.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004-2006,2011 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
00024 #define INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H
00025 
00026 #include <digital_api.h>
00027 #include <gr_tagged_stream_block.h>
00028 
00029 class digital_ofdm_cyclic_prefixer;
00030 typedef boost::shared_ptr<digital_ofdm_cyclic_prefixer> digital_ofdm_cyclic_prefixer_sptr;
00031 
00032 /*!
00033  * \param input_size FFT length (i.e. length of the OFDM symbols)
00034  * \param output_size FFT length + cyclic prefix length (in samples)
00035  * \param rolloff_len Length of the rolloff flank in samples
00036  * \param len_tag_key For framed processing the key of the length tag
00037  */
00038 DIGITAL_API digital_ofdm_cyclic_prefixer_sptr
00039 digital_make_ofdm_cyclic_prefixer (size_t input_size,
00040                 size_t output_size,
00041                 int rolloff_len=0,
00042                 const std::string &len_tag_key="");
00043 
00044 
00045 /*!
00046  * \brief Adds a cyclic prefix and performs pulse shaping on OFDM symbols.
00047  * \ingroup ofdm_blk
00048  *
00049  * Input: OFDM symbols (in the time domain, i.e. after the IFFT). Optionally,
00050  *        entire frames can be processed. In this case, \p len_tag_key must be
00051  *        specified which holds the key of the tag that denotes how
00052  *        many OFDM symbols are in a frame.
00053  * Output: A stream of (scalar) complex symbols, which include the cyclic prefix
00054  *         and the pulse shaping.
00055  *         Note: If complete frames are processed, and \p rolloff_len is greater
00056  *         than zero, the final OFDM symbol is followed by the delay line of
00057  *         the pulse shaping.
00058  *
00059  * The pulse shape is a raised cosine in the time domain.
00060  */
00061 class DIGITAL_API digital_ofdm_cyclic_prefixer : public gr_tagged_stream_block
00062 {
00063   friend DIGITAL_API digital_ofdm_cyclic_prefixer_sptr
00064     digital_make_ofdm_cyclic_prefixer (size_t input_size, size_t output_size, int rolloff_len, const std::string &len_tag_key);
00065 
00066 
00067  protected:
00068   digital_ofdm_cyclic_prefixer (size_t input_size, size_t output_size, int rolloff_len, const std::string &len_tag_key);
00069 
00070   //! Return the number of complex samples from the number of OFDM symbols (includes rolloff)
00071   int calculate_output_stream_length(const gr_vector_int &ninput_items);
00072 
00073  public:
00074   int work(int noutput_items,
00075                gr_vector_int &ninput_items,
00076                gr_vector_const_void_star &input_items,
00077                gr_vector_void_star &output_items);
00078 
00079  private:
00080   size_t d_fft_len;
00081   //! FFT length + CP length in samples
00082   size_t d_output_size;
00083   //! Length of the cyclic prefix in samples
00084   int d_cp_size;
00085   //! Length of pulse rolloff in samples
00086   int d_rolloff_len;
00087   //! Buffers the up-flank (at the beginning of the cyclic prefix)
00088   std::vector<float> d_up_flank;
00089   //! Buffers the down-flank (which trails the symbol)
00090   std::vector<float> d_down_flank;
00091   std::vector<gr_complex> d_delay_line; // We do this explicitly to avoid outputting zeroes (i.e. no history!)
00092 };
00093 
00094 #endif /* INCLUDED_DIGITAL_OFDM_CYCLIC_PREFIXER_H */
00095