Changeset 7071
- Timestamp:
- May 4, 2006, 4:48:35 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 7 edited
-
src/imageops/psImageConvolve.c (modified) (4 diffs)
-
src/mathtypes/psImage.c (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (2 diffs)
-
test/imageops/tst_psImageSmooth.c (modified) (6 diffs)
-
test/imageops/tst_psImageStructManip.c (modified) (16 diffs)
-
test/mathtypes/tst_psVectorSort_01.c (modified) (3 diffs)
-
test/mathtypes/verified/tst_psVectorSort_01.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageConvolve.c
r6937 r7071 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-0 4-21 20:45:56$7 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-05-05 02:48:34 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 603 603 /* generate normalized gaussian */ \ 604 604 psVector *gaussnorm = psVectorAlloc (Npixel, PS_TYPE_##TYPE); \ 605 gaussnorm->n = gaussnorm->nalloc; \ 605 606 sum = 0.0; \ 606 607 for (int i = -Nrange; i < Nrange + 1; i++) { \ … … 615 616 /* smooth in X direction */ \ 616 617 temp = psVectorAlloc (Nx, PS_TYPE_##TYPE); \ 618 temp->n = temp->nalloc; \ 617 619 for (int j = 0; j < Ny; j++) { \ 618 620 ps##TYPE *vi = image->data.TYPE[j]; \ … … 661 663 for (int j = 0; j < Nrange; j++) { \ 662 664 temp = psVectorAlloc (Nx, PS_TYPE_##TYPE); \ 665 temp->n = temp->nalloc; \ 663 666 /* zero the output row */ \ 664 667 memset (temp->data.TYPE, 0, Nx*sizeof(PS_TYPE_##TYPE)); \ -
trunk/psLib/src/mathtypes/psImage.c
r6912 r7071 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.10 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-0 4-20 01:13:11$11 * @version $Revision: 1.104 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-05-05 02:48:34 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 714 714 715 715 char buffer[20]; 716 for (int j = 0; j < a[0].numRows; j++) { 717 for (int i = 0; i < a[0].numCols; i++) { 716 // for (int j = 0; j < a[0].numRows; j++) { 717 // for (int i = 0; i < a[0].numCols; i++) { 718 for (int j = 0; j < a->numRows; j++) { 719 for (int i = 0; i < a->numCols; i++) { 718 720 snprintf (buffer,20, "%f ", p_psImageGetElementF64(a, i, j)); 719 721 write(fd,buffer,strlen(buffer)); -
trunk/psLib/src/mathtypes/psVector.c
r7056 r7071 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.7 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-05-0 4 00:09:11$11 * @version $Revision: 1.74 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-05-05 02:48:34 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 207 207 output = psVectorRecycle(output, nElements, type); 208 208 if (nElements == 0) { 209 psWarning("Warning: psVector was copied with 0 elements!\n");209 // psWarning("Warning: psVector was copied with 0 elements!\n"); 210 210 return output; 211 211 } -
trunk/psLib/test/imageops/tst_psImageSmooth.c
r6280 r7071 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-0 2-01 21:35:59$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-05-05 02:48:34 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 83 83 } 84 84 if (VERBOSE) { 85 p_psImagePrint(1, img, "The Sm mothed Image");85 p_psImagePrint(1, img, "The Smoothed Image"); 86 86 } 87 87 … … 132 132 } 133 133 if (VERBOSE) { 134 p_psImagePrint(1, img, "The Sm mothed Image");134 p_psImagePrint(1, img, "The Smoothed Image"); 135 135 } 136 136 … … 139 139 for (psS32 j = 1 ; j < numCols-1 ; j++) { 140 140 if ((fabs(img->data.F32[i][j] - 0.5) > 0.1)) { 141 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F32[i][j]); 141 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", 142 i, j, img->data.F32[i][j]); 142 143 testStatus = false; 143 144 } … … 150 151 for (psS32 j = 1 ; j < numCols-1 ; j++) { 151 152 if ((fabs(img->data.F64[i][j] - 0.5) > 0.1)) { 152 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", i, j, img->data.F64[i][j]); 153 printf("TEST ERROR: img[%d][%d] was %f, expected 0.5\n", 154 i, j, img->data.F64[i][j]); 153 155 testStatus = false; 154 156 } … … 161 163 return(testStatus); 162 164 } 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 165 185 166 static psS32 testImageSmooth() -
trunk/psLib/test/imageops/tst_psImageStructManip.c
r4547 r7071 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-07-13 02:47:00$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-05-05 02:48:34 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 62 62 subset3 = psImageSubset(original,region1); 63 63 64 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members nrow and ncol are equal to " 64 psLogMsg(__func__,PS_LOG_INFO, 65 "Verify the returned psImage structure members nrow and ncol are equal to " 65 66 "the input parameter nrow and ncol respectively."); 66 67 67 68 if (subset2->numCols != c/2 || subset2->numRows != r/2) { 68 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 69 psError(PS_ERR_UNKNOWN,true, 70 "psImageSubset output size was not proper(%dx%d, should be %dx%d).", 69 71 subset2->numCols, subset2->numRows, c/2,r/2); 70 72 return 1; … … 72 74 73 75 if (subset3->numCols != c/2 || subset3->numRows != r/2) { 74 psError(PS_ERR_UNKNOWN,true,"psImageSubset output size was not proper(%dx%d, should be %dx%d).", 76 psError(PS_ERR_UNKNOWN,true, 77 "psImageSubset output size was not proper(%dx%d, should be %dx%d).", 75 78 subset3->numCols, subset3->numRows, c/2,r/2); 76 79 return 2; 77 80 } 78 81 79 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the " 82 psLogMsg(__func__,PS_LOG_INFO, 83 "Verify the returned psImage structure contains expected values in the " 80 84 "row member, if the input psImage structure image contains known values."); 81 85 … … 95 99 } 96 100 97 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member type is equal to the input " 101 psLogMsg(__func__,PS_LOG_INFO, 102 "Verify the returned psImage structure member type is equal to the input " 98 103 "psImage structure member type."); 99 104 … … 109 114 } 110 115 111 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure members row0 and col0 are equal to " 116 psLogMsg(__func__,PS_LOG_INFO, 117 "Verify the returned psImage structure members row0 and col0 are equal to " 112 118 "the input parameters row0 and col0 respectively."); 113 119 114 120 if (subset2->col0 != c/4 || subset2->row0 != r/4) { 115 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).", 121 psError(PS_ERR_UNKNOWN,true, 122 "psImageSubset didn't set col0/row0 for subset2 (%d/%d, should be %d/%d).", 116 123 subset2->col0,subset2->row0,c/4,r/4); 117 124 return 8; 118 125 } 119 126 if (subset3->col0 != 0 || subset3->row0 != 0) { 120 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).", 127 psError(PS_ERR_UNKNOWN,true, 128 "psImageSubset didn't set col0/row0 for subset3 (%d/%d, should be %d/%d).", 121 129 subset3->col0,subset3->row0,0,0); 122 130 return 9; 123 131 } 124 132 125 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure member parent is equal to the " 133 psLogMsg(__func__,PS_LOG_INFO, 134 "Verify the returned psImage structure member parent is equal to the " 126 135 "input psImage structure pointer image."); 127 136 … … 138 147 } 139 148 140 psLogMsg(__func__,PS_LOG_INFO,"Verify the input psImage structure image only has the following members " 149 psLogMsg(__func__,PS_LOG_INFO, 150 "Verify the input psImage structure image only has the following members " 141 151 "changed: 1) Nchildren is increased by one. 2) parent contains pointer psImage structure " 142 152 "out at parent[Nchildren-1]."); 143 153 144 154 if (original->children == NULL || original->children->n != 2) { 145 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't increment number of children by one per subset."); 155 psError(PS_ERR_UNKNOWN,true, 156 "psImageSubset didn't increment number of children by one per subset."); 146 157 return 12; 147 158 } … … 180 191 } 181 192 if (memcmp(original,&preSubsetStruct,sizeof(psImage)) != 0) { 182 psError(PS_ERR_UNKNOWN,true,"psImageSubset changed the original struct though it failed to subset."); 193 psError(PS_ERR_UNKNOWN,true, 194 "psImageSubset changed the original struct though it failed to subset."); 183 195 return 17; 184 196 } 185 197 186 198 187 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program " 188 "execution doesn't stop, if the input parameters row0 and col0 are not within the range of " 189 "values of psImage structure image."); 199 psLogMsg(__func__,PS_LOG_INFO, 200 "Verify the returned psImage structure pointer is null and program " 201 "execution doesn't stop, if the input parameters row0 and col0 are not within " 202 "the range of values of psImage structure image."); 190 203 191 204 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 192 205 subset1 = psImageSubset(original, psRegionSet(0,c/2, 0,r*2)); 193 206 if (subset1 != NULL) { 194 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 207 psError(PS_ERR_UNKNOWN,true, 208 "psImageSubset didn't return NULL when subset origin was outside of " 195 209 "image (via cols)."); 196 210 return 18; … … 199 213 subset1 = psImageSubset(original,psRegionSet(0,c*2,0,r/2)); 200 214 if (subset1 != NULL) { 201 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 215 psError(PS_ERR_UNKNOWN,true, 216 "psImageSubset didn't return NULL when subset origin was outside of " 202 217 "image (via rows)."); 203 218 return 19; … … 206 221 subset1 = psImageSubset(original, psRegionSet(-1,c/2,0,r/2)); 207 222 if (subset1 != NULL) { 208 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 223 psError(PS_ERR_UNKNOWN,true, 224 "psImageSubset didn't return NULL when subset origin was outside of " 209 225 "image (col0=-1)."); 210 226 return 20; … … 213 229 subset1 = psImageSubset(original, psRegionSet(0,c/2,-1,r/2)); 214 230 if (subset1 != NULL) { 215 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset origin was outside of " 231 psError(PS_ERR_UNKNOWN,true, 232 "psImageSubset didn't return NULL when subset origin was outside of " 216 233 "image (row0=-1)."); 217 234 return 21; 218 235 } 219 236 220 psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure pointer is null and program " 221 "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 specify a range of " 222 "data not within the input psImage structure image. Also verify the input psImage structure " 223 "is not modified."); 237 psLogMsg(__func__,PS_LOG_INFO, 238 "Verify the returned psImage structure pointer is null and program " 239 "execution doesn't stop if the input parameters nrow, ncol, row0 and col0 " 240 "specify a range of data not within the input psImage structure image. Also " 241 "verify the input psImage structure is not modified."); 224 242 225 243 psLogMsg(__func__,PS_LOG_INFO,"An error should follow..."); 226 244 subset1 = psImageSubset(original,psRegionSet(0,c/2,0,r+1)); 227 245 if (subset1 != NULL) { 228 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via rows)."); 246 psError(PS_ERR_UNKNOWN,true, 247 "psImageSubset didn't return NULL when subset was outside of image (via rows)."); 229 248 return 22; 230 249 } … … 232 251 subset1 = psImageSubset(original, psRegionSet(0,c+1,0,r/2)); 233 252 if (subset1 != NULL) { 234 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via cols)."); 253 psError(PS_ERR_UNKNOWN,true, 254 "psImageSubset didn't return NULL when subset was outside of image (via cols)."); 235 255 return 23; 236 256 } … … 238 258 subset1 = psImageSubset(original,psRegionSet(0,c+1,0,r+1)); 239 259 if (subset1 != NULL) { 240 psError(PS_ERR_UNKNOWN,true,"psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); 260 psError(PS_ERR_UNKNOWN,true, 261 "psImageSubset didn't return NULL when subset was outside of image (via row+cols)."); 241 262 return 24; 242 263 } 243 264 244 psLogMsg(__func__, PS_LOG_INFO, "psImageFreeChildren shall deallocate any children images of a " 265 psLogMsg(__func__, PS_LOG_INFO, 266 "psImageFreeChildren shall deallocate any children images of a " 245 267 "psImage structure"); 246 268 … … 251 273 // Verify the returned psImage structure member Nchildren is set to zero. 252 274 if (original->children != NULL && original->children->n > 0) { 253 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren didn't set number of children to zero."); 275 psError(PS_ERR_UNKNOWN,true, 276 "psImageFreeChildren didn't set number of children to zero."); 254 277 return 25; 255 278 } 256 279 257 //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows and parent are not258 // modified.280 //Verify the returned psImage structure members type, nrow, ncol, row0, col0, rows 281 // and parent are not modified. 259 282 if (preSubsetStruct.numRows != original->numRows || 260 283 preSubsetStruct.numCols != original->numCols || … … 262 285 preSubsetStruct.col0 != original->col0) { 263 286 264 psError(PS_ERR_UNKNOWN,true,"psImageFreeChildren modified parent's non-children elements."); 287 psError(PS_ERR_UNKNOWN,true, 288 "psImageFreeChildren modified parent's non-children elements."); 265 289 return 27; 266 290 } … … 352 376 } \ 353 377 if (abs(img2Row[col] - (ps##OUT)(imgRow[col])) > 0.5) { \ 354 psError(PS_ERR_UNKNOWN, true,"returned psImage values after copy don't match at %d,%d " \ 378 psError(PS_ERR_UNKNOWN, true, \ 379 "returned psImage values after copy don't match at %d,%d " \ 355 380 "(%d vs %d)",\ 356 381 col,row,img2Row[col], (ps##OUT)(imgRow[col])); \ … … 456 481 for (psS32 row = 0; row < image2->numRows; row++) { 457 482 for (psS32 col = 0; col < image2->numCols; col++) { 458 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) { 483 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) 484 > FLT_EPSILON) { 459 485 psLogMsg(__func__,PS_LOG_ERROR, 460 486 "The value at (%d,%d) was %g, but should be %g.", -
trunk/psLib/test/mathtypes/tst_psVectorSort_01.c
r7043 r7071 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-05-0 2 22:35:52$14 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-05-05 02:48:35 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 165 165 // } 166 166 if (out != NULL) { 167 if (out->n != 0) { 168 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 169 "psVectorSort failed to correctly return a 0-length vector.\n"); 170 return 12; 171 } 172 } else { 167 173 psError(PS_ERR_BAD_PARAMETER_NULL, true, 168 "psVectorSort failed to return a NULL vector for 0-length input vector.\n");169 return 666;174 "psVectorSort returned a NULL vector instead of expected vector with n=0.\n"); 175 return 13; 170 176 } 171 177 /* if(out->n != 0) { … … 174 180 } 175 181 */ 182 psFree(out); 176 183 printFooter(stdout,"psVectorSort","Sort zero element vector",true); 177 184 -
trunk/psLib/test/mathtypes/verified/tst_psVectorSort_01.stderr
r7046 r7071 5 5 <DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO) 6 6 Error in psVectorSort: psVectorCopy returned NULL vector! 7 <DATE><TIME>|<HOST>|W|psVectorCopy (FILE:LINENO)8 Warning: psVector was copied with 0 elements!9 <DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO)10 Error in psVectorSort: Vector has less than 2 data entries!
Note:
See TracChangeset
for help on using the changeset viewer.
