GNU Radio's CCSDS Package
encodeLDPC_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 <+YOU OR YOUR COMPANY+>.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef INCLUDED_CCSDS_ENCODELDPC_IMPL_H
22 #define INCLUDED_CCSDS_ENCODELDPC_IMPL_H
23 
24 #include <ccsds/encodeLDPC.h>
25 #include <vector>
26 #include <algorithm>
27 #include <string>
28 #include <fstream>
29 #include <gnuradio/blocks/pack_k_bits.h>
30 using namespace std;
31 namespace gr {
32  namespace ccsds {
33 
34  class encodeLDPC_impl : public encodeLDPC
35  {
36  private:
37  std::string d_out_tag_key;
38  std::string d_file;
39  int d_code_type;
40  bool d_verbose;
41  vector < vector<unsigned char> > G;
42  int K;
43  int N;
44  int P;
45  int c;
46  int m;
47  int M;
48  uint64_t d_tag_position;
49  blocks::kernel::pack_k_bits *d_pack;
50  void encodeAR4JA(std::vector<unsigned char> &input);
51  void encodeFullC2(std::vector<unsigned char> &input);
52  void encodeC2(std::vector<unsigned char> &input);
53  void encode(std::vector<unsigned char> &input);
54  //void encodeAR4JA_R12_K1024(std::vector<unsigned char> &input);
55  void (encodeLDPC_impl::*ldpcEncode)(std::vector<unsigned char> &input);
56  protected:
57  int calculate_output_stream_length(const gr_vector_int &ninput_items);
58 
59  public:
60  encodeLDPC_impl(std::string circulant_file, int code_type,
61  std::string out_tag_key, std::string len_tag_key, int verbose);
62  ~encodeLDPC_impl();
63  void generatorMatrix();
64  void leftrotate(string &s, int d);
65  void rightrotate(string &s, int d);
66 
67  // Where all the action really happens
68  int work(int noutput_items,
69  gr_vector_int &ninput_items,
70  gr_vector_const_void_star &input_items,
71  gr_vector_void_star &output_items);
72  };
73 
74  } // namespace ccsds
75 } // namespace gr
76 
77 #endif /* INCLUDED_CCSDS_ENCODELDPC_IMPL_H */
78 
#define P
Definition: ldpc_encoder.h:10
void leftrotate(string &s, int d)
Definition: ldpc_encoder.h:13
STL namespace.
<+description of block+>
Definition: encodeLDPC.h:36
#define K
Definition: ldpc_encoder.h:9
std::vector< std::vector< unsigned char > > generatorMatrix()
Definition: ldpc_encoder.h:46
Definition: cc_depuncture.h:28
#define N
Definition: ldpc_encoder.h:8
void rightrotate(string &s, int d)
Definition: ldpc_encoder.h:22
Definition: encodeLDPC_impl.h:34