1///////////////////////////////////////////////////////////////////////////
2//
3// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
4// Digital Ltd. LLC
5//
6// All rights reserved.
7//
8// Redistribution and use in source and binary forms, with or without
9// modification, are permitted provided that the following conditions are
10// met:
11// * Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13// * Redistributions in binary form must reproduce the above
14// copyright notice, this list of conditions and the following disclaimer
15// in the documentation and/or other materials provided with the
16// distribution.
17// * Neither the name of Industrial Light & Magic nor the names of
18// its contributors may be used to endorse or promote products derived
19// from this software without specific prior written permission.
20//
21// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32//
33///////////////////////////////////////////////////////////////////////////
34
35
36#ifndef INCLUDED_IMF_STANDARD_ATTRIBUTES_H
37#define INCLUDED_IMF_STANDARD_ATTRIBUTES_H
38
39//-----------------------------------------------------------------------------
40//
41// Optional Standard Attributes -- these attributes are "optional"
42// because not every image file header has them, but they define a
43// "standard" way to represent commonly used data in the file header.
44//
45// For each attribute, with name "foo", and type "T", the following
46// functions are automatically generated via macros:
47//
48// void addFoo (Header &header, const T &value);
49// bool hasFoo (const Header &header);
50// const TypedAttribute<T> & fooAttribute (const Header &header);
51// TypedAttribute<T> & fooAttribute (Header &header);
52// const T & foo (const Header &Header);
53// T & foo (Header &Header);
54//
55//-----------------------------------------------------------------------------
56
57#include "ImfHeader.h"
58#include "ImfChromaticitiesAttribute.h"
59#include "ImfEnvmapAttribute.h"
60#include "ImfDeepImageStateAttribute.h"
61#include "ImfFloatAttribute.h"
62#include "ImfKeyCodeAttribute.h"
63#include "ImfMatrixAttribute.h"
64#include "ImfRationalAttribute.h"
65#include "ImfStringAttribute.h"
66#include "ImfStringVectorAttribute.h"
67#include "ImfTimeCodeAttribute.h"
68#include "ImfVecAttribute.h"
69#include "ImfNamespace.h"
70#include "ImfExport.h"
71
72#define IMF_STD_ATTRIBUTE_DEF(name,suffix,object) \
73 \
74 OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER \
75 IMF_EXPORT void add##suffix (Header &header, const object &v); \
76 IMF_EXPORT bool has##suffix (const Header &header); \
77 IMF_EXPORT const TypedAttribute<object> & name##Attribute (const Header &header); \
78 IMF_EXPORT TypedAttribute<object> & name##Attribute (Header &header); \
79 IMF_EXPORT const object & name (const Header &header); \
80 IMF_EXPORT object & name (Header &header); \
81 OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT \
82
83
84//
85// chromaticities -- for RGB images, specifies the CIE (x,y)
86// chromaticities of the primaries and the white point
87//
88
89IMF_STD_ATTRIBUTE_DEF (chromaticities, Chromaticities, Chromaticities)
90
91
92//
93// whiteLuminance -- for RGB images, defines the luminance, in Nits
94// (candelas per square meter) of the RGB value (1.0, 1.0, 1.0).
95//
96// If the chromaticities and the whiteLuminance of an RGB image are
97// known, then it is possible to convert the image's pixels from RGB
98// to CIE XYZ tristimulus values (see function RGBtoXYZ() in header
99// file ImfChromaticities.h).
100//
101//
102
103IMF_STD_ATTRIBUTE_DEF (whiteLuminance, WhiteLuminance, float)
104
105
106//
107// adoptedNeutral -- specifies the CIE (x,y) coordinates that should
108// be considered neutral during color rendering. Pixels in the image
109// file whose (x,y) coordinates match the adoptedNeutral value should
110// be mapped to neutral values on the display.
111//
112
113IMF_STD_ATTRIBUTE_DEF (adoptedNeutral, AdoptedNeutral, IMATH_NAMESPACE::V2f)
114
115
116//
117// renderingTransform, lookModTransform -- specify the names of the
118// CTL functions that implements the intended color rendering and look
119// modification transforms for this image.
120//
121
122IMF_STD_ATTRIBUTE_DEF (renderingTransform, RenderingTransform, std::string)
123IMF_STD_ATTRIBUTE_DEF (lookModTransform, LookModTransform, std::string)
124
125
126//
127// xDensity -- horizontal output density, in pixels per inch.
128// The image's vertical output density is xDensity * pixelAspectRatio.
129//
130
131IMF_STD_ATTRIBUTE_DEF (xDensity, XDensity, float)
132
133
134//
135// owner -- name of the owner of the image
136//
137
138IMF_STD_ATTRIBUTE_DEF (owner, Owner, std::string)
139
140
141//
142// comments -- additional image information in human-readable
143// form, for example a verbal description of the image
144//
145
146IMF_STD_ATTRIBUTE_DEF (comments, Comments, std::string)
147
148
149//
150// capDate -- the date when the image was created or captured,
151// in local time, and formatted as
152//
153// YYYY:MM:DD hh:mm:ss
154//
155// where YYYY is the year (4 digits, e.g. 2003), MM is the month
156// (2 digits, 01, 02, ... 12), DD is the day of the month (2 digits,
157// 01, 02, ... 31), hh is the hour (2 digits, 00, 01, ... 23), mm
158// is the minute, and ss is the second (2 digits, 00, 01, ... 59).
159//
160//
161
162IMF_STD_ATTRIBUTE_DEF (capDate, CapDate, std::string)
163
164
165//
166// utcOffset -- offset of local time at capDate from
167// Universal Coordinated Time (UTC), in seconds:
168//
169// UTC == local time + utcOffset
170//
171
172IMF_STD_ATTRIBUTE_DEF (utcOffset, UtcOffset, float)
173
174
175//
176// longitude, latitude, altitude -- for images of real objects, the
177// location where the image was recorded. Longitude and latitude are
178// in degrees east of Greenwich and north of the equator. Altitude
179// is in meters above sea level. For example, Kathmandu, Nepal is
180// at longitude 85.317, latitude 27.717, altitude 1305.
181//
182
183IMF_STD_ATTRIBUTE_DEF (longitude, Longitude, float)
184IMF_STD_ATTRIBUTE_DEF (latitude, Latitude, float)
185IMF_STD_ATTRIBUTE_DEF (altitude, Altitude, float)
186
187
188//
189// focus -- the camera's focus distance, in meters
190//
191
192IMF_STD_ATTRIBUTE_DEF (focus, Focus, float)
193
194
195//
196// exposure -- exposure time, in seconds
197//
198
199IMF_STD_ATTRIBUTE_DEF (expTime, ExpTime, float)
200
201
202//
203// aperture -- the camera's lens aperture, in f-stops (focal length
204// of the lens divided by the diameter of the iris opening)
205//
206
207IMF_STD_ATTRIBUTE_DEF (aperture, Aperture, float)
208
209
210//
211// isoSpeed -- the ISO speed of the film or image sensor
212// that was used to record the image
213//
214
215IMF_STD_ATTRIBUTE_DEF (isoSpeed, IsoSpeed, float)
216
217
218//
219// envmap -- if this attribute is present, the image represents
220// an environment map. The attribute's value defines how 3D
221// directions are mapped to 2D pixel locations. For details
222// see header file ImfEnvmap.h
223//
224
225IMF_STD_ATTRIBUTE_DEF (envmap, Envmap, Envmap)
226
227
228//
229// keyCode -- for motion picture film frames. Identifies film
230// manufacturer, film type, film roll and frame position within
231// the roll.
232//
233
234IMF_STD_ATTRIBUTE_DEF (keyCode, KeyCode, KeyCode)
235
236
237//
238// timeCode -- time and control code
239//
240
241IMF_STD_ATTRIBUTE_DEF (timeCode, TimeCode, TimeCode)
242
243
244//
245// wrapmodes -- determines how texture map images are extrapolated.
246// If an OpenEXR file is used as a texture map for 3D rendering,
247// texture coordinates (0.0, 0.0) and (1.0, 1.0) correspond to
248// the upper left and lower right corners of the data window.
249// If the image is mapped onto a surface with texture coordinates
250// outside the zero-to-one range, then the image must be extrapolated.
251// This attribute tells the renderer how to do this extrapolation.
252// The attribute contains either a pair of comma-separated keywords,
253// to specify separate extrapolation modes for the horizontal and
254// vertical directions; or a single keyword, to specify extrapolation
255// in both directions (e.g. "clamp,periodic" or "clamp"). Extra white
256// space surrounding the keywords is allowed, but should be ignored
257// by the renderer ("clamp, black " is equivalent to "clamp,black").
258// The keywords listed below are predefined; some renderers may support
259// additional extrapolation modes:
260//
261// black pixels outside the zero-to-one range are black
262//
263// clamp texture coordinates less than 0.0 and greater
264// than 1.0 are clamped to 0.0 and 1.0 respectively
265//
266// periodic the texture image repeats periodically
267//
268// mirror the texture image repeats periodically, but
269// every other instance is mirrored
270//
271
272IMF_STD_ATTRIBUTE_DEF (wrapmodes, Wrapmodes, std::string)
273
274
275//
276// framesPerSecond -- defines the nominal playback frame rate for image
277// sequences, in frames per second. Every image in a sequence should
278// have a framesPerSecond attribute, and the attribute value should be
279// the same for all images in the sequence. If an image sequence has
280// no framesPerSecond attribute, playback software should assume that
281// the frame rate for the sequence is 24 frames per second.
282//
283// In order to allow exact representation of NTSC frame and field rates,
284// framesPerSecond is stored as a rational number. A rational number is
285// a pair of integers, n and d, that represents the value n/d.
286//
287// For the exact values of commonly used frame rates, please see header
288// file ImfFramesPerSecond.h.
289//
290
291IMF_STD_ATTRIBUTE_DEF (framesPerSecond, FramesPerSecond, Rational)
292
293
294//
295// multiView -- defines the view names for multi-view image files.
296// A multi-view image contains two or more views of the same scene,
297// as seen from different viewpoints, for example a left-eye and
298// a right-eye view for stereo displays. The multiView attribute
299// lists the names of the views in an image, and a naming convention
300// identifies the channels that belong to each view.
301//
302// For details, please see header file ImfMultiView.h
303//
304
305IMF_STD_ATTRIBUTE_DEF (multiView , MultiView, StringVector)
306
307
308//
309// worldToCamera -- for images generated by 3D computer graphics rendering,
310// a matrix that transforms 3D points from the world to the camera coordinate
311// space of the renderer.
312//
313// The camera coordinate space is left-handed. Its origin indicates the
314// location of the camera. The positive x and y axes correspond to the
315// "right" and "up" directions in the rendered image. The positive z
316// axis indicates the camera's viewing direction. (Objects in front of
317// the camera have positive z coordinates.)
318//
319// Camera coordinate space in OpenEXR is the same as in Pixar's Renderman.
320//
321
322IMF_STD_ATTRIBUTE_DEF (worldToCamera, WorldToCamera, IMATH_NAMESPACE::M44f)
323
324
325//
326// worldToNDC -- for images generated by 3D computer graphics rendering, a
327// matrix that transforms 3D points from the world to the Normalized Device
328// Coordinate (NDC) space of the renderer.
329//
330// NDC is a 2D coordinate space that corresponds to the image plane, with
331// positive x and pointing to the right and y positive pointing down. The
332// coordinates (0, 0) and (1, 1) correspond to the upper left and lower right
333// corners of the OpenEXR display window.
334//
335// To transform a 3D point in word space into a 2D point in NDC space,
336// multiply the 3D point by the worldToNDC matrix and discard the z
337// coordinate.
338//
339// NDC space in OpenEXR is the same as in Pixar's Renderman.
340//
341
342IMF_STD_ATTRIBUTE_DEF (worldToNDC, WorldToNDC, IMATH_NAMESPACE::M44f)
343
344
345//
346// deepImageState -- specifies whether the pixels in a deep image are
347// sorted and non-overlapping.
348//
349// Note: this attribute can be set by application code that writes a file
350// in order to tell applications that read the file whether the pixel data
351// must be cleaned up prior to image processing operations such as flattening.
352// The IlmImf library does not verify that the attribute is consistent with
353// the actual state of the pixels. Application software may assume that the
354// attribute is valid, as long as the software will not crash or lock up if
355// any pixels are inconsistent with the deepImageState attribute.
356//
357
358IMF_STD_ATTRIBUTE_DEF (deepImageState, DeepImageState, DeepImageState)
359
360#endif
361