about summary refs log tree commit diff
path: root/editor/pnmnorm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-01-20 19:22:55 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-01-20 19:22:55 +0000
commit6d06b8e0c26536edaedf04ae56849667b85c1325 (patch)
tree2fc0bcebd14321d895b479c8a465a6ab69888e68 /editor/pnmnorm.c
parent16b223f52bfbbc2eef71496ffd434dccadb35579 (diff)
downloadnetpbm-mirror-6d06b8e0c26536edaedf04ae56849667b85c1325.tar.gz
netpbm-mirror-6d06b8e0c26536edaedf04ae56849667b85c1325.tar.xz
netpbm-mirror-6d06b8e0c26536edaedf04ae56849667b85c1325.zip
Fix handling of floating point imprecision in unnormalizing samples
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3513 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pnmnorm.c')
-rw-r--r--editor/pnmnorm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/pnmnorm.c b/editor/pnmnorm.c
index 7762f049..2f9a6b20 100644
--- a/editor/pnmnorm.c
+++ b/editor/pnmnorm.c
@@ -714,7 +714,7 @@ computeQuadraticTransfer(xelval   const bvalue,
 
    Set this mapping in newBrightness[].
 -----------------------------------------------------------------------------*/
-    xelval const middle = ROUNDU(middleNorm * maxval);
+    xelval const middle = pnm_unnormalize(middleNorm, maxval);
 
     /* Computing this function is just the task of finding a parabola that
        passes through 3 given points:
@@ -924,7 +924,7 @@ reportTransferParm(bool   const quadratic,
     if (quadratic)
         pm_message("remapping %u..%u..%u to %u..%u..%u",
                    bvalue, midvalue, wvalue,
-                   0, ROUNDU(maxval*middle), maxval);
+                   0, pnm_unnormalize(middle, maxval), maxval);
     else
         pm_message("remapping %u..%u to %u..%u",
                    bvalue, wvalue, 0, maxval);