- Timestamp:
- Jul 17, 2014, 12:36:19 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-ops-20130712
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psLib/src/imageops/psImageConvolve.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-ops-20130712
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-ops-20130712/psLib/src/imageops/psImageConvolve.c
r35767 r37068 36 36 #define MIN_GAUSS_FRAC 0.25 // Minimum Gaussian fraction to accept when smoothing 37 37 38 39 40 38 static bool threaded = false; // Run image convolution threaded? 41 39 static pthread_mutex_t threadMutex = PTHREAD_MUTEX_INITIALIZER; 42 43 40 44 41 static void kernelFree(psKernel *kernel) … … 780 777 } 781 778 782 void psImageSmooth _PreAlloc_DataFree (psImageSmooth_PreAlloc_Data *smdata) {779 void psImageSmoothCacheDataFree (psImageSmoothCacheData *smdata) { 783 780 psFree (smdata->resultX); 784 781 psFree (smdata->resultY); … … 786 783 } 787 784 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 786 psImageSmoothCacheData *psImageSmoothCacheAlloc (psImage *image, double sigma, double Nsigma) { 787 788 psImageSmoothCacheData *smdata = psAlloc(sizeof(psImageSmoothCacheData)); 789 psMemSetDeallocator(smdata, (psFreeFunc) psImageSmoothCacheDataFree); 790 791 smdata->kernel = NULL; 792 792 793 793 if (!image) { … … 796 796 smdata->Nx = 0; 797 797 smdata->Ny = 0; 798 smdata->kernel = NULL;799 798 smdata->resultX = NULL; 800 799 smdata->resultY = NULL; … … 807 806 smdata->Ny = image->numRows; // Number of rows 808 807 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); 810 810 811 811 // use a temp running buffer for X and Y directions. … … 819 819 } 820 820 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 823 bool 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 821 830 // 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)831 bool psImageSmoothCache_F32(psImage *image, psImageSmoothCacheData *smdata) 823 832 { 824 833 PS_ASSERT_IMAGE_NON_NULL(image, false); 834 PS_ASSERT_VECTOR_NON_NULL(smdata->kernel, false); 825 835 // assert on data type 826 836 … … 2156 2166 return threaded; 2157 2167 } 2158
Note:
See TracChangeset
for help on using the changeset viewer.
