diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-06-28 17:29:32 +0000 |
commit | 23ce26f64c34e30951ad9ade2151552ed77e7357 (patch) | |
tree | d73b31a0c2f7c7be4a69f8a8e84e00dd39c432b5 /analyzer/ppmhist.c | |
parent | 1b6e51a266008348ad93ed8b6ac9ec91b5024fea (diff) | |
download | netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.gz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.tar.xz netpbm-mirror-23ce26f64c34e30951ad9ade2151552ed77e7357.zip |
promote Advanced to Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@4558 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'analyzer/ppmhist.c')
-rw-r--r-- | analyzer/ppmhist.c | 44 |
1 files changed, 25 insertions, 19 deletions
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) { |