IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34453


Ignore:
Timestamp:
Sep 20, 2012, 2:45:21 PM (14 years ago)
Author:
watersc1
Message:

Define new overlay loop method that allows NAN values to be filtered
out correctly. This is likely slower than the memcpy method that was
already defined, but that doesn't do what is needed in ppSkycell
anymore.

I chose the "E" operator as the switch value as an alternative to "=".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/psLib/src/imageops/psImagePixelManip.c

    r34449 r34453  
    216216    }
    217217
    218 
     218#define psImageOverlayLoopClean(DATATYPE,OP) {   \
     219      for (int row=y0;row<imageRowLimit;row++) {            \
     220        ps##DATATYPE* imageRow = image->data.DATATYPE[row];        \
     221        ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0]; \
     222        for (int col=x0;col<imageColLimit;col++) {                 \
     223          if (!isfinite(imageRow[col])) {                          \
     224            imageRow[col] OP overlayRow[col-x0];                   \
     225          }                                                        \
     226          else if (!isfinite(overlayRow[col-x0])) {                \
     227            imageRow[col] = imageRow[col];                         \
     228          }                                                        \
     229          else {                                                   \
     230            imageRow[col] = overlayRow[col-x0];                    \
     231          }                                                             \
     232        }                                                               \
     233      }                                                                 \
     234      pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0);    \
     235    }
     236       
     237   
     238   
    219239    #define psImageOverlayLoop(DATATYPE,OP) { \
    220240        for (int row=y0;row<imageRowLimit;row++) { \
    221241            ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \
    222242            ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0]; \
    223             for (int col=x0;col<imageColLimit;col++) { \
    224               if (isfinite(overlayRow[col - x0])) { \
    225                 imageRow[col] OP overlayRow[col-x0]; \
    226               } \
    227             } \
    228         } \
     243            for (int col=x0;col<imageColLimit;col++) {                 \
     244                imageRow[col] OP overlayRow[col-x0];                   \
     245              }                                                        \
     246        }                                                              \
    229247        pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
    230     }
     248      }
    231249
    232250    #define psImageOverlayLoopDivide(DATATYPE,BADVALUE) { \
     
    250268    // a drawback?  We fall back on the loop if we have to change types.
    251269    #define psImageOverlaySetLoop(DATATYPE) { \
    252       if (0) { \
     270        if (image->type.type == overlay->type.type) { \
    253271            int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
    254272            for (int row = y0; row < imageRowLimit; row++) { \
     
    275293        psImageOverlayLoop(DATATYPE,*=); \
    276294        break; \
     295    case 'E': \
     296      psImageOverlayLoopClean(DATATYPE,=); \
     297      break;                           \
    277298    case '/': \
    278299        psImageOverlayLoopDivide(DATATYPE,BADVALUE); \
Note: See TracChangeset for help on using the changeset viewer.