diff options
author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-16 16:55:14 -0400 |
---|---|---|
committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-16 16:55:14 -0400 |
commit | 6ea9939e0610a809f6f47d13ec68df00d1ca0afc (patch) | |
tree | fe4a2eee3ddcf77e2367309dcd75a232b76dcd62 /dis/Neighborhood | |
parent | e9285d0cdea756a2830f0ace378e4197b36869aa (diff) |
Move the DIS benchmarks up a directory and update hardcoded paths
Note that this repo does not attempt to keep a copy of the original
DIS benchmark distributions. UNC real-time has another repo for that.
Diffstat (limited to 'dis/Neighborhood')
-rw-r--r-- | dis/Neighborhood/DISstressmarkRNG.h | 190 | ||||
-rw-r--r-- | dis/Neighborhood/neighborhood.c | 103 | ||||
-rw-r--r-- | dis/Neighborhood/utili.h | 363 |
3 files changed, 656 insertions, 0 deletions
diff --git a/dis/Neighborhood/DISstressmarkRNG.h b/dis/Neighborhood/DISstressmarkRNG.h new file mode 100644 index 0000000..4aa2620 --- /dev/null +++ b/dis/Neighborhood/DISstressmarkRNG.h | |||
@@ -0,0 +1,190 @@ | |||
1 | #include <math.h> | ||
2 | |||
3 | #define IA 16807 | ||
4 | #define IM 2147483647 | ||
5 | #define AM (1.0/IM) | ||
6 | #define IQ 127773 | ||
7 | #define IR 2836 | ||
8 | #define NTAB 32 | ||
9 | #define NDIV (1+(IM-1)/NTAB) | ||
10 | #define EPS 1.2e-7 | ||
11 | #define RNMX (1.0-EPS) | ||
12 | |||
13 | static long iy=0; | ||
14 | static long iv[NTAB]; | ||
15 | static long iseed; | ||
16 | |||
17 | int ABS(int x){ | ||
18 | if (x>= 0) return x; | ||
19 | else | ||
20 | return (-x); | ||
21 | } | ||
22 | |||
23 | int sign(int x){ | ||
24 | if (x >= 0) return 1; | ||
25 | else | ||
26 | return (-1); | ||
27 | } | ||
28 | |||
29 | int MAX(int x, int y){ | ||
30 | if (x>= y) return x; | ||
31 | else | ||
32 | return y; | ||
33 | } | ||
34 | |||
35 | int MIN(int x, int y){ | ||
36 | if (x<= y) return x; | ||
37 | else | ||
38 | return y; | ||
39 | } | ||
40 | |||
41 | void randInit(long idum) | ||
42 | { | ||
43 | long j; | ||
44 | long k; | ||
45 | |||
46 | assert (idum <= 0); | ||
47 | assert (iy == 0); | ||
48 | |||
49 | iseed = idum; | ||
50 | if (-(iseed)<1){ | ||
51 | iseed = 1; | ||
52 | } | ||
53 | else { | ||
54 | iseed = -(iseed); | ||
55 | } | ||
56 | for (j=NTAB+7; j>=0; j--){ | ||
57 | k = (iseed)/IQ; | ||
58 | iseed = IA*(iseed-k*IQ)-IR*k; | ||
59 | if (iseed < 0){ | ||
60 | iseed += IM; | ||
61 | } | ||
62 | if (j < NTAB){ | ||
63 | iv[j] = iseed; | ||
64 | } | ||
65 | } | ||
66 | iy = iv[0]; | ||
67 | } | ||
68 | |||
69 | float randNum() | ||
70 | { | ||
71 | long j; | ||
72 | long k; | ||
73 | float temp; | ||
74 | |||
75 | assert (iy != 0); | ||
76 | |||
77 | k = (iseed)/IQ; | ||
78 | iseed = IA*(iseed-k*IQ)-IR*k; | ||
79 | |||
80 | if (iseed < 0){ | ||
81 | iseed += IM; | ||
82 | } | ||
83 | j = iy/NDIV; | ||
84 | iy = iv[j]; | ||
85 | iv[j] = iseed; | ||
86 | |||
87 | temp = AM * iy; | ||
88 | |||
89 | if (temp > RNMX){ | ||
90 | return RNMX; | ||
91 | } | ||
92 | else { | ||
93 | return temp; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | |||
98 | float randomFloat(float lowest_float, float highest_float) | ||
99 | { | ||
100 | float value; | ||
101 | float range; | ||
102 | |||
103 | assert (lowest_float < highest_float); | ||
104 | |||
105 | range = highest_float - lowest_float; | ||
106 | value = randNum()*(highest_float - lowest_float) + lowest_float; | ||
107 | assert(value >= lowest_float); | ||
108 | assert(value <= highest_float); | ||
109 | |||
110 | return value; | ||
111 | |||
112 | } | ||
113 | |||
114 | float randomNonZeroFloat(float lowest_float, float highest_float, float epsilon) | ||
115 | { | ||
116 | |||
117 | double range; | ||
118 | float value; | ||
119 | |||
120 | |||
121 | assert (lowest_float < 0); | ||
122 | assert (highest_float > 0); | ||
123 | assert (epsilon > 0); | ||
124 | assert ((epsilon < -lowest_float) && (epsilon < highest_float)); | ||
125 | |||
126 | range = highest_float - lowest_float; | ||
127 | value = (randNum() * range)+lowest_float; | ||
128 | |||
129 | if (ABS(value) < epsilon) | ||
130 | { | ||
131 | if (value > 0) value = value + epsilon; | ||
132 | else if (value < 0) value = value - epsilon; | ||
133 | |||
134 | } | ||
135 | |||
136 | assert (value >= lowest_float); | ||
137 | assert (value <= highest_float); | ||
138 | |||
139 | return value; | ||
140 | } | ||
141 | |||
142 | unsigned int randomUInt(int lowest_uint, int highest_uint) | ||
143 | { | ||
144 | float range; | ||
145 | unsigned int value; | ||
146 | float temp; | ||
147 | |||
148 | range =(float)(highest_uint - lowest_uint + 1); | ||
149 | temp = randNum(); | ||
150 | value =(unsigned int)( floor(temp * range) + lowest_uint); | ||
151 | |||
152 | assert (value >= lowest_uint); | ||
153 | assert (value <= highest_uint); | ||
154 | |||
155 | return value; | ||
156 | } | ||
157 | |||
158 | unsigned int randomNonZeroUInt(int lowest_uint, int highest_uint) | ||
159 | { | ||
160 | float range; | ||
161 | unsigned int value; | ||
162 | float temp; | ||
163 | |||
164 | range =(float)(highest_uint - lowest_uint + 1); | ||
165 | value = 0; | ||
166 | while(value == 0){ | ||
167 | temp = randNum(); | ||
168 | |||
169 | value =(unsigned int)( floor(temp * range) + lowest_uint); | ||
170 | } | ||
171 | |||
172 | assert (value >= lowest_uint); | ||
173 | assert (value <= highest_uint); | ||
174 | |||
175 | return value; | ||
176 | } | ||
177 | |||
178 | int randInt(int lowest_uint, int highest_uint) | ||
179 | { | ||
180 | float range; | ||
181 | int value; | ||
182 | |||
183 | range = highest_uint - lowest_uint + 1; | ||
184 | value = (int)(floor(randNum() * range) + lowest_uint); | ||
185 | |||
186 | assert (value >= lowest_uint); | ||
187 | assert (value <= highest_uint); | ||
188 | |||
189 | return value; | ||
190 | } | ||
diff --git a/dis/Neighborhood/neighborhood.c b/dis/Neighborhood/neighborhood.c new file mode 100644 index 0000000..1736d38 --- /dev/null +++ b/dis/Neighborhood/neighborhood.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Sample code for the DIS Neighborhood Stressmark | ||
3 | * | ||
4 | * This source code is the completely correct source code based on | ||
5 | * the example codes provided by Atlantic Aerospace Division, Titan | ||
6 | * Systems Corporation, 2000. | ||
7 | * | ||
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 | ||
10 | * understanding of this stressmark, it is strongly suggested that you | ||
11 | * read the Benchmark Analysis and Specifications Document Version 1.0 | ||
12 | * before going on since the detailed comments are given in this documents. | ||
13 | * the comments are not repeated here. | ||
14 | */ | ||
15 | |||
16 | #include <stdio.h> | ||
17 | #include <stdlib.h> | ||
18 | #include <time.h> | ||
19 | #include<assert.h> | ||
20 | #include "DISstressmarkRNG.h" | ||
21 | #include "utili.h" | ||
22 | #include "extra.h" | ||
23 | |||
24 | /* | ||
25 | * main() | ||
26 | */ | ||
27 | int main(int argc, char** argv) | ||
28 | { | ||
29 | long int seed; | ||
30 | int dimension; | ||
31 | int numberLines; | ||
32 | int minThickness; | ||
33 | int maxThickness; | ||
34 | int distanceShort; | ||
35 | int distanceLong; | ||
36 | int bitDepth; | ||
37 | int maxPixel; | ||
38 | Pixel *image; | ||
39 | Neighborhood values; | ||
40 | |||
41 | time_t beginTime; | ||
42 | time_t endTime; | ||
43 | SET_UP | ||
44 | |||
45 | assert(fscanf(stdin, "%ld %d %d %d %d %d %d %d", | ||
46 | &seed, &bitDepth, &dimension, &numberLines, | ||
47 | &minThickness, &maxThickness, | ||
48 | &distanceShort, &distanceLong) == 8); | ||
49 | |||
50 | assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); | ||
51 | assert((dimension > 0) && (dimension <= MAX_DIMENSION)); | ||
52 | assert((numberLines > 0) && (numberLines <= MAX_NUMBER_LINES)); | ||
53 | assert((minThickness > 0) && (minThickness < dimension)); | ||
54 | assert((maxThickness >= minThickness) && (maxThickness < dimension)); | ||
55 | assert((distanceShort > 0) && (distanceShort < dimension)); | ||
56 | assert((distanceLong > 0) && (distanceLong < dimension)); | ||
57 | assert((bitDepth >= MIN_BIT_DEPTH) && (bitDepth <= MAX_BIT_DEPTH)); | ||
58 | |||
59 | randInit(seed); | ||
60 | maxPixel = (1 << bitDepth) - 1; | ||
61 | image = createImage(dimension, maxPixel, numberLines, | ||
62 | minThickness, maxThickness); | ||
63 | assert (image != NULL); | ||
64 | |||
65 | beginTime = time(NULL); | ||
66 | START_LOOP | ||
67 | neighborhoodCalculation(image, dimension, | ||
68 | distanceShort, distanceLong, &values, maxPixel); | ||
69 | STOP_LOOP | ||
70 | endTime = time(NULL); | ||
71 | WRITE_TO_FILE | ||
72 | |||
73 | // printf(" end time is %d\n", endTime); | ||
74 | |||
75 | fprintf(stdout, "%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", | ||
76 | values.distShort.deg0.entropy, | ||
77 | values.distShort.deg0.energy, | ||
78 | values.distShort.deg45.entropy, | ||
79 | values.distShort.deg45.energy, | ||
80 | values.distShort.deg90.entropy, | ||
81 | values.distShort.deg90.energy, | ||
82 | values.distShort.deg135.entropy, | ||
83 | values.distShort.deg135.energy); | ||
84 | |||
85 | fprintf(stdout,"%9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e %9.4e", | ||
86 | values.distLong.deg0.entropy, | ||
87 | values.distLong.deg0.energy,values.distShort.deg45.entropy, | ||
88 | values.distLong.deg45.energy, | ||
89 | values.distLong.deg90.entropy, | ||
90 | values.distLong.deg90.energy, | ||
91 | values.distLong.deg135.entropy, | ||
92 | values.distLong.deg135.energy); | ||
93 | |||
94 | fprintf(stderr, "time for neghborhood stressmark = %f\n", | ||
95 | difftime(endTime, beginTime)); | ||
96 | |||
97 | free((Pixel *)image); | ||
98 | return (SUCCESS); | ||
99 | } | ||
100 | |||
101 | |||
102 | |||
103 | |||
diff --git a/dis/Neighborhood/utili.h b/dis/Neighborhood/utili.h new file mode 100644 index 0000000..2a8e2a0 --- /dev/null +++ b/dis/Neighborhood/utili.h | |||
@@ -0,0 +1,363 @@ | |||
1 | /* | ||
2 | * Sample code for the DIS Pointer Stressmark | ||
3 | * | ||
4 | * This source code is the completely correct source code based on | ||
5 | * the example codes provided by Atlantic Aerospace Division, Titan | ||
6 | * Systems Corporation, 2000. | ||
7 | * | ||
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 | ||
10 | * understanding of this stressmark, it is strongly suggested that you | ||
11 | * read the Benchmark Analysis and Specifications Document Version 1.0 | ||
12 | * before going on since the detailed comments are given in this documents. | ||
13 | * the comments are not repeated here. | ||
14 | */ | ||
15 | |||
16 | #include <math.h> | ||
17 | |||
18 | #define TRUE 1 | ||
19 | #define FALSE !TRUE | ||
20 | #define SUCCESS TRUE | ||
21 | #define ERROR FLASE | ||
22 | |||
23 | #define MIN_PIXEL 0 | ||
24 | #define MAX_DIMENSION 32768 | ||
25 | #define MIN_SEED -2147483647 | ||
26 | #define MAX_SEED -1 | ||
27 | #define MAX_NUMBER_LINES 65536 | ||
28 | #define MIN_BIT_DEPTH 7 | ||
29 | #define MAX_BIT_DEPTH 15 | ||
30 | |||
31 | typedef struct { | ||
32 | int column; | ||
33 | int row; | ||
34 | }Coord; | ||
35 | |||
36 | /* | ||
37 | * Neighborhood structure consists of the GLCM descriptors entropy and | ||
38 | * energy for each of 2 distance and 4 angels | ||
39 | */ | ||
40 | typedef struct { | ||
41 | float entropy; | ||
42 | float energy; | ||
43 | }Descriptors; | ||
44 | |||
45 | typedef struct { | ||
46 | Descriptors deg0; | ||
47 | Descriptors deg45; | ||
48 | Descriptors deg90; | ||
49 | Descriptors deg135; | ||
50 | }Angeles; | ||
51 | |||
52 | typedef struct { | ||
53 | Angeles distShort; | ||
54 | Angeles distLong; | ||
55 | }Neighborhood; | ||
56 | |||
57 | typedef short int Pixel; /* short int;*/ | ||
58 | |||
59 | |||
60 | void drawLineSegment(Pixel *image, | ||
61 | Coord startPoint, | ||
62 | Coord endPoint, | ||
63 | int startValue, | ||
64 | int endValue, | ||
65 | int thickness, | ||
66 | int dimension) | ||
67 | { | ||
68 | int changeColumn, changeRow; | ||
69 | int delta; | ||
70 | int column, row; | ||
71 | float value, valueDelta; | ||
72 | int t; | ||
73 | |||
74 | changeColumn = endPoint.column - startPoint.column; | ||
75 | changeRow = endPoint.row - startPoint.row; | ||
76 | |||
77 | assert((changeRow != 0) || (changeColumn != 0)); | ||
78 | |||
79 | column = startPoint.column; | ||
80 | row = startPoint.row; | ||
81 | value = startValue; | ||
82 | |||
83 | if (ABS(changeColumn) > ABS(changeRow)){ | ||
84 | valueDelta = ((float) endValue - startValue)/ | ||
85 | ((float) ABS(changeColumn)); | ||
86 | delta = 2*ABS(row) - ABS(column); | ||
87 | for (column = startPoint.column; | ||
88 | column == endPoint.column+sign(changeColumn); | ||
89 | column += sign(changeColumn)){ | ||
90 | for (t = MAX(0, row-thickness/2); | ||
91 | t < MIN(dimension, row+thickness - thickness/2); | ||
92 | t++) | ||
93 | image[t*dimension + column] = (int)value; | ||
94 | value += valueDelta; | ||
95 | if (delta >= 0){ | ||
96 | row += sign(changeRow); | ||
97 | delta -= 2*ABS(changeColumn); | ||
98 | } | ||
99 | column += sign(changeColumn); | ||
100 | delta += 2*ABS(changeRow); | ||
101 | } | ||
102 | } | ||
103 | else { | ||
104 | valueDelta = ((float) endValue - startValue)/ | ||
105 | ((float) ABS(changeRow)); | ||
106 | delta = 2* ABS(column) - ABS(row); | ||
107 | for (row = startPoint.row; | ||
108 | row == endPoint.row + sign(changeRow); | ||
109 | row += sign(changeRow)){ | ||
110 | for (t = MAX(0, column-thickness/2); | ||
111 | t < MIN(dimension, row + thickness - thickness/2); | ||
112 | t++) | ||
113 | image[row*dimension + t] = (int)value; | ||
114 | if (delta >= 0){ | ||
115 | column += sign(changeColumn); | ||
116 | delta -= 2*ABS(changeRow); | ||
117 | } | ||
118 | row += sign(changeRow); | ||
119 | delta += 2*ABS(changeColumn); | ||
120 | } | ||
121 | } | ||
122 | return; | ||
123 | } | ||
124 | |||
125 | |||
126 | |||
127 | Pixel *createImage (int dimension, | ||
128 | Pixel maxPixel, | ||
129 | int numberLines, | ||
130 | int minThickness, | ||
131 | int maxThickness) | ||
132 | { | ||
133 | Pixel *image; | ||
134 | int i; | ||
135 | |||
136 | Coord startPoint; | ||
137 | Coord endPoint; | ||
138 | int thickness; | ||
139 | int startValue; | ||
140 | int endValue; | ||
141 | |||
142 | image = (Pixel *)malloc(sizeof(Pixel) * dimension * dimension); | ||
143 | assert (image != NULL); | ||
144 | for (i=0; i<dimension*dimension; i++){ | ||
145 | image[i] = 0; | ||
146 | } | ||
147 | |||
148 | for (i=0; i<numberLines; i++){ | ||
149 | float temp; | ||
150 | float prev; | ||
151 | |||
152 | temp = randomUInt(0, dimension*dimension - 1); | ||
153 | startPoint.row = (int) temp/dimension; | ||
154 | startPoint.column = (int) temp % dimension; | ||
155 | prev = temp; | ||
156 | |||
157 | while((temp = randomUInt(0, dimension*dimension -1)) == prev); | ||
158 | |||
159 | endPoint.row = (int) temp/dimension; | ||
160 | endPoint.column = (int) temp% dimension; | ||
161 | |||
162 | thickness = randomUInt(minThickness, maxThickness); | ||
163 | startValue = randomUInt(MIN_PIXEL, maxPixel); | ||
164 | endValue = randomUInt(MIN_PIXEL, maxPixel); | ||
165 | |||
166 | drawLineSegment(image, startPoint, endPoint, | ||
167 | startValue, endValue, thickness, dimension); | ||
168 | } | ||
169 | return(image); | ||
170 | } | ||
171 | |||
172 | |||
173 | void calcEntropyEnergy( | ||
174 | int *sumHist, | ||
175 | int *diffHist, | ||
176 | Pixel *image, | ||
177 | int numBins, | ||
178 | int dx, | ||
179 | int dy, | ||
180 | float *entropy, | ||
181 | float *energy, | ||
182 | int dimension, | ||
183 | Pixel maxPixel) | ||
184 | { | ||
185 | int index; | ||
186 | int totalNumPixels; | ||
187 | int rowIndex; | ||
188 | int rowLow, rowHigh; | ||
189 | int columnIndex; | ||
190 | int columnLow, columnHigh; | ||
191 | int columnForPixelAtDistance; | ||
192 | int rowForPixelAtDistance; | ||
193 | int value0RowOffset; | ||
194 | int value1RowOffset; | ||
195 | |||
196 | *entropy = 0.0; | ||
197 | *energy = 0.0; | ||
198 | |||
199 | for (index = 0; index < numBins; index++){ | ||
200 | sumHist[index] = 0; | ||
201 | diffHist[index] = 0; | ||
202 | } | ||
203 | |||
204 | if (dy < 0){ | ||
205 | rowLow = -dy; | ||
206 | rowHigh = dimension; | ||
207 | } | ||
208 | else { | ||
209 | rowLow = 0; | ||
210 | rowHigh = dimension - dy; | ||
211 | } | ||
212 | if (dx < 0){ | ||
213 | columnLow = -dx; | ||
214 | columnHigh = dimension; | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | columnLow = 0; | ||
219 | columnHigh = dimension - dx; | ||
220 | } | ||
221 | |||
222 | totalNumPixels = 0; | ||
223 | value0RowOffset = rowLow * dimension; | ||
224 | value1RowOffset = (rowLow + dy) * dimension; | ||
225 | |||
226 | for (rowIndex = rowLow; rowIndex<rowHigh; rowIndex++){ | ||
227 | for (columnIndex= columnLow; columnIndex<columnHigh; | ||
228 | columnIndex++){ | ||
229 | int value0; | ||
230 | int value1; | ||
231 | int binIndex; | ||
232 | |||
233 | rowForPixelAtDistance = rowIndex + dy; | ||
234 | columnForPixelAtDistance = columnIndex + dx; | ||
235 | |||
236 | value0 = *(image + value0RowOffset + columnIndex); | ||
237 | value1 = *(image + value1RowOffset + | ||
238 | columnForPixelAtDistance); | ||
239 | |||
240 | binIndex = value0 + value1 - 2*MIN_PIXEL; | ||
241 | assert((binIndex >= 0) && (binIndex < numBins)); | ||
242 | sumHist[binIndex] += 1; | ||
243 | binIndex = value0 - value1 + maxPixel - MIN_PIXEL; | ||
244 | |||
245 | assert((binIndex >= 0) && (binIndex < numBins)); | ||
246 | |||
247 | diffHist[binIndex] += 1; | ||
248 | totalNumPixels += 1; | ||
249 | |||
250 | } | ||
251 | |||
252 | value0RowOffset += dimension; | ||
253 | value1RowOffset += dimension; | ||
254 | |||
255 | } | ||
256 | |||
257 | |||
258 | if (totalNumPixels > 0){ | ||
259 | int index; | ||
260 | double energySum; | ||
261 | double energyDifference; | ||
262 | double entropyValue; | ||
263 | double sumNormalized; | ||
264 | double diffNormalized; | ||
265 | double scale; | ||
266 | |||
267 | energySum = (double) 0; | ||
268 | energyDifference = (double) 0; | ||
269 | entropyValue = (double) 0; | ||
270 | scale = 1.e0/totalNumPixels; | ||
271 | for (index = 0; index<numBins; index++){ | ||
272 | if (sumHist[index] > 0){ | ||
273 | sumNormalized = (double) sumHist[index]*scale; | ||
274 | entropyValue = entropyValue - sumNormalized * | ||
275 | log((double)sumNormalized); | ||
276 | energySum = energySum + sumNormalized * sumNormalized ; | ||
277 | } | ||
278 | if (diffHist[index] > 0){ | ||
279 | diffNormalized = (double)diffHist[index]*scale; | ||
280 | entropyValue = entropyValue - diffNormalized * log(diffNormalized); | ||
281 | energyDifference = energyDifference + | ||
282 | diffNormalized * diffNormalized; | ||
283 | } | ||
284 | } | ||
285 | *energy = energySum * energyDifference; | ||
286 | *entropy = entropyValue; | ||
287 | } | ||
288 | return; | ||
289 | } | ||
290 | |||
291 | |||
292 | void neighborhoodCalculation | ||
293 | (Pixel *image, | ||
294 | int dimension, | ||
295 | int distanceShort, | ||
296 | int distanceLong, | ||
297 | Neighborhood *neighborhood, | ||
298 | Pixel maxPixel) | ||
299 | { | ||
300 | int *sumHist, *diffHist; | ||
301 | int numBins; | ||
302 | |||
303 | numBins = (2 * (maxPixel - MIN_PIXEL + 1) -1); | ||
304 | sumHist = (int *) malloc(numBins * sizeof(int)); | ||
305 | assert (sumHist != NULL); | ||
306 | diffHist = (int *)malloc(numBins * sizeof(int)); | ||
307 | assert(diffHist != NULL); | ||
308 | |||
309 | printf(" before short calc deg0\n"); | ||
310 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
311 | distanceShort, 0, | ||
312 | &(neighborhood->distShort.deg0.entropy), | ||
313 | &(neighborhood->distShort.deg0.energy), dimension, | ||
314 | maxPixel); | ||
315 | |||
316 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
317 | distanceShort, distanceShort, | ||
318 | &(neighborhood->distShort.deg45.entropy), | ||
319 | &(neighborhood->distShort.deg45.energy), dimension, | ||
320 | maxPixel); | ||
321 | |||
322 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
323 | 0, distanceShort, | ||
324 | &(neighborhood->distShort.deg90.entropy), | ||
325 | &(neighborhood->distShort.deg90.energy), dimension, | ||
326 | maxPixel); | ||
327 | |||
328 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
329 | -distanceShort, distanceShort, | ||
330 | &(neighborhood->distShort.deg135.entropy), | ||
331 | &(neighborhood->distShort.deg135.energy), dimension, | ||
332 | maxPixel); | ||
333 | |||
334 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
335 | distanceLong, 0, | ||
336 | &(neighborhood->distLong.deg0.entropy), | ||
337 | &(neighborhood->distLong.deg0.energy), dimension, | ||
338 | maxPixel); | ||
339 | |||
340 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
341 | distanceLong, distanceLong, | ||
342 | &(neighborhood->distLong.deg45.entropy), | ||
343 | &(neighborhood->distLong.deg45.energy), dimension, | ||
344 | maxPixel); | ||
345 | |||
346 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
347 | 0, distanceLong, | ||
348 | &(neighborhood->distLong.deg90.entropy), | ||
349 | &(neighborhood->distLong.deg90.energy), dimension, | ||
350 | maxPixel); | ||
351 | |||
352 | calcEntropyEnergy(sumHist, diffHist, image, numBins, | ||
353 | -distanceLong, distanceLong, | ||
354 | &(neighborhood->distLong.deg135.entropy), | ||
355 | &(neighborhood->distLong.deg135.energy), dimension, | ||
356 | maxPixel); | ||
357 | |||
358 | free(sumHist); | ||
359 | free(diffHist); | ||
360 | |||
361 | return; | ||
362 | } | ||
363 | |||