]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authornicolas <nicolas@git.imagemagick.org>
Sun, 24 Oct 2010 18:39:45 +0000 (18:39 +0000)
committernicolas <nicolas@git.imagemagick.org>
Sun, 24 Oct 2010 18:39:45 +0000 (18:39 +0000)
ChangeLog
magick/resize.c

index 6e4d034d021d4443d306b154e68fb0e6ee69d6fb..9531729e8abb3bad1e339d2f421025e3b0085b8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2010-10-24  6.6.5-1 Nicolas Robidoux <nicolas.robidoux@gmail...>
+  * Simplified CubicBC formulas.
+
 2010-10-22  6.6.5-1 Nicolas Robidoux <nicolas.robidoux@gmail...>
   * Revert the Robidoux filter to a Keys cubic with C=(108 sqrt 2-29)/398
     (as is already in the documentation).
index ede77d9b73276df08a374a22b1b931a46ce19ba8..42b3699f95bc1f1578e40dcb6242116be8b056c8 100644 (file)
@@ -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;
+      }
     }
 
   /*