cvCornerMinEigenVal and cvCornerHarris - precision mismatch, associativity (Bug #811)
Description
The SIMD version of this code uses single precision arithmetic while
the scalar version uses double precision. Ideally, both versions of
the code should use the same precision to produce the same values.
To fix this, either the SIMD code should also use double precision
or the scalar code should use single precision.
A second issue concerns associativity. One line in the calcHarris
function reads:
t = _mm_mul_ps(_mm_mul_ps(t, t), k4);
This does not match the associativity of the scalar code:
dst[j] = (float)(a*c - b*b - k*(a + c)*(a + c));
To fix this we can either rewrite the SIMD code:
t = _mm_mul_ps(_mm_mul_ps(k4, t), t);
or the scalar code:
dst[j] = (float)(a*c - b*b - k*((a + c)*(a + c)));
We are a team of researchers at Imperial College London who have
developed a technique for symbolically crosschecking a floating-point
program against its SIMD-vectorized version, as well as a tool,
KLEE-FP, which implements this technique. We found this bug by
applying KLEE-FP to a test benchmark which compares the symbolic
output of the scalar version of the algorithm against that of the
SIMD version. In this case, KLEE-FP reported a mismatch.
Associated revisions
make scalar and SSE versions of minEigenVal & cornerHarris give [almost] the same results (ticket #811)
Merge pull request #811 from pengx17:2.4_ocl_bfmatcher_newtype
History
Updated by Vadim Pisarevsky almost 14 years ago
fixed in r5302
- Status changed from Open to Done
- (deleted custom field) set to fixed