Skip to content

Commit

Permalink
changes to enable custom namespace defines to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
kdt3rd authored and nickrasmussen committed Aug 8, 2018
1 parent a56773b commit acd76e1
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 50 deletions.
52 changes: 26 additions & 26 deletions OpenEXR/IlmImf/ImfFastHuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ FastHufDecoder::FastHufDecoder
{
if (currByte - table > numBytes)
{
throw Iex::InputExc ("Error decoding Huffman table "
"(Truncated table data).");
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
"(Truncated table data).");
}

//
Expand All @@ -146,17 +146,17 @@ FastHufDecoder::FastHufDecoder
{
if (currByte - table > numBytes)
{
throw Iex::InputExc ("Error decoding Huffman table "
"(Truncated table data).");
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
"(Truncated table data).");
}

int runLen = readBits (8, currBits, currBitCount, currByte) +
SHORTEST_LONG_RUN;

if (symbol + runLen > maxSymbol + 1)
{
throw Iex::InputExc ("Error decoding Huffman table "
"(Run beyond end of table).");
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
"(Run beyond end of table).");
}

symbol += runLen - 1;
Expand All @@ -168,8 +168,8 @@ FastHufDecoder::FastHufDecoder

if (symbol + runLen > maxSymbol + 1)
{
throw Iex::InputExc ("Error decoding Huffman table "
"(Run beyond end of table).");
throw IEX_NAMESPACE::InputExc ("Error decoding Huffman table "
"(Run beyond end of table).");
}

symbol += runLen - 1;
Expand Down Expand Up @@ -256,8 +256,8 @@ FastHufDecoder::FastHufDecoder
int symbol = *i >> 6;

if (mapping[codeLen] >= _numSymbols)
throw Iex::InputExc ("Huffman decode error "
"(Invalid symbol in header).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
"(Invalid symbol in header).");

_idToSymbol[mapping[codeLen]] = symbol;
mapping[codeLen]++;
Expand Down Expand Up @@ -401,8 +401,8 @@ FastHufDecoder::buildTables (Int64 *base, Int64 *offset)
}
else
{
throw Iex::InputExc ("Huffman decode error "
"(Overrun).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
"(Overrun).");
}
break;
}
Expand Down Expand Up @@ -578,8 +578,8 @@ FastHufDecoder::decode
int numDstElems)
{
if (numSrcBits < 128)
throw Iex::InputExc ("Error choosing Huffman decoder implementation "
"(insufficient number of bits).");
throw IEX_NAMESPACE::InputExc ("Error choosing Huffman decoder implementation "
"(insufficient number of bits).");

//
// Current position (byte/bit) in the src data stream
Expand Down Expand Up @@ -662,8 +662,8 @@ FastHufDecoder::decode

if (codeLen > _maxCodeLength)
{
throw Iex::InputExc ("Huffman decode error "
"(Decoded an invalid symbol).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
"(Decoded an invalid symbol).");
}

Int64 id = _ljOffset[codeLen] + (buffer >> (64 - codeLen));
Expand All @@ -673,8 +673,8 @@ FastHufDecoder::decode
}
else
{
throw Iex::InputExc ("Huffman decode error "
"(Decoded an invalid symbol).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error "
"(Decoded an invalid symbol).");
}
}

Expand Down Expand Up @@ -710,20 +710,20 @@ FastHufDecoder::decode

if (dstIdx < 1)
{
throw Iex::InputExc ("Huffman decode error (RLE code "
"with no previous symbol).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error (RLE code "
"with no previous symbol).");
}

if (dstIdx + rleCount > numDstElems)
{
throw Iex::InputExc ("Huffman decode error (Symbol run "
"beyond expected output buffer length).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error (Symbol run "
"beyond expected output buffer length).");
}

if (rleCount <= 0)
{
throw Iex::InputExc("Huffman decode error"
" (Invalid RLE length)");
throw IEX_NAMESPACE::InputExc("Huffman decode error"
" (Invalid RLE length)");
}

