GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef INCLUDED_FEC_POLAR_ENCODER_SYSTEMATIC_H
13 #define INCLUDED_FEC_POLAR_ENCODER_SYSTEMATIC_H
14 
15 #include <gnuradio/fec/api.h>
18 
19 namespace gr {
20 namespace fec {
21 namespace code {
22 
23 /*!
24  * \brief systematic POLAR encoder
25  * for basic details see 'polar_common' class.
26  * \ingroup error_coding_blk
27  *
28  * \details
29  * expects values with MSB first. It needs a full information word and encodes it in one
30  * pass. Output is a codeword of block_size.
31  *
32  * Systematic encoding indicates that the info bit values are present in the codeword.
33  * 'info_bit_positions' may be obtained by ordering all non frozen_bit_positions in
34  * increasing order. One may extract them at their positions after a bit reversal
35  * operation. encoder -> decoder chain would need additional bit-reversal after encoding +
36  * before decoding. This is unnecessary.
37  */
39 {
40 public:
41  /*!
42  * Factory for a polar code encoder object.
43  *
44  * \param block_size defines the codeword size. It MUST be a
45  * power of 2.
46  * \param num_info_bits represents the number of information
47  * bits in a block. Also called frame_size.
48  * \param frozen_bit_positions is an integer vector which
49  * defines the position of all frozen bits in a block.
50  * Its size MUST be equal to block_size - num_info_bits.
51  * Also it must be sorted and every position must only
52  * occur once. Frozen bit values will be set to ZERO!
53  */
55  make(int block_size, int num_info_bits, std::vector<int> frozen_bit_positions);
56 
57  // FECAPI
58  void generic_work(void* in_buffer, void* out_buffer) override;
59  double rate() override { return (1.0 * get_input_size() / get_output_size()); };
60  int get_input_size() override { return num_info_bits(); };
61  int get_output_size() override { return block_size(); };
62  bool set_frame_size(unsigned int frame_size) override { return false; };
63 
65 
66 private:
67  polar_encoder_systematic(int block_size,
68  int num_info_bits,
69  std::vector<int> frozen_bit_positions);
70 
71  void bit_reverse_and_reset_frozen_bits(unsigned char* outbuf,
72  const unsigned char* inbuf);
73  volk::vector<unsigned char> d_volk_syst_intermediate;
74 };
75 
76 } // namespace code
77 } // namespace fec
78 } // namespace gr
79 
80 #endif /* INCLUDED_FEC_POLAR_ENCODER_SYSTEMATIC_H */
POLAR code common operations and attributes.
Definition: polar_common.h:50
systematic POLAR encoder for basic details see 'polar_common' class.
Definition: polar_encoder_systematic.h:39
int get_input_size() override
Definition: polar_encoder_systematic.h:60
double rate() override
Definition: polar_encoder_systematic.h:59
void generic_work(void *in_buffer, void *out_buffer) override
bool set_frame_size(unsigned int frame_size) override
Definition: polar_encoder_systematic.h:62
int get_output_size() override
Definition: polar_encoder_systematic.h:61
static generic_encoder::sptr make(int block_size, int num_info_bits, std::vector< int > frozen_bit_positions)
Definition: generic_encoder.h:23
std::shared_ptr< generic_encoder > sptr
Definition: generic_encoder.h:37
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29