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