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