AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.07.17 11:22 "[Tiff] possible bug in JPEGDecode", by Aleksandar Zivkovic
2004.07.18 19:50 "Re: [Tiff] possible bug in JPEGDecode", by Andrey Kiselev

2004.07.18 19:50 "Re: [Tiff] possible bug in JPEGDecode", by Andrey Kiselev

I tried to use libtiff with scanline-oriented interface (as described in document Using the TIFF Library).

It seems it doesn't work. In my wrapper I'm using TIFFReadScanline function.

It seems that the problem occures in JPEGDecode (OJPEGDecode) function. TIFFjpeg_finish_decompress (TIFFojpeg_finish_decompress) is called even if a strip (or tile) is not finished. I override this with a patch:

static int
OJPEGDecode(register TIFF *tif,tidata_t buf,tsize_t cc,tsample_t s)
  {
.................................
 /* AZ: Close down the decompressor if we've finished the strip or tile. */
 if (sp->cinfo.d.output_scanline >= sp->cinfo.d.output_height)     /* I think we must check this first */

ERRCHK(TIFFojpeg_finish_decompress(sp,&ret)); /* AZ */
    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height
        || ret;
................................................
}

, So have I found a bug, or maybe Im not using scanline interface properly?

Both cases are possible. Could you show the code snippet you are using for scanline reading?

Andrey

Andrey V. Kiselev
Home phone: +7 812 5274898 ICQ# 26871517