Changeset 12249
- Timestamp:
- Mar 5, 2007, 4:27:09 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/imageops/tap_psImageGeomManip.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tap_psImageGeomManip.c
r11398 r12249 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 1-30 00:13:01$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-03-06 02:27:09 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 16 16 #include "tap.h" 17 17 #include "pstap.h" 18 18 #define VERBOSE 1 19 19 20 20 bool testImageShiftCase(psS32 cols, … … 47 47 for(psS32 row=0;row<rows;row++) { 48 48 psF32 *fRow = fOut->data.F32[row]; 49 for (psS32 col=0;col<cols;col++) { 50 psF32 fValue = psImagePixelInterpolate(fImg,col+0.5-colShift, 51 row+0.5-rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT); 52 if (fabsf(fRow[col] - fValue) > FLT_EPSILON) { 53 if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (flat interpolation)", 54 row,col,fRow[col],fValue); 55 errorFlag = true; 56 } 57 } 58 } 59 60 for(psS32 row=0;row<rows;row++) { 49 61 psS16 *sRow = sOut->data.S16[row]; 62 for (psS32 col=0;col<cols;col++) { 63 psS16 sValue = (psS16)psImagePixelInterpolate(sImg,col+0.5-colShift, 64 row+0.5-rowShift,NULL,0,-1,PS_INTERPOLATE_FLAT); 65 if (sRow[col] != sValue) { 66 if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (flat interpolation)", 67 row,col,sRow[col],sValue); 68 errorFlag = true; 69 } 70 } 71 } 72 73 74 for(psS32 row=0;row<rows;row++) { 50 75 psF32 *fBiRow = fBiOut->data.F32[row]; 76 for (psS32 col=0;col<cols;col++) { 77 psF32 fBiValue = psImagePixelInterpolate(fImg,col+0.5-colShift, 78 row+0.5-rowShift,NULL,0,NAN,PS_INTERPOLATE_BILINEAR); 79 if (fabsf(fBiRow[col] - fBiValue) > FLT_EPSILON) { 80 if (VERBOSE) diag("Float image not shifted correctly at %d,%d (%g vs %g) (bilinear interpolation)", 81 row,col,fBiRow[col],fBiValue); 82 errorFlag = true; 83 } 84 } 85 } 86 87 88 for(psS32 row=0;row<rows;row++) { 51 89 psS16 *sBiRow = sBiOut->data.S16[row]; 52 53 90 for (psS32 col=0;col<cols;col++) { 54 psF32 fValue = psImagePixelInterpolate(fImg,col+colShift, 55 row+rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT); 56 psS16 sValue = (psS16)psImagePixelInterpolate(sImg,col+colShift, 57 row+rowShift,NULL,0,-1,PS_INTERPOLATE_FLAT); 58 59 psF32 fBiValue = psImagePixelInterpolate(fImg,col+colShift, 60 row+rowShift,NULL,0,NAN,PS_INTERPOLATE_BILINEAR); 61 psS16 sBiValue = (psS16)psImagePixelInterpolate(sImg,col+colShift, 62 row+rowShift,NULL,0,-1,PS_INTERPOLATE_BILINEAR); 63 64 if (fabsf(fRow[col] - fValue) > FLT_EPSILON) { 65 diag("Float image not shifted correctly at %d,%d (%g vs %g)", 66 col,row,fRow[col],fValue); 91 psS16 sBiValue = (psS16)psImagePixelInterpolate(sImg,col+0.5-colShift, 92 row+0.5-rowShift,NULL,0,-1,PS_INTERPOLATE_BILINEAR); 93 if (sBiRow[col] != sBiValue) { 94 if (VERBOSE) diag("Short image not shifted correctly at %d,%d (%d vs %d) (bilinear interpolation)", 95 row,col,sBiRow[col],sBiValue); 67 96 errorFlag = true; 68 97 } 69 if (sRow[col] != sValue) { 70 diag("Short image not shifted correctly at %d,%d (%d vs %d)", 71 col,row,sRow[col],sValue); 72 errorFlag = true; 73 } 74 if (fabsf(fBiRow[col] - fBiValue) > FLT_EPSILON) { 75 diag("Float image not shifted correctly at %d,%d (%g vs %g)", 76 col,row,fBiRow[col],fBiValue); 77 errorFlag = true; 78 } 79 if (sBiRow[col] != sBiValue) { 80 diag("Short image not shifted correctly at %d,%d (%d vs %d)", 81 col,row,sBiRow[col],sBiValue); 82 errorFlag = true; 83 } 84 } 98 } 99 } 100 101 if (errorFlag) { 102 diag("Short or Float image not shifted correctly"); 85 103 } 86 104 … … 100 118 psLogSetFormat("HLNM"); 101 119 psLogSetLevel(PS_LOG_INFO); 102 plan_tests( 178);120 plan_tests(226); 103 121 104 122 // testImageRebin() … … 169 187 } \ 170 188 stats.options = PS_STAT_SAMPLE_MEAN; \ 171 ok(false, "XXXX: Skipping test because of a known seg fault"); \ 172 if (0) { \ 189 if (1) { \ 173 190 out = psImageRebin(NULL,in,NULL,0,4,&stats); \ 174 191 ok(out != NULL, "psImageRebin returned non-NULL"); \ … … 190 207 ok(!errorFlag, "psImageRebin() produced the correct data"); \ 191 208 } \ 192 ok(false, "XXXX: Skipping test because of a known seg fault"); \ 193 if (0) { \ 209 if (1) { \ 194 210 stats.options = PS_STAT_SAMPLE_MEAN; \ 195 211 out3 = psImageRebin(NULL,in,mask,1,4,&stats); \ … … 210 226 } \ 211 227 stats.options = PS_STAT_MAX; \ 212 ok(false, "XXXX: Skipping test because of a known seg fault"); \ 213 if (0) { \ 228 if (1) { \ 214 229 out2 = psImageRebin(out,in,NULL,0,3,&stats); \ 215 230 ok(out == out2, "psImageRebin didt recycle a psImage properly"); \ … … 540 555 // the rotation and input psImage to not correspond to the output image. 541 556 542 psImage *fOut = NULL; 557 psS32 rows = 64; 558 psS32 cols = 64; 559 psImage *fOut = psImageAlloc(cols,rows,PS_TYPE_F32); 543 560 psImage *sOut = NULL; 544 psImage *fBiOut = NULL;561 psImage *fBiOut = psImageAlloc(cols,rows,PS_TYPE_F32); 545 562 psImage *sBiOut = NULL; 546 563 psImage *fTruth = NULL; … … 548 565 psImage *fBiTruth = NULL; 549 566 psImage *sBiTruth = NULL; 550 psS32 rows = 64;551 psS32 cols = 64;552 567 psImage *fImg = psImageAlloc(cols,rows,PS_TYPE_F32); 553 568 psImage *sImg = psImageAlloc(cols,rows,PS_TYPE_S16); … … 804 819 // integer shift 805 820 // XXXX: These fail 806 ok(false, "XXXX: Skipping psImageShift() tests because of known failures");807 if ( 0)821 // ok(false, "XXXX: Skipping psImageShift() tests because of known failures"); 822 if (1) 808 823 { 809 824 ok(testImageShiftCase(64,128,0.0f,0.0f), "psImageShift (0, 0)"); 810 ok(testImageShiftCase( 64,128,0.0f,16.0f), "psImageShift (0, 16)");811 ok(testImageShiftCase( 64,128,0.0f,-16.0f), "psImageShift (0, -16)");812 ok(testImageShiftCase( 64,128,32.0f,0.0f), "psImageShift (32, 0)");813 ok(testImageShiftCase( 64,128,-32.0f,0.0f), "psImageShift (-32, 0)");814 ok(testImageShiftCase( 64,128,32.0f,16.0f), "psImageShift (32, 16)");815 ok(testImageShiftCase( 64,128,32.0f,-16.0f), "psImageShift (32, -16)");816 ok(testImageShiftCase( 64,128,-32.0f,16.0f), "psImageShift (-32, 16)");817 ok(testImageShiftCase( 64,128,-32.0f,-16.0f), "psImageShift (-32, -16)");825 ok(testImageShiftCase(4,8,0.0f,2.0f), "psImageShift (0, 16)"); 826 ok(testImageShiftCase(4,8,0.0f,-16.0f), "psImageShift (0, -16)"); 827 ok(testImageShiftCase(4,8,32.0f,0.0f), "psImageShift (32, 0)"); 828 ok(testImageShiftCase(4,8,-32.0f,0.0f), "psImageShift (-32, 0)"); 829 ok(testImageShiftCase(4,8,32.0f,16.0f), "psImageShift (32, 16)"); 830 ok(testImageShiftCase(4,8,32.0f,-16.0f), "psImageShift (32, -16)"); 831 ok(testImageShiftCase(4,8,-32.0f,16.0f), "psImageShift (-32, 16)"); 832 ok(testImageShiftCase(4,8,-32.0f,-16.0f), "psImageShift (-32, -16)"); 818 833 819 834 // fractional shift 820 ok(testImageShiftCase( 64,128,0.0f,16.4f), "psImageShift (0, 16.4)");821 ok(testImageShiftCase( 64,128,0.0f,-16.4f), "psImageShift (0, -16.4)");822 ok(testImageShiftCase( 64,128,32.7f,0.0f), "psImageShift (32.7, 0)");823 ok(testImageShiftCase( 64,128,-32.7f,0.0f), "psImageShift (-32.7, 0)");824 ok(testImageShiftCase( 64,128,32.6f,16.2f), "psImageShift (32.6, 16.2)");825 ok(testImageShiftCase( 64,128,32.6f,-16.2f), "psImageShift (32.6, -16.2)");826 ok(testImageShiftCase( 64,128,-32.6f,16.2f), "psImageShift (-32.6, 16.2)");827 ok(testImageShiftCase( 64,128,-32.6f,-16.2f), "psImageShift (-32.6, -16.2)");835 ok(testImageShiftCase(4,8,0.0f,16.4f), "psImageShift (0, 16.4)"); 836 ok(testImageShiftCase(4,8,0.0f,-16.4f), "psImageShift (0, -16.4)"); 837 ok(testImageShiftCase(4,8,32.7f,0.0f), "psImageShift (32.7, 0)"); 838 ok(testImageShiftCase(4,8,-32.7f,0.0f), "psImageShift (-32.7, 0)"); 839 ok(testImageShiftCase(4,8,32.6f,16.2f), "psImageShift (32.6, 16.2)"); 840 ok(testImageShiftCase(4,8,32.6f,-16.2f), "psImageShift (32.6, -16.2)"); 841 ok(testImageShiftCase(4,8,-32.6f,16.2f), "psImageShift (-32.6, 16.2)"); 842 ok(testImageShiftCase(4,8,-32.6f,-16.2f), "psImageShift (-32.6, -16.2)"); 828 843 } 829 844
Note:
See TracChangeset
for help on using the changeset viewer.
