[GRASS-SVN] r70143 - grass-addons/grass7/imagery/i.superpixels.slic

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 27 04:38:16 PST 2016


Author: rashadkm
Date: 2016-12-27 04:38:16 -0800 (Tue, 27 Dec 2016)
New Revision: 70143

Modified:
   grass-addons/grass7/imagery/i.superpixels.slic/main.c
Log:
use macro for min and max instead of fmin and fmax

Modified: grass-addons/grass7/imagery/i.superpixels.slic/main.c
===================================================================
--- grass-addons/grass7/imagery/i.superpixels.slic/main.c	2016-12-27 11:43:56 UTC (rev 70142)
+++ grass-addons/grass7/imagery/i.superpixels.slic/main.c	2016-12-27 12:38:16 UTC (rev 70143)
@@ -28,7 +28,14 @@
 #include <limits.h>
 #include <float.h>
 
+#ifndef MAX
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#endif
+#ifndef MIN
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#endif
 
+
 void SLIC_EnforceLabelConnectivity(
 	int*				labels,
 	int					width,
@@ -511,7 +518,7 @@
             if(hexgrid > 0 )
 			{
 				seedx = x*offset+(xoff<<(y&0x1))+xe;
-				seedx = fmin(double (g_width-1), seedx);
+				seedx = MIN(g_width-1,seedx);
 			} //for hex grid sampling
 			
 			int seedy = (y*offset+yoff+ye);
@@ -588,10 +595,10 @@
 		int n;
 		for(  n = 0; n < numk; n++ )
 		{
-			y1 = (int)fmax(0.0,	 kseedsy[n]-dbl_offset);
-			y2 = (int)fmin(he,   kseedsy[n]+dbl_offset);
-			x1 = (int)fmax(0.0,	 kseedsx[n]-dbl_offset);
-			x2 = (int)fmin(wi,	 kseedsx[n]+dbl_offset);
+			y1 = (int)MAX(0.0,	 kseedsy[n]-dbl_offset);
+			y2 = (int)MIN(he,   kseedsy[n]+dbl_offset);
+			x1 = (int)MAX(0.0,	 kseedsx[n]-dbl_offset);
+			x2 = (int)MIN(wi,	 kseedsx[n]+dbl_offset);
 			
 			int y;
 



More information about the grass-commit mailing list