Changeset 2815
- Timestamp:
- Dec 23, 2004, 1:57:32 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/tst_pmReadoutCombine.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/tst_pmReadoutCombine.c
r2812 r2815 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-12-23 23: 16:36$7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-23 23:57:32 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 }; 23 23 24 #define OUTPUT_ROWS_BASE 825 #define OUTPUT_COLS_BASE 1626 #define OUTPUT_ROWS_NUM 3227 #define OUTPUT_COLS_NUM 3228 24 #define NUM_READOUTS 10 29 #define OUT_IMAGE_SIZE 1030 25 31 26 int main(int argc, char* argv[]) … … 36 31 int doit() 37 32 { 38 return(0);39 33 int i; 40 int j;41 34 int r; 42 35 psList *list = NULL; … … 84 77 85 78 psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32); 86 for (i=0;i<numRows[r];i++) { 87 for (j=0;j<numCols[r];j++) { 88 tmpImage->data.F32[i][j] = (float) (i + j); 89 tmpImage->data.F32[i][j] = 1.0; 90 tmpImage->data.F32[i][j] = (float) r; 91 } 92 } 79 PS_IMAGE_SET_F32(tmpImage, ((float) r)); 93 80 94 81 *(int *) (& (tmpImage->row0)) = baseRows[r]; … … 113 100 output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0); 114 101 115 for (i=output->row0; i < (output->row0 + output->numRows) ; i++) { 116 for (j=output->col0; j < (output->col0 + output->numCols) ; j++) { 117 printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]); 118 } 119 printf("\n"); 120 } 121 122 psFree(params->stats); 123 psFree(params); 124 psFree(output); 125 psFree(zero); 126 psFree(scale); 127 128 psListElem *tmpInput = (psListElem *) list->head; 129 while (NULL != tmpInput) { 130 psReadout *tmpReadout = (psReadout *) tmpInput->data; 131 psFree(tmpReadout); 132 tmpInput = tmpInput->next; 133 } 134 psFree(list); 135 136 return(0); 137 } 138 139 #define EIGHT 8 140 int quarters() 141 { 142 int i; 143 int j; 144 int r; 145 psList *list = NULL; 146 int baseRowsReadout[EIGHT]; 147 int baseColsReadout[EIGHT]; 148 int baseRows[EIGHT]; 149 int baseCols[EIGHT]; 150 int numRows[EIGHT]; 151 int numCols[EIGHT]; 152 int minOutRow = 10000; 153 int minOutCol = 10000; 154 int maxOutRow = -1; 155 int maxOutCol = -1; 156 psImage *output = NULL; 157 psCombineParams *params = (psCombineParams *) psAlloc(sizeof(psCombineParams)); 158 psVector *zero = psVectorAlloc(EIGHT, PS_TYPE_F32); 159 psVector *scale = psVectorAlloc(EIGHT, PS_TYPE_F32); 160 for (i=0;i<EIGHT;i++) { 161 zero->data.F32[i] = 1.0; 162 } 163 for (i=0;i<EIGHT;i++) { 164 scale->data.F32[i] = 2.0; 165 } 166 167 params->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 168 params->maskVal = 1; 169 params->fracLow = 0.0; 170 params->fracHigh = 10000.0; 171 params->nKeep = 0; 172 173 for (r=0;r<EIGHT;r++) { 174 baseRowsReadout[r] = 0; 175 baseColsReadout[r] = 0; 176 baseRows[r] = 0; 177 baseCols[r] = 0; 178 numRows[r] = 10; 179 numCols[r] = 10; 180 181 psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32); 182 for (i=0;i<numRows[r];i++) { 183 for (j=0;j<numCols[r];j++) { 184 tmpImage->data.F32[i][j] = (float) (i + j); 185 tmpImage->data.F32[i][j] = 1.0; 186 tmpImage->data.F32[i][j] = (float) r; 187 } 188 } 189 190 *(int *) (& (tmpImage->row0)) = baseRows[r]; 191 *(int *) (& (tmpImage->col0)) = baseCols[r]; 192 psReadout *tmpReadout = psReadoutAlloc(baseColsReadout[r], 193 baseRowsReadout[r], 194 tmpImage); 195 minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r])); 196 minOutCol = PS_MIN(minOutCol, (baseColsReadout[r] + baseCols[r])); 197 maxOutRow = PS_MAX(maxOutRow, (baseRowsReadout[r] + baseRows[r] + numRows[r])); 198 maxOutCol = PS_MAX(maxOutCol, (baseColsReadout[r] + baseCols[r] + numCols[r])); 199 200 if (r == 0) { 201 list = psListAlloc(tmpReadout); 202 } else { 203 psListAdd(list, PS_LIST_HEAD, tmpReadout); 204 } 205 } 206 printf("tst_pmReadoutCombine(): (minOutRow, minOutCol) to (maxOutRow, maxOutCol) is (%d, %d) (%d, %d)\n", 207 minOutRow, minOutCol, maxOutRow, maxOutCol); 208 209 output = pmReadoutCombine(output, list, params, zero, scale, true, 1.0, 0.0); 210 211 for (i=output->row0; i < (output->row0 + output->numRows) ; i++) { 212 for (j=output->col0; j < (output->col0 + output->numCols) ; j++) { 102 for (int i=output->row0; i < (output->row0 + output->numRows) ; i++) { 103 for (int j=output->col0; j < (output->col0 + output->numCols) ; j++) { 213 104 printf("%.1f ", output->data.F32[i-output->row0][j-output->col0]); 214 105 } … … 261 152 { 262 153 int i; 263 int j;264 154 int r; 265 155 psList *list = NULL; … … 302 192 303 193 for (r=0;r<NUM_READOUTS;r++) { 304 baseRowsReadout[r] = r + 40;305 baseColsReadout[r] = r + 42;306 baseRows[r] = r;307 baseCols[r] = r+2;308 numRows[r] = 4 + (2 * r);309 numCols[r] = 8 + (2 * r);310 311 194 baseRowsReadout[r] = 0; 312 195 baseColsReadout[r] = 0; … … 317 200 318 201 psImage *tmpImage = psImageAlloc(numCols[r], numRows[r], PS_TYPE_F32); 319 for (i=0;i<numRows[r];i++) { 320 for (j=0;j<numCols[r];j++) { 321 tmpImage->data.F32[i][j] = (float) (i + j); 322 tmpImage->data.F32[i][j] = 1.0; 323 tmpImage->data.F32[i][j] = (float) r; 324 } 325 } 326 202 PS_IMAGE_SET_F32(tmpImage, ((float) r)); 327 203 *(int *) (& (tmpImage->row0)) = baseRows[r]; 328 204 *(int *) (& (tmpImage->col0)) = baseCols[r];
Note:
See TracChangeset
for help on using the changeset viewer.
