From c1e257f94b0efa193cc3b2f42892e234c0a37cbc Mon Sep 17 00:00:00 2001 From: "Gregory J. Ward" Date: Wed, 26 May 2021 17:50:26 +0000 Subject: [PATCH] fix: corner case where much of histogram gets truncated --- src/common/tonemap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/tonemap.c b/src/common/tonemap.c index 87d60ab4..b3a84eb7 100644 --- a/src/common/tonemap.c +++ b/src/common/tonemap.c @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tonemap.c,v 3.51 2021/05/04 21:50:54 greg Exp $"; +static const char RCSid[] = "$Id: tonemap.c,v 3.52 2021/05/26 17:50:26 greg Exp $"; #endif /* * Tone mapping functions. @@ -491,10 +491,10 @@ double Ldmax } if (!histot) returnErr(TM_E_TMFAIL); - threshold = histot/40 + 1; + threshold = histot/500 + 1; Lwavg = tmLuminance( (double)sum / histot ); /* use linear tone mapping? */ - if (tms->flags & TM_F_LINEAR || threshold < 4 || + if (tms->flags & TM_F_LINEAR || tms->hbrmax - tms->hbrmin < TM_BRTSCALE*logLddyn) goto linearmap; /* clamp histogram */