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_bb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 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_BB_H
24 #define INCLUDED_FEC_PUNCTURE_BB_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 unpacked bits.
34  * \ingroup error_coding_blk
35  *
36  * \details
37  * Puncture a given block of input samples of \p puncsize. The
38  * items produced is based on pattern \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 unpacked bits - that is, every
47  * input sample is a bit, either a 1 or 0. It's possible to use
48  * packed bits as symbols, but the puncturing will be done on
49  * the symbol level, not the bit level.
50  *
51  * \p puncpat is specified as a 32-bit integer that we can
52  * convert into the vector _puncpat used in the algorithm above:
53  *
54  * \code
55  * _puncpat = [0,...]
56  * for i in puncsize:
57  * _puncpat[i] = puncpat >> (puncsize-1-i)
58  * \endcode
59  *
60  * Example:
61  * \code
62  * puncsize = 8
63  * puncpat = 0xEF --> [1,1,1,0,1,1,1,1]
64  * input = [a, b, c, d, e, f, g, h]
65  * output = [a, b, c, e, f, g, h]
66  * \endcode
67  *
68  * The gr.fec Python module provides a read_bitlist function
69  * that can turn a string of a puncture pattern into the correct
70  * integer form. The pattern of 0xEF could be specified as
71  * fec.readbitlist("11101111"). Also, this allows us to use
72  * puncsize=len("11101111") to make sure that our sizes are set
73  * up correctly for the pattern we want.
74  *
75  * The fec.extended_encoder takes in the puncture pattern
76  * directly as a string and uses the readbitlist inside to do
77  * the conversion.
78  *
79  * The \p delay parameter delays the application of the puncture
80  * pattern. This is equivalent to circularly rotating the \p
81  * puncpat by \p delay. Note that because of the circular shift,
82  * the delay should be between 0 and \p puncsize, but this is
83  * not enforced; the effective delay will simply be \p delay mod
84  * \p puncsize. A negative value here is ignored.
85  */
86  class FEC_API puncture_bb : virtual public block
87  {
88  public:
89  // gr::fec::puncture_bb::sptr
91 
92  /*!
93  * \brief Constructs a puncture block for unpacked bits.
94  *
95  * \param puncsize Size of block of bits to puncture
96  * \param puncpat The puncturing pattern
97  * \param delay Delayed the puncturing pattern by shifting it
98  */
99  static sptr make(int puncsize, int puncpat, int delay=0);
100  };
101 
102  } /* namespace fec */
103 } /* namespace gr */
104 
105 #endif /* INCLUDED_FEC_PUNCTURE_BB_H */
boost::shared_ptr< puncture_bb > sptr
Definition: puncture_bb.h:90
shared_ptr documentation stub
Definition: shared_ptr_docstub.h:15
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
The abstract base class for all 'terminal' processing blocks.A signal processing flow is constructed ...
Definition: block.h:60
Puncture a stream of unpacked bits.
Definition: puncture_bb.h:86