for (int i = 0; i < rleCount; ++i)
Expand Down Expand Up @@ -760,8 +760,8 @@ FastHufDecoder::decode

if (numSrcBits != 0)
{
throw Iex::InputExc ("Huffman decode error (Compressed data remains "
"after filling expected output buffer).");
throw IEX_NAMESPACE::InputExc ("Huffman decode error (Compressed data remains "
"after filling expected output buffer).");
}
}

Expand Down
20 changes: 10 additions & 10 deletions OpenEXR/IlmImf/ImfZip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,42 @@

OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER

Imf::Zip::Zip(size_t maxRawSize):
Zip::Zip(size_t maxRawSize):
_maxRawSize(maxRawSize),
_tmpBuffer(0)
{
_tmpBuffer = new char[_maxRawSize];
}

Imf::Zip::Zip(size_t maxScanLineSize, size_t numScanLines):
Zip::Zip(size_t maxScanLineSize, size_t numScanLines):
_maxRawSize(0),
_tmpBuffer(0)
{
_maxRawSize = uiMult (maxScanLineSize, numScanLines);
_tmpBuffer = new char[_maxRawSize];
}

Imf::Zip::~Zip()
Zip::~Zip()
{
if (_tmpBuffer) delete[] _tmpBuffer;
}

size_t
Imf::Zip::maxRawSize()
Zip::maxRawSize()
{
return _maxRawSize;
}

size_t
Imf::Zip::maxCompressedSize()
Zip::maxCompressedSize()
{
return uiAdd (uiAdd (_maxRawSize,
size_t (ceil (_maxRawSize * 0.01))),
size_t (100));
}

