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

Comparing ray/src/common/tonemap.c (file contents):
Revision 3.55 by greg, Thu Nov 21 17:15:54 2024 UTC vs.
Revision 3.56 by greg, Mon Sep 1 07:50:45 2025 UTC

# Line 273 | Line 273 | int    len
273                  for (i = 1024; i--; )
274                          gamtab[i] = (int)(256.*pow((i+.5)/1024., 1./curgam));
275          }
276 +        if (cs != TM_NOCHROM && tms->flags & TM_F_BW) { /* fill B&W chroma */
277 +                int     j = 3;
278 +                while (j--) {
279 +                        const int       pv = (tms->cdiv[j]<<8)/TM_BRES;
280 +                        for (i = len; i--; )
281 +                                cs[3*i + j] = pv;
282 +                }
283 +        }
284          for (i = len; i--; ) {
285                  if (tmNeedMatrix(tms)) {                /* get monitor RGB */
286                          colortrans(cmon, tms->cmat, scan[i]);
# Line 289 | Line 297 | int    len
297                  if (cmon[RED] < .0f) cmon[RED] = .0f;
298                  if (cmon[GRN] < .0f) cmon[GRN] = .0f;
299                  if (cmon[BLU] < .0f) cmon[BLU] = .0f;
300 < #endif
293 <                                                        /* world luminance */
300 > #endif                                                  /* world luminance */
301                  lum =   tms->clf[RED]*cmon[RED] +
302                          tms->clf[GRN]*cmon[GRN] +
303                          tms->clf[BLU]*cmon[BLU] ;
# Line 299 | Line 306 | int    len
306                          ls[i] = TM_NOBRT;
307                  } else
308                          ls[i] = tmCvLumLUfp(&lum);
309 <                if (cs == TM_NOCHROM)                   /* no color? */
310 <                        continue;
309 >                if ((cs == TM_NOCHROM) | (tms->flags & TM_F_BW))
310 >                        continue;                       /* no color */
311                  if (tms->flags & TM_F_MESOPIC && lum < LMESUPPER) {
312                          slum = scotlum(cmon);           /* mesopic adj. */
313                          if (lum < LMESLOWER) {
# Line 317 | Line 324 | int    len
324                                  cmon[GRN] += d;
325                                  cmon[BLU] += d;
326                          }
320                } else if (tms->flags & TM_F_BW) {
321                        int     j = 3;
322                        while (j--) cs[3*i+j] = tms->cdiv[j]/(TM_BRES>>8);
323                        continue;
327                  }
328                  d = tms->clf[RED]*cmon[RED]/lum;
329                  cs[3*i  ] = d>=.999f ? 255 : gamtab[(int)(1024.f*d)];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines