IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

Threading the concatenation of inspection lists and pmStackReject.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.