Blender V5.3
blender::ocio Namespace Reference

Namespaces

namespace  internal

Classes

class  ColorSpace
class  Config
class  CPUProcessor
class  CPUProcessorCache
class  Display
struct  DisplayParameters
struct  GPUDisplayParameters
class  GPUShaderBinder
class  LibOCIOColorSpace
class  LibOCIOConfig
class  LibOCIOCPUProcessor
class  LibOCIODisplay
class  LibOCIOGPUShaderBinder
class  LibOCIOLook
class  LibOCIOView
class  Look
class  ocio_fallback_config
class  PackedImage
struct  ScopeGraticule
struct  ScopeInfo
struct  Version
class  View

Enumerations

enum class  BitDepth { BIT_DEPTH_UNKNOWN , BIT_DEPTH_F32 }
enum class  Gamut { Unknown , Rec709 , P3D65 , Rec2020 }
enum class  TransferFunction {
  Unknown , sRGB , ExtendedsRGB , Gamma18 ,
  Gamma22 , Gamma24 , Gamma26 , PQ ,
  HLG
}

Functions

std::string cleanup_description (const StringRef description)
 TEST (ocio_description, cleanup_description)
void report_exception (const OCIO_NAMESPACE::Exception &exception)
void report_error (const StringRefNull error)
static OCIO_NAMESPACE::ConstColorSpaceRcPtr get_display_view_colorspace (const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const char *display, const char *view)
static TransferFunction system_extended_srgb_transfer_function (const LibOCIOView *view, const bool use_hdr_buffer)
static OCIO_NAMESPACE::TransformRcPtr create_extended_srgb_transform (const TransferFunction transfer_function)
static void adjust_for_hdr_image_file (const LibOCIOConfig &config, OCIO_NAMESPACE::GroupTransformRcPtr &group, StringRefNull display_name, StringRefNull view_name)
static void display_as_scope_space (const LibOCIOConfig &config, OCIO_NAMESPACE::GroupTransformRcPtr &group, StringRefNull display_name, StringRefNull view_name)
static void display_as_extended_srgb (const LibOCIOConfig &config, OCIO_NAMESPACE::GroupTransformRcPtr &group, StringRefNull display_name, StringRefNull view_name, const bool use_hdr_buffer)
OCIO_NAMESPACE::TransformRcPtr create_ocio_display_transform (const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, StringRefNull display, StringRefNull view, StringRefNull look, StringRefNull from_colorspace)
static OCIO_NAMESPACE::TransformRcPtr create_untonemapped_ocio_display_transform (const LibOCIOConfig &config, StringRefNull display_name, StringRefNull from_colorspace, bool use_hdr_buffer)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_display_processor (const LibOCIOConfig &config, const DisplayParameters &display_parameters)
 TEST_F (ocio_fallback_config, loads_and_validates)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_processor (const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const StringRefNull from_colorspace, const StringRefNull to_colorspace)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_processor_silent (const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const StringRefNull from_colorspace, const StringRefNull to_colorspace)
OCIO_NAMESPACE::ConstProcessorRcPtr create_ocio_processor_between_configs (const OCIO_NAMESPACE::ConstConfigRcPtr &from_config, const StringRefNull from_colorspace, const OCIO_NAMESPACE::ConstConfigRcPtr &to_config, const StringRefNull to_colorspace)
static float linear_to_srgb (const float linear)
static float nits_to_scope_value (const float nits)
void source_comment_out_uniforms (std::string &source)
 TEST (ocio_source_processor, source_comment_out_uniforms)
Version get_version ()
bool split_view_specific_look (const StringRef look_name, StringRef &view, StringRef &ui_name)
 TEST (ocio_view_look, split_view_specific_look)
float3x3 calculate_white_point_matrix (const Config &config, const float temperature, const float tint)
StringRef interop_id_drop_namespace (const StringRef interop_id)
Color space information
static bool to_scene_linear_matrix (const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, const StringRefNull colorspace, float3x3 &to_scene_linear)

Variables

