summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/ffiConv2.c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/c/ffiConv2.c')
-rw-r--r--SD-VBS/common/c/ffiConv2.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/SD-VBS/common/c/ffiConv2.c b/SD-VBS/common/c/ffiConv2.c
new file mode 100644
index 0000000..83c7466
--- /dev/null
+++ b/SD-VBS/common/c/ffiConv2.c
@@ -0,0 +1,54 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "sdvbs_common.h"
6
7F2D* ffiConv2(F2D* a, I2D* b)
8{
9 F2D *c;
10 F2D *out;
11 int ma, na, mb, nb, ci, cj, i, j, m, n;
12 int r_index, c_index;
13
14 ma = a->height;
15 na = a->width;
16
17 mb = b->height;
18 nb = b->width;
19
20 r_index = ceil((mb + 1.0)/2.0);
21 c_index = ceil((nb + 1.0)/2.0);
22
23 ci = ma+mb-1;
24 cj = na+nb-1;
25
26 c = fSetArray(ci, cj, 0);
27
28 for(i=0; i<ci; i++)
29 {
30 for(j=0; j<cj; j++)
31 {
32 for(m=0; m<ma; m++)
33 {
34 for(n=0; n<na; n++)
35 {
36 if( (i-m)>=0 && (j-n)>=0 && (i-m)<mb && (j-n)<nb )
37 subsref(c,i,j) += subsref(a,m,n) * subsref(b,(i-m),(j-n));
38 }
39 }
40
41 }
42 }
43
44 out = fMallocHandle(ma, na);
45 for(i=0; i<ma; i++)
46 {
47 for(j=0; j<na; j++)
48 {
49 subsref(out,i,j) = subsref(c,(i+r_index-1),(j+c_index-1));
50 }
51 }
52
53 return out;
54}