From 14c854543b1a3cf344a371a5b45595657f95786b Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Tue, 26 Oct 2021 13:22:32 -0400 Subject: add deadlines and costs --- SD-VBS/benchmarks/stitch/src/c/dist2.c | 76 ---------- SD-VBS/benchmarks/stitch/src/c/extractFeatures.c | 181 ----------------------- SD-VBS/benchmarks/stitch/src/c/getANMS.c | 145 ------------------ SD-VBS/benchmarks/stitch/src/c/harris.c | 141 ------------------ SD-VBS/benchmarks/stitch/src/c/matchFeatures.c | 55 ------- SD-VBS/benchmarks/stitch/src/c/maxWindow.c | 51 ------- SD-VBS/benchmarks/stitch/src/c/script_stitch.c | 67 --------- SD-VBS/benchmarks/stitch/src/c/stitch.h | 22 --- SD-VBS/benchmarks/stitch/src/c/supress.c | 29 ---- 9 files changed, 767 deletions(-) delete mode 100644 SD-VBS/benchmarks/stitch/src/c/dist2.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/extractFeatures.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/getANMS.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/harris.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/matchFeatures.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/maxWindow.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/script_stitch.c delete mode 100644 SD-VBS/benchmarks/stitch/src/c/stitch.h delete mode 100644 SD-VBS/benchmarks/stitch/src/c/supress.c (limited to 'SD-VBS/benchmarks/stitch/src/c') diff --git a/SD-VBS/benchmarks/stitch/src/c/dist2.c b/SD-VBS/benchmarks/stitch/src/c/dist2.c deleted file mode 100644 index d76fcb2..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/dist2.c +++ /dev/null @@ -1,76 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -F2D* dist2(I2D* x, F2D* c) -{ - int ndata, dimx, ncentres, dimc, i, j, k; - F2D *n2, *t1, *t2; - float temp; - F2D *s1, *s2, *ctrans; - F2D *mult1, *mult2, *mult3; - - ndata = x->height; - dimx = x->width; - - ncentres = c->height; - dimc = c->width; - - if(dimx != dimc) - return NULL; - - s1 = fSetArray(ncentres, 1, 1); - s2 = fSetArray(ndata, 1, 1); - t1 = fMallocHandle(1, x->height); - - for(j=0; jwidth; j++) - { - temp = 0; - for(i=0; iheight; i++) - { - temp += subsref(x,j,i) * subsref(x,j,i); - } - - asubsref(t1,j) = temp; - } - - mult1 = fMtimes(s1, t1); - t2 = fMallocHandle(1, c->height); - - for(j=0; jwidth; j++) - { - temp = 0; - for(i=0; iheight; i++) - { - temp += subsref(c,j,i) * subsref(c,j,i); - } - - asubsref(t2,j) = temp; - } - - mult2 = fMtimes(s2, t2); - ctrans = fTranspose(c); - mult3 = ifMtimes(x, ctrans); - - for(i=0; i<(mult3->height * mult3->width); i++) - asubsref(mult3,i) = asubsref(mult3,i) * 2; - - free(t1); - free(t2); - free(s1); - free(s2); - free(ctrans); - - n2 = fMallocHandle(ndata, ncentres); - for(i=0; i<(ndata*ncentres); i++) - asubsref(n2,i) = asubsref(mult1,i) + asubsref(mult2,i) - asubsref(mult3,i); - - free(mult1); - free(mult2); - free(mult3); - - return n2; - -} diff --git a/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c b/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c deleted file mode 100644 index ea574e4..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/extractFeatures.c +++ /dev/null @@ -1,181 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" -#include - -#define min(a,b) (aheight; - - vecF = fMallocHandle(n, 64); - I1 = fiDeepCopy(I); - - Iconv = ffConv2(I1, g); - fFreeHandle(I1); - I1 = ffConv2(Iconv, g); - fFreeHandle(Iconv); - Iconv = fDeepCopy(I1); - - { - int i = (Iconv->height/5); - int j = (Iconv->width/5); - Isub = fMallocHandle(i, j); - } - - for(i=0, m=0; mheight; i+=5, m++) - { - for(j=0, k=0; kwidth; j+=5, k++) - { - subsref(Isub,m,k) = subsref(Iconv,i,j); - } - } - - fFreeHandle(Iconv); - fFreeHandle(g1); - fFreeHandle(g); - fFreeHandle(I1); - - nr = Isub->height; - nc = Isub->width; - - Xsub = iMallocHandle(x->height, x->width); - Ysub = iMallocHandle(y->height, y->width); - -// printf("Sizes = %d\t%d\t%d\t%d\n", Isub->height, Isub->width, x->height, x->width); - - for(i=0; i<(x->height*x->width); i++) - { - asubsref(Xsub,i) = min( ( asubsref(x,i) /5), nc-4 ); - asubsref(Ysub,i) = min( ( asubsref(y,i) /5), nr-4 ); - } - - { - int maxX, maxY; - maxX = Xsub->height>Xsub->width?Xsub->height:Xsub->width; - maxY = Ysub->height>Ysub->width?Ysub->height:Ysub->width; - if(maxX < 6 || maxY < 10) - { - fFreeHandle(vecF); - vecF = fSetArray(n,2,0); - for(i=0; i<(x->height); i++) - { - subsref(vecF, i, 0) = asubsref(Xsub,i)*1.0; - subsref(vecF, i, 1) = asubsref(Ysub,i)*1.0; - } - - fFreeHandle(Isub); - iFreeHandle(Xsub); - iFreeHandle(Ysub); - return vecF; - } - } - - { - int newSize = 4; - if(I->height > 32 && I->width >32) - newSize = 64; - fFreeHandle(vecF); - vecF = fMallocHandle(n, newSize); - } - -// printf("Size of Isub = %d\t%d\n", Isub->height, Isub->width); - for(i=0; i= (Isub->height-4)) - asubsref(Ysub,i) = Isub->height-5; - if( asubsref(Xsub,i) >= (Isub->width-4)) - asubsref(Xsub,i) = Isub->width-5; - - m = 0; - temp = 0; -// printf("SUBS %d\t%d\n", asubsref(Ysub,i), asubsref(Xsub,i)); - - for(k= asubsref(Xsub,i)-3; k<=( asubsref(Xsub,i)+4); k++) - { - for(j= asubsref(Ysub,i)-3; j<=( asubsref(Ysub,i)+4); j++) - { -// printf("%d\t%d\n", j, k); - subsref(vecF,i,m) = subsref(Isub,j,k); - temp += subsref(vecF,i,m); - m++; - } - } - mean = temp/64.0; - - std = 0; - for(j=0; j<64; j++) - { - subsref(vecF,i,j) = subsref(vecF,i,j) - mean; - std += subsref(vecF,i,j) * subsref(vecF,i,j); - } - - std = std/64; - std = sqrt(std); - for(j=0; j<64; j++) - { - subsref(vecF,i,j) = subsref(vecF,i,j)/std; - } - } - - iFreeHandle(Xsub); - fFreeHandle(Isub); - iFreeHandle(Ysub); - return vecF; -} - - - diff --git a/SD-VBS/benchmarks/stitch/src/c/getANMS.c b/SD-VBS/benchmarks/stitch/src/c/getANMS.c deleted file mode 100644 index fa03a85..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/getANMS.c +++ /dev/null @@ -1,145 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -F2D* getANMS (F2D *points, int r) -{ - unsigned int MAX_LIMIT = 10000000; - F2D *suppressR; - float C_ROBUST = 0.9; - F2D *srtdPnts; - int n, k; - I2D *srtdVIdx, *supId; - float r_sq, t, t1; - F2D *tempF, *srtdV, *interestPnts; - int i, j, validCount=0, cnt, end; - F2D *v; - int iter, rows, cols; - F2D* temp; - int supIdPtr = 0; - - v = fMallocHandle(points->height, 1); - for(i=0; iheight; i++) - asubsref(v,i) = subsref(points,i,2); - - r_sq = r * r * 1.0; - n = v->height; - - srtdVIdx = fSortIndices (v, 1); - srtdPnts = fMallocHandle (srtdVIdx->height, points->width); - - for (i = 0; i < srtdVIdx->height; i++) - for(j=0; jwidth; j++) - subsref(srtdPnts,i,j) = subsref(points, asubsref(srtdVIdx,i), j); - - temp = fSetArray (1, 3, 0); - suppressR = fSetArray(n, 1, MAX_LIMIT); - - validCount = 0; - iter = 0; - for (i = 0; i < suppressR->height; i++) - { - if ( asubsref(suppressR,i) > r_sq) - { - validCount++; - } - } - - k = 0; - supId = iMallocHandle(validCount, 1); - for (i = 0; i < (suppressR->height*suppressR->width); i++) - { - if ( asubsref(suppressR,i) > r_sq) - { - asubsref(supId,k++) = i; - } - } - - while (validCount > 0) - { - F2D *tempp, *temps; - asubsref(temp,0) = subsref(srtdPnts, asubsref(supId,0), 0); - asubsref(temp,1) = subsref(srtdPnts, asubsref(supId,0), 1); - asubsref(temp,2) = subsref(srtdPnts, asubsref(supId,0), 2); - - if(iter == 0) - interestPnts = fDeepCopy(temp); - else - { - tempp = fDeepCopy(interestPnts); - fFreeHandle(interestPnts); - interestPnts = ffVertcat(tempp, temp); - fFreeHandle(tempp); - } - iter++; - - tempp = fDeepCopy(srtdPnts); - temps = fDeepCopy(suppressR); - - fFreeHandle(srtdPnts); - fFreeHandle(suppressR); - - srtdPnts = fMallocHandle(supId->height-1, 3); - suppressR = fMallocHandle(supId->height-1, 1); - - k=0; - for(i=1; iheight; i++) - { - subsref(srtdPnts,k,0) = subsref(tempp, asubsref(supId,i) ,0); - subsref(srtdPnts,k,1) = subsref(tempp, asubsref(supId,i) ,1); - subsref(srtdPnts,k,2) = subsref(tempp, asubsref(supId,i) ,2); - subsref(suppressR,k,0) = subsref(temps, asubsref(supId,i) ,0); - k++; - } - - fFreeHandle(tempp); - fFreeHandle(temps); - rows = interestPnts->height-1; - cols = interestPnts->width; - for (i = 0; i < srtdPnts->height; i++) - { - t = 0; - t1 = 0; - - if ((C_ROBUST * subsref(interestPnts,rows,2)) >= subsref(srtdPnts, i,2)) - { - t = subsref(srtdPnts, i,0) - subsref(interestPnts,rows,0); - t1 = subsref(srtdPnts, i,1) - subsref(interestPnts,rows,1); - t = t * t + t1 * t1; - t1 = 0; - } - - if ((C_ROBUST * subsref(interestPnts,rows,2)) < subsref(srtdPnts, i,2)) - t1 = 1 * MAX_LIMIT; - - if ( asubsref(suppressR, i) > (t + t1)) - { - asubsref(suppressR, i) = t + t1; - } - } - - validCount=0; - for (i = 0; i < suppressR->height; i++) - if ( asubsref(suppressR,i) > r_sq) - validCount++; - - k = 0; - iFreeHandle(supId); - supId = iMallocHandle(validCount, 1); - - for (i = 0; i < suppressR->height*suppressR->width; i++) - if ( asubsref(suppressR,i) > r_sq) - asubsref(supId,k++) = i; - } - - iFreeHandle(supId); - iFreeHandle(srtdVIdx); - fFreeHandle(srtdPnts); - fFreeHandle(temp); - fFreeHandle(suppressR); - fFreeHandle(v); - - return interestPnts; -} diff --git a/SD-VBS/benchmarks/stitch/src/c/harris.c b/SD-VBS/benchmarks/stitch/src/c/harris.c deleted file mode 100644 index a24c2b4..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/harris.c +++ /dev/null @@ -1,141 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -F2D* harris(I2D* im) -{ - F2D *img1; - F2D *g1, *g2, *g; - F2D *Ix, *Iy; - F2D *Ix2, *Iy2, *IxIy; - F2D *v, *R, *Rmax, *Rnm; - float eps; - F2D *sobel, *sob, *temp, *temp1; - I2D *win, *x, *y; - int i; - - g1 = fSetArray(5,5,0); - g2 = fSetArray(3,3,0); - - asubsref(g1,0) = 1; - asubsref(g1,1) = 4; - asubsref(g1,2) = 6; - asubsref(g1,3) = 4; - asubsref(g1,4) = 1; - - asubsref(g1,5) = 4; - asubsref(g1,6) = 16; - asubsref(g1,7) = 24; - asubsref(g1,8) = 16; - asubsref(g1,9) = 4; - - asubsref(g1,10) = 6; - asubsref(g1,11) = 24; - asubsref(g1,12) = 36; - asubsref(g1,13) = 24; - asubsref(g1,14) = 6; - - asubsref(g1,15) = 4; - asubsref(g1,16) = 16; - asubsref(g1,17) = 24; - asubsref(g1,18) = 16; - asubsref(g1,19) = 4; - - asubsref(g1,20) = 1; - asubsref(g1,21) = 4; - asubsref(g1,22) = 6; - asubsref(g1,23) = 4; - asubsref(g1,24) = 1; - - asubsref(g2,0) = 1; - asubsref(g2,1) = 2; - asubsref(g2,2) = 1; - - asubsref(g2,3) = 2; - asubsref(g2,4) = 4; - asubsref(g2,5) = 2; - - asubsref(g2,6) = 1; - asubsref(g2,7) = 2; - asubsref(g2,8) = 1; - - g = fDivide(g1, 256); - sob = fMallocHandle(1,3); - asubsref(sob,0) = -0.5; - asubsref(sob,1) = 0; - asubsref(sob,2) = 0.5; - - { - F2D* imf; - imf = fiDeepCopy(im); - img1 = ffConv2(imf, g); - fFreeHandle(imf); - } - - Ix = ffConv2(img1, sob); - fFreeHandle(sob); - sob = fMallocHandle(3,1); - asubsref(sob,0) = -0.5; - asubsref(sob,1) = 0; - asubsref(sob,2) = 0.5; - Iy = ffConv2(img1, sob); - - fFreeHandle(g); - g = fDivide(g2, 16); - eps = 2.2204e-16; - sobel = fTimes(Ix, Ix); - Ix2 = ffConv2(sobel, g); - fFreeHandle(sobel); - - sobel = fTimes(Iy, Iy); - Iy2 = ffConv2(sobel, g); - fFreeHandle(sobel); - - sobel = fTimes(Ix, Iy); - IxIy = ffConv2(sobel, g); - fFreeHandle(sobel); - - temp = fTimes(Ix2, Iy2); - temp1 = fTimes(IxIy, IxIy); - sobel = fMinus(temp, temp1); - - fFreeHandle(temp); - temp = fPlus(Ix2, Iy2); - - for(i=0; i<(temp->height*temp->width); i++) - asubsref(temp,i) += eps; - - R = ffDivide(sobel, temp); - - win = iSetArray(1,2,3); - Rmax = maxWindow(R, win); - Rnm = supress(R, Rmax); - - v = fFind3(Rnm); - - iFreeHandle(win); - fFreeHandle(Rmax); - fFreeHandle(Rnm); - fFreeHandle(R); - - fFreeHandle(img1); - fFreeHandle(g1); - fFreeHandle(g2); - fFreeHandle(g); - fFreeHandle(Ix); - fFreeHandle(Iy); - fFreeHandle(Ix2); - fFreeHandle(Iy2); - fFreeHandle(IxIy); - fFreeHandle(sobel); - fFreeHandle(sob); - fFreeHandle(temp); - fFreeHandle(temp1); -// iFreeHandle(x); -// iFreeHandle(y); - - return v; -} - diff --git a/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c b/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c deleted file mode 100644 index 5450eb9..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c +++ /dev/null @@ -1,55 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -I2D* matchFeatures(F2D* vecF1, F2D* vecF2) -{ - int m, n, n1, n2, n1c, n2c, i, j; - I2D *id, *retMatch, *t; - F2D *val, *temp; - int rows, cols; - - n1 = vecF1->height; - n1c = vecF1->width; - n2 = vecF2->height; - n2c = vecF2->width; - - retMatch = iMallocHandle(1, 2); - - for(i=0; iheight + 1; - cols = t->width; - retMatch = iMallocHandle(rows, cols); - n = 0; - - for(m=0; m<(t->height*t->width); m++) - { - asubsref(retMatch,n++) = asubsref(t,m); - } - - asubsref(retMatch,n++) = i; - asubsref(retMatch,n) = asubsref(id,0); - } - } - - return retMatch; -} diff --git a/SD-VBS/benchmarks/stitch/src/c/maxWindow.c b/SD-VBS/benchmarks/stitch/src/c/maxWindow.c deleted file mode 100644 index 07f8dc9..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/maxWindow.c +++ /dev/null @@ -1,51 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -F2D* maxWindow(F2D* im, I2D* window) -{ - int exR, exC, rows, cols, tr, tc, i, j, k; - F2D *out, *temp; - float t; - int m; - - exR = asubsref(window,0)/2; - exC = asubsref(window,1)/2; - - rows = im->height; - cols = im->width; - - tr = rows+exR-1; - tc = cols+exC-1; - temp = fDeepCopy(im); - out = fMallocHandle(rows, cols); - - for(i=0; i= rows || (j+m) < 0 || (j+m) >= cols) - continue; - if( subsref(temp,(i+k),(j+m)) > t) - t = subsref(temp,(i+k),(j+m)); - } - } - subsref(out,i,j) = t; - } - } - - fFreeHandle(temp); - return out; -} - - - - - diff --git a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c b/SD-VBS/benchmarks/stitch/src/c/script_stitch.c deleted file mode 100644 index ee68e70..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/script_stitch.c +++ /dev/null @@ -1,67 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" -#include -#include "extra.h" -// Valgrind says we use 250Mb of heap - round up to 512Mb -#define STITCH_MEM 1<<29 -int main(int argc, char* argv[]) -{ - SET_UP - mallopt(M_TOP_PAD, STITCH_MEM); - mallopt(M_MMAP_MAX, 0); - int rows, cols; - F2D *x, *y, *v, *interestPnts, *Fcur, *int1, *int2; - I2D *Icur; - int i, j; - char im1[100], im2[100]; - x = y = v = Fcur = int1 = int2 = interestPnts = NULL; - - scanf("%s", im1); - Icur = readImage(im1); - rows = Icur->height; - cols = Icur->width; - - for_each_job { - fFreeHandle(v); - fFreeHandle(interestPnts); - fFreeHandle(int1); - fFreeHandle(int2); - fFreeHandle(Fcur); - v = harris(Icur); - interestPnts = getANMS(v, 24); - int1 = fMallocHandle(interestPnts->height, 1); - int2 = fSetArray(interestPnts->height, 1, 0); - for(i=0; iheight; i++) - { - asubsref(int1,i) = subsref(interestPnts,i,0); - asubsref(int2,i) = subsref(interestPnts,i,1); - } - - Fcur = extractFeatures(Icur, int1, int2); - } - -#ifdef CHECK - /** Self checking - use expected.txt from data directory **/ - { - int ret=0; - float tol = 0.02; -#ifdef GENERATE_OUTPUT - fWriteMatrix(Fcur, argv[1]); -#endif - ret = fSelfCheck(Fcur, "expected_C.txt", tol); - if (ret == -1) - printf("Error in Stitch\n"); - } -#endif - WRITE_TO_FILE - fFreeHandle(Icur); - fFreeHandle(v); - fFreeHandle(interestPnts); - fFreeHandle(int1); - fFreeHandle(int2); - fFreeHandle(Fcur); - return 0; -} diff --git a/SD-VBS/benchmarks/stitch/src/c/stitch.h b/SD-VBS/benchmarks/stitch/src/c/stitch.h deleted file mode 100644 index e2202fc..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/stitch.h +++ /dev/null @@ -1,22 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#ifndef _SCRIPT_STITCH_ -#define _SCRIPT_STITCH_ - -#include "sdvbs_common.h" - -F2D* dist2(I2D* x, F2D* c); -F2D* extractFeatures(I2D* I, F2D* x, F2D* y); -F2D* getANMS (F2D *points, int r); -F2D* harris(I2D* im); -I2D* matchFeatures(F2D* vecF1, F2D* vecF2); -F2D* maxWindow(F2D* im, I2D* window); -F2D* supress(F2D* im, F2D* im1); -int script_stitch(); - -#endif - - - diff --git a/SD-VBS/benchmarks/stitch/src/c/supress.c b/SD-VBS/benchmarks/stitch/src/c/supress.c deleted file mode 100644 index 6fbdb6c..0000000 --- a/SD-VBS/benchmarks/stitch/src/c/supress.c +++ /dev/null @@ -1,29 +0,0 @@ -/******************************** -Author: Sravanthi Kota Venkata -********************************/ - -#include "stitch.h" - -F2D* supress(F2D* im, F2D* im1) -{ - int rows, cols, i, j; - F2D *out; - - rows = im->height; - cols = im->width; - - out = fSetArray(rows, cols, 0); - - for(i=0; i