diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-09-28 19:34:22 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-09-28 19:34:22 +0000 |
commit | 860faaae6a58e83623b9620dc0e0f36f3126b251 (patch) | |
tree | e09259abd808ac7e9a4c2494e1ccefa0d08ef991 /analyzer | |
parent | 2b499210eb2a64c95e6891a8d361b38a8502e063 (diff) | |
download | netpbm-mirror-860faaae6a58e83623b9620dc0e0f36f3126b251.tar.gz netpbm-mirror-860faaae6a58e83623b9620dc0e0f36f3126b251.tar.xz netpbm-mirror-860faaae6a58e83623b9620dc0e0f36f3126b251.zip |
Promote Development to Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3691 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer')
-rw-r--r-- | analyzer/pamsumm.c | 4 | ||||
-rw-r--r-- | analyzer/ppmhist.c | 44 |
2 files changed, 27 insertions, 21 deletions
diff --git a/analyzer/pamsumm.c b/analyzer/pamsumm.c index 9b74e789..03ff6749 100644 --- a/analyzer/pamsumm.c +++ b/analyzer/pamsumm.c @@ -58,8 +58,8 @@ parseCommandLine(int argc, const char ** const argv, pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ - if (sumSpec + minSpec + maxSpec > 1) - pm_error("You may specify at most one of -sum, -min, and -max"); + if (sumSpec + minSpec + maxSpec + meanSpec > 1) + pm_error("You may specify at most one of -sum, -min, -max, and -mean"); if (sumSpec) { cmdlineP->function = FN_ADD; diff --git a/analyzer/ppmhist.c b/analyzer/ppmhist.c index c4ab3581..62345fa1 100644 --- a/analyzer/ppmhist.c +++ b/analyzer/ppmhist.c @@ -120,25 +120,6 @@ cmpUint(unsigned int const a, #ifndef LITERAL_FN_DEF_MATCH -static qsort_comparison_fn countcompare; -#endif - - -static int -countcompare(const void * const a, - const void * const b) { -/*---------------------------------------------------------------------------- - This is a 'qsort' collation function. ------------------------------------------------------------------------------*/ - const struct colorhist_item * const histItem1P = a; - const struct colorhist_item * const histItem2P = b; - - return cmpUint(histItem2P->value, histItem1P->value); -} - - - -#ifndef LITERAL_FN_DEF_MATCH static qsort_comparison_fn rgbcompare; #endif @@ -167,6 +148,31 @@ rgbcompare(const void * const a, +#ifndef LITERAL_FN_DEF_MATCH +static qsort_comparison_fn countcompare; +#endif + + +static int +countcompare(const void * const a, + const void * const b) { +/*---------------------------------------------------------------------------- + This is a 'qsort' collation function. +-----------------------------------------------------------------------------*/ + const struct colorhist_item * const histItem1P = a; + const struct colorhist_item * const histItem2P = b; + + int const countComparison = cmpUint(histItem2P->value, histItem1P->value); + + if (countComparison == 0) { + /* Counts are the same; use RGB secondary sort */ + return rgbcompare(a, b); + } else + return countComparison; +} + + + static pixval universalMaxval(pixval const maxval, int const format) { |