Re: patches 70* and 80*
| Newsgroups | gmane.comp.gnu.gift.general |
|---|---|
| Message-ID | <[email protected]> |
70-* and 80-* have already been commited to the CVS tree. Say hello to patches 81, 82, and 83. I'm kicking these out the door, they've been in my queue for at least a week now. I've had 5 disks fail in a period of 4 days. wheee, fun. Four of them 250 miles away, in a raid server. More speed improvements, i'll commit monday if no-one objects. ;) Wolfgang: my script now tests both gift-extract-features, and gift-write-feature-descs. other than that, nothing new to report. My private copy will be only 10% faster than the CVS copy, once this patch has been commited. Once I write a patch to fix what david didnt like about my first patches, then hunt down the source of that 10%, and build patches for it, i'll be working on converting gift-extract-features into a stream handling program, ALA your earlier suggestion. that, and working on improving the resolutions gift can handle. Julia Longtin <[email protected]> On Mon, Oct 02, 2006 at 12:05:26PM +0200, Wolfgang Müller wrote: > Hi, > > > functionally, these patches should be identical to the 70* and > > 80* patches i submitted almost a month ago. > > Any objections, David? Looks good to me. > > Cheers, > Wolfgang > > P.S.: Is any one of you great guys advancing on the scripted testing thingy? > > -- > Dr. Wolfgang Müller > LS Medieninformatik > Universität Bamberg > Check out the SIG MM web site http://www.sigmm.org > > > _______________________________________________ > help-GIFT mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-gift _______________________________________________ help-GIFT mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gift
81-ChangeLog
(text/plain, 396 B)
--- ../../dev2/gift/ChangeLog 2006-09-20 16:42:51.000000000 +0000 +++ ChangeLog 2006-09-20 20:55:52.000000000 +0000 @@ -1,3 +1,10 @@ +2006-09-20 <[email protected]> + + * FeatureExtraction/gabor.c + use one more memset. + reverse order of conv[] in memory. + swap conv[]'s x and y axis, to use in-order memory accesses. + 2006-09-19 <[email protected]> * FeatureExtraction/gabor.c
81-FeatureExtraction_gabor_c_swap_memory_order.patch
(text/plain, 2.8 KB)
--- ../../dev2/gift/FeatureExtraction/gabor.c 2006-09-20 16:42:51.000000000 +0000
+++ FeatureExtraction/gabor.c 2006-09-20 20:50:33.000000000 +0000
@@ -93,10 +93,10 @@
double conv[MAX_WIDTH*MAX_HEIGHT]; /* take advantage of our fixed image size. */
double * target_conv;
double * target_image;
- double temparray[kernal_size[2]];
+ double temparray[kernal_size[2]];
- memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
- memset(output, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
+ memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
+ memset(output, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
/* first convolution */
target_kernal=kernelsxy[filter_scale*num_gabors_per_scale+orientation];
@@ -108,13 +108,13 @@
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];
+ conv[((width*height)-1)-(x*height+y)] += 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] +=
+ conv[((width*height)-1)-(x*height+y)] +=
target_kernal[k]*target_image[k];
}
}
@@ -129,13 +129,12 @@
for (t_y = -kernal_size[filter_scale]/2; t_y <= kernal_size[filter_scale]/2; t_y++) {
if (((y - t_y) >= 0) && ((y - t_y) < height))
output[y*width + x] +=
- target_kernal[t_y + kernal_size[filter_scale]/2]*conv[(y - t_y)*width + x];
+ target_kernal[t_y + kernal_size[filter_scale]/2]*conv[((width*height)-1)-(x*height+(y - t_y))];
}
}
}
- for (i = 0; i < width*height; i++)
- conv[i] = 0;
+ memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double));
/* third convolution */
target_kernal=&target_kernal[kernal_size[filter_scale]];
@@ -147,13 +146,13 @@
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];
+ conv[((width*height)-1)-(x*height+y)] += 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] +=
+ conv[((width*height)-1)-(x*height+y)] +=
target_kernal[k]*target_image[k];
}
}
@@ -168,7 +167,7 @@
for (t_y = -kernal_size[filter_scale]/2; t_y <= kernal_size[filter_scale]/2; t_y++) {
if (((y - t_y) >= 0) && ((y - t_y) < height))
output[y*width + x] -=
- target_kernal[t_y + kernal_size[filter_scale]/2]*conv[(y - t_y)*width + x];
+ target_kernal[t_y + kernal_size[filter_scale]/2]*conv[((width*height)-1)-(x*height+(y - t_y))];
}
}
}
82-ChangeLog
(text/plain, 453 B)
--- ../../dev/gift/ChangeLog 2006-09-20 20:55:52.000000000 +0000 +++ ChangeLog 2006-09-20 21:33:38.000000000 +0000 @@ -1,6 +1,11 @@ 2006-09-20 <[email protected]> * FeatureExtraction/gabor.c + replace t_y with k. remove t_y and i, no longer in use. + +2006-09-20 <[email protected]> + + * FeatureExtraction/gabor.c use one more memset. reverse order of conv[] in memory. swap conv[]'s x and y axis, to use in-order memory accesses.
82-FeatureExtraction_gabor_c_remove_t_y_and_i.patch
(text/plain, 1.8 KB)
--- ../../dev/gift/FeatureExtraction/gabor.c 2006-09-20 20:50:33.000000000 +0000
+++ FeatureExtraction/gabor.c 2006-09-20 21:30:58.000000000 +0000
@@ -86,8 +86,6 @@
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_y;
- uint32_t i;
uint32_t k;
double * target_kernal;
double conv[MAX_WIDTH*MAX_HEIGHT]; /* take advantage of our fixed image size. */
@@ -126,10 +124,11 @@
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++) {
- if (((y - t_y) >= 0) && ((y - t_y) < height))
+ target_conv=&conv[((width*height)-1)-(x*height+y+(kernal_size[filter_scale]/2))];
+ for (k = 0; k < kernal_size[filter_scale]; k++) {
+ if (((y+(kernal_size[filter_scale]/2))>=k) && (y+(kernal_size[filter_scale]/2)<height+k))
output[y*width + x] +=
- target_kernal[t_y + kernal_size[filter_scale]/2]*conv[((width*height)-1)-(x*height+(y - t_y))];
+ target_kernal[k]*target_conv[k];
}
}
}
@@ -164,10 +163,11 @@
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++) {
- if (((y - t_y) >= 0) && ((y - t_y) < height))
+ target_conv=&conv[((width*height)-1)-(x*height+y+(kernal_size[filter_scale]/2))];
+ for (k = 0; k < kernal_size[filter_scale]; k++) {
+ if (((y+(kernal_size[filter_scale]/2))>=k) && (y+(kernal_size[filter_scale]/2)<height+k))
output[y*width + x] -=
- target_kernal[t_y + kernal_size[filter_scale]/2]*conv[((width*height)-1)-(x*height+(y - t_y))];
+ target_kernal[k]*target_conv[k];
}
}
}
83-ChangeLog
(text/plain, 344 B)
--- ../../dev2/gift/ChangeLog 2006-09-20 16:33:38.000000000 -0500 +++ ChangeLog 2006-10-05 15:37:13.000000000 -0500 @@ -1,3 +1,8 @@ +2006-10-05 <[email protected]> + + * FeatureExtraction/gabor.c + move a conditional outside of the inner loops, for iteration 2 and 4. + 2006-09-20 <[email protected]> * FeatureExtraction/gabor.c
83-FeatureExtraction_gabor_c_move_conditional_and_parallelize_2.patch
(text/plain, 1.8 KB)
--- ../../dev2/gift/FeatureExtraction/gabor.c 2006-09-20 16:30:58.000000000 -0500
+++ FeatureExtraction/gabor.c 2006-09-26 11:20:57.000000000 -0500
@@ -125,11 +125,22 @@
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
target_conv=&conv[((width*height)-1)-(x*height+y+(kernal_size[filter_scale]/2))];
+ if (((y>=kernal_size[filter_scale]/2)) && ((y+kernal_size[filter_scale]/2)<height))
+ {
+ /* first do the matrix multiply, then do the summation, so the matrix multiply can be vectored. */
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ temparray[k] = target_kernal[k]*target_conv[k];
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ output[y*width+x] += temparray[k];
+ }
+ else
+ {
for (k = 0; k < kernal_size[filter_scale]; k++) {
if (((y+(kernal_size[filter_scale]/2))>=k) && (y+(kernal_size[filter_scale]/2)<height+k))
output[y*width + x] +=
target_kernal[k]*target_conv[k];
}
+ }
}
}
@@ -164,11 +175,22 @@
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
target_conv=&conv[((width*height)-1)-(x*height+y+(kernal_size[filter_scale]/2))];
+ if (((y>=kernal_size[filter_scale]/2)) && ((y+kernal_size[filter_scale]/2)<height))
+ {
+ /* first do the matrix multiply, then do the summation, so the matrix multiply can be vectored. */
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ temparray[k] = target_kernal[k]*target_conv[k];
+ for (k = 0; k < kernal_size[filter_scale]; k++)
+ output[y*width+x] -= temparray[k];
+ }
+ else
+ {
for (k = 0; k < kernal_size[filter_scale]; k++) {
if (((y+(kernal_size[filter_scale]/2))>=k) && (y+(kernal_size[filter_scale]/2)<height+k))
output[y*width + x] -=
target_kernal[k]*target_conv[k];
}
+ }
}
}