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.50 by greg, Fri May 4 23:56:49 2018 UTC vs.
Revision 2.56 by greg, Mon Nov 20 21:44:29 2023 UTC

# Line 31 | Line 31 | struct {
31  
32   int     nfiles;                         /* number of input files */
33  
34 < VIEW    commvw;                         /* common view parameters */
34 > VIEW    *commvp = NULL;                 /* common view parameters */
35  
36 < char    ourfmt[LPICFMT+1] = PICFMT;     /* input picture format */
36 > char    ourfmt[MAXFMTLEN] = PICFMT;     /* input picture format */
37  
38   char    StandardInput[] = "<stdin>";
39   char    Command[] = "<Command>";
# 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 233 | Line 224 | main(
224          }
225                                                  /* complete header */
226          printargs(argc, argv, stdout);
227 <        if (commvw.type) {
227 >        if (commvp != NULL) {
228                  fputs(VIEWSTR, stdout);
229 <                fprintview(&commvw, stdout);
229 >                fprintview(commvp, stdout);
230                  fputc('\n', stdout);
231          }
232          if (strcmp(ourfmt, PICFMT))
# Line 261 | Line 252 | headline(                      /* check header line & echo if requested *
252          void    *p
253   )
254   {
255 <        char    fmt[32];
255 >        int     orig = *(int *)p;
256 >        char    fmt[MAXFMTLEN];
257          double  d;
258          COLOR   ctmp;
259  
# 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))
289 >        }
290 >        if (isaspect(s))
291                  input[nfiles].pa *= aspectval(s);
292          else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0)
293                  gotview++;
# Line 295 | Line 301 | headline(                      /* check header line & echo if requested *
301  
302  
303   static void
304 < checkfile(void)                 /* ready a file */
304 > checkfile(int orig)                     /* ready a file */
305   {
306          int     i;
307                                          /* process header */
# Line 304 | Line 310 | checkfile(void)                        /* ready a file */
310                  fputs(input[nfiles].name, stdout);
311                  fputs(":\n", stdout);
312          }
313 <        getheader(input[nfiles].fp, headline, NULL);
313 >        getheader(input[nfiles].fp, headline, &orig);
314          if (wrongformat < 0) {
315                  eputs(input[nfiles].name);
316                  eputs(": not a Radiance picture\n");
# Line 316 | Line 322 | checkfile(void)                        /* ready a file */
322          }
323          if (!gotview || setview(&input[nfiles].vw) != NULL)
324                  input[nfiles].vw.type = 0;
325 <        else if (!commvw.type)
326 <                commvw = input[nfiles].vw;
325 >        else if (commvp == NULL)
326 >                commvp = &input[nfiles].vw;
327          if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) {
328                  eputs(input[nfiles].name);
329                  eputs(": bad picture size\n");
# Line 675 | Line 681 | l_psize(char *nm)              /* compute pixel size in steradians
681  
682  
683   extern void
684 < wputs(char      *msg)
684 > wputs(const char *msg)
685   {
686          if (!nowarn)
687                  eputs(msg);
# Line 683 | Line 689 | wputs(char     *msg)
689  
690  
691   extern void
692 < eputs(char *msg)
692 > eputs(const char *msg)
693   {
694          fputs(msg, stderr);
695   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines