IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 10, 2013, 2:55:11 PM (13 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20130904

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psLib/src/imageops/psImageConvolve.c

    r35767 r36375  
    3636#define MIN_GAUSS_FRAC 0.25             // Minimum Gaussian fraction to accept when smoothing
    3737
    38 
    39 
    4038static bool threaded = false;           // Run image convolution threaded?
    4139static pthread_mutex_t threadMutex = PTHREAD_MUTEX_INITIALIZER;
    42 
    4340
    4441static void kernelFree(psKernel *kernel)
     
    780777}
    781778
    782 void psImageSmooth_PreAlloc_DataFree (psImageSmooth_PreAlloc_Data *smdata) {
     779void psImageSmoothCacheDataFree (psImageSmoothCacheData *smdata) {
    783780    psFree (smdata->resultX);
    784781    psFree (smdata->resultY);
     
    786783}
    787784
    788 psImageSmooth_PreAlloc_Data *psImageSmooth_PreAlloc_DataAlloc (psImage *image, double sigma, double Nsigma) {
    789 
    790     psImageSmooth_PreAlloc_Data *smdata = psAlloc(sizeof(psImageSmooth_PreAlloc_Data));
    791     psMemSetDeallocator(smdata, (psFreeFunc) psImageSmooth_PreAlloc_DataFree);
     785// allocate the psImageSmoothCache data structure, but do not define the kernel
     786psImageSmoothCacheData *psImageSmoothCacheAlloc (psImage *image, double sigma, double Nsigma) {
     787
     788    psImageSmoothCacheData *smdata = psAlloc(sizeof(psImageSmoothCacheData));
     789    psMemSetDeallocator(smdata, (psFreeFunc) psImageSmoothCacheDataFree);
     790
     791    smdata->kernel = NULL;
    792792
    793793    if (!image) {
     
    796796        smdata->Nx = 0;
    797797        smdata->Ny = 0;
    798         smdata->kernel = NULL;
    799798        smdata->resultX = NULL;
    800799        smdata->resultY = NULL;
     
    807806    smdata->Ny = image->numRows;            // Number of rows
    808807
    809     IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
     808    // XXX drop this : we now require a call to a kernel-creation function (like psImageSmoothCacheKernel_Gauss)
     809    // IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
    810810       
    811811    // use a temp running buffer for X and Y directions.
     
    819819}
    820820
     821// generate a Gaussian smoothing kernel for supplied sigma.  sigma here does not need to match
     822// that used to allocate the structure, but it is recommended
     823bool psImageSmoothCacheKernel_Gauss (psImageSmoothCacheData *smdata, float sigma) {
     824    // check for NULL structure elements?
     825    psFree (smdata->kernel);
     826    IMAGE_SMOOTH_GAUSS(smdata->kernel, smdata->Nrange, sigma, F32);
     827    return true;
     828}
     829
    821830// we can use the same DATA structure on multiple images of the same size
    822 bool psImageSmooth_PreAlloc_F32(psImage *image, psImageSmooth_PreAlloc_Data *smdata)
     831bool psImageSmoothCache_F32(psImage *image, psImageSmoothCacheData *smdata)
    823832{
    824833    PS_ASSERT_IMAGE_NON_NULL(image, false);
     834    PS_ASSERT_VECTOR_NON_NULL(smdata->kernel, false);
    825835    // assert on data type
    826836
     
    21562166    return threaded;
    21572167}
    2158 
Note: See TracChangeset for help on using the changeset viewer.