Changeset 19015 for trunk/psLib/src/imageops/psImageConvolve.c
- Timestamp:
- Aug 11, 2008, 5:08:41 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageConvolve.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageConvolve.c
r18957 r19015 7 7 /// @author Eugene Magnier, IfA 8 8 /// 9 /// @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $10 /// @date $Date: 2008-08- 08 18:07:30$9 /// @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 10 /// @date $Date: 2008-08-12 03:08:41 $ 11 11 /// 12 12 /// Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 33 33 34 34 #include "psImageConvolve.h" 35 36 static bool threaded = false; // Run image convolution threaded? 37 38 39 35 40 36 41 static void kernelFree(psKernel *kernel) … … 865 870 } 866 871 867 868 872 psImage *psImageConvolveMask(psImage *out, const psImage *mask, psMaskType maskVal, 869 873 psMaskType setVal, int xMin, int xMax, int yMin, int yMax) … … 899 903 } 900 904 901 static bool threadsInit = false; // Threads initialised?902 int numThreads = psThreadPoolSize();// Number of threads903 if (numThreads > 0 && !threadsInit) {904 psThreadTask *task = psThreadTaskAlloc("PSLIB_IMAGE_CONVOLVE_MASK", 8);905 task->function = &imageConvolveMaskThread;906 psThreadTaskAdd(task);907 psFree(task);908 threadsInit = true;909 }910 911 905 int numRows = mask->numRows; // Number of rows 912 906 int numCols = mask->numCols; // Number of columns … … 925 919 926 920 // Rows 927 if (numThreads > 0) { 921 if (threaded) { 922 int numThreads = psThreadPoolSize(); // Number of threads 928 923 float cols = (float)numCols / (float)numThreads; // Number of cols to do at once 929 924 for (int i = 0; i < numThreads; i++) { … … 963 958 964 959 // Columns 965 if (numThreads > 0) { 960 if (threaded) { 961 int numThreads = psThreadPoolSize(); // Number of threads 966 962 float cols = (float)numCols / (float)numThreads; // Number of columns to do at once 967 963 for (int i = 0; i < numThreads; i++) { … … 1064 1060 } 1065 1061 1062 1063 void psImageConvolveSetThreads(bool set) 1064 { 1065 if (set && !threaded) { 1066 { 1067 psThreadTask *task = psThreadTaskAlloc("PSLIB_IMAGE_CONVOLVE_MASK", 8); 1068 task->function = &imageConvolveMaskThread; 1069 psThreadTaskAdd(task); 1070 psFree(task); 1071 } 1072 } else if (!set && threaded) { 1073 psThreadTaskDelete("PSLIB_IMAGE_CONVOLVE_MASK"); 1074 } 1075 1076 threaded = set; 1077 1078 } 1079 1080 bool psImageConvolveGetThreads(void) 1081 { 1082 return threaded; 1083 } 1084
Note:
See TracChangeset
for help on using the changeset viewer.
