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