Changeset 5572
- Timestamp:
- Nov 22, 2005, 9:58:20 AM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
src/mathtypes/psImage.c (modified) (3 diffs)
-
test/mathtypes/verified/tst_psImage.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r5216 r5572 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 89$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 0-01 02:22:12$11 * @version $Revision: 1.90 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-22 19:58:16 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 220 220 221 221 va_list argp; 222 psU8 vU8;223 psF32 vF32;224 psF64 vF64;225 int temp;226 222 227 223 if (image == NULL) … … 231 227 232 228 switch (image->type.type) { 233 case PS_TYPE_U8: 234 temp = va_arg (argp, psU32); 235 if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 ) 236 vU8 = temp; 237 else { 238 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: U8 Value out of Range.\n"); 239 return false; 229 #define IMAGEINIT_INTCASE(TTT,NATIVETYPE) \ 230 case PS_TYPE_##TTT: { \ 231 NATIVETYPE temp = va_arg (argp, NATIVETYPE); \ 232 if ( temp < PS_MIN_##TTT || temp > PS_MAX_##TTT ) { \ 233 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value out of Range.\n"); \ 234 return false; \ 235 } \ 236 ps##TTT value = temp; \ 237 for (int iy = 0; iy < image->numRows; iy++) { \ 238 ps##TTT *row = image->data.TTT[iy]; \ 239 for (int ix = 0; ix < image->numCols; ix++) { \ 240 row[ix] = value; \ 241 } \ 242 } \ 243 return (true); \ 240 244 } 241 for (int iy = 0; iy < image->numRows; iy++) { 242 for (int ix = 0; ix < image->numCols; ix++) { 243 image->data.U8[iy][ix] = vU8; 244 } 245 246 IMAGEINIT_INTCASE(U8,unsigned int) 247 IMAGEINIT_INTCASE(U16,unsigned int) 248 IMAGEINIT_INTCASE(U32,unsigned int) 249 IMAGEINIT_INTCASE(S8,int) 250 IMAGEINIT_INTCASE(S16,int) 251 IMAGEINIT_INTCASE(S32,int) 252 253 #define IMAGEINIT_LONGCASE(TTT,NATIVETYPE) \ 254 case PS_TYPE_##TTT: { \ 255 ps##TTT value = va_arg (argp, NATIVETYPE); \ 256 for (int iy = 0; iy < image->numRows; iy++) { \ 257 ps##TTT *row = image->data.TTT[iy]; \ 258 for (int ix = 0; ix < image->numCols; ix++) { \ 259 row[ix] = value; \ 260 } \ 261 } \ 262 return (true); \ 245 263 } 246 return (true); 247 248 case PS_TYPE_F32: 249 vF32 = va_arg (argp, psF64); 250 251 for (int iy = 0; iy < image->numRows; iy++) { 252 for (int ix = 0; ix < image->numCols; ix++) { 253 image->data.F32[iy][ix] = vF32; 254 } 264 265 IMAGEINIT_LONGCASE(U64,unsigned long) 266 IMAGEINIT_LONGCASE(S64,long) 267 268 #define IMAGEINIT_FLOATCASE(TTT) \ 269 case PS_TYPE_##TTT: { \ 270 ps##TTT value = va_arg(argp, psF64); \ 271 \ 272 for (int iy = 0; iy < image->numRows; iy++) { \ 273 ps##TTT *row = image->data.TTT[iy]; \ 274 for (int ix = 0; ix < image->numCols; ix++) { \ 275 row[ix] = value; \ 276 } \ 277 } \ 278 return (true); \ 255 279 } 256 return (true); 257 258 case PS_TYPE_F64: 259 vF64 = va_arg (argp, psF64); 260 261 for (int iy = 0; iy < image->numRows; iy++) { 262 for (int ix = 0; ix < image->numCols; ix++) { 263 image->data.F64[iy][ix] = vF64; 264 } 265 } 266 return (true); 280 281 IMAGEINIT_FLOATCASE(F32) 282 IMAGEINIT_FLOATCASE(F64) 267 283 268 284 default: -
trunk/psLib/test/mathtypes/verified/tst_psImage.stderr
r5174 r5572 122 122 123 123 <DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO) 124 Error: U8Value out of Range.124 Error: Value out of Range. 125 125 <DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO) 126 126 ImageInit failed. U8 Case - 1x1 127 <DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO)128 datatype 260 not defined in psImageInit129 <DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO)130 ImageInit failed. S32 Case - 5x5131 127 132 128 ---> TESTPOINT PASSED (psImage{psImageInit} | tst_psImage.c)
Note:
See TracChangeset
for help on using the changeset viewer.
