Line 0
Link Here
|
|
|
1 |
#ifndef _HACKED_TIFFIOP_H_ |
2 |
#define _HACKED_TIFFIOP_H_ |
3 |
|
4 |
#include <fcntl.h> |
5 |
#include "tiffio.h" |
6 |
typedef unsigned char tidataval_t; /* internal image data value type */ |
7 |
typedef tidataval_t* tidata_t; /* reference to internal image data */ |
8 |
|
9 |
typedef struct { |
10 |
#define FIELD_SETLONGS 4 |
11 |
/* bit vector of fields that are set */ |
12 |
unsigned long td_fieldsset[FIELD_SETLONGS]; |
13 |
|
14 |
uint32 td_imagewidth, td_imagelength, td_imagedepth; |
15 |
uint32 td_tilewidth, td_tilelength, td_tiledepth; |
16 |
uint32 td_subfiletype; |
17 |
uint16 td_bitspersample; |
18 |
uint16 td_sampleformat; |
19 |
uint16 td_compression; |
20 |
uint16 td_photometric; |
21 |
uint16 td_threshholding; |
22 |
uint16 td_fillorder; |
23 |
uint16 td_orientation; |
24 |
uint16 td_samplesperpixel; |
25 |
uint32 td_rowsperstrip; |
26 |
uint16 td_minsamplevalue, td_maxsamplevalue; |
27 |
double td_sminsamplevalue, td_smaxsamplevalue; |
28 |
float td_xresolution, td_yresolution; |
29 |
uint16 td_resolutionunit; |
30 |
uint16 td_planarconfig; |
31 |
float td_xposition, td_yposition; |
32 |
uint16 td_pagenumber[2]; |
33 |
uint16* td_colormap[3]; |
34 |
uint16 td_halftonehints[2]; |
35 |
uint16 td_extrasamples; |
36 |
uint16* td_sampleinfo; |
37 |
/* even though the name is misleading, td_stripsperimage is the number |
38 |
* of striles (=strips or tiles) per plane, and td_nstrips the total |
39 |
* number of striles */ |
40 |
tstrile_t td_stripsperimage; |
41 |
tstrile_t td_nstrips; /* size of offset & bytecount arrays */ |
42 |
toff_t* td_stripoffset; |
43 |
toff_t* td_stripbytecount; /* FIXME: it should be tsize_t array */ |
44 |
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */ |
45 |
uint16 td_nsubifd; |
46 |
uint32* td_subifd; |
47 |
/* YCbCr parameters */ |
48 |
uint16 td_ycbcrsubsampling[2]; |
49 |
uint16 td_ycbcrpositioning; |
50 |
/* Colorimetry parameters */ |
51 |
uint16* td_transferfunction[3]; |
52 |
/* CMYK parameters */ |
53 |
int td_inknameslen; |
54 |
char* td_inknames; |
55 |
|
56 |
int td_customValueCount; |
57 |
TIFFTagValue *td_customValues; |
58 |
} TIFFDirectory; |
59 |
|
60 |
typedef void (*TIFFVoidMethod)(TIFF*); |
61 |
typedef int (*TIFFBoolMethod)(TIFF*); |
62 |
typedef int (*TIFFPreMethod)(TIFF*, tsample_t); |
63 |
typedef int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t); |
64 |
typedef int (*TIFFSeekMethod)(TIFF*, uint32); |
65 |
typedef void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t); |
66 |
typedef uint32 (*TIFFStripMethod)(TIFF*, uint32); |
67 |
typedef void (*TIFFTileMethod)(TIFF*, uint32*, uint32*); |
68 |
|
69 |
typedef struct client_info { |
70 |
struct client_info *next; |
71 |
void *data; |
72 |
char *name; |
73 |
} TIFFClientInfoLink; |
74 |
|
75 |
struct tiff { |
76 |
char* tif_name; /* name of open file */ |
77 |
int tif_fd; /* open file descriptor */ |
78 |
int tif_mode; /* open mode (O_*) */ |
79 |
uint32 tif_flags; |
80 |
#define TIFF_FILLORDER 0x00003 /* natural bit fill order for machine */ |
81 |
#define TIFF_DIRTYHEADER 0x00004 /* header must be written on close */ |
82 |
#define TIFF_DIRTYDIRECT 0x00008 /* current directory must be written */ |
83 |
#define TIFF_BUFFERSETUP 0x00010 /* data buffers setup */ |
84 |
#define TIFF_CODERSETUP 0x00020 /* encoder/decoder setup done */ |
85 |
#define TIFF_BEENWRITING 0x00040 /* written 1+ scanlines to file */ |
86 |
#define TIFF_SWAB 0x00080 /* byte swap file information */ |
87 |
#define TIFF_NOBITREV 0x00100 /* inhibit bit reversal logic */ |
88 |
#define TIFF_MYBUFFER 0x00200 /* my raw data buffer; free on close */ |
89 |
#define TIFF_ISTILED 0x00400 /* file is tile, not strip- based */ |
90 |
#define TIFF_MAPPED 0x00800 /* file is mapped into memory */ |
91 |
#define TIFF_POSTENCODE 0x01000 /* need call to postencode routine */ |
92 |
#define TIFF_INSUBIFD 0x02000 /* currently writing a subifd */ |
93 |
#define TIFF_UPSAMPLED 0x04000 /* library is doing data up-sampling */ |
94 |
#define TIFF_STRIPCHOP 0x08000 /* enable strip chopping support */ |
95 |
#define TIFF_HEADERONLY 0x10000 /* read header only, do not process */ |
96 |
/* the first directory */ |
97 |
#define TIFF_NOREADRAW 0x20000 /* skip reading of raw uncompressed */ |
98 |
/* image data */ |
99 |
#define TIFF_INCUSTOMIFD 0x40000 /* currently writing a custom IFD */ |
100 |
toff_t tif_diroff; /* file offset of current directory */ |
101 |
toff_t tif_nextdiroff; /* file offset of following directory */ |
102 |
toff_t* tif_dirlist; /* list of offsets to already seen */ |
103 |
/* directories to prevent IFD looping */ |
104 |
tsize_t tif_dirlistsize;/* number of entires in offset list */ |
105 |
uint16 tif_dirnumber; /* number of already seen directories */ |
106 |
TIFFDirectory tif_dir; /* internal rep of current directory */ |
107 |
TIFFDirectory tif_customdir; /* custom IFDs are separated from |
108 |
the main ones */ |
109 |
TIFFHeader tif_header; /* file's header block */ |
110 |
const int* tif_typeshift; /* data type shift counts */ |
111 |
const long* tif_typemask; /* data type masks */ |
112 |
uint32 tif_row; /* current scanline */ |
113 |
tdir_t tif_curdir; /* current directory (index) */ |
114 |
tstrip_t tif_curstrip; /* current strip for read/write */ |
115 |
toff_t tif_curoff; /* current offset for read/write */ |
116 |
toff_t tif_dataoff; /* current offset for writing dir */ |
117 |
/* SubIFD support */ |
118 |
uint16 tif_nsubifd; /* remaining subifds to write */ |
119 |
toff_t tif_subifdoff; /* offset for patching SubIFD link */ |
120 |
/* tiling support */ |
121 |
uint32 tif_col; /* current column (offset by row too) */ |
122 |
ttile_t tif_curtile; /* current tile for read/write */ |
123 |
tsize_t tif_tilesize; /* # of bytes in a tile */ |
124 |
/* compression scheme hooks */ |
125 |
int tif_decodestatus; |
126 |
TIFFBoolMethod tif_setupdecode;/* called once before predecode */ |
127 |
TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */ |
128 |
TIFFBoolMethod tif_setupencode;/* called once before preencode */ |
129 |
int tif_encodestatus; |
130 |
TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */ |
131 |
TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */ |
132 |
TIFFCodeMethod tif_decoderow; /* scanline decoding routine */ |
133 |
TIFFCodeMethod tif_encoderow; /* scanline encoding routine */ |
134 |
TIFFCodeMethod tif_decodestrip;/* strip decoding routine */ |
135 |
TIFFCodeMethod tif_encodestrip;/* strip encoding routine */ |
136 |
TIFFCodeMethod tif_decodetile; /* tile decoding routine */ |
137 |
TIFFCodeMethod tif_encodetile; /* tile encoding routine */ |
138 |
TIFFVoidMethod tif_close; /* cleanup-on-close routine */ |
139 |
TIFFSeekMethod tif_seek; /* position within a strip routine */ |
140 |
TIFFVoidMethod tif_cleanup; /* cleanup state routine */ |
141 |
TIFFStripMethod tif_defstripsize;/* calculate/constrain strip size */ |
142 |
TIFFTileMethod tif_deftilesize;/* calculate/constrain tile size */ |
143 |
tidata_t tif_data; /* compression scheme private data */ |
144 |
/* input/output buffering */ |
145 |
tsize_t tif_scanlinesize;/* # of bytes in a scanline */ |
146 |
tsize_t tif_scanlineskew;/* scanline skew for reading strips */ |
147 |
tidata_t tif_rawdata; /* raw data buffer */ |
148 |
tsize_t tif_rawdatasize;/* # of bytes in raw data buffer */ |
149 |
tidata_t tif_rawcp; /* current spot in raw buffer */ |
150 |
tsize_t tif_rawcc; /* bytes unread from raw buffer */ |
151 |
/* memory-mapped file support */ |
152 |
tidata_t tif_base; /* base of mapped file */ |
153 |
toff_t tif_size; /* size of mapped file region (bytes) |
154 |
FIXME: it should be tsize_t */ |
155 |
TIFFMapFileProc tif_mapproc; /* map file method */ |
156 |
TIFFUnmapFileProc tif_unmapproc;/* unmap file method */ |
157 |
/* input/output callback methods */ |
158 |
thandle_t tif_clientdata; /* callback parameter */ |
159 |
TIFFReadWriteProc tif_readproc; /* read method */ |
160 |
TIFFReadWriteProc tif_writeproc;/* write method */ |
161 |
TIFFSeekProc tif_seekproc; /* lseek method */ |
162 |
TIFFCloseProc tif_closeproc; /* close method */ |
163 |
TIFFSizeProc tif_sizeproc; /* filesize method */ |
164 |
/* post-decoding support */ |
165 |
TIFFPostMethod tif_postdecode; /* post decoding routine */ |
166 |
/* tag support */ |
167 |
TIFFFieldInfo** tif_fieldinfo; /* sorted table of registered tags */ |
168 |
size_t tif_nfields; /* # entries in registered tag table */ |
169 |
const TIFFFieldInfo *tif_foundfield;/* cached pointer to already found tag */ |
170 |
TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */ |
171 |
TIFFClientInfoLink *tif_clientinfo; /* extra client information. */ |
172 |
}; |
173 |
|
174 |
#if defined(__cplusplus) |
175 |
extern "C" { |
176 |
#endif |
177 |
|
178 |
extern int _TIFFDataSize(TIFFDataType); |
179 |
|
180 |
#if defined(__cplusplus) |
181 |
} |
182 |
#endif |
183 |
|
184 |
|
185 |
#endif |