int
Imf::Zip::compress(const char *raw, int rawSize, char *compressed)
Zip::compress(const char *raw, int rawSize, char *compressed)
{
//
// Reorder the pixel data.
Expand Down Expand Up @@ -130,7 +130,7 @@ Imf::Zip::compress(const char *raw, int rawSize, char *compressed)
if (Z_OK != ::compress ((Bytef *)compressed, &outSize,
(const Bytef *) _tmpBuffer, rawSize))
{
throw Iex::BaseExc ("Data compression (zlib) failed.");
throw IEX_NAMESPACE::BaseExc ("Data compression (zlib) failed.");
}

return outSize;
Expand Down Expand Up @@ -261,8 +261,8 @@ interleave_scalar(const char *source, size_t outSize, char *out)
#endif

int
Imf::Zip::uncompress(const char *compressed, int compressedSize,
char *raw)
Zip::uncompress(const char *compressed, int compressedSize,
char *raw)
{
//
// Decompress the data using zlib
Expand All @@ -273,7 +273,7 @@ Imf::Zip::uncompress(const char *compressed, int compressedSize,
if (Z_OK != ::uncompress ((Bytef *)_tmpBuffer, &outSize,
(const Bytef *) compressed, compressedSize))
{
throw Iex::InputExc ("Data decompression (zlib) failed.");
throw IEX_NAMESPACE::InputExc ("Data decompression (zlib) failed.");
}

if (outSize == 0)
Expand Down
10 changes: 5 additions & 5 deletions OpenEXR/IlmImf/dwaLookups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ namespace {
class LutHeaderWorker
{
public:
class Runner : public IlmThread::Thread
class Runner : public ILMTHREAD_NAMESPACE::Thread
{
public:
Runner(LutHeaderWorker &worker, bool output):
IlmThread::Thread(),
ILMTHREAD_NAMESPACE::Thread(),
_worker(worker),
_output(output)
{
Expand All @@ -87,7 +87,7 @@ namespace {
private:
LutHeaderWorker &_worker;
bool _output;
IlmThread::Semaphore _semaphore;
ILMTHREAD_NAMESPACE::Semaphore _semaphore;

}; // class LutHeaderWorker::Runner

Expand Down Expand Up @@ -436,7 +436,7 @@ generateToNonlinear()
int
cpuCount()
{
if (!IlmThread::supportsThreads()) return 1;
if (!ILMTHREAD_NAMESPACE::supportsThreads()) return 1;

int cpuCount = 1;

Expand Down Expand Up @@ -492,7 +492,7 @@ generateLutHeader()
}
}

if (IlmThread::supportsThreads()) {
if (ILMTHREAD_NAMESPACE::supportsThreads()) {
std::vector<LutHeaderWorker::Runner*> runners;
for (size_t i=0; i<workers.size(); ++i) {
runners.push_back( new LutHeaderWorker::Runner(*workers[i], (i==0)) );
Expand Down
4 changes: 2 additions & 2 deletions OpenEXR/IlmImfTest/compareDwa.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

void compareDwa(int width,
int height,
const OPENEXR_IMF_NAMESPACE::Array2D<Imf::Rgba> &src,
const OPENEXR_IMF_NAMESPACE::Array2D<Imf::Rgba> &test,
const OPENEXR_IMF_NAMESPACE::Array2D<OPENEXR_IMF_NAMESPACE::Rgba> &src,
const OPENEXR_IMF_NAMESPACE::Array2D<OPENEXR_IMF_NAMESPACE::Rgba> &test,
OPENEXR_IMF_NAMESPACE::RgbaChannels channels);

#endif
2 changes: 2 additions & 0 deletions OpenEXR/IlmImfUtil/ImfDeepImageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
//----------------------------------------------------------------------------

#include "ImfImageChannel.h"
#include "ImfSampleCountChannel.h"
#include "ImfImageLevel.h"
#include "ImfUtilExport.h"

#include "ImfDeepFrameBuffer.h"
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImfUtil/ImfDeepImageLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ DeepImageLevel::initializeSampleLists ()


void
DeepImageLevel::resize (const Imath::Box2i& dataWindow)
DeepImageLevel::resize (const Box2i& dataWindow)
{
//
// Note: if the following code throws an exception, then the image level
Expand Down
1 change: 1 addition & 0 deletions OpenEXR/IlmImfUtil/ImfFlatImageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include "ImfImageChannel.h"
#include "ImfUtilExport.h"
#include "ImfImageLevel.h"

#include <ImfPixelType.h>
#include <ImfFrameBuffer.h>
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImfUtil/ImfFlatImageLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ FlatImageLevel::~FlatImageLevel ()


void
FlatImageLevel::resize (const Imath::Box2i& dataWindow)
FlatImageLevel::resize (const Box2i& dataWindow)
{
//
// Note: if the following code throws an exception, then the image level
Expand Down
4 changes: 2 additions & 2 deletions OpenEXR/IlmImfUtil/ImfFlatImageLevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
//
//----------------------------------------------------------------------------

#include <ImfFlatImageChannel.h>
#include <ImfImageLevel.h>
#include "ImfFlatImageChannel.h"
#include "ImfImageLevel.h"
#include <ImathBox.h>
#include <string>
#include <map>
Expand Down
4 changes: 2 additions & 2 deletions OpenEXR/IlmImfUtil/ImfImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ Image::levelHeight (int ly) const


void
Image::resize (const Imath::Box2i &dataWindow)
Image::resize (const Box2i &dataWindow)
{
resize (dataWindow, _levelMode, _levelRoundingMode);
}


void
Image::resize
(const Imath::Box2i &dataWindow,
(const Box2i &dataWindow,
LevelMode levelMode,
LevelRoundingMode levelRoundingMode)
{
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImfUtil/ImfImageLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ImageLevel::~ImageLevel ()


void
ImageLevel::resize (const Imath::Box2i& dataWindow)
ImageLevel::resize (const Box2i& dataWindow)
{
if (dataWindow.max.x < dataWindow.min.x - 1||
dataWindow.max.y < dataWindow.min.y - 1)
Expand Down

0 comments on commit acd76e1

Please sign in to comment.