| 13 |
|
#include "tiffio.h" |
| 14 |
|
#include "color.h" |
| 15 |
|
#include "tonemap.h" |
| 16 |
+ |
#include "tmaptiff.h" |
| 17 |
|
#include "resolu.h" |
| 18 |
|
|
| 19 |
|
|
| 43 |
|
RESOLU rs; /* picture resolution */ |
| 44 |
|
} PICTURE; |
| 45 |
|
|
| 46 |
< |
extern PICTURE *openpicture(); |
| 46 |
> |
uint16 comp = COMPRESSION_NONE; /* TIFF compression mode */ |
| 47 |
|
|
| 48 |
|
#define closepicture(p) (fclose((p)->fp),free((void *)(p))) |
| 49 |
|
|
| 50 |
|
static gethfunc headline; |
| 51 |
|
|
| 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, |
| 96 |
|
if (argc-i < 2) goto userr; |
| 97 |
|
lddyn = atof(argv[++i]); |
| 98 |
|
break; |
| 99 |
+ |
case 'z': /* LZW compression */ |
| 100 |
+ |
comp = COMPRESSION_LZW; |
| 101 |
+ |
break; |
| 102 |
|
case 'p': /* set display primaries */ |
| 103 |
|
if (argc-i < 9) goto userr; |
| 104 |
|
myprims[RED][CIEX] = atof(argv[++i]); |
| 137 |
|
exit(rval==0 ? 0 : 1); |
| 138 |
|
userr: |
| 139 |
|
fprintf(stderr, |
| 140 |
< |
"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-p xr yr xg yg xb yb xw yw] input.{tif|pic} output.tif\n", |
| 140 |
> |
"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-z][-p xr yr xg yg xb yb xw yw] input.{tif|pic} output.tif\n", |
| 141 |
|
argv[0]); |
| 142 |
|
exit(1); |
| 143 |
|
} |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
|
| 165 |
< |
PICTURE * |
| 166 |
< |
openpicture(fname) /* open/check Radiance picture file */ |
| 167 |
< |
char *fname; |
| 165 |
> |
static PICTURE * |
| 166 |
> |
openpicture( /* open/check Radiance picture file */ |
| 167 |
> |
char *fname |
| 168 |
> |
) |
| 169 |
|
{ |
| 170 |
|
FILE *fp; |
| 171 |
|
register PICTURE *pp; |
| 204 |
|
} |
| 205 |
|
|
| 206 |
|
|
| 207 |
< |
int |
| 208 |
< |
tmap_picture(fname, pp) /* tone map Radiance picture */ |
| 209 |
< |
char *fname; |
| 210 |
< |
register PICTURE *pp; |
| 207 |
> |
static int |
| 208 |
> |
tmap_picture( /* tone map Radiance picture */ |
| 209 |
> |
char *fname, |
| 210 |
> |
register PICTURE *pp |
| 211 |
> |
) |
| 212 |
|
{ |
| 213 |
|
uint16 orient; |
| 214 |
|
int xsiz, ysiz; |
| 232 |
|
} |
| 233 |
|
|
| 234 |
|
|
| 235 |
< |
tmap_tiff(fname, tp) /* tone map SGILOG TIFF */ |
| 236 |
< |
char *fname; |
| 237 |
< |
TIFF *tp; |
| 235 |
> |
static int |
| 236 |
> |
tmap_tiff( /* tone map SGILOG TIFF */ |
| 237 |
> |
char *fname, |
| 238 |
> |
TIFF *tp |
| 239 |
> |
) |
| 240 |
|
{ |
| 241 |
|
float xres, yres; |
| 242 |
|
uint16 orient, resunit, phot; |
| 265 |
|
} |
| 266 |
|
|
| 267 |
|
|
| 268 |
< |
putimage(or, xs, ys, xr, yr, ru, pd) /* write out our image */ |
| 269 |
< |
uint16 or; |
| 270 |
< |
uint32 xs, ys; |
| 271 |
< |
float xr, yr; |
| 272 |
< |
uint16 ru; |
| 273 |
< |
BYTE *pd; |
| 268 |
> |
static int |
| 269 |
> |
putimage( /* write out our image */ |
| 270 |
> |
uint16 or, |
| 271 |
> |
uint32 xs, |
| 272 |
> |
uint32 ys, |
| 273 |
> |
float xr, |
| 274 |
> |
float yr, |
| 275 |
> |
uint16 ru, |
| 276 |
> |
BYTE *pd |
| 277 |
> |
) |
| 278 |
|
{ |
| 279 |
|
register int y; |
| 280 |
|
uint32 rowsperstrip; |
| 297 |
|
TIFFSetField(tifout, TIFFTAG_IMAGEWIDTH, xs); |
| 298 |
|
TIFFSetField(tifout, TIFFTAG_IMAGELENGTH, ys); |
| 299 |
|
TIFFSetField(tifout, TIFFTAG_RESOLUTIONUNIT, ru); |
| 300 |
+ |
TIFFSetField(tifout, TIFFTAG_COMPRESSION, comp); |
| 301 |
|
TIFFSetField(tifout, TIFFTAG_XRESOLUTION, xr); |
| 302 |
|
TIFFSetField(tifout, TIFFTAG_YRESOLUTION, yr); |
| 303 |
|
TIFFSetField(tifout, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); |