more patches

[email protected]
Newsgroups gmane.comp.gnu.gift.general
Message-ID <[email protected]>
well, first off, you seem to have dropped a patch during the last set.
gift compiles, but dosent work.

i'm attatching that patch to this mail. please apply immediately.

second off, i'm adding another patch, that colapses kernel[11,12,21,22] into one variable, kernelsxy, and removes it from the global scope.

speed improvement: 1.72 VS 1.66. probably just because of less calls of malloc().

Thanks,

Julia Longtin <[email protected]>

_______________________________________________
help-GIFT mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gift
20-FeatureExtraction_extract_features.c-remove_global_variables.patch (text/plain, 2.3 KB)
--- ../../dev2/gift/FeatureExtraction/extract_features.c	2006-06-28 00:08:54.000000000 +0000
+++ FeatureExtraction/extract_features.c	2006-06-28 21:50:05.000000000 +0000
@@ -22,15 +22,35 @@
 #define numV 3
 #define numGrey 4
 
+#define OLDFIXED
+#ifdef OLDFIXED
+/* the number of scales to recognise features at */
+#define num_gabor_scales 3
+/* the number of color blocks we're going to break the image into (overlapping) */
+#define num_total_colour_blocks (256+64+16+4)
+#endif
+
+void init_feature_variables(uint32_t, uint32_t **, uint32_t ***, uint32_t ***);
+void extract_gabor_features(PPM *, uint32_t ***, uint32_t ***);
+void extract_mode_features(PPM *, uint32_t *, uint32_t, uint32_t **, byte *, uint32_t *);
+enum ppm_error write_mode_features(char *, uint32_t, uint32_t *, uint32_t ***, uint32_t ***, byte *);
+
 int main(int argc, char *argv[]) {
 
 	char *in_fname, *out_fname;
 	char *point_pos;
 	FILE *ppm_file;
 	PPM *im_rgb, *im_hsv, *im_quant;
-	int *colmap, colmap_size;
+	uint32_t *colmap, colmap_size;
 	enum file_types ppm_type;
 	enum ppm_error the_error;
+	uint32_t ** block_gabor_class[num_gabor_scales];
+	uint32_t ** gabor_histogram[num_gabor_scales];
+	/* the "mode" of each color block. */
+	byte block_mode[num_total_colour_blocks];
+	/* the colour count of each block. for quantizing the image */
+	uint32_t * col_counts[num_total_colour_blocks];
+	uint32_t * col_histogram;
  
 	switch(argc) {
 	case 2:
@@ -94,17 +114,20 @@
 		exit(1);
 	}
 
+	/* FIXME: move this back into init_feature_variables. */
+	col_histogram = (uint32_t *)malloc(colmap_size*sizeof(uint32_t));
+
 	/* initialise the variables required for the feature extraction */
-	init_feature_variables(colmap_size);
+	init_feature_variables(colmap_size, col_counts, block_gabor_class, gabor_histogram);
 
 	/* extract the features */
 
-	extract_mode_features(im_quant, colmap, colmap_size);
+	extract_mode_features(im_quant, colmap, colmap_size, col_counts, block_mode, col_histogram);
 
-	extract_gabor_features(im_hsv);
+	extract_gabor_features(im_hsv, block_gabor_class, gabor_histogram);
 
 	/* write them to the file */
-	if ((the_error = write_mode_features(out_fname, colmap_size)) != PPM_OK) {
+	if ((the_error = write_mode_features(out_fname, colmap_size, col_histogram, block_gabor_class, gabor_histogram, block_mode)) != PPM_OK) {
 	  ppm_handle_error(the_error);
 	  exit(1);
 	}
patches_round_3.tar.gz (application/x-gzip, 2.1 KB) - not displayed
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.