beeping-core 2.0.0
C++20 library for encoding and decoding data over sound
Loading...
Searching...
No Matches
ReedSolomon.h
1#ifndef __REEDSOLOMON__
2#define __REEDSOLOMON__
3
4#include <vector>
5
6namespace BEEPING {
7class ReedSolomon {
8 public:
9 ReedSolomon();
10 ~ReedSolomon();
11
12 void GenerateGaloisField();
13 void GeneratePoly();
14 void Encode();
15 void Decode();
16
17 int mm; /* RS code over GF(2**4) - change to suit */
18 int nn; /* nn=2**mm -1 length of codeword */
19 int tt; /* number of errors that can be corrected */
20 int kk; /* kk = nn-2*tt */
21
22 int msg_len; /* for shortened RS code */
23
24 // for encode
25 int* pp; /* specify irreducible polynomial coeffts */
26 int* alpha_to;
27 int* index_of;
28 int* gg;
29
30 int* recd;
31 int* data;
32 int* bb;
33
34 // For decode
35 int **elp, *d, *l, *u_lu, *s;
36 int *root, *loc, *z, *err, *reg;
37
38 // Voctro API
39 // encoding
40 void SetMessage(const std::vector<int> message);
41 void GetCode(std::vector<int>& code);
42 // decoding
43 void SetCode(const std::vector<int> code);
44 void GetMessage(std::vector<int>& message);
45};
46} // namespace BEEPING
47
48#endif //__REEDSOLOMON__