From a40afa4455ce65300b2fff57505d515e4d944fda Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Sun, 10 Nov 2024 00:21:00 +0100 Subject: [PATCH] Tests: slightly simplify ImageValidator --- Tests/VisualTests/Common/include/ImageValidator.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Tests/VisualTests/Common/include/ImageValidator.h b/Tests/VisualTests/Common/include/ImageValidator.h index e3194cc8bd0..5377ab46b04 100644 --- a/Tests/VisualTests/Common/include/ImageValidator.h +++ b/Tests/VisualTests/Common/include/ImageValidator.h @@ -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 */ @@ -57,7 +51,6 @@ struct ComparisonResult }; typedef std::vector ComparisonResultVector; -typedef Ogre::SharedPtr ComparisonResultVectorPtr; /** Simple object for doing image comparison between two image sets */ class ImageValidator @@ -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(); @@ -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);