Thread necromancy!

PR that proposes a fix to this old problem:  
https://github.com/OpenImageIO/oiio/pull/2117



> On Sep 27, 2016, at 2:21 PM, Yang Yang <[email protected]> wrote:
> 
> Hi Larry,
> 
> I did investigation and found the problem is caused by commit 
> https://github.com/OpenImageIO/oiio/commit/331c5cfc95d50894e5d65a980edd90b477f27f3d
>  
> <https://github.com/OpenImageIO/oiio/commit/331c5cfc95d50894e5d65a980edd90b477f27f3d>
> 
> The issue is due to the following code where TIFFRGBA interface is enabled 
> for COMPRESSION_JPEG.
> However, when I remove COMPRESSION_JPEG and m_use_rgba_interface will keep 
> false and no crash for JPEG in TIFF.
> 
> +        // OK, some edge cases we just don't handle. For those, fall back on
> +        // the TIFFRGBA interface.
> +        if (m_compression == COMPRESSION_JPEG || m_compression == 
> COMPRESSION_OJPEG ||
> +            m_photometric == PHOTOMETRIC_YCBCR || m_photometric == 
> PHOTOMETRIC_CIELAB ||
> +            m_photometric == PHOTOMETRIC_ICCLAB || m_photometric == 
> PHOTOMETRIC_ITULAB ||
> +            m_photometric == PHOTOMETRIC_LOGL || m_photometric == 
> PHOTOMETRIC_LOGLUV) {
> +            char emsg[1024];
> +            m_use_rgba_interface = true;
> +            if (! TIFFRGBAImageOK (m_tif, emsg)) {
> +                error ("No support for this flavor of TIFF file");
> +                return false;
> +            }
> +            // This falls back to looking like uint8 images
> +            m_spec.format = TypeDesc::UINT8;
> +            m_spec.channelformats.clear ();
> +            m_photometric = PHOTOMETRIC_RGB;
> +        }
> 
> Regards,
> 
> Yang
> 
> 
> 
> 2016-09-25 18:21 GMT-05:00 Yang Yang <[email protected] 
> <mailto:[email protected]>>:
> Hi Larry,
> 
> The libtiff is exactly the same, I only pull from master to update to the 
> newest version of OIIO. The old version is from 2015 somewhere.
> I will try to search and see which commit failed this image.
> 
> Regards,
> 
> Yang
> 
> 2016-09-25 13:00 GMT-05:00 Larry Gritz <[email protected] 
> <mailto:[email protected]>>:
> It does fail for me! So I'll take a look and see if I can figure out what's 
> going on.
> 
> To answer the question in your subject line, yes, the unit tests do test TIFF 
> JPEG compression by reading a JPEG-compressed file from the libtiff test 
> images. But that's really it. I've never actually seen a JPEG-compressed TIFF 
> image "in the wild", so I admit that it has not been extensively tested, 
> especially for edge cases like being both JPEG and multi-image.
> 
> 
>> On Sep 25, 2016, at 10:56 AM, Larry Gritz <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Sorry, Yang Yang. I think your email was sent list from an address other 
>> than you use to subscribe to the list, so it went into "quarantine" awaiting 
>> my approval to forward it to the rest of the list. But I've been traveling 
>> and very busy for a few days, and by the time I noticed it was awaiting 
>> moderation, it had already expired from the quarantine queue. (I have since 
>> extended the length of time things will wait in the queue before being 
>> auto-deleted.)
>> 
>> So you're saying that this file can't be opened properly by today's master, 
>> but could be at some point in the past? Do you know what version works? 
>> Also, are you quite sure that both versions you tried (the one that worked, 
>> and the one that didn't) are using the very same version of libtiff? And do 
>> you know which version of libtiff you are using?
>> 
>> 
>>> Begin forwarded message:
>>> 
>>> From: Yang Yang <[email protected] <mailto:[email protected]>>
>>> Subject: Did anyone test JPEG compression support in TIFF format in the 
>>> master branch?
>>> Date: September 23, 2016 at 8:22:25 AM PDT
>>> To: OpenImageIO developers <[email protected] 
>>> <mailto:[email protected]>>
>>> 
>>> 
>>> Hi All,
>>> 
>>> I encountered a strange issue that read tiff image which contains multiple 
>>> jpeg files will crash application. It crashes at TIFFReadRGBAImageOriented.
>>> 
>>> *****************************************************
>>> bool
>>> TIFFInput::read_native_scanline (int y, int z, void *data)
>>> {
>>>     y -= m_spec.y;
>>> 
>>>     if (m_use_rgba_interface) {
>>>         // We punted and used the RGBA image interface -- copy from buffer.
>>>         // libtiff has no way to read just one scanline as RGBA. So we
>>>         // buffer the whole image.
>>>         if (! m_rgbadata.size()) { // first time through: allocate & read
>>>             m_rgbadata.resize (m_spec.width * m_spec.height * m_spec.depth);
>>>             bool ok = TIFFReadRGBAImageOriented (m_tif, m_spec.width, 
>>> m_spec.height,
>>>                                        &m_rgbadata[0], ORIENTATION_TOPLEFT, 
>>> 0);
>>> 
>>> *****************************************************
>>> 
>>> However the file can be open correctly using old version OpenImageIO and 
>>> other tools such as IrfanView.
>>> 
>>> I have no idea what is going wrong. It seems like the data is corrupted 
>>> somehow.
>>> I also attached an example file which failed in master branch oiio.
>>> I would be appreciated if anyone can point out a hint.
>>> 
>>> Regards,
>>> 
>>> Yang
>>> <Test-JPEG-2.tiff>
>>> 
>>> 
>>> 
>>> 

--
Larry Gritz
[email protected]




_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to