--- Begin Message ---
The following commit has been merged in the upstream branch:
commit a4c5aff9511f156000130d52a9b6778f882a3100
Author: Matteo F. Vescovi <[email protected]>
Date: Wed Apr 18 14:41:56 2012 +0200
Imported Upstream version 1.0.3+dfsg0
diff --git a/CHANGES b/CHANGES
index 4d2a495..ff27b4f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,14 @@
Changes:
+Release 1.0.3 (16 Apr 2012)
+---------------------------
+* Fix reading bugs in DPX and Cineon.
+* iconvert handles the int32 and uint32 cases.
+* Bug fix in to_native_rectangle, which could lead to errors in certain
+ data format conversions.
+* Various Windows build fixes, including fixes for Windows 7.
+* Compilation fixes on FreeBSD.
+
Release 1.0.2 (19 Mar 2012)
----------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a8a440f..7dc6541 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,7 @@
project (OpenImageIO)
set (OIIO_VERSION_MAJOR 1)
set (OIIO_VERSION_MINOR 0)
-set (OIIO_VERSION_PATCH 2)
+set (OIIO_VERSION_PATCH 3)
cmake_minimum_required (VERSION 2.6)
if (NOT CMAKE_VERSION VERSION_LESS 2.8.4)
diff --git a/src/cineon.imageio/libcineon/ReaderInternal.h
b/src/cineon.imageio/libcineon/ReaderInternal.h
index 42e141c..0c77b6e 100644
--- a/src/cineon.imageio/libcineon/ReaderInternal.h
+++ b/src/cineon.imageio/libcineon/ReaderInternal.h
@@ -72,14 +72,20 @@ namespace cineon
// end of line padding
int eolnPad = dpxHeader.EndOfLinePadding();
+ // number of datums in one row
+ int datums = dpxHeader.Width() * numberOfComponents;
+
+ // Line length in bytes rounded to 32 bits boundary
+ int lineLength = ((datums - 1) / 3 + 1) * 4;
// read in each line at a time directly into the user memory
space
for (int line = 0; line < height; line++)
{
+ // determine offset into image element
+ int actline = line + block.y1;
+
// first get line offset
- long offset = (line + block.y1) * dpxHeader.Width() *
numberOfComponents;
- offset += offset % 3;
- offset = offset / 3 * 4;
+ long offset = actline * lineLength;
// add in eoln padding
offset += line * eolnPad;
diff --git a/src/dpx.imageio/libdpx/ReaderInternal.h
b/src/dpx.imageio/libdpx/ReaderInternal.h
index 8fb1685..3f564dd 100644
--- a/src/dpx.imageio/libdpx/ReaderInternal.h
+++ b/src/dpx.imageio/libdpx/ReaderInternal.h
@@ -133,25 +133,18 @@ namespace dpx
// number of datums in one row
int datums = dpxHeader.Width() * numberOfComponents;
+ // Line length in bytes rounded to 32 bits boundary
+ int lineLength = ((datums - 1) / 3 + 1) * 4;
+
// read in each line at a time directly into the user memory
space
for (int line = 0; line < height; line++)
{
// determine offset into image element
-
int actline = line + block.y1;
// first get line offset
- long offset = actline * datums;
-
- // add in the accumulated round-up offset - the
following magical formula is
- // just an unrolling of a loop that does the same work
in constant time:
- // for (int i = 1; i <= actline; ++i)
- // offset += (i * datums) % 3;
- offset += datums % 3 * ((actline + 2) / 3) + (3 -
datums % 3) % 3 * ((actline + 1) / 3);
-
- // round up to the 32-bit boundary
- offset = offset / 3 * 4;
-
+ long offset = actline * lineLength;
+
// add in eoln padding
offset += line * eolnPad;
diff --git a/src/iconvert/iconvert.cpp b/src/iconvert/iconvert.cpp
index 596b97f..77bbb6c 100644
--- a/src/iconvert/iconvert.cpp
+++ b/src/iconvert/iconvert.cpp
@@ -251,16 +251,20 @@ adjust_spec (ImageInput *in, ImageOutput *out,
outspec.set_format (TypeDesc::UINT16);
else if (dataformatname == "int16")
outspec.set_format (TypeDesc::INT16);
+ else if (dataformatname == "uint32" || dataformatname == "uint")
+ outspec.set_format (TypeDesc::UINT32);
+ else if (dataformatname == "int32" || dataformatname == "int")
+ outspec.set_format (TypeDesc::INT32);
else if (dataformatname == "half")
outspec.set_format (TypeDesc::HALF);
else if (dataformatname == "float")
outspec.set_format (TypeDesc::FLOAT);
else if (dataformatname == "double")
outspec.set_format (TypeDesc::DOUBLE);
- if (outspec.format != inspec.format || inspec.channelformats.size())
- nocopy = true;
outspec.channelformats.clear ();
}
+ if (outspec.format != inspec.format || inspec.channelformats.size())
+ nocopy = true;
outspec.attribute ("oiio:Gamma", gammaval);
if (sRGB) {
diff --git a/src/libOpenImageIO/CMakeLists.txt
b/src/libOpenImageIO/CMakeLists.txt
index baed860..ad3dfed 100644
--- a/src/libOpenImageIO/CMakeLists.txt
+++ b/src/libOpenImageIO/CMakeLists.txt
@@ -210,9 +210,9 @@ endif ()
-if (MSVC)
+if (WIN32)
target_link_libraries (OpenImageIO psapi.lib)
-endif (MSVC)
+endif ()
link_ilmbase (OpenImageIO)
if (EMBEDPLUGINS)
diff --git a/src/libOpenImageIO/imageoutput.cpp
b/src/libOpenImageIO/imageoutput.cpp
index 898860f..eb56f17 100644
--- a/src/libOpenImageIO/imageoutput.cpp
+++ b/src/libOpenImageIO/imageoutput.cpp
@@ -246,7 +246,16 @@ ImageOutput::to_native_rectangle (int xbegin, int xend,
int ybegin, int yend,
int depth = zend - zbegin;
// Do the strides indicate that the data area is contiguous?
- bool contiguous = (xstride == (stride_t)m_spec.pixel_bytes(native_data));
+ bool contiguous;
+ if (native_data) {
+ // If it's native data, it had better be contiguous by the
+ // file's definition.
+ contiguous = (xstride == (stride_t)(m_spec.pixel_bytes(native_data)));
+ } else {
+ // If it's not native data, we only care if the user's buffer
+ // is contiguous.
+ contiguous = (xstride == (stride_t)(format.size()*m_spec.nchannels));
+ }
contiguous &= ((ystride == xstride*width || height == 1) &&
(zstride == ystride*height || depth == 1));
diff --git a/src/libOpenImageIO/imagespec_test.cpp
b/src/libOpenImageIO/imagespec_test.cpp
index 414a1bd..b3e4fdb 100644
--- a/src/libOpenImageIO/imagespec_test.cpp
+++ b/src/libOpenImageIO/imagespec_test.cpp
@@ -122,12 +122,12 @@ void test_imagespec_metadata_val ()
OIIO_CHECK_NE (ret, "-1, -1");
OIIO_CHECK_NE (ret, "18446744073709551615, 18446744073709551615,");
- std::string smatrix[] = {"this is \"a test\"", "this is another test"};
- metadata_val_test (&smatrix[0], 1, TypeDesc::TypeString, ret);
+ const char* smatrix[] = {"this is \"a test\"", "this is another test"};
+ metadata_val_test (smatrix, 1, TypeDesc::TypeString, ret);
OIIO_CHECK_EQUAL (ret, "\"this is \"a test\"\"");
OIIO_CHECK_NE (ret, smatrix[0]);
OIIO_CHECK_NE (ret, "\"this is \"a test\"\",");
- metadata_val_test (smatrix, sizeof (smatrix) / sizeof (std::string),
TypeDesc::TypeString, ret);
+ metadata_val_test (smatrix, sizeof (smatrix) / sizeof (char *),
TypeDesc::TypeString, ret);
OIIO_CHECK_EQUAL (ret, "\"this is \"a test\"\", \"this is another test\"");
float matrix16[2][16] = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16},
diff --git a/src/libutil/strutil.cpp b/src/libutil/strutil.cpp
index 1900707..cda7c01 100644
--- a/src/libutil/strutil.cpp
+++ b/src/libutil/strutil.cpp
@@ -241,7 +241,7 @@ Strutil::unescape_chars (const std::string &escaped)
octalChar = 8*octalChar + (c - '0');
s.erase (i, 1);
--len;
- c = s[i+1];
+ c = i+1 < len ? s[i+1] : '\0';
}
s[i] = (char) octalChar;
}
diff --git a/src/libutil/sysutil.cpp b/src/libutil/sysutil.cpp
index 6121f4e..d5dcf56 100644
--- a/src/libutil/sysutil.cpp
+++ b/src/libutil/sysutil.cpp
@@ -39,7 +39,7 @@
# include <sys/ioctl.h>
#endif
-#ifdef __FreeBSD__
+#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
# include <sys/types.h>
# include <sys/resource.h>
# include <sys/sysctl.h>
@@ -154,7 +154,7 @@ Sysutil::this_program_path ()
#elif defined(_WIN32)
// According to MSDN...
int r = GetModuleFileName (NULL, filename, size);
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
@@ -193,7 +193,7 @@ Sysutil::terminal_columns ()
{
int columns = 80; // a decent guess, if we have nothing more to go on
-#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||
defined(__FreeBSD_kernel__)
struct winsize w;
ioctl (0, TIOCGWINSZ, &w);
columns = w.ws_col;
diff --git a/src/rla.imageio/rlaoutput.cpp b/src/rla.imageio/rlaoutput.cpp
index 9cec8a8..b5f3a3e 100644
--- a/src/rla.imageio/rlaoutput.cpp
+++ b/src/rla.imageio/rlaoutput.cpp
@@ -31,6 +31,7 @@
#include <cstdio>
#include <cstdlib>
#include <cmath>
+#include <ctime>
#include "dassert.h"
#include "typedesc.h"
diff --git a/src/tiff.imageio/tiffoutput.cpp b/src/tiff.imageio/tiffoutput.cpp
index 291e261..2ebc071 100644
--- a/src/tiff.imageio/tiffoutput.cpp
+++ b/src/tiff.imageio/tiffoutput.cpp
@@ -32,6 +32,7 @@
#include <cstdio>
#include <cstdlib>
#include <cmath>
+#include <ctime>
#include <iostream>
#include <tiffio.h>
--
OpenImageIO packaging
--- End Message ---