IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7123


Ignore:
Timestamp:
May 15, 2006, 5:27:13 PM (20 years ago)
Author:
Paul Price
Message:

Reverting to loop method for overlay with images of different types
--- memcpy will only work if the types are the same.

File:
1 edited

Legend:

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

    r7112 r7123  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-05-13 02:35:02 $
     12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-05-16 03:27:13 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    260260    // faster than using a 'for' loop.  Josh Hoblitt says it has an additional advantage that it doesn't blow
    261261    // away the L2 cache.  Of course, if you want to use the result immediately afterwards, perhaps this is
    262     // a drawback?
     262    // a drawback?  We fall back on the loop if we have to change types.
    263263    #define psImageOverlaySetLoop(DATATYPE) { \
    264         int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
    265         for (int row = y0; row < imageRowLimit; row++) { \
    266             ps##DATATYPE *imageRow = image->data.DATATYPE[row]; \
    267             ps##DATATYPE *overlayRow = overlay->data.DATATYPE[row - y0]; \
    268             memcpy(&imageRow[x0], overlayRow, numBytes); \
    269         } \
    270         pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
     264        if (image->type.type == overlay->type.type) { \
     265            int numBytes = (imageColLimit - x0) * sizeof(ps##DATATYPE); \
     266            for (int row = y0; row < imageRowLimit; row++) { \
     267                ps##DATATYPE *imageRow = image->data.DATATYPE[row]; \
     268                ps##DATATYPE *overlayRow = overlay->data.DATATYPE[row - y0]; \
     269                memcpy(&imageRow[x0], overlayRow, numBytes); \
     270            } \
     271            pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
     272        } else { \
     273            psImageOverlayLoop(DATATYPE,=); \
     274        } \
    271275    }
    272276
Note: See TracChangeset for help on using the changeset viewer.