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: check for tilesize in reduceMemory mode #920

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/lib/OpenEXRUtil/ImfCheckFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,14 +904,16 @@ runChecks(T& source,bool reduceMemory,bool reduceTime)


//
// scanline images with very wide parts take excessive memory to read
// assume the first part is wide until the header of the first part is checked
// so the single part scanline input APIs can be skipped.
// scanline images with very wide parts and tiled images with large tiles
// take excessive memory to read.
// Assume the first part requires excessive memory until the header of the first part is checked
// so the single part input APIs can be skipped.
//
// If the MultiPartInputFile constructor throws an exception, the first part
// will assumed to be a wide image
//
bool firstPartWide = true;
bool largeTiles = true;

bool threw = false;
{
Expand All @@ -936,10 +938,24 @@ runChecks(T& source,bool reduceMemory,bool reduceTime)
firstPartType = multi.header(0).type();
if (isTiled(firstPartType))
{
if ( multi.header(0).tileDescription().ySize * (b.max.x-b.min.x+1) > gMaxTilePixelsPerScanline )
const TileDescription& tileDescription = multi.header(0).tileDescription();
if ( tileDescription.ySize * (b.max.x-b.min.x+1) > gMaxTilePixelsPerScanline )
{
firstPartWide = true;
}

if( tileDescription.ySize * tileDescription.xSize <= gMaxTileSize)
{
largeTiles = false;
}

}
else
{
// file is not tiled, so can't contain large tiles
// setting largeTiles false here causes the Tile and DeepTile API
// tests to run on non-tiled files, which should cause exceptions to be thrown
largeTiles = false;
}


Expand Down Expand Up @@ -991,6 +1007,7 @@ runChecks(T& source,bool reduceMemory,bool reduceTime)
}
}

if( !reduceMemory || !largeTiles )
{
bool gotThrow = false;
resetInput(source);
Expand Down Expand Up @@ -1028,6 +1045,7 @@ runChecks(T& source,bool reduceMemory,bool reduceTime)
}
}

if( !reduceMemory || !largeTiles )
{
bool gotThrow = false;
resetInput(source);
Expand Down