[Pkg-phototools-commits] [SCM] openimageio branch, master, updated. upstream/1.1.2+dfsg0-100-g0e6f3ea

Matteo F. Vescovi mfv.debian at gmail.com
Thu Jan 10 13:26:37 UTC 2013


The following commit has been merged in the master branch:
commit 6d97a3566917fcb303754b6d48bb85cb03a2531e
Author: Matteo F. Vescovi <mfv.debian at gmail.com>
Date:   Thu Jan 10 14:22:40 2013 +0100

    Imported Upstream version 1.1.3+dfsg0

diff --git a/CHANGES b/CHANGES
index 71962de..b93fae4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,22 @@
 Changes:
 
 
+Release 1.1.3 (9 Jan 2013)
+---------------------------
+* Build fix: incorrectly named OpenEXR 2.x files.
+* Bug fix in oiiotool --croptofull on OSX
+* Build fixes for MinGW on Windows.
+* maketx --fullpixels option ignores any origin or display window in the
+  source image, pretending the pixel data is the entire 0-1 image range
+  starting at the origin (useful when the source image is created by an
+  application that incorrectly writes it out as if it were a crop window).
+* maketx no longer will clobber existing ImageDescription metadata
+  when it adds SHA-1 hash or other info as it creates the texture.
+* Many additional Exif and IPTC tags are correctly recognized.
+* maketx and oiiotool recognize and take advantage of IPTC:ImageHistory
+  metadata.
+
+
 Release 1.1.2 (5 Dec 2012)
 --------------------------
 * maketx fixes -- was botching creation of textures from source images that
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d1fcb98..46a85cd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,7 +3,7 @@ project (OpenImageIO)
 # Release version of the library
 set (OIIO_VERSION_MAJOR 1)
 set (OIIO_VERSION_MINOR 1)
-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/doc/maketx.tex b/src/doc/maketx.tex
index 297e402..514bc2d 100644
--- a/src/doc/maketx.tex
+++ b/src/doc/maketx.tex
@@ -150,6 +150,14 @@ be replaced by the average of all the finite values within a $3 \times 3$
 region surrounding the pixel.
 \apiend
 
+\apiitem{--fullpixels}
+\NEW
+Resets the ``full'' (or ``display'') pixel range to be the ``data''
+range.  This is used to deal with input images that appear, in their
+headers, to be crop windows or overscanned images, but you want to treat
+them as full 0--1 range images over just their defined pixel data.
+\apiend
+
 %\apiitem{--ingamma {\rm \emph{value}} \\
 %--outgamma {\rm \emph{value}}}
 %Not currently implemented
diff --git a/src/doc/openimageio.tex b/src/doc/openimageio.tex
index ddca466..de854bf 100644
--- a/src/doc/openimageio.tex
+++ b/src/doc/openimageio.tex
@@ -85,7 +85,7 @@
 \date{{\large 
 %Editor: Larry Gritz \\[2ex]
 Date: 18 Nov, 2012
-% \\ (with corrections, 18 Sep 2012)
+\\ (with corrections, 5 Jan 2013)
 }}
 
 
diff --git a/src/doc/stdmetadata.tex b/src/doc/stdmetadata.tex
index 3125f50..e5ce191 100644
--- a/src/doc/stdmetadata.tex
+++ b/src/doc/stdmetadata.tex
@@ -274,7 +274,7 @@ purposes.
 
 \apiitem{"Exif:ExposureProgram" : int}
 The exposure program used to set exposure when the picture was taken:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & unknown \\
@@ -342,7 +342,7 @@ Distance to the subject, in meters.
 \apiitem{"Exif:MeteringMode" : int}
 The metering mode:
 
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & unknown \\
@@ -359,7 +359,7 @@ The metering mode:
 \apiitem{"Exif:LightSource" : int}
 The kind of light source:
 
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & unknown \\
@@ -411,6 +411,17 @@ A sum of:
 Actual focal length of the lens, in mm.
 \apiend
 
+\apiitem{"Exif:SecurityClassification" : string}
+Security classification of the image: `C' = confidential,
+`R' = restricted, `S' = secret, `T' = top secret,
+`U' = unclassified.
+\apiend
+
+\apiitem{"Exif:ImageHistory" : string}
+Image history.
+\apiend
+
+
 %\apiitem{"Exif:SubjectArea",TIFF_NOTYPE } // skip
 %\apiitem{"Exif:MakerNote",TIFF_NOTYPE } // skip it
 %\apiitem{"Exif:UserComment",TIFF_NOTYPE }// skip it
@@ -451,8 +462,16 @@ Seconds (BCPS).
 "Exif:FocalPlaneYResolution" : float \\
 "Exif:FocalPlaneResolutionUnit" : int} 
 The number of pixels in the $x$ and $y$ dimension, per resolution unit.
