IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7112


Ignore:
Timestamp:
May 12, 2006, 4:35:02 PM (20 years ago)
Author:
Paul Price
Message:

Adding optimisation for psImageOverlaySection. When using the '='
operation, we can potentially speed things up using memcpy.

File:
1 edited

Legend:

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

    r6227 r7112  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-01-28 01:12:11 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-05-13 02:35:02 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    253253                imageRow[col] OP overlayRow[col-x0]; \
    254254            } \
     255        } \
     256        pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
     257    }
     258
     259    // Use memcpy to perform the '=' operation.  Depending on the particular application, it can be about 20%
     260    // faster than using a 'for' loop.  Josh Hoblitt says it has an additional advantage that it doesn't blow
     261    // away the L2 cache.  Of course, if you want to use the result immediately afterwards, perhaps this is
     262    // a drawback?
     263    #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); \
    255269        } \
    256270        pixelsOverlaid += (imageRowLimit - y0) * (imageColLimit - x0); \
     
    273287        break; \
    274288    case '=': \
    275         psImageOverlayLoop(DATATYPE,=); \
     289        psImageOverlaySetLoop(DATATYPE); \
    276290        break; \
    277291    default: \
Note: See TracChangeset for help on using the changeset viewer.