Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pstanczyk committed Jul 12, 2013
2 parents 5e17845 + dcb7916 commit 34f5447
Show file tree
Hide file tree
Showing 36 changed files with 1,179 additions and 46 deletions.
4 changes: 4 additions & 0 deletions IlmBase/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 2.0.1
* Bumped version to track OpenEXR
(Piotr Stanczyk)

Version 2.0.0
* Bumped version to track OpenEXR
(Piotr Stanczyk)
Expand Down
6 changes: 3 additions & 3 deletions IlmBase/configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(IlmBase, 2.0.0)
AC_INIT(IlmBase, 2.0.1)

AC_SUBST(ILMBASE_VERSION_MAJOR, 2)
AC_SUBST(ILMBASE_VERSION_MINOR, 0)
AC_SUBST(ILMBASE_VERSION_PATCH, 0)
AC_SUBST(ILMBASE_VERSION_PATCH, 1)

AC_SUBST(ILMBASE_VERSION, ${ILMBASE_VERSION_MAJOR}.${ILMBASE_VERSION_MINOR}.${ILMBASE_VERSION_PATCH})
AC_SUBST(ILMBASE_VERSION_API, ${ILMBASE_VERSION_MAJOR}_${ILMBASE_VERSION_MINOR})
Expand All @@ -16,7 +16,7 @@ AM_MAINTAINER_MODE


LIBTOOL_CURRENT=10
LIBTOOL_REVISION=0
LIBTOOL_REVISION=1
LIBTOOL_AGE=0
LIBTOOL_VERSION=$LIBTOOL_CURRENT:$LIBTOOL_REVISION:$LIBTOOL_AGE
AC_SUBST(LIBTOOL_VERSION)
Expand Down
12 changes: 12 additions & 0 deletions OpenEXR/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Version 2.0.1
* Temporarily turning off optimisation code path
(Piotr Stanczyk)
* Added additional tests for future optimisation refactoring
(Piotr Stanczyk / Peter Hillman)
* Fixes for StringVectors
(Peter Hillman)
* Additional checks for type mismatches
(Peter Hillman)
* Fix for Composite Deep Scanline
(Brendan Bolles)

Version 2.0.0
* Updated Documentation
(Peter Hillman)
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfCompositeDeepScanLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ CompositeDeepScanLine::readPixels(int start, int end)

