diff --git a/MicroBenchmarks/harris/harris.h b/MicroBenchmarks/harris/harris.h --- a/MicroBenchmarks/harris/harris.h +++ b/MicroBenchmarks/harris/harris.h @@ -28,13 +28,13 @@ // Initialize a checkboard image void initCheckboardImage(int height, int width); // print image to output.txt -void printImage(int height, int width, float img[(2 + HEIGHT)][2 + WIDTH]); +void printImage(int height, int width, float img[HEIGHT][WIDTH]); // harris kernel from polymage_naive.cpp void harrisKernel(int height , int width , float inputImg[2 + HEIGHT][2 + WIDTH] - , float outputImg[(2 + HEIGHT)][2 + WIDTH] + , float outputImg[HEIGHT][WIDTH] , float Ix [(2 + HEIGHT)][2 + WIDTH] , float Iy [(2 + HEIGHT)][2 + WIDTH] , float Ixx [(2 + HEIGHT)][2 + WIDTH] diff --git a/MicroBenchmarks/harris/harrisKernel.cpp b/MicroBenchmarks/harris/harrisKernel.cpp --- a/MicroBenchmarks/harris/harrisKernel.cpp +++ b/MicroBenchmarks/harris/harrisKernel.cpp @@ -3,7 +3,7 @@ // harris kernel from polymage_naive.cpp void harrisKernel( int height, int width, float inputImg[2 + HEIGHT][2 + WIDTH], - float outputImg[(2 + HEIGHT)][2 + WIDTH], float Ix[(2 + HEIGHT)][2 + WIDTH], + float outputImg[HEIGHT][WIDTH], float Ix[(2 + HEIGHT)][2 + WIDTH], float Iy[(2 + HEIGHT)][2 + WIDTH], float Ixx[(2 + HEIGHT)][2 + WIDTH], float Ixy[(2 + HEIGHT)][2 + WIDTH], float Iyy[(2 + HEIGHT)][2 + WIDTH], float Sxx[(2 + HEIGHT)][2 + WIDTH], float Sxy[(2 + HEIGHT)][2 + WIDTH], @@ -103,7 +103,7 @@ } } - for (int _i0 = 2; (_i0 < height); _i0++) { + for (int _i0 = 0; (_i0 < height); _i0++) { for (int _i1 = 2; (_i1 < width); _i1++) { outputImg[_i0][_i1] = (det[_i0][_i1] - ((0.04f * trace[_i0][_i1]) * trace[_i0][_i1])); diff --git a/MicroBenchmarks/harris/main.cpp b/MicroBenchmarks/harris/main.cpp --- a/MicroBenchmarks/harris/main.cpp +++ b/MicroBenchmarks/harris/main.cpp @@ -29,7 +29,7 @@ } // Writes image matrix to a file. -void printImage(int height, int width, float arr[(2 + HEIGHT)][2 + WIDTH], +void printImage(int height, int width, float arr[HEIGHT][WIDTH], int dummy) { std::ofstream myfile; myfile.open("output.txt"); @@ -63,9 +63,9 @@ malloc(sizeof(float) * (2 + HEIGHT) * (2 + WIDTH)); initCheckboardImage((HEIGHT + 2), (WIDTH + 2), *image); - float(*imageOutput)[2 + HEIGHT][2 + WIDTH]; - imageOutput = (float(*)[2 + HEIGHT][2 + WIDTH]) - malloc(sizeof(float) * (2 + HEIGHT) * (2 + WIDTH)); + float(*imageOutput)[HEIGHT][WIDTH]; + imageOutput = (float(*)[HEIGHT][WIDTH]) + malloc(sizeof(float) * HEIGHT * WIDTH); float(*Ix)[2 + HEIGHT][2 + WIDTH]; float(*Iy)[2 + HEIGHT][2 + WIDTH]; @@ -154,9 +154,9 @@ malloc(sizeof(float) * (2 + HEIGHT) * (2 + WIDTH)); initCheckboardImage((HEIGHT + 2), (WIDTH + 2), *image); - float(*imageOutput)[2 + HEIGHT][2 + WIDTH]; - imageOutput = (float(*)[2 + HEIGHT][2 + WIDTH]) - malloc(sizeof(float) * (2 + HEIGHT) * (2 + WIDTH)); + float(*imageOutput)[HEIGHT][WIDTH]; + imageOutput = (float(*)[HEIGHT][WIDTH]) + malloc(sizeof(float) * HEIGHT * WIDTH); float(*Ix)[2 + HEIGHT][2 + WIDTH]; float(*Iy)[2 + HEIGHT][2 + WIDTH];