From 67f3197566ab6ca771b3f63e691d01dbd89f0994 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 29 Mar 2023 16:35:55 +0200 Subject: [PATCH 1/7] typo/lang fixes in comments # Conflicts: # src/binarize.c --- src/convolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/convolve.c b/src/convolve.c index a1dcf7c16..72c53f414 100644 --- a/src/convolve.c +++ b/src/convolve.c @@ -296,7 +296,7 @@ PIX *pixd, *pixt; * for the first wc + 1 and last wc columns in the intermediate * lines. * (5) The caller should verify that wc < w and hc < h. - * Under those conditions, illegal reads and writes can occur. + * Failing either condition, illegal reads and writes can occur. * (6) Implementation note: to get the same results in the interior * between this function and pixConvolve(), it is necessary to * add 0.5 for roundoff in the main loop that runs over all pixels. From 2991f078c5433a437794efaf7217c610b79f47ce Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 8 Aug 2023 07:34:21 +0200 Subject: [PATCH 2/7] typo fix in documentation comment --- src/coloring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coloring.c b/src/coloring.c index 82d82e1a4..17bf23f2e 100644 --- a/src/coloring.c +++ b/src/coloring.c @@ -459,7 +459,7 @@ PIXCMAP *cmap; * \param[in] srcval color center to be selected for change: 0xrrggbb00 * \param[in] dstval target color for pixels: 0xrrggbb00 * \param[in] diff max absolute difference, applied to all components - * \return pixd with all pixels within diff of pixval set to pixval, + * \return pixd with all pixels within diff of srcval set to dstval, * or pixd on error * *

From 2249eed9e7c37ef90bab5c1357de91cdb62291e9 Mon Sep 17 00:00:00 2001
From: Ger Hobbelt 
Date: Sun, 13 Aug 2023 20:44:38 +0200
Subject: [PATCH 3/7] tweak a few comments for better readability of the
 documentation

---
 src/pix2.c     | 12 ++++++------
 src/pixarith.c | 20 ++++++++++----------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/pix2.c b/src/pix2.c