for(size_t pixel=0;pixel<total_pixels;pixel++)
{
for(size_t part=0;part<parts;part++)
for(size_t part=0 ; part<parts && offset<overall_sample_count ; part++ )
{
pointers[part][channel][pixel]=&samples[channel][offset];
offset+=counts[part][pixel];
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ DeepScanLineOutputFile::DeepScanLineOutputFile
_data->_streamData->currentPosition = _data->_streamData->os->tellp();

// Write header and empty offset table to the file.
writeMagicNumberAndVersionField(*_data->_streamData->os, header);
writeMagicNumberAndVersionField(*_data->_streamData->os, _data->header);
_data->previewPosition =
_data->header.writeTo (*_data->_streamData->os);
_data->lineOffsetsPosition =
Expand Down
5 changes: 1 addition & 4 deletions OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ DeepTiledOutputFile::DeepTiledOutputFile
_data->_streamData->currentPosition = _data->_streamData->os->tellp();

// Write header and empty offset table to the file.
writeMagicNumberAndVersionField(*_data->_streamData->os, header);
writeMagicNumberAndVersionField(*_data->_streamData->os, _data->header);
_data->previewPosition = _data->header.writeTo (*_data->_streamData->os, true);
_data->tileOffsetsPosition = _data->tileOffsets.writeTo (*_data->_streamData->os);
_data->multipart = false;
Expand Down Expand Up @@ -1171,9 +1171,6 @@ void
DeepTiledOutputFile::initialize (const Header &header)
{
_data->header = header;
if (_data->header.hasType() && _data->header.type() != DEEPTILE)
throw IEX_NAMESPACE::ArgExc("The type data in the header for DeepTiledOutputFile "
"can only be " + DEEPTILE + ".");
_data->header.setType(DEEPTILE);
_data->lineOrder = _data->header.lineOrder();

Expand Down
19 changes: 18 additions & 1 deletion OpenEXR/IlmImf/ImfInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,15 @@ InputFile::InputFile (const char fileName[], int numThreads):
_data->_streamData = new InputStreamMutex();
_data->_streamData->is = is;
_data->header.readFrom (*_data->_streamData->is, _data->version);

// fix type attribute in single part regular image types
// (may be wrong if an old version of OpenEXR converts
// a tiled image to scanline or vice versa)
if(!isNonImage(_data->version) && !isMultiPart(_data->version) && _data->header.hasType())
{
_data->header.setType(isTiled(_data->version) ? TILEDIMAGE : SCANLINEIMAGE);
}

_data->header.sanityCheck (isTiled (_data->version));

initialize();
Expand Down Expand Up @@ -423,6 +432,15 @@ InputFile::InputFile (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int numThread
_data->_streamData = new InputStreamMutex();
_data->_streamData->is = &is;
_data->header.readFrom (*_data->_streamData->is, _data->version);

// fix type attribute in single part regular image types
// (may be wrong if an old version of OpenEXR converts
// a tiled image to scanline or vice versa)
if(!isNonImage(_data->version) && !isMultiPart(_data->version) && _data->header.hasType())
{
_data->header.setType(isTiled(_data->version) ? TILEDIMAGE : SCANLINEIMAGE);
}

_data->header.sanityCheck (isTiled (_data->version));

initialize();
Expand Down Expand Up @@ -492,7 +510,6 @@ InputFile::initialize ()
{
if (!_data->part)
{

if(_data->header.hasType() && _data->header.type()==DEEPSCANLINE)
{
_data->isTiled=false;
Expand Down
15 changes: 15 additions & 0 deletions OpenEXR/IlmImf/ImfMultiPartInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,21 @@ MultiPartInputFile::initialize()

_data->_headers[i].setType(tiled ? TILEDIMAGE : SCANLINEIMAGE);
}
else{

//
// Silently fix the header type if it's wrong
// (happens when a regular Image file written by EXR_2.0 is rewritten by an older library,
// so doesn't effect deep image types)
//

if(!multipart && !isNonImage(_data->version))
{
_data->_headers[i].setType(tiled ? TILEDIMAGE : SCANLINEIMAGE);
}
}



if( _data->_headers[i].hasName() == false )
{
Expand Down
2 changes: 1 addition & 1 deletion OpenEXR/IlmImf/ImfNamespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
// Open Source version of this file pulls in the IlmBaseConfig.h file
// for the configure time options.
//
#include <OpenEXRConfig.h>
#include "OpenEXRConfig.h"


#ifndef OPENEXR_IMF_NAMESPACE
Expand Down
11 changes: 9 additions & 2 deletions OpenEXR/IlmImf/ImfOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ OutputFile::OutputFile
_data->_streamData->currentPosition = _data->_streamData->os->tellp();

// Write header and empty offset table to the file.
writeMagicNumberAndVersionField(*_data->_streamData->os, header);
writeMagicNumberAndVersionField(*_data->_streamData->os, _data->header);
_data->previewPosition =
_data->header.writeTo (*_data->_streamData->os);
_data->lineOffsetsPosition =
Expand Down Expand Up @@ -713,7 +713,7 @@ OutputFile::OutputFile
_data->_streamData->currentPosition = _data->_streamData->os->tellp();

// Write header and empty offset table to the file.
writeMagicNumberAndVersionField(*_data->_streamData->os, header);
writeMagicNumberAndVersionField(*_data->_streamData->os, _data->header);
_data->previewPosition =
_data->header.writeTo (*_data->_streamData->os);
_data->lineOffsetsPosition =
Expand Down Expand Up @@ -775,6 +775,13 @@ OutputFile::initialize (const Header &header)
{
_data->header = header;

// "fix" the type if it happens to be set incorrectly
// (attribute is optional, but ensure it is correct if it exists)
if(_data->header.hasType())
{
_data->header.setType(SCANLINEIMAGE);
}

const Box2i &dataWindow = header.dataWindow();

_data->currentScanLine = (header.lineOrder() == INCREASING_Y)?
Expand Down
4 changes: 2 additions & 2 deletions OpenEXR/IlmImf/ImfScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,8 @@ ScanLineInputFile::setFrameBuffer (const FrameBuffer &frameBuffer)
_data->optimizationMode = detectOptimizationMode(frameBuffer, channels,v);
}

// TODO-pk this disables optimization
// _data->optimizationMode._destination._format = Imf::OptimizationMode::PIXELFORMAT_OTHER;
// Uncomment the line below to disable optimization code path
_data->optimizationMode._destination._format = Imf::OptimizationMode::PIXELFORMAT_OTHER;


//
Expand Down
6 changes: 5 additions & 1 deletion OpenEXR/IlmImf/ImfStringVectorAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ StringVectorAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &i
std::string str;
str.resize (strSize);

Xdr::read<StreamIO> (is, &str[0], strSize);
if( strSize>0 )
{
Xdr::read<StreamIO> (is, &str[0], strSize);
}

read += strSize;

_value.push_back (str);
Expand Down
13 changes: 13 additions & 0 deletions OpenEXR/IlmImf/ImfTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,23 @@ TiledInputFile::multiPartInitialize(InputPartData* part)
void
TiledInputFile::initialize ()
{
// fix bad types in header (arises when a tool built against an older version of
// OpenEXR converts a scanline image to tiled)
// only applies when file is a single part, regular image, tiled file
//
if(!isMultiPart(_data->version) &&
!isNonImage(_data->version) &&
isTiled(_data->version) &&
_data->header.hasType() )
{
_data->header.setType(TILEDIMAGE);
}

if (_data->partNumber == -1)
{
if (!isTiled (_data->version))
throw IEX_NAMESPACE::ArgExc ("Expected a tiled file but the file is not tiled.");

}
else
{
Expand Down
15 changes: 14 additions & 1 deletion OpenEXR/IlmImf/ImfTiledOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ TiledOutputFile::TiledOutputFile
_streamData->currentPosition = _streamData->os->tellp();

// Write header and empty offset table to the file.
writeMagicNumberAndVersionField(*_streamData->os, header);
writeMagicNumberAndVersionField(*_streamData->os, _data->header);
_data->previewPosition = _data->header.writeTo (*_streamData->os, true);
_data->tileOffsetsPosition = _data->tileOffsets.writeTo (*_streamData->os);
}
Expand Down Expand Up @@ -968,12 +968,25 @@ TiledOutputFile::initialize (const Header &header)
_data->header = header;
_data->lineOrder = _data->header.lineOrder();



//
// Check that the file is indeed tiled
//

_data->tileDesc = _data->header.tileDescription();


//
// 'Fix' the type attribute if it exists but is incorrectly set
// (attribute is optional, but ensure it is correct if it exists)
//
if(_data->header.hasType())
{
_data->header.setType(TILEDIMAGE);
}


//
// Save the dataWindow information
//
Expand Down
22 changes: 14 additions & 8 deletions OpenEXR/IlmImfTest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,27 @@ IlmImfTest_SOURCES = main.cpp tmpDir.h testAttributes.cpp testChannels.cpp \
testTiledRgba.h compareFloat.h compareFloat.cpp \
testTiledYa.cpp testTiledYa.h \
testYca.cpp testYca.h compareB44.h compareB44.cpp \
testMultiView.cpp testMultiView.h \
testMultiView.cpp testMultiView.h \
testIsComplete.cpp testIsComplete.h \
testMultiPartApi.cpp testMultiPartApi.h \
testMultiPartThreading.cpp testMultiPartThreading.h \
testMultiScanlinePartThreading.cpp testMultiScanlinePartThreading.h \
testMultiTiledPartThreading.cpp testMultiTiledPartThreading.h \
testDeepScanLineBasic.cpp testDeepScanLineBasic.h \
testDeepTiledBasic.cpp testDeepTiledBasic.h \
testDeepScanLineBasic.cpp testDeepScanLineBasic.h \
testDeepTiledBasic.cpp testDeepTiledBasic.h \
testMultiPartFileMixingBasic.cpp testMultiPartFileMixingBasic.h \
testMultiPartSharedAttributes.cpp testMultiPartSharedAttributes.h \
testBackwardCompatibility.cpp testBackwardCompatibility.h \
testCopyDeepScanLine.cpp testCopyDeepScanLine.h testCopyDeepTiled.h \
testCopyDeepTiled.cpp testCopyMultiPartFile.h testCopyMultiPartFile.cpp \
testCompositeDeepScanLine.h testCompositeDeepScanLine.cpp \
testInputPart.cpp testInputPart.h \
testDeepScanLineMultipleRead.h testDeepScanLineMultipleRead.cpp \
testCopyDeepScanLine.cpp testCopyDeepScanLine.h \
testCopyDeepTiled.cpp testCopyDeepTiled.h \
testCopyMultiPartFile.h testCopyMultiPartFile.cpp \
testCompositeDeepScanLine.h testCompositeDeepScanLine.cpp \
testInputPart.cpp testInputPart.h \
testDeepScanLineMultipleRead.h testDeepScanLineMultipleRead.cpp \
testPartHelper.h testPartHelper.cpp \
testOptimized.cpp testOptimized.h \
testOptimizedInterleavePatterns.cpp testOptimizedInterleavePatterns.h \
testBadTypeAttributes.cpp testBadTypeAttributes.h \
testFutureProofing.cpp testFutureProofing.h

AM_CPPFLAGS = -DILM_IMF_TEST_IMAGEDIR=\"$(srcdir)/\"
Expand Down Expand Up @@ -70,4 +73,7 @@ EXTRA_DIST = comp_none.exr comp_piz.exr comp_rle.exr comp_zip.exr \
tiled.exr comp_b44.exr comp_b44_piz.exr \
v1.7.test.planar.exr v1.7.test.tiled.exr v1.7.test.1.exr v1.7.test.interleaved.exr \
invalid_shared_attrs_multipart.exr \
tiled_with_scanlineimage_type.exr scanline_with_tiledimage_type.exr \
tiled_with_deepscanline_type.exr tiled_with_deeptile_type.exr \
scanline_with_deepscanline_type.exr scanline_with_deeptiled_type.exr \
CMakeLists.txt
14 changes: 13 additions & 1 deletion OpenEXR/IlmImfTest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#include "testCopyMultiPartFile.h"
#include "testPartHelper.h"
#include "testOptimized.h"
#include "testOptimizedInterleavePatterns.h"
#include "testBadTypeAttributes.h"
#include "testFutureProofing.h"


Expand Down Expand Up @@ -125,7 +127,13 @@ main (int argc, char *argv[])
TEST (testScanLineApi,"basic");
TEST (testExistingStreams,"core");
TEST (testStandardAttributes,"core");
#if 0
// Temporarily disabling the optimisation path and this
// associated test.
/// c.f. https://github.com/openexr/openexr/issues/66
TEST (testOptimized,"basic");
#endif
TEST (testOptimizedInterleavePatterns,"basic");
TEST (testYca,"basic");
TEST (testTiledYa,"basic");
TEST (testNativeFormat,"basic");
Expand All @@ -140,6 +148,7 @@ main (int argc, char *argv[])
TEST (testMultiPartFileMixingBasic,"multi");
TEST (testInputPart,"multi");
TEST (testPartHelper,"multi");
TEST (testBadTypeAttributes,"multi");
TEST (testMultiScanlinePartThreading,"multi");
TEST (testMultiTiledPartThreading,"multi");
TEST (testMultiPartThreading,"multi");
Expand All @@ -165,7 +174,10 @@ main (int argc, char *argv[])
std::stringstream ss;
ss << "ls -lG /proc/" << getpid() << "/fd";

system (ss.str().c_str());
if(system (ss.str().c_str())==-1)
{
std::cout << "failed to run ls\n";
}

std::cout << std::endl;

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions OpenEXR/IlmImfTest/testAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,14 @@ writeReadAttr (const Array2D<float> &pf1,
a15.push_back ("straw into");
a15.push_back ("gold");



M33d a16 (12, 13, 14, 15, 16, 17, 18, 19, 20);
M44d a17 (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17);
V2d a18 (27.51, 28.51);
V3d a19 (37.51, 38.51, 39.51);

StringVector a20;

//
// Write an image file with extra attributes in the header
Expand Down Expand Up @@ -141,6 +145,7 @@ writeReadAttr (const Array2D<float> &pf1,
hdr.insert ("a17", M44dAttribute (a17));
hdr.insert ("a18", V2dAttribute (a18));
hdr.insert ("a19", V3dAttribute (a19));
hdr.insert ("a20", StringVectorAttribute (a20));

hdr.channels().insert ("F", // name
Channel (FLOAT, // type
Expand Down Expand Up @@ -227,6 +232,9 @@ writeReadAttr (const Array2D<float> &pf1,
assert (hdr.typedAttribute <M44dAttribute> ("a17").value() == a17);
assert (hdr.typedAttribute <V2dAttribute> ("a18").value() == a18);
assert (hdr.typedAttribute <V3dAttribute> ("a19").value() == a19);
assert (hdr.typedAttribute <StringVectorAttribute> ("a20").value() == a20);


}

remove (fileName);
Expand Down
Loading

0 comments on commit 34f5447

Please sign in to comment.