Fix error double accounting in fuzzyCompare()
authorAlexander Galazin <alexander.galazin@arm.com>
Tue, 8 Aug 2017 11:15:40 +0000 (13:15 +0200)
committerAlexander Galazin <alexander.galazin@arm.com>
Thu, 10 Aug 2017 07:12:48 +0000 (07:12 +0000)
fuzzyCompare() has a loop to go through all the pixels and generate error sum.
It skips some pixels using random number generator between 0-8.
Random number generator sometime generate 0 and it ends up
calculating error sum twice for the same pixel.
If this pixel has error, then this add up error sum twice.

Components: Framework

Change-Id: I08e06e29faedb99cfd8fa479e97a437c06008848

framework/common/tcuFuzzyImageCompare.cpp

index 596ab83..4e76476 100644 (file)
@@ -318,7 +318,7 @@ float fuzzyCompare (const FuzzyCompareParams& params, const ConstPixelBufferAcce
 
        for (int y = 1; y < height-1; y++)
        {
-               for (int x = 1; x < width-1; x += params.maxSampleSkip > 0 ? (int)rnd.getInt(0, params.maxSampleSkip) : 1)
+               for (int x = 1; x < width-1; x += 1 + (int)rnd.getInt(0, params.maxSampleSkip))
                {
                        const deUint32  minDist2RefToCmp        = distSquaredToNeighbor<4>(rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y);
                        const deUint32  minDist2CmpToRef        = distSquaredToNeighbor<4>(rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y);