GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
tpc_encoder.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_ENCODER_H
24 #define INCLUDED_TPC_ENCODER_H
25 
26 #include <gnuradio/fec/encoder.h>
28 #include <map>
29 #include <string>
30 #include <vector>
31 
32 
33 namespace gr {
34 namespace fec {
35 
37 {
38 
39  // private constructor
40  tpc_encoder(std::vector<int> row_polys,
41  std::vector<int> col_polys,
42  int krow,
43  int kcol,
44  int bval,
45  int qval);
46 
47  // plug into the generic fec api
48  void generic_work(void* inBuffer, void* outbuffer);
49  int get_output_size();
50  int get_input_size();
51 
52  std::vector<int> d_rowpolys;
53  std::vector<int> d_colpolys;
54 
55  unsigned int d_krow;
56  unsigned int d_kcol;
57 
58  unsigned int d_bval;
59  unsigned int d_qval;
60 
61  // store the state transitions & outputs
62  int rowNumStates;
63  std::vector<std::vector<int>> rowOutputs;
64  std::vector<std::vector<int>> rowNextStates;
65  int colNumStates;
66  std::vector<std::vector<int>> colOutputs;
67  std::vector<std::vector<int>> colNextStates;
68 
69  std::vector<int> rowTail;
70  std::vector<int> colTail;
71 
72  int rowEncoder_K;
73  size_t rowEncoder_n;
74  int rowEncoder_m;
75  int colEncoder_K;
76  size_t colEncoder_n;
77  int colEncoder_m;
78  int outputSize;
79  int inputSize;
80 
81  // memory allocated for processing
82  int inputSizeWithPad;
83  std::vector<unsigned char> inputWithPad;
84 
85  std::vector<std::vector<uint8_t>> rowEncodedBits;
86  std::vector<unsigned char> rowToEncode;
87  size_t numRowsToEncode;
88  std::vector<uint8_t> rowEncoded_block;
89 
90  std::vector<std::vector<uint8_t>> colEncodedBits;
91  std::vector<unsigned char> colToEncode;
92  int numColsToEncode;
93  std::vector<uint8_t> colEncoded_block;
94 
95  void block_conv_encode(std::vector<uint8_t>& output,
96  std::vector<uint8_t> input,
97  std::vector<std::vector<int>> transOutputVec,
98  std::vector<std::vector<int>> transNextStateVec,
99  std::vector<int> tail,
100  size_t KK,
101  size_t nn);
102 
103  FILE* fp;
104 
105 public:
106  ~tpc_encoder();
107  static generic_encoder::sptr make(std::vector<int> row_poly,
108  std::vector<int> col_poly,
109  int krow,
110  int kcol,
111  int bval,
112  int qval);
113  double rate() { return (1.0 * get_input_size() / get_output_size()); }
114  bool set_frame_size(unsigned int) { return false; }
115 };
116 
117 
118 } // namespace fec
119 } // namespace gr
120 
121 #endif /* INCLUDED_TPC_ENCODER_H */
Definition: tpc_encoder.h:36
bool set_frame_size(unsigned int)
Definition: tpc_encoder.h:114
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
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
double rate()
Definition: tpc_encoder.h:113