I send this mail just to show the list what was just commited.
functionally, these patches should be identical to the 70* and
80* patches i submitted almost a month ago.
Julia Longtin <[EMAIL PROTECTED]>
--- ../../dev2/gift/ChangeLog 2006-09-19 20:03:22.000000000 +0000
+++ ChangeLog 2006-09-19 20:10:30.000000000 +0000
@@ -1,3 +1,8 @@
+2006-09-19 <[EMAIL PROTECTED]>
+
+ * FeatureExtraction/gabor.c
+ remove int32_t t_x, replace with uint32_t k. uint32_t is slightly
faster, and simplifies the inner loops.
+
2006-09-15 <[EMAIL PROTECTED]>
* FeatureExtraction/gabor.c
--- ../../dev2/gift/FeatureExtraction/gabor.c 2006-09-19 20:03:22.000000000
+0000
+++ FeatureExtraction/gabor.c 2006-09-19 21:07:28.000000000 +0000
@@ -86,30 +86,33 @@
void gabor_filter(double *image, int width, int height, int filter_scale, int
orientation, double **kernelsxy, double *output) {
uint32_t x, y;
- int32_t t_x, t_y;
+ int32_t t_y;
uint32_t i;
+ uint32_t k;
double * target_kernal;
double conv[MAX_WIDTH*MAX_HEIGHT]; /* take advantage of our fixed image
size. */
+ double * target_conv;
+ double * target_image;
memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
-
- target_kernal=kernelsxy[filter_scale*num_gabors_per_scale+orientation];
+ memset(output, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
/* first convolution */
+ target_kernal=kernelsxy[filter_scale*num_gabors_per_scale+orientation];
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
- output[y*width + x] = 0; /* might as well be here */
- for (t_x = -kernal_size[filter_scale]/2; t_x <=
kernal_size[filter_scale]/2; t_x++) {
- if (((x - t_x) >= 0) && ((x - t_x) < width)) {
+
target_image=&image[(width*height)-(y*width+x+kernal_size[filter_scale]/2)];
+ for (k=0; k < kernal_size[filter_scale]; k++) {
+ if ((x+kernal_size[filter_scale]/2 >= k) &&
(x+kernal_size[filter_scale]/2 < width+k)) {
conv[y*width + x] +=
- target_kernal[t_x +
kernal_size[filter_scale]/2]*image[65536-(y*width+ (x - t_x))];
+ target_kernal[k]*target_image[k];
}
}
}
}
- target_kernal=&target_kernal[kernal_size[filter_scale]];
/* second convolution */
+ target_kernal=&target_kernal[kernal_size[filter_scale]];
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
for (t_y = -kernal_size[filter_scale]/2; t_y <=
kernal_size[filter_scale]/2; t_y++) {
@@ -123,21 +126,22 @@
for (i = 0; i < width*height; i++)
conv[i] = 0;
- target_kernal=&target_kernal[kernal_size[filter_scale]];
/* third convolution */
+ target_kernal=&target_kernal[kernal_size[filter_scale]];
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
- for (t_x = -kernal_size[filter_scale]/2; t_x <=
kernal_size[filter_scale]/2; t_x++) {
- if (((x - t_x) >= 0) && ((x - t_x) < width)) {
+
target_image=&image[(width*height)-(y*width+x+kernal_size[filter_scale]/2)];
+ for (k=0; k < kernal_size[filter_scale]; k++) {
+ if ((x+kernal_size[filter_scale]/2 >= k) &&
(x+kernal_size[filter_scale]/2 < width+k)) {
conv[y*width + x] +=
- target_kernal[t_x +
kernal_size[filter_scale]/2]*image[65536-(y*width + (x - t_x))];
+ target_kernal[k]*target_image[k];
}
}
}
}
- target_kernal=&target_kernal[kernal_size[filter_scale]];
/* fourth convolution */
+ target_kernal=&target_kernal[kernal_size[filter_scale]];
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
for (t_y = -kernal_size[filter_scale]/2; t_y <=
kernal_size[filter_scale]/2; t_y++) {
--- ../../dev2/gift/ChangeLog 2006-09-19 21:18:19.000000000 +0000
+++ ChangeLog 2006-09-19 21:26:28.000000000 +0000
@@ -1,3 +1,8 @@
+2006-09-19 <[EMAIL PROTECTED]>
+
+ * FeatureExtraction/gabor.c
+ move a conditional outside of the inner loops, for iteration 1 and 3.
+
2006-09-19 <[EMAIL PROTECTED]>
* FeatureExtraction/gabor.c
--- ../../dev2/gift/FeatureExtraction/gabor.c 2006-09-19 21:18:23.000000000
+0000
+++ FeatureExtraction/gabor.c 2006-09-19 21:21:39.000000000 +0000
@@ -93,6 +93,7 @@
double conv[MAX_WIDTH*MAX_HEIGHT]; /* take advantage of our fixed image
size. */
double * target_conv;
double * target_image;
+ double temparray[kernal_size[2]];
memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
memset(output, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
@@ -102,12 +103,22 @@
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
target_image=&image[(width*height)-(y*width+x+kernal_size[filter_scale]/2)];
+ if ((x>=kernal_size[filter_scale]/2) &&
((x+kernal_size[filter_scale]/2)<width))
+ {
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ temparray[k]= target_kernal[k]*target_image[k];
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ conv[y*width+x] += temparray[k];
+ }
+ else
+ {
for (k=0; k < kernal_size[filter_scale]; k++) {
if ((x+kernal_size[filter_scale]/2 >= k) &&
(x+kernal_size[filter_scale]/2 < width+k)) {
conv[y*width + x] +=
target_kernal[k]*target_image[k];
}
}
+ }
}
}
@@ -131,12 +142,22 @@
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
target_image=&image[(width*height)-(y*width+x+kernal_size[filter_scale]/2)];
+ if ((x>=kernal_size[filter_scale]/2) &&
((x+kernal_size[filter_scale]/2)<width))
+ {
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ temparray[k]= target_kernal[k]*target_image[k];
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ conv[y*width+x] += temparray[k];
+ }
+ else
+ {
for (k=0; k < kernal_size[filter_scale]; k++) {
if ((x+kernal_size[filter_scale]/2 >= k) &&
(x+kernal_size[filter_scale]/2 < width+k)) {
conv[y*width + x] +=
target_kernal[k]*target_image[k];
}
}
+ }
}
}
_______________________________________________
help-GIFT mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gift