IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 18, 2010, 12:01:15 PM (16 years ago)
Author:
Paul Price
Message:

Reworking ppStack to not grow the rejected pixels for the unconvolved stack. Also working with convolved and unconvolved stacks separately, so they don't have to be in memory at the same time. This should reduce the memory usage of ppStack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackCombineFinal.c

    r27004 r27319  
    1515
    1616bool ppStackCombineFinal(pmReadout *target, ppStackThreadData *stack, psArray *covariances,
    17                          ppStackOptions *options, pmConfig *config, bool safe, bool normalise)
     17                         ppStackOptions *options, pmConfig *config, bool safe, bool normalise, bool grow)
    1818{
    1919    psAssert(stack, "Require stack");
    2020    psAssert(options, "Require options");
    2121    psAssert(config, "Require configuration");
     22
     23    int numCols = target->image->numCols, numRows = target->image->numRows; // Size of image
     24
     25    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
     26    psAssert(recipe, "We've thrown an error on this before.");
     27    float poorFrac = psMetadataLookupF32(NULL, recipe, "POOR.FRACTION"); // Fraction for "poor"
     28
     29    // Grow the list of rejected pixels, if desired
     30    psArray *reject = psArrayAlloc(options->num); // Pixels rejected for each image
     31    for (int i = 0; i < options->num; i++) {
     32        if (grow) {
     33            reject->data[i] = pmStackRejectGrow(options->rejected->data[i], numCols, numRows, poorFrac,
     34                                                options->regions->data[i], options->kernels->data[i]);
     35            if (!reject->data[i]) {
     36                psError(psErrorCodeLast(), false, "Unable to grow rejected pixels for image %d", i);
     37                psFree(reject);
     38                return false;
     39            }
     40        } else {
     41            reject->data[i] = psMemIncrRefCounter(options->rejected->data[i]);
     42        }
     43    }
    2244
    2345    if (!target->mask) {
     
    3254            // Something went wrong
    3355            psError(psErrorCodeLast(), false, "Unable to read chunk %d", numChunk);
     56            psFree(reject);
    3457            return false;
    3558        }
     
    4366        psArrayAdd(job->args, 1, target);
    4467        psArrayAdd(job->args, 1, thread);
     68        psArrayAdd(job->args, 1, reject);
    4569        psArrayAdd(job->args, 1, options);
    4670        psArrayAdd(job->args, 1, config);
     
    4973        if (!psThreadJobAddPending(job)) {
    5074            psFree(job);
     75            psFree(reject);
    5176            return false;
    5277        }
     
    5681    if (!psThreadPoolWait(true)) {
    5782        psError(psErrorCodeLast(), false, "Unable to do final combination.");
     83        psFree(reject);
    5884        return false;
    5985    }
     86
     87    psFree(reject);
    6088
    6189    // Sum covariance matrices
Note: See TracChangeset for help on using the changeset viewer.