GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
6  *
7  */
8 
9 
10 #ifndef INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H
11 #define INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H
12 
13 #include <gnuradio/fec/api.h>
14 #include <gnuradio/fec/fec_mtrx.h>
16 
17 namespace gr {
18 namespace fec {
19 namespace code {
20 
21 /*!
22  * \brief LDPC bit flip decoding class
23  * \ingroup error_coding_blk
24  *
25  * \details
26  * A hard decision bit flip decoder class for decoding low
27  * density parity check (LDPC) codes. The decoder requires
28  * knowledge of the matrix used to create (encode) the
29  * codewords. The simple algorithm is:
30  *
31  * 1. Compute parity checks on all of the bits.
32  * 2. Flip the bit(s) associated with the most failed parity
33  * checks.
34  * 3. Check to see if new word is valid. (\f$\overline{x}\f$
35  * is a codeword if and only if
36  * \f$\mathbf{H}\bar{x}^{T}=\overline{0}\f$.) If it is not
37  * valid, go back to step 1.
38  * 4. Repeat until valid codeword is found or the maximum
39  * number of iterations is reached.
40  */
42 {
43 public:
44  /*!
45  * \brief Build a bit flip decoding FEC API object.
46  * \param mtrx_obj The LDPC parity check matrix to use for
47  * decoding. This should be the same matrix used for
48  * encoding. Provide either a ldpc_H_matrix or
49  * a ldpc_G_matrix object.
50  * \param max_iter Maximum number of iterations to complete
51  * during the decoding algorithm. The default is 100
52  * because this seemed to be sufficient during
53  * testing. May be increased for possibly better
54  * performance, but may slow things down.
55  */
56  static generic_decoder::sptr make(const fec_mtrx_sptr mtrx_obj,
57  unsigned int max_iter = 100);
58 
59  /*!
60  * \brief Sets the uncoded frame size to \p frame_size.
61  * \details
62  * Sets the uncoded frame size to \p frame_size. If \p
63  * frame_size is greater than the value given to the
64  * constructor, the frame size will be capped by that initial
65  * value and this function will return false. Otherwise, it
66  * returns true.
67  */
68  bool set_frame_size(unsigned int frame_size) override = 0;
69 
70  //! Returns the coding rate of this decoder.
71  double rate() override = 0;
72 };
73 } /* namespace code */
74 } /* namespace fec */
75 } /* namespace gr */
76 
77 #endif /* INCLUDED_FEC_LDPC_BIT_FLIP_DECODER_H */
LDPC bit flip decoding class.
Definition: ldpc_bit_flip_decoder.h:42
double rate() override=0
Returns the coding rate of this decoder.
static generic_decoder::sptr make(const fec_mtrx_sptr mtrx_obj, unsigned int max_iter=100)
Build a bit flip decoding FEC API object.
bool set_frame_size(unsigned int frame_size) override=0
Sets the uncoded frame size to frame_size.
Parent class for FECAPI objects.
Definition: generic_decoder.h:48
std::shared_ptr< generic_decoder > sptr
Definition: generic_decoder.h:62
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29