diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-09-11 02:38:48 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-09-11 02:38:48 +0000 |
commit | 7bd77004a7a252e5e33309944e04e70dc7fd8c46 (patch) | |
tree | 849a3f7d70929bb58046634ae85725362e8e69d6 | |
parent | dc71766e555f84091dc4cff5f2e7634f52f94bda (diff) | |
download | netpbm-mirror-7bd77004a7a252e5e33309944e04e70dc7fd8c46.tar.gz netpbm-mirror-7bd77004a7a252e5e33309944e04e70dc7fd8c46.tar.xz netpbm-mirror-7bd77004a7a252e5e33309944e04e70dc7fd8c46.zip |
Fast path for local thresholding: don't compute unneeded global stuff
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@53 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | doc/HISTORY | 12 | ||||
-rw-r--r-- | editor/pamthreshold.c | 21 |
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); |