Disabled external gits
This commit is contained in:
23
cs440-acg/ext/openexr/OpenEXR/exrmultiview/CMakeLists.txt
Normal file
23
cs440-acg/ext/openexr/OpenEXR/exrmultiview/CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
# yue.nicholas@gmail.com
|
||||
|
||||
ADD_EXECUTABLE ( exrmultiview
|
||||
makeMultiView.cpp
|
||||
main.cpp
|
||||
Image.cpp
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES ( exrmultiview
|
||||
IlmImf
|
||||
Half
|
||||
Imath${ILMBASE_LIBSUFFIX}
|
||||
Iex${ILMBASE_LIBSUFFIX}
|
||||
IlmThread${ILMBASE_LIBSUFFIX}
|
||||
${PTHREAD_LIB}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
||||
INSTALL ( TARGETS
|
||||
exrmultiview
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}/bin
|
||||
)
|
132
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Image.cpp
Normal file
132
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Image.cpp
Normal file
@@ -0,0 +1,132 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Classes for storing OpenEXR images in memory.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "Image.h"
|
||||
#include "namespaceAlias.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace IMATH;
|
||||
using namespace IEX;
|
||||
using namespace IMF;
|
||||
|
||||
|
||||
ImageChannel::ImageChannel (Image &image): _image (image)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
ImageChannel::~ImageChannel ()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
Image::Image (): _dataWindow (Box2i (V2i (0, 0), V2i (0, 0)))
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
Image::Image (const Box2i &dataWindow): _dataWindow (dataWindow)
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
Image::~Image ()
|
||||
{
|
||||
for (ChannelMap::iterator i = _channels.begin(); i != _channels.end(); ++i)
|
||||
delete i->second;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Image::resize (const IMATH::Box2i &dataWindow)
|
||||
{
|
||||
_dataWindow = dataWindow;
|
||||
|
||||
for (ChannelMap::iterator i = _channels.begin(); i != _channels.end(); ++i)
|
||||
i->second->resize();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Image::addChannel (const string &name, const IMF::Channel &channel)
|
||||
{
|
||||
switch (channel.type)
|
||||
{
|
||||
case IMF::HALF:
|
||||
_channels[name] = new HalfChannel (*this,
|
||||
channel.xSampling,
|
||||
channel.ySampling);
|
||||
break;
|
||||
|
||||
case IMF::FLOAT:
|
||||
_channels[name] = new FloatChannel (*this,
|
||||
channel.xSampling,
|
||||
channel.ySampling);
|
||||
break;
|
||||
|
||||
case IMF::UINT:
|
||||
_channels[name] = new UIntChannel (*this,
|
||||
channel.xSampling,
|
||||
channel.ySampling);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw IEX::ArgExc ("Unknown channel type.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImageChannel &
|
||||
Image::channel (const string &name)
|
||||
{
|
||||
return *_channels.find(name)->second;
|
||||
}
|
||||
|
||||
|
||||
const ImageChannel &
|
||||
Image::channel (const string &name) const
|
||||
{
|
||||
return *_channels.find(name)->second;
|
||||
}
|
271
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Image.h
Normal file
271
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Image.h
Normal file
@@ -0,0 +1,271 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDED_IMAGE_H
|
||||
#define INCLUDED_IMAGE_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Classes for storing OpenEXR images in memory.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include <ImfChannelList.h>
|
||||
#include <ImfFrameBuffer.h>
|
||||
#include <ImfArray.h>
|
||||
#include <ImathBox.h>
|
||||
#include <half.h>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "namespaceAlias.h"
|
||||
|
||||
class Image;
|
||||
|
||||
|
||||
class ImageChannel
|
||||
{
|
||||
public:
|
||||
|
||||
friend class Image;
|
||||
|
||||
ImageChannel (Image &image);
|
||||
virtual ~ImageChannel();
|
||||
|
||||
virtual IMF::Slice slice () const = 0;
|
||||
|
||||
Image & image () {return _image;}
|
||||
const Image & image () const {return _image;}
|
||||
virtual void black() =0;
|
||||
private:
|
||||
|
||||
virtual void resize () = 0;
|
||||
|
||||
Image & _image;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class TypedImageChannel: public ImageChannel
|
||||
{
|
||||
public:
|
||||
|
||||
TypedImageChannel (Image &image, int xSampling, int ySampling);
|
||||
|
||||
virtual ~TypedImageChannel ();
|
||||
|
||||
IMF::PixelType pixelType () const;
|
||||
|
||||
virtual IMF::Slice slice () const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
virtual void resize ();
|
||||
virtual void black();
|
||||
|
||||
int _xSampling;
|
||||
int _ySampling;
|
||||
IMF::Array2D<T> _pixels;
|
||||
};
|
||||
|
||||
|
||||
typedef TypedImageChannel<half> HalfChannel;
|
||||
typedef TypedImageChannel<float> FloatChannel;
|
||||
typedef TypedImageChannel<unsigned int> UIntChannel;
|
||||
|
||||
|
||||
class Image
|
||||
{
|
||||
public:
|
||||
|
||||
Image ();
|
||||
Image (const IMATH_NAMESPACE::Box2i &dataWindow);
|
||||
~Image ();
|
||||
|
||||
const IMATH_NAMESPACE::Box2i & dataWindow () const;
|
||||
void resize (const IMATH_NAMESPACE::Box2i &dataWindow);
|
||||
|
||||
int width () const;
|
||||
int height () const;
|
||||
|
||||
void addChannel (const std::string &name,
|
||||
const IMF::Channel &channel);
|
||||
|
||||
ImageChannel & channel (const std::string &name);
|
||||
const ImageChannel & channel (const std::string &name) const;
|
||||
|
||||
template <class T>
|
||||
TypedImageChannel<T> & typedChannel (const std::string &name);
|
||||
|
||||
template <class T>
|
||||
const TypedImageChannel<T> & typedChannel (const std::string &name) const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map <std::string, ImageChannel *> ChannelMap;
|
||||
|
||||
IMATH_NAMESPACE::Box2i _dataWindow;
|
||||
ChannelMap _channels;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Implementation of templates and inline functions.
|
||||
//
|
||||
|
||||
template <class T>
|
||||
TypedImageChannel<T>::TypedImageChannel
|
||||
(Image &image,
|
||||
int xSampling,
|
||||
int ySampling)
|
||||
:
|
||||
ImageChannel (image),
|
||||
_xSampling (xSampling),
|
||||
_ySampling (ySampling),
|
||||
_pixels (0, 0)
|
||||
{
|
||||
resize();
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
TypedImageChannel<T>::~TypedImageChannel ()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
inline IMF::PixelType
|
||||
HalfChannel::pixelType () const
|
||||
{
|
||||
return IMF::HALF;
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
inline IMF::PixelType
|
||||
FloatChannel::pixelType () const
|
||||
{
|
||||
return IMF::FLOAT;
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
inline IMF::PixelType
|
||||
UIntChannel::pixelType () const
|
||||
{
|
||||
return IMF::UINT;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
IMF::Slice
|
||||
TypedImageChannel<T>::slice () const
|
||||
{
|
||||
const IMATH_NAMESPACE::Box2i &dw = image().dataWindow();
|
||||
int w = dw.max.x - dw.min.x + 1;
|
||||
|
||||
return IMF::Slice (pixelType(),
|
||||
(char *) (&_pixels[0][0] -
|
||||
dw.min.y / _ySampling * (w / _xSampling) -
|
||||
dw.min.x / _xSampling),
|
||||
sizeof (T),
|
||||
(w / _xSampling) * sizeof (T),
|
||||
_xSampling,
|
||||
_ySampling);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void
|
||||
TypedImageChannel<T>::resize ()
|
||||
{
|
||||
int width = image().width() / _xSampling;
|
||||
int height = image().height() / _ySampling;
|
||||
|
||||
_pixels.resizeEraseUnsafe (height, width);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void
|
||||
TypedImageChannel<T>::black ()
|
||||
{
|
||||
memset(&_pixels[0][0],0,image().width()/_xSampling*image().height()/_ySampling*sizeof(T));
|
||||
}
|
||||
|
||||
|
||||
inline const IMATH_NAMESPACE::Box2i &
|
||||
Image::dataWindow () const
|
||||
{
|
||||
return _dataWindow;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
Image::width () const
|
||||
{
|
||||
return _dataWindow.max.x - _dataWindow.min.x + 1;
|
||||
}
|
||||
|
||||
|
||||
inline int
|
||||
Image::height () const
|
||||
{
|
||||
return _dataWindow.max.y - _dataWindow.min.y + 1;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
TypedImageChannel<T> &
|
||||
Image::typedChannel (const std::string &name)
|
||||
{
|
||||
return dynamic_cast <TypedImageChannel<T>&> (channel (name));
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
const TypedImageChannel<T> &
|
||||
Image::typedChannel (const std::string &name) const
|
||||
{
|
||||
return dynamic_cast <const TypedImageChannel<T>&> (channel (name));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
24
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Makefile.am
Normal file
24
cs440-acg/ext/openexr/OpenEXR/exrmultiview/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
bin_PROGRAMS = exrmultiview
|
||||
|
||||
INCLUDES = -I$(top_builddir) \
|
||||
-I$(top_srcdir)/IlmImf -I$(top_srcdir)/config \
|
||||
@ILMBASE_CXXFLAGS@
|
||||
|
||||
LDADD = @ILMBASE_LDFLAGS@ @ILMBASE_LIBS@ \
|
||||
$(top_builddir)/IlmImf/libIlmImf.la \
|
||||
-lz
|
||||
|
||||
exrmultiview_SOURCES = main.cpp \
|
||||
Image.h Image.cpp \
|
||||
makeMultiView.cpp makeMultiView.h \
|
||||
namespaceAlias.h
|
||||
|
||||
noinst_HEADERS = Image.h makeMultiView.h
|
||||
|
||||
EXTRA_DIST = main.cpp \
|
||||
Image.h Image.cpp \
|
||||
makeMultiView.h makeMultiView.cpp \
|
||||
namespaceAlias.h \
|
||||
CMakeLists.txt
|
260
cs440-acg/ext/openexr/OpenEXR/exrmultiview/main.cpp
Normal file
260
cs440-acg/ext/openexr/OpenEXR/exrmultiview/main.cpp
Normal file
@@ -0,0 +1,260 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// exrmultiview -- a program that combines multiple
|
||||
// single-view OpenEXR image files into a single
|
||||
// multi-view image file.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <makeMultiView.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "namespaceAlias.h"
|
||||
using namespace IMF;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
usageMessage (const char argv0[], bool verbose = false)
|
||||
{
|
||||
cerr << "usage: " << argv0 << " "
|
||||
"[options] viewname1 infile1 viewname2 infile2 ... outfile" << endl;
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
cerr << "\n"
|
||||
"Combines two or more single-view OpenEXR image files into\n"
|
||||
"a single multi-view image file. On the command line,\n"
|
||||
"each single-view input image is specified together with\n"
|
||||
"a corresponding view name. The first view on the command\n"
|
||||
"line becomes the default view. Example:\n"
|
||||
"\n"
|
||||
" " << argv0 << " left imgL.exr right imgR.exr imgLR.exr\n"
|
||||
"\n"
|
||||
"Here, imgL.exr and imgR.exr become the left and right\n"
|
||||
"views in output file imgLR.exr. The left view becomes\n"
|
||||
"the default view.\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
"\n"
|
||||
"-z x sets the data compression method to x\n"
|
||||
" (none/rle/zip/piz/pxr24/b44/b44a/dwaa/dwab,\n"
|
||||
" default is piz)\n"
|
||||
"\n"
|
||||
"-v verbose mode\n"
|
||||
"\n"
|
||||
"-h prints this message\n";
|
||||
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
Compression
|
||||
getCompression (const string &str)
|
||||
{
|
||||
Compression c;
|
||||
|
||||
if (str == "no" || str == "none" || str == "NO" || str == "NONE")
|
||||
{
|
||||
c = NO_COMPRESSION;
|
||||
}
|
||||
else if (str == "rle" || str == "RLE")
|
||||
{
|
||||
c = RLE_COMPRESSION;
|
||||
}
|
||||
else if (str == "zip" || str == "ZIP")
|
||||
{
|
||||
c = ZIP_COMPRESSION;
|
||||
}
|
||||
else if (str == "piz" || str == "PIZ")
|
||||
{
|
||||
c = PIZ_COMPRESSION;
|
||||
}
|
||||
else if (str == "pxr24" || str == "PXR24")
|
||||
{
|
||||
c = PXR24_COMPRESSION;
|
||||
}
|
||||
else if (str == "b44" || str == "B44")
|
||||
{
|
||||
c = B44_COMPRESSION;
|
||||
}
|
||||
else if (str == "b44a" || str == "B44A")
|
||||
{
|
||||
c = B44A_COMPRESSION;
|
||||
}
|
||||
else if (str == "dwaa" || str == "DWAA")
|
||||
{
|
||||
c = DWAA_COMPRESSION;
|
||||
}
|
||||
else if (str == "dwab" || str == "DWAB")
|
||||
{
|
||||
c = DWAB_COMPRESSION;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Unknown compression method \"" << str << "\"." << endl;
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
vector <string> views;
|
||||
vector <const char *> inFiles;
|
||||
const char *outFile = 0;
|
||||
Compression compression = PIZ_COMPRESSION;
|
||||
bool verbose = false;
|
||||
|
||||
//
|
||||
// Parse the command line.
|
||||
//
|
||||
|
||||
if (argc < 2)
|
||||
usageMessage (argv[0], true);
|
||||
|
||||
int i = 1;
|
||||
|
||||
while (i < argc)
|
||||
{
|
||||
if (!strcmp (argv[i], "-z"))
|
||||
{
|
||||
//
|
||||
// Set compression method
|
||||
//
|
||||
|
||||
if (i > argc - 2)
|
||||
usageMessage (argv[0]);
|
||||
|
||||
compression = getCompression (argv[i + 1]);
|
||||
i += 2;
|
||||
}
|
||||
else if (!strcmp (argv[i], "-v"))
|
||||
{
|
||||
//
|
||||
// Verbose mode
|
||||
//
|
||||
|
||||
verbose = true;
|
||||
i += 1;
|
||||
}
|
||||
else if (!strcmp (argv[i], "-h"))
|
||||
{
|
||||
//
|
||||
// Print help message
|
||||
//
|
||||
|
||||
usageMessage (argv[0], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// View or image file name
|
||||
//
|
||||
|
||||
if (i > argc - 2 || argv[i + 1][0] == '-')
|
||||
{
|
||||
//
|
||||
// Output file
|
||||
//
|
||||
|
||||
if (outFile)
|
||||
usageMessage (argv[0]);
|
||||
|
||||
outFile = argv[i];
|
||||
i += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// View plus input file
|
||||
//
|
||||
|
||||
views.push_back (argv[i]);
|
||||
inFiles.push_back (argv[i + 1]);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (views.size() < 2)
|
||||
{
|
||||
cerr << "Must specify at least two views." << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (outFile == 0)
|
||||
{
|
||||
cerr << "Must specify an output file." << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Load inFiles, and save a combined multi-view image in outFile.
|
||||
//
|
||||
|
||||
int exitStatus = 0;
|
||||
|
||||
try
|
||||
{
|
||||
makeMultiView (views, inFiles, outFile, compression, verbose);
|
||||
}
|
||||
catch (const exception &e)
|
||||
{
|
||||
cerr << e.what() << endl;
|
||||
exitStatus = 1;
|
||||
}
|
||||
|
||||
return exitStatus;
|
||||
}
|
172
cs440-acg/ext/openexr/OpenEXR/exrmultiview/makeMultiView.cpp
Normal file
172
cs440-acg/ext/openexr/OpenEXR/exrmultiview/makeMultiView.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Combine multiple single-view images
|
||||
// into one multi-view image.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "makeMultiView.h"
|
||||
#include "Image.h"
|
||||
#include <ImfInputFile.h>
|
||||
#include <ImfOutputFile.h>
|
||||
#include <ImfChannelList.h>
|
||||
#include <ImfFrameBuffer.h>
|
||||
#include <ImfStandardAttributes.h>
|
||||
#include <ImfMultiView.h>
|
||||
#include "Iex.h"
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include "namespaceAlias.h"
|
||||
using namespace IMF;
|
||||
using namespace IMATH_NAMESPACE;
|
||||
using namespace std;
|
||||
|
||||
|
||||
void
|
||||
makeMultiView (const vector <string> &viewNames,
|
||||
const vector <const char *> &inFileNames,
|
||||
const char *outFileName,
|
||||
Compression compression,
|
||||
bool verbose)
|
||||
{
|
||||
Header header;
|
||||
Image image;
|
||||
FrameBuffer outFb;
|
||||
|
||||
//
|
||||
// Find the size of the dataWindow, check files
|
||||
//
|
||||
|
||||
Box2i d;
|
||||
|
||||
|
||||
for (size_t i = 0; i < viewNames.size(); ++i)
|
||||
{
|
||||
InputFile in (inFileNames[i]);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
cout << "reading file " << inFileNames[i] << " "
|
||||
"for " << viewNames[i] << " view" << endl;
|
||||
}
|
||||
|
||||
if (hasMultiView (in.header()))
|
||||
{
|
||||
THROW (IEX_NAMESPACE::NoImplExc,
|
||||
"The image in file " << inFileNames[i] << " is already a "
|
||||
"multi-view image. Cannot combine multiple multi-view "
|
||||
"images.");
|
||||
}
|
||||
|
||||
header = in.header();
|
||||
if (i == 0)
|
||||
{
|
||||
d=header.dataWindow();
|
||||
}else{
|
||||
d.extendBy(header.dataWindow());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
image.resize (d);
|
||||
|
||||
header.dataWindow()=d;
|
||||
|
||||
// blow away channels; we'll rebuild them
|
||||
header.channels()=ChannelList();
|
||||
|
||||
|
||||
//
|
||||
// Read the input image files
|
||||
//
|
||||
|
||||
for (size_t i = 0; i < viewNames.size(); ++i)
|
||||
{
|
||||
InputFile in (inFileNames[i]);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
cout << "reading file " << inFileNames[i] << " "
|
||||
"for " << viewNames[i] << " view" << endl;
|
||||
}
|
||||
|
||||
FrameBuffer inFb;
|
||||
|
||||
for (ChannelList::ConstIterator j = in.header().channels().begin();
|
||||
j != in.header().channels().end();
|
||||
++j)
|
||||
{
|
||||
const Channel &inChannel = j.channel();
|
||||
string inChanName = j.name();
|
||||
string outChanName = insertViewName (inChanName, viewNames, i);
|
||||
|
||||
image.addChannel (outChanName, inChannel);
|
||||
image.channel(outChanName).black();
|
||||
|
||||
header.channels().insert (outChanName, inChannel);
|
||||
|
||||
inFb.insert (inChanName, image.channel(outChanName).slice());
|
||||
outFb.insert (outChanName, image.channel(outChanName).slice());
|
||||
}
|
||||
|
||||
in.setFrameBuffer (inFb);
|
||||
in.readPixels (in.header().dataWindow().min.y, in.header().dataWindow().max.y);
|
||||
}
|
||||
|
||||
//
|
||||
// Write the output image file
|
||||
//
|
||||
|
||||
{
|
||||
header.compression() = compression;
|
||||
addMultiView (header, viewNames);
|
||||
|
||||
OutputFile out (outFileName, header);
|
||||
|
||||
if (verbose)
|
||||
cout << "writing file " << outFileName << endl;
|
||||
|
||||
out.setFrameBuffer (outFb);
|
||||
|
||||
out.writePixels
|
||||
(header.dataWindow().max.y - header.dataWindow().min.y + 1);
|
||||
}
|
||||
}
|
58
cs440-acg/ext/openexr/OpenEXR/exrmultiview/makeMultiView.h
Normal file
58
cs440-acg/ext/openexr/OpenEXR/exrmultiview/makeMultiView.h
Normal file
@@ -0,0 +1,58 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2007, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef INCLUDED_MAKE_MULTI_VIEW_H
|
||||
#define INCLUDED_MAKE_MULTI_VIEW_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Combine multiple single-view images
|
||||
// into one multi-view image.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include <ImfCompression.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "namespaceAlias.h"
|
||||
|
||||
|
||||
void makeMultiView (const std::vector <std::string> &viewNames,
|
||||
const std::vector <const char *> &inFileNames,
|
||||
const char *outFileName,
|
||||
IMF::Compression compression,
|
||||
bool verbose);
|
||||
|
||||
#endif
|
45
cs440-acg/ext/openexr/OpenEXR/exrmultiview/namespaceAlias.h
Normal file
45
cs440-acg/ext/openexr/OpenEXR/exrmultiview/namespaceAlias.h
Normal file
@@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
|
||||
// Digital Ltd. LLC
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Industrial Light & Magic nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#ifndef NAMESPACEALIAS_H_
|
||||
#define NAMESPACEALIAS_H_
|
||||
|
||||
#include <ImfNamespace.h>
|
||||
#include <ImathNamespace.h>
|
||||
#include <IexNamespace.h>
|
||||
|
||||
namespace IMF = OPENEXR_IMF_NAMESPACE;
|
||||
namespace IMATH = IMATH_NAMESPACE;
|
||||
namespace IEX = IEX_NAMESPACE;
|
||||
|
||||
#endif /* NAMESPACEALIAS_H_ */
|
Reference in New Issue
Block a user