Changeset 32717
- Timestamp:
- Nov 18, 2011, 4:54:08 PM (15 years ago)
- Location:
- tags/ipp-20111110/psLib/src
- Files:
-
- 6 edited
-
imageops/psImageConvolve.c (modified) (5 diffs)
-
imageops/psImageCovariance.c (modified) (2 diffs)
-
sys/psMemory.c (modified) (10 diffs)
-
sys/psThread.c (modified) (1 diff)
-
types/psArray.c (modified) (1 diff)
-
types/psArray.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20111110/psLib/src/imageops/psImageConvolve.c
r30595 r32717 859 859 860 860 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_SMOOTHMASK_PIXELS"); 861 psArrayAdd(job->args, 1, out);862 psArrayAdd(job->args, 1, (psImage*)image);863 psArrayAdd(job->args, 1, (psImage*)mask);861 psArrayAdd(job->args, 0, out); 862 psArrayAdd(job->args, 0, (psImage*)image); 863 psArrayAdd(job->args, 0, (psImage*)mask); 864 864 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 865 psArrayAdd(job->args, 1, (psVector*)x);866 psArrayAdd(job->args, 1, (psVector*)y);867 psArrayAdd(job->args, 1, gaussNorm);865 psArrayAdd(job->args, 0, (psVector*)x); 866 psArrayAdd(job->args, 0, (psVector*)y); 867 psArrayAdd(job->args, 0, gaussNorm); 868 868 PS_ARRAY_ADD_SCALAR(job->args, minGauss, PS_TYPE_F32); 869 869 PS_ARRAY_ADD_SCALAR(job->args, size, PS_TYPE_S32); … … 1203 1203 // allocate a job, construct the arguments for this job 1204 1204 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_SMOOTHMASK_SCANROWS"); 1205 psArrayAdd(job->args, 1, calculation);1206 psArrayAdd(job->args, 1, calcMask);1207 psArrayAdd(job->args, 1, (psImage *) image); // cast away const1208 psArrayAdd(job->args, 1, (psImage *) mask); // cast away const1205 psArrayAdd(job->args, 0, calculation); 1206 psArrayAdd(job->args, 0, calcMask); 1207 psArrayAdd(job->args, 0, (psImage *) image); // cast away const 1208 psArrayAdd(job->args, 0, (psImage *) mask); // cast away const 1209 1209 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 1210 psArrayAdd(job->args, 1, gaussNorm);1210 psArrayAdd(job->args, 0, gaussNorm); 1211 1211 PS_ARRAY_ADD_SCALAR(job->args, minGauss, PS_TYPE_F32); 1212 1212 PS_ARRAY_ADD_SCALAR(job->args, size, PS_TYPE_S32); … … 1250 1250 // allocate a job, construct the arguments for this job 1251 1251 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_SMOOTHMASK_SCANCOLS"); 1252 psArrayAdd(job->args, 1, output);1253 psArrayAdd(job->args, 1, calculation);1254 psArrayAdd(job->args, 1, calcMask);1252 psArrayAdd(job->args, 0, output); 1253 psArrayAdd(job->args, 0, calculation); 1254 psArrayAdd(job->args, 0, calcMask); 1255 1255 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 1256 psArrayAdd(job->args, 1, gaussNorm);1256 psArrayAdd(job->args, 0, gaussNorm); 1257 1257 PS_ARRAY_ADD_SCALAR(job->args, minGauss, PS_TYPE_F32); 1258 1258 PS_ARRAY_ADD_SCALAR(job->args, size, PS_TYPE_S32); … … 1572 1572 1573 1573 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_CONVOLVE_MASK"); 1574 psArrayAdd(job->args, 1, conv);1575 psArrayAdd(job->args, 1, (psImage*)mask); // Casting away const to put on arguments1574 psArrayAdd(job->args, 0, conv); 1575 psArrayAdd(job->args, 0, (psImage*)mask); // Casting away const to put on arguments 1576 1576 PS_ARRAY_ADD_SCALAR(job->args, start, PS_TYPE_S32); 1577 1577 PS_ARRAY_ADD_SCALAR(job->args, stop, PS_TYPE_S32); … … 1607 1607 1608 1608 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_CONVOLVE_MASK"); 1609 psArrayAdd(job->args, 1, out);1610 psArrayAdd(job->args, 1, conv);1609 psArrayAdd(job->args, 0, out); 1610 psArrayAdd(job->args, 0, conv); 1611 1611 PS_ARRAY_ADD_SCALAR(job->args, start, PS_TYPE_S32); 1612 1612 PS_ARRAY_ADD_SCALAR(job->args, stop, PS_TYPE_S32); -
tags/ipp-20111110/psLib/src/imageops/psImageCovariance.c
r30595 r32717 177 177 if (threaded) { 178 178 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_COVARIANCE_CALCULATE"); 179 psArrayAdd(job->args, 1, out);180 psArrayAdd(job->args, 1, covar);181 psArrayAdd(job->args, 1, (psKernel*)kernel); // Casting away const179 psArrayAdd(job->args, 0, out); 180 psArrayAdd(job->args, 0, covar); 181 psArrayAdd(job->args, 0, (psKernel*)kernel); // Casting away const 182 182 PS_ARRAY_ADD_SCALAR(job->args, x, PS_TYPE_S32); 183 183 PS_ARRAY_ADD_SCALAR(job->args, y, PS_TYPE_S32); … … 345 345 if (threaded) { 346 346 psThreadJob *job = psThreadJobAlloc("PSLIB_IMAGE_COVARIANCE_BIN"); 347 psArrayAdd(job->args, 1, out);348 psArrayAdd(job->args, 1, covar);347 psArrayAdd(job->args, 0, out); 348 psArrayAdd(job->args, 0, covar); 349 349 PS_ARRAY_ADD_SCALAR(job->args, bin, PS_TYPE_S32); 350 350 PS_ARRAY_ADD_SCALAR(job->args, binVal, PS_TYPE_F32); -
tags/ipp-20111110/psLib/src/sys/psMemory.c
r32276 r32717 56 56 57 57 # define USE_SPINLOCK 0 58 # define USE_HARDLOCK 058 # define USE_HARDLOCK 1 59 59 60 60 # if (USE_SPINLOCK) … … 337 337 /**** Unique ID for allocated blocks and associated accessor functions 338 338 */ 339 static psMemId memid = 0;339 static volatile psMemId memid = 0; 340 340 341 341 /* Return memory ID counter for next block to be allocated … … 384 384 // pointer to the last mem block that was allocated. 385 385 // This is the root of the entire memory list 386 static psMemBlock *lastMemBlockAllocated = NULL;386 static volatile psMemBlock *lastMemBlockAllocated = NULL; 387 387 388 388 // set lock on lastMemBlockAllocated … … 655 655 memBlock->refCounter = 1; // one user so far 656 656 657 psMemBlock *last0 = lastMemBlockAllocated; 658 int flight0 = (lastMemBlockAllocated) ? lastMemBlockAllocated->inFlight : 10; 657 // XXX these lines are test lines that potentially access invalid memory 658 // XXX psMemBlock *last0 = lastMemBlockAllocated; 659 // XXX int flight0 = (lastMemBlockAllocated) ? lastMemBlockAllocated->inFlight : 10; 659 660 660 661 // need exclusive access of the memory block list now... … … 663 664 BLOCKLAST_LOCK (); 664 665 665 psMemBlock *last1 = lastMemBlockAllocated;666 int flight1 = (lastMemBlockAllocated) ? lastMemBlockAllocated->inFlight : 10;667 668 if (false) {669 fprintf (stderr, "last 0 : %lld, last 1 : %lld, flight0: %d, flight1: %d\n", (long long int) last0, (long long int) last1, (int) flight0, (int) flight1);670 }666 // XXX psMemBlock *last1 = lastMemBlockAllocated; 667 // XXX int flight1 = (lastMemBlockAllocated) ? lastMemBlockAllocated->inFlight : 10; 668 669 // XXX if (false) { 670 // XXX fprintf (stderr, "last 0 : %lld, last 1 : %lld, flight0: %d, flight1: %d\n", (long long int) last0, (long long int) last1, (int) flight0, (int) flight1); 671 // XXX } 671 672 672 673 // increment the memory id only after we've grabbed the memBlockListMutex this value is … … 679 680 lastMemBlockAllocated->previousBlock = memBlock; 680 681 } 681 memBlock->nextBlock = lastMemBlockAllocated;682 memBlock->nextBlock = (psMemBlock *) lastMemBlockAllocated; 682 683 lastMemBlockAllocated = memBlock; 683 684 … … 909 910 psS32 nleak = 0; 910 911 psS32 j = 0; 911 psMemBlock *topBlock = lastMemBlockAllocated;912 psMemBlock *topBlock = (psMemBlock *) lastMemBlockAllocated; 912 913 913 914 // XXX move this elsewhere? 914 915 if (fd != NULL) { 916 # if (USE_HARDLOCK) 917 # else 915 918 fprintf (fd, "set %d locks, cleared %d locks, retry on %d locks (memID %ld)\n", setLock, clearLock, retryLock, memid); 919 # endif 916 920 } 917 921 … … 1293 1297 1294 1298 psS32 nbad = 0; // number of bad blocks 1295 for (psMemBlock *memBlock = lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) {1299 for (psMemBlock *memBlock = (psMemBlock *) lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) { 1296 1300 if (isBadMemBlock(output, memBlock, __FILE__, __LINE__, __func__)) { 1297 1301 nbad++; … … 1324 1328 1325 1329 // loop through the linked list of memBlocks looking for a matching pointer 1326 for (psMemBlock *memBlock = lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) {1330 for (psMemBlock *memBlock = (psMemBlock *) lastMemBlockAllocated; memBlock != NULL; memBlock = memBlock->nextBlock) { 1327 1331 if (memBlock == addr) { 1328 1332 // we found the memBlock … … 1375 1379 size_t alloc = 0, persist = 0; 1376 1380 size_t nalloc = 0, npersist = 0; 1377 for (psMemBlock* ptr = lastMemBlockAllocated; ptr != NULL; ptr = ptr->nextBlock) {1381 for (psMemBlock* ptr = (psMemBlock *) lastMemBlockAllocated; ptr != NULL; ptr = ptr->nextBlock) { 1378 1382 assert (ptr->refCounter > 0); 1379 1383 -
tags/ipp-20111110/psLib/src/sys/psThread.c
r32481 r32717 91 91 92 92 job->type = psStringCopy(type); 93 job->args = psArrayAlloc (0);93 job->args = psArrayAllocEmpty(16); 94 94 job->results = NULL; 95 95 return job; -
tags/ipp-20111110/psLib/src/types/psArray.c
r26892 r32717 35 35 #include "psSort.h" 36 36 37 #define DEFAULT_ARRAY_ADD 10// Default number to add to an array when not specified37 #define DEFAULT_ARRAY_ADD 8 // Default number to add to an array when not specified 38 38 39 39 /***************************************************************************** -
tags/ipp-20111110/psLib/src/types/psArray.h
r26892 r32717 171 171 #define PS_ARRAY_ADD_SCALAR(ARRAY, VALUE, TYPE) { \ 172 172 psScalar *scalar = psScalarAlloc(VALUE, TYPE); \ 173 psArrayAdd(ARRAY, 1, scalar); \173 psArrayAdd(ARRAY, 0, scalar); \ 174 174 psFree(scalar); \ 175 175 }
Note:
See TracChangeset
for help on using the changeset viewer.
