about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY12
-rw-r--r--editor/pamthreshold.c21
2 files changed, 26 insertions, 7 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index bbee700b..e9a64973 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,6 +6,18 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.36.0
 
+              pamthreshold: don't gather global information, and reread
+              file, for local thresholding (to save time, resources).
+              Thanks Erik Auerswald <auerswal@unix-ag.uni-kl.de>.
+
+              Remove some generated files from release so build works.
+
+              Properly clean thinkjettopbm.c with 'make distclean'.
+
+              Fix version number control.
+
+              Remove general history from change file
+
               libnetpbm: BK color matching adjustments, change of
               enum bk_color.  Thanks "Kenan Kalajdzic"
               <kalajdzic@gmail.com>.
diff --git a/editor/pamthreshold.c b/editor/pamthreshold.c
index 40260e79..4caaed9b 100644
--- a/editor/pamthreshold.c
+++ b/editor/pamthreshold.c
@@ -508,9 +508,16 @@ thresholdLocal(struct pam *       const inpamP,
 
     windowHeight = MIN(oddLocalHeight, inpamP->height);
 
-    analyzeDistribution(inpamP, &histogram, &globalRange);
-
-    computeGlobalThreshold(inpamP, histogram, globalRange, &globalThreshold);
+    /* global information is needed for dual thresholding */
+    if (cmdline.dual) {
+        analyzeDistribution(inpamP, &histogram, &globalRange);
+        computeGlobalThreshold(inpamP, histogram, globalRange,
+                               &globalThreshold);
+    } else {
+        histogram = NULL;
+        initRange(&globalRange);
+        globalThreshold = 1.0;
+    }
 
     outrow = pnm_allocpamrow(outpamP);
 
@@ -580,17 +587,17 @@ main(int argc, char **argv) {
 
     parseCommandLine(argc, argv, &cmdline);
 
-    if (cmdline.simple)
+    if (cmdline.simple || cmdline.local)
         ifP = pm_openr(cmdline.inputFileName);
     else
         ifP = pm_openr_seekable(cmdline.inputFileName);
 
-    /* threshold each image in the PAM file */
+    /* Threshold each image in the PAM file */
     eof = FALSE;
     while (!eof) {
         pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type));
 
-        /* set output image parameters for a bilevel image */
+        /* Set output image parameters for a bilevel image */
         outpam.size        = sizeof(outpam);
         outpam.len         = PAM_STRUCT_SIZE(tuple_type);
         outpam.file        = stdout;
@@ -605,7 +612,7 @@ main(int argc, char **argv) {
 
         pnm_writepaminit(&outpam);
 
-        /* do the thresholding */
+        /* Do the thresholding */
 
         if (cmdline.simple)
             thresholdSimple(&inpam, &outpam, cmdline.threshold);