GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H
13 #define INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H
14 
15 #include <gnuradio/fec/api.h>
17 
18 namespace gr {
19 namespace fec {
20 namespace code {
21 
22 /*!
23  * \brief Standard systematic successive cancellation (SC) decoder for POLAR codes
24  *
25  * \details
26  * It expects float input with bits mapped 1 --> 1, 0 --> -1
27  * Or: f = 2.0 * bit - 1.0
28  *
29  * Systematic encoding indicates that the info bit values are present in the codeword.
30  * 'info_bit_positions' may be obtained by ordering all non frozen_bit_positions in
31  * increasing order. One may extract them at their positions after a bit reversal
32  * operation. encoder -> decoder chain would need additional bit-reversal after encoding +
33  * before decoding. This is unnecessary.
34  */
36 {
37 public:
38  /*!
39  * \param block_size codeword size. MUST be a power of 2.
40  * \param num_info_bits represents the number of information
41  * bits in a block. Also called frame_size. <= block_size
42  * \param frozen_bit_positions is an integer vector which
43  * defines the position of all frozen bits in a block.
44  * Its size MUST be equal to block_size - num_info_bits.
45  * Also it must be sorted and every position must only
46  * occur once.
47  */
49  make(int block_size, int num_info_bits, std::vector<int> frozen_bit_positions);
50 
52 
53  // FECAPI
54  void generic_work(void* in_buffer, void* out_buffer) override;
55 
56 private:
57  polar_decoder_sc_systematic(int block_size,
58  int num_info_bits,
59  std::vector<int> frozen_bit_positions);
60  volk::vector<float> d_llr_vec;
61  volk::vector<unsigned char> d_u_hat_vec;
62  volk::vector<unsigned char> d_frame_vec;
63  unsigned char retrieve_bit_from_llr(float llr, const int pos);
64  void sc_decode(float* llrs, unsigned char* u);
65  void extract_info_bits_reversed(unsigned char* outbuf, const unsigned char* inbuf);
66 };
67 
68 } /* namespace code */
69 } // namespace fec
70 } // namespace gr
71 
72 #endif /* INCLUDED_FEC_POLAR_DECODER_SC_SYSTEMATIC_H */
Class holds common methods and attributes for different decoder implementations.
Definition: polar_decoder_common.h:28
Standard systematic successive cancellation (SC) decoder for POLAR codes.
Definition: polar_decoder_sc_systematic.h:36
void generic_work(void *in_buffer, void *out_buffer) override
static generic_decoder::sptr make(int block_size, int num_info_bits, std::vector< int > frozen_bit_positions)
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