Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exrcheck: better tile checks in reduceMemory mode #928

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/lib/OpenEXRUtil/ImfCheckFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ readMultiPart(MultiPartInputFile& in,bool reduceMemory,bool reduceTime)
}

bool widePart = false;
bool largeTiles = false;
Box2i b = in.header( part ).dataWindow();

//
Expand All @@ -736,10 +737,16 @@ readMultiPart(MultiPartInputFile& in,bool reduceMemory,bool reduceTime)
//
if (isTiled(in.header( part ).type()))
{
if ( in.header( part ).tileDescription().ySize * (b.max.x-b.min.x+1) > gMaxTilePixelsPerScanline )
const TileDescription& tileDescription = in.header( part ).tileDescription();
int tilesPerScanline = (b.max.x-b.min.x + tileDescription.xSize) / tileDescription.xSize;
if ( tileDescription.ySize * tileDescription.xSize * tilesPerScanline > gMaxTilePixelsPerScanline )
meshula marked this conversation as resolved.
Show resolved Hide resolved
{
widePart = true;
}
if( tileDescription.ySize * tileDescription.xSize > gMaxTileSize)
{
largeTiles = true;
}
}

if (!reduceMemory || !widePart)
Expand All @@ -762,7 +769,8 @@ readMultiPart(MultiPartInputFile& in,bool reduceMemory,bool reduceTime)
}
}

{
if (!reduceMemory || !largeTiles)
{
bool gotThrow = false;

try
Expand Down Expand Up @@ -804,6 +812,7 @@ readMultiPart(MultiPartInputFile& in,bool reduceMemory,bool reduceTime)
}
}

if (!reduceMemory || !largeTiles)
{
bool gotThrow = false;

Expand Down Expand Up @@ -970,7 +979,8 @@ runChecks(T& source,bool reduceMemory,bool reduceTime)
if (isTiled(firstPartType))
{
const TileDescription& tileDescription = multi.header(0).tileDescription();
if ( tileDescription.ySize * (b.max.x-b.min.x+1) > gMaxTilePixelsPerScanline )
int tilesPerScanline = (b.max.x-b.min.x + tileDescription.xSize) / tileDescription.xSize;
if ( tileDescription.ySize * tileDescription.xSize * tilesPerScanline > gMaxTilePixelsPerScanline )
{
firstPartWide = true;
}
Expand Down