From d15ee9a79904d322dce471e477ee5e8862e9ff86 Mon Sep 17 00:00:00 2001 From: nicolas Date: Sun, 24 Oct 2010 18:39:45 +0000 Subject: [PATCH] --- ChangeLog | 3 +++ magick/resize.c | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e4d034d0..9531729e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-10-24 6.6.5-1 Nicolas Robidoux + * Simplified CubicBC formulas. + 2010-10-22 6.6.5-1 Nicolas Robidoux * Revert the Robidoux filter to a Keys cubic with C=(108 sqrt 2-29)/398 (as is already in the documentation). diff --git a/magick/resize.c b/magick/resize.c index ede77d9b7..42b3699f9 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -1024,7 +1024,7 @@ MagickExport ResizeFilter *AcquireResizeFilter(const Image *image, if (artifact != (const char *) NULL) { B=StringToDouble(artifact); - C=(1.0-B)/2.0; /* Calculate C as if it is a Keys cubic filter. */ + C=(1.0-B)/2.0; /* Calculate C to get a Keys cubic filter. */ artifact=GetImageArtifact(image,"filter:c"); /* user C override */ if (artifact != (const char *) NULL) C=StringToDouble(artifact); @@ -1035,18 +1035,21 @@ MagickExport ResizeFilter *AcquireResizeFilter(const Image *image, if (artifact != (const char *) NULL) { C=StringToDouble(artifact); - B=1.0-2.0*C; /* Calculate B as if it is a Keys cubic filter. */ + B=1.0-2.0*C; /* Calculate B to get a Keys cubic filter. */ } } /* Convert B,C values into Cubic Coefficents. See CubicBC(). */ - resize_filter->coeff[0]=1.0-(1.0/3.0)*B; - resize_filter->coeff[1]=0.0; - resize_filter->coeff[2]=-3.0+2.0*B+C; - resize_filter->coeff[3]=2.0-1.5*B-C; - resize_filter->coeff[4]=(4.0/3.0)*B+4.0*C; - resize_filter->coeff[5]=-2.0*B-8.0*C; - resize_filter->coeff[6]=B+5.0*C; - resize_filter->coeff[7]=(-1.0/6.0)*B-C; + { + const double twoB = B+B; + resize_filter->coeff[0]=1.0-(1.0/3.0)*B; + resize_filter->coeff[1]=0.0; + resize_filter->coeff[2]=-3.0+twoB+C; + resize_filter->coeff[3]=2.0-1.5*B-C; + resize_filter->coeff[4]=(4.0/3.0)*B+4.0*C; + resize_filter->coeff[5]=-8.0*C-twoB; + resize_filter->coeff[6]=B+5.0*C; + resize_filter->coeff[7]=(-1.0/6.0)*B-C; + } } /* -- 2.50.1