2010-09-20 6.6.4-5 Nicolas Robidoux <nicolas.robidoux@gmail...>
- * Modified "magick/resize.c" so that PIL is a MagickRealType number. Earlier,
- some computations were needlessly done in long double precision because PIL
- forced an automatic upcast wherever it appeared.
+ * Modified "magick/resize.c" so that MagickPIL is a MagickRealType number.
+ Earlier, some computations were needlessly done in long double precision
+ because PIL forced an automatic upcast wherever it appeared. Changed its
+ name to MagickRealTypePI.
* Modified "magick/resize.c" so that Bohman uses one trig call + one sqrt call
instead of two trig calls.
%
*/
-#define MagickPIL ((MagickRealType) 3.14159265358979323846264338327950288420L)
+#define MagickREALTYPEPI ((MagickRealType) 3.14159265358979323846264338327950288420L)
static MagickRealType Bessel(const MagickRealType x,
const ResizeFilter *magick_unused(resize_filter))
http://www.ph.ed.ac.uk/%7ewjh/teaching/mo/slides/lens/lens.pdf.
*/
if (x == 0.0)
- return((MagickRealType) (0.25*MagickPIL));
- return(BesselOrderOne((MagickRealType) (MagickPIL*x))/(x+x));
+ return((MagickRealType) (0.25*MagickREALTYPEPI));
+ return(BesselOrderOne((MagickRealType) (MagickREALTYPEPI*x))/(x+x));
}
static MagickRealType Blackman(const MagickRealType x,
Refactored by Chantal Racette and Nicolas Robidoux to one trig
call and five flops.
*/
- const MagickRealType cospix = cos((double) (MagickPIL*x));
+ const MagickRealType cospix = cos((double) (MagickREALTYPEPI*x));
return(0.34+cospix*(0.5+cospix*0.16));
}
and 7 flops, taking advantage of the fact that the support of
Bohman is 1 (so that we know that sin(pi x) >= 0).
*/
- const double cospix = cos((double) (MagickPIL*x));
+ const double cospix = cos((double) (MagickREALTYPEPI*x));
const double sinpix = sqrt(1.0-cospix*cospix);
- return((MagickRealType) ((1.0-x)*cospix+(1.0/MagickPIL)*sinpix));
+ return((MagickRealType) ((1.0-x)*cospix+(1.0/MagickREALTYPEPI)*sinpix));
}
static MagickRealType Box(const MagickRealType x,
/*
Cosine window function: .5 + .5 cos(pi x).
*/
- const MagickRealType cospix = cos((double) (MagickPIL*x));
+ const MagickRealType cospix = cos((double) (MagickREALTYPEPI*x));
return(0.5+0.5*cospix);
}
/*
Offset cosine window function: .54 + .46 cos(pi x).
*/
- const MagickRealType cospix = cos((double) (MagickPIL*x));
+ const MagickRealType cospix = cos((double) (MagickREALTYPEPI*x));
return(0.54+0.46*cospix);
}
*/
if (x != 0.0)
{
- const MagickRealType pix = (MagickRealType) (MagickPIL*x);
+ const MagickRealType pix = (MagickRealType) (MagickREALTYPEPI*x);
return(sin((double) pix)/pix);
}
return(1.0);
*/
if (x > 4.0)
{
- const MagickRealType pix = (MagickRealType) (MagickPIL*x);
+ const MagickRealType pix = (MagickRealType) (MagickREALTYPEPI*x);
return(sin((double) pix)/pix);
}
{