2012-09-15 10:03:17 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2012 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2013-03-29 16:02:27 +00:00
|
|
|
#include <sstream>
|
2012-09-15 10:03:17 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2016-02-20 08:45:01 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# pragma warning(push)
|
|
|
|
# pragma warning(disable : 4251 4275)
|
|
|
|
#endif
|
2012-09-15 10:03:17 +00:00
|
|
|
#include <OpenColorIO/OpenColorIO.h>
|
2016-02-20 08:45:01 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# pragma warning(pop)
|
|
|
|
#endif
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
using namespace OCIO_NAMESPACE;
|
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2012-10-04 13:39:08 +00:00
|
|
|
#include "ocio_impl.h"
|
2012-09-15 10:03:17 +00:00
|
|
|
|
2012-09-26 13:21:10 +00:00
|
|
|
#if !defined(WITH_ASSERT_ABORT)
|
2012-09-15 10:03:17 +00:00
|
|
|
# define OCIO_abort()
|
|
|
|
#else
|
|
|
|
# include <stdlib.h>
|
|
|
|
# define OCIO_abort() abort()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
# define __func__ __FUNCTION__
|
|
|
|
#endif
|
|
|
|
|
2018-12-05 12:34:04 +00:00
|
|
|
/* NOTE: This is because OCIO 1.1.0 has a bug which makes default
|
|
|
|
* display to be the one which is first alphabetically.
|
|
|
|
*
|
|
|
|
* Fix has been submitted as a patch
|
|
|
|
* https://github.com/imageworks/OpenColorIO/pull/638
|
|
|
|
*
|
|
|
|
* For until then we use first usable display instead. */
|
|
|
|
#define DEFAULT_DISPLAY_WORKAROUND
|
|
|
|
#ifdef DEFAULT_DISPLAY_WORKAROUND
|
2018-12-06 09:55:31 +00:00
|
|
|
# include <algorithm>
|
|
|
|
# include <map>
|
2018-12-05 12:34:04 +00:00
|
|
|
# include <mutex>
|
2018-12-06 09:55:31 +00:00
|
|
|
# include <vector>
|
|
|
|
# include <string>
|
|
|
|
# include <set>
|
|
|
|
using std::vector;
|
|
|
|
using std::set;
|
|
|
|
using std::string;
|
|
|
|
using std::map;
|
2018-12-05 12:34:04 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
static void OCIO_reportError(const char *err)
|
|
|
|
{
|
|
|
|
std::cerr << "OpenColorIO Error: " << err << std::endl;
|
|
|
|
|
2012-09-26 13:21:10 +00:00
|
|
|
OCIO_abort();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void OCIO_reportException(Exception &exception)
|
|
|
|
{
|
|
|
|
OCIO_reportError(exception.what());
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *OCIOImpl::getCurrentConfig(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstConfigRcPtr *config = OBJECT_GUARDED_NEW(ConstConfigRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
*config = GetCurrentConfig();
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
if (*config)
|
|
|
|
return (OCIO_ConstConfigRcPtr *) config;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(config, ConstConfigRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr *config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
SetCurrentConfig(*(ConstConfigRcPtr *) config);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromEnv(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstConfigRcPtr *config = OBJECT_GUARDED_NEW(ConstConfigRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
*config = Config::CreateFromEnv();
|
|
|
|
|
|
|
|
if (*config)
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstConfigRcPtr *) config;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(config, ConstConfigRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromFile(const char *filename)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstConfigRcPtr *config = OBJECT_GUARDED_NEW(ConstConfigRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
2016-03-23 18:25:29 +00:00
|
|
|
*config = Config::CreateFromFile(filename);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (*config)
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstConfigRcPtr *) config;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(config, ConstConfigRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::configRelease(OCIO_ConstConfigRcPtr *config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((ConstConfigRcPtr *) config, ConstConfigRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::configGetNumColorSpaces(OCIO_ConstConfigRcPtr *config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getNumColorSpaces();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *config, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getColorSpaceNameByIndex(index);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstColorSpaceRcPtr *OCIOImpl::configGetColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstColorSpaceRcPtr *cs = OBJECT_GUARDED_NEW(ConstColorSpaceRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
*cs = (*(ConstConfigRcPtr *) config)->getColorSpace(name);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (*cs)
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstColorSpaceRcPtr *) cs;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(cs, ConstColorSpaceRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getIndexForColorSpace(name);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetDefaultDisplay(OCIO_ConstConfigRcPtr *config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2018-12-05 12:34:04 +00:00
|
|
|
#ifdef DEFAULT_DISPLAY_WORKAROUND
|
|
|
|
if (getenv("OCIO_ACTIVE_DISPLAYS") == NULL) {
|
|
|
|
const char *active_displays =
|
|
|
|
(*(ConstConfigRcPtr *) config)->getActiveDisplays();
|
2018-12-06 08:16:52 +00:00
|
|
|
if (active_displays[0] != '\0') {
|
|
|
|
const char *separator_pos = strchr(active_displays, ',');
|
|
|
|
if (separator_pos == NULL) {
|
|
|
|
return active_displays;
|
|
|
|
}
|
|
|
|
static std::string active_display;
|
|
|
|
/* NOTE: Configuration is shared and is never changed during
|
|
|
|
* runtime, so we only guarantee two threads don't initialize at the
|
|
|
|
* same. */
|
|
|
|
static std::mutex mutex;
|
|
|
|
mutex.lock();
|
|
|
|
if (active_display.empty()) {
|
|
|
|
active_display = active_displays;
|
|
|
|
active_display[separator_pos - active_displays] = '\0';
|
|
|
|
}
|
|
|
|
mutex.unlock();
|
|
|
|
return active_display.c_str();
|
2018-12-05 12:34:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getDefaultDisplay();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::configGetNumDisplays(OCIO_ConstConfigRcPtr* config)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getNumDisplays();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetDisplay(OCIO_ConstConfigRcPtr *config, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getDisplay(index);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-12-06 09:55:31 +00:00
|
|
|
#ifdef DEFAULT_DISPLAY_WORKAROUND
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
void splitStringEnvStyle(vector<string>* tokens, const string& str)
|
|
|
|
{
|
|
|
|
tokens->clear();
|
|
|
|
const int len = str.length();
|
|
|
|
int token_start = 0, token_length = 0;
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
const char ch = str[i];
|
|
|
|
if (ch != ',' && ch != ':') {
|
|
|
|
/* Append non-separator char to a token. */
|
|
|
|
++token_length;
|
|
|
|
} else {
|
|
|
|
/* Append current token to the list (if any). */
|
|
|
|
if (token_length > 0) {
|
|
|
|
string token = str.substr(token_start, token_length);
|
|
|
|
tokens->push_back(token);
|
|
|
|
}
|
|
|
|
/* Re-set token pointers. */
|
|
|
|
token_start = i + 1;
|
|
|
|
token_length = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Append token which might be at the end of the string. */
|
|
|
|
if (token_length != 0) {
|
|
|
|
string token = str.substr(token_start, token_length);
|
|
|
|
tokens->push_back(token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string stringToLower(const string& str) {
|
|
|
|
string lower = str;
|
|
|
|
std::transform(lower.begin(), lower.end(), lower.begin(), tolower);
|
|
|
|
return lower;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
#endif
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *config, const char *display)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2018-12-05 12:34:04 +00:00
|
|
|
#ifdef DEFAULT_DISPLAY_WORKAROUND
|
|
|
|
/* NOTE: We assume that first active view always exists for a default
|
|
|
|
* display. */
|
|
|
|
if (getenv("OCIO_ACTIVE_VIEWS") == NULL) {
|
2018-12-06 09:55:31 +00:00
|
|
|
ConstConfigRcPtr config_ptr = *((ConstConfigRcPtr *) config);
|
|
|
|
const char *active_views_encoded = config_ptr->getActiveViews();
|
|
|
|
if (active_views_encoded[0] != '\0') {
|
|
|
|
const string display_lower = stringToLower(display);
|
|
|
|
static map<string, string> default_display_views;
|
2018-12-06 08:16:52 +00:00
|
|
|
static std::mutex mutex;
|
|
|
|
mutex.lock();
|
2018-12-06 09:55:31 +00:00
|
|
|
/* Check if the view is already known. */
|
|
|
|
map<string, string>::const_iterator it =
|
|
|
|
default_display_views.find(display_lower);
|
|
|
|
if (it != default_display_views.end()) {
|
|
|
|
mutex.unlock();
|
|
|
|
return it->second.c_str();
|
|
|
|
}
|
|
|
|
/* Active views. */
|
|
|
|
vector<string> active_views;
|
|
|
|
splitStringEnvStyle(&active_views, active_views_encoded);
|
|
|
|
/* Get all views supported by tge display. */
|
|
|
|
set<string> display_views;
|
|
|
|
const int num_display_views = config_ptr->getNumViews(display);
|
|
|
|
for (int view_index = 0;
|
|
|
|
view_index < num_display_views;
|
|
|
|
++view_index)
|
|
|
|
{
|
|
|
|
const char *view = config_ptr->getView(display, view_index);
|
|
|
|
display_views.insert(stringToLower(view));
|
|
|
|
}
|
|
|
|
/* Get first view which is supported by tge display. */
|
|
|
|
for (const string& view : active_views) {
|
|
|
|
const string view_lower = stringToLower(view);
|
|
|
|
if (display_views.find(view_lower) != display_views.end()) {
|
|
|
|
default_display_views[display_lower] = view;
|
|
|
|
mutex.unlock();
|
|
|
|
return default_display_views[display_lower].c_str();
|
|
|
|
}
|
2018-12-06 08:16:52 +00:00
|
|
|
}
|
|
|
|
mutex.unlock();
|
2018-12-05 12:34:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2012-09-15 10:03:17 +00:00
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getDefaultView(display);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::configGetNumViews(OCIO_ConstConfigRcPtr *config, const char *display)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getNumViews(display);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetView(OCIO_ConstConfigRcPtr *config, const char *display, int index)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getView(display, index);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *config, const char *display, const char *view)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstConfigRcPtr *) config)->getDisplayColorSpaceName(display, view);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-03-17 13:15:05 +00:00
|
|
|
void OCIOImpl::configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *rgb)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
(*(ConstConfigRcPtr *) config)->getDefaultLumaCoefs(rgb);
|
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-12 14:42:34 +00:00
|
|
|
void OCIOImpl::configGetXYZtoRGB(OCIO_ConstConfigRcPtr *config_, float xyz_to_rgb[3][3])
|
|
|
|
{
|
|
|
|
ConstConfigRcPtr config = (*(ConstConfigRcPtr *) config_);
|
|
|
|
|
|
|
|
/* Default to ITU-BT.709 in case no appropriate transform found. */
|
|
|
|
memcpy(xyz_to_rgb, OCIO_XYZ_TO_LINEAR_SRGB, sizeof(OCIO_XYZ_TO_LINEAR_SRGB));
|
|
|
|
|
|
|
|
/* Auto estimate from XYZ and scene_linear roles, assumed to be a linear transform. */
|
|
|
|
if(config->hasRole("XYZ") && config->hasRole("scene_linear")) {
|
|
|
|
ConstProcessorRcPtr to_rgb_processor = config->getProcessor("XYZ", "scene_linear");
|
|
|
|
if(to_rgb_processor) {
|
|
|
|
xyz_to_rgb[0][0] = 1.0f;
|
|
|
|
xyz_to_rgb[0][1] = 0.0f;
|
|
|
|
xyz_to_rgb[0][2] = 0.0f;
|
|
|
|
xyz_to_rgb[1][0] = 0.0f;
|
|
|
|
xyz_to_rgb[1][1] = 1.0f;
|
|
|
|
xyz_to_rgb[1][2] = 0.0f;
|
|
|
|
xyz_to_rgb[2][0] = 0.0f;
|
|
|
|
xyz_to_rgb[2][1] = 0.0f;
|
|
|
|
xyz_to_rgb[2][2] = 1.0f;
|
|
|
|
to_rgb_processor->applyRGB(xyz_to_rgb[0]);
|
|
|
|
to_rgb_processor->applyRGB(xyz_to_rgb[1]);
|
|
|
|
to_rgb_processor->applyRGB(xyz_to_rgb[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-09 09:48:26 +00:00
|
|
|
int OCIOImpl::configGetNumLooks(OCIO_ConstConfigRcPtr *config)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return (*(ConstConfigRcPtr *) config)->getNumLooks();
|
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *OCIOImpl::configGetLookNameByIndex(OCIO_ConstConfigRcPtr *config, int index)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
return (*(ConstConfigRcPtr *) config)->getLookNameByIndex(index);
|
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
OCIO_ConstLookRcPtr *OCIOImpl::configGetLook(OCIO_ConstConfigRcPtr *config, const char *name)
|
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstLookRcPtr *look = OBJECT_GUARDED_NEW(ConstLookRcPtr);
|
2013-09-09 09:48:26 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
*look = (*(ConstConfigRcPtr *) config)->getLook(name);
|
|
|
|
|
|
|
|
if (*look)
|
|
|
|
return (OCIO_ConstLookRcPtr *) look;
|
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(look, ConstLookRcPtr);
|
2013-09-09 09:48:26 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *OCIOImpl::lookGetProcessSpace(OCIO_ConstLookRcPtr *look)
|
|
|
|
{
|
|
|
|
return (*(ConstLookRcPtr *) look)->getProcessSpace();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OCIOImpl::lookRelease(OCIO_ConstLookRcPtr *look)
|
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((ConstLookRcPtr *) look, ConstLookRcPtr);
|
2013-09-09 09:48:26 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs_)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
ConstColorSpaceRcPtr *cs = (ConstColorSpaceRcPtr *) cs_;
|
2012-09-15 10:03:17 +00:00
|
|
|
const char *family = (*cs)->getFamily();
|
|
|
|
|
|
|
|
if (!strcmp(family, "rrt") || !strcmp(family, "display")) {
|
|
|
|
/* assume display and rrt transformations are not invertible
|
|
|
|
* in fact some of them could be, but it doesn't make much sense to allow use them as invertible
|
|
|
|
*/
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*cs)->isData()) {
|
|
|
|
/* data color spaces don't have transformation at all */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*cs)->getTransform(COLORSPACE_DIR_TO_REFERENCE)) {
|
|
|
|
/* if there's defined transform to reference space, color space could be converted to scene linear */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
int OCIOImpl::colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-19 15:01:36 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstColorSpaceRcPtr *) cs)->isData();
|
2012-09-19 15:01:36 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((ConstColorSpaceRcPtr *) cs, ConstColorSpaceRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstProcessorRcPtr *OCIOImpl::configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config, const char *srcName, const char *dstName)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstProcessorRcPtr *p = OBJECT_GUARDED_NEW(ConstProcessorRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
*p = (*(ConstConfigRcPtr *) config)->getProcessor(srcName, dstName);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (*p)
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstProcessorRcPtr *) p;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(p, ConstProcessorRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ConstProcessorRcPtr *OCIOImpl::configGetProcessor(OCIO_ConstConfigRcPtr *config, OCIO_ConstTransformRcPtr *transform)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ConstProcessorRcPtr *p = OBJECT_GUARDED_NEW(ConstProcessorRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
*p = (*(ConstConfigRcPtr *) config)->getProcessor(*(ConstTransformRcPtr *) transform);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
if (*p)
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ConstProcessorRcPtr *) p;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(p, ConstProcessorRcPtr);
|
2012-09-18 19:20:26 +00:00
|
|
|
|
2012-09-15 10:03:17 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorApply(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->apply(*(PackedImageDesc *) img);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorApply_predivide(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img_)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
2012-10-05 10:05:26 +00:00
|
|
|
PackedImageDesc *img = (PackedImageDesc *) img_;
|
2012-09-15 10:03:17 +00:00
|
|
|
int channels = img->getNumChannels();
|
|
|
|
|
|
|
|
if (channels == 4) {
|
|
|
|
float *pixels = img->getData();
|
|
|
|
|
|
|
|
int width = img->getWidth();
|
|
|
|
int height = img->getHeight();
|
|
|
|
|
|
|
|
for (int y = 0; y < height; y++) {
|
|
|
|
for (int x = 0; x < width; x++) {
|
|
|
|
float *pixel = pixels + 4 * (y * width + x);
|
|
|
|
|
2012-10-04 13:39:08 +00:00
|
|
|
processorApplyRGBA_predivide(processor, pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->apply(*img);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorApplyRGB(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->applyRGB(pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorApplyRGBA(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->applyRGBA(pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorApplyRGBA_predivide(OCIO_ConstProcessorRcPtr *processor, float *pixel)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
if (pixel[3] == 1.0f || pixel[3] == 0.0f) {
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->applyRGBA(pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
float alpha, inv_alpha;
|
|
|
|
|
|
|
|
alpha = pixel[3];
|
|
|
|
inv_alpha = 1.0f / alpha;
|
|
|
|
|
|
|
|
pixel[0] *= inv_alpha;
|
|
|
|
pixel[1] *= inv_alpha;
|
|
|
|
pixel[2] *= inv_alpha;
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ConstProcessorRcPtr *) processor)->applyRGBA(pixel);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
pixel[0] *= alpha;
|
|
|
|
pixel[1] *= alpha;
|
|
|
|
pixel[2] *= alpha;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::processorRelease(OCIO_ConstProcessorRcPtr *p)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE(p, ConstProcessorRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::colorSpaceGetName(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstColorSpaceRcPtr *) cs)->getName();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::colorSpaceGetDescription(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstColorSpaceRcPtr *) cs)->getDescription();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
const char *OCIOImpl::colorSpaceGetFamily(OCIO_ConstColorSpaceRcPtr *cs)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
return (*(ConstColorSpaceRcPtr *)cs)->getFamily();
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_DisplayTransformRcPtr *OCIOImpl::createDisplayTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
DisplayTransformRcPtr *dt = OBJECT_GUARDED_NEW(DisplayTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
*dt = DisplayTransform::Create();
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_DisplayTransformRcPtr *) dt;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetInputColorSpaceName(OCIO_DisplayTransformRcPtr *dt, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(DisplayTransformRcPtr *) dt)->setInputColorSpaceName(name);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetDisplay(OCIO_DisplayTransformRcPtr *dt, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(DisplayTransformRcPtr *) dt)->setDisplay(name);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetView(OCIO_DisplayTransformRcPtr *dt, const char *name)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(DisplayTransformRcPtr *) dt)->setView(name);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetDisplayCC(OCIO_DisplayTransformRcPtr *dt, OCIO_ConstTransformRcPtr *t)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(DisplayTransformRcPtr *) dt)->setDisplayCC(* (ConstTransformRcPtr *) t);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetLinearCC(OCIO_DisplayTransformRcPtr *dt, OCIO_ConstTransformRcPtr *t)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(DisplayTransformRcPtr *) dt)->setLinearCC(*(ConstTransformRcPtr *) t);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2013-09-09 09:48:26 +00:00
|
|
|
void OCIOImpl::displayTransformSetLooksOverride(OCIO_DisplayTransformRcPtr *dt, const char *looks)
|
|
|
|
{
|
|
|
|
(*(DisplayTransformRcPtr *) dt)->setLooksOverride(looks);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OCIOImpl::displayTransformSetLooksOverrideEnabled(OCIO_DisplayTransformRcPtr *dt, bool enabled)
|
|
|
|
{
|
|
|
|
(*(DisplayTransformRcPtr *) dt)->setLooksOverrideEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::displayTransformRelease(OCIO_DisplayTransformRcPtr *dt)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((DisplayTransformRcPtr *) dt, DisplayTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_PackedImageDesc *OCIOImpl::createOCIO_PackedImageDesc(float *data, long width, long height, long numChannels,
|
2013-01-08 20:55:07 +00:00
|
|
|
long chanStrideBytes, long xStrideBytes, long yStrideBytes)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
try {
|
|
|
|
void *mem = MEM_mallocN(sizeof(PackedImageDesc), __func__);
|
|
|
|
PackedImageDesc *id = new(mem) PackedImageDesc(data, width, height, numChannels, chanStrideBytes, xStrideBytes, yStrideBytes);
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_PackedImageDesc *) id;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
catch (Exception &exception) {
|
|
|
|
OCIO_reportException(exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::OCIO_PackedImageDescRelease(OCIO_PackedImageDesc* id)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((PackedImageDesc *) id, PackedImageDesc);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_ExponentTransformRcPtr *OCIOImpl::createExponentTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
ExponentTransformRcPtr *et = OBJECT_GUARDED_NEW(ExponentTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
*et = ExponentTransform::Create();
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_ExponentTransformRcPtr *) et;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::exponentTransformSetValue(OCIO_ExponentTransformRcPtr *et, const float *exponent)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(ExponentTransformRcPtr *) et)->setValue(exponent);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::exponentTransformRelease(OCIO_ExponentTransformRcPtr *et)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((ExponentTransformRcPtr *) et, ExponentTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
OCIO_MatrixTransformRcPtr *OCIOImpl::createMatrixTransform(void)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
MatrixTransformRcPtr *mt = OBJECT_GUARDED_NEW(MatrixTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
|
|
|
|
*mt = MatrixTransform::Create();
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
return (OCIO_MatrixTransformRcPtr *) mt;
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::matrixTransformSetValue(OCIO_MatrixTransformRcPtr *mt, const float *m44, const float *offset4)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2012-10-05 10:05:26 +00:00
|
|
|
(*(MatrixTransformRcPtr *) mt)->setValue(m44, offset4);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2012-10-05 10:05:26 +00:00
|
|
|
void OCIOImpl::matrixTransformRelease(OCIO_MatrixTransformRcPtr *mt)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
2013-10-09 08:46:02 +00:00
|
|
|
OBJECT_GUARDED_DELETE((MatrixTransformRcPtr *) mt, MatrixTransformRcPtr);
|
2012-09-15 10:03:17 +00:00
|
|
|
}
|
|
|
|
|
2013-09-07 19:41:46 +00:00
|
|
|
void OCIOImpl::matrixTransformScale(float *m44, float *offset4, const float *scale4f)
|
2012-09-15 10:03:17 +00:00
|
|
|
{
|
|
|
|
MatrixTransform::Scale(m44, offset4, scale4f);
|
|
|
|
}
|
2013-12-08 09:03:17 +00:00
|
|
|
|
|
|
|
const char *OCIOImpl::getVersionString(void)
|
|
|
|
{
|
2016-03-23 18:25:29 +00:00
|
|
|
return GetVersion();
|
2013-12-08 09:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int OCIOImpl::getVersionHex(void)
|
|
|
|
{
|
|
|
|
return GetVersionHex();
|
|
|
|
}
|