Changeset 2273 for trunk/psLib/test/image/tst_psImageFFT.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageFFT.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageFFT.c
r2204 r2273 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-1 0-27 00:57:33$8 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-04 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 85 85 img2 = psImageFFT(img2,img,PS_FFT_FORWARD); 86 86 if (img2->type.type != PS_TYPE_C32) { 87 psError( __func__,"FFT didn't produce complex values?");87 psError(PS_ERR_UNKNOWN, true,"FFT didn't produce complex values?"); 88 88 return 1; 89 89 } 90 90 if (img2->numCols != m || img2->numRows != n) { 91 psError( __func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",91 psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).", 92 92 img2->numCols,img2->numRows,m,n); 93 93 return 2; … … 103 103 if (! (col == 0 && (row == 1 || row == n-1)) 104 104 && ! (row == 0 && (col==1 || col == n-1)) ) { 105 psError( __func__,"Result invalid at %d,%d (%.2f)",col,row,mag);105 psError(PS_ERR_UNKNOWN, true,"Result invalid at %d,%d (%.2f)",col,row,mag); 106 106 return 3; 107 107 } … … 109 109 if ( (col == 0 && (row == 1 || row == n-1)) 110 110 || (row == 0 && (col==1 || col == n-1)) ) { 111 psError( __func__,"Result invalid at %d,%d (%.2f)",col,row,mag);111 psError(PS_ERR_UNKNOWN, true,"Result invalid at %d,%d (%.2f)",col,row,mag); 112 112 return 4; 113 113 } … … 120 120 121 121 if (img3->type.type != PS_TYPE_C32) { 122 psError( __func__,"FFT didn't produce complex values?");122 psError(PS_ERR_UNKNOWN, true,"FFT didn't produce complex values?"); 123 123 return 5; 124 124 } 125 125 126 126 if (img3->numCols != m || img3->numRows != n) { 127 psError( __func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",127 psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).", 128 128 img3->numCols,img3->numRows,m,n); 129 129 return 6; … … 136 136 psF32 pixel = creal(img3Row[col])/m/n; 137 137 if (fabsf(pixel-imgRow[col]) > 0.1) { 138 psError( __func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",138 psError(PS_ERR_UNKNOWN, true,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)", 139 139 col,row,pixel,imgRow[col]); 140 140 return 7; … … 149 149 char* typeStr; 150 150 PS_TYPE_NAME(typeStr,img3->type.type) 151 psError( __func__,"FFT asked to make real result, but I got a %s type image?",typeStr);151 psError(PS_ERR_UNKNOWN, true,"FFT asked to make real result, but I got a %s type image?",typeStr); 152 152 return 8; 153 153 } 154 154 155 155 if (img3->numCols != m || img3->numRows != n) { 156 psError( __func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",156 psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).", 157 157 img3->numCols,img3->numRows,m,n); 158 158 return 9; … … 165 165 psF32 pixel = img3Row[col]/m/n; 166 166 if (fabsf(pixel-imgRow[col]) > 0.1) { 167 psError( __func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",167 psError(PS_ERR_UNKNOWN, true,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)", 168 168 col,row,pixel,imgRow[col]); 169 169 return 10; … … 175 175 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error."); 176 176 if (psImageFFT(NULL,img2,PS_FFT_REVERSE|PS_FFT_FORWARD) != NULL) { 177 psError( __func__,"PS_FFT_REVERSE|PS_FFT_FORWARD option produced something?");177 psError(PS_ERR_UNKNOWN, true,"PS_FFT_REVERSE|PS_FFT_FORWARD option produced something?"); 178 178 return 11; 179 179 } … … 181 181 psLogMsg(__func__,PS_LOG_INFO,"Following should be an error."); 182 182 if (psImageFFT(NULL,img2,PS_FFT_FORWARD|PS_FFT_REAL_RESULT) != NULL) { 183 psError( __func__,"PS_FFT_FORWARD|PS_FFT_REAL_RESULT option produced something?");183 psError(PS_ERR_UNKNOWN, true,"PS_FFT_FORWARD|PS_FFT_REAL_RESULT option produced something?"); 184 184 return 12; 185 185 } … … 188 188 img4 = psImageFFT(NULL,NULL,PS_FFT_FORWARD); 189 189 if (img4 != NULL ) { 190 psError( __func__,"psImageFFT should return null for a null input image.");190 psError(PS_ERR_UNKNOWN, true,"psImageFFT should return null for a null input image."); 191 191 return 10; 192 192 } … … 197 197 img5 = psImageFFT(NULL,img4,PS_FFT_REAL_RESULT); 198 198 if (img5 != NULL) { 199 psError( __func__,"psImageFFT should return null for an invalid FFT direction.");199 psError(PS_ERR_UNKNOWN, true,"psImageFFT should return null for an invalid FFT direction."); 200 200 return 11; 201 201 } … … 229 229 img2 = psImageReal(img2,img); 230 230 if (img2 == NULL) { 231 psError( __func__,"psImageReal returned a NULL?");231 psError(PS_ERR_UNKNOWN, true,"psImageReal returned a NULL?"); 232 232 return 1; 233 233 } 234 234 if (img2->type.type != PS_TYPE_F32) { 235 psError( __func__,"psImageReal returned a wrong type (%d)?",235 psError(PS_ERR_UNKNOWN, true,"psImageReal returned a wrong type (%d)?", 236 236 img2->type.type); 237 237 return 2; … … 240 240 img3 = psImageImaginary(img3,img); 241 241 if (img3 == NULL) { 242 psError( __func__,"psImageImaginary returned a NULL?");242 psError(PS_ERR_UNKNOWN, true,"psImageImaginary returned a NULL?"); 243 243 return 3; 244 244 } 245 245 if (img3->type.type != PS_TYPE_F32) { 246 psError( __func__,"psImageImaginary returned a wrong type (%d)?",246 psError(PS_ERR_UNKNOWN, true,"psImageImaginary returned a wrong type (%d)?", 247 247 img3->type.type); 248 248 return 4; … … 255 255 for (psU32 col=0;col<m;col++) { 256 256 if (fabsf(img2Row[col] - row) > FLT_EPSILON) { 257 psError( __func__,"psImageReal didn't return the real portion at n=%d",257 psError(PS_ERR_UNKNOWN, true,"psImageReal didn't return the real portion at n=%d", 258 258 n); 259 259 return 5; 260 260 } 261 261 if (fabsf(img3Row[col] - col) > FLT_EPSILON) { 262 psError( __func__,"psImageImaginary didn't return the imag portion at n=%d",262 psError(PS_ERR_UNKNOWN, true,"psImageImaginary didn't return the imag portion at n=%d", 263 263 n); 264 264 return 6; … … 307 307 // 3. verify that the result is a psC32 308 308 if (img3->type.type != PS_TYPE_C32) { 309 psError( __func__,"Image Type from psImageComplex is not complex? (%d)",309 psError(PS_ERR_UNKNOWN, true,"Image Type from psImageComplex is not complex? (%d)", 310 310 img3->type.type); 311 311 return 1; … … 319 319 if (fabsf(crealf(img3Row[col]) - row) > FLT_EPSILON || 320 320 fabsf(cimagf(img3Row[col]) - col) > FLT_EPSILON) { 321 psError( __func__,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",321 psError(PS_ERR_UNKNOWN, true,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)", 322 322 col,row,crealf(img3Row[col]),cimagf(img3Row[col])); 323 323 return 2; … … 334 334 // 8. verify that an appropriate error occurred. (this partially has to be done via inspection) 335 335 if (img3 != NULL) { 336 psError( __func__,"psImageComplex returned a image though input types mismatched.");336 psError(PS_ERR_UNKNOWN, true,"psImageComplex returned a image though input types mismatched."); 337 337 return 3; 338 338 } … … 347 347 // 11. verify thet an appropriate error occurred. 348 348 if (img3 != NULL) { 349 psError( __func__,"psImageComplex returned a image though input sizes mismatched.");349 psError(PS_ERR_UNKNOWN, true,"psImageComplex returned a image though input sizes mismatched."); 350 350 return 4; 351 351 } … … 380 380 // 3. verify result is psC32 381 381 if (img2->type.type != PS_TYPE_C32) { 382 psError( __func__,"the psImageConjugate didn't return a C32 image.");382 psError(PS_ERR_UNKNOWN, true,"the psImageConjugate didn't return a C32 image."); 383 383 return 1; 384 384 } … … 390 390 if (fabsf(crealf(img2Row[col]) - row) > FLT_EPSILON || 391 391 fabsf(cimagf(img2Row[col]) + col) > FLT_EPSILON) { 392 psError( __func__,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",392 psError(PS_ERR_UNKNOWN, true,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)", 393 393 col,row,crealf(img2Row[col]),cimagf(img2Row[col])); 394 394 return 2; … … 425 425 // 3. verify result is psF32 426 426 if (img2->type.type != PS_TYPE_F32) { 427 psError( __func__,"the type was not PS_TYPE_F32.");427 psError(PS_ERR_UNKNOWN, true,"the type was not PS_TYPE_F32."); 428 428 return 1; 429 429 } … … 438 438 439 439 if (fabsf(img2Row[col] - power) > 2.0f*FLT_EPSILON) { 440 psError( __func__,"psImagePowerSpectrum result is invalid (%d,%d, %.2f vs %.2f)",440 psError(PS_ERR_UNKNOWN, true,"psImagePowerSpectrum result is invalid (%d,%d, %.2f vs %.2f)", 441 441 col,row,img2Row[col],power); 442 442 return 2;
Note:
See TracChangeset
for help on using the changeset viewer.
