diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-06-26 18:15:09 +0000 |
commit | aab4792db8e0adcaf63cf57a1f5e0b18666dae47 (patch) | |
tree | bbfa9c4e12783d2dfd785c4e10964366550e9a60 /analyzer | |
parent | fe14f983ade44baa0794e4ce58a1a5334e46cf68 (diff) | |
download | netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.gz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.tar.xz netpbm-mirror-aab4792db8e0adcaf63cf57a1f5e0b18666dae47.zip |
Promote Development to Advanced as Release 10.75.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2803 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer')
-rw-r--r-- | analyzer/pgmtexture.c | 6 | ||||
-rw-r--r-- | analyzer/pnmpsnr.c | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/analyzer/pgmtexture.c b/analyzer/pgmtexture.c index 07317336..84c6bf4a 100644 --- a/analyzer/pgmtexture.c +++ b/analyzer/pgmtexture.c @@ -518,11 +518,12 @@ f3_corr(float ** const p, the image. -----------------------------------------------------------------------------*/ unsigned int i; - float sumSqrx, sumSqry, tmp; + float sumSqrx; + float tmp; float * px; float meanx, meany, stddevx, stddevy; - sumSqrx = 0.0; sumSqry = 0.0; + sumSqrx = 0.0; meanx = 0.0; meany = 0.0; px = vector(0, ng); @@ -545,7 +546,6 @@ f3_corr(float ** const p, } meany = meanx; - sumSqry = sumSqrx; stddevx = sqrt(sumSqrx - (SQR(meanx))); stddevy = stddevx; diff --git a/analyzer/pnmpsnr.c b/analyzer/pnmpsnr.c index 19f013a4..1ddefac2 100644 --- a/analyzer/pnmpsnr.c +++ b/analyzer/pnmpsnr.c @@ -2,7 +2,7 @@ * pnmpsnr.c: Compute error (RMSE, PSNR) between images * * - * Derived from pnmpnsmr by Ulrich Hafner, part of his fiasco package, + * Derived from pnmpnsmr by Ullrich Hafner, part of his fiasco package, * On 2001.03.04. * Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de> @@ -402,6 +402,21 @@ psnrFromSumSqDiff(struct SqDiff const sumSqDiff, +static bool +psnrIsFinite(double const psnr) { + + /* We would just use C standard isfinite(), but that is not standard + before C99. Neither is INFINITY. + + A finite PSNR, in this program, cannot be anywhere near 1,000,000, + because of limits of the program, so we just compare to that. + */ + + return psnr < 1000000.0; +} + + + static void reportPsnrHuman(struct Psnr const psnr, ColorSpace const colorSpace, @@ -417,7 +432,7 @@ reportPsnrHuman(struct Psnr const psnr, pm_asprintf(&label, "%s:", colorSpace.componentName[i]); - if (isfinite(psnr.psnr[i])) + if (psnrIsFinite(psnr.psnr[i])) pm_message(" %-6.6s %.2f dB", label, psnr.psnr[i]); else pm_message(" %-6.6s no difference", label); |