summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorrimio <vasi.vilvoiu@gmail.com>2019-01-08 18:30:03 +0200
committerrimio <vasi.vilvoiu@gmail.com>2019-01-08 18:30:03 +0200
commit85acad49b42bf3734249dae13429a26395a68a03 (patch)
tree01361d557a2b80752f399e27fc6f38fd0757f5f0 /util
parenta7d5e7ca20c959b739d80f96362f326a5848cdb3 (diff)
Start encoder
Diffstat (limited to 'util')
-rw-r--r--util/genluts.py30
-rw-r--r--util/view.py11
2 files changed, 41 insertions, 0 deletions
diff --git a/util/genluts.py b/util/genluts.py
new file mode 100644
index 0000000..fcaead9
--- /dev/null
+++ b/util/genluts.py
@@ -0,0 +1,30 @@
+import sys
+import numpy as np
+
+f = open('src/luts.c', 'w')
+
+# header
+f.write('/*\n')
+f.write(' * Copyright (c) 2018 Vasile Vilvoiu (YO7JBP) <vasi.vilvoiu@gmail.com>\n')
+f.write(' *\n')
+f.write(' * libsstv is free software; you can redistribute it and/or modify\n')
+f.write(' * it under the terms of the MIT license. See LICENSE for details.\n')
+f.write(' */\n\n')
+f.write('#include "luts.h"\n\n')
+
+x = np.linspace(0.0, 2 * np.pi, num=1024, endpoint=False)
+sn = np.sin(x)
+
+# SSTV_SIN_INT10_INT8
+f.write('int8_t SSTV_SIN_INT10_INT8[1024] = { ')
+for s in sn * 127:
+ f.write(str(int(np.around(s))) + ', ')
+f.write('};\n\n')
+
+# SSTV_SIN_INT10_INT16
+f.write('int16_t SSTV_SIN_INT10_INT16[1024] = { ')
+for s in sn * 32767:
+ f.write(str(int(np.around(s))) + ', ')
+f.write('};\n\n')
+
+f.close() \ No newline at end of file
diff --git a/util/view.py b/util/view.py
new file mode 100644
index 0000000..b6e95fe
--- /dev/null
+++ b/util/view.py
@@ -0,0 +1,11 @@
+import sys
+import numpy as np
+import matplotlib.pyplot as plt
+
+f = open('test.csv')
+lines = [int(l.replace('\n', '')) for l in f.readlines()[:-2]]
+f.close()
+
+s = np.array(lines)
+plt.plot(s)
+plt.show()