Skip to content

Commit d0749f0

Browse files
author
Cristy
committed
correct PSNR distortion
1 parent 4ac361b commit d0749f0

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

magick/compare.c

+6-14
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,6 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image,
14241424
MagickBooleanType
14251425
status;
14261426

1427-
ssize_t
1428-
i;
1429-
14301427
status=GetMeanSquaredDistortion(image,reconstruct_image,channel,distortion,
14311428
exception);
14321429
if ((channel & RedChannel) != 0)
@@ -1443,8 +1440,8 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image,
14431440
{
14441441
if ((fabs(distortion[GreenChannel]) < MagickEpsilon) ||
14451442
(fabs(distortion[GreenChannel]) >= 1.0))
1446-
distortion[GreenChannel]=fabs(distortion[GreenChannel]) < MagickEpsilon ?
1447-
0.0 : 1.0;
1443+
distortion[GreenChannel]=fabs(distortion[GreenChannel]) <
1444+
MagickEpsilon ? 0.0 : 1.0;
14481445
else
14491446
distortion[GreenChannel]=(-10.0*MagickLog10(PerceptibleReciprocal(
14501447
distortion[GreenChannel])))/48.1647;
@@ -1463,8 +1460,8 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image,
14631460
{
14641461
if ((fabs(distortion[OpacityChannel]) < MagickEpsilon) ||
14651462
(fabs(distortion[OpacityChannel]) >= 1.0))
1466-
distortion[OpacityChannel]=fabs(distortion[OpacityChannel]) < MagickEpsilon ?
1467-
0.0 : 1.0;
1463+
distortion[OpacityChannel]=fabs(distortion[OpacityChannel]) <
1464+
MagickEpsilon ? 0.0 : 1.0;
14681465
else
14691466
distortion[OpacityChannel]=(-10.0*MagickLog10(PerceptibleReciprocal(
14701467
distortion[OpacityChannel])))/48.1647;
@@ -1473,17 +1470,12 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image,
14731470
{
14741471
if ((fabs(distortion[BlackChannel]) < MagickEpsilon) ||
14751472
(fabs(distortion[BlackChannel]) >= 1.0))
1476-
distortion[BlackChannel]=fabs(distortion[BlackChannel]) < MagickEpsilon ?
1477-
0.0 : 1.0;
1473+
distortion[BlackChannel]=fabs(distortion[BlackChannel]) <
1474+
MagickEpsilon ? 0.0 : 1.0;
14781475
else
14791476
distortion[BlackChannel]=(-10.0*MagickLog10(PerceptibleReciprocal(
14801477
distortion[BlackChannel])))/48.1647;
14811478
}
1482-
distortion[CompositeChannels]=0.0;
1483-
for (i=0; i < (ssize_t) CompositeChannels; i++)
1484-
if (fabs(distortion[i]) >= MagickEpsilon)
1485-
distortion[CompositeChannels]+=distortion[i];
1486-
distortion[CompositeChannels]/=(double) GetNumberChannels(image,channel);
14871479
return(status);
14881480
}
14891481

0 commit comments

Comments
 (0)