-The code for resolution units is: 2 for inches.
-% FIXME? units?
+The codes for resolution units are:
+\smallskip
+
+\begin{tabular}{p{0.3in} p{4in}}
+1 & none \\
+2 & inches \\
+3 & cm \\
+4 & mm \\
+5 & $\mu$m \\
+\end{tabular}
 \apiend
 
 
@@ -464,7 +483,7 @@ The exposure index selected on the camera.
 
 \apiitem{"Exif:SensingMethod" : int}
 The image sensor type on the camra:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 1 & undefined \\
@@ -478,8 +497,14 @@ The image sensor type on the camra:
 \apiend
 
 \apiitem{"Exif:FileSource" : int}
-Set to 3, if captured by a digital camera, otherwise it should not be
-present.
+The source type of the scanned image, if known:
+\smallskip
+
+\begin{tabular}{p{0.3in} p{4in}}
+1 & film scanner \\
+2 & reflection print scanner \\
+3 & digital camera \\
+\end{tabular}
 \apiend
 
 \apiitem{"Exif:SceneType" : int}
@@ -496,7 +521,7 @@ performed on the image data.
 
 \apiitem{"Exif:ExposureMode" : int}
 The exposure mode:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & auto \\
@@ -519,7 +544,7 @@ The equivalent focal length of a 35mm camera, in mm.
 
 \apiitem{"Exif:SceneCaptureType" : int}
 The type of scene that was shot:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & standard \\
@@ -531,7 +556,7 @@ The type of scene that was shot:
 
 \apiitem{"Exif:GainControl" : float }
 The degree of overall gain adjustment:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & none \\
@@ -544,7 +569,7 @@ The degree of overall gain adjustment:
 
 \apiitem{"Exif:Contrast" : int}
 The direction of contrast processing applied by the camera:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & normal \\
@@ -555,7 +580,7 @@ The direction of contrast processing applied by the camera:
 
 \apiitem{"Exif:Saturation" : int}
 The direction of saturation processing applied by the camera:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & normal \\
@@ -566,7 +591,7 @@ The direction of saturation processing applied by the camera:
 
 \apiitem{"Exif:Sharpness" : int}
 The direction of sharpness processing applied by the camera:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & normal \\
@@ -579,7 +604,7 @@ The direction of sharpness processing applied by the camera:
 
 \apiitem{"Exif:SubjectDistanceRange" : int}
 The distance to the subject:
-\medskip
+\smallskip
 
 \begin{tabular}{p{0.3in} p{4in}}
 0 & unknown \\
@@ -744,6 +769,10 @@ Date according to the GPS device, in format \qkw{YYYY:MM:DD}.
 If 1, indicates that differential correction was applied.
 \apiend
 
+\apiitem{"GPS:HPositioningError" : float}
+Positioning error.
+\apiend
+
 
 
 \section{IPTC metadata}
@@ -772,37 +801,99 @@ CopyrightNotice & \qkw{Copyright} \\[0.5ex]
 Creator & \qkw{Artist} \\
 \end{tabular}
 
-\medskip
+\bigskip
 
 The remainder of IPTC metadata fields should use the following names,
 prefixed with ``IPTC:'' to avoid conflicts with other plugins or
 standards.
 
+\apiitem{"IPTC:ObjecTypeReference" : string}
+Object type reference.
+\apiend
+
+\apiitem{"IPTC:ObjectAttributeReference" : string}
+Object attribute reference.
+\apiend
+
 \apiitem{"IPTC:ObjectName" : string}
 The name of the object in the picture.
 \apiend
 
+\apiitem{"IPTC:EditStatus" : string}
+Edit status.
+\apiend
+
+\apiitem{"IPTC:SubjectReference" : string}
+Subject reference.
+\apiend
+
+\apiitem{"IPTC:Category" : string}
+Category.
+\apiend
+
 % \apiitem{  25, "Keywords" : string}
 %\apiend
 % FIXME
 
+\apiitem{"IPTC:ContentLocationCode" : string}
+Code for content location.
+\apiend
+
+\apiitem{"IPTC:ContentLocationName" : string}
+Name of content location.
+\apiend
+
+\apiitem{"IPTC:ReleaseDate" : string \\
+"IPTC:ReleaseTime" : string}
+Release date and time.
+\apiend
+
+\apiitem{"IPTC:ExpirationDate" : string \\
+"IPTC:ExpirationTime" : string}
+Expiration date and time.
+\apiend
+
 \apiitem{"IPTC:Instructions" : string}
 Special instructions for handling the image.
 \apiend
 
