Skip to content

Commit

Permalink
perf: improved black crushing behavior for linear mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Apr 7, 2021
1 parent c5ce2d4 commit 1ad2408
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 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.47 2021/04/07 21:13:52 greg Exp $";
static const char RCSid[] = "$Id: tonemap.c,v 3.48 2021/04/07 23:12:19 greg Exp $";
#endif
/*
* Tone mapping functions.
Expand Down Expand Up @@ -439,9 +439,11 @@ double Lddyn
for (i = tms->mbrmax-tms->mbrmin+1; i--; ) {
double d;
d = expmult/tms->inpsf * tmLuminance(tms->mbrmin + i);
if (d <= minD)
break; /* map initialized to zeroes */
d = (d - minD)/(1. - minD);
if (d >= 2.*minD)
d -= minD;
else /* soft black crushing */
d *= d/(4.*minD);
d /= 1. - minD;
d = TM_BRES*pow(d, 1./gamval);
tms->lumap[i] = (d > maxV) ? maxV : (int)d;
}
Expand Down

0 comments on commit 1ad2408

Please sign in to comment.