Changeset 19346
- Timestamp:
- Sep 3, 2008, 12:22:54 PM (18 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 4 edited
-
ppStack.h (modified) (1 diff)
-
ppStackLoop.c (modified) (6 diffs)
-
ppStackReadout.c (modified) (1 diff)
-
ppStackThread.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStack.h
r19337 r19346 96 96 ); 97 97 98 // Concatenate inspection lists for each input image 99 bool ppStackInspect(psThreadJob *job // Job to process 100 ); 101 98 102 // Perform stacking on a readout 99 103 bool ppStackReadoutFinal(const pmConfig *config, // Configuration -
trunk/ppStack/src/ppStackLoop.c
r19337 r19346 477 477 pmReadout *outRO = NULL; // Output readout 478 478 pmFPAview *view = NULL; // View to readout 479 psArray *inspect = NULL; // Array of arrays of pixels to inspect 479 480 { 480 481 int row0, col0; // Offset for readout … … 518 519 519 520 bool status; // Status of read 520 for (int numChunk = 0; true; numChunk++) { 521 int numChunk; // Number of chunks 522 for (numChunk = 0; true; numChunk++) { 521 523 ppStackThread *thread = ppStackThreadRead(&status, stack, config, numChunk, overlap); 522 524 if (!status) { … … 567 569 } 568 570 571 // Harvest the jobs, gathering the inspection lists 572 inspect = psArrayAlloc(num); 573 for (int i = 0; i < num; i++) { 574 if (inputMask->data.U8[i]) { 575 continue; 576 } 577 inspect->data[i] = psArrayAllocEmpty(numChunk); 578 } 579 psThreadJob *job; // Completed job 580 while ((job = psThreadJobGetDone())) { 581 psArray *results = job->results; // Results of job 582 for (int i = 0; i < num; i++) { 583 if (inputMask->data.U8[i]) { 584 continue; 585 } 586 inspect->data[i] = psArrayAdd(inspect->data[i], 1, results->data[i]); 587 } 588 psFree(job); 589 } 590 569 591 memDump("initial"); 570 592 } … … 573 595 psArray *rejected = psArrayAlloc(num); 574 596 { 575 psArray *inspect = psArrayAlloc(num); // Pixels to inspect576 597 int numRejected = 0; // Number of inputs rejected completely 577 598 … … 581 602 numRejected++; 582 603 } 583 inspect->data[i] = psPixelsAllocEmpty(PIXELS_BUFFER);584 }585 586 // Harvest the jobs, combining the inspection lists587 psThreadJob *job; // Completed job588 while ((job = psThreadJobGetDone())) {589 psArray *results = job->results; // Results of job590 psAssert(results && results->n == num, "Results array.");591 for (int i = 0; i < num; i++) {592 if (inputMask->data.U8[i]) {593 continue;594 }595 inspect->data[i] = psPixelsConcatenate(inspect->data[i], results->data[i]);596 }597 psFree(job);598 604 } 599 605 … … 602 608 continue; 603 609 } 610 611 psThreadJob *job = psThreadJobAlloc("PPSTACK_INSPECT"); // Job to start 612 psArrayAdd(job->args, 1, inspect); 613 PS_ARRAY_ADD_SCALAR(job->args, i, PS_TYPE_S32); 614 if (!psThreadJobAddPending(job)) { 615 psFree(job); 616 psFree(subKernels); 617 psFree(subRegions); 618 psFree(stack); 619 psFree(inputMask); 620 psFree(view); 621 psFree(outRO); 622 psFree(inspect); 623 psFree(rejected); 624 return false; 625 } 626 psFree(job); 627 } 628 629 if (!psThreadPoolWait(false)) { 630 psError(PS_ERR_UNKNOWN, false, "Unable to concatenate inspection lists."); 631 psFree(subKernels); 632 psFree(subRegions); 633 psFree(stack); 634 psFree(inputMask); 635 psFree(view); 636 psFree(outRO); 637 psFree(inspect); 638 psFree(rejected); 639 return false; 640 } 641 642 if (psMetadataLookupS32(NULL, config->arguments, "-threads") > 0) { 643 pmStackRejectThreadsInit(); 644 } 645 646 // Reject bad pixels 647 for (int i = 0; i < num; i++) { 604 648 605 649 #ifdef TESTING -
trunk/ppStack/src/ppStackReadout.c
r19337 r19346 46 46 47 47 return status; 48 } 49 50 51 bool ppStackInspect(psThreadJob *job) 52 { 53 PS_ASSERT_THREAD_JOB_NON_NULL(job, false); 54 55 psArray *args = job->args; // Input arguments 56 psArray *inspect = args->data[0]; // Array of pixel arrays 57 int index = PS_SCALAR_VALUE(args->data[1], S32); // Index of interest 58 59 psArray *inputs = inspect->data[index]; // Array of interest 60 psPixels *output = NULL; // Output pixel list 61 for (int i = 0; i < inputs->n; i++) { 62 psPixels *input = inputs->data[i]; // Input pixel list 63 if (!input || input->n == 0) { 64 continue; 65 } 66 output = psPixelsConcatenate(output, input); 67 } 68 69 psFree(inputs); 70 inspect->data[index] = output; 71 72 return true; 48 73 } 49 74 -
trunk/ppStack/src/ppStackThread.c
r19337 r19346 242 242 243 243 { 244 psThreadTask *task = psThreadTaskAlloc("PPSTACK_INSPECT", 2); 245 task->function = &ppStackInspect; 246 psThreadTaskAdd(task); 247 psFree(task); 248 } 249 250 { 244 251 psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 4); 245 252 task->function = &ppStackReadoutFinalThread;
Note:
See TracChangeset
for help on using the changeset viewer.
