AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
April 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2007.04.11 23:10 "O-JPEG problems", by Mick O'neill
2007.04.12 02:13 "Re: O-JPEG problems", by Joris Van Damme
2007.04.12 03:04 "Re: O-JPEG problems", by Mick O'neill
2007.04.12 23:12 "Re: O-JPEG problems", by Mick O'neill
2007.04.13 01:35 "Re: O-JPEG problems", by Mick O'neill
2007.04.13 01:42 "Re: O-JPEG problems", by Frank Warmerdam
2007.04.24 01:55 "Re: O-JPEG problems", by Mick O'neill
2007.04.24 08:25 "Re: O-JPEG problems", by Joris Van Damme
2007.04.25 22:58 "Re: O-JPEG problems", by Mick O'neill
2007.04.26 06:54 "Re: O-JPEG problems", by Joris Van Damme
2007.04.24 10:27 "Re: O-JPEG problems", by Andrey Kiselev
2007.04.25 13:41 "Re: O-JPEG problems", by Charles Auer
2007.04.29 22:56 "Re: O-JPEG problems", by Mick O'neill

2007.04.11 23:10 "O-JPEG problems", by Mick O'neill

I 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