IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 18, 2017, 11:48:56 AM (9 years ago)
Author:
eugene
Message:

built-in isfinite does not allow non-float arguments : small re-code to handle cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelManip.c

    r34800 r40045  
    216216    }
    217217
     218    // this function is only called for float-type values
    218219#define psImageOverlayLoopClean(DATATYPE,OP) {   \
    219220      for (int row=y0;row<imageRowLimit;row++) {            \
     
    235236    }
    236237
    237 #define psImageOverlayLoopMask(DATATYPE) {                  \
    238       for (int row=y0;row<imageRowLimit;row++) {            \
    239         ps##DATATYPE* imageRow = image->data.DATATYPE[row];        \
    240         ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0]; \
    241         for (int col=x0;col<imageColLimit;col++) {                 \
    242           if (!isfinite(imageRow[col])) {                          \
    243             imageRow[col] = overlayRow[col-x0];            \
    244           }                                                        \
    245           else if (!isfinite(overlayRow[col-x0])) {                \
    246             imageRow[col] = imageRow[col];                         \
    247           }                                                        \
    248           else {                                                   \
    249             imageRow[col] &= overlayRow[col-x0];                   \
    250           }                                                             \
     238#define psImageOverlayLoopCleanInt(DATATYPE,OP) {                       \
     239      for (int row=y0;row<imageRowLimit;row++) {                        \
     240        ps##DATATYPE* imageRow = image->data.DATATYPE[row];             \
     241        ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0];      \
     242        for (int col=x0;col<imageColLimit;col++) {                      \
     243          imageRow[col] = overlayRow[col-x0];                           \
     244        }                                                               \
     245      }                                                                 \
     246      pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0);    \
     247    }
     248
     249    // test for int type (but compiler does not allow int type to go to isfinit)
     250    //  bool isFloatType = ((PS_TYPE_##DATATYPE == PS_TYPE_F32) || (PS_TYPE_##DATATYPE == PS_TYPE_F64));
     251
     252    // this function is only called for int type data, so we cannot test for isfinite
     253#define psImageOverlayLoopMask(DATATYPE) {                              \
     254      for (int row=y0;row<imageRowLimit;row++) {                        \
     255        ps##DATATYPE* imageRow = image->data.DATATYPE[row];             \
     256        ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-y0];      \
     257        for (int col=x0;col<imageColLimit;col++) {                      \
     258          imageRow[col] &= overlayRow[col-x0];                          \
    251259        }                                                               \
    252260      }                                                                 \
     
    328336    } \
    329337    break;
     338
     339    // this function is only called for Int type data
    330340    #define psImageOverlayCaseInt(DATATYPE,BADVALUE) \
    331341case PS_TYPE_##DATATYPE: \
     
    341351        break; \
    342352    case 'E': \
    343       psImageOverlayLoopClean(DATATYPE,=); \
     353      psImageOverlayLoopCleanInt(DATATYPE,=); \
    344354      break;                               \
    345355    case 'M':                              \
Note: See TracChangeset for help on using the changeset viewer.