Changeset 5174
- Timestamp:
- Sep 28, 2005, 3:15:38 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 11 edited
-
src/imageops/psImagePixelExtract.c (modified) (2 diffs)
-
src/imageops/psImagePixelExtract.h (modified) (2 diffs)
-
src/sys/psTrace.h (modified) (2 diffs)
-
src/types/psList.c (modified) (10 diffs)
-
src/types/psList.h (modified) (3 diffs)
-
src/types/psMetadata.h (modified) (2 diffs)
-
src/types/psMetadataConfig.c (modified) (5 diffs)
-
test/imageops/tst_psImagePixelExtract.c (modified) (4 diffs)
-
test/imageops/verified/tst_psImagePixelExtract.stderr (modified) (1 diff)
-
test/mathtypes/tst_psImage.c (modified) (2 diffs)
-
test/mathtypes/verified/tst_psImage.stderr (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImagePixelExtract.c
r4544 r5174 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-0 7-12 19:33:49$10 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-09-29 01:15:38 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 23 23 #include "psErrorText.h" 24 25 26 #define FUNC_MACRO_VECTOR_STORE_ROW(TYPE) \ 27 static psVector *vectorStoreRow##TYPE(psVector *vec, const psImage *in, int row) \ 28 { \ 29 \ 30 for (int i = 0; i < in->numCols; i++) \ 31 { \ 32 vec->data.TYPE[i] = in->data.TYPE[i][row]; \ 33 } \ 34 return vec; \ 35 } \ 36 37 FUNC_MACRO_VECTOR_STORE_ROW(S8) 38 FUNC_MACRO_VECTOR_STORE_ROW(S16) 39 FUNC_MACRO_VECTOR_STORE_ROW(S32) 40 FUNC_MACRO_VECTOR_STORE_ROW(S64) 41 FUNC_MACRO_VECTOR_STORE_ROW(U8) 42 FUNC_MACRO_VECTOR_STORE_ROW(U16) 43 FUNC_MACRO_VECTOR_STORE_ROW(U32) 44 FUNC_MACRO_VECTOR_STORE_ROW(U64) 45 FUNC_MACRO_VECTOR_STORE_ROW(F32) 46 FUNC_MACRO_VECTOR_STORE_ROW(F64) 47 FUNC_MACRO_VECTOR_STORE_ROW(C32) 48 FUNC_MACRO_VECTOR_STORE_ROW(C64) 49 50 psVector *psImageRow(psVector *out, 51 const psImage *input, 52 psU32 row) 53 { 54 if (input == NULL) { 55 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 56 return NULL; 57 } 58 if (row >= input->numRows) { 59 psError(PS_ERR_BAD_PARAMETER_NULL, true, 60 "Specified row number is out of range for specified image.\n"); 61 return NULL; 62 } 63 psVectorRecycle(out, input->numCols, input->type.type); 64 65 switch (input->type.type) { 66 case PS_TYPE_S8: 67 out = vectorStoreRowS8(out, input, row); 68 break; 69 case PS_TYPE_S16: 70 out = vectorStoreRowS16(out, input, row); 71 break; 72 case PS_TYPE_S32: 73 out = vectorStoreRowS32(out, input, row); 74 break; 75 case PS_TYPE_S64: 76 out = vectorStoreRowS64(out, input, row); 77 break; 78 case PS_TYPE_U8: 79 out = vectorStoreRowU8(out, input, row); 80 break; 81 case PS_TYPE_U16: 82 out = vectorStoreRowU16(out, input, row); 83 break; 84 case PS_TYPE_U32: 85 out = vectorStoreRowU32(out, input, row); 86 break; 87 case PS_TYPE_U64: 88 out = vectorStoreRowU64(out, input, row); 89 break; 90 case PS_TYPE_F32: 91 out = vectorStoreRowF32(out, input, row); 92 break; 93 case PS_TYPE_F64: 94 out = vectorStoreRowF64(out, input, row); 95 break; 96 case PS_TYPE_C32: 97 out = vectorStoreRowC32(out, input, row); 98 break; 99 case PS_TYPE_C64: 100 out = vectorStoreRowC64(out, input, row); 101 break; 102 default: 103 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 104 "Specified psImage has invalid type for this function.\n"); 105 return NULL; 106 } 107 108 return out; 109 } 110 111 112 #define FUNC_MACRO_VECTOR_STORE_COL(TYPE) \ 113 static psVector *vectorStoreCol##TYPE(psVector *vec, const psImage *in, int col) \ 114 { \ 115 \ 116 for (int i = 0; i < in->numRows; i++) \ 117 { \ 118 vec->data.TYPE[i] = in->data.TYPE[col][i]; \ 119 } \ 120 return vec; \ 121 } \ 122 123 FUNC_MACRO_VECTOR_STORE_COL(S8) 124 FUNC_MACRO_VECTOR_STORE_COL(S16) 125 FUNC_MACRO_VECTOR_STORE_COL(S32) 126 FUNC_MACRO_VECTOR_STORE_COL(S64) 127 FUNC_MACRO_VECTOR_STORE_COL(U8) 128 FUNC_MACRO_VECTOR_STORE_COL(U16) 129 FUNC_MACRO_VECTOR_STORE_COL(U32) 130 FUNC_MACRO_VECTOR_STORE_COL(U64) 131 FUNC_MACRO_VECTOR_STORE_COL(F32) 132 FUNC_MACRO_VECTOR_STORE_COL(F64) 133 FUNC_MACRO_VECTOR_STORE_COL(C32) 134 FUNC_MACRO_VECTOR_STORE_COL(C64) 135 136 137 psVector *psImageCol(psVector *out, 138 const psImage *input, 139 psU32 column) 140 { 141 if (input == NULL) { 142 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 143 return NULL; 144 } 145 if (column >= input->numRows) { 146 psError(PS_ERR_BAD_PARAMETER_NULL, true, 147 "Specified column number is out of range for specified image.\n"); 148 return NULL; 149 } 150 psVectorRecycle(out, input->numCols, input->type.type); 151 152 switch (input->type.type) { 153 case PS_TYPE_S8: 154 out = vectorStoreColS8(out, input, column); 155 break; 156 case PS_TYPE_S16: 157 out = vectorStoreColS16(out, input, column); 158 break; 159 case PS_TYPE_S32: 160 out = vectorStoreColS32(out, input, column); 161 break; 162 case PS_TYPE_S64: 163 out = vectorStoreColS64(out, input, column); 164 break; 165 case PS_TYPE_U8: 166 out = vectorStoreColU8(out, input, column); 167 break; 168 case PS_TYPE_U16: 169 out = vectorStoreColU16(out, input, column); 170 break; 171 case PS_TYPE_U32: 172 out = vectorStoreColU32(out, input, column); 173 break; 174 case PS_TYPE_U64: 175 out = vectorStoreColU64(out, input, column); 176 break; 177 case PS_TYPE_F32: 178 out = vectorStoreColF32(out, input, column); 179 break; 180 case PS_TYPE_F64: 181 out = vectorStoreColF64(out, input, column); 182 break; 183 case PS_TYPE_C32: 184 out = vectorStoreColC32(out, input, column); 185 break; 186 case PS_TYPE_C64: 187 out = vectorStoreColC64(out, input, column); 188 break; 189 default: 190 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 191 "Specified psImage has invalid type for this function.\n"); 192 return NULL; 193 } 194 195 return out; 196 197 } 198 24 199 25 200 psVector* psImageSlice(psVector* out, -
trunk/psLib/src/imageops/psImagePixelExtract.h
r4590 r5174 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-0 7-21 02:39:57$10 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-09-29 01:15:38 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 32 32 PS_CUT_Y_NEG ///< Cut in the y dimension from top down. 33 33 } psImageCutDirection; 34 35 /** Extracts a single complete row from the image and returns it to the 36 * provided vector, allocating it if it is NULL. 37 * 38 * @return psVector*: The row data extracted from psImage input 39 */ 40 psVector *psImageRow( 41 psVector *out, ///< specified vector to return 42 const psImage *input, ///< input image 43 psU32 row ///< row number to extract 44 ); 45 46 /** Extracts a single complete column from the image and returns it to the 47 * provided vector, allocating it if it is NULL. 48 * 49 * @return psVector*: The column data extracted from psImage input 50 */ 51 psVector *psImageCol( 52 psVector *out, ///< specified vector to return 53 const psImage *input, ///< input image 54 psU32 column ///< column number to extract 55 ); 34 56 35 57 /** Extract pixels from rectlinear region to a vector (array of floats). -
trunk/psLib/src/sys/psTrace.h
r5070 r5174 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09- 19 22:50:29$11 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-29 01:15:38 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 143 143 * @return FILE*: File Destination 144 144 */ 145 int psTraceGetDestination( );145 int psTraceGetDestination(void); 146 146 147 147 /* \} */// End of SystemGroup Functions -
trunk/psLib/src/types/psList.c
r4898 r5174 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 8-30 01:14:13$8 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-29 01:15:38 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 39 39 } 40 40 41 pthread_mutex_lock(&list->lock) 42 ; 41 pthread_mutex_lock(&list->p_lock); 43 42 44 43 // remove the free function of iterators to avoid double removal from list … … 59 58 } 60 59 61 pthread_mutex_unlock(&list->lock) 62 ; 63 64 pthread_mutex_destroy(&list->lock) 65 ; 60 pthread_mutex_unlock(&list->p_lock); 61 62 pthread_mutex_destroy(&list->p_lock); 66 63 67 64 } … … 88 85 int index = iterator->index; 89 86 90 pthread_mutex_lock(&list->lock) 91 ; 87 pthread_mutex_lock(&list->p_lock); 92 88 93 89 if (elem == list->head) { // head of list? … … 115 111 list->n--; 116 112 117 pthread_mutex_unlock(&list-> lock)113 pthread_mutex_unlock(&list->p_lock) 118 114 ; 119 115 … … 139 135 psListIteratorAlloc(list,PS_LIST_HEAD,true); 140 136 141 pthread_mutex_init(&(list->lock), NULL) 142 ; 137 pthread_mutex_init(&(list->p_lock), NULL); 143 138 144 139 if (data != NULL) { … … 322 317 psListElem* elem = psAlloc(sizeof(psListElem)); 323 318 324 pthread_mutex_lock(&list->lock) 325 ; 319 pthread_mutex_lock(&list->p_lock); 326 320 327 321 // set the new list element's attributes … … 359 353 } 360 354 361 pthread_mutex_unlock(&list->lock) 362 ; 355 pthread_mutex_unlock(&list->p_lock); 363 356 364 357 return true; … … 397 390 psListElem* elem = psAlloc(sizeof(psListElem)); 398 391 399 pthread_mutex_lock(&list->lock) 400 ; 392 pthread_mutex_lock(&list->p_lock); 401 393 402 394 // set the new list element's attributes … … 434 426 } 435 427 436 pthread_mutex_unlock(&list->lock) 437 ; 428 pthread_mutex_unlock(&list->p_lock); 438 429 439 430 return true; -
trunk/psLib/src/types/psList.h
r4898 r5174 7 7 * @ingroup LinkedList 8 8 * 9 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 8-30 01:14:13$9 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-09-29 01:15:38 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 60 60 ///< others are user-level iterators created by psListIteratorAlloc. 61 61 62 pthread_mutex_t lock;///< mutex to lock a node during changes63 //void *lock; ///< Optional lock for thread safety62 pthread_mutex_t p_lock; ///< mutex to lock a node during changes 63 void *lock; ///< Optional lock for thread safety 64 64 } 65 65 psList; … … 75 75 typedef struct 76 76 { 77 psList* list; ///< List iterator to works on78 psListElem* cursor; ///< current cursor position79 bool offEnd; ///< Iterator off the end?80 long index; ///< the index number in the list81 bool mutable; ///< Is it permissible to modify the list?77 psList* list; ///< List iterator to works on 78 psListElem* cursor; ///< current cursor position 79 bool offEnd; ///< Iterator off the end? 80 long index; ///< the index number in the list 81 bool mutable; ///< Is it permissible to modify the list? 82 82 } 83 83 psListIterator; -
trunk/psLib/src/types/psMetadata.h
r5136 r5174 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.6 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09-2 6 21:13:26$13 * @version $Revision: 1.66 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-29 01:15:38 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 136 136 ; 137 137 138 139 138 /** Checks the type of a particular pointer. 140 139 * -
trunk/psLib/src/types/psMetadataConfig.c
r5136 r5174 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-09-2 6 21:13:26$12 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-29 01:15:38 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 /** Maximum size of a string */ 58 58 #define MAX_STRING_LENGTH 256 59 #define MAXSTR 2 5659 #define MAXSTR 2256 60 60 61 61 … … 1228 1228 psString newString = NULL; 1229 1229 psString newStr = NULL; 1230 char mdString[ 2048];1230 char mdString[16000]; 1231 1231 psMetadataItem *item = NULL; 1232 1232 psMetadataIterator *iter = psMetadataIteratorAlloc(md, PS_LIST_HEAD, NULL); … … 1242 1242 while ( (item = psMetadataGetAndIncrement(iter)) ) { 1243 1243 type = item->type; 1244 if ( type == PS_DATA_STRING) 1244 if ( type == PS_DATA_STRING) { 1245 1245 type = PS_DATA_STRING; 1246 if ( type == PS_DATA_VECTOR) 1246 } 1247 if ( type == PS_DATA_VECTOR) { 1247 1248 type = PS_DATA_VECTOR; 1248 if ( type == PS_DATA_TIME) 1249 } 1250 if ( type == PS_DATA_TIME) { 1249 1251 type = PS_DATA_TIME; 1250 if ( item->type == PS_DATA_METADATA) 1252 } 1253 if ( item->type == PS_DATA_METADATA) { 1251 1254 type = PS_DATA_METADATA; 1255 } 1256 if (item == NULL) { 1257 type = PS_DATA_UNKNOWN; 1258 } 1252 1259 1253 1260 switch (type) { … … 1455 1462 } 1456 1463 } 1457 newString = psStringNCopy(mdString, 2048);1464 newString = psStringNCopy(mdString, 16000); 1458 1465 psFree(iter); 1459 1466 return newString; -
trunk/psLib/test/imageops/tst_psImagePixelExtract.c
r4547 r5174 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 7-13 02:47:00$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-29 01:15:38 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 21 21 static psS32 testImageCut(void); 22 22 static psS32 testImageRadialCut(void); 23 static psS32 testImageRowCol(void); 23 24 24 25 … … 27 28 {testImageCut, 555, "psImageCut", 0, false}, 28 29 {testImageRadialCut, 557, "psImageRadialCut", 0, false}, 30 {testImageRowCol, 559, "psImageRowCol", 0, false}, 29 31 {NULL} 30 32 }; … … 742 744 return 0; 743 745 } 746 747 psS32 testImageRowCol(void) 748 { 749 psVector *rowcol = NULL; 750 psVector *empty = NULL; 751 psImage *image = NULL; 752 psImage *emptyImage = NULL; 753 754 image = psImageAlloc(3, 3, PS_TYPE_F64); 755 rowcol = psVectorAlloc(3, PS_TYPE_F64); 756 757 image->data.F64[0][0] = 666.666; 758 image->data.F64[1][0] = 66.6; 759 image->data.F64[2][0] = 6.66; 760 image->data.F64[0][1] = 6.6; 761 image->data.F64[1][1] = 6.666; 762 image->data.F64[2][1] = 66.666; 763 image->data.F64[0][2] = 666.6; 764 image->data.F64[1][2] = 666.66; 765 image->data.F64[2][2] = 66.66; 766 767 //Test for error with NULL image 768 empty = psImageCol(empty, emptyImage, 0); 769 if (empty != NULL) { 770 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 771 "psImageCol failed to return NULL for NULL image input.\n"); 772 return 1; 773 } 774 //Test for error with Out of Range Row 775 empty = psImageRow(empty, image, 5); 776 if (empty != NULL) { 777 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 778 "psImageRow failed to return NULL for out of range row input.\n"); 779 return 2; 780 } 781 rowcol->data.F64[0] = 1.1; 782 rowcol->data.F64[2] = 2.2; 783 //Test recycling of non-NULL vector & correct output 784 rowcol = psImageCol(rowcol, image, 1); 785 if (rowcol->data.F64[0] != 66.6 && rowcol->data.F64[2] != 666.66) { 786 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 787 "psImageCol failed to return correct values.\n"); 788 return 3; 789 } 790 791 psFree(rowcol); 792 psFree(image); 793 return 0; 794 } 795 -
trunk/psLib/test/imageops/verified/tst_psImagePixelExtract.stderr
r4547 r5174 146 146 ---> TESTPOINT PASSED (psImage{psImageRadialCut} | tst_psImagePixelExtract.c) 147 147 148 /***************************** TESTPOINT ******************************************\ 149 * TestFile: tst_psImagePixelExtract.c * 150 * TestPoint: psImage{psImageRowCol} * 151 * TestType: Positive * 152 \**********************************************************************************/ 153 154 <DATE><TIME>|<HOST>|E|psImageCol (FILE:LINENO) 155 Can not operate on a NULL psImage. 156 <DATE><TIME>|<HOST>|E|psImageRow (FILE:LINENO) 157 Specified row number is out of range for specified image. 158 159 ---> TESTPOINT PASSED (psImage{psImageRowCol} | tst_psImagePixelExtract.c) 160 -
trunk/psLib/test/mathtypes/tst_psImage.c
r5101 r5174 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-09-2 3 00:04:36$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-29 01:15:38 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 36 36 {testRegion3,793,"psRegionForSquare",0,false}, 37 37 {testImageInit,794,"psImageInit",0,false}, 38 {testImageGetSet,795,"psImage Init",0,false},38 {testImageGetSet,795,"psImageGetSet",0,false}, 39 39 {NULL} 40 40 }; -
trunk/psLib/test/mathtypes/verified/tst_psImage.stderr
r5114 r5174 134 134 /***************************** TESTPOINT ******************************************\ 135 135 * TestFile: tst_psImage.c * 136 * TestPoint: psImage{psImage Init}*136 * TestPoint: psImage{psImageGetSet} * 137 137 * TestType: Positive * 138 138 \**********************************************************************************/ … … 141 141 Invalid position. Position too large 142 142 143 ---> TESTPOINT PASSED (psImage{psImage Init} | tst_psImage.c)143 ---> TESTPOINT PASSED (psImage{psImageGetSet} | tst_psImage.c) 144 144
Note:
See TracChangeset
for help on using the changeset viewer.
