IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 26, 2009, 8:40:07 PM (18 years ago)
Author:
eugene
Message:

incorporating changes from 16bit mask upgrades (eam_branch_20081230)

Location:
trunk/psLib/src/mathtypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psVector.c

    r20547 r21183  
    1010*  @author Joshua Hoblitt, University of Hawaii
    1111*
    12 *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2008-11-05 11:12:40 $
     12*  @version $Revision: 1.105 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2009-01-27 06:39:38 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    987987}
    988988
    989 // count number of pixels with given mask value
     989// count number of pixels with given mask value.  the comparison is against a U64 type to
     990// allow any int-type of vector.  all signed and unsigned int types are allowed
    990991long psVectorCountPixelMask (psVector *mask,
    991                              psMaskType value)
     992                             psU64 value)
    992993{
    993994    long Npixels = 0;
     
    998999    }
    9991000
    1000     psElemType type;
    1001     type = mask->type.type;
    1002 
    1003     if (type != PS_TYPE_MASK) {
    1004         psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    1005                 "psVector type does not match the specified psMaskType!\n");
    1006         return -1;
    1007     }
    1008 
     1001# define PS_VECTOR_COUNT_PIXEL_MASK(NAME,TYPE) \
     1002    case PS_TYPE_##NAME: \
     1003        for (long i = 0; i < mask->n; i++) { \
     1004            if (mask->data.TYPE[i] & value) { \
     1005                Npixels ++; \
     1006            } \
     1007        } \
     1008        break;
     1009
     1010    psElemType type = mask->type.type;
    10091011    switch (type) {
    1010     case PS_TYPE_U8:
    1011     case PS_TYPE_U16:
    1012         for (long i = 0; i < mask->n; i++) {
    1013             if (mask->data.PS_TYPE_MASK_DATA[i] & value) {
    1014                 Npixels ++;
    1015             }
    1016         }
    1017         break;
    1018     case PS_TYPE_S8:
    1019     case PS_TYPE_S16:
    1020     case PS_TYPE_S32:
    1021     case PS_TYPE_S64:
    1022     case PS_TYPE_U32:
    1023     case PS_TYPE_U64:
    1024     case PS_TYPE_F32:
    1025     case PS_TYPE_F64:
     1012        PS_VECTOR_COUNT_PIXEL_MASK(U8, U8);
     1013        PS_VECTOR_COUNT_PIXEL_MASK(U16,U16);
     1014        PS_VECTOR_COUNT_PIXEL_MASK(U32,U32);
     1015        PS_VECTOR_COUNT_PIXEL_MASK(U64,U64);
     1016        PS_VECTOR_COUNT_PIXEL_MASK(S8, S8);
     1017        PS_VECTOR_COUNT_PIXEL_MASK(S16,S16);
     1018        PS_VECTOR_COUNT_PIXEL_MASK(S32,S32);
     1019        PS_VECTOR_COUNT_PIXEL_MASK(S64,S64);
    10261020    default:
    10271021        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
  • trunk/psLib/src/mathtypes/psVector.h

    r19502 r21183  
    1010 * @author Joshua Hoblitt, University of Hawaii
    1111 *
    12  * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
    13  * @date $Date: 2008-09-12 00:22:48 $
     12 * @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
     13 * @date $Date: 2009-01-27 06:39:38 $
    1414 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1515 */
     
    379379 */
    380380long psVectorCountPixelMask(
    381     psVector *mask,                    ///< input vector to count
    382     psMaskType value                   ///< the mask value to satisfy
     381    psVector *mask,                     ///< input vector to count
     382    psU64 value                         ///< the mask value to satisfy
    383383);
    384384
Note: See TracChangeset for help on using the changeset viewer.