Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
872eb638
Commit
872eb638
authored
Jul 05, 2016
by
remicres
Browse files
BUG: wrong block size in populate blocks offsets, fixed
parent
044952fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
View file @
872eb638
...
...
@@ -518,13 +518,24 @@ SimpleParallelTiffWriter<TInputImage>
* Raster creation
************************************************************************/
// When mode is tiled, check the GeoTiff tile size
int inputRegionMinSize = std::min(inputRegion.GetSize()[0], inputRegion.GetSize()[1]);
if (m_TiffTiledMode && m_TiffTileSize > inputRegionMinSize)
// First, compute the block size
int block_size_x = m_TiffTiledMode;
if (m_TiffTiledMode)
{
// When mode is tiled, check the GeoTiff tile size
int inputRegionMinSize = std::min(inputRegion.GetSize()[0], inputRegion.GetSize()[1]);
if (m_TiffTileSize > inputRegionMinSize)
{
// Find the nearest (floor) power of 2
block_size_x = (int) std::pow(2, std::floor(std::log((double) inputRegionMinSize)/std::log(2.0)));
itkWarningMacro(<<"GeoTiff tile size is bigger than image. Setting to " << block_size_x);
}
}
else
{
// Find the nearest (floor) power of 2
m_TiffTileSize = (int) std::pow(2, std::floor(std::log((double) inputRegionMinSize)/std::log(2.0)));
itkWarningMacro(<<"GeoTiff tile size is bigger than image. Setting to " << m_TiffTileSize);
// When mode is not tiled (i.e. striped)
block_size_x = inputPtr->GetLargestPossibleRegion().GetSize()[0];
}
// Master process (Rank 0) is responsible for the creation of the output raster.
...
...
@@ -547,8 +558,8 @@ SimpleParallelTiffWriter<TInputImage>
dataType,
geotransform,
inputPtr->GetProjectionRef(),
m_TiffTiledMode
,
m_TiffTile
Siz
e);
block_size_x
,
m_TiffTile
dMod
e);
if (sperr != sptw::SP_None)
{
...
...
@@ -574,7 +585,7 @@ SimpleParallelTiffWriter<TInputImage>
if (otb::MPIConfig::Instance()->GetMyRank() == 0)
{
SPTW_ERROR sperr = populate_tile_offsets(output_raster,
m_TiffTileS
ize,
block_s
ize
_x
,
m_TiffTiledMode);
if (sperr != sptw::SP_None)
{
...
...
Modules/ThirdParty/SPTW/src/sptw.cc
View file @
872eb638
...
...
@@ -268,8 +268,8 @@ SPTW_ERROR create_generic_raster(string filename,
GDALDataType
band_type
,
double
*
geotransform
,
string
projection_srs
,
bool
tiled_mode
,
int
tile
s_siz
e
)
{
int
block_size_x
,
bool
tile
d_mod
e
)
{
GDALAllRegister
();
...
...
@@ -289,15 +289,11 @@ SPTW_ERROR create_generic_raster(string filename,
if
(
tiled_mode
)
{
std
::
stringstream
ts
;
ts
<<
tiles
_size
;
ts
<<
block
_size
_x
;
options
=
CSLSetNameValue
(
options
,
"TILED"
,
"YES"
);
options
=
CSLSetNameValue
(
options
,
"BLOCKXSIZE"
,
ts
.
str
().
c_str
());
options
=
CSLSetNameValue
(
options
,
"BLOCKYSIZE"
,
ts
.
str
().
c_str
());
}
else
{
tiles_size
=
x_size
;
}
// Create output raster
GDALDataset
*
output
=
...
...
Modules/ThirdParty/SPTW/src/sptw.h
View file @
872eb638
...
...
@@ -104,8 +104,8 @@ namespace sptw {
GDALDataType
band_type
,
double
*
geotransform
,
string
projection_srs
,
bool
tiled_mode
,
int
tile
s_siz
e
);
int
block_size_x
,
bool
tile
d_mod
e
);
SPTW_ERROR
create_raster
(
string
filename
,
int64_t
x_size
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment