IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42375


Ignore:
Timestamp:
Feb 8, 2023, 11:21:05 AM (3 years ago)
Author:
eugene
Message:

fix indentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/psModules/src/camera/pmFPABin.c

    r42215 r42375  
    3131    psImage *outImage;                  // Output image
    3232    if (out->image && out->image->numCols >= numColsOut && out->image->numRows >= numRowsOut) {
    33         outImage = out->image;
     33        outImage = out->image;
    3434    } else {
    35         outImage = out->image = psImageRecycle(out->image,  numColsOut, numRowsOut, PS_TYPE_F32);
     35        outImage = out->image = psImageRecycle(out->image,  numColsOut, numRowsOut, PS_TYPE_F32);
    3636    }
    3737
    3838    psImage *outMask;                   // Output mask
    3939    if (out->mask && out->mask->numCols >= numColsOut && out->mask->numRows >= numRowsOut) {
    40         outMask = out->mask;
     40        outMask = out->mask;
    4141    } else {
    42         outMask = out->mask = psImageRecycle(out->mask,  numColsOut, numRowsOut, PS_TYPE_IMAGE_MASK);
     42        outMask = out->mask = psImageRecycle(out->mask,  numColsOut, numRowsOut, PS_TYPE_IMAGE_MASK);
    4343    }
    4444
     
    5050    int yStart = psImageBinningGetFineY(binning, 0); // Starting input y for binning
    5151    for (int yOut = 0; yOut < numRowsOut; yOut++) {
    52         int yStop = psImageBinningGetFineY(binning, yOut + 1); // Stopping input y for binning
    53         yStop = PS_MIN(yStop, yLast);
    54         int xStart = psImageBinningGetFineX(binning, 0); // Starting input x for binning
    55         for (int xOut = 0; xOut < numColsOut; xOut++) {
    56             int xStop = psImageBinningGetFineX(binning, xOut + 1); // Stopping input x for binning
    57             xStop = PS_MIN(xStop, xLast);
     52        int yStop = psImageBinningGetFineY(binning, yOut + 1); // Stopping input y for binning
     53        yStop = PS_MIN(yStop, yLast);
     54        int xStart = psImageBinningGetFineX(binning, 0); // Starting input x for binning
     55        for (int xOut = 0; xOut < numColsOut; xOut++) {
     56            int xStop = psImageBinningGetFineX(binning, xOut + 1); // Stopping input x for binning
     57            xStop = PS_MIN(xStop, xLast);
    5858
    59             float sum = 0.0;            // Sum of pixels
    60             int numPix = 0;             // Number of pixels
     59            float sum = 0.0;            // Sum of pixels
     60            int numPix = 0;             // Number of pixels
    6161
    6262            for (int j = 0; j < Nbits; j++) { // Reset bit counter
    63               bitcounter[j] = 0;
     63                bitcounter[j] = 0;
    6464            }
    6565            pxlcount = 0;
    6666           
    67             for (int y = yStart; y < yStop; y++) {
    68                 for (int x = xStart; x < xStop; x++) {
    69                   if (false && inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] != 0)) {
    70                       for (int j = 0; j < Nbits; j++) {
    71                         psImageMaskType M = (psImageMaskType) pow(2,j);
    72                         if (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & M) {
    73                           bitcounter[j]++;
     67            for (int y = yStart; y < yStop; y++) {
     68                for (int x = xStart; x < xStop; x++) {
     69                    if (false && inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] != 0)) {
     70                        for (int j = 0; j < Nbits; j++) {
     71                            psImageMaskType M = (psImageMaskType) pow(2,j);
     72                            if (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & M) {
     73                                bitcounter[j]++;
     74                            }
    7475                        }
    75                       }
    7676                    }
    7777                 
    78                     if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal)) {
    79                         continue;
    80                     }
    81                     if (!isfinite(inImage->data.F32[y][x])) {
    82                         continue;
    83                     }
    84                     sum += inImage->data.F32[y][x];
    85                     numPix++;
     78                    if (inMask && (inMask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal)) {
     79                        continue;
     80                    }
     81                    if (!isfinite(inImage->data.F32[y][x])) {
     82                        continue;
     83                    }
     84                    sum += inImage->data.F32[y][x];
     85                    numPix++;
    8686
    8787
    88                 }
    89             }
     88                }
     89            }
    9090           
    9191            // Values to set
    92             float imageValue;
     92            float imageValue;
    9393            psImageMaskType maskValue;
    94             if (numPix > 0) {
    95                 imageValue = sum / numPix;
    96                 maskValue = 0;
    97             } else {
    98                 imageValue = NAN;
    99                 maskValue = maskVal;
    100             }
    101             outImage->data.F32[yOut][xOut] = imageValue;
     94            if (numPix > 0) {
     95                imageValue = sum / numPix;
     96                maskValue = 0;
     97            } else {
     98                imageValue = NAN;
     99                maskValue = maskVal;
     100            }
     101            outImage->data.F32[yOut][xOut] = imageValue;
    102102            if (true) {
    103               outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
     103                outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
    104104            } else {
    105               outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = 0;
     105                outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = 0;
    106106            }
    107107            // this loop is pointless if pxlcount == 0 (all masked)
    108108            if (false) {
    109               if (pxlcount) {
    110                 for (int j = 0; j < Nbits; j++) {
    111                   if (bitcounter[j] > 0.5 * pxlcount) {
    112                     outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] |= (1 << j);
    113                   }
     109                if (pxlcount) {
     110                    for (int j = 0; j < Nbits; j++) {
     111                        if (bitcounter[j] > 0.5 * pxlcount) {
     112                            outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] |= (1 << j);
     113                        }
     114                    }
     115                } else {
     116                    outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
    114117                }
    115               } else {
    116                 outMask->data.PS_TYPE_IMAGE_MASK_DATA[yOut][xOut] = maskValue;
    117               }
    118118            }
    119119            xStart = xStop;
    120         }
    121         yStart = yStop;
     120        }
     121        yStart = yStop;
    122122    }
    123123
     
    126126    out->data_exists = true;
    127127    if (out->parent) {
    128         pmCell *outCell = out->parent;  // Output cell
    129         outCell->data_exists = outCell->parent->data_exists = true;
     128        pmCell *outCell = out->parent;  // Output cell
     129        outCell->data_exists = outCell->parent->data_exists = true;
    130130
    131         // We would copy the concepts from the input cell, except that is done by pmFPACopy,
    132         // pmChipCopyStructure, etc.  This function just does the mechanics of binning.
    133         // We don't even update the CELL.XBIN, CELL.YBIN because that would apply the correction twice.
     131        // We would copy the concepts from the input cell, except that is done by pmFPACopy,
     132        // pmChipCopyStructure, etc.  This function just does the mechanics of binning.
     133        // We don't even update the CELL.XBIN, CELL.YBIN because that would apply the correction twice.
    134134    }
    135135
Note: See TracChangeset for help on using the changeset viewer.