GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
tpc_decoder.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#ifndef INCLUDED_TPC_DECODER_H
24#define INCLUDED_TPC_DECODER_H
25
26typedef float INPUT_DATATYPE;
27typedef unsigned char OUTPUT_DATATYPE;
28
30#include <map>
31#include <string>
32#include <vector>
33
34namespace gr {
35namespace fec {
36
37
38#define MAXLOG 1e7
39
41{
42 // private constructor
43 tpc_decoder(std::vector<int> row_polys,
44 std::vector<int> col_polys,
45 int krow,
46 int kcol,
47 int bval,
48 int qval,
49 int max_iter,
50 int decoder_type);
51
52 // plug into the generic fec api
53 int get_history();
54 float get_shift();
55 int get_input_item_size();
56 int get_output_item_size();
57 const char* get_conversion();
58 void generic_work(void* inBuffer, void* outbuffer);
59 int get_output_size();
60 int get_input_size();
61
62 std::vector<int> d_rowpolys;
63 std::vector<int> d_colpolys;
64
65 unsigned int d_krow;
66 unsigned int d_kcol;
67
68 int d_bval;
69 int d_qval;
70
71 int d_max_iter;
72 int d_decoder_type;
73
74 // store the state transitions & outputs
75 int rowNumStates;
76 std::vector<std::vector<int>> rowOutputs;
77 std::vector<std::vector<int>> rowNextStates;
78 int colNumStates;
79 std::vector<std::vector<int>> colOutputs;
80 std::vector<std::vector<int>> colNextStates;
81
82 int rowEncoder_K;
83 int rowEncoder_n;
84 int rowEncoder_m;
85 int colEncoder_K;
86 int colEncoder_n;
87 int colEncoder_m;
88 int outputSize;
89 int inputSize;
90
91 uint32_t codeword_M;
92 uint32_t codeword_N;
93
94 int mInit, nInit;
95
96 // memory allocated for processing
97 int inputSizeWithPad;
98
99 std::vector<std::vector<float>> channel_llr;
100 std::vector<std::vector<float>> Z;
101 std::vector<float> extrinsic_info;
102 std::vector<float> input_u_rows;
103 std::vector<float> input_u_cols;
104 std::vector<float> input_c_rows;
105 std::vector<float> input_c_cols;
106 std::vector<float> output_u_rows;
107 std::vector<float> output_u_cols;
108 std::vector<float> output_c_rows;
109 std::vector<float> output_c_cols;
110
111 uint32_t numInitLoadIter;
112 int numInitRemaining;
113 int output_c_col_idx;
114
115 bool earlyExit;
116
117 FILE* fp;
118
119 // soft input soft output decoding
120 int mm_row, max_states_row, num_symbols_row;
121 std::vector<std::vector<float>> beta_row;
122 std::vector<float> alpha_prime_row;
123 std::vector<float> alpha_row;
124 std::vector<float> metric_c_row;
125 std::vector<float> rec_array_row;
126 std::vector<float> num_llr_c_row;
127 std::vector<float> den_llr_c_row;
128 void siso_decode_row();
129
130 int mm_col, max_states_col, num_symbols_col;
131 std::vector<std::vector<float>> beta_col;
132 std::vector<float> alpha_prime_col;
133 std::vector<float> alpha_col;
134 std::vector<float> metric_c_col;
135 std::vector<float> rec_array_col;
136 std::vector<float> num_llr_c_col;
137 std::vector<float> den_llr_c_col;
138 void siso_decode_col();
139
140 // Computes the branch metric used for decoding, returning a metric between the
141 // hypothetical symbol and received vector
142 float gamma(const std::vector<float> rec_array, const int symbol);
143
144 float (tpc_decoder::*max_star)(const float, const float);
145
146 float linear_log_map(const float delta1, const float delta2);
147 float max_log_map(const float delta1, const float delta2);
148 float constant_log_map(const float delta1, const float delta2);
149 float log_map_lut_correction(const float delta1, const float delta2);
150 float log_map_cfunction_correction(const float delta1, const float delta2);
151
152 template <typename T>
153 static int sgn(T val);
154
155public:
156 static generic_decoder::sptr make(std::vector<int> row_poly,
157 std::vector<int> col_poly,
158 int krow,
159 int kcol,
160 int bval,
161 int qval,
162 int max_iter,
163 int decoder_type);
165 double rate() { return (1.0 * get_output_size() / get_input_size()); }
166 bool set_frame_size(unsigned int frame_size) { return false; }
167};
168
169} // namespace fec
170} // namespace gr
171
172#endif /* INCLUDED_TPC_DECODER_H */
Parent class for FECAPI objects.
Definition generic_decoder.h:61
boost::shared_ptr< generic_decoder > sptr
Definition generic_decoder.h:75
Definition tpc_decoder.h:41
double rate()
Definition tpc_decoder.h:165
static generic_decoder::sptr make(std::vector< int > row_poly, std::vector< int > col_poly, int krow, int kcol, int bval, int qval, int max_iter, int decoder_type)
bool set_frame_size(unsigned int frame_size)
Definition tpc_decoder.h:166
#define FEC_API
Definition gr-fec/include/gnuradio/fec/api.h:30
FEC_API int get_history(generic_decoder::sptr my_decoder)
FEC_API float get_shift(generic_decoder::sptr my_decoder)
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
float INPUT_DATATYPE
Definition tpc_decoder.h:26
unsigned char OUTPUT_DATATYPE
Definition tpc_decoder.h:27