From 11448c73dc7185706e6b4822c36ee483b50e98e3 Mon Sep 17 00:00:00 2001 From: Mikael Sundell Date: Thu, 29 Jun 2023 20:19:57 +0200 Subject: [PATCH 1/5] Update to cmake_minimum_required Added write for option for optional, dynamic and custom attribute types --- CMakeLists.txt | 2 +- aces_attributestructs.cpp | 5 +++- aces_attributestructs.h | 4 ++- aces_writeattributes.cpp | 56 ++++++++++++++++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 314d42c..5b3121f 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) diff --git a/aces_attributestructs.cpp b/aces_attributestructs.cpp index 24c02e4..0ed92d1 100644 --- a/aces_attributestructs.cpp +++ b/aces_attributestructs.cpp @@ -247,7 +247,10 @@ longitude ( 0.0f ), orientation ( 0 ), originalImageFlag ( -1 ), timecodeRate ( 0 ), -utcOffset ( 0.0f ) +utcOffset ( 0.0f ), +optionalAttributes ( false ), +dynamicAttributes ( false ), +customAttributes ( false ) { // initialize required attributes to required values diff --git a/aces_attributestructs.h b/aces_attributestructs.h index f28981f..048a73f 100644 --- a/aces_attributestructs.h +++ b/aces_attributestructs.h @@ -297,6 +297,7 @@ struct acesHeaderInfo { string storageMediaSerialNumber; int32 timecodeRate; // fps float utcOffset; // -seconds, = (UTC time - local time) TIFF tag 34858 + bool optionalAttributes; // // dynamic == expected to be unique for each image string capDate; // YYYY:MM:DD hh:mm:ss = capture time = TIFF tag 36867 dateTimeOriginal @@ -304,7 +305,7 @@ struct acesHeaderInfo { keycode keyCode; timecode timeCode; // TIFF tag 51043 string uuid; // TIFF tag 42016 ImageUniqueID - + bool dynamicAttributes; // // sample custom (TIFF/EP) attributes not defined in the ACES spec string artist; // TIFF tag 315 artist @@ -312,6 +313,7 @@ struct acesHeaderInfo { string dateTime; // YYYY-MM-DDThh:mm:ssTZ when THIS file was created TIFF 306 dateTime int32 orientation; // flipped, rotated TIFF tag 274 orientation string software; // TIFF tag 305 software + bool customAttributes; // }; ostream& operator<< ( ostream& s, const acesHeaderInfo& v ); diff --git a/aces_writeattributes.cpp b/aces_writeattributes.cpp index 0e08ebd..28f710c 100755 --- a/aces_writeattributes.cpp +++ b/aces_writeattributes.cpp @@ -626,7 +626,61 @@ void aces_writeattributes:: writeHeader ( acesHeaderInfo & hi, wrtAttr ( "pixelAspectRatio", hi.pixelAspectRatio ); wrtAttr ( "screenWindowCenter", hi.screenWindowCenter ); wrtAttr ( "screenWindowWidth", hi.screenWindowWidth ); - + + // optional attributes + if ( hi.optionalAttributes ) { + wrtAttr ( "altitude", hi.altitude ); + wrtAttr ( "aperture", hi.aperture ); + wrtAttr ( "cameraFirmwareVersion", hi.cameraFirmwareVersion ); + wrtAttr ( "cameraIdentifier", hi.cameraIdentifier ); + wrtAttr ( "cameraLabel", hi.cameraLabel ); + wrtAttr ( "cameraMake", hi.cameraMake ); + wrtAttr ( "cameraModel", hi.cameraModel ); + wrtAttr ( "cameraUpDirection", hi.cameraUpDirection ); + wrtAttr ( "cameraViewingDirection", hi.cameraViewingDirection ); + wrtAttr ( "cameraPosition", hi.cameraPosition ); + wrtAttr ( "cameraSerialNumber", hi.cameraSerialNumber ); + wrtAttr ( "captureRate", hi.captureRate ); + wrtAttr ( "comments", hi.comments ); + wrtAttr ( "convergenceDistance", hi.convergenceDistance ); + wrtAttr ( "expTime", hi.expTime ); + wrtAttr ( "focalLength", hi.focalLength ); + wrtAttr ( "focus", hi.focus ); + wrtAttr ( "framesPerSecond", hi.framesPerSecond ); + wrtAttr ( "free", hi.free ); + wrtAttr ( "headerChecksum", hi.headerChecksum ); + wrtAttr ( "imageChecksum", hi.imageChecksum ); + wrtAttr ( "imageCounter", hi.imageCounter ); + wrtAttr ( "imageRotation", hi.imageRotation ); + wrtAttr ( "interocularDistance", hi.interocularDistance ); + wrtAttr ( "isoSpeed", hi.isoSpeed ); + wrtAttr ( "latitude", hi.latitude ); + wrtAttr ( "lensAttributes", hi.lensAttributes ); + wrtAttr ( "lensMake", hi.lensMake ); + wrtAttr ( "lensModel", hi.lensModel ); + wrtAttr ( "lensSerialNumber", hi.lensSerialNumber ); + wrtAttr ( "longitude", hi.longitude ); + } + + // dynamic attributes + if ( hi.dynamicAttributes ) { + wrtAttr ( "capDate", hi.capDate ); + wrtAttr ( "imageCounter", hi.imageCounter ); + wrtAttr ( "keyCode", hi.keyCode ); + wrtAttr ( "timeCode", hi.timeCode ); + wrtAttr ( "uuid", hi.uuid ); + } + + // custom attributes + if ( hi.customAttributes ) { + wrtAttr ( "artist", hi.artist ); + wrtAttr ( "copyright", hi.copyright ); + wrtAttr ( "creator", hi.creator ); + wrtAttr ( "dateTime", hi.dateTime ); + wrtAttr ( "orientation", hi.orientation ); + wrtAttr ( "software", hi.software ); + } + // terminator writeChar ( 0 ); From c94716086e982d345e736d7a46dccaf7d36526c5 Mon Sep 17 00:00:00 2001 From: Mikael Sundell Date: Fri, 30 Jun 2023 18:40:20 +0200 Subject: [PATCH 2/5] Fixes for better attribute writes now ignores empty values --- aces_attributestructs.cpp | 7 +- aces_writeattributes.cpp | 151 ++++++++++++++++++++++---------------- 2 files changed, 90 insertions(+), 68 deletions(-) diff --git a/aces_attributestructs.cpp b/aces_attributestructs.cpp index 0ed92d1..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 ), @@ -247,11 +246,7 @@ longitude ( 0.0f ), orientation ( 0 ), originalImageFlag ( -1 ), timecodeRate ( 0 ), -utcOffset ( 0.0f ), -optionalAttributes ( false ), -dynamicAttributes ( false ), -customAttributes ( false ) - +utcOffset ( 0.0f ) { // initialize required attributes to required values Chromaticities = ChromaticitiesForACES; diff --git a/aces_writeattributes.cpp b/aces_writeattributes.cpp index 28f710c..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,71 +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); - // optional attributes - if ( hi.optionalAttributes ) { - wrtAttr ( "altitude", hi.altitude ); - wrtAttr ( "aperture", hi.aperture ); - wrtAttr ( "cameraFirmwareVersion", hi.cameraFirmwareVersion ); - wrtAttr ( "cameraIdentifier", hi.cameraIdentifier ); - wrtAttr ( "cameraLabel", hi.cameraLabel ); - wrtAttr ( "cameraMake", hi.cameraMake ); - wrtAttr ( "cameraModel", hi.cameraModel ); - wrtAttr ( "cameraUpDirection", hi.cameraUpDirection ); - wrtAttr ( "cameraViewingDirection", hi.cameraViewingDirection ); - wrtAttr ( "cameraPosition", hi.cameraPosition ); - wrtAttr ( "cameraSerialNumber", hi.cameraSerialNumber ); - wrtAttr ( "captureRate", hi.captureRate ); - wrtAttr ( "comments", hi.comments ); - wrtAttr ( "convergenceDistance", hi.convergenceDistance ); - wrtAttr ( "expTime", hi.expTime ); - wrtAttr ( "focalLength", hi.focalLength ); - wrtAttr ( "focus", hi.focus ); - wrtAttr ( "framesPerSecond", hi.framesPerSecond ); - wrtAttr ( "free", hi.free ); - wrtAttr ( "headerChecksum", hi.headerChecksum ); - wrtAttr ( "imageChecksum", hi.imageChecksum ); - wrtAttr ( "imageCounter", hi.imageCounter ); - wrtAttr ( "imageRotation", hi.imageRotation ); - wrtAttr ( "interocularDistance", hi.interocularDistance ); - wrtAttr ( "isoSpeed", hi.isoSpeed ); - wrtAttr ( "latitude", hi.latitude ); - wrtAttr ( "lensAttributes", hi.lensAttributes ); - wrtAttr ( "lensMake", hi.lensMake ); - wrtAttr ( "lensModel", hi.lensModel ); - wrtAttr ( "lensSerialNumber", hi.lensSerialNumber ); - wrtAttr ( "longitude", hi.longitude ); - } + // 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); - // dynamic attributes - if ( hi.dynamicAttributes ) { - wrtAttr ( "capDate", hi.capDate ); - wrtAttr ( "imageCounter", hi.imageCounter ); - wrtAttr ( "keyCode", hi.keyCode ); - wrtAttr ( "timeCode", hi.timeCode ); - wrtAttr ( "uuid", hi.uuid ); - } + // 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); - // custom attributes - if ( hi.customAttributes ) { - wrtAttr ( "artist", hi.artist ); - wrtAttr ( "copyright", hi.copyright ); - wrtAttr ( "creator", hi.creator ); - wrtAttr ( "dateTime", hi.dateTime ); - wrtAttr ( "orientation", hi.orientation ); - wrtAttr ( "software", hi.software ); - } - // terminator writeChar ( 0 ); From eabe46c507c7b3567c7ba2e2c4720eebaffa1134 Mon Sep 17 00:00:00 2001 From: Mikael Sundell Date: Sun, 16 Jul 2023 12:56:19 +0200 Subject: [PATCH 3/5] Removed optional, dynamic and custom attribute booleans, no longer needed --- .gitignore | 1 + aces_attributestructs.h | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) 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/aces_attributestructs.h b/aces_attributestructs.h index 048a73f..e61db1c 100644 --- a/aces_attributestructs.h +++ b/aces_attributestructs.h @@ -297,7 +297,6 @@ struct acesHeaderInfo { string storageMediaSerialNumber; int32 timecodeRate; // fps float utcOffset; // -seconds, = (UTC time - local time) TIFF tag 34858 - bool optionalAttributes; // // dynamic == expected to be unique for each image string capDate; // YYYY:MM:DD hh:mm:ss = capture time = TIFF tag 36867 dateTimeOriginal @@ -305,7 +304,6 @@ struct acesHeaderInfo { keycode keyCode; timecode timeCode; // TIFF tag 51043 string uuid; // TIFF tag 42016 ImageUniqueID - bool dynamicAttributes; // // sample custom (TIFF/EP) attributes not defined in the ACES spec string artist; // TIFF tag 315 artist @@ -313,7 +311,6 @@ struct acesHeaderInfo { string dateTime; // YYYY-MM-DDThh:mm:ssTZ when THIS file was created TIFF 306 dateTime int32 orientation; // flipped, rotated TIFF tag 274 orientation string software; // TIFF tag 305 software - bool customAttributes; // }; ostream& operator<< ( ostream& s, const acesHeaderInfo& v ); From e76e9db0f4098d131139e18b43eae7168eeaa561 Mon Sep 17 00:00:00 2001 From: Mikael Sundell Date: Mon, 17 Jul 2023 16:30:10 +0200 Subject: [PATCH 4/5] Removed export PACKAGE to prevent install conflicts Changed install paths to fixed in cmake configuration --- CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b3121f..7b5227f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) From 2fe5d70ffae7d8143921b3ead14f01c6cb6a07b6 Mon Sep 17 00:00:00 2001 From: Mikael Sundell Date: Sun, 30 Jul 2023 20:21:10 +0200 Subject: [PATCH 5/5] Changed DEF_INSTALL_CMAKE_DIR from CMake to case sensitive cmake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b5227f..d0eaf98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" )