Changeset 19013
- Timestamp:
- Aug 11, 2008, 4:51:20 PM (18 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPA.c
r18830 r19013 282 282 tmpReadout->lastWeightScan = 0; 283 283 284 tmpReadout->forceScan = false; 285 284 286 return(tmpReadout); 285 287 } -
trunk/psModules/src/camera/pmFPA.h
r18843 r19013 6 6 * @author Eugene Magnier, IfA 7 7 * 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-08- 01 03:16:10 $8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-08-12 02:51:20 $ 10 10 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 11 11 */ … … 136 136 int thisWeightScan; ///< start scan for next/current read 137 137 int lastWeightScan; ///< start scan of the last read 138 bool forceScan; ///< Force pmFPARead to obey the above commanded this and last scans. 138 139 } pmReadout; 139 140 -
trunk/psModules/src/camera/pmFPARead.c
r19011 r19013 44 44 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 45 45 46 // Return pointer to appropriate value for tracking scans46 // Get the "thisXXXScan" value in the readout for the appropriate image type 47 47 static int readoutGetThisScan(pmReadout *readout, // Readout of interest 48 48 fpaReadType type // Type of image … … 61 61 } 62 62 63 // Return pointer to appropriate value for tracking scans64 static int readoutSet LastScan(pmReadout *readout, // Readout of interest65 fpaReadType type, // Type of image66 int numScans // requested number of scans63 // Set the "thisXXXScan" value in the readout for the appropriate image type 64 static int readoutSetThisScan(pmReadout *readout, // Readout of interest 65 fpaReadType type, // Type of image 66 int thisScan // Starting scan number 67 67 ) 68 68 { 69 69 switch (type) { 70 70 case FPA_READ_TYPE_IMAGE: 71 readout-> lastImageScan = readout->thisImageScan + numScans;71 readout->thisImageScan = thisScan; 72 72 return readout->lastImageScan; 73 73 case FPA_READ_TYPE_MASK: 74 readout-> lastMaskScan = readout->thisMaskScan + numScans;74 readout->thisMaskScan = thisScan; 75 75 return readout->lastMaskScan; 76 76 case FPA_READ_TYPE_WEIGHT: 77 readout->lastWeightScan = readout->thisWeightScan + numScans; 77 readout->thisWeightScan = thisScan; 78 return readout->lastWeightScan; 79 default: 80 psAbort("Unknown read type: %x\n", type); 81 } 82 return false; 83 } 84 85 // Get the "lastXXXScan" value in the readout for the appropriate image type 86 static int readoutGetLastScan(pmReadout *readout, // Readout of interest 87 fpaReadType type // Type of image 88 ) 89 { 90 switch (type) { 91 case FPA_READ_TYPE_IMAGE: 92 return readout->lastImageScan; 93 case FPA_READ_TYPE_MASK: 94 return readout->lastMaskScan; 95 case FPA_READ_TYPE_WEIGHT: 96 return readout->lastWeightScan; 97 default: 98 psAbort("Unknown read type: %x\n", type); 99 } 100 } 101 102 // Set the "lastXXXScan" value in the readout for the appropriate image type 103 static int readoutSetLastScan(pmReadout *readout, // Readout of interest 104 fpaReadType type, // Type of image 105 int lastScan // Last scan number 106 ) 107 { 108 switch (type) { 109 case FPA_READ_TYPE_IMAGE: 110 readout->lastImageScan = lastScan; 111 return readout->lastImageScan; 112 case FPA_READ_TYPE_MASK: 113 readout->lastMaskScan = lastScan; 114 return readout->lastMaskScan; 115 case FPA_READ_TYPE_WEIGHT: 116 readout->lastWeightScan = lastScan; 78 117 return readout->lastWeightScan; 79 118 default: … … 156 195 } 157 196 158 // Does the current readout, with scans set for a new read, represent any real data, or is it 159 // beyond the end? Requires that cellNumReadouts() has been called before (for header and 160 // concepts to have been read) In the process, adjusts the TRIMSEC 161 static bool readoutHaveMoreScans(bool *result, // true : more data to read 197 // Does the current readout, with scans set for a new read, represent any real data, or is it beyond the end? 198 // Requires that cellNumReadouts() has been called before (for header and concepts to have been read) 199 // In the process, adjusts the TRIMSEC 200 static bool readoutHaveMoreScans(int *start, // Start of scan 201 int *last, // Last possible scan (defined by TRIMSEC) 162 202 pmReadout *readout, // Readout of interest 163 203 int numScans, // Number of scans to read at a time … … 166 206 ) 167 207 { 168 assert(result); 208 assert(start); 209 assert(last); 169 210 assert(readout); 170 171 *result = false;172 211 173 212 if (!pmConceptsReadCell(readout->parent, PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE, … … 213 252 } 214 253 254 *last = (readdir == 1) ? trimsec->y1 : trimsec->x1; // Maximum possible scan number 255 215 256 // Calculate the segment offset and upper limit 216 257 if (numScans == 0) { 217 // in the case of numScans == 0, we never call this funtion unless the data has not yet 218 // been read. thus, only if the delta is should we return false (ie, trimsec defines an empty region) 219 int thisScan = (readdir == 1) ? trimsec->y0 : trimsec->x0; 220 int lastScan = (readdir == 1) ? trimsec->y1 : trimsec->x1; 221 *result = (lastScan > thisScan); 222 return true; 223 } 224 225 // allow multiple threads to read different segments into different readouts 226 // this thread may not have read a segment yet; but others have. trust readout->imageScan 227 228 // is the start scan of the read less than the last possible scan? 229 int thisScan = readoutGetThisScan(readout, type); 230 int lastScan = (readdir == 1) ? trimsec->y1 : trimsec->x1; 231 232 *result = (lastScan > thisScan); 258 // Read entire image. In that case, we never call this funtion unless the data has not yet been read. 259 // thus, only if the delta is should we return false (ie, trimsec defines an empty region) 260 *start = (readdir == 1) ? trimsec->y0 : trimsec->x0; 261 } else if (readout->forceScan) { 262 // We're forced to read what we're told 263 *start = readoutGetThisScan(readout, type); 264 } else { 265 // Progressive scans 266 psImage *image = *readoutImageByType(readout, type); // Appropriate image from readout 267 *start = image ? readoutGetLastScan(readout, type) + numScans : 0; 268 } 269 233 270 return true; 234 // XXX fold this and the above case together235 271 } 236 272 … … 271 307 } 272 308 273 bool haveData;274 if (!readoutHaveMoreScans(& haveData, readout, numScans, type, config)) {309 int start, last; // Start and last scans 310 if (!readoutHaveMoreScans(&start, &last, readout, numScans, type, config)) { 275 311 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 276 312 return false; 277 313 } 278 314 279 return haveData;315 return start < last; 280 316 } 281 317 … … 458 494 } 459 495 460 bool haveData; 461 if (!readoutHaveMoreScans(&haveData, readout, numScans, type, config)) { 496 int thisScan; // Starting scan for this read 497 int maxScan; // Maximum scan number 498 if (!readoutHaveMoreScans(&thisScan, &maxScan, readout, numScans, type, config)) { 462 499 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 463 500 return false; 464 501 } 465 if ( !haveData) {502 if (thisScan >= maxScan) { 466 503 psError(PS_ERR_IO, true, "No more of the readout to read."); 467 504 return false; 468 505 } 469 470 506 471 507 pmHDU *hdu = pmHDUFromCell(cell); // The HDU … … 511 547 } 512 548 513 // Determine the numbe of scans to read 514 int thisScan = readoutGetThisScan(readout, type); 515 int lastScan = readoutSetLastScan (readout, type, numScans); 549 // Determine the number of scans to read 550 int lastScan = readoutSetLastScan(readout, type, thisScan + numScans); 516 551 if (thisScan == 0) { 517 552 overlap = 0; 518 553 } 519 554 thisScan -= overlap; 555 readoutSetThisScan(readout, type, thisScan); 520 556 521 557 // Calculate limits, adjust readout->row0,col0 522 558 // XXX Should row0,col0 be adjusted, since they are used for astrometry??? 523 // Just moved to using the "scansTracker" for tracking position in chunk reads, so row0,col0 not required524 559 if (readdir == 1) { 525 560 // Reading rows
Note:
See TracChangeset
for help on using the changeset viewer.
