Index: trunk/psLib/src/imageops/psImageConvolve.c
===================================================================
--- trunk/psLib/src/imageops/psImageConvolve.c	(revision 35767)
+++ trunk/psLib/src/imageops/psImageConvolve.c	(revision 36375)
@@ -36,9 +36,6 @@
 #define MIN_GAUSS_FRAC 0.25             // Minimum Gaussian fraction to accept when smoothing
 
-
-
 static bool threaded = false;           // Run image convolution threaded?
 static pthread_mutex_t threadMutex = PTHREAD_MUTEX_INITIALIZER;
-
 
 static void kernelFree(psKernel *kernel)
@@ -780,5 +777,5 @@
 }
 
-void psImageSmooth_PreAlloc_DataFree (psImageSmooth_PreAlloc_Data *smdata) {
+void psImageSmoothCacheDataFree (psImageSmoothCacheData *smdata) {
     psFree (smdata->resultX);
     psFree (smdata->resultY);
@@ -786,8 +783,11 @@
 }
 
-psImageSmooth_PreAlloc_Data *psImageSmooth_PreAlloc_DataAlloc (psImage *image, double sigma, double Nsigma) {
-
-    psImageSmooth_PreAlloc_Data *smdata = psAlloc(sizeof(psImageSmooth_PreAlloc_Data));
-    psMemSetDeallocator(smdata, (psFreeFunc) psImageSmooth_PreAlloc_DataFree);
+// allocate the psImageSmoothCache data structure, but do not define the kernel
+psImageSmoothCacheData *psImageSmoothCacheAlloc (psImage *image, double sigma, double Nsigma) {
+
+    psImageSmoothCacheData *smdata = psAlloc(sizeof(psImageSmoothCacheData));
+    psMemSetDeallocator(smdata, (psFreeFunc) psImageSmoothCacheDataFree);
+
+    smdata->kernel = NULL;
 
     if (!image) {
@@ -796,5 +796,4 @@
 	smdata->Nx = 0;
 	smdata->Ny = 0;
-	smdata->kernel = NULL;
 	smdata->resultX = NULL;
 	smdata->resultY = NULL;
@@ -807,5 +806,6 @@
     smdata->Ny = image->numRows;            // Number of rows
 
-    IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
+    // XXX drop this : we now require a call to a kernel-creation function (like psImageSmoothCacheKernel_Gauss)
+    // IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
        
     // use a temp running buffer for X and Y directions.
@@ -819,8 +819,18 @@
 }
 
+// generate a Gaussian smoothing kernel for supplied sigma.  sigma here does not need to match
+// that used to allocate the structure, but it is recommended
+bool psImageSmoothCacheKernel_Gauss (psImageSmoothCacheData *smdata, float sigma) {
+    // check for NULL structure elements?
+    psFree (smdata->kernel);
+    IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
+    return true;
+}
+
 // we can use the same DATA structure on multiple images of the same size
-bool psImageSmooth_PreAlloc_F32(psImage *image, psImageSmooth_PreAlloc_Data *smdata)
+bool psImageSmoothCache_F32(psImage *image, psImageSmoothCacheData *smdata)
 {
     PS_ASSERT_IMAGE_NON_NULL(image, false);
+    PS_ASSERT_VECTOR_NON_NULL(smdata->kernel, false);
     // assert on data type
 
@@ -2156,3 +2166,2 @@
     return threaded;
 }
-
