diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 19:07:11 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 20:54:41 -0400 |
| commit | 1120161286ee5c855b630bccc9e0b37bb8a3ee65 (patch) | |
| tree | 082a47491403a624a28f8b2bf8e20bbdb3f5e0e7 /dis/Neighborhood | |
| parent | 5aad2261f7c012aa16a93c7c5bf6bda0081658fb (diff) | |
Fix DIS coding style by running them all through clang-format
Also fixes a missing header in DISstressmarkRNG.h and the "all"
make target. No functional changes.
Diffstat (limited to 'dis/Neighborhood')
| -rw-r--r-- | dis/Neighborhood/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Neighborhood/neighborhood.c | 77 | ||||
| -rw-r--r-- | dis/Neighborhood/utili.h | 435 |
3 files changed, 231 insertions, 282 deletions
diff --git a/dis/Neighborhood/DISstressmarkRNG.h b/dis/Neighborhood/DISstressmarkRNG.h index 4aa2620..6243606 100644 --- a/dis/Neighborhood/DISstressmarkRNG.h +++ b/dis/Neighborhood/DISstressmarkRNG.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #include <assert.h> | ||
| 1 | #include <math.h> | 2 | #include <math.h> |
| 2 | 3 | ||
| 3 | #define IA 16807 | 4 | #define IA 16807 |
diff --git a/dis/Neighborhood/neighborhood.c b/dis/Neighborhood/neighborhood.c index 23f3a8e..614b8e8 100644 --- a/dis/Neighborhood/neighborhood.c +++ b/dis/Neighborhood/neighborhood.c | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Sample code for the DIS Neighborhood Stressmark | 2 | * Sample code for the DIS Neighborhood Stressmark |
| 3 | * | 3 | * |
| 4 | * This source code is the completely correct source code based on | 4 | * This source code is the completely correct source code based on |
| 5 | * the example codes provided by Atlantic Aerospace Division, Titan | 5 | * the example codes provided by Atlantic Aerospace Division, Titan |
| 6 | * Systems Corporation, 2000. | 6 | * Systems Corporation, 2000. |
| 7 | * | 7 | * |
| 8 | * If you just compile and generate the executables from this source | 8 | * If you just compile and generate the executables from this source |
| 9 | * code, this code would be enough. However, if you wish to get a complete | 9 | * code, this code would be enough. However, if you wish to get a complete |
| 10 | * understanding of this stressmark, it is strongly suggested that you | 10 | * understanding of this stressmark, it is strongly suggested that you |
| 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 | 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 |
| 12 | * before going on since the detailed comments are given in this documents. | 12 | * before going on since the detailed comments are given in this documents. |
| @@ -17,19 +17,18 @@ | |||
| 17 | * 06/2020 Joshua Bakita Include image creation time in timing | 17 | * 06/2020 Joshua Bakita Include image creation time in timing |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include "DISstressmarkRNG.h" | ||
| 21 | #include "extra.h" | ||
| 22 | #include "utili.h" | ||
| 23 | #include <assert.h> | ||
| 20 | #include <stdio.h> | 24 | #include <stdio.h> |
| 21 | #include <stdlib.h> | 25 | #include <stdlib.h> |
| 22 | #include <time.h> | 26 | #include <time.h> |
| 23 | #include<assert.h> | ||
| 24 | #include "DISstressmarkRNG.h" | ||
| 25 | #include "utili.h" | ||
| 26 | #include "extra.h" | ||
| 27 | 27 | ||
| 28 | /* | 28 | /* |
| 29 | * main() | 29 | * main() |
| 30 | */ | 30 | */ |
| 31 | int main(int argc, char** argv) | 31 | int main(int argc, char **argv) { |
| 32 | { | ||
| 33 | long int seed; | 32 | long int seed; |
| 34 | int dimension; | 33 | int dimension; |
| 35 | int numberLines; | 34 | int numberLines; |
| @@ -46,10 +45,9 @@ int main(int argc, char** argv) | |||
| 46 | time_t endTime; | 45 | time_t endTime; |
| 47 | SET_UP | 46 | SET_UP |
| 48 | 47 | ||
| 49 | assert(fscanf(stdin, "%ld %d %d %d %d %d %d %d", | 48 | assert(fscanf(stdin, "%ld %d %d %d %d %d %d %d", &seed, &bitDepth, &dimension, |
| 50 | &seed, &bitDepth, &dimension, &numberLines, | 49 | &numberLines, &minThickness, &maxThickness, &distanceShort, |
| 51 | &minThickness, &maxThickness, | 50 | &distanceLong) == 8); |
| 52 | &distanceShort, &distanceLong) == 8); | ||
| 53 | 51 | ||
| 54 | assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); | 52 | assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); |
| 55 | assert((dimension > 0) && (dimension <= MAX_DIMENSION)); | 53 | assert((dimension > 0) && (dimension <= MAX_DIMENSION)); |
| @@ -67,43 +65,32 @@ int main(int argc, char** argv) | |||
| 67 | 65 | ||
| 68 | beginTime = time(NULL); | 66 | beginTime = time(NULL); |
| 69 | START_LOOP | 67 | START_LOOP |
| 70 | createImage(image, dimension, maxPixel, numberLines, | 68 | createImage(image, dimension, maxPixel, numberLines, minThickness, |
| 71 | minThickness, maxThickness); | 69 | maxThickness); |
| 72 | 70 | ||
| 73 | neighborhoodCalculation(image, dimension, | 71 | neighborhoodCalculation(image, dimension, distanceShort, distanceLong, |
| 74 | distanceShort, distanceLong, &values, maxPixel); | 72 | &values, maxPixel); |
| 75 | STOP_LOOP | 73 | STOP_LOOP |
| 76 | endTime = time(NULL); | 74 | endTime = time(NULL); |
| 77 | WRITE_TO_FILE | 75 | WRITE_TO_FILE |
| 78 | 76 | ||
| 79 | // printf(" end time is %d\n", endTime); | 77 | // printf(" end time is %d\n", endTime); |
| 80 | 78 | ||
| 81 | fprintf(stdout, "%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", | 79 | fprintf(stdout, "%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", |
| 82 | values.distShort.deg0.entropy, | 80 | values.distShort.deg0.entropy, values.distShort.deg0.energy, |
| 83 | values.distShort.deg0.energy, | 81 | values.distShort.deg45.entropy, values.distShort.deg45.energy, |
| 84 | values.distShort.deg45.entropy, | 82 | values.distShort.deg90.entropy, values.distShort.deg90.energy, |
| 85 | values.distShort.deg45.energy, | 83 | values.distShort.deg135.entropy, values.distShort.deg135.energy); |
| 86 | values.distShort.deg90.entropy, | ||
| 87 | values.distShort.deg90.energy, | ||
| 88 | values.distShort.deg135.entropy, | ||
| 89 | values.distShort.deg135.energy); | ||
| 90 | 84 | ||
| 91 | fprintf(stdout,"%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", | 85 | fprintf(stdout, "%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", |
| 92 | values.distLong.deg0.entropy, | 86 | values.distLong.deg0.entropy, values.distLong.deg0.energy, |
| 93 | values.distLong.deg0.energy,values.distShort.deg45.entropy, | 87 | values.distShort.deg45.entropy, values.distLong.deg45.energy, |
| 94 | values.distLong.deg45.energy, | 88 | values.distLong.deg90.entropy, values.distLong.deg90.energy, |
| 95 | values.distLong.deg90.entropy, | 89 | values.distLong.deg135.entropy, values.distLong.deg135.energy); |
| 96 | values.distLong.deg90.energy, | ||
| 97 | values.distLong.deg135.entropy, | ||
| 98 | values.distLong.deg135.energy); | ||
| 99 | 90 | ||
| 100 | fprintf(stderr, "time for neghborhood stressmark = %f seconds.\n", | 91 | fprintf(stderr, "time for neghborhood stressmark = %f seconds.\n", |
| 101 | difftime(endTime, beginTime)); | 92 | difftime(endTime, beginTime)); |
| 102 | 93 | ||
| 103 | free((Pixel *)image); | 94 | free((Pixel *)image); |
| 104 | return (SUCCESS); | 95 | return (SUCCESS); |
| 105 | } | 96 | } |
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | |||
diff --git a/dis/Neighborhood/utili.h b/dis/Neighborhood/utili.h index 5b54d9b..b5a7498 100644 --- a/dis/Neighborhood/utili.h +++ b/dis/Neighborhood/utili.h | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Sample code for the DIS Pointer Stressmark | 2 | * Sample code for the DIS Pointer Stressmark |
| 3 | * | 3 | * |
| 4 | * This source code is the completely correct source code based on | 4 | * This source code is the completely correct source code based on |
| 5 | * the example codes provided by Atlantic Aerospace Division, Titan | 5 | * the example codes provided by Atlantic Aerospace Division, Titan |
| 6 | * Systems Corporation, 2000. | 6 | * Systems Corporation, 2000. |
| 7 | * | 7 | * |
| 8 | * If you just compile and generate the executables from this source | 8 | * If you just compile and generate the executables from this source |
| 9 | * code, this code would be enough. However, if you wish to get a complete | 9 | * code, this code would be enough. However, if you wish to get a complete |
| 10 | * understanding of this stressmark, it is strongly suggested that you | 10 | * understanding of this stressmark, it is strongly suggested that you |
| 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 | 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 |
| 12 | * before going on since the detailed comments are given in this documents. | 12 | * before going on since the detailed comments are given in this documents. |
| @@ -22,287 +22,248 @@ | |||
| 22 | 22 | ||
| 23 | #define MIN_PIXEL 0 | 23 | #define MIN_PIXEL 0 |
| 24 | #define MAX_DIMENSION 32768 | 24 | #define MAX_DIMENSION 32768 |
| 25 | #define MIN_SEED -2147483647 | 25 | #define MIN_SEED -2147483647 |
| 26 | #define MAX_SEED -1 | 26 | #define MAX_SEED -1 |
| 27 | #define MAX_NUMBER_LINES 65536 | 27 | #define MAX_NUMBER_LINES 65536 |
| 28 | #define MIN_BIT_DEPTH 7 | 28 | #define MIN_BIT_DEPTH 7 |
| 29 | #define MAX_BIT_DEPTH 15 | 29 | #define MAX_BIT_DEPTH 15 |
| 30 | 30 | ||
| 31 | typedef struct { | 31 | typedef struct { |
| 32 | int column; | 32 | int column; |
| 33 | int row; | 33 | int row; |
| 34 | }Coord; | 34 | } Coord; |
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| 37 | * Neighborhood structure consists of the GLCM descriptors entropy and | 37 | * Neighborhood structure consists of the GLCM descriptors entropy and |
| 38 | * energy for each of 2 distance and 4 angels | 38 | * energy for each of 2 distance and 4 angels |
| 39 | */ | 39 | */ |
| 40 | typedef struct { | 40 | typedef struct { |
| 41 | float entropy; | 41 | float entropy; |
| 42 | float energy; | 42 | float energy; |
| 43 | }Descriptors; | 43 | } Descriptors; |
