Index: trunk/psLib/src/imageops/psImageInterpolate.h
===================================================================
--- trunk/psLib/src/imageops/psImageInterpolate.h	(revision 19140)
+++ trunk/psLib/src/imageops/psImageInterpolate.h	(revision 20306)
@@ -7,6 +7,6 @@
  * @author Paul Price, Institute for Astronomy
  *
- * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- * @date $Date: 2008-08-21 01:12:44 $
+ * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ * @date $Date: 2008-10-22 02:10:37 $
  * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
  */
@@ -18,12 +18,12 @@
 /// Enumeration of options in interpolation
 typedef enum {
-    PS_INTERPOLATE_NONE,               ///< no interpolate defined (error state)
-    PS_INTERPOLATE_FLAT,               ///< Flat interpolation (nearest pixel)
-    PS_INTERPOLATE_BILINEAR,           ///< Bilinear interpolation
-    PS_INTERPOLATE_BICUBE,             ///< Bicubic interpolation with 3x3 region
-    PS_INTERPOLATE_GAUSS,              ///< Gaussian inteprolation with 3x3 region
-    PS_INTERPOLATE_LANCZOS2,           ///< Sinc interpolation with 4x4 pixel kernel
-    PS_INTERPOLATE_LANCZOS3,           ///< Sinc interpolation with 6x6 pixel kernel
-    PS_INTERPOLATE_LANCZOS4,           ///< Sinc interpolation with 8x8 pixel kernel
+    PS_INTERPOLATE_NONE = 0,            ///< No interpolate defined (error state)
+    PS_INTERPOLATE_FLAT,                ///< Flat interpolation (nearest pixel)
+    PS_INTERPOLATE_BILINEAR,            ///< Bilinear interpolation
+    PS_INTERPOLATE_BIQUADRATIC,         ///< Biquadratic interpolation with 3x3 region
+    PS_INTERPOLATE_GAUSS,               ///< Gaussian inteprolation with 3x3 region
+    PS_INTERPOLATE_LANCZOS2,            ///< Sinc interpolation with 4x4 pixel kernel
+    PS_INTERPOLATE_LANCZOS3,            ///< Sinc interpolation with 6x6 pixel kernel
+    PS_INTERPOLATE_LANCZOS4,            ///< Sinc interpolation with 8x8 pixel kernel
 } psImageInterpolateMode;
 
@@ -54,30 +54,34 @@
     float poorFrac;                     ///< Fraction of flux in bad pixels before output is marked bad
     bool shifting;                      ///< Shifting images? Don't interpolate if the shift is exact.
-} psImageInterpolateOptions;
+    int numKernels;                     ///< Number of pre-calculated kernels
+    const psImage *kernel, *kernel2;    ///< 1D interpolation kernel and kernel^2 (row) for each spacing
+    const psVector *sumKernel2;         ///< Sum of kernel^2 for each spacing
+} psImageInterpolation;
 
 
 /// Allocator
-psImageInterpolateOptions *psImageInterpolateOptionsAlloc(psImageInterpolateMode mode, // Interpolation mode
-                                                          const psImage *image, // Input image
-                                                          const psImage *variance,  // Variance image
-                                                          const psImage *mask, // Mask image
-                                                          psMaskType maskVal, // Value to mask
-                                                          double badImage, // Value for image if bad
-                                                          double badVariance, // Value for variance if bad
-                                                          psMaskType badMask, // Mask value for bad pixels
-                                                          psMaskType poorMask, // Mask value for poor pixels
-                                                          float poorFrac // Fraction of flux for question
+psImageInterpolation *psImageInterpolationAlloc(
+    psImageInterpolateMode mode,        // Interpolation mode
+    const psImage *image,               // Input image
+    const psImage *variance,            // Variance image
+    const psImage *mask,                // Mask image
+    psMaskType maskVal,                 // Value to mask
+    double badImage,                    // Value for image if bad
+    double badVariance,                 // Value for variance if bad
+    psMaskType badMask,                 // Mask value for bad pixels
+    psMaskType poorMask,                // Mask value for poor pixels
+    float poorFrac,                     // Fraction of flux for question
+    int numKernels                      // Number of interpolation kernels to pre-calculate
     ) PS_ATTR_MALLOC;
 
 
-
 /// Interpolate image pixel value given floating point coordinates.
-psImageInterpolateStatus psImageInterpolate(double *imageValue, ///< Return value for image
-                                            double *varianceValue, ///< Return value for variance
-                                            psMaskType *maskValue, ///< Return value for mask
-                                            float x, float y, ///< Location to which to interpolate
-                                            const psImageInterpolateOptions *options ///< Options
+psImageInterpolateStatus psImageInterpolate(
+    double *imageValue,                 ///< Return value for image
+    double *varianceValue,              ///< Return value for variance
+    psMaskType *maskValue,              ///< Return value for mask
+    float x, float y,                   ///< Location to which to interpolate
+    const psImageInterpolation *options ///< Options
     );
-
 
 // Return the appropriate interpolation mode given a char string name for that mode
@@ -91,5 +95,5 @@
 /// factor.
 float psImageInterpolateVarianceFactor(float x, float y, ///< Position of interest
-                                       const psImageInterpolateOptions *options ///< Interpolation options
+                                       psImageInterpolateMode mode ///< Interpolation mode
     );
 
