Hi Paul hmm - that sounds about right. let me take a closer look in a mo ...
Piotr ________________________________________ From: openexr-devel-bounces+pstanczyk=ilm....@nongnu.org [openexr-devel-bounces+pstanczyk=ilm....@nongnu.org] on behalf of Paul Miller [p...@fxtech.com] Sent: 13 February 2012 14:44 To: Ciaran Wills Cc: openexr-devel@nongnu.org Subject: Re: [Openexr-devel] how to properly save with data window? On 2/13/2012 4:33 PM, Ciaran Wills wrote: > > On Feb 13, 2012, at 1:16 PM, Paul Miller wrote: > >> When I specify for example a data window such as (-70,-154)-(649,331) for a >> 720x486 image and then call writePixels(486), the library is crashing down >> in copyFromFrameBuffer(). >> >> Perhaps this is the way I am adding Slices to my frame-buffer? >> >> for (int i = 0; i< channels; i++) >> { >> const half *pixels = pixPtr + i; >> frameBuffer.insert(chanName, Slice(HALF, (char *)(pixels), sizeof(half) >> * channels, sizeof(half) * width * channels)); >> } >> >> I am basing this on "3.2 Writing a Cropped Image" in the reading/writing >> document. Though my RGBA pixels are packed into a single buffer. >> >> What am I doing wrong? > > I think you probably need to offset the pixel pointer to point at where pixel > (0, 0) would be - section 2.2 explains the pixel pointer math a bit clearer. I tried that as well: const half *pixels = pixPtr + chan_index; pixels = pixels - dataWindow.min.x - (dataWindow.min.y * width); fb.insert(chanName, Slice(HALF, (char *)(pixels), sizeof(half) * channels, sizeof(half) * width * channels)); But I got the same crash in the same place. Thus my confusion. _______________________________________________ Openexr-devel mailing list Openexr-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/openexr-devel _______________________________________________ Openexr-devel mailing list Openexr-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/openexr-devel