Blender
V5.3
source
blender
imbuf
opencolorio
intern
libocio
libocio_view.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2026 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#include "
libocio_view.hh
"
6
7
namespace
blender::ocio
{
8
9
int
LibOCIOView::max_nits
()
const
10
{
11
/* This is current based on heuristics using the view transform name, as OpenColorIO has no
12
* standard way to specify this. Recognizes "- SDR" and "- HDR XXXX nits" as used by the
13
* Blender and ACES configs. */
14
const
StringRefNull
n = name_;
15
if
(n.
endswith
(
" - SDR"
)) {
16
return
100;
17
}
18
const
int64_t
nits_pos = n.
find
(
" nits"
);
19
if
(nits_pos ==
StringRef::not_found
) {
20
return
0;
21
}
22
const
int64_t
num_end = nits_pos;
23
int64_t
num_start = num_end;
24
while
(num_start > 0 && n[num_start - 1] >=
'0'
&& n[num_start - 1] <=
'9'
) {
25
num_start--;
26
}
27
int
value = 0;
28
for
(
int64_t
i = num_start; i < num_end; i++) {
29
value = value * 10 + (n[i] -
'0'
);
30
}
31
return
value > 0 ? value : 0;
32
}
33
34
}
// namespace blender::ocio
blender::StringRefNull
Definition
BLI_string_ref.hh:144
blender::blender::StringRefBase::not_found
static constexpr int64_t not_found
Definition
bmesh_polygon.hh:62
blender::blender::StringRefBase::find
constexpr int64_t find(char c, int64_t pos=0) const
Definition
BLI_string_ref.hh:339
blender::blender::StringRefBase::endswith
constexpr bool endswith(StringRef suffix) const
Definition
BLI_string_ref.hh:285
blender::ocio::LibOCIOView::max_nits
int max_nits() const override
Definition
libocio_view.cc:9
libocio_view.hh
blender::ocio
Definition
BLF_api.hh:39
blender::int64_t
__int64 int64_t
Definition
BKE_text.h:90
Generated on
for Blender by
doxygen
1.18.0