GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
depuncture_bb.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_DEPUNCTURE_BB_H
24 #define INCLUDED_FEC_DEPUNCTURE_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 Depuncture a stream of samples.
34  * \ingroup error_coding_blk
35  *
36  * \details
37 
38  * Depuncture a given block of input samples of \p puncsize. The
39  * items produced is based on the pattern \p puncpat. Basically,
40  * if:
41  *
42  * \code
43  * k = 0
44  * if _puncpat[i] == 1:
45  * out[i] = input[k++]
46  * else:
47  * out[i] = symbol # default sym=127
48  * \endcode
49  *
50  * This block is designed for unpacked bits - that is, every
51  * input sample is a bit, either a 1 or 0. It's possible to use
52  * packed bits as symbols, but the depuncturing will be done on
53  * the symbol level, not the bit level.
54  *
55  * \p puncpat is specified as a 32-bit integer that we can
56  * convert into the vector _puncpat used in the algorithm above:
57  *
58  * \code
59  * _puncpat = [0,...]
60  * for i in puncsize:
61  * _puncpat[i] = puncpat >> (puncsize-1-i)
62  * \endcode
63  *
64  * Example:
65  * \code
66  * puncsize = 8
67  * puncpat = 0xEF --> [1,1,1,0,1,1,1,1]
68  * input = [a, b, c, d, e, f, g, h]
69  * output = [a, b, c, 127, e, f, g, h]
70  * \endcode
71  *
72  * The gr.fec Python module provides a read_bitlist function
73  * that can turn a string of a puncture pattern into the correct
74  * integer form. The pattern of 0xEF could be specified as
75  * fec.readbitlist("11101111"). Also, this allows us to use
76  * puncsize=len("11101111") to make sure that our sizes are set
77  * up correctly for the pattern we want.
78  *
79  * The fec.extended_decoder takes in the puncture pattern
80  * directly as a string and uses the readbitlist inside to do
81  * the conversion.
82  *
83  * The \p delay parameter delays the application of the puncture
84  * pattern. This is equivalent to circularly rotating the \p
85  * puncpat by \p delay. Note that because of the circular shift,
86  * the delay should be between 0 and \p puncsize, but this is
87  * not enforced; the effective delay will simply be \p delay mod
88  * \p puncsize. A negative value here is ignored.
89  */
90  class FEC_API depuncture_bb : virtual public block
91  {
92  public:
93  // gr::fec::depuncture_bb::sptr
94  typedef boost::shared_ptr<depuncture_bb> sptr;
95 
96  /*!
97  * \brief Constructs a depuncture block.
98  *
99  * \param puncsize Size of block of bits to puncture
100  * \param puncpat The puncturing pattern
101  * \param delay Delayed the puncturing pattern by shifting it
102  * \param symbol The symbol to reinsert into the stream (def=127)
103  */
104  static sptr make(int puncsize, int puncpat,
105  int delay=0, char symbol=127);
106  };
107 
108  } /* namespace fec */
109 } /* namespace gr */
110 
111 #endif /* INCLUDED_FEC_DEPUNCTURE_BB_H */
Depuncture a stream of samples.
Definition: depuncture_bb.h:90
Include this header to use the message passing features.
Definition: logger.h:131
#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
boost::shared_ptr< depuncture_bb > sptr
Definition: depuncture_bb.h:94