GNU Radio's SATNOGS Package
conv_encoder.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
4  *
5  * Copyright (C) 2021, Libre Space Foundation <http://libre.space>
6  *
7  * This program 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 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef INCLUDED_SATNOGS_CONV_ENCODER_H
22 #define INCLUDED_SATNOGS_CONV_ENCODER_H
23 
24 #include <satnogs/api.h>
25 #include <cstdint>
26 #include <cstdlib>
27 #include <cstddef>
28 #include <itpp/base/array.h>
29 #include <itpp/comm/convcode.h>
30 #include <itpp/comm/reedsolomon.h>
31 
32 namespace gr {
33 namespace satnogs {
34 
36 
37  /**
38  * \brief SATNOGS compatible convolutional encoder with puncturing support
39  *
40  */
41 public:
42  typedef enum {
43  RATE_1_2 = 0,
47  RATE_7_8
48  } coding_rate_t;
49 
50  conv_encoder(coding_rate_t cc_rate, size_t max_frame_len);
51  ~conv_encoder();
52 
53  size_t
54  encode(uint8_t *out, const uint8_t *in, size_t len);
55 
56  size_t
57  encode_trunc(uint8_t *out, const uint8_t *in, size_t len);
58 
59  void
60  reset();
61 
62  size_t
63  finalize(uint8_t *out);
64 
65 private:
66  coding_rate_t d_cc_rate;
67  itpp::Convolutional_Code d_conv_code;
68  itpp::ivec d_cc_generator;
69 
70  size_t
71  inv_and_puncture(uint8_t *out, const itpp::bvec &in);
72 };
73 
74 }
75 }
76 
77 #endif /* INCLUDED_SATNOGS_CONV_ENCODER_H */
Definition: conv_encoder.h:35
Definition: conv_encoder.h:45
coding_rate_t
SATNOGS compatible convolutional encoder with puncturing support.
Definition: conv_encoder.h:42
Definition: amsat_duv_decoder.h:29
Definition: conv_encoder.h:46
Definition: conv_encoder.h:44
#define SATNOGS_API
Definition: api.h:30