| 10 |
|
#include <time.h> |
| 11 |
|
#include <string.h> |
| 12 |
|
|
| 13 |
+ |
#include "platform.h" |
| 14 |
|
#include "tiffio.h" |
| 15 |
|
#include "color.h" |
| 16 |
|
#include "tonemap.h" |
| 39 |
|
|
| 40 |
|
typedef struct { |
| 41 |
|
FILE *fp; /* file pointer */ |
| 42 |
< |
char fmt[32]; /* picture format */ |
| 42 |
> |
char fmt[MAXFMTLEN]; /* picture format */ |
| 43 |
|
double pa; /* pixel aspect ratio */ |
| 44 |
|
RESOLU rs; /* picture resolution */ |
| 45 |
|
} PICTURE; |
| 55 |
|
static int tmap_picture(char *fname, PICTURE *pp); |
| 56 |
|
static int tmap_tiff(char *fname, TIFF *tp); |
| 57 |
|
static int putimage(uint16 or, uint32 xs, uint32 ys, float xr, float yr, |
| 58 |
< |
uint16 ru, BYTE *pd); |
| 58 |
> |
uint16 ru, uby8 *pd); |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
int |
| 185 |
|
/* else try opening it */ |
| 186 |
|
if ((fp = fopen(fname, "r")) == NULL) |
| 187 |
|
return(NULL); |
| 188 |
+ |
SET_FILE_BINARY(fp); |
| 189 |
|
/* allocate struct */ |
| 190 |
|
if ((pp = (PICTURE *)malloc(sizeof(PICTURE))) == NULL) |
| 191 |
|
return(NULL); /* serious error -- should exit? */ |
| 215 |
|
uint16 orient; |
| 216 |
|
double paspect = (pp->rs.rt & YMAJOR) ? pp->pa : 1./pp->pa; |
| 217 |
|
int xsiz, ysiz; |
| 218 |
< |
BYTE *pix; |
| 218 |
> |
uby8 *pix; |
| 219 |
|
/* read and tone map picture */ |
| 220 |
|
if (tmMapPicture(&pix, &xsiz, &ysiz, flags, |
| 221 |
|
rgbp, gamv, lddyn, ldmax, fname, pp->fp) != TM_E_OK) |
| 244 |
|
float xres, yres; |
| 245 |
|
uint16 orient, resunit, phot; |
| 246 |
|
int xsiz, ysiz; |
| 247 |
< |
BYTE *pix; |
| 247 |
> |
uby8 *pix; |
| 248 |
|
/* check to make sure it's SGILOG */ |
| 249 |
|
TIFFGetFieldDefaulted(tp, TIFFTAG_PHOTOMETRIC, &phot); |
| 250 |
|
if ((phot == PHOTOMETRIC_LOGL) | (phot == PHOTOMETRIC_MINISBLACK)) |
| 276 |
|
float xr, |
| 277 |
|
float yr, |
| 278 |
|
uint16 ru, |
| 279 |
< |
BYTE *pd |
| 279 |
> |
uby8 *pd |
| 280 |
|
) |
| 281 |
|
{ |
| 282 |
|
register int y; |