diff --git a/.gitignore b/.gitignore index f041276..1404b35 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ [bB]uild/ +.DS_Store # CMake files CMakeFiles/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 314d42c..d0eaf98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ # IMPLEMENTATION, OR APPLICATIONS THEREOF, HELD BY PARTIES OTHER THAN # A.M.P.A.S., WHETHER DISCLOSED OR UNDISCLOSED. -cmake_minimum_required (VERSION 2.6) +cmake_minimum_required (VERSION 3.1) project (AcesContainer) include (GenerateExportHeader) @@ -66,7 +66,7 @@ if( WIN32 AND NOT CYGWIN ) set(DEF_INSTALL_CMAKE_DIR CMake) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0" ) else() - set(DEF_INSTALL_CMAKE_DIR lib/CMake/AcesContainer) + set(DEF_INSTALL_CMAKE_DIR lib/cmake/AcesContainer) endif() set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Install directory for project CMake files" ) @@ -135,14 +135,7 @@ include_directories( # Add all targets to the build-tree export set export(TARGETS AcesContainer FILE "${PROJECT_BINARY_DIR}/AcesContainerTargets.cmake") -# export(TARGETS AcesContainer_lib -# FILE "${PROJECT_BINARY_DIR}/AcesContainerTargets.cmake") -# Export the package for use from the build-tree -# (this registers the build-tree with a global CMake-registry) -export(PACKAGE AcesContainer) -# export(PACKAGE AcesContainer_lib) - # Create the FooBarConfig.cmake and FooBarConfigVersion files file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}") @@ -154,7 +147,7 @@ configure_file(config/AcesContainerConfig.cmake.in "${PROJECT_BINARY_DIR}/AcesContainerConfig.cmake" @ONLY) # ... for the install tree -set(CONF_INCLUDE_DIRS "\${AcesContainer_CMAKE_DIR}/${REL_INCLUDE_DIR}" "\${AcesContainer_CMAKE_DIR}/${REL_INCLUDE_DIR}/aces") +set(CONF_INCLUDE_DIRS "${INSTALL_INCLUDE_DIR}") set(CONF_LIB_DIRS "${INSTALL_LIB_DIR}") configure_file(config/AcesContainerConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AcesContainerConfig.cmake" @ONLY) diff --git a/aces_attributestructs.cpp b/aces_attributestructs.cpp index 24c02e4..9179d4e 100644 --- a/aces_attributestructs.cpp +++ b/aces_attributestructs.cpp @@ -228,7 +228,6 @@ acesImageContainerFlag ( 1 ), pixelAspectRatio ( 1.0f ), screenWindowWidth ( 1.0f ), - // initialize optional attributes to "ignored" values altitude ( 0.0f ), aperture ( 0.0f ), @@ -248,7 +247,6 @@ orientation ( 0 ), originalImageFlag ( -1 ), timecodeRate ( 0 ), utcOffset ( 0.0f ) - { // initialize required attributes to required values Chromaticities = ChromaticitiesForACES; diff --git a/aces_attributestructs.h b/aces_attributestructs.h index f28981f..e61db1c 100644 --- a/aces_attributestructs.h +++ b/aces_attributestructs.h @@ -305,7 +305,6 @@ struct acesHeaderInfo { timecode timeCode; // TIFF tag 51043 string uuid; // TIFF tag 42016 ImageUniqueID - // sample custom (TIFF/EP) attributes not defined in the ACES spec string artist; // TIFF tag 315 artist string copyright; // TIFF tag 33432 copyright diff --git a/aces_writeattributes.cpp b/aces_writeattributes.cpp index 0e08ebd..92345b5 100755 --- a/aces_writeattributes.cpp +++ b/aces_writeattributes.cpp @@ -107,6 +107,31 @@ #include +#define check_wrtAttr(condition, attribute, value) \ + if (condition) wrtAttr(attribute, value) + +#define check_multiview(value) ((value).size() > 0) + +#define check_keycode(value) ((value).filmMfcCode > 0 || \ + (value).filmType > 0 || \ + (value).prefix > 0 || \ + (value).count > 0 || \ + (value).perfOffset > 0 || \ + (value).perfsPerFrame > 0 || \ + (value).perfsPerCount > 0) + +#define check_timecode(value) ((value).timeAndFlags > 0 || \ + (value).userData > 0) + +#define check_v3f(value) ((value).x != 0.0 || \ + (value).y != 0.0 || \ + (value).z != 0.0) + +#define check_float(value) (value != 0.0f) +#define check_int32(value) (value != 0) +#define check_string(value) ((value).size()) +#define check_srational(value) (value.d != 0.0) + using namespace std; // ===================================================================== @@ -616,17 +641,73 @@ void aces_writeattributes:: writeHeader ( acesHeaderInfo & hi, writeMagicNumberAndVersion (); // required aces attributes - wrtAttr ( "acesImageContainerFlag", hi.acesImageContainerFlag ); - wrtAttr ( "channels", hi.channels ); - wrtAttr ( "chromaticities", hi.Chromaticities ); - wrtAttr ( "compression", hi.Compression ); - wrtAttr ( "dataWindow", hi.dataWindow ); - wrtAttr ( "displayWindow", hi.displayWindow ); - wrtAttr ( "lineOrder", hi.LineOrder ); - wrtAttr ( "pixelAspectRatio", hi.pixelAspectRatio ); - wrtAttr ( "screenWindowCenter", hi.screenWindowCenter ); - wrtAttr ( "screenWindowWidth", hi.screenWindowWidth ); - + wrtAttr ( "acesImageContainerFlag", hi.acesImageContainerFlag ); + wrtAttr ( "channels", hi.channels ); + wrtAttr ( "chromaticities", hi.Chromaticities ); + wrtAttr ( "compression", hi.Compression ); + wrtAttr ( "dataWindow", hi.dataWindow ); + wrtAttr ( "displayWindow", hi.displayWindow ); + wrtAttr ( "lineOrder", hi.LineOrder ); + wrtAttr ( "pixelAspectRatio", hi.pixelAspectRatio ); + wrtAttr ( "screenWindowCenter", hi.screenWindowCenter ); + wrtAttr ( "screenWindowWidth", hi.screenWindowWidth ); + + // aces conditional attributes + check_wrtAttr(check_float(hi.altitude), "altitude", hi.altitude); + check_wrtAttr(check_float(hi.aperture), "aperture", hi.aperture); + check_wrtAttr(check_string(hi.cameraFirmwareVersion), "cameraFirmwareVersion", hi.cameraFirmwareVersion); + check_wrtAttr(check_string(hi.cameraIdentifier), "cameraIdentifier", hi.cameraIdentifier); + check_wrtAttr(check_string(hi.cameraLabel), "cameraLabel", hi.cameraLabel); + check_wrtAttr(check_string(hi.cameraMake), "cameraMake", hi.cameraMake); + check_wrtAttr(check_string(hi.cameraModel), "cameraModel", hi.cameraModel); + check_wrtAttr(check_v3f(hi.cameraUpDirection), "cameraUpDirection", hi.cameraUpDirection); + check_wrtAttr(check_v3f(hi.cameraViewingDirection), "cameraUpDirection", hi.cameraUpDirection); + check_wrtAttr(check_v3f(hi.cameraPosition), "cameraUpDirection", hi.cameraUpDirection); + check_wrtAttr(check_string(hi.cameraSerialNumber), "cameraUpDirection", hi.cameraUpDirection); + check_wrtAttr(check_srational(hi.captureRate), "captureRate", hi.captureRate); + check_wrtAttr(check_float(hi.convergenceDistance), "convergenceDistance", hi.convergenceDistance); + check_wrtAttr(check_float(hi.expTime), "expTime", hi.expTime); + check_wrtAttr(check_float(hi.focalLength), "focalLength", hi.focalLength); + check_wrtAttr(check_float(hi.focus), "focus", hi.focus); + check_wrtAttr(check_srational(hi.framesPerSecond), "framesPerSecond", hi.framesPerSecond); + check_wrtAttr(check_string(hi.free), "free", hi.free); + check_wrtAttr(check_string(hi.headerChecksum), "headerChecksum", hi.headerChecksum); + check_wrtAttr(check_string(hi.imageChecksum), "imageChecksum", hi.imageChecksum); + check_wrtAttr(check_float(hi.imageRotation), "imageRotation", hi.imageRotation); + check_wrtAttr(check_float(hi.interocularDistance), "interocularDistance", hi.interocularDistance); + check_wrtAttr(check_float(hi.isoSpeed), "isoSpeed", hi.isoSpeed); + check_wrtAttr(check_float(hi.latitude), "latitude", hi.latitude); + check_wrtAttr(check_string(hi.lensAttributes), "lensAttributes", hi.lensAttributes); + check_wrtAttr(check_string(hi.lensMake), "lensMake", hi.lensMake); + check_wrtAttr(check_string(hi.lensModel), "lensModel", hi.lensModel); + check_wrtAttr(check_string(hi.lensSerialNumber), "lensSerialNumber", hi.lensSerialNumber); + check_wrtAttr(check_float(hi.longitude), "longitude", hi.longitude); + check_wrtAttr(check_multiview(hi.multiView), "multiView", hi.multiView); + check_wrtAttr(check_int32(hi.originalImageFlag), "originalImageFlag", hi.originalImageFlag); + check_wrtAttr(check_string(hi.owner), "owner", hi.owner); + check_wrtAttr(check_string(hi.recorderFirmwareVersion), "recorderFirmwareVersion", hi.recorderFirmwareVersion); + check_wrtAttr(check_string(hi.recorderMake), "recorderMake", hi.recorderMake); + check_wrtAttr(check_string(hi.recorderModel), "recorderModel", hi.recorderModel); + check_wrtAttr(check_string(hi.recorderSerialNumber), "recorderSerialNumber", hi.recorderSerialNumber); + check_wrtAttr(check_string(hi.reelName), "reelName", hi.reelName); + check_wrtAttr(check_string(hi.storageMediaSerialNumber),"storageMediaSerialNumber", hi.storageMediaSerialNumber); + check_wrtAttr(check_int32(hi.timecodeRate), "timecodeRate", hi.timecodeRate); + check_wrtAttr(check_float(hi.utcOffset), "utcOffset", hi.utcOffset); + + // aces conditional dynamic attributes + check_wrtAttr(check_string(hi.capDate), "capDate", hi.capDate); + check_wrtAttr(check_int32(hi.imageCounter), "imageCounter", hi.imageCounter); + check_wrtAttr(check_keycode(hi.keyCode), "keyCode", hi.keyCode); + check_wrtAttr(check_timecode(hi.timeCode), "timeCode", hi.timeCode); + check_wrtAttr(check_string(hi.uuid), "lensAttributes", hi.lensAttributes); + + // aces conditional custom (TIFF/EP) attributes + check_wrtAttr(check_string(hi.artist), "artist", hi.artist); + check_wrtAttr(check_string(hi.copyright), "copyright", hi.copyright); + check_wrtAttr(check_string(hi.dateTime), "dateTime", hi.dateTime); + check_wrtAttr(check_int32(hi.orientation), "orientation", hi.orientation); + check_wrtAttr(check_string(hi.software), "software", hi.software); + // terminator writeChar ( 0 );