Skip to content

Commit

Permalink
fix: corner case where much of histogram gets truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed May 26, 2021
1 parent d51f536 commit c1e257f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/tonemap.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit c1e257f

Please sign in to comment.