diff --git a/Code/Common/otbImageRegionSquareTileSplitter.txx b/Code/Common/otbImageRegionSquareTileSplitter.txx index 6870b8dd034b2cef25ba00ab21b28721a2aa40bd..a964c82dd4f6ced85a42ac04a6f77a2b77baee63 100644 --- a/Code/Common/otbImageRegionSquareTileSplitter.txx +++ b/Code/Common/otbImageRegionSquareTileSplitter.txx @@ -33,8 +33,8 @@ ImageRegionSquareTileSplitter<VImageDimension> unsigned int theoricalNbPixelPerTile = region.GetNumberOfPixels() / requestedNumber; unsigned int theoricalTileDimension = static_cast<unsigned int> (vcl_sqrt(static_cast<double>(theoricalNbPixelPerTile)) ); - // Take the previous multiple of m_TileSizeAlignment (eventually generate more splits than requested) - m_TileDimension = theoricalTileDimension / m_TileSizeAlignment * m_TileSizeAlignment; + // Take the next multiple of m_TileSizeAlignment (eventually generate more splits than requested) + m_TileDimension = (theoricalTileDimension + m_TileSizeAlignment - 1) / m_TileSizeAlignment * m_TileSizeAlignment; // Minimal tile size is m_TileSizeAlignment * m_TileSizeAlignment if (m_TileDimension < m_TileSizeAlignment)