Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
ea64ed2e
Commit
ea64ed2e
authored
13 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
BUG: change variable type from std::stremoff to unint64_t
parent
9ada2383
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Common/otbStreamingTraits.txx
+20
-16
20 additions, 16 deletions
Code/Common/otbStreamingTraits.txx
with
20 additions
and
16 deletions
Code/Common/otbStreamingTraits.txx
+
20
−
16
View file @
ea64ed2e
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
#include "itkLinearInterpolateImageFunction.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "stdint.h"
namespace otb
namespace otb
{
{
...
@@ -55,10 +57,10 @@ unsigned long StreamingTraitsBase<TImage>
...
@@ -55,10 +57,10 @@ unsigned long StreamingTraitsBase<TImage>
{
{
const unsigned long bufferMemorySizeOctet = bufferMemorySize / 8;
const unsigned long bufferMemorySizeOctet = bufferMemorySize / 8;
unsigned long numberColumnsOfRegion = region.GetSize()[0]; // X dimension
unsigned long numberColumnsOfRegion = region.GetSize()[0]; // X dimension
const u
nsigned long sizeLine =
numberColumnsOfRegion * \
const u
int64_t sizeLine = static_cast<uint64_t>(
numberColumnsOfRegion * \
image->GetNumberOfComponentsPerPixel() * \
image->GetNumberOfComponentsPerPixel() * \
sizeof(PixelType);
sizeof(PixelType)
)
;
u
nsigned long
regionSize = region.GetSize()[1] * sizeLine;
u
int64_t
regionSize =
static_cast<uint64_t>(
region.GetSize()[1]
)
* sizeLine;
otbMsgDevMacro(<< "image->GetNumberOfComponentsPerPixel() = " << image->GetNumberOfComponentsPerPixel());
otbMsgDevMacro(<< "image->GetNumberOfComponentsPerPixel() = " << image->GetNumberOfComponentsPerPixel());
otbMsgDevMacro(<< "sizeof(PixelType) = " << sizeof(PixelType));
otbMsgDevMacro(<< "sizeof(PixelType) = " << sizeof(PixelType));
otbMsgDevMacro(<< "numberColumnsOfRegion = " << numberColumnsOfRegion);
otbMsgDevMacro(<< "numberColumnsOfRegion = " << numberColumnsOfRegion);
...
@@ -68,7 +70,7 @@ unsigned long StreamingTraitsBase<TImage>
...
@@ -68,7 +70,7 @@ unsigned long StreamingTraitsBase<TImage>
otbMsgDevMacro(<< "bufferMemorySizeOctet = " << bufferMemorySizeOctet);
otbMsgDevMacro(<< "bufferMemorySizeOctet = " << bufferMemorySizeOctet);
//Active streaming
//Active streaming
if (regionSize > bufferMemorySizeOctet)
if (regionSize >
static_cast<uint64_t>(
bufferMemorySizeOctet)
)
{
{
//The regionSize must be at list equal to the sizeLine
//The regionSize must be at list equal to the sizeLine
if (regionSize < sizeLine)
if (regionSize < sizeLine)
...
@@ -115,13 +117,13 @@ unsigned long StreamingTraitsBase<TImage>
...
@@ -115,13 +117,13 @@ unsigned long StreamingTraitsBase<TImage>
{
{
typedef otb::ConfigurationFile ConfigurationType;
typedef otb::ConfigurationFile ConfigurationType;
ConfigurationType::Pointer conf = ConfigurationType::GetInstance();
ConfigurationType::Pointer conf = ConfigurationType::GetInstance();
std::streamoff
streamMaxSizeBufferForStreamingInBytes;
uint64_t
streamMaxSizeBufferForStreamingInBytes;
std::streamoff
streamImageSizeToActivateStreamingInBytes;
uint64_t
streamImageSizeToActivateStreamingInBytes;
try
try
{
{
streamMaxSizeBufferForStreamingInBytes = conf->GetParameter<
std::streamoff
>(
streamMaxSizeBufferForStreamingInBytes = conf->GetParameter<
uint64_t
>(
"OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING");
"OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING");
streamImageSizeToActivateStreamingInBytes = conf->GetParameter<
std::streamoff
>(
streamImageSizeToActivateStreamingInBytes = conf->GetParameter<
uint64_t
>(
"OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING");
"OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING");
}
}
catch(...)
catch(...)
...
@@ -129,15 +131,17 @@ unsigned long StreamingTraitsBase<TImage>
...
@@ -129,15 +131,17 @@ unsigned long StreamingTraitsBase<TImage>
// We should never have to go here if the configuration file is
// We should never have to go here if the configuration file is
// correct and found. In case it is not fallback on the cmake
// correct and found. In case it is not fallback on the cmake
// defined constants.
// defined constants.
streamMaxSizeBufferForStreamingInBytes = OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING;
streamMaxSizeBufferForStreamingInBytes =
static_cast<uint64_t>(
OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING
)
;
streamImageSizeToActivateStreamingInBytes = OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING;
streamImageSizeToActivateStreamingInBytes =
static_cast<uint64_t>(
OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING
)
;
}
}
std::streamoff numberColumnsOfRegion = region.GetSize()[0]; // X dimension
uint64_t numberColumnsOfRegion = region.GetSize()[0]; // X dimension
const std::streamoff sizeLineInBytes = static_cast<std::streamoff>(numberColumnsOfRegion) * \
const uint64_t sizeLineInBytes = static_cast<uint64_t>(numberColumnsOfRegion) * \
static_cast<std::streamoff>(image->GetNumberOfComponentsPerPixel()) * \
static_cast<uint64_t>(image->GetNumberOfComponentsPerPixel()) * \
static_cast<std::streamoff>(sizeof(PixelType));
static_cast<uint64_t>(sizeof(PixelType));
const std::streamoff regionSizeInBytes = region.GetSize()[1] * sizeLineInBytes;
// Store in double, because std::streamoff = long which max value is 12.8e9.
// It happens that we loop the buffer
const uint64_t regionSizeInBytes = static_cast<uint64_t>(region.GetSize()[1]) * sizeLineInBytes;
otbMsgDevMacro(<< "streamImageSizeToActivateStreaming in Bytes = " << streamImageSizeToActivateStreamingInBytes);
otbMsgDevMacro(<< "streamImageSizeToActivateStreaming in Bytes = " << streamImageSizeToActivateStreamingInBytes);
otbMsgDevMacro(<< "streamMaxSizeBufferForStreaming in Bytes = " << streamMaxSizeBufferForStreamingInBytes);
otbMsgDevMacro(<< "streamMaxSizeBufferForStreaming in Bytes = " << streamMaxSizeBufferForStreamingInBytes);
otbMsgDevMacro(<< "image->GetNumberOfComponentsPerPixel() = " << image->GetNumberOfComponentsPerPixel());
otbMsgDevMacro(<< "image->GetNumberOfComponentsPerPixel() = " << image->GetNumberOfComponentsPerPixel());
...
@@ -146,7 +150,7 @@ unsigned long StreamingTraitsBase<TImage>
...
@@ -146,7 +150,7 @@ unsigned long StreamingTraitsBase<TImage>
otbMsgDevMacro(<< "sizeLine in Bytes = " << sizeLineInBytes);
otbMsgDevMacro(<< "sizeLine in Bytes = " << sizeLineInBytes);
otbMsgDevMacro(<< "regionSizeInBytes = " << regionSizeInBytes);
otbMsgDevMacro(<< "regionSizeInBytes = " << regionSizeInBytes);
if (regionSizeInBytes > streamImageSizeToActivateStreamingInBytes)
if (
regionSizeInBytes > streamImageSizeToActivateStreamingInBytes
)
{
{
// Activate streaming
// Activate streaming
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment