+3








92db29b9e7
* Fix support for X86 32-bit (#1842) Signed-off-by: Mark Reid <mindmark@gmail.com> (cherry picked from commit16b3157f2e) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Add some small arm neon optimizations (#1847) * Remove unused includes Signed-off-by: Mark Reid <mindmark@gmail.com> * Use neon hardware support for f16 conversions Signed-off-by: Mark Reid <mindmark@gmail.com> * Add some small neon optimizations use blendv,floor and fma intrinsics were possible Signed-off-by: Mark Reid <mindmark@gmail.com> --------- Signed-off-by: Mark Reid <mindmark@gmail.com> (cherry picked from commit14f0afa2d8) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Add links to new release notes documentation (#1848) Signed-off-by: Kevin Wheatley <kevin.wheatley@framestore.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit87126fad7f) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Changing version to 2.4.0 (#1852) Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit381d1fc371) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Correctly recover CXX_FLAGS in CheckSupportSSE2.cmake (#1861) Signed-off-by: Chongyun Lee <uchkks@protonmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitc429400170) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix regression in cccid handling when no value is supplied (#1855) In v1 of OCIO FileTransforms are able to load .cc files without specifying a cccid. In v2 this broke causing an exception to be raised instead of using the first cc found in the file. Signed-off-by: Kevin Wheatley <kevin.wheatley@framestore.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitc7ad35340a) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix missing cache id reset on look update. (#1873) Signed-off-by: Eric Renaud-Houde <eric.renaud.houde@gmail.com> (cherry picked from commitdddbee023d) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * ocioview: Curve Inspector improvements (#1845) * Curve inspector improvements - Move README to root app folder - Change curve inspector grid to always render as a square with 10 segments. - Add transform init callback to set new transform subscriptions to the current viewer if set to passthrough. Signed-off-by: Michael Dolan <michdolan@gmail.com> * Improve log range calculation Signed-off-by: Michael Dolan <michdolan@gmail.com> * Improve channel sample comparison Signed-off-by: Michael Dolan <michdolan@gmail.com> * Update src/apps/ocioview/ocioview/inspect/curve_inspector.py Signed-off-by: Michael Dolan <michdolan@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> Signed-off-by: Michael Dolan <michdolan@gmail.com> --------- Signed-off-by: Michael Dolan <michdolan@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit8add374dad) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix missing Default View Transform on equal operator (#1886) Add the missing assignment of the the default view transform when a config is copied using the equal operator Signed-off-by: Michael De Caria <decariamichael@gmail.com> Signed-off-by: Doug Walker <doug.walker@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitbc8569b2db) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Remove circular import caused by typing annotations. (#1882) Signed-off-by: Thomas Mansencal <thomas.mansencal@gmail.com> Signed-off-by: Doug Walker <doug.walker@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit1fad4666c3) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * fix(grammatical): Spelling mistakes (#1892) Signed-off-by: AbhineshJha <abhinesh_223002@saitm.org> Signed-off-by: Doug Walker <doug.walker@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit0d00b2c538) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Improve ocioview mac support and simplify dependencies (#1853) * PySide 6, remove imath, add imageio support Signed-off-by: Rémi Achard <remiachard@gmail.com> Remove Imath Signed-off-by: Rémi Achard <remiachard@gmail.com> Support imageio as fallback for openimageio Signed-off-by: Rémi Achard <remiachard@gmail.com> Further adjustments following latest updates Signed-off-by: Rémi Achard <remiachard@gmail.com> Fix pixel probe Signed-off-by: Remi Achard <remiachard@gmail.com> Add OpenColorIO to requirements Signed-off-by: Remi Achard <remiachard@gmail.com> * Fix rebase issue Signed-off-by: Remi Achard <remiachard@gmail.com> --------- Signed-off-by: Remi Achard <remiachard@gmail.com> Signed-off-by: Thomas Mansencal <thomas.mansencal@gmail.com> Signed-off-by: Michael Dolan <michdolan@gmail.com> Co-authored-by: Thomas Mansencal <thomas.mansencal@gmail.com> Co-authored-by: Michael Dolan <michdolan@gmail.com> (cherry picked from commit45544ce667) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Issue #1874 Cast to unsigned char for isspace. (#1888) * Issue #1874 Cast to unsigned char for isspace. Signed-off-by: pylee <penne.y.lee@intel.com> * Add unit test. Signed-off-by: pylee <penne.y.lee@intel.com> * Add test comment as suggested in code review. Signed-off-by: pylee <penne.y.lee@intel.com> --------- Signed-off-by: pylee <penne.y.lee@intel.com> Signed-off-by: Doug Walker <doug.walker@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commited852073f2) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Tentative fix for the doxygen installation in the CI (Windows) (#1890) Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitb94a184e4b) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Simplify the Findyaml-cpp module (#1891) This fixes compatibility with yaml-cpp 0.8, which previously failed because of a `get_property` call with the wrong target name. I took the liberty to add a few simplifications along the way. Signed-off-by: Tobias Mayer <tobim@fastmail.fm> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit1d3b69502e) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Skip processor concatenation if the display color space is also data. (#1896) * Skip processor concatenation if the display view transform is also data. Signed-off-by: Eric Renaud-Houde <eric.renaud.houde@gmail.com> * Moved missing display color space exception before processor creation. Signed-off-by: Eric Renaud-Houde <eric.renaud.houde@gmail.com> --------- Signed-off-by: Eric Renaud-Houde <eric.renaud.houde@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit52b496528c) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Restore GPU workflow and minor updates to CI (#1899) * Restore GPU workflow runs Signed-off-by: Rémi Achard <remiachard@gmail.com> * Enable undefined behaviour sanitizer Signed-off-by: Rémi Achard <remiachard@gmail.com> * Fix SIMD option for platform_latest Signed-off-by: Rémi Achard <remiachard@gmail.com> * Fix install_docs_env on CI workflow (not used at the moment) Signed-off-by: Rémi Achard <remiachard@gmail.com> * Fix OpenEXR build flag Signed-off-by: Rémi Achard <remiachard@gmail.com> --------- Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit382dcb6ce7) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Improve handling of pystring include dir (#1901) Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit9078753990) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Improve compatibility with minizip-ng COMPAT mode (#1902) Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitffd0f70ad5) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix NamedTransform context var issue (#1905) Signed-off-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit4d64b32bc7) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix env serialization for v1 configs (#1904) Signed-off-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit4f4f30e1d3) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix yaml-cpp build issues (#1907) Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commit41441bb2e6) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Adsk Contrib - Improve heuristics for finding known color spaces (#1913) * Improve heuristics Signed-off-by: Doug Walker <doug.walker@autodesk.com> * Add some comments Signed-off-by: Doug Walker <doug.walker@autodesk.com> --------- Signed-off-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitd8852b5d6c) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Add Python 3.12 wheels (#1898) Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitf2cfec330e) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Increment library version to 2.3.1 Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> * Fix wrong RPATH being injected into Python bindings DSO (#1849) Signed-off-by: Kevin Wheatley <kevin.wheatley@framestore.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com> (cherry picked from commitba2b41e309) Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> --------- Signed-off-by: Mark Reid <mindmark@gmail.com> Signed-off-by: Doug Walker <Doug.Walker@autodesk.com> Signed-off-by: Kevin Wheatley <kevin.wheatley@framestore.com> Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> Signed-off-by: Chongyun Lee <uchkks@protonmail.com> Signed-off-by: Eric Renaud-Houde <eric.renaud.houde@gmail.com> Signed-off-by: Michael Dolan <michdolan@gmail.com> Signed-off-by: Michael De Caria <decariamichael@gmail.com> Signed-off-by: Doug Walker <doug.walker@autodesk.com> Signed-off-by: Thomas Mansencal <thomas.mansencal@gmail.com> Signed-off-by: AbhineshJha <abhinesh_223002@saitm.org> Signed-off-by: Remi Achard <remiachard@gmail.com> Signed-off-by: pylee <penne.y.lee@intel.com> Signed-off-by: Tobias Mayer <tobim@fastmail.fm> Signed-off-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: Mark Reid <mindmark@gmail.com> Co-authored-by: Kevin Wheatley <kevin.wheatley@framestore.com> Co-authored-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com> Co-authored-by: Uchiha Kakashi <45286352+licy183@users.noreply.github.com> Co-authored-by: Éric Renaud-Houde <eric.renaud.houde@gmail.com> Co-authored-by: Michael Dolan <michdolan@gmail.com> Co-authored-by: Michael De Caria <decariamichael@gmail.com> Co-authored-by: Thomas Mansencal <thomas.mansencal@gmail.com> Co-authored-by: Abhinesh <142514166+AbhineshJha@users.noreply.github.com> Co-authored-by: Rémi Achard <remiachard@gmail.com> Co-authored-by: PenneLee <pennelee@gmail.com> Co-authored-by: tobim <tobim+github@fastmail.fm>
152 lines
4.2 KiB
C++
152 lines
4.2 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright Contributors to the OpenColorIO Project.
|
|
|
|
#ifndef INCLUDED_OCIO_UNITTESTUTILS_H
|
|
#define INCLUDED_OCIO_UNITTESTUTILS_H
|
|
|
|
|
|
#include <fstream>
|
|
|
|
#ifdef __has_include
|
|
# if __has_include(<version>)
|
|
# include <version>
|
|
# endif
|
|
#endif
|
|
|
|
#include <pystring.h>
|
|
|
|
#include <OpenColorIO/OpenColorIO.h>
|
|
|
|
#include "MathUtils.h"
|
|
#include "Op.h"
|
|
#include "Platform.h"
|
|
#include "CPUInfoConfig.h"
|
|
|
|
namespace OCIO_NAMESPACE
|
|
{
|
|
|
|
const std::string & GetTestFilesDir();
|
|
|
|
// Special test function that copies the implementation of FileTransform
|
|
// in order to be able to access ops from a file path. fileOps will not be
|
|
// finalized and will thus contain NoOps including FileNoOps.
|
|
// context can be used to control working directory, search path etc.
|
|
void BuildOpsTest(OpRcPtrVec & fileOps,
|
|
const std::string & fileName,
|
|
ContextRcPtr & context,
|
|
TransformDirection dir);
|
|
|
|
// Create a FileTransform.
|
|
FileTransformRcPtr CreateFileTransform(const std::string & fileName);
|
|
|
|
// Create processor for a given file.
|
|
ConstProcessorRcPtr GetFileTransformProcessor(const std::string & fileName);
|
|
|
|
class CachedFile;
|
|
|
|
template <class LocalFileFormat, class LocalCachedFile>
|
|
OCIO_SHARED_PTR<LocalCachedFile> LoadTestFile(
|
|
const std::string & fileName, std::ios_base::openmode mode)
|
|
{
|
|
const std::string filePath(GetTestFilesDir() + "/" + fileName);
|
|
|
|
// Open the filePath
|
|
std::ifstream filestream;
|
|
Platform::OpenInputFileStream(filestream, filePath.c_str(), mode);
|
|
|
|
if (!filestream.is_open())
|
|
{
|
|
throw Exception("Error opening test file.");
|
|
}
|
|
|
|
std::string root, extension, name;
|
|
pystring::os::path::splitext(root, extension, filePath);
|
|
|
|
// Read file
|
|
LocalFileFormat tester;
|
|
OCIO_SHARED_PTR<CachedFile> cachedFile = tester.read(filestream, filePath, INTERP_DEFAULT);
|
|
|
|
filestream.close();
|
|
|
|
return DynamicPtrCast<LocalCachedFile>(cachedFile);
|
|
}
|
|
|
|
// Relative comparison: check if the difference between value and expected
|
|
// relative to (divided by) expected does not exceed the eps. A minimum
|
|
// expected value is used to limit the scaling of the difference and
|
|
// avoid large relative differences for small numbers.
|
|
template<typename T>
|
|
inline bool EqualWithSafeRelError(T value,
|
|
T expected,
|
|
T eps,
|
|
T minExpected)
|
|
{
|
|
// If value and expected are infinity, return true.
|
|
if (value == expected) return true;
|
|
if (IsNan(value) && IsNan(expected)) return true;
|
|
const T div = (expected > 0) ?
|
|
((expected < minExpected) ? minExpected : expected) :
|
|
((-expected < minExpected) ? minExpected : -expected);
|
|
|
|
return (
|
|
((value > expected) ? value - expected : expected - value)
|
|
/ div) <= eps;
|
|
}
|
|
|
|
// C++20 introduces new strongly typed, UTF-8 based, char8_t and u8string types
|
|
// which are not implicitly convertible to char and std::string respectively.
|
|
// Here we simply choose to ignore these new types for unit tests while the
|
|
// core API is not explicitly compatible with such types.
|
|
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r2.html
|
|
#if defined(__cpp_lib_char8_t)
|
|
# define U8(x) reinterpret_cast<const char *>(u8##x)
|
|
#else
|
|
# define U8(x) u8##x
|
|
#endif
|
|
|
|
struct EnvironmentVariableGuard
|
|
{
|
|
EnvironmentVariableGuard(const std::string & name, const std::string & value) : m_name(name)
|
|
{
|
|
if (!name.empty())
|
|
{
|
|
Platform::Setenv(name.c_str(), value);
|
|
}
|
|
}
|
|
|
|
EnvironmentVariableGuard(const std::string & name) : m_name(name)
|
|
{
|
|
}
|
|
|
|
~EnvironmentVariableGuard()
|
|
{
|
|
if (!m_name.empty())
|
|
{
|
|
Platform::Unsetenv(m_name.c_str());
|
|
}
|
|
}
|
|
|
|
const std::string m_name;
|
|
};
|
|
|
|
/**
|
|
* \brief Create a Temporary Directory
|
|
*
|
|
* \param name Name of the directory
|
|
* \return Full path to the directory
|
|
*/
|
|
std::string CreateTemporaryDirectory(const std::string & name);
|
|
|
|
/**
|
|
* \brief Remove the directory specified in the path.
|
|
*
|
|
* \param directoryPath Path to the directory
|
|
*/
|
|
void RemoveTemporaryDirectory(const std::string & directoryPath);
|
|
|
|
}
|
|
// namespace OCIO_NAMESPACE
|
|
|
|
|
|
#endif // INCLUDED_OCIO_UNITTESTUTILS_H
|