Blender V5.3
libocio_config.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "libocio_config.hh"
6
7#include <algorithm>
8#include <numeric>
9
10#include <fmt/format.h>
11
12#include "BLI_array.hh"
13#include "BLI_assert.hh"
14#include "BLI_index_range.hh"
15#include "BLI_map.hh"
16#include "BLI_math_matrix.hh"
17
18#include "OCIO_matrix.hh"
19#include "OCIO_role_names.hh"
20
21#include "error_handling.hh"
22#include "libocio_colorspace.hh"
25#include "libocio_processor.hh"
26
27namespace blender::ocio {
28
29/* -------------------------------------------------------------------- */
32
34{
35 try {
36 OCIO_NAMESPACE::ConstConfigRcPtr ocio_config = OCIO_NAMESPACE::Config::CreateFromEnv();
37 if (!ocio_config) {
38 return nullptr;
39 }
40
41 return std::unique_ptr<LibOCIOConfig>(new LibOCIOConfig(ocio_config));
42 }
43 catch (OCIO_NAMESPACE::Exception &exception) {
44 report_exception(exception);
45 }
46
47 return nullptr;
48}
49
51{
52 std::unique_ptr<Config> new_config = create_from_environment();
53 if (!new_config) {
54 OCIO_NAMESPACE::SetCurrentConfig(ocio_config_);
55 return false;
56 }
57
58 return switch_to(*new_config, validate);
59}
60
61bool LibOCIOConfig::switch_to(Config &new_config, const FunctionRef<bool(const Config &)> validate)
62{
63 if (!validate(new_config)) {
64 OCIO_NAMESPACE::SetCurrentConfig(ocio_config_);
65 return false;
66 }
67
68 reinitialize(static_cast<LibOCIOConfig &>(new_config));
69 return true;
70}
71
72/* Note there is no CreateFromFile based method here, as it has issues with paths
73 * containing "$" due to the variable expansion feature. */
74
75/* Old config color spaces that will be either reused for the new config or retained. */
79
80 void add(Vector<std::unique_ptr<LibOCIOColorSpace>> &other_color_spaces)
81 {
82 for (std::unique_ptr<LibOCIOColorSpace> &color_space : other_color_spaces) {
83 index_by_name.add(std::string(color_space->name()), color_spaces.size());
84 color_spaces.append(std::move(color_space));
85 }
86 other_color_spaces.clear();
87 }
88
89 std::unique_ptr<LibOCIOColorSpace> reuse(const StringRefNull name)
90 {
91 const int *reuse_index = index_by_name.lookup_ptr(name);
92 if (reuse_index && color_spaces[*reuse_index]) {
93 return std::move(color_spaces[*reuse_index]);
94 }
95 return nullptr;
96 }
97};
98
99LibOCIOConfig::LibOCIOConfig(const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config)
100{
101 BLI_assert(ocio_config);
102
103 /* Set the global OpenColorIO configuration so that other parts of Blender can access it. For
104 * example, Cycles uses for own color management of textures.
105 *
106 * Acquire a pointer to the configuration and pass it around explicitly to avoid unneeded shared
107 * pointer acquisition. */
108 OCIO_NAMESPACE::SetCurrentConfig(ocio_config);
109 ocio_config_ = OCIO_NAMESPACE::GetCurrentConfig();
110
111 /* Set to ensure each interop ID is only marked as primary for one color space. */
112 Set<StringRef> primary_interop_ids;
113 initialize_active_color_spaces(primary_interop_ids);
114 initialize_inactive_color_spaces(primary_interop_ids);
115 initialize_hdr_color_spaces(primary_interop_ids);
116 initialize_looks();
117 initialize_displays();
118}
119
121
122void LibOCIOConfig::initialize_active_color_spaces(Set<StringRef> &primary_interop_ids)
123{
124 const int num_color_spaces = ocio_config_->getNumColorSpaces();
125 if (num_color_spaces < 0) {
126 report_error(fmt::format(
127 "Invalid OpenColorIO configuration: invalid number of color spaces {}", num_color_spaces));
128 return;
129 }
130
131 color_spaces_.reserve(num_color_spaces);
132
133 for (const int i : IndexRange(num_color_spaces)) {
134 const char *colorspace_name = ocio_config_->getColorSpaceNameByIndex(i);
135
136 OCIO_NAMESPACE::ConstColorSpaceRcPtr ocio_color_space;
137 try {
138 ocio_color_space = ocio_config_->getColorSpace(colorspace_name);
139 }
140 catch (OCIO_NAMESPACE::Exception &exception) {
141 report_exception(exception);
142 return;
143 }
144
145 if (!ocio_color_space) {
146 report_error(fmt::format("Invalid OpenColorIO configuration: color space {} not found",
147 colorspace_name));
148 return;
149 }
150
151 color_spaces_.append(std::make_unique<LibOCIOColorSpace>(
152 i, ocio_config_, ocio_color_space, primary_interop_ids));
153 }
154
155 initialize_sorted_color_space_index();
156}
157
158void LibOCIOConfig::initialize_sorted_color_space_index()
159{
160 /* Create index array for access to the color space in alphabetic order. */
161 sorted_color_space_index_.resize(color_spaces_.size());
162 std::iota(sorted_color_space_index_.begin(), sorted_color_space_index_.end(), 0);
163 std::ranges::sort(sorted_color_space_index_, [&](int a, int b) {
164 return color_spaces_[a]->name() < color_spaces_[b]->name();
165 });
166}
167
168bool LibOCIOConfig::has_color_space_name(const char *name) const
169{
170 /* Only match the color space name itself, not aliases or roles like #getColorSpace does. */
171 try {
172 const OCIO_NAMESPACE::ConstColorSpaceRcPtr ocio_color_space = ocio_config_->getColorSpace(
173 name);
174 return ocio_color_space && StringRef(ocio_color_space->getName()) == name;
175 }
176 catch (OCIO_NAMESPACE::Exception &exception) {
177 report_exception(exception);
178 }
179
180 return false;
181}
182
183void LibOCIOConfig::reuse_color_spaces(
184 Vector<std::unique_ptr<LibOCIOColorSpace>> &new_color_spaces,
185 Vector<std::unique_ptr<LibOCIOColorSpace>> &color_spaces,
186 ColorSpacesRetained &retained)
187{
188 for (std::unique_ptr<LibOCIOColorSpace> &new_space : new_color_spaces) {
189 /* Try to reuse a color space from the previous config if possible. */
190 std::unique_ptr<LibOCIOColorSpace> existing = retained.reuse(new_space->name());
191
192 if (!existing) {
193 /* Match by alias, to also reuse color spaces that were renamed. Skip aliases
194 * that are the name of another color space in the new config. */
195 const OCIO_NAMESPACE::ConstColorSpaceRcPtr &ocio_color_space = new_space->ocio_color_space();
196 const int num_aliases = ocio_color_space->getNumAliases();
197 for (int i = 0; i < num_aliases && !existing; i++) {
198 const char *alias = ocio_color_space->getAlias(i);
199 if (!has_color_space_name(alias)) {
200 existing = retained.reuse(alias);
201 }
202 }
203 }
204
205 if (existing) {
206 /* Update the colorspace in-place so pointers to it are still valid. */
207 *existing = std::move(*new_space);
208 color_spaces.append(std::move(existing));
209 }
210 else {
211 color_spaces.append(std::move(new_space));
212 }
213 }
214
215 new_color_spaces.clear();
216}
217
218void LibOCIOConfig::reinitialize(LibOCIOConfig &new_config)
219{
220 ocio_config_ = new_config.ocio_config_;
221
222 /* Retain color spaces from the old config. */
223 ColorSpacesRetained retained;
224 retained.add(color_spaces_);
225 retained.add(inactive_color_spaces_);
226 retained.add(retained_color_spaces_);
227
228 /* Add new color spaces or reuse existing ones. */
229 reuse_color_spaces(new_config.color_spaces_, color_spaces_, retained);
230 reuse_color_spaces(new_config.inactive_color_spaces_, inactive_color_spaces_, retained);
231
232 /* Retain color spaces not used by the new config, since some image buffers may
233 * still point to them. */
234 for (std::unique_ptr<LibOCIOColorSpace> &color_space : retained.color_spaces) {
235 if (color_space) {
236 color_space->index = -1;
237 color_space->switch_scene_linear_config(ocio_config_);
238 retained_color_spaces_.append(std::move(color_space));
239 }
240 }
241
242 looks_.clear();
243 displays_.clear();
244 initialize_looks();
245 initialize_displays();
246 initialize_sorted_color_space_index();
247
248 gpu_shader_binder_.clear_caches();
249}
250
251void LibOCIOConfig::initialize_inactive_color_spaces(Set<StringRef> &primary_interop_ids)
252{
253 const int num_inactive_color_spaces = ocio_config_->getNumColorSpaces(
254 OCIO_NAMESPACE::SEARCH_REFERENCE_SPACE_ALL, OCIO_NAMESPACE::COLORSPACE_INACTIVE);
255 if (num_inactive_color_spaces < 0) {
256 report_error(fmt::format(
257 "Invalid OpenColorIO configuration: invalid number of inactive color spaces {}",
258 num_inactive_color_spaces));
259 return;
260 }
261
262 for (const int i : IndexRange(num_inactive_color_spaces)) {
263 const char *colorspace_name = ocio_config_->getColorSpaceNameByIndex(
264 OCIO_NAMESPACE::SEARCH_REFERENCE_SPACE_ALL, OCIO_NAMESPACE::COLORSPACE_INACTIVE, i);
265
266 OCIO_NAMESPACE::ConstColorSpaceRcPtr ocio_color_space;
267 try {
268 ocio_color_space = ocio_config_->getColorSpace(colorspace_name);
269 inactive_color_spaces_.append(std::make_unique<LibOCIOColorSpace>(
270 get_num_all_color_spaces(), ocio_config_, ocio_color_space, primary_interop_ids));
271 }
272 catch (OCIO_NAMESPACE::Exception &exception) {
273 report_exception(exception);
274 continue;
275 }
276 }
277}
278
279void LibOCIOConfig::initialize_looks()
280{
281 const int num_looks = ocio_config_->getNumLooks();
282
283 looks_.reserve(num_looks + 1);
284
285 /* Add entry for look None. */
286 looks_.append_as(0, nullptr);
287
288 for (const int i : IndexRange(num_looks)) {
289 const StringRefNull view_name = ocio_config_->getLookNameByIndex(i);
290
291 /* Look None is built-in and always exists. Skip it from the configuration. */
292 if (view_name == "None") {
293 continue;
294 }
295
296 const OCIO_NAMESPACE::ConstLookRcPtr ocio_look = ocio_config_->getLook(view_name.c_str());
297 looks_.append_as(i + 1, ocio_look);
298 }
299}
300
301void LibOCIOConfig::initialize_displays()
302{
303 const int num_displays = ocio_config_->getNumDisplays();
304 if (num_displays < 0) {
305 report_error(fmt::format("Invalid OpenColorIO configuration: invalid number of displays {}",
306 num_displays));
307 return;
308 }
309
310 displays_.reserve(num_displays);
311
312 for (const int i : IndexRange(num_displays)) {
313 displays_.append_as(i, *this);
314 }
315}
316
318
319/* -------------------------------------------------------------------- */
322
324{
325 try {
326 double rgb_double[3];
327 ocio_config_->getDefaultLumaCoefs(rgb_double);
328
329 return float3(rgb_double[0], rgb_double[1], rgb_double[2]);
330 }
331 catch (OCIO_NAMESPACE::Exception &exception) {
332 report_exception(exception);
333 }
334
335 /* Fallback to the older Blender assumed primaries of ITU-BT.709 / sRGB, matching the
336 * coefficients used in the fallback configuration. */
337 return float3(0.2126f, 0.7152f, 0.0722f);
338}
339
340static bool to_scene_linear_matrix(const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config,
343{
344 const OCIO_NAMESPACE::ConstProcessorRcPtr processor = create_ocio_processor(
345 ocio_config, colorspace.c_str(), OCIO_NAMESPACE::ROLE_SCENE_LINEAR);
346 if (!processor) {
347 return false;
348 }
349
350 const OCIO_NAMESPACE::ConstCPUProcessorRcPtr cpu_processor = processor->getDefaultCPUProcessor();
352 cpu_processor->applyRGB(to_scene_linear[0]);
353 cpu_processor->applyRGB(to_scene_linear[1]);
354 cpu_processor->applyRGB(to_scene_linear[2]);
355
356 return true;
357}
358
360{
361 /* Default to ITU-BT.709 in case no appropriate transform found.
362 * Note XYZ is defined here as having a D65 white point. */
363 float3x3 xyz_to_scene_linear = XYZ_TO_REC709;
364
365 /* Get from OpenColorO config if it has the required roles. */
366 if (!ocio_config_->hasRole(OCIO_NAMESPACE::ROLE_SCENE_LINEAR)) {
367 return xyz_to_scene_linear;
368 }
369
370 if (ocio_config_->hasRole("aces_interchange")) {
371 /* Standard OpenColorIO role, defined as ACES AP0 (ACES2065-1). */
372 float3x3 aces_to_scene_linear;
373 if (to_scene_linear_matrix(ocio_config_, "aces_interchange", aces_to_scene_linear)) {
374 float3x3 xyz_to_aces = math::invert(ACES_TO_XYZ);
375 xyz_to_scene_linear = aces_to_scene_linear * xyz_to_aces;
376 }
377 }
378 else if (ocio_config_->hasRole("XYZ")) {
379 /* Custom role used before the standard existed. */
380 to_scene_linear_matrix(ocio_config_, "XYZ", xyz_to_scene_linear);
381 }
382
383 return xyz_to_scene_linear;
384}
385
386const char *LibOCIOConfig::get_color_space_from_filepath(const char *filepath) const
387{
388 /* Ignore the default rule, same behavior as for example OpenImageIO and xStudio.
389 * The ACES studio config has only a default rule set to ACES2065-1, which works
390 * poorly if we assign it to every file as default.
391 *
392 * It's unclear if the default rule should be used for anything, and if not why
393 * it even exists. */
394 if (ocio_config_->filepathOnlyMatchesDefaultRule(filepath)) {
395 return nullptr;
396 }
397
398 return ocio_config_->getColorSpaceFromFilepath(filepath);
399}
400
402
403/* -------------------------------------------------------------------- */
406
408{
409 OCIO_NAMESPACE::ConstColorSpaceRcPtr ocio_color_space;
410
411 try {
412 /* Lookup color space in the OpenColorIO, letting it resolve role name or an alias. */
413 ocio_color_space = ocio_config_->getColorSpace(name.c_str());
414 }
415 catch (OCIO_NAMESPACE::Exception &exception) {
416 report_exception(exception);
417 return nullptr;
418 }
419
420 if (!ocio_color_space) {
421 return nullptr;
422 }
423
424 /* TODO(sergey): Is there faster way to lookup Blender-side color space?
425 * It does not seem that pointer in ConstColorSpaceRcPtr is unique enough to use for
426 * comparison. */
427 for (const std::unique_ptr<LibOCIOColorSpace> &color_space : color_spaces_) {
428 if (color_space->name() == ocio_color_space->getName()) {
429 return color_space.get();
430 }
431 }
432
433 /* Also lookup in the inactive color space, as the requested space might be coming from the
434 * display and marked as inactive to prevent it from showing up in the application menu. */
435 for (const std::unique_ptr<LibOCIOColorSpace> &color_space : inactive_color_spaces_) {
436 if (color_space->name() == ocio_color_space->getName()) {
437 return color_space.get();
438 }
439 }
440
441 if (!ocio_config_->isInactiveColorSpace(ocio_color_space->getName())) {
443 fmt::format("Invalid OpenColorIO configuration: color space {} not found on Blender side",
444 ocio_color_space->getName()));
445 }
446
447 return nullptr;
448}
449
451{
452 return color_spaces_.size();
453}
454
456{
457 return color_spaces_.size() + inactive_color_spaces_.size();
458}
459
461{
462 if (index < 0) {
463 return nullptr;
464 }
465 if (index < color_spaces_.size()) {
466 return color_spaces_[index].get();
467 }
468
469 const int inactive_index = index - color_spaces_.size();
470 if (inactive_index < inactive_color_spaces_.size()) {
471 return inactive_color_spaces_[inactive_index].get();
472 }
473 return nullptr;
474}
475
477{
478 BLI_assert(color_spaces_.size() == sorted_color_space_index_.size());
479 if (index < 0 || index >= color_spaces_.size()) {
480 return nullptr;
481 }
482 return get_color_space_by_index(sorted_color_space_index_[index]);
483}
484
486{
487 for (const std::unique_ptr<LibOCIOColorSpace> &color_space : color_spaces_) {
488 if (color_space->interop_id() == interop_id && color_space->is_primary_interop_id()) {
489 return color_space.get();
490 }
491 }
492
493 for (const std::unique_ptr<LibOCIOColorSpace> &color_space : inactive_color_spaces_) {
494 if (color_space->interop_id() == interop_id && color_space->is_primary_interop_id()) {
495 return color_space.get();
496 }
497 }
498
499 /* Fall back to name and alias lookup. */
500 return get_color_space(interop_id);
501}
502
504{
505 return ocio_config_->hasRole(name.c_str());
506}
507
509
510/* -------------------------------------------------------------------- */
513
515{
516 /* Based on empirical testing, video works with 100 nits diffuse white, while
517 * images need 203 nits diffuse whites to show matching results. */
518 const ColorSpace *colorspece = get_color_space(name);
519 if (colorspece == nullptr) {
520 return nullptr;
521 }
522 if (colorspece->interop_id() == "pq_rec2020_display") {
523 return get_color_space("blender:pq_rec2020_display_203nits");
524 }
525 if (colorspece->interop_id() == "hlg_rec2020_display") {
526 return get_color_space("blender:hlg_rec2020_display_203nits");
527 }
528 return nullptr;
529}
530
531void LibOCIOConfig::initialize_hdr_color_spaces(Set<StringRef> &primary_interop_ids)
532{
533 for (StringRefNull interop_id : {"pq_rec2020_display", "hlg_rec2020_display"}) {
534 const auto *colorspace = static_cast<const LibOCIOColorSpace *>(
536 if (!colorspace || !colorspace->is_display_referred()) {
537 continue;
538 }
539
540 /* Create colorspace that uses 203 nits diffuse white instead of 100 nits. */
541 const auto hdr_100_colorspace = ocio_config_->getColorSpace(colorspace->name().c_str());
542 OCIO_NAMESPACE::TransformRcPtr to_display_100_nits;
543 if (const auto transform = hdr_100_colorspace->getTransform(
544 OCIO_NAMESPACE::COLORSPACE_DIR_FROM_REFERENCE))
545 {
546 to_display_100_nits = transform->createEditableCopy();
547 }
548 else if (const auto transform = hdr_100_colorspace->getTransform(
549 OCIO_NAMESPACE::COLORSPACE_DIR_TO_REFERENCE))
550 {
551 to_display_100_nits = transform->createEditableCopy();
552 to_display_100_nits->setDirection(
553 OCIO_NAMESPACE::GetInverseTransformDirection(to_display_100_nits->getDirection()));
554 }
555 else {
556 continue;
557 }
558
559 const auto hdr_colorspace = OCIO_NAMESPACE::ColorSpace::Create(
560 OCIO_NAMESPACE::REFERENCE_SPACE_DISPLAY);
561 const auto group = OCIO_NAMESPACE::GroupTransform::Create();
562
563 hdr_colorspace->setName(("blender:" + interop_id + "_203nits").c_str());
564
565 const auto to_203_nits = OCIO_NAMESPACE::MatrixTransform::Create();
566 to_203_nits->setMatrix(double4x4(double3x3::diagonal(203.0 / 100.0)).base_ptr());
567 group->appendTransform(to_203_nits);
568
569 group->appendTransform(to_display_100_nits);
570
571 hdr_colorspace->setTransform(group, OCIO_NAMESPACE::COLORSPACE_DIR_FROM_REFERENCE);
572
573 OCIO_NAMESPACE::Config *mutable_ocio_config = const_cast<OCIO_NAMESPACE::Config *>(
574 ocio_config_.get());
575 mutable_ocio_config->addColorSpace(hdr_colorspace);
576
577 inactive_color_spaces_.append(std::make_unique<LibOCIOColorSpace>(
578 get_num_all_color_spaces(), ocio_config_, hdr_colorspace, primary_interop_ids));
579 }
580}
581
583
584/* -------------------------------------------------------------------- */
587
589{
590 if (ocio_config_->getRoleColorSpace(OCIO_NAMESPACE::ROLE_SCENE_LINEAR) == name) {
591 return;
592 }
593
594 /* This is a bad const cast, but seems to work ok, and reloading the whole config is
595 * something we don't support yet. When we do this could be changed. */
596 OCIO_NAMESPACE::Config *mutable_ocio_config = const_cast<OCIO_NAMESPACE::Config *>(
597 ocio_config_.get());
598 mutable_ocio_config->setRole(OCIO_NAMESPACE::ROLE_SCENE_LINEAR, name.c_str());
599
600 for (std::unique_ptr<LibOCIOColorSpace> &color_space : color_spaces_) {
601 color_space->clear_caches();
602 }
603 for (std::unique_ptr<LibOCIOColorSpace> &color_space : inactive_color_spaces_) {
604 color_space->clear_caches();
605 }
606 for (std::unique_ptr<LibOCIOColorSpace> &color_space : retained_color_spaces_) {
607 color_space->clear_caches();
608 }
609 for (LibOCIODisplay &display : displays_) {
610 display.clear_caches();
611 }
612 gpu_shader_binder_.clear_caches();
613}
614
616
617/* -------------------------------------------------------------------- */
620
622{
623 if (displays_.is_empty()) {
624 return nullptr;
625 }
626 /* Matches the behavior of OpenColorIO, but avoids using API which potentially throws exception
627 * and requires string lookups. */
628 return &displays_[0]; // NOLINT(readability-container-data-pointer)
629}
630
632{
633 /* TODO(@sergey): Is there faster way to lookup Blender-side display? */
634 for (const LibOCIODisplay &display : displays_) {
635 if (display.name() == name) {
636 return &display;
637 }
638 }
639 return nullptr;
640}
641
643{
644 return displays_.size();
645}
646
648{
649 if (index < 0 || index >= displays_.size()) {
650 return nullptr;
651 }
652 return &displays_[index];
653}
654
656
657/* -------------------------------------------------------------------- */
660
662 const StringRefNull view) const
663{
664 StringRefNull display_color_space;
665
666 try {
667 display_color_space = ocio_config_->getDisplayViewColorSpaceName(display.c_str(),
668 view.c_str());
669 /* OpenColorIO does not resolve this token for us, so do it ourselves. */
670 if (strcasecmp(display_color_space.c_str(), "<USE_DISPLAY_NAME>") == 0) {
671 display_color_space = display;
672 }
673 }
674 catch (OCIO_NAMESPACE::Exception &exception) {
675 report_exception(exception);
676 display_color_space = display;
677 }
678
679 return get_color_space(display_color_space);
680}
681
683
684/* -------------------------------------------------------------------- */
687
689{
690 /* TODO(sergey): Is there faster way to lookup Blender-side look? */
691 for (const LibOCIOLook &look : looks_) {
692 if (look.name() == name) {
693 return &look;
694 }
695 }
696 return nullptr;
697}
698
700{
701 return looks_.size();
702}
703
705{
706 if (index < 0 || index >= looks_.size()) {
707 return nullptr;
708 }
709 return &looks_[index];
710}
711
713
714/* -------------------------------------------------------------------- */
717
718std::shared_ptr<const CPUProcessor> LibOCIOConfig::get_display_cpu_processor(
719 const DisplayParameters &display_parameters) const
720{
721 OCIO_NAMESPACE::ConstProcessorRcPtr processor = create_ocio_display_processor(
722 *this, display_parameters);
723 if (!processor) {
724 return nullptr;
725 }
726 return std::make_shared<LibOCIOCPUProcessor>(processor->getDefaultCPUProcessor());
727}
728
729std::shared_ptr<const CPUProcessor> LibOCIOConfig::get_cpu_processor(
730 const StringRefNull from_colorspace, const StringRefNull to_colorspace) const
731{
732 const OCIO_NAMESPACE::ConstProcessorRcPtr processor = create_ocio_processor(
733 ocio_config_, from_colorspace.c_str(), to_colorspace.c_str());
734 if (!processor) {
735 return nullptr;
736 }
737 return std::make_shared<LibOCIOCPUProcessor>(processor->getDefaultCPUProcessor());
738}
739
741
742/* -------------------------------------------------------------------- */
745
747{
748 return gpu_shader_binder_;
749}
750
752
753} // namespace blender::ocio
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
constexpr IndexRange()=default
const Value * lookup_ptr(const Key &key) const
Definition BLI_map.hh:508
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:295
constexpr const char * c_str() const
constexpr StringRef()
int64_t size() const
void append(const T &value)
virtual StringRefNull interop_id() const =0
const ColorSpace * get_color_space_for_hdr_image(StringRefNull name) const override
const Display * get_display_by_name(StringRefNull name) const override
int get_num_looks() const override
std::shared_ptr< const CPUProcessor > get_display_cpu_processor(const DisplayParameters &display_parameters) const override
void set_scene_linear_role(StringRefNull name) override
int get_num_all_color_spaces() const override
int get_num_active_color_spaces() const override
float3 get_default_luma_coefs() const override
int get_num_displays() const override
float3x3 get_xyz_to_scene_linear_matrix() const override
std::shared_ptr< const CPUProcessor > get_cpu_processor(StringRefNull from_colorspace, StringRefNull to_colorspace) const override
const char * get_color_space_from_filepath(const char *filepath) const override
const Display * get_display_by_index(int index) const override
bool switch_to(Config &new_config, FunctionRef< bool(const Config &)> validate) override
static std::unique_ptr< Config > create_from_environment()
const Look * get_look_by_index(int index) const override
const ColorSpace * get_display_view_color_space(StringRefNull display, StringRefNull view) const override
bool switch_to_from_environment(FunctionRef< bool(const Config &)> validate) override
const ColorSpace * get_sorted_color_space_by_index(int index) const override
const ColorSpace * get_color_space(StringRefNull name) const override
const ColorSpace * get_color_space_by_interop_id(StringRefNull interop_id) const override
const ColorSpace * get_color_space_by_index(int index) const override
const GPUShaderBinder & get_gpu_shader_binder() const override
const Look * get_look_by_name(StringRefNull name) const override
bool is_role(StringRefNull name) const override
const Display * get_default_display() const override
BLI_INLINE ColorSceneLinear4f< eAlpha::Straight > to_scene_linear(const ColorTheme4f &theme4f)
Definition BLI_color.hh:126
CartesianBasis invert(const CartesianBasis &basis)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_display_processor(const LibOCIOConfig &config, const DisplayParameters &display_parameters)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_processor(const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const StringRefNull from_colorspace, const StringRefNull to_colorspace)
void report_exception(const OCIO_NAMESPACE::Exception &exception)
void report_error(const StringRefNull error)
static bool to_scene_linear_matrix(const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const StringRefNull colorspace, float3x3 &to_scene_linear)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
MatBase< double, 4, 4 > double4x4
float4 transform(float4 hs_position)
static MatBase diagonal(double value)
Vector< std::unique_ptr< LibOCIOColorSpace > > color_spaces
void add(Vector< std::unique_ptr< LibOCIOColorSpace > > &other_color_spaces)
std::unique_ptr< LibOCIOColorSpace > reuse(const StringRefNull name)