Changeset 18862 for trunk/ppMerge/src/ppMergeLoop_Threaded.c
- Timestamp:
- Aug 1, 2008, 1:59:36 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeLoop_Threaded.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppMerge/src/ppMergeLoop_Threaded.c
r18839 r18862 11 11 12 12 #include "ppMerge.h" 13 14 // XXX this function is now sufficiently different for the major types, it would make sense to just 15 // split it into three: BASIC, SHUTTER, DARK 13 16 14 17 bool ppMergeLoop(pmConfig *config) … … 145 148 146 149 float shutterRef = NAN; // Reference shutter correction 150 pmReadout *pattern = NULL; 147 151 if (type == PPMERGE_TYPE_SHUTTER) { 148 152 shutterRef = pmShutterCorrectionReference(shutters->data[cellNum]); 153 pattern = pmReadoutAlloc(NULL); 149 154 } 150 155 … … 159 164 } 160 165 166 ppMergeFileGroup *fileGroup = NULL; 161 167 psArray *fileGroups = psArrayAlloc (nThreads + 1); 162 168 … … 170 176 } 171 177 172 ppMergeFileGroup *fileGroup = ppMergeFileGroupAlloc();178 fileGroup = ppMergeFileGroupAlloc(); 173 179 fileGroup->readouts = readouts; 174 180 fileGroup->read = false; … … 185 191 case PPMERGE_TYPE_FRINGE: 186 192 psAssert (fileGroups->n > 0, "no valid file groups defined"); 187 ppMergeFileGroup *fileGroup = fileGroups->data[0];193 fileGroup = fileGroups->data[0]; 188 194 if (!pmReadoutCombinePrepare(outRO, fileGroup->readouts, combination)) { 189 195 goto ERROR; 190 196 } 191 197 break; 192 198 case PPMERGE_TYPE_DARK: 199 psAssert (fileGroups->n > 0, "no valid file groups defined"); 200 fileGroup = fileGroups->data[0]; 201 if (!pmDarkCombinePrepare(outCell, fileGroup->readouts, darkOrdinates, darkNorm)) { 202 goto ERROR; 203 } 204 break; 205 case PPMERGE_TYPE_SHUTTER: 206 psAssert (fileGroups->n > 0, "no valid file groups defined"); 207 fileGroup = fileGroups->data[0]; 208 if (!pmShutterCorrectionGeneratePrepare(outRO, pattern, fileGroup->readouts, maskVal)) { 209 goto ERROR; 210 } 211 break; 193 212 default: 194 213 fprintf (stderr, "not yet ready"); … … 197 216 198 217 // Read input data by chunks 199 //psTimerStart ("ppMergeLoop");218 psTimerStart ("ppMergeLoop"); 200 219 for (int numChunk = 0; true; numChunk++) { 201 220 202 221 bool status = false; 203 ppMergeFileGroup *fileGroup = ppMergeReadChunk (&status, fileGroups, config, numChunk);222 fileGroup = ppMergeReadChunk (&status, fileGroups, config, numChunk); 204 223 if (!status) goto ERROR; 205 224 if (!fileGroup) break; … … 208 227 209 228 switch (type) { 210 case PPMERGE_TYPE_SHUTTER: 229 case PPMERGE_TYPE_BIAS: 230 case PPMERGE_TYPE_FLAT: 231 case PPMERGE_TYPE_FRINGE: 211 232 // allocate a job 212 job = psThreadJobAlloc ("PPMERGE_ SHUTTER_CORRECTION");233 job = psThreadJobAlloc ("PPMERGE_READOUT_COMBINE"); 213 234 214 235 // construct the arguments for this job 215 236 psArrayAdd (job->args, 1, outRO); 216 237 psArrayAdd (job->args, 1, fileGroup); 217 psArrayAdd (job->args, 1, psScalarAlloc(shutterRef, PS_TYPE_F32)); 218 psArrayAdd (job->args, 1, shutters->data[cellNum]); 219 psArrayAdd (job->args, 1, psScalarAlloc(iter, PS_TYPE_S32)); 220 psArrayAdd (job->args, 1, psScalarAlloc(rej, PS_TYPE_F32)); 221 psArrayAdd (job->args, 1, psScalarAlloc(maskVal, PS_TYPE_U8)); 222 223 // call: pmShutterCorrectionGenerate(outRO, NULL, fileGroup->readouts, shutterRef, shutters->data[cellNum], iter, rej, maskVal) 238 psArrayAdd (job->args, 1, zeros); 239 psArrayAdd (job->args, 1, scales); 240 psArrayAdd (job->args, 1, combination); 241 242 // call: pmReadoutCombine(outRO, fileGroup->readouts, zeros, scales, combination); 224 243 if (!psThreadJobAddPending (job)) { 225 244 goto ERROR; … … 233 252 psArrayAdd (job->args, 1, outCell); 234 253 psArrayAdd (job->args, 1, fileGroup); 235 psArrayAdd (job->args, 1, darkOrdinates);236 psArrayAdd (job->args, 1, darkNorm);237 254 psArrayAdd (job->args, 1, psScalarAlloc(iter, PS_TYPE_S32)); 238 255 psArrayAdd (job->args, 1, psScalarAlloc(rej, PS_TYPE_F32)); 239 256 psArrayAdd (job->args, 1, psScalarAlloc(maskVal, PS_TYPE_U8)); 240 257 241 // call: pmDarkCombine(outCell, fileGroup->readouts, darkOrdinates, darkNorm,iter, rej, maskVal);258 // call: pmDarkCombine(outCell, fileGroup->readouts, iter, rej, maskVal); 242 259 if (!psThreadJobAddPending (job)) { 243 260 goto ERROR; 244 261 } 245 262 break; 246 case PPMERGE_TYPE_BIAS: 247 case PPMERGE_TYPE_FLAT: 248 case PPMERGE_TYPE_FRINGE: 263 case PPMERGE_TYPE_SHUTTER: 249 264 // allocate a job 250 job = psThreadJobAlloc ("PPMERGE_ READOUT_COMBINE");265 job = psThreadJobAlloc ("PPMERGE_SHUTTER_CORRECTION"); 251 266 252 267 // construct the arguments for this job 253 268 psArrayAdd (job->args, 1, outRO); 269 psArrayAdd (job->args, 1, pattern); 254 270 psArrayAdd (job->args, 1, fileGroup); 255 psArrayAdd (job->args, 1, zeros); 256 psArrayAdd (job->args, 1, scales); 257 psArrayAdd (job->args, 1, combination); 258 259 // call: pmReadoutCombine(outRO, fileGroup->readouts, zeros, scales, combination); 271 psArrayAdd (job->args, 1, psScalarAlloc(shutterRef, PS_TYPE_F32)); 272 psArrayAdd (job->args, 1, shutters->data[cellNum]); 273 psArrayAdd (job->args, 1, psScalarAlloc(iter, PS_TYPE_S32)); 274 psArrayAdd (job->args, 1, psScalarAlloc(rej, PS_TYPE_F32)); 275 psArrayAdd (job->args, 1, psScalarAlloc(maskVal, PS_TYPE_U8)); 276 277 // call: pmShutterCorrectionGenerate(outRO, pattern, fileGroup->readouts, shutterRef, shutters->data[cellNum], iter, rej, maskVal) 260 278 if (!psThreadJobAddPending (job)) { 261 279 goto ERROR; … … 281 299 psFree(fileGroups); 282 300 301 // XXX eventually need to keep both the shutter and the pattern, as we do with dark 302 psFree(pattern); 303 283 304 // Get list of cells for concepts averaging 284 305 psList *inCells = psListAlloc(NULL); // List of cells … … 295 316 } 296 317 psFree(inCells); 297 //fprintf (stdout, "done ppMergeLoop for cell : %f\n", psTimerMark ("ppMergeLoop"));318 fprintf (stdout, "done ppMergeLoop for cell : %f\n", psTimerMark ("ppMergeLoop")); 298 319 299 320 // Plug supplementary images into their own FPAs
Note:
See TracChangeset
for help on using the changeset viewer.