index bb71aaa02..ee16f7f82 100644
--- a/src/pix2.c
+++ b/src/pix2.c
@@ -1465,9 +1465,9 @@ l_uint32  *data, *pword;
 /*!
  * \brief   pixSetOrClearBorder()
  *
- * \param[in]    pixs   all depths
- * \param[in]    left,  right, top, bot amount to set or clear
- * \param[in]    op     operation PIX_SET or PIX_CLR
+ * \param[in]    pixs                     all depths
+ * \param[in]    left, right, top, bot    border region amount to set or clear: these distances are from outside
+ * \param[in]    op                       operation PIX_SET or PIX_CLR
  * \return  0 if OK; 1 on error
  *
  * 
@@ -1511,7 +1511,7 @@ l_int32  w, h;
  * \brief   pixSetBorderVal()
  *
  * \param[in]    pixs                   8, 16 or 32 bpp
- * \param[in]    left, right, top, bot  amount to set
+ * \param[in]    left, right, top, bot  border region amount to set: these distances are from outside
  * \param[in]    val                    value to set at each border pixel
  * \return  0 if OK; 1 on error
  *
@@ -2196,7 +2196,7 @@ PIX     *pixd;
  *
  * 
  * Notes:
- *      (1) This applies mirrored boundary conditions horizontally
+ *      (1) This applies mirrored boundary conditions (b.c.) horizontally
  *          and repeated b.c. vertically.
  *      (2) It is specifically used for avoiding special operations
  *          near boundaries when convolving a hue-saturation histogram
@@ -2408,7 +2408,7 @@ PIXCMAP   *cmap;
  * Notes:
  *      (1) the 4th byte, sometimes called the "alpha channel",
  *          and which is often used for blending between different
- *          images, is left with 0 value.
+ *          images, is left with 0 value (fully opaque).
  *      (2) see Note (4) in pix.h for details on storage of
  *          8-bit samples within each 32-bit word.
  *      (3) This implementation, setting the r, g and b components
diff --git a/src/pixarith.c b/src/pixarith.c
index 1f450da5a..6ae662ac6 100644
--- a/src/pixarith.c
+++ b/src/pixarith.c
@@ -1117,9 +1117,9 @@ PIX       *pixc1, *pixc2, *pixd;
  *          for a 3 component image.  For 32 bpp, ignore the LSB
  *          of each word (the alpha channel)
  *      (3) There are 3 cases:
- *          ~  if pixd == null,   Min(src1, src2) --> new pixd
- *          ~  if pixd == pixs1,  Min(src1, src2) --> src1  (in-place)
- *          ~  if pixd != pixs1,  Min(src1, src2) --> input pixd
+ *          ~  if pixd == null,   MinOrMax(src1, src2) --> new pixd
+ *          ~  if pixd == pixs1,  MinOrMax(src1, src2) --> src1  (in-place)
+ *          ~  if pixd != pixs1,  MinOrMax(src1, src2) --> input pixd
  * 
*/ PIX * @@ -1401,7 +1401,7 @@ PIX *pixd; * Notes: * (1) Scales pixel values to fit maximally within a 32 bpp dest pixd * (2) All color components are scaled with the same factor, based - * on the maximum r,g or b component in the image. This should + * on the maximum r, g or b component in the image. This should * not be used if the 32-bit value is a single number (e.g., a * count in a histogram generated by pixMakeHistoHS()). * (3) Uses a LUT for log scaling. @@ -1502,9 +1502,9 @@ linearScaleRGBVal(l_uint32 sval, { l_uint32 dval; - dval = ((l_uint8)(factor * (sval >> 24) + 0.5) << 24) | - ((l_uint8)(factor * ((sval >> 16) & 0xff) + 0.5) << 16) | - ((l_uint8)(factor * ((sval >> 8) & 0xff) + 0.5) << 8) | + dval = ((l_uint8)(factor * (sval >> 24) + 0.5f) << 24) | + ((l_uint8)(factor * ((sval >> 16) & 0xff) + 0.5f) << 16) | + ((l_uint8)(factor * ((sval >> 8) & 0xff) + 0.5f) << 8) | (sval & 0xff); return dval; } @@ -1536,10 +1536,10 @@ logScaleRGBVal(l_uint32 sval, { l_uint32 dval; - dval = ((l_uint8)(factor * getLogBase2(sval >> 24, tab) + 0.5) << 24) | - ((l_uint8)(factor * getLogBase2(((sval >> 16) & 0xff), tab) + 0.5) + dval = ((l_uint8)(factor * getLogBase2(sval >> 24, tab) + 0.5f) << 24) | + ((l_uint8)(factor * getLogBase2(((sval >> 16) & 0xff), tab) + 0.5f) << 16) | - ((l_uint8)(factor * getLogBase2(((sval >> 8) & 0xff), tab) + 0.5) + ((l_uint8)(factor * getLogBase2(((sval >> 8) & 0xff), tab) + 0.5f) << 8) | (sval & 0xff); return dval; From 18283f8ef7dc9483d522c237a7694e4121ea7e19 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 13 Aug 2023 21:14:16 +0200 Subject: [PATCH 4/7] tweak a few comments for better readability of the documentation --- src/pix3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pix3.c b/src/pix3.c index 29f165107..d46cb0cf8 100644 --- a/src/pix3.c +++ b/src/pix3.c @@ -1767,7 +1767,7 @@ l_int32 w, h; * Notes: * (1) For a binary image, if there are no fg (black) pixels, empty = 1. * (2) For a grayscale image, if all pixels are black (0), empty = 1. - * (3) For an RGB image, if all 4 components in every pixel is 0, + * (3) For an RGB image, if all 4 components in every pixel is 0 (i.e. opaque black), * empty = 1. * (4) For a colormapped image, pixel values are 0. The colormap * is ignored. From 2d672a86741f248026f822a03502646b24a52f91 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2023 13:03:13 +0200 Subject: [PATCH 5/7] comments: some minimal whitespace and typo corrections # Conflicts: # prog/thresholding_demo.c # src/baseline.c --- src/adaptmap.c | 2 +- src/baseline.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/adaptmap.c b/src/adaptmap.c index 6fcf6533e..fce0593fd 100644 --- a/src/adaptmap.c +++ b/src/adaptmap.c @@ -291,7 +291,7 @@ pixBackgroundNormSimple(PIX *pixs, * grayscale version can be used elsewhere. If the input is RGB * and this is not supplied, it is made internally using only * the green component, and destroyed after use. - * (6) The dimensions of the pixel tile (%sx, %sy) give the amount by + * (6) The dimensions of the pixel tile (%sx, %sy) give the amount * by which the map is reduced in size from the input image. * (7) The input image is binarized using %thresh, in order to * locate the foreground components. If this is set too low, diff --git a/src/baseline.c b/src/baseline.c index 46bde2c05..3d452ebc5 100644 --- a/src/baseline.c +++ b/src/baseline.c @@ -54,7 +54,7 @@ #include #include "allheaders.h" - /* Min to travel after finding max before abandoning peak */ + /* Minimum distance to travel after finding max before abandoning peak */ static const l_int32 MinDistInPeak = 35; /* Thresholds for peaks and zeros, relative to the max peak */ @@ -65,8 +65,8 @@ static const l_int32 ZeroThresholdRatio = 100; static const l_int32 DefaultSlices = 10; static const l_int32 DefaultSweepReduction = 2; static const l_int32 DefaultBsReduction = 1; -static const l_float32 DefaultSweepRange = 5.; /* degrees */ -static const l_float32 DefaultSweepDelta = 1.; /* degrees */ +static const l_float32 DefaultSweepRange = 5.; /* degrees */ +static const l_float32 DefaultSweepDelta = 1.; /* degrees */ static const l_float32 DefaultMinbsDelta = 0.01; /* degrees */ /* Overlap slice fraction added to top and bottom of each slice */ From 0630bff18b36f1793f6dabe8efa05821e7424a47 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2023 18:20:36 +0200 Subject: [PATCH 6/7] comments: some minimal whitespace and typo corrections --- src/numafunc1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numafunc1.c b/src/numafunc1.c index 3bd44d274..e7f27dad9 100644 --- a/src/numafunc1.c +++ b/src/numafunc1.c @@ -1415,7 +1415,7 @@ NUMA *nad; * *
  * Notes:
- *      (1) For each edge interval, where where the value is less
+ *      (1) For each edge interval, where the value is less
  *          than %thresh1 on one side, greater than %thresh2 on
  *          the other, and between these thresholds throughout the
  *          interval, this records a triplet of values: the

From 5d467b4d5ba0db5e35c90e2fe94b5b178c360b56 Mon Sep 17 00:00:00 2001
From: Ger Hobbelt 
Date: Thu, 24 Aug 2023 13:44:05 +0200
Subject: [PATCH 7/7] additional comment fixes.

---
 src/pix3.c | 2 +-
 src/rop.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pix3.c b/src/pix3.c
index d46cb0cf8..45ca41cce 100644
--- a/src/pix3.c
+++ b/src/pix3.c
@@ -1507,7 +1507,7 @@ pixInvert(PIX  *pixd,
  * 
  * Notes:
  *      (1) This gives the union of two images with equal depth,
- *          aligning them to the the UL corner.  pixs1 and pixs2
+ *          aligning them to the UL corner.  pixs1 and pixs2
  *          need not have the same width and height.
  *      (2) There are 3 cases:
  *            (a) pixd == null,   (src1 | src2) --> new pixd
diff --git a/src/rop.c b/src/rop.c
index e89be5701..27a6606e4 100644
--- a/src/rop.c
+++ b/src/rop.c
@@ -100,7 +100,7 @@ static l_int32 checkRasteropCrop(l_int32 pixw, l_int32 pixh, l_int32 dx,
  *  Three, PIX_CLR, PIX_SET, and PIX_NOT(PIX_DST) operate only on the dest.
  *  These are handled by the low-level rasteropUniLow().
  *
- *  The other 14 involve the both the src and the dest, and depend on
+ *  The other 14 involve both the src and the dest, and depend on
  *  the bit values of either just the src or the bit values of both
  *  src and dest.  They are handled by rasteropLow():
  *