Changeset 2273 for trunk/psLib/test/image/tst_psImageConvolve.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageConvolve.c (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageConvolve.c
r2204 r2273 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-1 0-27 00:57:33$7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-11-04 01:05:00 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 52 52 53 53 if (k == NULL) { 54 psError( __func__,"psKernelAlloc returned NULL for [%d:%d,%d:%d].",54 psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for [%d:%d,%d:%d].", 55 55 xMin[i], xMax[i], yMin[i], yMax[i]); 56 56 return i*10+1; … … 59 59 if (k->xMin != xMin[i] || k->xMax != xMax[i] || 60 60 k->yMin != yMin[i] || k->yMax != yMax[i]) { 61 psError( __func__,"Min/max members, [%d:%d,%d:%d], of psKernel wrong. Should be [%d:%d,%d:%d].",61 psError(PS_ERR_UNKNOWN, true,"Min/max members, [%d:%d,%d:%d], of psKernel wrong. Should be [%d:%d,%d:%d].", 62 62 k->xMin,k->xMax, k->yMin, k->yMax, 63 63 xMin[i], xMax[i], yMin[i], yMax[i]); … … 67 67 if (k->image->numCols != xMax[i]-xMin[i]+1 || 68 68 k->image->numRows != yMax[i]-yMin[i]+1) { 69 psError( __func__,"Size of the kernel image is wrong (%dx%d vs %dx%d).",69 psError(PS_ERR_UNKNOWN, true,"Size of the kernel image is wrong (%dx%d vs %dx%d).", 70 70 xMax[i]-xMin[i]+1, yMax[i]-yMin[i]+1, 71 71 k->image->numCols, k->image->numRows); … … 75 75 for (psS32 j=yMin[i]; j<yMax[i]; j++) { 76 76 if (k->kernel[j]+xMin[i] != k->image->data.PS_TYPE_KERNEL_DATA[j-yMin[i]]) { 77 psError( __func__,"The kernel pointer was set wrong for row %d.",77 psError(PS_ERR_UNKNOWN, true,"The kernel pointer was set wrong for row %d.", 78 78 j); 79 79 return i*10+4; … … 87 87 k = psKernelAlloc(5, -5, -2, 2); 88 88 if (k == NULL) { 89 psError( __func__,"psKernelAlloc returned NULL for xMin > xMax.");89 psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for xMin > xMax."); 90 90 return i*10+5; 91 91 } 92 92 93 93 if (k->xMin != -5 || k->xMax != 5) { 94 psError( __func__,"psKernelAlloc didn't swap xMin & xMax.");94 psError(PS_ERR_UNKNOWN, true,"psKernelAlloc didn't swap xMin & xMax."); 95 95 return i*10+6; 96 96 } … … 101 101 k = psKernelAlloc(-2, 2, 5, -5); 102 102 if (k == NULL) { 103 psError( __func__,"psKernelAlloc returned NULL for yMin > yMax.");103 psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for yMin > yMax."); 104 104 return i*10+7; 105 105 } 106 106 107 107 if (k->yMin != -5 || k->yMax != 5) { 108 psError( __func__,"psKernelAlloc didn't swap yMin & yMax.");108 psError(PS_ERR_UNKNOWN, true,"psKernelAlloc didn't swap yMin & yMax."); 109 109 return i*10+8; 110 110 } … … 136 136 137 137 if (result == NULL) { 138 psError( __func__,"psKernelGenerate returned NULL.");138 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL."); 139 139 return 1; 140 140 } … … 142 142 if (result->xMin != -1 || result->xMax != 1 || 143 143 result->yMin != -2 || result->yMax != 2) { 144 psError( __func__,"psKernelGenerate result had a range of [%d:%d,%d:%d]. Suppose to be [0:1,1:2].",144 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d]. Suppose to be [0:1,1:2].", 145 145 result->xMin, result->xMax, result->yMin, result->yMax); 146 146 return 2; … … 154 154 } 155 155 if (fabsf(1.0 - sum) > FLT_EPSILON) { 156 psError( __func__,"psKernelGenerate result is not normalized (sum=%g).",156 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result is not normalized (sum=%g).", 157 157 sum); 158 158 … … 166 166 fabsf(result->kernel[-1][ 0] - 2.0/10.0) > FLT_EPSILON || 167 167 fabsf(result->kernel[-2][-1] - 0.0/10.0) > FLT_EPSILON) { 168 psError( __func__,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",168 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.", 169 169 result->kernel[-1][0], result->kernel[1][1], 170 170 result->kernel[2][0], result->kernel[-2][-1]); … … 191 191 192 192 if (result == NULL) { 193 psError( __func__,"psKernelGenerate returned NULL.");193 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL."); 194 194 return 5; 195 195 } … … 197 197 if (result->xMin != 0 || result->xMax != 1 || 198 198 result->yMin != 0 || result->yMax != 3) { 199 psError( __func__,"psKernelGenerate result had a range of [%d:%d,%d:%d]. Suppose to be [0:1,1:2].",199 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d]. Suppose to be [0:1,1:2].", 200 200 result->xMin, result->xMax, result->yMin, result->yMax); 201 201 return 6; … … 209 209 } 210 210 if (fabsf(1.0 - sum) > FLT_EPSILON) { 211 psError( __func__,"psKernelGenerate result is not normalized (sum=%g).",211 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result is not normalized (sum=%g).", 212 212 sum); 213 213 … … 220 220 fabsf(result->kernel[3][1] - 8.0/21.0) > FLT_EPSILON || 221 221 fabsf(result->kernel[2][1] - 10.0/21.0) > FLT_EPSILON) { 222 psError( __func__,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",222 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.", 223 223 result->kernel[1][0], result->kernel[1][1], 224 224 result->kernel[2][0], result->kernel[2][1]); … … 246 246 result = psKernelGenerate(tVec, xVec, yVec, false); 247 247 if (result == NULL) { 248 psError( __func__,"psKernelGenerate returned NULL.");248 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL."); 249 249 return 9; 250 250 } … … 254 254 fabsf(result->kernel[ 1][ 1] - 6.0/8.0) > FLT_EPSILON || 255 255 fabsf(result->kernel[ 0][ 0] - 1.0/8.0) > FLT_EPSILON) { 256 psError( __func__,"psKernelGenerate result values wrong for truncated time vector.");256 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values wrong for truncated time vector."); 257 257 258 258 return 10; … … 264 264 result = psKernelGenerate(NULL, xVec, yVec, true); 265 265 if (result != NULL) { 266 psError( __func__,"psKernelGenerate returned a kernel with no time vector.");266 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no time vector."); 267 267 return 11; 268 268 } … … 271 271 result = psKernelGenerate(tVec, NULL, yVec, true); 272 272 if (result != NULL) { 273 psError( __func__,"psKernelGenerate returned a kernel with no x vector.");273 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no x vector."); 274 274 return 11; 275 275 } … … 278 278 result = psKernelGenerate(tVec, xVec, NULL, true); 279 279 if (result != NULL) { 280 psError( __func__,"psKernelGenerate returned a kernel with no y vector.");280 psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no y vector."); 281 281 return 11; 282 282 } … … 336 336 337 337 if (out == NULL) { 338 psError( __func__, "psImageConvolve returned a NULL for direct gaussian case.");338 psError(PS_ERR_UNKNOWN, true, "psImageConvolve returned a NULL for direct gaussian case."); 339 339 return 1; 340 340 } 341 341 342 342 if (out->numCols != c || out->numRows != r) { 343 psError( __func__, "psImageConvolve result image is %dx%d, but expected %dx%d.",343 psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is %dx%d, but expected %dx%d.", 344 344 out->numCols, out->numRows, 345 345 c,r); … … 350 350 char* typeStr; 351 351 PS_TYPE_NAME(typeStr,out->type.type); 352 psError( __func__, "psImageConvolve result image is of type %s, not psF32.",352 psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is of type %s, not psF32.", 353 353 typeStr); 354 354 return 3; … … 359 359 for (psS32 j=-1;j<1;j++) { 360 360 if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 361 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",361 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 362 362 c/2+j,r/2+i, 363 363 out->data.F32[r/2+i][c/2+j], g->kernel[i][j]); … … 365 365 } 366 366 if (i >= 0 && j >= 0 && fabsf(out->data.F32[i][j] - g->kernel[i][j]) > 0.0001) { 367 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",367 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 368 368 j,i, 369 369 out->data.F32[i][j], g->kernel[i][j]); … … 371 371 } 372 372 if (i <= 0 && fabsf(out->data.F32[r-1+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 373 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",373 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 374 374 c/2+j,r-1+i, 375 375 out->data.F32[r-1+i][c/2+j], g->kernel[i][j]); … … 397 397 398 398 if (out == NULL) { 399 psError( __func__, "psImageConvolve returned a NULL for gaussian case.");399 psError(PS_ERR_UNKNOWN, true, "psImageConvolve returned a NULL for gaussian case."); 400 400 return 10; 401 401 } 402 402 403 403 if (out != out2) { 404 psError( __func__, "psImageConvolve didn't recycle the supplied out image struct.");404 psError(PS_ERR_UNKNOWN, true, "psImageConvolve didn't recycle the supplied out image struct."); 405 405 return 11; 406 406 } 407 407 408 408 if (out->numCols != c || out->numRows != r) { 409 psError( __func__, "psImageConvolve result image is %dx%d, but expected %dx%d.",409 psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is %dx%d, but expected %dx%d.", 410 410 out->numCols, out->numRows, 411 411 c,r); … … 416 416 char* typeStr; 417 417 PS_TYPE_NAME(typeStr,out->type.type); 418 psError( __func__, "psImageConvolve result image is of type %s, not psF32.",418 psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is of type %s, not psF32.", 419 419 typeStr); 420 420 return 13; … … 426 426 for (psS32 j=-1;j<1;j++) { 427 427 if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 428 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",428 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 429 429 c/2+j,r/2+i, 430 430 out->data.F32[r/2+i][c/2+j], g->kernel[i][j]); … … 433 433 } 434 434 if (i >= 0 && j >= 0 && fabsf(out->data.F32[i][j] - g->kernel[i][j]) > 0.0001) { 435 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",435 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 436 436 j,i, 437 437 out->data.F32[i][j], g->kernel[i][j]); … … 439 439 } 440 440 if (i <= 0 && fabsf(out->data.F32[r-1+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 441 psError( __func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.",441 psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d. Value is %g, expected %g.", 442 442 c/2+j,r-1+i, 443 443 out->data.F32[r-1+i][c/2+j], g->kernel[i][j]);
Note:
See TracChangeset
for help on using the changeset viewer.
