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.28 by greg, Wed Aug 9 16:26:54 2006 UTC vs.
Revision 3.29 by greg, Wed May 23 21:38:50 2007 UTC

# Line 507 | Line 507 | double Ldmax
507                  sum += (j -= HISTEP) * tms->histo[i];
508          }
509          threshold = histot*0.005 + .5;
510 <        if (threshold < 4)
510 >        if (!histot)
511                  returnErr(TM_E_TMFAIL);
512          Lwavg = tmLuminance( (double)sum / histot );
513 +                                        /* use linear tone mapping? */
514 +        if (tms->flags & TM_F_LINEAR || threshold < 4)
515 +                goto linearmap;
516                                          /* allocate space for mapping */
517          if (!tmNewMap(tms))
518                  returnErr(TM_E_NOMEM);
516                                        /* use linear tone mapping? */
517        if (tms->flags & TM_F_LINEAR)
518                goto linearmap;
519                                          /* clamp histogram */
520          histo = (int *)malloc(histlen*sizeof(int));
521          cumf = (float *)malloc((histlen+2)*sizeof(float));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines