Compare commits

...
5 Commits
Author SHA1 Message Date
Michael Dolan ebdec4111f Update OCIO_VERSION_PATCH and ChaneLog for release 1.1.1 (#705) 2019-03-27 22:12:57 -07:00
Michael Dolan 29bd217d20 Cherry picked fixes for proposed 1.1.x release (#678)
* Fix wrong display returned by getDefaultDisplay() (#638)

* Fix window-specific issue in GetEnv()

While the content of result was correct, its length was set
to a wrong size.

This is a patch by Patrick Hodoul.

* Fix wrong display returned by getDefaultDisplay()

Solved by ignoring environment variable if it's an empty string.
Ideally, need to test it to be NULL instead to support obscure
case when empty string is passed. Unfortunately, this is not
possible with the current API, and is unlikely scenario anyway.

The issue was caused by wrong logic around parsing display/views
override environment variable: if it is missing, it was converted
to an empty string. That empty string was considered an override
of one element display, with an empty name.

Additionally, make it so getDisplay() returns displays in order
of either active_displays configuration variable or environment
variable override. the issue there was caused by wrong order of
arguments to vector intersection.

Conflicts:
	src/OpenColorIO/Platform.cpp
	src/core/Config.cpp

This commit was cherry-picked from 718cc7f9f7. Changes were made
for compatibility with the older version of Platform.cpp; mainly
reverting "Getenv" to "getenv".

* Add Compatibility with OIIO 1.9+ API changes (#601)

This fix adds compatibility with OIIO 1.9+, minor ImageInput/ImageOutput API changes. At a certain point ImageInput::create switched from returning a raw pointer (that later needed to be deleted) to returning a std::unique_ptr.

* Correct ImageInput/ImageOutput swaps

* Restore C++03 compat when using old OIIO (#682)

We recently tried to change the OCIO code so that it would build
against both OIIO 2.0 as well as the older 1.x versions. In doing so,
we inadvertently broke OCIO for C++03.

This patch still requires C++11 when building against OIIO 2.x (it has
to), but is fine with C++03 if using older OIIO.
(cherry picked from commit 65a08dbedb)

* Add note about C++11 requirement when building with newer OIIO version

* Add error directive to apps when incompatable C++ std and OIIO lib are used
2019-03-20 23:49:06 -07:00
Michael Dolan 52e4e59e23 ASWF mail list updates for RB-1.1 (#698)
* Update OCIO mail lists to ASWF domain (#673)

* Update OCIO mail lists to ASWF domain

* Conform remaining http instances to https

* Change ocio-dev to ocio-user as it relates to config design

Conflicts:
	CONTRIBUTING.md

* Add placeholder for needed URL update

* Update thread URL to aswf.io location
2019-03-20 21:52:54 -07:00
Zicklag 2d2d4086b4 Add USE_SSE Checks To Fix Compile on Linux (#677)
Fix 'Not SSE' build on RB-1.1 branch as documented by #617
2019-03-05 10:38:11 -05:00
Michael Dolan ee570919ee Update RB-1.1 CI builds to resolve failure cases (#679)
* Update CI builds to resolve failure cases
* Incompatible boost path for VS2015
* Incomplete python env for OSX (xcode)
* Adopt latest travis OSX configuration
2019-02-25 22:20:39 -08:00
17 changed files with 498 additions and 35 deletions
+4 -3
View File
@@ -8,14 +8,15 @@ platform:
- x64
environment:
global:
CMAKE_PREFIX_PATH: C:/Libraries/boost
BOOST_ROOT: 'C:\Libraries\boost'
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
CMAKE_PLATFORM: "Visual Studio 12 2013 Win64"
CMAKE_PREFIX_PATH: C:/Libraries/boost
BOOST_ROOT: 'C:\Libraries\boost'
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
CMAKE_PREFIX_PATH: C:/Libraries/boost_1_60_0
BOOST_ROOT: 'C:\Libraries\boost_1_60_0'
install:
- cinstall: python
+22 -4
View File
@@ -24,9 +24,27 @@ env:
- OPTIONS="-DCMAKE_BUILD_TYPE=Release -DOCIO_BUILD_TESTS=yes -DOCIO_BUILD_DOCS=yes"
# Install missing packages
install:
- if [[ $TRAVIS_OS_NAME = linux ]]; then sudo apt-get update -qq; fi
- if [[ $TRAVIS_OS_NAME = linux ]]; then sudo apt-get install -qq texlive-full; fi
before_install:
# Linux ones
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update -qq;
sudo apt-get install -y -qq texlive-full;
fi
# OSX ones
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install glew;
brew upgrade cmake;
brew upgrade pyenv;
echo 'eval "$(pyenv init -)"' >> .bash_profile;
source .bash_profile;
export PYTHON_CONFIGURE_OPTS="--enable-framework";
pyenv install -v 2.7.15;
pyenv global 2.7.15;
export OPTIONS="$OPTIONS -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.dylib";
export OPTIONS="$OPTIONS -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/include/python2.7";
export OPTIONS="$OPTIONS -DPYTHON_EXECUTABLE=$(which python2)";
fi
# Run the Build script
script:
@@ -35,7 +53,7 @@ script:
- cmake .. -DCMAKE_INSTALL_PREFIX=../_install $OPTIONS
- cmake --build . --target install
- ctest --output-on-failure .
- if [[ $TRAVIS_OS_NAME = linux ]]; then cmake --build . --target pdf; fi
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then cmake --build . --target pdf; fi
deploy:
provider: pages
+1 -1
View File
@@ -1,7 +1,7 @@
project(OpenColorIO)
set(OCIO_VERSION_MAJOR 1)
set(OCIO_VERSION_MINOR 1)
set(OCIO_VERSION_PATCH 0)
set(OCIO_VERSION_PATCH 1)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/share/cmake)
+11
View File
@@ -1,3 +1,14 @@
**Version 1.1.1 (March 25 2019):**
* Added optional compatibility for building apps with OpenImageIO 1.9+
* Added USE_SSE checks to fix Linux build failure
* getDisplays() result ordering now matches the active_displays config
definition or OCIO_ACTIVE_DISPLAYS env var override.
* Fixed incorrect getDefaultDisplay()/getDefaultView() result when
OCIO_ACTIVE_DISPLAYS or OCIO_ACTIVE_VIEWS env vars are unset.
* Fixed Windows-specific GetEnv() bug
* Fixed Windows and MacOS CI failure cases
* Updated mail list URLs to aswf.io domain
**Version 1.1.0 (Jan 5 2018):**
* libc++ build fixes
* Added support for YAML > 5.0.1
+2 -2
View File
@@ -34,8 +34,8 @@ Web Resources
-------------
* Web page: http://opencolorio.org
* Mail lists:
* Developer: ocio-dev@googlegroups.com
* User: ocio-users@googlegroups.com
* Developer: ocio-dev@lists.aswf.io
* User: ocio-user@lists.aswf.io
* Slack channel: https://opencolorio.slack.com
* Please request access on the ocio-dev email with the email address you would like to be invited on
+2 -2
View File
@@ -225,8 +225,8 @@ Export capabilities through ociobakelut::
See this `ocio-dev thread
<http://groups.google.com/group/ocio-dev/browse_thread/thread/56fd58e60d98e0f6#>`__
See this `ocio-dev thread
<https://lists.aswf.io/g/ocio-dev/topic/30498585>`__
for additional usage discussions.
When exporting an ICC Profile, you will be asked to specify your monitor’s
+2 -2
View File
@@ -33,8 +33,8 @@ rst_prolog = """
.. |Sony Imageworks| replace:: `Sony Imageworks`_
.. _Jeremy Selan: mailto:jeremy.selan@gmail.com
.. |Jeremy Selan| replace:: `Jeremy Selan`_
.. _ocio-users: http://groups.google.com/group/ocio-users
.. _ocio-dev: http://groups.google.com/group/ocio-dev
.. _ocio-user: https://lists.aswf.io/g/ocio-user
.. _ocio-dev: https://lists.aswf.io/g/ocio-dev
"""
# -- Options for HTML output ---------------------------------------------------
+1 -1
View File
@@ -8,7 +8,7 @@ and how to create new ones.
OCIO Configurations can be downloaded here: `.zip <http://github.com/imageworks/OpenColorIO-Configs/zipball/master>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO-Configs/tarball/master>`__ (OCIO v1.0+)
If you are interested in crafting custom color configurations, and need assistance, please contact: `ocio-dev <http://groups.google.com/group/ocio-dev>`__\.
If you are interested in crafting custom color configurations, and need assistance, please contact: `ocio-user <https://lists.aswf.io/g/ocio-user>`__\.
Public Configs
**************
+5 -5
View File
@@ -23,11 +23,11 @@ Mailing Lists
There are two mailing lists associated with OpenColorIO:
`ocio-users <http://groups.google.com/group/ocio-users>`__\ ``@googlegroups.com``
`ocio-user <https://lists.aswf.io/g/ocio-user>`__\ ``@lists.aswf.io``
For end users (artists, often) interested in OCIO profile design,
facility color management, and workflow.
`ocio-dev <http://groups.google.com/group/ocio-dev>`__\ ``@googlegroups.com``
`ocio-dev <https://lists.aswf.io/g/ocio-dev>`__\ ``@lists.aswf.io``
For developers interested OCIO APIs, code integration, compilation, etc.
Quick Start
@@ -40,7 +40,7 @@ each application.
Note that OCIO configurations are required to do any 'real' work, and are
available separately on the :ref:`downloads` section of this site. Example
images are also available. For assistance customizing .ocio configurations,
contact `ocio-users <http://groups.google.com/group/ocio-users>`__\.
contact `ocio-user <https://lists.aswf.io/g/ocio-user>`__\.
- Step 1: set the OCIO environment-variable to /path/to/your/profile.ocio
- Step 2: Launch supported application.
@@ -51,7 +51,7 @@ provide a menu option to select a different OCIO configuration after launch.
Please be sure to select a profile that matches your color workflow (VFX work
typically requires a different profile than animated features). If you need
assistance picking a profile, email
`ocio-users <http://groups.google.com/group/ocio-users>`__\.
`ocio-user <https://lists.aswf.io/g/ocio-user>`__\.
Downloading and Building the Code
*********************************
@@ -64,7 +64,7 @@ Download a `.zip <http://github.com/imageworks/OpenColorIO/zipball/master>`_ or
current state of the repository.
Please see the :ref:`developer-guide` for more info, and contact `ocio-dev
<http://groups.google.com/group/ocio-dev>`__\ with any questions.
<https://lists.aswf.io/g/ocio-dev>`__\ with any questions.
.. toctree::
:hidden:
+17 -2
View File
@@ -39,6 +39,9 @@ namespace OCIO = OCIO_NAMESPACE;
namespace OIIO = OIIO_NAMESPACE;
#endif
#if OIIO_VERSION >= 10903 && __cplusplus < 201103
#error While not officially supported, compile with C++11 (or higher) to use OIIO versions 1.9.3 or newer
#endif
#include "argparse.h"
@@ -119,7 +122,11 @@ int main(int argc, const char **argv)
std::cerr << "Loading " << inputimage << std::endl;
try
{
#if OIIO_VERSION < 10903
OIIO::ImageInput* f = OIIO::ImageInput::create(inputimage);
#else
auto f = OIIO::ImageInput::create(inputimage);
#endif
if(!f)
{
std::cerr << "Could not create image input." << std::endl;
@@ -143,7 +150,9 @@ int main(int argc, const char **argv)
memset(&img[0], 0, imgwidth*imgheight*components*sizeof(float));
f->read_image(OIIO::TypeDesc::TypeFloat, &img[0]);
delete f;
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(f);
#endif
std::vector<int> kchannels;
//parse --ch argument
@@ -308,7 +317,11 @@ int main(int argc, const char **argv)
// Write out the result
try
{
#if OIIO_VERSION < 10903
OIIO::ImageOutput* f = OIIO::ImageOutput::create(outputimage);
#else
auto f = OIIO::ImageOutput::create(outputimage);
#endif
if(!f)
{
std::cerr << "Could not create output input." << std::endl;
@@ -318,7 +331,9 @@ int main(int argc, const char **argv)
f->open(outputimage, spec);
f->write_image(OIIO::TypeDesc::FLOAT, &img[0]);
f->close();
delete f;
#if OIIO_VERSION < 10903
OIIO::ImageOutput::destroy(f);
#endif
}
catch(...)
{
+9 -2
View File
@@ -41,8 +41,9 @@ namespace OCIO = OCIO_NAMESPACE;
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/typedesc.h>
#if (OIIO_VERSION < 10100)
namespace OIIO = OIIO_NAMESPACE;
#if OIIO_VERSION >= 10903 && __cplusplus < 201103
#error While not officially supported, compile with C++11 (or higher) to use OIIO versions 1.9.3 or newer
#endif
#ifdef __APPLE__
@@ -106,7 +107,11 @@ static void InitImageTexture(const char * filename)
std::cout << "loading: " << filename << std::endl;
try
{
#if OIIO_VERSION < 10903
OIIO::ImageInput* f = OIIO::ImageInput::create(filename);
#else
auto f = OIIO::ImageInput::create(filename);
#endif
if(!f)
{
std::cerr << "Could not create image input." << std::endl;
@@ -137,7 +142,9 @@ static void InitImageTexture(const char * filename)
OIIO::TypeDesc::TypeFloat,
#endif
&img[0]);
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(f);
#endif
}
catch(...)
{
+17 -4
View File
@@ -32,8 +32,9 @@ OCIO_NAMESPACE_USING;
#include <OpenImageIO/imageio.h>
#include <OpenImageIO/typedesc.h>
#if (OIIO_VERSION < 10100)
namespace OIIO = OIIO_NAMESPACE;
#if OIIO_VERSION >= 10903 && __cplusplus < 201103
#error While not officially supported, compile with C++11 (or higher) to use OIIO versions 1.9.3 or newer
#endif
#include "argparse.h"
@@ -116,7 +117,11 @@ void Generate(int cubesize, int maxwidth,
processor->apply(imgdesc);
}
#if OIIO_VERSION < 10903
OIIO::ImageOutput* f = OIIO::ImageOutput::create(outputfile);
#else
auto f = OIIO::ImageOutput::create(outputfile);
#endif
if(!f)
{
throw Exception( "Could not create output image.");
@@ -128,7 +133,9 @@ void Generate(int cubesize, int maxwidth,
f->open(outputfile, spec);
f->write_image(OIIO::TypeDesc::FLOAT, &img[0]);
f->close();
delete f;
#if OIIO_VERSION < 10903
OIIO::ImageOutput::destroy(f);
#endif
}
@@ -137,7 +144,11 @@ void Extract(int cubesize, int maxwidth,
const std::string & outputfile)
{
// Read the image
#if OIIO_VERSION < 10903
OIIO::ImageInput* f = OIIO::ImageInput::create(inputfile);
#else
auto f = OIIO::ImageInput::create(inputfile);
#endif
if(!f)
{
throw Exception("Could not create input image.");
@@ -183,7 +194,9 @@ void Extract(int cubesize, int maxwidth,
std::vector<float> img;
img.resize(spec.width*spec.height*spec.nchannels, 0);
f->read_image(OIIO::TypeDesc::TypeFloat, &img[0]);
delete f;
#if OIIO_VERSION < 10903
OIIO::ImageInput::destroy(f);
#endif
// Repack into rgb
// Convert the RGB[...] image to an RGB image, in place.
+374 -2
View File
@@ -265,11 +265,17 @@ OCIO_NAMESPACE_ENTER
{
std::string activeDisplays;
Platform::getenv(OCIO_ACTIVE_DISPLAYS_ENVVAR, activeDisplays);
SplitStringEnvStyle(activeDisplaysEnvOverride_, activeDisplays.c_str());
activeDisplays = pystring::strip(activeDisplays);
if (!activeDisplays.empty()) {
SplitStringEnvStyle(activeDisplaysEnvOverride_, activeDisplays.c_str());
}
std::string activeViews;
Platform::getenv(OCIO_ACTIVE_VIEWS_ENVVAR, activeViews);
SplitStringEnvStyle(activeViewsEnvOverride_, activeViews.c_str());
activeViews = pystring::strip(activeViews);
if (!activeViews.empty()) {
SplitStringEnvStyle(activeViewsEnvOverride_, activeViews.c_str());
}
defaultLumaCoefs_.resize(3);
defaultLumaCoefs_[0] = DEFAULT_LUMA_COEFF_R;
@@ -2077,4 +2083,370 @@ OIIO_ADD_TEST(Config, Env_colorspace_name)
}
}
OIIO_ADD_TEST(Config, display)
{
static const std::string SIMPLE_PROFILE_HEADER =
"ocio_profile_version: 1\n"
"\n"
"search_path: luts\n"
"strictparsing: true\n"
"luma: [0.2126, 0.7152, 0.0722]\n"
"\n"
"roles:\n"
" default: raw\n"
" scene_linear: lnh\n"
"\n"
"displays:\n"
" sRGB_1:\n"
" - !<View> {name: Raw, colorspace: raw}\n"
" sRGB_2:\n"
" - !<View> {name: Raw, colorspace: raw}\n"
" sRGB_3:\n"
" - !<View> {name: Raw, colorspace: raw}\n"
"\n";
static const std::string SIMPLE_PROFILE_FOOTER =
"\n"
"colorspaces:\n"
" - !<ColorSpace>\n"
" name: raw\n"
" family: \"\"\n"
" equalitygroup: \"\"\n"
" bitdepth: unknown\n"
" isdata: false\n"
" allocation: uniform\n"
"\n"
" - !<ColorSpace>\n"
" name: lnh\n"
" family: \"\"\n"
" equalitygroup: \"\"\n"
" bitdepth: unknown\n"
" isdata: false\n"
" allocation: uniform\n";
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 3);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_1"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(2)), std::string("sRGB_3"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: [sRGB_1]\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 1);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_1"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: [sRGB_2, sRGB_1]\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 2);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_1"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_2");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_DISPLAYS_ENVVAR) + "= sRGB_3, sRGB_2");
putenv(const_cast<char *>(active_displays.c_str()));
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 2);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_3"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_3");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: [sRGB_2, sRGB_1]\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_DISPLAYS_ENVVAR) + "= sRGB_3, sRGB_2");
putenv(const_cast<char *>(active_displays.c_str()));
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 2);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_3"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_3");
}
{
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_DISPLAYS_ENVVAR) + "="); // No value
putenv(const_cast<char *>(active_displays.c_str()));
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: [sRGB_2, sRGB_1]\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 2);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_1"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_2");
}
{
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_DISPLAYS_ENVVAR) + "= "); // No value, but misleading space
putenv(const_cast<char *>(active_displays.c_str()));
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: [sRGB_2, sRGB_1]\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(config->getNumDisplays(), 2);
OIIO_CHECK_EQUAL(std::string(config->getDisplay(0)), std::string("sRGB_2"));
OIIO_CHECK_EQUAL(std::string(config->getDisplay(1)), std::string("sRGB_1"));
OIIO_CHECK_EQUAL(std::string(config->getDefaultDisplay()), "sRGB_2");
}
}
OIIO_ADD_TEST(Config, view)
{
static const std::string SIMPLE_PROFILE_HEADER =
"ocio_profile_version: 1\n"
"\n"
"search_path: luts\n"
"strictparsing: true\n"
"luma: [0.2126, 0.7152, 0.0722]\n"
"\n"
"roles:\n"
" default: raw\n"
" scene_linear: lnh\n"
"\n"
"displays:\n"
" sRGB_1:\n"
" - !<View> {name: View_1, colorspace: raw}\n"
" - !<View> {name: View_2, colorspace: raw}\n"
" sRGB_2:\n"
" - !<View> {name: View_2, colorspace: raw}\n"
" - !<View> {name: View_3, colorspace: raw}\n"
" sRGB_3:\n"
" - !<View> {name: View_3, colorspace: raw}\n"
" - !<View> {name: View_1, colorspace: raw}\n"
"\n";
static const std::string SIMPLE_PROFILE_FOOTER =
"\n"
"colorspaces:\n"
" - !<ColorSpace>\n"
" name: raw\n"
" family: \"\"\n"
" equalitygroup: \"\"\n"
" bitdepth: unknown\n"
" isdata: false\n"
" allocation: uniform\n"
"\n"
" - !<ColorSpace>\n"
" name: lnh\n"
" family: \"\"\n"
" equalitygroup: \"\"\n"
" bitdepth: unknown\n"
" isdata: false\n"
" allocation: uniform\n";
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: [View_3]\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: [View_3, View_2, View_1]\n"
+ SIMPLE_PROFILE_FOOTER;
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_VIEWS_ENVVAR) + "= View_3, View_2");
putenv(const_cast<char *>(active_displays.c_str()));
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_VIEWS_ENVVAR) + "="); // No value.
putenv(const_cast<char *>(active_displays.c_str()));
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
{
std::string myProfile =
SIMPLE_PROFILE_HEADER
+
"active_displays: []\n"
"active_views: []\n"
+ SIMPLE_PROFILE_FOOTER;
const std::string active_displays(
std::string(OCIO::OCIO_ACTIVE_VIEWS_ENVVAR) + "= "); // No value, but misleading space
putenv(const_cast<char *>(active_displays.c_str()));
std::istringstream is(myProfile);
OCIO::ConstConfigRcPtr config;
OIIO_CHECK_NO_THROW(config = OCIO::Config::CreateFromStream(is));
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_1")), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 0)), "View_1");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_1", 1)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_2")), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 0)), "View_2");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_2", 1)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getDefaultView("sRGB_3")), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 0)), "View_3");
OIIO_CHECK_EQUAL(std::string(config->getView("sRGB_3", 1)), "View_1");
}
}
#endif // OCIO_UNIT_TEST
+2 -2
View File
@@ -114,13 +114,13 @@ OCIO_NAMESPACE_ENTER
// Apply the env override if it's not empty.
if(!activeDisplaysEnvOverride.empty())
{
displayCache = IntersectStringVecsCaseIgnore(displayMasterList, activeDisplaysEnvOverride);
displayCache = IntersectStringVecsCaseIgnore(activeDisplaysEnvOverride, displayMasterList);
if(!displayCache.empty()) return;
}
// Otherwise, aApply the active displays if it's not empty.
else if(!activeDisplays.empty())
{
displayCache = IntersectStringVecsCaseIgnore(displayMasterList, activeDisplays);
displayCache = IntersectStringVecsCaseIgnore(activeDisplays, displayMasterList);
if(!displayCache.empty()) return;
}
+3
View File
@@ -189,6 +189,7 @@ OCIO_NAMESPACE_ENTER
return simple_lut[clamp(index, 0.0f, maxIndex)];
}
#if !defined(USE_SSE) || defined(OCIO_UNIT_TEST)
void Lut1D_Nearest(float* rgbaBuffer, long numPixels, const Lut1D & lut)
{
float maxIndex[3];
@@ -218,6 +219,8 @@ OCIO_NAMESPACE_ENTER
rgbaBuffer += 4;
}
}
#endif
#ifdef USE_SSE
void Lut1D_Nearest_SSE(float* rgbaBuffer, long numPixels, const Lut1D & lut)
{
+2
View File
@@ -330,11 +330,13 @@ OCIO_NAMESPACE_ENTER
namespace
{
#if defined(OCIO_UNIT_TEST)
void GetMxbResult(float* vout, float* m, float* x, float* v)
{
GetM44V4Product(vout, m, x);
GetV4Sum(vout, vout, v);
}
#endif
} // anon namespace
+24 -3
View File
@@ -35,8 +35,9 @@ OCIO_NAMESPACE_ENTER
}
else
{
value.resize(len+1);
::snprintf(&value[0], len, "%s", val);
// NB: len is the sizeof() of a string ( i.e. not its strlen() )
value = val;
value.resize(len-1);
if(val) free(val);
}
#else
@@ -89,11 +90,31 @@ OIIO_ADD_TEST(Platform, getenv)
OIIO_ADD_TEST(Platform, putenv)
{
{
::putenv("MY_DUMMY_ENV=SomeValue");
const std::string value("MY_DUMMY_ENV=SomeValue");
::putenv(const_cast<char*>(value.c_str()));
std::string env;
OCIO::Platform::getenv("MY_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(!env.empty());
OIIO_CHECK_ASSERT(0==strcmp("SomeValue", env.c_str()));
OIIO_CHECK_EQUAL(strlen("SomeValue"), env.size());
}
{
const std::string value("MY_DUMMY_ENV= ");
::putenv(const_cast<char*>(value.c_str()));
std::string env;
OCIO::Platform::getenv("MY_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(!env.empty());
OIIO_CHECK_ASSERT(0==strcmp(" ", env.c_str()));
OIIO_CHECK_EQUAL(strlen(" "), env.size());
}
{
const std::string value("MY_DUMMY_ENV=");
::putenv(const_cast<char*>(value.c_str()));
std::string env;
OCIO::Platform::getenv("MY_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(env.empty());
}
}