]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 5 Aug 2012 12:11:45 +0000 (12:11 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 5 Aug 2012 12:11:45 +0000 (12:11 +0000)
MagickCore/accelerate.c
MagickCore/magick-type.h

index 520760538ec21cf3a351a1c7d7e18321434b67fc..0ab5f102a97fcff21d17013de2c69fb518e4ad18 100644 (file)
@@ -195,6 +195,13 @@ static const char
     "#endif\n"
     "}\n"
     "\n"
+    "static inline float MagickEpsilonReciprocal(const float x)\n"
+    "{\n"
+    "  float sign = x < (float) 0.0 ? (float) -1.0 : (float) 1.0;\n"
+    "  return((sign*x) >= MagickEpsilon ? (float) 1.0/x : sign*((float) 1.0/\n"
+    "    MagickEpsilon));\n"
+    "}\n"
+    "\n"
     "__kernel void Convolve(const __global CLPixelType *input,\n"
     "  __constant float *filter,const unsigned long width,const unsigned long height,\n"
     "  const unsigned int matte,__global CLPixelType *output)\n"
@@ -295,7 +302,7 @@ static const char
     "      break;\n"
     "    }\n"
     "  }\n"
-    "  gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);\n"
+    "  gamma=MagickEpsilonReciprocal(gamma);\n"
     "  const unsigned long index = y*columns+x;\n"
     "  output[index].x=ClampToQuantum(gamma*sum.x);\n"
     "  output[index].y=ClampToQuantum(gamma*sum.y);\n"
index 789662f5aa055b8951cb7037d5d61a12204c7be3..33a7961de35d13818871febaf7dc9dde93b01dc8 100644 (file)
@@ -99,7 +99,7 @@ typedef double Quantum;
 # error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64"
 #endif
 #endif
-#define MagickEpsilon  ((MagickRealType) 2.220446e-16)
+#define MagickEpsilon  ((MagickRealType) 1.0e-16)
 #define MagickHuge  ((MagickRealType) 1.0/MagickEpsilon)
 #define MagickPI  3.14159265358979323846264338327950288419716939937510L
 #define QuantumScale  ((double) 1.0/(double) QuantumRange)