GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
puncture_ff.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013-2014 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_FEC_PUNCTURE_FF_H
24 #define INCLUDED_FEC_PUNCTURE_FF_H
25 
26 #include <gnuradio/fec/api.h>
27 #include <gnuradio/block.h>
28 
29 namespace gr {
30  namespace fec {
31 
32  /*!
33  * \brief Puncture a stream of floats.
34  * \ingroup error_coding_blk
35  *
36  * \details
37  * For a given block of input samples of \p puncsize, the items
38  * produced is based on \p puncpat. Basically, if:
39  *
40  * \code
41  * k = 0
42  * if _puncpat[i] == 1:
43  * out[k++] = input[i]
44  * \endcode
45  *
46  * This block is designed for floats, generally 1's and -1's. It's
47  * possible to use other float values as symbols, but this is not
48  * the expected operation.
49  *
50  * \p puncpat is specified as a 32-bit integer that we can
51  * convert into the vector _puncpat used in the algorithm above:
52  *
53  * \code
54  * _puncpat = [0,...]
55  * for i in puncsize:
56  * _puncpat[i] = puncpat >> (puncsize-1-i)
57  * \endcode
58  *
59  * Example:
60  * \code
61  * puncsize = 8
62  * puncpat = 0xEF --> [1,1,1,0,1,1,1,1]
63  * input = [a, b, c, d, e, f, g, h]
64  * output = [a, b, c, e, f, g, h]
65  * \endcode
66  *
67  * The gr.fec Python module provides a read_bitlist function
68  * that can turn a string of a puncture pattern into the correct
69  * integer form. The pattern of 0xEF could be specified as
70  * fec.readbitlist("11101111"). Also, this allows us to use
71  * puncsize=len("11101111") to make sure that our sizes are set
72  * up correctly for the pattern we want.
73  *
74  * The fec.extended_encoder takes in the puncture pattern
75  * directly as a string and uses the readbitlist inside to do
76  * the conversion.
77  *
78  * The \p delay parameter delays the application of the puncture
79  * pattern. This is equivalent to circularly rotating the \p
80  * puncpat by \p delay. Note that because of the circular shift,
81  * the delay should be between 0 and \p puncsize, but this is
82  * not enforced; the effective delay will simply be \p delay mod
83  * \p puncsize. A negative value here is ignored.
84  */
85  class FEC_API puncture_ff : virtual public block
86  {
87  public:
88  // gr::fec::puncture_ff::sptr
90 
91  /*!
92  * \brief Constructs a puncture block for floats.
93  *
94  * \param puncsize Size of block of bits to puncture
95  * \param puncpat The puncturing pattern
96  * \param delay Delayed the puncturing pattern by shifting it
97  */
98  static sptr make(int puncsize, int puncpat, int delay);
99  };
100 
101  } /* namespace fec */
102 } /* namespace gr */
103 
104 #endif /* INCLUDED_FEC_PUNCTURE_FF_H */
boost::shared_ptr< puncture_ff > sptr
Definition: puncture_ff.h:89
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
Puncture a stream of floats.
Definition: puncture_ff.h:85
The abstract base class for all 'terminal' processing blocks.A signal processing flow is constructed ...
Definition: block.h:60