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.15 by greg, Thu Sep 8 19:08:52 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] > cwhite[i])
153 +                        gryc[i] = cwhite[i];
154 +                else if (gryc[i] < cblack[i])
155 +                        gryc[i] = cblack[i];
156 +        return(bright(gryc));
157 + }
158 +
159 +
160   static void
161   matscan(                        /* apply color matrix to scaline */
162          register COLOR  *sl,
# Line 146 | Line 164 | matscan(                       /* apply color matrix to scaline */
164          COLORMAT        mat
165   )
166   {
167 +        double  gryv;
168 +
169          while (len--) {
170 +                gryv = greypoint(sl[0]);
171                  colortrans(sl[0], mat, sl[0]);
172 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite);
172 >                clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite);
173                  sl++;
174          }
175   }
# Line 165 | Line 186 | mbscan(                        /* apply macbethcal adj. to scaline */
186          register int    i, j;
187  
188          while (len--) {
189 +                d = greypoint(sl[0]);
190                  colortrans(sl[0], mb->cmat, sl[0]);
191 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, mb->cmin, mb->cmax);
191 >                clipgamut(sl[0], d, CGAMUT, mb->cmin, mb->cmax);
192                  for (i = 0; i < 3; i++) {
193                          d = colval(sl[0],i);
194                          for (j = 0; j < 4 && mb->xa[i][j+1] <= d; j++)
# Line 188 | Line 210 | cwscan(                        /* apply color space warp to scaline */
210   )
211   {
212          int     rval;
213 +        double  gryv;
214  
215          while (len--) {
216 +                gryv = greypoint(sl[0]);
217                  rval = warp3d(sl[0], sl[0], wp);
218                  if (rval & W3ERROR)
219                          syserror("warp3d");
# Line 198 | Line 222 | cwscan(                        /* apply color space warp to scaline */
222                                          progname, cwarpfile);
223                          exit(1);
224                  }
225 <                clipgamut(sl[0], bright(sl[0]), CGAMUT, cblack, cwhite);
225 >                clipgamut(sl[0], gryv, CGAMUT, cblack, cwhite);
226                  sl++;
227          }
228   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines