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_encoder_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_ENCODER_SYSTEMATIC_H
25 #define INCLUDED_FEC_POLAR_ENCODER_SYSTEMATIC_H
26 
27 #include <gnuradio/fec/api.h>
30 
31 namespace gr {
32  namespace fec {
33  namespace code {
34 
35  /*!
36  * \brief systematic POLAR encoder
37  * for basic details see 'polar_common' class.
38  * \ingroup error_coding_blk
39  *
40  * \details
41  * expects values with MSB first. It needs a full information word and encodes it in one pass.
42  * Output is a codeword of block_size.
43  *
44  * Systematic encoding indicates that the info bit values are present in the codeword.
45  * 'info_bit_positions' may be obtained by ordering all non frozen_bit_positions in increasing order.
46  * One may extract them at their positions after a bit reversal operation.
47  * encoder -> decoder chain would need additional bit-reversal after encoding + before decoding.
48  * This is unnecessary.
49  */
51  {
52  public:
53  /*!
54  * Factory for a polar code encoder object.
55  *
56  * \param block_size defines the codeword size. It MUST be a
57  * power of 2.
58  * \param num_info_bits represents the number of information
59  * bits in a block. Also called frame_size.
60  * \param frozen_bit_positions is an integer vector which
61  * defines the position of all frozen bits in a block.
62  * Its size MUST be equal to block_size - num_info_bits.
63  * Also it must be sorted and every position must only
64  * occur once. Frozen bit values will be set to ZERO!
65  */
67  make(int block_size, int num_info_bits, std::vector<int> frozen_bit_positions);
68 
69  // FECAPI
70  void
71  generic_work(void *in_buffer, void *out_buffer);
72  double
73  rate()
74  {
75  return (1.0 * get_input_size() / get_output_size());
76  }
77  ;
78  int
80  {
81  return num_info_bits();
82  }
83  ;
84  int
86  {
87  return block_size();
88  }
89  ;
90  bool
91  set_frame_size(unsigned int frame_size)
92  {
93  return false;
94  }
95  ;
96 
98  private:
99  polar_encoder_systematic(int block_size, int num_info_bits,
100  std::vector<int> frozen_bit_positions);
101 
102  void bit_reverse_and_reset_frozen_bits(unsigned char *outbuf, const unsigned char *inbuf);
103  unsigned char* d_volk_syst_intermediate;
104  };
105 
106  } // namespace code
107  } // namespace fec
108 } // namespace gr
109 
110 #endif /* INCLUDED_FEC_POLAR_ENCODER_SYSTEMATIC_H */
111 
bool set_frame_size(unsigned int frame_size)
Definition: polar_encoder_systematic.h:91
systematic POLAR encoder for basic details see 'polar_common' class.
Definition: polar_encoder_systematic.h:50
double rate()
Definition: polar_encoder_systematic.h:73
int get_output_size()
Definition: polar_encoder_systematic.h:85
Include this header to use the message passing features.
Definition: logger.h:131
Definition: generic_encoder.h:34
boost::shared_ptr< generic_encoder > sptr
Definition: generic_encoder.h:49
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:30
int get_input_size()
Definition: polar_encoder_systematic.h:79
POLAR code common operations and attributes.
Definition: polar_common.h:55