GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
polar_decoder_sc_systematic.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 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 
24 #ifndef INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H
25 #define INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H
26 
27 #include <gnuradio/fec/api.h>
29 
30 namespace gr {
31  namespace fec {
32  namespace code {
33 
34  /*!
35  * \brief Standard systematic successive cancellation (SC) decoder for POLAR codes
36  *
37  * \details
38  * It expects float input with bits mapped 1 --> 1, 0 --> -1
39  * Or: f = 2.0 * bit - 1.0
40  *
41  * Systematic encoding indicates that the info bit values are present in the codeword.
42  * 'info_bit_positions' may be obtained by ordering all non frozen_bit_positions in increasing order.
43  * One may extract them at their positions after a bit reversal operation.
44  * encoder -> decoder chain would need additional bit-reversal after encoding + before decoding.
45  * This is unnecessary.
46  */
48  {
49  public:
50  /*!
51  * \param block_size codeword size. MUST be a power of 2.
52  * \param num_info_bits represents the number of information
53  * bits in a block. Also called frame_size. <= block_size
54  * \param frozen_bit_positions is an integer vector which
55  * defines the position of all frozen bits in a block.
56  * Its size MUST be equal to block_size - num_info_bits.
57  * Also it must be sorted and every position must only
58  * occur once.
59  */
60  static generic_decoder::sptr make(int block_size, int num_info_bits,
61  std::vector<int> frozen_bit_positions);
62 
64 
65  // FECAPI
66  void generic_work(void *in_buffer, void *out_buffer);
67  private:
68  polar_decoder_sc_systematic(int block_size, int num_info_bits, std::vector<int> frozen_bit_positions);
69  float* d_llr_vec;
70  unsigned char* d_u_hat_vec;
71  unsigned char* d_frame_vec;
72  unsigned char retrieve_bit_from_llr(float llr, const int pos);
73  void sc_decode(float* llrs, unsigned char* u);
74  void extract_info_bits_reversed(unsigned char* outbuf, const unsigned char* inbuf);
75  };
76 
77  } /* namespace code */
78  } // namespace fec
79 } // namespace gr
80 
81 #endif /* INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H */
82 
Include this header to use the message passing features.
Definition: logger.h:131
Standard systematic successive cancellation (SC) decoder for POLAR codes.
Definition: polar_decoder_sc_systematic.h:47
Class holds common methods and attributes for different decoder implementations.
Definition: polar_decoder_common.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