-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLDPCDecoder.h
More file actions
50 lines (47 loc) · 1.33 KB
/
Copy pathLDPCDecoder.h
File metadata and controls
50 lines (47 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef LDPCDECODER_H_
#define LDPCDECODER_H_
#include <vector>
#include <map>
#include <fstream>
#include "BpNode.h"
#include <boost/numeric/ublas/matrix.hpp>
class LDPCDecoder {
public:
struct symbol {
double phase;
double quad;
};
template<typename T> int sign(T val) {
return (val > T(0)) - (val < T(0));
}
LDPCDecoder(int k, int n, boost::numeric::ublas::matrix<int> matrix,
int passes, int symbols);
std::vector<int> decode(std::vector<double> rec);
std::vector<int> decode(std::vector<double> rec, boost::numeric::ublas::matrix<double> &errors, int counter, std::vector<int> uncoded);
std::vector<double> deInterleave(std::vector<double> received);
std::vector<double> deModLlr(std::vector<double> phase,
std::vector<double> quad, double n0);
virtual ~LDPCDecoder();
private:
static const bool DEBUG = false;
int passes;
int k;
int n;
int p;
int symbols;
double energy;
std::map<std::string,symbol> grayMap;
boost::numeric::ublas::matrix<int> matrix;
std::vector<std::vector<int> > checks;
std::vector<BpNode*> received;
std::vector<BpNode*> parity;
void forwardPassing();
void backwardPassing();
bool parityCheck();
void initializeGraph();
void resetGraph();
void initializeChecks();
std::vector<double> llr(double received_p, double received_q, double n0);
void initDemod();
};
#endif /* LDPCDECODER_H_ */