GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
polar_decoder_sc.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_H
13 #define INCLUDED_FEC_POLAR_DECODER_SC_H
14 
15 #include <gnuradio/fec/api.h>
17 
18 
19 namespace gr {
20 namespace fec {
21 namespace code {
22 
23 /*!
24  * \brief Standard successive cancellation (SC) decoder for POLAR codes
25  *
26  * \details
27  * It expects float input with bits mapped 1 --> 1, 0 --> -1
28  * Or: f = 2.0 * bit - 1.0
29  *
30  */
32 {
33 public:
34  /*!
35  * \param block_size codeword size. MUST be a power of 2.
36  * \param num_info_bits represents the number of information
37  * bits in a block. Also called frame_size. <= block_size
38  * \param frozen_bit_positions is an integer vector which
39  * defines the position of all frozen bits in a block.
40  * Its size MUST be equal to block_size - num_info_bits.
41  * Also it must be sorted and every position must only
42  * occur once.
43  * \param frozen_bit_values holds an unpacked byte for every
44  * frozen bit position. It defines if a frozen bit is
45  * fixed to '0' or '1'. Defaults to all ZERO.
46  */
47  static generic_decoder::sptr make(int block_size,
48  int num_info_bits,
49  std::vector<int> frozen_bit_positions,
50  std::vector<uint8_t> frozen_bit_values);
51  ~polar_decoder_sc() override;
52 
53  // FECAPI
54  void generic_work(void* in_buffer, void* out_buffer) override;
55 
56 private:
57  polar_decoder_sc(int block_size,
58  int num_info_bits,
59  std::vector<int> frozen_bit_positions,
60  std::vector<uint8_t> frozen_bit_values);
61 
62  volk::vector<float> d_llr_vec;
63  volk::vector<unsigned char> d_u_hat_vec;
64 
65  unsigned char retrieve_bit_from_llr(float llr, const int pos);
66  void sc_decode(float* llrs, unsigned char* u);
67 };
68 
69 } // namespace code
70 } // namespace fec
71 } // namespace gr
72 
73 #endif /* INCLUDED_FEC_POLAR_DECODER_SC_H */
Class holds common methods and attributes for different decoder implementations.
Definition: polar_decoder_common.h:28
Standard successive cancellation (SC) decoder for POLAR codes.
Definition: polar_decoder_sc.h:32
static generic_decoder::sptr make(int block_size, int num_info_bits, std::vector< int > frozen_bit_positions, std::vector< uint8_t > frozen_bit_values)
void generic_work(void *in_buffer, void *out_buffer) override
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