Skip to content

Commit 8cbcebe

Browse files
committed
Build correctly against OCIO 2.x (in progress) (AcademySoftwareFoundation#2530)
And incorporate a build against OCIO master into the "bleeding edge" CI test, so we don't drift out of sync again.
1 parent 5d6829b commit 8cbcebe

File tree

4 files changed

+65
-3
lines changed

4 files changed

+65
-3
lines changed

.github/workflows/workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
source src/build-scripts/ci-build-and-test.bash
7070
7171
linux-bleeding:
72-
name: "Linux bleeding edge: gcc9, C++17, avx2, exr 2.4"
72+
name: "Linux bleeding edge: gcc9, C++17, avx2, exr 2.4, OCIO master"
7373
runs-on: ubuntu-18.04
7474
steps:
7575
- uses: actions/checkout@v1
@@ -79,6 +79,7 @@ jobs:
7979
CMAKE_CXX_STANDARD: 17
8080
USE_SIMD: avx2,f16c
8181
OPENEXR_BRANCH: v2.4.0
82+
OCIO_BRANCH: master
8283
run: |
8384
source src/build-scripts/ci-startup.bash
8485
source src/build-scripts/gh-installdeps.bash

src/libOpenImageIO/color_ocio.cpp

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,39 @@ ColorConfig::configname() const
591591

592592

593593
#ifdef USE_OCIO
594+
595+
# if OCIO_VERSION_HEX >= 0x02000000
596+
inline OCIO::BitDepth
597+
ocio_bitdepth(TypeDesc type)
598+
{
599+
if (type == TypeDesc::UINT8)
600+
return OCIO::BIT_DEPTH_UINT8;
601+
if (type == TypeDesc::UINT16)
602+
return OCIO::BIT_DEPTH_UINT16;
603+
if (type == TypeDesc::UINT32)
604+
return OCIO::BIT_DEPTH_UINT32;
605+
// N.B.: OCIOv2 also supports 10, 12, and 14 bit int, but we won't
606+
// ever have data in that format at this stage.
607+
if (type == TypeDesc::HALF)
608+
return OCIO::BIT_DEPTH_F16;
609+
if (type == TypeDesc::FLOAT)
610+
return OCIO::BIT_DEPTH_F32;
611+
return OCIO::BIT_DEPTH_UNKNOWN;
612+
}
613+
# endif
614+
615+
594616
// Custom ColorProcessor that wraps an OpenColorIO Processor.
595617
class ColorProcessor_OCIO : public ColorProcessor {
596618
public:
597619
ColorProcessor_OCIO(OCIO::ConstProcessorRcPtr p)
598-
: m_p(p) {};
599-
virtual ~ColorProcessor_OCIO(void) {};
620+
: m_p(p)
621+
# if OCIO_VERSION_HEX >= 0x02000000
622+
, m_cpuproc(p->getDefaultCPUProcessor())
623+
# endif
624+
{
625+
}
626+
virtual ~ColorProcessor_OCIO(void) {}
600627

601628
virtual bool isNoOp() const { return m_p->isNoOp(); }
602629
virtual bool hasChannelCrosstalk() const
@@ -607,13 +634,23 @@ class ColorProcessor_OCIO : public ColorProcessor {
607634
stride_t chanstride, stride_t xstride,
608635
stride_t ystride) const
609636
{
637+
# if OCIO_VERSION_HEX >= 0x02000000
638+
OCIO::PackedImageDesc pid(data, width, height, channels,
639+
OCIO::BIT_DEPTH_F32, // For now, only float
640+
chanstride, xstride, ystride);
641+
m_cpuproc->apply(pid);
642+
# else
610643
OCIO::PackedImageDesc pid(data, width, height, channels, chanstride,
611644
xstride, ystride);
612645
m_p->apply(pid);
646+
# endif
613647
}
614648

615649
private:
616650
OCIO::ConstProcessorRcPtr m_p;
651+
# if OCIO_VERSION_HEX >= 0x02000000
652+
OCIO::ConstCPUProcessorRcPtr m_cpuproc;
653+
# endif
617654
};
618655
#endif
619656

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
getNumColorSpaces = 14
2+
getColorSpaceNames = [u'linear', u'sRGB', u'sRGBf', u'rec709', u'Cineon', u'Gamma1.8', u'Gamma2.2', u'Panalog', u'REDLog', u'ViperLog', u'AlexaV3LogC', u'PLogLin', u'SLog', u'raw']
3+
getNumLooks = 0
4+
getLookNames = []
5+
getNumDisplays = 1
6+
getDisplayNames = [u'default']
7+
getDefaultDisplayName = default
8+
getNumViews = 1
9+
getViewNames = [u'sRGB']
10+
getDefaultViewName =
11+
12+
Done.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
getNumColorSpaces = 14
2+
getColorSpaceNames = ['linear', 'sRGB', 'sRGBf', 'rec709', 'Cineon', 'Gamma1.8', 'Gamma2.2', 'Panalog', 'REDLog', 'ViperLog', 'AlexaV3LogC', 'PLogLin', 'SLog', 'raw']
3+
getNumLooks = 0
4+
getLookNames = []
5+
getNumDisplays = 1
6+
getDisplayNames = ['default']
7+
getDefaultDisplayName = default
8+
getNumViews = 1
9+
getViewNames = ['sRGB']
10+
getDefaultViewName =
11+
12+
Done.

0 commit comments

Comments
 (0)