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

Comparing ray/src/px/ra_xyze.c (file contents):
Revision 2.2 by greg, Wed Oct 25 15:13:38 1995 UTC vs.
Revision 2.4 by gregl, Tue Jul 22 10:17:53 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1995 Regents of the University of California */
1 > /* Copyright (c) 1997 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 125 | Line 125 | char  *argv[];
125          if (rgbinp == -1)
126                  rgbinp = !rgbout;
127          printargs(argc, argv, stdout);          /* add to header */
128        if (expcomp < 0.99 || expcomp > 1.01)
129                fputexpos(expcomp, stdout);
128          convert();                              /* convert picture */
129          exit(0);
130   userr:
# Line 154 | Line 152 | convert()                              /* convert to XYZE or RGBE picture */
152          COLORMAT        xfm;
153          register COLOR  *scanin;
154          register COLR   *scanout;
155 +        double  ourexp = expcomp;
156          int     y;
157          register int    x;
158                                                  /* compute transform */
159          if (rgbout) {
161                double  mult;
160                  if (rgbinp) {                   /* RGBE -> RGBE */
161                          comprgb2rgbmat(xfm, inprims, outprims);
164                        mult = expcomp;
162                  } else {                        /* XYZE -> RGBE */
163                          compxyz2rgbmat(xfm, outprims);
164 <                        mult = expcomp/WHTEFFICACY;
164 >                        ourexp *= WHTEFFICACY;
165                  }
169                for (y = 0; y < 3; y++)
170                        for (x = 0; x < 3; x++)
171                                xfm[y][x] *= mult;
166          } else {
167                  if (rgbinp) {                   /* RGBE -> XYZE */
168                          comprgb2xyzmat(xfm, inprims);
169 <                        for (y = 0; y < 3; y++)
176 <                                for (x = 0; x < 3; x++)
177 <                                        xfm[y][x] *= WHTEFFICACY*expcomp;
169 >                        ourexp /= WHTEFFICACY;
170                  } else {                        /* XYZE -> XYZE */
171                          for (y = 0; y < 3; y++)
172                                  for (x = 0; x < 3; x++)
173 <                                        xfm[y][x] = x==y ? expcomp : 0.;
173 >                                        xfm[y][x] = x==y ? 1. : 0.;
174                  }
175          }
176 +        for (y = 0; y < 3; y++)
177 +                for (x = 0; x < 3; x++)
178 +                        xfm[y][x] *= expcomp;
179                                                  /* get input resolution */
180          if ((order = fgetresolu(&xmax, &ymax, stdin)) < 0)
181                  quiterr("bad picture format");
182                                                  /* complete output header */
183 +        if (ourexp < 0.99 || ourexp > 1.01)
184 +                fputexpos(ourexp, stdout);
185          if (rgbout) {
186                  fputprims(outprims, stdout);
187                  fputformat(COLRFMT, stdout);
# Line 201 | Line 198 | convert()                              /* convert to XYZE or RGBE picture */
198          for (y = 0; y < ymax; y++) {
199                  if (freadscan(scanin, xmax, stdin) < 0)
200                          quiterr("error reading input picture");
201 <                for (x = 0; x < xmax; x++)
201 >                for (x = 0; x < xmax; x++) {
202                          colortrans(scanin[x], xfm, scanin[x]);
203 +                        if (rgbout)
204 +                                clipgamut(scanin[x], bright(scanin[x]),
205 +                                                CGAMUT_LOWER, cblack, cwhite);
206 +                }
207                  if (scanout != NULL) {
208                          for (x = 0; x < xmax; x++)
209                                  setcolr(scanout[x], colval(scanin[x],RED),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines