Changeset 2812 for trunk/psModules/src/pmReadoutCombine.c
- Timestamp:
- Dec 23, 2004, 1:16:36 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmReadoutCombine.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmReadoutCombine.c
r2810 r2812 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-12-23 2 0:27:51$7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-23 23:16:36 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 psCombineParams; 28 28 29 30 int p_psDetermineNumBits(unsigned int data) 29 /****************************************************************************** 30 p_psDetermineNumBits(data): This routine takes an enum psStatsOptions as an 31 argument and returns the number of non-zero bits. 32 *****************************************************************************/ 33 psStatsOptions p_psDetermineNumBits(psStatsOptions data) 31 34 { 32 inti;33 unsigned inttmpData = data;34 intnumBits = 0;35 36 for (i=0;i< sizeof(unsigned int);i++) {37 if (0x0001 & &tmpData) {35 psS32 i; 36 psU64 tmpData = data; 37 psS32 numBits = 0; 38 39 for (i=0;i<4 * sizeof(psStatsOptions);i++) { 40 if (0x0001 & tmpData) { 38 41 numBits++; 39 42 } … … 43 46 } 44 47 48 // XXX: Whats this? 45 49 #define MAX_INT 10000 46 50 psImage *pmReadoutCombine(psImage *output, … … 55 59 PS_PTR_CHECK_NULL(inputs, NULL); 56 60 PS_PTR_CHECK_NULL(params, NULL); 61 PS_PTR_CHECK_NULL(params->stats, NULL); 62 if (zero != NULL) { 63 PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL); 64 } 65 if (scale != NULL) { 66 PS_VECTOR_CHECK_TYPE(scale, PS_TYPE_F32, NULL); 67 } 68 if ((zero != NULL) && (scale != NULL)) { 69 PS_VECTOR_CHECK_TYPE_EQUAL(zero, scale, NULL); 70 // XXX: Currently only type F32 is implemented. 71 // PS_VECTOR_CHECK_TYPE_S16_S32_F32(scale, NULL); 72 } 73 57 74 psStats *stats = params->stats; 58 75 int i; … … 66 83 int numInputs = 0; 67 84 int tmpI; 85 psElemType outputType = PS_TYPE_F32; 86 87 if (1 < p_psDetermineNumBits(params->stats->options)) { 88 psError(PS_ERR_UNKNOWN, true, 89 "Multiple statistical options have been requested.\n"); 90 return(NULL); 91 } 68 92 69 93 // … … 86 110 PS_READOUT_CHECK_EMPTY(tmpReadout, output); 87 111 PS_READOUT_CHECK_TYPE(tmpReadout, PS_TYPE_F32, output); 112 outputType = tmpReadout->image->type.type; 88 113 89 114 minInputRows = PS_MIN(minInputRows, … … 105 130 106 131 // We ensure that the zero vector is of the proper size. 132 107 133 if (zero != NULL) { 108 134 PS_VECTOR_CHECK_TYPE(zero, PS_TYPE_F32, NULL); 109 135 if (numInputs > zero->n) { 110 // XXX: ERROR: the zero vector does not have enough elements.136 psError(PS_ERR_UNKNOWN, true, "zero vector has incorrect size (%d)\n", zero->n); 111 137 return(NULL); 112 138 } else if (numInputs < zero->n) { 113 // XXX: WARNING: the zero vector too many elements. 139 psLogMsg(__func__, PS_LOG_WARN, 140 "WARNING: the zero vector too many elements (%d)\n", zero->n); 114 141 } 115 142 } … … 119 146 PS_VECTOR_CHECK_TYPE(scale, PS_TYPE_F32, NULL); 120 147 if (numInputs > scale->n) { 121 // XXX: ERROR: the scale vector does not have enough elements.148 psError(PS_ERR_UNKNOWN, true, "scale vector has incorrect size (%d)\n", scale->n); 122 149 return(NULL); 123 150 } else if (numInputs < scale->n) { 124 // XXX: WARNING: the scale vector too many elements. 151 psLogMsg(__func__, PS_LOG_WARN, 152 "WARNING: the scale vector too many elements (%d)\n", scale->n); 125 153 } 126 154 } … … 134 162 if (output == NULL) { 135 163 output = psImageAlloc(maxInputCols-minInputCols, 136 maxInputRows-minInputRows, PS_TYPE_F32);164 maxInputRows-minInputRows, outputType); 137 165 *(int *) &(output->col0) = minInputCols; 138 166 *(int *) &(output->row0) = minInputRows; … … 140 168 if (((output->col0 + output->numCols) < maxInputCols) || 141 169 ((output->row0 + output->numRows) < maxInputRows)) { 142 //XXX ERROR: "Output image (%d, %d) is too small to hold combined images.\n", 143 // output->row0 + output->numRows, 144 // output->col0 + output->numCols); 170 psError(PS_ERR_UNKNOWN, true, 171 "Output image (%d, %d) is too small to hold combined images.\n", 172 output->row0 + output->numRows, 173 output->col0 + output->numCols); 145 174 return(NULL); 146 175 } … … 150 179 return(NULL); 151 180 } 152 }153 154 if (1 < p_psDetermineNumBits(params->stats->options)) {155 //XXX psError(PS_ERR_UNKNOWN,true, "Multiple statistical options have been requested.\n");156 return(NULL);157 181 } 158 182 … … 254 278 // XXX: Is this correct? 255 279 // We add the zero vector, if non-NULL. 280 256 281 if (zero != NULL) { 257 282 for (int r = 0; r < numInputs ; r++) {
Note:
See TracChangeset
for help on using the changeset viewer.
