Compare commits

...
15 Commits
Author SHA1 Message Date
Rashil Gandhi 6a7c18bec3 Fixed Copyright typo in #977 commit (#982)
Signed-off-by: Rashil Gandhi <rashil2000@gmail.com>
2020-04-06 08:45:39 -04:00
Rashil Gandhi 1f4dfb0116 Made #953 changes in RB-1.1 release branch (#977)
Signed-off-by: Rashil Gandhi <rashil2000@gmail.com>
2020-04-02 09:15:58 -04:00
Larry GritzandLee Kerley 2098ce08de add cmake support for OCIO_LIBNAME_SUFFIX (#954)
This patch from Lee Kerley makes it easier for people making custom
builds to add an optional suffix to the library name itself.

The purpose is to prevent a studio build for internal tools from
conflicting with a different build of OCIO that might be embedded in a
DCC app. The existing option to customize the inner namespace does a
good job preventing symbol clashes at link time, but does not address
the problem where both the DCC app and the plugin we write end up
callled libOpenColorIO.so, so whichever is first in the
`LD_LIBRARY_PATH` will win and the other won't be found.

This is a patch against RB-1.1, because that's what we need ASAP, but
after this is merged, we will submit another one against master (the
build system has changed enough it won't just cherry pick).

Signed-off-by: Lee Kerley <lkerley@imageworks.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>

Co-authored-by: Lee Kerley <lee.kerley@gmail.com>
2020-03-12 19:38:02 -04:00
Michael Dolan 0ff98b8958 Update RB-1.1 repo URLs (#852)
* Update Imageworks repo URLs to ASWF
* Correct broken links
* Update travis.ci URLs
* Update docs downloads page

Signed-off-by: michdolan <michdolan@gmail.com>
2019-10-05 11:02:28 -07:00
Patrick Hodoul 11672b1bcb Adsk Contrib - Port getenv() master fix (#836) 2019-09-25 23:52:21 -04:00
Patrick Hodoul c8d8f428ba Adsk Contrib - Port a CDL Transform fix from master to OCIOv1 (#835)
* Adsk Contrib - Port a CDL Transform fix from master to OCIOv1

* Fix Linux build break

* Fix Linux build break, part II
2019-09-25 17:11:23 -04:00
Matthew Cong 9b7885176d Address two warnings in GCC 8/9 (#838)
* Fix a GCC 9 const char* -> char* cast warning and address the GCC 8+
function cast warning
* Use _putenv_s on Windows
* Move warning suppresion and add Platform::setenv
* Switch from _putenv_s/setenv to Platform::setenv
2019-09-23 20:19:49 -07:00
Matthew Cong 4564ef0177 Backport support for GLSL 4.0 to the v1.1 branch (#834) 2019-09-20 07:21:53 -04:00
Michael Dolan 1c624651b7 CI branch cleanup RB-1.1 (#798)
* Limit AppVeyor to RB- branches

* Limit Travis to RB- branches

* Fix self-assign-field warning

* Remove unused declaration, add CXX_STANDARD warning
2019-09-06 15:43:59 -04:00
Michael Dolan 35b3b4180e Fix typo in FormatRegistry::getFormatNameByIndex (RB-1.1) (#736)
* Fix typo in FormatRegistry::getFormatNameByIndex (#732)

* Fix copy paste error

* FormatByIndex API UnitTest

* Fix invisible character

* Improve unittest

* Out of bounds index fix

* Rename test method

Conflicts:
	src/OpenColorIO/transforms/FileTransform.cpp

* Remove dependency on master Platform
2019-04-29 18:51:32 -04:00
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
39 changed files with 924 additions and 208 deletions
+8 -3
View File
@@ -1,3 +1,7 @@
branches:
only:
- /^RB-.*$/
version: '{branch}-{build}'
image: Visual Studio 2013
clone_folder: C:\source\ocio
@@ -8,14 +12,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
+26 -4
View File
@@ -1,6 +1,10 @@
# travis-ci.org build file
# https://docs.travis-ci.com/user/languages/cpp
branches:
only:
- /^RB-.*$/
matrix:
include:
- os: linux
@@ -24,9 +28,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 +57,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
+17 -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)
@@ -9,6 +9,18 @@ if(NOT DEFINED CMAKE_FIRST_RUN)
SET(CMAKE_FIRST_RUN 1 CACHE INTERNAL "")
endif()
###############################################################################
### C++ configuration ###
if(CMAKE_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD EQUAL 98)
message(WARNING " CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD} is not officially supported. Use 98 for full support.")
elseif(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 98)
endif()
# Disable fallback to other C++ version if standard is not supported.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
###############################################################################
### GLOBAL ###
@@ -93,6 +105,10 @@ if(NOT OCIO_NAMESPACE)
endif(NOT OCIO_NAMESPACE)
messageonce("Setting Namespace to: ${OCIO_NAMESPACE}")
set(OCIO_LIBNAME_SUFFIX "" CACHE STRING
"Specify a suffix to all libraries that are built")
messageonce("Setting Libname suffix to: ${OCIO_LIBNAME_SUFFIX}")
# If CMAKE_INSTALL_EXEC_PREFIX is not specified, install binaries
# directly into the regular install prefix
if(NOT CMAKE_INSTALL_EXEC_PREFIX)
+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
+3 -3
View File
@@ -2,7 +2,7 @@ OpenColorIO
===========
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://travis-ci.org/imageworks/OpenColorIO.svg?branch=master)](https://travis-ci.org/imageworks/OpenColorIO)
[![Build Status](https://travis-ci.org/AcademySoftwareFoundation/OpenColorIO.svg?branch=RB-1.1)](https://travis-ci.org/AcademySoftwareFoundation/OpenColorIO)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/fidyv9jkxeigyd2a/branch/master?svg=true)]()
Introduction
@@ -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
+7 -7
View File
@@ -20,7 +20,7 @@ After Effects
An OpenColorIO plugin is available for use in After Effects.
See `src/aftereffects
<http://github.com/imageworks/OpenColorIO/tree/master/src/aftereffects>`__
<http://github.com/AcademySoftwareFoundation/OpenColorIO/tree/RB-1.1/src/aftereffects>`__
if you are interested in building your own OCIO plugins.
Pre-built binaries are also available for `download
@@ -145,13 +145,13 @@ C++
The core OpenColorIO API is avaiable for use in C++. See the `export
directory
<http://github.com/imageworks/OpenColorIO/tree/master/export/OpenColorIO>`__
<http://github.com/AcademySoftwareFoundation/OpenColorIO/tree/RB-1.1/export/OpenColorIO>`__
for the C++ API headers. Minimal code examples are also available in
the source code distribution. Of particular note are
`src/apps/ocioconvert/
<https://github.com/imageworks/OpenColorIO/tree/master/src/apps/ocioconvert>`__
<https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/RB-1.1/src/apps/ocioconvert>`__
and `src/apps/ociodisplay/
<https://github.com/imageworks/OpenColorIO/tree/master/src/apps/ociodisplay>`__
<https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/RB-1.1/src/apps/ociodisplay>`__
Also see the :ref:`developer-guide`
@@ -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
@@ -251,7 +251,7 @@ the OpenColorIO section of the `RV User Manual
Java (Beta)
***********
The OpenColorIO API is available for use in Java. See the `jniglue directory
<http://github.com/imageworks/OpenColorIO/tree/master/src/jniglue>`__
<http://github.com/AcademySoftwareFoundation/OpenColorIO/tree/RB-1.1/src/jniglue>`__
in the codebase.
This integration is currently considered a work in progress, and should not be
+11 -11
View File
@@ -14,7 +14,7 @@ templates_path = ['templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'OpenColorIO'
copyright = u'2010, Sony Pictures Imageworks'
copyright = u'Contributors to the OpenColorIO Project'
# The short X.Y version.
version = '@OCIO_VERSION_MAJOR@.@OCIO_VERSION_MINOR@'
# The full version, including alpha/beta/rc tags.
@@ -29,12 +29,12 @@ pygments_style = 'sphinx'
rst_prolog = """
.. |OCIO| replace:: *OCIO*
.. |OpenColorIO| replace:: **OpenColorIO**
.. _Sony Imageworks: http://www.imageworks.com/
.. |Sony Imageworks| replace:: `Sony Imageworks`_
.. _Academy Software Foundation: https://www.aswf.io/
.. |Academy Software Foundation| replace:: `Academy Software Foundation`_
.. _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 ---------------------------------------------------
@@ -65,7 +65,7 @@ htmlhelp_basename = 'OpenColorIOdoc'
#latex_font_size = '10pt'
latex_documents = [
('index', 'OpenColorIO.tex', u'OpenColorIO Documentation',
u'Sony Pictures Imageworks', 'manual', False),
u'Academy Software Foundation', 'manual', False),
]
latex_elements = {
'preamble': '\setcounter{tocdepth}{2}',
@@ -83,21 +83,21 @@ latex_domain_indices = ['cpp-modindex', 'py-modindex']
# -- Options for manual page output --------------------------------------------
man_pages = [
('index', 'opencolorio', u'OpenColorIO Documentation',
[u'Sony Pictures Imageworks'], 1)
[u'Academy Software Foundation'], 1)
]
# -- Options for Texinfo output ------------------------------------------------
texinfo_documents = [
('index', 'OpenColorIO', u'OpenColorIO Documentation', u'Sony Pictures Imageworks',
('index', 'OpenColorIO', u'OpenColorIO Documentation', u'Academy Software Foundation',
'OpenColorIO', 'One line description of project.', 'Miscellaneous'),
]
texinfo_appendices = []
# -- Options for Epub output ---------------------------------------------------
epub_title = u'OpenColorIO'
epub_author = u'Sony Pictures Imageworks'
epub_publisher = u'Sony Pictures Imageworks'
epub_copyright = u'2010, Sony Pictures Imageworks'
epub_author = u'Contributors to the OpenColorIO Project'
epub_publisher = u'Contributors to the OpenColorIO Project'
epub_copyright = u'Contributors to the OpenColorIO Project'
#epub_language = ''
#epub_scheme = ''
#epub_identifier = ''
+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
@@ -6,7 +6,7 @@ Getting started
Checking Out The Codebase
*************************
The master code repository is available on Github: http://github.com/imageworks/OpenColorIO
The master code repository is available on Github: http://github.com/AcademySoftwareFoundation/OpenColorIO
For those unfamiliar with git, the wonderful part about it is that even though
only a limited number people have write access to the master repository, anyone
@@ -24,11 +24,11 @@ available at: http://help.github.com/
To check out a read-only version of the repository (no GitHub signup required)::
git clone git://github.com/imageworks/OpenColorIO.git ocio
git clone git://github.com/AcademySoftwareFoundation/OpenColorIO.git ocio
For write-access, you must first register for a GitHub account (free). Then,
you must create a local fork of the OpenColorIO repository by visiting
http://github.com/imageworks/OpenColorIO and clicking the "Fork" icon. If you
http://github.com/AcademySoftwareFoundation/OpenColorIO and clicking the "Fork" icon. If you
get hung up on this, further instructions on this process are available at
http://help.github.com/forking/
@@ -43,12 +43,12 @@ To check out a read-write version of the repository (GitHub acct required)::
Receiving objects: 100% (2220/2220), 2.89 MiB | 2.29 MiB/s, done.
Resolving deltas: 100% (1434/1434), done.
Both read + read/write users should then add the Imageworks (SPI) master branch
Both read + read/write users should then add the `AcademySoftwareFoundation/OpenColorIO <https://github.com/AcademySoftwareFoundation/OpenColorIO>`_ master branch
as a remote. This will allow you to more easily fetch updates as they become
available::
cd ocio
git remote add upstream git://github.com/imageworks/OpenColorIO.git
git remote add upstream git://github.com/AcademySoftwareFoundation/OpenColorIO.git
Optionally, you may then add any additional users who have individual working
forks (just as you've done). This will allow you to track, view, and
+1 -1
View File
@@ -268,7 +268,7 @@ analyze the op-stream metadata and determine the appropriate allocation to use.
interserting a forward allocation to the end of the pre-ops, and the inverse
allocation to the start of the lattice ops.
See https://github.com/imageworks/OpenColorIO/blob/master/src/core/NoOps.cpp#L183
See https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/master/src/core/NoOps.cpp#L183
#. The 3 lists of ops are then optimized individually, and stored on the processor.
The Lut3d is computed by applying the gpu-lattice ops, on the CPU, to a lut3d
+1 -1
View File
@@ -1,5 +1,5 @@
Issues
======
Please visit http://github.com/imageworks/OpenColorIO/issues for an up to date
Please visit http://github.com/AcademySoftwareFoundation/OpenColorIO/issues for an up to date
listing of bugs, feature requests etc
+5 -5
View File
@@ -23,7 +23,7 @@ successfully contribute to the project. If any of the terms used are unfamiliar
to you please do a quick search and then ask any of the contributors for
assistance.
* Fork the Imageworks OpenColorIO repository
* Fork the `AcademySoftwareFoundation/OpenColorIO <https://github.com/AcademySoftwareFoundation/OpenColorIO>`_ repository
* Activate Travis-CI and Appveyor for your fork
* Clone your fork to your local workspace::
@@ -32,15 +32,15 @@ assistance.
* cd into the cloned directory
* Connect your cloned repo to the original upstream repository as a remote::
git remote add upstream https://github.com/imageworks/OpenColorIO.git
git remote add upstream https://github.com/AcademySoftwareFoundation/OpenColorIO.git
* You should now have two remotes::
git remote -v
origin https://github.com/$USER/OpenColorIO (fetch)
origin https://github.com/$USER/OpenColorIO (fetch)
upstream https://github.com/imageworks/OpenColorIO (fetch)
upstream https://github.com/imageworks/OpenColorIO (push)
origin https://github.com/$USER/OpenColorIO (push)
upstream https://github.com/AcademySoftwareFoundation/OpenColorIO (fetch)
upstream https://github.com/AcademySoftwareFoundation/OpenColorIO (push)
* Pull the latest changes from upstream::
+20 -17
View File
@@ -5,8 +5,8 @@ Downloads
* Sample OCIO Configurations -- `.zip <http://github.com/imageworks/OpenColorIO-Configs/zipball/master>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO-Configs/tarball/master>`__
* Reference Images v1.0v4 -- `.tgz <http://code.google.com/p/opencolorio/downloads/detail?name=ocio-images.1.0v4.tgz>`__
* Core Library v1.0.9 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.9>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.9>`__
* Core Library latest -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/master>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/master>`__
* Core Library v1.1.1 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.1.1>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.1.1>`__
* Core Library latest -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/master>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/master>`__
Per-version updates: :ref:`changelog-main`.
@@ -16,27 +16,30 @@ Build instructions: :ref:`building-from-source`.
Contributor License Agreements
******************************
Please see the `Imageworks Open Source website <http://opensource.imageworks.com/cla/>`__
Please see the `OCIO GitHub repository <https://github.com/AcademySoftwareFoundation/OpenColorIO/tree/master/docs/aswf>`__
Deprecated Downloads
********************
* Reference Images v1.0v3 `tgz <http://code.google.com/p/opencolorio/downloads/detail?name=ocio-images.1.0v3.tgz>`__
* Reference Images v1.0v2 `tgz <http://code.google.com/p/opencolorio/downloads/detail?name=ocio-images.1.0v2.tgz>`__
* Reference Images v1.0v1 `tgz <http://code.google.com/p/opencolorio/downloads/detail?name=ocio-images.1.0v1.tgz>`__
* Core Library v1.0.8 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.8>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.8>`__
* Core Library v1.0.7 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.7>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.7>`__
* Core Library v1.0.6 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.6>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.6>`__
* Core Library v1.0.5 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.5>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.5>`__
* Core Library v1.0.4 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.4>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.4>`__
* Core Library v1.0.3 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.3>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.3>`__
* Core Library v1.0.2 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.2>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.2>`__
* Core Library v1.0.1 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.1>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.1>`__
* Core Library v1.0.0 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v1.0.0>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v1.0.0>`__
* Core Library v1.1.0 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.1.0>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.1.0>`__
* Core Library v1.0.9 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.9>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.9>`__
* Core Library v1.0.8 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.8>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.8>`__
* Core Library v1.0.7 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.7>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.7>`__
* Core Library v1.0.6 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.6>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.6>`__
* Core Library v1.0.5 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.5>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.5>`__
* Core Library v1.0.4 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.4>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.4>`__
* Core Library v1.0.3 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.3>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.3>`__
* Core Library v1.0.2 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.2>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.2>`__
* Core Library v1.0.1 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.1>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.1>`__
* Core Library v1.0.0 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v1.0.0>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v1.0.0>`__
* Color Config v0.7v4 `tgz <http://code.google.com/p/opencolorio/downloads/detail?name=ocio-configs.0.7v4.tgz>`__ (OCIO v0.7.6+)
* Core Library v0.8.7 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v0.8.7>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v0.8.7>`__
* Core Library v0.7.9 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v0.7.9>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v0.7.9>`__
* Core Library v0.6.1 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v0.6.1>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v0.6.1>`__
* Core Library v0.5.16 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v0.5.16>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v0.5.16>`__
* Core Library v0.5.8 -- `.zip <http://github.com/imageworks/OpenColorIO/zipball/v0.5.8>`__ `.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/v0.5.8>`__
* Core Library v0.8.7 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v0.8.7>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v0.8.7>`__
* Core Library v0.7.9 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v0.7.9>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v0.7.9>`__
* Core Library v0.6.1 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v0.6.1>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v0.6.1>`__
* Core Library v0.5.16 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v0.5.16>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v0.5.16>`__
* Core Library v0.5.8 -- `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/v0.5.8>`__ `.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/v0.5.8>`__
+8 -8
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,20 +51,20 @@ 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
*********************************
Source code is available on Github at
http://github.com/imageworks/OpenColorIO
http://github.com/AcademySoftwareFoundation/OpenColorIO
Download a `.zip <http://github.com/imageworks/OpenColorIO/zipball/master>`_ or
`.tar.gz <http://github.com/imageworks/OpenColorIO/tarball/master>`_ of the
Download a `.zip <http://github.com/AcademySoftwareFoundation/OpenColorIO/zipball/master>`_ or
`.tar.gz <http://github.com/AcademySoftwareFoundation/OpenColorIO/tarball/master>`_ of the
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:
+2 -1
View File
@@ -263,7 +263,8 @@ OCIO_NAMESPACE_ENTER
GPU_LANGUAGE_UNKNOWN = 0,
GPU_LANGUAGE_CG, ///< Nvidia Cg shader
GPU_LANGUAGE_GLSL_1_0, ///< OpenGL Shading Language
GPU_LANGUAGE_GLSL_1_3 ///< OpenGL Shading Language
GPU_LANGUAGE_GLSL_1_3, ///< OpenGL Shading Language
GPU_LANGUAGE_GLSL_4_0 ///< OpenGL Shading Language
};
//!cpp:type::
+1 -1
View File
@@ -113,7 +113,7 @@ def _cdltransforms_to_xml(allcc):
def SelectCCCIDPanel(*args, **kwargs):
# Wrap class definition in a function, so nukescripts.PythonPanel
# is only accessed when ``SelectCCCIDPanel()`` is called,
# https://github.com/imageworks/OpenColorIO/issues/277
# https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/277
import nukescripts
+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.
+101
View File
@@ -364,6 +364,7 @@ OCIO_NAMESPACE_ENTER
{
AutoMutex lock(g_cacheMutex);
g_cache.clear();
g_cacheSrcIsCC.clear();
}
// TODO: Expose functions for introspecting in ccc file
@@ -847,3 +848,103 @@ OCIO_NAMESPACE_ENTER
}
}
OCIO_NAMESPACE_EXIT
#ifdef OCIO_UNIT_TEST
namespace OCIO = OCIO_NAMESPACE;
#include "Platform.h"
#include "unittest.h"
namespace
{
static const std::string kContentsA(
"<ColorCorrectionCollection>\n"
" <ColorCorrection id=\"cc03343\">\n"
" <SOPNode>\n"
" <Slope>0.1 0.2 0.3 </Slope>\n"
" <Offset>0.8 0.1 0.3 </Offset>\n"
" <Power>0.5 0.5 0.5 </Power>\n"
" </SOPNode>\n"
" <SATNode>\n"
" <Saturation>1</Saturation>\n"
" </SATNode>\n"
" </ColorCorrection>\n"
" <ColorCorrection id=\"cc03344\">\n"
" <SOPNode>\n"
" <Slope>1.2 1.3 1.4 </Slope>\n"
" <Offset>0.3 0 0 </Offset>\n"
" <Power>0.75 0.75 0.75 </Power>\n"
" </SOPNode>\n"
" <SATNode>\n"
" <Saturation>1</Saturation>\n"
" </SATNode>\n"
" </ColorCorrection>\n"
"</ColorCorrectionCollection>\n"
);
static const std::string kContentsB(
"<ColorCorrectionCollection>\n"
" <ColorCorrection id=\"cc03343\">\n"
" <SOPNode>\n"
" <Slope>1.1 2.2 3.3 </Slope>\n"
" <Offset>0.8 0.1 0.3 </Offset>\n"
" <Power>0.5 0.5 0.5 </Power>\n"
" </SOPNode>\n"
" <SATNode>\n"
" <Saturation>1</Saturation>\n"
" </SATNode>\n"
" </ColorCorrection>\n"
" <ColorCorrection id=\"cc03344\">\n"
" <SOPNode>\n"
" <Slope>1.2 1.3 1.4 </Slope>\n"
" <Offset>0.3 0 0 </Offset>\n"
" <Power>0.75 0.75 0.75 </Power>\n"
" </SOPNode>\n"
" <SATNode>\n"
" <Saturation>1</Saturation>\n"
" </SATNode>\n"
" </ColorCorrection>\n"
"</ColorCorrectionCollection>\n"
);
}
OIIO_ADD_TEST(CDLTransform, clear_caches)
{
std::string filename;
OIIO_CHECK_NO_THROW(OCIO::Platform::createTempFilename(filename, ""));
std::fstream stream(filename.c_str(), std::ios_base::out|std::ios_base::trunc);
stream << kContentsA;
stream.close();
OCIO::CDLTransformRcPtr transform;
OIIO_CHECK_NO_THROW(transform = OCIO::CDLTransform::CreateFromFile(filename.c_str(), "cc03343"));
float slope[3];
OIIO_CHECK_NO_THROW(transform->getSlope(slope));
OIIO_CHECK_EQUAL(slope[0], 0.1f);
OIIO_CHECK_EQUAL(slope[1], 0.2f);
OIIO_CHECK_EQUAL(slope[2], 0.3f);
stream.open(filename.c_str(), std::ios_base::out|std::ios_base::trunc);
stream << kContentsB;
stream.close();
OIIO_CHECK_NO_THROW(OCIO::ClearAllCaches());
OIIO_CHECK_NO_THROW(transform = OCIO::CDLTransform::CreateFromFile(filename.c_str(), "cc03343"));
OIIO_CHECK_NO_THROW(transform->getSlope(slope));
OIIO_CHECK_EQUAL(slope[0], 1.1f);
OIIO_CHECK_EQUAL(slope[1], 2.2f);
OIIO_CHECK_EQUAL(slope[2], 3.3f);
}
#endif
+2 -2
View File
@@ -56,7 +56,7 @@ if(OCIO_BUILD_SHARED)
endif()
set_target_properties(OpenColorIO PROPERTIES
OUTPUT_NAME OpenColorIO
OUTPUT_NAME OpenColorIO${OCIO_LIBNAME_SUFFIX}
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}")
@@ -84,7 +84,7 @@ if(OCIO_BUILD_STATIC)
set_target_properties(OpenColorIO_STATIC PROPERTIES COMPILE_DEFINITIONS "OpenColorIO_STATIC")
set_target_properties(OpenColorIO_STATIC PROPERTIES
OUTPUT_NAME OpenColorIO
OUTPUT_NAME OpenColorIO${OCIO_LIBNAME_SUFFIX}
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/static"
COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS}"
LINK_FLAGS "${EXTERNAL_LINK_FLAGS}")
+379 -13
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;
@@ -324,7 +330,7 @@ OCIO_NAMESPACE_ENTER
sanitytext_ = rhs.sanitytext_;
cacheids_ = rhs.cacheids_;
cacheidnocontext_ = cacheidnocontext_;
cacheidnocontext_ = rhs.cacheidnocontext_;
}
return *this;
}
@@ -1909,11 +1915,8 @@ OIIO_ADD_TEST(Config, EnvCheck)
" - !<View> {name: Raw, colorspace: raw}\n"
"\n";
std::string test("SHOW=bar");
putenv((char *)test.c_str());
std::string test2("TASK=lighting");
putenv((char *)test2.c_str());
OCIO::Platform::setenv("SHOW", "bar");
OCIO::Platform::setenv("TASK", "lighting");
std::istringstream is;
is.str(SIMPLE_PROFILE);
@@ -2034,8 +2037,7 @@ OIIO_ADD_TEST(Config, Env_colorspace_name)
}
{
char * env = (char *)"CAMERARAW=lnh";
putenv(env);
OCIO::Platform::setenv("CAMERARAW", "lnh");
std::istringstream is;
is.str(MY_OCIO_CONFIG);
@@ -2048,9 +2050,7 @@ OIIO_ADD_TEST(Config, Env_colorspace_name)
{
// Test when the env. variable content is wrong
char * env = (char *)"CAMERARAW=FaultyColorSpaceName";
putenv(env);
OCIO::Platform::setenv("CAMERARAW", "FaultyColorSpaceName");
std::istringstream is;
is.str(MY_OCIO_CONFIG);
@@ -2077,4 +2077,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;
}
+34 -1
View File
@@ -334,7 +334,7 @@ OCIO_NAMESPACE_ENTER
}
else if(capability == FORMAT_CAPABILITY_WRITE)
{
if(index<0 || index>=static_cast<int>(m_readFormatNames.size()))
if(index<0 || index>=static_cast<int>(m_writeFormatNames.size()))
{
return "";
}
@@ -671,3 +671,36 @@ OCIO_NAMESPACE_ENTER
}
}
OCIO_NAMESPACE_EXIT
///////////////////////////////////////////////////////////////////////////////
#ifdef OCIO_UNIT_TEST
namespace OCIO = OCIO_NAMESPACE;
#include "UnitTest.h"
void ValidateFormatByIndex(OCIO::FormatRegistry &reg, int cap)
{
int numFormat = reg.getNumFormats(cap);
// Check out of bounds access
OIIO_CHECK_EQUAL(0, strcmp(reg.getFormatNameByIndex(cap, -1), ""));
OIIO_CHECK_EQUAL(0, strcmp(reg.getFormatExtensionByIndex(cap, -1), ""));
OIIO_CHECK_EQUAL(0, strcmp(reg.getFormatNameByIndex(cap, numFormat), ""));
OIIO_CHECK_EQUAL(0, strcmp(reg.getFormatExtensionByIndex(cap, numFormat), ""));
// Check valid access
for (int i = 0; i < numFormat; ++i) {
OIIO_CHECK_NE(0, strcmp(reg.getFormatNameByIndex(cap, i), ""));
OIIO_CHECK_NE(0, strcmp(reg.getFormatExtensionByIndex(cap, i), ""));
}
}
OIIO_ADD_TEST(FileTransform, FormatByIndex)
{
OCIO::FormatRegistry & formatRegistry = OCIO::FormatRegistry::GetInstance();
ValidateFormatByIndex(formatRegistry, OCIO::FORMAT_CAPABILITY_WRITE);
ValidateFormatByIndex(formatRegistry, OCIO::FORMAT_CAPABILITY_READ);
}
#endif // OCIO_UNIT_TEST
+10 -4
View File
@@ -48,7 +48,7 @@ OCIO_NAMESPACE_ENTER
}
os << ")";
}
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
os << "mat4(";
for(int i=0; i<16; i++)
@@ -76,7 +76,7 @@ OCIO_NAMESPACE_ENTER
}
os << ")";
}
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
os << "vec4(";
for(int i=0; i<4; i++)
@@ -104,7 +104,7 @@ OCIO_NAMESPACE_ENTER
}
os << ")";
}
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
os << "vec3(";
for(int i=0; i<3; i++)
@@ -153,7 +153,7 @@ OCIO_NAMESPACE_ENTER
{
os << "mul( " << mtx << ", " << vec << ")";
}
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
os << vec << " * " << mtx;
}
@@ -183,6 +183,12 @@ OCIO_NAMESPACE_ENTER
os << lutName << ", ";
os << m << " * " << variableName << ".rgb + " << b << ").rgb;" << std::endl;
}
else if(lang == GPU_LANGUAGE_GLSL_4_0)
{
os << "texture(";
os << lutName << ", ";
os << m << " * " << variableName << ".rgb + " << b << ").rgb;" << std::endl;
}
else
{
throw Exception("Unsupported shader language.");
+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
+2
View File
@@ -207,6 +207,7 @@ OCIO_NAMESPACE_ENTER
if(language == GPU_LANGUAGE_CG) return "cg";
else if(language == GPU_LANGUAGE_GLSL_1_0) return "glsl_1.0";
else if(language == GPU_LANGUAGE_GLSL_1_3) return "glsl_1.3";
else if(language == GPU_LANGUAGE_GLSL_4_0) return "glsl_4.0";
return "unknown";
}
@@ -216,6 +217,7 @@ OCIO_NAMESPACE_ENTER
if(str == "cg") return GPU_LANGUAGE_CG;
else if(str == "glsl_1.0") return GPU_LANGUAGE_GLSL_1_0;
else if(str == "glsl_1.3") return GPU_LANGUAGE_GLSL_1_3;
else if(str == "glsl_4.0") return GPU_LANGUAGE_GLSL_4_0;
return GPU_LANGUAGE_UNKNOWN;
}
+177 -100
View File
@@ -1,100 +1,177 @@
//
// made by Autodesk Inc. under the terms of the OpenColorIO BSD 3 Clause License
//
//
#include <OpenColorIO/OpenColorIO.h>
#include "Platform.h"
OCIO_NAMESPACE_ENTER
{
namespace Platform
{
// Unlike the ::getenv(), the method does not use any static buffer
// for the Windows platform only. *nix platforms are still using
// the ::getenv method, but reducing the static vairable usage.
//
void getenv (const char* name, std::string& value)
{
#ifdef WINDOWS
// To remove the security compilation warning, the _dupenv_s method
// must be used (instead of the getenv). The improvement is that
// the buffer length is now under control to mitigate buffer overflow attacks.
//
char * val;
size_t len = 0;
// At least _dupenv_s validates the memory size by returning ENOMEM
// in case of allocation size issue.
const errno_t err = ::_dupenv_s(&val, &len, name);
if(err!=0 || len==0 || !val || !*val)
{
if(val) free(val);
value.resize(0);
}
else
{
value.resize(len+1);
::snprintf(&value[0], len, "%s", val);
if(val) free(val);
}
#else
const char* val = ::getenv(name);
value = (val && *val) ? val : "";
#endif
}
}//namespace platform
}
OCIO_NAMESPACE_EXIT
///////////////////////////////////////////////////////////////////////////////
#ifdef OCIO_UNIT_TEST
namespace OCIO = OCIO_NAMESPACE;
#include "UnitTest.h"
OIIO_ADD_TEST(Platform, getenv)
{
{
std::string env;
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OIIO_CHECK_ASSERT(env.empty());
}
{
std::string env;
OCIO::Platform::getenv("PATH", env);
OIIO_CHECK_ASSERT(!env.empty());
}
{
std::string env;
OCIO::Platform::getenv("PATH", env);
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OIIO_CHECK_ASSERT(env.empty());
}
{
std::string env;
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OCIO::Platform::getenv("PATH", env);
OIIO_CHECK_ASSERT(!env.empty());
}
}
OIIO_ADD_TEST(Platform, putenv)
{
{
::putenv("MY_DUMMY_ENV=SomeValue");
std::string env;
OCIO::Platform::getenv("MY_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(!env.empty());
OIIO_CHECK_ASSERT(0==strcmp("SomeValue", env.c_str()));
}
}
#endif // OCIO_UNIT_TEST
//
// made by Autodesk Inc. under the terms of the OpenColorIO BSD 3 Clause License
//
//
#include <cstdlib>
#include <sstream>
#include <vector>
#include <OpenColorIO/OpenColorIO.h>
#include "Platform.h"
OCIO_NAMESPACE_ENTER
{
namespace Platform
{
void getenv (const char* name, std::string& value)
{
#ifdef _WIN32
if(uint32_t size = GetEnvironmentVariable(name, nullptr, 0))
{
std::vector<char> buffer(size);
GetEnvironmentVariable(name, buffer.data(), size);
value = std::string(buffer.data());
}
else
{
value.clear();
}
#else
const char* val = ::getenv(name);
value = (val && *val) ? val : "";
#endif
}
void setenv (const char* name, const std::string& value)
{
#ifdef _WIN32
::_putenv_s(name, value.c_str());
#else
::setenv(name, value.c_str(), 1);
#endif
}
void createTempFilename(std::string & filename, const std::string & filenameExt)
{
// Note: Because of security issue, tmpnam could not be used.
#ifdef _WIN32
char tmpFilename[L_tmpnam];
if(tmpnam_s(tmpFilename))
{
throw Exception("Could not create a temporary file.");
}
filename = tmpFilename;
#else
std::stringstream ss;
ss << "/tmp/ocio";
ss << std::rand();
filename = ss.str();
#endif
filename += filenameExt;
}
}//namespace platform
}
OCIO_NAMESPACE_EXIT
///////////////////////////////////////////////////////////////////////////////
#ifdef OCIO_UNIT_TEST
namespace OCIO = OCIO_NAMESPACE;
#include "UnitTest.h"
OIIO_ADD_TEST(Platform, getenv)
{
{
std::string env;
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OIIO_CHECK_ASSERT(env.empty());
}
{
std::string env;
OCIO::Platform::getenv("PATH", env);
OIIO_CHECK_ASSERT(!env.empty());
}
{
std::string env;
OCIO::Platform::getenv("PATH", env);
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OIIO_CHECK_ASSERT(env.empty());
}
{
std::string env;
OCIO::Platform::getenv("NotExistingEnvVariable", env);
OCIO::Platform::getenv("PATH", env);
OIIO_CHECK_ASSERT(!env.empty());
}
#ifdef _WIN32
{
SetEnvironmentVariable("MY_WINDOWS_DUMMY_ENV", "1");
std::string env;
OCIO::Platform::getenv("MY_WINDOWS_DUMMY_ENV", env);
OIIO_CHECK_EQUAL(env, std::string("1"));
}
{
SetEnvironmentVariable("MY_WINDOWS_DUMMY_ENV", " ");
std::string env;
OCIO::Platform::getenv("MY_WINDOWS_DUMMY_ENV", env);
OIIO_CHECK_EQUAL(env, std::string(" "));
}
{
SetEnvironmentVariable("MY_WINDOWS_DUMMY_ENV", "");
std::string env;
OCIO::Platform::getenv("MY_WINDOWS_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(env.empty());
}
#endif
}
OIIO_ADD_TEST(Platform, setenv)
{
{
OCIO::Platform::setenv("MY_DUMMY_ENV", "SomeValue");
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());
}
{
OCIO::Platform::setenv("MY_DUMMY_ENV", " ");
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());
}
{
OCIO::Platform::setenv("MY_DUMMY_ENV", "");
std::string env;
OCIO::Platform::getenv("MY_DUMMY_ENV", env);
OIIO_CHECK_ASSERT(env.empty());
}
}
OIIO_ADD_TEST(Platform, createTempFilename)
{
std::string f1, f2;
OIIO_CHECK_NO_THROW(OCIO::Platform::createTempFilename(f1, ""));
OIIO_CHECK_NO_THROW(OCIO::Platform::createTempFilename(f2, ""));
OIIO_CHECK_ASSERT(f1!=f2);
OIIO_CHECK_NO_THROW(OCIO::Platform::createTempFilename(f1, ".ctf"));
OIIO_CHECK_NO_THROW(OCIO::Platform::createTempFilename(f2, ".ctf"));
OIIO_CHECK_ASSERT(f1!=f2);
}
#endif // OCIO_UNIT_TEST
+4 -1
View File
@@ -103,7 +103,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#define snprintf sprintf_s
#define strtok_r strtok_s
#define sscanf sscanf_s
#define putenv _putenv
typedef __int64 FilePos;
#define fseeko _fseeki64
#define ftello _ftelli64
@@ -158,6 +157,10 @@ OCIO_NAMESPACE_ENTER
namespace Platform
{
void getenv (const char* name, std::string& value);
void setenv (const char* name, const std::string& value);
// Create a temporary filename where filenameExt could be empty.
void createTempFilename(std::string & filename, const std::string & filenameExt);
}
}
+2 -2
View File
@@ -241,7 +241,7 @@ OCIO_NAMESPACE_ENTER
shader << "vec4 " << fcnName << "(vec4 inPixel, \n";
shader << " sampler3D " << lut3dName << ") \n";
}
else if(lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
shader << "vec4 " << fcnName << "(in vec4 inPixel, \n";
shader << " const sampler3D " << lut3dName << ") \n";
@@ -254,7 +254,7 @@ OCIO_NAMESPACE_ENTER
{
shader << "half4 " << pixelName << " = inPixel; \n";
}
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3)
else if(lang == GPU_LANGUAGE_GLSL_1_0 || lang == GPU_LANGUAGE_GLSL_1_3 || lang == GPU_LANGUAGE_GLSL_4_0)
{
shader << "vec4 " << pixelName << " = inPixel; \n";
}
@@ -43,4 +43,6 @@ public class GpuLanguage extends LoadLibrary
GPU_LANGUAGE_GLSL_1_0 = new GpuLanguage(2);
public static final GpuLanguage
GPU_LANGUAGE_GLSL_1_3 = new GpuLanguage(3);
public static final GpuLanguage
GPU_LANGUAGE_GLSL_4_0 = new GpuLanguage(4);
}
@@ -133,6 +133,8 @@ public class GlobalsTest extends TestCase {
assertEquals(globals.GpuLanguageFromString("glsl_1.0"), GpuLanguage.GPU_LANGUAGE_GLSL_1_0);
assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_GLSL_1_3), "glsl_1.3");
assertEquals(globals.GpuLanguageFromString("glsl_1.3"), GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
assertEquals(globals.GpuLanguageToString(GpuLanguage.GPU_LANGUAGE_GLSL_4_0), "glsl_4.0");
assertEquals(globals.GpuLanguageFromString("glsl_4.0"), GpuLanguage.GPU_LANGUAGE_GLSL_4_0);
// EnvironmentMode
assertEquals(globals.EnvironmentModeToString(EnvironmentMode.ENV_ENVIRONMENT_UNKNOWN), "unknown");
@@ -12,13 +12,23 @@ public class GpuShaderDescTest extends TestCase {
public void test_interface() {
GpuShaderDesc desc = new GpuShaderDesc();
desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
assertEquals(GpuLanguage.GPU_LANGUAGE_GLSL_1_3, desc.getLanguage());
desc.setFunctionName("foo123");
assertEquals("foo123", desc.getFunctionName());
desc.setLut3DEdgeLen(32);
assertEquals(32, desc.getLut3DEdgeLen());
desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_1_0);
assertEquals(GpuLanguage.GPU_LANGUAGE_GLSL_1_0, desc.getLanguage());
assertEquals("glsl_1.0 foo123 32", desc.getCacheID());
desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_1_3);
assertEquals(GpuLanguage.GPU_LANGUAGE_GLSL_1_3, desc.getLanguage());
assertEquals("glsl_1.3 foo123 32", desc.getCacheID());
desc.setLanguage(GpuLanguage.GPU_LANGUAGE_GLSL_4_0);
assertEquals(GpuLanguage.GPU_LANGUAGE_GLSL_4_0, desc.getLanguage());
assertEquals("glsl_4.0 foo123 32", desc.getCacheID());
}
}
+5 -1
View File
@@ -11,6 +11,10 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# Python breaks strict-aliasing rules. Disable the warning here.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing -Wno-missing-field-initializers")
# GCC 8 and above has a new heuristic to detect invalid pointer
# casts. However, this results in false positives on the Python
# C API which we compile against to generate Python bindings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cast-function-type")
endif()
if(WIN32)
@@ -93,7 +97,7 @@ endif()
#
# TODO: This wont let the normal shared library symbols work on OSX.
# We should explore whether this should be built as a normal dylib, instead
# of as a bundle. See https://github.com/imageworks/OpenColorIO/pull/175
# of as a bundle. See https://github.com/AcademySoftwareFoundation/OpenColorIO/pull/175
if(OCIO_PYGLUE_SONAME)
message(STATUS "Setting PyOCIO SOVERSION to: ${SOVERSION}")
-1
View File
@@ -53,7 +53,6 @@ OCIO_NAMESPACE_ENTER
///
int PyOCIO_AllocationTransform_init(PyOCIO_Transform * self, PyObject * args, PyObject * kwds);
PyObject * PyOCIO_AllocationTransform_equals(PyObject * self, PyObject * args);
PyObject * PyOCIO_AllocationTransform_getAllocation(PyObject * self);
PyObject * PyOCIO_AllocationTransform_setAllocation(PyObject * self, PyObject * args);
PyObject * PyOCIO_AllocationTransform_getNumVars(PyObject * self);
+2
View File
@@ -148,6 +148,8 @@ OCIO_NAMESPACE_ENTER
const_cast<char*>(GpuLanguageToString(GPU_LANGUAGE_GLSL_1_0)));
PyModule_AddStringConstant(m, "GPU_LANGUAGE_GLSL_1_3",
const_cast<char*>(GpuLanguageToString(GPU_LANGUAGE_GLSL_1_3)));
PyModule_AddStringConstant(m, "GPU_LANGUAGE_GLSL_4_0",
const_cast<char*>(GpuLanguageToString(GPU_LANGUAGE_GLSL_4_0)));
PyModule_AddStringConstant(m, "ENV_ENVIRONMENT_UNKNOWN",
const_cast<char*>(EnvironmentModeToString(ENV_ENVIRONMENT_UNKNOWN)));
+1
View File
@@ -58,6 +58,7 @@ class ConstantsTest(unittest.TestCase):
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_CG, "cg")
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_1_0, "glsl_1.0")
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_1_3, "glsl_1.3")
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_4_0, "glsl_4.0")
# EnvironmentMode
self.assertEqual(OCIO.Constants.ENV_ENVIRONMENT_UNKNOWN, "unknown")
+12 -2
View File
@@ -7,11 +7,21 @@ class GpuShaderDescTest(unittest.TestCase):
def test_interface(self):
desc = OCIO.GpuShaderDesc()
desc.setLanguage(OCIO.Constants.GPU_LANGUAGE_GLSL_1_3)
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_1_3, desc.getLanguage())
desc.setFunctionName("foo123")
self.assertEqual("foo123", desc.getFunctionName())
desc.setLut3DEdgeLen(32)
self.assertEqual(32, desc.getLut3DEdgeLen())
desc.setLanguage(OCIO.Constants.GPU_LANGUAGE_GLSL_1_0)
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_1_0, desc.getLanguage())
self.assertEqual("glsl_1.0 foo123 32", desc.getCacheID())
desc.setLanguage(OCIO.Constants.GPU_LANGUAGE_GLSL_1_3)
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_1_3, desc.getLanguage())
self.assertEqual("glsl_1.3 foo123 32", desc.getCacheID())
desc.setLanguage(OCIO.Constants.GPU_LANGUAGE_GLSL_4_0)
self.assertEqual(OCIO.Constants.GPU_LANGUAGE_GLSL_4_0, desc.getLanguage())
self.assertEqual("glsl_4.0 foo123 32", desc.getCacheID())