summaryrefslogtreecommitdiff
path: root/controller/fw/src/ldpc_wrapper.cpp
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-02-27 16:02:41 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-02-27 16:02:41 +0100
commitf6061fe574166b7d23b208f047e8789081877c57 (patch)
tree78ce2e5e6dc28736c66d4412ef3f2dc46036e3ab /controller/fw/src/ldpc_wrapper.cpp
parent43ff9fdac05c0ceb696685f683bba077bd2c8da2 (diff)
downloadmaster-thesis-f6061fe574166b7d23b208f047e8789081877c57.tar.gz
master-thesis-f6061fe574166b7d23b208f047e8789081877c57.tar.bz2
master-thesis-f6061fe574166b7d23b208f047e8789081877c57.zip
Add missing files
Diffstat (limited to 'controller/fw/src/ldpc_wrapper.cpp')
-rw-r--r--controller/fw/src/ldpc_wrapper.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/controller/fw/src/ldpc_wrapper.cpp b/controller/fw/src/ldpc_wrapper.cpp
new file mode 100644
index 0000000..da63343
--- /dev/null
+++ b/controller/fw/src/ldpc_wrapper.cpp
@@ -0,0 +1,84 @@
+
+#include <stdlib.h>
+#include <algorithm>
+#include <cstdint>
+#include <cmath>
+
+#include "ldpc/generic.hh"
+#include "ldpc/layered_decoder.hh"
+
+static const int DEFAULT_TRIALS = 25;
+
+struct DVB_S2_TABLE_C9
+{
+ static const int M = 360;
+ static const int N = 16200;
+ static const int K = 13320;
+ static const int LINKS_MIN_CN = 15;
+ static const int LINKS_MAX_CN = 19;
+ static const int LINKS_TOTAL = 49319;
+ static const int DEG_MAX = 13;
+ static const int DEG[];
+ static const int LEN[];
+ static const int POS[];
+};
+
+const int DVB_S2_TABLE_C9::DEG[] = {
+ 13, 3, 0
+};
+
+const int DVB_S2_TABLE_C9::LEN[] = {
+ 1, 36, 0
+};
+
+const int DVB_S2_TABLE_C9::POS[] = {
+ 3, 2409, 499, 1481, 908, 559, 716, 1270, 333, 2508, 2264, 1702, 2805,
+ 4, 2447, 1926,
+ 5, 414, 1224,
+ 6, 2114, 842,
+ 7, 212, 573,
+ 0, 2383, 2112,
+ 1, 2286, 2348,
+ 2, 545, 819,
+ 3, 1264, 143,
+ 4, 1701, 2258,
+ 5, 964, 166,
+ 6, 114, 2413,
+ 7, 2243, 81,
+ 0, 1245, 1581,
+ 1, 775, 169,
+ 2, 1696, 1104,
+ 3, 1914, 2831,
+ 4, 532, 1450,
+ 5, 91, 974,
+ 6, 497, 2228,
+ 7, 2326, 1579,
+ 0, 2482, 256,
+ 1, 1117, 1261,
+ 2, 1257, 1658,
+ 3, 1478, 1225,
+ 4, 2511, 980,
+ 5, 2320, 2675,
+ 6, 435, 1278,
+ 7, 228, 503,
+ 0, 1885, 2369,
+ 1, 57, 483,
+ 2, 838, 1050,
+ 3, 1231, 1990,
+ 4, 1738, 68,
+ 5, 2392, 951,
+ 6, 163, 645,
+ 7, 2644, 1704,
+};
+
+extern "C" {
+
+ int ldpc_decode(float *symbols, int trials) {
+ if (trials < 0)
+ trials = DEFAULT_TRIALS;
+
+ LDPCDecoder<float, SumProductAlgorithm<float, SelfCorrectedUpdate<float>>, LDPC<DVB_S2_TABLE_C9>> decoder;
+ return decoder.run(symbols, symbols+decoder.K, trials, 1);
+ }
+
+}