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

Comparing ray/src/px/pcond2.c (file contents):
Revision 3.14 by greg, Sun Nov 14 16:57:18 2004 UTC vs.
Revision 3.17 by greg, Thu Sep 8 22:29:47 2005 UTC

# Line 139 | Line 139 | sfscan(                        /* apply scalefactor to scanline */
139   }
140  
141  
142 + static double
143 + greypoint(                      /* compute gamut mapping grey target */
144 +        COLOR col
145 + )
146 + {
147 +        COLOR   gryc;
148 +        int     i;
149 +                                /* improves saturated color rendering */
150 +        copycolor(gryc, col);
151 +        for (i = 3; i--; )
152 +                if (gryc[i] > 1)
153 +                        gryc[i] = 1;
154 +                else if (gryc[i] < 0)
155 +                        gryc[i] = 0;
156 +        return(bright(gryc));
157 + }
158 +
159 +
160   static void
161   matscan(                        /* apply color matrix to scaline */
162          register COLOR  *sl,
# Line 148 | Line 166 | matscan(                       /* apply color matrix to scaline */
166   {
167          while (len--) {
168                  colortrans(sl[0], mat, sl[0]);
169 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite);
169 >                clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite);
170                  sl++;
171          }
172   }
# Line 166 | Line 184 | mbscan(                        /* apply macbethcal adj. to scaline */
184  
185          while (len--) {
186                  colortrans(sl[0], mb->cmat, sl[0]);
187 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, mb->cmin, mb->cmax);
187 >                clipgamut(sl[0], greypoint(sl[0]), CGAMUT, mb->cmin, mb->cmax);
188                  for (i = 0; i < 3; i++) {
189                          d = colval(sl[0],i);
190                          for (j = 0; j < 4 && mb->xa[i][j+1] <= d; j++)
# Line 198 | Line 216 | cwscan(                        /* apply color space warp to scaline */
216                                          progname, cwarpfile);
217                          exit(1);
218                  }
219 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite);
219 >                clipgamut(sl[0], greypoint(sl[0]), CGAMUT, cblack, cwhite);
220                  sl++;
221          }
222   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines