| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2007.04.11 23:10 "O-JPEG problems", by Mick O'neillI have encountered a number of TIFF files that have images in the OJPEG
format (type 6), but do not contain the JPEGInterchangeFormat Tag. When
this problem was first recognised (about 18 months ago), I was able to
put the following modification into the OJepgSetupDecode function to
allow for it:
if (!is_JFIF && !sp->is_WANG) {
const char *p = tif->tif_rawdata;
if (memcmp(p, "\xff\xd8\xff\xe0", 4) == 0 && memcmp(p +
6, "JFIF", 4) == 0) {
is_JFIF = 1;
sp->src.next_input_byte = p;
sp->src.bytes_in_buffer = tif->tif_rawdatasize;
}
}
This patch gets included after the
is_JFIF = !sp->is_WANG && TIFFFieldSet(tif,FIELD_JPEGIFOFFSET);
Line in the same function. The patch also required the tif_data memory
to be initialised first in the TIFFInitOJEG function:
memset(tif->tif_data, 0, sizeof(*sp));
After the data is allocated
This all worked fine in LibTIFF version 3.7.4 when I discovered it, but
recently porting it to 3.8.2, it no longer completely does the job - the
first page of the TIFF file fails, and the rest succeed.
I have uploaded a sample TIFF file to
http://midimick.com/temp/TestBig.tif , and also the 3.8.2 modified
tiff_ojpeg.c file at http://midimick.com/temp.tif_ojpeg.c . If anyoine
can see what it is that has changed between the library versions that
has caused this patch to stop working, it would be greatly appreciated
(I am going nuts trying to trace through both versions to see where it
is going wrong).
Thanks
Mick
|
|||||||