#define _MAGICKCORE_COLOR_PRIVATE_H
#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
+static inline double GetMaxImageFuzz(const Image *a,const Image *b)
+{
+ double
+ fuzz;
+
+ fuzz=(double) MagickMax(MagickMax(a->fuzz,b->fuzz),(MagickRealType)
+ MagickSQ1_2);
+ return(fuzz*fuzz);
+}
+
extern MagickPrivate MagickBooleanType
ColorComponentGenesis(void),
IsEquivalentAlpha(const Image *,const PixelInfo *,const PixelInfo *),
*image_view,
*reconstruct_view;
+ double
+ fuzz;
+
const char
*artifact;
Generate difference image.
*/
status=MagickTrue;
+ fuzz=GetMaxImageFuzz(image,reconstruct_image);
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
highlight_view=AcquireAuthenticCacheView(highlight_image,exception);
((reconstruct_traits & UpdatePixelTrait) == 0))
continue;
distance=Sa*p[i]-Da*GetPixelChannel(reconstruct_image,channel,q);
- if (fabs(distance) >= MagickEpsilon)
- difference=MagickTrue;
+ if ((distance*distance) > fuzz)
+ {
+ difference=MagickTrue;
+ break;
+ }
}
if (difference == MagickFalse)
SetPixelViaPixelInfo(highlight_image,&lowlight,r);
Compute the absolute difference in pixels between two images.
*/
status=MagickTrue;
- fuzz=(double) MagickMax(MagickMax(image->fuzz,reconstruct_image->fuzz),
- (MagickRealType) MagickSQ1_2);
- fuzz*=fuzz;
+ fuzz=GetMaxImageFuzz(image,reconstruct_image);
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
distance=Sa*p[i]-Da*GetPixelChannel(reconstruct_image,channel,q);
if ((distance*distance) > fuzz)
{
+ channel_distortion[i]++;
difference=MagickTrue;
- break;
}
}
if (difference != MagickFalse)
- {
- channel_distortion[i]++;
- channel_distortion[CompositePixelChannel]++;
- }
+ channel_distortion[CompositePixelChannel]++;
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
}