summaryrefslogtreecommitdiff
path: root/src/c/signalProcessing
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/signalProcessing')
-rw-r--r--src/c/signalProcessing/includes/window.h33
-rw-r--r--src/c/signalProcessing/interfaces/int_window.h27
-rw-r--r--src/c/signalProcessing/window/dwindowa.c67
3 files changed, 127 insertions, 0 deletions
diff --git a/src/c/signalProcessing/includes/window.h b/src/c/signalProcessing/includes/window.h
new file mode 100644
index 00000000..0a06f22e
--- /dev/null
+++ b/src/c/signalProcessing/includes/window.h
@@ -0,0 +1,33 @@
+ /* Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+ This file must be used under the terms of the CeCILL.
+ This source file is licensed as described in the file COPYING, which
+ you should have received as part of this distribution. The terms
+ are also available at
+ http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ Author: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __WINDOW_H__
+#define __WINDOW_H__
+#include "types.h"
+#include "floatComplex.h"
+#include "doubleComplex.h"
+#include "uint8.h"
+#include "uint16.h"
+#include "int16.h"
+#include "factorial.h"
+#include "gamma.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dwindowa(char* inp1, int size, double n, double* out);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__WINDOW_H__*/
diff --git a/src/c/signalProcessing/interfaces/int_window.h b/src/c/signalProcessing/interfaces/int_window.h
new file mode 100644
index 00000000..77a90a2c
--- /dev/null
+++ b/src/c/signalProcessing/interfaces/int_window.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+ This file must be used under the terms of the CeCILL.
+ This source file is licensed as described in the file COPYING, which
+ you should have received as part of this distribution. The terms
+ are also available at
+ http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ Author: Brijesh Gupta C R
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_WINDOW_H__
+#define __INT_WINDOW_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define g2d0windowd2(in1, size, in2, out) dwindowa(in1, size[0]*size[1], in2, out)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_WINDOW_H__*/
diff --git a/src/c/signalProcessing/window/dwindowa.c b/src/c/signalProcessing/window/dwindowa.c
new file mode 100644
index 00000000..316f7138
--- /dev/null
+++ b/src/c/signalProcessing/window/dwindowa.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+ This file must be used under the terms of the CeCILL.
+ This source file is licensed as described in the file COPYING, which
+ you should have received as part of this distribution. The terms
+ are also available at
+ http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ Organization: FOSSEE, IIT Bombay
+ Author: Brijesh Gupta C R
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <string.h>
+#include "math.h"
+#include "window.h"
+#include "ones.h"
+#include "abs.h"
+#define PI 3.1415927
+
+void dwindowa(char* inp1, int size, double n, double* out)
+{
+
+ double no2, un[(int)n], xt[(int)n];
+
+ no2 = (n-1)/2;
+ for(int i = 0; i < n; i++)
+ xt[i] = -no2 + i;
+
+ donesa(un, 1, n);
+
+
+ char tr[] = "tr", re[] = "re", hm[] = "hm", hn[] = "hn";
+ double flagtr = 0;
+
+ if(strncmp(re, inp1,2) == 0)
+ {
+ for(int i = 0; i < n; i++)
+ out[i] = un[i];
+ }
+
+
+
+
+ if(strncmp(tr, inp1,2) == 0)
+ {
+ for(int i = 0; i < n; i++)
+ out[i] = un[i] - (2 * dabss(xt[i])) / (n+1);
+ }
+
+
+
+ if(strncmp(hm, inp1,2) == 0)
+ {
+ for(int i = 0; i < n; i++)
+ out[i] = 0.54 * un[i] + 0.46 * cos(2*PI*xt[i]/(n-1));
+ }
+
+
+ if(strncmp(hn, inp1,2) == 0)
+ {
+ for(int i = 0; i < n; i++)
+ out[i] = 0.5 * un[i] + 0.5 * cos(2*PI*xt[i]/(n-1));
+ }
+
+
+
+}