static CLG_LogRef LOG = {"color_management"}
static CLG_LogRef LOG = {"color_management"}
static const char * fallback_config_source
static constexpr float SCOPE_SDR_IN_HDR_SCOPE = 0.75f
static constexpr float SCOPE_HDR_MAX_NITS = 10000.0f
static constexpr float SCOPE_SDR_WHITE_NITS = 100.0f
static constexpr float SCOPE_MAX_LINEAR = SCOPE_HDR_MAX_NITS / SCOPE_SDR_WHITE_NITS
static constexpr float SCOPE_SRGB_A = 1.055f
static constexpr float SCOPE_SRGB_B = 0.055f
static constexpr float SCOPE_SRGB_GAMMA = 2.4f
static constexpr float SCOPE_HDR_B = 0.0368291f
static constexpr float SCOPE_HDR_C = 0.8882908f
static constexpr float SCOPE_HDR_D = 0.8307242f
static const float3x3 XYZ_TO_REC709
static const float3x3 XYZ_TO_REC2020
static const float3x3 ACES_TO_XYZ
static const float3x3 ACESCG_TO_XYZ
static const double4x4 OCIO_XYZ_TO_REC709
static const double4x4 OCIO_XYZ_TO_P3
static const double4x4 OCIO_XYZ_TO_REC2020

Enumeration Type Documentation

◆ BitDepth

enum class blender::ocio::BitDepth
strong
Enumerator
BIT_DEPTH_UNKNOWN 
BIT_DEPTH_F32 

Definition at line 15 of file OCIO_packed_image.hh.

◆ Gamut

enum class blender::ocio::Gamut
strong
Enumerator
Unknown 
Rec709 
P3D65 
Rec2020 

Definition at line 14 of file OCIO_view.hh.

◆ TransferFunction

Enumerator
Unknown 
sRGB 
ExtendedsRGB 
Gamma18 
Gamma22 
Gamma24 
Gamma26 
PQ 
HLG 

Definition at line 21 of file OCIO_view.hh.

Function Documentation

◆ adjust_for_hdr_image_file()

◆ calculate_white_point_matrix()

◆ cleanup_description()

std::string blender::ocio::cleanup_description ( StringRef description)

Cleanup description making it possible to easily show in the interface as a tooltip.

This includes:

  • Stripping all trailing line break character.
  • Replacing all inner line break character with space.

Definition at line 11 of file description.cc.

References cleanup_description(), ELEM, blender::blender::StringRefBase::is_empty(), blender::result, and blender::blender::StringRefBase::trim().

Referenced by cleanup_description(), blender::ocio::LibOCIOColorSpace::LibOCIOColorSpace(), and TEST().

◆ create_extended_srgb_transform()

OCIO_NAMESPACE::TransformRcPtr blender::ocio::create_extended_srgb_transform ( const TransferFunction transfer_function)
static

◆ create_ocio_display_processor()

OCIO_NAMESPACE::ConstProcessorRcPtr blender::ocio::create_ocio_display_processor ( const LibOCIOConfig & config,
const DisplayParameters & display_parameters )

◆ create_ocio_display_transform()

OCIO_NAMESPACE::TransformRcPtr blender::ocio::create_ocio_display_transform ( const OCIO_NAMESPACE::ConstConfigRcPtr & ocio_config,
StringRefNull display,
StringRefNull view,
StringRefNull look,
StringRefNull from_colorspace )

◆ create_ocio_processor()

OCIO_NAMESPACE::ConstProcessorRcPtr blender::ocio::create_ocio_processor ( const OCIO_NAMESPACE::ConstConfigRcPtr & ocio_config,
StringRefNull from_colorspace,
StringRefNull to_colorspace )

Create OpenColorIO processor between color spaces. If the processor can not be created returns nullptr.

The silent version does not print any errors if the processor creation has failed.

Definition at line 11 of file libocio_processor.cc.

References blender::StringRefNull::c_str(), create_ocio_processor(), and report_exception().

