Ok, from the start: Here's how I did it at first: for each tile of the image, i fill a buffer with contiguous data. Example, for a 6x4 image, with 4x4 tiles, i use a 16*4 buffer (16 pixels, 4 channels) - for the first tile the buffer contains RGBA 16 times. - for the second tile the buffer contains RGBA 8 times, the rest is filled with zeros
for each tile i call "out->write_tile (tile->get_x(), tile->get_y(), 0, TypeDesc::FLOAT, &buffer[0]);" with no stride parameter. This work fine for EXR, but not for TIFF. Second try was to write data non contiguously. Using the example above, i would now write for the second tile RGBARGBA00000000 RGBARGBA00000000 RGBARGBA00000000 RGBARGBA00000000 and then make the same call to write_tile. This work correctly for TIFF, not for EXR. So I ended doing things separately, i fill the buffer one way for EXR, another way for TIFF. That was the situation before you mail yesterday evening. After reading your message, I did a test: while always filled the buffer with contiguous data, as I did at first, I added a stride parameter to the write_tile function to specifiy the Y stride. And it works perfectly. Which does raises the same question again: as far as I understand, the exr plugin and the tiff plugin are not fetching data the same way from the buffer: the exr plugin computes the index of the data using the valid pixel width while the TIFF plugin uses the real tile width (the one from the spec structure). I though that using AutoStride parameters, function were using the hypothesis that data was contiguous. Following this thought, it looks like the write_tile function in the tiff plugin is not behaving correctly. Does this make any sense ? 2013/10/11 Larry Gritz <[email protected]> > Can you clarify a bit about exactly what's going on? > > So, in your app, for the bottom or right tiles, does your app prepare a > buffer that's the size of a regular tile and only fill part of it in? Or > does your app size its buffer big enough only for the valid pixels in that > bucket? > > Which of {exr,tiff} appears to be working correctly? And what happens for > the one that's broken? > > The intended behavior is that the app can either pass in a full bucket or > a "sized" bucket, as long as it gets the strides correct (but using > Autostride will cause it to assume it's a "full" bucket). In theory, the > plugin will only copy the valid pixels out of the app's buffer. Also in > theory, the plugin is responsible for copying your pixels into a temp > buffer, if necessary, in order to match the expectations of the underlying > image format library. I'd need to look at the docs for those libraries to > refresh my memory about exactly what the expect in these two cases. > > > > On Oct 11, 2013, at 12:36 PM, Lerenard Michel wrote: > > Ok, one detail in your post rings a bell. I'm actually calling write_tile > without any stride parameter, thinking my previous calls to copy_image > would have written data correctly in the buffer. > I'll check if setting the stride manually solves my issue. > > I'm still confused by the fact that the two plugins does not have the same > behavior. > > > 2013/10/11 Larry Gritz <[email protected]> > >> Which one seems to be working properly and which is broken? >> >> Is there a specific resolution that can reproduce the problem? >> >> From the *app's* point of view, it shouldn't matter. The app is calling >> write_tile with strides, which can let it easily specify whether it's a >> buffer the full size of an ordinary tile, or if the buffer is truly the >> size of a partial tile. >> >> The plugin is then responsible for rearranging the data, if necessary, >> before passing on to the underlying format-writing library (libtiff or >> libIlmImf). It's entirely possible that one of these is not doing that >> properly, though it would be slightly surprising to me because I don't >> recall having any errors reported related to this, and we use both file >> types. >> >> -- lg >> >> >> On Oct 11, 2013, at 8:38 AM, Michel Lerenard wrote: >> >> > Hi, >> > >> > i've stumbled across a serious issue while saving images. I'm using the >> write_tile function to write data in the image, and the function does not >> have the same behavior in Tiff and EXR plugins when writing the bottom and >> left border tiles, whose height and width can be truncated to respect the >> image size. >> > >> > The tiff plugin requires a buffer which covers a complete tile (ie >> spec.tilewidth*spec.tileheight*spec.channels) => non contiguous data on >> partially used border tiles. >> > the exr plugin requires a buffer which covers the exact size of the >> current tile. => contiguous data on all tiles >> > >> > >> > I need to have format specific code to arrange data so its works, using >> OIIO::copy_image. Is it intended, or is it a bug ? >> > >> > Michel >> > >> >> -- >> Larry Gritz >> [email protected] >> >> >> _______________________________________________ >> Oiio-dev mailing list >> [email protected] >> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org >> > > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > > > -- > Larry Gritz > [email protected] > > > > _______________________________________________ > Oiio-dev mailing list > [email protected] > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > >
_______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
