GNU Radio Manual and C++ API Reference 3.10.5.1
The Free & Open Software Radio Ecosystem
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 * SPDX-License-Identifier: GPL-3.0-or-later
8 *
9 */
10
11#ifndef INCLUDED_FEC_DEPUNCTURE_BB_H
12#define INCLUDED_FEC_DEPUNCTURE_BB_H
13
14#include <gnuradio/block.h>
15#include <gnuradio/fec/api.h>
16
17namespace gr {
18namespace fec {
19
20/*!
21 * \brief Depuncture a stream of samples.
22 * \ingroup error_coding_blk
23 *
24 * \details
25
26 * Depuncture a given block of input samples of \p puncsize. The
27 * items produced is based on the pattern \p puncpat. Basically,
28 * if:
29 *
30 * \code
31 * k = 0
32 * if _puncpat[i] == 1:
33 * out[i] = input[k++]
34 * else:
35 * out[i] = symbol # default sym=127
36 * \endcode
37 *
38 * This block is designed for unpacked bits - that is, every
39 * input sample is a bit, either a 1 or 0. It's possible to use
40 * packed bits as symbols, but the depuncturing will be done on
41 * the symbol level, not the bit level.
42 *
43 * \p puncpat is specified as a 32-bit integer that we can
44 * convert into the vector _puncpat used in the algorithm above:
45 *
46 * \code
47 * _puncpat = [0,...]
48 * for i in puncsize:
49 * _puncpat[i] = puncpat >> (puncsize-1-i)
50 * \endcode
51 *
52 * Example:
53 * \code
54 * puncsize = 8
55 * puncpat = 0xEF --> [1,1,1,0,1,1,1,1]
56 * input = [a, b, c, d, e, f, g, h]
57 * output = [a, b, c, 127, e, f, g, h]
58 * \endcode
59 *
60 * The gr.fec Python module provides a read_bitlist function
61 * that can turn a string of a puncture pattern into the correct
62 * integer form. The pattern of 0xEF could be specified as
63 * fec.readbitlist("11101111"). Also, this allows us to use
64 * puncsize=len("11101111") to make sure that our sizes are set
65 * up correctly for the pattern we want.
66 *
67 * The fec.extended_decoder takes in the puncture pattern
68 * directly as a string and uses the readbitlist inside to do
69 * the conversion.
70 *
71 * The \p delay parameter delays the application of the puncture
72 * pattern. This is equivalent to circularly rotating the \p
73 * puncpat by \p delay. Note that because of the circular shift,
74 * the delay should be between 0 and \p puncsize, but this is
75 * not enforced; the effective delay will simply be \p delay mod
76 * \p puncsize. A negative value here is ignored.
77 */
78class FEC_API depuncture_bb : virtual public block
79{
80public:
81 // gr::fec::depuncture_bb::sptr
82 typedef std::shared_ptr<depuncture_bb> sptr;
83
84 /*!
85 * \brief Constructs a depuncture block.
86 *
87 * \param puncsize Size of block of bits to puncture
88 * \param puncpat The puncturing pattern
89 * \param delay Delayed the puncturing pattern by shifting it
90 * \param symbol The symbol to reinsert into the stream (def=127)
91 */
92 static sptr make(int puncsize, int puncpat, int delay = 0, uint8_t symbol = 127);
93};
94
95} /* namespace fec */
96} /* namespace gr */
97
98#endif /* INCLUDED_FEC_DEPUNCTURE_BB_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:63
Depuncture a stream of samples.
Definition: depuncture_bb.h:79
static sptr make(int puncsize, int puncpat, int delay=0, uint8_t symbol=127)
Constructs a depuncture block.
std::shared_ptr< depuncture_bb > sptr
Definition: depuncture_bb.h:82
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29