Referenced by create_ocio_processor(), blender::ocio::LibOCIOConfig::get_cpu_processor(), blender::ocio::LibOCIOColorSpace::get_from_scene_linear_cpu_processor(), blender::ocio::LibOCIOColorSpace::get_to_scene_linear_cpu_processor(), and to_scene_linear_matrix().

◆ create_ocio_processor_between_configs()

OCIO_NAMESPACE::ConstProcessorRcPtr blender::ocio::create_ocio_processor_between_configs ( const OCIO_NAMESPACE::ConstConfigRcPtr & from_config,
StringRefNull from_colorspace,
const OCIO_NAMESPACE::ConstConfigRcPtr & to_config,
StringRefNull to_colorspace )

Create OpenColorIO processor that converts between color spaces in different configs, through standard interchange roles. If the processor can not be created returns nullptr.

Definition at line 43 of file libocio_processor.cc.

References blender::StringRefNull::c_str(), and create_ocio_processor_between_configs().

Referenced by create_ocio_processor_between_configs(), blender::ocio::LibOCIOColorSpace::get_from_scene_linear_cpu_processor(), and blender::ocio::LibOCIOColorSpace::get_to_scene_linear_cpu_processor().

◆ create_ocio_processor_silent()

OCIO_NAMESPACE::ConstProcessorRcPtr blender::ocio::create_ocio_processor_silent ( const OCIO_NAMESPACE::ConstConfigRcPtr & ocio_config,
const StringRefNull from_colorspace,
const StringRefNull to_colorspace )

◆ create_untonemapped_ocio_display_transform()

◆ display_as_extended_srgb()

◆ display_as_scope_space()

◆ get_display_view_colorspace()

OCIO_NAMESPACE::ConstColorSpaceRcPtr blender::ocio::get_display_view_colorspace ( const OCIO_NAMESPACE::ConstConfigRcPtr & ocio_config,
const char * display,
const char * view )
static

◆ get_version()

Version blender::ocio::get_version ( )

Get OpenColorIO library version. When compiled without OpenColorIO library returns {0, 0, 0}.

Definition at line 11 of file version.cc.

References get_version().

Referenced by get_version(), and blender::make_ocio_info().

◆ interop_id_drop_namespace()

StringRef blender::ocio::interop_id_drop_namespace ( const StringRef interop_id)
inline

◆ linear_to_srgb()

float blender::ocio::linear_to_srgb ( const float linear)
static

Convert linear value to sRGB using the sRGB OETF.

Definition at line 70 of file libocio_scope.cc.

References linear_to_srgb(), SCOPE_SRGB_A, SCOPE_SRGB_B, and SCOPE_SRGB_GAMMA.

Referenced by linear_to_srgb(), and nits_to_scope_value().

◆ nits_to_scope_value()

float blender::ocio::nits_to_scope_value ( const float nits)
static

◆ report_error()

◆ report_exception()

◆ source_comment_out_uniforms()

void blender::ocio::source_comment_out_uniforms ( std::string & source)

Comment out all uniform statements. This avoids double declarations from the backend. This function modifies source in-place without adding extra characters. This means that statement like uniform vec3 pos; becomes //iform vec3 pos;.

Definition at line 9 of file source_processor.cc.

References source_comment_out_uniforms().

Referenced by source_comment_out_uniforms(), and TEST().

◆ split_view_specific_look()

bool blender::ocio::split_view_specific_look ( StringRef look_name,
StringRef & view,
StringRef & ui_name )

Split the view-specific look name to a view name and look name for the interface.

Look is considered to be view-specific when it contains dash in its name. In this case the part of the look name is considered to be the name of the view the look is specific to.

If the look is not view-specific view is an empty string and ui name is the look name.

Returns true if the look name is view-specific.

Definition at line 9 of file view_specific_look.cc.

References blender::blender::StringRefBase::find(), split_view_specific_look(), and blender::blender::StringRefBase::substr().

Referenced by blender::ocio::LibOCIOLook::LibOCIOLook(), split_view_specific_look(), and TEST().

