register ssize_t
i;
+ size_t
+ columns,
+ rows;
+
ssize_t
y;
if (artifact != (const char *) NULL)
c2=pow(StringToDouble(artifact,(char **) NULL)*SSIML,2.0);
status=MagickTrue;
+ rows=MagickMax(image->rows,reconstruct_image->rows);
+ columns=MagickMax(image->columns,reconstruct_image->columns);
image_view=AcquireVirtualCacheView(image,exception);
reconstruct_view=AcquireVirtualCacheView(reconstruct_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
- magick_threads(image,reconstruct_image,image->rows,1)
+ magick_threads(image,reconstruct_image,rows,1)
#endif
- for (y=0; y < (ssize_t) image->rows; y++)
+ for (y=0; y < (ssize_t) rows; y++)
{
double
channel_distortion[MaxPixelChannels+1];
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,-((ssize_t) kernel_info->width/2L),y-
- ((ssize_t) kernel_info->height/2L),image->columns+kernel_info->width,
+ ((ssize_t) kernel_info->height/2L),columns+kernel_info->width,
kernel_info->height,exception);
q=GetCacheViewVirtualPixels(reconstruct_view,-((ssize_t) kernel_info->width/
- 2L),y-((ssize_t) kernel_info->height/2L),reconstruct_image->columns+
- kernel_info->width,kernel_info->height,exception);
+ 2L),y-((ssize_t) kernel_info->height/2L),columns+kernel_info->width,
+ kernel_info->height,exception);
if ((p == (const Quantum *) NULL) || (q == (const Quantum *) NULL))
{
status=MagickFalse;
continue;
}
(void) ResetMagickMemory(channel_distortion,0,sizeof(channel_distortion));
- for (x=0; x < (ssize_t) image->columns; x++)
+ for (x=0; x < (ssize_t) columns; x++)
{
double
x_pixel_mu[MaxPixelChannels+1],
reference+=GetPixelChannels(image);
target+=GetPixelChannels(reconstruct_image);
}
- reference+=GetPixelChannels(image)*image->columns;
- target+=GetPixelChannels(reconstruct_image)*reconstruct_image->columns;
+ reference+=GetPixelChannels(image)*columns;
+ target+=GetPixelChannels(reconstruct_image)*columns;
}
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelTrait traits = GetPixelChannelTraits(image,channel);
if ((traits == UndefinedPixelTrait) || ((traits & UpdatePixelTrait) == 0))
continue;
- distortion[i]/=((double) image->columns*image->rows);
+ distortion[i]/=((double) columns*rows);
}
- distortion[CompositePixelChannel]/=((double) image->columns*image->rows);
+ distortion[CompositePixelChannel]/=((double) columns*rows);
distortion[CompositePixelChannel]/=(double) GetImageChannels(image);
kernel_info=DestroyKernelInfo(kernel_info);
return(status);