Skip to content

Commit

Permalink
Tests: slightly simplify ImageValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Nov 9, 2024
1 parent f0b87ee commit 8866f8d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Tests/VisualTests/Common/include/ImageValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ THE SOFTWARE.

#include "Ogre.h"

#if OGRE_DOUBLE_PRECISION == 1
#define WITH_FLOAT_SUFFIX(x) x
#else
#define WITH_FLOAT_SUFFIX(x) x##f
#endif

/** Some functionality for comparing images */

/* Results of comparing two test images */
Expand All @@ -57,7 +51,6 @@ struct ComparisonResult
};

typedef std::vector<ComparisonResult> ComparisonResultVector;
typedef Ogre::SharedPtr<ComparisonResultVector> ComparisonResultVectorPtr;

/** Simple object for doing image comparison between two image sets */
class ImageValidator
Expand Down Expand Up @@ -115,7 +108,7 @@ class ImageValidator

out.incorrectPixels = 0;
Ogre::ColourValue disparity = Ogre::ColourValue(0,0,0);
Ogre::Real ssim = 0.0;
float ssim = 0.0;

int width = img1.getWidth();
int height = img1.getHeight();
Expand Down Expand Up @@ -189,8 +182,7 @@ class ImageValidator
if(out.incorrectPixels != 0)
{
// average and clamp to [-1,1]
out.ssim = std::max(WITH_FLOAT_SUFFIX(-1.0),
std::min(WITH_FLOAT_SUFFIX(1.0), ssim/(width*height/WITH_FLOAT_SUFFIX(64.))));
out.ssim = Ogre::Math::Clamp(ssim/(width*height/64.f), -1.f, 1.f);

// average the raw deviance value to get MSE
out.mseChannels = disparity / (width*height);
Expand Down

0 comments on commit 8866f8d

Please sign in to comment.