◆ system_extended_srgb_transfer_function()

TransferFunction blender::ocio::system_extended_srgb_transfer_function ( const LibOCIOView * view,
const bool use_hdr_buffer )
static

◆ TEST() [1/3]

blender::ocio::TEST ( ocio_description ,
cleanup_description  )

Definition at line 11 of file description_test.cc.

References cleanup_description(), blender::EXPECT_EQ(), and TEST().

Referenced by TEST(), TEST(), and TEST().

◆ TEST() [2/3]

blender::ocio::TEST ( ocio_source_processor ,
source_comment_out_uniforms  )

◆ TEST() [3/3]

blender::ocio::TEST ( ocio_view_look ,
split_view_specific_look  )

◆ TEST_F()

blender::ocio::TEST_F ( ocio_fallback_config ,
loads_and_validates  )

◆ to_scene_linear_matrix()

bool blender::ocio::to_scene_linear_matrix ( const OCIO_NAMESPACE::ConstConfigRcPtr & ocio_config,
const StringRefNull colorspace,
float3x3 & to_scene_linear )
static

Variable Documentation

◆ ACES_TO_XYZ

const float3x3 blender::ocio::ACES_TO_XYZ
static
Initial value:
= {{0.938280f, 0.337369f, 0.001174f},
{-0.004451f, 0.729522f, -0.003711f},
{0.016628f, -0.066890f, 1.091595f}}

Definition at line 28 of file OCIO_matrix.hh.

◆ ACESCG_TO_XYZ

const float3x3 blender::ocio::ACESCG_TO_XYZ
static
Initial value:
= {{0.652238f, 0.267672f, -0.005382f},
{0.128237f, 0.674340f, 0.001369f},
{0.169983f, 0.057988f, 1.093071f}}

Definition at line 34 of file OCIO_matrix.hh.

◆ fallback_config_source

const char* blender::ocio::fallback_config_source
static

◆ LOG [1/2]

CLG_LogRef blender::ocio::LOG = {"color_management"}
static

◆ LOG [2/2]

CLG_LogRef blender::ocio::LOG = {"color_management"}
static

Definition at line 27 of file libocio_display_processor.cc.

◆ OCIO_XYZ_TO_P3

const double4x4 blender::ocio::OCIO_XYZ_TO_P3
static
Initial value:
= {
{2.690225911625598, -0.82008218427349111, 0.03624575465400464, 0},
{-1.0940019373661367, 1.7504809082920574, -0.07858083680558868, 0},
{-0.4250823476747525, 0.026601954212205722, 0.95874699366098559, 0},
{0, 0, 0, 1}}

Definition at line 45 of file OCIO_matrix.hh.

◆ OCIO_XYZ_TO_REC2020

const double4x4 blender::ocio::OCIO_XYZ_TO_REC2020
static
Initial value:
= {
{1.716651187971268, -0.66668435183248875, 0.01763985744531079, 0},
{-0.35567078377639244, 1.6164812366349386, -0.04277061325780853, 0},
{-0.25336628137365991, 0.015768545813911128, 0.94210312123547435, 0},
{0, 0, 0, 1}}

Definition at line 51 of file OCIO_matrix.hh.

◆ OCIO_XYZ_TO_REC709

const double4x4 blender::ocio::OCIO_XYZ_TO_REC709
static
Initial value:
= {
{3.2409699419045217, -0.96924363628087973, 0.055630079696993649, 0},
{-1.5373831775700935, 1.8759675015077204, -0.20397695888897652, 0},
{-0.49861076029300355, 0.041555057407175626, 1.0569715142428788, 0},
{0, 0, 0, 1}}

Definition at line 39 of file OCIO_matrix.hh.

◆ SCOPE_HDR_B

float blender::ocio::SCOPE_HDR_B = 0.0368291f
staticconstexpr

Constants for the HDR log curve: scope = b * ln(linear - c) + d, computed to ensure C1 continuity with the sRGB OETF at SCOPE_SDR_IN_HDR_SCOPE.

