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< unsigned int > sampleCount;<br>
Imf::Array2D< half* > dataR, dataG, dataB, dataA;<br>
<br>
void readDeepExr(const char *filename)<br>
{<br>
Imf::DeepScanLineInputFile file(filename);<br>
const Imf::Header &header =3D file.header();<br>
<br>
dataWindow =3D header.dataWindow();<br>
displayWindow =3D header.displayWindow();<br>
width =3D dataWindow.max.x - dataWindow.min.x + 1;<br>
height =3D dataWindow.max.y - dataWindow.min.y + 1;<br>
<br>
sampleCount.resizeEraseUnsafe(height, width);<br>
Imf::Array2D< float* >dataZ(height, width);<br>
dataR.resizeEraseUnsafe(height, width); dataG.resizeEraseUnsafe(heig=
ht, width);<br>
dataB.resizeEraseUnsafe(height, width); dataA.resizeEraseUnsafe(heig=
ht, width); <br>
<br>
Imf::DeepFrameBuffer frameBuffer;<br>
frameBuffer.insertSampleCountSlice (Imf::Slice (Imf::UINT,<br>
(char *) (&sampleCount[0][0] - dataWindow.min.x - dataWin=
dow.min.y * width),<br>
sizeof (unsigned int) * 1, // xStride<br>
sizeof (unsigned int) * width)); // yStride<br>
frameBuffer.insert ("Z",<br>
Imf::DeepSlice (Imf::FLOAT, (char *) (&dataZ[0][0] - data=
Window.min.x - dataWindow.min.y * width),<br>
sizeof (float *) * 1, // xStride for pointer array<br>
sizeof (float *) * width, // yStride for pointer array<br>
sizeof (float) * 1)); // stride for Z data sample<br>
frameBuffer.insert ("R",<br>
Imf::DeepSlice (Imf::HALF, (char *) (&dataR[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
sizeof (half *), // xStride for pointer array<br>
sizeof (half *) * width, // yStride for pointer array<br>
sizeof (half))); // stride for O data sample<br>
frameBuffer.insert ("G",<br>
Imf::DeepSlice (Imf::HALF, (char *) (&dataG[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
frameBuffer.insert ("B",<br>
Imf::DeepSlice (Imf::HALF, (char *) (&dataB[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
frameBuffer.insert ("A",<br>
Imf::DeepSlice (Imf::HALF, (char *) (&dataA[0][0] - dataW=
indow.min.x - dataWindow.min.y * width),<br>
sizeof (half *), sizeof (half *) * width, sizeof (half)));<br>
<br>
file.setFrameBuffer(frameBuffer);<br>
file.readPixelSampleCounts(dataWindow.min.y, dataWindow.max.y);<br>
<br>
for (int y =3D 0; y < height; y++)<br>
{<br>
for (int x =3D 0; x < width; x++)<br>
{<br>
int s =3D sampleCount[y][x];<br>
dataZ[y][x] =3D new float[s];<br>
dataR[y][x] =3D new half[s];<br>
dataG[y][x] =3D new half[s];<br>
dataB[y][x] =3D new half[s];<br>
dataA[y][x] =3D new half[s]; <br>
} <br>
}<br>
file.readPixels(dataWindow.min.y, dataWindow.max.y);<br>
std::cout << "Done.\n";<br>
<br>
// 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&w Bornemann und Wolf GbR<br>
Seyfferstr. 34<br>
70197 Stuttgart<br>
Deutschland<br>
<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=
> <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=
> <br>
tel: +49 (711) 664 525-3<br>
fax: +49 (711) 664 525-1<br>
mob: +49 (173) 66 37 652<br>
<br>
skype: lupus_lux<br>
msn: </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==--