ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/tonemap.c
(Generate patch)

Comparing ray/src/common/tonemap.c (file contents):
Revision 3.50 by greg, Tue Apr 13 02:42:31 2021 UTC vs.
Revision 3.52 by greg, Wed May 26 17:50:26 2021 UTC

# Line 160 | Line 160 | TMstruct       *tms
160          if (tms == NULL || tms->histo == NULL)
161                  return;
162          free(tms->histo);
163 +        tms->hbrmin = 10; tms->hbrmax = -10;
164          tms->histo = NULL;
165   }
166  
# Line 343 | Line 344 | int    wt
344   {
345          static const char funcName[] = "tmAddHisto";
346          int     oldorig=0, oldlen, horig, hlen;
347 <        int     i, j;
347 >        int     i;
348  
349          if (tms == NULL)
350                  returnErr(TM_E_TMINVAL);
# Line 364 | Line 365 | int    wt
365                  oldlen = HISTI(tms->hbrmax) + 1 - oldorig;
366          }
367          for (i = len; i--; ) {
368 <                if ((j = ls[i]) < MINBRT)
368 >                if (ls[i] < MINBRT)
369                          continue;
370 <                if (j < tms->hbrmin)
371 <                        tms->hbrmin = j;
372 <                else if (j > tms->hbrmax)
373 <                        tms->hbrmax = j;
370 >                if (ls[i] < tms->hbrmin)
371 >                        tms->hbrmin = ls[i];
372 >                else if (ls[i] > tms->hbrmax)
373 >                        tms->hbrmax = ls[i];
374          }
375          horig = HISTI(tms->hbrmin);
376          hlen = HISTI(tms->hbrmax) + 1 - horig;
# Line 490 | Line 491 | double Ldmax
491          }
492          if (!histot)
493                  returnErr(TM_E_TMFAIL);
494 <        threshold = histot/40 + 1;
494 >        threshold = histot/500 + 1;
495          Lwavg = tmLuminance( (double)sum / histot );
496                                          /* use linear tone mapping? */
497 <        if (tms->flags & TM_F_LINEAR || threshold < 4 ||
497 >        if (tms->flags & TM_F_LINEAR ||
498                          tms->hbrmax - tms->hbrmin < TM_BRTSCALE*logLddyn)
499                  goto linearmap;
500                                          /* clamp histogram */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines