From 55bdfd181200cc098ddd9f3919019250e1ba7ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E7=8E=AE=E6=96=87?= Date: Fri, 13 Jan 2023 16:53:08 +0800 Subject: [PATCH] Support negative stride MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for negative stride to FrameBuffer Slice. Change data type of stride from size_t to ptrdiff_t. Add support for negative stride in `copyIntoFrameBuffer` and `copyFromFrameBuffer`. Add a new `testNegativeStride` test. Fixes: #614 Signed-off-by: 胡玮文 --- src/lib/OpenEXR/ImfAcesFile.cpp | 14 +- src/lib/OpenEXR/ImfAcesFile.h | 4 +- src/lib/OpenEXR/ImfCRgbaFile.cpp | 10 +- src/lib/OpenEXR/ImfCRgbaFile.h | 10 +- src/lib/OpenEXR/ImfDeepFrameBuffer.cpp | 4 +- src/lib/OpenEXR/ImfDeepFrameBuffer.h | 4 +- src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp | 12 +- src/lib/OpenEXR/ImfDeepTiledInputFile.cpp | 12 +- src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp | 12 +- src/lib/OpenEXR/ImfFrameBuffer.cpp | 14 +- src/lib/OpenEXR/ImfFrameBuffer.h | 18 +-- src/lib/OpenEXR/ImfMisc.cpp | 62 ++++---- src/lib/OpenEXR/ImfMisc.h | 12 +- src/lib/OpenEXR/ImfOutputFile.cpp | 10 +- src/lib/OpenEXR/ImfRgbaFile.cpp | 30 ++-- src/lib/OpenEXR/ImfRgbaFile.h | 12 +- src/lib/OpenEXR/ImfScanLineInputFile.cpp | 12 +- src/lib/OpenEXR/ImfTiledInputFile.cpp | 12 +- src/lib/OpenEXR/ImfTiledOutputFile.cpp | 10 +- src/lib/OpenEXR/ImfTiledRgbaFile.cpp | 30 ++-- src/lib/OpenEXR/ImfTiledRgbaFile.h | 4 +- src/test/OpenEXRTest/CMakeLists.txt | 2 + src/test/OpenEXRTest/main.cpp | 2 + src/test/OpenEXRTest/testNegativeStride.cpp | 159 +++++++++++++++++++ src/test/OpenEXRTest/testNegativeStride.h | 8 + 25 files changed, 326 insertions(+), 153 deletions(-) create mode 100644 src/test/OpenEXRTest/testNegativeStride.cpp create mode 100644 src/test/OpenEXRTest/testNegativeStride.h diff --git a/src/lib/OpenEXR/ImfAcesFile.cpp b/src/lib/OpenEXR/ImfAcesFile.cpp index 880ffb30f9..66cf9884d4 100644 --- a/src/lib/OpenEXR/ImfAcesFile.cpp +++ b/src/lib/OpenEXR/ImfAcesFile.cpp @@ -190,7 +190,7 @@ AcesOutputFile::~AcesOutputFile () void AcesOutputFile::setFrameBuffer ( - const Rgba* base, size_t xStride, size_t yStride) + const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { _data->rgbaFile->setFrameBuffer (base, xStride, yStride); } @@ -282,11 +282,11 @@ class AcesInputFile::Data RgbaInputFile* rgbaFile; - Rgba* fbBase; - size_t fbXStride; - size_t fbYStride; - int minX; - int maxX; + Rgba* fbBase; + ptrdiff_t fbXStride; + ptrdiff_t fbYStride; + int minX; + int maxX; bool mustConvertColor; M44f fileToAces; @@ -440,7 +440,7 @@ AcesInputFile::~AcesInputFile () } void -AcesInputFile::setFrameBuffer (Rgba* base, size_t xStride, size_t yStride) +AcesInputFile::setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { _data->rgbaFile->setFrameBuffer (base, xStride, yStride); _data->fbBase = base; diff --git a/src/lib/OpenEXR/ImfAcesFile.h b/src/lib/OpenEXR/ImfAcesFile.h index 86a2de91ad..4aae72cda2 100644 --- a/src/lib/OpenEXR/ImfAcesFile.h +++ b/src/lib/OpenEXR/ImfAcesFile.h @@ -150,7 +150,7 @@ class IMF_EXPORT_TYPE AcesOutputFile //------------------------------------------------ IMF_EXPORT - void setFrameBuffer (const Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //------------------------------------------------- // Write pixel data (see class Imf::OutputFile) @@ -247,7 +247,7 @@ class IMF_EXPORT_TYPE AcesInputFile //----------------------------------------------------- IMF_EXPORT - void setFrameBuffer (Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //-------------------------------------------- // Read pixel data (see class Imf::InputFile) diff --git a/src/lib/OpenEXR/ImfCRgbaFile.cpp b/src/lib/OpenEXR/ImfCRgbaFile.cpp index 084b2573ec..9807d8f844 100644 --- a/src/lib/OpenEXR/ImfCRgbaFile.cpp +++ b/src/lib/OpenEXR/ImfCRgbaFile.cpp @@ -947,7 +947,7 @@ ImfCloseOutputFile (ImfOutputFile* out) int ImfOutputSetFrameBuffer ( - ImfOutputFile* out, const ImfRgba* base, size_t xStride, size_t yStride) + ImfOutputFile* out, const ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { try { @@ -1043,8 +1043,8 @@ int ImfTiledOutputSetFrameBuffer ( ImfTiledOutputFile* out, const ImfRgba* base, - size_t xStride, - size_t yStride) + ptrdiff_t xStride, + ptrdiff_t yStride) { try { @@ -1165,7 +1165,7 @@ ImfCloseInputFile (ImfInputFile* in) int ImfInputSetFrameBuffer ( - ImfInputFile* in, ImfRgba* base, size_t xStride, size_t yStride) + ImfInputFile* in, ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { try { @@ -1245,7 +1245,7 @@ ImfCloseTiledInputFile (ImfTiledInputFile* in) int ImfTiledInputSetFrameBuffer ( - ImfTiledInputFile* in, ImfRgba* base, size_t xStride, size_t yStride) + ImfTiledInputFile* in, ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { try { diff --git a/src/lib/OpenEXR/ImfCRgbaFile.h b/src/lib/OpenEXR/ImfCRgbaFile.h index a259da3c4c..f06c89d53b 100644 --- a/src/lib/OpenEXR/ImfCRgbaFile.h +++ b/src/lib/OpenEXR/ImfCRgbaFile.h @@ -297,7 +297,7 @@ int ImfCloseOutputFile (ImfOutputFile* out); IMF_EXPORT int ImfOutputSetFrameBuffer ( - ImfOutputFile* out, const ImfRgba* base, size_t xStride, size_t yStride); + ImfOutputFile* out, const ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride); IMF_EXPORT int ImfOutputWritePixels (ImfOutputFile* out, int numScanLines); @@ -335,8 +335,8 @@ IMF_EXPORT int ImfTiledOutputSetFrameBuffer ( ImfTiledOutputFile* out, const ImfRgba* base, - size_t xStride, - size_t yStride); + ptrdiff_t xStride, + ptrdiff_t yStride); IMF_EXPORT int ImfTiledOutputWriteTile ( @@ -385,7 +385,7 @@ int ImfCloseInputFile (ImfInputFile* in); IMF_EXPORT int ImfInputSetFrameBuffer ( - ImfInputFile* in, ImfRgba* base, size_t xStride, size_t yStride); + ImfInputFile* in, ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride); IMF_EXPORT int ImfInputReadPixels (ImfInputFile* in, int scanLine1, int scanLine2); @@ -414,7 +414,7 @@ int ImfCloseTiledInputFile (ImfTiledInputFile* in); IMF_EXPORT int ImfTiledInputSetFrameBuffer ( - ImfTiledInputFile* in, ImfRgba* base, size_t xStride, size_t yStride); + ImfTiledInputFile* in, ImfRgba* base, ptrdiff_t xStride, ptrdiff_t yStride); IMF_EXPORT int diff --git a/src/lib/OpenEXR/ImfDeepFrameBuffer.cpp b/src/lib/OpenEXR/ImfDeepFrameBuffer.cpp index a6ce21ab7f..a313ff0992 100644 --- a/src/lib/OpenEXR/ImfDeepFrameBuffer.cpp +++ b/src/lib/OpenEXR/ImfDeepFrameBuffer.cpp @@ -14,8 +14,8 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER DeepSlice::DeepSlice ( PixelType t, char* b, - size_t xst, - size_t yst, + ptrdiff_t xst, + ptrdiff_t yst, size_t spst, int xsm, int ysm, diff --git a/src/lib/OpenEXR/ImfDeepFrameBuffer.h b/src/lib/OpenEXR/ImfDeepFrameBuffer.h index 3876796859..c59bc60ac8 100644 --- a/src/lib/OpenEXR/ImfDeepFrameBuffer.h +++ b/src/lib/OpenEXR/ImfDeepFrameBuffer.h @@ -49,8 +49,8 @@ struct IMF_EXPORT_TYPE DeepSlice : public Slice DeepSlice ( PixelType type = HALF, char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, size_t sampleStride = 0, int xSampling = 1, int ySampling = 1, diff --git a/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp b/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp index f17d821c90..6b4e08a0d8 100644 --- a/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepScanLineInputFile.cpp @@ -62,8 +62,8 @@ struct InSliceInfo PixelType typeInFile; char* base; char* pointerArrayBase; - size_t xPointerStride; - size_t yPointerStride; + ptrdiff_t xPointerStride; + ptrdiff_t yPointerStride; size_t sampleStride; int xSampling; int ySampling; @@ -75,8 +75,8 @@ struct InSliceInfo PixelType typeInFrameBuffer = HALF, char* base = NULL, PixelType typeInFile = HALF, - size_t xPointerStride = 0, - size_t yPointerStride = 0, + ptrdiff_t xPointerStride = 0, + ptrdiff_t yPointerStride = 0, size_t sampleStride = 0, int xSampling = 1, int ySampling = 1, @@ -89,8 +89,8 @@ InSliceInfo::InSliceInfo ( PixelType tifb, char* b, PixelType tifl, - size_t xpst, - size_t ypst, + ptrdiff_t xpst, + ptrdiff_t ypst, size_t spst, int xsm, int ysm, diff --git a/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp b/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp index 7d1d882d68..bdf7f78730 100644 --- a/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepTiledInputFile.cpp @@ -60,8 +60,8 @@ struct TInSliceInfo PixelType typeInFrameBuffer; PixelType typeInFile; char* pointerArrayBase; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; ptrdiff_t sampleStride; bool fill; bool skip; @@ -73,8 +73,8 @@ struct TInSliceInfo PixelType typeInFrameBuffer = HALF, char* base = NULL, PixelType typeInFile = HALF, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, ptrdiff_t sampleStride = 0, bool fill = false, bool skip = false, @@ -87,8 +87,8 @@ TInSliceInfo::TInSliceInfo ( PixelType tifb, char* b, PixelType tifl, - size_t xs, - size_t ys, + ptrdiff_t xs, + ptrdiff_t ys, ptrdiff_t spst, bool f, bool s, diff --git a/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp b/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp index fc23df2643..fb42a941ae 100644 --- a/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp +++ b/src/lib/OpenEXR/ImfDeepTiledOutputFile.cpp @@ -71,8 +71,8 @@ struct TOutSliceInfo PixelType type; const char* base; size_t sampleStride; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; bool zero; int xTileCoords; int yTileCoords; @@ -80,8 +80,8 @@ struct TOutSliceInfo TOutSliceInfo ( PixelType type = HALF, size_t sampleStride = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, bool zero = false, int xTileCoords = 0, int yTileCoords = 0); @@ -90,8 +90,8 @@ struct TOutSliceInfo TOutSliceInfo::TOutSliceInfo ( PixelType t, size_t spst, - size_t xStride, - size_t yStride, + ptrdiff_t xStride, + ptrdiff_t yStride, bool z, int xtc, int ytc) diff --git a/src/lib/OpenEXR/ImfFrameBuffer.cpp b/src/lib/OpenEXR/ImfFrameBuffer.cpp index 44686b32dc..c868a25427 100644 --- a/src/lib/OpenEXR/ImfFrameBuffer.cpp +++ b/src/lib/OpenEXR/ImfFrameBuffer.cpp @@ -22,8 +22,8 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER Slice::Slice ( PixelType t, char* b, - size_t xst, - size_t yst, + ptrdiff_t xst, + ptrdiff_t yst, int xsm, int ysm, double fv, @@ -49,8 +49,8 @@ Slice::Make ( const IMATH_NAMESPACE::V2i& origin, int64_t w, int64_t h, - size_t xStride, - size_t yStride, + ptrdiff_t xStride, + ptrdiff_t yStride, int xSampling, int ySampling, double fillValue, @@ -69,7 +69,7 @@ Slice::Make ( THROW (IEX_NAMESPACE::ArgExc, "Invalid pixel type."); } } - if (yStride == 0) yStride = static_cast (w / xSampling) * xStride; + if (yStride == 0) yStride = (w / xSampling) * xStride; // data window is an int, so force promote to higher type to avoid // overflow for off y (degenerate size checks should be in @@ -99,8 +99,8 @@ Slice::Make ( PixelType type, const void* ptr, const IMATH_NAMESPACE::Box2i& dataWindow, - size_t xStride, - size_t yStride, + ptrdiff_t xStride, + ptrdiff_t yStride, int xSampling, int ySampling, double fillValue, diff --git a/src/lib/OpenEXR/ImfFrameBuffer.h b/src/lib/OpenEXR/ImfFrameBuffer.h index 229ec4dfe6..fd0c74456a 100644 --- a/src/lib/OpenEXR/ImfFrameBuffer.h +++ b/src/lib/OpenEXR/ImfFrameBuffer.h @@ -62,9 +62,9 @@ struct IMF_EXPORT_TYPE Slice // //--------------------------------------------------------------------- - char* base; - size_t xStride; - size_t yStride; + char* base; + ptrdiff_t xStride; + ptrdiff_t yStride; //-------------------------------------------- // Subsampling: pixel (x, y) is present in the @@ -107,8 +107,8 @@ struct IMF_EXPORT_TYPE Slice Slice ( PixelType type = HALF, char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, int xSampling = 1, int ySampling = 1, double fillValue = 0.0, @@ -127,8 +127,8 @@ struct IMF_EXPORT_TYPE Slice const IMATH_NAMESPACE::V2i& origin, int64_t w, int64_t h, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, int xSampling = 1, int ySampling = 1, double fillValue = 0.0, @@ -141,8 +141,8 @@ struct IMF_EXPORT_TYPE Slice PixelType type, const void* ptr, const IMATH_NAMESPACE::Box2i& dataWindow, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, int xSampling = 1, int ySampling = 1, double fillValue = 0.0, diff --git a/src/lib/OpenEXR/ImfMisc.cpp b/src/lib/OpenEXR/ImfMisc.cpp index 09c820bc40..be755b0ae8 100644 --- a/src/lib/OpenEXR/ImfMisc.cpp +++ b/src/lib/OpenEXR/ImfMisc.cpp @@ -262,7 +262,7 @@ copyIntoFrameBuffer ( const char*& readPtr, char* writePtr, char* endPtr, - size_t xStride, + ptrdiff_t xStride, bool fill, double fillValue, Compressor::Format format, @@ -273,6 +273,7 @@ copyIntoFrameBuffer ( // Copy a horizontal row of pixels from an input // file's line or tile buffer to a frame buffer. // + endPtr += xStride; if (fill) { @@ -288,7 +289,7 @@ copyIntoFrameBuffer ( { unsigned int fillVal = (unsigned int) (fillValue); - while (writePtr <= endPtr) + while (writePtr != endPtr) { *(unsigned int*) writePtr = fillVal; writePtr += xStride; @@ -301,7 +302,7 @@ copyIntoFrameBuffer ( { half fillVal = half (fillValue); - while (writePtr <= endPtr) + while (writePtr != endPtr) { *(half*) writePtr = fillVal; writePtr += xStride; @@ -314,7 +315,7 @@ copyIntoFrameBuffer ( { float fillVal = float (fillValue); - while (writePtr <= endPtr) + while (writePtr != endPtr) { *(float*) writePtr = fillVal; writePtr += xStride; @@ -343,7 +344,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { Xdr::read ( readPtr, *(unsigned int*) writePtr); @@ -353,7 +354,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (writePtr <= endPtr) + while (writePtr != endPtr) { half h; Xdr::read (readPtr, h); @@ -364,7 +365,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { float f; Xdr::read (readPtr, f); @@ -385,7 +386,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { unsigned int ui; Xdr::read (readPtr, ui); @@ -396,7 +397,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (writePtr <= endPtr) + while (writePtr != endPtr) { Xdr::read (readPtr, *(half*) writePtr); writePtr += xStride; @@ -405,7 +406,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { float f; Xdr::read (readPtr, f); @@ -426,7 +427,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { unsigned int ui; Xdr::read (readPtr, ui); @@ -437,7 +438,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (writePtr <= endPtr) + while (writePtr != endPtr) { half h; Xdr::read (readPtr, h); @@ -448,7 +449,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { Xdr::read (readPtr, *(float*) writePtr); writePtr += xStride; @@ -479,7 +480,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { for (size_t i = 0; i < sizeof (unsigned int); ++i) writePtr[i] = readPtr[i]; @@ -491,7 +492,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (writePtr <= endPtr) + while (writePtr != endPtr) { half h = *(half*) readPtr; *(unsigned int*) writePtr = halfToUint (h); @@ -502,7 +503,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { float f; @@ -528,7 +529,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { unsigned int ui; @@ -546,14 +547,14 @@ copyIntoFrameBuffer ( // If we're tightly packed, just memcpy if (xStride == sizeof (half)) { - int numBytes = endPtr - writePtr + sizeof (half); + int numBytes = endPtr - writePtr; memcpy (writePtr, readPtr, numBytes); readPtr += numBytes; writePtr += numBytes; } else { - while (writePtr <= endPtr) + while (writePtr != endPtr) { *(half*) writePtr = *(half*) readPtr; readPtr += sizeof (half); @@ -564,7 +565,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { float f; @@ -589,7 +590,7 @@ copyIntoFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { unsigned int ui; @@ -604,7 +605,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (writePtr <= endPtr) + while (writePtr != endPtr) { half h = *(half*) readPtr; *(float*) writePtr = float (h); @@ -615,7 +616,7 @@ copyIntoFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (writePtr <= endPtr) + while (writePtr != endPtr) { for (size_t i = 0; i < sizeof (float); ++i) writePtr[i] = readPtr[i]; @@ -1525,12 +1526,13 @@ copyFromFrameBuffer ( char*& writePtr, const char*& readPtr, const char* endPtr, - size_t xStride, + ptrdiff_t xStride, Compressor::Format format, PixelType type) { char* localWritePtr = writePtr; const char* localReadPtr = readPtr; + endPtr += xStride; // // Copy a horizontal row of pixels from a frame // buffer to an output file's line or tile buffer. @@ -1546,7 +1548,7 @@ copyFromFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { Xdr::write ( localWritePtr, *(const unsigned int*) localReadPtr); @@ -1556,7 +1558,7 @@ copyFromFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { Xdr::write ( localWritePtr, *(const half*) localReadPtr); @@ -1566,7 +1568,7 @@ copyFromFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { Xdr::write ( localWritePtr, *(const float*) localReadPtr); @@ -1587,7 +1589,7 @@ copyFromFrameBuffer ( { case OPENEXR_IMF_INTERNAL_NAMESPACE::UINT: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { for (size_t i = 0; i < sizeof (unsigned int); ++i) *localWritePtr++ = localReadPtr[i]; @@ -1598,7 +1600,7 @@ copyFromFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::HALF: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { *(half*) localWritePtr = *(const half*) localReadPtr; localWritePtr += sizeof (half); @@ -1608,7 +1610,7 @@ copyFromFrameBuffer ( case OPENEXR_IMF_INTERNAL_NAMESPACE::FLOAT: - while (localReadPtr <= endPtr) + while (localReadPtr != endPtr) { for (size_t i = 0; i < sizeof (float); ++i) *localWritePtr++ = localReadPtr[i]; diff --git a/src/lib/OpenEXR/ImfMisc.h b/src/lib/OpenEXR/ImfMisc.h index 41e6944f62..95991fd5c7 100644 --- a/src/lib/OpenEXR/ImfMisc.h +++ b/src/lib/OpenEXR/ImfMisc.h @@ -173,7 +173,7 @@ int numLinesInBuffer (Compressor* compressor); // readPtr points just past the end of the // copied data. // -// writePtr, endPtr point to the lefmost and rightmost pixels +// writePtr, endPtr point to the first and last pixels // in the frame buffer slice // // xStride the xStride for the frame buffer slice @@ -191,7 +191,7 @@ void copyIntoFrameBuffer ( const char*& readPtr, char* writePtr, char* endPtr, - size_t xStride, + ptrdiff_t xStride, bool fill, double fillValue, Compressor::Format format, @@ -207,7 +207,7 @@ void copyIntoFrameBuffer ( // readPtr initially points to the beginning of the // data in the line or tile buffer. readPtr // is advanced as the pixel data are copied; -// when copyIntoFrameBuffer() returns, +// when copyIntoDeepFrameBuffer() returns, // readPtr points just past the end of the // copied data. // @@ -307,7 +307,7 @@ void convertInPlace ( // writePtr points just past the end of the // copied data. // -// readPtr, endPtr point to the lefmost and rightmost pixels +// readPtr, endPtr point to the first and last pixels // in the frame buffer slice // // xStride the xStride for the frame buffer slice @@ -326,7 +326,7 @@ void copyFromFrameBuffer ( char*& writePtr, const char*& readPtr, const char* endPtr, - size_t xStride, + ptrdiff_t xStride, Compressor::Format format, PixelType type); @@ -372,7 +372,7 @@ void copyFromFrameBuffer ( // // type the pixel data type in the frame buffer // and in the output file's channel (function -// copyFromFrameBuffer() doesn't do on-the-fly +// copyFromDeepFrameBuffer() doesn't do on-the-fly // data type conversion) // diff --git a/src/lib/OpenEXR/ImfOutputFile.cpp b/src/lib/OpenEXR/ImfOutputFile.cpp index 385473b268..18a1311a8b 100644 --- a/src/lib/OpenEXR/ImfOutputFile.cpp +++ b/src/lib/OpenEXR/ImfOutputFile.cpp @@ -59,8 +59,8 @@ struct OutSliceInfo { PixelType type; const char* base; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; int xSampling; int ySampling; bool zero; @@ -68,15 +68,15 @@ struct OutSliceInfo OutSliceInfo ( PixelType type = HALF, const char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, int xSampling = 1, int ySampling = 1, bool zero = false); }; OutSliceInfo::OutSliceInfo ( - PixelType t, const char* b, size_t xs, size_t ys, int xsm, int ysm, bool z) + PixelType t, const char* b, ptrdiff_t xs, ptrdiff_t ys, int xsm, int ysm, bool z) : type (t) , base (b) , xStride (xs) diff --git a/src/lib/OpenEXR/ImfRgbaFile.cpp b/src/lib/OpenEXR/ImfRgbaFile.cpp index 195a7f8ca4..89cd5eeb3b 100644 --- a/src/lib/OpenEXR/ImfRgbaFile.cpp +++ b/src/lib/OpenEXR/ImfRgbaFile.cpp @@ -153,7 +153,7 @@ class RgbaOutputFile::ToYca : public std::mutex void setYCRounding (unsigned int roundY, unsigned int roundC); - void setFrameBuffer (const Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); void writePixels (int numScanLines); int currentScanLine () const; @@ -180,8 +180,8 @@ class RgbaOutputFile::ToYca : public std::mutex Rgba* _buf[N]; Rgba* _tmpBuf; const Rgba* _fbBase; - size_t _fbXStride; - size_t _fbYStride; + ptrdiff_t _fbXStride; + ptrdiff_t _fbYStride; int _roundY; int _roundC; }; @@ -241,7 +241,7 @@ RgbaOutputFile::ToYca::setYCRounding (unsigned int roundY, unsigned int roundC) void RgbaOutputFile::ToYca::setFrameBuffer ( - const Rgba* base, size_t xStride, size_t yStride) + const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { if (_fbBase == 0) { @@ -603,7 +603,7 @@ RgbaOutputFile::~RgbaOutputFile () void RgbaOutputFile::setFrameBuffer ( - const Rgba* base, size_t xStride, size_t yStride) + const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { if (_toYca) { @@ -612,8 +612,8 @@ RgbaOutputFile::setFrameBuffer ( } else { - size_t xs = xStride * sizeof (Rgba); - size_t ys = yStride * sizeof (Rgba); + ptrdiff_t xs = xStride * sizeof (Rgba); + ptrdiff_t ys = yStride * sizeof (Rgba); FrameBuffer fb; @@ -749,8 +749,8 @@ class RgbaInputFile::FromYca : public std::mutex void setFrameBuffer ( Rgba* base, - size_t xStride, - size_t yStride, + ptrdiff_t xStride, + ptrdiff_t yStride, const string& channelNamePrefix); void readPixels (int scanLine1, int scanLine2); @@ -777,8 +777,8 @@ class RgbaInputFile::FromYca : public std::mutex Rgba* _buf2[3]; Rgba* _tmpBuf; Rgba* _fbBase; - size_t _fbXStride; - size_t _fbYStride; + ptrdiff_t _fbXStride; + ptrdiff_t _fbYStride; }; RgbaInputFile::FromYca::FromYca ( @@ -823,7 +823,7 @@ RgbaInputFile::FromYca::~FromYca () void RgbaInputFile::FromYca::setFrameBuffer ( - Rgba* base, size_t xStride, size_t yStride, const string& channelNamePrefix) + Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride, const string& channelNamePrefix) { if (_fbBase == 0) { @@ -1219,7 +1219,7 @@ RgbaInputFile::~RgbaInputFile () } void -RgbaInputFile::setFrameBuffer (Rgba* base, size_t xStride, size_t yStride) +RgbaInputFile::setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { if (_fromYca) { @@ -1228,8 +1228,8 @@ RgbaInputFile::setFrameBuffer (Rgba* base, size_t xStride, size_t yStride) } else { - size_t xs = xStride * sizeof (Rgba); - size_t ys = yStride * sizeof (Rgba); + ptrdiff_t xs = xStride * sizeof (Rgba); + ptrdiff_t ys = yStride * sizeof (Rgba); FrameBuffer fb; diff --git a/src/lib/OpenEXR/ImfRgbaFile.h b/src/lib/OpenEXR/ImfRgbaFile.h index afce96f136..d1bb7ae3bb 100644 --- a/src/lib/OpenEXR/ImfRgbaFile.h +++ b/src/lib/OpenEXR/ImfRgbaFile.h @@ -43,8 +43,8 @@ ComputeBasePointer ( const Rgba* ptr, const IMATH_NAMESPACE::V2i& origin, int64_t w, - size_t xStride = 1, - size_t yStride = 0) + ptrdiff_t xStride = 1, + ptrdiff_t yStride = 0) { if (yStride == 0) yStride = w; int64_t offx = static_cast (origin.x); @@ -69,8 +69,8 @@ ComputeBasePointer ( Rgba* ptr, const IMATH_NAMESPACE::V2i& origin, int64_t w, - size_t xStride = 1, - size_t yStride = 0) + ptrdiff_t xStride = 1, + ptrdiff_t yStride = 0) { if (yStride == 0) yStride = w; int64_t offx = static_cast (origin.x); @@ -176,7 +176,7 @@ class IMF_EXPORT_TYPE RgbaOutputFile //------------------------------------------------ IMF_EXPORT - void setFrameBuffer (const Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //--------------------------------------------- // Write pixel data (see class Imf::OutputFile) @@ -353,7 +353,7 @@ class IMF_EXPORT_TYPE RgbaInputFile //----------------------------------------------------- IMF_EXPORT - void setFrameBuffer (Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //---------------------------------------------------------------- // Switch to a different layer within the current part diff --git a/src/lib/OpenEXR/ImfScanLineInputFile.cpp b/src/lib/OpenEXR/ImfScanLineInputFile.cpp index adaaa9f86f..d1a060604b 100644 --- a/src/lib/OpenEXR/ImfScanLineInputFile.cpp +++ b/src/lib/OpenEXR/ImfScanLineInputFile.cpp @@ -58,8 +58,8 @@ struct InSliceInfo PixelType typeInFrameBuffer; PixelType typeInFile; char* base; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; int xSampling; int ySampling; bool fill; @@ -70,8 +70,8 @@ struct InSliceInfo PixelType typeInFrameBuffer = HALF, PixelType typeInFile = HALF, char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, int xSampling = 1, int ySampling = 1, bool fill = false, @@ -83,8 +83,8 @@ InSliceInfo::InSliceInfo ( PixelType tifb, PixelType tifl, char* b, - size_t xs, - size_t ys, + ptrdiff_t xs, + ptrdiff_t ys, int xsm, int ysm, bool f, diff --git a/src/lib/OpenEXR/ImfTiledInputFile.cpp b/src/lib/OpenEXR/ImfTiledInputFile.cpp index 58508beb7e..8d32432338 100644 --- a/src/lib/OpenEXR/ImfTiledInputFile.cpp +++ b/src/lib/OpenEXR/ImfTiledInputFile.cpp @@ -59,8 +59,8 @@ struct TInSliceInfo PixelType typeInFrameBuffer; PixelType typeInFile; char* base; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; bool fill; bool skip; double fillValue; @@ -71,8 +71,8 @@ struct TInSliceInfo PixelType typeInFrameBuffer = HALF, PixelType typeInFile = HALF, char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, bool fill = false, bool skip = false, double fillValue = 0.0, @@ -84,8 +84,8 @@ TInSliceInfo::TInSliceInfo ( PixelType tifb, PixelType tifl, char* b, - size_t xs, - size_t ys, + ptrdiff_t xs, + ptrdiff_t ys, bool f, bool s, double fv, diff --git a/src/lib/OpenEXR/ImfTiledOutputFile.cpp b/src/lib/OpenEXR/ImfTiledOutputFile.cpp index 82849d0d8d..55cbcb5a79 100644 --- a/src/lib/OpenEXR/ImfTiledOutputFile.cpp +++ b/src/lib/OpenEXR/ImfTiledOutputFile.cpp @@ -70,8 +70,8 @@ struct TOutSliceInfo { PixelType type; const char* base; - size_t xStride; - size_t yStride; + ptrdiff_t xStride; + ptrdiff_t yStride; bool zero; int xTileCoords; int yTileCoords; @@ -79,15 +79,15 @@ struct TOutSliceInfo TOutSliceInfo ( PixelType type = HALF, const char* base = 0, - size_t xStride = 0, - size_t yStride = 0, + ptrdiff_t xStride = 0, + ptrdiff_t yStride = 0, bool zero = false, int xTileCoords = 0, int yTileCoords = 0); }; TOutSliceInfo::TOutSliceInfo ( - PixelType t, const char* b, size_t xs, size_t ys, bool z, int xtc, int ytc) + PixelType t, const char* b, ptrdiff_t xs, ptrdiff_t ys, bool z, int xtc, int ytc) : type (t) , base (b) , xStride (xs) diff --git a/src/lib/OpenEXR/ImfTiledRgbaFile.cpp b/src/lib/OpenEXR/ImfTiledRgbaFile.cpp index 1299b3fc03..a494d8b039 100644 --- a/src/lib/OpenEXR/ImfTiledRgbaFile.cpp +++ b/src/lib/OpenEXR/ImfTiledRgbaFile.cpp @@ -119,7 +119,7 @@ class TiledRgbaOutputFile::ToYa public: ToYa (TiledOutputFile& outputFile, RgbaChannels rgbaChannels); - void setFrameBuffer (const Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); void writeTile (int dx, int dy, int lx, int ly); @@ -131,8 +131,8 @@ class TiledRgbaOutputFile::ToYa V3f _yw; Array2D _buf; const Rgba* _fbBase; - size_t _fbXStride; - size_t _fbYStride; + ptrdiff_t _fbXStride; + ptrdiff_t _fbYStride; }; TiledRgbaOutputFile::ToYa::ToYa ( @@ -154,7 +154,7 @@ TiledRgbaOutputFile::ToYa::ToYa ( void TiledRgbaOutputFile::ToYa::setFrameBuffer ( - const Rgba* base, size_t xStride, size_t yStride) + const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { _fbBase = base; _fbXStride = xStride; @@ -332,7 +332,7 @@ TiledRgbaOutputFile::~TiledRgbaOutputFile () void TiledRgbaOutputFile::setFrameBuffer ( - const Rgba* base, size_t xStride, size_t yStride) + const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { if (_toYa) { @@ -343,8 +343,8 @@ TiledRgbaOutputFile::setFrameBuffer ( } else { - size_t xs = xStride * sizeof (Rgba); - size_t ys = yStride * sizeof (Rgba); + ptrdiff_t xs = xStride * sizeof (Rgba); + ptrdiff_t ys = yStride * sizeof (Rgba); FrameBuffer fb; @@ -581,8 +581,8 @@ class TiledRgbaInputFile::FromYa void setFrameBuffer ( Rgba* base, - size_t xStride, - size_t yStride, + ptrdiff_t xStride, + ptrdiff_t yStride, const string& channelNamePrefix); void readTile (int dx, int dy, int lx, int ly); @@ -594,8 +594,8 @@ class TiledRgbaInputFile::FromYa V3f _yw; Array2D _buf; Rgba* _fbBase; - size_t _fbXStride; - size_t _fbYStride; + ptrdiff_t _fbXStride; + ptrdiff_t _fbYStride; }; TiledRgbaInputFile::FromYa::FromYa (TiledInputFile& inputFile) @@ -614,7 +614,7 @@ TiledRgbaInputFile::FromYa::FromYa (TiledInputFile& inputFile) void TiledRgbaInputFile::FromYa::setFrameBuffer ( - Rgba* base, size_t xStride, size_t yStride, const string& channelNamePrefix) + Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride, const string& channelNamePrefix) { if (_fbBase == 0) { @@ -747,7 +747,7 @@ TiledRgbaInputFile::~TiledRgbaInputFile () } void -TiledRgbaInputFile::setFrameBuffer (Rgba* base, size_t xStride, size_t yStride) +TiledRgbaInputFile::setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride) { if (_fromYa) { @@ -758,8 +758,8 @@ TiledRgbaInputFile::setFrameBuffer (Rgba* base, size_t xStride, size_t yStride) } else { - size_t xs = xStride * sizeof (Rgba); - size_t ys = yStride * sizeof (Rgba); + ptrdiff_t xs = xStride * sizeof (Rgba); + ptrdiff_t ys = yStride * sizeof (Rgba); FrameBuffer fb; diff --git a/src/lib/OpenEXR/ImfTiledRgbaFile.h b/src/lib/OpenEXR/ImfTiledRgbaFile.h index 048741a9f8..bde2bb362d 100644 --- a/src/lib/OpenEXR/ImfTiledRgbaFile.h +++ b/src/lib/OpenEXR/ImfTiledRgbaFile.h @@ -137,7 +137,7 @@ class IMF_EXPORT_TYPE TiledRgbaOutputFile //------------------------------------------------ IMF_EXPORT - void setFrameBuffer (const Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (const Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //-------------------------- // Access to the file header @@ -352,7 +352,7 @@ class IMF_EXPORT_TYPE TiledRgbaInputFile //----------------------------------------------------- IMF_EXPORT - void setFrameBuffer (Rgba* base, size_t xStride, size_t yStride); + void setFrameBuffer (Rgba* base, ptrdiff_t xStride, ptrdiff_t yStride); //------------------------------------------------------------------- // Switch to a different layer -- subsequent calls to readTile() diff --git a/src/test/OpenEXRTest/CMakeLists.txt b/src/test/OpenEXRTest/CMakeLists.txt index 52b1eee2fb..865cdb2405 100644 --- a/src/test/OpenEXRTest/CMakeLists.txt +++ b/src/test/OpenEXRTest/CMakeLists.txt @@ -46,6 +46,7 @@ add_executable(OpenEXRTest testMultiTiledPartThreading.cpp testMultiView.cpp testNativeFormat.cpp + testNegativeStride.cpp testOptimized.cpp testOptimizedInterleavePatterns.cpp testPartHelper.cpp @@ -119,6 +120,7 @@ define_openexr_tests( testMultiTiledPartThreading testMultiView testNativeFormat + testNegativeStride testOptimized testOptimizedInterleavePatterns testPartHelper diff --git a/src/test/OpenEXRTest/main.cpp b/src/test/OpenEXRTest/main.cpp index a19b85b5e4..58d6328f0c 100644 --- a/src/test/OpenEXRTest/main.cpp +++ b/src/test/OpenEXRTest/main.cpp @@ -48,6 +48,7 @@ #include "testMultiTiledPartThreading.h" #include "testMultiView.h" #include "testNativeFormat.h" +#include "testNegativeStride.h" #include "testOptimized.h" #include "testOptimizedInterleavePatterns.h" #include "testPartHelper.h" @@ -206,6 +207,7 @@ main (int argc, char* argv[]) TEST (testYca, "basic"); TEST (testTiledYa, "basic"); TEST (testNativeFormat, "basic"); + TEST (testNegativeStride, "basic"); TEST (testMultiView, "basic"); TEST (testIsComplete, "basic"); TEST (testDeepScanLineBasic, "deep"); diff --git a/src/test/OpenEXRTest/testNegativeStride.cpp b/src/test/OpenEXRTest/testNegativeStride.cpp new file mode 100644 index 0000000000..8a55d207b9 --- /dev/null +++ b/src/test/OpenEXRTest/testNegativeStride.cpp @@ -0,0 +1,159 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) Contributors to the OpenEXR Project. +// + +#ifdef NDEBUG +# undef NDEBUG +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace OPENEXR_IMF_NAMESPACE; +using namespace std; + +namespace { + +enum FLIP_FLAGS +{ + FLIP_NONE = 0, + FLIP_X = 1, + FLIP_Y = 2 +}; + +void +fillPixels (Array2D& ph, int width, int height) +{ + for (int y = 0; y < height; ++y) + for (int x = 0; x < width; ++x) + ph[y][x] = y * 1000 + x; +} + +Slice filppedSlice (const Array2D& ph, FLIP_FLAGS flip) +{ + cout << "flipX " << ((flip & FLIP_X) != 0) + << ", flipY " << ((flip & FLIP_Y) != 0) + << flush; + + char *base = (char *) &ph[0][0]; + ptrdiff_t strideX = sizeof (ph[0][0]); + ptrdiff_t strideY = sizeof (ph[0][0]) * ph.width (); + if (flip & FLIP_X) + { + base += strideX * (ph.width () - 1); + strideX = -strideX; + } + if (flip & FLIP_Y) + { + base += strideY * (ph.height () - 1); + strideY = -strideY; + } + return Slice (FLOAT, base, strideX, strideY); +} + +void +writeRead ( + const Array2D& ph, + const char fileName[], + FLIP_FLAGS writeFlip, + FLIP_FLAGS readFlip) +{ + int width = ph.width (); + int height = ph.height (); + { + Header hdr (width, height); + hdr.channels ().insert ("F", Channel (FLOAT)); + + FrameBuffer fb; + fb.insert ("F", filppedSlice (ph, writeFlip)); + + cout << " writing" << flush; + + remove (fileName); + OutputFile out (fileName, hdr); + out.setFrameBuffer (fb); + out.writePixels (height); + } + { + cout << " "; + FrameBuffer fb; + Array2D ph2 (height, width); + for (int y = 0; y < height; ++y) + for (int x = 0; x < width; ++x) + ph2[y][x] = -1.0f; + fb.insert ("F", filppedSlice (ph2, readFlip)); + + cout << " reading" << flush; + + InputFile in (fileName); + in.setFrameBuffer (fb); + in.readPixels (0, height - 1); + + cout << " comparing" << flush; + + FLIP_FLAGS flip = (FLIP_FLAGS) (writeFlip ^ readFlip); + + for (int y = 0; y < height; ++y) + { + for (int x = 0; x < width; ++x) + { + int x2 = x; + int y2 = y; + + if (flip & FLIP_X) + x2 = width - 1 - x; + + if (flip & FLIP_Y) + y2 = height - 1 - y; + + assert (ph[y][x] == ph2[y2][x2]); + } + } + } +} + +} // namespace + +void +testNegativeStride (const string& tempDir) +{ + try + { + cout << "Testing negative slice stride" << endl; + + const int W = 117; + const int H = 97; + + Array2D ph (H, W); + fillPixels (ph, W, H); + + string fileName = tempDir + "imf_test_negative_stride.exr"; + for (int readFlip = 0; readFlip < 4; ++readFlip) + for (int writeFlip = 0; writeFlip < 4; ++writeFlip) + { + writeRead (ph, fileName.c_str (), + (FLIP_FLAGS) writeFlip, (FLIP_FLAGS) readFlip); + cout << endl; + } + + cout << "ok\n" << endl; + } + catch (const std::exception& e) + { + cerr << "ERROR -- caught exception: " << e.what () << endl; + assert (false); + } +} diff --git a/src/test/OpenEXRTest/testNegativeStride.h b/src/test/OpenEXRTest/testNegativeStride.h new file mode 100644 index 0000000000..57f93dff84 --- /dev/null +++ b/src/test/OpenEXRTest/testNegativeStride.h @@ -0,0 +1,8 @@ +// +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) Contributors to the OpenEXR Project. +// + +#include + +void testNegativeStride (const std::string& tempDir);