Changeset 2291
- Timestamp:
- Nov 5, 2004, 2:44:56 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 6 edited
-
dataManip/psConstants.h (modified) (2 diffs)
-
image/psImage.c (modified) (2 diffs)
-
image/psImageStats.c (modified) (10 diffs)
-
imageops/psImageStats.c (modified) (10 diffs)
-
math/psConstants.h (modified) (2 diffs)
-
mathtypes/psImage.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psConstants.h
r2274 r2291 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-11-0 4 01:59:04$8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-06 00:44:56 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 42 42 "Error: %s is 0 or less.", #NAME); \ 43 return(RVAL); \ 44 } 45 46 #define PS_INT_CHECK_ZERO(NAME, RVAL) \ 47 if (NAME < 1) { \ 48 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 49 "Error: %s is 0.", #NAME); \ 43 50 return(RVAL); \ 44 51 } -
trunk/psLib/src/image/psImage.c
r2273 r2291 1 2 1 /** @file psImage.c 3 2 * … … 10 9 * @author Ross Harman, MHPCC 11 10 * 12 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-11-0 4 01:05:00$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:44:56 $ 14 13 * 15 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/image/psImageStats.c
r2273 r2291 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-0 4 01:05:00$11 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:44:56 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 psS32 maskVal) 43 43 { 44 PS_PTR_CHECK_NULL(stats, NULL); 45 PS_INT_CHECK_ZERO(stats->options, NULL); 46 PS_IMAGE_CHECK_NULL(in, NULL) 44 47 psVector* junkData = NULL; 45 48 psVector* junkMask = NULL; 46 49 47 if (stats == NULL) {48 psError(PS_ERR_BAD_PARAMETER_NULL, true,49 PS_ERRORTEXT_psImage_STAT_NULL);50 return NULL;51 }52 53 if (in == NULL) {54 psError(PS_ERR_BAD_PARAMETER_NULL, true,55 PS_ERRORTEXT_psImage_IMAGE_NULL);56 return NULL;57 }58 59 if (stats->options == 0) {60 psError(PS_ERR_BAD_PARAMETER_VALUE, true,61 PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);62 return stats;63 }64 50 // stuff the image data into a psVector struct. 65 51 junkData = psAlloc(sizeof(psVector)); … … 97 83 NOTE: We assume that the psHistogram structure out has already been 98 84 allocated and initialized. 99 NOTE: verify that image/mask have the correct types and sizes.100 85 *****************************************************************************/ 101 86 psHistogram* psImageHistogram(psHistogram* out, … … 104 89 psU32 maskVal) 105 90 { 91 PS_PTR_CHECK_NULL(out, NULL); 92 PS_PTR_CHECK_NULL(in, NULL); 93 if (mask != NULL) { 94 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 95 } 106 96 psVector* junkData = NULL; 107 97 psVector* junkMask = NULL; 108 109 // NOTE: Verify this action.110 PS_PTR_CHECK_NULL(out, NULL);111 PS_PTR_CHECK_NULL(in, NULL);112 98 113 99 junkData = psAlloc(sizeof(psVector)); … … 118 104 119 105 if (mask != NULL) { 120 if (mask->type.type != PS_TYPE_MASK) {121 char* typeStr;122 PS_TYPE_NAME(typeStr,mask->type.type);123 psError(PS_ERR_BAD_PARAMETER_TYPE, true,124 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,125 typeStr, PS_TYPE_MASK_NAME);126 psFree(out);127 psFree(junkData);128 return NULL;129 }130 106 // stuff the mask data into a psVector struct. 131 107 junkMask = psAlloc(sizeof(psVector)); … … 187 163 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 188 164 { 189 if (maxChebyPoly < 1) { 190 return(NULL); 191 } 165 PS_INT_CHECK_POSITIVE(maxChebyPoly, NULL); 192 166 psPolynomial1D **chebPolys = NULL; 193 167 psS32 i = 0; … … 238 212 (input->type.type != PS_TYPE_F32) && 239 213 (input->type.type != PS_TYPE_F64)) { 240 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 241 "Unallowable image type.\n"); 214 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unallowable image type.\n"); 242 215 } 243 216 PS_POLY_CHECK_NULL(coeffs, NULL); … … 252 225 double *cScalingFactors = NULL; 253 226 double *rScalingFactors = NULL; 254 255 // Check for null inputs256 if (input == NULL) {257 psError(PS_ERR_BAD_PARAMETER_NULL, true,258 PS_ERRORTEXT_psImage_IMAGE_NULL);259 return NULL;260 }261 262 if (coeffs == NULL) {263 psError(PS_ERR_BAD_PARAMETER_NULL, true,264 PS_ERRORTEXT_psImage_COEFF_NULL);265 return NULL;266 }267 227 268 228 // Create the sums[][] data structure. This … … 287 247 } 288 248 chebPolys = p_psCreateChebyshevPolys(maxChebyPoly); 289 290 249 291 250 // Compute the sums[][] data structure. … … 373 332 float polySum = 0.0; 374 333 375 // Check for null inputs376 if (input == NULL) {377 psError(PS_ERR_BAD_PARAMETER_NULL, true,378 PS_ERRORTEXT_psImage_IMAGE_NULL);379 return NULL;380 }381 382 if (coeffs == NULL) {383 psError(PS_ERR_BAD_PARAMETER_NULL, true,384 PS_ERRORTEXT_psImage_COEFF_NULL);385 return NULL;386 }387 388 334 // We scale the pixel positions to values between -1.0 and 1.0 389 335 // Use static data structures here. -
trunk/psLib/src/imageops/psImageStats.c
r2273 r2291 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-0 4 01:05:00$11 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:44:56 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 psS32 maskVal) 43 43 { 44 PS_PTR_CHECK_NULL(stats, NULL); 45 PS_INT_CHECK_ZERO(stats->options, NULL); 46 PS_IMAGE_CHECK_NULL(in, NULL) 44 47 psVector* junkData = NULL; 45 48 psVector* junkMask = NULL; 46 49 47 if (stats == NULL) {48 psError(PS_ERR_BAD_PARAMETER_NULL, true,49 PS_ERRORTEXT_psImage_STAT_NULL);50 return NULL;51 }52 53 if (in == NULL) {54 psError(PS_ERR_BAD_PARAMETER_NULL, true,55 PS_ERRORTEXT_psImage_IMAGE_NULL);56 return NULL;57 }58 59 if (stats->options == 0) {60 psError(PS_ERR_BAD_PARAMETER_VALUE, true,61 PS_ERRORTEXT_psImage_NO_STAT_OPTIONS);62 return stats;63 }64 50 // stuff the image data into a psVector struct. 65 51 junkData = psAlloc(sizeof(psVector)); … … 97 83 NOTE: We assume that the psHistogram structure out has already been 98 84 allocated and initialized. 99 NOTE: verify that image/mask have the correct types and sizes.100 85 *****************************************************************************/ 101 86 psHistogram* psImageHistogram(psHistogram* out, … … 104 89 psU32 maskVal) 105 90 { 91 PS_PTR_CHECK_NULL(out, NULL); 92 PS_PTR_CHECK_NULL(in, NULL); 93 if (mask != NULL) { 94 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 95 } 106 96 psVector* junkData = NULL; 107 97 psVector* junkMask = NULL; 108 109 // NOTE: Verify this action.110 PS_PTR_CHECK_NULL(out, NULL);111 PS_PTR_CHECK_NULL(in, NULL);112 98 113 99 junkData = psAlloc(sizeof(psVector)); … … 118 104 119 105 if (mask != NULL) { 120 if (mask->type.type != PS_TYPE_MASK) {121 char* typeStr;122 PS_TYPE_NAME(typeStr,mask->type.type);123 psError(PS_ERR_BAD_PARAMETER_TYPE, true,124 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,125 typeStr, PS_TYPE_MASK_NAME);126 psFree(out);127 psFree(junkData);128 return NULL;129 }130 106 // stuff the mask data into a psVector struct. 131 107 junkMask = psAlloc(sizeof(psVector)); … … 187 163 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 188 164 { 189 if (maxChebyPoly < 1) { 190 return(NULL); 191 } 165 PS_INT_CHECK_POSITIVE(maxChebyPoly, NULL); 192 166 psPolynomial1D **chebPolys = NULL; 193 167 psS32 i = 0; … … 238 212 (input->type.type != PS_TYPE_F32) && 239 213 (input->type.type != PS_TYPE_F64)) { 240 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 241 "Unallowable image type.\n"); 214 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unallowable image type.\n"); 242 215 } 243 216 PS_POLY_CHECK_NULL(coeffs, NULL); … … 252 225 double *cScalingFactors = NULL; 253 226 double *rScalingFactors = NULL; 254 255 // Check for null inputs256 if (input == NULL) {257 psError(PS_ERR_BAD_PARAMETER_NULL, true,258 PS_ERRORTEXT_psImage_IMAGE_NULL);259 return NULL;260 }261 262 if (coeffs == NULL) {263 psError(PS_ERR_BAD_PARAMETER_NULL, true,264 PS_ERRORTEXT_psImage_COEFF_NULL);265 return NULL;266 }267 227 268 228 // Create the sums[][] data structure. This … … 287 247 } 288 248 chebPolys = p_psCreateChebyshevPolys(maxChebyPoly); 289 290 249 291 250 // Compute the sums[][] data structure. … … 373 332 float polySum = 0.0; 374 333 375 // Check for null inputs376 if (input == NULL) {377 psError(PS_ERR_BAD_PARAMETER_NULL, true,378 PS_ERRORTEXT_psImage_IMAGE_NULL);379 return NULL;380 }381 382 if (coeffs == NULL) {383 psError(PS_ERR_BAD_PARAMETER_NULL, true,384 PS_ERRORTEXT_psImage_COEFF_NULL);385 return NULL;386 }387 388 334 // We scale the pixel positions to values between -1.0 and 1.0 389 335 // Use static data structures here. -
trunk/psLib/src/math/psConstants.h
r2274 r2291 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-11-0 4 01:59:04$8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-06 00:44:56 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 42 42 "Error: %s is 0 or less.", #NAME); \ 43 return(RVAL); \ 44 } 45 46 #define PS_INT_CHECK_ZERO(NAME, RVAL) \ 47 if (NAME < 1) { \ 48 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 49 "Error: %s is 0.", #NAME); \ 43 50 return(RVAL); \ 44 51 } -
trunk/psLib/src/mathtypes/psImage.c
r2273 r2291 1 2 1 /** @file psImage.c 3 2 * … … 10 9 * @author Ross Harman, MHPCC 11 10 * 12 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-11-0 4 01:05:00$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:44:56 $ 14 13 * 15 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
