From: cristy Date: Sun, 5 Aug 2012 12:11:45 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d5be0043cde75f41121f401feef1f793508d137;p=imagemagick --- diff --git a/MagickCore/accelerate.c b/MagickCore/accelerate.c index 520760538..0ab5f102a 100644 --- a/MagickCore/accelerate.c +++ b/MagickCore/accelerate.c @@ -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" diff --git a/MagickCore/magick-type.h b/MagickCore/magick-type.h index 789662f5a..33a7961de 100644 --- a/MagickCore/magick-type.h +++ b/MagickCore/magick-type.h @@ -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)