about summary refs log tree commit diff
path: root/analyzer
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-09-08 15:57:44 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-09-08 15:57:44 +0000
commit0cee6ebc77c9477ddfe5710812058b24ba9c0b02 (patch)
tree07e3015c906df2d2d1509ce03167b0f4f0fc6223 /analyzer
parent48e0e92b9824d6f2d91fe346bb64f810c90c1114 (diff)
downloadnetpbm-mirror-0cee6ebc77c9477ddfe5710812058b24ba9c0b02.tar.gz
netpbm-mirror-0cee6ebc77c9477ddfe5710812058b24ba9c0b02.tar.xz
netpbm-mirror-0cee6ebc77c9477ddfe5710812058b24ba9c0b02.zip
Fix bug: signed value declared unsigned, so row below center of a region looks like a row way above it and gets ignored
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3320 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer')
-rw-r--r--analyzer/pamgetcolor.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/analyzer/pamgetcolor.c b/analyzer/pamgetcolor.c
index 123ae23f..cd9d2028 100644
--- a/analyzer/pamgetcolor.c
+++ b/analyzer/pamgetcolor.c
@@ -379,7 +379,7 @@ readChord(RegData *    const dataP,
           uint         const x0,
           uint         const x1) {
 /*----------------------------------------------------------------------------
-  Update region sample *dataP with the data from horisontal chord lying in row
+  Update region sample *dataP with the data from horizontal chord lying in row
   'row' and going from 'x0' to 'x1'. 'linear' means tuples in 'row' are the
   intensity-linear values as opposed to normal libnetpbm gamma-adjusted
   values.
@@ -421,13 +421,15 @@ processRow(tuple *      const   row,
     for (r = 0; r < cmdLineP->regN; ++r) {
         RegSpec   const spec = cmdLineP->regSpecs[r];
         RegData * const dataP = &regSamples[r];
-        uint      const yd = spec.y - y;
+        int       const yd = (int)spec.y - (int)y;
 
         if (abs(yd) > cmdLineP->radius) {
-            /* Avoid the slow root operation */
+            /* Row is entirely above or below the region; Avoid the slow root
+               operation
+            */
         } else {
             uint const xd2 = sqri(cmdLineP->radius) - sqri(yd);
-            uint const xd = (int)(sqrt((double)xd2) + 0.5);
+            uint const xd  = ROUNDU(sqrt((double)xd2));
 
             int x0, x1;