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

Comparing ray/src/px/pcomb.c (file contents):
Revision 2.52 by greg, Wed Apr 3 20:16:31 2019 UTC vs.
Revision 2.53 by greg, Fri Mar 18 18:31:47 2022 UTC

# Line 76 | Line 76 | int    gotview;
76  
77  
78   static gethfunc headline;
79 < static void checkfile(void);
79 > static void checkfile(int orig);
80   static double rgb_bright(COLOR  clr);
81   static double xyz_bright(COLOR  clr);
82   static void init(void);
# Line 177 | Line 177 | main(
177                                  quit(1);
178                          }
179                  }
180 <                checkfile();
181 <                if (original) {
182 <                        colval(input[nfiles].coef,RED) /=
183 <                                        colval(input[nfiles].expos,RED);
184 <                        colval(input[nfiles].coef,GRN) /=
185 <                                        colval(input[nfiles].expos,GRN);
186 <                        colval(input[nfiles].coef,BLU) /=
187 <                                        colval(input[nfiles].expos,BLU);
188 <                        setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
189 <                }
180 >                checkfile(original);
181                  nfiles++;
182                  original = 0;
183          }
# Line 261 | Line 252 | headline(                      /* check header line & echo if requested *
252          void    *p
253   )
254   {
255 +        int     orig = *(int *)p;
256          char    fmt[MAXFMTLEN];
257          double  d;
258          COLOR   ctmp;
# Line 275 | Line 267 | headline(                      /* check header line & echo if requested *
267                          wrongformat = globmatch(PICFMT, fmt) ? 1 : -1;
268                  return(0);      /* don't echo */
269          }
270 <        if (isexpos(s)) {                       /* exposure */
270 >        if (orig) {                             /* undo exposure? */
271 >                if (isexpos(s)) {
272 >                        d = 1./exposval(s);
273 >                        scalecolor(input[nfiles].coef, d);
274 >                        return(0);      /* don't echo */
275 >                }
276 >                if (iscolcor(s)) {
277 >                        int     i;
278 >                        colcorval(ctmp, s);
279 >                        for (i = 3; i--; )
280 >                                colval(input[nfiles].coef,i) /= colval(ctmp,i);
281 >                        return(0);      /* don't echo */
282 >                }
283 >        } else if (isexpos(s)) {                /* record exposure? */
284                  d = exposval(s);
285                  scalecolor(input[nfiles].expos, d);
286 <        } else if (iscolcor(s)) {               /* color correction */
286 >        } else if (iscolcor(s)) {
287                  colcorval(ctmp, s);
288                  multcolor(input[nfiles].expos, ctmp);
289          } else if (isaspect(s))
# Line 295 | Line 300 | headline(                      /* check header line & echo if requested *
300  
301  
302   static void
303 < checkfile(void)                 /* ready a file */
303 > checkfile(int orig)                     /* ready a file */
304   {
305          int     i;
306                                          /* process header */
# Line 304 | Line 309 | checkfile(void)                        /* ready a file */
309                  fputs(input[nfiles].name, stdout);
310                  fputs(":\n", stdout);
311          }
312 <        getheader(input[nfiles].fp, headline, NULL);
312 >        getheader(input[nfiles].fp, headline, &orig);
313          if (wrongformat < 0) {
314                  eputs(input[nfiles].name);
315                  eputs(": not a Radiance picture\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines