Skip to content

Commit

Permalink
perf: minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Feb 5, 2021
1 parent 3cd72d8 commit e87d63a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 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.42 2021/01/07 20:34:45 greg Exp $";
static const char RCSid[] = "$Id: tonemap.c,v 3.43 2021/02/05 01:07:28 greg Exp $";
#endif
/*
* Tone mapping functions.
Expand Down Expand Up @@ -581,9 +581,13 @@ int len
lv = tms->mbrmax;
li = tms->lumap[lv - tms->mbrmin];
}
if (cs == TM_NOCHROM)
*ps++ = li>=TM_BRES ? 255 : (int)(256*li/TM_BRES);
else {
if (cs == TM_NOCHROM) {
#if !(TM_BRES & 0xff)
*ps++ = li>=TM_BRES ? 255 : li/(TM_BRES>>8);
#else
*ps++ = li>=TM_BRES ? 255 : (li<<8)/TM_BRES;
#endif
} else {
pv = *cs++ * li / tms->cdiv[RED];
*ps++ = pv>255 ? 255 : pv;
pv = *cs++ * li / tms->cdiv[GRN];
Expand Down

0 comments on commit e87d63a

Please sign in to comment.