Changeset 5530
- Timestamp:
- Nov 16, 2005, 1:07:10 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 13 edited
-
src/imageops/psImagePixelExtract.c (modified) (3 diffs)
-
src/imageops/psImageStats.c (modified) (5 diffs)
-
src/math/psMinimize.c (modified) (4 diffs)
-
src/math/psMinimize.h (modified) (2 diffs)
-
src/math/psStats.c (modified) (4 diffs)
-
src/mathtypes/psImage.h (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (4 diffs)
-
src/mathtypes/psVector.h (modified) (2 diffs)
-
src/types/psArray.c (modified) (3 diffs)
-
src/types/psArray.h (modified) (2 diffs)
-
src/types/psPixels.c (modified) (3 diffs)
-
src/types/psPixels.h (modified) (2 diffs)
-
test/types/tst_psMetadata_04.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImagePixelExtract.c
r5511 r5530 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-11-1 4 22:18:33$10 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-11-16 23:06:14 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 23 23 #include "psErrorText.h" 24 25 24 26 25 #define FUNC_MACRO_VECTOR_STORE_ROW(TYPE) \ … … 407 406 imgVec = psAlloc(sizeof(psVector)); 408 407 imgVec->type = input->type; 409 imgVec->n = *(int*)&imgVec->nalloc = numCols; 408 409 P_PSVECTOR_SET_NALLOC(imgVec,numCols); 410 imgVec->n = numCols; 410 411 if (mask != NULL) { 411 412 maskVec = psAlloc(sizeof(psVector)); 412 413 maskVec->type = mask->type; 413 maskVec->n = *(int*)&maskVec->nalloc = numCols; 414 P_PSVECTOR_SET_NALLOC(maskVec,numCols); 415 maskVec->n = numCols; 414 416 } 415 417 // recycle output to make a proper sized/type output structure -
trunk/psLib/src/imageops/psImageStats.c
r5294 r5530 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-12 21:02:20$11 * @version $Revision: 1.84 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-16 23:06:14 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 junkData = (psVector *) psAlloc(sizeof(psVector)); 65 65 junkData->type = in->type; 66 *(int*)&junkData->nalloc = in->numRows * in->numCols;66 P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols); 67 67 junkData->n = junkData->nalloc; 68 68 junkData->data.U8 = in->data.V[0]; // since psImage data is contiguous... … … 88 88 junkMask = psAlloc(sizeof(psVector)); 89 89 junkMask->type = mask->type; 90 *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;90 P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols); 91 91 junkMask->n = junkMask->nalloc; 92 92 junkMask->data.U8 = mask->data.V[0]; … … 137 137 junkData = (psVector *) psAlloc(sizeof(psVector)); 138 138 junkData->type = in->type; 139 *(int*)&junkData->nalloc = in->numRows * in->numCols;139 P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols); 140 140 junkData->n = junkData->nalloc; 141 141 junkData->data.U8 = in->data.V[0]; // since psImage data is contiguous... … … 161 161 junkMask = psAlloc(sizeof(psVector)); 162 162 junkMask->type = mask->type; 163 *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;163 P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols); 164 164 junkMask->n = junkMask->nalloc; 165 165 junkMask->data.U8 = mask->data.V[0]; -
trunk/psLib/src/math/psMinimize.c
r5453 r5530 10 10 * @author EAM, IfA 11 11 * 12 * @version $Revision: 1.14 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-1 0-28 19:15:04$12 * @version $Revision: 1.145 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-16 23:06:19 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 17 17 * XXX: must follow coding name standards on local functions. 18 18 * XXX: put local functions in front. 19 * 19 * 20 20 */ 21 21 /*****************************************************************************/ … … 596 596 psMinimization *min = psAlloc(sizeof(psMinimization)); 597 597 psMemSetDeallocator(min, (psFreeFunc)minimizationFree); 598 *(int*)&min->maxIter = maxIter;599 *(float*)&min->tol = tol;598 P_PSMINIMIZATION_SET_MAXITER(min,maxIter); 599 P_PSMINIMIZATION_SET_TOL(min,tol); 600 600 min->value = 0.0; 601 601 min->iter = 0; … … 1164 1164 for (i=0;i<numDims;i++) { 1165 1165 if (myParamMask->data.U8[i] == 0) { 1166 *(int*)&dummyMin.maxIter = PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS;1166 P_PSMINIMIZATION_SET_MAXITER((&dummyMin),PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS); 1167 1167 *(float*)&dummyMin.tol = PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE; 1168 1168 mul = p_psLineMin(&dummyMin, -
trunk/psLib/src/math/psMinimize.h
r5176 r5530 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $11 * @date $Date: 2005- 09-29 02:16:19 $10 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-11-16 23:06:19 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 psMinimization; 53 53 54 /** Allocates a psMinimization structure. 55 * 56 * @return psMinimization* : a new psMinimization struct 57 */ 58 psMinimization *psMinimizationAlloc( 59 int maxIter, ///< Number of minimization iterations to perform. 60 float tol ///< Requested error tolerance 61 ); 54 #define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val 55 #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val 56 57 58 /** Allocates a psMinimization structure. 59 * 60 * @return psMinimization* : a new psMinimization struct 61 */ 62 psMinimization *psMinimizationAlloc( 63 int maxIter, ///< Number of minimization iterations to perform. 64 float tol ///< Requested error tolerance 65 ); 62 66 63 67 /** Checks the type of a particular pointer. -
trunk/psLib/src/math/psStats.c
r5517 r5530 17 17 * 18 18 * 19 * @version $Revision: 1.15 0$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-11-1 5 20:10:32$19 * @version $Revision: 1.151 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-11-16 23:06:19 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 2334 2334 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 2335 2335 psMemSetDeallocator(newHist, (psFreeFunc) histogramFree); 2336 newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32); 2337 *(int *)&newHist->bounds->n = newHist->bounds->nalloc; 2336 psVector* newBounds = psVectorAlloc(n + 1, PS_TYPE_F32); 2337 newHist->bounds = newBounds; 2338 newBounds->n = newHist->bounds->nalloc; 2338 2339 2339 2340 // Calculate the bounds for each bin. … … 2343 2344 binSize += FLT_EPSILON; 2344 2345 for (i = 0; i < n + 1; i++) { 2345 new Hist->bounds->data.F32[i] = lower + (binSize * (psF32)i);2346 newBounds->data.F32[i] = lower + (binSize * (psF32)i); 2346 2347 } 2347 2348 … … 2383 2384 newHist = (psHistogram* ) psAlloc(sizeof(psHistogram)); 2384 2385 psMemSetDeallocator(newHist, (psFreeFunc) histogramFree); 2385 newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 2386 *(int *)&newHist->bounds->n = newHist->bounds->nalloc; 2386 psVector* newBounds = psVectorAlloc(bounds->n, PS_TYPE_F32); 2387 newHist->bounds = newBounds; 2388 newBounds->n = newHist->bounds->nalloc; 2387 2389 for (i = 0; i < bounds->n; i++) { 2388 new Hist->bounds->data.F32[i] = bounds->data.F32[i];2390 newBounds->data.F32[i] = bounds->data.F32[i]; 2389 2391 } 2390 2392 -
trunk/psLib/src/mathtypes/psImage.h
r5137 r5530 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005- 09-26 22:35:53$13 * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-16 23:06:21 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 80 80 psImage; 81 81 82 /** Basic image region structure. 83 * 84 * Struct for specifying a rectangular area in an image. 85 * 86 */ 87 typedef struct 88 { 89 float x0; ///< the first column of the region. 90 float x1; ///< the last column of the region. 91 float y0; ///< the first row of the region. 92 float y1; ///< the last row of the region. 93 } 94 psRegion; 82 #define P_PSIMAGE_SET_NUMCOLS(img,nc) *(int*)&img->numCols = nc 83 #define P_PSIMAGE_SET_NUMROWS(img,nr) *(int*)&img->numCols = nr 84 #define P_PSIMAGE_SET_TYPE(img,t) *(psMathType*)&img->type = t 85 86 /** Basic image region structure. 87 * 88 * Struct for specifying a rectangular area in an image. 89 * 90 */ 91 typedef struct 92 { 93 float x0; ///< the first column of the region. 94 float x1; ///< the last column of the region. 95 float y0; ///< the first row of the region. 96 float y1; ///< the last row of the region. 97 } 98 psRegion; 95 99 96 100 /** Create an image of the specified size and type. -
trunk/psLib/src/mathtypes/psVector.c
r5222 r5530 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-04 01:31:40$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-16 23:06:21 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 87 87 psVec->type.dimen = PS_DIMEN_VECTOR; 88 88 psVec->type.type = type; 89 *(long*)&psVec->nalloc = nalloc;89 P_PSVECTOR_SET_NALLOC(psVec,nalloc); 90 90 psVec->n = nalloc; 91 91 … … 114 114 // Realloc after decrementation to avoid accessing freed array elements 115 115 vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize); 116 *(long*)&vector->nalloc = nalloc;116 P_PSVECTOR_SET_NALLOC(vector,nalloc); 117 117 } 118 118 … … 143 143 if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) { 144 144 vector->data.U8 = psRealloc(vector->data.U8, byteSize); 145 *(long*)&vector->nalloc = nalloc;145 P_PSVECTOR_SET_NALLOC(vector,nalloc); 146 146 } 147 147 -
trunk/psLib/src/mathtypes/psVector.h
r5137 r5530 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 49$ $Name: not supported by cvs2svn $14 * @date $Date: 2005- 09-26 22:35:53$13 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-16 23:06:21 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 psVector; 56 56 57 /*****************************************************************************/ 58 59 /* FUNCTION PROTOTYPES */ 60 61 /*****************************************************************************/ 62 63 /** Checks the type of a particular pointer. 64 * 65 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 66 * 67 * @return bool: True if the pointer matches a psVector structure, false otherwise. 68 */ 69 bool psMemCheckVector( 70 psPtr ptr ///< the pointer whose type to check 71 ) 72 ; 57 #define P_PSVECTOR_SET_NALLOC(vec,n) *(long*)&(vec->nalloc) = n 58 59 /*****************************************************************************/ 60 61 /* FUNCTION PROTOTYPES */ 62 63 /*****************************************************************************/ 64 65 /** Checks the type of a particular pointer. 66 * 67 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 68 * 69 * @return bool: True if the pointer matches a psVector structure, false otherwise. 70 */ 71 bool psMemCheckVector( 72 psPtr ptr ///< the pointer whose type to check 73 ) 74 ; 73 75 74 76 /** Allocate a vector. -
trunk/psLib/src/types/psArray.c
r5216 r5530 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-01 02:22:15 $11 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-16 23:06:35 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 63 63 psMemSetDeallocator(psArr, (psFreeFunc) arrayFree); 64 64 65 *(long*)&psArr->nalloc = nalloc;65 P_PSARRAY_SET_NALLOC(psArr,nalloc); 66 66 psArr->n = nalloc; 67 67 … … 87 87 // Realloc after decrementation to avoid accessing freed array elements 88 88 in->data = psRealloc(in->data, nalloc * sizeof(psPtr)); 89 *(long*)&in->nalloc = nalloc;89 P_PSARRAY_SET_NALLOC(in,nalloc); 90 90 } 91 91 -
trunk/psLib/src/types/psArray.h
r5454 r5530 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-1 0-29 00:05:53$13 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-11-16 23:06:35 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 40 40 psArray; 41 41 42 /*****************************************************************************/ 42 #define P_PSARRAY_SET_NALLOC(vec,n) *(long*)&vec->nalloc = n 43 43 44 /* FUNCTION PROTOTYPES*/44 /*****************************************************************************/ 45 45 46 /*****************************************************************************/46 /* FUNCTION PROTOTYPES */ 47 47 48 /** Checks the type of a particular pointer. 49 * 50 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 51 * 52 * @return bool: True if the pointer matches a psArray structure, false otherwise. 53 */ 54 bool psMemCheckArray( 55 psPtr ptr ///< the pointer whose type to check 56 ) 57 ; 48 /*****************************************************************************/ 49 50 /** Checks the type of a particular pointer. 51 * 52 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 53 * 54 * @return bool: True if the pointer matches a psArray structure, false otherwise. 55 */ 56 bool psMemCheckArray( 57 psPtr ptr ///< the pointer whose type to check 58 ) 59 ; 58 60 59 61 -
trunk/psLib/src/types/psPixels.c
r5214 r5530 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-1 0-01 00:14:17$9 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-11-16 23:06:35 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 66 66 } 67 67 out->n = nalloc; 68 *(long*)&out->nalloc = nalloc;68 P_PSPIXELS_SET_NALLOC(out,nalloc); 69 69 70 70 psMemSetDeallocator(out, (psFreeFunc)pixelsFree); … … 94 94 } 95 95 96 *(long*)&pixels->nalloc = nalloc;96 P_PSPIXELS_SET_NALLOC(pixels,nalloc); 97 97 98 98 if (pixels->n > pixels->nalloc) { -
trunk/psLib/src/types/psPixels.h
r5214 r5530 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-1 0-01 00:14:17$9 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-11-16 23:06:35 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 psPixels; 49 49 50 #define P_PSPIXELS_SET_NALLOC(pix,n) *(long*)&pix->nalloc = n 50 51 51 /** Allocates a new psPixels structure52 *53 * @return psPixels* new psPixels54 */55 psPixels* psPixelsAlloc(56 long nalloc ///< the size of the coordinate vectors57 )58 ;52 /** Allocates a new psPixels structure 53 * 54 * @return psPixels* new psPixels 55 */ 56 psPixels* psPixelsAlloc( 57 long nalloc ///< the size of the coordinate vectors 58 ) 59 ; 59 60 60 61 /** Checks the type of a particular pointer. -
trunk/psLib/test/types/tst_psMetadata_04.c
r5522 r5530 1 2 1 /** @file tst_psMetadata_04.c 3 *4 * @brief Test driver for psMetadata functions5 *6 * This test driver contains the following tests for psMetadata:7 * Test A - Allocate metadata and items8 * Test B - Lookup metadata item by name9 * Test C - Attempt to use null metadata10 * Test D - Attempt to use null key11 * Test E - Attempt to lookup non-existant metadata item12 * Test F - Lookup metadata item by index13 * Test G - Lookup metadata item and return psS32 value14 * Test H - Lookup metadata item and return psF64 value15 * Test I - Lookup metadata item and return psVector pointer16 * Test J - Lookup metadata item and return psMetadata pointer17 * Test K - Lookup metadata item and return psString value18 * Test L - Attempt to use null metadata19 * Test M - Attempt to get non-existant metadata item20 * Test N - Attempt to look up with an invalid metadata object21 * Test O - Attempt get item with an invalid metadata object22 * Test P - Attempt get value of non-existant metadata item23 * Test Q - Free psMetadata24 *25 * @author Ross Harman, MHPCC26 *27 * @version $Revision: 1.9$ $Name: not supported by cvs2svn $28 * @date $Date: 2005-11-16 02:40:13$29 *30 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii31 *32 */2 * 3 * @brief Test driver for psMetadata functions 4 * 5 * This test driver contains the following tests for psMetadata: 6 * Test A - Allocate metadata and items 7 * Test B - Lookup metadata item by name 8 * Test C - Attempt to use null metadata 9 * Test D - Attempt to use null key 10 * Test E - Attempt to lookup non-existant metadata item 11 * Test F - Lookup metadata item by index 12 * Test G - Lookup metadata item and return psS32 value 13 * Test H - Lookup metadata item and return psF64 value 14 * Test I - Lookup metadata item and return psVector pointer 15 * Test J - Lookup metadata item and return psMetadata pointer 16 * Test K - Lookup metadata item and return psString value 17 * Test L - Attempt to use null metadata 18 * Test M - Attempt to get non-existant metadata item 19 * Test N - Attempt to look up with an invalid metadata object 20 * Test O - Attempt get item with an invalid metadata object 21 * Test P - Attempt get value of non-existant metadata item 22 * Test Q - Free psMetadata 23 * 24 * @author Ross Harman, MHPCC 25 * 26 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 27 * @date $Date: 2005-11-16 23:07:10 $ 28 * 29 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 30 * 31 */ 33 32 34 33 #include <string.h>
Note:
See TracChangeset
for help on using the changeset viewer.
