summaryrefslogtreecommitdiff
path: root/filt
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-10-06 20:53:28 +0100
committerFreeArtMan <dos21h@gmail.com>2015-10-06 20:53:28 +0100
commit21c34937937f27a89290f4377b4ff1801079e6ec (patch)
tree61194300a31b5d2ced985f39c033cc68734374e7 /filt
parent4391e4e70162cc0ad61fc90ff341c3686998ef4b (diff)
downloadradiola-21c34937937f27a89290f4377b4ff1801079e6ec.tar.gz
radiola-21c34937937f27a89290f4377b4ff1801079e6ec.zip
Added new interface files
Diffstat (limited to 'filt')
-rw-r--r--filt/f_5th.c32
-rw-r--r--filt/filt.h11
-rw-r--r--filt/make.mk10
3 files changed, 53 insertions, 0 deletions
diff --git a/filt/f_5th.c b/filt/f_5th.c
new file mode 100644
index 0000000..811fb18
--- /dev/null
+++ b/filt/f_5th.c
@@ -0,0 +1,32 @@
+#include "filt.h"
+
+void f_5th(int16_t *data, int length, int16_t *hist)
+/* for half of interleaved data */
+{
+ int i;
+ int16_t a, b, c, d, e, f;
+ a = hist[1];
+ b = hist[2];
+ c = hist[3];
+ d = hist[4];
+ e = hist[5];
+ f = data[0];
+ /* a downsample should improve resolution, so don't fully shift */
+ data[0] = (a + (b+e)*5 + (c+d)*10 + f) >> 4;
+ for (i=4; i<length; i+=4) {
+ a = c;
+ b = d;
+ c = e;
+ d = f;
+ e = data[i-2];
+ f = data[i];
+ data[i/2] = (a + (b+e)*5 + (c+d)*10 + f) >> 4;
+ }
+ /* archive */
+ hist[0] = a;
+ hist[1] = b;
+ hist[2] = c;
+ hist[3] = d;
+ hist[4] = e;
+ hist[5] = f;
+} \ No newline at end of file
diff --git a/filt/filt.h b/filt/filt.h
new file mode 100644
index 0000000..d235449
--- /dev/null
+++ b/filt/filt.h
@@ -0,0 +1,11 @@
+#ifndef __RADIOLA_FILT_H
+#define __RADIOLA_FILT_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+//fifth order filter from rtlsdr
+void f_5th(int16_t *data, int length, int16_t *hist);
+
+#endif \ No newline at end of file
diff --git a/filt/make.mk b/filt/make.mk
new file mode 100644
index 0000000..e65653c
--- /dev/null
+++ b/filt/make.mk
@@ -0,0 +1,10 @@
+DIR_FILT = filt/
+SOURCES_FILT += filt/f_5th.c
+OBJECTS_FILT += $(SOURCES_FILT:.c=.o)
+LDFLAGS +=
+
+
+OBJECTS_DIR_FILT += $(subst $(DIR_FILT),$(BUILD_DIR)$(DIR_FILT),$(OBJECTS_FILT))
+
+OBJECTS += $(OBJECTS_FILT)
+OBJECTS_FINAL += $(OBJECTS_DIR_FILT) \ No newline at end of file