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

Comparing ray/src/px/normtiff.c (file contents):
Revision 3.5 by greg, Mon Jul 14 04:56:54 2003 UTC vs.
Revision 3.8 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 8 | Line 8 | static const char      RCSid[] = "$Id$";
8   #include <stdio.h>
9   #include <math.h>
10   #include <time.h>
11 + #include <string.h>
12 +
13   #include "tiffio.h"
14   #include "color.h"
15   #include "tonemap.h"
16 + #include "tmaptiff.h"
17   #include "resolu.h"
18  
19  
# Line 40 | Line 43 | typedef struct {
43          RESOLU  rs;             /* picture resolution */
44   } PICTURE;
45  
46 < extern PICTURE  *openpicture();
46 > //extern PICTURE        *openpicture();
47  
48   #define closepicture(p)         (fclose((p)->fp),free((void *)(p)))
49  
50 + static gethfunc headline;
51  
52 < main(argc, argv)
53 < int     argc;
54 < char    *argv[];
52 > static int headline(char        *s, void *pp);
53 > static PICTURE * openpicture(char       *fname);
54 > static int tmap_picture(char    *fname, PICTURE *pp);
55 > static int tmap_tiff(char       *fname, TIFF    *tp);
56 > static int putimage(uint16      or, uint32      xs, uint32      ys, float       xr, float       yr,
57 >        uint16 ru, BYTE *pd);
58 >
59 >
60 > int
61 > main(
62 >        int     argc,
63 >        char    *argv[]
64 > )
65   {
66          PICTURE *pin = NULL;
67          TIFF    *tin = NULL;
# Line 126 | Line 140 | userr:
140   }
141  
142  
143 < int
144 < headline(s, pp)                         /* process line from header */
145 < char    *s;
146 < register PICTURE        *pp;
143 > static int
144 > headline(                               /* process line from header */
145 >        char    *s,
146 >        void *pp
147 > )
148   {
149          register char   *cp;
150  
# Line 137 | Line 152 | register PICTURE       *pp;
152                  if (*cp & 0x80)
153                          return(-1);     /* non-ascii in header */
154          if (isaspect(s))
155 <                pp->pa *= aspectval(s);
155 >                ((PICTURE *)pp)->pa *= aspectval(s);
156          else
157 <                formatval(pp->fmt, s);
157 >                formatval(((PICTURE *)pp)->fmt, s);
158          return(0);
159   }
160  
161  
162 < PICTURE *
163 < openpicture(fname)                      /* open/check Radiance picture file */
164 < char    *fname;
162 > static PICTURE *
163 > openpicture(                    /* open/check Radiance picture file */
164 >        char    *fname
165 > )
166   {
167          FILE    *fp;
168          register PICTURE        *pp;
# Line 170 | Line 186 | char   *fname;
186                  return(NULL);           /* serious error -- should exit? */
187          pp->fp = fp; pp->fmt[0] = '\0'; pp->pa = 1.;
188                                          /* load header */
189 <        if (getheader(fp, headline, (char *)pp) < 0) {
189 >        if (getheader(fp, headline, pp) < 0) {
190                  closepicture(pp);
191                  return(NULL);
192          }
# Line 185 | Line 201 | char   *fname;
201   }
202  
203  
204 < int
205 < tmap_picture(fname, pp)                 /* tone map Radiance picture */
206 < char    *fname;
207 < register PICTURE        *pp;
204 > static int
205 > tmap_picture(                   /* tone map Radiance picture */
206 >        char    *fname,
207 >        register PICTURE        *pp
208 > )
209   {
210          uint16  orient;
211          int     xsiz, ysiz;
# Line 212 | Line 229 | register PICTURE       *pp;
229   }
230  
231  
232 < tmap_tiff(fname, tp)                    /* tone map SGILOG TIFF */
233 < char    *fname;
234 < TIFF    *tp;
232 > static int
233 > tmap_tiff(                      /* tone map SGILOG TIFF */
234 >        char    *fname,
235 >        TIFF    *tp
236 > )
237   {
238          float   xres, yres;
239          uint16  orient, resunit, phot;
# Line 222 | Line 241 | TIFF   *tp;
241          BYTE    *pix;
242                                          /* check to make sure it's SGILOG */
243          TIFFGetFieldDefaulted(tp, TIFFTAG_PHOTOMETRIC, &phot);
244 <        if (phot == PHOTOMETRIC_LOGL | phot == PHOTOMETRIC_MINISBLACK)
244 >        if ((phot == PHOTOMETRIC_LOGL) | (phot == PHOTOMETRIC_MINISBLACK))
245                  flags |= TM_F_BW;
246                                          /* read and tone map TIFF */
247          if (tmMapTIFF(&pix, &xsiz, &ysiz, flags,
# Line 243 | Line 262 | TIFF   *tp;
262   }
263  
264  
265 < putimage(or, xs, ys, xr, yr, ru, pd)    /* write out our image */
266 < uint16  or;
267 < uint32  xs, ys;
268 < float   xr, yr;
269 < uint16 ru;
270 < BYTE    *pd;
265 > static int
266 > putimage(       /* write out our image */
267 >        uint16  or,
268 >        uint32  xs,
269 >        uint32  ys,
270 >        float   xr,
271 >        float   yr,
272 >        uint16 ru,
273 >        BYTE    *pd
274 > )
275   {
276          register int    y;
277          uint32  rowsperstrip;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines