@@ -31,12 +31,6 @@ THE SOFTWARE.
3131
3232#include " Ogre.h"
3333
34- #if OGRE_DOUBLE_PRECISION == 1
35- #define WITH_FLOAT_SUFFIX (x ) x
36- #else
37- #define WITH_FLOAT_SUFFIX (x ) x##f
38- #endif
39-
4034/* * Some functionality for comparing images */
4135
4236/* Results of comparing two test images */
@@ -57,7 +51,6 @@ struct ComparisonResult
5751};
5852
5953typedef std::vector<ComparisonResult> ComparisonResultVector;
60- typedef Ogre::SharedPtr<ComparisonResultVector> ComparisonResultVectorPtr;
6154
6255/* * Simple object for doing image comparison between two image sets */
6356class ImageValidator
@@ -115,7 +108,7 @@ class ImageValidator
115108
116109 out.incorrectPixels = 0 ;
117110 Ogre::ColourValue disparity = Ogre::ColourValue (0 ,0 ,0 );
118- Ogre::Real ssim = 0.0 ;
111+ float ssim = 0.0 ;
119112
120113 int width = img1.getWidth ();
121114 int height = img1.getHeight ();
@@ -189,8 +182,7 @@ class ImageValidator
189182 if (out.incorrectPixels != 0 )
190183 {
191184 // average and clamp to [-1,1]
192- out.ssim = std::max (WITH_FLOAT_SUFFIX (-1.0 ),
193- std::min (WITH_FLOAT_SUFFIX (1.0 ), ssim/(width*height/WITH_FLOAT_SUFFIX (64 .))));
185+ out.ssim = Ogre::Math::Clamp (ssim/(width*height/64 .f ), -1 .f , 1 .f );
194186
195187 // average the raw deviance value to get MSE
196188 out.mseChannels = disparity / (width*height);
0 commit comments