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/benchmarks/stitch/src/c/script_stitch.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/benchmarks/stitch/src/c/script_stitch.c')
-rw-r--r-- | SD-VBS/benchmarks/stitch/src/c/script_stitch.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c new file mode 100644 index 0000000..00c9a93 --- /dev/null +++ b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "stitch.h" | ||
6 | #include <malloc.h> | ||
7 | #include "extra.h" | ||
8 | #define STITCH_MEM 1<<30 | ||
9 | int main(int argc, char* argv[]) | ||
10 | { | ||
11 | SET_UP | ||
12 | mallopt(M_TOP_PAD, STITCH_MEM); | ||
13 | mallopt(M_MMAP_MAX, 0); | ||
14 | int rows, cols; | ||
15 | F2D *x, *y, *v, *interestPnts, *Fcur, *int1, *int2; | ||
16 | I2D *Icur; | ||
17 | int i, j; | ||
18 | char im1[100], im2[100]; | ||
19 | |||
20 | |||
21 | printf("Input image: "); | ||
22 | scanf("%s", im1); | ||
23 | Icur = readImage(im1); | ||
24 | rows = Icur->height; | ||
25 | cols = Icur->width; | ||
26 | |||
27 | printf("start\n"); | ||
28 | for_each_job{ | ||
29 | v = harris(Icur); | ||
30 | interestPnts = getANMS(v, 24); | ||
31 | int1 = fMallocHandle(interestPnts->height, 1); | ||
32 | int2 = fSetArray(interestPnts->height, 1, 0); | ||
33 | for(i=0; i<int1->height; i++) | ||
34 | { | ||
35 | asubsref(int1,i) = subsref(interestPnts,i,0); | ||
36 | asubsref(int2,i) = subsref(interestPnts,i,1); | ||
37 | } | ||
38 | |||
39 | Fcur = extractFeatures(Icur, int1, int2); | ||
40 | } | ||
41 | printf("end..\n"); | ||
42 | |||
43 | |||
44 | #ifdef CHECK | ||
45 | /** Self checking - use expected.txt from data directory **/ | ||
46 | { | ||
47 | int ret=0; | ||
48 | float tol = 0.02; | ||
49 | #ifdef GENERATE_OUTPUT | ||
50 | fWriteMatrix(Fcur, argv[1]); | ||
51 | #endif | ||
52 | ret = fSelfCheck(Fcur, "expected_C.txt", tol); | ||
53 | if (ret == -1) | ||
54 | printf("Error in Stitch\n"); | ||
55 | } | ||
56 | #endif | ||
57 | iFreeHandle(Icur); | ||
58 | fFreeHandle(v); | ||
59 | fFreeHandle(interestPnts); | ||
60 | fFreeHandle(int1); | ||
61 | fFreeHandle(int2); | ||
62 | fFreeHandle(Fcur); | ||
63 | WRITE_TO_FILE | ||
64 | return 0; | ||
65 | } | ||