From 2d5be0043cde75f41121f401feef1f793508d137 Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 5 Aug 2012 12:11:45 +0000 Subject: [PATCH] --- MagickCore/accelerate.c | 9 ++++++++- MagickCore/magick-type.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) 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) -- 2.50.1