Skip to content

Commit eafd854

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/8212
1 parent 0a02fb4 commit eafd854

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

coders/heic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,6 @@ static MagickBooleanType WriteHEICImage(const ImageInfo *image_info,
14101410
cicp.xi=(double) nclx_profile->matrix_coefficients;
14111411
cicp.psi=(double) nclx_profile->full_range_flag;
14121412
(void) ParseGeometry(option,&cicp);
1413-
memset(&nclx_profile,0,sizeof(nclx_profile));
14141413
heif_nclx_color_profile_set_color_primaries(nclx_profile,
14151414
(uint16_t) cicp.rho);
14161415
heif_nclx_color_profile_set_transfer_characteristics(nclx_profile,

magick/compare.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,15 @@ MagickExport MagickBooleanType GetImageChannelDistortion(Image *image,
17801780
}
17811781
}
17821782
*distortion=channel_similarity[CompositeChannels];
1783+
switch (metric)
1784+
{
1785+
case NormalizedCrossCorrelationErrorMetric:
1786+
{
1787+
*distortion=(1.0-(*distortion))/2.0;
1788+
break;
1789+
}
1790+
default: break;
1791+
}
17831792
channel_similarity=(double *) RelinquishMagickMemory(channel_similarity);
17841793
(void) FormatImageProperty(image,"distortion","%.*g",GetMagickPrecision(),
17851794
*distortion);
@@ -1853,8 +1862,7 @@ MagickExport double *GetImageChannelDistortions(Image *image,
18531862
sizeof(*similarity));
18541863
if (similarity == (double *) NULL)
18551864
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
1856-
(void) memset(similarity,0,length*
1857-
sizeof(*similarity));
1865+
(void) memset(similarity,0,length*sizeof(*similarity));
18581866
status=MagickTrue;
18591867
switch (metric)
18601868
{
@@ -1927,6 +1935,17 @@ MagickExport double *GetImageChannelDistortions(Image *image,
19271935
return((double *) NULL);
19281936
}
19291937
distortion=similarity;
1938+
distortion=channel_similarity;
1939+
switch (metric)
1940+
{
1941+
case NormalizedCrossCorrelationErrorMetric:
1942+
{
1943+
for (i=0; i <= MaxPixelChannels; i++)
1944+
distortion[i]=(1.0-distortion[i])/2.0;
1945+
break;
1946+
}
1947+
default: break;
1948+
}
19301949
return(distortion);
19311950
}
19321951

0 commit comments

Comments
 (0)