Re: Optimizing

[email protected]
Newsgroups gmane.comp.gnu.gift.general
Message-ID <[email protected]>
On Fri, Sep 15, 2006 at 04:54:33PM -0500, [email protected] wrote:
> On Thu, Aug 17, 2006 at 10:45:50PM +0100, David Squire wrote:
> > [email protected] wrote:
> > 
> > >I don't find the branch idea to be a great one, because what appears to be 
> > >already happening is everyone is using their own branches, and the one in 
> > >the tree, which is the one that people new to the project will use, is 
> > >being left to rot. David's criticism of that optimization is valid, I'll 
> > >be adding a MAX_WIDTH and MAX_HEIGHT, so that both of us are satisfied. 
> > >All of my allocation changes are already in tree, and this one is the only 
> > >one that we both agree was a "badly implemented idea". 
> > 
> > Not so fast. I still haven't read everything that happened while I was
> > walking :) I had about 500 non-spam emails to deal with when I returned...
> > 
> > Cheers,
> > 
> > David
> > 
> > 
> > -- 
> > Dr David McG. Squire, Senior Lecturer, on sabbatical in 2006
> > Caulfield School of Information Technology, Monash University, Australia
> > CRICOS Provider No. 00008C        http://www.csse.monash.edu.au/~davids/
> > 
> 
> David,
> 
> Have you had time to read the other two patches (70 and 80)?
> 
> Heres a new version of patch 60, with your and johan's input.
> 
> I've been dead busy for a while, so i'm just getting around to this.
> 
> If you have no objections, i'd like to apply this, and patch 70 and 80
> come next tuesday. should make a big difference.
> 
> (yes, memset is faster. thanks johan)
> 
> Wolfgang:
> 
> I'm about 5 or 6 patches from getting to re-structuring as you 
> suggested. I just want to get this work in before tackling something
> else. :)
> 
> Julia Longtin <[email protected]>

> --- ChangeLog	2006-09-15 20:12:43.000000000 +0000
> +++ ../../dev/gift/ChangeLog	2006-09-15 21:21:52.000000000 +0000
> @@ -1,3 +1,9 @@
> +2006-09-15    <[email protected]>
> +
> +	* FeatureExtraction/gabor.c
> +	dont use calloc for conv, instead declare, and clear with memset.
> +	change to C99 datatypes in gabor_filter().
> +
>  2006-09-14    <[email protected]>
>      * scripts/perl/gift-add-collection.pl
>  	Fixed a buglet in the last part of the help message, and added a

> --- ../../dev2/gift/FeatureExtraction/gabor.c	2006-08-28 17:18:09.000000000 +0000
> +++ FeatureExtraction/gabor.c	2006-09-15 21:44:01.000000000 +0000
> @@ -2,12 +2,16 @@
>  #include <stdlib.h>
>  #include <malloc.h>
>  #include <math.h>
> +/* for memset(), others */
>  #include <string.h>
>  #include <unistd.h>
>  #include <ppm.h>
>  
>  #include "gabor.h"
>  
> +/* for MAX_WIDTH and MAX_HEIGHT */
> +#include "gift_features.h"
> +
>  /* for uint32_t */
>  #include <stdint.h>
>  
> @@ -79,15 +83,15 @@
>  	}
>  }
>  
> -void gabor_filter(double *image, int width, int height, int filter_scale, int orientation, double ** kernelsxy, double *output) {
> +void gabor_filter(double *image, int width, int height, int filter_scale, int orientation, double **kernelsxy, double *output) {
>  
> -	double *conv;
> -	int x, y, t_x, t_y;
> -	int i;
> +	uint32_t x, y;
> +	int32_t t_x, t_y;
> +	uint32_t i;
>  	double * target_kernal;
> +	double conv[MAX_WIDTH*MAX_HEIGHT]; /* take advantage of our fixed image size. */
>  
> -
> -	conv = (double *)calloc(width*height, sizeof(double));
> +	memset(&conv, 0, MAX_WIDTH*MAX_HEIGHT*sizeof(double)); 
>  
>  	target_kernal=kernelsxy[filter_scale*num_gabors_per_scale+orientation];
>  
> @@ -144,5 +148,4 @@
>  	}
>  	}
>  
> -	free(conv);
>  }

> --- FeatureExtraction/gift_features.h	2001-02-01 11:22:30.000000000 +0000
> +++ ../../dev/gift/FeatureExtraction/gift_features.h	2006-09-15 20:31:37.000000000 +0000
> @@ -24,4 +24,8 @@
>     adapting to Wolfgang's code */
>  #define WOLFGANG_HACK 
>  
> +/* fixed size buffer values, so that we dont code these into the .c files */
> +#define MAX_WIDTH  256
> +#define MAX_HEIGHT 256
> +
>  #endif

Replying to myself, just to make sure...

David,

Do you have any objections to the patch above, or the 70* and 80* patches i submitted last time arround?

Speak now, cause as soon as my laptop is set up, i'm commiting. :)

Julia Longtin <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.