Definition at line 65 of file libocio_scope.cc.

Referenced by nits_to_scope_value().

◆ SCOPE_HDR_C

float blender::ocio::SCOPE_HDR_C = 0.8882908f
staticconstexpr

Definition at line 66 of file libocio_scope.cc.

Referenced by nits_to_scope_value().

◆ SCOPE_HDR_D

float blender::ocio::SCOPE_HDR_D = 0.8307242f
staticconstexpr

Definition at line 67 of file libocio_scope.cc.

Referenced by nits_to_scope_value().

◆ SCOPE_HDR_MAX_NITS

float blender::ocio::SCOPE_HDR_MAX_NITS = 10000.0f
staticconstexpr

Maximum HDR luminance in nits that maps to scope value 1.0, same as PQ and beyond what any real world display can do.

Definition at line 45 of file libocio_scope.cc.

◆ SCOPE_MAX_LINEAR

float blender::ocio::SCOPE_MAX_LINEAR = SCOPE_HDR_MAX_NITS / SCOPE_SDR_WHITE_NITS
staticconstexpr

Maximum linear light value (nits / SDR white nits). Linear 1.0 = 100 nits = SDR white, linear MAX_LINEAR = 10000 nits.

Definition at line 54 of file libocio_scope.cc.

Referenced by blender::ocio::LibOCIOView::append_scope_space_transforms().

◆ SCOPE_SDR_IN_HDR_SCOPE

float blender::ocio::SCOPE_SDR_IN_HDR_SCOPE = 0.75f
staticconstexpr

Scope space encoding constants for SDR and HDR displays.

For SDR we use the sRGB OETF to get something that is near perceptually linear. For HDR we use the same curve for SDR values for the first 75% of scope space, and then use log for the remaining 25% from 100 nits to 10000 nits.

The log curve is chosen such that the two pieces meet at 100 nits with C1 continuity.

Gamut is the same as the display space.

The reason to use this instead of display space for scopes is that it lets us design a curve allocates most space for SDR values. It also means the scope drawing shaders can have a hardcoded color space transforms and we don't need to insert arbitrary OCIO transforms into them. Scope value at 100 nits (SDR reference white) for HDR displays.

Definition at line 39 of file libocio_scope.cc.

Referenced by nits_to_scope_value(), and blender::ocio::LibOCIOView::scope_info().

◆ SCOPE_SDR_WHITE_NITS

float blender::ocio::SCOPE_SDR_WHITE_NITS = 100.0f
staticconstexpr

SDR reference white in nits.

Definition at line 48 of file libocio_scope.cc.

Referenced by blender::ocio::LibOCIOView::append_scope_space_transforms(), and nits_to_scope_value().

◆ SCOPE_SRGB_A

float blender::ocio::SCOPE_SRGB_A = 1.055f
staticconstexpr

Constants for the sRGB OETF used for the SDR portion of the scope encoding.

Definition at line 57 of file libocio_scope.cc.

Referenced by linear_to_srgb().

◆ SCOPE_SRGB_B

float blender::ocio::SCOPE_SRGB_B = 0.055f
staticconstexpr

◆ SCOPE_SRGB_GAMMA

float blender::ocio::SCOPE_SRGB_GAMMA = 2.4f
staticconstexpr

◆ XYZ_TO_REC2020

const float3x3 blender::ocio::XYZ_TO_REC2020
static
Initial value:
{{1.7166512f, -0.6666844, 0.0176399f},
{-0.3556708f, 1.6164812f, -0.0427706f},
{-0.2533663f, 0.0157685f, 0.9421031f}}

Definition at line 22 of file OCIO_matrix.hh.

◆ XYZ_TO_REC709

const float3x3 blender::ocio::XYZ_TO_REC709
static
Initial value:
{{3.2409699f, -0.9692436f, 0.0556301f},
{-1.5373832f, 1.8759675f, -0.2039770f},
{-0.4986108f, 0.0415551f, 1.0569715f}}

Definition at line 15 of file OCIO_matrix.hh.