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.13 by greg, Mon Nov 8 15:50:59 2004 UTC vs.
Revision 3.16 by greg, Thu Sep 8 21:16:44 2005 UTC

# Line 115 | Line 115 | firstscan(void)                                /* return first processed scanline
115                          comprgb2rgbWBmat(mbcond.cmat, inprims, outprims);
116                  else
117                          compxyz2rgbWBmat(mbcond.cmat, outprims);
118 <        if (what2do&DO_ACUITY && !initacuity()) {
119 <                fprintf(stderr, "%s: warning - cannot initialize acuity pass\n",
120 <                                progname);
121 <                what2do &= ~DO_ACUITY;
122 <        }
118 >        if (what2do&DO_ACUITY)
119 >                initacuity();
120          scanbuf = (COLOR *)malloc(scanlen(&inpres)*sizeof(COLOR));
121          if (scanbuf == NULL)
122                  syserror("malloc");
# Line 142 | 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((*lumf)(gryc,0));
157 + }
158 +
159 +
160   static void
161   matscan(                        /* apply color matrix to scaline */
162          register COLOR  *sl,
# Line 149 | 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 168 | 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 191 | 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 201 | 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