IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 20 years ago

Closed 20 years ago

#754 closed defect (fixed)

psImageSmooth algorithm

Reported by: David.Robbins@… Owned by: Paul Price
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

It appears as though the current implementation of psImageSmooth was a recent
addition to replace slower, existing code. It appears however, that this
function is not working for a couple of reasons. First, when given a square
matrix (ie, numCols=numRows) the function produces incorrect answers. Secondly,
and more disastrous, when the matrix is not square the function can result in an
abort call.
ie, for test case #2 in tst_psImageSmooth (numCols=1, numRows=20) the following
output results:

...
classdhcp178.mhpcc.hawaii.edu|E|checkMemBlock (psMemory.c:180)

Memory block 26 is corrupted; buffer overflow detected.

classdhcp178.mhpcc.hawaii.edu|A|memProblemCallbackDefault

Detected a problem in the memory system at psVector.c:59

Return value mismatch: expected 1, got -6
---> TESTPOINT FAILED (psImage{psImageSmooth} | tst_psImageSmooth.c)

I've done some further investigating and determined that this problem is being
cause by an attempt to store values outside the allocated psVector range.
Here's what's happening in this case: (...in psImageConvolve.c:)
617: temp = psVectorAlloc(1, PS_TYPE_##TYPE); \
621: ps##TYPE *vo = temp->data.TYPE; \
624: for (int i=0; i < 5; i++, vi++, vo++) { \
632: *vo = s / g; \

I'm not exactly sure how to fix this other than looking up the algorithm on the
internet and re-implementing the function myself. Please let me know how to
proceed here.

Change History (1)

comment:1 by Paul Price, 20 years ago

Cc: eugene@… added
Resolution: fixed
Status: newclosed

Added bounds checking to psImageSmooth.

Discovered bugs:

  • The final row and column were not being smoothed. This was fixed by removing

the "-1"s that prohibited kernel iteration over the entire range.

  • The smoothed data was being copied before the next smoothing, so that it could

affect the smooth performed immediately after, resulting in a wider tail for the
positive y axis. Fixed bug by performing the copy after the smoothing is
performed, and carrying around an additional row vector that cycles into the
array of rows.

Performed manual checks of the smoothing by inserting single high pixel into an
image and smoothing. Repeated with pixel at a variety of locations. Results
appear reasonable.

Removed the old version of the function from the source code (it'll be in the
CVS history if required).

Updates to the source and test code have been checked into MHPCC's CVS.

Note: See TracTickets for help on using tickets.