[GRASS-SVN] r52077 - grass-addons/grass7/imagery/i.segment

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 15 07:42:45 PDT 2012


Author: momsen
Date: 2012-06-15 07:42:42 -0700 (Fri, 15 Jun 2012)
New Revision: 52077

Modified:
   grass-addons/grass7/imagery/i.segment/Makefile
   grass-addons/grass7/imagery/i.segment/create_isegs.c
   grass-addons/grass7/imagery/i.segment/iseg.h
Log:
fixed Makefile.  speed test (with io_debug method) runs. bug(s) in list implementation in region growing algorithm.

Modified: grass-addons/grass7/imagery/i.segment/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.segment/Makefile	2012-06-15 10:48:58 UTC (rev 52076)
+++ grass-addons/grass7/imagery/i.segment/Makefile	2012-06-15 14:42:42 UTC (rev 52077)
@@ -2,18 +2,9 @@
 
 PGM = i.segment
 
-LIBES = $(IMAGERYLIB) $(RASTERLIB) $(SEGMENTLIB) $(GISLIB)
-# $(LINKMLIB) 
-DEPENDENCIES = $(IMAGERYDEP) $(RASTERDEP) $(SEGMENTDEP) $(GISDEP)
-# $(LINKMLIB)
+LIBES = $(IMAGERYLIB) $(RASTERLIB) $(SEGMENTLIB) $(GISLIB) $(LINKMLIB) 
+DEPENDENCIES = $(IMAGERYDEP) $(RASTERDEP) $(SEGMENTDEP) $(GISDEP) $(LINKMDEP)
 
-# Tried adding above two items.  Compile error:
-# make: *** No rule to make target `-lgrass_linkm.7.0.svn', needed by `/home/emomsen/SVN/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/i.segment'.  Stop.
-
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
 default: cmd
-
-# included in very different way here:
-# ... grass_trunk/lib/bitmap$ cat Makefile
-#

Modified: grass-addons/grass7/imagery/i.segment/create_isegs.c
===================================================================
--- grass-addons/grass7/imagery/i.segment/create_isegs.c	2012-06-15 10:48:58 UTC (rev 52076)
+++ grass-addons/grass7/imagery/i.segment/create_isegs.c	2012-06-15 14:42:42 UTC (rev 52077)
@@ -12,11 +12,11 @@
 #include "iseg.h"
 
 
- /*
-    #define LINKM 
-  */
 
+#define LINKM
 
+
+
 int create_isegs(struct files *files, struct functions *functions)
 {
 
@@ -78,14 +78,14 @@
 
     /* spot to test things... */
 
-    /*speed test... showed a difference of 1min 16s for G_malloc and 56s for linkm. (with i < 200000000   */
+    /*speed test... showed a difference of 1min 9s for G_malloc and 34s for linkm. (with i < 2000000000   */
     /* TODO: fine tune the chunk size */
 
 #ifdef LINKM
     head = (VOID_T *) link_init(sizeof(struct pixels));
 #endif
 
-    for (i = 0; i < 200000000; i++) {
+    for (i = 0; i < 10; i++) {
 #ifdef LINKM
 	p = (struct pixels *)link_new(head);
 	link_dispose(head, p);
@@ -102,34 +102,11 @@
     G_message("used G_malloc");
 #endif
 
-
-    /* Now repeating the code above, without the ifdef tags.
-     * Gives compile errors:
-     * /usr/bin/ld: OBJ.x86_64-unknown-linux-gnu/create_isegs.o: undefined reference to symbol 'link_cleanup'
-     * /usr/bin/ld: note: 'link_cleanup' is defined in DSO /home/emomsen/SVN/grass_trunk/dist.x86_64-unknown-linux-gnu/lib/libgrass_linkm.7.0.svn.so so try adding it to the linker command line
-     * /home/emomsen/SVN/grass_trunk/dist.x86_64-unknown-linux-gnu/lib/libgrass_linkm.7.0.svn.so: could not read symbols: Invalid operation
-     * 
-     * Also gives some errors 
-     * create_isegs.c:143:14: warning: passing argument 1 of ‘link_new’ from incompatible pointer type [enabled by default]
-     * /home/emomsen/SVN/grass_trunk/dist.x86_64-unknown-linux-gnu/include/grass/defs/linkm.h:17:19: note: expected ‘struct link_head *’ but argument is of type ‘char *’
-     * */
-
-#ifdef NODEF
-    head = (VOID_T *) link_init(sizeof(struct pixels));
-
-    for (i = 0; i < 200000000; i++) {
-	p = (struct pixels *)link_new(head);
-	link_dispose(head, p);
-    }
-
-    link_cleanup(head);
-#endif
-
     G_message("end speed test");
     return 0;
 }
 
-#ifdef NODEF
+
 int region_growing(struct files *files, struct functions *functions)
 {
     int row, col, n, m, t;
@@ -548,8 +525,6 @@
     return 0;
 }
 
-#endif
-
 int find_four_pixel_neighbors(int p_row, int p_col, int pixel_neighbors[][2],
 			      struct files *files)
 {

Modified: grass-addons/grass7/imagery/i.segment/iseg.h
===================================================================
--- grass-addons/grass7/imagery/i.segment/iseg.h	2012-06-15 10:48:58 UTC (rev 52076)
+++ grass-addons/grass7/imagery/i.segment/iseg.h	2012-06-15 14:42:42 UTC (rev 52077)
@@ -74,9 +74,9 @@
 /* pixel stack */
 struct pixels
 {
+    struct pixels *next;
     int row;
     int col;
-    struct pixels *next;
 };
 
 /* parse_args.c */



More information about the grass-commit mailing list