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/tracking/src/c/getInterpolatePatch.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/tracking/src/c/getInterpolatePatch.c')
-rw-r--r-- | SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c b/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c new file mode 100644 index 0000000..99e95f9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** Perform simple interpolation around 2*winSize*2*winSize neighbourhood **/ | ||
8 | F2D* getInterpolatePatch(F2D* src, int cols, float centerX, float centerY, int winSize) | ||
9 | { | ||
10 | F2D *dst; | ||
11 | float a, b, a11, a12, a21, a22; | ||
12 | int i, j, k, srcIdx, dstIdx; | ||
13 | int srcIdxx, dstIdxx; | ||
14 | |||
15 | a = centerX - floor(centerX); | ||
16 | b = centerY - floor(centerY); | ||
17 | |||
18 | a11 = (1-a)*(1-b); | ||
19 | a12 = a*(1-b); | ||
20 | a21 = (1-a)*b; | ||
21 | a22 = a*b; | ||
22 | |||
23 | dst = fSetArray(1,2*winSize*2*winSize, 0); | ||
24 | |||
25 | |||
26 | for(i=-winSize; i<winSize; i++) | ||
27 | { | ||
28 | srcIdxx = floor(centerY) + i; | ||
29 | dstIdxx = i+winSize; | ||
30 | |||
31 | for(j=-winSize; j<(winSize); j++) | ||
32 | { | ||
33 | srcIdx = srcIdxx * cols + floor(centerX) + j; | ||
34 | dstIdx = dstIdxx * 2 * winSize + j + winSize; | ||
35 | asubsref(dst,dstIdx) = asubsref(src,srcIdx)*a11 + asubsref(src,srcIdx+1)*a12 + asubsref(src,srcIdx+cols)*a21 + asubsref(src,srcIdx+1+cols)*a22; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | return dst; | ||
40 | } | ||
41 | |||
42 | |||
43 | |||