diff options
| author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
|---|---|---|
| committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
| commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
| tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/disparity/src | |
| parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) | |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/disparity/src')
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/computeSAD.c | 27 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/correlateSAD_2D.c | 34 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/disparity.h | 24 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/finalSAD.c | 28 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/findDisparity.c | 29 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/getDisparity.c | 43 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/integralImage2D2D.c | 31 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/padarray2.c | 33 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/padarray4.c | 41 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/disparity/src/c/script_disparity.c | 132 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/disparity/src/matlab/getDisparity.m | 54 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/disparity/src/matlab/refineDisparity.m | 31 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/disparity/src/matlab/script_run_profile.m | 43 |
13 files changed, 550 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/disparity/src/c/computeSAD.c b/SD-VBS/benchmarks/disparity/src/c/computeSAD.c new file mode 100644 index 0000000..e12bd55 --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/computeSAD.c | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "disparity.h" | ||
| 8 | |||
| 9 | void computeSAD(I2D *Ileft, I2D* Iright_moved, F2D* SAD) | ||
| 10 | { | ||
| 11 | int rows, cols, i, j, diff; | ||
| 12 | |||
| 13 | rows = Ileft->height; | ||
| 14 | cols = Ileft->width; | ||
| 15 | |||
| 16 | for(i=0; i<rows; i++) | ||
| 17 | { | ||
| 18 | for(j=0; j<cols; j++) | ||
| 19 | { | ||
| 20 | diff = subsref(Ileft,i,j) - subsref(Iright_moved,i,j); | ||
| 21 | subsref(SAD,i,j) = diff * diff; | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | return; | ||
| 26 | } | ||
| 27 | |||
diff --git a/SD-VBS/benchmarks/disparity/src/c/correlateSAD_2D.c b/SD-VBS/benchmarks/disparity/src/c/correlateSAD_2D.c new file mode 100644 index 0000000..6b43cbd --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/correlateSAD_2D.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "disparity.h" | ||
| 8 | |||
| 9 | void correlateSAD_2D(I2D* Ileft, I2D* Iright, I2D* Iright_moved, int win_sz, int disparity, F2D* SAD, F2D* integralImg, F2D* retSAD, I2D* range) | ||
| 10 | { | ||
| 11 | int rows, cols; | ||
| 12 | int i, j, endRM; | ||
| 13 | //I2D *range; | ||
| 14 | |||
| 15 | //iResetArray(range,1,2,0); | ||
| 16 | subsref(range,0,0) = 0; | ||
| 17 | subsref(range,0,1) = disparity; | ||
| 18 | |||
| 19 | rows = Iright_moved->height; | ||
| 20 | cols = Iright_moved->width; | ||
| 21 | |||
| 22 | for(i=0; i<rows*cols; i++) | ||
| 23 | asubsref(Iright_moved,i) = 0; | ||
| 24 | |||
| 25 | padarray4(Iright, range, -1, Iright_moved); | ||
| 26 | |||
| 27 | computeSAD(Ileft, Iright_moved, SAD); | ||
| 28 | integralImage2D2D(SAD, integralImg); | ||
| 29 | finalSAD(integralImg, win_sz, retSAD); | ||
| 30 | |||
| 31 | //iFreeHandle(range); | ||
| 32 | return; | ||
| 33 | } | ||
| 34 | |||
diff --git a/SD-VBS/benchmarks/disparity/src/c/disparity.h b/SD-VBS/benchmarks/disparity/src/c/disparity.h new file mode 100644 index 0000000..8617a87 --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/disparity.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #ifndef _DISP_ | ||
| 6 | #define _DISP_ | ||
| 7 | |||
| 8 | #include "sdvbs_common.h" | ||
| 9 | void computeSAD(I2D *Ileft, I2D* Iright_moved, F2D* SAD); | ||
| 10 | I2D* getDisparity(I2D* Ileft, I2D* Iright, int win_sz, int max_shift, | ||
| 11 | I2D* minSAD, I2D* retDisp, I2D* halfWin, | ||
| 12 | I2D* IrightPadded, I2D* IleftPadded, I2D* Iright_moved, | ||
| 13 | F2D* retSAD, F2D* SAD, F2D* integralImg, | ||
| 14 | I2D* range); | ||
| 15 | void finalSAD(F2D* integralImg, int win_sz, F2D* retSAD); | ||
| 16 | void findDisparity(F2D* retSAD, F2D* minSAD, I2D* retDisp, int level, int nr, int nc); | ||
| 17 | void integralImage2D2D(F2D* SAD, F2D* integralImg); | ||
| 18 | void correlateSAD_2D(I2D* Ileft, I2D* Iright, I2D* Iright_moved, int win_sz, int disparity, F2D* SAD, F2D* integralImg, F2D* retSAD, I2D* range); | ||
| 19 | I2D* padarray2(I2D* inMat, I2D* borderMat); | ||
| 20 | void padarray4(I2D* inMat, I2D* borderMat, int dir, I2D* paddedArray); | ||
| 21 | |||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
diff --git a/SD-VBS/benchmarks/disparity/src/c/finalSAD.c b/SD-VBS/benchmarks/disparity/src/c/finalSAD.c new file mode 100644 index 0000000..8155820 --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/finalSAD.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "disparity.h" | ||
| 8 | |||
| 9 | void finalSAD(F2D* integralImg, int win_sz, F2D* retSAD) | ||
| 10 | { | ||
| 11 | int endR, endC; | ||
| 12 | int i, j, k; | ||
| 13 | |||
| 14 | endR = integralImg->height; | ||
| 15 | endC = integralImg->width; | ||
| 16 | |||
| 17 | k = 0; | ||
| 18 | for(j=0; j<(endC-win_sz); j++) | ||
| 19 | { | ||
| 20 | for(i=0; i<(endR-win_sz); i++) | ||
| 21 | { | ||
| 22 | subsref(retSAD,i,j) = subsref(integralImg,(win_sz+i),(j+win_sz)) + subsref(integralImg,(i+1) ,(j+1)) - subsref(integralImg,(i+1),(j+win_sz)) - subsref(integralImg,(win_sz+i),(j+1)); | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | return; | ||
| 27 | } | ||
| 28 | |||
diff --git a/SD-VBS/benchmarks/disparity/src/c/findDisparity.c b/SD-VBS/benchmarks/disparity/src/c/findDisparity.c new file mode 100644 index 0000000..6335daf --- /dev/null +++ b/SD-VBS/benchmarks/disparity/src/c/findDisparity.c | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "disparity.h" | ||
| 8 | |||
| 9 | void findDisparity(F2D* retSAD, F2D* minSAD, I2D* retDisp, int level, int nr, int nc) | ||
| 10 | { | ||
| 11 | int i, j, a, b; | ||
| 12 | |||
| 13 | for(i=0; i<nr; i++) | ||
| 14 | { | ||
| 15 | for(j=0; j<nc; j++) | ||
| 16 | { | ||
| 17 | a = subsref(retSAD,i,j); | ||
| 18 | b = subsref(minSAD,i,j); | ||
| 19 | if(a<b) | ||
| 20 | { | ||
| 21 | subsref(minSAD,i,j) = a; | ||
| 22 | subsref(retDisp,i,j) = level; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | } | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | |||
| 29 | |||
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 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "disparity.h" | ||
| 8 | |||
| 9 | I2D* 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; | ||
