GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
ldpc_bit_flip_decoder.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Free Software Foundation, Inc.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published
7  * by the Free Software Foundation; either version 3, or (at your
8  * option) any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H
23 #define INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H
24 
25 #include <gnuradio/fec/api.h>
26 #include <gnuradio/fec/fec_mtrx.h>
28 
29 namespace gr {
30 namespace fec {
31 namespace code {
32 
33 /*!
34  * \brief LDPC bit flip decoding class
35  * \ingroup error_coding_blk
36  *
37  * \details
38  * A hard decision bit flip decoder class for decoding low
39  * density parity check (LDPC) codes. The decoder requires
40  * knowledge of the matrix used to create (encode) the
41  * codewords. The simple algorithm is:
42  *
43  * 1. Compute parity checks on all of the bits.
44  * 2. Flip the bit(s) associated with the most failed parity
45  * checks.
46  * 3. Check to see if new word is valid. (\f$\overline{x}\f$
47  * is a codeword if and only if
48  * \f$\mathbf{H}\bar{x}^{T}=\overline{0}\f$.) If it is not
49  * valid, go back to step 1.
50  * 4. Repeat until valid codeword is found or the maximum
51  * number of iterations is reached.
52  */
54 {
55 public:
56  /*!
57  * \brief Build a bit flip decoding FEC API object.
58  * \param mtrx_obj The LDPC parity check matrix to use for
59  * decoding. This should be the same matrix used for
60  * encoding. Provide either a ldpc_H_matrix or
61  * a ldpc_G_matrix object.
62  * \param max_iter Maximum number of iterations to complete
63  * during the decoding algorithm. The default is 100
64  * because this seemed to be sufficient during
65  * testing. May be increased for possibly better
66  * performance, but may slow things down.
67  */
68  static generic_decoder::sptr make(const fec_mtrx_sptr mtrx_obj,
69  unsigned int max_iter = 100);
70 
71  /*!
72  * \brief Sets the uncoded frame size to \p frame_size.
73  * \details
74  * Sets the uncoded frame size to \p frame_size. If \p
75  * frame_size is greater than the value given to the
76  * constructor, the frame size will be capped by that initial
77  * value and this function will return false. Otherwise, it
78  * returns true.
79  */
80  virtual bool set_frame_size(unsigned int frame_size) = 0;
81 
82  //! Returns the coding rate of this decoder.
83  virtual double rate() = 0;
84 };
85 } /* namespace code */
86 } /* namespace fec */
87 } /* namespace gr */
88 
89 #endif /* INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H */
Parent class for FECAPI objects.
Definition: generic_decoder.h:60
LDPC bit flip decoding class.
Definition: ldpc_bit_flip_decoder.h:53
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
boost::shared_ptr< generic_decoder > sptr
Definition: generic_decoder.h:75