+\apiitem{"IPTC:ReferenceService" : string \\
+"IPTC:ReferenceDate" : string \\
+"IPTC:ReferenceNumber" : string}
+Reference date, service, and number.
+\apiend
+
+\apiitem{"IPTC:DateCreated" : string \\
+"IPTC:TimeCreated" : string}
+Date and time that the image was created.
+\apiend
+
+\apiitem{"IPTC:DigitalCreationDate" : string \\
+"IPTC:DigitalCreationTime" : string}
+Date and time that the image was digitized.
+\apiend
+
+
 %\apiitem{"IPTC:Creator" : string}
 %The creator of the image.  This is optinal and, If present, 
 %is expected to be the same as the data in the standard \qkw{Artist} field.
 %\apiend
 
+\apiitem{"IPTC:ProgramVersion" : string}
+The version number of the creation software.
+\apiend
+
 \apiitem{"IPTC:AuthorsPosition" : string}
 The job title or position of the creator of the image.
 \apiend
 
 \apiitem{"IPTC:City" : string \\
+"IPTC:Sublocation" : string \\
 "IPTC:State" : string \\
-"IPTC:Country" : string}
-The city, state, and country of the location of the image.
+"IPTC:Country" : string \\
+"IPTC:CountryCode" : string}
+The city, sublocation within the city,
+state, country, and country code of the location of the image.
 \apiend
 
 \apiitem{"IPTC:Headline" : string}
@@ -837,6 +928,29 @@ email, etc.).
 The name of the person who wrote the caption or description of the image.
 \apiend
 
+\apiitem{"IPTC:JobID" : string \\
+"IPTC:MasterDocumentID" : string \\
+"IPTC:ShortDocumentID" : string \\
+"IPTC:UniqueDocumentID" : string \\
+"IPTC:OwnerID" : string }
+Various identification tags.
+\apiend
+
+\apiitem{"IPTC:Prefs" : string \\
+"IPTC:ClassifyState" : string \\
+"IPTC:SimilarityIndex" : string}
+Who knows what the heck these are?
+\apiend
+
+\apiitem{"IPTC:DocumentNotes" : string}
+Notes about the image or document.
+\apiend
+
+\apiitem{"IPTC:DocumentHistory" : string}
+The history of the image or document.
+\apiend
+
+
 
 \section{Extension conventions}
 
diff --git a/src/include/fmath.h b/src/include/fmath.h
index 45067f9..58cb6a5 100644
--- a/src/include/fmath.h
+++ b/src/include/fmath.h
@@ -843,8 +843,10 @@ inline float degrees (float rad) { return rad * (float)(180.0 / M_PI); }
 #define hypotf _hypotf
 #define copysign(x,y) _copysign(x,y)
 #define copysignf(x,y) copysign(x,y)
+#ifdef _MSC_VER
 #define isnan(x) _isnan(x)
 #define isfinite(x) _finite(x)
+#endif
 
 #define M_E        2.71828182845904523536
 #define M_LOG2E    1.44269504088896340736
@@ -870,10 +872,12 @@ roundf (float val) {
     return static_cast<float>(round (val));
 }
 
+#ifdef _MSC_VER
 template<class T>
 inline int isinf (T x) {
     return (isfinite(x)||isnan(x)) ? 0 : static_cast<int>(copysign(1.0f, x));
 }
