diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-02-11 02:58:01 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2010-02-11 02:58:01 +0000 |
commit | 1eeb51dabc467b999332a156b9c045a6d8426fba (patch) | |
tree | 86f2d900510aa50c4310b1f9272beee3fefd5e90 /analyzer | |
parent | 234a5b352f8b13677903701971c2de63a2a4ca75 (diff) | |
download | netpbm-mirror-1eeb51dabc467b999332a156b9c045a6d8426fba.tar.gz netpbm-mirror-1eeb51dabc467b999332a156b9c045a6d8426fba.tar.xz netpbm-mirror-1eeb51dabc467b999332a156b9c045a6d8426fba.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1125 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer')
-rw-r--r-- | analyzer/pnmhistmap.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/analyzer/pnmhistmap.c b/analyzer/pnmhistmap.c index 4369c8d5..1de0f9c5 100644 --- a/analyzer/pnmhistmap.c +++ b/analyzer/pnmhistmap.c @@ -210,7 +210,7 @@ pgmHist(FILE * const ifP, for (j = cols-1; j >= 0; --j) { int const value = grayrow[j]; - if (value >= startval && value <= endval) + if (value >= startval && value < endval) ++ghist[SCALE_H(value-startval)]; } } @@ -323,9 +323,9 @@ countComp(xelval const value, unsigned int const histWidth, unsigned int * const hist) { - double const hscale = (float)histWidth / (endval - startval + 1); + double const hscale = (float)histWidth / (endval - startval); - if (value >= startval && value <= endval) { + if (value >= startval && value < endval) { unsigned int const bin = ROUNDU((value-startval) * hscale); assert(bin < histWidth); ++hist[bin]; @@ -347,10 +347,10 @@ fillPpmBins(FILE * const ifP, unsigned int const histWidth, unsigned int ** const hist) { /*---------------------------------------------------------------------------- - For each wanted color component, given by colorWanted[], - hist[color] is the histogram. Each histogram as 'histWidth' bins; - we ignore color component values less than 'startval' and greater - than 'endval' and spread the rest evenly across the 'histWidth' bins. + For each wanted color component, given by colorWanted[], hist[color] is the + histogram. Each histogram as 'histWidth' bins; we ignore color component + values less than 'startval' and greater than or equal to 'endval' and + spread the rest evenly across the 'histWidth' bins. We get the color component values from the PNM image on *ifP, which is positioned to the raster, whose format is described @@ -501,9 +501,9 @@ main(int argc, const char ** argv) { pnm_readpnminit(ifP, &cols, &rows, &maxval, &format); startval = cmdline.lval; - endval = MIN(maxval, cmdline.rval); + endval = MIN(maxval, cmdline.rval) + 1; - range = endval - startval + 1; + range = endval - startval; if (cmdline.widthSpec) histWidth = cmdline.width; |