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: Revert to using 'getStep' for Rgba interfaces #926

Merged
Changes from all commits
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
33 changes: 32 additions & 1 deletion src/lib/OpenEXRUtil/ImfCheckFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ const int gMaxTileSize = 1000*1000;
const int gMaxSamplesPerDeepPixel = 1000;
const int gMaxSamplesPerScanline = 1<<12;

//
// limits for reduceTime mode
//
const int gTargetPixelsToRead = 1<<28;
const int gMaxScanlinesToRead = 1<<20;




//
// compute row stride appropriate to process files quickly
// only used for the 'Rgba' interfaces, which read potentially non-existant channels
//
//

int
getStep( const Box2i &dw , bool reduceTime)
{

if (reduceTime)
{
size_t rowCount = (dw.max.y - dw.min.y + 1);
size_t pixelCount = rowCount * (dw.max.x - dw.min.x + 1);
return max( 1 , max ( static_cast<int>(pixelCount / gTargetPixelsToRead) , static_cast<int>(rowCount / gMaxScanlinesToRead) ) );
}
else
{
return 1;
}

}
//
// read image or part using the Rgba interface
//
Expand All @@ -61,7 +92,7 @@ readRgba(T& in, bool reduceMemory , bool reduceTime)
Array<Rgba> pixels (w);
in.setFrameBuffer (&pixels[-dx], 1, 0);

int step = 1;
int step = getStep( dw , reduceTime );

//
// try reading scanlines. Continue reading scanlines
Expand Down