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.5 by gwlarson, Tue Oct 27 09:08:27 1998 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 34 | Line 34 | int  doflat = -1;                      /* produce flat file? */
34   char  *progname;
35  
36  
37 + int
38   headline(s)                             /* process header line */
39   char    *s;
40   {
# Line 46 | Line 47 | char   *s;
47                          rgbinp = 0;
48                  else
49                          rgbinp = -2;
50 <                return;                 /* don't echo */
50 >                return(0);              /* don't echo */
51          }
52          if (isprims(s)) {               /* get input primaries */
53                  primsval(inprims, s);
54 <                return;                 /* don't echo */
54 >                return(0);              /* don't echo */
55          }
56                                          /* should I grok colcorr also? */
57 <        fputs(s, stdout);
57 >        return(fputs(s, stdout));
58   }
59  
60  
# Line 125 | Line 126 | char  *argv[];
126          if (rgbinp == -1)
127                  rgbinp = !rgbout;
128          printargs(argc, argv, stdout);          /* add to header */
128        if (expcomp < 0.99 || expcomp > 1.01)
129                fputexpos(expcomp, stdout);
129          convert();                              /* convert picture */
130          exit(0);
131   userr:
# Line 154 | Line 153 | convert()                              /* convert to XYZE or RGBE picture */
153          COLORMAT        xfm;
154          register COLOR  *scanin;
155          register COLR   *scanout;
156 +        double  ourexp = expcomp;
157          int     y;
158          register int    x;
159                                                  /* compute transform */
160          if (rgbout) {
161                double  mult;
161                  if (rgbinp) {                   /* RGBE -> RGBE */
162                          comprgb2rgbmat(xfm, inprims, outprims);
164                        mult = expcomp;
163                  } else {                        /* XYZE -> RGBE */
164                          compxyz2rgbmat(xfm, outprims);
165 <                        mult = expcomp/WHTEFFICACY;
165 >                        ourexp *= WHTEFFICACY;
166                  }
169                for (y = 0; y < 3; y++)
170                        for (x = 0; x < 3; x++)
171                                xfm[y][x] *= mult;
167          } else {
168                  if (rgbinp) {                   /* RGBE -> XYZE */
169                          comprgb2xyzmat(xfm, inprims);
170 <                        for (y = 0; y < 3; y++)
176 <                                for (x = 0; x < 3; x++)
177 <                                        xfm[y][x] *= WHTEFFICACY*expcomp;
170 >                        ourexp /= WHTEFFICACY;
171                  } else {                        /* XYZE -> XYZE */
172                          for (y = 0; y < 3; y++)
173                                  for (x = 0; x < 3; x++)
174 <                                        xfm[y][x] = x==y ? expcomp : 0.;
174 >                                        xfm[y][x] = x==y ? 1. : 0.;
175                  }
176          }
177 +        for (y = 0; y < 3; y++)
178 +                for (x = 0; x < 3; x++)
179 +                        xfm[y][x] *= expcomp;
180                                                  /* get input resolution */
181          if ((order = fgetresolu(&xmax, &ymax, stdin)) < 0)
182                  quiterr("bad picture format");
183                                                  /* complete output header */
184 +        if (ourexp < 0.99 || ourexp > 1.01)
185 +                fputexpos(ourexp, stdout);
186          if (rgbout) {
187                  fputprims(outprims, stdout);
188                  fputformat(COLRFMT, stdout);
# Line 201 | Line 199 | convert()                              /* convert to XYZE or RGBE picture */
199          for (y = 0; y < ymax; y++) {
200                  if (freadscan(scanin, xmax, stdin) < 0)
201                          quiterr("error reading input picture");
202 <                for (x = 0; x < xmax; x++)
202 >                for (x = 0; x < xmax; x++) {
203                          colortrans(scanin[x], xfm, scanin[x]);
204 +                        if (rgbout)
205 +                                clipgamut(scanin[x], bright(scanin[x]),
206 +                                                CGAMUT_LOWER, cblack, cwhite);
207 +                }
208                  if (scanout != NULL) {
209                          for (x = 0; x < xmax; x++)
210                                  setcolr(scanout[x], colval(scanin[x],RED),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines