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