Deep image input data memory layout.
Thomas Loockx <[email protected]> Mon, 3 Aug 2015 11:11:08 +1200
| Newsgroups | gmane.comp.video.openexr.devel |
|---|---|
| Message-ID | <CAF_QEvjFV20pnULY20T=G_S6mVpDrNSgGR6Qorxmu06zo2FHYA@mail.gmail.com> |
Hi,
I'm trying to integrate OpenEXR deep pixel rendering into our render engine.
We ran into a crash in copyFromDeepFrameBuffer in this snippet (more
specifically in line 1598 of ImfMisc.cpp).
case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT:
for (int x = xMin; x <= xMax; x++)
{
unsigned int count =
sampleCount(sampleCountBase,
sampleCountXStride,
sampleCountYStride,
x - xOffsetForSampleCount,
y - yOffsetForSampleCount);
const char* ptr = base + (y-yOffsetForData) *
dataYStride + (x-xOffsetForData) * dataXStride;
const char* readPtr = ((const char**) ptr)[0];
for (unsigned int i = 0; i < count; i++)
{
Xdr::write <CharPtrIO> (writePtr, *(const float *)
readPtr); // CRASH HERE
readPtr += sampleStride;
}
}
break;
My understanding here is that OpenEXR internally interprets a deep
pixel in a channel as a pointer to an array of floating point values.
Unfortunately our memory isn't layed out like that. We allocate a
single memory chunk for the
full deep image. I tried several ways of creating the deep slice but I
can't seem to code my way around it.
Am I forced to copy all my data in arrays (or at least allocate a
separate buffer of float* pointers that point into my data) or is
there a way around this?
thanks,
Thomas Loockx