Changeset 30595
- Timestamp:
- Feb 13, 2011, 10:45:16 AM (15 years ago)
- Location:
- trunk/psLib
- Files:
-
- 8 edited
- 6 copied
-
src/imageops (modified) (1 prop)
-
src/imageops/psImageConvolve.c (modified) (6 diffs)
-
src/imageops/psImageConvolve.h (modified) (2 diffs)
-
src/imageops/psImageCovariance.c (modified) (1 diff)
-
src/sys/psLogMsg.c (modified) (3 diffs)
-
src/sys/psMemory.c (modified) (1 diff)
-
test/imageops/Makefile.am (modified) (1 diff)
-
test/imageops/samples (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/samples )
-
test/imageops/samples/conv.sample1.001.fits (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/samples/conv.sample1.001.fits )
-
test/imageops/samples/conv.sample1.002.fits (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/samples/conv.sample1.002.fits )
-
test/imageops/samples/incovar.sample1.001.fits (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/samples/incovar.sample1.001.fits )
-
test/imageops/samples/incovar.sample1.002.fits (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/samples/incovar.sample1.002.fits )
-
test/imageops/tap_psImageCovariance.c (copied) (copied from branches/eam_branches/ipp-20101205/psLib/test/imageops/tap_psImageCovariance.c )
-
test/math (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops
- Property svn:mergeinfo deleted
-
trunk/psLib/src/imageops/psImageConvolve.c
r28405 r30595 67 67 } 68 68 69 psKernel *psKernelAlloc(int xMin, int xMax, int yMin, int yMax) 69 psKernel *p_psKernelAlloc(const char *file, 70 unsigned int lineno, 71 const char *func, 72 int xMin, int xMax, int yMin, int yMax) 70 73 { 71 74 // Check the inputs to make sure max > min; if not, switch. … … 91 94 int numCols = xMax - xMin + 1; // Number of columns for kernel image 92 95 93 psKernel *kernel = p sAlloc(sizeof(psKernel)); // The kernel, to be returned96 psKernel *kernel = p_psAlloc(file, lineno, func, sizeof(psKernel)); // The kernel, to be returned 94 97 psMemSetDeallocator(kernel,(psFreeFunc)kernelFree); 95 98 … … 272 275 float threshold = sumKernel * (1.0 - frac); // Threshold for truncation 273 276 277 int truncateRadius = maxSize; // Truncation radius 278 bool truncate = false; 279 274 280 // Find truncation size 275 int truncate = 0; // Truncation radius 276 for (int radius = 1; truncate == 0 && radius < maxSize; radius++) { 281 for (int radius = 1; !truncate && (radius < maxSize); radius++) { 277 282 int uMin = PS_MAX(-radius, xMin); 278 283 int uMax = PS_MIN(radius, xMax); … … 290 295 } 291 296 } 297 // This is the truncation radius 292 298 if (sum > threshold) { 293 // This is the truncation radius 294 truncate = radius; 295 } 296 } 297 if (truncate == maxSize) { 298 // No truncation possible 299 truncate = true; 300 truncateRadius = radius; 301 } 302 } 303 304 // Do nothing if no truncation is possible 305 if (!truncate) { 299 306 return true; 300 307 } … … 302 309 // Truncate the kernel 303 310 { 304 int uMin = PS_MAX(-truncate , xMin);305 int uMax = PS_MIN(truncate , xMax);306 int vMin = PS_MAX(-truncate , yMin);307 int vMax = PS_MIN(truncate , yMax);308 int r2 = PS_SQR(truncate );311 int uMin = PS_MAX(-truncateRadius, xMin); 312 int uMax = PS_MIN(truncateRadius, xMax); 313 int vMin = PS_MAX(-truncateRadius, yMin); 314 int vMax = PS_MIN(truncateRadius, yMax); 315 int r2 = PS_SQR(truncateRadius); 309 316 for (int v = vMin; v <= vMax; v++) { 310 317 int v2 = PS_SQR(v); … … 317 324 } 318 325 } 319 kernel->xMin = PS_MAX(-truncate , kernel->xMin);320 kernel->xMax = PS_MIN(truncate , kernel->xMax);321 kernel->yMin = PS_MAX(-truncate , kernel->yMin);322 kernel->yMax = PS_MIN(truncate , kernel->yMax);326 kernel->xMin = PS_MAX(-truncateRadius, kernel->xMin); 327 kernel->xMax = PS_MIN(truncateRadius, kernel->xMax); 328 kernel->yMin = PS_MAX(-truncateRadius, kernel->yMin); 329 kernel->yMax = PS_MIN(truncateRadius, kernel->yMax); 323 330 324 331 return true; -
trunk/psLib/src/imageops/psImageConvolve.h
r26892 r30595 84 84 /// @return psKernel* A new kernel object 85 85 /// 86 #ifdef DOXYGEN 86 87 psKernel *psKernelAlloc( 87 88 int xMin, ///< Most negative x index … … 89 90 int yMin, ///< Most negative y index 90 91 int yMax ///< Most positive y index 92 ); 93 #else // ifdef DOXYGEN 94 psKernel *p_psKernelAlloc( 95 const char *file, ///< File of caller 96 unsigned int lineno, ///< Line number of caller 97 const char *func, ///< Function name of caller 98 int xMin, ///< Most negative x index 99 int xMax, ///< Most positive x index 100 int yMin, ///< Most negative y index 101 int yMax ///< Most positive y index 91 102 ) PS_ATTR_MALLOC; 103 #define psKernelAlloc(xMin, xMax, yMin, yMax) \ 104 p_psKernelAlloc(__FILE__, __LINE__, __func__, (xMin), (xMax), (yMin), (yMax)) 105 #endif // ifdef DOXYGEN 92 106 93 107 /// Allocate a convolution kernel from a provided image -
trunk/psLib/src/imageops/psImageCovariance.c
r28667 r30595 30 30 return covar; 31 31 } 32 33 /** 34 35 * changes from 28666 36 ** add scale to imageCovarianceCalculate (& multiply at return) 37 ** add scale to imageCovarianceCalculateThread 38 39 ** accumulate scale (sum kernel^2) in psImageCovarianceCalculate and pass to imageCovarianceCalculate 40 ** accumulate scale (sum kernel^2) in psImageCovarianceCalculateFactor and pass to imageCovarianceCalculate 41 42 **/ 32 43 33 44 /// Calculation of covariance matrix element when convolving -
trunk/psLib/src/sys/psLogMsg.c
r28404 r30595 291 291 head_ptr += strlen(head_ptr); 292 292 } 293 // Hostname should be 20 characters. 293 294 // Hostname should be 10 characters. 294 295 if (logHost) { 295 296 if (head_ptr > head) { 296 297 *head_ptr++ = '|'; 297 298 } 298 maxLength -= snprintf(head_ptr, maxLength, " %-20s", hostname);299 maxLength -= snprintf(head_ptr, maxLength, " %s ", hostname); 299 300 head_ptr += strlen(head_ptr); 300 301 } … … 310 311 *head_ptr++ = '|'; 311 312 } 312 maxLength -= snprintf(head_ptr, maxLength, "%s ", name);313 maxLength -= snprintf(head_ptr, maxLength, "%s|\n", name); 313 314 314 315 head_ptr += strlen(head_ptr); 315 } 316 317 if (head_ptr > head) { 318 *head_ptr++ = '\n'; 319 } else if (!logMsg) { // no output desired 316 } else { 317 if (head_ptr > head) { 318 *head_ptr++ = '|'; 319 } 320 } 321 322 // rather than putting in a return for the message, let's only put in the return if we asked for the function name 323 if ((head_ptr == head) && !logMsg) { // no output desired 320 324 return; 321 325 } … … 332 336 char *line = strtok_r(msg, "\n", &msgPtr); 333 337 while (line) { 334 if(write(logFD, " ", 4)) {;} // ignore return value338 if(write(logFD, " ", PS_MIN(2*level, 10))) {;} // ignore return value 335 339 if(write(logFD, line, strlen(line))) {;} // ignore return value 336 340 if(write(logFD, "\n", 1)) {;} // ignore return value -
trunk/psLib/src/sys/psMemory.c
r28401 r30595 626 626 nleak++; 627 627 628 if (fd != NULL) { 628 // only print a max of 500 leaks (make this an argument) 629 if ((nleak < 500) && (fd != NULL)) { 629 630 if (nleak == 1) { 630 631 fprintf(fd, "# func at (file:line) ID: X Ref: X\n"); -
trunk/psLib/test/imageops/Makefile.am
r29929 r30595 26 26 tap_psImageMapFit \ 27 27 tap_psImageMapFit2 \ 28 tap_psImageMaskOps 28 tap_psImageMaskOps \ 29 tap_psImageCovariance 29 30 30 31 # tap_psImageShiftKernel -
trunk/psLib/test/math
- Property svn:mergeinfo deleted
Note:
See TracChangeset
for help on using the changeset viewer.
