ImfStandardAttributes.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. #ifndef INCLUDED_IMF_STANDARD_ATTRIBUTES_H
  35. #define INCLUDED_IMF_STANDARD_ATTRIBUTES_H
  36. //-----------------------------------------------------------------------------
  37. //
  38. // Optional Standard Attributes -- these attributes are "optional"
  39. // because not every image file header has them, but they define a
  40. // "standard" way to represent commonly used data in the file header.
  41. //
  42. // For each attribute, with name "foo", and type "T", the following
  43. // functions are automatically generated via macros:
  44. //
  45. // void addFoo (Header &header, const T &value);
  46. // bool hasFoo (const Header &header);
  47. // const TypedAttribute<T> & fooAttribute (const Header &header);
  48. // TypedAttribute<T> & fooAttribute (Header &header);
  49. // const T & foo (const Header &Header);
  50. // T & foo (Header &Header);
  51. //
  52. //-----------------------------------------------------------------------------
  53. #include "ImfHeader.h"
  54. #include "ImfBoxAttribute.h"
  55. #include "ImfChromaticitiesAttribute.h"
  56. #include "ImfEnvmapAttribute.h"
  57. #include "ImfDeepImageStateAttribute.h"
  58. #include "ImfFloatAttribute.h"
  59. #include "ImfKeyCodeAttribute.h"
  60. #include "ImfMatrixAttribute.h"
  61. #include "ImfRationalAttribute.h"
  62. #include "ImfStringAttribute.h"
  63. #include "ImfStringVectorAttribute.h"
  64. #include "ImfTimeCodeAttribute.h"
  65. #include "ImfVecAttribute.h"
  66. #include "ImfNamespace.h"
  67. #include "ImfExport.h"
  68. #define IMF_STD_ATTRIBUTE_DEF(name,suffix,object) \
  69. \
  70. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER \
  71. IMF_EXPORT void add##suffix (Header &header, const object &v); \
  72. IMF_EXPORT bool has##suffix (const Header &header); \
  73. IMF_EXPORT const TypedAttribute<object> & \
  74. name##Attribute (const Header &header); \
  75. IMF_EXPORT TypedAttribute<object> & \
  76. name##Attribute (Header &header); \
  77. IMF_EXPORT const object & \
  78. name (const Header &header); \
  79. IMF_EXPORT object & name (Header &header); \
  80. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT \
  81. //
  82. // chromaticities -- for RGB images, specifies the CIE (x,y)
  83. // chromaticities of the primaries and the white point
  84. //
  85. IMF_STD_ATTRIBUTE_DEF (chromaticities, Chromaticities, Chromaticities)
  86. //
  87. // whiteLuminance -- for RGB images, defines the luminance, in Nits
  88. // (candelas per square meter) of the RGB value (1.0, 1.0, 1.0).
  89. //
  90. // If the chromaticities and the whiteLuminance of an RGB image are
  91. // known, then it is possible to convert the image's pixels from RGB
  92. // to CIE XYZ tristimulus values (see function RGBtoXYZ() in header
  93. // file ImfChromaticities.h).
  94. //
  95. //
  96. IMF_STD_ATTRIBUTE_DEF (whiteLuminance, WhiteLuminance, float)
  97. //
  98. // adoptedNeutral -- specifies the CIE (x,y) coordinates that should
  99. // be considered neutral during color rendering. Pixels in the image
  100. // file whose (x,y) coordinates match the adoptedNeutral value should
  101. // be mapped to neutral values on the display.
  102. //
  103. IMF_STD_ATTRIBUTE_DEF (adoptedNeutral, AdoptedNeutral, IMATH_NAMESPACE::V2f)
  104. //
  105. // renderingTransform, lookModTransform -- specify the names of the
  106. // CTL functions that implements the intended color rendering and look
  107. // modification transforms for this image.
  108. //
  109. IMF_STD_ATTRIBUTE_DEF (renderingTransform, RenderingTransform, std::string)
  110. IMF_STD_ATTRIBUTE_DEF (lookModTransform, LookModTransform, std::string)
  111. //
  112. // xDensity -- horizontal output density, in pixels per inch.
  113. // The image's vertical output density is xDensity * pixelAspectRatio.
  114. //
  115. IMF_STD_ATTRIBUTE_DEF (xDensity, XDensity, float)
  116. //
  117. // owner -- name of the owner of the image
  118. //
  119. IMF_STD_ATTRIBUTE_DEF (owner, Owner, std::string)
  120. //
  121. // comments -- additional image information in human-readable
  122. // form, for example a verbal description of the image
  123. //
  124. IMF_STD_ATTRIBUTE_DEF (comments, Comments, std::string)
  125. //
  126. // capDate -- the date when the image was created or captured,
  127. // in local time, and formatted as
  128. //
  129. // YYYY:MM:DD hh:mm:ss
  130. //
  131. // where YYYY is the year (4 digits, e.g. 2003), MM is the month
  132. // (2 digits, 01, 02, ... 12), DD is the day of the month (2 digits,
  133. // 01, 02, ... 31), hh is the hour (2 digits, 00, 01, ... 23), mm
  134. // is the minute, and ss is the second (2 digits, 00, 01, ... 59).
  135. //
  136. //
  137. IMF_STD_ATTRIBUTE_DEF (capDate, CapDate, std::string)
  138. //
  139. // utcOffset -- offset of local time at capDate from
  140. // Universal Coordinated Time (UTC), in seconds:
  141. //
  142. // UTC == local time + utcOffset
  143. //
  144. IMF_STD_ATTRIBUTE_DEF (utcOffset, UtcOffset, float)
  145. //
  146. // longitude, latitude, altitude -- for images of real objects, the
  147. // location where the image was recorded. Longitude and latitude are
  148. // in degrees east of Greenwich and north of the equator. Altitude
  149. // is in meters above sea level. For example, Kathmandu, Nepal is
  150. // at longitude 85.317, latitude 27.717, altitude 1305.
  151. //
  152. IMF_STD_ATTRIBUTE_DEF (longitude, Longitude, float)
  153. IMF_STD_ATTRIBUTE_DEF (latitude, Latitude, float)
  154. IMF_STD_ATTRIBUTE_DEF (altitude, Altitude, float)
  155. //
  156. // focus -- the camera's focus distance, in meters
  157. //
  158. IMF_STD_ATTRIBUTE_DEF (focus, Focus, float)
  159. //
  160. // exposure -- exposure time, in seconds
  161. //
  162. IMF_STD_ATTRIBUTE_DEF (expTime, ExpTime, float)
  163. //
  164. // aperture -- the camera's lens aperture, in f-stops (focal length
  165. // of the lens divided by the diameter of the iris opening)
  166. //
  167. IMF_STD_ATTRIBUTE_DEF (aperture, Aperture, float)
  168. //
  169. // isoSpeed -- the ISO speed of the film or image sensor
  170. // that was used to record the image
  171. //
  172. IMF_STD_ATTRIBUTE_DEF (isoSpeed, IsoSpeed, float)
  173. //
  174. // envmap -- if this attribute is present, the image represents
  175. // an environment map. The attribute's value defines how 3D
  176. // directions are mapped to 2D pixel locations. For details
  177. // see header file ImfEnvmap.h
  178. //
  179. IMF_STD_ATTRIBUTE_DEF (envmap, Envmap, Envmap)
  180. //
  181. // keyCode -- for motion picture film frames. Identifies film
  182. // manufacturer, film type, film roll and frame position within
  183. // the roll.
  184. //
  185. IMF_STD_ATTRIBUTE_DEF (keyCode, KeyCode, KeyCode)
  186. //
  187. // timeCode -- time and control code
  188. //
  189. IMF_STD_ATTRIBUTE_DEF (timeCode, TimeCode, TimeCode)
  190. //
  191. // wrapmodes -- determines how texture map images are extrapolated.
  192. // If an OpenEXR file is used as a texture map for 3D rendering,
  193. // texture coordinates (0.0, 0.0) and (1.0, 1.0) correspond to
  194. // the upper left and lower right corners of the data window.
  195. // If the image is mapped onto a surface with texture coordinates
  196. // outside the zero-to-one range, then the image must be extrapolated.
  197. // This attribute tells the renderer how to do this extrapolation.
  198. // The attribute contains either a pair of comma-separated keywords,
  199. // to specify separate extrapolation modes for the horizontal and
  200. // vertical directions; or a single keyword, to specify extrapolation
  201. // in both directions (e.g. "clamp,periodic" or "clamp"). Extra white
  202. // space surrounding the keywords is allowed, but should be ignored
  203. // by the renderer ("clamp, black " is equivalent to "clamp,black").
  204. // The keywords listed below are predefined; some renderers may support
  205. // additional extrapolation modes:
  206. //
  207. // black pixels outside the zero-to-one range are black
  208. //
  209. // clamp texture coordinates less than 0.0 and greater
  210. // than 1.0 are clamped to 0.0 and 1.0 respectively
  211. //
  212. // periodic the texture image repeats periodically
  213. //
  214. // mirror the texture image repeats periodically, but
  215. // every other instance is mirrored
  216. //
  217. IMF_STD_ATTRIBUTE_DEF (wrapmodes, Wrapmodes, std::string)
  218. //
  219. // framesPerSecond -- defines the nominal playback frame rate for image
  220. // sequences, in frames per second. Every image in a sequence should
  221. // have a framesPerSecond attribute, and the attribute value should be
  222. // the same for all images in the sequence. If an image sequence has
  223. // no framesPerSecond attribute, playback software should assume that
  224. // the frame rate for the sequence is 24 frames per second.
  225. //
  226. // In order to allow exact representation of NTSC frame and field rates,
  227. // framesPerSecond is stored as a rational number. A rational number is
  228. // a pair of integers, n and d, that represents the value n/d.
  229. //
  230. // For the exact values of commonly used frame rates, please see header
  231. // file ImfFramesPerSecond.h.
  232. //
  233. IMF_STD_ATTRIBUTE_DEF (framesPerSecond, FramesPerSecond, Rational)
  234. //
  235. // multiView -- defines the view names for multi-view image files.
  236. // A multi-view image contains two or more views of the same scene,
  237. // as seen from different viewpoints, for example a left-eye and
  238. // a right-eye view for stereo displays. The multiView attribute
  239. // lists the names of the views in an image, and a naming convention
  240. // identifies the channels that belong to each view.
  241. //
  242. // For details, please see header file ImfMultiView.h
  243. //
  244. IMF_STD_ATTRIBUTE_DEF (multiView , MultiView, StringVector)
  245. //
  246. // worldToCamera -- for images generated by 3D computer graphics rendering,
  247. // a matrix that transforms 3D points from the world to the camera coordinate
  248. // space of the renderer.
  249. //
  250. // The camera coordinate space is left-handed. Its origin indicates the
  251. // location of the camera. The positive x and y axes correspond to the
  252. // "right" and "up" directions in the rendered image. The positive z
  253. // axis indicates the camera's viewing direction. (Objects in front of
  254. // the camera have positive z coordinates.)
  255. //
  256. // Camera coordinate space in OpenEXR is the same as in Pixar's Renderman.
  257. //
  258. IMF_STD_ATTRIBUTE_DEF (worldToCamera, WorldToCamera, IMATH_NAMESPACE::M44f)
  259. //
  260. // worldToNDC -- for images generated by 3D computer graphics rendering, a
  261. // matrix that transforms 3D points from the world to the Normalized Device
  262. // Coordinate (NDC) space of the renderer.
  263. //
  264. // NDC is a 2D coordinate space that corresponds to the image plane, with
  265. // positive x and pointing to the right and y positive pointing down. The
  266. // coordinates (0, 0) and (1, 1) correspond to the upper left and lower right
  267. // corners of the OpenEXR display window.
  268. //
  269. // To transform a 3D point in word space into a 2D point in NDC space,
  270. // multiply the 3D point by the worldToNDC matrix and discard the z
  271. // coordinate.
  272. //
  273. // NDC space in OpenEXR is the same as in Pixar's Renderman.
  274. //
  275. IMF_STD_ATTRIBUTE_DEF (worldToNDC, WorldToNDC, IMATH_NAMESPACE::M44f)
  276. //
  277. // deepImageState -- specifies whether the pixels in a deep image are
  278. // sorted and non-overlapping.
  279. //
  280. // Note: this attribute can be set by application code that writes a file
  281. // in order to tell applications that read the file whether the pixel data
  282. // must be cleaned up prior to image processing operations such as flattening.
  283. // The IlmImf library does not verify that the attribute is consistent with
  284. // the actual state of the pixels. Application software may assume that the
  285. // attribute is valid, as long as the software will not crash or lock up if
  286. // any pixels are inconsistent with the deepImageState attribute.
  287. //
  288. IMF_STD_ATTRIBUTE_DEF (deepImageState, DeepImageState, DeepImageState)
  289. //
  290. // originalDataWindow -- if application software crops an image, then it
  291. // should save the data window of the original, un-cropped image in the
  292. // originalDataWindow attribute.
  293. //
  294. IMF_STD_ATTRIBUTE_DEF
  295. (originalDataWindow, OriginalDataWindow, IMATH_NAMESPACE::Box2i)
  296. //
  297. // dwaCompressionLevel -- sets the quality level for images compressed
  298. // with the DWAA or DWAB method.
  299. //
  300. IMF_STD_ATTRIBUTE_DEF (dwaCompressionLevel, DwaCompressionLevel, float)
  301. #endif