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.11 by greg, Fri Jun 20 00:25:49 2003 UTC vs.
Revision 3.15 by greg, Thu Jul 22 17:48:52 2004 UTC

# Line 43 | Line 43 | double gamval;
43                  return(NULL);
44  
45          tmnew->flags = flags & ~TM_F_UNIMPL;
46 +        if (tmnew->flags & TM_F_BW)
47 +                tmnew->flags &= ~TM_F_MESOPIC;
48                                                  /* set monitor transform */
49          if (monpri == NULL || monpri == stdprims || tmnew->flags & TM_F_BW) {
50                  tmnew->monpri = stdprims;
# Line 162 | Line 164 | COLOR  *scan;
164   int     len;
165   {
166          static char     funcName[] = "tmCvColors";
167 <        static COLOR    csmall = {1e-6, 1e-6, 1e-6};
167 >        static COLOR    csmall = {.5*MINLUM, .5*MINLUM, .5*MINLUM};
168          COLOR   cmon;
169          double  lum, slum;
170          register double d;
# Line 170 | Line 172 | int    len;
172  
173          if (tmTop == NULL)
174                  returnErr(TM_E_TMINVAL);
175 <        if (ls == NULL | scan == NULL | len < 0)
175 >        if ((ls == NULL) | (scan == NULL) | (len < 0))
176                  returnErr(TM_E_ILLEGAL);
177          for (i = len; i--; ) {
178 <                if (tmNeedMatrix(tmTop))                /* get monitor RGB */
178 >                if (tmNeedMatrix(tmTop)) {              /* get monitor RGB */
179                          colortrans(cmon, tmTop->cmat, scan[i]);
180 <                else {
180 >                } else {
181                          cmon[RED] = tmTop->inpsf*scan[i][RED];
182                          cmon[GRN] = tmTop->inpsf*scan[i][GRN];
183                          cmon[BLU] = tmTop->inpsf*scan[i][BLU];
# Line 243 | Line 245 | int    len;
245  
246          if (tmTop == NULL)
247                  returnErr(TM_E_TMINVAL);
248 <        if (ls == NULL | scan == NULL | len < 0)
248 >        if ((ls == NULL) | (scan == NULL) | (len < 0))
249                  returnErr(TM_E_ILLEGAL);
250          for (i = len; i--; )
251                  if (scan[i] <= TM_NOLUM) {
# Line 415 | Line 417 | double Ldmax;
417                  histot += tmTop->histo[i];
418                  sum += (j -= HISTEP) * tmTop->histo[i];
419          }
420 <        threshold = histot*.025 + .5;
420 >        threshold = histot*0.005 + .5;
421          if (threshold < 4)
422                  returnErr(TM_E_TMFAIL);
423          Lwavg = tmLuminance( (double)sum / histot );
# Line 428 | Line 430 | double Ldmax;
430                                          /* clamp histogram */
431          histo = (int *)malloc(histlen*sizeof(int));
432          cumf = (float *)malloc((histlen+2)*sizeof(float));
433 <        if (histo == NULL | cumf == NULL)
433 >        if ((histo == NULL) | (cumf == NULL))
434                  returnErr(TM_E_NOMEM);
435          cumf[histlen+1] = 1.;           /* guard for assignment code */
436          for (i = histlen; i--; )        /* make malleable copy */
# Line 496 | Line 498 | int    len;
498  
499          if (tmTop == NULL || tmTop->lumap == NULL)
500                  returnErr(TM_E_TMINVAL);
501 <        if (ps == NULL | ls == NULL | len < 0)
501 >        if ((ps == NULL) | (ls == NULL) | (len < 0))
502                  returnErr(TM_E_ILLEGAL);
503          while (len--) {
504                  if ((li = *ls++) < tmTop->mbrmin) {
# Line 538 | Line 540 | register struct tmStruct       *tms;
540   {
541          register struct tmStruct        *tms2;
542                                          /* special cases first */
543 <        if (tms == NULL | tmTop == NULL)
543 >        if ((tms == NULL) | (tmTop == NULL))
544                  return(0);
545          if (tms == tmTop) {
546                  tmTop = tms->tmprev;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines