From a3537ba3f3974a0dae049e4577143766c3af8c67 Mon Sep 17 00:00:00 2001 From: Peter Hillman Date: Thu, 18 Feb 2021 11:56:35 +1300 Subject: [PATCH] exrcheck: Revert to using 'getStep' for Rgba interfaces Signed-off-by: Peter Hillman --- src/lib/OpenEXRUtil/ImfCheckFile.cpp | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/lib/OpenEXRUtil/ImfCheckFile.cpp b/src/lib/OpenEXRUtil/ImfCheckFile.cpp index dd7ed49bbf..73545e8017 100644 --- a/src/lib/OpenEXRUtil/ImfCheckFile.cpp +++ b/src/lib/OpenEXRUtil/ImfCheckFile.cpp @@ -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(pixelCount / gTargetPixelsToRead) , static_cast(rowCount / gMaxScanlinesToRead) ) ); + } + else + { + return 1; + } + +} // // read image or part using the Rgba interface // @@ -61,7 +92,7 @@ readRgba(T& in, bool reduceMemory , bool reduceTime) Array pixels (w); in.setFrameBuffer (&pixels[-dx], 1, 0); - int step = 1; + int step = getStep( dw , reduceTime ); // // try reading scanlines. Continue reading scanlines