mirror of
https://github.com/joel16/VITAlbum.git
synced 2024-11-26 21:10:25 +00:00
libs: Update various libraries
This commit is contained in:
parent
1f528581c5
commit
4858b3d72a
@ -18,12 +18,12 @@ set(VITA_VERSION "01.40")
|
||||
|
||||
add_definitions(-DAPP_VERSION="${VITA_VERSION}")
|
||||
add_definitions(
|
||||
-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_DISABLE_DEMO_WINDOWS -DIMGUI_DISABLE_METRICS_WINDOW
|
||||
-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS -DIMGUI_DISABLE_DEMO_WINDOWS -DIMGUI_DISABLE_DEBUG_TOOLS
|
||||
-DIMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS -DIMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
|
||||
-DIMGUI_DISABLE_WIN32_FUNCTIONS -DIMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION -DIMGUI_ENABLE_FREETYPE
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -mtune=cortex-a9 -mfpu=neon -Wall -Wno-psabi -fno-rtti -std=gnu++17")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -ffast-math -mtune=cortex-a9 -mfpu=neon -Wall -Wno-psabi -Wno-unused-function -fno-rtti -std=gnu++17")
|
||||
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1")
|
||||
|
||||
include_directories(
|
||||
@ -70,15 +70,18 @@ target_link_libraries(${PROJECT_NAME}
|
||||
tiff
|
||||
webpdemux
|
||||
webp
|
||||
sharpyuv
|
||||
turbojpeg
|
||||
jpeg
|
||||
png
|
||||
pthread
|
||||
lzma
|
||||
z
|
||||
zstd
|
||||
vitaGL
|
||||
vitashark
|
||||
mathneon
|
||||
SceShaccCgExt
|
||||
SceAppMgr_stub
|
||||
SceAppUtil_stub
|
||||
SceCommonDialog_stub
|
||||
@ -90,6 +93,7 @@ target_link_libraries(${PROJECT_NAME}
|
||||
SceLibKernel_stub
|
||||
SceShaccCg_stub
|
||||
SceSysmodule_stub
|
||||
taihen_stub
|
||||
)
|
||||
|
||||
vita_create_self(${PROJECT_NAME}.self ${PROJECT_NAME} UNSAFE)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* stb_image - v2.27 - public domain image loader - http://nothings.org/stb
|
||||
/* stb_image - v2.28 - public domain image loader - http://nothings.org/stb
|
||||
no warranty implied; use at your own risk
|
||||
|
||||
Do this:
|
||||
@ -48,6 +48,7 @@ LICENSE
|
||||
|
||||
RECENT REVISION HISTORY:
|
||||
|
||||
2.28 (2023-01-29) many error fixes, security errors, just tons of stuff
|
||||
2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes
|
||||
2.26 (2020-07-13) many minor fixes
|
||||
2.25 (2020-02-02) fix warnings
|
||||
@ -108,7 +109,7 @@ RECENT REVISION HISTORY:
|
||||
Cass Everitt Ryamond Barbiero github:grim210
|
||||
Paul Du Bois Engin Manap Aldo Culquicondor github:sammyhw
|
||||
Philipp Wiesemann Dale Weiler Oriol Ferrer Mesia github:phprus
|
||||
Josh Tobin Matthew Gregan github:poppolopoppo
|
||||
Josh Tobin Neil Bickford Matthew Gregan github:poppolopoppo
|
||||
Julian Raschke Gregory Mullen Christian Floisand github:darealshinji
|
||||
Baldur Karlsson Kevin Schmidt JR Smith github:Michaelangel007
|
||||
Brad Weinberger Matvey Cherevko github:mosra
|
||||
@ -140,7 +141,7 @@ RECENT REVISION HISTORY:
|
||||
// // ... x = width, y = height, n = # 8-bit components per pixel ...
|
||||
// // ... replace '0' with '1'..'4' to force that many components per pixel
|
||||
// // ... but 'n' will always be the number that it would have been if you said 0
|
||||
// stbi_image_free(data)
|
||||
// stbi_image_free(data);
|
||||
//
|
||||
// Standard parameters:
|
||||
// int *x -- outputs image width in pixels
|
||||
@ -635,7 +636,7 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__SYMBIAN32__)
|
||||
typedef unsigned short stbi__uint16;
|
||||
typedef signed short stbi__int16;
|
||||
typedef unsigned int stbi__uint32;
|
||||
@ -1063,6 +1064,23 @@ static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)
|
||||
}
|
||||
#endif
|
||||
|
||||
// returns 1 if the sum of two signed ints is valid (between -2^31 and 2^31-1 inclusive), 0 on overflow.
|
||||
static int stbi__addints_valid(int a, int b)
|
||||
{
|
||||
if ((a >= 0) != (b >= 0)) return 1; // a and b have different signs, so no overflow
|
||||
if (a < 0 && b < 0) return a >= INT_MIN - b; // same as a + b >= INT_MIN; INT_MIN - b cannot overflow since b < 0.
|
||||
return a <= INT_MAX - b;
|
||||
}
|
||||
|
||||
// returns 1 if the product of two signed shorts is valid, 0 on overflow.
|
||||
static int stbi__mul2shorts_valid(short a, short b)
|
||||
{
|
||||
if (b == 0 || b == -1) return 1; // multiplication by 0 is always 0; check for -1 so SHRT_MIN/b doesn't overflow
|
||||
if ((a >= 0) == (b >= 0)) return a <= SHRT_MAX/b; // product is positive, so similar to mul2sizes_valid
|
||||
if (b < 0) return a <= SHRT_MIN / b; // same as a * b >= SHRT_MIN
|
||||
return a >= SHRT_MIN / b;
|
||||
}
|
||||
|
||||
// stbi__err - error
|
||||
// stbi__errpf - error returning pointer to float
|
||||
// stbi__errpuc - error returning pointer to unsigned char
|
||||
@ -1985,9 +2003,12 @@ static int stbi__build_huffman(stbi__huffman *h, int *count)
|
||||
int i,j,k=0;
|
||||
unsigned int code;
|
||||
// build size list for each symbol (from JPEG spec)
|
||||
for (i=0; i < 16; ++i)
|
||||
for (j=0; j < count[i]; ++j)
|
||||
for (i=0; i < 16; ++i) {
|
||||
for (j=0; j < count[i]; ++j) {
|
||||
h->size[k++] = (stbi_uc) (i+1);
|
||||
if(k >= 257) return stbi__err("bad size list","Corrupt JPEG");
|
||||
}
|
||||
}
|
||||
h->size[k] = 0;
|
||||
|
||||
// compute actual symbols (from jpeg spec)
|
||||
@ -2112,6 +2133,8 @@ stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)
|
||||
|
||||
// convert the huffman code to the symbol id
|
||||
c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];
|
||||
if(c < 0 || c >= 256) // symbol id out of bounds!
|
||||
return -1;
|
||||
STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);
|
||||
|
||||
// convert the id to a symbol
|
||||
@ -2130,6 +2153,7 @@ stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
|
||||
unsigned int k;
|
||||
int sgn;
|
||||
if (j->code_bits < n) stbi__grow_buffer_unsafe(j);
|
||||
if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing
|
||||
|
||||
sgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 if MSB set (negative)
|
||||
k = stbi_lrot(j->code_buffer, n);
|
||||
@ -2144,6 +2168,7 @@ stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)
|
||||
{
|
||||
unsigned int k;
|
||||
if (j->code_bits < n) stbi__grow_buffer_unsafe(j);
|
||||
if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing
|
||||
k = stbi_lrot(j->code_buffer, n);
|
||||
j->code_buffer = k & ~stbi__bmask[n];
|
||||
k &= stbi__bmask[n];
|
||||
@ -2155,6 +2180,7 @@ stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
|
||||
{
|
||||
unsigned int k;
|
||||
if (j->code_bits < 1) stbi__grow_buffer_unsafe(j);
|
||||
if (j->code_bits < 1) return 0; // ran out of bits from stream, return 0s intead of continuing
|
||||
k = j->code_buffer;
|
||||
j->code_buffer <<= 1;
|
||||
--j->code_bits;
|
||||
@ -2192,8 +2218,10 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman
|
||||
memset(data,0,64*sizeof(data[0]));
|
||||
|
||||
diff = t ? stbi__extend_receive(j, t) : 0;
|
||||
if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err("bad delta","Corrupt JPEG");
|
||||
dc = j->img_comp[b].dc_pred + diff;
|
||||
j->img_comp[b].dc_pred = dc;
|
||||
if (!stbi__mul2shorts_valid(dc, dequant[0])) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||||
data[0] = (short) (dc * dequant[0]);
|
||||
|
||||
// decode AC components, see JPEG spec
|
||||
@ -2207,6 +2235,7 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman
|
||||
if (r) { // fast-AC path
|
||||
k += (r >> 4) & 15; // run
|
||||
s = r & 15; // combined length
|
||||
if (s > j->code_bits) return stbi__err("bad huffman code", "Combined length longer than code bits available");
|
||||
j->code_buffer <<= s;
|
||||
j->code_bits -= s;
|
||||
// decode into unzigzag'd location
|
||||
@ -2246,8 +2275,10 @@ static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__
|
||||
if (t < 0 || t > 15) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||||
diff = t ? stbi__extend_receive(j, t) : 0;
|
||||
|
||||
if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err("bad delta", "Corrupt JPEG");
|
||||
dc = j->img_comp[b].dc_pred + diff;
|
||||
j->img_comp[b].dc_pred = dc;
|
||||
if (!stbi__mul2shorts_valid(dc, 1 << j->succ_low)) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||||
data[0] = (short) (dc * (1 << j->succ_low));
|
||||
} else {
|
||||
// refinement scan for DC coefficient
|
||||
@ -2282,6 +2313,7 @@ static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__
|
||||
if (r) { // fast-AC path
|
||||
k += (r >> 4) & 15; // run
|
||||
s = r & 15; // combined length
|
||||
if (s > j->code_bits) return stbi__err("bad huffman code", "Combined length longer than code bits available");
|
||||
j->code_buffer <<= s;
|
||||
j->code_bits -= s;
|
||||
zig = stbi__jpeg_dezigzag[k++];
|
||||
@ -3102,6 +3134,7 @@ static int stbi__process_marker(stbi__jpeg *z, int m)
|
||||
sizes[i] = stbi__get8(z->s);
|
||||
n += sizes[i];
|
||||
}
|
||||
if(n > 256) return stbi__err("bad DHT header","Corrupt JPEG"); // Loop over i < n would write past end of values!
|
||||
L -= 17;
|
||||
if (tc == 0) {
|
||||
if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0;
|
||||
@ -3351,6 +3384,28 @@ static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)
|
||||
{
|
||||
// some JPEGs have junk at end, skip over it but if we find what looks
|
||||
// like a valid marker, resume there
|
||||
while (!stbi__at_eof(j->s)) {
|
||||
int x = stbi__get8(j->s);
|
||||
while (x == 255) { // might be a marker
|
||||
if (stbi__at_eof(j->s)) return STBI__MARKER_none;
|
||||
x = stbi__get8(j->s);
|
||||
if (x != 0x00 && x != 0xff) {
|
||||
// not a stuffed zero or lead-in to another marker, looks
|
||||
// like an actual marker, return it
|
||||
return x;
|
||||
}
|
||||
// stuffed zero has x=0 now which ends the loop, meaning we go
|
||||
// back to regular scan loop.
|
||||
// repeated 0xff keeps trying to read the next byte of the marker.
|
||||
}
|
||||
}
|
||||
return STBI__MARKER_none;
|
||||
}
|
||||
|
||||
// decode image to YCbCr format
|
||||
static int stbi__decode_jpeg_image(stbi__jpeg *j)
|
||||
{
|
||||
@ -3367,25 +3422,22 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j)
|
||||
if (!stbi__process_scan_header(j)) return 0;
|
||||
if (!stbi__parse_entropy_coded_data(j)) return 0;
|
||||
if (j->marker == STBI__MARKER_none ) {
|
||||
// handle 0s at the end of image data from IP Kamera 9060
|
||||
while (!stbi__at_eof(j->s)) {
|
||||
int x = stbi__get8(j->s);
|
||||
if (x == 255) {
|
||||
j->marker = stbi__get8(j->s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
j->marker = stbi__skip_jpeg_junk_at_end(j);
|
||||
// if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0
|
||||
}
|
||||
m = stbi__get_marker(j);
|
||||
if (STBI__RESTART(m))
|
||||
m = stbi__get_marker(j);
|
||||
} else if (stbi__DNL(m)) {
|
||||
int Ld = stbi__get16be(j->s);
|
||||
stbi__uint32 NL = stbi__get16be(j->s);
|
||||
if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG");
|
||||
if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG");
|
||||
m = stbi__get_marker(j);
|
||||
} else {
|
||||
if (!stbi__process_marker(j, m)) return 0;
|
||||
if (!stbi__process_marker(j, m)) return 1;
|
||||
m = stbi__get_marker(j);
|
||||
}
|
||||
m = stbi__get_marker(j);
|
||||
}
|
||||
if (j->progressive)
|
||||
stbi__jpeg_finish(j);
|
||||
@ -3976,6 +4028,7 @@ static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int re
|
||||
unsigned char* result;
|
||||
stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg));
|
||||
if (!j) return stbi__errpuc("outofmem", "Out of memory");
|
||||
memset(j, 0, sizeof(stbi__jpeg));
|
||||
STBI_NOTUSED(ri);
|
||||
j->s = s;
|
||||
stbi__setup_jpeg(j);
|
||||
@ -3989,6 +4042,7 @@ static int stbi__jpeg_test(stbi__context *s)
|
||||
int r;
|
||||
stbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg));
|
||||
if (!j) return stbi__err("outofmem", "Out of memory");
|
||||
memset(j, 0, sizeof(stbi__jpeg));
|
||||
j->s = s;
|
||||
stbi__setup_jpeg(j);
|
||||
r = stbi__decode_jpeg_header(j, STBI__SCAN_type);
|
||||
@ -4014,6 +4068,7 @@ static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
|
||||
int result;
|
||||
stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg)));
|
||||
if (!j) return stbi__err("outofmem", "Out of memory");
|
||||
memset(j, 0, sizeof(stbi__jpeg));
|
||||
j->s = s;
|
||||
result = stbi__jpeg_info_raw(j, x, y, comp);
|
||||
STBI_FREE(j);
|
||||
@ -4256,11 +4311,12 @@ static int stbi__parse_huffman_block(stbi__zbuf *a)
|
||||
a->zout = zout;
|
||||
return 1;
|
||||
}
|
||||
if (z >= 286) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, length codes 286 and 287 must not appear in compressed data
|
||||
z -= 257;
|
||||
len = stbi__zlength_base[z];
|
||||
if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]);
|
||||
z = stbi__zhuffman_decode(a, &a->z_distance);
|
||||
if (z < 0) return stbi__err("bad huffman code","Corrupt PNG");
|
||||
if (z < 0 || z >= 30) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, distance codes 30 and 31 must not appear in compressed data
|
||||
dist = stbi__zdist_base[z];
|
||||
if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]);
|
||||
if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG");
|
||||
@ -4955,7 +5011,7 @@ STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
|
||||
static STBI_THREAD_LOCAL int stbi__unpremultiply_on_load_local, stbi__unpremultiply_on_load_set;
|
||||
static STBI_THREAD_LOCAL int stbi__de_iphone_flag_local, stbi__de_iphone_flag_set;
|
||||
|
||||
STBIDEF void stbi__unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply)
|
||||
STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply)
|
||||
{
|
||||
stbi__unpremultiply_on_load_local = flag_true_if_should_unpremultiply;
|
||||
stbi__unpremultiply_on_load_set = 1;
|
||||
@ -5064,14 +5120,13 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
|
||||
if (!pal_img_n) {
|
||||
s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
|
||||
if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode");
|
||||
if (scan == STBI__SCAN_header) return 1;
|
||||
} else {
|
||||
// if paletted, then pal_n is our final components, and
|
||||
// img_n is # components to decompress/filter.
|
||||
s->img_n = 1;
|
||||
if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG");
|
||||
// if SCAN_header, have to scan to see if we have a tRNS
|
||||
}
|
||||
// even with SCAN_header, have to scan to see if we have a tRNS
|
||||
break;
|
||||
}
|
||||
|
||||
@ -5103,6 +5158,8 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
|
||||
if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG");
|
||||
if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG");
|
||||
has_trans = 1;
|
||||
// non-paletted with tRNS = constant alpha. if header-scanning, we can stop now.
|
||||
if (scan == STBI__SCAN_header) { ++s->img_n; return 1; }
|
||||
if (z->depth == 16) {
|
||||
for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is
|
||||
} else {
|
||||
@ -5115,7 +5172,13 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
|
||||
case STBI__PNG_TYPE('I','D','A','T'): {
|
||||
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
|
||||
if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG");
|
||||
if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; }
|
||||
if (scan == STBI__SCAN_header) {
|
||||
// header scan definitely stops at first IDAT
|
||||
if (pal_img_n)
|
||||
s->img_n = pal_img_n;
|
||||
return 1;
|
||||
}
|
||||
if (c.length > (1u << 30)) return stbi__err("IDAT size limit", "IDAT section larger than 2^30 bytes");
|
||||
if ((int)(ioff + c.length) < (int)ioff) return 0;
|
||||
if (ioff + c.length > idata_limit) {
|
||||
stbi__uint32 idata_limit_old = idata_limit;
|
||||
@ -5498,8 +5561,22 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req
|
||||
psize = (info.offset - info.extra_read - info.hsz) >> 2;
|
||||
}
|
||||
if (psize == 0) {
|
||||
if (info.offset != s->callback_already_read + (s->img_buffer - s->img_buffer_original)) {
|
||||
return stbi__errpuc("bad offset", "Corrupt BMP");
|
||||
// accept some number of extra bytes after the header, but if the offset points either to before
|
||||
// the header ends or implies a large amount of extra data, reject the file as malformed
|
||||
int bytes_read_so_far = s->callback_already_read + (int)(s->img_buffer - s->img_buffer_original);
|
||||
int header_limit = 1024; // max we actually read is below 256 bytes currently.
|
||||
int extra_data_limit = 256*4; // what ordinarily goes here is a palette; 256 entries*4 bytes is its max size.
|
||||
if (bytes_read_so_far <= 0 || bytes_read_so_far > header_limit) {
|
||||
return stbi__errpuc("bad header", "Corrupt BMP");
|
||||
}
|
||||
// we established that bytes_read_so_far is positive and sensible.
|
||||
// the first half of this test rejects offsets that are either too small positives, or
|
||||
// negative, and guarantees that info.offset >= bytes_read_so_far > 0. this in turn
|
||||
// ensures the number computed in the second half of the test can't overflow.
|
||||
if (info.offset < bytes_read_so_far || info.offset - bytes_read_so_far > extra_data_limit) {
|
||||
return stbi__errpuc("bad offset", "Corrupt BMP");
|
||||
} else {
|
||||
stbi__skip(s, info.offset - bytes_read_so_far);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7187,12 +7264,12 @@ static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int re
|
||||
// Run
|
||||
value = stbi__get8(s);
|
||||
count -= 128;
|
||||
if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
|
||||
if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
|
||||
for (z = 0; z < count; ++z)
|
||||
scanline[i++ * 4 + k] = value;
|
||||
} else {
|
||||
// Dump
|
||||
if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
|
||||
if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
|
||||
for (z = 0; z < count; ++z)
|
||||
scanline[i++ * 4 + k] = stbi__get8(s);
|
||||
}
|
||||
@ -7446,10 +7523,17 @@ static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req
|
||||
|
||||
out = (stbi_uc *) stbi__malloc_mad4(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0);
|
||||
if (!out) return stbi__errpuc("outofmem", "Out of memory");
|
||||
stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8));
|
||||
if (!stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8))) {
|
||||
STBI_FREE(out);
|
||||
return stbi__errpuc("bad PNM", "PNM file truncated");
|
||||
}
|
||||
|
||||
if (req_comp && req_comp != s->img_n) {
|
||||
out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);
|
||||
if (ri->bits_per_channel == 16) {
|
||||
out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, s->img_n, req_comp, s->img_x, s->img_y);
|
||||
} else {
|
||||
out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);
|
||||
}
|
||||
if (out == NULL) return out; // stbi__convert_format frees input on failure
|
||||
}
|
||||
return out;
|
||||
@ -7486,6 +7570,8 @@ static int stbi__pnm_getinteger(stbi__context *s, char *c)
|
||||
while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) {
|
||||
value = value*10 + (*c - '0');
|
||||
*c = (char) stbi__get8(s);
|
||||
if((value > 214748364) || (value == 214748364 && *c > '7'))
|
||||
return stbi__err("integer parse overflow", "Parsing an integer in the PPM header overflowed a 32-bit int");
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -7516,9 +7602,13 @@ static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
|
||||
stbi__pnm_skip_whitespace(s, &c);
|
||||
|
||||
*x = stbi__pnm_getinteger(s, &c); // read width
|
||||
if(*x == 0)
|
||||
return stbi__err("invalid width", "PPM image header had zero or overflowing width");
|
||||
stbi__pnm_skip_whitespace(s, &c);
|
||||
|
||||
*y = stbi__pnm_getinteger(s, &c); // read height
|
||||
if (*y == 0)
|
||||
return stbi__err("invalid width", "PPM image header had zero or overflowing width");
|
||||
stbi__pnm_skip_whitespace(s, &c);
|
||||
|
||||
maxv = stbi__pnm_getinteger(s, &c); // read max value
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
Subproject commit c71a50deb5ddf1ea386b91e60fa2e4a26d080074
|
||||
Subproject commit 458a1090314a965dd37b02c918d83077a0142ad5
|
Binary file not shown.
@ -83,7 +83,7 @@
|
||||
#define LIBJPEG_12_PATH ""
|
||||
|
||||
/* Support LZMA2 compression */
|
||||
/* #undef LZMA_SUPPORT */
|
||||
#define LZMA_SUPPORT 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "LibTIFF Software"
|
||||
@ -95,7 +95,7 @@
|
||||
#define PACKAGE_NAME "LibTIFF Software"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "LibTIFF Software 4.3.0"
|
||||
#define PACKAGE_STRING "LibTIFF Software 4.5.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "tiff"
|
||||
@ -104,7 +104,7 @@
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "4.3.0"
|
||||
#define PACKAGE_VERSION "4.5.0"
|
||||
|
||||
/* Size of size_t */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
@ -112,17 +112,20 @@
|
||||
/* Default size of the strip in bytes (when strip chopping enabled) */
|
||||
#define STRIP_SIZE_DEFAULT 8192
|
||||
|
||||
/** Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
|
||||
#define TIFF_MAX_DIR_COUNT 1048576
|
||||
|
||||
/* define to use win32 IO system */
|
||||
/* #undef USE_WIN32_FILEIO */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "4.3.0"
|
||||
#define VERSION "4.5.0"
|
||||
|
||||
/* Support WEBP compression */
|
||||
#define WEBP_SUPPORT 1
|
||||
|
||||
/* Support ZSTD compression */
|
||||
/* #undef ZSTD_SUPPORT */
|
||||
#define ZSTD_SUPPORT 1
|
||||
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
|
@ -2,28 +2,28 @@
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFDIR_
|
||||
#define _TIFFDIR_
|
||||
#define _TIFFDIR_
|
||||
|
||||
#include "tiff.h"
|
||||
#include "tiffio.h"
|
||||
@ -32,10 +32,11 @@
|
||||
* ``Library-private'' Directory-related Definitions.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
const TIFFField *info;
|
||||
int count;
|
||||
void *value;
|
||||
typedef struct
|
||||
{
|
||||
const TIFFField *info;
|
||||
int count;
|
||||
void *value;
|
||||
} TIFFTagValue;
|
||||
|
||||
/*
|
||||
@ -49,79 +50,91 @@ typedef struct {
|
||||
* BigTIFF, then it is placed in the offset field to save space. If so,
|
||||
* it is left-justified in the offset field.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t tdir_tag; /* see below */
|
||||
uint16_t tdir_type; /* data type; see below */
|
||||
uint64_t tdir_count; /* number of items; length in spec */
|
||||
union {
|
||||
uint16_t toff_short;
|
||||
uint32_t toff_long;
|
||||
uint64_t toff_long8;
|
||||
} tdir_offset; /* either offset or the data itself if fits */
|
||||
uint8_t tdir_ignore; /* flag status to ignore tag when parsing tags in tif_dirread.c */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t tdir_tag; /* see below */
|
||||
uint16_t tdir_type; /* data type; see below */
|
||||
uint64_t tdir_count; /* number of items; length in spec */
|
||||
union
|
||||
{
|
||||
uint16_t toff_short;
|
||||
uint32_t toff_long;
|
||||
uint64_t toff_long8;
|
||||
} tdir_offset; /* either offset or the data itself if fits */
|
||||
uint8_t tdir_ignore; /* flag status to ignore tag when parsing tags in
|
||||
tif_dirread.c */
|
||||
} TIFFDirEntry;
|
||||
|
||||
/*
|
||||
* Internal format of a TIFF directory entry.
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
#define FIELD_SETLONGS 4
|
||||
/* bit vector of fields that are set */
|
||||
unsigned long td_fieldsset[FIELD_SETLONGS];
|
||||
/* bit vector of fields that are set */
|
||||
unsigned long td_fieldsset[FIELD_SETLONGS];
|
||||
|
||||
uint32_t td_imagewidth, td_imagelength, td_imagedepth;
|
||||
uint32_t td_tilewidth, td_tilelength, td_tiledepth;
|
||||
uint32_t td_subfiletype;
|
||||
uint16_t td_bitspersample;
|
||||
uint16_t td_sampleformat;
|
||||
uint16_t td_compression;
|
||||
uint16_t td_photometric;
|
||||
uint16_t td_threshholding;
|
||||
uint16_t td_fillorder;
|
||||
uint16_t td_orientation;
|
||||
uint16_t td_samplesperpixel;
|
||||
uint32_t td_rowsperstrip;
|
||||
uint16_t td_minsamplevalue, td_maxsamplevalue;
|
||||
double* td_sminsamplevalue;
|
||||
double* td_smaxsamplevalue;
|
||||
float td_xresolution, td_yresolution;
|
||||
uint16_t td_resolutionunit;
|
||||
uint16_t td_planarconfig;
|
||||
float td_xposition, td_yposition;
|
||||
uint16_t td_pagenumber[2];
|
||||
uint16_t* td_colormap[3];
|
||||
uint16_t td_halftonehints[2];
|
||||
uint16_t td_extrasamples;
|
||||
uint16_t* td_sampleinfo;
|
||||
/* even though the name is misleading, td_stripsperimage is the number
|
||||
* of striles (=strips or tiles) per plane, and td_nstrips the total
|
||||
* number of striles */
|
||||
uint32_t td_stripsperimage;
|
||||
uint32_t td_nstrips; /* size of offset & bytecount arrays */
|
||||
uint64_t* td_stripoffset_p; /* should be accessed with TIFFGetStrileOffset */
|
||||
uint64_t* td_stripbytecount_p; /* should be accessed with TIFFGetStrileByteCount */
|
||||
uint32_t td_stripoffsetbyteallocsize; /* number of elements currently allocated for td_stripoffset/td_stripbytecount. Only used if TIFF_LAZYSTRILELOAD is set */
|
||||
uint32_t td_imagewidth, td_imagelength, td_imagedepth;
|
||||
uint32_t td_tilewidth, td_tilelength, td_tiledepth;
|
||||
uint32_t td_subfiletype;
|
||||
uint16_t td_bitspersample;
|
||||
uint16_t td_sampleformat;
|
||||
uint16_t td_compression;
|
||||
uint16_t td_photometric;
|
||||
uint16_t td_threshholding;
|
||||
uint16_t td_fillorder;
|
||||
uint16_t td_orientation;
|
||||
uint16_t td_samplesperpixel;
|
||||
uint32_t td_rowsperstrip;
|
||||
uint16_t td_minsamplevalue, td_maxsamplevalue;
|
||||
double *td_sminsamplevalue;
|
||||
double *td_smaxsamplevalue;
|
||||
float td_xresolution, td_yresolution;
|
||||
uint16_t td_resolutionunit;
|
||||
uint16_t td_planarconfig;
|
||||
float td_xposition, td_yposition;
|
||||
uint16_t td_pagenumber[2];
|
||||
uint16_t *td_colormap[3];
|
||||
uint16_t td_halftonehints[2];
|
||||
uint16_t td_extrasamples;
|
||||
uint16_t *td_sampleinfo;
|
||||
/* even though the name is misleading, td_stripsperimage is the number
|
||||
* of striles (=strips or tiles) per plane, and td_nstrips the total
|
||||
* number of striles */
|
||||
uint32_t td_stripsperimage;
|
||||
uint32_t td_nstrips; /* size of offset & bytecount arrays */
|
||||
uint64_t
|
||||
*td_stripoffset_p; /* should be accessed with TIFFGetStrileOffset */
|
||||
uint64_t *td_stripbytecount_p; /* should be accessed with
|
||||
TIFFGetStrileByteCount */
|
||||
uint32_t
|
||||
td_stripoffsetbyteallocsize; /* number of elements currently allocated
|
||||
for td_stripoffset/td_stripbytecount.
|
||||
Only used if TIFF_LAZYSTRILELOAD is set
|
||||
*/
|
||||
#ifdef STRIPBYTECOUNTSORTED_UNUSED
|
||||
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
|
||||
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
|
||||
#endif
|
||||
TIFFDirEntry td_stripoffset_entry; /* for deferred loading */
|
||||
TIFFDirEntry td_stripbytecount_entry; /* for deferred loading */
|
||||
uint16_t td_nsubifd;
|
||||
uint64_t* td_subifd;
|
||||
/* YCbCr parameters */
|
||||
uint16_t td_ycbcrsubsampling[2];
|
||||
uint16_t td_ycbcrpositioning;
|
||||
/* Colorimetry parameters */
|
||||
uint16_t* td_transferfunction[3];
|
||||
float* td_refblackwhite;
|
||||
/* CMYK parameters */
|
||||
int td_inknameslen;
|
||||
char* td_inknames;
|
||||
TIFFDirEntry td_stripoffset_entry; /* for deferred loading */
|
||||
TIFFDirEntry td_stripbytecount_entry; /* for deferred loading */
|
||||
uint16_t td_nsubifd;
|
||||
uint64_t *td_subifd;
|
||||
/* YCbCr parameters */
|
||||
uint16_t td_ycbcrsubsampling[2];
|
||||
uint16_t td_ycbcrpositioning;
|
||||
/* Colorimetry parameters */
|
||||
uint16_t *td_transferfunction[3];
|
||||
float *td_refblackwhite;
|
||||
/* CMYK parameters */
|
||||
int td_inknameslen;
|
||||
char *td_inknames;
|
||||
uint16_t td_numberofinks; /* number of inks in InkNames string */
|
||||
|
||||
int td_customValueCount;
|
||||
TIFFTagValue *td_customValues;
|
||||
int td_customValueCount;
|
||||
TIFFTagValue *td_customValues;
|
||||
|
||||
unsigned char td_deferstrilearraywriting; /* see TIFFDeferStrileArrayWriting() */
|
||||
unsigned char
|
||||
td_deferstrilearraywriting; /* see TIFFDeferStrileArrayWriting() */
|
||||
} TIFFDirectory;
|
||||
|
||||
/*
|
||||
@ -135,49 +148,49 @@ typedef struct {
|
||||
* Note that a bit *is* allocated for ignored tags; this is understood by the
|
||||
* directory reading logic which uses this fact to avoid special-case handling
|
||||
*/
|
||||
#define FIELD_IGNORE 0
|
||||
#define FIELD_IGNORE 0
|
||||
|
||||
/* multi-item fields */
|
||||
#define FIELD_IMAGEDIMENSIONS 1
|
||||
#define FIELD_TILEDIMENSIONS 2
|
||||
#define FIELD_RESOLUTION 3
|
||||
#define FIELD_POSITION 4
|
||||
#define FIELD_IMAGEDIMENSIONS 1
|
||||
#define FIELD_TILEDIMENSIONS 2
|
||||
#define FIELD_RESOLUTION 3
|
||||
#define FIELD_POSITION 4
|
||||
|
||||
/* single-item fields */
|
||||
#define FIELD_SUBFILETYPE 5
|
||||
#define FIELD_BITSPERSAMPLE 6
|
||||
#define FIELD_COMPRESSION 7
|
||||
#define FIELD_PHOTOMETRIC 8
|
||||
#define FIELD_THRESHHOLDING 9
|
||||
#define FIELD_FILLORDER 10
|
||||
#define FIELD_ORIENTATION 15
|
||||
#define FIELD_SAMPLESPERPIXEL 16
|
||||
#define FIELD_ROWSPERSTRIP 17
|
||||
#define FIELD_MINSAMPLEVALUE 18
|
||||
#define FIELD_MAXSAMPLEVALUE 19
|
||||
#define FIELD_PLANARCONFIG 20
|
||||
#define FIELD_RESOLUTIONUNIT 22
|
||||
#define FIELD_PAGENUMBER 23
|
||||
#define FIELD_STRIPBYTECOUNTS 24
|
||||
#define FIELD_STRIPOFFSETS 25
|
||||
#define FIELD_COLORMAP 26
|
||||
#define FIELD_EXTRASAMPLES 31
|
||||
#define FIELD_SAMPLEFORMAT 32
|
||||
#define FIELD_SMINSAMPLEVALUE 33
|
||||
#define FIELD_SMAXSAMPLEVALUE 34
|
||||
#define FIELD_IMAGEDEPTH 35
|
||||
#define FIELD_TILEDEPTH 36
|
||||
#define FIELD_HALFTONEHINTS 37
|
||||
#define FIELD_YCBCRSUBSAMPLING 39
|
||||
#define FIELD_YCBCRPOSITIONING 40
|
||||
#define FIELD_REFBLACKWHITE 41
|
||||
#define FIELD_TRANSFERFUNCTION 44
|
||||
#define FIELD_INKNAMES 46
|
||||
#define FIELD_SUBIFD 49
|
||||
#define FIELD_SUBFILETYPE 5
|
||||
#define FIELD_BITSPERSAMPLE 6
|
||||
#define FIELD_COMPRESSION 7
|
||||
#define FIELD_PHOTOMETRIC 8
|
||||
#define FIELD_THRESHHOLDING 9
|
||||
#define FIELD_FILLORDER 10
|
||||
#define FIELD_ORIENTATION 15
|
||||
#define FIELD_SAMPLESPERPIXEL 16
|
||||
#define FIELD_ROWSPERSTRIP 17
|
||||
#define FIELD_MINSAMPLEVALUE 18
|
||||
#define FIELD_MAXSAMPLEVALUE 19
|
||||
#define FIELD_PLANARCONFIG 20
|
||||
#define FIELD_RESOLUTIONUNIT 22
|
||||
#define FIELD_PAGENUMBER 23
|
||||
#define FIELD_STRIPBYTECOUNTS 24
|
||||
#define FIELD_STRIPOFFSETS 25
|
||||
#define FIELD_COLORMAP 26
|
||||
#define FIELD_EXTRASAMPLES 31
|
||||
#define FIELD_SAMPLEFORMAT 32
|
||||
#define FIELD_SMINSAMPLEVALUE 33
|
||||
#define FIELD_SMAXSAMPLEVALUE 34
|
||||
#define FIELD_IMAGEDEPTH 35
|
||||
#define FIELD_TILEDEPTH 36
|
||||
#define FIELD_HALFTONEHINTS 37
|
||||
#define FIELD_YCBCRSUBSAMPLING 39
|
||||
#define FIELD_YCBCRPOSITIONING 40
|
||||
#define FIELD_REFBLACKWHITE 41
|
||||
#define FIELD_TRANSFERFUNCTION 44
|
||||
#define FIELD_INKNAMES 46
|
||||
#define FIELD_SUBIFD 49
|
||||
#define FIELD_NUMBEROFINKS 50
|
||||
/* FIELD_CUSTOM (see tiffio.h) 65 */
|
||||
/* end of support for well-known tags; codec-private tags follow */
|
||||
#define FIELD_CODEC 66 /* base of codec-private tags */
|
||||
|
||||
#define FIELD_CODEC 66 /* base of codec-private tags */
|
||||
|
||||
/*
|
||||
* Pseudo-tags don't normally need field bits since they are not written to an
|
||||
@ -187,131 +200,137 @@ typedef struct {
|
||||
* or ``unset'' then it can do using internal state flags without polluting
|
||||
* the field bit space defined for real tags.
|
||||
*/
|
||||
#define FIELD_PSEUDO 0
|
||||
#define FIELD_PSEUDO 0
|
||||
|
||||
#define FIELD_LAST (32*FIELD_SETLONGS-1)
|
||||
#define FIELD_LAST (32 * FIELD_SETLONGS - 1)
|
||||
|
||||
#define BITn(n) (((unsigned long)1L)<<((n)&0x1f))
|
||||
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n)/32])
|
||||
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
|
||||
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
|
||||
#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
|
||||
#define BITn(n) (((unsigned long)1L) << ((n)&0x1f))
|
||||
#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
|
||||
#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
|
||||
#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
|
||||
#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
|
||||
|
||||
#define FieldSet(fields, f) (fields[(f)/32] & BITn(f))
|
||||
#define ResetFieldBit(fields, f) (fields[(f)/32] &= ~BITn(f))
|
||||
#define FieldSet(fields, f) (fields[(f) / 32] & BITn(f))
|
||||
#define ResetFieldBit(fields, f) (fields[(f) / 32] &= ~BITn(f))
|
||||
|
||||
typedef enum {
|
||||
TIFF_SETGET_UNDEFINED = 0,
|
||||
TIFF_SETGET_ASCII = 1,
|
||||
TIFF_SETGET_UINT8 = 2,
|
||||
TIFF_SETGET_SINT8 = 3,
|
||||
TIFF_SETGET_UINT16 = 4,
|
||||
TIFF_SETGET_SINT16 = 5,
|
||||
TIFF_SETGET_UINT32 = 6,
|
||||
TIFF_SETGET_SINT32 = 7,
|
||||
TIFF_SETGET_UINT64 = 8,
|
||||
TIFF_SETGET_SINT64 = 9,
|
||||
TIFF_SETGET_FLOAT = 10,
|
||||
TIFF_SETGET_DOUBLE = 11,
|
||||
TIFF_SETGET_IFD8 = 12,
|
||||
TIFF_SETGET_INT = 13,
|
||||
TIFF_SETGET_UINT16_PAIR = 14,
|
||||
TIFF_SETGET_C0_ASCII = 15,
|
||||
TIFF_SETGET_C0_UINT8 = 16,
|
||||
TIFF_SETGET_C0_SINT8 = 17,
|
||||
TIFF_SETGET_C0_UINT16 = 18,
|
||||
TIFF_SETGET_C0_SINT16 = 19,
|
||||
TIFF_SETGET_C0_UINT32 = 20,
|
||||
TIFF_SETGET_C0_SINT32 = 21,
|
||||
TIFF_SETGET_C0_UINT64 = 22,
|
||||
TIFF_SETGET_C0_SINT64 = 23,
|
||||
TIFF_SETGET_C0_FLOAT = 24,
|
||||
TIFF_SETGET_C0_DOUBLE = 25,
|
||||
TIFF_SETGET_C0_IFD8 = 26,
|
||||
TIFF_SETGET_C16_ASCII = 27,
|
||||
TIFF_SETGET_C16_UINT8 = 28,
|
||||
TIFF_SETGET_C16_SINT8 = 29,
|
||||
TIFF_SETGET_C16_UINT16 = 30,
|
||||
TIFF_SETGET_C16_SINT16 = 31,
|
||||
TIFF_SETGET_C16_UINT32 = 32,
|
||||
TIFF_SETGET_C16_SINT32 = 33,
|
||||
TIFF_SETGET_C16_UINT64 = 34,
|
||||
TIFF_SETGET_C16_SINT64 = 35,
|
||||
TIFF_SETGET_C16_FLOAT = 36,
|
||||
TIFF_SETGET_C16_DOUBLE = 37,
|
||||
TIFF_SETGET_C16_IFD8 = 38,
|
||||
TIFF_SETGET_C32_ASCII = 39,
|
||||
TIFF_SETGET_C32_UINT8 = 40,
|
||||
TIFF_SETGET_C32_SINT8 = 41,
|
||||
TIFF_SETGET_C32_UINT16 = 42,
|
||||
TIFF_SETGET_C32_SINT16 = 43,
|
||||
TIFF_SETGET_C32_UINT32 = 44,
|
||||
TIFF_SETGET_C32_SINT32 = 45,
|
||||
TIFF_SETGET_C32_UINT64 = 46,
|
||||
TIFF_SETGET_C32_SINT64 = 47,
|
||||
TIFF_SETGET_C32_FLOAT = 48,
|
||||
TIFF_SETGET_C32_DOUBLE = 49,
|
||||
TIFF_SETGET_C32_IFD8 = 50,
|
||||
TIFF_SETGET_OTHER = 51
|
||||
typedef enum
|
||||
{
|
||||
TIFF_SETGET_UNDEFINED = 0,
|
||||
TIFF_SETGET_ASCII = 1,
|
||||
TIFF_SETGET_UINT8 = 2,
|
||||
TIFF_SETGET_SINT8 = 3,
|
||||
TIFF_SETGET_UINT16 = 4,
|
||||
TIFF_SETGET_SINT16 = 5,
|
||||
TIFF_SETGET_UINT32 = 6,
|
||||
TIFF_SETGET_SINT32 = 7,
|
||||
TIFF_SETGET_UINT64 = 8,
|
||||
TIFF_SETGET_SINT64 = 9,
|
||||
TIFF_SETGET_FLOAT = 10,
|
||||
TIFF_SETGET_DOUBLE = 11,
|
||||
TIFF_SETGET_IFD8 = 12,
|
||||
TIFF_SETGET_INT = 13,
|
||||
TIFF_SETGET_UINT16_PAIR = 14,
|
||||
TIFF_SETGET_C0_ASCII = 15,
|
||||
TIFF_SETGET_C0_UINT8 = 16,
|
||||
TIFF_SETGET_C0_SINT8 = 17,
|
||||
TIFF_SETGET_C0_UINT16 = 18,
|
||||
TIFF_SETGET_C0_SINT16 = 19,
|
||||
TIFF_SETGET_C0_UINT32 = 20,
|
||||
TIFF_SETGET_C0_SINT32 = 21,
|
||||
TIFF_SETGET_C0_UINT64 = 22,
|
||||
TIFF_SETGET_C0_SINT64 = 23,
|
||||
TIFF_SETGET_C0_FLOAT = 24,
|
||||
TIFF_SETGET_C0_DOUBLE = 25,
|
||||
TIFF_SETGET_C0_IFD8 = 26,
|
||||
TIFF_SETGET_C16_ASCII = 27,
|
||||
TIFF_SETGET_C16_UINT8 = 28,
|
||||
TIFF_SETGET_C16_SINT8 = 29,
|
||||
TIFF_SETGET_C16_UINT16 = 30,
|
||||
TIFF_SETGET_C16_SINT16 = 31,
|
||||
TIFF_SETGET_C16_UINT32 = 32,
|
||||
TIFF_SETGET_C16_SINT32 = 33,
|
||||
TIFF_SETGET_C16_UINT64 = 34,
|
||||
TIFF_SETGET_C16_SINT64 = 35,
|
||||
TIFF_SETGET_C16_FLOAT = 36,
|
||||
TIFF_SETGET_C16_DOUBLE = 37,
|
||||
TIFF_SETGET_C16_IFD8 = 38,
|
||||
TIFF_SETGET_C32_ASCII = 39,
|
||||
TIFF_SETGET_C32_UINT8 = 40,
|
||||
TIFF_SETGET_C32_SINT8 = 41,
|
||||
TIFF_SETGET_C32_UINT16 = 42,
|
||||
TIFF_SETGET_C32_SINT16 = 43,
|
||||
TIFF_SETGET_C32_UINT32 = 44,
|
||||
TIFF_SETGET_C32_SINT32 = 45,
|
||||
TIFF_SETGET_C32_UINT64 = 46,
|
||||
TIFF_SETGET_C32_SINT64 = 47,
|
||||
TIFF_SETGET_C32_FLOAT = 48,
|
||||
TIFF_SETGET_C32_DOUBLE = 49,
|
||||
TIFF_SETGET_C32_IFD8 = 50,
|
||||
TIFF_SETGET_OTHER = 51
|
||||
} TIFFSetGetFieldType;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern const TIFFFieldArray* _TIFFGetFields(void);
|
||||
extern const TIFFFieldArray* _TIFFGetExifFields(void);
|
||||
extern const TIFFFieldArray* _TIFFGetGpsFields(void);
|
||||
extern void _TIFFSetupFields(TIFF* tif, const TIFFFieldArray* infoarray);
|
||||
extern void _TIFFPrintFieldInfo(TIFF*, FILE*);
|
||||
extern const TIFFFieldArray *_TIFFGetFields(void);
|
||||
extern const TIFFFieldArray *_TIFFGetExifFields(void);
|
||||
extern const TIFFFieldArray *_TIFFGetGpsFields(void);
|
||||
extern void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *infoarray);
|
||||
extern void _TIFFPrintFieldInfo(TIFF *, FILE *);
|
||||
|
||||
extern int _TIFFFillStriles(TIFF*);
|
||||
extern int _TIFFFillStriles(TIFF *);
|
||||
|
||||
typedef enum {
|
||||
tfiatImage,
|
||||
tfiatExif,
|
||||
tfiatGps, /* EXIF-GPS fields array type */
|
||||
tfiatOther
|
||||
} TIFFFieldArrayType;
|
||||
typedef enum
|
||||
{
|
||||
tfiatImage,
|
||||
tfiatExif,
|
||||
tfiatGps, /* EXIF-GPS fields array type */
|
||||
tfiatOther
|
||||
} TIFFFieldArrayType;
|
||||
|
||||
struct _TIFFFieldArray {
|
||||
TIFFFieldArrayType type; /* array type, will be used to determine if IFD is image and such */
|
||||
uint32_t allocated_size; /* 0 if array is constant, other if modified by future definition extension support */
|
||||
uint32_t count; /* number of elements in fields array */
|
||||
TIFFField* fields; /* actual field info */
|
||||
};
|
||||
struct _TIFFFieldArray
|
||||
{
|
||||
TIFFFieldArrayType type; /* array type, will be used to determine if IFD
|
||||
is image and such */
|
||||
uint32_t allocated_size; /* 0 if array is constant, other if modified by
|
||||
future definition extension support */
|
||||
uint32_t count; /* number of elements in fields array */
|
||||
TIFFField *fields; /* actual field info */
|
||||
};
|
||||
|
||||
struct _TIFFField {
|
||||
uint32_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
uint32_t reserved; /* reserved for future extension */
|
||||
TIFFSetGetFieldType set_field_type; /* type to be passed to TIFFSetField */
|
||||
TIFFSetGetFieldType get_field_type; /* type to be passed to TIFFGetField */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char* field_name; /* ASCII name */
|
||||
TIFFFieldArray* field_subfields; /* if field points to child ifds, child ifd field definition array */
|
||||
};
|
||||
struct _TIFFField
|
||||
{
|
||||
uint32_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
uint32_t
|
||||
field_anonymous; /* if true, this is a unknown / anonymous tag */
|
||||
TIFFSetGetFieldType
|
||||
set_field_type; /* type to be passed to TIFFSetField */
|
||||
TIFFSetGetFieldType
|
||||
get_field_type; /* type to be passed to TIFFGetField */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
TIFFFieldArray *field_subfields; /* if field points to child ifds, child
|
||||
ifd field definition array */
|
||||
};
|
||||
|
||||
extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32_t);
|
||||
extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32_t, TIFFDataType);
|
||||
extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32_t, TIFFDataType);
|
||||
extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
|
||||
extern int _TIFFMergeFields(TIFF *, const TIFFField[], uint32_t);
|
||||
extern const TIFFField *_TIFFFindOrRegisterField(TIFF *, uint32_t,
|
||||
TIFFDataType);
|
||||
extern TIFFField *_TIFFCreateAnonField(TIFF *, uint32_t, TIFFDataType);
|
||||
extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
|
||||
extern int _TIFFCheckDirNumberAndOffset(TIFF *tif, tdir_t dirn,
|
||||
uint64_t diroff);
|
||||
extern int _TIFFGetDirNumberFromOffset(TIFF *tif, uint64_t diroff,
|
||||
tdir_t *dirn);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* _TIFFDIR_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
100
libs/libtiff/tif_hash_set.h
Normal file
100
libs/libtiff/tif_hash_set.h
Normal file
@ -0,0 +1,100 @@
|
||||
/**********************************************************************
|
||||
* $Id$
|
||||
*
|
||||
* Name: tif_hash_set.h
|
||||
* Project: TIFF - Common Portability Library
|
||||
* Purpose: Hash set functions.
|
||||
* Author: Even Rouault, <even dot rouault at spatialys.com>
|
||||
*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2008-2009, Even Rouault <even dot rouault at spatialys.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef TIFF_HASH_SET_H_INCLUDED
|
||||
#define TIFF_HASH_SET_H_INCLUDED
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* \file tif_hash_set.h
|
||||
*
|
||||
* Hash set implementation.
|
||||
*
|
||||
* An hash set is a data structure that holds elements that are unique
|
||||
* according to a comparison function. Operations on the hash set, such as
|
||||
* insertion, removal or lookup, are supposed to be fast if an efficient
|
||||
* "hash" function is provided.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Types */
|
||||
|
||||
/** Opaque type for a hash set */
|
||||
typedef struct _TIFFHashSet TIFFHashSet;
|
||||
|
||||
/** TIFFHashSetHashFunc */
|
||||
typedef unsigned long (*TIFFHashSetHashFunc)(const void *elt);
|
||||
|
||||
/** TIFFHashSetEqualFunc */
|
||||
typedef bool (*TIFFHashSetEqualFunc)(const void *elt1, const void *elt2);
|
||||
|
||||
/** TIFFHashSetFreeEltFunc */
|
||||
typedef void (*TIFFHashSetFreeEltFunc)(void *elt);
|
||||
|
||||
/* Functions */
|
||||
|
||||
TIFFHashSet *TIFFHashSetNew(TIFFHashSetHashFunc fnHashFunc,
|
||||
TIFFHashSetEqualFunc fnEqualFunc,
|
||||
TIFFHashSetFreeEltFunc fnFreeEltFunc);
|
||||
|
||||
void TIFFHashSetDestroy(TIFFHashSet *set);
|
||||
|
||||
#ifdef notused
|
||||
void TIFFHashSetClear(TIFFHashSet *set);
|
||||
|
||||
int TIFFHashSetSize(const TIFFHashSet *set);
|
||||
|
||||
/** TIFFHashSetIterEltFunc */
|
||||
typedef int (*TIFFHashSetIterEltFunc)(void *elt, void *user_data);
|
||||
|
||||
void TIFFHashSetForeach(TIFFHashSet *set, TIFFHashSetIterEltFunc fnIterFunc,
|
||||
void *user_data);
|
||||
#endif
|
||||
|
||||
bool TIFFHashSetInsert(TIFFHashSet *set, void *elt);
|
||||
|
||||
void *TIFFHashSetLookup(TIFFHashSet *set, const void *elt);
|
||||
|
||||
bool TIFFHashSetRemove(TIFFHashSet *set, const void *elt);
|
||||
|
||||
#ifdef notused
|
||||
bool TIFFHashSetRemoveDeferRehash(TIFFHashSet *set, const void *elt);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TIFF_HASH_SET_H_INCLUDED */
|
1422
libs/libtiff/tiff.h
1422
libs/libtiff/tiff.h
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,7 @@
|
||||
|
||||
/* Support strip chopping (whether or not to convert single-strip uncompressed
|
||||
images to multiple strips of ~8Kb to reduce memory usage) */
|
||||
#define STRIPCHOP_DEFAULT 1
|
||||
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
|
||||
|
||||
/* Enable SubIFD tag (330) support */
|
||||
#define SUBIFD_SUPPORT 1
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _TIFFIO_
|
||||
#define _TIFFIO_
|
||||
#define _TIFFIO_
|
||||
|
||||
/*
|
||||
* TIFF I/O Library Definitions.
|
||||
@ -65,17 +65,17 @@ typedef struct tiff TIFF;
|
||||
typedef TIFF_SSIZE_T tmsize_t;
|
||||
#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
|
||||
|
||||
typedef uint64_t toff_t; /* file offset */
|
||||
typedef uint64_t toff_t; /* file offset */
|
||||
/* the following are deprecated and should be replaced by their defining
|
||||
counterparts */
|
||||
typedef uint32_t ttag_t; /* directory tag */
|
||||
typedef uint16_t tdir_t; /* directory index */
|
||||
typedef uint16_t tsample_t; /* sample number */
|
||||
typedef uint32_t tstrile_t; /* strip or tile number */
|
||||
typedef tstrile_t tstrip_t; /* strip number */
|
||||
typedef tstrile_t ttile_t; /* tile number */
|
||||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||
typedef void* tdata_t; /* image data ref */
|
||||
typedef uint32_t ttag_t; /* directory tag */
|
||||
typedef uint32_t tdir_t; /* directory index */
|
||||
typedef uint16_t tsample_t; /* sample number */
|
||||
typedef uint32_t tstrile_t; /* strip or tile number */
|
||||
typedef tstrile_t tstrip_t; /* strip number */
|
||||
typedef tstrile_t ttile_t; /* tile number */
|
||||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||
typedef void *tdata_t; /* image data ref */
|
||||
|
||||
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
|
||||
#define __WIN32__
|
||||
@ -89,21 +89,22 @@ typedef void* tdata_t; /* image data ref */
|
||||
*/
|
||||
|
||||
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
||||
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
|
||||
# define AVOID_WIN32_FILEIO
|
||||
# endif
|
||||
#if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \
|
||||
!defined(USE_WIN32_FILEIO)
|
||||
#define AVOID_WIN32_FILEIO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_WIN32_FILEIO)
|
||||
# define VC_EXTRALEAN
|
||||
# include <windows.h>
|
||||
# ifdef __WIN32__
|
||||
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
|
||||
# else
|
||||
typedef HFILE thandle_t; /* client data handle */
|
||||
# endif /* __WIN32__ */
|
||||
#define VC_EXTRALEAN
|
||||
#include <windows.h>
|
||||
#ifdef __WIN32__
|
||||
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
|
||||
#else
|
||||
typedef void* thandle_t; /* client data handle */
|
||||
typedef HFILE thandle_t; /* client data handle */
|
||||
#endif /* __WIN32__ */
|
||||
#else
|
||||
typedef void *thandle_t; /* client data handle */
|
||||
#endif /* USE_WIN32_FILEIO */
|
||||
|
||||
/*
|
||||
@ -112,15 +113,15 @@ typedef void* thandle_t; /* client data handle */
|
||||
* very large. Bit-or these flags to enable printing
|
||||
* multiple items.
|
||||
*/
|
||||
#define TIFFPRINT_NONE 0x0 /* no extra info */
|
||||
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
|
||||
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
|
||||
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
|
||||
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
|
||||
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
||||
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
||||
#define TIFFPRINT_NONE 0x0 /* no extra info */
|
||||
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
|
||||
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
|
||||
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
|
||||
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
|
||||
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
||||
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Colour conversion stuff
|
||||
*/
|
||||
|
||||
@ -135,42 +136,45 @@ typedef void* thandle_t; /* client data handle */
|
||||
|
||||
/* Structure for holding information about a display device. */
|
||||
|
||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||
|
||||
typedef struct {
|
||||
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||
float d_YCR; /* Light o/p for reference white */
|
||||
float d_YCG;
|
||||
float d_YCB;
|
||||
uint32_t d_Vrwr; /* Pixel values for ref. white */
|
||||
uint32_t d_Vrwg;
|
||||
uint32_t d_Vrwb;
|
||||
float d_Y0R; /* Residual light for black pixel */
|
||||
float d_Y0G;
|
||||
float d_Y0B;
|
||||
float d_gammaR; /* Gamma values for the three guns */
|
||||
float d_gammaG;
|
||||
float d_gammaB;
|
||||
typedef struct
|
||||
{
|
||||
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||
float d_YCR; /* Light o/p for reference white */
|
||||
float d_YCG;
|
||||
float d_YCB;
|
||||
uint32_t d_Vrwr; /* Pixel values for ref. white */
|
||||
uint32_t d_Vrwg;
|
||||
uint32_t d_Vrwb;
|
||||
float d_Y0R; /* Residual light for black pixel */
|
||||
float d_Y0G;
|
||||
float d_Y0B;
|
||||
float d_gammaR; /* Gamma values for the three guns */
|
||||
float d_gammaG;
|
||||
float d_gammaB;
|
||||
} TIFFDisplay;
|
||||
|
||||
typedef struct { /* YCbCr->RGB support */
|
||||
TIFFRGBValue* clamptab; /* range clamping table */
|
||||
int* Cr_r_tab;
|
||||
int* Cb_b_tab;
|
||||
int32_t* Cr_g_tab;
|
||||
int32_t* Cb_g_tab;
|
||||
int32_t* Y_tab;
|
||||
typedef struct
|
||||
{ /* YCbCr->RGB support */
|
||||
TIFFRGBValue *clamptab; /* range clamping table */
|
||||
int *Cr_r_tab;
|
||||
int *Cb_b_tab;
|
||||
int32_t *Cr_g_tab;
|
||||
int32_t *Cb_g_tab;
|
||||
int32_t *Y_tab;
|
||||
} TIFFYCbCrToRGB;
|
||||
|
||||
typedef struct { /* CIE Lab 1976->RGB support */
|
||||
int range; /* Size of conversion table */
|
||||
typedef struct
|
||||
{ /* CIE Lab 1976->RGB support */
|
||||
int range; /* Size of conversion table */
|
||||
#define CIELABTORGB_TABLE_RANGE 1500
|
||||
float rstep, gstep, bstep;
|
||||
float X0, Y0, Z0; /* Reference white point */
|
||||
TIFFDisplay display;
|
||||
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
|
||||
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
|
||||
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||
float rstep, gstep, bstep;
|
||||
float X0, Y0, Z0; /* Reference white point */
|
||||
TIFFDisplay display;
|
||||
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
|
||||
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
|
||||
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||
} TIFFCIELabToRGB;
|
||||
|
||||
/*
|
||||
@ -180,63 +184,66 @@ typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
||||
/*
|
||||
* The image reading and conversion routines invoke
|
||||
* ``put routines'' to copy/image/whatever tiles of
|
||||
* raw image data. A default set of routines are
|
||||
* raw image data. A default set of routines are
|
||||
* provided to convert/copy raw image data to 8-bit
|
||||
* packed ABGR format rasters. Applications can supply
|
||||
* alternate routines that unpack the data into a
|
||||
* different format or, for example, unpack the data
|
||||
* and draw the unpacked raster on the display.
|
||||
*/
|
||||
typedef void (*tileContigRoutine)
|
||||
(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
|
||||
unsigned char*);
|
||||
typedef void (*tileSeparateRoutine)
|
||||
(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
|
||||
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||
typedef void (*tileContigRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
|
||||
uint32_t, uint32_t, uint32_t, int32_t,
|
||||
int32_t, unsigned char *);
|
||||
typedef void (*tileSeparateRoutine)(TIFFRGBAImage *, uint32_t *, uint32_t,
|
||||
uint32_t, uint32_t, uint32_t, int32_t,
|
||||
int32_t, unsigned char *, unsigned char *,
|
||||
unsigned char *, unsigned char *);
|
||||
/*
|
||||
* RGBA-reader state.
|
||||
*/
|
||||
struct _TIFFRGBAImage {
|
||||
TIFF* tif; /* image handle */
|
||||
int stoponerr; /* stop on read error */
|
||||
int isContig; /* data is packed/separate */
|
||||
int alpha; /* type of alpha data present */
|
||||
uint32_t width; /* image width */
|
||||
uint32_t height; /* image height */
|
||||
uint16_t bitspersample; /* image bits/sample */
|
||||
uint16_t samplesperpixel; /* image samples/pixel */
|
||||
uint16_t orientation; /* image orientation */
|
||||
uint16_t req_orientation; /* requested orientation */
|
||||
uint16_t photometric; /* image photometric interp */
|
||||
uint16_t* redcmap; /* colormap palette */
|
||||
uint16_t* greencmap;
|
||||
uint16_t* bluecmap;
|
||||
/* get image data routine */
|
||||
int (*get)(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
|
||||
/* put decoded strip/tile */
|
||||
union {
|
||||
void (*any)(TIFFRGBAImage*);
|
||||
tileContigRoutine contig;
|
||||
tileSeparateRoutine separate;
|
||||
} put;
|
||||
TIFFRGBValue* Map; /* sample mapping array */
|
||||
uint32_t** BWmap; /* black&white map */
|
||||
uint32_t** PALmap; /* palette image map */
|
||||
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
||||
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
||||
struct _TIFFRGBAImage
|
||||
{
|
||||
TIFF *tif; /* image handle */
|
||||
int stoponerr; /* stop on read error */
|
||||
int isContig; /* data is packed/separate */
|
||||
int alpha; /* type of alpha data present */
|
||||
uint32_t width; /* image width */
|
||||
uint32_t height; /* image height */
|
||||
uint16_t bitspersample; /* image bits/sample */
|
||||
uint16_t samplesperpixel; /* image samples/pixel */
|
||||
uint16_t orientation; /* image orientation */
|
||||
uint16_t req_orientation; /* requested orientation */
|
||||
uint16_t photometric; /* image photometric interp */
|
||||
uint16_t *redcmap; /* colormap palette */
|
||||
uint16_t *greencmap;
|
||||
uint16_t *bluecmap;
|
||||
/* get image data routine */
|
||||
int (*get)(TIFFRGBAImage *, uint32_t *, uint32_t, uint32_t);
|
||||
/* put decoded strip/tile */
|
||||
union
|
||||
{
|
||||
void (*any)(TIFFRGBAImage *);
|
||||
tileContigRoutine contig;
|
||||
tileSeparateRoutine separate;
|
||||
} put;
|
||||
TIFFRGBValue *Map; /* sample mapping array */
|
||||
uint32_t **BWmap; /* black&white map */
|
||||
uint32_t **PALmap; /* palette image map */
|
||||
TIFFYCbCrToRGB *ycbcr; /* YCbCr conversion state */
|
||||
TIFFCIELabToRGB *cielab; /* CIE L*a*b conversion state */
|
||||
|
||||
uint8_t* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
|
||||
uint8_t* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
|
||||
uint8_t *UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
|
||||
uint8_t *Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
|
||||
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for extracting components from the
|
||||
* packed ABGR form returned by TIFFReadRGBAImage.
|
||||
*/
|
||||
#define TIFFGetR(abgr) ((abgr) & 0xff)
|
||||
#define TIFFGetR(abgr) ((abgr)&0xff)
|
||||
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
|
||||
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
|
||||
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
|
||||
@ -248,15 +255,16 @@ struct _TIFFRGBAImage {
|
||||
* More codecs may be registered through calls to the library
|
||||
* and/or the builtin implementations may be overridden.
|
||||
*/
|
||||
typedef int (*TIFFInitMethod)(TIFF*, int);
|
||||
typedef struct {
|
||||
char* name;
|
||||
uint16_t scheme;
|
||||
TIFFInitMethod init;
|
||||
typedef int (*TIFFInitMethod)(TIFF *, int);
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
uint16_t scheme;
|
||||
TIFFInitMethod init;
|
||||
} TIFFCodec;
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* share internal LogLuv conversion routines? */
|
||||
#ifndef LOGLUV_PUBLIC
|
||||
@ -264,311 +272,376 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__attribute__)
|
||||
# define TIFF_ATTRIBUTE(x) __attribute__(x)
|
||||
#define TIFF_ATTRIBUTE(x) __attribute__(x)
|
||||
#else
|
||||
# define TIFF_ATTRIBUTE(x) /*nothing*/
|
||||
#define TIFF_ATTRIBUTE(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
|
||||
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
|
||||
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
|
||||
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
||||
typedef int (*TIFFCloseProc)(thandle_t);
|
||||
typedef toff_t (*TIFFSizeProc)(thandle_t);
|
||||
typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size);
|
||||
typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size);
|
||||
typedef void (*TIFFExtendProc)(TIFF*);
|
||||
typedef void (*TIFFErrorHandler)(const char *, const char *, va_list);
|
||||
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char *, const char *,
|
||||
va_list);
|
||||
typedef int (*TIFFErrorHandlerExtR)(TIFF *, void *user_data, const char *,
|
||||
const char *, va_list);
|
||||
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void *, tmsize_t);
|
||||
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
||||
typedef int (*TIFFCloseProc)(thandle_t);
|
||||
typedef toff_t (*TIFFSizeProc)(thandle_t);
|
||||
typedef int (*TIFFMapFileProc)(thandle_t, void **base, toff_t *size);
|
||||
typedef void (*TIFFUnmapFileProc)(thandle_t, void *base, toff_t size);
|
||||
typedef void (*TIFFExtendProc)(TIFF *);
|
||||
|
||||
extern const char* TIFFGetVersion(void);
|
||||
extern const char *TIFFGetVersion(void);
|
||||
|
||||
extern const TIFFCodec* TIFFFindCODEC(uint16_t);
|
||||
extern TIFFCodec* TIFFRegisterCODEC(uint16_t, const char*, TIFFInitMethod);
|
||||
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
||||
extern int TIFFIsCODECConfigured(uint16_t);
|
||||
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
|
||||
extern const TIFFCodec *TIFFFindCODEC(uint16_t);
|
||||
extern TIFFCodec *TIFFRegisterCODEC(uint16_t, const char *, TIFFInitMethod);
|
||||
extern void TIFFUnRegisterCODEC(TIFFCodec *);
|
||||
extern int TIFFIsCODECConfigured(uint16_t);
|
||||
extern TIFFCodec *TIFFGetConfiguredCODECs(void);
|
||||
|
||||
/*
|
||||
* Auxiliary functions.
|
||||
*/
|
||||
/*
|
||||
* Auxiliary functions.
|
||||
*/
|
||||
|
||||
extern void* _TIFFmalloc(tmsize_t s);
|
||||
extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
|
||||
extern void* _TIFFrealloc(void* p, tmsize_t s);
|
||||
extern void _TIFFmemset(void* p, int v, tmsize_t c);
|
||||
extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
|
||||
extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c);
|
||||
extern void _TIFFfree(void* p);
|
||||
extern void *_TIFFmalloc(tmsize_t s);
|
||||
extern void *_TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
|
||||
extern void *_TIFFrealloc(void *p, tmsize_t s);
|
||||
extern void _TIFFmemset(void *p, int v, tmsize_t c);
|
||||
extern void _TIFFmemcpy(void *d, const void *s, tmsize_t c);
|
||||
extern int _TIFFmemcmp(const void *p1, const void *p2, tmsize_t c);
|
||||
extern void _TIFFfree(void *p);
|
||||
|
||||
/*
|
||||
** Stuff, related to tag handling and creating custom tags.
|
||||
*/
|
||||
extern int TIFFGetTagListCount( TIFF * );
|
||||
extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index );
|
||||
|
||||
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
||||
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
||||
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
|
||||
#define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */
|
||||
/*
|
||||
** Stuff, related to tag handling and creating custom tags.
|
||||
*/
|
||||
extern int TIFFGetTagListCount(TIFF *);
|
||||
extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index);
|
||||
|
||||
#define FIELD_CUSTOM 65
|
||||
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
||||
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
||||
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
|
||||
#define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */
|
||||
|
||||
typedef struct _TIFFField TIFFField;
|
||||
typedef struct _TIFFFieldArray TIFFFieldArray;
|
||||
#define FIELD_CUSTOM 65
|
||||
|
||||
extern const TIFFField* TIFFFindField(TIFF *, uint32_t, TIFFDataType);
|
||||
extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32_t);
|
||||
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
|
||||
typedef struct _TIFFField TIFFField;
|
||||
typedef struct _TIFFFieldArray TIFFFieldArray;
|
||||
|
||||
extern uint32_t TIFFFieldTag(const TIFFField*);
|
||||
extern const char* TIFFFieldName(const TIFFField*);
|
||||
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
|
||||
extern int TIFFFieldPassCount(const TIFFField*);
|
||||
extern int TIFFFieldReadCount(const TIFFField*);
|
||||
extern int TIFFFieldWriteCount(const TIFFField*);
|
||||
extern const TIFFField *TIFFFindField(TIFF *, uint32_t, TIFFDataType);
|
||||
extern const TIFFField *TIFFFieldWithTag(TIFF *, uint32_t);
|
||||
extern const TIFFField *TIFFFieldWithName(TIFF *, const char *);
|
||||
|
||||
typedef int (*TIFFVSetMethod)(TIFF*, uint32_t, va_list);
|
||||
typedef int (*TIFFVGetMethod)(TIFF*, uint32_t, va_list);
|
||||
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
|
||||
extern uint32_t TIFFFieldTag(const TIFFField *);
|
||||
extern const char *TIFFFieldName(const TIFFField *);
|
||||
extern TIFFDataType TIFFFieldDataType(const TIFFField *);
|
||||
extern int TIFFFieldPassCount(const TIFFField *);
|
||||
extern int TIFFFieldReadCount(const TIFFField *);
|
||||
extern int TIFFFieldWriteCount(const TIFFField *);
|
||||
extern int
|
||||
TIFFFieldSetGetSize(const TIFFField *); /* returns internal storage size of
|
||||
TIFFSetGetFieldType in bytes. */
|
||||
extern int TIFFFieldSetGetCountSize(
|
||||
const TIFFField *); /* returns size of count parameter 0=none,
|
||||
2=uint16_t, 4=uint32_t */
|
||||
extern int TIFFFieldIsAnonymous(const TIFFField *);
|
||||
|
||||
typedef struct {
|
||||
TIFFVSetMethod vsetfield; /* tag set routine */
|
||||
TIFFVGetMethod vgetfield; /* tag get routine */
|
||||
TIFFPrintMethod printdir; /* directory print routine */
|
||||
} TIFFTagMethods;
|
||||
typedef int (*TIFFVSetMethod)(TIFF *, uint32_t, va_list);
|
||||
typedef int (*TIFFVGetMethod)(TIFF *, uint32_t, va_list);
|
||||
typedef void (*TIFFPrintMethod)(TIFF *, FILE *, long);
|
||||
|
||||
extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
|
||||
extern void *TIFFGetClientInfo(TIFF *, const char *);
|
||||
extern void TIFFSetClientInfo(TIFF *, void *, const char *);
|
||||
typedef struct
|
||||
{
|
||||
TIFFVSetMethod vsetfield; /* tag set routine */
|
||||
TIFFVGetMethod vgetfield; /* tag get routine */
|
||||
TIFFPrintMethod printdir; /* directory print routine */
|
||||
} TIFFTagMethods;
|
||||
|
||||
extern void TIFFCleanup(TIFF* tif);
|
||||
extern void TIFFClose(TIFF* tif);
|
||||
extern int TIFFFlush(TIFF* tif);
|
||||
extern int TIFFFlushData(TIFF* tif);
|
||||
extern int TIFFGetField(TIFF* tif, uint32_t tag, ...);
|
||||
extern int TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap);
|
||||
extern int TIFFGetFieldDefaulted(TIFF* tif, uint32_t tag, ...);
|
||||
extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32_t tag, va_list ap);
|
||||
extern int TIFFReadDirectory(TIFF* tif);
|
||||
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
|
||||
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
|
||||
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
|
||||
extern uint64_t TIFFScanlineSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFScanlineSize(TIFF* tif);
|
||||
extern uint64_t TIFFRasterScanlineSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
|
||||
extern uint64_t TIFFStripSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFStripSize(TIFF* tif);
|
||||
extern uint64_t TIFFRawStripSize64(TIFF* tif, uint32_t strip);
|
||||
extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32_t strip);
|
||||
extern uint64_t TIFFVStripSize64(TIFF* tif, uint32_t nrows);
|
||||
extern tmsize_t TIFFVStripSize(TIFF* tif, uint32_t nrows);
|
||||
extern uint64_t TIFFTileRowSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFTileRowSize(TIFF* tif);
|
||||
extern uint64_t TIFFTileSize64(TIFF* tif);
|
||||
extern tmsize_t TIFFTileSize(TIFF* tif);
|
||||
extern uint64_t TIFFVTileSize64(TIFF* tif, uint32_t nrows);
|
||||
extern tmsize_t TIFFVTileSize(TIFF* tif, uint32_t nrows);
|
||||
extern uint32_t TIFFDefaultStripSize(TIFF* tif, uint32_t request);
|
||||
extern void TIFFDefaultTileSize(TIFF*, uint32_t*, uint32_t*);
|
||||
extern int TIFFFileno(TIFF*);
|
||||
extern int TIFFSetFileno(TIFF*, int);
|
||||
extern thandle_t TIFFClientdata(TIFF*);
|
||||
extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
|
||||
extern int TIFFGetMode(TIFF*);
|
||||
extern int TIFFSetMode(TIFF*, int);
|
||||
extern int TIFFIsTiled(TIFF*);
|
||||
extern int TIFFIsByteSwapped(TIFF*);
|
||||
extern int TIFFIsUpSampled(TIFF*);
|
||||
extern int TIFFIsMSB2LSB(TIFF*);
|
||||
extern int TIFFIsBigEndian(TIFF*);
|
||||
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
|
||||
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
|
||||
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
|
||||
extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
|
||||
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
|
||||
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
|
||||
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
|
||||
extern uint32_t TIFFCurrentRow(TIFF*);
|
||||
extern uint16_t TIFFCurrentDirectory(TIFF*);
|
||||
extern uint16_t TIFFNumberOfDirectories(TIFF*);
|
||||
extern uint64_t TIFFCurrentDirOffset(TIFF*);
|
||||
extern uint32_t TIFFCurrentStrip(TIFF*);
|
||||
extern uint32_t TIFFCurrentTile(TIFF* tif);
|
||||
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||
extern int TIFFSetupStrips(TIFF *);
|
||||
extern int TIFFWriteCheck(TIFF*, int, const char *);
|
||||
extern void TIFFFreeDirectory(TIFF*);
|
||||
extern int TIFFCreateDirectory(TIFF*);
|
||||
extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
|
||||
extern int TIFFCreateEXIFDirectory(TIFF*);
|
||||
extern int TIFFCreateGPSDirectory(TIFF*);
|
||||
extern int TIFFLastDirectory(TIFF*);
|
||||
extern int TIFFSetDirectory(TIFF*, uint16_t);
|
||||
extern int TIFFSetSubDirectory(TIFF*, uint64_t);
|
||||
extern int TIFFUnlinkDirectory(TIFF*, uint16_t);
|
||||
extern int TIFFSetField(TIFF*, uint32_t, ...);
|
||||
extern int TIFFVSetField(TIFF*, uint32_t, va_list);
|
||||
extern int TIFFUnsetField(TIFF*, uint32_t);
|
||||
extern int TIFFWriteDirectory(TIFF *);
|
||||
extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
|
||||
extern int TIFFCheckpointDirectory(TIFF *);
|
||||
extern int TIFFRewriteDirectory(TIFF *);
|
||||
extern int TIFFDeferStrileArrayWriting(TIFF *);
|
||||
extern int TIFFForceStrileArrayWriting(TIFF* );
|
||||
extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
|
||||
extern void *TIFFGetClientInfo(TIFF *, const char *);
|
||||
extern void TIFFSetClientInfo(TIFF *, void *, const char *);
|
||||
|
||||
extern void TIFFCleanup(TIFF *tif);
|
||||
extern void TIFFClose(TIFF *tif);
|
||||
extern int TIFFFlush(TIFF *tif);
|
||||
extern int TIFFFlushData(TIFF *tif);
|
||||
extern int TIFFGetField(TIFF *tif, uint32_t tag, ...);
|
||||
extern int TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap);
|
||||
extern int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag, ...);
|
||||
extern int TIFFVGetFieldDefaulted(TIFF *tif, uint32_t tag, va_list ap);
|
||||
extern int TIFFReadDirectory(TIFF *tif);
|
||||
extern int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff,
|
||||
const TIFFFieldArray *infoarray);
|
||||
extern int TIFFReadEXIFDirectory(TIFF *tif, toff_t diroff);
|
||||
extern int TIFFReadGPSDirectory(TIFF *tif, toff_t diroff);
|
||||
extern uint64_t TIFFScanlineSize64(TIFF *tif);
|
||||
extern tmsize_t TIFFScanlineSize(TIFF *tif);
|
||||
extern uint64_t TIFFRasterScanlineSize64(TIFF *tif);
|
||||
extern tmsize_t TIFFRasterScanlineSize(TIFF *tif);
|
||||
extern uint64_t TIFFStripSize64(TIFF *tif);
|
||||
extern tmsize_t TIFFStripSize(TIFF *tif);
|
||||
extern uint64_t TIFFRawStripSize64(TIFF *tif, uint32_t strip);
|
||||
extern tmsize_t TIFFRawStripSize(TIFF *tif, uint32_t strip);
|
||||
extern uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows);
|
||||
extern tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows);
|
||||
extern uint64_t TIFFTileRowSize64(TIFF *tif);
|
||||
extern tmsize_t TIFFTileRowSize(TIFF *tif);
|
||||
extern uint64_t TIFFTileSize64(TIFF *tif);
|
||||
extern tmsize_t TIFFTileSize(TIFF *tif);
|
||||
extern uint64_t TIFFVTileSize64(TIFF *tif, uint32_t nrows);
|
||||
extern tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows);
|
||||
extern uint32_t TIFFDefaultStripSize(TIFF *tif, uint32_t request);
|
||||
extern void TIFFDefaultTileSize(TIFF *, uint32_t *, uint32_t *);
|
||||
extern int TIFFFileno(TIFF *);
|
||||
extern int TIFFSetFileno(TIFF *, int);
|
||||
extern thandle_t TIFFClientdata(TIFF *);
|
||||
extern thandle_t TIFFSetClientdata(TIFF *, thandle_t);
|
||||
extern int TIFFGetMode(TIFF *);
|
||||
extern int TIFFSetMode(TIFF *, int);
|
||||
extern int TIFFIsTiled(TIFF *);
|
||||
extern int TIFFIsByteSwapped(TIFF *);
|
||||
extern int TIFFIsUpSampled(TIFF *);
|
||||
extern int TIFFIsMSB2LSB(TIFF *);
|
||||
extern int TIFFIsBigEndian(TIFF *);
|
||||
extern int TIFFIsBigTIFF(TIFF *);
|
||||
extern TIFFReadWriteProc TIFFGetReadProc(TIFF *);
|
||||
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF *);
|
||||
extern TIFFSeekProc TIFFGetSeekProc(TIFF *);
|
||||
extern TIFFCloseProc TIFFGetCloseProc(TIFF *);
|
||||
extern TIFFSizeProc TIFFGetSizeProc(TIFF *);
|
||||
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF *);
|
||||
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *);
|
||||
extern uint32_t TIFFCurrentRow(TIFF *);
|
||||
extern tdir_t TIFFCurrentDirectory(TIFF *);
|
||||
extern tdir_t TIFFNumberOfDirectories(TIFF *);
|
||||
extern uint64_t TIFFCurrentDirOffset(TIFF *);
|
||||
extern uint32_t TIFFCurrentStrip(TIFF *);
|
||||
extern uint32_t TIFFCurrentTile(TIFF *tif);
|
||||
extern int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size);
|
||||
extern int TIFFWriteBufferSetup(TIFF *tif, void *bp, tmsize_t size);
|
||||
extern int TIFFSetupStrips(TIFF *);
|
||||
extern int TIFFWriteCheck(TIFF *, int, const char *);
|
||||
extern void TIFFFreeDirectory(TIFF *);
|
||||
extern int TIFFCreateDirectory(TIFF *);
|
||||
extern int TIFFCreateCustomDirectory(TIFF *, const TIFFFieldArray *);
|
||||
extern int TIFFCreateEXIFDirectory(TIFF *);
|
||||
extern int TIFFCreateGPSDirectory(TIFF *);
|
||||
extern int TIFFLastDirectory(TIFF *);
|
||||
extern int TIFFSetDirectory(TIFF *, tdir_t);
|
||||
extern int TIFFSetSubDirectory(TIFF *, uint64_t);
|
||||
extern int TIFFUnlinkDirectory(TIFF *, tdir_t);
|
||||
extern int TIFFSetField(TIFF *, uint32_t, ...);
|
||||
extern int TIFFVSetField(TIFF *, uint32_t, va_list);
|
||||
extern int TIFFUnsetField(TIFF *, uint32_t);
|
||||
extern int TIFFWriteDirectory(TIFF *);
|
||||
extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
|
||||
extern int TIFFCheckpointDirectory(TIFF *);
|
||||
extern int TIFFRewriteDirectory(TIFF *);
|
||||
extern int TIFFDeferStrileArrayWriting(TIFF *);
|
||||
extern int TIFFForceStrileArrayWriting(TIFF *);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
||||
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
|
||||
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
|
||||
extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int = 0);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*,
|
||||
int = ORIENTATION_BOTLEFT, int = 0);
|
||||
extern void TIFFPrintDirectory(TIFF *, FILE *, long = 0);
|
||||
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
|
||||
uint16_t sample = 0);
|
||||
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
|
||||
uint16_t sample = 0);
|
||||
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||
int = 0);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||
int = ORIENTATION_BOTLEFT, int = 0);
|
||||
#else
|
||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
||||
extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
|
||||
extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
|
||||
extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*, int, int);
|
||||
extern void TIFFPrintDirectory(TIFF *, FILE *, long);
|
||||
extern int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row,
|
||||
uint16_t sample);
|
||||
extern int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row,
|
||||
uint16_t sample);
|
||||
extern int TIFFReadRGBAImage(TIFF *, uint32_t, uint32_t, uint32_t *, int);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||
int, int);
|
||||
#endif
|
||||
|
||||
extern int TIFFReadRGBAStrip(TIFF*, uint32_t, uint32_t * );
|
||||
extern int TIFFReadRGBATile(TIFF*, uint32_t, uint32_t, uint32_t * );
|
||||
extern int TIFFReadRGBAStripExt(TIFF*, uint32_t, uint32_t *, int stop_on_error );
|
||||
extern int TIFFReadRGBATileExt(TIFF*, uint32_t, uint32_t, uint32_t *, int stop_on_error );
|
||||
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
|
||||
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
|
||||
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
|
||||
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
|
||||
extern TIFF* TIFFOpen(const char*, const char*);
|
||||
# ifdef __WIN32__
|
||||
extern TIFF* TIFFOpenW(const wchar_t*, const char*);
|
||||
# endif /* __WIN32__ */
|
||||
extern TIFF* TIFFFdOpen(int, const char*, const char*);
|
||||
extern TIFF* TIFFClientOpen(const char*, const char*,
|
||||
thandle_t,
|
||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
||||
TIFFSeekProc, TIFFCloseProc,
|
||||
TIFFSizeProc,
|
||||
TIFFMapFileProc, TIFFUnmapFileProc);
|
||||
extern const char* TIFFFileName(TIFF*);
|
||||
extern const char* TIFFSetFileName(TIFF*, const char *);
|
||||
extern void TIFFError(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
|
||||
extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
|
||||
extern void TIFFWarning(const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,2,3)));
|
||||
extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) TIFF_ATTRIBUTE((__format__ (__printf__,3,4)));
|
||||
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
||||
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
|
||||
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
|
||||
extern uint32_t TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
|
||||
extern int TIFFCheckTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
|
||||
extern uint32_t TIFFNumberOfTiles(TIFF*);
|
||||
extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
|
||||
extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
|
||||
extern uint32_t TIFFComputeStrip(TIFF*, uint32_t, uint16_t);
|
||||
extern uint32_t TIFFNumberOfStrips(TIFF*);
|
||||
extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
|
||||
extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
|
||||
extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
|
||||
extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
|
||||
extern int TIFFReadFromUserBuffer(TIFF* tif, uint32_t strile,
|
||||
void* inbuf, tmsize_t insize,
|
||||
void* outbuf, tmsize_t outsize);
|
||||
extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
|
||||
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
|
||||
extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
|
||||
extern void TIFFSwabShort(uint16_t*);
|
||||
extern void TIFFSwabLong(uint32_t*);
|
||||
extern void TIFFSwabLong8(uint64_t*);
|
||||
extern void TIFFSwabFloat(float*);
|
||||
extern void TIFFSwabDouble(double*);
|
||||
extern void TIFFSwabArrayOfShort(uint16_t* wp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfTriples(uint8_t* tp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfLong(uint32_t* lp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfLong8(uint64_t* lp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
|
||||
extern void TIFFReverseBits(uint8_t* cp, tmsize_t n);
|
||||
extern const unsigned char* TIFFGetBitRevTable(int);
|
||||
extern int TIFFReadRGBAStrip(TIFF *, uint32_t, uint32_t *);
|
||||
extern int TIFFReadRGBATile(TIFF *, uint32_t, uint32_t, uint32_t *);
|
||||
extern int TIFFReadRGBAStripExt(TIFF *, uint32_t, uint32_t *,
|
||||
int stop_on_error);
|
||||
extern int TIFFReadRGBATileExt(TIFF *, uint32_t, uint32_t, uint32_t *,
|
||||
int stop_on_error);
|
||||
extern int TIFFRGBAImageOK(TIFF *, char[1024]);
|
||||
extern int TIFFRGBAImageBegin(TIFFRGBAImage *, TIFF *, int, char[1024]);
|
||||
extern int TIFFRGBAImageGet(TIFFRGBAImage *, uint32_t *, uint32_t,
|
||||
uint32_t);
|
||||
extern void TIFFRGBAImageEnd(TIFFRGBAImage *);
|
||||
|
||||
extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
|
||||
extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
|
||||
extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, int *pbErr);
|
||||
extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile, int *pbErr);
|
||||
extern const char *TIFFFileName(TIFF *);
|
||||
extern const char *TIFFSetFileName(TIFF *, const char *);
|
||||
extern void TIFFError(const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 2, 3)));
|
||||
extern void TIFFErrorExt(thandle_t, const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
|
||||
extern void TIFFWarning(const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 2, 3)));
|
||||
extern void TIFFWarningExt(thandle_t, const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
|
||||
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
||||
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
|
||||
|
||||
extern void TIFFWarningExtR(TIFF *, const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
|
||||
extern void TIFFErrorExtR(TIFF *, const char *, const char *, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 3, 4)));
|
||||
|
||||
typedef struct TIFFOpenOptions TIFFOpenOptions;
|
||||
extern TIFFOpenOptions *TIFFOpenOptionsAlloc(void);
|
||||
extern void TIFFOpenOptionsFree(TIFFOpenOptions *);
|
||||
extern void
|
||||
TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts,
|
||||
tmsize_t max_single_mem_alloc);
|
||||
extern void
|
||||
TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts,
|
||||
TIFFErrorHandlerExtR handler,
|
||||
void *errorhandler_user_data);
|
||||
extern void
|
||||
TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts,
|
||||
TIFFErrorHandlerExtR handler,
|
||||
void *warnhandler_user_data);
|
||||
|
||||
extern TIFF *TIFFOpen(const char *, const char *);
|
||||
extern TIFF *TIFFOpenExt(const char *, const char *, TIFFOpenOptions *opts);
|
||||
#ifdef __WIN32__
|
||||
extern TIFF *TIFFOpenW(const wchar_t *, const char *);
|
||||
extern TIFF *TIFFOpenWExt(const wchar_t *, const char *,
|
||||
TIFFOpenOptions *opts);
|
||||
#endif /* __WIN32__ */
|
||||
extern TIFF *TIFFFdOpen(int, const char *, const char *);
|
||||
extern TIFF *TIFFFdOpenExt(int, const char *, const char *,
|
||||
TIFFOpenOptions *opts);
|
||||
extern TIFF *TIFFClientOpen(const char *, const char *, thandle_t,
|
||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
||||
TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
|
||||
TIFFMapFileProc, TIFFUnmapFileProc);
|
||||
extern TIFF *TIFFClientOpenExt(const char *, const char *, thandle_t,
|
||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
||||
TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
|
||||
TIFFMapFileProc, TIFFUnmapFileProc,
|
||||
TIFFOpenOptions *opts);
|
||||
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
|
||||
extern uint32_t TIFFComputeTile(TIFF *tif, uint32_t x, uint32_t y,
|
||||
uint32_t z, uint16_t s);
|
||||
extern int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z,
|
||||
uint16_t s);
|
||||
extern uint32_t TIFFNumberOfTiles(TIFF *);
|
||||
extern tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
|
||||
uint32_t z, uint16_t s);
|
||||
extern tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32_t x, uint32_t y,
|
||||
uint32_t z, uint16_t s);
|
||||
extern uint32_t TIFFComputeStrip(TIFF *, uint32_t, uint16_t);
|
||||
extern uint32_t TIFFNumberOfStrips(TIFF *);
|
||||
extern tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf,
|
||||
tmsize_t size);
|
||||
extern tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf,
|
||||
tmsize_t size);
|
||||
extern tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf,
|
||||
tmsize_t size);
|
||||
extern tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf,
|
||||
tmsize_t size);
|
||||
extern int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf,
|
||||
tmsize_t insize, void *outbuf,
|
||||
tmsize_t outsize);
|
||||
extern tmsize_t TIFFWriteEncodedStrip(TIFF *tif, uint32_t strip, void *data,
|
||||
tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteRawStrip(TIFF *tif, uint32_t strip, void *data,
|
||||
tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteEncodedTile(TIFF *tif, uint32_t tile, void *data,
|
||||
tmsize_t cc);
|
||||
extern tmsize_t TIFFWriteRawTile(TIFF *tif, uint32_t tile, void *data,
|
||||
tmsize_t cc);
|
||||
extern int TIFFDataWidth(
|
||||
TIFFDataType); /* table of tag datatype widths within TIFF file. */
|
||||
extern void TIFFSetWriteOffset(TIFF *tif, toff_t off);
|
||||
extern void TIFFSwabShort(uint16_t *);
|
||||
extern void TIFFSwabLong(uint32_t *);
|
||||
extern void TIFFSwabLong8(uint64_t *);
|
||||
extern void TIFFSwabFloat(float *);
|
||||
extern void TIFFSwabDouble(double *);
|
||||
extern void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfFloat(float *fp, tmsize_t n);
|
||||
extern void TIFFSwabArrayOfDouble(double *dp, tmsize_t n);
|
||||
extern void TIFFReverseBits(uint8_t *cp, tmsize_t n);
|
||||
extern const unsigned char *TIFFGetBitRevTable(int);
|
||||
|
||||
extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
|
||||
extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
|
||||
extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile,
|
||||
int *pbErr);
|
||||
extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile,
|
||||
int *pbErr);
|
||||
|
||||
#ifdef LOGLUV_PUBLIC
|
||||
#define U_NEU 0.210526316
|
||||
#define V_NEU 0.473684211
|
||||
#define UVSCALE 410.
|
||||
extern double LogL16toY(int);
|
||||
extern double LogL10toY(int);
|
||||
extern void XYZtoRGB24(float*, uint8_t*);
|
||||
extern int uv_decode(double*, double*, int);
|
||||
extern void LogLuv24toXYZ(uint32_t, float*);
|
||||
extern void LogLuv32toXYZ(uint32_t, float*);
|
||||
#define U_NEU 0.210526316
|
||||
#define V_NEU 0.473684211
|
||||
#define UVSCALE 410.
|
||||
extern double LogL16toY(int);
|
||||
extern double LogL10toY(int);
|
||||
extern void XYZtoRGB24(float *, uint8_t *);
|
||||
extern int uv_decode(double *, double *, int);
|
||||
extern void LogLuv24toXYZ(uint32_t, float *);
|
||||
extern void LogLuv32toXYZ(uint32_t, float *);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32_t LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32_t LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32_t LogLuv24fromXYZ(float *, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32_t LogLuv32fromXYZ(float *, int = SGILOGENCODE_NODITHER);
|
||||
#else
|
||||
extern int LogL16fromY(double, int);
|
||||
extern int LogL10fromY(double, int);
|
||||
extern int uv_encode(double, double, int);
|
||||
extern uint32_t LogLuv24fromXYZ(float*, int);
|
||||
extern uint32_t LogLuv32fromXYZ(float*, int);
|
||||
extern int LogL16fromY(double, int);
|
||||
extern int LogL10fromY(double, int);
|
||||
extern int uv_encode(double, double, int);
|
||||
extern uint32_t LogLuv24fromXYZ(float *, int);
|
||||
extern uint32_t LogLuv32fromXYZ(float *, int);
|
||||
#endif
|
||||
#endif /* LOGLUV_PUBLIC */
|
||||
|
||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
|
||||
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
|
||||
float *, float *, float *);
|
||||
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||
uint32_t *, uint32_t *, uint32_t *);
|
||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB *, const TIFFDisplay *,
|
||||
float *);
|
||||
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
|
||||
float *, float *, float *);
|
||||
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32_t *,
|
||||
uint32_t *, uint32_t *);
|
||||
|
||||
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
||||
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
|
||||
uint32_t *, uint32_t *, uint32_t *);
|
||||
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *, float *, float *);
|
||||
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
|
||||
uint32_t *, uint32_t *, uint32_t *);
|
||||
|
||||
/****************************************************************************
|
||||
* O B S O L E T E D I N T E R F A C E S
|
||||
*
|
||||
* Don't use this stuff in your applications, it may be removed in the future
|
||||
* libtiff versions.
|
||||
****************************************************************************/
|
||||
typedef struct {
|
||||
ttag_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
} TIFFFieldInfo;
|
||||
/****************************************************************************
|
||||
* O B S O L E T E D I N T E R F A C E S
|
||||
*
|
||||
* Don't use this stuff in your applications, it may be removed in the
|
||||
*future libtiff versions.
|
||||
****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
ttag_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
} TIFFFieldInfo;
|
||||
|
||||
extern int TIFFMergeFieldInfo(TIFF *, const TIFFFieldInfo[], uint32_t);
|
||||
|
||||
extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32_t);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TIFFIO_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
@ -2,28 +2,28 @@
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFIOP_
|
||||
#define _TIFFIOP_
|
||||
#define _TIFFIOP_
|
||||
/*
|
||||
* ``Library-private'' definitions.
|
||||
*/
|
||||
@ -31,38 +31,48 @@
|
||||
#include "tif_config.h"
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_ASSERT_H
|
||||
# include <assert.h>
|
||||
#include <assert.h>
|
||||
#else
|
||||
# define assert(x)
|
||||
#define assert(x)
|
||||
#endif
|
||||
|
||||
#include "tif_hash_set.h"
|
||||
#include "tiffio.h"
|
||||
|
||||
#include "tif_dir.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef STRIP_SIZE_DEFAULT
|
||||
# define STRIP_SIZE_DEFAULT 8192
|
||||
#define STRIP_SIZE_DEFAULT 8192
|
||||
#endif
|
||||
|
||||
#define streq(a,b) (strcmp(a,b) == 0)
|
||||
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
|
||||
#ifndef TIFF_MAX_DIR_COUNT
|
||||
#define TIFF_MAX_DIR_COUNT 1048576
|
||||
#endif
|
||||
|
||||
#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
|
||||
|
||||
#define streq(a, b) (strcmp(a, b) == 0)
|
||||
#define strneq(a, b, n) (strncmp(a, b, n) == 0)
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
typedef struct client_info {
|
||||
typedef struct client_info
|
||||
{
|
||||
struct client_info *next;
|
||||
void *data;
|
||||
char *name;
|
||||
@ -72,187 +82,232 @@ typedef struct client_info {
|
||||
* Typedefs for ``method pointers'' used internally.
|
||||
* these are deprecated and provided only for backwards compatibility.
|
||||
*/
|
||||
typedef unsigned char tidataval_t; /* internal image data value type */
|
||||
typedef tidataval_t* tidata_t; /* reference to internal image data */
|
||||
typedef unsigned char tidataval_t; /* internal image data value type */
|
||||
typedef tidataval_t *tidata_t; /* reference to internal image data */
|
||||
|
||||
typedef void (*TIFFVoidMethod)(TIFF*);
|
||||
typedef int (*TIFFBoolMethod)(TIFF*);
|
||||
typedef int (*TIFFPreMethod)(TIFF*, uint16_t);
|
||||
typedef int (*TIFFCodeMethod)(TIFF* tif, uint8_t* buf, tmsize_t size, uint16_t sample);
|
||||
typedef int (*TIFFSeekMethod)(TIFF*, uint32_t);
|
||||
typedef void (*TIFFPostMethod)(TIFF* tif, uint8_t* buf, tmsize_t size);
|
||||
typedef uint32_t (*TIFFStripMethod)(TIFF*, uint32_t);
|
||||
typedef void (*TIFFTileMethod)(TIFF*, uint32_t*, uint32_t*);
|
||||
typedef void (*TIFFVoidMethod)(TIFF *);
|
||||
typedef int (*TIFFBoolMethod)(TIFF *);
|
||||
typedef int (*TIFFPreMethod)(TIFF *, uint16_t);
|
||||
typedef int (*TIFFCodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size,
|
||||
uint16_t sample);
|
||||
typedef int (*TIFFSeekMethod)(TIFF *, uint32_t);
|
||||
typedef void (*TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size);
|
||||
typedef uint32_t (*TIFFStripMethod)(TIFF *, uint32_t);
|
||||
typedef void (*TIFFTileMethod)(TIFF *, uint32_t *, uint32_t *);
|
||||
|
||||
struct tiff {
|
||||
char* tif_name; /* name of open file */
|
||||
int tif_fd; /* open file descriptor */
|
||||
int tif_mode; /* open mode (O_*) */
|
||||
uint32_t tif_flags;
|
||||
#define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
|
||||
#define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
|
||||
#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
|
||||
#define TIFF_BUFFERSETUP 0x00010U /* data buffers setup */
|
||||
#define TIFF_CODERSETUP 0x00020U /* encoder/decoder setup done */
|
||||
#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
|
||||
#define TIFF_SWAB 0x00080U /* byte swap file information */
|
||||
#define TIFF_NOBITREV 0x00100U /* inhibit bit reversal logic */
|
||||
#define TIFF_MYBUFFER 0x00200U /* my raw data buffer; free on close */
|
||||
#define TIFF_ISTILED 0x00400U /* file is tile, not strip- based */
|
||||
#define TIFF_MAPPED 0x00800U /* file is mapped into memory */
|
||||
#define TIFF_POSTENCODE 0x01000U /* need call to postencode routine */
|
||||
#define TIFF_INSUBIFD 0x02000U /* currently writing a subifd */
|
||||
#define TIFF_UPSAMPLED 0x04000U /* library is doing data up-sampling */
|
||||
#define TIFF_STRIPCHOP 0x08000U /* enable strip chopping support */
|
||||
#define TIFF_HEADERONLY 0x10000U /* read header only, do not process the first directory */
|
||||
#define TIFF_NOREADRAW 0x20000U /* skip reading of raw uncompressed image data */
|
||||
#define TIFF_INCUSTOMIFD 0x40000U /* currently writing a custom IFD */
|
||||
#define TIFF_BIGTIFF 0x80000U /* read/write bigtiff */
|
||||
#define TIFF_BUF4WRITE 0x100000U /* rawcc bytes are for writing */
|
||||
#define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
|
||||
#define TIFF_PERSAMPLE 0x400000U /* get/set per sample tags as arrays */
|
||||
#define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
|
||||
#define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
|
||||
#define TIFF_LAZYSTRILELOAD 0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
|
||||
#define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
|
||||
uint64_t tif_diroff; /* file offset of current directory */
|
||||
uint64_t tif_nextdiroff; /* file offset of following directory */
|
||||
uint64_t* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
|
||||
uint16_t tif_dirlistsize; /* number of entries in offset list */
|
||||
uint16_t tif_dirnumber; /* number of already seen directories */
|
||||
TIFFDirectory tif_dir; /* internal rep of current directory */
|
||||
TIFFDirectory tif_customdir; /* custom IFDs are separated from the main ones */
|
||||
union {
|
||||
TIFFHeaderCommon common;
|
||||
TIFFHeaderClassic classic;
|
||||
TIFFHeaderBig big;
|
||||
} tif_header;
|
||||
uint16_t tif_header_size; /* file's header block and its length */
|
||||
uint32_t tif_row; /* current scanline */
|
||||
uint16_t tif_curdir; /* current directory (index) */
|
||||
uint32_t tif_curstrip; /* current strip for read/write */
|
||||
uint64_t tif_curoff; /* current offset for read/write */
|
||||
uint64_t tif_dataoff; /* current offset for writing dir */
|
||||
/* SubIFD support */
|
||||
uint16_t tif_nsubifd; /* remaining subifds to write */
|
||||
uint64_t tif_subifdoff; /* offset for patching SubIFD link */
|
||||
/* tiling support */
|
||||
uint32_t tif_col; /* current column (offset by row too) */
|
||||
uint32_t tif_curtile; /* current tile for read/write */
|
||||
tmsize_t tif_tilesize; /* # of bytes in a tile */
|
||||
/* compression scheme hooks */
|
||||
int tif_decodestatus;
|
||||
TIFFBoolMethod tif_fixuptags; /* called in TIFFReadDirectory */
|
||||
TIFFBoolMethod tif_setupdecode; /* called once before predecode */
|
||||
TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */
|
||||
TIFFBoolMethod tif_setupencode; /* called once before preencode */
|
||||
int tif_encodestatus;
|
||||
TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */
|
||||
TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */
|
||||
TIFFCodeMethod tif_decoderow; /* scanline decoding routine */
|
||||
TIFFCodeMethod tif_encoderow; /* scanline encoding routine */
|
||||
TIFFCodeMethod tif_decodestrip; /* strip decoding routine */
|
||||
TIFFCodeMethod tif_encodestrip; /* strip encoding routine */
|
||||
TIFFCodeMethod tif_decodetile; /* tile decoding routine */
|
||||
TIFFCodeMethod tif_encodetile; /* tile encoding routine */
|
||||
TIFFVoidMethod tif_close; /* cleanup-on-close routine */
|
||||
TIFFSeekMethod tif_seek; /* position within a strip routine */
|
||||
TIFFVoidMethod tif_cleanup; /* cleanup state routine */
|
||||
TIFFStripMethod tif_defstripsize; /* calculate/constrain strip size */
|
||||
TIFFTileMethod tif_deftilesize; /* calculate/constrain tile size */
|
||||
uint8_t* tif_data; /* compression scheme private data */
|
||||
/* input/output buffering */
|
||||
tmsize_t tif_scanlinesize; /* # of bytes in a scanline */
|
||||
tmsize_t tif_scanlineskew; /* scanline skew for reading strips */
|
||||
uint8_t* tif_rawdata; /* raw data buffer */
|
||||
tmsize_t tif_rawdatasize; /* # of bytes in raw data buffer */
|
||||
tmsize_t tif_rawdataoff; /* rawdata offset within strip */
|
||||
tmsize_t tif_rawdataloaded;/* amount of data in rawdata */
|
||||
uint8_t* tif_rawcp; /* current spot in raw buffer */
|
||||
tmsize_t tif_rawcc; /* bytes unread from raw buffer */
|
||||
/* memory-mapped file support */
|
||||
uint8_t* tif_base; /* base of mapped file */
|
||||
tmsize_t tif_size; /* size of mapped file region (bytes, thus tmsize_t) */
|
||||
TIFFMapFileProc tif_mapproc; /* map file method */
|
||||
TIFFUnmapFileProc tif_unmapproc; /* unmap file method */
|
||||
/* input/output callback methods */
|
||||
thandle_t tif_clientdata; /* callback parameter */
|
||||
TIFFReadWriteProc tif_readproc; /* read method */
|
||||
TIFFReadWriteProc tif_writeproc; /* write method */
|
||||
TIFFSeekProc tif_seekproc; /* lseek method */
|
||||
TIFFCloseProc tif_closeproc; /* close method */
|
||||
TIFFSizeProc tif_sizeproc; /* filesize method */
|
||||
/* post-decoding support */
|
||||
TIFFPostMethod tif_postdecode; /* post decoding routine */
|
||||
/* tag support */
|
||||
TIFFField** tif_fields; /* sorted table of registered tags */
|
||||
size_t tif_nfields; /* # entries in registered tag table */
|
||||
const TIFFField* tif_foundfield; /* cached pointer to already found tag */
|
||||
TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */
|
||||
TIFFClientInfoLink* tif_clientinfo; /* extra client information. */
|
||||
/* Backward compatibility stuff. We need these two fields for
|
||||
* setting up an old tag extension scheme. */
|
||||
TIFFFieldArray* tif_fieldscompat;
|
||||
size_t tif_nfieldscompat;
|
||||
struct TIFFOffsetAndDirNumber
|
||||
{
|
||||
uint64_t offset;
|
||||
tdir_t dirNumber;
|
||||
};
|
||||
typedef struct TIFFOffsetAndDirNumber TIFFOffsetAndDirNumber;
|
||||
|
||||
struct tiff
|
||||
{
|
||||
char *tif_name; /* name of open file */
|
||||
int tif_fd; /* open file descriptor */
|
||||
int tif_mode; /* open mode (O_*) */
|
||||
uint32_t tif_flags;
|
||||
#define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
|
||||
#define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
|
||||
#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
|
||||
#define TIFF_BUFFERSETUP 0x00010U /* data buffers setup */
|
||||
#define TIFF_CODERSETUP 0x00020U /* encoder/decoder setup done */
|
||||
#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
|
||||
#define TIFF_SWAB 0x00080U /* byte swap file information */
|
||||
#define TIFF_NOBITREV 0x00100U /* inhibit bit reversal logic */
|
||||
#define TIFF_MYBUFFER 0x00200U /* my raw data buffer; free on close */
|
||||
#define TIFF_ISTILED 0x00400U /* file is tile, not strip- based */
|
||||
#define TIFF_MAPPED 0x00800U /* file is mapped into memory */
|
||||
#define TIFF_POSTENCODE 0x01000U /* need call to postencode routine */
|
||||
#define TIFF_INSUBIFD 0x02000U /* currently writing a subifd */
|
||||
#define TIFF_UPSAMPLED 0x04000U /* library is doing data up-sampling */
|
||||
#define TIFF_STRIPCHOP 0x08000U /* enable strip chopping support */
|
||||
#define TIFF_HEADERONLY \
|
||||
0x10000U /* read header only, do not process the first directory */
|
||||
#define TIFF_NOREADRAW \
|
||||
0x20000U /* skip reading of raw uncompressed image data */
|
||||
#define TIFF_INCUSTOMIFD 0x40000U /* currently writing a custom IFD */
|
||||
#define TIFF_BIGTIFF 0x80000U /* read/write bigtiff */
|
||||
#define TIFF_BUF4WRITE 0x100000U /* rawcc bytes are for writing */
|
||||
#define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
|
||||
#define TIFF_PERSAMPLE 0x400000U /* get/set per sample tags as arrays */
|
||||
#define TIFF_BUFFERMMAP \
|
||||
0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
|
||||
#define TIFF_DEFERSTRILELOAD \
|
||||
0x1000000U /* defer strip/tile offset/bytecount array loading. */
|
||||
#define TIFF_LAZYSTRILELOAD \
|
||||
0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. \
|
||||
Only used if TIFF_DEFERSTRILELOAD is set and in read-only \
|
||||
mode */
|
||||
#define TIFF_CHOPPEDUPARRAYS \
|
||||
0x4000000U /* set when allocChoppedUpStripArrays() has modified strip \
|
||||
array */
|
||||
uint64_t tif_diroff; /* file offset of current directory */
|
||||
uint64_t tif_nextdiroff; /* file offset of following directory */
|
||||
uint64_t tif_lastdiroff; /* file offset of last directory written so far */
|
||||
uint64_t *tif_dirlistoff; /* list of offsets to already seen directories to
|
||||
prevent IFD looping */
|
||||
TIFFHashSet *tif_map_dir_offset_to_number;
|
||||
TIFFHashSet *tif_map_dir_number_to_offset;
|
||||
tdir_t tif_dirnumber; /* number of already seen directories */
|
||||
TIFFDirectory tif_dir; /* internal rep of current directory */
|
||||
TIFFDirectory
|
||||
tif_customdir; /* custom IFDs are separated from the main ones */
|
||||
union
|
||||
{
|
||||
TIFFHeaderCommon common;
|
||||
TIFFHeaderClassic classic;
|
||||
TIFFHeaderBig big;
|
||||
} tif_header;
|
||||
uint16_t tif_header_size; /* file's header block and its length */
|
||||
uint32_t tif_row; /* current scanline */
|
||||
tdir_t tif_curdir; /* current directory (index) */
|
||||
uint32_t tif_curstrip; /* current strip for read/write */
|
||||
uint64_t tif_curoff; /* current offset for read/write */
|
||||
uint64_t tif_lastvalidoff; /* last valid offset allowed for rewrite in
|
||||
place. Used only by TIFFAppendToStrip() */
|
||||
uint64_t tif_dataoff; /* current offset for writing dir */
|
||||
/* SubIFD support */
|
||||
uint16_t tif_nsubifd; /* remaining subifds to write */
|
||||
uint64_t tif_subifdoff; /* offset for patching SubIFD link */
|
||||
/* tiling support */
|
||||
uint32_t tif_col; /* current column (offset by row too) */
|
||||
uint32_t tif_curtile; /* current tile for read/write */
|
||||
tmsize_t tif_tilesize; /* # of bytes in a tile */
|
||||
/* compression scheme hooks */
|
||||
int tif_decodestatus;
|
||||
TIFFBoolMethod tif_fixuptags; /* called in TIFFReadDirectory */
|
||||
TIFFBoolMethod tif_setupdecode; /* called once before predecode */
|
||||
TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */
|
||||
TIFFBoolMethod tif_setupencode; /* called once before preencode */
|
||||
int tif_encodestatus;
|
||||
TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */
|
||||
TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */
|
||||
TIFFCodeMethod tif_decoderow; /* scanline decoding routine */
|
||||
TIFFCodeMethod tif_encoderow; /* scanline encoding routine */
|
||||
TIFFCodeMethod tif_decodestrip; /* strip decoding routine */
|
||||
TIFFCodeMethod tif_encodestrip; /* strip encoding routine */
|
||||
TIFFCodeMethod tif_decodetile; /* tile decoding routine */
|
||||
TIFFCodeMethod tif_encodetile; /* tile encoding routine */
|
||||
TIFFVoidMethod tif_close; /* cleanup-on-close routine */
|
||||
TIFFSeekMethod tif_seek; /* position within a strip routine */
|
||||
TIFFVoidMethod tif_cleanup; /* cleanup state routine */
|
||||
TIFFStripMethod tif_defstripsize; /* calculate/constrain strip size */
|
||||
TIFFTileMethod tif_deftilesize; /* calculate/constrain tile size */
|
||||
uint8_t *tif_data; /* compression scheme private data */
|
||||
/* input/output buffering */
|
||||
tmsize_t tif_scanlinesize; /* # of bytes in a scanline */
|
||||
tmsize_t tif_scanlineskew; /* scanline skew for reading strips */
|
||||
uint8_t *tif_rawdata; /* raw data buffer */
|
||||
tmsize_t tif_rawdatasize; /* # of bytes in raw data buffer */
|
||||
tmsize_t tif_rawdataoff; /* rawdata offset within strip */
|
||||
tmsize_t tif_rawdataloaded; /* amount of data in rawdata */
|
||||
uint8_t *tif_rawcp; /* current spot in raw buffer */
|
||||
tmsize_t tif_rawcc; /* bytes unread from raw buffer */
|
||||
/* memory-mapped file support */
|
||||
uint8_t *tif_base; /* base of mapped file */
|
||||
tmsize_t tif_size; /* size of mapped file region (bytes, thus tmsize_t) */
|
||||
TIFFMapFileProc tif_mapproc; /* map file method */
|
||||
TIFFUnmapFileProc tif_unmapproc; /* unmap file method */
|
||||
/* input/output callback methods */
|
||||
thandle_t tif_clientdata; /* callback parameter */
|
||||
TIFFReadWriteProc tif_readproc; /* read method */
|
||||
TIFFReadWriteProc tif_writeproc; /* write method */
|
||||
TIFFSeekProc tif_seekproc; /* lseek method */
|
||||
TIFFCloseProc tif_closeproc; /* close method */
|
||||
TIFFSizeProc tif_sizeproc; /* filesize method */
|
||||
/* post-decoding support */
|
||||
TIFFPostMethod tif_postdecode; /* post decoding routine */
|
||||
/* tag support */
|
||||
TIFFField **tif_fields; /* sorted table of registered tags */
|
||||
size_t tif_nfields; /* # entries in registered tag table */
|
||||
const TIFFField *tif_foundfield; /* cached pointer to already found tag */
|
||||
TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */
|
||||
TIFFClientInfoLink *tif_clientinfo; /* extra client information. */
|
||||
/* Backward compatibility stuff. We need these two fields for
|
||||
* setting up an old tag extension scheme. */
|
||||
TIFFFieldArray *tif_fieldscompat;
|
||||
size_t tif_nfieldscompat;
|
||||
/* Error handler support */
|
||||
TIFFErrorHandlerExtR tif_errorhandler;
|
||||
void *tif_errorhandler_user_data;
|
||||
TIFFErrorHandlerExtR tif_warnhandler;
|
||||
void *tif_warnhandler_user_data;
|
||||
tmsize_t tif_max_single_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
};
|
||||
|
||||
#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
|
||||
struct TIFFOpenOptions
|
||||
{
|
||||
TIFFErrorHandlerExtR errorhandler; /* may be NULL */
|
||||
void *errorhandler_user_data; /* may be NULL */
|
||||
TIFFErrorHandlerExtR warnhandler; /* may be NULL */
|
||||
void *warnhandler_user_data; /* may be NULL */
|
||||
tmsize_t max_single_mem_alloc; /* in bytes. 0 for unlimited */
|
||||
};
|
||||
|
||||
#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
|
||||
|
||||
#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
|
||||
#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
|
||||
#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
|
||||
#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
|
||||
#define TIFFReadFile(tif, buf, size) \
|
||||
((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
|
||||
#define TIFFWriteFile(tif, buf, size) \
|
||||
((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))
|
||||
#define TIFFSeekFile(tif, off, whence) \
|
||||
((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
|
||||
#define TIFFCloseFile(tif) \
|
||||
((*(tif)->tif_closeproc)((tif)->tif_clientdata))
|
||||
#define TIFFGetFileSize(tif) \
|
||||
((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
|
||||
#define TIFFMapFileContents(tif, paddr, psize) \
|
||||
((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))
|
||||
#define TIFFUnmapFileContents(tif, addr, size) \
|
||||
((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))
|
||||
#define TIFFReadFile(tif, buf, size) \
|
||||
((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
|
||||
#define TIFFWriteFile(tif, buf, size) \
|
||||
((*(tif)->tif_writeproc)((tif)->tif_clientdata, (buf), (size)))
|
||||
#define TIFFSeekFile(tif, off, whence) \
|
||||
((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
|
||||
#define TIFFCloseFile(tif) ((*(tif)->tif_closeproc)((tif)->tif_clientdata))
|
||||
#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
|
||||
#define TIFFMapFileContents(tif, paddr, psize) \
|
||||
((*(tif)->tif_mapproc)((tif)->tif_clientdata, (paddr), (psize)))
|
||||
#define TIFFUnmapFileContents(tif, addr, size) \
|
||||
((*(tif)->tif_unmapproc)((tif)->tif_clientdata, (addr), (size)))
|
||||
|
||||
/*
|
||||
* Default Read/Seek/Write definitions.
|
||||
*/
|
||||
#ifndef ReadOK
|
||||
#define ReadOK(tif, buf, size) \
|
||||
(TIFFReadFile((tif),(buf),(size))==(size))
|
||||
#define ReadOK(tif, buf, size) (TIFFReadFile((tif), (buf), (size)) == (size))
|
||||
#endif
|
||||
#ifndef SeekOK
|
||||
#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
|
||||
#endif
|
||||
#ifndef WriteOK
|
||||
#define WriteOK(tif, buf, size) \
|
||||
(TIFFWriteFile((tif),(buf),(size))==(size))
|
||||
#define WriteOK(tif, buf, size) (TIFFWriteFile((tif), (buf), (size)) == (size))
|
||||
#endif
|
||||
|
||||
/* NB: the uint32_t casts are to silence certain ANSI-C compilers */
|
||||
#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
|
||||
((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
|
||||
0U)
|
||||
#define TIFFhowmany_32(x, y) \
|
||||
(((uint32_t)x < (0xffffffff - (uint32_t)(y - 1))) \
|
||||
? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y))) \
|
||||
: 0U)
|
||||
/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
|
||||
/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
|
||||
#define TIFFhowmany_32_maxuint_compat(x, y) \
|
||||
(((uint32_t)(x) / (uint32_t)(y)) + ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
|
||||
#define TIFFhowmany8_32(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
|
||||
#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
|
||||
#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
|
||||
#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
|
||||
#define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
|
||||
#define TIFFhowmany_32_maxuint_compat(x, y) \
|
||||
(((uint32_t)(x) / (uint32_t)(y)) + \
|
||||
((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
|
||||
#define TIFFhowmany8_32(x) \
|
||||
(((x)&0x07) ? ((uint32_t)(x) >> 3) + 1 : (uint32_t)(x) >> 3)
|
||||
#define TIFFroundup_32(x, y) (TIFFhowmany_32(x, y) * (y))
|
||||
#define TIFFhowmany_64(x, y) \
|
||||
((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
|
||||
#define TIFFhowmany8_64(x) \
|
||||
(((x)&0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
|
||||
#define TIFFroundup_64(x, y) (TIFFhowmany_64(x, y) * (y))
|
||||
|
||||
/* Safe multiply which returns zero if there is an *unsigned* integer overflow. This macro is not safe for *signed* integer types */
|
||||
#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
|
||||
/* Safe multiply which returns zero if there is an *unsigned* integer overflow.
|
||||
* This macro is not safe for *signed* integer types */
|
||||
#define TIFFSafeMultiply(t, v, m) \
|
||||
((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v))) \
|
||||
? (t)((v) * (m)) \
|
||||
: (t)0)
|
||||
|
||||
#define TIFFmax(A,B) ((A)>(B)?(A):(B))
|
||||
#define TIFFmin(A,B) ((A)<(B)?(A):(B))
|
||||
#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
|
||||
#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
|
||||
|
||||
#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
/*
|
||||
Support for large files.
|
||||
@ -273,28 +328,31 @@ struct tiff {
|
||||
must be available on the target computer in order for the program to run.
|
||||
*/
|
||||
#if defined(HAVE_FSEEKO)
|
||||
# define fseek(stream,offset,whence) fseeko(stream,offset,whence)
|
||||
# define ftell(stream,offset,whence) ftello(stream,offset,whence)
|
||||
#define fseek(stream, offset, whence) fseeko(stream, offset, whence)
|
||||
#define ftell(stream, offset, whence) ftello(stream, offset, whence)
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__WIN32__) && \
|
||||
!(defined(_MSC_VER) && _MSC_VER < 1400) && \
|
||||
!(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
|
||||
#if defined(__WIN32__) && !(defined(_MSC_VER) && _MSC_VER < 1400) && \
|
||||
!(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
|
||||
typedef unsigned int TIFFIOSize_t;
|
||||
#define _TIFF_lseek_f(fildes,offset,whence) _lseeki64(fildes,/* __int64 */ offset,whence)
|
||||
#define _TIFF_lseek_f(fildes, offset, whence) \
|
||||
_lseeki64(fildes, /* __int64 */ offset, whence)
|
||||
/* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */
|
||||
#define _TIFF_fseek_f(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
|
||||
#define _TIFF_fstat_f(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
|
||||
#define _TIFF_fseek_f(stream, offset, whence) \
|
||||
_fseeki64(stream, /* __int64 */ offset, whence)
|
||||
#define _TIFF_fstat_f(fildes, stat_buff) \
|
||||
_fstati64(fildes, /* struct _stati64 */ stat_buff)
|
||||
/* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */
|
||||
/* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/ stat_buff) */
|
||||
/* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/
|
||||
* stat_buff) */
|
||||
#define _TIFF_stat_s struct _stati64
|
||||
#define _TIFF_off_t __int64
|
||||
#else
|
||||
typedef size_t TIFFIOSize_t;
|
||||
#define _TIFF_lseek_f(fildes,offset,whence) lseek(fildes,offset,whence)
|
||||
#define _TIFF_lseek_f(fildes, offset, whence) lseek(fildes, offset, whence)
|
||||
/* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */
|
||||
#define _TIFF_fseek_f(stream,offset,whence) fseek(stream,offset,whence)
|
||||
#define _TIFF_fstat_f(fildes,stat_buff) fstat(fildes,stat_buff)
|
||||
#define _TIFF_fseek_f(stream, offset, whence) fseek(stream, offset, whence)
|
||||
#define _TIFF_fstat_f(fildes, stat_buff) fstat(fildes, stat_buff)
|
||||
/* #define _TIFF_ftell_f(stream) ftell(stream) */
|
||||
/* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */
|
||||
#define _TIFF_stat_s struct stat
|
||||
@ -303,7 +361,8 @@ typedef size_t TIFFIOSize_t;
|
||||
|
||||
#if defined(__has_attribute) && defined(__clang__)
|
||||
#if __has_attribute(no_sanitize)
|
||||
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
|
||||
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW \
|
||||
__attribute__((no_sanitize("unsigned-integer-overflow")))
|
||||
#else
|
||||
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
|
||||
#endif
|
||||
@ -311,138 +370,153 @@ typedef size_t TIFFIOSize_t;
|
||||
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
extern int _TIFFgetMode(const char* mode, const char* module);
|
||||
extern int _TIFFNoRowEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoStripEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoTileEncode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoRowDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoStripDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoTileDecode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
|
||||
extern void _TIFFNoPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc);
|
||||
extern int _TIFFNoPreCode(TIFF* tif, uint16_t s);
|
||||
extern int _TIFFNoSeek(TIFF* tif, uint32_t off);
|
||||
extern void _TIFFSwab16BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
|
||||
extern void _TIFFSwab24BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
|
||||
extern void _TIFFSwab32BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
|
||||
extern void _TIFFSwab64BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
|
||||
extern int TIFFFlushData1(TIFF* tif);
|
||||
extern int TIFFDefaultDirectory(TIFF* tif);
|
||||
extern void _TIFFSetDefaultCompressionState(TIFF* tif);
|
||||
extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t, void *);
|
||||
extern int TIFFSetCompressionScheme(TIFF* tif, int scheme);
|
||||
extern int TIFFSetDefaultCompressionState(TIFF* tif);
|
||||
extern uint32_t _TIFFDefaultStripSize(TIFF* tif, uint32_t s);
|
||||
extern void _TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th);
|
||||
extern int _TIFFDataSize(TIFFDataType type);
|
||||
extern int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata,
|
||||
const char *mode, const char *module);
|
||||
extern int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
|
||||
uint16_t s);
|
||||
extern int _TIFFNoStripEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
|
||||
uint16_t s);
|
||||
extern int _TIFFNoTileEncode(TIFF *, uint8_t *pp, tmsize_t cc, uint16_t s);
|
||||
extern int _TIFFNoRowDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
|
||||
uint16_t s);
|
||||
extern int _TIFFNoStripDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
|
||||
uint16_t s);
|
||||
extern int _TIFFNoTileDecode(TIFF *, uint8_t *pp, tmsize_t cc, uint16_t s);
|
||||
extern void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc);
|
||||
extern int _TIFFNoPreCode(TIFF *tif, uint16_t s);
|
||||
extern int _TIFFNoSeek(TIFF *tif, uint32_t off);
|
||||
extern void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
|
||||
extern void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
|
||||
extern void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
|
||||
extern void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
|
||||
extern int TIFFFlushData1(TIFF *tif);
|
||||
extern int TIFFDefaultDirectory(TIFF *tif);
|
||||
extern void _TIFFSetDefaultCompressionState(TIFF *tif);
|
||||
extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t,
|
||||
void *);
|
||||
extern int TIFFSetCompressionScheme(TIFF *tif, int scheme);
|
||||
extern int TIFFSetDefaultCompressionState(TIFF *tif);
|
||||
extern uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s);
|
||||
extern void _TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th);
|
||||
|
||||
/*--: Rational2Double: Return size of TIFFSetGetFieldType in bytes. */
|
||||
extern int _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype);
|
||||
extern void _TIFFsetByteArray(void **, const void *, uint32_t);
|
||||
extern void _TIFFsetByteArrayExt(TIFF *, void **, const void *, uint32_t);
|
||||
extern void _TIFFsetShortArray(uint16_t **, const uint16_t *, uint32_t);
|
||||
extern void _TIFFsetShortArrayExt(TIFF *, uint16_t **, const uint16_t *,
|
||||
uint32_t);
|
||||
extern void _TIFFsetLongArray(uint32_t **, const uint32_t *, uint32_t);
|
||||
extern void _TIFFsetLongArrayExt(TIFF *, uint32_t **, const uint32_t *,
|
||||
uint32_t);
|
||||
extern void _TIFFsetFloatArray(float **, const float *, uint32_t);
|
||||
extern void _TIFFsetFloatArrayExt(TIFF *, float **, const float *,
|
||||
uint32_t);
|
||||
extern void _TIFFsetDoubleArray(double **, const double *, uint32_t);
|
||||
extern void _TIFFsetDoubleArrayExt(TIFF *, double **, const double *,
|
||||
uint32_t);
|
||||
|
||||
extern void _TIFFsetByteArray(void**, void*, uint32_t);
|
||||
extern void _TIFFsetString(char**, char*);
|
||||
extern void _TIFFsetShortArray(uint16_t**, uint16_t*, uint32_t);
|
||||
extern void _TIFFsetLongArray(uint32_t**, uint32_t*, uint32_t);
|
||||
extern void _TIFFsetFloatArray(float**, float*, uint32_t);
|
||||
extern void _TIFFsetDoubleArray(double**, double*, uint32_t);
|
||||
extern void _TIFFprintAscii(FILE *, const char *);
|
||||
extern void _TIFFprintAsciiTag(FILE *, const char *, const char *);
|
||||
|
||||
extern void _TIFFprintAscii(FILE*, const char*);
|
||||
extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);
|
||||
extern TIFFErrorHandler _TIFFwarningHandler;
|
||||
extern TIFFErrorHandler _TIFFerrorHandler;
|
||||
extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
|
||||
extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
|
||||
void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata,
|
||||
const char *module, const char *fmt, ...)
|
||||
TIFF_ATTRIBUTE((__format__(__printf__, 4, 5)));
|
||||
|
||||
extern TIFFErrorHandler _TIFFwarningHandler;
|
||||
extern TIFFErrorHandler _TIFFerrorHandler;
|
||||
extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
|
||||
extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
|
||||
extern uint32_t _TIFFMultiply32(TIFF *, uint32_t, uint32_t, const char *);
|
||||
extern uint64_t _TIFFMultiply64(TIFF *, uint64_t, uint64_t, const char *);
|
||||
extern tmsize_t _TIFFMultiplySSize(TIFF *, tmsize_t, tmsize_t,
|
||||
const char *);
|
||||
extern tmsize_t _TIFFCastUInt64ToSSize(TIFF *, uint64_t, const char *);
|
||||
extern void *_TIFFCheckMalloc(TIFF *, tmsize_t, tmsize_t, const char *);
|
||||
extern void *_TIFFCheckRealloc(TIFF *, void *, tmsize_t, tmsize_t,
|
||||
const char *);
|
||||
|
||||
extern uint32_t _TIFFMultiply32(TIFF*, uint32_t, uint32_t, const char*);
|
||||
extern uint64_t _TIFFMultiply64(TIFF*, uint64_t, uint64_t, const char*);
|
||||
extern tmsize_t _TIFFMultiplySSize(TIFF*, tmsize_t, tmsize_t, const char*);
|
||||
extern tmsize_t _TIFFCastUInt64ToSSize(TIFF*, uint64_t, const char*);
|
||||
extern void* _TIFFCheckMalloc(TIFF*, tmsize_t, tmsize_t, const char*);
|
||||
extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
|
||||
extern double _TIFFUInt64ToDouble(uint64_t);
|
||||
extern float _TIFFUInt64ToFloat(uint64_t);
|
||||
|
||||
extern double _TIFFUInt64ToDouble(uint64_t);
|
||||
extern float _TIFFUInt64ToFloat(uint64_t);
|
||||
extern float _TIFFClampDoubleToFloat(double);
|
||||
extern uint32_t _TIFFClampDoubleToUInt32(double);
|
||||
|
||||
extern float _TIFFClampDoubleToFloat(double);
|
||||
extern tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif,
|
||||
uint32_t strip,
|
||||
void **buf,
|
||||
tmsize_t bufsizetoalloc,
|
||||
tmsize_t size_to_read);
|
||||
extern tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32_t tile,
|
||||
void **buf,
|
||||
tmsize_t bufsizetoalloc,
|
||||
tmsize_t size_to_read);
|
||||
extern tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf,
|
||||
tmsize_t bufsizetoalloc,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t z, uint16_t s);
|
||||
extern int _TIFFSeekOK(TIFF *tif, toff_t off);
|
||||
|
||||
extern tmsize_t
|
||||
_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip,
|
||||
void **buf, tmsize_t bufsizetoalloc,
|
||||
tmsize_t size_to_read);
|
||||
extern tmsize_t
|
||||
_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32_t tile,
|
||||
void **buf, tmsize_t bufsizetoalloc,
|
||||
tmsize_t size_to_read);
|
||||
extern tmsize_t
|
||||
_TIFFReadTileAndAllocBuffer(TIFF* tif,
|
||||
void **buf, tmsize_t bufsizetoalloc,
|
||||
uint32_t x, uint32_t y, uint32_t z, uint16_t s);
|
||||
extern int _TIFFSeekOK(TIFF* tif, toff_t off);
|
||||
|
||||
extern int TIFFInitDumpMode(TIFF*, int);
|
||||
extern int TIFFInitDumpMode(TIFF *, int);
|
||||
#ifdef PACKBITS_SUPPORT
|
||||
extern int TIFFInitPackBits(TIFF*, int);
|
||||
extern int TIFFInitPackBits(TIFF *, int);
|
||||
#endif
|
||||
#ifdef CCITT_SUPPORT
|
||||
extern int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
|
||||
extern int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
|
||||
extern int TIFFInitCCITTRLE(TIFF *, int), TIFFInitCCITTRLEW(TIFF *, int);
|
||||
extern int TIFFInitCCITTFax3(TIFF *, int), TIFFInitCCITTFax4(TIFF *, int);
|
||||
#endif
|
||||
#ifdef THUNDER_SUPPORT
|
||||
extern int TIFFInitThunderScan(TIFF*, int);
|
||||
extern int TIFFInitThunderScan(TIFF *, int);
|
||||
#endif
|
||||
#ifdef NEXT_SUPPORT
|
||||
extern int TIFFInitNeXT(TIFF*, int);
|
||||
extern int TIFFInitNeXT(TIFF *, int);
|
||||
#endif
|
||||
#ifdef LZW_SUPPORT
|
||||
extern int TIFFInitLZW(TIFF*, int);
|
||||
extern int TIFFInitLZW(TIFF *, int);
|
||||
#endif
|
||||
#ifdef OJPEG_SUPPORT
|
||||
extern int TIFFInitOJPEG(TIFF*, int);
|
||||
extern int TIFFInitOJPEG(TIFF *, int);
|
||||
#endif
|
||||
#ifdef JPEG_SUPPORT
|
||||
extern int TIFFInitJPEG(TIFF*, int);
|
||||
extern int TIFFJPEGIsFullStripRequired(TIFF*);
|
||||
extern int TIFFInitJPEG(TIFF *, int);
|
||||
extern int TIFFJPEGIsFullStripRequired(TIFF *);
|
||||
#endif
|
||||
#ifdef JBIG_SUPPORT
|
||||
extern int TIFFInitJBIG(TIFF*, int);
|
||||
extern int TIFFInitJBIG(TIFF *, int);
|
||||
#endif
|
||||
#ifdef ZIP_SUPPORT
|
||||
extern int TIFFInitZIP(TIFF*, int);
|
||||
extern int TIFFInitZIP(TIFF *, int);
|
||||
#endif
|
||||
#ifdef PIXARLOG_SUPPORT
|
||||
extern int TIFFInitPixarLog(TIFF*, int);
|
||||
extern int TIFFInitPixarLog(TIFF *, int);
|
||||
#endif
|
||||
#ifdef LOGLUV_SUPPORT
|
||||
extern int TIFFInitSGILog(TIFF*, int);
|
||||
extern int TIFFInitSGILog(TIFF *, int);
|
||||
#endif
|
||||
#ifdef LERC_SUPPORT
|
||||
extern int TIFFInitLERC(TIFF* tif, int);
|
||||
extern int TIFFInitLERC(TIFF *tif, int);
|
||||
#endif
|
||||
#ifdef LZMA_SUPPORT
|
||||
extern int TIFFInitLZMA(TIFF*, int);
|
||||
extern int TIFFInitLZMA(TIFF *, int);
|
||||
#endif
|
||||
#ifdef ZSTD_SUPPORT
|
||||
extern int TIFFInitZSTD(TIFF*, int);
|
||||
extern int TIFFInitZSTD(TIFF *, int);
|
||||
#endif
|
||||
#ifdef WEBP_SUPPORT
|
||||
extern int TIFFInitWebP(TIFF*, int);
|
||||
extern int TIFFInitWebP(TIFF *, int);
|
||||
#endif
|
||||
extern const TIFFCodec _TIFFBuiltinCODECS[];
|
||||
extern const TIFFCodec _TIFFBuiltinCODECS[];
|
||||
extern void TIFFCIELab16ToXYZ(TIFFCIELabToRGB *, uint32_t l, int32_t a,
|
||||
int32_t b, float *, float *, float *);
|
||||
|
||||
extern void *_TIFFmallocExt(TIFF *tif, tmsize_t s);
|
||||
extern void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz);
|
||||
extern void *_TIFFreallocExt(TIFF *tif, void *p, tmsize_t s);
|
||||
extern void _TIFFfreeExt(TIFF *tif, void *p);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* _TIFFIOP_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
||||
|
@ -1,4 +1,9 @@
|
||||
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.3.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||
/* clang-format off */
|
||||
|
||||
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
|
||||
* formatting of below line being a single line.
|
||||
*/
|
||||
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.0\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||
/*
|
||||
* This define can be used in code that requires
|
||||
* compilation-related definitions specific to a
|
||||
@ -6,4 +11,20 @@
|
||||
* version checking should be done based on the
|
||||
* string returned by TIFFGetVersion.
|
||||
*/
|
||||
#define TIFFLIB_VERSION 20210416
|
||||
#define TIFFLIB_VERSION 20221213
|
||||
|
||||
/* The following defines have been added in 4.5.0 */
|
||||
#define TIFFLIB_MAJOR_VERSION 4
|
||||
#define TIFFLIB_MINOR_VERSION 5
|
||||
#define TIFFLIB_MICRO_VERSION 0
|
||||
|
||||
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
|
||||
* greater or equal to major.minor.micro
|
||||
*/
|
||||
#define TIFFLIB_AT_LEAST(major, minor, micro) \
|
||||
(TIFFLIB_MAJOR_VERSION > (major) || \
|
||||
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \
|
||||
(TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \
|
||||
TIFFLIB_MICRO_VERSION >= (micro)))
|
||||
|
||||
/* clang-format on */
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "imgui_impl_vitagl.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define GL_COLOR_MATERIAL 0x0B57
|
||||
|
||||
#define lerp(value, from_max, to_max) ((((value * 10) * (to_max * 10)) / (from_max * 10)) / 10)
|
||||
|
||||
struct ImGui_ImplVitaGL_Data {
|
||||
@ -186,7 +184,7 @@ void ImGui_ImplVitaGL_RenderDrawData(ImDrawData *draw_data) {
|
||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||
//GLint last_shade_model; glGetIntegerv(GL_SHADE_MODEL, &last_shade_model);
|
||||
//GLint last_tex_env_mode; glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_tex_env_mode);
|
||||
GLint last_tex_env_mode; glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_tex_env_mode);
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||
|
||||
// Setup desired GL state
|
||||
@ -223,7 +221,7 @@ void ImGui_ImplVitaGL_RenderDrawData(ImDrawData *draw_data) {
|
||||
continue;
|
||||
|
||||
// Apply scissor/clipping rectangle (Y is inverted in OpenGL)
|
||||
glScissor(static_cast<int>(clip_min.x), static_cast<int>(fb_height - clip_max.y), static_cast<int>(clip_max.x - clip_min.x), static_cast<int>(clip_max.y - clip_min.y));
|
||||
glScissor(static_cast<int>(clip_min.x), static_cast<int>(static_cast<int>(fb_height) - clip_max.y), static_cast<int>(clip_max.x - clip_min.x), static_cast<int>(clip_max.y - clip_min.y));
|
||||
|
||||
// Bind texture, Draw
|
||||
glBindTexture(GL_TEXTURE_2D, reinterpret_cast<GLuint>(pcmd->GetTexID()));
|
||||
@ -246,7 +244,7 @@ void ImGui_ImplVitaGL_RenderDrawData(ImDrawData *draw_data) {
|
||||
glViewport(last_viewport[0], last_viewport[1], static_cast<GLsizei>(last_viewport[2]), static_cast<GLsizei>(last_viewport[3]));
|
||||
glScissor(last_scissor_box[0], last_scissor_box[1], static_cast<GLsizei>(last_scissor_box[2]), static_cast<GLsizei>(last_scissor_box[3]));
|
||||
//glShadeModel(last_shade_model);
|
||||
//glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode);
|
||||
}
|
||||
|
||||
bool ImGui_ImplVitaGL_CreateFontsTexture(void) {
|
||||
@ -271,7 +269,7 @@ bool ImGui_ImplVitaGL_CreateFontsTexture(void) {
|
||||
glBindTexture(GL_TEXTURE_2D, bd->FontTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
|
@ -44,7 +44,7 @@ namespace Tabs {
|
||||
ImGui::Dummy(ImVec2(0.0f, 5.0f)); // Spacing
|
||||
ImGui::Text("libpng version: %s", PNG_LIBPNG_VER_STRING);
|
||||
ImGui::Dummy(ImVec2(0.0f, 5.0f)); // Spacing
|
||||
ImGui::Text("LibTIFF version: %d", TIFFLIB_VERSION);
|
||||
ImGui::Text("LibTIFF version: %d.%d.%d", TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, TIFFLIB_MICRO_VERSION);
|
||||
ImGui::Dummy(ImVec2(0.0f, 5.0f)); // Spacing
|
||||
ImGui::Text("libwebp version: %d.%d.%d", (WebPGetDecoderVersion() >> 16) & 0xFF, (WebPGetDecoderVersion() >> 8) & 0xFF, WebPGetDecoderVersion() & 0xFF);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user