Re: Problem with deep data

Michael Wolf <[email protected]> Thu, 19 Apr 2018 23:45:27 +0200
Newsgroups gmane.comp.video.openexr.devel
Organization db&w GbR
Message-ID <[email protected]>
--===============8839266349357837919==
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head><title>Re: [Openexr-devel] Problem with deep data</title>
</head>
<body>
<span style=3D" font-family:'Courier New'; font-size: 14pt;">Hallo Richard,=
<br>
<br>
This is a snippet from my simple deep reader (half RGBA, float Z)- minus al=
l the cleanup.<br>
It was written some time ago as a simple test, but it works for the purpose=
. Maybe it helps you find the issue.<br>
<br>
--- snip ---<br>
<br>
<span style=3D" font-family:'Tahoma'; font-size: 10pt; color: #000000;">Imf=
::Array2D&lt; unsigned int &gt; sampleCount;<br>
Imf::Array2D&lt; half* &gt; dataR, dataG, dataB, dataA;<br>
<br>
void readDeepExr(const char *filename)<br>
{<br>
&nbsp; Imf::DeepScanLineInputFile file(filename);<br>
&nbsp; const Imf::Header &amp;header =3D file.header();<br>
<br>
&nbsp; dataWindow =3D header.dataWindow();<br>
&nbsp; displayWindow =3D header.displayWindow();<br>
&nbsp; width =3D dataWindow.max.x - dataWindow.min.x + 1;<br>
&nbsp; height =3D dataWindow.max.y - dataWindow.min.y + 1;<br>
<br>
&nbsp; sampleCount.resizeEraseUnsafe(height, width);<br>
&nbsp; Imf::Array2D&lt; float* &gt;dataZ(height, width);<br>
&nbsp; dataR.resizeEraseUnsafe(height, width); dataG.resizeEraseUnsafe(heig=
ht, width);<br>
&nbsp; dataB.resizeEraseUnsafe(height, width); dataA.resizeEraseUnsafe(heig=
ht, width); &nbsp; &nbsp; &nbsp; &nbsp;<br>
<br>
&nbsp; Imf::DeepFrameBuffer frameBuffer;<br>
&nbsp; frameBuffer.insertSampleCountSlice (Imf::Slice (Imf::UINT,<br>
&nbsp; &nbsp; (char *) (&amp;sampleCount[0][0] - dataWindow.min.x - dataWin=
dow.min.y * width),<br>
&nbsp; &nbsp; sizeof (unsigned int) * 1, // xStride<br>
&nbsp; &nbsp; sizeof (unsigned int) * width)); // yStride<br>
&nbsp; frameBuffer.insert ("Z",<br>
&nbsp; &nbsp; Imf::DeepSlice (Imf::FLOAT, (char *) (&amp;dataZ[0][0] - data=
Window.min.x - dataWindow.min.y * width),<br>
&nbsp; &nbsp; sizeof (float *) * 1, // xStride for pointer array<br>
&nbsp; &nbsp; sizeof (float *) * width, // yStride for pointer array<br>
&nbsp; &nbsp; sizeof (float) * 1)); // stride for Z data sample<br>
&nbsp; frameBuffer.insert ("R",<br>
&nbsp; &nbsp; Imf::DeepSlice (Imf::HALF, (char *) (&amp;dataR[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
&nbsp; &nbsp; sizeof (half *), // xStride for pointer array<br>
&nbsp; &nbsp; sizeof (half *) * width, // yStride for pointer array<br>
&nbsp; &nbsp; sizeof (half))); // stride for O data sample<br>
&nbsp; frameBuffer.insert ("G",<br>
&nbsp; &nbsp; Imf::DeepSlice (Imf::HALF, (char *) (&amp;dataG[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
&nbsp; &nbsp; sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
&nbsp; frameBuffer.insert ("B",<br>
&nbsp; &nbsp; Imf::DeepSlice (Imf::HALF, (char *) (&amp;dataB[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
&nbsp; &nbsp; sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
&nbsp; frameBuffer.insert ("A",<br>
&nbsp; &nbsp; Imf::DeepSlice (Imf::HALF, (char *) (&amp;dataA[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
&nbsp; &nbsp; sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
<br>
&nbsp; file.setFrameBuffer(frameBuffer);<br>
&nbsp; file.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y);<br>
<br>
&nbsp; for (int y =3D 0; y &lt; height; y++)<br>
&nbsp; {<br>
&nbsp; &nbsp; for (int x =3D 0; x &lt; width; x++)<br>
&nbsp; &nbsp; {<br>
&nbsp; &nbsp; &nbsp; int s =3D sampleCount[y][x];<br>
&nbsp; &nbsp; &nbsp; dataZ[y][x] =3D new float[s];<br>
&nbsp; &nbsp; &nbsp; dataR[y][x] =3D new half[s];<br>
&nbsp; &nbsp; &nbsp; dataG[y][x] =3D new half[s];<br>
&nbsp; &nbsp; &nbsp; dataB[y][x] =3D new half[s];<br>
&nbsp; &nbsp; &nbsp; dataA[y][x] =3D new half[s]; &nbsp; &nbsp; &nbsp;<br>
&nbsp; &nbsp; } &nbsp; &nbsp;<br>
&nbsp; }<br>
&nbsp; file.readPixels(dataWindow.min.y, dataWindow.max.y);<br>
&nbsp; std::cout &lt;&lt; "Done.\n";<br>
&nbsp;<br>
&nbsp; // clean up etc...<br>
}<br>
<br>
<br>
<span style=3D" font-family:'Courier New'; font-size: 14pt; color: #000000;=
">--- snip ---<br>
<br>
Cheers,<br>
Mike<br>
<br>
<span style=3D" font-family:'calibri'; color: #c0c0c0;"><i>--<br>
db&amp;w Bornemann und Wolf GbR<br>
Seyfferstr. 34<br>
70197 Stuttgart<br>
Deutschland<br>
&nbsp;<br>
</i></span></span></span></span><a style=3D" font-family:'calibri'; font-si=
ze: 14pt;" href=3D"mailto:[email protected]">[email protected]</a><=
br>
<span style=3D" font-family:'calibri'; font-size: 14pt; color: #c0c0c0;"><i=
>&nbsp;<br>
</i></span><a style=3D" font-family:'calibri'; font-size: 14pt;" href=3D"ht=
tp://www.db-w.com">http://www.db-w.com</a><br>
<span style=3D" font-family:'calibri'; font-size: 14pt; color: #c0c0c0;"><i=
>&nbsp;<br>
tel: +49 (711) 664 525-3<br>
fax: +49 (711) 664 525-1<br>
mob: +49 (173) 66 37 652<br>
&nbsp;<br>
skype: lupus_lux<br>
msn: &nbsp; </i></span><a style=3D" font-family:'calibri'; font-size: 14pt;=
" href=3D"mailto:[email protected]">[email protected]</a></body></h=
tml>



--===============8839266349357837919==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Openexr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/openexr-devel

--===============8839266349357837919==--