GNU Radio Manual and C++ API Reference
3.8.1.0
The Free & Open Software Radio Ecosystem
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/block.h
>
27
#include <
gnuradio/fec/api.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
* Note that due to the above concept, the default setting in the
80
* extended encoder of '11' translates into no puncturing.
81
*
82
* The \p delay parameter delays the application of the puncture
83
* pattern. This is equivalent to circularly rotating the \p
84
* puncpat by \p delay. Note that because of the circular shift,
85
* the delay should be between 0 and \p puncsize, but this is
86
* not enforced; the effective delay will simply be \p delay mod
87
* \p puncsize. A negative value here is ignored.
88
*/
89
class
FEC_API
puncture_bb
:
virtual
public
block
90
{
91
public
:
92
// gr::fec::puncture_bb::sptr
93
typedef
boost::shared_ptr<puncture_bb>
sptr
;
94
95
/*!
96
* \brief Constructs a puncture block for unpacked bits.
97
*
98
* \param puncsize Size of block of bits to puncture
99
* \param puncpat The puncturing pattern
100
* \param delay Delayed the puncturing pattern by shifting it
101
*/
102
static
sptr
make(
int
puncsize,
int
puncpat,
int
delay = 0);
103
};
104
105
}
/* namespace fec */
106
}
/* namespace gr */
107
108
#endif
/* INCLUDED_FEC_PUNCTURE_BB_H */
block.h
api.h
FEC_API
#define FEC_API
Definition:
gr-fec/include/gnuradio/fec/api.h:30
gr::block
The abstract base class for all 'terminal' processing blocks.
Definition:
block.h:71
gr::fec::puncture_bb::sptr
boost::shared_ptr< puncture_bb > sptr
Definition:
puncture_bb.h:93
gr
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition:
basic_block.h:43
gr::fec::puncture_bb
Puncture a stream of unpacked bits.
Definition:
puncture_bb.h:89
gr-fec
include
gnuradio
fec
puncture_bb.h
Generated by
1.8.16