Changeset 19061
- Timestamp:
- Aug 13, 2008, 5:30:53 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmSubtraction.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtraction.c
r19059 r19061 215 215 region.y0 - size, region.y1 + size); // Add a border 216 216 217 // Casting away const 218 psMutexLock((psImage*)image); 217 bool threaded = pmSubtractionThreaded(); // Are we running threaded? 218 219 // Casting away const for image, mask 220 if (threaded) { 221 psMutexLock((psImage*)image); 222 } 219 223 psImage *subImage = psImageSubset((psImage*)image, border); // Subimage to convolve 220 psMutexUnlock((psImage*)image);221 222 // Casting away const223 psMutexLock((psImage*)mask);224 if (threaded) { 225 psMutexUnlock((psImage*)image); 226 psMutexLock((psImage*)mask); 227 } 224 228 psImage *subMask = mask ? psImageSubset((psImage*)mask, border) : NULL; // Subimage mask 225 psMutexUnlock((psImage*)mask); 229 if (threaded) { 230 psMutexUnlock((psImage*)mask); 231 } 226 232 227 233 psImage *convolved = psImageConvolveFFT(NULL, subImage, subMask, maskVal, kernel); // Convolution 228 234 229 psMutexLock((psImage*)image); 235 if (threaded) { 236 psMutexLock((psImage*)image); 237 } 230 238 psFree(subImage); 231 psMutexUnlock((psImage*)image); 232 233 psMutexLock((psImage*)mask); 239 if (threaded) { 240 psMutexUnlock((psImage*)image); 241 psMutexLock((psImage*)mask); 242 } 234 243 psFree(subMask); 235 psMutexUnlock((psImage*)mask); 244 if (threaded) { 245 psMutexUnlock((psImage*)mask); 246 } 236 247 237 248 // Now, we have to chop off the borders, and stick it in where it belongs … … 239 250 psImage *subConv = psImageSubset(convolved, psRegionSet(size, -size, size, -size)); // Cut off the edges 240 251 241 psMutexLock(target); 252 if (threaded) { 253 psMutexLock(target); 254 } 242 255 psImage *subTarget = psImageSubset(target, region); // Target for this subregion 243 psMutexUnlock(target); 256 if (threaded) { 257 psMutexUnlock(target); 258 } 244 259 if (background != 0.0) { 245 260 psBinaryOp(subTarget, subConv, "+", psScalarAlloc(background, PS_TYPE_F32)); … … 252 267 psFree(subConv); 253 268 psFree(convolved); 254 psMutexLock(target); 269 if (threaded) { 270 psMutexLock(target); 271 } 255 272 psFree(subTarget); 256 psMutexUnlock(target); 273 if (threaded) { 274 psMutexUnlock(target); 275 } 257 276 return; 258 277 }
Note:
See TracChangeset
for help on using the changeset viewer.
