*image_view,
*reconstruct_view;
+ double
+ area;
+
MagickBooleanType
status;
status=MagickTrue;
rows=MagickMax(image->rows,reconstruct_image->rows);
columns=MagickMax(image->columns,reconstruct_image->columns);
+ area=0.0;
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
register ssize_t
i;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
channel_distortion[i]+=distance*distance;
channel_distortion[CompositePixelChannel]+=distance*distance;
}
+ area++;
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
}
}
reconstruct_view=DestroyCacheView(reconstruct_view);
image_view=DestroyCacheView(image_view);
+ area=PerceptibleReciprocal(area);
for (j=0; j <= MaxPixelChannels; j++)
- distortion[j]/=((double) columns*rows);
+ distortion[j]*=area;
distortion[CompositePixelChannel]/=(double) GetImageChannels(image);
distortion[CompositePixelChannel]=sqrt(distortion[CompositePixelChannel]);
return(status);
*image_view,
*reconstruct_view;
+ double
+ area;
+
MagickBooleanType
status;
status=MagickTrue;
rows=MagickMax(image->rows,reconstruct_image->rows);
columns=MagickMax(image->columns,reconstruct_image->columns);
+ area=0.0;
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
register ssize_t
i;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
channel_distortion[i]+=distance;
channel_distortion[CompositePixelChannel]+=distance;
}
+ area++;
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
}
}
reconstruct_view=DestroyCacheView(reconstruct_view);
image_view=DestroyCacheView(image_view);
+ area=PerceptibleReciprocal(area);
for (j=0; j <= MaxPixelChannels; j++)
- distortion[j]/=((double) columns*rows);
+ distortion[j]*=area;
distortion[CompositePixelChannel]/=(double) GetImageChannels(image);
return(status);
}
register ssize_t
i;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
*image_view,
*reconstruct_view;
+ double
+ area;
+
MagickBooleanType
status;
status=MagickTrue;
rows=MagickMax(image->rows,reconstruct_image->rows);
columns=MagickMax(image->columns,reconstruct_image->columns);
+ area=0.0;
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
register ssize_t
i;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
channel_distortion[i]+=distance*distance;
channel_distortion[CompositePixelChannel]+=distance*distance;
}
+ area++;
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
}
}
reconstruct_view=DestroyCacheView(reconstruct_view);
image_view=DestroyCacheView(image_view);
+ area=PerceptibleReciprocal(area);
for (j=0; j <= MaxPixelChannels; j++)
- distortion[j]/=((double) columns*rows);
+ distortion[j]*=area;
distortion[CompositePixelChannel]/=GetImageChannels(image);
return(status);
}
distortion[i]=0.0;
rows=MagickMax(image->rows,reconstruct_image->rows);
columns=MagickMax(image->columns,reconstruct_image->columns);
- area=1.0/((double) columns*rows);
+ area=0.0;
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
for (y=0; y < (ssize_t) rows; y++)
+ {
+ register const Quantum
+ *magick_restrict p,
+ *magick_restrict q;
+
+ register ssize_t
+ x;
+
+ p=GetCacheViewVirtualPixels(image_view,0,y,columns,1,exception);
+ q=GetCacheViewVirtualPixels(reconstruct_view,0,y,columns,1,exception);
+ if ((p == (const Quantum *) NULL) || (q == (const Quantum *) NULL))
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (x=0; x < (ssize_t) columns; x++)
+ {
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
+ {
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(reconstruct_image);
+ continue;
+ }
+ area++;
+ p+=GetPixelChannels(image);
+ q+=GetPixelChannels(reconstruct_image);
+ }
+ }
+ area=PerceptibleReciprocal(area);
+ for (y=0; y < (ssize_t) rows; y++)
{
register const Quantum
*magick_restrict p,
Da,
Sa;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);
register ssize_t
i;
- if (GetPixelReadMask(image,p) == 0)
+ if ((GetPixelReadMask(image,p) == 0) ||
+ (GetPixelReadMask(reconstruct_image,q) == 0))
{
p+=GetPixelChannels(image);
q+=GetPixelChannels(reconstruct_image);