Changeset 20306 for trunk/psLib/test/imageops/tap_psImageInterpolate2.c
- Timestamp:
- Oct 21, 2008, 4:10:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tap_psImageInterpolate2.c
r19129 r20306 79 79 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 12345); 80 80 81 psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(mode, image, 82 variance, mask, 0, NAN, NAN, 83 0, 0, 0.0); 81 psImageInterpolation *interp = psImageInterpolationAlloc(mode, image, variance, mask, 0, NAN, NAN, 82 0, 0, 0.0, 0); 84 83 ok(interp, "Interpolation options set"); 85 84 skip_start(!interp, 2 * num, "Interpolation options failed"); … … 93 92 psMaskType maskVal; 94 93 95 psImageInterpolateStatus status = psImageInterpolate(&imageVal, &varianceVal, &maskVal, x, y, interp); 96 ok(status != PS_INTERPOLATE_STATUS_ERROR, "Interpolation at %.2f,%.2f (%x)", x, y, status); 97 skip_start(status == PS_INTERPOLATE_STATUS_ERROR, 1, "Interpolation failed"); 94 psImageInterpolateStatus interpOK = psImageInterpolate(&imageVal, &varianceVal, &maskVal, 95 x, y, interp); 96 ok(interpOK != PS_INTERPOLATE_STATUS_ERROR, "Interpolation at %.2f,%.2f (%x)", x, y, interpOK); 97 skip_start(interpOK == PS_INTERPOLATE_STATUS_ERROR, 1, "Interpolation failed"); 98 98 99 int xCentral, yCentral; // Central pixel of interpolation 100 switch (mode) { 101 case PS_INTERPOLATE_BICUBE: 102 case PS_INTERPOLATE_GAUSS: 103 xCentral = x; 104 yCentral = y; 105 break; 106 default: 107 xCentral = floor(x - 0.5); 108 yCentral = floor(y - 0.5); 109 break; 110 } 99 int xCentral = x - 0.5, yCentral = y - 0.5; // Central pixel of interpolation 111 100 112 101 if (xCentral - (xKernel - 1) / 2 < 0 || xCentral + xKernel / 2 > xSize - 1 || 113 102 yCentral - (yKernel - 1) / 2 < 0 || yCentral + yKernel / 2 > ySize - 1) { 114 ok(status == PS_INTERPOLATE_STATUS_BAD || status == PS_INTERPOLATE_STATUS_POOR, 115 "Interpolation at border"); 103 ok(interpOK == PS_INTERPOLATE_STATUS_OFF || interpOK == PS_INTERPOLATE_STATUS_BAD || 104 interpOK == PS_INTERPOLATE_STATUS_POOR, 105 "Interpolation at %.2f,%.2f (border): %x", x, y, interpOK); 116 106 } else { 117 is_double_tol(imageVal, imageFunc(x, y), tol, "Interpolation = %f vs %f ",118 imageVal, imageFunc(x, y) );107 is_double_tol(imageVal, imageFunc(x, y), tol, "Interpolation = %f vs %f (%d)", 108 imageVal, imageFunc(x, y), interpOK); 119 109 } 120 110 … … 146 136 check(16, 16, PS_TYPE_F64, 32, PS_INTERPOLATE_BILINEAR, 2, 2, 1.0e-6); // 66 tests 147 137 148 check(16, 16, PS_TYPE_F32, 32, PS_INTERPOLATE_BI CUBE, 3, 3, 1.0e-6); // 66 tests149 check(16, 16, PS_TYPE_F64, 32, PS_INTERPOLATE_BI CUBE, 3, 3, 1.0e-6); // 66 tests138 check(16, 16, PS_TYPE_F32, 32, PS_INTERPOLATE_BIQUADRATIC, 3, 3, 1.0e-6); // 66 tests 139 check(16, 16, PS_TYPE_F64, 32, PS_INTERPOLATE_BIQUADRATIC, 3, 3, 1.0e-6); // 66 tests 150 140 151 141 check(16, 16, PS_TYPE_F32, 32, PS_INTERPOLATE_GAUSS, 3, 3, 1.0e-3); // 66 tests
Note:
See TracChangeset
for help on using the changeset viewer.
