summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/disparity/src/c/getDisparity.c
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/benchmarks/disparity/src/c/getDisparity.c
parent601ed25a4c5b66cb75315832c15613a727db2c26 (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/disparity/src/c/getDisparity.c')
-rw-r--r--SD-VBS/benchmarks/disparity/src/c/getDisparity.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/disparity/src/c/getDisparity.c b/SD-VBS/benchmarks/disparity/src/c/getDisparity.c
new file mode 100644
index 0000000..3246e97
--- /dev/null
+++ b/SD-VBS/benchmarks/disparity/src/c/getDisparity.c
@@ -0,0 +1,43 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "disparity.h"
8
9I2D* getDisparity(I2D* Ileft, I2D* Iright, int win_sz, int max_shift,
10 I2D* minSAD, I2D* retDisp, I2D* halfWin,
11 I2D* IrightPadded, I2D* IleftPadded, I2D* Iright_moved,
12 F2D* retSAD, F2D* SAD, F2D* integralImg,
13 I2D* range)
14{
15 int nr, nc, k;
16 int half_win_sz, rows, cols;
17
18 nr = Ileft->height;
19 nc = Ileft->width;
20 half_win_sz=win_sz/2;
21
22
23 fResetArray(minSAD, nr, nc, 255.0*255.0);
24 iResetArray(retDisp, nr, nc,max_shift);
25 iResetArray(halfWin, 1,2,half_win_sz);
26
27 rows = IleftPadded->height;
28 cols = IleftPadded->width;
29 fResetArray(SAD, rows, cols,255);
30 fResetArray(integralImg, rows, cols,0);
31 //fResetArray(retSAD,rows-win_sz, cols-win_sz, 0);
32 iResetArray(Iright_moved, rows, cols, 0);
33
34 for( k=0; k<max_shift; k++)
35 {
36 correlateSAD_2D(IleftPadded, IrightPadded, Iright_moved, win_sz, k, SAD, integralImg, retSAD, range);
37 findDisparity(retSAD, minSAD, retDisp, k, nr, nc);
38 }
39
40
41 return retDisp;
42}
43