diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/c/ffConv2_dY.c | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
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 | } | ||
