IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19346


Ignore:
Timestamp:
Sep 3, 2008, 12:22:54 PM (18 years ago)
Author:
Paul Price
Message:

Threading the concatenation of inspection lists and pmStackReject.

Location:
trunk/ppStack/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStack.h

    r19337 r19346  
    9696    );
    9797
     98// Concatenate inspection lists for each input image
     99bool ppStackInspect(psThreadJob *job    // Job to process
     100    );
     101
    98102// Perform stacking on a readout
    99103bool ppStackReadoutFinal(const pmConfig *config,   // Configuration
  • trunk/ppStack/src/ppStackLoop.c

    r19337 r19346  
    477477    pmReadout *outRO = NULL;            // Output readout
    478478    pmFPAview *view = NULL;             // View to readout
     479    psArray *inspect = NULL;            // Array of arrays of pixels to inspect
    479480    {
    480481        int row0, col0;                 // Offset for readout
     
    518519
    519520        bool status;                    // Status of read
    520         for (int numChunk = 0; true; numChunk++) {
     521        int numChunk;                   // Number of chunks
     522        for (numChunk = 0; true; numChunk++) {
    521523            ppStackThread *thread = ppStackThreadRead(&status, stack, config, numChunk, overlap);
    522524            if (!status) {
     
    567569        }
    568570
     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
    569591        memDump("initial");
    570592    }
     
    573595    psArray *rejected = psArrayAlloc(num);
    574596    {
    575         psArray *inspect = psArrayAlloc(num); // Pixels to inspect
    576597        int numRejected = 0;        // Number of inputs rejected completely
    577598
     
    581602                numRejected++;
    582603            }
    583             inspect->data[i] = psPixelsAllocEmpty(PIXELS_BUFFER);
    584         }
    585 
    586         // Harvest the jobs, combining the inspection lists
    587         psThreadJob *job;           // Completed job
    588         while ((job = psThreadJobGetDone())) {
    589             psArray *results = job->results; // Results of job
    590             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);
    598604        }
    599605
     
    602608                continue;
    603609            }
     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++) {
    604648
    605649#ifdef TESTING
  • trunk/ppStack/src/ppStackReadout.c

    r19337 r19346  
    4646
    4747    return status;
     48}
     49
     50
     51bool 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;
    4873}
    4974
  • trunk/ppStack/src/ppStackThread.c

    r19337 r19346  
    242242
    243243    {
     244        psThreadTask *task = psThreadTaskAlloc("PPSTACK_INSPECT", 2);
     245        task->function = &ppStackInspect;
     246        psThreadTaskAdd(task);
     247        psFree(task);
     248    }
     249
     250    {
    244251        psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 4);
    245252        task->function = &ppStackReadoutFinalThread;
Note: See TracChangeset for help on using the changeset viewer.