Hi,
I'm bumping this topic to answer my second question:
"Second question: can the premult work when reading channel per channel
? Naively I'd say that it can't: we may not have the data in memory. "
The answer is yes, depending on how you set the strides. Using auto
stride, it will always fail, because ystride is computed using the
number of channels in the file, not the number of channels we read.
I changed my code to always set the stride manually and the crashes are
gone.
Shouldn't the auto stride functions use the (chend-chmin +1) instead of
nchannels to compute the correct value ? I'm thinking that if someone is
reading not all channels, the output buffer will contain data only for
the requested channels, so the stride should match it.
On 06/23/2016 10:36 AM, Michel Lerenard wrote:
Hi,
A while ago, I had an issue with single channel tiff files ( crash in
alpha premult ), which I fixed by setting
"oiio:UnassociatedAlpha" = 1 in the spec config.
Weird thing is, I kept getting crashes with another file that declares
multiple channels, in the same premult function.
In my code, I read channel by channel, so I have multiple calls to
TIFFInput::read_scanline, with chbegin = chend each time.
After a bit of debug, I found that the first time I call the function,
the m_convert_alpha boolean is correctly set to false. However, in the
second call, it get erased in ImageInput::read_scanlines and is set to
true.
The issue comes from the way the read_native_scanline function is
coded: if we request a scanline that we have already read, we close
the file and reopened it using this calls:
if (! close () ||
! open (m_filename, dummyspec) ||
! seek_subimage (old_subimage, old_miplevel, dummyspec)) {
return false; // Somehow, the re-open failed
}
So obviously, the current config paremeters are lost. Isn't it
possible rewind instead of reopening the file ?
Second question: can the premult work when reading channel per channel
? Naively I'd say that it can't: we may not have the data in memory.
Michel
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org