+#endif
 
 inline float
 log2f (float val) {
@@ -963,7 +967,7 @@ truncf(float val)
 
 
 // Some systems have isnan, isinf and isfinite in the std namespace.
-#ifndef WIN32
+#ifndef _MSC_VER
  using std::isnan;
  using std::isinf;
  using std::isfinite;
diff --git a/src/include/sysutil.h b/src/include/sysutil.h
index 255367c..21691e0 100644
--- a/src/include/sysutil.h
+++ b/src/include/sysutil.h
@@ -42,6 +42,10 @@
 
 #include <string>
 
+#ifdef __MINGW32__
+#include <malloc.h> // for alloca
+#endif
+
 #include "export.h"
 #include "version.h"
 
diff --git a/src/libOpenImageIO/exif.cpp b/src/libOpenImageIO/exif.cpp
index 73175ab..406f143 100644
--- a/src/libOpenImageIO/exif.cpp
+++ b/src/libOpenImageIO/exif.cpp
@@ -45,6 +45,14 @@ extern "C" {
 #include "tiff.h"
 }
 
+// Some EXIF tags that don't seem to be in tiff.h
+#ifndef EXIFTAG_SECURITYCLASSIFICATION
+#define EXIFTAG_SECURITYCLASSIFICATION 37394
+#endif
+#ifndef EXIFTAG_IMAGEHISTORY
+#define EXIFTAG_IMAGEHISTORY 37395
+#endif
+
 #ifdef TIFF_VERSION_BIG
 // In old versions of TIFF, this was defined in tiff.h.  It's gone from
 // "BIG TIFF" (libtiff 4.x), so we just define it here.
@@ -144,6 +152,8 @@ static const EXIF_tag_info exif_tag_table[] = {
     { EXIFTAG_LIGHTSOURCE,	"Exif:LightSource",	TIFF_SHORT, 1 },
     { EXIFTAG_FLASH,	        "Exif:Flash",	        TIFF_SHORT, 1 },
     { EXIFTAG_FOCALLENGTH,	"Exif:FocalLength",	TIFF_RATIONAL, 1 }, // mm
+    { EXIFTAG_SECURITYCLASSIFICATION, "Exif:SecurityClassification", TIFF_ASCII, 1 },
+    { EXIFTAG_IMAGEHISTORY,     "Exif:ImageHistory",    TIFF_ASCII, 1 },
     { EXIFTAG_SUBJECTAREA,	"Exif:SubjectArea",	TIFF_NOTYPE, 1 }, // skip
     { EXIFTAG_MAKERNOTE,	"Exif:MakerNote",	TIFF_NOTYPE, 1 },	 // skip it
     { EXIFTAG_USERCOMMENT,	"Exif:UserComment",	TIFF_NOTYPE, 1 },	// skip it
@@ -205,7 +215,8 @@ enum GPSTag {
     GPSTAG_PROCESSINGMETHOD = 27,
     GPSTAG_AREAINFORMATION = 28,
     GPSTAG_DATESTAMP = 29,
-    GPSTAG_DIFFERENTIAL = 30
+    GPSTAG_DIFFERENTIAL = 30,
+    GPSTAG_HPOSITIONINGERROR = 31
 };
 
 static const EXIF_tag_info gps_tag_table[] = {
@@ -240,6 +251,7 @@ static const EXIF_tag_info gps_tag_table[] = {
     { GPSTAG_AREAINFORMATION,	"GPS:AreaInformation",	TIFF_UNDEFINED, 1 },
     { GPSTAG_DATESTAMP,		"GPS:DateStamp",	TIFF_ASCII, 0 },
     { GPSTAG_DIFFERENTIAL,	"GPS:Differential",	TIFF_SHORT, 1 },
+    { GPSTAG_HPOSITIONINGERROR,	"GPS:HPositioningError",TIFF_RATIONAL, 1 },
     { -1, NULL }  // signal end of table
 };
 
diff --git a/src/libOpenImageIO/formatspec.cpp b/src/libOpenImageIO/formatspec.cpp
index ed6e7fb..1ef5ad7 100644
--- a/src/libOpenImageIO/formatspec.cpp
+++ b/src/libOpenImageIO/formatspec.cpp
@@ -712,6 +712,7 @@ static LabelTable ExifExposureProgram_table[] = {
     { 6, "Action program, biased toward fast shutter" },
     { 7, "Portrait mode, foreground in focus" },
     { 8, "Landscape mode, background in focus" },
+    { 9, "bulb" },
     { -1, NULL }
 };
 
@@ -757,7 +758,8 @@ static LabelTable orientation_table[] = {
 };
 
 static LabelTable resunit_table[] = {
-    { 1, "none" }, { 2, "inches" }, { 3, "cm" }, { -1, NULL }
+    { 1, "none" }, { 2, "inches" }, { 3, "cm" },
+    { 4, "mm" }, { 5, "um" }, { -1, NULL }
 };
 
 static LabelTable ExifSensingMethod_table[] = {
@@ -768,6 +770,7 @@ static LabelTable ExifSensingMethod_table[] = {
 };
 
 static LabelTable ExifFileSource_table[] = {
+    { 1, "film scanner" }, { 2, "reflection print scanner" },
     { 3, "digital camera" }, { -1, NULL }
 };
 
diff --git a/src/libOpenImageIO/iptc.cpp b/src/libOpenImageIO/iptc.cpp
index ddc697c..40fa63b 100644
--- a/src/libOpenImageIO/iptc.cpp
+++ b/src/libOpenImageIO/iptc.cpp
@@ -48,58 +48,66 @@ struct IIMtag {
     int tag;                  // IIM code
     const char *name;         // Attribute name we use
     const char *anothername;  // Optional second name
+    bool repeatable;          // May repeat
 };
 
 static IIMtag iimtag [] = {
-    {   5, "IPTC:ObjectName", NULL },
-    {  15, "IPTC:Category", NULL },
-//    {  25, "Keywords", NULL },
-    {  40, "IPTC:Instructions", NULL },
-    {  65, "IPTC:OriginatingProgram", "Software" },
-    {  80, "IPTC:Creator", "Artist" },   // N.B. in theory, repeatable
-    {  85, "IPTC:AuthorsPosition", NULL },  // N.B. in theory, repeatable
-    {  90, "IPTC:City", NULL },
-    {  92, "IPTC:Sublocation", NULL },
-    {  95, "IPTC:State", NULL },
-    { 100, "IPTC:CountryCode", NULL },
-    { 101, "IPTC:Country", NULL },
-    { 103, "IPTC:TransmissionReference", NULL },
-    { 105, "IPTC:Headline", NULL },
-    { 110, "IPTC:Provider", NULL }, // aka Credit
-    { 115, "IPTC:Source", NULL },
-    { 116, "IPTC:CopyrightNotice", "Copyright" },
-    { 118, "IPTC:Contact", NULL },
-    { 120, "IPTC:Caption", "ImageDescription"},
-    { 122, "IPTC:CaptionWriter", NULL },  // should it be called Writer?
-    { -1, NULL, NULL }
+    {   3, "IPTC:ObjectTypeReference", NULL, false },
+    {   4, "IPTC:ObjectAttributeReference", NULL, true },
+    {   5, "IPTC:ObjectName", NULL, false },
+    {   7, "IPTC:EditStatus", NULL, false },
+    {  12, "IPTC:SubjectReference", NULL, true },
+    {  15, "IPTC:Category", NULL, false },
+//  20 is "SupplementalCategories", but has been deprecated by IPTC
+//    {  25, "Keywords", NULL, false },  // handled by special case
+    {  26, "IPTC:ContentLocationCode", NULL, true },
+    {  27, "IPTC:ContentLocationName", NULL, true },
+    {  30, "IPTC:ReleaseDate", NULL, false },
+    {  35, "IPTC:ReleaseTime", NULL, false },
+    {  37, "IPTC:ExpirationDate", NULL, false },
+    {  38, "IPTC:ExpirationTime", NULL, false },
+    {  40, "IPTC:Instructions", NULL, false },
+    {  45, "IPTC:ReferenceService", NULL, true },
+    {  47, "IPTC:ReferenceDate", NULL, false },
+    {  50, "IPTC:ReferenceNumber", NULL, true },
+    {  55, "IPTC:DateCreated", NULL, false },
+    {  60, "IPTC:TimeCreated", NULL, false },
+    {  62, "IPTC:DigitalCreationDate", NULL, false },
+    {  63, "IPTC:DigitalCreationTime", NULL, false },
+    {  65, "IPTC:OriginatingProgram", "Software", false },
+    {  70, "IPTC:ProgramVersion", NULL, false },
+    {  80, "IPTC:Creator", "Artist", true },
+    {  85, "IPTC:AuthorsPosition", NULL, true },
+    {  90, "IPTC:City", NULL, false },
+    {  92, "IPTC:Sublocation", NULL, false },
+    {  95, "IPTC:State", NULL, false },
+    { 100, "IPTC:CountryCode", NULL, false },
+    { 101, "IPTC:Country", NULL, false },
+    { 103, "IPTC:TransmissionReference", NULL, false },
+    { 105, "IPTC:Headline", NULL, false },
+    { 110, "IPTC:Provider", NULL, false }, // aka Credit
+    { 115, "IPTC:Source", NULL, false },
+    { 116, "IPTC:CopyrightNotice", "Copyright", false },
+    { 118, "IPTC:Contact", NULL, false },
+    { 120, "IPTC:Caption", "ImageDescription", false},
+    { 121, "IPTC:LocalCaption", NULL, false},
+    { 122, "IPTC:CaptionWriter", NULL, false },  // should it be called Writer?
+    // Note: 150-154 is audio sampling stuff
+    { 184, "IPTC:JobID", NULL, false },
+    { 185, "IPTC:MasterDocumentID", NULL, false },
+    { 186, "IPTC:ShortDocumentID", NULL, false },
+    { 187, "IPTC:UniqueDocumentID", NULL, false },
+    { 188, "IPTC:OwnerID", NULL, false },
+    { 221, "IPTC:Prefs", NULL, false },
+    { 225, "IPTC:ClassifyState", NULL, false },
+    { 228, "IPTC:SimilarityIndex", NULL, false },
+    { 230, "IPTC:DocumentNotes", NULL, false },
+    { 231, "IPTC:DocumentHistory", NULL, false },
+    { -1, NULL, NULL, false }
 };
 
-// FIXME? others:
-// 20 SupplementalCategories (repeatable) [ deprecated by IPTC ]
-// 30 ReleaseDate
-// 35 ReleaseTime
-// 37 ExpirationDate
-// 38 ExpirationTime
-// 45 ReferenceService
-// 47 ReferenceDate
-// 50 ReferenceNumber
-// 55 DateCreated (CCYYMMDD, 00 for unknown parts)
-// 60 TimeCreated [11 digs]
-// 62 DigitalCreationDate [8 digs]
-// 63 DigitalCreationTime [11 digs]
-// 70 ProgramVersion
-// 121 LocalCaption
-// 150-154 audio stuff
-// 184 JobID
-// 185 MasterDocumentID
-// 186 ShortDocumentID
-// 187 UniqueDocumentID
-// 188 OwnerID
-// 221 Prefs
-// 225 ClassifyState
-// 228 SimilarityIndex
-// 230 DocumentNotes
-// 231 DocumentHistory
+// N.B. All "Date" fields are 8 digit strings: CCYYMMDD
+// All "Time" fields are 11 digit strings (what format?)
 
 };   // anonymous namespace
 
diff --git a/src/libOpenImageIO/strutil_test.cpp b/src/libOpenImageIO/strutil_test.cpp
index 6ab6b81..3e6baa1 100644
--- a/src/libOpenImageIO/strutil_test.cpp
+++ b/src/libOpenImageIO/strutil_test.cpp
@@ -35,6 +35,25 @@ OIIO_NAMESPACE_USING;
 
 
 
+void test_format ()
+{
+    // Test formatting
+    OIIO_CHECK_EQUAL (Strutil::format ("%d %f %g", int(3), 3.14f, 3.14f),
+                      "3 3.140000 3.14");
+    OIIO_CHECK_EQUAL (Strutil::format ("'%s' '%s'", "foo", std::string("foo")),
+                      "'foo' 'foo'");
+    OIIO_CHECK_EQUAL (Strutil::format ("'%3d' '%03d' '%-3d'", 3, 3, 3),
+                      "'  3' '003' '3  '");
+
+    // Test '+' format modifier
+// FIXME -- this fails at the moment, due to tinyformat error
+//    OIIO_CHECK_EQUAL (Strutil::format ("%+d%+d%+d", 3, -3, 0), "+3-3+0");
+
+    // FIXME -- we should make comprehensive tests here
+}
+
+
+
 void test_memformat ()
 {
     OIIO_CHECK_EQUAL (Strutil::memformat (15), "15 B");
@@ -147,6 +166,7 @@ void test_strip ()
 
 int main (int argc, char *argv[])
 {
+    test_format ();
     test_memformat ();
     test_timeintervalformat ();
     test_get_rest_arguments ();
diff --git a/src/libutil/ustring.cpp b/src/libutil/ustring.cpp
index 79c0e9b..53208da 100644
--- a/src/libutil/ustring.cpp
+++ b/src/libutil/ustring.cpp
@@ -229,7 +229,8 @@ ustring::make_unique (const char *str)
     // new one!  Use the one in the table and disregard the one we
     // speculatively built.  Note that we've already released the lock
     // on the table at this point.
-    delete rep;
+    rep->~TableRep ();  // destructor
+    free (rep);         // because it was malloced
     return result;
 }
 
diff --git a/src/maketx/maketx.cpp b/src/maketx/maketx.cpp
index 87c4d80..ca17b9d 100644
--- a/src/maketx/maketx.cpp
+++ b/src/maketx/maketx.cpp
@@ -38,6 +38,7 @@
 
 #include <boost/version.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/regex.hpp>
 #include <OpenEXR/ImathMatrix.h>
 
 #include "argparse.h"
@@ -80,6 +81,7 @@ static double stat_miptime = 0;
 static double stat_colorconverttime = 0;
 static bool checknan = false;
 static std::string fixnan = "none"; // none, black, box3
+static bool set_full_to_pixels = false;
 static int found_nonfinite = 0;
 static spin_mutex maketx_mutex;   // for anything that needs locking
 static std::string filtername = "box";
@@ -249,6 +251,7 @@ getargs (int argc, char *argv[])
                   "--nomipmap", &nomipmap, "Do not make multiple MIP-map levels",
                   "--checknan", &checknan, "Check for NaN/Inf values (abort if found)",
                   "--fixnan %s", &fixnan, "Attempt to fix NaN/Inf values in the image (options: none, black, box3)",
+                  "--fullpixels", &set_full_to_pixels, "Set the 'full' image range to be the pixel data window",
                   "--Mcamera %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
                           &Mcam[0][0], &Mcam[0][1], &Mcam[0][2], &Mcam[0][3], 
                           &Mcam[1][0], &Mcam[1][1], &Mcam[1][2], &Mcam[1][3], 
@@ -289,7 +292,7 @@ getargs (int argc, char *argv[])
                           "if your image contains an alpha channel.",
                   "<SEPARATOR>", "Configuration Presets",
                   "--prman", &prman, "Use PRMan-safe settings for tile size, planarconfig, and metadata.",
-                  "--oiio", &oiio, "Use OIIO-optimized settings for tile size, planarconfig, metadata, and constant-color optimizations.",
+                  "--oiio", &oiio, "Use OIIO-optimized settings for tile size, planarconfig, metadata.",
                   NULL);
     if (ap.parse (argc, (const char**)argv) < 0) {
         std::cerr << ap.geterror() << std::endl;
@@ -836,6 +839,18 @@ make_texturemap (const char *maptypename = "texture map")
             out_dataformat = TypeDesc::FLOAT;
     }
 
+    if (set_full_to_pixels) {
+        // User requested that we treat the image as uncropped or not
+        // overscan
+        ImageSpec &spec (src.specmod());
+        spec.full_x = spec.x = 0;
+        spec.full_y = spec.y = 0;
+        spec.full_z = spec.z = 0;
+        spec.full_width = spec.width;
+        spec.full_height = spec.height;
+        spec.full_depth = spec.depth;
+    }
+
     // Copy the input spec
     const ImageSpec &srcspec = src.spec();
     ImageSpec dstspec = srcspec;
@@ -910,7 +925,16 @@ make_texturemap (const char *maptypename = "texture map")
         time (&date);    // not update: get the time now
     dstspec.attribute ("DateTime", datestring(date));
 
-    dstspec.attribute ("Software", full_command_line);
+    std::string software = Strutil::format ("OpenImageIO %s : %s",
+                                      OIIO_VERSION_STRING, full_command_line);
+    dstspec.attribute ("Software", software);
+
+    // Append command to image history
+    std::string history = dstspec.get_string_attribute ("Exif:ImageHistory");
+    if (history.length() && ! Strutil::iends_with (history, "\n"))
+        history += std::string("\n");
+    history += full_command_line;
+    dstspec.attribute ("Exif:ImageHistory", history);
     
     if (shadowmode) {
         dstspec.attribute ("textureformat", "Shadow");
@@ -1121,14 +1145,15 @@ make_texturemap (const char *maptypename = "texture map")
     std::string desc = dstspec.get_string_attribute ("ImageDescription");
     bool updatedDesc = false;
     
-    // FIXME: We need to do real dictionary style partial updates on the
-    //        ImageDescription. I.e., set one key without affecting the
-    //        other keys. But in the meantime, just clear it out if
-    //        it appears the incoming image was a maketx style texture.
-    
-    if ((desc.find ("SHA-1=") != std::string::npos) || 
-        (desc.find ("ConstantColor=") != std::string::npos)) {
-        desc = "";
+    // Eliminate any SHA-1 or ConstantColor hints in the ImageDescription.
+    if (desc.size()) {
+        desc = boost::regex_replace (desc, boost::regex("SHA-1=[[:xdigit:]]*[ ]*"), "");
+        static const char *fp_number_pattern =
+            "([+-]?((?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?)))";
+        const std::string color_pattern =
+            std::string ("ConstantColor=(\\[?") + fp_number_pattern + ",?)+\\]?[ ]*";
+        desc = boost::regex_replace (desc, boost::regex(color_pattern), "");
+        updatedDesc = true;
     }
     
     // The hash is only computed for the top mipmap level of pixel data.
diff --git a/src/oiiotool/oiiotool.cpp b/src/oiiotool/oiiotool.cpp
index d5fa609..0ad6a10 100644
--- a/src/oiiotool/oiiotool.cpp
+++ b/src/oiiotool/oiiotool.cpp
@@ -223,6 +223,19 @@ adjust_output_options (ImageSpec &spec, const Oiiotool &ot)
     if (ot.output_planarconfig == "contig" ||
         ot.output_planarconfig == "separate")
         spec.attribute ("planarconfig", ot.output_planarconfig);
+
+    // Append command to image history
+    std::string history = spec.get_string_attribute ("Exif:ImageHistory");
+    if (! Strutil::iends_with (history, ot.full_command_line)) { // don't add twice
+        if (history.length() && ! Strutil::iends_with (history, "\n"))
+            history += std::string("\n");
+        history += ot.full_command_line;
+        spec.attribute ("Exif:ImageHistory", history);
+    }
+
+    std::string software = Strutil::format ("OpenImageIO %s : %s",
+                                   OIIO_VERSION_STRING, ot.full_command_line);
+    spec.attribute ("Software", software);
 }
 
 
@@ -1450,9 +1463,21 @@ action_croptofull (int argc, const char *argv[])
     const ImageSpec &Aspec (*A->spec(0,0));
     // Implement by calling action_crop with a geometry specifier built
     // from the current full image size.
+#if 0
+    // This should work...
     std::string size = Strutil::format ("%dx%d%+d%+d",
                                         Aspec.full_width, Aspec.full_height,
                                         Aspec.full_x, Aspec.full_y);
+    // ... but tinyformat doesn't print the sign for '0' values!  It
+    // appears to be a bug with iostream use of 'showpos' format flag,
+    // specific to certain gcc libs, perhaps only on OSX.  Workaround:
+#else
+    std::string size = Strutil::format ("%dx%d%c%d%c%d",
+                                        Aspec.full_width, Aspec.full_height,
+                                        Aspec.full_x >= 0 ? '+' : '-',
+                                        Aspec.full_y >= 0 ? '+' : '-',
+                                        abs(Aspec.full_x), abs(Aspec.full_y));
+#endif
     const char *newargv[2] = { "crop", size.c_str() };
     return action_crop (2, newargv);
 }
@@ -1815,7 +1840,8 @@ static void
 getargs (int argc, char *argv[])
 {
     bool help = false;
-    ArgParse ap;
+    ArgParse ap (argc, (const char **)argv);
+    ot.full_command_line = ap.command_line();
     ap.options ("oiiotool -- simple image processing operations\n"
                 OIIO_INTRO_STRING "\n"
                 "Usage:  oiiotool [filename,option,action]...\n",
diff --git a/src/oiiotool/oiiotool.h b/src/oiiotool/oiiotool.h
index 6af3ae3..9db54aa 100644
--- a/src/oiiotool/oiiotool.h
+++ b/src/oiiotool/oiiotool.h
@@ -56,7 +56,8 @@ public:
     bool hash;
     bool updatemode;
     int threads;
-    
+    std::string full_command_line;
+
     // Output options
     TypeDesc output_dataformat;
     int output_bitspersample;
diff --git a/src/openexr.imageio/exrinput.cpp b/src/openexr.imageio/exrinput.cpp
index ead1aa9..7b242f4 100644
--- a/src/openexr.imageio/exrinput.cpp
+++ b/src/openexr.imageio/exrinput.cpp
@@ -61,7 +61,7 @@
 #include <OpenEXR/ImfMultiPartInputFile.h>
 #include <OpenEXR/ImfInputPart.h>
 #include <OpenEXR/ImfTiledInputPart.h>
-#include <OpenEXR/ImfDeepScanlineInputPart.h>
+#include <OpenEXR/ImfDeepScanLineInputPart.h>
 #include <OpenEXR/ImfDeepTiledInputPart.h>
 #include <OpenEXR/ImfDeepFrameBuffer.h>
 #endif
diff --git a/src/openexr.imageio/exroutput.cpp b/src/openexr.imageio/exroutput.cpp
index 5562bf3..b3b3854 100644
--- a/src/openexr.imageio/exroutput.cpp
+++ b/src/openexr.imageio/exroutput.cpp
@@ -69,7 +69,7 @@
 #include <OpenEXR/ImfPartType.h>
 #include <OpenEXR/ImfOutputPart.h>
 #include <OpenEXR/ImfTiledOutputPart.h>
-#include <OpenEXR/ImfDeepScanlineOutputPart.h>
+#include <OpenEXR/ImfDeepScanLineOutputPart.h>
 #include <OpenEXR/ImfDeepTiledOutputPart.h>
 #endif
 
diff --git a/testsuite/oiiotool-fixnan/ref/out.txt b/testsuite/oiiotool-fixnan/ref/out.txt
index 066dc23..9b45b4b 100644
--- a/testsuite/oiiotool-fixnan/ref/out.txt
+++ b/testsuite/oiiotool-fixnan/ref/out.txt
@@ -23,6 +23,8 @@ black.exr            :   64 x   64, 3 channel, half openexr
     channel list: R, G, B
     oiio:ColorSpace: "Linear"
     compression: "zip"
+    Exif:ImageHistory: "../../oiiotool/oiiotool bad.exr --fixnan black -o black.exr"
+    Software: "OpenImageIO 1.1.2 : ../../oiiotool/oiiotool bad.exr --fixnan black -o black.exr"
     DateTime: "2012:02:24 23:11:09"
     PixelAspectRatio: 1
     screenWindowCenter: 0 0
@@ -42,6 +44,8 @@ box3.exr             :   64 x   64, 3 channel, half openexr
     channel list: R, G, B
     oiio:ColorSpace: "Linear"
     compression: "zip"
+    Exif:ImageHistory: "../../oiiotool/oiiotool bad.exr --fixnan box3 -o box3.exr"
+    Software: "OpenImageIO 1.1.2 : ../../oiiotool/oiiotool bad.exr --fixnan box3 -o box3.exr"
     DateTime: "2012:02:24 23:11:09"
     PixelAspectRatio: 1
     screenWindowCenter: 0 0

-- 
OpenImageIO packaging



More information about the Pkg-phototools-commits mailing list