2004.07.21 05:28 "[Tiff] JPEG Compression Support", by Jean Paul Mir V.

2004.07.21 05:28 "[Tiff] JPEG Compression Support", by Jean Paul Mir V.


I'm working on a C++ ATL component for TIFF conversion to PCL, PS And PDF. Actually I have completed TiffToPCL and TiffToPS translation based on tiff2ps and tifftopcl tools of libtiff.

Everything works fine until I started using Grayscale and Color Images using JPEG compression. After many errors I successfully created libtiff.lib, but when I tried to convert the file using my ATL I got so many errors regarding unrecognized tags and so on. One of those alerts saids "Old-Style JPEG Support is not installed"... then I enabled OJPEG compression and recompile it again.

At this time I got an error like "..._ jpeg_reset_huff_decode unrecognized... " or something like that...

I searched on internet and found an article saying that I would need to patch libtiff to add OJPEG support to the library.. I could not patch the library but I found the missing function:

 jpeg_reset_huff_decode (register j_decompress_ptr cinfo)
 { register huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   register int ci = 0;

   /* Discard encoded input bits, up to the next Byte boundary */
   entropy->bitstate.bits_left &= ~7;
   /* Re-initialize DC predictions to 0 */
   do entropy->saved.last_dc_val[ci] = 0; while (++ci < cinfo->comps_in_scan);

I just copy-paste it into jduff.c and then the compilation ends up successfully.

Once I got the library and my DLL compiled(after Library compilation), I tried to convert a JPEG Compressed tiff file to a PCL file and all I got is a full of gray lines page.

Could someone tell me how could I build propertly the library with support for JPEG and OJPEG compression???

Thanks in advance!