Index: trunk/psLib/test/image/tst_psImageManip.c
===================================================================
--- trunk/psLib/test/image/tst_psImageManip.c	(revision 2105)
+++ trunk/psLib/test/image/tst_psImageManip.c	(revision 2204)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-14 01:22:59 $
+ *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-27 00:57:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,14 +25,14 @@
 #include "psType.h"
 
-static int testImageClip(void);
-static int testImageClipNAN(void);
-static int testImageClipComplexRegion(void);
-static int testImageOverlay(void);
-static int testImageRebin(void);
-static int testImageRoll(void);
-static int testImageRotate(void);
-static int testImageShift(void);
-static int testImageShiftCase(int cols, int rows, float colShift,float rowShift);
-static int testImageResample(void);
+static psS32 testImageClip(void);
+static psS32 testImageClipNAN(void);
+static psS32 testImageClipComplexRegion(void);
+static psS32 testImageOverlay(void);
+static psS32 testImageRebin(void);
+static psS32 testImageRoll(void);
+static psS32 testImageRotate(void);
+static psS32 testImageShift(void);
+static psS32 testImageShiftCase(psS32 cols, psS32 rows, float colShift,float rowShift);
+static psS32 testImageResample(void);
 
 testDescription tests[] = {
@@ -49,5 +49,5 @@
                           };
 
-int main(int argc, char* argv[])
+psS32 main(psS32 argc, char* argv[])
 {
     psLogSetLevel(PS_LOG_INFO);
@@ -57,13 +57,13 @@
 
 
-int testImageClip(void)
+psS32 testImageClip(void)
 {
     psImage* img = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
+    psU32 c = 128;
+    psU32 r = 256;
     psF64 min;
     psF64 max;
-    int numClipped = 0;
-    int retVal;
+    psS32 numClipped = 0;
+    psS32 retVal;
 
     psLogMsg(__func__,PS_LOG_INFO,
@@ -95,7 +95,7 @@
     #define testImageClipByType(datatype) \
     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned int row=0;row<r;row++) { \
+    for (psU32 row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
+        for (psU32 col=0;col<c;col++) { \
             imgRow[col] = (ps##datatype)(row+col); \
         } \
@@ -107,7 +107,7 @@
     \
     numClipped = 0; \
-    for (unsigned int row=0;row<r;row++) { \
+    for (psU32 row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
+        for (psU32 col=0;col<c;col++) { \
             ps##datatype value = (ps##datatype)(row+col); \
             if (value < min) { \
@@ -134,7 +134,7 @@
     #define testImageClipByComplexType(datatype) \
     img = psImageAlloc(c,r,PS_TYPE_##datatype); \
-    for (unsigned int row=0;row<r;row++) { \
+    for (psU32 row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
+        for (psU32 col=0;col<c;col++) { \
             imgRow[col] = (ps##datatype)(row+I*col); \
         } \
@@ -146,7 +146,7 @@
     \
     numClipped = 0; \
-    for (unsigned int row=0;row<r;row++) { \
+    for (psU32 row=0;row<r;row++) { \
         ps##datatype* imgRow = img->data.datatype[row]; \
-        for (unsigned int col=0;col<c;col++) { \
+        for (psU32 col=0;col<c;col++) { \
             ps##datatype value = row+I*col; \
             if (cabs(value) < min) { \
@@ -225,11 +225,11 @@
 }
 
-int testImageClipNAN(void)
+psS32 testImageClipNAN(void)
 {
     psImage* img = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
-    int numClipped = 0;
-    int retVal;
+    psU32 c = 128;
+    psU32 r = 256;
+    psS32 numClipped = 0;
+    psS32 retVal;
 
     psLogMsg(__func__,PS_LOG_INFO,
@@ -317,11 +317,11 @@
 }
 
-int testImageClipComplexRegion(void)
+psS32 testImageClipComplexRegion(void)
 {
     psImage* img = NULL;
-    unsigned int c = 1024;
-    unsigned int r = 2048;
-    int numClipped = 0;
-    int retVal;
+    psU32 c = 1024;
+    psU32 r = 2048;
+    psS32 numClipped = 0;
+    psS32 retVal;
 
     psLogMsg(__func__,PS_LOG_INFO,
@@ -581,5 +581,5 @@
 }
 
-int testImageOverlay(void)
+psS32 testImageOverlay(void)
 {
 
@@ -588,7 +588,7 @@
     psImage* img3 = NULL;
     psImage* img4 = NULL;
-    unsigned int c = 128;
-    unsigned int r = 256;
-    int retVal;
+    psU32 c = 128;
+    psU32 r = 256;
+    psS32 retVal;
 
     /*
@@ -833,5 +833,5 @@
 }
 
-static int testImageRebin(void)
+static psS32 testImageRebin(void)
 {
 
@@ -869,5 +869,5 @@
     memset(meanTruthWMask->data.F32[0],0,sizeof(psF32)*4*4); \
     memset(maxTruth->data.F32[0],0,sizeof(psF32)*6*6); \
-    for (int row = 0; row<16; row++) { \
+    for (psS32 row = 0; row<16; row++) { \
         ps##DATATYPE* inRow = in->data.DATATYPE[row]; \
         psF32* meanTruthRow = meanTruth->data.F32[row/4]; \
@@ -875,5 +875,5 @@
         psF32* maxTruthRow = maxTruth->data.F32[row/3]; \
         psU8* maskRow = mask->data.U8[row]; \
-        for (int col = 0; col<16; col++) { \
+        for (psS32 col = 0; col<16; col++) { \
             if(col != 15) { \
                 maskRow[col] = 0; \
@@ -891,8 +891,8 @@
         } \
     } \
-    for (int row = 0; row<4; row++) { \
+    for (psS32 row = 0; row<4; row++) { \
         psF32* meanTruthRow = meanTruth->data.F32[row]; \
         psF32* meanTruthWMaskRow = meanTruthWMask->data.F32[row]; \
-        for (int col = 0; col<4; col++) { \
+        for (psS32 col = 0; col<4; col++) { \
             meanTruthRow[col] /= 16; \
             if ( col == 3 ) { \
@@ -915,8 +915,8 @@
         return 2; \
     } \
-    for (int row = 0; row<4; row++) { \
+    for (psS32 row = 0; row<4; row++) { \
         ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
         psF32* truthRow = meanTruth->data.F32[row]; \
-        for (int col = 0; col<4; col++) { \
+        for (psS32 col = 0; col<4; col++) { \
             if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \
                 psError(__func__,"psImageRebin didn't produce the proper mean " \
@@ -929,9 +929,9 @@
     stats.options = PS_STAT_SAMPLE_MEAN; \
     out3 = psImageRebin(NULL,in,mask,1,4,&stats); \
-    for (int row = 0; row<4; row++) { \
+    for (psS32 row = 0; row<4; row++) { \
         ps##DATATYPE* outRow = out3->data.DATATYPE[row]; \
         psF32* truthRow = meanTruthWMask->data.F32[row]; \
-        for ( int col = 0; col<4; col++) { \
-            if(abs((int)outRow[col]-(int)truthRow[col]) > FLT_EPSILON) { \
+        for ( psS32 col = 0; col<4; col++) { \
+            if(abs((psS32)outRow[col]-(psS32)truthRow[col]) > FLT_EPSILON) { \
                 psError(__func__,"psImageRebin with mask didn't produce the proper mean " \
                         "result at (%d,%d) [%f vs %f].", \
@@ -957,8 +957,8 @@
         return 5; \
     } \
-    for (int row = 0; row<6; row++) { \
+    for (psS32 row = 0; row<6; row++) { \
         ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
         psF32* truthRow = maxTruth->data.F32[row]; \
-        for (int col = 0; col<6; col++) { \
+        for (psS32 col = 0; col<6; col++) { \
             if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \
                 psError(__func__,"psImageRebin didn't produce the proper " \
@@ -1082,5 +1082,5 @@
 }
 
-static int testImageRoll(void)
+static psS32 testImageRoll(void)
 {
 
@@ -1088,8 +1088,8 @@
     psImage* out;
     psImage* out2;
-    int rows = 64;
-    int cols = 64;
-    int rows1 = 8;
-    int cols1 = 8;
+    psS32 rows = 64;
+    psS32 cols = 64;
+    psS32 rows1 = 8;
+    psS32 cols1 = 8;
 
     /*
@@ -1108,7 +1108,7 @@
 
     in = psImageAlloc(cols,rows,PS_TYPE_F32);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             inRow[col] = (psF32)row+(psF32)col/1000.0f;
         }
@@ -1116,8 +1116,8 @@
 
     out = psImageRoll(NULL,in,0,0);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[row];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[col] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1130,8 +1130,8 @@
 
     out2 = psImageRoll(out,in,cols/4,0);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[row];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[(col+cols/4) % cols] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1151,8 +1151,8 @@
 
     out = psImageRoll(out,in,0,rows/4);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[(row+rows/4)%rows];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[col] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1165,8 +1165,8 @@
 
     out = psImageRoll(out,in,cols/4,rows/4);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[(row+rows/4)%rows];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[(col+cols/4) % cols] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1179,8 +1179,8 @@
 
     out = psImageRoll(out,in,-cols/4,0);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[row];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[(col+(cols-cols/4)) % cols] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1193,8 +1193,8 @@
 
     out = psImageRoll(out,in,0,-rows/4);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[(row+rows-rows/4)%rows];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[col] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1207,8 +1207,8 @@
 
     out = psImageRoll(out,in,-cols/4,-rows/4);
-    for (int row=0;row<rows;row++) {
+    for (psS32 row=0;row<rows;row++) {
         psF32* inRow = in->data.F32[(row+rows-rows/4)%rows];
         psF32* outRow = out->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             if (inRow[(col+cols-cols/4) % cols] != outRow[col]) {
                 psError(__func__,"psImageRoll didn't produce expected result "
@@ -1236,7 +1236,7 @@
     in = psImageAlloc(rows1,cols1,PS_TYPE_##DATATYPE); \
     \
-    for (int row=0;row<rows1;row++) { \
+    for (psS32 row=0;row<rows1;row++) { \
         ps##DATATYPE* inRow = in->data.DATATYPE[row]; \
-        for (int col=0;col<cols1;col++) { \
+        for (psS32 col=0;col<cols1;col++) { \
             inRow[col] = (ps##DATATYPE)row+(ps##DATATYPE)col; \
         } \
@@ -1244,8 +1244,8 @@
     \
     out = psImageRoll(NULL,in,rows1/4,cols1/4); \
-    for (int row=0;row<rows1;row++) { \
+    for (psS32 row=0;row<rows1;row++) { \
         ps##DATATYPE* inRow = in->data.DATATYPE[(row+rows1/4)%rows1]; \
         ps##DATATYPE* outRow = out->data.DATATYPE[row]; \
-        for (int col=0;col<cols1;col++) { \
+        for (psS32 col=0;col<cols1;col++) { \
             if (inRow[(col+cols1/4)%cols1] != outRow[col]) { \
                 psError(__func__,"psImageRoll didn't produce expected result " \
@@ -1270,5 +1270,5 @@
 }
 
-int testImageRotate(void)
+psS32 testImageRotate(void)
 {
     /*
@@ -1300,15 +1300,15 @@
     psImage* fBiTruth = NULL;
     psImage* sBiTruth = NULL;
-    int rows = 64;
-    int cols = 64;
+    psS32 rows = 64;
+    psS32 cols = 64;
     psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32);
     psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
     psImage* s32Img = psImageAlloc(cols,rows,PS_TYPE_S32);
 
-    for(int row=0;row<rows;row++) {
+    for(psS32 row=0;row<rows;row++) {
         psF32* fRow = fImg->data.F32[row];
         psS16* sRow = sImg->data.S16[row];
         psS32* s32Row = s32Img->data.S32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             fRow[col] = (psF32)(row)+(psF32)(col)/100.0f;
             sRow[col] = row-2*col;
@@ -1336,7 +1336,7 @@
         ("temp/sBiOut.fits");
     ;
-    int index = 0;
-    bool fail = false;
-    for (int rot=-180;rot<=180;rot+=45) {
+    psS32 index = 0;
+    psBool fail = false;
+    for (psS32 rot=-180;rot<=180;rot+=45) {
         psImage* oldOut = fOut;
         psImage* oldBiOut = fBiOut;
@@ -1388,8 +1388,8 @@
                 fail = true;
             } else {
-                for (int row=0;row<fTruth->numRows;row++) {
+                for (psS32 row=0;row<fTruth->numRows;row++) {
                     psF32* truthRow = fTruth->data.F32[row];
                     psF32* outRow = fOut->data.F32[row];
-                    for (int col=0;col<fTruth->numCols;col++) {
+                    for (psS32 col=0;col<fTruth->numCols;col++) {
                         if (fabsf(truthRow[col]-outRow[col]) > 1) {
                             psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d.",
@@ -1409,12 +1409,12 @@
             if (sTruth->numRows != sOut->numRows ||
                     sTruth->numCols != sOut->numCols) {
-                psError(__func__,"Rotated short image size did not match truth "
+                psError(__func__,"Rotated psS16 image size did not match truth "
                         "image for %d deg rotation.",rot);
                 fail = true;
             } else {
-                for (int row=0;row<sTruth->numRows;row++) {
+                for (psS32 row=0;row<sTruth->numRows;row++) {
                     psS16* truthRow = sTruth->data.S16[row];
                     psS16* outRow = sOut->data.S16[row];
-                    for (int col=0;col<sTruth->numCols;col++) {
+                    for (psS32 col=0;col<sTruth->numCols;col++) {
                         if (fabsf(truthRow[col]-outRow[col]) > 1) {
                             psError(__func__,"Short Image mismatch (%d vs %d) "
@@ -1440,8 +1440,8 @@
                 fail = true;
             } else {
-                for (int row=0;row<fBiTruth->numRows;row++) {
+                for (psS32 row=0;row<fBiTruth->numRows;row++) {
                     psF32* truthRow = fBiTruth->data.F32[row];
                     psF32* outRow = fBiOut->data.F32[row];
-                    for (int col=0;col<fBiTruth->numCols;col++) {
+                    for (psS32 col=0;col<fBiTruth->numCols;col++) {
                         if (fabsf(truthRow[col]-outRow[col]) > 1) {
                             psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d. BILINEAR",
@@ -1461,12 +1461,12 @@
             if (sBiTruth->numRows != sBiOut->numRows ||
                     sBiTruth->numCols != sBiOut->numCols) {
-                psError(__func__,"Rotated short image size did not match truth "
+                psError(__func__,"Rotated psS16 image size did not match truth "
                         "image for %d deg rotation. BILINEAR",rot);
                 fail = true;
             } else {
-                for (int row=0;row<sBiTruth->numRows;row++) {
+                for (psS32 row=0;row<sBiTruth->numRows;row++) {
                     psS16* truthRow = sBiTruth->data.S16[row];
                     psS16* outRow = sBiOut->data.S16[row];
-                    for (int col=0;col<sBiTruth->numCols;col++) {
+                    for (psS32 col=0;col<sBiTruth->numCols;col++) {
                         if (fabsf(truthRow[col]-outRow[col]) > 1) {
                             psError(__func__,"Short Image mismatch (%d vs %d) "
@@ -1537,5 +1537,5 @@
 }
 
-static int testImageShift(void)
+static psS32 testImageShift(void)
 {
     /* psImageShift:
@@ -1558,5 +1558,5 @@
     */
 
-    int retVal=0;
+    psS32 retVal=0;
 
     // integer shift
@@ -1627,8 +1627,8 @@
 }
 
-static int testImageShiftCase(int cols,
-                              int rows,
-                              float colShift,
-                              float rowShift)
+static psS32 testImageShiftCase(psS32 cols,
+                                psS32 rows,
+                                float colShift,
+                                float rowShift)
 {
     psImage* fOut = NULL;
@@ -1643,8 +1643,8 @@
     psImage* sBiOut = psImageAlloc(cols,rows,PS_TYPE_S16);
 
-    for(int row=0;row<rows;row++) {
+    for(psS32 row=0;row<rows;row++) {
         psF32* fRow = fImg->data.F32[row];
         psS16* sRow = sImg->data.S16[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             fRow[col] = (psF32)(row)+(psF32)(col)/100.0f;
             sRow[col] = row-2*col;
@@ -1657,5 +1657,5 @@
     sBiOut = psImageShift(sBiOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_BILINEAR);
 
-    for(int row=0;row<rows;row++) {
+    for(psS32 row=0;row<rows;row++) {
         psF32* fRow = fOut->data.F32[row];
         psS16* sRow = sOut->data.S16[row];
@@ -1663,5 +1663,5 @@
         psS16* sBiRow = sBiOut->data.S16[row];
 
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             psF32 fValue = psImagePixelInterpolate(fImg,col+colShift,
                                                    row+rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT);
@@ -1707,17 +1707,17 @@
 }
 
-static int testImageResample(void)
+static psS32 testImageResample(void)
 {
 
-    int rows = 60;
-    int cols = 80;
+    psS32 rows = 60;
+    psS32 cols = 80;
     psImage* result = NULL;
-    int scale = 4;
+    psS32 scale = 4;
     psErr* err;
 
     psImage* image = psImageAlloc(cols,rows,PS_TYPE_F32);
-    for(int row=0;row<rows;row++) {
+    for(psS32 row=0;row<rows;row++) {
         psF32* imageRow = image->data.F32[row];
-        for (int col=0;col<cols;col++) {
+        for (psS32 col=0;col<cols;col++) {
             imageRow[col] = row+2*col;
         }
@@ -1753,6 +1753,6 @@
 
     psF32 truthValue;
-    for(int row=0;row<result->numRows;row++) {
-        for (int col=0;col<result->numCols;col++) {
+    for(psS32 row=0;row<result->numRows;row++) {
+        for (psS32 col=0;col<result->numCols;col++) {
             truthValue = psImagePixelInterpolate(image,
                                                  (float)col/(float)scale,(float)row/(float)scale,
