[Gdal-dev] TIFF with JPEG compression on Win32

Julien Demaria dem at acri-st.fr
Mon Oct 4 05:24:00 EDT 2004


At 15:53 01/10/2004, you wrote:
>Julien Demaria wrote:
>>Hi,
>>I don't know why but my gdal Win32 build doesn't support read or write 
>>TIFF with JPEG compression, but my Linux and Solaris builds work well :
>>read error:
>>Input file size is 2044, 1704
>>0.ERROR 1: JPEGLib:JPEG parameter struct mismatch: library thinks size is 
>>464, caller expects 432
>>Assertion failed: sp->cinfo.comm.is_decompressor, file tif_jpeg.c, line 606
>>write error:
>>Input file size is 2044, 1704
>>0.ERROR 1: JPEGLib:JPEG parameter struct mismatch: library thinks size is 
>>376, caller expects 360
>>ERROR 1: JPEGLib:Improper call to JPEG library in state 0
>>ERROR 1: TIFFWriteScanline failed.
>>ERROR 1: JPEGLib:JPEG parameter struct mismatch: library thinks size is 
>>376, caller expects 360
>>I compile my Win32 build with VC6 with netCDF, MrSID 4 and Kakadu support 
>>and with /Ox /MD /EHsc flags and /NODEFAULTLIB:LIBC linker flag.
>>I've tested with the OpenEV_FW 1.8.2 package and it works well...
>>If anyone has ideas of the causes, or similar problem....
>
>Julien,
>
>This is a common problem.  Are you building with an external libjpeg or
>the built in copy?  The built-in copy is supposed to work fine but there
>are things that need to be tweaked with an external copy.  Andrey knows the
>details but he may not be able to answer email today.

Frank,

I am building with the built in copy


>I ended up hacking tif_jpeg.c for my OpenEV_FW 1.8.2 build a bit but Andrey's
>suggestion was actually to slightly modify the jconfig.h file in libjpeg.
>However, I didn't keep track of the details.
>
>It all relates to differing sizes for the bool type, and the need to keep
>them consistent between how things are built for tif_jpeg.c and within libjpeg
>itself.   If you search for "boolean" in tif_jpeg.c you will see some
>discussion of the issue.  There is also at least one bugzilla report on
>the problem though I don't have a link off hand.

On my configuration, tif_jpeg.c uses "boolean" type from RPCNDR.H as 
"unsigned char", but jpeg/libjpeg/jmorecfg.h uses it as "int"...

Changing in jmorecfg.h

#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif

to

#ifndef HAVE_BOOLEAN
typedef unsigned char boolean;
#endif

works for me.

Are you sure the actual CVS GDAL built with built in JPEG lib works well 
about JPEG-in-TIFF ? because it seems libjpeg and tif_jpeg.c are compiled 
with different sizes for booleans on Win32...

Best Regards,

Julien




More information about the Gdal-dev mailing list