Changeset 21183 for trunk/psLib/src/mathtypes
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (18 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 2 edited
-
psVector.c (modified) (3 diffs)
-
psVector.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psVector.c
r20547 r21183 10 10 * @author Joshua Hoblitt, University of Hawaii 11 11 * 12 * @version $Revision: 1.10 4$ $Name: not supported by cvs2svn $13 * @date $Date: 200 8-11-05 11:12:40$12 * @version $Revision: 1.105 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2009-01-27 06:39:38 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 987 987 } 988 988 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 990 991 long psVectorCountPixelMask (psVector *mask, 991 ps MaskTypevalue)992 psU64 value) 992 993 { 993 994 long Npixels = 0; … … 998 999 } 999 1000 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; 1009 1011 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); 1026 1020 default: 1027 1021 psError(PS_ERR_BAD_PARAMETER_TYPE, true, -
trunk/psLib/src/mathtypes/psVector.h
r19502 r21183 10 10 * @author Joshua Hoblitt, University of Hawaii 11 11 * 12 * @version $Revision: 1.7 3$ $Name: not supported by cvs2svn $13 * @date $Date: 200 8-09-12 00:22:48 $12 * @version $Revision: 1.74 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2009-01-27 06:39:38 $ 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 15 15 */ … … 379 379 */ 380 380 long psVectorCountPixelMask( 381 psVector *mask, ///< input vector to count382 ps MaskType value///< the mask value to satisfy381 psVector *mask, ///< input vector to count 382 psU64 value ///< the mask value to satisfy 383 383 ); 384 384
Note:
See TracChangeset
for help on using the changeset viewer.
