Commit 67f82674 authored by Cédric Traizet's avatar Cédric Traizet Committed by OTB Bot
Browse files

BUG: add patch to fix compilation of ossim with gcc 8

parent 5c096f44
diff -burN ossim-1.8.20-3.orig/ossim/include/ossim/base/ossimConstants.h ossim-1.8.20-3/ossim/include/ossim/base/ossimConstants.h
--- ossim-1.8.20-3.orig/ossim/include/ossim/base/ossimConstants.h 2021-07-28 10:09:22.060007606 +0200
+++ ossim-1.8.20-3/ossim/include/ossim/base/ossimConstants.h 2021-07-28 12:01:27.058425125 +0200
@@ -294,12 +294,21 @@
OSSIM_CFLOAT64 = 14, /**< 64 bit complex floating point */
OSSIM_NORMALIZED_FLOAT = 15, /**< 32 bit normalized floating point */
OSSIM_NORMALIZED_DOUBLE = 16, /**< 64 bit normalized floating point */
+ OSSIM_UINT11 = 17, /**< 16 bit unsigned integer (11 bits used) */
+ OSSIM_UINT12 = 18, /**< 16 bit unsigned integer (12 bits used) */
+ OSSIM_UINT13 = 19, /**< 16 bit unsigned integer (13 bits used) */
+ OSSIM_UINT14 = 20, /**< 16 bit unsigned integer (14 bits used) */
+ OSSIM_UINT15 = 21, /**< 16 bit unsigned integer (15 bits used) */
//---
// Below for backward compatibility only. Please use above enums in
// conjunction with null, min, max settings to determine bit depth.
//---
OSSIM_USHORT11 = 17, /**< 16 bit unsigned integer (11 bits used) */
+ OSSIM_USHORT12 = 18, /**< 16 bit unsigned integer (12 bits used) */
+ OSSIM_USHORT13 = 19, /**< 16 bit unsigned integer (13 bits used) */
+ OSSIM_USHORT14 = 20, /**< 16 bit unsigned integer (14 bits used) */
+ OSSIM_USHORT15 = 21, /**< 16 bit unsigned integer (15 bits used) */
OSSIM_UCHAR = 1, /**< 8 bit unsigned iteger */
OSSIM_USHORT16 = 3, /**< 16 bit unsigned iteger */
OSSIM_SSHORT16 = 4, /**< 16 bit signed integer */
@@ -524,6 +533,22 @@
#define OSSIM_DEFAULT_MIN_PIX_UINT11 ((ossim_uint16)1)
#define OSSIM_DEFAULT_MAX_PIX_UINT11 ((ossim_uint16)0x07FF)
+#define OSSIM_DEFAULT_NULL_PIX_UINT12 ((ossim_uint16)0)
+#define OSSIM_DEFAULT_MIN_PIX_UINT12 ((ossim_uint16)1)
+#define OSSIM_DEFAULT_MAX_PIX_UINT12 ((ossim_uint16)0x0FFF)
+
+#define OSSIM_DEFAULT_NULL_PIX_UINT13 ((ossim_uint16)0)
+#define OSSIM_DEFAULT_MIN_PIX_UINT13 ((ossim_uint16)1)
+#define OSSIM_DEFAULT_MAX_PIX_UINT13 ((ossim_uint16)0x1FFF)
+
+#define OSSIM_DEFAULT_NULL_PIX_UINT14 ((ossim_uint16)0)
+#define OSSIM_DEFAULT_MIN_PIX_UINT14 ((ossim_uint16)1)
+#define OSSIM_DEFAULT_MAX_PIX_UINT14 ((ossim_uint16)0x3FFF)
+
+#define OSSIM_DEFAULT_NULL_PIX_UINT15 ((ossim_uint16)0)
+#define OSSIM_DEFAULT_MIN_PIX_UINT15 ((ossim_uint16)1)
+#define OSSIM_DEFAULT_MAX_PIX_UINT15 ((ossim_uint16)0x7FFF)
+
#define OSSIM_DEFAULT_NULL_PIX_FLOAT ((ossim_float32)-1.0/FLT_EPSILON)
#define OSSIM_DEFAULT_MIN_PIX_FLOAT ((ossim_float32)((-1.0/FLT_EPSILON) + 1))
#define OSSIM_DEFAULT_MAX_PIX_FLOAT ((ossim_float32)((1.0/FLT_EPSILON)))
diff -burN ossim-1.8.20-3.orig/ossim/include/ossim/imaging/ossimBitMaskWriter.h ossim-1.8.20-3/ossim/include/ossim/imaging/ossimBitMaskWriter.h
--- ossim-1.8.20-3.orig/ossim/include/ossim/imaging/ossimBitMaskWriter.h 2021-07-28 10:09:22.084007795 +0200
+++ ossim-1.8.20-3/ossim/include/ossim/imaging/ossimBitMaskWriter.h 2021-07-28 10:37:48.125261018 +0200
@@ -16,6 +16,7 @@
#include <ossim/base/ossimIpt.h>
#include <ossim/base/ossimOutputSource.h>
#include <ossim/imaging/ossimPixelFlipper.h>
+#include <ossim/imaging/ossimMemoryImageSource.h>
#include <vector>
class ossimFilename;
@@ -123,6 +124,7 @@
ossimIpt computeImageSize(ossim_uint32 rlevel, ossimImageData* tile) const;
ossimRefPtr<ossimPixelFlipper> m_flipper;
+ ossimRefPtr<ossimMemoryImageSource> m_memoryImage;
vector<ossim_uint8*> m_buffers;
vector<ossimIpt> m_bufferSizes;
ossim_uint32 m_startingResLevel;
diff -burN ossim-1.8.20-3.orig/ossim/include/ossim/imaging/ossimPixelFlipper.h ossim-1.8.20-3/ossim/include/ossim/imaging/ossimPixelFlipper.h
--- ossim-1.8.20-3.orig/ossim/include/ossim/imaging/ossimPixelFlipper.h 2021-07-28 10:09:22.076007732 +0200
+++ ossim-1.8.20-3/ossim/include/ossim/imaging/ossimPixelFlipper.h 2021-07-28 10:39:08.741887033 +0200
@@ -206,9 +206,6 @@
virtual void setProperty(ossimRefPtr<ossimProperty> property);
virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
- //! This object can be used outside of an image chain for offline processing of existing tile.
- template <class T> void flipPixels(T dummy, ossimImageData* inpuTile, ossim_uint32 resLevel);
-
protected:
/** destructor */
virtual ~ossimPixelFlipper();
@@ -216,6 +213,9 @@
ossimImageData* inpuTile,
ossim_uint32 resLevel);
+ //! This object can be used outside of an image chain for offline processing of existing tile.
+ template <class T> void flipPixels(T dummy, ossimImageData* inpuTile, ossim_uint32 resLevel);
+
/**
* Verifies pixel is in range.
* @return Returns true if in range else false.
diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/imaging/ossimBitMaskWriter.cpp ossim-1.8.20-3/ossim/src/ossim/imaging/ossimBitMaskWriter.cpp
--- ossim-1.8.20-3.orig/ossim/src/ossim/imaging/ossimBitMaskWriter.cpp 2021-07-28 10:09:22.048007512 +0200
+++ ossim-1.8.20-3/ossim/src/ossim/imaging/ossimBitMaskWriter.cpp 2021-07-28 10:56:32.965045856 +0200
@@ -29,6 +29,7 @@
ossimBitMaskWriter::ossimBitMaskWriter()
:
m_flipper(0),
+ m_memoryImage(0),
m_startingResLevel(0)
{
}
@@ -116,43 +117,12 @@
if (!m_flipper.valid())
initializeFlipper();
- // The flipper is used to identify null pixels since it has more sophisticated filtering
- // than available from the tile object:
- switch (tile->getScalarType())
- {
- case OSSIM_UCHAR:
- m_flipper->flipPixels(ossim_uint8(0), tile.get(), rLevel);
- break;
- case OSSIM_UINT16:
- case OSSIM_USHORT11:
- m_flipper->flipPixels(ossim_uint16(0), tile.get(), rLevel);
- break;
- case OSSIM_SSHORT16:
- m_flipper->flipPixels(ossim_sint16(0), tile.get(), rLevel);
- break;
- case OSSIM_UINT32:
- m_flipper->flipPixels(ossim_uint32(0), tile.get(), rLevel);
- break;
- case OSSIM_SINT32:
- m_flipper->flipPixels(ossim_sint32(0), tile.get(), rLevel);
- break;
- case OSSIM_FLOAT32:
- case OSSIM_NORMALIZED_FLOAT:
- m_flipper->flipPixels(float(0), tile.get(), rLevel);
- break;
- case OSSIM_NORMALIZED_DOUBLE:
- case OSSIM_FLOAT64:
- m_flipper->flipPixels(ossim_float64(0), tile.get(), rLevel);
- break;
- case OSSIM_SCALAR_UNKNOWN:
- default:
- ossimNotify(ossimNotifyLevel_WARN) << "ossimBitMaskWriter::generateMask()-- "
- "Unsupported scalar type!" << endl;
- break;
- }
-
- ossimIpt image_size = computeImageSize(rLevel, tile.get());
- ossim_uint32 num_mask_cols = (image_size.x+7)/8; // size of mask buffer after compression
+ ossimRefPtr<ossimImageData> flipTile;
+ m_memoryImage->setImage(tile);
+ m_flipper->initialize();
+ flipTile = m_flipper->getTile(tile->getImageRectangle());
+ ossimIpt image_size = computeImageSize(rLevel, flipTile.get());
+ ossim_uint32 num_mask_cols = (image_size.x + 7) / 8; // size of mask buffer after compression
ossim_uint32 num_mask_rows = image_size.y;
ossim_uint8* maskbuf = 0;
@@ -169,7 +139,7 @@
maskbuf = m_buffers[mask_rlevel];
ossim_uint32 mask_index=0, tile_index=0, start_bit=0;
- ossimIrect tile_rect (tile->getImageRectangle());
+ ossimIrect tile_rect (flipTile->getImageRectangle());
ossimIpt ul (tile_rect.ul());
ossimIpt lr (tile_rect.lr());
@@ -188,8 +158,7 @@
for (ossim_uint32 mask_bit=start_bit; mask_bit<8; ++mask_bit)
{
// Decide whether to mask depending on pixel flipper outputting a NULL pixel.
- // if (tile->isNull(tile_index++))
- if (tile->isNull(tile_index++))
+ if (flipTile->isNull(tile_index++))
maskbuf[mask_index] &= MASK_BITS_0[mask_bit];
else
maskbuf[mask_index] |= MASK_BITS_1[mask_bit];
@@ -296,6 +265,11 @@
m_flipper->setTargetValue(0);
m_flipper->setReplacementValue(0);
}
+ if (!m_memoryImage)
+ {
+ m_memoryImage = new ossimMemoryImageSource();
+ m_flipper->connectMyInputTo(m_memoryImage.get());
+ }
// This method gets called when an input connection is made as well as other times, so keep an
// eye out for valid input connection:
diff -burN ossim-1.8.20-3.orig/ossim/src/ossim/imaging/ossimPixelFlipper.cpp ossim-1.8.20-3/ossim/src/ossim/imaging/ossimPixelFlipper.cpp
--- ossim-1.8.20-3.orig/ossim/src/ossim/imaging/ossimPixelFlipper.cpp 2021-07-28 10:09:22.008007198 +0200
+++ ossim-1.8.20-3/ossim/src/ossim/imaging/ossimPixelFlipper.cpp 2021-07-28 11:03:04.195539425 +0200
@@ -94,7 +94,6 @@
// Call the appropriate load method.
switch (inputTile->getScalarType())
{
-
case OSSIM_UCHAR:
{
flipPixels(ossim_uint8(0), inputTile.get(), resLevel);
@@ -103,6 +102,10 @@
case OSSIM_UINT16:
case OSSIM_USHORT11:
+ case OSSIM_USHORT12:
+ case OSSIM_USHORT13:
+ case OSSIM_USHORT14:
+ case OSSIM_USHORT15:
{
flipPixels(ossim_uint16(0), inputTile.get(), resLevel);
break;
@@ -126,7 +129,7 @@
case OSSIM_FLOAT32:
case OSSIM_NORMALIZED_FLOAT:
{
- flipPixels(float(0), inputTile.get(), resLevel);
+ flipPixels(ossim_float32(0), inputTile.get(), resLevel);
break;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment