Changeset 2816
- Timestamp:
- Dec 23, 2004, 2:58:08 PM (22 years ago)
- Location:
- trunk/psModules
- Files:
-
- 2 edited
-
src/pmReadoutCombine.c (modified) (2 diffs)
-
test/tst_pmReadoutCombine.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmReadoutCombine.c
r2814 r2816 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-12-2 3 23:42:25$7 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-24 00:58:08 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 277 277 // XXX: Is this correct? 278 278 // We add the zero vector, if non-NULL. 279 280 279 if (zero != NULL) { 281 280 for (int r = 0; r < numInputs ; r++) { -
trunk/psModules/test/tst_pmReadoutCombine.c
r2815 r2816 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-12-2 3 23:57:32$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-24 00:58:08 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 24 24 #define NUM_READOUTS 10 25 #define INPUT_NUM_ROWS 10 26 #define INPUT_NUM_COLS 10 27 #define VEC_ZERO 1.0 28 #define VEC_SCALE 2.0 29 30 psS32 VerifyTheOutput(psImage *output, psF32 expect) 31 { 32 bool testStatus = true; 33 34 for (psS32 i = 0 ; i < output->numRows ; i++) { 35 for (psS32 j = 0 ; j < output->numCols ; j++) { 36 if (output->data.F32[i][j] != expect) { 37 printf("ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect); 38 testStatus = false; 39 } 40 } 41 } 42 return(testStatus); 43 } 44 45 25 46 26 47 int main(int argc, char* argv[]) … … 49 70 psVector *scale = psVectorAlloc(NUM_READOUTS, PS_TYPE_F32); 50 71 for (i=0;i<NUM_READOUTS;i++) { 51 zero->data.F32[i] = 1.0;72 zero->data.F32[i] = VEC_ZERO; 52 73 } 53 74 for (i=0;i<NUM_READOUTS;i++) { 54 scale->data.F32[i] = 2.0;75 scale->data.F32[i] = VEC_SCALE; 55 76 } 56 77 … … 73 94 baseRows[r] = 0; 74 95 baseCols[r] = 0; 75 numRows[r] = 10;76 numCols[r] = 10;96 numRows[r] = INPUT_NUM_ROWS; 97 numCols[r] = INPUT_NUM_COLS; 77 98 78 99 psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32); 79 100 PS_IMAGE_SET_F32(tmpImage, ((float) r)); 80 81 101 *(int *) (& (tmpImage->row0)) = baseRows[r]; 82 102 *(int *) (& (tmpImage->col0)) = baseCols[r]; … … 99 119 100 120 output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0); 101 102 for (int i=output->row0; i < (output->row0 + output->numRows) ; i++) { 103 for (int j=output->col0; j < (output->col0 + output->numCols) ; j++) { 104 printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]); 105 } 106 printf("\n"); 107 } 121 psF32 NR = (psF32) NUM_READOUTS; 122 psF32 expectedPixel = ((((NR-1.0) * (NR/2.0)) / NR) + VEC_ZERO) * VEC_SCALE; 123 VerifyTheOutput(output, expectedPixel); 108 124 109 125 psFree(params->stats); … … 132 148 return(testStatus); 133 149 } 134 135 psS32 VerifyTheOutput(psImage *output)136 {137 bool testStatus = true;138 139 for (psS32 i = 0 ; i < output->numRows ; i++) {140 for (psS32 j = 0 ; j < output->numCols ; j++) {141 if (output->data.F32[i][j] != 45.0) {142 printf("ERROR: output[%d][%d] is %.2f, should be 45.0\n", i, j, output->data.F32[i][j]);143 testStatus = false;144 }145 }146 }147 return(testStatus);148 }149 150 150 151 151 int test01() … … 196 196 baseRows[r] = 0; 197 197 baseCols[r] = 0; 198 numRows[r] = 10;199 numCols[r] = 10;198 numRows[r] = INPUT_NUM_ROWS; 199 numCols[r] = INPUT_NUM_COLS; 200 200 201 201 psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32); … … 252 252 rc = pmReadoutCombine(output, list, params, zeroBig, scale, true, 1.0, 0.0); 253 253 if (rc != NULL) { 254 if (false == VerifyTheOutput(rc )) {254 if (false == VerifyTheOutput(rc, 45.0)) { 255 255 testStatus = false; 256 256 } … … 292 292 rc = pmReadoutCombine(output, list, params, zero, scaleBig, true, 1.0, 0.0); 293 293 if (rc != NULL) { 294 if (false == VerifyTheOutput(rc )) {294 if (false == VerifyTheOutput(rc, 45.0)) { 295 295 testStatus = false; 296 296 }
Note:
See TracChangeset
for help on using the changeset viewer.
