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

Comparing ray/src/px/pcond.c (file contents):
Revision 3.9 by greg, Wed Jan 29 13:22:08 1997 UTC vs.
Revision 3.13 by gwlarson, Tue Oct 27 09:08:26 1998 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13  
14   #define LDMAX           100             /* default max. display luminance */
15 < #define LDMINF          0.01            /* default min. display lum. factor */
15 > #define LDDYN           32              /* default dynamic range */
16  
17   int     what2do = 0;                    /* desired adjustments */
18  
19   double  ldmax = LDMAX;                  /* maximum output luminance */
20 < double  ldmin = 0.;                     /* minimum output luminance */
21 < double  Bldmin, Bldmax;                 /* Bl(ldmin) and Bl(ldmax) */
20 > double  lddyn = LDDYN;                  /* display dynamic range */
21 > double  Bldmin, Bldmax;                 /* Bl(ldmax/lddyn) and Bl(ldmax) */
22  
23   char    *progname;                      /* global argv[0] */
24  
# Line 85 | Line 85 | char   *argv[];
85                          if (fixfrac > FTINY) what2do |= DO_FIXHIST;
86                          else what2do &= ~DO_FIXHIST;
87                          break;
88 +                case 'I':
89 +                        bool(DO_PREHIST);
90 +                        break;
91                  case 'l':
92                          bool(DO_LINEAR);
93                          break;
# Line 111 | Line 114 | char   *argv[];
114                          if (i+1 >= argc) goto userr;
115                          mbcalfile = argv[++i];
116                          break;
117 <                case 't':
117 >                case 'm':
118                          if (i+1 >= argc) goto userr;
119 +                        cwarpfile = argv[++i];
120 +                        break;
121 +                case 'u':
122 +                        if (i+1 >= argc) goto userr;
123                          ldmax = atof(argv[++i]);
124                          if (ldmax <= FTINY)
125                                  goto userr;
126                          break;
127 <                case 'b':
127 >                case 'd':
128                          if (i+1 >= argc) goto userr;
129 <                        ldmin = atof(argv[++i]);
129 >                        lddyn = atof(argv[++i]);
130                          break;
131 <                case 'm':
131 >                case 'x':
132                          if (i+1 >= argc) goto userr;
133                          if ((mapfp = fopen(argv[++i], "w")) == NULL) {
134                                  fprintf(stderr,
# Line 133 | Line 140 | char   *argv[];
140                  default:
141                          goto userr;
142                  }
143 <        if (mbcalfile != NULL & outprims != stdprims) {
144 <                fprintf(stderr, "%s: only one of -p or -f option supported\n",
143 >        if ((what2do & (DO_FIXHIST|DO_PREHIST)) == (DO_FIXHIST|DO_PREHIST)) {
144 >                fprintf(stderr, "%s: only one of -i or -I option\n", progname);
145 >                exit(1);
146 >        }
147 >        if ((mbcalfile != NULL) + (cwarpfile != NULL) +
148 >                        (outprims != stdprims) > 1) {
149 >                fprintf(stderr,
150 >                        "%s: only one of -p, -m or -f option supported\n",
151                                  progname);
152                  exit(1);
153          }
154          if (outprims == stdprims & inprims != stdprims)
155                  outprims = inprims;
156 <        if (ldmin <= FTINY)
144 <                ldmin = ldmax*LDMINF;
145 <        else if (ldmin >= ldmax) {
146 <                fprintf(stderr, "%s: Ldmin (%f) >= Ldmax (%f)!\n", progname,
147 <                                ldmin, ldmax);
148 <                exit(1);
149 <        }
150 <        Bldmin = Bl(ldmin);
156 >        Bldmin = Bl(ldmax/lddyn);
157          Bldmax = Bl(ldmax);
158          if (i >= argc || i+2 < argc)
159                  goto userr;
# Line 165 | Line 171 | char   *argv[];
171          printargs(argc, argv, stdout);  /* add to output header */
172          if (mbcalfile == NULL & outprims != stdprims)
173                  fputprims(outprims, stdout);
174 <        getfovimg();                    /* get foveal sample image */
175 <        if (what2do&DO_FIXHIST)         /* get fixation history? */
174 >        if ((what2do & (DO_PREHIST|DO_VEIL|DO_ACUITY)) != DO_PREHIST)
175 >                getfovimg();            /* get foveal sample image? */
176 >        if (what2do&DO_PREHIST)         /* get histogram? */
177 >                gethisto(stdin);
178 >        else if (what2do&DO_FIXHIST)    /* get fixation history? */
179                  getfixations(stdin);
180          mapimage();                     /* map the picture */
181          if (mapfp != NULL)              /* write out basic mapping */
182                  putmapping(mapfp);
183          exit(0);
184   userr:
185 <        fprintf(stderr, "Usage: %s [-{h|a|v|s|c|l|w}[+-]][-i ffrac][-e ev][-p xr yr xg yg xb yb xw yw|-f mbf.cal][-t Ldmax][-b Ldmin][-m mapfile] inpic [outpic]\n",
185 >        fprintf(stderr, "Usage: %s [-{h|a|v|s|c|l|w}[+-]][-I|-i ffrac][-e ev][-p xr yr xg yg xb yb xw yw|-f mbf.cal|-m rgb.cwp][-u Ldmax][-d Lddyn][-x mapfile] inpic [outpic]\n",
186                          progname);
187          exit(1);
188   #undef bool
# Line 199 | Line 208 | char   *s;
208                  if (!strcmp(fmt,COLRFMT)) lumf = rgblum;
209                  else if (!strcmp(fmt,CIEFMT)) lumf = cielum;
210                  else lumf = NULL;
211 <                return;                 /* don't echo */
211 >                return(0);              /* don't echo */
212          }
213          if (isprims(s)) {               /* get input primaries */
214                  primsval(inprimS, s);
215                  inprims= inprimS;
216 <                return;                 /* don't echo */
216 >                return(0);              /* don't echo */
217          }
218          if (isexpos(s)) {               /* picture exposure */
219                  inpexp *= exposval(s);
220 <                return;                 /* don't echo */
220 >                return(0);              /* don't echo */
221          }
222          if (isaspect(s))                /* pixel aspect ratio */
223                  pixaspect *= aspectval(s);
224          if (isview(s))                  /* image view */
225                  gotview += sscanview(&ourview, s);
226 <        fputs(s, stdout);
226 >        return(fputs(s, stdout));
227   }
228  
229  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines