Skip to content

Commit c41a2fc

Browse files
committed
ImfCheckFile: handle partial deep tiles
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
1 parent fffdcf2 commit c41a2fc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/lib/OpenEXRUtil/ImfCheckFile.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,15 +694,24 @@ readDeepTile (T& in, bool reduceMemory, bool reduceTime)
694694
try
695695
{
696696

697+
697698
in.readPixelSampleCounts (
698699
x, y, x, y, xlevel, ylevel);
699700

700701
size_t bufferSize = 0;
701702
size_t fileBufferSize = 0;
702703

703-
for (int ty = 0; ty < tileHeight; ++ty)
704+
Box2i tileRange =
705+
in.dataWindowForTile (x, y, xlevel, ylevel);
706+
707+
int thisTileWidth =
708+
tileRange.max.x - tileRange.min.x + 1;
709+
int thisTileHeight =
710+
tileRange.max.y - tileRange.min.y + 1;
711+
712+
for (int ty = 0; ty < thisTileHeight; ++ty)
704713
{
705-
for (int tx = 0; tx < tileWidth; ++tx)
714+
for (int tx = 0; tx < thisTileWidth; ++tx)
706715
{
707716
fileBufferSize +=
708717
channelCount *
@@ -731,9 +740,10 @@ readDeepTile (T& in, bool reduceMemory, bool reduceTime)
731740
pixelBuffer.resize (bufferSize);
732741
size_t bufferIndex = 0;
733742

734-
for (int ty = 0; ty < tileHeight; ++ty)
743+
for (int ty = 0; ty < thisTileHeight; ++ty)
735744
{
736-
for (int tx = 0; tx < tileWidth; ++tx)
745+
for (int tx = 0; tx < thisTileWidth;
746+
++tx)
737747
{
738748
if (!reduceMemory ||
739749
localSampleCount[ty][tx] *

0 commit comments

Comments
 (0)